Fix bug #7080 - Quota only shown when logged as root.
authorJeremy Allison <jra@samba.org>
Tue, 5 Apr 2011 18:24:39 +0000 (11:24 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 5 Apr 2011 20:56:33 +0000 (13:56 -0700)
Remove the final incorrect uses of conn->session_info->utok.uid.
When we're in the "admin users" list, then this value is not set
to zero.

Inspired by the comment on this bug by Dmitry Butskoy <dmitry@butskoy.name>.

I'll create a different fix for 3.5.x.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Apr  5 21:53:59 CEST 2011 on sn-devel-104
(cherry picked from commit b6a30be70266c07733ddfa2ae08d127e08560868)

source3/modules/onefs_open.c
source3/smbd/nttrans.c
source3/smbd/trans2.c

index 19b2ea073617be2878f20e16dff1c2987384d1b5..80f799ca6f6d1d0ee6af60718a1fd1c6c17e7779 100644 (file)
@@ -1310,7 +1310,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
                new_file_created = True;
        }
 
-       set_share_mode(lck, fsp, conn->session_info->utok.uid, 0,
+       set_share_mode(lck, fsp, get_current_uid(conn), 0,
                       fsp->oplock_type);
 
        /* Handle strange delete on close create semantics. */
@@ -1666,7 +1666,7 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
                return NT_STATUS_DELETE_PENDING;
        }
 
-       set_share_mode(lck, fsp, conn->session_info->utok.uid, 0, NO_OPLOCK);
+       set_share_mode(lck, fsp, get_current_uid(conn), 0, NO_OPLOCK);
 
        /*
         * For directories the delete on close bit at open time seems
index a7da776451d939f9779acea9f7e6bd9f7aa916cd..2b540187d9ce449d2cb044f31b134bf3595a736a 100644 (file)
@@ -2512,7 +2512,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
        ZERO_STRUCT(qt);
 
        /* access check */
-       if (conn->session_info->utok.uid != 0) {
+       if (get_current_uid(conn) != 0) {
                DEBUG(1,("get_user_quota: access_denied service [%s] user "
                         "[%s]\n", lp_servicename(SNUM(conn)),
                         conn->session_info->unix_name));
@@ -2782,7 +2782,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
        ZERO_STRUCT(qt);
 
        /* access check */
-       if (conn->session_info->utok.uid != 0) {
+       if (get_current_uid(conn) != 0) {
                DEBUG(1,("set_user_quota: access_denied service [%s] user "
                         "[%s]\n", lp_servicename(SNUM(conn)),
                         conn->session_info->unix_name));
index 4890de3a5ceabedff5ebf52bbfb91b35c5c6844b..fe06538246a7225a6cb83642483a563558568a1b 100644 (file)
@@ -3203,7 +3203,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
                        fsp.fnum = -1;
 
                        /* access check */
-                       if (conn->session_info->utok.uid != sec_initial_uid()) {
+                       if (get_current_uid(conn) != 0) {
                                DEBUG(0,("set_user_quota: access_denied "
                                         "service [%s] user [%s]\n",
                                         lp_servicename(SNUM(conn)),
@@ -3698,8 +3698,7 @@ cap_low = 0x%x, cap_high = 0x%x\n",
                                ZERO_STRUCT(quotas);
 
                                /* access check */
-                               if ((conn->session_info->utok.uid != sec_initial_uid())
-                                   ||!CAN_WRITE(conn)) {
+                               if ((get_current_uid(conn) != 0) || !CAN_WRITE(conn)) {
                                        DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
                                                 lp_servicename(SNUM(conn)),
                                                 conn->session_info->unix_name));