summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-04-04 15:28:18 -0700
committerJeremy Allison <jra@samba.org>2008-04-04 15:28:18 -0700
commita11835a3c01aaa6e0a59a78ff7862a8a3910705d (patch)
treee2794fb6d6db721d808a9afe9fc9e9e3cdf9feb6 /source
parentbfc99dcfe6f592477b8f62adbb1e1a7baec65dcd (diff)
downloadsamba-a11835a3c01aaa6e0a59a78ff7862a8a3910705d.tar.gz
When using plaintext ucs2 passwords clistr_push calls ucs2_align, which causes
the space taken by the unicode password to be one byte too long (as we're on an odd byte boundary here). Reduce the count by 1 to cope with this. Fixes smbclient against NetApp servers which can't cope. Fix from bryan.kolodziej@allenlund.com in bug #3840. Jeremy.
Diffstat (limited to 'source')
-rw-r--r--source/libsmb/cliconnect.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 42e0b635117..ce9e7fa2236 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -249,10 +249,16 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli,
if ( (capabilities & CAP_UNICODE) == 0 ) {
p += clistr_push(cli, p, pass, -1, STR_TERMINATE); /* password */
SSVAL(cli->outbuf,smb_vwv7,PTR_DIFF(p, smb_buf(cli->outbuf)));
- }
- else {
+ } else {
+ /* For ucs2 passwords clistr_push calls ucs2_align, which causes
+ * the space taken by the unicode password to be one byte too
+ * long (as we're on an odd byte boundary here). Reduce the
+ * count by 1 to cope with this. Fixes smbclient against NetApp
+ * servers which can't cope. Fix from
+ * bryan.kolodziej@allenlund.com in bug #3840.
+ */
p += clistr_push(cli, p, pass, -1, STR_UNICODE|STR_TERMINATE); /* unicode password */
- SSVAL(cli->outbuf,smb_vwv8,PTR_DIFF(p, smb_buf(cli->outbuf)));
+ SSVAL(cli->outbuf,smb_vwv8,PTR_DIFF(p, smb_buf(cli->outbuf))-1);
}
p += clistr_push(cli, p, user, -1, STR_TERMINATE); /* username */
@@ -1026,7 +1032,6 @@ NTSTATUS cli_session_setup(struct cli_state *cli,
}
return NT_STATUS_OK;
-
}
/****************************************************************************