Add config option PidFile.
authorLinus Nordberg <linus@nordu.net>
Wed, 11 Apr 2012 15:08:42 +0000 (17:08 +0200)
committerLinus Nordberg <linus@nordu.net>
Wed, 11 Apr 2012 15:08:42 +0000 (17:08 +0200)
Note that `-i' on the command line overrides this config option.

This closes RADSECPROXY-32.

README
radsecproxy.c
radsecproxy.conf.5.xml
radsecproxy.h

diff --git a/README b/README
index ea70ae4..d7bc627 100644 (file)
--- a/README
+++ b/README
@@ -24,13 +24,14 @@ instructions, please see the enclosed example file and the
 documentation at
 http://software.uninett.no/radsecproxy/?page=documentation
 
-There are five options that may be specified on the command line:
+The following options may be specified on the command line:
 "-c configfile" to specify a non-default config file path.
 "-d loglevel" to set a loglevel of 1, 2, 3, 4 and 5 where 5 is the
               most detailed.
 "-f" to run the proxy in the foreground with logging to stderr.
      Without "-f" the default is to detach as a daemon and log to
      syslog.
+"-i pidfile" to name a file to which the PID is written.
 "-v" just prints version information and exits.
 "-p" (pretend) makes the proxy go through the configuration files as
      normal, but stops before creating any sockets or doing any
index 845c208..9a4d2bc 100644 (file)
@@ -3082,6 +3082,7 @@ void getmainconfig(const char *configfile) {
            "ListenDTLS", CONF_MSTR, &listenargs[RAD_DTLS],
            "SourceDTLS", CONF_STR, &sourcearg[RAD_DTLS],
 #endif
+            "PidFile", CONF_STR, &options.pidfile,
            "TTLAttribute", CONF_STR, &options.ttlattr,
            "addTTL", CONF_LINT, &addttl,
            "LogLevel", CONF_LINT, &loglevel,
@@ -3280,6 +3281,8 @@ int radsecproxy_main(int argc, char **argv) {
 
     debug_timestamp_on();
     debug(DBG_INFO, "radsecproxy revision %s starting", PACKAGE_VERSION);
+    if (!pidfile)
+        pidfile = options.pidfile;
     if (pidfile && !createpidfile(pidfile))
        debugx(1, DBG_ERR, "failed to create pidfile %s: %s", pidfile, strerror(errno));
 
index 35182f0..d5e4c10 100644 (file)
@@ -126,6 +126,17 @@ blocktype name {
     </para>
     <variablelist>
       <varlistentry>
+        <term><literal>PidFile</literal></term>
+        <listitem>
+         <para>
+            The PidFile option specifies the name of a file to which
+            the process id (PID) will be written.  This is overridden
+            by the <option>-i</option> command line option.  There is
+            no default value for the PidFile option.
+         </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><literal>LogLevel</literal></term>
         <listitem>
          <para>
index c1e7744..a8d5b49 100644 (file)
@@ -54,6 +54,7 @@ enum rsp_fticks_mac_type {
 };
 
 struct options {
+    char *pidfile;
     char *logdestination;
     char *ftickssyslogfacility;
     char *ttlattr;