summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/globals.h5
-rw-r--r--source3/smbd/password.c22
-rw-r--r--source3/smbd/process.c7
-rw-r--r--source3/smbd/smb2_sesssetup.c3
4 files changed, 17 insertions, 20 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 075dc564d9..b927e16053 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -452,6 +452,9 @@ struct smbd_server_connection {
bool using_smb2;
int trans_num;
+ size_t num_users;
+ struct user_struct *users;
+
struct files_struct *files;
struct bitmap *file_bmap;
int real_max_open_files;
@@ -535,9 +538,7 @@ struct smbd_server_connection {
* this holds info on user ids that are already
* validated for this VC
*/
- user_struct *validated_users;
uint16_t next_vuid;
- int num_validated_vuids;
} sessions;
struct {
connection_struct *Connections;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 27ba3bd01b..39cde15aaf 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -52,7 +52,7 @@ static user_struct *get_valid_user_struct_internal(
if (vuid == UID_FIELD_INVALID)
return NULL;
- usp=sconn->smb1.sessions.validated_users;
+ usp=sconn->users;
for (;usp;usp=usp->next,count++) {
if (vuid == usp->vuid) {
switch (server_allocated) {
@@ -69,8 +69,7 @@ static user_struct *get_valid_user_struct_internal(
break;
}
if (count > 10) {
- DLIST_PROMOTE(sconn->smb1.sessions.validated_users,
- usp);
+ DLIST_PROMOTE(sconn->users, usp);
}
return usp;
}
@@ -128,14 +127,15 @@ void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid)
TALLOC_FREE(vuser->gensec_security);
}
- DLIST_REMOVE(sconn->smb1.sessions.validated_users, vuser);
+ DLIST_REMOVE(sconn->users, vuser);
+ SMB_ASSERT(sconn->num_users > 0);
+ sconn->num_users--;
/* clear the vuid from the 'cache' on each connection, and
from the vuid 'owner' of connections */
conn_clear_vuid_caches(sconn, vuid);
TALLOC_FREE(vuser);
- sconn->smb1.sessions.num_validated_vuids--;
}
/****************************************************************************
@@ -148,9 +148,8 @@ void invalidate_all_vuids(struct smbd_server_connection *sconn)
return;
}
- while (sconn->smb1.sessions.validated_users != NULL) {
- invalidate_vuid(sconn,
- sconn->smb1.sessions.validated_users->vuid);
+ while (sconn->users != NULL) {
+ invalidate_vuid(sconn, sconn->users->vuid);
}
}
@@ -173,7 +172,7 @@ int register_initial_vuid(struct smbd_server_connection *sconn)
user_struct *vuser;
/* Limit allowed vuids to 16bits - VUID_OFFSET. */
- if (sconn->smb1.sessions.num_validated_vuids >= 0xFFFF-VUID_OFFSET) {
+ if (sconn->num_users >= 0xFFFF-VUID_OFFSET) {
return UID_FIELD_INVALID;
}
@@ -201,9 +200,10 @@ int register_initial_vuid(struct smbd_server_connection *sconn)
* to NTLMSSP.
*/
increment_next_vuid(&sconn->smb1.sessions.next_vuid);
- sconn->smb1.sessions.num_validated_vuids++;
- DLIST_ADD(sconn->smb1.sessions.validated_users, vuser);
+ sconn->num_users++;
+ DLIST_ADD(sconn->users, vuser);
+
return vuser->vuid;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 113131828f..f87eccfdcd 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2984,20 +2984,17 @@ static void smbd_id_cache_kill(struct messaging_context *msg_ctx,
{
const char *msg = (data && data->data)
? (const char *)data->data : "<NULL>";
- struct user_struct *validated_users;
struct id_cache_ref id;
struct smbd_server_connection *sconn =
talloc_get_type_abort(private_data,
struct smbd_server_connection);
- validated_users = sconn->smb1.sessions.validated_users;
-
if (!id_cache_ref_parse(msg, &id)) {
DEBUG(0, ("Invalid ?ID: %s\n", msg));
return;
}
- if (id_in_use(validated_users, &id)) {
+ if (id_in_use(sconn->users, &id)) {
exit_server_cleanly(msg);
}
id_cache_delete_from_cache(&id);
@@ -3265,9 +3262,7 @@ void smbd_process(struct tevent_context *ev_ctx,
sconn->smb1.sessions.max_send = BUFFER_SIZE;
sconn->smb1.sessions.last_session_tag = UID_FIELD_INVALID;
/* this holds info on user ids that are already validated for this VC */
- sconn->smb1.sessions.validated_users = NULL;
sconn->smb1.sessions.next_vuid = VUID_OFFSET;
- sconn->smb1.sessions.num_validated_vuids = 0;
conn_init(sconn);
if (!init_dptrs(sconn)) {
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index c94d016c0f..96e8d40cdd 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -173,7 +173,8 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbd_smb2_session *session,
session->compat_vuser->session_info = session->session_info;
session->compat_vuser->session_keystr = NULL;
session->compat_vuser->vuid = session->vuid;
- DLIST_ADD(session->sconn->smb1.sessions.validated_users, session->compat_vuser);
+ DLIST_ADD(session->sconn->users, session->compat_vuser);
+ session->sconn->num_users++;
if (security_session_user_level(session->session_info, NULL) >= SECURITY_USER) {
session->compat_vuser->homes_snum =