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

abartlet at samba.org abartlet at samba.org
Fri Oct 28 02:09:36 GMT 2005


Author: abartlet
Date: 2005-10-28 02:09:35 +0000 (Fri, 28 Oct 2005)
New Revision: 11348

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

Log:
Fixes for 'net join':

 - Add more servicePrincipalNames
 - Always add them, not just for BDC accounts, and not just the first
   time the account is created (it might be an upgrade from an NT4
   account).

This should fix us for being a domain member in ADS again.


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-10-28 01:42:20 UTC (rev 11347)
+++ branches/SAMBA_4_0/source/libnet/libnet_join.c	2005-10-28 02:09:35 UTC (rev 11348)
@@ -390,7 +390,8 @@
 	msg->dn = msgs[0]->dn;
 
 	{
-		const char *service_principal_name[2];
+		int i;
+		const char *service_principal_name[6];
 		const char *dns_host_name = strlower_talloc(tmp_ctx, 
 							    talloc_asprintf(tmp_ctx, 
 									    "%s.%s", 
@@ -404,17 +405,18 @@
 		}
 
 		service_principal_name[0] = talloc_asprintf(tmp_ctx, "host/%s", dns_host_name);
-		if (!service_principal_name[0]) {
-			r->out.error_string = NULL;
-			talloc_free(tmp_ctx);
-			return NT_STATUS_NO_MEMORY;
-		}
-
 		service_principal_name[1] = talloc_asprintf(tmp_ctx, "host/%s", strlower_talloc(tmp_ctx, r->in.netbios_name));
-		if (!service_principal_name[1]) {
-			r->out.error_string = NULL;
-			talloc_free(tmp_ctx);
-			return NT_STATUS_NO_MEMORY;
+		service_principal_name[2] = talloc_asprintf(tmp_ctx, "host/%s/%s", dns_host_name, realm);
+		service_principal_name[3] = talloc_asprintf(tmp_ctx, "host/%s/%s", strlower_talloc(tmp_ctx, r->in.netbios_name), realm);
+		service_principal_name[4] = talloc_asprintf(tmp_ctx, "host/%s/%s", dns_host_name, r->out.domain_name);
+		service_principal_name[5] = talloc_asprintf(tmp_ctx, "host/%s/%s", strlower_talloc(tmp_ctx, r->in.netbios_name), r->out.domain_name);
+		
+		for (i=0; i < ARRAY_SIZE(service_principal_name); i++) {
+			if (!service_principal_name[i]) {
+				r->out.error_string = NULL;
+				talloc_free(tmp_ctx);
+				return NT_STATUS_NO_MEMORY;
+			}
 		}
 
 		rtn = samdb_msg_add_string(remote_ldb, tmp_ctx, msg, "dNSHostName", dns_host_name);
@@ -502,9 +504,11 @@
 
 	r->out.kvno = kvno;
 
-	status = libnet_JoinSite(ctx,
-				 drsuapi_pipe, drsuapi_bind_handle,
-				 remote_ldb, r);
+	if (r->in.acct_type ==  ACB_SVRTRUST) {
+		status = libnet_JoinSite(ctx,
+					 drsuapi_pipe, drsuapi_bind_handle,
+					 remote_ldb, r);
+	}
 	talloc_free(tmp_ctx);
 
 	return status;
@@ -1000,10 +1004,7 @@
 
 	/* Now, if it was AD, then we want to start looking changing a
 	 * few more things.  Otherwise, we are done. */
-	if (realm 
-	    && (r->in.acct_type ==  ACB_SVRTRUST) 
-	    && (!NT_STATUS_EQUAL(cu_status, NT_STATUS_USER_EXISTS))) {
-		
+	if (realm) {
 		status = libnet_JoinADSDomain(ctx, r);
 		return status;
 	}



More information about the samba-cvs mailing list