36 #include <libxml/parser.h> 46 "usage: %s [options]\n\n" 48 " -c, --conf [PATH_TO_CONF_FILE] Path to OpenDNSSEC configuration file\n" 50 " -k, --kasp [PATH_TO_KASP_FILE] Path to KASP policy file\n" 51 " (defaults to the path from the conf.xml file)\n",
54 " -z, --zonelist [PATH_TO_ZONELIST_FILE] Path to zonelist file\n" 55 " (defaults to the path from the conf.xml file)\n" 56 " -V, --version Display the version information\n" 57 " -v, --verbose Print extra DEBUG messages\n" 58 " -h, --help Show this message\n");
64 int main (
int argc,
char *argv[])
67 char *conffile = NULL, *kaspfile = NULL, *zonelistfile = NULL;
69 char **repo_list = NULL;
71 int ch, i, verbose = 0, option_index = 0;
72 static struct option long_options[] =
74 {
"config", required_argument, 0,
'c'},
75 {
"help", no_argument, 0,
'h'},
76 {
"kasp", required_argument, 0,
'k'},
77 {
"zonelist", required_argument, 0,
'z'},
78 {
"version", no_argument, 0,
'V'},
79 {
"verbose", no_argument, 0,
'v'},
82 char **policy_names = NULL;
86 if ((
progname = strrchr(argv[0],
'/'))) {
92 while ((ch = getopt_long(argc, argv,
"c:hk:Vvz:", long_options, &option_index)) != -1)
110 printf(
"%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
119 kc_helper_printto_stdout = 1;
122 conffile =
StrStrdup((
char *)OPENDNSSEC_CONFIG_FILE);
127 status =
check_conf(conffile, &kaspfile, &zonelistfile, &repo_list,
128 &repo_count, verbose);
130 status +=
check_kasp(kaspfile, repo_list, repo_count, verbose,
131 &policy_names, &policy_count);
133 status +=
check_zonelist(zonelistfile, verbose, policy_names, policy_count);
135 for (i = 0; i < policy_count; i++) {
136 free(policy_names[i]);
141 for (i = 0; i < repo_count; i++)
149 dual_log(
"DEBUG: finished %d", status);
char * StrStrdup(const char *string)
int check_conf(const char *conf, char **kasp, char **zonelist, char ***repo_listout, int *repo_countout, int verbose)
int check_kasp(const char *kasp, char **repo_list, int repo_count, int verbose, char ***policy_names_out, int *policy_count_out)
int check_zonelist(const char *zonelist, int verbose, char **policy_names, int policy_count)
int main(int argc, char *argv[])
#define DEFAULT_LOG_FACILITY
int kc_helper_printto_stdout
void log_init(int facility, const char *program_name)
void dual_log(const char *format,...)