projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use resources for the greylister too.
[apps/pfixtools.git]
/
postlicyd
/
main-postlicyd.c
diff --git
a/postlicyd/main-postlicyd.c
b/postlicyd/main-postlicyd.c
index
86d1400
..
c60d515
100644
(file)
--- a/
postlicyd/main-postlicyd.c
+++ b/
postlicyd/main-postlicyd.c
@@
-44,7
+44,7
@@
#include "query.h"
#define DAEMON_NAME "postlicyd"
#include "query.h"
#define DAEMON_NAME "postlicyd"
-#define DAEMON_VERSION "0.
3
"
+#define DAEMON_VERSION "0.
4
"
#define DEFAULT_PORT 10000
#define RUNAS_USER "nobody"
#define RUNAS_GROUP "nogroup"
#define DEFAULT_PORT 10000
#define RUNAS_USER "nobody"
#define RUNAS_GROUP "nogroup"
@@
-283,6
+283,7
@@
void usage(void)
" -f stay in foreground\n"
" -d grow logging level\n"
" -u unsafe mode (don't drop privileges)\n"
" -f stay in foreground\n"
" -d grow logging level\n"
" -u unsafe mode (don't drop privileges)\n"
+ " -c check-conf\n"
, stderr);
}
, stderr);
}
@@
-295,8
+296,9
@@
int main(int argc, char *argv[])
bool daemonize = true;
int port = DEFAULT_PORT;
bool port_from_cli = false;
bool daemonize = true;
int port = DEFAULT_PORT;
bool port_from_cli = false;
+ bool check_conf = false;
- for (int c = 0; (c = getopt(argc, argv, "ufd" "l:p:")) >= 0; ) {
+ for (int c = 0; (c = getopt(argc, argv, "ufd
c
" "l:p:")) >= 0; ) {
switch (c) {
case 'p':
pidfile = optarg;
switch (c) {
case 'p':
pidfile = optarg;
@@
-314,6
+316,11
@@
int main(int argc, char *argv[])
case 'd':
++log_level;
break;
case 'd':
++log_level;
break;
+ case 'c':
+ check_conf = true;
+ daemonize = false;
+ unsafe = true;
+ break;
default:
usage();
return EXIT_FAILURE;
default:
usage();
return EXIT_FAILURE;
@@
-329,7
+336,10
@@
int main(int argc, char *argv[])
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
- info("starting %s v%s...", DAEMON_NAME, DAEMON_VERSION);
+ if (check_conf) {
+ return config_check(argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE;
+ }
+ info("%s v%s...", DAEMON_NAME, DAEMON_VERSION);
if (pidfile_open(pidfile) < 0) {
crit("unable to write pidfile %s", pidfile);
if (pidfile_open(pidfile) < 0) {
crit("unable to write pidfile %s", pidfile);