summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-29 22:06:08 +0100
committerVolker Lendecke <vl@samba.org>2008-12-30 11:26:10 +0100
commitf4559530d1aa192193c45e0c48d0c97369a8eca8 (patch)
treedfcf3d4efbc5bdbbb019cae0c077166040d53e4e /source3/smbd
parent12f4d01f4a9a99690a9f3421160bb1cea85aa9ff (diff)
downloadsamba-f4559530d1aa192193c45e0c48d0c97369a8eca8.tar.gz
samba-f4559530d1aa192193c45e0c48d0c97369a8eca8.tar.bz2
samba-f4559530d1aa192193c45e0c48d0c97369a8eca8.zip
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@shmoop.org> for reporting #5933
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/password.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index d729c2e77b..005d92bd88 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,
@@ -136,6 +136,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.
*****************************************************/
@@ -164,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",
@@ -181,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);