summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/authenticate.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2001-06-24 21:18:14 +0000
committermillert <millert@openbsd.org>2001-06-24 21:18:14 +0000
commit08b57e3d241b2052ee2c211bf1f574e07d4433f4 (patch)
treee8b5f6114ef681c5ebeefd36c522eeef6580063c /lib/libc/gen/authenticate.c
parentwrong place for cold (diff)
downloadwireguard-openbsd-08b57e3d241b2052ee2c211bf1f574e07d4433f4.tar.xz
wireguard-openbsd-08b57e3d241b2052ee2c211bf1f574e07d4433f4.zip
When splitting instance from username, treat '/' as a separator as
well (for Kerb5).
Diffstat (limited to 'lib/libc/gen/authenticate.c')
-rw-r--r--lib/libc/gen/authenticate.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c
index c40b12063bd..e21b74fe541 100644
--- a/lib/libc/gen/authenticate.c
+++ b/lib/libc/gen/authenticate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authenticate.c,v 1.2 2001/06/03 19:55:57 millert Exp $ */
+/* $OpenBSD: authenticate.c,v 1.3 2001/06/24 21:18:15 millert Exp $ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -286,7 +286,7 @@ auth_usercheck(char *name, char *style, char *type, char *password)
auth_session_t *as;
login_cap_t *lc;
struct passwd *pwd;
- char *dot;
+ char *sep, save;
if (strlen(name) >= sizeof(namebuf))
return (NULL);
@@ -300,15 +300,16 @@ auth_usercheck(char *name, char *style, char *type, char *password)
*style++ = '\0';
/*
- * Cope with user.instance. We are only using this to get
- * the class so it is okay if we strip a .root instance
+ * Cope with user[./]instance. We are only using this to get
+ * the class so it is okay if we strip a root instance
* The actual login script will pay attention to the instance.
*/
if ((pwd = getpwnam(name)) == NULL) {
- if ((dot = strchr(name, '.')) != NULL) {
- dot = '\0';
+ if ((sep = strpbrk(name, "./")) != NULL) {
+ save = *sep;
+ *sep = '\0';
pwd = getpwnam(name);
- *dot = '.';
+ *sep = save;
}
}
if ((lc = login_getclass(pwd ? pwd->pw_class : NULL)) == NULL)
@@ -338,6 +339,7 @@ int
auth_userokay(char *name, char *style, char *type, char *password)
{
auth_session_t *as;
+
as = auth_usercheck(name, style, type, password);
return (as != NULL ? auth_close(as) : 0);
@@ -350,7 +352,7 @@ auth_userchallenge(char *name, char *style, char *type, char **challengep)
auth_session_t *as;
login_cap_t *lc;
struct passwd *pwd;
- char *dot;
+ char *sep, save;
if (strlen(name) >= sizeof(namebuf))
return (NULL);
@@ -364,15 +366,16 @@ auth_userchallenge(char *name, char *style, char *type, char **challengep)
*style++ = '\0';
/*
- * Cope with user.instance. We are only using this to get
- * the class so it is okay if we strip a .root instance
+ * Cope with user[./]instance. We are only using this to get
+ * the class so it is okay if we strip a root instance
* The actual login script will pay attention to the instance.
*/
if ((pwd = getpwnam(name)) == NULL) {
- if ((dot = strchr(name, '.')) != NULL) {
- dot = '\0';
+ if ((sep = strpbrk(name, "./")) != NULL) {
+ save = *sep;
+ *sep = '\0';
pwd = getpwnam(name);
- *dot = '.';
+ *sep = save;
}
}
if ((lc = login_getclass(pwd ? pwd->pw_class : NULL)) == NULL)