summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-04-09 22:31:37 +0000
committerJeremy Allison <jra@samba.org>2003-04-09 22:31:37 +0000
commit045db5d0458b331e987d82d6e9a61a0b85957d17 (patch)
tree875c013dbc6f8164ffa341e8b33e57da05be0e78 /source3
parent0b11782f733db1d754d95ca03bb21550ab1156f1 (diff)
downloadsamba-045db5d0458b331e987d82d6e9a61a0b85957d17.tar.gz
samba-045db5d0458b331e987d82d6e9a61a0b85957d17.tar.bz2
samba-045db5d0458b331e987d82d6e9a61a0b85957d17.zip
Ensure we have WinXP-like semantics for checking TIDs and FIDs.
Jeremy. (This used to be commit 52e44dde4ef9717eae7cf454f56d309fdd4b7d1f)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/smb_macros.h9
-rw-r--r--source3/smbd/reply.c4
2 files changed, 9 insertions, 4 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 999850b8eb..45fa23b87d 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -77,12 +77,15 @@
#define OPEN_CONN(conn) ((conn) && (conn)->open)
#define IS_IPC(conn) ((conn) && (conn)->ipc)
#define IS_PRINT(conn) ((conn) && (conn)->printer)
-#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn)
+#define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid)
-#define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \
+#define CHECK_FSP(fsp,conn) do {\
+ extern struct current_user current_user;\
+ if (!FNUM_OK(fsp,conn)) \
return(ERROR_DOS(ERRDOS,ERRbadfid)); \
else if((fsp)->fd == -1) \
- return(ERROR_DOS(ERRDOS,ERRbadaccess))
+ return(ERROR_DOS(ERRDOS,ERRbadaccess));\
+ } while(0)
#define CHECK_READ(fsp) if (!(fsp)->can_read) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 77f4c6783f..7da5c877a7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1464,6 +1464,7 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st
int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
{
+ extern struct current_user current_user;
ssize_t maxcount,mincount;
size_t nread = 0;
SMB_OFF_T startpos;
@@ -2361,6 +2362,7 @@ int reply_exit(connection_struct *conn,
int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
int dum_buffsize)
{
+ extern struct current_user current_user;
int outsize = 0;
time_t mtime;
int32 eclass = 0, err = 0;
@@ -2381,7 +2383,7 @@ int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
* We can only use CHECK_FSP if we know it's not a directory.
*/
- if(!fsp || (fsp->conn != conn)) {
+ if(!fsp || (fsp->conn != conn) || (fsp->vuid != current_user.vuid)) {
END_PROFILE(SMBclose);
return ERROR_DOS(ERRDOS,ERRbadfid);
}