OSSP CVS Repository

ossp - Check-in [250]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 250
Date: 2001-Jan-06 15:12:21 (local)
2001-Jan-06 14:12:21 (UTC)
User:simons
Branch:
Comment: Replaced the old basedir-mechanism in Petidomo, which used to be the home directory of the petidomo user. Now, Petidomo expects its master config file in ETCDIR, which is '/etc' per default. All other paths will be set there at run-time.
Tickets:
Inspections:
Files:
ossp-pkg/petidomo/Makefile.in      1.16 -> 1.17     2 inserted, 1 deleted
ossp-pkg/petidomo/config.c      1.6 -> 1.7     69 inserted, 70 deleted
ossp-pkg/petidomo/configure.in      1.4 -> 1.5     25 inserted, 2 deleted
ossp-pkg/petidomo/petidomo.h      1.2 -> 1.3     1 inserted, 2 deleted

ossp-pkg/petidomo/Makefile.in 1.16 -> 1.17

--- Makefile.in  2000/12/16 13:11:54     1.16
+++ Makefile.in  2001/01/06 14:12:21     1.17
@@ -15,6 +15,7 @@
 infodir         = @infodir@
 mandir          = @mandir@
 includedir      = @includedir@
+ETCDIR          = @ETCDIR@
 
 CC              = @CC@
 AR              = ar
@@ -24,7 +25,7 @@
 INSTALL         = ../etc/install-sh
 
 CFLAGS          = @CFLAGS@
-CPPFLAGS        = @CPPFLAGS@ @DEFS@
+CPPFLAGS        = @CPPFLAGS@ @DEFS@ -DETCDIR=\"$(ETCDIR)\"
 LDFLAGS         = @LDFLAGS@
 
 OBJS            = acl.o archive.o authen.o config.o \


ossp-pkg/petidomo/config.c 1.6 -> 1.7

--- config.c     2000/12/15 17:27:53     1.6
+++ config.c     2001/01/06 14:12:21     1.7
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/Attic/config.c,v $
-   $Revision: 1.6 $
+   $Revision: 1.7 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -31,102 +31,96 @@
 /* These variables need to be static/global, so that the addresses as
    used in MasterCF are known at compile time. */
 
-static char *             fqdn = NULL;
-static char *             master_password = NULL;
-static char *             mta = "/usr/sbin/sendmail";
-static char *             mta_options = "-i -f%s";
-
-int
-InitPetidomo(void)
-{
-    char *             basedir = "/usr/local/petidomo";
-    int                rc;
+static char*  fqdn            = NULL;
+static char*  master_password = NULL;
+static char*  mta             = "/usr/sbin/sendmail";
+static char*  mta_options     = "-i -f%s";
+
+int InitPetidomo(void)
+    {
+    int    rc;
 
     /* Format description of our global config file. */
 
-    struct ConfigFile  MasterCF[] = {
+    struct ConfigFile  MasterCF[] =
+        {
         { "Hostname", CF_STRING, &fqdn },
         { "AdminPassword", CF_STRING, &master_password },
         { "MTA", CF_STRING, &mta },
         { "MTA_Options", CF_STRING, &mta_options },
         { NULL, 0, NULL}
-    };
+        };
 
     /* Allocate memory for the global config structure. */
 
     MasterConfig = calloc(sizeof(struct PD_Config), 1);
-    if (MasterConfig == NULL) {
+    if (MasterConfig == NULL)
+        {
         syslog(LOG_ERR, "Failed to allocate %d byte of memory.", sizeof(struct PD_Config));
         return -1;
-    }
+        }
 
     /* Init the list of read list configs. */
 
     ListConfigs = InitList(NULL);
 
-    /* chdir() into the base directory. */
-
-    rc = chdir(basedir);
-    if (rc != 0) {
-        syslog(LOG_ERR, "Failed to change current directory to \"%s\": %m", basedir);
-        return -1;
-    }
-
     /* Parse the config file. */
 
-    rc = ReadConfig("etc/petidomo.conf", MasterCF);
-    if (rc != 0) {
-        syslog(LOG_ERR, "Failed to parse the master config file \"petidomo.conf\"");
+    rc = ReadConfig(ETCDIR "/petidomo.conf", MasterCF);
+    if (rc != 0)
+        {
+        syslog(LOG_ERR, "Failed to parse the master config file.");
         return -1;
-    }
+        }
 
     /* Do consistency checks. */
 
-    if (fqdn == NULL) {
+    if (fqdn == NULL)
+        {
         syslog(LOG_ERR, "The master config file \"petidomo.conf\" doesn't set the host name.");
         return -1;
-    }
-    if (master_password == NULL) {
+        }
+    if (master_password == NULL)
+        {
         syslog(LOG_ERR, "The master config file \"petidomo.conf\" doesn't set the admin password.");
         return -1;
-    }
-    if (strstr(mta_options, "%s") == NULL) {
+        }
+    if (strstr(mta_options, "%s") == NULL)
+        {
         syslog(LOG_ERR, "The argument to MTA_Options in the master config file is invalid.");
         return -1;
-    }
+        }
 
     /* Copy the results to the structure. */
 
-    MasterConfig->basedir = basedir;
     MasterConfig->fqdn = fqdn;
     MasterConfig->master_password = master_password;
     MasterConfig->mta = mta;
     MasterConfig->mta_options = mta_options;
 
     return 0;
-}
+    }
 
