diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-05 11:12:56 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-05 11:12:56 -0800 |
commit | 36441da4240f3e3a296eed65f0796b25b7b05a3a (patch) | |
tree | 3399982fb4f83b11d5b1258a49ea1b78725bb832 /source3/libsmb | |
parent | 8f13ba45686f0f8c3415143246fba44e81fe8a73 (diff) | |
download | samba-36441da4240f3e3a296eed65f0796b25b7b05a3a.tar.gz samba-36441da4240f3e3a296eed65f0796b25b7b05a3a.tar.bz2 samba-36441da4240f3e3a296eed65f0796b25b7b05a3a.zip |
Remove the horror that was the global smb_rw_error.
Each cli struct has it's own local copy of this variable,
so use that in client code. In the smbd server, add one
static to smbd/proccess.c and use that inside smbd. Fix
a bunch of places where smb_rw_error could be set by
calling read_data() in places where we weren't reading
from the SMB client socket (ie. winbindd).
Jeremy.
(This used to be commit 255c2adf7b6ef30932b5bb9f142ccef4a5d3d0db)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clientgen.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 0a8ff4e552..ee1a0fe3db 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -52,24 +52,26 @@ int cli_set_port(struct cli_state *cli, int port) should never go into a blocking read. ****************************************************************************/ -static ssize_t client_receive_smb(int fd,char *buffer, unsigned int timeout, size_t maxlen) +static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen) { ssize_t len; for(;;) { - len = receive_smb_raw(fd, buffer, timeout, maxlen); + len = receive_smb_raw(cli->fd, cli->inbuf, cli->timeout, + maxlen, &cli->smb_rw_error); if (len < 0) { DEBUG(10,("client_receive_smb failed\n")); - show_msg(buffer); + show_msg(cli->inbuf); return len; } /* Ignore session keepalive packets. */ - if(CVAL(buffer,0) != SMBkeepalive) + if(CVAL(cli->inbuf,0) != SMBkeepalive) { break; + } } - show_msg(buffer); + show_msg(cli->inbuf); return len; } @@ -86,7 +88,7 @@ bool cli_receive_smb(struct cli_state *cli) return False; again: - len = client_receive_smb(cli->fd,cli->inbuf,cli->timeout, 0); + len = client_receive_smb(cli, 0); if (len > 0) { /* it might be an oplock break request */ @@ -110,7 +112,6 @@ bool cli_receive_smb(struct cli_state *cli) /* If the server is not responding, note that now */ if (len < 0) { DEBUG(0, ("Receiving SMB: Server stopped responding\n")); - cli->smb_rw_error = get_smb_read_error(); close(cli->fd); cli->fd = -1; return False; @@ -154,9 +155,10 @@ bool cli_receive_smb(struct cli_state *cli) ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len) { if (cli->timeout > 0) { - return read_socket_with_timeout(cli->fd, buffer, len, len, cli->timeout); + return read_socket_with_timeout(cli->fd, buffer, len, + len, cli->timeout, &cli->smb_rw_error); } else { - return read_data(cli->fd, buffer, len); + return read_data(cli->fd, buffer, len, &cli->smb_rw_error); } } @@ -174,7 +176,7 @@ bool cli_receive_smb_readX_header(struct cli_state *cli) again: /* Read up to the size of a readX header reply. */ - len = client_receive_smb(cli->fd, cli->inbuf, cli->timeout, (smb_size - 4) + 24); + len = client_receive_smb(cli, (smb_size - 4) + 24); if (len > 0) { /* it might be an oplock break request */ @@ -240,7 +242,6 @@ bool cli_receive_smb_readX_header(struct cli_state *cli) read_err: - set_smb_read_error(SMB_READ_ERROR); cli->smb_rw_error = SMB_READ_ERROR; close(cli->fd); cli->fd = -1; |