allow empty username, and determine using pname_to_uid
[openssh.git] / auth.c
diff --git a/auth.c b/auth.c
index 33680b9..ba27ec0 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -275,7 +275,8 @@ auth_log(Authctxt *authctxt, int authenticated, char *method, char *info)
            authmsg,
            method,
            authctxt->valid ? "" : "invalid user ",
-           authctxt->user,
+           (authctxt->user && authctxt->user[0]) ?
+               authctxt->user : "unknown",
            get_remote_ipaddr(),
            get_remote_port(),
            info);
@@ -587,7 +588,8 @@ getpwnamallow(const char *user)
 #endif
        if (pw == NULL) {
                logit("Invalid user %.100s from %.100s",
-                   user, get_remote_ipaddr());
+                     (user && user[0]) ? user : "unknown",
+                     get_remote_ipaddr());
 #ifdef CUSTOM_FAILED_LOGIN
                record_failed_login(user,
                    get_canonical_hostname(options.use_dns), "ssh");