summaryrefslogtreecommitdiff
path: root/source3/smbd/file_access.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-12 13:56:51 -0800
committerJeremy Allison <jra@samba.org>2010-03-12 13:56:51 -0800
commite80ceb1d7355c8c46a2ed90d5721cf367640f4e8 (patch)
treea1172af1868d93449ac25d68576193a872e0bb50 /source3/smbd/file_access.c
parent31b0417f7def5af5392088eec8fe6e77074d3da9 (diff)
downloadsamba-e80ceb1d7355c8c46a2ed90d5721cf367640f4e8.tar.gz
samba-e80ceb1d7355c8c46a2ed90d5721cf367640f4e8.tar.bz2
samba-e80ceb1d7355c8c46a2ed90d5721cf367640f4e8.zip
Remove more uses of "extern struct current_user current_user;".
Use accessor functions to get to this value. Tidies up much of the user context code. Volker, please look at the changes in smbd/uid.c to familiarize yourself with these changes as I think they make the logic in there cleaner. Cause smbd/posix_acls.c code to look at current user context, not stored context on the conn struct - allows correct use of these function calls under a become_root()/unbecome_root() pair. Jeremy.
Diffstat (limited to 'source3/smbd/file_access.c')
-rw-r--r--source3/smbd/file_access.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index 631efce677..5c3089ede6 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -35,7 +35,7 @@ bool can_access_file_acl(struct connection_struct *conn,
struct security_descriptor *secdesc = NULL;
bool ret;
- if (conn->server_info->utok.uid == 0 || conn->admin_user) {
+ if (get_current_uid(conn) == (uid_t)0) {
/* I'm sorry sir, I didn't know you were root... */
return true;
}
@@ -111,7 +111,7 @@ bool can_delete_file_in_directory(connection_struct *conn,
ret = false;
goto out;
}
- if (conn->server_info->utok.uid == 0 || conn->admin_user) {
+ if (get_current_uid(conn) == (uid_t)0) {
/* I'm sorry sir, I didn't know you were root... */
ret = true;
goto out;
@@ -195,7 +195,7 @@ bool can_access_file_data(connection_struct *conn,
DEBUG(10,("can_access_file_data: requesting 0x%x on file %s\n",
(unsigned int)access_mask, smb_fname_str_dbg(smb_fname)));
- if (conn->server_info->utok.uid == 0 || conn->admin_user) {
+ if (get_current_uid(conn) == (uid_t)0) {
/* I'm sorry sir, I didn't know you were root... */
return True;
}
@@ -203,7 +203,7 @@ bool can_access_file_data(connection_struct *conn,
SMB_ASSERT(VALID_STAT(smb_fname->st));
/* Check primary owner access. */
- if (conn->server_info->utok.uid == smb_fname->st.st_ex_uid) {
+ if (get_current_uid(conn) == smb_fname->st.st_ex_uid) {
switch (access_mask) {
case FILE_READ_DATA:
return (smb_fname->st.st_ex_mode & S_IRUSR) ?