diff options
author | Jeremy Allison <jra@samba.org> | 2003-12-12 22:54:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-12-12 22:54:41 +0000 |
commit | 7ec4ae7544162eb7c49b16515bed00ff21da797a (patch) | |
tree | 064e815331a5ba5b1c8ac4ac721322614b265741 /source3/smbd/sesssetup.c | |
parent | 3bdde6f8450f1f1f28dec38c0607ca2cb49d677b (diff) | |
download | samba-7ec4ae7544162eb7c49b16515bed00ff21da797a.tar.gz samba-7ec4ae7544162eb7c49b16515bed00ff21da797a.tar.bz2 samba-7ec4ae7544162eb7c49b16515bed00ff21da797a.zip |
Fix for bug #815. Make plaintext unicode passwords work with NT4.x
Jeremy.
(This used to be commit 29bac18b6971f459c3cb138366ae493d5805f643)
Diffstat (limited to 'source3/smbd/sesssetup.c')
-rw-r--r-- | source3/smbd/sesssetup.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index da48c81fc1..e9cfa47d0c 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -689,11 +689,17 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf, nt_resp = data_blob(p+passlen1, passlen2); } else { pstring pass; - BOOL unic; - unic=SVAL(inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS; - srvstr_pull(inbuf, pass, smb_buf(inbuf), - sizeof(pass), unic ? passlen2 : passlen1, - STR_TERMINATE); + BOOL unic=SVAL(inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS; + + if ((ra_type == RA_WINNT) && (passlen2 == 0) && unic && passlen1) { + /* NT4.0 stuffs up plaintext unicode password lengths... */ + srvstr_pull(inbuf, pass, smb_buf(inbuf) + 1, + sizeof(pass), passlen1, STR_TERMINATE); + } else { + srvstr_pull(inbuf, pass, smb_buf(inbuf), + sizeof(pass), unic ? passlen2 : passlen1, + STR_TERMINATE); + } plaintext_password = data_blob(pass, strlen(pass)+1); } |