$NetBSD: patch-am,v 1.4 2002/12/23 21:23:59 jlam Exp $ --- modules/pam_issue/pam_issue.c.orig Sun Nov 11 21:23:29 2001 +++ modules/pam_issue/pam_issue.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -244,12 +245,24 @@ char *do_prompt(FILE *fd) case 'U': { int users = 0; +#if (defined(BSD) && BSD >= 199306) + struct utmp ut; + FILE *uf; + + if ((uf == fopen(_PATH_UTMP, "r")) != NULL) { + while (fread(&ut, sizeof(ut), 1, uf) > 0) + if (ut.ut_name[0] != '\0') + ++users; + (void) fclose(uf); + } +#else struct utmp *ut; setutent(); while ((ut = getutent())) if (ut->ut_type == USER_PROCESS) users++; endutent(); +#endif printf ("%d ", users); if (c == 'U') snprintf (buf, 1024, "%s", (users == 1) ?