svn commit: samba r12430 - in branches/SAMBA_4_0/source/libnet: .

abartlet at samba.org abartlet at samba.org
Thu Dec 22 09:58:51 GMT 2005


Author: abartlet
Date: 2005-12-22 09:58:51 +0000 (Thu, 22 Dec 2005)
New Revision: 12430

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12430

Log:
Clarify libnet_join code. Add/fix comments.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/libnet/libnet_join.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_join.c	2005-12-22 09:56:14 UTC (rev 12429)
+++ branches/SAMBA_4_0/source/libnet/libnet_join.c	2005-12-22 09:58:51 UTC (rev 12430)
@@ -834,7 +834,7 @@
 	od.in.sid = domain_sid;
 	od.out.domain_handle = &d_handle;
 
-	/* 4. do a samr_OpenDomain to get a domain handle */
+	/* do a samr_OpenDomain to get a domain handle */
 	status = dcerpc_samr_OpenDomain(samr_pipe, tmp_ctx, &od);			
 	if (!NT_STATUS_IS_OK(status)) {
 		r->out.error_string = talloc_asprintf(mem_ctx,
@@ -856,17 +856,10 @@
 	cu.out.rid            = &rid;
 	cu.out.access_granted = &access_granted;
 
-	/* 4. do a samr_CreateUser2 to get an account handle, or an error */
+	/* do a samr_CreateUser2 to get an account handle, or an error */
 	cu_status = dcerpc_samr_CreateUser2(samr_pipe, tmp_ctx, &cu);			
 	status = cu_status;
-	if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
-			r->out.error_string = talloc_asprintf(mem_ctx,
-								"samr_CreateUser2 for [%s] failed: %s\n",
-								r->in.domain_name, nt_errstr(status));
-			talloc_free(tmp_ctx);
-			return status;
-
-	} else if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+	if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
 		/* prepare samr_LookupNames */
 		ln.in.domain_handle = &d_handle;
 		ln.in.num_names = 1;
@@ -943,6 +936,12 @@
 				return status;
 			}
 		}
+	} else if (!NT_STATUS_IS_OK(status)) {
+		r->out.error_string = talloc_asprintf(mem_ctx,
+						      "samr_CreateUser2 for [%s] failed: %s\n",
+						      r->in.domain_name, nt_errstr(status));
+		talloc_free(tmp_ctx);
+		return status;
 	}
 
 	/* prepare samr_QueryUserInfo (get flags) */
@@ -1078,6 +1077,7 @@
 		return NT_STATUS_NO_MEMORY;
 	}
 
+	/* Finish out by pushing various bits of status data out for the caller to use */
 	r->out.join_password = password_str;
 	talloc_steal(mem_ctx, password_str);
 



More information about the samba-cvs mailing list