s3: winbind: Prevent null ptr access by returning error if no creds available
authorNoel Power <noel.power@suse.com>
Thu, 22 Oct 2015 11:37:17 +0000 (12:37 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 4 Nov 2015 21:15:24 +0000 (22:15 +0100)
Prevent rpccli_netlogon_network_logon/rpccli_netlogon_password_logon
being called with 'NULL' credentials

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11569

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/winbindd/winbindd_pam.c

index 0ea146b6804226732c3e290ff35b784754011ff6..78b262505432fecfd0545247240feedaef26c06c 100644 (file)
@@ -1379,8 +1379,11 @@ static NTSTATUS winbind_samlogon_retry_loop(struct winbindd_domain *domain,
                        return result;
                }
                netr_attempts = 0;
-
-               if (interactive && username != NULL && password != NULL) {
+               if (domain->conn.netlogon_creds == NULL) {
+                       DBG_NOTICE("No security credentials available for "
+                                 "domain [%s]\n", domainname);
+                       result = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+               } else if (interactive && username != NULL && password != NULL) {
                        result = rpccli_netlogon_password_logon(domain->conn.netlogon_creds,
                                                                netlogon_pipe->binding_handle,
                                                                mem_ctx,