diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-06-21 09:10:42 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-06-21 09:10:42 +0000 |
commit | 91b8a8d1d21b810b6aca44ce647837669efd6dcf (patch) | |
tree | 2490cec37a9ae7f9f9ad9adabac033b41e26c07b /source3/libsmb | |
parent | 4ff011d88ef5b79b92d2cea1abe32c93bc03f724 (diff) | |
download | samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.tar.gz samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.tar.bz2 samba-91b8a8d1d21b810b6aca44ce647837669efd6dcf.zip |
next_token() was supposed to be a reentrant replacement for strtok(),
but the code suffered from bitrot and is not now reentrant. That means
we can get bizarre behaviour
i've fixed this by making next_token() reentrant and creating a
next_token_nr() that is a small non-reentrant wrapper for those lumps
of code (mostly smbclient) that have come to rely on the non-reentrant
behaviour
(This used to be commit 674ee2f1d12b0afc164a9e9072758fd1c5e54df7)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clireadwrite.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 6c52d2b776..9ee63270df 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -139,9 +139,9 @@ static void cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 memset(cli->inbuf,'\0',smb_size); if (size > 0xFFFF) - set_message(cli->outbuf,14,size,True); + set_message(cli->outbuf,14,0,True); else - set_message(cli->outbuf,12,size,True); + set_message(cli->outbuf,12,0,True); CVAL(cli->outbuf,smb_com) = SMBwriteX; SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -162,6 +162,7 @@ static void cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11); memcpy(p, buf, size); + cli_setup_bcc(cli, p+size); SSVAL(cli->outbuf,smb_mid,cli->mid + i); @@ -240,7 +241,7 @@ ssize_t cli_smbwrite(struct cli_state *cli, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,5, 3 + size,True); + set_message(cli->outbuf,5, 0,True); CVAL(cli->outbuf,smb_com) = SMBwrite; SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -253,8 +254,10 @@ ssize_t cli_smbwrite(struct cli_state *cli, p = smb_buf(cli->outbuf); *p++ = 1; - SSVAL(p, 0, size); - memcpy(p+2, buf, size); + SSVAL(p, 0, size); p += 2; + memcpy(p, buf, size); p += size; + + cli_setup_bcc(cli, p); cli_send_smb(cli); if (!cli_receive_smb(cli)) { |