On Fri, 13 Dec 2019 22:37:31 +0200, Dennis Lindroos wrote:

> If the user argument has the ":style" suffix attached to it then
> getpwnam(user) will return a NULL pointer.
> I tried just using strsep(3) to strip off the auth style and it works for
> me (this is probably not the safest bit of coding but i'm sure you figure
> out).

I think this is a safer approach.

 - todd

Index: usr.sbin/radiusd/radiusd_bsdauth.c
===================================================================
RCS file: /cvs/src/usr.sbin/radiusd/radiusd_bsdauth.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 radiusd_bsdauth.c
--- usr.sbin/radiusd/radiusd_bsdauth.c  3 Dec 2019 17:45:02 -0000       1.13
+++ usr.sbin/radiusd/radiusd_bsdauth.c  14 Dec 2019 15:14:29 -0000
@@ -189,6 +189,7 @@ main(int argc, char *argv[])
                                group = user + args->userlen;
                                group[args->grouplen - 1] = '\0';
 
+                               user[strcspn(user, ":")] = '\0';
                                pw = getpwnam(user);
                                if (pw == NULL)
                                        goto invalid;

Reply via email to