diff options
author | Gerald Carter <jerry@samba.org> | 2003-05-21 16:12:07 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-05-21 16:12:07 +0000 |
commit | c52ee09afe06dce29118356078cc4c26b126afc6 (patch) | |
tree | d5f297b2f0cb0a2709bb83359ab2274118131745 /source3/libsmb | |
parent | 7c11c9fd550c904c294981ad4c112eb94c63d7dd (diff) | |
download | samba-c52ee09afe06dce29118356078cc4c26b126afc6.tar.gz samba-c52ee09afe06dce29118356078cc4c26b126afc6.tar.bz2 samba-c52ee09afe06dce29118356078cc4c26b126afc6.zip |
fix for UNICODE plaintext passwords (bug #59) and fix smbclient to send the unicode plain text password if negoitated
(This used to be commit e7d635af80c844f17ff9f34c26c1e9c978951ce1)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cliconnect.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 154a7cae58..8ebac7bae7 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -188,6 +188,9 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user, { uint32 capabilities = cli_session_setup_capabilities(cli); char *p; + fstring lanman; + + snprintf( lanman, sizeof(lanman), "Samba %s", VERSION ); set_message(cli->outbuf,13,0,True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); @@ -201,12 +204,22 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user, SSVAL(cli->outbuf,smb_vwv8,0); SIVAL(cli->outbuf,smb_vwv11,capabilities); p = smb_buf(cli->outbuf); - p += clistr_push(cli, p, pass, -1, STR_TERMINATE); /* password */ - SSVAL(cli->outbuf,smb_vwv7,PTR_DIFF(p, smb_buf(cli->outbuf))); + + /* check wether to send the ASCII or UNICODE version of the password */ + + 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 { + 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))); + } + p += clistr_push(cli, p, user, -1, STR_TERMINATE); /* username */ p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE); /* workgroup */ p += clistr_push(cli, p, "Unix", -1, STR_TERMINATE); - p += clistr_push(cli, p, "Samba", -1, STR_TERMINATE); + p += clistr_push(cli, p, lanman, -1, STR_TERMINATE); cli_setup_bcc(cli, p); cli_send_smb(cli); |