svn commit: samba r17557 - in branches/SAMBA_3_0/source/utils: .

vlendec at samba.org vlendec at samba.org
Tue Aug 15 14:27:20 GMT 2006


Author: vlendec
Date: 2006-08-15 14:27:20 +0000 (Tue, 15 Aug 2006)
New Revision: 17557

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

Log:
Change net_join_domain to return NTSTATUS instead of int.

Thanks to Michael Adam <ma at sernet.de>.

Volker
Modified:
   branches/SAMBA_3_0/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c	2006-08-15 14:18:15 UTC (rev 17556)
+++ branches/SAMBA_3_0/source/utils/net_ads.c	2006-08-15 14:27:20 UTC (rev 17557)
@@ -887,28 +887,27 @@
  Do the domain join
  ********************************************************************/
 
-static int net_join_domain( TALLOC_CTX *ctx, const char *servername, 
-                            struct in_addr *ip, DOM_SID **dom_sid, const char *password )
+static NTSTATUS net_join_domain(TALLOC_CTX *ctx, const char *servername, 
+				struct in_addr *ip, DOM_SID **dom_sid, 
+				const char *password)
 {
-	int ret = -1;
+	NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
 	struct cli_state *cli = NULL;
 
-	if ( !NT_STATUS_IS_OK(connect_to_ipc_krb5(&cli, ip, servername)) )
+	ret = connect_to_ipc_krb5(&cli, ip, servername);
+	if ( !NT_STATUS_IS_OK(ret) ) {
 		goto done;
+	}
 	
 	saf_store( cli->server_domain, cli->desthost );
 
-	if ( !NT_STATUS_IS_OK(netdom_get_domain_sid( ctx, cli, dom_sid )) )
+	ret = netdom_get_domain_sid( ctx, cli, dom_sid );
+	if ( !NT_STATUS_IS_OK(ret) ) {
 		goto done;
-
-	if ( !NT_STATUS_IS_OK(netdom_join_domain( ctx, cli, *dom_sid, 
-		password, ND_TYPE_AD )) )
-	{
-		goto done;
 	}
-	
-	ret = 0;
 
+	ret = netdom_join_domain( ctx, cli, *dom_sid, password, ND_TYPE_AD );
+
 done:
 	if ( cli ) 
 		cli_shutdown(cli);
@@ -1171,6 +1170,7 @@
 {
 	ADS_STRUCT *ads = NULL;
 	ADS_STATUS status;
+	NTSTATUS nt_status;
 	char *machine_account = NULL;
 	const char *short_domain_name = NULL;
 	char *tmp_password, *password;
@@ -1239,9 +1239,10 @@
 	tmp_password = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
 	password = talloc_strdup(ctx, tmp_password);
 	
-	if ( net_join_domain( ctx, ads->config.ldap_server_name, &ads->ldap_ip, &domain_sid, password ) != 0 ) {
-		/* There should be more detailed output here... */
-		d_fprintf(stderr, "call of net_join_domain failed\n");
+	nt_status = net_join_domain(ctx, ads->config.ldap_server_name, 
+				    &ads->ldap_ip, &domain_sid, password);
+	if ( !NT_STATUS_IS_OK(nt_status) ) {
+		d_fprintf(stderr, "call of net_join_domain failed: %s\n", nt_errstr(nt_status));
 		goto fail;
 	}
 	



More information about the samba-cvs mailing list