r24557: rename 'dcerpc_table_' -> 'ndr_table_'
[ira/wip.git] / source / torture / rpc / testjoin.c
1 /* 
2    Unix SMB/CIFS implementation.
3
4    utility code to join/leave a domain
5
6    Copyright (C) Andrew Tridgell 2004
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 /*
23   this code is used by other torture modules to join/leave a domain
24   as either a member, bdc or thru a trust relationship
25 */
26
27 #include "includes.h"
28 #include "torture/torture.h"
29 #include "system/time.h"
30 #include "lib/crypto/crypto.h"
31 #include "libnet/libnet.h"
32 #include "lib/cmdline/popt_common.h"
33 #include "lib/ldb/include/ldb.h"
34 #include "librpc/gen_ndr/ndr_samr_c.h"
35
36 #include "libcli/auth/libcli_auth.h"
37 #include "torture/rpc/rpc.h"
38 #include "libcli/security/security.h"
39
40 struct test_join {
41         struct dcerpc_pipe *p;
42         struct policy_handle user_handle;
43         struct libnet_JoinDomain *libnet_r;
44         struct dom_sid *dom_sid;
45         const char *dom_netbios_name;
46         const char *dom_dns_name;
47         struct dom_sid *user_sid;
48         struct GUID user_guid;
49         const char *netbios_name;
50 };
51
52
53 static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
54                                   struct policy_handle *handle, const char *name)
55 {
56         NTSTATUS status;
57         struct samr_DeleteUser d;
58         struct policy_handle user_handle;
59         uint32_t rid;
60         struct samr_LookupNames n;
61         struct lsa_String sname;
62         struct samr_OpenUser r;
63
64         sname.string = name;
65
66         n.in.domain_handle = handle;
67         n.in.num_names = 1;
68         n.in.names = &sname;
69
70         status = dcerpc_samr_LookupNames(p, mem_ctx, &n);
71         if (NT_STATUS_IS_OK(status)) {
72                 rid = n.out.rids.ids[0];
73         } else {
74                 return status;
75         }
76
77         r.in.domain_handle = handle;
78         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
79         r.in.rid = rid;
80         r.out.user_handle = &user_handle;
81
82         status = dcerpc_samr_OpenUser(p, mem_ctx, &r);
83         if (!NT_STATUS_IS_OK(status)) {
84                 printf("OpenUser(%s) failed - %s\n", name, nt_errstr(status));
85                 return status;
86         }
87
88         d.in.user_handle = &user_handle;
89         d.out.user_handle = &user_handle;
90         status = dcerpc_samr_DeleteUser(p, mem_ctx, &d);
91         if (!NT_STATUS_IS_OK(status)) {
92                 return status;
93         }
94
95         return NT_STATUS_OK;
96 }
97
98 /*
99   create a test user in the domain
100   an opaque pointer is returned. Pass it to torture_leave_domain() 
101   when finished
102 */
103
104 struct test_join *torture_create_testuser(const char *username, 
105                                           const char *domain,
106                                           uint16_t acct_type,
107                                           const char **random_password)
108 {
109         NTSTATUS status;
110         struct samr_Connect c;
111         struct samr_CreateUser2 r;
112         struct samr_OpenDomain o;
113         struct samr_LookupDomain l;
114         struct samr_GetUserPwInfo pwp;
115         struct samr_SetUserInfo s;
116         union samr_UserInfo u;
117         struct policy_handle handle;
118         struct policy_handle domain_handle;
119         uint32_t access_granted;
120         uint32_t rid;
121         DATA_BLOB session_key;
122         struct lsa_String name;
123         
124         int policy_min_pw_len = 0;
125         struct test_join *join;
126         char *random_pw;
127         const char *dc_binding = lp_parm_string(-1, "torture", "dc_binding");
128
129         join = talloc(NULL, struct test_join);
130         if (join == NULL) {
131                 return NULL;
132         }
133
134         ZERO_STRUCTP(join);
135
136         printf("Connecting to SAMR\n");
137         
138         if (dc_binding) {
139                 status = dcerpc_pipe_connect(join,
140                                              &join->p,
141                                              dc_binding,
142                                              &ndr_table_samr,
143                                              cmdline_credentials, NULL);
144                                              
145         } else {
146                 status = torture_rpc_connection(join, 
147                                                 &join->p, 
148                                                 &ndr_table_samr);
149         }
150         if (!NT_STATUS_IS_OK(status)) {
151                 return NULL;
152         }
153
154         c.in.system_name = NULL;
155         c.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
156         c.out.connect_handle = &handle;
157
158         status = dcerpc_samr_Connect(join->p, join, &c);
159         if (!NT_STATUS_IS_OK(status)) {
160                 const char *errstr = nt_errstr(status);
161                 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
162                         errstr = dcerpc_errstr(join, join->p->last_fault_code);
163                 }
164                 printf("samr_Connect failed - %s\n", errstr);
165                 return NULL;
166         }
167
168         printf("Opening domain %s\n", domain);
169
170         name.string = domain;
171         l.in.connect_handle = &handle;
172         l.in.domain_name = &name;
173
174         status = dcerpc_samr_LookupDomain(join->p, join, &l);
175         if (!NT_STATUS_IS_OK(status)) {
176                 printf("LookupDomain failed - %s\n", nt_errstr(status));
177                 goto failed;
178         }
179
180         talloc_steal(join, l.out.sid);
181         join->dom_sid = l.out.sid;
182         join->dom_netbios_name = talloc_strdup(join, domain);
183         if (!join->dom_netbios_name) goto failed;
184
185         o.in.connect_handle = &handle;
186         o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
187         o.in.sid = l.out.sid;
188         o.out.domain_handle = &domain_handle;
189
190         status = dcerpc_samr_OpenDomain(join->p, join, &o);
191         if (!NT_STATUS_IS_OK(status)) {
192                 printf("OpenDomain failed - %s\n", nt_errstr(status));
193                 goto failed;
194         }
195
196         printf("Creating account %s\n", username);
197
198 again:
199         name.string = username;
200         r.in.domain_handle = &domain_handle;
201         r.in.account_name = &name;
202         r.in.acct_flags = acct_type;
203         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
204         r.out.user_handle = &join->user_handle;
205         r.out.access_granted = &access_granted;
206         r.out.rid = &rid;
207
208         status = dcerpc_samr_CreateUser2(join->p, join, &r);
209
210         if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
211                 status = DeleteUser_byname(join->p, join, &domain_handle, name.string);
212                 if (NT_STATUS_IS_OK(status)) {
213                         goto again;
214                 }
215         }
216
217         if (!NT_STATUS_IS_OK(status)) {
218                 printf("CreateUser2 failed - %s\n", nt_errstr(status));
219                 goto failed;
220         }
221
222         join->user_sid = dom_sid_add_rid(join, join->dom_sid, rid);
223
224         pwp.in.user_handle = &join->user_handle;
225
226         status = dcerpc_samr_GetUserPwInfo(join->p, join, &pwp);
227         if (NT_STATUS_IS_OK(status)) {
228                 policy_min_pw_len = pwp.out.info.min_password_length;
229         }
230
231         random_pw = generate_random_str(join, MAX(8, policy_min_pw_len));
232
233         printf("Setting account password '%s'\n", random_pw);
234
235         ZERO_STRUCT(u);
236         s.in.user_handle = &join->user_handle;
237         s.in.info = &u;
238         s.in.level = 24;
239
240         encode_pw_buffer(u.info24.password.data, random_pw, STR_UNICODE);
241         u.info24.pw_len = strlen(random_pw);
242
243         status = dcerpc_fetch_session_key(join->p, &session_key);
244         if (!NT_STATUS_IS_OK(status)) {
245                 printf("SetUserInfo level %u - no session key - %s\n",
246                        s.in.level, nt_errstr(status));
247                 torture_leave_domain(join);
248                 goto failed;
249         }
250
251         arcfour_crypt_blob(u.info24.password.data, 516, &session_key);
252
253         status = dcerpc_samr_SetUserInfo(join->p, join, &s);
254         if (!NT_STATUS_IS_OK(status)) {
255                 printf("SetUserInfo failed - %s\n", nt_errstr(status));
256                 goto failed;
257         }
258
259         ZERO_STRUCT(u);
260         s.in.user_handle = &join->user_handle;
261         s.in.info = &u;
262         s.in.level = 21;
263
264         u.info21.acct_flags = acct_type | ACB_PWNOEXP;
265         u.info21.fields_present = SAMR_FIELD_ACCT_FLAGS | SAMR_FIELD_DESCRIPTION | SAMR_FIELD_COMMENT | SAMR_FIELD_FULL_NAME;
266
267         u.info21.comment.string = talloc_asprintf(join, 
268                                                   "Tortured by Samba4: %s", 
269                                                   timestring(join, time(NULL)));
270         
271         u.info21.full_name.string = talloc_asprintf(join, 
272                                                     "Torture account for Samba4: %s", 
273                                                     timestring(join, time(NULL)));
274         
275         u.info21.description.string = talloc_asprintf(join, 
276                                          "Samba4 torture account created by host %s: %s", 
277                                          lp_netbios_name(), timestring(join, time(NULL)));
278
279         printf("Resetting ACB flags, force pw change time\n");
280
281         status = dcerpc_samr_SetUserInfo(join->p, join, &s);
282         if (!NT_STATUS_IS_OK(status)) {
283                 printf("SetUserInfo failed - %s\n", nt_errstr(status));
284                 goto failed;
285         }
286
287         if (random_password) {
288                 *random_password = random_pw;
289         }
290
291         return join;
292
293 failed:
294         torture_leave_domain(join);
295         return NULL;
296 }
297
298
299 _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, 
300                                       uint32_t acct_flags,
301                                       struct cli_credentials **machine_credentials)
302 {
303         NTSTATUS status;
304         struct libnet_context *libnet_ctx;
305         struct libnet_JoinDomain *libnet_r;
306         struct test_join *tj;
307         struct samr_SetUserInfo s;
308         union samr_UserInfo u;
309         
310         tj = talloc(NULL, struct test_join);
311         if (!tj) return NULL;
312
313         libnet_r = talloc(tj, struct libnet_JoinDomain);
314         if (!libnet_r) {
315                 talloc_free(tj);
316                 return NULL;
317         }
318         
319         libnet_ctx = libnet_context_init(NULL); 
320         if (!libnet_ctx) {
321                 talloc_free(tj);
322                 return NULL;
323         }
324         
325         tj->libnet_r = libnet_r;
326                 
327         libnet_ctx->cred = cmdline_credentials;
328         libnet_r->in.binding = lp_parm_string(-1, "torture", "binding");
329         if (!libnet_r->in.binding) {
330                 libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(-1, "torture", "host"));
331         }
332         libnet_r->in.level = LIBNET_JOINDOMAIN_SPECIFIED;
333         libnet_r->in.netbios_name = machine_name;
334         libnet_r->in.account_name = talloc_asprintf(libnet_r, "%s$", machine_name);
335         if (!libnet_r->in.account_name) {
336                 talloc_free(tj);
337                 return NULL;
338         }
339         
340         libnet_r->in.acct_type = acct_flags;
341         libnet_r->in.recreate_account = True;
342
343         status = libnet_JoinDomain(libnet_ctx, libnet_r, libnet_r);
344         if (!NT_STATUS_IS_OK(status)) {
345                 if (libnet_r->out.error_string) {
346                         DEBUG(0, ("Domain join failed - %s\n", libnet_r->out.error_string));
347                 } else {
348                         DEBUG(0, ("Domain join failed - %s\n", nt_errstr(status)));
349                 }
350                 talloc_free(tj);
351                 return NULL;
352         }
353         tj->p = libnet_r->out.samr_pipe;
354         tj->user_handle = *libnet_r->out.user_handle;
355         tj->dom_sid = libnet_r->out.domain_sid;
356         talloc_steal(tj, libnet_r->out.domain_sid);
357         tj->dom_netbios_name    = libnet_r->out.domain_name;
358         talloc_steal(tj, libnet_r->out.domain_name);
359         tj->dom_dns_name        = libnet_r->out.realm;
360         talloc_steal(tj, libnet_r->out.realm);
361         tj->user_guid = libnet_r->out.account_guid;
362         tj->netbios_name = talloc_strdup(tj, machine_name);
363         if (!tj->netbios_name) {
364                 talloc_free(tj);
365                 return NULL;
366         }
367
368         ZERO_STRUCT(u);
369         s.in.user_handle = &tj->user_handle;
370         s.in.info = &u;
371         s.in.level = 21;
372
373         u.info21.fields_present = SAMR_FIELD_DESCRIPTION | SAMR_FIELD_COMMENT | SAMR_FIELD_FULL_NAME;
374         u.info21.comment.string = talloc_asprintf(tj, 
375                                                   "Tortured by Samba4: %s", 
376                                                   timestring(tj, time(NULL)));
377         u.info21.full_name.string = talloc_asprintf(tj, 
378                                                     "Torture account for Samba4: %s", 
379                                                     timestring(tj, time(NULL)));
380         
381         u.info21.description.string = talloc_asprintf(tj, 
382                                                       "Samba4 torture account created by host %s: %s", 
383                                                       lp_netbios_name(), timestring(tj, time(NULL)));
384
385         status = dcerpc_samr_SetUserInfo(tj->p, tj, &s);
386         if (!NT_STATUS_IS_OK(status)) {
387                 printf("SetUserInfo (non-critical) failed - %s\n", nt_errstr(status));
388         }
389
390         *machine_credentials = cli_credentials_init(tj);
391         cli_credentials_set_conf(*machine_credentials);
392         cli_credentials_set_workstation(*machine_credentials, machine_name, CRED_SPECIFIED);
393         cli_credentials_set_domain(*machine_credentials, libnet_r->out.domain_name, CRED_SPECIFIED);
394         if (libnet_r->out.realm) {
395                 cli_credentials_set_realm(*machine_credentials, libnet_r->out.realm, CRED_SPECIFIED);
396         }
397         cli_credentials_set_username(*machine_credentials, libnet_r->in.account_name, CRED_SPECIFIED);
398         cli_credentials_set_password(*machine_credentials, libnet_r->out.join_password, CRED_SPECIFIED);
399         if (acct_flags & ACB_SVRTRUST) {
400                 cli_credentials_set_secure_channel_type(*machine_credentials,
401                                                         SEC_CHAN_BDC);
402         } else if (acct_flags & ACB_WSTRUST) {
403                 cli_credentials_set_secure_channel_type(*machine_credentials,
404                                                         SEC_CHAN_WKSTA);
405         } else {
406                 DEBUG(0, ("Invalid account type specificed to torture_join_domain\n"));
407                 talloc_free(*machine_credentials);
408                 return NULL;
409         }
410
411         return tj;
412 }
413
414 struct dcerpc_pipe *torture_join_samr_pipe(struct test_join *join) 
415 {
416         return join->p;
417 }
418
419 struct policy_handle *torture_join_samr_user_policy(struct test_join *join) 
420 {
421         return &join->user_handle;
422 }
423
424 static NTSTATUS torture_leave_ads_domain(TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *libnet_r)
425 {
426         int rtn;
427         TALLOC_CTX *tmp_ctx;
428
429         struct ldb_dn *server_dn;
430         struct ldb_context *ldb_ctx;
431
432         char *remote_ldb_url; 
433          
434         /* Check if we are a domain controller. If not, exit. */
435         if (!libnet_r->out.server_dn_str) {
436                 return NT_STATUS_OK;
437         }
438
439         tmp_ctx = talloc_named(mem_ctx, 0, "torture_leave temporary context");
440         if (!tmp_ctx) {
441                 libnet_r->out.error_string = NULL;
442                 return NT_STATUS_NO_MEMORY;
443         }
444
445         ldb_ctx = ldb_init(tmp_ctx);
446         if (!ldb_ctx) {
447                 libnet_r->out.error_string = NULL;
448                 talloc_free(tmp_ctx);
449                 return NT_STATUS_NO_MEMORY;
450         }
451
452         /* Remove CN=Servers,... entry from the AD. */ 
453         server_dn = ldb_dn_new(tmp_ctx, ldb_ctx, libnet_r->out.server_dn_str);
454         if (! ldb_dn_validate(server_dn)) {
455                 libnet_r->out.error_string = NULL;
456                 talloc_free(tmp_ctx);
457                 return NT_STATUS_NO_MEMORY;
458         }
459
460         remote_ldb_url = talloc_asprintf(tmp_ctx, "ldap://%s", libnet_r->out.samr_binding->host);
461         if (!remote_ldb_url) {
462                 libnet_r->out.error_string = NULL;
463                 talloc_free(tmp_ctx);
464                 return NT_STATUS_NO_MEMORY;
465         }
466
467         ldb_set_opaque(ldb_ctx, "credentials", cmdline_credentials);
468
469         rtn = ldb_connect(ldb_ctx, remote_ldb_url, 0, NULL);
470         if (rtn != 0) {
471                 libnet_r->out.error_string = NULL;
472                 talloc_free(tmp_ctx);
473                 return NT_STATUS_UNSUCCESSFUL;
474         }
475
476         rtn = ldb_delete(ldb_ctx, server_dn);
477         if (rtn != 0) {
478                 libnet_r->out.error_string = NULL;
479                 talloc_free(tmp_ctx);
480                 return NT_STATUS_UNSUCCESSFUL;
481         }
482
483         DEBUG(0, ("%s removed successfully.\n", libnet_r->out.server_dn_str));
484
485         talloc_free(tmp_ctx); 
486         return NT_STATUS_OK;
487 }
488
489 /*
490   leave the domain, deleting the machine acct
491 */
492
493 _PUBLIC_ void torture_leave_domain(struct test_join *join)
494 {
495         struct samr_DeleteUser d;
496         NTSTATUS status;
497
498         if (!join) {
499                 return;
500         }
501         d.in.user_handle = &join->user_handle;
502         d.out.user_handle = &join->user_handle;
503                                         
504         /* Delete machine account */                                                                                                                                                                                                                                                                                                                    
505         status = dcerpc_samr_DeleteUser(join->p, join, &d);
506         if (!NT_STATUS_IS_OK(status)) {
507                 printf("Delete of machine account failed\n");
508         } else {
509                 printf("Delete of machine account was successful.\n");
510         }
511
512         if (join->libnet_r) {
513                 status = torture_leave_ads_domain(join, join->libnet_r);
514         }
515         
516         talloc_free(join);
517 }
518
519 /*
520   return the dom sid for a test join
521 */
522 _PUBLIC_ const struct dom_sid *torture_join_sid(struct test_join *join)
523 {
524         return join->dom_sid;
525 }
526
527 const struct dom_sid *torture_join_user_sid(struct test_join *join)
528 {
529         return join->user_sid;
530 }
531
532 const char *torture_join_netbios_name(struct test_join *join)
533 {
534         return join->netbios_name;
535 }
536
537 const struct GUID *torture_join_user_guid(struct test_join *join)
538 {
539         return &join->user_guid;
540 }
541
542 const char *torture_join_dom_netbios_name(struct test_join *join)
543 {
544         return join->dom_netbios_name;
545 }
546
547 const char *torture_join_dom_dns_name(struct test_join *join)
548 {
549         return join->dom_dns_name;
550 }
551
552
553 #if 0 /* Left as the documentation of the join process, but see new implementation in libnet_become_dc.c */
554 struct test_join_ads_dc {
555         struct test_join *join;
556 };
557
558 struct test_join_ads_dc *torture_join_domain_ads_dc(const char *machine_name, 
559                                                     const char *domain,
560                                                     struct cli_credentials **machine_credentials)
561 {
562         struct test_join_ads_dc *join;
563
564         join = talloc(NULL, struct test_join_ads_dc);
565         if (join == NULL) {
566                 return NULL;
567         }
568
569         join->join = torture_join_domain(machine_name, 
570                                         ACB_SVRTRUST,
571                                         machine_credentials);
572
573         if (!join->join) {
574                 return NULL;
575         }
576
577 /* W2K: */
578         /* W2K: modify userAccountControl from 4096 to 532480 */
579         
580         /* W2K: modify RDN to OU=Domain Controllers and skip the $ from server name */
581
582         /* ask objectVersion of Schema Partition */
583
584         /* ask rIDManagerReferenz of the Domain Partition */
585
586         /* ask fsMORoleOwner of the RID-Manager$ object
587          * returns CN=NTDS Settings,CN=<DC>,CN=Servers,CN=Default-First-Site-Name, ...
588          */
589
590         /* ask for dnsHostName of CN=<DC>,CN=Servers,CN=Default-First-Site-Name, ... */
591
592         /* ask for objectGUID of CN=NTDS Settings,CN=<DC>,CN=Servers,CN=Default-First-Site-Name, ... */
593
594         /* ask for * of CN=Default-First-Site-Name, ... */
595
596         /* search (&(|(objectClass=user)(objectClass=computer))(sAMAccountName=<machine_name>$)) in Domain Partition 
597          * attributes : distinguishedName, userAccountControl
598          */
599
600         /* ask * for CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name,... 
601          * should fail with noSuchObject
602          */
603
604         /* add CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name,... 
605          *
606          * objectClass = server
607          * systemFlags = 50000000
608          * serverReferenz = CN=<machine_name>,OU=Domain Controllers,...
609          */
610
611         /* ask for * of CN=NTDS Settings,CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name, ...
612          * should fail with noSuchObject
613          */
614
615         /* search for (ncname=<domain_nc>) in CN=Partitions,CN=Configuration,... 
616          * attributes: ncName, dnsRoot
617          */
618
619         /* modify add CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name,...
620          * serverReferenz = CN=<machine_name>,OU=Domain Controllers,...
621          * should fail with attributeOrValueExists
622          */
623
624         /* modify replace CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name,...
625          * serverReferenz = CN=<machine_name>,OU=Domain Controllers,...
626          */
627
628         /* DsAddEntry to create the CN=NTDS Settings,CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name, ...
629          *
630          */
631
632         /* replicate CN=Schema,CN=Configuration,...
633          * using DRSUAPI_DS_BIND_GUID_W2K ("6abec3d1-3054-41c8-a362-5a0c5b7d5d71")
634          *
635          */
636
637         /* replicate CN=Configuration,...
638          * using DRSUAPI_DS_BIND_GUID_W2K ("6abec3d1-3054-41c8-a362-5a0c5b7d5d71")
639          *
640          */
641
642         /* replicate Domain Partition
643          * using DRSUAPI_DS_BIND_GUID_W2K ("6abec3d1-3054-41c8-a362-5a0c5b7d5d71")
644          *
645          */
646
647         /* call DsReplicaUpdateRefs() for all partitions like this:
648          *     req1: struct drsuapi_DsReplicaUpdateRefsRequest1
649          *           naming_context           : *
650          *                 naming_context: struct drsuapi_DsReplicaObjectIdentifier
651          *                     __ndr_size               : 0x000000ae (174)
652          *                     __ndr_size_sid           : 0x00000000 (0)
653          *                     guid                     : 00000000-0000-0000-0000-000000000000
654          *                     sid                      : S-0-0
655          *                     dn                       : 'CN=Schema,CN=Configuration,DC=w2k3,DC=vmnet1,DC=vm,DC=base'
656          *           dest_dsa_dns_name        : *
657          *                 dest_dsa_dns_name        : '4a0df188-a0b8-47ea-bbe5-e614723f16dd._msdcs.w2k3.vmnet1.vm.base'
658          *           dest_dsa_guid            : 4a0df188-a0b8-47ea-bbe5-e614723f16dd
659          *           options                  : 0x0000001c (28)
660          *                 0: DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION
661          *                 0: DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE
662          *                 1: DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE
663          *                 1: DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE
664          *                 1: DRSUAPI_DS_REPLICA_UPDATE_0x00000010      
665          *
666          * 4a0df188-a0b8-47ea-bbe5-e614723f16dd is the objectGUID the DsAddEntry() returned for the
667          * CN=NTDS Settings,CN=<machine_name>,CN=Servers,CN=Default-First-Site-Name, ...
668          */
669
670 /* W2K3: see libnet/libnet_become_dc.c */
671         return join;
672 }
673
674 #endif