Remove more uses of "extern struct current_user current_user;".
[ira/wip.git] / source3 / smbd / file_access.c
index 631efce677d8fb1028cd6673e9ae09cf5f967b3f..5c3089ede65a30116f70e640f50e226230bec34f 100644 (file)
@@ -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) ?