s3:auth_sam: make sure we never handle empty usernames
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Jan 2020 15:17:30 +0000 (16:17 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 11 Feb 2020 07:51:23 +0000 (07:51 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14247

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 01b8374e7942141e7f6cbdec7623c981a008e4c1)

source3/auth/auth_sam.c

index 56f28ab94a67d5f1d700706f084fe43001554e19..e2c62f94d4895eb0dfbd8acd106434fcc9a229f1 100644 (file)
@@ -36,6 +36,12 @@ static NTSTATUS auth_sam_ignoredomain_auth(const struct auth_context *auth_conte
                return NT_STATUS_UNSUCCESSFUL;
        }
 
+       if (user_info->mapped.account_name == NULL ||
+           user_info->mapped.account_name[0] == '\0')
+       {
+               return NT_STATUS_NOT_IMPLEMENTED;
+       }
+
        DBG_DEBUG("Check auth for: [%s]\\[%s]\n",
                  user_info->mapped.domain_name,
                  user_info->mapped.account_name);
@@ -77,6 +83,12 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
                return NT_STATUS_LOGON_FAILURE;
        }
 
+       if (user_info->mapped.account_name == NULL ||
+           user_info->mapped.account_name[0] == '\0')
+       {
+               return NT_STATUS_NOT_IMPLEMENTED;
+       }
+
        DBG_DEBUG("Check auth for: [%s]\\[%s]\n",
                  user_info->mapped.domain_name,
                  user_info->mapped.account_name);
@@ -148,6 +160,12 @@ static NTSTATUS auth_sam_netlogon3_auth(const struct auth_context *auth_context,
                return NT_STATUS_LOGON_FAILURE;
        }
 
+       if (user_info->mapped.account_name == NULL ||
+           user_info->mapped.account_name[0] == '\0')
+       {
+               return NT_STATUS_NOT_IMPLEMENTED;
+       }
+
        DBG_DEBUG("Check auth for: [%s]\\[%s]\n",
                  user_info->mapped.domain_name,
                  user_info->mapped.account_name);