]> git.ozlabs.org Git - ppp.git/commitdiff
Merge pull request #358 from enaess/ppp-autotools
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 9 Aug 2022 09:42:51 +0000 (19:42 +1000)
committerGitHub <noreply@github.com>
Tue, 9 Aug 2022 09:42:51 +0000 (19:42 +1000)
PPP autotools

15 files changed:
configure.ac
pppd/Makefile.am
pppd/auth.c
pppd/eap-tls.c
pppd/eap.c
pppd/ipcp.c
pppd/main.c
pppd/options.c
pppd/pathnames.h
pppd/plugins/pppoe/Makefile.am
pppd/plugins/pppoe/plugin.c
pppd/plugins/radius/Makefile.am
pppd/plugins/radius/pathnames.h
pppd/plugins/radius/sendserver.c
pppd/utils.c

index 5a134fa4cf59f29e4a80edf6cc874982313def7f..640f70e46352e8ed5a455e627ff9d92429c01f5a 100644 (file)
@@ -17,8 +17,8 @@ AC_CONFIG_HEADERS([pppd/config.h pppd/pppdconf.h pppd/plugins/pppoe/config.h])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
 AC_PROG_LN_S
+LT_INIT
 
 PKG_PROG_PKG_CONFIG
 
@@ -194,7 +194,7 @@ AS_IF([test "x$enable_openssl_engine" != "xno"], [],
 #
 # Specify runtime directory
 AC_ARG_WITH([plugin-dir],
-       AC_HELP_STRING([--with-plugin-dir=DIR], [Specify the plugin directory for pppd]))
+       AS_HELP_STRING([--with-plugin-dir=DIR],[Specify the plugin directory for pppd]))
 AS_IF([test -n "$with_plugin_dir"],
        [PPPD_PLUGIN_DIR="$with_plugin_dir"],
        [PPPD_PLUGIN_DIR="${libdir}/pppd/$VERSION"])
@@ -203,19 +203,19 @@ AC_SUBST(PPPD_PLUGIN_DIR, "$PPPD_PLUGIN_DIR", [The pppd plugin directory])
 #
 # Specify runtime directory
 AC_ARG_WITH([runtime-dir],
-       AC_HELP_STRING([--with-runtime-dir=DIR], [Specify the runtime directory for pppd]))
+       AS_HELP_STRING([--with-runtime-dir=DIR],[Specify the runtime directory for pppd]))
 AS_IF([test -n "$with_runtime_dir"],
        [PPPD_RUNTIME_DIR="$with_runtime_dir"],
-       [PPPD_RUNTIME_DIR="${localstatedir}/run/pppd"])
+       [PPPD_RUNTIME_DIR="${runstatedir}/pppd"])
 AC_SUBST(PPPD_RUNTIME_DIR)
 
 #
 # Specify runtime directory
 AC_ARG_WITH([logfile-dir],
-       AC_HELP_STRING([--with-logfile-dir=DIR], [Specify the log directory for pppd]))
+       AS_HELP_STRING([--with-logfile-dir=DIR],[Specify the log directory for pppd]))
 AS_IF([test -n "$with_logfile_dir"],
        [PPPD_LOGFILE_DIR="$with_logfile_dir"],
-       [PPPD_LOGFILE_DIR="${localstatedir}/log/pppd"])
+       [PPPD_LOGFILE_DIR="${localstatedir}/log/ppp"])
 AC_SUBST(PPPD_LOGFILE_DIR)
 
 #
index 7dc6cdd33e5456b070974896163b6185265c6136..b392f2e2e877b44a205e3c1bc5c8301820effd8d 100644 (file)
@@ -68,7 +68,7 @@ pppd_SOURCES = \
     upap.c \
     utils.c
 
-pppd_CPPFLAGS = -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"'
+pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DLOCALSTATEDIR=\"${localstatedir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"'
 pppd_LDFLAGS =
 pppd_LIBS =
 
