Skip to content

Commit

Permalink
wbinfo: avoid segfault in wbinfo_auth_crap() if winbindd is not avail…
Browse files Browse the repository at this point in the history
…able

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13256

Signed-off-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
  • Loading branch information
metze-samba authored and slowfranklin committed Feb 10, 2018
1 parent b112cbc commit 8b0e1a7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nsswitch/wbinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,13 +1798,22 @@ static bool wbinfo_auth_crap(char *username, bool use_ntlmv2, bool use_lanman)
if (use_ntlmv2) {
DATA_BLOB server_chal;
DATA_BLOB names_blob;
const char *netbios_name = NULL;
const char *domain = NULL;

netbios_name = get_winbind_netbios_name(),
domain = get_winbind_domain();
if (domain == NULL) {
d_fprintf(stderr, "Failed to get domain from winbindd\n");
return false;
}

server_chal = data_blob(params.password.response.challenge, 8);

/* Pretend this is a login to 'us', for blob purposes */
names_blob = NTLMv2_generate_names_blob(NULL,
get_winbind_netbios_name(),
get_winbind_domain());
netbios_name,
domain);

if (pass != NULL &&
!SMBNTLMv2encrypt(NULL, name_user, name_domain, pass,
Expand Down

0 comments on commit 8b0e1a7

Please sign in to comment.