* openbsd doesn't like pam. so... if we don't have the calls don't use 'em
authorWilfried Göesgens <willi@citadel.org>
Thu, 10 Jan 2008 00:09:28 +0000 (00:09 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 10 Jan 2008 00:09:28 +0000 (00:09 +0000)
citadel/citadel.c
citadel/configure.ac
citadel/server_main.c
citadel/user_ops.c

index edd981cb3bb773101f87c9cee7af875e7b45d1d6..700c732f21d00da4e9501855a282dd5d2a322ed9 100644 (file)
@@ -2341,3 +2341,4 @@ TERMN8:   scr_printf("%s logged out.", fullname);
        goto GSTA;
 
 }      /* end main() */
+
index 4880fd3064c86a272bd86a9ffb844b259ad1a1e1..cb7ed9be863357c5004bf0ca36e52cfcdede4b57 100644 (file)
@@ -308,7 +308,7 @@ dnl Checks for libraries.
 dnl We want to test for the following in libc before checking for their
 dnl respective libraries, because some systems (like Irix) have both, and the
 dnl non-libc versions may be broken.
-AC_CHECK_FUNCS(crypt gethostbyname connect flock)
+AC_CHECK_FUNCS(crypt gethostbyname connect flock getpwnam_r getpwuid_r)
 
 
 dnl disable backtrace if we don't want it.
index d9c6d17e8b98f864364ed4c4f20273c2f5ef16e6..a63564d17be70a6b0a63569bc6cb504c5dd8b28f 100644 (file)
@@ -229,11 +229,15 @@ int main(int argc, char **argv)
        /* on some dists rundir gets purged on startup. so we need to recreate it. */
 
        if (stat(ctdl_run_dir, &filestats)==-1){
+#ifdef HAVE_GETPWUID_R
 #ifdef SOLARIS_GETPWUID
                pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
-#else
+#else // SOLARIS_GETPWUID
                getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
-#endif
+#endif // SOLARIS_GETPWUID
+#else // HAVE_GETPWUID_R
+               pwp = NULL;
+#endif // HAVE_GETPWUID_R
                mkdir(ctdl_run_dir, 0755);
                chown(ctdl_run_dir, config.c_ctdluid, (pwp==NULL)?-1:pw.pw_gid);
        }
@@ -304,11 +308,16 @@ int main(int argc, char **argv)
        if (drop_root_perms) {
                cdb_chmod_data();       /* make sure we own our data files */
 
+#ifdef HAVE_GETPWUID_R
 #ifdef SOLARIS_GETPWUID
                pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
-#else
+#else // SOLARIS_GETPWUID
                getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
-#endif
+#endif // SOLARIS_GETPWUID
+#else // HAVE_GETPWUID_R
+               pwp = NULL;
+#endif // HAVE_GETPWUID_R
+
                if (pwp == NULL)
                        CtdlLogPrintf(CTDL_CRIT, "WARNING: getpwuid(%ld): %s\n"
                                   "Group IDs will be incorrect.\n", (long)CTDLUID,
index 67eab32fc218bccbeb03e461efa2559e4468b5ea..a144fc0d28b700f961c0d550f5ff6f3f9f9d49b5 100644 (file)
@@ -390,11 +390,15 @@ int CtdlLoginExistingUser(char *authname, char *trythisname)
                char pwdbuffer[256];
        
                lprintf(CTDL_DEBUG, "asking host about <%s>\n", username);
+#ifdef HAVE_GETPWNAM_R
 #ifdef SOLARIS_GETPWUID
                tempPwdPtr = getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer);
-#else
+#else // SOLARIS_GETPWUID
                getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer, &tempPwdPtr);
-#endif
+#endif // SOLARIS_GETPWUID
+#else // HAVE_GETPWNAM_R
+               tempPwdPtr = NULL;
+#endif // HAVE_GETPWNAM_R
                if (tempPwdPtr == NULL) {
                        return login_not_found;
                }
@@ -876,11 +880,15 @@ int create_user(char *newusername, int become_user)
                struct passwd *tempPwdPtr;
                char pwdbuffer[256];
        
+#ifdef HAVE_GETPWNAM_R
 #ifdef SOLARIS_GETPWUID
                tempPwdPtr = getpwnam_r(username, &pd, pwdbuffer, sizeof(pwdbuffer));
-#else
+#else // SOLARIS_GETPWUID
                getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer, &tempPwdPtr);
-#endif
+#endif // SOLARIS_GETPWUID
+#else // HAVE_GETPWNAM_R
+               tempPwdPtr = NULL;
+#endif // HAVE_GETPWNAM_R
                if (tempPwdPtr != NULL) {
                        extract_token(username, pd.pw_gecos, 0, ',', sizeof username);
                        uid = pd.pw_uid;