diff options
Diffstat (limited to 'src/lib/krb5/os/kuserok.c')
-rw-r--r-- | src/lib/krb5/os/kuserok.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/krb5/os/kuserok.c b/src/lib/krb5/os/kuserok.c index bc4f824126..b87b528d10 100644 --- a/src/lib/krb5/os/kuserok.c +++ b/src/lib/krb5/os/kuserok.c @@ -74,9 +74,22 @@ krb5_kuserok(krb5_context context, krb5_principal principal, const char *luser) int gobble; /* no account => no access */ - if ((pwd = getpwnam(luser)) == NULL) { +#ifdef HAVE_GETPWNAM_R + char pwbuf[BUFSIZ]; + struct passwd pwx; +#if !defined(GETPWNAM_R_4_ARGS) + /* POSIX */ + if (getpwnam_r(luser, &pwx, pwbuf, sizeof(pwbuf), &pwd) != 0) + pwd = NULL; +#else + /* draft POSIX */ + pwd = getpwnam_r(luser, &pwx, pwbuf, sizeof(pwbuf)); +#endif +#else + pwd = getpwnam(luser); +#endif + if (pwd == NULL) return(FALSE); - } (void) strncpy(pbuf, pwd->pw_dir, sizeof(pbuf) - 1); pbuf[sizeof(pbuf) - 1] = '\0'; (void) strncat(pbuf, "/.k5login", sizeof(pbuf) - 1 - strlen(pbuf)); |