summaryrefslogtreecommitdiff
path: root/source3/smbd/uid.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/uid.c')
-rw-r--r--source3/smbd/uid.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 913e9f30b00..5b0afcb1e9a 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -661,8 +661,24 @@ void smbd_unbecome_root(void)
bool become_user(connection_struct *conn, uint64_t vuid)
{
+ struct user_struct *vuser;
+ int snum = SNUM(conn);
bool ok;
+ if (conn == NULL) {
+ DBG_WARNING("Connection not open\n");
+ return false;
+ }
+
+ vuser = get_valid_user_struct(conn->sconn, vuid);
+ if (vuser == NULL) {
+ /* Invalid vuid sent */
+ DBG_WARNING("Invalid vuid %llu used on share %s.\n",
+ (unsigned long long)vuid,
+ lp_const_servicename(snum));
+ return false;
+ }
+
ok = push_sec_ctx();
if (!ok) {
return false;
@@ -670,7 +686,7 @@ bool become_user(connection_struct *conn, uint64_t vuid)
push_conn_ctx();
- ok = change_to_user_and_service(conn, vuid);
+ ok = change_to_user_internal(conn, vuser->session_info, vuid);
if (!ok) {
pop_sec_ctx();
pop_conn_ctx();