index fc2839009c35d0c76836d15f3ece65208b4bf9c9..5c64f28bb42f682b9af5982c8c63ac8fccfd1227 100644 (file)
@@ -750,7 +750,7 @@ link_down(int unit)
        if (auth_script_state == s_up && auth_script_pid == 0) {
            update_link_stats(unit);
            auth_script_state = s_down;
-           auth_script(_PATH_AUTHDOWN);
+           auth_script(PPP_PATH_AUTHDOWN);
        }
     }
     if (!doing_multilink) {
@@ -899,7 +899,7 @@ network_phase(int unit)
        auth_state = s_up;
        if (auth_script_state == s_down && auth_script_pid == 0) {
            auth_script_state = s_up;
-           auth_script(_PATH_AUTHUP);
+           auth_script(PPP_PATH_AUTHUP);
        }
     }
 
@@ -1489,7 +1489,7 @@ check_passwd(int unit,
      * Open the file of pap secrets and scan for a suitable secret
      * for authenticating this user.
      */
-    filename = _PATH_UPAPFILE;
+    filename = PPP_PATH_UPAPFILE;
     addrs = opts = NULL;
     ret = UPAP_AUTHNAK;
     f = fopen(filename, "r");
@@ -1590,7 +1590,7 @@ null_login(int unit)
      * Open the file of pap secrets and scan for a suitable secret.
      */
     if (ret <= 0) {
-       filename = _PATH_UPAPFILE;
+       filename = PPP_PATH_UPAPFILE;
        addrs = NULL;
        f = fopen(filename, "r");
        if (f == NULL)
@@ -1637,7 +1637,7 @@ get_pap_passwd(char *passwd)
            return ret;
     }
 
-    filename = _PATH_UPAPFILE;
+    filename = PPP_PATH_UPAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
        return 0;
@@ -1674,7 +1674,7 @@ have_pap_secret(int *lacks_ipp)
            return ret;
     }
 
-    filename = _PATH_UPAPFILE;
+    filename = PPP_PATH_UPAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
        return 0;
@@ -1716,7 +1716,7 @@ have_chap_secret(char *client, char *server,
        }
     }
 
-    filename = _PATH_CHAPFILE;
+    filename = PPP_PATH_CHAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
        return 0;
@@ -1754,7 +1754,7 @@ have_srp_secret(char *client, char *server, int need_ip, int *lacks_ipp)
     char *filename;
     struct wordlist *addrs;
 
-    filename = _PATH_SRPFILE;
+    filename = PPP_PATH_SRPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
        return 0;