-const struct PD_Config *
-getMasterConfig(void)
-{
+const struct PD_Config* getMasterConfig(void)
+    {
     return MasterConfig;
-}
+    }
+
 
-static char *     list_fqdn = NULL;
-static char *     admin_password = NULL;
-static char *     posting_password = NULL;
-static char *     listtype = NULL;
-static char *     reply_to = NULL;
-static char *     postingfilter = NULL;
-static char *     archivepath = NULL;
-static bool       allowpubsub = TRUE;
-static bool       allowaliensub = TRUE;
-static bool       allowmembers = FALSE;
-static bool       showonindex = TRUE;
-
-const struct List_Config *
-getListConfig(const char * listname)
-{
+static char*     list_fqdn = NULL;
+static char*     admin_password = NULL;
+static char*     posting_password = NULL;
+static char*     listtype = NULL;
+static char*     reply_to = NULL;
+static char*     postingfilter = NULL;
+static char*     archivepath = NULL;
+static bool      allowpubsub = TRUE;
+static bool      allowaliensub = TRUE;
+static bool      allowmembers = FALSE;
+static bool      showonindex = TRUE;
+
+const struct List_Config* getListConfig(const char * listname)
+    {
     const struct PD_Config *  MasterConfig;
     struct List_Config *      ListConfig;
     Node                      node;
@@ -135,7 +129,8 @@
 
     /* Format description of our global config file. */
 
-    struct ConfigFile ListCF[] = {
+    struct ConfigFile ListCF[] =
+        {
         { "ListType", CF_STRING, &listtype },
         { "AllowPublicSubscription", CF_YES_NO, &allowpubsub },
         { "AllowAlienSubscription", CF_YES_NO, &allowaliensub },
@@ -148,7 +143,7 @@
         { "PostingFilter", CF_STRING, &postingfilter },
         { "Archive", CF_STRING, &archivepath },
         { NULL, 0, NULL}
-    };
+        };
 
     /* Get the master configuration. */
 
@@ -158,41 +153,45 @@
 
     node = FindNodeByKey(ListConfigs, listname);
     if (node != NULL)
-      return getNodeData(node);
+        return getNodeData(node);
 
     /* No? Then read the config file. */
 
     sprintf(buffer, "lists/%s/config", listname);
     rc = ReadConfig(buffer, ListCF);
-    if (rc != 0) {
+    if (rc != 0)
+        {
         syslog(LOG_ERR, "Failed to parse the list \"%s\"'s config file.", listname);
         exit(1);
-    }
+        }
 
     /* Do consistency checks. */
 
-    if (listtype == NULL) {
+    if (listtype == NULL)
+        {
         syslog(LOG_ERR, "List \"%s\" doesn't have a valid type in config file.", listname);
         exit(1);
-    }
+        }
 
     /* Set up the list config structure. */
 
     ListConfig = calloc(sizeof(struct List_Config), 1);
-    if (ListConfig == NULL) {
+    if (ListConfig == NULL)
+        {
         syslog(LOG_ERR, "Failed to allocate %d byte of memory.", sizeof(struct List_Config));
         exit(1);
-    }
+        }
     if (!strcasecmp(listtype, "open"))
-      ListConfig->listtype = LIST_OPEN;
+        ListConfig->listtype = LIST_OPEN;
     else if (!strcasecmp(listtype, "closed"))
-      ListConfig->listtype = LIST_CLOSED;
+        ListConfig->listtype = LIST_CLOSED;
     else if (!strcasecmp(listtype, "moderated"))
-      ListConfig->listtype = LIST_MODERATED;
-    else {
+        ListConfig->listtype = LIST_MODERATED;
+    else
+        {
         syslog(LOG_ERR, "List \"%s\" doesn't have a valid type in config file.", listname);
         exit(1);
-    }
+        }
     ListConfig->allowpubsub = allowpubsub;
     ListConfig->allowaliensub = allowaliensub;
     ListConfig->allowmembers = allowmembers;
@@ -200,7 +199,7 @@
     ListConfig->fqdn = (list_fqdn) ? list_fqdn : MasterConfig->fqdn;
     ListConfig->reply_to = reply_to;
     if (reply_to != NULL && strcasecmp(reply_to, "none"))
-      CanonizeAddress(&(ListConfig->reply_to), ListConfig->fqdn);
+        CanonizeAddress(&(ListConfig->reply_to), ListConfig->fqdn);
     ListConfig->admin_password = admin_password;
     ListConfig->posting_password = posting_password;
     ListConfig->postingfilter = postingfilter;
@@ -208,4 +207,4 @@
     AppendNode(ListConfigs, xstrdup(listname), ListConfig);
 
     return ListConfig;
-}
+    }


