From 90b33a05e967e9e29c4584bed188ef6fa5a3fbf0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 26 Feb 2012 16:49:09 +0100 Subject: s3: Make sure the andX chains are ended correctly Normally chain_reply took care of this. This will go away soon. --- source3/smbd/blocking.c | 2 ++ source3/smbd/nttrans.c | 6 ++++++ source3/smbd/pipes.c | 9 +++++++++ source3/smbd/reply.c | 13 +++++++++++++ source3/smbd/sesssetup.c | 3 +++ 5 files changed, 33 insertions(+) (limited to 'source3/smbd') diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 6496e43505..ac878926d1 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -271,6 +271,8 @@ static void reply_lockingX_success(struct blocking_lock_record *blr) struct smb_request *req = blr->req; reply_outbuf(req, 2, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ /* * As this message is a lockingX call we must handle diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index cfa048ba19..b03e0997a2 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -352,6 +352,9 @@ static void do_ntcreate_pipe_open(connection_struct *conn, reply_outbuf(req, 34, 0); } + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + p = (char *)req->outbuf + smb_vwv2; p++; SSVAL(p,0,pnum); @@ -634,6 +637,9 @@ void reply_ntcreate_and_X(struct smb_request *req) reply_outbuf(req, 34, 0); } + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + p = (char *)req->outbuf + smb_vwv2; SCVAL(p, 0, oplock_granted); diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 9e5dfc3018..d567537ed6 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -146,6 +146,9 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req) /* Prepare the reply */ reply_outbuf(req, 15, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + /* Mark the opened file as an existing named pipe in message mode. */ SSVAL(req->outbuf,smb_vwv9,2); SSVAL(req->outbuf,smb_vwv10,0xc700); @@ -354,6 +357,9 @@ static void pipe_write_andx_done(struct tevent_req *subreq) reply_outbuf(req, 6, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + nwritten = (state->pipe_start_message_raw ? nwritten + 2 : nwritten); SSVAL(req->outbuf,smb_vwv2,nwritten); @@ -417,6 +423,9 @@ void reply_pipe_read_and_X(struct smb_request *req) state->smb_mincnt = SVAL(req->vwv+6, 0); reply_outbuf(req, 12, state->smb_maxcnt); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + data = (uint8_t *)smb_buf(req->outbuf); /* diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index e3a3766239..1b156b2acc 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -860,6 +860,8 @@ void reply_tcon_and_X(struct smb_request *req) } } + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ DEBUG(3,("tconX service=%s \n", service)); @@ -2035,6 +2037,9 @@ void reply_open_and_X(struct smb_request *req) reply_outbuf(req, 15, 0); } + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + if (core_oplock_request && lp_fake_oplocks(SNUM(conn))) { SCVAL(req->outbuf, smb_flg, CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED); @@ -2094,6 +2099,8 @@ void reply_ulogoffX(struct smb_request *req) invalidate_vuid(sconn, req->vuid); reply_outbuf(req, 2, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ DEBUG( 3, ( "ulogoffX vuid=%d\n", req->vuid ) ); @@ -3684,6 +3691,8 @@ normal_read: nosendfile_read: reply_outbuf(req, 12, smb_maxcnt); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ nread = read_file(fsp, smb_buf(req->outbuf), startpos, smb_maxcnt); saved_errno = errno; @@ -4628,6 +4637,8 @@ void reply_write_and_X(struct smb_request *req) } reply_outbuf(req, 6, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ SSVAL(req->outbuf,smb_vwv2,nwritten); SSVAL(req->outbuf,smb_vwv4,nwritten>>16); @@ -7835,6 +7846,8 @@ void reply_lockingX(struct smb_request *req) } reply_outbuf(req, 2, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ DEBUG(3, ("lockingX fnum=%d type=%d num_locks=%d num_ulocks=%d\n", fsp->fnum, (unsigned int)locktype, num_locks, num_ulocks)); diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index b2e1f2421f..cc801364cd 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -736,6 +736,9 @@ void reply_sesssetup_and_X(struct smb_request *req) /* it's ok - setup a reply */ reply_outbuf(req, 3, 0); + SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ + SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ + if (get_Protocol() >= PROTOCOL_NT1) { push_signature(&req->outbuf); /* perhaps grab OS version here?? */ -- cgit