summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-05 10:28:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:20 -0500
commitfbe15d8db9fc06c9ad6565f15da58dbb7027ce35 (patch)
tree16d6a7c0653b7e65f05b5759c66111a434bc0c01 /source3/smbd
parentbcd0bf8e5e52d8f09e43aa74be55cafcb8e2cb59 (diff)
downloadsamba-fbe15d8db9fc06c9ad6565f15da58dbb7027ce35.tar.gz
samba-fbe15d8db9fc06c9ad6565f15da58dbb7027ce35.tar.bz2
samba-fbe15d8db9fc06c9ad6565f15da58dbb7027ce35.zip
r24239: Push reply_prep_legacy into api_fd_reply
(This used to be commit e2a96497928ab959e36639fef2d493640bb6e951)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/ipc.c89
1 files changed, 38 insertions, 51 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index e238a3cc12..a190a59996 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -263,7 +263,7 @@ static BOOL api_SNPHS(const char *inbuf,
When no reply is generated, indicate unsupported.
****************************************************************************/
-static BOOL api_no_reply(const char *inbuf, char *outbuf, int max_rdata_len)
+static void api_no_reply(struct smb_request *req)
{
char rparam[4];
@@ -274,39 +274,35 @@ static BOOL api_no_reply(const char *inbuf, char *outbuf, int max_rdata_len)
DEBUG(3,("Unsupported API fd command\n"));
/* now send the reply */
- send_trans_reply(inbuf, outbuf, rparam, 4, NULL, 0, False);
+ send_trans_reply_new(req, rparam, 4, NULL, 0, False);
- return -1;
+ return;
}
/****************************************************************************
Handle remote api calls delivered to a named pipe already opened.
****************************************************************************/
-static int api_fd_reply(connection_struct *conn,
- uint16 vuid,
- const char *inbuf,
- char *outbuf,
- uint16 *setup,
- char *data,
- char *params,
- int suwcnt,
- int tdscnt,
- int tpscnt,
- int mdrcnt,
- int mprcnt)
+static void api_fd_reply(connection_struct *conn, uint16 vuid,
+ struct smb_request *req,
+ uint16 *setup, char *data, char *params,
+ int suwcnt, int tdscnt, int tpscnt,
+ int mdrcnt, int mprcnt)
{
BOOL reply = False;
smb_np_struct *p = NULL;
int pnum;
int subcommand;
+ char *inbuf, *outbuf;
+ int size, buflength;
DEBUG(5,("api_fd_reply\n"));
/* First find out the name of this file. */
if (suwcnt != 2) {
DEBUG(0,("Unexpected named pipe transaction.\n"));
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
/* Get the file handle and hence the file name. */
@@ -322,18 +318,20 @@ static int api_fd_reply(connection_struct *conn,
/* Win9x does this call with a unicode pipe name, not a pnum. */
/* Just return success for now... */
DEBUG(3,("Got TRANSACT_WAITNAMEDPIPEHANDLESTATE on text pipe name\n"));
- send_trans_reply(inbuf, outbuf, NULL, 0, NULL, 0, False);
- return -1;
+ send_trans_reply_new(req, NULL, 0, NULL, 0, False);
+ return;
}
DEBUG(1,("api_fd_reply: INVALID PIPE HANDLE: %x\n", pnum));
- return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+ reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return;
}
if (vuid != p->vuid) {
DEBUG(1, ("Got pipe request (pnum %x) using invalid VUID %d, "
"expected %d\n", pnum, vuid, p->vuid));
- return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+ reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return;
}
DEBUG(3,("Got API command 0x%x on pipe \"%s\" (pnum %x)\n", subcommand, p->name, pnum));
@@ -343,6 +341,11 @@ static int api_fd_reply(connection_struct *conn,
DEBUG(10,("api_fd_reply: p:%p max_trans_reply: %d\n", p, p->max_trans_reply));
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &buflength)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
+ }
+
switch (subcommand) {
case TRANSACT_DCERPCCMD:
/* dce/rpc command */
@@ -359,13 +362,16 @@ static int api_fd_reply(connection_struct *conn,
reply = api_SNPHS(inbuf, outbuf, p, params, tpscnt);
break;
default:
- return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
- if (!reply)
- return api_no_reply(inbuf, outbuf, mdrcnt);
+ if (!reply) {
+ api_no_reply(req);
+ return;
+ }
- return -1;
+ reply_post_legacy(req, -1);
}
/****************************************************************************
@@ -404,40 +410,21 @@ static void named_pipe(connection_struct *conn, uint16 vuid,
strequal(name,"WINREG") ||
strequal(name,"SAMR") ||
strequal(name,"LSARPC")) {
- char *inbuf, *outbuf;
- int size, bufsize;
DEBUG(4,("named pipe command from Win95 (wow!)\n"));
- if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize)) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
-
- reply_post_legacy(
- req,
- api_fd_reply(conn, vuid, inbuf, outbuf,
- setup, data, params,
- suwcnt, tdscnt, tpscnt,
- mdrcnt, mprcnt));
+ api_fd_reply(conn, vuid, req,
+ setup, data, params,
+ suwcnt, tdscnt, tpscnt,
+ mdrcnt, mprcnt);
return;
}
if (strlen(name) < 1) {
- char *inbuf, *outbuf;
- int size, bufsize;
-
- if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize)) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
-
- reply_post_legacy(
- req,
- api_fd_reply(conn, vuid, inbuf, outbuf,
- setup, data,
- params, suwcnt, tdscnt,
- tpscnt, mdrcnt, mprcnt));
+ api_fd_reply(conn, vuid, req,
+ setup, data,
+ params, suwcnt, tdscnt,
+ tpscnt, mdrcnt, mprcnt);
return;
}