[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Feb 5 13:11:48 MST 2010


The branch, master has been updated
       via  abbd0f9... s3: Make use of ZERO_STRUCTP
       via  3ea602a... s3: Remove a pointless if-statement
       via  dcc850e... s3: Make guest_user_info() static
       via  004e3e4... s3: Hide some uses of pdb_get_init_flags (which I would love to remove...)
       via  1cd7223... s3: Fix some nonempty blank lines
      from  e4d29bb... s4:UID wrapper - Make it work on older distributions

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


- Log -----------------------------------------------------------------
commit abbd0f9195fe9b4feb29b86a04c88be001e2737a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 5 15:55:14 2010 +0100

    s3: Make use of ZERO_STRUCTP

commit 3ea602a7c3f71a5cc1b2f867d86d8baa24bfe661
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 5 15:53:19 2010 +0100

    s3: Remove a pointless if-statement

commit dcc850e3b30f84513c4b38dac88dffa19aac53cd
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 5 15:50:11 2010 +0100

    s3: Make guest_user_info() static

commit 004e3e400d0f404ffd9515c1f502c5287a4bff1c
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 5 15:40:12 2010 +0100

    s3: Hide some uses of pdb_get_init_flags (which I would love to remove...)

commit 1cd7223b8e380813b5324eb903e980c6eeefda5f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 5 15:43:26 2010 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/include/proto.h        |    1 -
 source3/passdb/machine_sid.c   |   20 +++++++-------
 source3/passdb/pdb_get_set.c   |    2 +-
 source3/passdb/pdb_interface.c |    2 +-
 source3/passdb/pdb_ldap.c      |    2 +-
 source3/passdb/pdb_smbpasswd.c |   54 ++++++++++++++++++++--------------------
 6 files changed, 40 insertions(+), 41 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8a17039..177c333 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4575,7 +4575,6 @@ struct event_context *pdb_get_event_context(void);
 NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
 struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
-bool guest_user_info( struct samu *user );
 bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) ;
 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32 flags,
 			 uint32 *rid);
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c
index c7c3cc4..d70e7c4 100644
--- a/source3/passdb/machine_sid.c
+++ b/source3/passdb/machine_sid.c
@@ -5,17 +5,17 @@
    Copyright (C) Andrew Tridgell		2002
    Copyright (C) Gerald (Jerry) Carter		2000
    Copyright (C) Stefan (metze) Metzmacher	2002
-      
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -42,12 +42,12 @@ static bool read_sid_from_file(const char *fname, DOM_SID *sid)
 	bool ret;
 
 	lines = file_lines_load(fname, &numlines,0, NULL);
-	
+
 	if (!lines || numlines < 1) {
-		if (lines) TALLOC_FREE(lines);
+		TALLOC_FREE(lines);
 		return False;
 	}
-	
+
 	ret = string_to_sid(sid, lines[0]);
 	TALLOC_FREE(lines);
 	return ret;
@@ -61,7 +61,8 @@ static void generate_random_sid(DOM_SID *sid)
 	int i;
 	uchar raw_sid_data[12];
 
-	memset((char *)sid, '\0', sizeof(*sid));
+	ZERO_STRUCTP(sid);
+
 	sid->sid_rev_num = 1;
 	sid->id_auth[5] = 5;
 	sid->num_auths = 0;
@@ -81,7 +82,7 @@ static DOM_SID *pdb_generate_sam_sid(void)
 	DOM_SID domain_sid;
 	char *fname = NULL;
 	DOM_SID *sam_sid;
-	
+
 	if(!(sam_sid=SMB_MALLOC_P(DOM_SID)))
 		return NULL;
 
@@ -124,7 +125,6 @@ static DOM_SID *pdb_generate_sam_sid(void)
 		}
 
 		return sam_sid;
-		
 	}
 
 	/* check for an old MACHINE.SID file for backwards compatibility */
@@ -185,7 +185,7 @@ DOM_SID *get_global_sam_sid(void)
 
 	if (global_sam_sid != NULL)
 		return global_sam_sid;
