mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
Remove current_user references from trans2.c
This involved replacing the CHECK_NTQUOTA_HANDLE_OK macro by a function.
This commit is contained in:
parent
4c31cc0b62
commit
5595cdf837
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user