2012/4/1 Theo de Raadt <[email protected]>:
> You should really re-do that so that the login name cannot start or
> end with a '.'

Index: login_yubikey.c
===================================================================
RCS file: /cvs/src/libexec/login_yubikey/login_yubikey.c,v
retrieving revision 1.4
diff -u -r1.4 login_yubikey.c
--- login_yubikey.c     1 Feb 2012 16:07:28 -0000       1.4
+++ login_yubikey.c     1 Apr 2012 08:37:07 -0000
@@ -165,10 +165,15 @@
 static int
 clean_string(const char *s)
 {
+       int nlim, n = 0;
+
+       nlim = strlen(s) - 1;
        while (*s) {
-               if (!isalnum(*s) && *s != '-' && *s != '_')
+               if (!isalnum(*s) && *s != '-' && *s != '_' &&
+                   !(*s == '.' && !(n == 0 || n == nlim)))
                        return (0);
                ++s;
+               n++;
        }
        return (1);
 }

Reply via email to