Remove reference to conn->admin_user in preparation for removal.
authorJeremy Allison <jra@samba.org>
Mon, 15 Mar 2010 19:24:06 +0000 (12:24 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 15 Mar 2010 21:49:26 +0000 (14:49 -0700)
We use (uid_t)0 here not sec_initial_uid() as make test uses a single user context.
I will revisit this when all the uid check changes are complete.

Jeremy.

source3/smbd/dir.c

index b1e9734681eb5371df887b93460fd963ecdf04ac..69c5d7534a6b2f1d131d57dde01c647a6049f38a 100644 (file)
@@ -1127,11 +1127,12 @@ static bool user_can_read_file(connection_struct *conn,
                               struct smb_filename *smb_fname)
 {
        /*
-        * If user is a member of the Admin group
-        * we never hide files from them.
+        * Never hide files from the root user.
+        * We use (uid_t)0 here not sec_initial_uid()
+        * as make test uses a single user context.
         */
 
-       if (conn->admin_user) {
+       if (get_current_uid(conn) == (uid_t)0) {
                return True;
        }
 
@@ -1149,11 +1150,12 @@ static bool user_can_write_file(connection_struct *conn,
                                const struct smb_filename *smb_fname)
 {
        /*
-        * If user is a member of the Admin group
-        * we never hide files from them.
+        * Never hide files from the root user.
+        * We use (uid_t)0 here not sec_initial_uid()
+        * as make test uses a single user context.
         */
 
-       if (conn->admin_user) {
+       if (get_current_uid(conn) == (uid_t)0) {
                return True;
        }
 
@@ -1176,12 +1178,14 @@ static bool file_is_special(connection_struct *conn,
                            const struct smb_filename *smb_fname)
 {
        /*
-        * If user is a member of the Admin group
-        * we never hide files from them.
+        * Never hide files from the root user.
+        * We use (uid_t)0 here not sec_initial_uid()
+        * as make test uses a single user context.
         */
 
-       if (conn->admin_user)
+       if (get_current_uid(conn) == (uid_t)0) {
                return False;
+       }
 
        SMB_ASSERT(VALID_STAT(smb_fname->st));