@@ -1802,7 +1802,7 @@ get_secret(int unit, char *client, char *server,
            return 0;
        }
     } else {
-       filename = _PATH_CHAPFILE;
+       filename = PPP_PATH_CHAPFILE;
        addrs = NULL;
        secbuf[0] = 0;
 
@@ -1856,7 +1856,7 @@ get_srp_secret(int unit, char *client, char *server,
     if (!am_server && passwd[0] != '\0') {
        strlcpy(secret, passwd, MAXWORDLEN);
     } else {
-       filename = _PATH_SRPFILE;
+       filename = PPP_PATH_SRPFILE;
        addrs = NULL;
 
        fp = fopen(filename, "r");
@@ -2359,13 +2359,13 @@ auth_script_done(void *arg)
     case s_up:
        if (auth_state == s_down) {
            auth_script_state = s_down;
-           auth_script(_PATH_AUTHDOWN);
+           auth_script(PPP_PATH_AUTHDOWN);
        }
        break;
     case s_down:
        if (auth_state == s_up) {
            auth_script_state = s_up;
-           auth_script(_PATH_AUTHUP);
+           auth_script(PPP_PATH_AUTHUP);
        }
        break;
     }
@@ -2419,7 +2419,7 @@ have_eaptls_secret_server(char *client, char *server,
     char cacertfile[MAXWORDLEN];
     char pkfile[MAXWORDLEN];
 
-    filename = _PATH_EAPTLSSERVFILE;
+    filename = PPP_PATH_EAPTLSSERVFILE;
     f = fopen(filename, "r");
     if (f == NULL)
                return 0;
@@ -2476,7 +2476,7 @@ have_eaptls_secret_client(char *client, char *server)
        if (pkcs12_file)
                return 1;
 
-    filename = _PATH_EAPTLSCLIFILE;
+    filename = PPP_PATH_EAPTLSCLIFILE;
     f = fopen(filename, "r");
     if (f == NULL)
                return 0;
@@ -2694,7 +2694,7 @@ get_eaptls_secret(int unit, char *client, char *server,
        }
        else
        {
-               filename = (am_server ? _PATH_EAPTLSSERVFILE : _PATH_EAPTLSCLIFILE);
+               filename = (am_server ? PPP_PATH_EAPTLSSERVFILE : PPP_PATH_EAPTLSCLIFILE);
                addrs = NULL;
 
                fp = fopen(filename, "r");
index 69e34a1d7cc9023f37f9b0f18474b89bd80df438..a7e444dc762aa153511670116e42e7c4461adcda 100644 (file)
@@ -158,10 +158,10 @@ CONF *eaptls_ssl_load_config( void )
 
     config = NCONF_new( NULL );
     dbglog( "Loading OpenSSL config file" );
-    ret_code = NCONF_load( config, _PATH_OPENSSLCONFFILE, &error_line );
+    ret_code = NCONF_load( config, PPP_PATH_OPENSSLCONFFILE, &error_line );
     if (ret_code == 0)
     {
-        warn( "EAP-TLS: Error in OpenSSL config file %s at line %d", _PATH_OPENSSLCONFFILE, error_line );
+        warn( "EAP-TLS: Error in OpenSSL config file %s at line %d", PPP_PATH_OPENSSLCONFFILE, error_line );
         NCONF_free( config );
         config = NULL;
         ERR_clear_error();
index 4ad67a5c5eb70810ccbfb632819eb98907394d21..305a8387b0e8b213f2983a76dca8287e86051d62 100644 (file)
@@ -1503,7 +1503,7 @@ name_of_pn_file(void)
                errno = EINVAL;
                return (NULL);
        }
-       file = _PATH_PSEUDONYM;
+       file = PPP_PATH_PSEUDONYM;
        pl = strlen(user) + strlen(file) + 2;
        path = malloc(pl);
        if (path == NULL)
index e3e8112eb1462942e72b9cf6699b2ad3c66551f7..776f06f0e9ee50349b5e28823fc1e697f774d2c7 100644 (file)
@@ -1767,7 +1767,7 @@ ip_demand_conf(int u)
     }
     if (!sifaddr(u, wo->ouraddr, wo->hisaddr, GetMask(wo->ouraddr)))
        return 0;
-    ipcp_script(_PATH_IPPREUP, 1);
+    ipcp_script(PPP_PATH_IPPREUP, 1);
     if (!sifup(u))
        return 0;
     if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
@@ -1933,7 +1933,7 @@ ipcp_up(fsm *f)
        ifindex = if_nametoindex(ifname);
 
        /* run the pre-up script, if any, and wait for it to finish */
-       ipcp_script(_PATH_IPPREUP, 1);
+       ipcp_script(PPP_PATH_IPPREUP, 1);
 
        /* check if preup script renamed the interface */
        if (!if_indextoname(ifindex, ifname)) {
@@ -2153,9 +2153,9 @@ create_resolv(u_int32_t peerdns1, u_int32_t peerdns2)
 {
     FILE *f;
 
-    f = fopen(_PATH_RESOLV, "w");
+    f = fopen(PPP_PATH_RESOLV, "w");
     if (f == NULL) {
-       error("Failed to create %s: %m", _PATH_RESOLV);
+       error("Failed to create %s: %m", PPP_PATH_RESOLV);
        return;
     }
 
@@ -2166,7 +2166,7 @@ create_resolv(u_int32_t peerdns1, u_int32_t peerdns2)
        fprintf(f, "nameserver %s\n", ip_ntoa(peerdns2));
 
     if (ferror(f))
-       error("Write failed to %s: %m", _PATH_RESOLV);
+       error("Write failed to %s: %m", PPP_PATH_RESOLV);
 
     fclose(f);
 }
index 49319e2a81a7fbd4e8cc6cce5e131b931de8f1b6..7e4775226d16eb25c64ee89a01fcaa723d257117 100644 (file)
@@ -294,12 +294,12 @@ main(int argc, char *argv[])
     struct protent *protp;
     char numbuf[16];
 
-    strlcpy(path_ipup, _PATH_IPUP, MAXPATHLEN);
-    strlcpy(path_ipdown, _PATH_IPDOWN, MAXPATHLEN);
+    strlcpy(path_ipup, PPP_PATH_IPUP, MAXPATHLEN);
+    strlcpy(path_ipdown, PPP_PATH_IPDOWN, MAXPATHLEN);
 
 #ifdef PPP_WITH_IPV6CP
-    strlcpy(path_ipv6up, _PATH_IPV6UP, MAXPATHLEN);
-    strlcpy(path_ipv6down, _PATH_IPV6DOWN, MAXPATHLEN);
+    strlcpy(path_ipv6up, PPP_PATH_IPV6UP, MAXPATHLEN);
+    strlcpy(path_ipv6down, PPP_PATH_IPV6DOWN, MAXPATHLEN);
 #endif
     link_stats_valid = 0;
     new_phase(PHASE_INITIALIZE);
@@ -348,7 +348,7 @@ main(int argc, char *argv[])
      * Parse, in order, the system options file, the user's options file,
      * and the command line arguments.
      */
-    if (!options_from_file(_PATH_SYSOPTIONS, !privileged, 0, 1)
+    if (!options_from_file(PPP_PATH_SYSOPTIONS, !privileged, 0, 1)
        || !options_from_user()
        || !parse_args(argc-1, argv+1))
        exit(EXIT_OPTION_ERROR);
@@ -405,9 +405,9 @@ main(int argc, char *argv[])
        die(0);
 
     /* Make sure fds 0, 1, 2 are open to somewhere. */
-    fd_devnull = open(_PATH_DEVNULL, O_RDWR);
+    fd_devnull = open(PPP_DEVNULL, O_RDWR);
     if (fd_devnull < 0)
-       fatal("Couldn't open %s: %m", _PATH_DEVNULL);
+       fatal("Couldn't open %s: %m", PPP_DEVNULL);
     while (fd_devnull <= 2) {
        i = dup(fd_devnull);
        if (i < 0)
@@ -421,12 +421,12 @@ main(int argc, char *argv[])
     sys_init();
 
 #ifdef PPP_WITH_TDB
-    pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
+    pppdb = tdb_open(PPP_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
     if (pppdb != NULL) {
        slprintf(db_key, sizeof(db_key), "pppd%d", getpid());
        update_db_entry();
     } else {
-       warn("Warning: couldn't open ppp database %s", _PATH_PPPDB);
+       warn("Warning: couldn't open ppp database %s", PPP_PATH_PPPDB);
        if (multilink) {
            warn("Warning: disabling multilink");
            multilink = 0;
@@ -814,7 +814,7 @@ create_pidfile(int pid)
     FILE *pidfile;
 
     slprintf(pidfilename, sizeof(pidfilename), "%s%s.pid",
-            _PATH_VARRUN, ifname);
+            PPP_PATH_VARRUN, ifname);
     if ((pidfile = fopen(pidfilename, "w")) != NULL) {
        fprintf(pidfile, "%d\n", pid);
        (void) fclose(pidfile);
@@ -833,7 +833,7 @@ create_linkpidfile(int pid)
        return;
     script_setenv("LINKNAME", linkname, 1);
     slprintf(linkpidfile, sizeof(linkpidfile), "%sppp-%s.pid",
-            _PATH_VARRUN, linkname);
+            PPP_PATH_VARRUN, linkname);
     if ((pidfile = fopen(linkpidfile, "w")) != NULL) {
        fprintf(pidfile, "%d\n", pid);
        if (ifname[0])
@@ -1655,7 +1655,7 @@ update_system_environment(void)
 /*
  * device_script - run a program to talk to the specified fds
  * (e.g. to run the connector or disconnector script).
- * stderr gets connected to the log fd or to the _PATH_CONNERRS file.
+ * stderr gets connected to the log fd or to the PPP_PATH_CONNERRS file.
  */
 int
 device_script(char *program, int in, int out, int dont_wait)
@@ -1668,7 +1668,7 @@ device_script(char *program, int in, int out, int dont_wait)
     if (log_to_fd >= 0)
        errfd = log_to_fd;
     else
-       errfd = open(_PATH_CONNERRS, O_WRONLY | O_APPEND | O_CREAT, 0644);
+       errfd = open(PPP_PATH_CONNERRS, O_WRONLY | O_APPEND | O_CREAT, 0644);
 
     ++conn_running;
     pid = safe_fork(in, out, errfd);
index 1fbe46e642c316b28096f557f5ed5dc83cae0551..92997e6c2310d1cd67c6bb2ce1a3bfc99ab21164 100644 (file)
@@ -531,7 +531,7 @@ options_from_user(void)
     pw = getpwuid(getuid());
     if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0)
        return 1;
-    file = _PATH_USEROPT;
+    file = PPP_PATH_USEROPT;
     pl = strlen(user) + strlen(file) + 2;
     path = malloc(pl);
     if (path == NULL)
@@ -563,13 +563,13 @@ options_for_tty(void)
        dev = p + 5;
     if (dev[0] == 0 || strcmp(dev, "tty") == 0)
        return 1;               /* don't look for /etc/ppp/options.tty */
-    pl = strlen(_PATH_TTYOPT) + strlen(dev) + 1;
+    pl = strlen(PPP_PATH_TTYOPT) + strlen(dev) + 1;
     path = malloc(pl);
     if (path == NULL)
        novm("tty init file name");
-    slprintf(path, pl, "%s%s", _PATH_TTYOPT, dev);
+    slprintf(path, pl, "%s%s", PPP_PATH_TTYOPT, dev);
     /* Turn slashes into dots, for Solaris case (e.g. /dev/term/a) */
-    for (p = path + strlen(_PATH_TTYOPT); *p != 0; ++p)
+    for (p = path + strlen(PPP_PATH_TTYOPT); *p != 0; ++p)
        if (*p == '/')
            *p = '.';
     option_priority = OPRIO_CFGFILE;
@@ -1466,10 +1466,10 @@ callfile(char **argv)
        return 0;
     }
 
-    l = strlen(arg) + strlen(_PATH_PEERFILES) + 1;
+    l = strlen(arg) + strlen(PPP_PATH_PEERFILES) + 1;
     if ((fname = (char *) malloc(l)) == NULL)
        novm("call file name");
-    slprintf(fname, l, "%s%s", _PATH_PEERFILES, arg);
+    slprintf(fname, l, "%s%s", PPP_PATH_PEERFILES, arg);
     script_setenv("CALL_FILE", arg, 0);
 
     ok = options_from_file(fname, 1, 1, 1);
@@ -1597,7 +1597,7 @@ loadplugin(char **argv)
     const char *vers;
 
     if (strchr(arg, '/') == 0) {
-       const char *base = _PATH_PLUGIN;
+       const char *base = PPP_PATH_PLUGIN;
        int l = strlen(base) + strlen(arg) + 2;
        path = malloc(l);
        if (path == 0)
index 57a130e1c2e3b4278226366aa2c9c58e2edcd87e..de2fb6889005103c7735315fb230469e7f3fce34 100644 (file)
@@ -1,5 +1,46 @@
 /*
- * define path names
+ * pathnames.h - define default paths for pppd
+ *
+ * Copyright (c) 1999-2002 Paul Mackerras. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. The name(s) of the authors of this software must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission.
+ *
+ * 3. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by Paul Mackerras
+ *     <paulus@samba.org>".
+ *
+ * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Paths are controlled by configure. Typically, one would pass the following options
+ * to configure:
+ *    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+ *
+ * Note that if the prefix variable do control all the other directory variables, e.g
+ * sysconfdir is ${prefix}/etc. Setting prefix to /usr, you'll have to override
+ * sysconfdir with /etc to avoid installing config files into /usr/etc.
+ *
+ * In addition, there are three explicit variables that has overrides via configure:
+ * - PPPD_RUNTIME_DIR, set by --with-runtime-dir=<dir>
+ * - PPPD_LOGFILE_DIR, set by --with-logfile-dir=<dir>
+ * - PPPD_PLUGIN_DIR, set by --with-plugin-dir=<dir>
  */
 #ifndef PPP_PATHNAMES_H
 #define PPP_PATHNAMES_H
 #endif /* HAVE_PATHS_H */
 
 #ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL  "/dev/null"
+#define _PATH_DEVNULL           "/dev/null"
 #endif
 
+#define PPP_DEVNULL             _PATH_DEVNULL
+
+/*
+ * PPPD_RUNTIME_DIR is set by passing --with-runtime-dir=<path> via configure
+ *    the default value set by configure when option is absent is ${localstatedir}/run/pppd
+ */
 #ifdef PPPD_RUNTIME_DIR
-#undef  _PATH_VARRUN
-#define _PATH_VARRUN   PPPD_RUNTIME_DIR "/"
+#define PPP_PATH_VARRUN         PPPD_RUNTIME_DIR
+#else
+#define PPP_PATH_VARRUN         _PATH_VARRUN
 #endif
 
+/*
+ * PPPD_LOGFILE_DIR is set by passing --with-logfile-dir=<path> via configure
+ *    the default value set by configure when option is absent is ${localstatedir}/log/ppp
+ */
 #ifdef PPPD_LOGFILE_DIR
-#undef  _PATH_VARLOG
-#define _PATH_VARLOG    PPPD_LOGFILE_DIR
+#define PPP_PATH_VARLOG         PPPD_LOGFILE_DIR
+#else
+#define PPP_PATH_VARLOG         _PATH_VARRUN "/log/ppp"
 #endif
 
+/*
+ * PPPD_PLUGIN_DIR is set by passing --with-plugin-dir=<path> via configure
+ *    the default value set by configure when option is absent is ${libdir}/pppd/${version}
+ */
 #ifdef PPPD_PLUGIN_DIR
-#define _PATH_PLUGIN    PPPD_PLUGIN_DIR
-#else
-#ifdef __STDC__
-#define _PATH_PLUGIN   DESTDIR "/lib/pppd/" VERSION
-#else  /* __STDC__ */
-#define _PATH_PLUGIN   "/usr/lib/pppd"
-#endif /* __STDC__ */
+#define PPP_PATH_PLUGIN         PPPD_PLUGIN_DIR
 #endif /* PPPD_PLUGIN_DIR */
 
-#ifndef _ROOT_PATH
-#define _ROOT_PATH
-#endif
+#define PPP_PATH_CONFDIR        SYSCONFDIR "/ppp"
 
-#define _PATH_UPAPFILE          _ROOT_PATH "/etc/ppp/pap-secrets"
-#define _PATH_CHAPFILE          _ROOT_PATH "/etc/ppp/chap-secrets"
-#define _PATH_SRPFILE   _ROOT_PATH "/etc/ppp/srp-secrets"
+#define PPP_PATH_UPAPFILE       PPP_PATH_CONFDIR "/pap-secrets"
+#define PPP_PATH_CHAPFILE       PPP_PATH_CONFDIR "/chap-secrets"
+#define PPP_PATH_SRPFILE        PPP_PATH_CONFDIR "/srp-secrets"
 
 #ifdef PPP_WITH_EAPTLS
-#define _PATH_EAPTLSCLIFILE    _ROOT_PATH "/etc/ppp/eaptls-client"
-#define _PATH_EAPTLSSERVFILE   _ROOT_PATH "/etc/ppp/eaptls-server"
-#define _PATH_OPENSSLCONFFILE  _ROOT_PATH "/etc/ppp/openssl.cnf"
+#define PPP_PATH_EAPTLSCLIFILE  PPP_PATH_CONFDIR "/eaptls-client"
+#define PPP_PATH_EAPTLSSERVFILE PPP_PATH_CONFDIR "/eaptls-server"
+#define PPP_PATH_OPENSSLCONFFILE PPP_PATH_CONFDIR "/openssl.cnf"
 #endif /* PPP_WITH_EAPTLS */
 
-#define _PATH_SYSOPTIONS _ROOT_PATH "/etc/ppp/options"
-#define _PATH_IPUP      _ROOT_PATH "/etc/ppp/ip-up"
-#define _PATH_IPDOWN    _ROOT_PATH "/etc/ppp/ip-down"
-#define _PATH_IPPREUP   _ROOT_PATH "/etc/ppp/ip-pre-up"
-#define _PATH_AUTHUP    _ROOT_PATH "/etc/ppp/auth-up"
-#define _PATH_AUTHDOWN  _ROOT_PATH "/etc/ppp/auth-down"
-#define _PATH_TTYOPT    _ROOT_PATH "/etc/ppp/options."
-#define _PATH_CONNERRS  _ROOT_PATH _PATH_VARLOG "/connect-errors"
-#define _PATH_PEERFILES         _ROOT_PATH "/etc/ppp/peers/"
-#define _PATH_RESOLV    _ROOT_PATH "/etc/ppp/resolv.conf"
+#define PPP_PATH_SYSOPTIONS     PPP_PATH_CONFDIR "/options"
+#define PPP_PATH_IPUP           PPP_PATH_CONFDIR "/ip-up"
+#define PPP_PATH_IPDOWN         PPP_PATH_CONFDIR "/ip-down"
+#define PPP_PATH_IPPREUP        PPP_PATH_CONFDIR "/ip-pre-up"
+#define PPP_PATH_AUTHUP         PPP_PATH_CONFDIR "/auth-up"
+#define PPP_PATH_AUTHDOWN       PPP_PATH_CONFDIR "/auth-down"
+#define PPP_PATH_TTYOPT         PPP_PATH_CONFDIR "/options."
+#define PPP_PATH_PEERFILES      PPP_PATH_CONFDIR "/peers/"
+#define PPP_PATH_RESOLV         PPP_PATH_CONFDIR "/resolv.conf"
 
-#define _PATH_USEROPT   ".ppprc"
-#define        _PATH_PSEUDONYM  ".ppp_pseudonym"
+#define PPP_PATH_CONNERRS       PPP_PATH_VARLOG  "/connect-errors"
+
+#define PPP_PATH_USEROPT        ".ppprc"
+#define PPP_PATH_PSEUDONYM         ".ppp_pseudonym"
 
 #ifdef PPP_WITH_IPV6CP
-#define _PATH_IPV6UP     _ROOT_PATH "/etc/ppp/ipv6-up"
-#define _PATH_IPV6DOWN   _ROOT_PATH "/etc/ppp/ipv6-down"
+#define PPP_PATH_IPV6UP         PPP_PATH_CONFDIR "/ipv6-up"
+#define PPP_PATH_IPV6DOWN       PPP_PATH_CONFDIR "/ipv6-down"
+#endif
+
+#define PPP_PATH_PPPDB          PPP_PATH_VARRUN  "/pppd2.tdb"
+
+#ifdef __linux__
+#define PPP_PATH_LOCKDIR        PPP_PATH_VARRUN  "/lock"
+#else
+#ifdef SVR4
+#define PPP_PATH_LOCKDIR        LOCALSTATEDIR "/spool/locks"
+#else
+#define PPP_PATH_LOCKDIR        LOCALSTATEDIR "/spool/lock"
+#endif
 #endif
 
-#ifdef __STDC__
-#define _PATH_PPPDB    _ROOT_PATH _PATH_VARRUN "pppd2.tdb"
-#else /* __STDC__ */
-#define _PATH_PPPDB    _PPP_VARRUN "pppd2.tdb"
-#endif /* __STDC__ */
 
 #endif /* PPP_PATHNAMES_H */
index 6cea70aae967c96fd17b9e9a3749febdeeae3cbf..5fea701ca8b0e11aeffe002049c6e0f8b8f36dfb 100644 (file)
@@ -6,7 +6,7 @@ dist_man8_MANS = pppoe-discovery.8
 noinst_HEADERS = \
     pppoe.h
 
-pppoe_la_CPPFLAGS = -I${top_srcdir}
+pppoe_la_CPPFLAGS = -I${top_srcdir} -DSYSCONFDIR=\"${sysconfdir}\"
 pppoe_la_LDFLAGS = -module -avoid-version
 pppoe_la_SOURCES = plugin.c discovery.c if.c common.c
 
index 92d049353c49b24b6bb81f295a37317cfd1cd778..70205657202f90dd9cbe4f2b4087ca19cdb10ac8 100644 (file)
@@ -53,13 +53,8 @@ static char const RCSID[] =
 #include <pppd/lcp.h>
 #include <pppd/ipcp.h>
 #include <pppd/ccp.h>
-/* #include <pppd/pathnames.h> ?, see below ... */
 
-#ifndef _ROOT_PATH
-#define _ROOT_PATH ""
-#endif
-
-#define _PATH_ETHOPT         _ROOT_PATH "/etc/ppp/options."
+#define PPP_PATH_ETHOPT         SYSCONFDIR "/ppp/options."
 
 char pppd_version[] = PPPD_VERSION;
 
@@ -332,7 +327,7 @@ PPPOEDeviceOptions(void)
 {
     char buf[MAXPATHLEN];
 
-    strlcpy(buf, _PATH_ETHOPT, MAXPATHLEN);
+    strlcpy(buf, PPP_PATH_ETHOPT, MAXPATHLEN);
     strlcat(buf, devnam, MAXPATHLEN);
     if (!options_from_file(buf, 0, 0, 1))
        exit(EXIT_OPTION_ERROR);
index ec637ae7897e17ed85c020fbcf4de3f9e6c93004..40f4d16ccb0d692fa13a896173960bc3e703ee65 100644 (file)
@@ -47,7 +47,7 @@ radrealms_la_SOURCES = radrealms.c
 libradiusclient_la_SOURCES = \
     avpair.c buildreq.c config.c dict.c ip_util.c \
        clientid.c sendserver.c lock.c util.c
-libradiusclient_la_CPPFLAGS = $(RADIUS_CPPFLAGS)
+libradiusclient_la_CPPFLAGS = $(RADIUS_CPPFLAGS) -DSYSCONFDIR=\"${sysconfdir}\"
 
 if !WITH_OPENSSL
 libradiusclient_la_SOURCES += md5.c
index 5aa4c60b9c161211a52cdc1f0b501f17a546c03f..3a00d2c1ed897d078e5c95f1e476fceca82c2591 100644 (file)
 #ifndef PATHNAMES_H
 #define PATHNAMES_H
 
-#define _PATH_DEV_URANDOM      "/dev/urandom"          /* Linux only */
-#define _PATH_ETC_ISSUE                "/etc/issue"
+#define PPP_PATH_DEV_URANDOM   "/dev/urandom"          /* Linux only */
+#define PPP_PATH_ETC_ISSUE             "/etc/issue"
 
 /* normally defined in the Makefile */
-#ifndef _PATH_ETC_RADIUSCLIENT_CONF
-#define _PATH_ETC_RADIUSCLIENT_CONF       "/etc/radiusclient.conf"
+#ifndef PPP_PATH_ETC_RADIUSCLIENT_CONF
+#define PPP_PATH_ETC_RADIUSCLIENT_CONF       SYSCONFDIR "/radiusclient.conf"
 #endif
 
 #endif /* PATHNAMES_H */
index f6012868e2dbbbcb6de5f3a4806088d0c9f761a9..acf78e5fa0000a41e4eb547509cc110030861b05 100644 (file)
@@ -491,7 +491,7 @@ static void rc_random_vector (unsigned char *vector)
    we use /dev/urandom here, as /dev/random might block and we don't
    need that much randomness. BTW, great idea, Ted!     -lf, 03/18/95  */
 
-       if ((fd = open(_PATH_DEV_URANDOM, O_RDONLY)) >= 0)
+       if ((fd = open(PPP_PATH_DEV_URANDOM, O_RDONLY)) >= 0)
        {
                unsigned char *pos;
                int readcount;
index e75bb9c8eecd21279a999c18f8c0bc4f132ef1e3..bd82e2b4ec20031f5db5b70246e4ab9e83654426 100644 (file)
@@ -61,6 +61,7 @@
 #include "pppd.h"
 #include "fsm.h"
 #include "lcp.h"
+#include "pathnames.h"
 
 
 #if defined(SUNOS4)
@@ -781,18 +782,6 @@ complete_read(int fd, void *buf, size_t count)
 #endif
 
 /* Procedures for locking the serial device using a lock file. */
-#ifndef LOCK_DIR
-#ifdef __linux__
-#define LOCK_DIR       "/var/lock"
-#else
-#ifdef SVR4
-#define LOCK_DIR       "/var/spool/locks"
-#else
-#define LOCK_DIR       "/var/spool/lock"
-#endif
-#endif
-#endif /* LOCK_DIR */
-
 static char lock_file[MAXPATHLEN];
 
 /*
@@ -833,7 +822,7 @@ lock(char *dev)
        return -1;
     }
     slprintf(lock_file, sizeof(lock_file), "%s/LK.%03d.%03d.%03d",
-            LOCK_DIR, major(sbuf.st_dev),
+            PPP_PATH_LOCKDIR, major(sbuf.st_dev),
             major(sbuf.st_rdev), minor(sbuf.st_rdev));
 #else
     char *p;
@@ -851,7 +840,7 @@ lock(char *dev)
        if ((p = strrchr(dev, '/')) != NULL)
            dev = p + 1;
 
-    slprintf(lock_file, sizeof(lock_file), "%s/LCK..%s", LOCK_DIR, dev);
+    slprintf(lock_file, sizeof(lock_file), "%s/LCK..%s", PPP_PATH_LOCKDIR, dev);
 #endif
 
     while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) {