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 */
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);
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;
/* 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;
/* 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;
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
****************************************************************************/
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
*/
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);