summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-15 10:45:15 -0700
committerJeremy Allison <jra@samba.org>2010-03-15 14:49:06 -0700
commit5d6610a21580a1d588465ec9f144f5a6daad57cd (patch)
tree9d74de23fd24871d4d0ff1bbac3d28b17c9bfa93 /source3/smbd
parent1332ce52b7b78b9e03e376f312120c0f1d7e302a (diff)
downloadsamba-5d6610a21580a1d588465ec9f144f5a6daad57cd.tar.gz
samba-5d6610a21580a1d588465ec9f144f5a6daad57cd.tar.bz2
samba-5d6610a21580a1d588465ec9f144f5a6daad57cd.zip
Add accessor functions for current uid, gid, unix token, NT token and vuid.
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/uid.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 706f8c9f6a..5e3b84da50 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -505,3 +505,46 @@ 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;
+}