[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3308-gf03e6b8

Volker Lendecke vlendec at samba.org
Mon Dec 29 22:05:59 GMT 2008


The branch, v3-2-test has been updated
       via  f03e6b8faf8f3222e3dcdaae906f48e2aa3eeba8 (commit)
       via  228d0c9459e9187d671875eda03aaa1435ab8401 (commit)
      from  c0fc381ac7ad09fd454fd6802149c46b607069ee (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit f03e6b8faf8f3222e3dcdaae906f48e2aa3eeba8
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 22:06:08 2008 +0100

    Second part of the bugfix for #5933
    
    Incrementing the next vuid did not correctly overflow
    
    Now we survive BENCH-SESSSETUP with -o 100000. Takes a while though :-)
    
    Thanks a lot to Ofer Tal <otsmb at shmoop.org> for reporting #5933

commit 228d0c9459e9187d671875eda03aaa1435ab8401
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 22:01:57 2008 +0100

    First part of bugfix for #5933
    
    Ofer Tal <otsmb at shmoop.org> fully correctly noted that we're incrementing
    num_validated_vuids twice per session setup, but decrement it only once.
    Looking at sesssetup.c we always call register_initial_vuid() before
    register_existing_vuid(), so there's no point in incrementing it in
    register_existing_vuid().
    
    Jeremy, please check!

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

Summary of changes:
 source/smbd/password.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/password.c b/source/smbd/password.c
index 80eba56..c19df0c 100644
--- a/source/smbd/password.c
+++ b/source/smbd/password.c
@@ -27,7 +27,7 @@ static char *session_workgroup = NULL;
 
 /* this holds info on user ids that are already validated for this VC */
 static user_struct *validated_users;
-static int next_vuid = VUID_OFFSET;
+static uint16_t next_vuid = VUID_OFFSET;
 static int num_validated_vuids;
 
 enum server_allocated_state { SERVER_ALLOCATED_REQUIRED_YES,
@@ -149,6 +149,16 @@ void invalidate_all_vuids(void)
 	}
 }
 
+static void increment_next_vuid(uint16_t *vuid)
+{
+	*vuid += 1;
+
+	/* Check for vuid wrap. */
+	if (*vuid == UID_FIELD_INVALID) {
+		*vuid = VUID_OFFSET;
+	}
+}
+
 /****************************************************
  Create a new partial auth user struct.
 *****************************************************/
@@ -177,11 +187,8 @@ int register_initial_vuid(void)
 	/* Allocate a free vuid. Yes this is a linear search... */
 	while( get_valid_user_struct_internal(next_vuid,
 			SERVER_ALLOCATED_REQUIRED_ANY) != NULL ) {
+		increment_next_vuid(&next_vuid);
 		next_vuid++;
-		/* Check for vuid wrap. */
-		if (next_vuid == UID_FIELD_INVALID) {
-			next_vuid = VUID_OFFSET;
-		}
 	}
 
 	DEBUG(10,("register_initial_vuid: allocated vuid = %u\n",
@@ -194,7 +201,7 @@ int register_initial_vuid(void)
 	 * need to allocate a vuid between the first and second calls
 	 * to NTLMSSP.
 	 */
-	next_vuid++;
+	increment_next_vuid(&next_vuid);
 	num_validated_vuids++;
 
 	DLIST_ADD(validated_users, vuser);
@@ -325,9 +332,6 @@ int register_existing_vuid(uint16 vuid,
 		"and will be vuid %u\n",
 		(int)vuser->uid,vuser->user.unix_name, vuser->vuid));
 
-	next_vuid++;
-	num_validated_vuids++;
-
 	if (!session_claim(vuser)) {
 		DEBUG(1, ("register_existing_vuid: Failed to claim session "
 			"for vuid=%d\n",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list