chiark
/
gitweb
/
~ianmdlvl
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Import release 0.1.0
[secnet.git]
/
secnet.c
diff --git
a/secnet.c
b/secnet.c
index b0bb4b3d6a477b99af53376f4f7cfc951bffea9a..be94f95e6398c84c8a288bbe9315037abcaaeefe 100644
(file)
--- a/
secnet.c
+++ b/
secnet.c
@@
-4,29
+4,24
@@
*
*/
*
*/
-
static char *version="secnet version " VERSION " $Date: 1996/03/13 22:27:41 $"
;
+
extern char version[]
;
+#include "secnet.h"
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
-#include <stdarg.h>
#include <errno.h>
#include <errno.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/inet.h>
-#include <adns.h>
#include <pwd.h>
#include <pwd.h>
-#include <sys/types.h>
-#include "secnet.h"
#include "util.h"
#include "conffile.h"
#include "util.h"
#include "conffile.h"
-#include "modules.h"
/* Command-line options (possibly config-file options too) */
static char *configfile="/etc/secnet/secnet.conf";
/* Command-line options (possibly config-file options too) */
static char *configfile="/etc/secnet/secnet.conf";
+bool_t just_check_config=False;
static char *userid=NULL;
static uid_t uid=0;
static bool_t background=True;
static char *userid=NULL;
static uid_t uid=0;
static bool_t background=True;
@@
-64,10
+59,11
@@
static void parse_options(int argc, char **argv)
{"quiet", 0, 0, 'f'},
{"debug", 1, 0, 'd'},
{"config", 1, 0, 'c'},
{"quiet", 0, 0, 'f'},
{"debug", 1, 0, 'd'},
{"config", 1, 0, 'c'},
+ {"just-check-config", 0, 0, 'j'},
{0,0,0,0}
};
{0,0,0,0}
};
- c=getopt_long(argc, argv, "vwdnc:ft:",
+ c=getopt_long(argc, argv, "vwdn
j
c:ft:",
long_options, &option_index);
if (c==-1)
break;
long_options, &option_index);
if (c==-1)
break;
@@
-81,6
+77,7
@@
static void parse_options(int argc, char **argv)
" -w, --nowarnings suppress warnings\n"
" -v, --verbose output extra diagnostics\n"
" -c, --config=filename specify a configuration file\n"
" -w, --nowarnings suppress warnings\n"
" -v, --verbose output extra diagnostics\n"
" -c, --config=filename specify a configuration file\n"
+ " -j, --just-check-config stop after reading configfile\n"
" -n, --nodetach do not run in background\n"
" -d, --debug=item,... set debug options\n"
" --help display this help and exit\n"
" -n, --nodetach do not run in background\n"
" -d, --debug=item,... set debug options\n"
" --help display this help and exit\n"
@@
-118,6
+115,10
@@
static void parse_options(int argc, char **argv)
fatal("secnet: no config filename specified");
break;
fatal("secnet: no config filename specified");
break;
+ case 'j':
+ just_check_config=True;
+ break;
+
case '?':
break;
case '?':
break;
@@
-156,7
+157,7
@@
static void setup(dict_t *config)
fatal("configuration does not include a system/log facility\n");
}
log=init_log(l);
fatal("configuration does not include a system/log facility\n");
}
log=init_log(l);
- log->log(log->st,LOG_DEBUG,"
secnet " VERSION ": logging started"
);
+ log->log(log->st,LOG_DEBUG,"
%s: logging started",version
);
/* Who are we supposed to run as? */
userid=dict_read_string(system,"userid",False,"system",loc);
/* Who are we supposed to run as? */
userid=dict_read_string(system,"userid",False,"system",loc);
@@
-345,6
+346,14
@@
int main(int argc, char **argv)
enter_phase(PHASE_SETUP);
setup(config);
enter_phase(PHASE_SETUP);
setup(config);
+
+ if (just_check_config) {
+ Message(M_INFO,"configuration file check complete\n");
+ exit(0);
+ }
+
+ enter_phase(PHASE_GETRESOURCES);
+ /* Appropriate phase hooks will have been run */
enter_phase(PHASE_DROPPRIV);
droppriv();
enter_phase(PHASE_DROPPRIV);
droppriv();