-	
+
 	/*
 	 * memory for global_sam_sid is allocated in
 	 * pdb_generate_sam_sid() as needed
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 555b207..becd87f 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -85,7 +85,7 @@ time_t pdb_get_pass_can_change_time(const struct samu *sampass)
 	   to indicate that the user cannot change their password.  jmcd
 	*/
 	if (sampass->pass_can_change_time == get_time_t_max() &&
-	    pdb_get_init_flags(sampass, PDB_CANCHANGETIME) == PDB_CHANGED)
+	    IS_SAM_CHANGED(sampass, PDB_CANCHANGETIME))
 		return sampass->pass_can_change_time;
 
 	if (!pdb_get_account_policy(PDB_POLICY_MIN_PASSWORD_AGE, &allow))
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index bd85ded..130909e 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -248,7 +248,7 @@ bool pdb_getsampwnam(struct samu *sam_acct, const char *username)
 /**********************************************************************
 **********************************************************************/
 
-bool guest_user_info( struct samu *user )
+static bool guest_user_info( struct samu *user )
 {
 	struct passwd *pwd;
 	NTSTATUS result;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 68e0c22..6e5f9ac 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -609,7 +609,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 		}
 	}
 
-	if (pdb_get_init_flags(sampass,PDB_USERSID) == PDB_DEFAULT) {
+	if (IS_SAM_DEFAULT(sampass, PDB_USERSID)) {
 		DEBUG(1, ("init_sam_from_ldap: no %s or %s attribute found for this user %s\n", 
 			get_userattr_key2string(ldap_state->schema_ver,
 				LDAP_ATTR_USER_SID),
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index f465d34..d584d0e 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -30,7 +30,7 @@
    else.  However, smb_passwd is limited to the information
    stored by an smbpasswd entry 
  */
- 
+
 struct smb_passwd
 {
         uint32 smb_userid;        /* this is actually the unix uid_t */
@@ -47,10 +47,10 @@ struct smbpasswd_privates
 {
 	/* used for maintain locks on the smbpasswd file */
 	int 	pw_file_lock_depth;
-	
+
 	/* Global File pointer */
 	FILE 	*pw_file;
-	
+
 	/* formerly static variables */
 	struct smb_passwd pw_buf;
 	fstring user_name;
@@ -168,7 +168,7 @@ static void pdb_init_smb(struct smb_passwd *user)
 	if (user == NULL) 
 		return;
 	ZERO_STRUCTP (user);
-	
+
 	user->pass_last_set_time = (time_t)0;
 }
 
@@ -224,7 +224,7 @@ creating file %s\n", pfile));
 				break;
 			}
 	}
-		       
+
 	for(race_loop = 0; race_loop < 5; race_loop++) {
 		DEBUG(10, ("startsmbfilepwent_internal: opening file %s\n", pfile));
 
@@ -1193,7 +1193,7 @@ static bool build_smb_pass (struct smb_passwd *smb_pw, const struct samu *sampas
 
 	if (!IS_SAM_DEFAULT(sampass, PDB_USERSID)) {
 		rid = pdb_get_user_rid(sampass);
-		
+
 		/* If the user specified a RID, make sure its able to be both stored and retreived */
 		if (rid == DOMAIN_USER_RID_GUEST) {
 			struct passwd *passwd = getpwnam_alloc(NULL, lp_guestaccount());
@@ -1230,7 +1230,7 @@ static bool build_sam_account(struct smbpasswd_privates *smbpasswd_state,
 			      struct samu *sam_pass, const struct smb_passwd *pw_buf)
 {
 	struct passwd *pwfile;
-	
+
 	if ( !sam_pass ) {
 		DEBUG(5,("build_sam_account: struct samu is NULL\n"));
 		return False;
@@ -1243,14 +1243,14 @@ static bool build_sam_account(struct smbpasswd_privates *smbpasswd_state,
 		"%u is not in unix passwd database!\n", pw_buf->smb_name, pw_buf->smb_userid));
 			return False;
 	}
-	
+
 	if ( !NT_STATUS_IS_OK( samu_set_unix(sam_pass, pwfile )) )
 		return False;
-		
+
 	TALLOC_FREE(pwfile);
 
 	/* set remaining fields */
-		
+
 	if (!pdb_set_nt_passwd (sam_pass, pw_buf->smb_nt_passwd, PDB_SET))
 		return False;
 	if (!pdb_set_lanman_passwd (sam_pass, pw_buf->smb_passwd, PDB_SET))
@@ -1258,7 +1258,7 @@ static bool build_sam_account(struct smbpasswd_privates *smbpasswd_state,
 	pdb_set_acct_ctrl (sam_pass, pw_buf->acct_ctrl, PDB_SET);
 	pdb_set_pass_last_set_time (sam_pass, pw_buf->pass_last_set_time, PDB_SET);
 	pdb_set_pass_can_change_time (sam_pass, pw_buf->pass_last_set_time, PDB_SET);
-	
+
 	return True;
 }
 
@@ -1294,21 +1294,21 @@ static NTSTATUS smbpasswd_getsampwnam(struct pdb_methods *my_methods,
 
 	while ( ((smb_pw=getsmbfilepwent(smbpasswd_state, fp)) != NULL)&& (!strequal(smb_pw->smb_name, username)) )
 		/* do nothing....another loop */ ;
-	
+
 	endsmbfilepwent(fp, &(smbpasswd_state->pw_file_lock_depth));
 
 
 	/* did we locate the username in smbpasswd  */
 	if (smb_pw == NULL)
 		return nt_status;
-	
+
 	DEBUG(10, ("getsampwnam (smbpasswd): found by name: %s\n", smb_pw->smb_name));
 
 	if (!sam_acct) {
 		DEBUG(10,("getsampwnam (smbpasswd): struct samu is NULL\n"));
 		return nt_status;
 	}
-		
+
 	/* now build the struct samu */
 	if (!build_sam_account(smbpasswd_state, sam_acct, smb_pw))
 		return nt_status;
@@ -1324,7 +1324,7 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, struct sam
 	struct smb_passwd *smb_pw;
 	FILE *fp = NULL;
 	uint32 rid;
-	
+
 	DEBUG(10, ("smbpasswd_getsampwrid: search by sid: %s\n",
 		   sid_string_dbg(sid)));
 
@@ -1358,9 +1358,9 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, struct sam
 	/* did we locate the username in smbpasswd  */
 	if (smb_pw == NULL)
 		return nt_status;
-	
+
 	DEBUG(10, ("getsampwrid (smbpasswd): found by name: %s\n", smb_pw->smb_name));
-		
+
 	if (!sam_acct) {
 		DEBUG(10,("getsampwrid: (smbpasswd) struct samu is NULL\n"));
 		return nt_status;
@@ -1387,12 +1387,12 @@ static NTSTATUS smbpasswd_add_sam_account(struct pdb_methods *my_methods, struct
 {
 	struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
 	struct smb_passwd smb_pw;
-	
+
 	/* convert the struct samu */
 	if (!build_smb_pass(&smb_pw, sampass)) {
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
+
 	/* add the entry */
 	return add_smbfilepwd_entry(smbpasswd_state, &smb_pw);
 }
@@ -1401,19 +1401,19 @@ static NTSTATUS smbpasswd_update_sam_account(struct pdb_methods *my_methods, str
 {
 	struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
 	struct smb_passwd smb_pw;
-	
+
 	/* convert the struct samu */
 	if (!build_smb_pass(&smb_pw, sampass)) {
 		DEBUG(0, ("smbpasswd_update_sam_account: build_smb_pass failed!\n"));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
+
 	/* update the entry */
 	if(!mod_smbfilepwd_entry(smbpasswd_state, &smb_pw)) {
 		DEBUG(0, ("smbpasswd_update_sam_account: mod_smbfilepwd_entry failed!\n"));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
+
 	return NT_STATUS_OK;
 }
 
@@ -1445,7 +1445,7 @@ static NTSTATUS smbpasswd_rename_sam_account (struct pdb_methods *my_methods,
 	if ( !(new_acct = samu_new( NULL )) ) {
 		return NT_STATUS_NO_MEMORY;
 	}
-	
+
 	if ( !pdb_copy_sam_account( new_acct, old_acct ) 
 		|| !pdb_set_username(new_acct, newname, PDB_CHANGED)) 
 	{
@@ -1516,7 +1516,7 @@ done:
 
 	if (new_acct)
 		TALLOC_FREE(new_acct);
-	
+
 	return (ret);	
 }
 
@@ -1528,9 +1528,9 @@ static uint32_t smbpasswd_capabilities(struct pdb_methods *methods)
 static void free_private_data(void **vp) 
 {
 	struct smbpasswd_privates **privates = (struct smbpasswd_privates**)vp;
-	
+
 	endsmbfilepwent((*privates)->pw_file, &((*privates)->pw_file_lock_depth));
-	
+
 	*privates = NULL;
 	/* No need to free any further, as it is talloc()ed */
 }
@@ -1698,7 +1698,7 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char
 	} else {
 		privates->smbpasswd_file = talloc_strdup(*pdb_method, lp_smb_passwd_file());
 	}
-	
+
 	if (!privates->smbpasswd_file) {
 		DEBUG(0, ("talloc_strdp() failed for storing smbpasswd location!\n"));
 		return NT_STATUS_NO_MEMORY;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list