diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-02-04 22:48:01 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2018-02-11 11:12:09 +0100 |
commit | c549aa4f1d89c30fd9af49627182b402d406a472 (patch) | |
tree | 341187ca0ee2fa38e3b7765d906e18dc228bdfd0 /nsswitch | |
parent | 2fae4128318004354135d2a7d570855eab114d60 (diff) | |
download | samba-c549aa4f1d89c30fd9af49627182b402d406a472.tar.gz |
wbinfo: avoid segfault in wbinfo_auth_crap() if winbindd is not available
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13256
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 8b0e1a77ae5f7ef6d8db9a05718afa8d472a971b)
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/wbinfo.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index 54d5758aa6c..82863c26760 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -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, |