[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Mon Mar 5 09:39:02 MST 2012
The branch, master has been updated
via cae455f s3: Fix a "Invalid (state->nread >= 0)" warning
via 216769f s3: Move the drain_socket on error to reply_write_and_X
via 82b948a s3: Use "goto out;" in reply_write_and_X
from 07386bb s3: Remove "size" param from switch_message
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cae455f68802be2fa31328878be4119df1c1d864
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 5 15:56:55 2012 +0100
s3: Fix a "Invalid (state->nread >= 0)" warning
Both read_from_internal_pipe and tstream_readv_pdu_queue_recv return
ssize_t.
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Mon Mar 5 17:38:16 CET 2012 on sn-devel-104
commit 216769f2ce7d18a7ca83bf440b6efd7ad4675675
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 5 15:40:49 2012 +0100
s3: Move the drain_socket on error to reply_write_and_X
That's the only case where this can happen, so we should not clutter the main
code path.
commit 82b948a8160e3b5bb80238413967ed7f5798a35c
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 5 15:47:52 2012 +0100
s3: Use "goto out;" in reply_write_and_X
-----------------------------------------------------------------------
Summary of changes:
source3/rpc_server/srv_pipe_hnd.c | 2 +-
source3/smbd/process.c | 9 ---------
source3/smbd/reply.c | 36 ++++++++++++++++++------------------
3 files changed, 19 insertions(+), 28 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 3616922..e4172e7 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -687,7 +687,7 @@ struct np_read_state {
struct np_proxy_state *p;
struct np_ipc_readv_next_vector_state next_vector;
- size_t nread;
+ ssize_t nread;
bool is_data_outstanding;
};
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 15e1efe..f61ad5d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1521,15 +1521,6 @@ static void construct_reply(struct smbd_server_connection *sconn,
conn = switch_message(req->cmd, req);
- if (req->unread_bytes) {
- /* writeX failed. drain socket. */
- if (drain_socket(req->sconn->sock, req->unread_bytes) !=
- req->unread_bytes) {
- smb_panic("failed to drain pending bytes");
- }
- req->unread_bytes = 0;
- }
-
if (req->done) {
TALLOC_FREE(req);
return;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 26a928f..e3a3766 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4494,8 +4494,7 @@ void reply_write_and_X(struct smb_request *req)
if ((req->wct != 12) && (req->wct != 14)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
numtowrite = SVAL(req->vwv+10, 0);
@@ -4512,20 +4511,17 @@ void reply_write_and_X(struct smb_request *req)
/* Can't do a recvfile write on IPC$ */
if (IS_IPC(conn)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
if (numtowrite != req->unread_bytes) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
} else {
if (smb_doff > smblen || smb_doff + numtowrite < numtowrite ||
smb_doff + numtowrite > smblen) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
}
@@ -4533,12 +4529,10 @@ void reply_write_and_X(struct smb_request *req)
if (IS_IPC(conn)) {
if (req->unread_bytes) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
reply_pipe_write_and_X(req);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
fsp = file_fsp(req, SVAL(req->vwv+2, 0));
@@ -4546,14 +4540,12 @@ void reply_write_and_X(struct smb_request *req)
write_through = BITSETW(req->vwv+7,0);
if (!check_fsp(conn, req, fsp)) {
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
if (!CHECK_WRITE(fsp)) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
data = smb_base(req->inbuf) + smb_doff;
@@ -4576,8 +4568,7 @@ void reply_write_and_X(struct smb_request *req)
"used and we don't support 64 bit offsets.\n",
(unsigned int)IVAL(req->vwv+12, 0) ));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
- END_PROFILE(SMBwriteX);
- return;
+ goto out;
}
#endif /* LARGE_SMB_OFF_T */
@@ -4656,6 +4647,15 @@ void reply_write_and_X(struct smb_request *req)
return;
out:
+ if (req->unread_bytes) {
+ /* writeX failed. drain socket. */
+ if (drain_socket(req->sconn->sock, req->unread_bytes) !=
+ req->unread_bytes) {
+ smb_panic("failed to drain pending bytes");
+ }
+ req->unread_bytes = 0;
+ }
+
END_PROFILE(SMBwriteX);
return;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list