summaryrefslogtreecommitdiff
path: root/source4/smbd/reply.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-04 11:01:58 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-04 11:01:58 +0000
commit42c6a2548a658a198f128cdce36b9fcf869c33c8 (patch)
tree45addf4f9e93d6d12b4f4d6fa44b8f4a9e16119d /source4/smbd/reply.c
parent2e5ae6f0650962db86fcdb1290f9a7c8b07b1410 (diff)
downloadsamba-42c6a2548a658a198f128cdce36b9fcf869c33c8.tar.gz
samba-42c6a2548a658a198f128cdce36b9fcf869c33c8.tar.bz2
samba-42c6a2548a658a198f128cdce36b9fcf869c33c8.zip
merged more updates from Jim Myers
(This used to be commit 03bf30659640d684073f92d64da6e911edb65a73)
Diffstat (limited to 'source4/smbd/reply.c')
-rw-r--r--source4/smbd/reply.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/source4/smbd/reply.c b/source4/smbd/reply.c
index 3d237d964d..759ec1ef05 100644
--- a/source4/smbd/reply.c
+++ b/source4/smbd/reply.c
@@ -709,6 +709,7 @@ void reply_readbraw(struct request_context *req)
if (req->out.buffer == NULL) {
goto failed;
}
+ SIVAL(req->out.buffer, 0, 0); /* init NBT header */
/* tell the backend where to put the data */
io.readbraw.out.data = req->out.buffer + NBT_HDR_SIZE;
@@ -723,11 +724,13 @@ void reply_readbraw(struct request_context *req)
req->out.size = io.readbraw.out.nread + NBT_HDR_SIZE;
req_send_reply(req);
+ return;
failed:
/* any failure in readbraw is equivalent to reading zero bytes */
req->out.size = 4;
req->out.buffer = talloc(req->mem_ctx, req->out.size);
+ SIVAL(req->out.buffer, 0, 0); /* init NBT header */
req_send_reply(req);
}
@@ -742,6 +745,8 @@ static void reply_lockread_send(struct request_context *req)
CHECK_ASYNC_STATUS;
/* trim packet */
+ io->lockread.out.nread = MIN(io->lockread.out.nread,
+ req_max_data(req) - 3);
req_grow_data(req, 3 + io->lockread.out.nread);
/* construct reply */
@@ -800,6 +805,8 @@ static void reply_read_send(struct request_context *req)
CHECK_ASYNC_STATUS;
/* trim packet */
+ io->read.out.nread = MIN(io->read.out.nread,
+ req_max_data(req) - 3);
req_grow_data(req, 3 + io->read.out.nread);
/* construct reply */
@@ -833,7 +840,7 @@ void reply_read(struct request_context *req)
req_setup_reply(req, 5, 3 + io->read.in.count);
/* tell the backend where to put the data */
- io->lockread.out.data = req->out.data + 3;
+ io->read.out.data = req->out.data + 3;
req->async.send_fn = reply_read_send;
req->async.private = io;
@@ -856,6 +863,8 @@ static void reply_read_and_X_send(struct request_context *req)
CHECK_ASYNC_STATUS;
/* trim the packet to the right size */
+ io->readx.out.nread = MIN(io->readx.out.nread,
+ req_max_data(req) - 1);
req_grow_data(req, 1 + io->readx.out.nread);
/* construct reply */
@@ -1922,26 +1931,6 @@ void reply_getattrE(struct request_context *req)
REQ_ASYNC_TAIL;
}
-/****************************************************************************
- Reply to a search.
- Can be called from SMBsearch, SMBffirst or SMBfunique.
-****************************************************************************/
-void reply_search(struct request_context *req)
-{
- /* do this one later */
- req_reply_error(req, NT_STATUS_FOOBAR);
-}
-
-
-/****************************************************************************
- Reply to a fclose (stop directory search).
-****************************************************************************/
-void reply_fclose(struct request_context *req)
-{
- /* skip this one for now too */
- req_reply_error(req, NT_STATUS_FOOBAR);
-}
-
/****************************************************************************
reply to an old style session setup command
@@ -2196,22 +2185,6 @@ void reply_transs2(struct request_context *req)
req_reply_error(req, NT_STATUS_FOOBAR);
}
-/****************************************************************************
- Reply to an SMBnttrans request
-****************************************************************************/
-void reply_nttrans(struct request_context *req)
-{
- req_reply_error(req, NT_STATUS_FOOBAR);
-}
-
-/****************************************************************************
- Reply to an SMBnttranss request
-****************************************************************************/
-void reply_nttranss(struct request_context *req)
-{
- req_reply_error(req, NT_STATUS_FOOBAR);
-}
-
/****************************************************************************
Reply to an SMBfindclose request