* configure.in: Don't check for getpwuid_r here.
authorKen Raeburn <raeburn@mit.edu>
Sat, 26 Mar 2005 02:06:43 +0000 (02:06 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 26 Mar 2005 02:06:43 +0000 (02:06 +0000)
* prof_file.c (profile_open_file): Use k5_getpwuid_r.

ticket: 2982
status: open

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17158 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/ChangeLog
src/util/profile/configure.in
src/util/profile/prof_file.c

index c2d47942f481cb6f4d609ac48d9e16e384db844c..de8cb0e78485148ca747bf36c9e5fdd1fd7a6bcf 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-25  Ken Raeburn  <raeburn@mit.edu>
+
+       * configure.in: Don't check for getpwuid_r here.
+       * prof_file.c (profile_open_file): Use k5_getpwuid_r.
+
 2005-03-13  Ken Raeburn  <raeburn@mit.edu>
 
        * configure.in: Check struct stat for fields st_mtimensec,
index 0164540d763b024f5d75ee0f5bbaed1c19c6c6ae..5e04820b7e4366f82c82ea68a91de0a229299e35 100644 (file)
@@ -5,7 +5,7 @@ AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_HEADERS(unistd.h stdlib.h pwd.h)
-AC_CHECK_FUNCS(stat access strdup getpwuid_r)
+AC_CHECK_FUNCS(stat access strdup)
 AC_CHECK_MEMBERS([struct stat.st_mtimensec,struct stat.st_mtimespec.tv_nsec,struct stat.st_mtim.tv_nsec],,,[#include <sys/types.h>
 #include <sys/stat.h>])
 AC_PROG_AWK
index 004c3efd7466c4ffdea20e11f790031013619a36..f31347c3747b6abbf71117795e6d5cf8e357344f 100644 (file)
@@ -213,25 +213,12 @@ errcode_t profile_open_file(const_profile_filespec_t filespec,
 #ifdef HAVE_PWD_H
                if (home_env == NULL) {
                    uid_t uid;
-                   struct passwd *pw;
-#ifdef HAVE_GETPWUID_R
-                   struct passwd pwx;
+                   struct passwd *pw, pwx;
                    char pwbuf[BUFSIZ];
-#endif
 
                    uid = getuid();
-#ifndef HAVE_GETPWUID_R
-                   pw = getpwuid(uid);
-#elif defined(GETPWUID_R_4_ARGS)
-                   /* earlier POSIX drafts */
-                   pw = getpwuid_r(uid, &pwx, pwbuf, sizeof(pwbuf));
-#else
-                   /* POSIX */
-                   if (getpwuid_r(uid, &pwx, pwbuf, sizeof(pwbuf), &pw) != 0)
-                       /* Probably already null, but let's make sure.  */
-                       pw = NULL;
-#endif /* getpwuid variants */
-                   if (pw != NULL && pw->pw_dir[0] != 0)
+                   if (!k5_getpwuid_r(uid, &pwx, pwbuf, sizeof(pwbuf), &pw)
+                       && pw != NULL && pw->pw_dir[0] != 0)
                        home_env = pw->pw_dir;
                }
 #endif