[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1666-g4112bb2

Simo Sorce idra at samba.org
Sat May 16 19:29:25 GMT 2009


The branch, master has been updated
       via  4112bb2428eccdf21c831d6f846fa055b1d1d7d3 (commit)
      from  72b744f38ebb9f9576c05c7bb0a00de26697ec8f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4112bb2428eccdf21c831d6f846fa055b1d1d7d3
Author: Simo Sorce <idra at samba.org>
Date:   Sat May 16 13:04:06 2009 -0400

    Move smb_create_user() in samsync
    
    It is not used anywhere else, so make it also static and remove
    it from proto.h

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h                |    5 ---
 source3/libnet/libnet_samsync_passdb.c |   60 ++++++++++++++++++++++++++++++++
 source3/passdb/passdb.c                |   60 --------------------------------
 3 files changed, 60 insertions(+), 65 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index f6b2b3c..81fc1c0 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4333,11 +4333,6 @@ bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
 		       const char **account_name, uint32 *channel);
 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
 						struct samu *pw);
-NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
-			 uint32_t acct_flags,
-			 const char *account,
-			 struct passwd **passwd_p);
-
 /* The following definitions come from passdb/pdb_compat.c  */
 
 uint32 pdb_get_user_rid (const struct samu *sampass);
diff --git a/source3/libnet/libnet_samsync_passdb.c b/source3/libnet/libnet_samsync_passdb.c
index 95e8448..27c7aac 100644
--- a/source3/libnet/libnet_samsync_passdb.c
+++ b/source3/libnet/libnet_samsync_passdb.c
@@ -226,6 +226,66 @@ static NTSTATUS sam_account_from_delta(struct samu *account,
 	return NT_STATUS_OK;
 }
 
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
+				uint32_t acct_flags,
+				const char *account,
+				struct passwd **passwd_p)
+{
+	struct passwd *passwd;
+	char *add_script = NULL;
+
+	passwd = Get_Pwnam_alloc(mem_ctx, account);
+	if (passwd) {
+		*passwd_p = passwd;
+		return NT_STATUS_OK;
+	}
+
+	/* Create appropriate user */
+	if (acct_flags & ACB_NORMAL) {
+		add_script = talloc_strdup(mem_ctx, lp_adduser_script());
+	} else if ( (acct_flags & ACB_WSTRUST) ||
+		    (acct_flags & ACB_SVRTRUST) ||
+		    (acct_flags & ACB_DOMTRUST) ) {
+		add_script = talloc_strdup(mem_ctx, lp_addmachine_script());
+	} else {
+		DEBUG(1, ("Unknown user type: %s\n",
+			  pdb_encode_acct_ctrl(acct_flags, NEW_PW_FORMAT_SPACE_PADDED_LEN)));
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
+	if (!add_script) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	if (*add_script) {
+		int add_ret;
+		add_script = talloc_all_string_sub(mem_ctx, add_script,
+						   "%u", account);
+		if (!add_script) {
+			return NT_STATUS_NO_MEMORY;
+		}
+		add_ret = smbrun(add_script, NULL);
+		DEBUG(add_ret ? 0 : 1,("fetch_account: Running the command `%s' "
+			 "gave %d\n", add_script, add_ret));
+		if (add_ret == 0) {
+			smb_nscd_flush_user_cache();
+		}
+	}
+
+	/* try and find the possible unix account again */
+	passwd = Get_Pwnam_alloc(mem_ctx, account);
+	if (!passwd) {
+		return NT_STATUS_NO_SUCH_USER;
+	}
+
+	*passwd_p = passwd;
+
+	return NT_STATUS_OK;
+}
 /****************************************************************
 ****************************************************************/
 
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index c36cda5..6aab5e3 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -2348,63 +2348,3 @@ struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
 
 	return hours;
 }
-
-/****************************************************************
-****************************************************************/
-
-NTSTATUS smb_create_user(TALLOC_CTX *mem_ctx,
-			 uint32_t acct_flags,
-			 const char *account,
-			 struct passwd **passwd_p)
-{
-	struct passwd *passwd;
-	char *add_script = NULL;
-
-	passwd = Get_Pwnam_alloc(mem_ctx, account);
-	if (passwd) {
-		*passwd_p = passwd;
-		return NT_STATUS_OK;
-	}
-
-	/* Create appropriate user */
-	if (acct_flags & ACB_NORMAL) {
-		add_script = talloc_strdup(mem_ctx, lp_adduser_script());
-	} else if ( (acct_flags & ACB_WSTRUST) ||
-		    (acct_flags & ACB_SVRTRUST) ||
-		    (acct_flags & ACB_DOMTRUST) ) {
-		add_script = talloc_strdup(mem_ctx, lp_addmachine_script());
-	} else {
-		DEBUG(1, ("Unknown user type: %s\n",
-			  pdb_encode_acct_ctrl(acct_flags, NEW_PW_FORMAT_SPACE_PADDED_LEN)));
-		return NT_STATUS_UNSUCCESSFUL;
-	}
-
-	if (!add_script) {
-		return NT_STATUS_NO_MEMORY;
-	}
-
-	if (*add_script) {
-		int add_ret;
-		add_script = talloc_all_string_sub(mem_ctx, add_script,
-						   "%u", account);
-		if (!add_script) {
-			return NT_STATUS_NO_MEMORY;
-		}
-		add_ret = smbrun(add_script, NULL);
-		DEBUG(add_ret ? 0 : 1,("fetch_account: Running the command `%s' "
-			 "gave %d\n", add_script, add_ret));
-		if (add_ret == 0) {
-			smb_nscd_flush_user_cache();
-		}
-	}
-
-	/* try and find the possible unix account again */
-	passwd = Get_Pwnam_alloc(mem_ctx, account);
-	if (!passwd) {
-		return NT_STATUS_NO_SUCH_USER;
-	}
-
-	*passwd_p = passwd;
-
-	return NT_STATUS_OK;
-}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list