[SCM] Samba Shared Repository - branch master updated - ff50a88331e95bcb03e7d60a2e1eaded516f309f

Volker Lendecke vlendec at samba.org
Tue Dec 30 10:21:34 GMT 2008


The branch, master has been updated
       via  ff50a88331e95bcb03e7d60a2e1eaded516f309f (commit)
       via  f4559530d1aa192193c45e0c48d0c97369a8eca8 (commit)
       via  12f4d01f4a9a99690a9f3421160bb1cea85aa9ff (commit)
       via  cf79461f4e25752750ee6ff14fb8620a6c11ac1d (commit)
       via  fb54e711fbb2c3a37bf0171f0ea4f32ff1b78430 (commit)
       via  9957d5f3a0faa14a387de1ad4c8bcf88e3ada58a (commit)
       via  12c9d7fa6f1d0fe20d71a5c57f009527620bdeb8 (commit)
      from  332e8ac6c4db8a12db853eb2a353ff7b4b416157 (commit)

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


- Log -----------------------------------------------------------------
commit ff50a88331e95bcb03e7d60a2e1eaded516f309f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 22:07:56 2008 +0100

    Print the vuid in BENCH-SESSSETUP

commit f4559530d1aa192193c45e0c48d0c97369a8eca8
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 12f4d01f4a9a99690a9f3421160bb1cea85aa9ff
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!

commit cf79461f4e25752750ee6ff14fb8620a6c11ac1d
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 21:07:41 2008 +0100

    Move a comment to its place

commit fb54e711fbb2c3a37bf0171f0ea4f32ff1b78430
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 21:03:15 2008 +0100

    Simplify invalidate_vuid slightly
    
    get_valid_user_struct_internal() checks for UID_FIELD_INVALID itself

commit 9957d5f3a0faa14a387de1ad4c8bcf88e3ada58a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 21:01:13 2008 +0100

    Simplify is_partial_auth_vuid slightly

commit 12c9d7fa6f1d0fe20d71a5c57f009527620bdeb8
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 29 19:50:39 2008 +0100

    Simplify invalidate_all_vuids() slightly
    
    invalidate_vuid takes care of removing the user_struct from validated_users

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

Summary of changes:
 source3/smbd/password.c   |   38 +++++++++++++++-----------------------
 source3/smbd/sesssetup.c  |   10 +++++-----
 source3/torture/torture.c |    2 ++
 3 files changed, 22 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 84b40f2..005d92b 100644
--- a/source3/smbd/password.c
+++ b/source3/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,
@@ -82,11 +82,7 @@ user_struct *get_valid_user_struct(uint16 vuid)
 
 bool is_partial_auth_vuid(uint16 vuid)
 {
-	if (vuid == UID_FIELD_INVALID) {
-		return False;
-	}
-	return get_valid_user_struct_internal(vuid,
-			SERVER_ALLOCATED_REQUIRED_NO) ? True : False;
+	return (get_partial_auth_user_struct(vuid) != NULL);
 }
 
 /****************************************************************************
@@ -107,10 +103,6 @@ void invalidate_vuid(uint16 vuid)
 {
 	user_struct *vuser = NULL;
 
-	if (vuid == UID_FIELD_INVALID) {
-		return;
-	}
-
 	vuser = get_valid_user_struct_internal(vuid,
 			SERVER_ALLOCATED_REQUIRED_ANY);
 	if (vuser == NULL) {
@@ -139,11 +131,18 @@ void invalidate_vuid(uint16 vuid)
 
 void invalidate_all_vuids(void)
 {
-	user_struct *usp, *next=NULL;
+	while (validated_users != NULL) {
+		invalidate_vuid(validated_users->vuid);
+	}
+}
+
+static void increment_next_vuid(uint16_t *vuid)
+{
+	*vuid += 1;
 
-	for (usp=validated_users;usp;usp=next) {
-		next = usp->next;
-		invalidate_vuid(usp->vuid);
+	/* Check for vuid wrap. */
+	if (*vuid == UID_FIELD_INVALID) {
+		*vuid = VUID_OFFSET;
 	}
 }
 
@@ -175,11 +174,7 @@ 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 ) {
-		next_vuid++;
-		/* Check for vuid wrap. */
-		if (next_vuid == UID_FIELD_INVALID) {
-			next_vuid = VUID_OFFSET;
-		}
+		increment_next_vuid(&next_vuid);
 	}
 
 	DEBUG(10,("register_initial_vuid: allocated vuid = %u\n",
@@ -192,7 +187,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);
@@ -292,9 +287,6 @@ int register_existing_vuid(uint16 vuid,
 		"and will be vuid %u\n", (int)vuser->server_info->utok.uid,
 		 vuser->server_info->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",
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index a24843f..73948ec 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -547,11 +547,6 @@ static void reply_spnego_kerberos(struct smb_request *req,
 		}
 	}
 
-	/* register_existing_vuid keeps the server info */
-	/* register_existing_vuid takes ownership of session_key on success,
-	 * no need to free after this on success. A better interface would copy
-	 * it.... */
-
 	if (!is_partial_auth_vuid(sess_vuid)) {
 		sess_vuid = register_initial_vuid();
 	}
@@ -560,6 +555,11 @@ static void reply_spnego_kerberos(struct smb_request *req,
 	server_info->user_session_key = session_key;
 	session_key = data_blob_null;
 
+	/* register_existing_vuid keeps the server info */
+	/* register_existing_vuid takes ownership of session_key on success,
+	 * no need to free after this on success. A better interface would copy
+	 * it.... */
+
 	sess_vuid = register_existing_vuid(sess_vuid,
 					server_info,
 					nullblob,
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index b5c1ac9..63942da 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4869,6 +4869,8 @@ static bool run_sesssetup_bench(int dummy)
 			return false;
 		}
 
+		d_printf("\r%d   ", (int)c->vuid);
+
 		if (!cli_ulogoff(c)) {
 			d_printf("(%s) cli_ulogoff failed: %s\n",
 				 __location__, cli_errstr(c));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list