changeset 2672:e2b8702fcdf6 HEAD

Don't allow empty usernames. Solaris PAM seems to eat all memory with them.
author Timo Sirainen <tss@iki.fi>
date Sun, 26 Sep 2004 18:51:57 +0300
parents 3b70ddb51771
children 5f2c5b65b0cd
files src/auth/mech.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/mech.c	Sun Sep 26 17:15:54 2004 +0300
+++ b/src/auth/mech.c	Sun Sep 26 18:51:57 2004 +0300
@@ -257,6 +257,12 @@
 {
 	unsigned char *p;
 
+	if (*username == '\0') {
+		/* Some PAM plugins go nuts with empty usernames */
+		*error_r = "Empty username";
+		return FALSE;
+	}
+
 	for (p = (unsigned char *)username; *p != '\0'; p++) {
 		if (username_translation[*p & 0xff] != 0)
 			*p = username_translation[*p & 0xff];