summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-01-08 11:02:16 -0800
committerAndrew Bartlett <abartlet@samba.org>2013-01-09 15:29:47 +1100
commitfcdd6092b10a4b4406af47b989dcf1a9d693580e (patch)
tree55110d3e9f17aaf0ac9354d439943df3f2b85729
parent296c0c34f198dfc7a8f13f26e54fbc980f667784 (diff)
downloadsamba-fcdd6092b10a4b4406af47b989dcf1a9d693580e.tar.gz
samba-fcdd6092b10a4b4406af47b989dcf1a9d693580e.tar.bz2
samba-fcdd6092b10a4b4406af47b989dcf1a9d693580e.zip
Fixup the change_to_user_by_session() case as called from become_user_by_session()
Use inside source3/printing/nt_printing.c:get_correct_cversion(). Allow check_user_ok() to be called with vuid==UID_FIELD_INVALID. All this should do is throw away one entry in the vuid cache. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/smbd/uid.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index b2fe39cb9c..a795eef8af 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -191,6 +191,13 @@ static bool check_user_ok(connection_struct *conn,
for (i=0; i<VUID_CACHE_SIZE; i++) {
ent = &conn->vuid_cache->array[i];
if (ent->vuid == vuid) {
+ if (vuid == UID_FIELD_INVALID) {
+ /*
+ * Slow path, we don't care
+ * about the array traversal.
+ */
+ continue;
+ }
free_conn_session_info_if_unused(conn);
conn->session_info = ent->session_info;
conn->read_only = ent->read_only;
@@ -232,11 +239,26 @@ static bool check_user_ok(connection_struct *conn,
return false;
}
+ /*
+ * It's actually OK to call check_user_ok() with
+ * vuid == UID_FIELD_INVALID as called from change_to_user_by_session().
+ * All this will do is throw away one entry in the cache.
+ */
+
ent->vuid = vuid;
ent->read_only = readonly_share;
ent->share_access = share_access;
free_conn_session_info_if_unused(conn);
conn->session_info = ent->session_info;
+ if (vuid == UID_FIELD_INVALID) {
+ /*
+ * Not strictly needed, just make it really
+ * clear this entry is actually an unused one.
+ */
+ ent->read_only = false;
+ ent->share_access = 0;
+ ent->session_info = NULL;
+ }
conn->read_only = readonly_share;
conn->share_access = share_access;