ossp-pkg/petidomo/configure.in 1.4 -> 1.5

--- configure.in 2000/12/16 13:18:18     1.4
+++ configure.in 2001/01/06 14:12:21     1.5
@@ -1,12 +1,12 @@
 dnl
 dnl configure.in -- Process this file with autoconf to produce a configure script.
 dnl
-dnl $Header: /v/ossp/cvs/ossp-pkg/petidomo/configure.in,v 1.4 2000/12/16 13:18:18 simons Exp $
+dnl $Header: /v/ossp/cvs/ossp-pkg/petidomo/configure.in,v 1.5 2001/01/06 14:12:21 simons Exp $
 dnl
 
 AC_INIT(petidomo.h)
 AC_CONFIG_AUX_DIR(../etc)
-AC_REVISION($Revision: 1.4 $)dnl
+AC_REVISION($Revision: 1.5 $)dnl
 
 dnl Checks for paths and programs.
 dnl
@@ -39,6 +39,29 @@
 dnl
 CFLAGS=`echo $CFLAGS | sed -e "s/-O2/-O3/"`
 
+dnl Where is the /etc directory?
+dnl
+AC_MSG_CHECKING(etcdir)
+AC_ARG_WITH(etcdir,
+[  --with-etcdir=PATH      Directory containing petidomo.conf (default /etc).],
+[ case "$withval" in
+  no)
+    AC_MSG_ERROR(Need ETCDIR.)
+    ;;
+  yes)
+    ETCDIR="/etc"
+    AC_MSG_RESULT(/etc)
+    ;;
+  *)
+    ETCDIR="$withval"
+    AC_MSG_RESULT($withval)
+    ;;
+  esac ],
+  ETCDIR="/etc"
+  AC_MSG_RESULT(/etc)
+)
+AC_SUBST(ETCDIR)
+
 dnl Write results.
 dnl
 AC_OUTPUT(Makefile)


ossp-pkg/petidomo/petidomo.h 1.2 -> 1.3

--- petidomo.h   2000/12/16 13:11:54     1.2
+++ petidomo.h   2001/01/06 14:12:21     1.3
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v $
-   $Revision: 1.2 $
+   $Revision: 1.3 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -51,7 +51,6 @@
 /********** config.c **********/
 
 struct PD_Config {
-    char *    basedir;
     char *    fqdn;
     char *    master_password;
     char *    mta;

CVSTrac 2.0.1