summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-27 16:14:29 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-27 16:14:29 +0000
commitf868196c1db2e4559960a1ded81afad7dd873beb (patch)
tree64bdd6902e68ded942508b059c887012b50d2211
parentd94a4a630d9256b80cfe90e8ffbb74bf7bd5b64f (diff)
downloadsamba-f868196c1db2e4559960a1ded81afad7dd873beb.tar.gz
samba-f868196c1db2e4559960a1ded81afad7dd873beb.tar.bz2
samba-f868196c1db2e4559960a1ded81afad7dd873beb.zip
checks against file handle in api_fd_reply(). i don't know what error
message should be returned, so i just let it fall through to sending an "api_unsupported" (This used to be commit 85d132da6756da0904fe894ea617b84e38e610ff)
-rw-r--r--source3/smbd/ipc.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 9c9c183a14..0354b4ecbe 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -2765,10 +2765,13 @@ static int api_fd_reply(int cnum,uint16 vuid,char *outbuf,
char *rparam = NULL;
int rdata_len = 0;
int rparam_len = 0;
- BOOL reply=False;
+
+ BOOL reply = False;
+
int i;
int fd;
int subcommand;
+ pstring pipe_name;
DEBUG(5,("api_fd_reply\n"));
/* First find out the name of this file. */
@@ -2781,19 +2784,28 @@ static int api_fd_reply(int cnum,uint16 vuid,char *outbuf,
/* Get the file handle and hence the file name. */
fd = setup[1];
subcommand = setup[0];
-
+ if (fd >= 0 && fd < MAX_OPEN_FILES)
+ {
+ pstrcpy(pipe_name, Files[fd].name);
+ }
+ else
+ {
+ pipe_name[0] = 0;
+ DEBUG(1,("api_fd_reply: INVALID FILE HANDLE: %x\n", fd));
+ }
+
DEBUG(3,("Got API command %d on pipe %s (fd %x)",
- subcommand,Files[fd].name, fd));
+ subcommand, pipe_name, fd));
DEBUG(3,("(tdscnt=%d,tpscnt=%d,mdrcnt=%d,mprcnt=%d,cnum=%d,vuid=%d)\n",
tdscnt,tpscnt,mdrcnt,mprcnt,cnum,vuid));
- for (i=0;api_fd_commands[i].name;i++)
+ for (i = 0; api_fd_commands[i].name; i++)
{
- if (strequal(api_fd_commands[i].pipename, Files[fd].name) &&
+ if (strequal(api_fd_commands[i].pipename, pipe_name) &&
api_fd_commands[i].subcommand == subcommand &&
api_fd_commands[i].fn)
{
- DEBUG(3,("Doing %s\n",api_fd_commands[i].name));
+ DEBUG(3,("Doing %s\n", api_fd_commands[i].name));
break;
}
}