summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-02 19:50:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:12 -0500
commit2945d4492d10d83acd2d345339da941db5d7fc53 (patch)
tree0eafea20d572ae0b03b6faab0a4061e707e31b4a
parente3a53acafe4c4fd35970e2512c3a782ed644730f (diff)
downloadsamba-2945d4492d10d83acd2d345339da941db5d7fc53.tar.gz
samba-2945d4492d10d83acd2d345339da941db5d7fc53.tar.bz2
samba-2945d4492d10d83acd2d345339da941db5d7fc53.zip
r24141: Add check_fsp as a replacement for CHECK_FSP
(This used to be commit a3d77a576f863c4d9f95a1a898f70ae5b5bbc471)
-rw-r--r--source3/smbd/reply.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0bb9d9ca7d..91e4274814 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -285,6 +285,33 @@ size_t srvstr_get_path(const char *inbuf, uint16 smb_flags2, char *dest,
}
/****************************************************************************
+ Check if we have a correct fsp pointing to a file. Replacement for the
+ CHECK_FSP macro.
+****************************************************************************/
+BOOL check_fsp(connection_struct *conn, struct smb_request *req,
+ files_struct *fsp, struct current_user *user)
+{
+ if (!(fsp) || !(conn)) {
+ reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return False;
+ }
+ if (((conn) != (fsp)->conn) || current_user.vuid != (fsp)->vuid) {
+ reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return False;
+ }
+ if ((fsp)->is_directory) {
+ reply_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
+ return False;
+ }
+ if ((fsp)->fh->fd == -1) {
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+ return False;
+ }
+ (fsp)->num_smb_operations++;
+ return True;
+}
+
+/****************************************************************************
Reply to a (netbios-level) special message.
****************************************************************************/