summaryrefslogtreecommitdiff
path: root/source3/smbd/uid.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-15 10:33:09 -0700
committerJeremy Allison <jra@samba.org>2010-03-15 14:48:54 -0700
commit4b85a0ea7fe036347b9fe5c725e55b043f75ccb4 (patch)
tree33c588f05e060adaf709cdbd42ee1bae86d59d32 /source3/smbd/uid.c
parent83b9e12513984af8b372f5558043ed0f65d832fd (diff)
downloadsamba-4b85a0ea7fe036347b9fe5c725e55b043f75ccb4.tar.gz
samba-4b85a0ea7fe036347b9fe5c725e55b043f75ccb4.tar.bz2
samba-4b85a0ea7fe036347b9fe5c725e55b043f75ccb4.zip
Rever e80ceb1d7355c8c46a2ed90d5721cf367640f4e8 "Remove more uses of "extern struct current_user current_user;"."
As requested by Volker, split this into smaller commits. Jeremy.
Diffstat (limited to 'source3/smbd/uid.c')
-rw-r--r--source3/smbd/uid.c72
1 files changed, 15 insertions, 57 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 3bf5a7ee49..706f8c9f6a 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -167,9 +167,6 @@ static bool check_user_ok(connection_struct *conn,
conn->read_only = readonly_share;
conn->admin_user = admin_user;
- if (conn->admin_user) {
- conn->server_info->utok.uid = sec_initial_uid();
- }
return(True);
}
@@ -281,22 +278,26 @@ bool change_to_user(connection_struct *conn, uint16 vuid)
return false;
}
- /* security = share sets force_user. */
- if (!conn->force_user && !vuser) {
- DEBUG(2,("change_to_user: Invalid vuid used %d in accessing "
- "share %s.\n",vuid, lp_servicename(snum) ));
- return False;
- }
-
/*
* conn->server_info is now correctly set up with a copy we can mess
* with for force_group etc.
*/
- uid = conn->server_info->utok.uid;
- gid = conn->server_info->utok.gid;
- num_groups = conn->server_info->utok.ngroups;
- group_list = conn->server_info->utok.groups;
+ if (conn->force_user) /* security = share sets this too */ {
+ uid = conn->server_info->utok.uid;
+ gid = conn->server_info->utok.gid;
+ group_list = conn->server_info->utok.groups;
+ num_groups = conn->server_info->utok.ngroups;
+ } else if (vuser) {
+ uid = conn->admin_user ? 0 : vuser->server_info->utok.uid;
+ gid = conn->server_info->utok.gid;
+ num_groups = conn->server_info->utok.ngroups;
+ group_list = conn->server_info->utok.groups;
+ } else {
+ DEBUG(2,("change_to_user: Invalid vuid used %d in accessing "
+ "share %s.\n",vuid, lp_servicename(snum) ));
+ return False;
+ }
/*
* See if we should force group for this service.
@@ -504,46 +505,3 @@ bool unbecome_user(void)
pop_conn_ctx();
return True;
}
-
-/****************************************************************************
- Return the current user we are running effectively as on this connection.
- I'd like to make this return conn->server_info->utok.uid, but become_root()
- doesn't alter this value.
-****************************************************************************/
-
-uid_t get_current_uid(connection_struct *conn)
-{
- return current_user.ut.uid;
-}
-
-/****************************************************************************
- Return the current group we are running effectively as on this connection.
- I'd like to make this return conn->server_info->utok.gid, but become_root()
- doesn't alter this value.
-****************************************************************************/
-
-gid_t get_current_gid(connection_struct *conn)
-{
- return current_user.ut.gid;
-}
-
-/****************************************************************************
- Return the UNIX token we are running effectively as on this connection.
- I'd like to make this return &conn->server_info->utok, but become_root()
- doesn't alter this value.
-****************************************************************************/
-
-const UNIX_USER_TOKEN *get_current_utok(connection_struct *conn)
-{
- return &current_user.ut;
-}
-
-const NT_USER_TOKEN *get_current_nttok(connection_struct *conn)
-{
- return current_user.nt_user_token;
-}
-
-uint16_t get_current_vuid(connection_struct *conn)
-{
- return current_user.vuid;
-}