svn commit: samba r4977 - in trunk/source: include libsmb

jerry at samba.org jerry at samba.org
Tue Jan 25 03:22:15 GMT 2005


Author: jerry
Date: 2005-01-25 03:22:15 +0000 (Tue, 25 Jan 2005)
New Revision: 4977

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

Log:
fix 'net rpc join' in order to play with 'net rpc samdump'; starting on SAM replication
Modified:
   trunk/source/include/rpc_netlogon.h
   trunk/source/libsmb/trusts_util.c


Changeset:
Modified: trunk/source/include/rpc_netlogon.h
===================================================================
--- trunk/source/include/rpc_netlogon.h	2005-01-25 02:58:31 UTC (rev 4976)
+++ trunk/source/include/rpc_netlogon.h	2005-01-25 03:22:15 UTC (rev 4977)
@@ -68,6 +68,7 @@
 #define SAM_DATABASE_BUILTIN   0x01 /* BUILTIN users and groups */
 #define SAM_DATABASE_PRIVS     0x02 /* Privileges */
 
+#define NETLOGON_CONTROL_SYNC			0x2
 #define NETLOGON_CONTROL_REDISCOVER		0x5
 #define NETLOGON_CONTROL_TC_QUERY		0x6
 #define NETLOGON_CONTROL_TRANSPORT_NOTIFY	0x7

Modified: trunk/source/libsmb/trusts_util.c
===================================================================
--- trunk/source/libsmb/trusts_util.c	2005-01-25 02:58:31 UTC (rev 4976)
+++ trunk/source/libsmb/trusts_util.c	2005-01-25 03:22:15 UTC (rev 4977)
@@ -69,6 +69,7 @@
 	char *new_trust_passwd;
 	char *str;
 	NTSTATUS nt_status;
+	BOOL is_new_trust = False;
 	
 	/* Get trust password before updating it */
 	nt_status = pdb_init_trustpw_talloc(mem_ctx, &trust);
@@ -79,8 +80,8 @@
 
 	nt_status = pdb_gettrustpwnam(trust, domain);
 	if (!NT_STATUS_IS_OK(nt_status)) {
-		DEBUG(0, ("Couldn't get trust password for domain [%s]\n", domain));
-		return nt_status;
+		DEBUG(3, ("Couldn't get trust password for domain [%s]\n", domain));
+		is_new_trust = True;
 	}
 		
 	/* Create a random machine account password */
@@ -92,9 +93,18 @@
 	nt_status = just_change_the_password(cli, mem_ctx, orig_trust_passwd_hash,
 					     new_trust_passwd_hash, sec_channel_type);
 	
-	if (NT_STATUS_IS_OK(nt_status)) {
+	if (NT_STATUS_IS_OK(nt_status)) 
+	{
+		/* see if we are adding a new trust */
+
+		if ( is_new_trust ) {
+			trust->private.flags = PASS_SERVER_TRUST_NT;
+			pdb_set_tp_domain_name_c(trust, domain);
+		}
+
 		DEBUG(3,("%s : trust_pw_change_and_store_it: Changed password.\n", 
 			 timestring(False)));
+
 		/*
 		 * Return the result of trying to write the new password
 		 * back into the trust account file.
@@ -113,7 +123,11 @@
 		/* trust password flags (according to sec channel type) */
 		sec_channel_type = SCHANNEL_TYPE(trust->private.flags);
 		
-		nt_status = pdb_update_trust_passwd(trust);
+		if ( is_new_trust )
+			nt_status = pdb_add_trust_passwd(trust);
+		else
+			nt_status = pdb_update_trust_passwd(trust);
+
 		if (!NT_STATUS_IS_OK(nt_status)) {
 			DEBUG(0, ("Error when updating trust password for domain [%s]\n",
 				  domain));



More information about the samba-cvs mailing list