summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-06-19 18:46:57 +0200
committerVolker Lendecke <vl@samba.org>2008-06-19 18:51:38 +0200
commit52664f62ba84719a9ea6eb8f9c01f1f3a9bd1b24 (patch)
tree5ec0a18c19d919768503e024486e095cd87fccec /source3
parente901466061bbbbe0c7b5dc9856346a308d80506b (diff)
downloadsamba-52664f62ba84719a9ea6eb8f9c01f1f3a9bd1b24.tar.gz
samba-52664f62ba84719a9ea6eb8f9c01f1f3a9bd1b24.tar.bz2
samba-52664f62ba84719a9ea6eb8f9c01f1f3a9bd1b24.zip
Remove current_user references from trans2.c
This involved replacing the CHECK_NTQUOTA_HANDLE_OK macro by a function. (This used to be commit 5595cdf837edb82db69a3e57bcf3108be7feeeb8)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/ntquotas.h5
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/include/smb_macros.h2
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/reply.c31
-rw-r--r--source3/smbd/trans2.c4
6 files changed, 37 insertions, 11 deletions
diff --git a/source3/include/ntquotas.h b/source3/include/ntquotas.h
index 5b92b666c2..ed503b3854 100644
--- a/source3/include/ntquotas.h
+++ b/source3/include/ntquotas.h
@@ -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 */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e60bfb76a1..30642678eb 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.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);
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 0e21431226..20e2a9a443 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -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;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 8e55d6b8e9..ad5db7a3e7 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -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;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index f12dbdc8f3..aaa284dc39 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -363,6 +363,37 @@ bool check_fsp(connection_struct *conn, struct smb_request *req,
}
/****************************************************************************
+ 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
****************************************************************************/
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index ee966ad8cd..881b29c6f0 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -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);