Remove current_user references from trans2.c
authorVolker Lendecke <vl@samba.org>
Thu, 19 Jun 2008 16:46:57 +0000 (18:46 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 19 Jun 2008 16:51:38 +0000 (18:51 +0200)
This involved replacing the CHECK_NTQUOTA_HANDLE_OK macro by a function.
(This used to be commit 5595cdf837edb82db69a3e57bcf3108be7feeeb8)

source3/include/ntquotas.h
source3/include/proto.h
source3/include/smb_macros.h
source3/smbd/nttrans.c
source3/smbd/reply.c
source3/smbd/trans2.c

index 5b92b666c27aff91cfb7eee4ece8dc4b4403fa87..ed503b38543a03dd47aad05726bc31284c741644 100644 (file)
@@ -88,9 +88,4 @@ typedef struct _SMB_NTQUOTA_HANDLE {
        SMB_NTQUOTA_LIST *tmp_list;
 } SMB_NTQUOTA_HANDLE;
 
-#define CHECK_NTQUOTA_HANDLE_OK(fsp,conn)      (FNUM_OK(fsp,conn) &&\
-        (fsp)->fake_file_handle &&\
-        ((fsp)->fake_file_handle->type == FAKE_FILE_TYPE_QUOTA) &&\
-        (fsp)->fake_file_handle->private_data)
-
 #endif /*_NTQUOTAS_H */
index e60bfb76a1eada28e55b649effb45c2fcbe70876..30642678eb55e76848c42d8d213d7a04a2ae879b 100644 (file)
@@ -10092,6 +10092,8 @@ bool check_fsp_open(connection_struct *conn, struct smb_request *req,
                    files_struct *fsp);
 bool check_fsp(connection_struct *conn, struct smb_request *req,
               files_struct *fsp);
+bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
+                             files_struct *fsp);
 bool fsp_belongs_conn(connection_struct *conn, struct smb_request *req,
                      files_struct *fsp);
 void reply_special(char *inbuf);
index 0e21431226d7dd18fbb0a5e6654932d1a91c143a..20e2a9a4437f2d375b00dcabd6405f3c5227434e 100644 (file)
@@ -75,8 +75,6 @@
                                return ERROR_NT(NT_STATUS_INVALID_HANDLE); \
                        } while(0)
 
-#define FNUM_OK(fsp,c) ((fsp) && !(fsp)->is_directory && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid)
-
 /* you must add the following extern declaration to files using this macro
  * (do not add it to the macro as that causes nested extern declaration warnings)
  * extern struct current_user current_user;
index 8e55d6b8e9834ec1c98ebe542d3b6ac78c93fe7a..ad5db7a3e7b33d63fb46c994cd9e3c4791b8e95d 100644 (file)
@@ -2056,7 +2056,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
 
        /* maybe we can check the quota_fnum */
        fsp = file_fsp(SVAL(params,0));
-       if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) {
+       if (!check_fsp_ntquota_handle(conn, req, fsp)) {
                DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
                reply_nterror(req, NT_STATUS_INVALID_HANDLE);
                return;
@@ -2323,7 +2323,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
 
        /* maybe we can check the quota_fnum */
        fsp = file_fsp(SVAL(params,0));
-       if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) {
+       if (!check_fsp_ntquota_handle(conn, req, fsp)) {
                DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
                reply_nterror(req, NT_STATUS_INVALID_HANDLE);
                return;
index f12dbdc8f3d614579dc3de882e824e62356d1783..aaa284dc39314f18ee44a9ca56f0c7c28b3260dc 100644 (file)
@@ -362,6 +362,37 @@ bool check_fsp(connection_struct *conn, struct smb_request *req,
        return True;
 }
 
+/****************************************************************************
+ Check if we have a correct fsp pointing to a quota fake file. Replacement for
+ the CHECK_NTQUOTA_HANDLE_OK macro.
+****************************************************************************/
+
+bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
+                             files_struct *fsp)
+{
+       if (!check_fsp_open(conn, req, fsp)) {
+               return false;
+       }
+
+       if (fsp->is_directory) {
+               return false;
+       }
+
+       if (fsp->fake_file_handle == NULL) {
+               return false;
+       }
+
+       if (fsp->fake_file_handle->type != FAKE_FILE_TYPE_QUOTA) {
+               return false;
+       }
+
+       if (fsp->fake_file_handle->private_data == NULL) {
+               return false;
+       }
+
+       return true;
+}
+
 /****************************************************************************
  Check if we have a correct fsp. Replacement for the FSP_BELONGS_CONN macro
 ****************************************************************************/
index ee966ad8cdfd0431ed10596866575f266ccbd332..881b29c6f0ac76265344124282187ef0b88c342b 100644 (file)
@@ -28,7 +28,6 @@
 extern int max_send;
 extern enum protocol_types Protocol;
 extern uint32 global_client_caps;
-extern struct current_user current_user;
 
 #define get_file_size(sbuf) ((sbuf).st_size)
 #define DIR_ENTRY_SAFETY_MARGIN 4096
@@ -3293,7 +3292,8 @@ cap_low = 0x%x, cap_high = 0x%x\n",
                                 */
                                fsp = file_fsp(SVAL(params,0));
 
-                               if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) {
+                               if (!check_fsp_ntquota_handle(conn, req,
+                                                             fsp)) {
                                        DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
                                        reply_nterror(
                                                req, NT_STATUS_INVALID_HANDLE);