mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:libsmb: let cli_tree_connect_creds() only call cli_credentials_get_password() if needed
Only legacy protocols need a password for share level authentication, so avoid triggering the password prompt for the common case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15018 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Apr 23 15:21:38 UTC 2024 on atb-devel-224
This commit is contained in:
parent
aff2932c42
commit
2674df4cc0
@ -2424,9 +2424,25 @@ NTSTATUS cli_tree_connect_creds(struct cli_state *cli,
|
||||
const char *share, const char *dev,
|
||||
struct cli_credentials *creds)
|
||||
{
|
||||
bool need_pass = false;
|
||||
const char *pw = NULL;
|
||||
|
||||
if (creds != NULL) {
|
||||
/*
|
||||
* We should work out if the protocol
|
||||
* will make use of a password for share level
|
||||
* authentication before we may cause
|
||||
* the password prompt to be called.
|
||||
*/
|
||||
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
|
||||
uint16_t sec_mode = smb1cli_conn_server_security_mode(cli->conn);
|
||||
|
||||
/* in user level security don't send a password now */
|
||||
if (!(sec_mode & NEGOTIATE_SECURITY_USER_LEVEL)) {
|
||||
need_pass = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_pass && creds != NULL) {
|
||||
pw = cli_credentials_get_password(creds);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user