Patch from Steve Langasek <vorlon@netexpress.net>.
authoraland <aland>
Tue, 24 Jul 2001 16:04:13 +0000 (16:04 +0000)
committeraland <aland>
Tue, 24 Jul 2001 16:04:13 +0000 (16:04 +0000)
Kick PAM into shape, so that the radius entries are sent to the
radius configuration, when using syslog.  PAM likes to re-do
openlog() with a different facility, which is not a nice thing
to do to people.

src/include/radiusd.h
src/main/radiusd.c
src/modules/rlm_pam/rlm_pam.c

index e29a8ba..607e9dd 100644 (file)
@@ -160,6 +160,7 @@ typedef int (*RAD_COMPARE_FUNC)(void *instance, VALUE_PAIR *, VALUE_PAIR *, VALU
  */
 extern const char      *progname;
 extern int             debug_flag;
+extern int             syslog_facility;
 extern const char      *radacct_dir;
 extern const char      *radlog_dir;
 extern const char      *radlib_dir;
index 45442ca..4f0edc6 100644 (file)
@@ -97,6 +97,7 @@ const char *radius_dir = NULL;
 const char *radacct_dir = NULL;
 const char *radlog_dir = NULL;
 const char *radlib_dir = NULL;
+int syslog_facility;
 int log_stripped_names;
 int debug_flag;
 int use_dbm = FALSE;
@@ -464,11 +465,11 @@ int main(int argc, char *argv[])
        int fd = 0;
        int devnull;
        int status;
-       int syslog_facility = LOG_DAEMON;
        int radius_port = 0;
        struct servent *svp;
        struct timeval *tv = NULL;
 
+       syslog_facility = LOG_DAEMON;
 #ifdef OSFC2
        set_auth_parameters(argc,argv);
 #endif
index a36fec8..23fc75c 100644 (file)
@@ -256,6 +256,13 @@ static int pam_auth(void *instance, REQUEST *request)
        r = pam_pass((char *)request->username->strvalue,
                     (char *)request->password->strvalue,
                     pam_auth_string);
+
+#if HAVE_SYSLOG_H
+       if (!strcmp(radlog_dir, "syslog")) {
+               openlog(progname, LOG_PID, syslog_facility);
+       }
+#endif
+
        if (r == 0) {
                return RLM_MODULE_OK;
        }