Index | Thread | Search

From:
Piotr Durlej <pdurlej@cat4u.org>
Subject:
login: produce a meaningful diagnostic in case of an empty login name
To:
tech@openbsd.org
Date:
Fri, 17 Jul 2026 18:45:47 +0200

Download raw body.

Thread
  • Piotr Durlej:

    login: produce a meaningful diagnostic in case of an empty login name

Hello,

login(1) produces an "Invalid argument" diagnostic in case of an empty login
name as well - here's a patch:

---
 usr.bin/login/login.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 3f2155e7d0b..14e5cf1af3d 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -371,6 +371,9 @@ main(int argc, char *argv[])
 			auth_setoption(as, "remote_addr", ripaddr);
 	}
 
+	if (!*username)
+		errx(1, "empty login name");
+
 	/*
 	 * Request that things like the approval script print things
 	 * to stdout (in particular, the nologins files)
-- 
2.53.0