diff options
author | Ken Raeburn <raeburn@mit.edu> | 2004-06-04 20:29:22 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2004-06-04 20:29:22 +0000 |
commit | ef0cef40abae03d70812cef6d4451c1fa9d782c7 (patch) | |
tree | 8e209bcbfd1e0edf6079b95bdba60c7cb2e451b0 /src | |
parent | 141482616bd7019c763b54afad65601f291fb395 (diff) | |
download | krb5-ef0cef40abae03d70812cef6d4451c1fa9d782c7.tar.gz krb5-ef0cef40abae03d70812cef6d4451c1fa9d782c7.tar.xz krb5-ef0cef40abae03d70812cef6d4451c1fa9d782c7.zip |
* kuserok.c (krb5_kuserok): Handle draft POSIX versions of getpwnam_r
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16409 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/krb5/os/ChangeLog | 5 | ||||
-rw-r--r-- | src/lib/krb5/os/kuserok.c | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index a0d6496551..07ab6ee095 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +2004-06-04 Ken Raeburn <raeburn@mit.edu> + + * kuserok.c (krb5_kuserok): Handle draft POSIX versions of + getpwnam_r. + 2004-06-02 Tom Yu <tlyu@mit.edu> * an_to_ln.c (do_replacement): Patch from Bill Dodd to fix missing 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)); |