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
-
libnet.h (deleted)
-
libnet_dssync.c (modified) (19 diffs)
-
libnet_dssync.h (modified) (3 diffs)
-
libnet_dssync_keytab.c (modified) (9 diffs)
-
libnet_dssync_passdb.c (added)
-
libnet_join.c (modified) (46 diffs)
-
libnet_join.h (added)
-
libnet_keytab.c (modified) (1 diff)
-
libnet_keytab.h (modified) (1 diff)
-
libnet_proto.h (deleted)
-
libnet_samsync.c (modified) (11 diffs)
-
libnet_samsync.h (modified) (3 diffs)
-
libnet_samsync_display.c (modified) (3 diffs)
-
libnet_samsync_keytab.c (modified) (6 diffs)
-
libnet_samsync_ldif.c (modified) (2 diffs)
-
libnet_samsync_passdb.c (modified) (14 diffs)
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/.h" 27 28 28 29 /**************************************************************** … … 31 32 static int libnet_dssync_free_context(struct dssync_context *ctx) 32 33 { 34 35 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 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 = , mem_ctx, 168 174 &bind_guid, 169 175 &bind_info, … … 219 225 NTSTATUS status; 220 226 WERROR werr; 221 int32_t level = 1;227 int32_t level = 1; 222 228 union drsuapi_DsNameRequest req; 223 int32_t level_out;229 int32_t level_out; 224 230 struct drsuapi_DsNameString names[1]; 225 231 union drsuapi_DsNameCtr ctr; 232 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 = , 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 256 257 258 259 260 261 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 int32_t *plevel, 304 314 union drsuapi_DsGetNCChangesRequest *preq) 305 315 { 306 316 NTSTATUS status; 307 317 uint32_t count; 308 int32_t level;318 int32_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_D | 326 DRSUAPI_D | 327 DRSUAPI_D | 328 DRSUAPI_D | 329 DRSUAPI_D_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 int32_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 int32_t level_out = 0; 439 int32_t out_level = 0; 430 440 int y; 431 441 bool last_query; 442 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 456 444 457 445 458 if (level == 8) { … … 453 466 } 454 467 455 status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,468 status = , 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_)); 466 479 goto out; 467 480 } … … 469 482 if (!W_ERROR_IS_OK(werr)) { 470 483 status = werror_to_ntstatus(werr); 484 485 486 471 487 goto out; 472 488 } … … 525 541 mapping_ctr = &ctr6->mapping_ctr; 526 542 543 544 545 527 546 if (ctr6->more_data) { 528 547 req->req8.highwatermark = ctr6->new_highwatermark; … … 564 583 } 565 584 } 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 566 602 } 567 603 … … 577 613 NTSTATUS status; 578 614 579 int32_t level = 0;615 int32_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 22 23 21 24 struct dssync_context; 22 25 … … 28 31 struct drsuapi_DsReplicaObjectListItemEx *objects, 29 32 struct drsuapi_DsReplicaOIDMapping_Ctr *mappings); 33 34 35 36 37 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 67 68 69 70 71 72 73 -
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_ATT_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_ATT_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_ATT_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_ATT_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_ATT_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_ATT_sAMAccountType: 334 336 sam_type = IVAL(blob->data, 0); 335 337 break; 336 case DRSUAPI_ATT RIBUTE_userAccountControl:338 case DRSUAPI_ATT_userAccountControl: 337 339 uacc = IVAL(blob->data, 0); 338 340 break; 339 case DRSUAPI_ATT RIBUTE_supplementalCredentials:341 case DRSUAPI_ATT_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 _ADS 93 109 94 110 /**************************************************************** … … 630 646 return ADS_SUCCESS; 631 647 } 632 #endif /* WITH_ADS */648 #endif /* _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; 701 717 union lsa_PolicyInformation *info = NULL; 718 702 719 703 720 status = libnet_join_connect_dc_ipc(r->in.dc_name, … … 718 735 } 719 736 737 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 = , 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 = (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 = , 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 769 770 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 = (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 ); 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; 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 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 = , 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 ); 983 } 984 } 985 986 status = , 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 = , 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 }
