mirror of
https://github.com/samba-team/samba.git
synced 2025-02-14 01:57:53 +03:00
fix for UNICODE plaintext passwords (bug #59) and fix smbclient to send the unicode plain text password if negoitated
This commit is contained in:
parent
dbe711f0fa
commit
207186e1c8
@ -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);
|
||||
|
@ -620,8 +620,11 @@ 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), passlen1, STR_TERMINATE);
|
||||
sizeof(pass), unic ? passlen2 : passlen1,
|
||||
STR_TERMINATE);
|
||||
plaintext_password = data_blob(pass, strlen(pass)+1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user