Changeset 740 for vendor/current/source3/libnet
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source3/libnet
- Files:
-
- 2 added
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/libnet/libnet_dssync.c
r414 r740 22 22 23 23 #include "includes.h" 24 #include "libnet/libnet.h" 24 #include "libnet/libnet_dssync.h" 25 #include "rpc_client/cli_pipe.h" 25 26 #include "../libcli/drsuapi/drsuapi.h" 26 #include "../librpc/gen_ndr/ cli_drsuapi.h"27 #include "../librpc/gen_ndr/ndr_drsuapi_c.h" 27 28 28 29 /**************************************************************** … … 31 32 static int libnet_dssync_free_context(struct dssync_context *ctx) 32 33 { 34 WERROR result; 35 struct dcerpc_binding_handle *b; 36 33 37 if (!ctx) { 34 38 return 0; … … 36 40 37 41 if (is_valid_policy_hnd(&ctx->bind_handle) && ctx->cli) { 38 rpccli_drsuapi_DsUnbind(ctx->cli, ctx, &ctx->bind_handle, NULL); 42 b = ctx->cli->binding_handle; 43 dcerpc_drsuapi_DsUnbind(b, ctx, &ctx->bind_handle, &result); 39 44 } 40 45 … … 125 130 struct drsuapi_DsBindInfoCtr bind_info; 126 131 struct drsuapi_DsBindInfo28 info28; 132 struct dcerpc_binding_handle *b = ctx->cli->binding_handle; 127 133 128 134 ZERO_STRUCT(info28); … … 165 171 bind_info.info.info28 = info28; 166 172 167 status = rpccli_drsuapi_DsBind(ctx->cli, mem_ctx,173 status = dcerpc_drsuapi_DsBind(b, mem_ctx, 168 174 &bind_guid, 169 175 &bind_info, … … 219 225 NTSTATUS status; 220 226 WERROR werr; 221 int32_t level = 1;227 uint32_t level = 1; 222 228 union drsuapi_DsNameRequest req; 223 int32_t level_out;229 uint32_t level_out; 224 230 struct drsuapi_DsNameString names[1]; 225 231 union drsuapi_DsNameCtr ctr; 232 struct dcerpc_binding_handle *b = ctx->cli->binding_handle; 226 233 227 234 names[0].str = talloc_asprintf(mem_ctx, "%s\\", ctx->domain_name); … … 236 243 req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; 237 244 238 status = rpccli_drsuapi_DsCrackNames(ctx->cli, mem_ctx,245 status = dcerpc_drsuapi_DsCrackNames(b, mem_ctx, 239 246 &ctx->bind_handle, 240 247 level, … … 246 253 ctx->error_message = talloc_asprintf(ctx, 247 254 "Failed to lookup DN for domain name: %s", 255 get_friendly_nt_error_msg(status)); 256 return status; 257 } 258 259 if (!W_ERROR_IS_OK(werr)) { 260 ctx->error_message = talloc_asprintf(ctx, 261 "Failed to lookup DN for domain name: %s", 248 262 get_friendly_werror_msg(werr)); 249 return status;250 }251 252 if (!W_ERROR_IS_OK(werr)) {253 263 return werror_to_ntstatus(werr); 254 264 } … … 301 311 const char *dn, 302 312 struct replUpToDateVectorBlob *utdv, 303 int32_t *plevel,313 uint32_t *plevel, 304 314 union drsuapi_DsGetNCChangesRequest *preq) 305 315 { 306 316 NTSTATUS status; 307 317 uint32_t count; 308 int32_t level;318 uint32_t level; 309 319 union drsuapi_DsGetNCChangesRequest req; 310 320 struct dom_sid null_sid; … … 313 323 struct drsuapi_DsReplicaCursorCtrEx *cursors = NULL; 314 324 315 uint32_t replica_flags = DRSUAPI_D S_REPLICA_NEIGHBOUR_WRITEABLE|316 DRSUAPI_D S_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP|317 DRSUAPI_D S_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS|318 DRSUAPI_D S_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS|319 DRSUAPI_D S_REPLICA_NEIGHBOUR_NEVER_SYNCED;325 uint32_t replica_flags = DRSUAPI_DRS_WRIT_REP | 326 DRSUAPI_DRS_INIT_SYNC | 327 DRSUAPI_DRS_PER_SYNC | 328 DRSUAPI_DRS_GET_ANC | 329 DRSUAPI_DRS_NEVER_SYNCED; 320 330 321 331 ZERO_STRUCT(null_sid); … … 416 426 static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx, 417 427 struct dssync_context *ctx, 418 int32_t level,428 uint32_t level, 419 429 union drsuapi_DsGetNCChangesRequest *req, 420 430 struct replUpToDateVectorBlob **pnew_utdv) … … 426 436 struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL; 427 437 struct replUpToDateVectorBlob *new_utdv = NULL; 428 int32_t level_out = 0;429 int32_t out_level = 0;438 uint32_t level_out = 0; 439 uint32_t out_level = 0; 430 440 int y; 431 441 bool last_query; 442 struct dcerpc_binding_handle *b = ctx->cli->binding_handle; 432 443 433 444 if (!ctx->single_object_replication) { … … 442 453 struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL; 443 454 struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL; 455 uint32_t linked_attributes_count = 0; 456 struct drsuapi_DsReplicaLinkedAttribute *linked_attributes = NULL; 444 457 445 458 if (level == 8) { … … 453 466 } 454 467 455 status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,468 status = dcerpc_drsuapi_DsGetNCChanges(b, mem_ctx, 456 469 &ctx->bind_handle, 457 470 level, … … 463 476 ctx->error_message = talloc_asprintf(ctx, 464 477 "Failed to get NC Changes: %s", 465 get_friendly_ werror_msg(werr));478 get_friendly_nt_error_msg(status)); 466 479 goto out; 467 480 } … … 469 482 if (!W_ERROR_IS_OK(werr)) { 470 483 status = werror_to_ntstatus(werr); 484 ctx->error_message = talloc_asprintf(ctx, 485 "Failed to get NC Changes: %s", 486 get_friendly_werror_msg(werr)); 471 487 goto out; 472 488 } … … 525 541 mapping_ctr = &ctr6->mapping_ctr; 526 542 543 linked_attributes = ctr6->linked_attributes; 544 linked_attributes_count = ctr6->linked_attributes_count; 545 527 546 if (ctr6->more_data) { 528 547 req->req8.highwatermark = ctr6->new_highwatermark; … … 564 583 } 565 584 } 585 586 if (linked_attributes_count == 0) { 587 continue; 588 } 589 590 if (ctx->ops->process_links) { 591 status = ctx->ops->process_links(ctx, mem_ctx, 592 linked_attributes_count, 593 linked_attributes, 594 mapping_ctr); 595 if (!NT_STATUS_IS_OK(status)) { 596 ctx->error_message = talloc_asprintf(ctx, 597 "Failed to call processing function: %s", 598 nt_errstr(status)); 599 goto out; 600 } 601 } 566 602 } 567 603 … … 577 613 NTSTATUS status; 578 614 579 int32_t level = 0;615 uint32_t level = 0; 580 616 union drsuapi_DsGetNCChangesRequest req; 581 617 struct replUpToDateVectorBlob *old_utdv = NULL; -
vendor/current/source3/libnet/libnet_dssync.h
r414 r740 19 19 */ 20 20 21 #include "../librpc/gen_ndr/drsuapi.h" 22 #include "../librpc/gen_ndr/drsblobs.h" 23 21 24 struct dssync_context; 22 25 … … 28 31 struct drsuapi_DsReplicaObjectListItemEx *objects, 29 32 struct drsuapi_DsReplicaOIDMapping_Ctr *mappings); 33 NTSTATUS (*process_links)(struct dssync_context *ctx, 34 TALLOC_CTX *mem_ctx, 35 uint32_t count, 36 struct drsuapi_DsReplicaLinkedAttribute *links, 37 struct drsuapi_DsReplicaOIDMapping_Ctr *mappings); 30 38 NTSTATUS (*finish)(struct dssync_context *ctx, TALLOC_CTX *mem_ctx, 31 39 struct replUpToDateVectorBlob *new_utdv); … … 56 64 57 65 extern const struct dssync_ops libnet_dssync_keytab_ops; 66 extern const struct dssync_ops libnet_dssync_passdb_ops; 67 68 /* The following definitions come from libnet/libnet_dssync.c */ 69 70 NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx, 71 struct dssync_context **ctx_p); 72 NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx, 73 struct dssync_context *ctx); -
vendor/current/source3/libnet/libnet_dssync_keytab.c
r414 r740 20 20 21 21 #include "includes.h" 22 #include "libnet/libnet.h" 22 #include "smb_krb5.h" 23 #include "ads.h" 24 #include "libnet/libnet_dssync.h" 25 #include "libnet/libnet_keytab.h" 23 26 #include "librpc/gen_ndr/ndr_drsblobs.h" 24 27 25 #if defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC)28 #if defined(HAVE_ADS) 26 29 27 30 static NTSTATUS keytab_startup(struct dssync_context *ctx, TALLOC_CTX *mem_ctx, … … 53 56 old_utdv = talloc(mem_ctx, struct replUpToDateVectorBlob); 54 57 55 ndr_err = ndr_pull_struct_blob(&entry->password, old_utdv, 56 NULL, old_utdv, 58 ndr_err = ndr_pull_struct_blob(&entry->password, old_utdv, old_utdv, 57 59 (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob); 58 60 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 92 94 } 93 95 94 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL,new_utdv,96 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, new_utdv, 95 97 (ndr_push_flags_fn_t)ndr_push_replUpToDateVectorBlob); 96 98 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 147 149 uint32_t j; 148 150 149 ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, NULL,&scb,151 ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, &scb, 150 152 (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob); 151 153 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 204 206 goto done; 205 207 } 206 ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, NULL,pkb,208 ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, pkb, 207 209 (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob); 208 210 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 272 274 attr = &cur->object.attribute_ctr.attributes[i]; 273 275 274 if (attr->attid == DRSUAPI_ATT RIBUTE_servicePrincipalName) {276 if (attr->attid == DRSUAPI_ATTID_servicePrincipalName) { 275 277 uint32_t count; 276 278 num_spns = attr->value_ctr.num_values; … … 296 298 297 299 switch (attr->attid) { 298 case DRSUAPI_ATT RIBUTE_unicodePwd:300 case DRSUAPI_ATTID_unicodePwd: 299 301 300 302 if (blob->length != 16) { … … 317 319 kvno = cur->meta_data_ctr->meta_data[i].version; 318 320 break; 319 case DRSUAPI_ATT RIBUTE_ntPwdHistory:321 case DRSUAPI_ATTID_ntPwdHistory: 320 322 pwd_history_len = blob->length / 16; 321 323 pwd_history = blob->data; 322 324 break; 323 case DRSUAPI_ATT RIBUTE_userPrincipalName:325 case DRSUAPI_ATTID_userPrincipalName: 324 326 pull_string_talloc(mem_ctx, NULL, 0, &upn, 325 327 blob->data, blob->length, 326 328 STR_UNICODE); 327 329 break; 328 case DRSUAPI_ATT RIBUTE_sAMAccountName:330 case DRSUAPI_ATTID_sAMAccountName: 329 331 pull_string_talloc(mem_ctx, NULL, 0, &name, 330 332 blob->data, blob->length, 331 333 STR_UNICODE); 332 334 break; 333 case DRSUAPI_ATT RIBUTE_sAMAccountType:335 case DRSUAPI_ATTID_sAMAccountType: 334 336 sam_type = IVAL(blob->data, 0); 335 337 break; 336 case DRSUAPI_ATT RIBUTE_userAccountControl:338 case DRSUAPI_ATTID_userAccountControl: 337 339 uacc = IVAL(blob->data, 0); 338 340 break; 339 case DRSUAPI_ATT RIBUTE_supplementalCredentials:341 case DRSUAPI_ATTID_supplementalCredentials: 340 342 status = parse_supplemental_credentials(mem_ctx, 341 343 blob, … … 600 602 return NT_STATUS_NOT_SUPPORTED; 601 603 } 602 #endif /* defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC)*/604 #endif /* defined(HAVE_ADS) */ 603 605 604 606 const struct dssync_ops libnet_dssync_keytab_ops = { -
vendor/current/source3/libnet/libnet_join.c
r597 r740 20 20 21 21 #include "includes.h" 22 #include "libnet/libnet.h" 22 #include "ads.h" 23 #include "librpc/gen_ndr/ndr_libnet_join.h" 24 #include "libnet/libnet_join.h" 23 25 #include "libcli/auth/libcli_auth.h" 24 #include "../librpc/gen_ndr/cli_samr.h" 25 #include "../librpc/gen_ndr/cli_lsa.h" 26 #include "../librpc/gen_ndr/ndr_samr_c.h" 27 #include "rpc_client/init_samr.h" 28 #include "../librpc/gen_ndr/ndr_lsa_c.h" 29 #include "rpc_client/cli_lsarpc.h" 30 #include "../librpc/gen_ndr/ndr_netlogon.h" 31 #include "rpc_client/cli_netlogon.h" 32 #include "lib/smbconf/smbconf.h" 33 #include "lib/smbconf/smbconf_reg.h" 34 #include "../libds/common/flags.h" 35 #include "secrets.h" 36 #include "rpc_client/init_lsa.h" 37 #include "rpc_client/cli_pipe.h" 38 #include "krb5_env.h" 39 #include "../libcli/security/security.h" 40 #include "passdb.h" 41 #include "libsmb/libsmb.h" 26 42 27 43 /**************************************************************** … … 90 106 } 91 107 92 #ifdef WITH_ADS108 #ifdef HAVE_ADS 93 109 94 110 /**************************************************************** … … 630 646 return ADS_SUCCESS; 631 647 } 632 #endif /* WITH_ADS */648 #endif /* HAVE_ADS */ 633 649 634 650 /**************************************************************** … … 685 701 pass, 686 702 flags, 687 Undefined , NULL);703 Undefined); 688 704 } 689 705 … … 698 714 struct rpc_pipe_client *pipe_hnd = NULL; 699 715 struct policy_handle lsa_pol; 700 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;716 NTSTATUS status, result; 701 717 union lsa_PolicyInformation *info = NULL; 718 struct dcerpc_binding_handle *b; 702 719 703 720 status = libnet_join_connect_dc_ipc(r->in.dc_name, … … 718 735 } 719 736 737 b = pipe_hnd->binding_handle; 738 720 739 status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, 721 740 SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol); … … 724 743 } 725 744 726 status = rpccli_lsa_QueryInfoPolicy2(pipe_hnd, mem_ctx,745 status = dcerpc_lsa_QueryInfoPolicy2(b, mem_ctx, 727 746 &lsa_pol, 728 747 LSA_POLICY_INFO_DNS, 729 &info); 730 if (NT_STATUS_IS_OK(status)) { 748 &info, 749 &result); 750 if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(result)) { 731 751 r->out.domain_is_ad = true; 732 752 r->out.netbios_domain_name = info->dns.name.string; 733 753 r->out.dns_domain_name = info->dns.dns_domain.string; 734 754 r->out.forest_name = info->dns.dns_forest.string; 735 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->dns.sid);755 r->out.domain_sid = dom_sid_dup(mem_ctx, info->dns.sid); 736 756 NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid); 737 757 } 738 758 739 759 if (!NT_STATUS_IS_OK(status)) { 740 status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,760 status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx, 741 761 &lsa_pol, 742 762 LSA_POLICY_INFO_ACCOUNT_DOMAIN, 743 &info); 763 &info, 764 &result); 744 765 if (!NT_STATUS_IS_OK(status)) { 745 766 goto done; 746 767 } 768 if (!NT_STATUS_IS_OK(result)) { 769 status = result; 770 goto done; 771 } 747 772 748 773 r->out.netbios_domain_name = info->account_domain.name.string; 749 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->account_domain.sid);774 r->out.domain_sid = dom_sid_dup(mem_ctx, info->account_domain.sid); 750 775 NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid); 751 776 } 752 777 753 rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);778 dcerpc_lsa_Close(b, mem_ctx, &lsa_pol, &result); 754 779 TALLOC_FREE(pipe_hnd); 755 780 … … 818 843 struct rpc_pipe_client *pipe_hnd = NULL; 819 844 struct policy_handle sam_pol, domain_pol, user_pol; 820 NTSTATUS status = NT_STATUS_UNSUCCESSFUL ;845 NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result; 821 846 char *acct_name; 822 847 struct lsa_String lsa_acct_name; … … 826 851 struct samr_Ids name_types; 827 852 union samr_UserInfo user_info; 853 struct dcerpc_binding_handle *b = NULL; 828 854 829 855 struct samr_CryptPassword crypt_pwd; … … 860 886 } 861 887 862 status = rpccli_samr_Connect2(pipe_hnd, mem_ctx, 888 b = pipe_hnd->binding_handle; 889 890 status = dcerpc_samr_Connect2(b, mem_ctx, 863 891 pipe_hnd->desthost, 864 892 SAMR_ACCESS_ENUM_DOMAINS 865 893 | SAMR_ACCESS_LOOKUP_DOMAIN, 866 &sam_pol); 867 if (!NT_STATUS_IS_OK(status)) { 868 goto done; 869 } 870 871 status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, 894 &sam_pol, 895 &result); 896 if (!NT_STATUS_IS_OK(status)) { 897 goto done; 898 } 899 if (!NT_STATUS_IS_OK(result)) { 900 status = result; 901 goto done; 902 } 903 904 status = dcerpc_samr_OpenDomain(b, mem_ctx, 872 905 &sam_pol, 873 906 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 … … 875 908 | SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, 876 909 r->out.domain_sid, 877 &domain_pol); 878 if (!NT_STATUS_IS_OK(status)) { 910 &domain_pol, 911 &result); 912 if (!NT_STATUS_IS_OK(status)) { 913 goto done; 914 } 915 if (!NT_STATUS_IS_OK(result)) { 916 status = result; 879 917 goto done; 880 918 } … … 899 937 access_desired)); 900 938 901 status = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,939 status = dcerpc_samr_CreateUser2(b, mem_ctx, 902 940 &domain_pol, 903 941 &lsa_acct_name, … … 906 944 &user_pol, 907 945 &access_granted, 908 &user_rid); 946 &user_rid, 947 &result); 948 if (!NT_STATUS_IS_OK(status)) { 949 goto done; 950 } 951 952 status = result; 909 953 if (!NT_STATUS_IS_OK(status) && 910 954 !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { … … 936 980 937 981 if (NT_STATUS_IS_OK(status)) { 938 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);939 } 940 } 941 942 status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,982 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 983 } 984 } 985 986 status = dcerpc_samr_LookupNames(b, mem_ctx, 943 987 &domain_pol, 944 988 1, 945 989 &lsa_acct_name, 946 990 &user_rids, 947 &name_types); 948 if (!NT_STATUS_IS_OK(status)) { 991 &name_types, 992 &result); 993 if (!NT_STATUS_IS_OK(status)) { 994 goto done; 995 } 996 if (!NT_STATUS_IS_OK(result)) { 997 status = result; 949 998 goto done; 950 999 } … … 961 1010 /* Open handle on user */ 962 1011 963 status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,1012 status = dcerpc_samr_OpenUser(b, mem_ctx, 964 1013 &domain_pol, 965 1014 SEC_FLAG_MAXIMUM_ALLOWED, 966 1015 user_rid, 967 &user_pol); 968 if (!NT_STATUS_IS_OK(status)) { 1016 &user_pol, 1017 &result); 1018 if (!NT_STATUS_IS_OK(status)) { 1019 goto done; 1020 } 1021 if (!NT_STATUS_IS_OK(result)) { 1022 status = result; 969 1023 goto done; 970 1024 } … … 973 1027 974 1028 acct_flags |= ACB_PWNOEXP; 975 if (r->out.domain_is_ad) {976 #if !defined(ENCTYPE_ARCFOUR_HMAC)977 acct_flags |= ACB_USE_DES_KEY_ONLY;978 #endif979 ;;980 }981 1029 982 1030 /* Set account flags on machine account */ … … 984 1032 user_info.info16.acct_flags = acct_flags; 985 1033 986 status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,1034 status = dcerpc_samr_SetUserInfo(b, mem_ctx, 987 1035 &user_pol, 988 1036 16, 989 &user_info );990 991 if (!NT_STATUS_IS_OK(status)) { 992 993 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,994 & user_pol);1037 &user_info, 1038 &result); 1039 if (!NT_STATUS_IS_OK(status)) { 1040 dcerpc_samr_DeleteUser(b, mem_ctx, 1041 &user_pol, 1042 &result); 995 1043 996 1044 libnet_join_set_error_string(mem_ctx, r, … … 1000 1048 } 1001 1049 1050 if (!NT_STATUS_IS_OK(result)) { 1051 status = result; 1052 1053 dcerpc_samr_DeleteUser(b, mem_ctx, 1054 &user_pol, 1055 &result); 1056 1057 libnet_join_set_error_string(mem_ctx, r, 1058 "Failed to set account flags for machine account (%s)\n", 1059 nt_errstr(status)); 1060 goto done; 1061 } 1062 1002 1063 /* Set password on machine account - first try level 26 */ 1003 1064 … … 1009 1070 user_info.info26.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON; 1010 1071 1011 status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,1072 status = dcerpc_samr_SetUserInfo2(b, mem_ctx, 1012 1073 &user_pol, 1013 1074 26, 1014 &user_info); 1015 1016 if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) { 1075 &user_info, 1076 &result); 1077 1078 if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) { 1017 1079 1018 1080 /* retry with level 24 */ … … 1025 1087 user_info.info24.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON; 1026 1088 1027 status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,1089 status = dcerpc_samr_SetUserInfo2(b, mem_ctx, 1028 1090 &user_pol, 1029 1091 24, 1030 &user_info); 1031 } 1032 1033 if (!NT_STATUS_IS_OK(status)) { 1034 1035 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx, 1036 &user_pol); 1092 &user_info, 1093 &result); 1094 } 1095 1096 if (!NT_STATUS_IS_OK(status)) { 1097 1098 dcerpc_samr_DeleteUser(b, mem_ctx, 1099 &user_pol, 1100 &result); 1037 1101 1038 1102 libnet_join_set_error_string(mem_ctx, r, … … 1041 1105 goto done; 1042 1106 } 1107 if (!NT_STATUS_IS_OK(result)) { 1108 status = result; 1109 1110 dcerpc_samr_DeleteUser(b, mem_ctx, 1111 &user_pol, 1112 &result); 1113 1114 libnet_join_set_error_string(mem_ctx, r, 1115 "Failed to set password for machine account (%s)\n", 1116 nt_errstr(status)); 1117 goto done; 1118 } 1043 1119 1044 1120 status = NT_STATUS_OK; … … 1050 1126 1051 1127 if (is_valid_policy_hnd(&sam_pol)) { 1052 rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);1128 dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result); 1053 1129 } 1054 1130 if (is_valid_policy_hnd(&domain_pol)) { 1055 rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);1131 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 1056 1132 } 1057 1133 if (is_valid_policy_hnd(&user_pol)) { 1058 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);1134 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1059 1135 } 1060 1136 TALLOC_FREE(pipe_hnd); … … 1105 1181 machine_password, 1106 1182 0, 1107 Undefined , NULL);1183 Undefined); 1108 1184 free(machine_account); 1109 1185 free(machine_password); … … 1118 1194 "", 1119 1195 0, 1120 Undefined , NULL);1196 Undefined); 1121 1197 } 1122 1198 … … 1210 1286 struct rpc_pipe_client *pipe_hnd = NULL; 1211 1287 struct policy_handle sam_pol, domain_pol, user_pol; 1212 NTSTATUS status = NT_STATUS_UNSUCCESSFUL ;1288 NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result; 1213 1289 char *acct_name; 1214 1290 uint32_t user_rid; … … 1217 1293 struct samr_Ids name_types; 1218 1294 union samr_UserInfo *info = NULL; 1295 struct dcerpc_binding_handle *b = NULL; 1219 1296 1220 1297 ZERO_STRUCT(sam_pol); … … 1241 1318 } 1242 1319 1243 status = rpccli_samr_Connect2(pipe_hnd, mem_ctx, 1320 b = pipe_hnd->binding_handle; 1321 1322 status = dcerpc_samr_Connect2(b, mem_ctx, 1244 1323 pipe_hnd->desthost, 1245 1324 SEC_FLAG_MAXIMUM_ALLOWED, 1246 &sam_pol); 1247 if (!NT_STATUS_IS_OK(status)) { 1248 goto done; 1249 } 1250 1251 status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, 1325 &sam_pol, 1326 &result); 1327 if (!NT_STATUS_IS_OK(status)) { 1328 goto done; 1329 } 1330 if (!NT_STATUS_IS_OK(result)) { 1331 status = result; 1332 goto done; 1333 } 1334 1335 status = dcerpc_samr_OpenDomain(b, mem_ctx, 1252 1336 &sam_pol, 1253 1337 SEC_FLAG_MAXIMUM_ALLOWED, 1254 1338 r->in.domain_sid, 1255 &domain_pol); 1256 if (!NT_STATUS_IS_OK(status)) { 1339 &domain_pol, 1340 &result); 1341 if (!NT_STATUS_IS_OK(status)) { 1342 goto done; 1343 } 1344 if (!NT_STATUS_IS_OK(result)) { 1345 status = result; 1257 1346 goto done; 1258 1347 } … … 1265 1354 init_lsa_String(&lsa_acct_name, acct_name); 1266 1355 1267 status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,1356 status = dcerpc_samr_LookupNames(b, mem_ctx, 1268 1357 &domain_pol, 1269 1358 1, 1270 1359 &lsa_acct_name, 1271 1360 &user_rids, 1272 &name_types); 1273 1274 if (!NT_STATUS_IS_OK(status)) { 1361 &name_types, 1362 &result); 1363 1364 if (!NT_STATUS_IS_OK(status)) { 1365 goto done; 1366 } 1367 if (!NT_STATUS_IS_OK(result)) { 1368 status = result; 1275 1369 goto done; 1276 1370 } … … 1287 1381 /* Open handle on user */ 1288 1382 1289 status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,1383 status = dcerpc_samr_OpenUser(b, mem_ctx, 1290 1384 &domain_pol, 1291 1385 SEC_FLAG_MAXIMUM_ALLOWED, 1292 1386 user_rid, 1293 &user_pol); 1294 if (!NT_STATUS_IS_OK(status)) { 1387 &user_pol, 1388 &result); 1389 if (!NT_STATUS_IS_OK(status)) { 1390 goto done; 1391 } 1392 if (!NT_STATUS_IS_OK(result)) { 1393 status = result; 1295 1394 goto done; 1296 1395 } … … 1298 1397 /* Get user info */ 1299 1398 1300 status = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,1399 status = dcerpc_samr_QueryUserInfo(b, mem_ctx, 1301 1400 &user_pol, 1302 1401 16, 1303 &info); 1304 if (!NT_STATUS_IS_OK(status)) { 1305 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); 1402 &info, 1403 &result); 1404 if (!NT_STATUS_IS_OK(status)) { 1405 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1406 goto done; 1407 } 1408 if (!NT_STATUS_IS_OK(result)) { 1409 status = result; 1410 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1306 1411 goto done; 1307 1412 } … … 1311 1416 info->info16.acct_flags |= ACB_DISABLED; 1312 1417 1313 status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,1418 status = dcerpc_samr_SetUserInfo(b, mem_ctx, 1314 1419 &user_pol, 1315 1420 16, 1316 info); 1317 1318 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); 1421 info, 1422 &result); 1423 if (!NT_STATUS_IS_OK(status)) { 1424 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1425 goto done; 1426 } 1427 if (!NT_STATUS_IS_OK(result)) { 1428 status = result; 1429 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1430 goto done; 1431 } 1432 status = result; 1433 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1319 1434 1320 1435 done: 1321 if (pipe_hnd ) {1436 if (pipe_hnd && b) { 1322 1437 if (is_valid_policy_hnd(&domain_pol)) { 1323 rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);1438 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 1324 1439 } 1325 1440 if (is_valid_policy_hnd(&sam_pol)) { 1326 rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);1441 dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result); 1327 1442 } 1328 1443 TALLOC_FREE(pipe_hnd); … … 1341 1456 static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) 1342 1457 { 1343 WERROR werr; 1458 WERROR werr = WERR_OK; 1459 sbcErr err; 1344 1460 struct smbconf_ctx *ctx; 1345 1461 1346 werr = smbconf_init_reg(r, &ctx, NULL); 1347 if (!W_ERROR_IS_OK(werr)) { 1462 err = smbconf_init_reg(r, &ctx, NULL); 1463 if (!SBC_ERROR_IS_OK(err)) { 1464 werr = WERR_NO_SUCH_SERVICE; 1348 1465 goto done; 1349 1466 } … … 1351 1468 if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { 1352 1469 1353 werr = smbconf_set_global_parameter(ctx, "security", "user"); 1354 W_ERROR_NOT_OK_GOTO_DONE(werr); 1355 1356 werr = smbconf_set_global_parameter(ctx, "workgroup", 1357 r->in.domain_name); 1470 err = smbconf_set_global_parameter(ctx, "security", "user"); 1471 if (!SBC_ERROR_IS_OK(err)) { 1472 werr = WERR_NO_SUCH_SERVICE; 1473 goto done; 1474 } 1475 1476 err = smbconf_set_global_parameter(ctx, "workgroup", 1477 r->in.domain_name); 1478 if (!SBC_ERROR_IS_OK(err)) { 1479 werr = WERR_NO_SUCH_SERVICE; 1480 goto done; 1481 } 1358 1482 1359 1483 smbconf_delete_global_parameter(ctx, "realm"); … … 1361 1485 } 1362 1486 1363 werr = smbconf_set_global_parameter(ctx, "security", "domain"); 1364 W_ERROR_NOT_OK_GOTO_DONE(werr); 1365 1366 werr = smbconf_set_global_parameter(ctx, "workgroup", 1367 r->out.netbios_domain_name); 1368 W_ERROR_NOT_OK_GOTO_DONE(werr); 1487 err = smbconf_set_global_parameter(ctx, "security", "domain"); 1488 if (!SBC_ERROR_IS_OK(err)) { 1489 werr = WERR_NO_SUCH_SERVICE; 1490 goto done; 1491 } 1492 1493 err = smbconf_set_global_parameter(ctx, "workgroup", 1494 r->out.netbios_domain_name); 1495 if (!SBC_ERROR_IS_OK(err)) { 1496 werr = WERR_NO_SUCH_SERVICE; 1497 goto done; 1498 } 1369 1499 1370 1500 if (r->out.domain_is_ad) { 1371 werr = smbconf_set_global_parameter(ctx, "security", "ads"); 1372 W_ERROR_NOT_OK_GOTO_DONE(werr); 1373 1374 werr = smbconf_set_global_parameter(ctx, "realm", 1375 r->out.dns_domain_name); 1376 W_ERROR_NOT_OK_GOTO_DONE(werr); 1501 err = smbconf_set_global_parameter(ctx, "security", "ads"); 1502 if (!SBC_ERROR_IS_OK(err)) { 1503 werr = WERR_NO_SUCH_SERVICE; 1504 goto done; 1505 } 1506 1507 err = smbconf_set_global_parameter(ctx, "realm", 1508 r->out.dns_domain_name); 1509 if (!SBC_ERROR_IS_OK(err)) { 1510 werr = WERR_NO_SUCH_SERVICE; 1511 goto done; 1512 } 1377 1513 } 1378 1514 … … 1388 1524 { 1389 1525 WERROR werr = WERR_OK; 1526 sbcErr err; 1390 1527 struct smbconf_ctx *ctx; 1391 1528 1392 werr = smbconf_init_reg(r, &ctx, NULL); 1393 if (!W_ERROR_IS_OK(werr)) { 1529 err = smbconf_init_reg(r, &ctx, NULL); 1530 if (!SBC_ERROR_IS_OK(err)) { 1531 werr = WERR_NO_SUCH_SERVICE; 1394 1532 goto done; 1395 1533 } … … 1397 1535 if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { 1398 1536 1399 werr = smbconf_set_global_parameter(ctx, "security", "user"); 1400 W_ERROR_NOT_OK_GOTO_DONE(werr); 1401 1402 werr = smbconf_delete_global_parameter(ctx, "workgroup"); 1403 W_ERROR_NOT_OK_GOTO_DONE(werr); 1537 err = smbconf_set_global_parameter(ctx, "security", "user"); 1538 if (!SBC_ERROR_IS_OK(err)) { 1539 werr = WERR_NO_SUCH_SERVICE; 1540 goto done; 1541 } 1542 1543 err = smbconf_delete_global_parameter(ctx, "workgroup"); 1544 if (!SBC_ERROR_IS_OK(err)) { 1545 werr = WERR_NO_SUCH_SERVICE; 1546 goto done; 1547 } 1404 1548 1405 1549 smbconf_delete_global_parameter(ctx, "realm"); … … 1599 1743 } 1600 1744 1601 #ifdef WITH_ADS1745 #ifdef HAVE_ADS 1602 1746 if (r->out.domain_is_ad && 1603 1747 !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) { … … 1609 1753 } 1610 1754 } 1611 #endif /* WITH_ADS */1755 #endif /* HAVE_ADS */ 1612 1756 1613 1757 libnet_join_add_dom_rids_to_builtins(r->out.domain_sid); … … 1817 1961 WERROR werr; 1818 1962 struct cli_state *cli = NULL; 1819 #ifdef WITH_ADS1963 #ifdef HAVE_ADS 1820 1964 ADS_STATUS ads_status; 1821 #endif /* WITH_ADS */1965 #endif /* HAVE_ADS */ 1822 1966 1823 1967 if (!r->in.dc_name) { … … 1860 2004 } 1861 2005 1862 #ifdef WITH_ADS 2006 #ifdef HAVE_ADS 2007 2008 create_local_private_krb5_conf_for_domain( 2009 r->out.dns_domain_name, r->out.netbios_domain_name, 2010 NULL, &cli->dest_ss, cli->desthost); 2011 1863 2012 if (r->out.domain_is_ad && r->in.account_ou && 1864 2013 !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) { … … 1880 2029 r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; 1881 2030 } 1882 #endif /* WITH_ADS */2031 #endif /* HAVE_ADS */ 1883 2032 1884 2033 if ((r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE) && … … 1955 2104 } 1956 2105 2106 ZERO_STRUCT(r->out); 2107 1957 2108 werr = libnet_join_pre_processing(mem_ctx, r); 1958 2109 if (!W_ERROR_IS_OK(werr)) { … … 2003 2154 return WERR_SETUP_NOT_JOINED; 2004 2155 } 2005 r->in.domain_sid = sid_dup_talloc(mem_ctx, &sid);2156 r->in.domain_sid = dom_sid_dup(mem_ctx, &sid); 2006 2157 W_ERROR_HAVE_NO_MEMORY(r->in.domain_sid); 2007 2158 } … … 2038 2189 } 2039 2190 2040 #ifdef WITH_ADS2191 #ifdef HAVE_ADS 2041 2192 /* for net ads leave, try to delete the account. If it works, 2042 2193 no sense in disabling. If it fails, we can still try to 2043 2194 disable it. jmcd */ 2044 2195 2045 2196 if (r->in.delete_machine_account) { 2046 2197 ADS_STATUS ads_status; … … 2065 2216 } 2066 2217 } 2067 #endif /* WITH_ADS */2218 #endif /* HAVE_ADS */ 2068 2219 2069 2220 /* The WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag really means … … 2080 2231 return ntstatus_to_werror(status); 2081 2232 } 2082 2233 2083 2234 r->out.disabled_machine_account = true; 2084 2235 } -
vendor/current/source3/libnet/libnet_keytab.c
r414 r740 21 21 22 22 #include "includes.h" 23 #include "libnet/libnet.h" 23 #include "smb_krb5.h" 24 #include "ads.h" 25 #include "libnet/libnet_keytab.h" 24 26 25 27 #ifdef HAVE_KRB5 -
vendor/current/source3/libnet/libnet_keytab.h
r414 r740 40 40 }; 41 41 42 /* The following definitions come from libnet/libnet_keytab.c */ 43 44 krb5_error_code libnet_keytab_init(TALLOC_CTX *mem_ctx, 45 const char *keytab_name, 46 struct libnet_keytab_context **ctx); 47 krb5_error_code libnet_keytab_add(struct libnet_keytab_context *ctx); 48 49 struct libnet_keytab_entry *libnet_keytab_search(struct libnet_keytab_context *ctx, 50 const char *principal, int kvno, 51 const krb5_enctype enctype, 52 TALLOC_CTX *mem_ctx); 53 NTSTATUS libnet_keytab_add_to_keytab_entries(TALLOC_CTX *mem_ctx, 54 struct libnet_keytab_context *ctx, 55 uint32_t kvno, 56 const char *name, 57 const char *prefix, 58 const krb5_enctype enctype, 59 DATA_BLOB blob); 42 60 #endif /* HAVE_KRB5 */ -
vendor/current/source3/libnet/libnet_samsync.c
r414 r740 23 23 24 24 #include "includes.h" 25 #include "libnet/libnet.h" 26 #include "../lib/crypto/crypto.h" 25 #include "libnet/libnet_samsync.h" 27 26 #include "../libcli/samsync/samsync.h" 28 27 #include "../libcli/auth/libcli_auth.h" 29 #include "../librpc/gen_ndr/cli_netlogon.h" 28 #include "rpc_client/rpc_client.h" 29 #include "../librpc/gen_ndr/ndr_netlogon.h" 30 #include "../librpc/gen_ndr/ndr_netlogon_c.h" 31 #include "../libcli/security/security.h" 32 #include "messages.h" 30 33 31 34 /** … … 72 75 73 76 if (domain_sid) { 74 ctx->domain_sid = sid_dup_talloc(mem_ctx, domain_sid);77 ctx->domain_sid = dom_sid_dup(mem_ctx, domain_sid); 75 78 NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid); 76 79 … … 78 81 NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid_str); 79 82 } 83 84 ctx->msg_ctx = messaging_init(ctx, procid_self(), 85 event_context_init(ctx)); 86 NT_STATUS_HAVE_NO_MEMORY(ctx->msg_ctx); 80 87 81 88 *ctx_p = ctx; … … 194 201 struct netr_ChangeLogEntry *e) 195 202 { 196 NTSTATUS result ;203 NTSTATUS result, status; 197 204 NTSTATUS callback_status; 198 205 const char *logon_server = ctx->cli->desthost; … … 202 209 uint16_t restart_state = 0; 203 210 uint32_t sync_context = 0; 211 struct dcerpc_binding_handle *b = ctx->cli->binding_handle; 204 212 205 213 ZERO_STRUCT(return_authenticator); … … 212 220 if (ctx->single_object_replication && 213 221 !ctx->force_full_replication) { 214 result = rpccli_netr_DatabaseRedo(ctx->cli, mem_ctx,222 status = dcerpc_netr_DatabaseRedo(b, mem_ctx, 215 223 logon_server, 216 224 computername, … … 219 227 *e, 220 228 0, 221 &delta_enum_array); 229 &delta_enum_array, 230 &result); 222 231 } else if (!ctx->force_full_replication && 223 232 sequence_num && (*sequence_num > 0)) { 224 result = rpccli_netr_DatabaseDeltas(ctx->cli, mem_ctx,233 status = dcerpc_netr_DatabaseDeltas(b, mem_ctx, 225 234 logon_server, 226 235 computername, … … 230 239 sequence_num, 231 240 &delta_enum_array, 232 0xffff); 241 0xffff, 242 &result); 233 243 } else { 234 result = rpccli_netr_DatabaseSync2(ctx->cli, mem_ctx,244 status = dcerpc_netr_DatabaseSync2(b, mem_ctx, 235 245 logon_server, 236 246 computername, … … 241 251 &sync_context, 242 252 &delta_enum_array, 243 0xffff); 244 } 245 246 if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) { 247 return result; 253 0xffff, 254 &result); 255 } 256 257 if (!NT_STATUS_IS_OK(status)) { 258 return status; 248 259 } 249 260 … … 253 264 DEBUG(0,("credentials chain check failed\n")); 254 265 return NT_STATUS_ACCESS_DENIED; 266 } 267 268 if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) { 269 return result; 255 270 } 256 271 … … 397 412 blob = data_blob_const(r->array, r->length); 398 413 399 ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL,str,414 ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, str, 400 415 (ndr_pull_flags_fn_t)ndr_pull_netr_AcctLockStr); 401 416 -
vendor/current/source3/libnet/libnet_samsync.h
r414 r740 18 18 */ 19 19 20 #include "../librpc/gen_ndr/netlogon.h" 20 21 21 22 enum net_samsync_mode { … … 75 76 76 77 struct rpc_pipe_client *cli; 78 struct messaging_context *msg_ctx; 77 79 78 80 const struct samsync_ops *ops; … … 85 87 extern const struct samsync_ops libnet_samsync_display_ops; 86 88 extern const struct samsync_ops libnet_samsync_passdb_ops; 89 90 /* The following definitions come from libnet/libnet_samsync.c */ 91 92 NTSTATUS libnet_samsync_init_context(TALLOC_CTX *mem_ctx, 93 const struct dom_sid *domain_sid, 94 struct samsync_context **ctx_p); 95 NTSTATUS libnet_samsync(enum netr_SamDatabaseID database_id, 96 struct samsync_context *ctx); 97 NTSTATUS pull_netr_AcctLockStr(TALLOC_CTX *mem_ctx, 98 struct lsa_BinaryString *r, 99 struct netr_AcctLockStr **str_p); -
vendor/current/source3/libnet/libnet_samsync_display.c
r414 r740 25 25 26 26 #include "includes.h" 27 #include "libnet/libnet.h" 27 #include "libnet/libnet_samsync.h" 28 #include "passdb.h" 28 29 29 30 static void display_group_mem_info(uint32_t rid, … … 207 208 break; 208 209 case NETR_DELTA_POLICY: 209 printf("Policy\n"); 210 printf("Policy: %s\n", 211 sid_string_dbg(id.sid)); 210 212 break; 211 213 case NETR_DELTA_TRUSTED_DOMAIN: … … 214 216 break; 215 217 case NETR_DELTA_DELETE_TRUST: 216 printf("Delete Trust: % d\n",217 u.delete_trust.unknown);218 printf("Delete Trust: %s\n", 219 sid_string_dbg(id.sid)); 218 220 break; 219 221 case NETR_DELTA_ACCOUNT: 220 printf("Account\n"); 222 printf("Account: %s\n", 223 sid_string_dbg(id.sid)); 221 224 break; 222 225 case NETR_DELTA_DELETE_ACCOUNT: 223 printf("Delete Account: % d\n",224 u.delete_account.unknown);226 printf("Delete Account: %s\n", 227 sid_string_dbg(id.sid)); 225 228 break; 226 229 case NETR_DELTA_SECRET: 227 printf("Secret\n"); 230 printf("Secret: %s\n", 231 id.name); 228 232 break; 229 233 case NETR_DELTA_DELETE_SECRET: 230 printf("Delete Secret: % d\n",231 u.delete_secret.unknown);234 printf("Delete Secret: %s\n", 235 id.name); 232 236 break; 233 237 case NETR_DELTA_DELETE_GROUP2: -
vendor/current/source3/libnet/libnet_samsync_keytab.c
r414 r740 20 20 21 21 #include "includes.h" 22 #include "libnet/libnet.h" 23 24 #if defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC) 22 #include "smb_krb5.h" 23 #include "ads.h" 24 #include "libnet/libnet_keytab.h" 25 #include "libnet/libnet_samsync.h" 26 #include "krb5_env.h" 27 28 #if defined(HAVE_ADS) 25 29 26 30 /**************************************************************** … … 29 33 static NTSTATUS keytab_ad_connect(TALLOC_CTX *mem_ctx, 30 34 const char *domain_name, 35 const char *dc, 31 36 const char *username, 32 37 const char *password, 33 38 struct libnet_keytab_context *ctx) 34 39 { 35 NTSTATUS status;36 40 ADS_STATUS ad_status; 37 41 ADS_STRUCT *ads; 38 struct netr_DsRGetDCNameInfo *info = NULL;39 const char *dc;40 41 status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, NULL, 0, &info);42 if (!NT_STATUS_IS_OK(status)) {43 return status;44 }45 46 dc = strip_hostname(info->dc_unc);47 42 48 43 ads = ads_init(NULL, domain_name, dc); … … 116 111 uint64_t old_sequence_num = 0; 117 112 const char *principal = NULL; 113 struct netr_DsRGetDCNameInfo *info = NULL; 114 const char *dc; 118 115 119 116 ret = libnet_keytab_init(mem_ctx, ctx->output_filename, &keytab_ctx); … … 122 119 } 123 120 121 status = dsgetdcname(mem_ctx, ctx->msg_ctx, 122 ctx->domain_name, NULL, NULL, 0, &info); 123 if (!NT_STATUS_IS_OK(status)) { 124 return status; 125 } 126 127 dc = strip_hostname(info->dc_unc); 128 124 129 keytab_ctx->clean_old_entries = ctx->clean_old_entries; 125 130 ctx->private_data = keytab_ctx; … … 127 132 status = keytab_ad_connect(mem_ctx, 128 133 ctx->domain_name, 134 dc, 129 135 ctx->username, 130 136 ctx->password, … … 294 300 } 295 301 296 #endif /* defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC)*/302 #endif /* defined(HAVE_ADS) */ 297 303 298 304 const struct samsync_ops libnet_samsync_keytab_ops = { -
vendor/current/source3/libnet/libnet_samsync_ldif.c
r478 r740 26 26 #include "includes.h" 27 27 #include "libnet/libnet_samsync.h" 28 #include "smbldap.h" 29 #include "transfer_file.h" 30 #include "passdb.h" 28 31 29 32 #ifdef HAVE_LDAP … … 84 87 len = strlen(suffix); 85 88 suffix_attr = (char*)SMB_MALLOC(len+1); 89 if (!suffix_attr) { 90 return NT_STATUS_NO_MEMORY; 91 } 86 92 memcpy(suffix_attr, suffix, len); 87 93 suffix_attr[len] = '\0'; -
vendor/current/source3/libnet/libnet_samsync_passdb.c
r414 r740 25 25 26 26 #include "includes.h" 27 #include "libnet/libnet.h" 27 #include "system/passwd.h" 28 #include "libnet/libnet_samsync.h" 29 #include "../libcli/security/security.h" 30 #include "passdb.h" 28 31 29 32 /* Convert a struct samu_DELTA to a struct samu. */ … … 179 182 pdb_sethexhours(newstr, r->logon_hours.bits); 180 183 if (!strequal(oldstr, newstr)) 181 pdb_set_hours(account, r->logon_hours.bits, PDB_CHANGED); 184 pdb_set_hours(account, r->logon_hours.bits, 185 pdb_get_hours_len(account), PDB_CHANGED); 182 186 } 183 187 … … 300 304 GROUP_MAP map; 301 305 struct group *grp; 302 DOM_SIDuser_sid;303 DOM_SIDgroup_sid;306 struct dom_sid user_sid; 307 struct dom_sid group_sid; 304 308 struct passwd *passwd = NULL; 305 309 fstring sid_string; … … 319 323 } 320 324 321 sid_copy(&user_sid, get_global_sam_sid()); 322 sid_append_rid(&user_sid, r->rid); 325 sid_compose(&user_sid, get_global_sam_sid(), r->rid); 323 326 324 327 DEBUG(3, ("Attempting to find SID %s for user %s in the passdb\n", … … 387 390 fstring comment; 388 391 struct group *grp = NULL; 389 DOM_SIDgroup_sid;392 struct dom_sid group_sid; 390 393 fstring sid_string; 391 394 GROUP_MAP map; … … 396 399 397 400 /* add the group to the mapping table */ 398 sid_copy(&group_sid, get_global_sam_sid()); 399 sid_append_rid(&group_sid, rid); 401 sid_compose(&group_sid, get_global_sam_sid(), rid); 400 402 sid_to_fstring(sid_string, &group_sid); 401 403 … … 452 454 char **nt_members = NULL; 453 455 char **unix_members; 454 DOM_SIDgroup_sid;456 struct dom_sid group_sid; 455 457 GROUP_MAP map; 456 458 struct group *grp; … … 460 462 } 461 463 462 sid_copy(&group_sid, get_global_sam_sid()); 463 sid_append_rid(&group_sid, rid); 464 sid_compose(&group_sid, get_global_sam_sid(), rid); 464 465 465 466 if (!get_domain_group_from_sid(group_sid, &map)) { … … 486 487 for (i=0; i < r->num_rids; i++) { 487 488 struct samu *member = NULL; 488 DOM_SIDmember_sid;489 struct dom_sid member_sid; 489 490 490 491 if ( !(member = samu_new(mem_ctx)) ) { … … 492 493 } 493 494 494 sid_copy(&member_sid, get_global_sam_sid()); 495 sid_append_rid(&member_sid, r->rids[i]); 495 sid_compose(&member_sid, get_global_sam_sid(), r->rids[i]); 496 496 497 497 if (!pdb_getsampwsid(member, &member_sid)) { … … 574 574 uint32_t rid, 575 575 struct netr_DELTA_ALIAS *r, 576 const DOM_SID*dom_sid)576 const struct dom_sid *dom_sid) 577 577 { 578 578 fstring name; 579 579 fstring comment; 580 580 struct group *grp = NULL; 581 DOM_SIDalias_sid;581 struct dom_sid alias_sid; 582 582 fstring sid_string; 583 583 GROUP_MAP map; … … 588 588 589 589 /* Find out whether the group is already mapped */ 590 sid_copy(&alias_sid, dom_sid); 591 sid_append_rid(&alias_sid, rid); 590 sid_compose(&alias_sid, dom_sid, rid); 592 591 sid_to_fstring(sid_string, &alias_sid); 593 592 … … 614 613 map.sid = alias_sid; 615 614 616 if ( sid_equal(dom_sid, &global_sid_Builtin))615 if (dom_sid_equal(dom_sid, &global_sid_Builtin)) 617 616 map.sid_name_use = SID_NAME_WKN_GRP; 618 617 else … … 636 635 uint32_t rid, 637 636 struct netr_DELTA_ALIAS_MEMBER *r, 638 const DOM_SID*dom_sid)637 const struct dom_sid *dom_sid) 639 638 { 640 639 return NT_STATUS_OK;
Note:
See TracChangeset
for help on using the changeset viewer.