Petidomo will now expect its master config file at
SYSCONFDIR/petidomo.conf. This location can be changed at run-time with the command line parameter --masterconf.
This commit is contained in:
parent
bacafded6a
commit
191e98cadf
8
config.c
8
config.c
@ -36,7 +36,7 @@ static char* master_password = NULL;
|
||||
static char* mta = "/usr/sbin/sendmail";
|
||||
static char* mta_options = "-i -f%s";
|
||||
|
||||
int InitPetidomo(void)
|
||||
int InitPetidomo(const char* masterconfig_path)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@ -66,7 +66,7 @@ int InitPetidomo(void)
|
||||
|
||||
/* Parse the config file. */
|
||||
|
||||
rc = ReadConfig(ETCDIR "/petidomo.conf", MasterCF);
|
||||
rc = ReadConfig(masterconfig_path, MasterCF);
|
||||
if (rc != 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to parse the master config file.");
|
||||
@ -77,12 +77,12 @@ int InitPetidomo(void)
|
||||
|
||||
if (fqdn == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "The master config file \"petidomo.conf\" doesn't set the host name.");
|
||||
syslog(LOG_ERR, "The master config file \"%s\" doesn't set the host name.", masterconfig_path);
|
||||
return -1;
|
||||
}
|
||||
if (master_password == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "The master config file \"petidomo.conf\" doesn't set the admin password.");
|
||||
syslog(LOG_ERR, "The master config file \"%s\" doesn't set the admin password.", masterconfig_path);
|
||||
return -1;
|
||||
}
|
||||
if (strstr(mta_options, "%s") == NULL)
|
||||
|
||||
10
main.c
10
main.c
@ -30,8 +30,9 @@
|
||||
# define LOG_PERROR 0
|
||||
#endif
|
||||
|
||||
static char* listname = NULL;
|
||||
static char* mode = NULL;
|
||||
static char* listname = NULL;
|
||||
static char* mode = NULL;
|
||||
static char* masterconfig_path = SYSCONFDIR "/petidomo.conf";
|
||||
|
||||
int
|
||||
main(int argc, char * argv[])
|
||||
@ -41,6 +42,7 @@ main(int argc, char * argv[])
|
||||
argv_t args[] =
|
||||
{
|
||||
{ARGV_MAND, "mode", ARGV_CHAR_P, &mode, "mode", "listserv, deliver, or approve."},
|
||||
{ARGV_MAYBE, "masterconf", ARGV_CHAR_P, &masterconfig_path, "masterconf", "Path to petidomo.conf."},
|
||||
{ARGV_MAYBE, 0L, ARGV_CHAR_P, &listname, "listname", "Default mailing list."},
|
||||
{ARGV_LAST}
|
||||
};
|
||||
@ -58,12 +60,14 @@ main(int argc, char * argv[])
|
||||
|
||||
/* Init Petidomo's internal stuff. */
|
||||
|
||||
if (InitPetidomo() != 0) {
|
||||
if (InitPetidomo(masterconfig_path) != 0) {
|
||||
syslog(LOG_CRIT, "Failed to initialize my internals.");
|
||||
exit(1);
|
||||
}
|
||||
MasterConfig = getMasterConfig();
|
||||
|
||||
return 0;
|
||||
|
||||
/* Load the file from standard input and save it, so that it isn't
|
||||
lost in case of an error. */
|
||||
|
||||
|
||||
@ -77,9 +77,9 @@ struct List_Config {
|
||||
char * reply_to;
|
||||
};
|
||||
|
||||
int InitPetidomo(void);
|
||||
const struct PD_Config *getMasterConfig(void );
|
||||
const struct List_Config *getListConfig(const char *listname);
|
||||
int InitPetidomo(const char* masterconfig_path);
|
||||
const struct PD_Config *getMasterConfig(void);
|
||||
const struct List_Config *getListConfig(const char* listname);
|
||||
|
||||
/********** rfcparse.c **********/
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user