37 #include <libxml/tree.h> 38 #include <libxml/parser.h> 39 #include <libxml/xpath.h> 40 #include <libxml/xpathInternals.h> 41 #include <libxml/relaxng.h> 45 #define StrFree(ptr) {if(ptr != NULL) {free(ptr); (ptr) = NULL;}} 53 "usage: %s [options]\n\n" 55 " -c, --conf [PATH_TO_CONF_FILE] Path to OpenDNSSEC configuration file\n" 57 " -k, --kasp [PATH_TO_KASP_FILE] Path to KASP policy file\n" 58 " (defaults to the path from the conf.xml file)\n",
61 " -z, --zonelist [PATH_TO_ZONELIST_FILE] Path to zonelist file\n" 62 " (defaults to the path from the conf.xml file)\n" 63 " -V, --version Display the version information\n" 64 " -v, --verbose Print extra DEBUG messages\n" 65 " -h, --help Show this message\n");
71 int main (
int argc,
char *argv[])
74 char *conffile = NULL, *kaspfile = NULL, *zonelistfile = NULL;
76 char **repo_list = NULL;
78 int ch, i, verbose = 0, option_index = 0;
79 static struct option long_options[] =
81 {
"config", required_argument, 0,
'c'},
82 {
"help", no_argument, 0,
'h'},
83 {
"kasp", required_argument, 0,
'k'},
84 {
"zonelist", required_argument, 0,
'z'},
85 {
"version", no_argument, 0,
'V'},
86 {
"verbose", no_argument, 0,
'v'},
89 char **policy_names = NULL;
93 if ((
progname = strrchr(argv[0],
'/'))) {
99 while ((ch = getopt_long(argc, argv,
"c:hk:Vvz:", long_options, &option_index)) != -1)
117 printf(
"%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
126 kc_helper_printto_stdout = 1;
129 conffile =
StrStrdup((
char *)OPENDNSSEC_CONFIG_FILE);
134 status =
check_conf(conffile, &kaspfile, &zonelistfile, &repo_list,
135 &repo_count, verbose);
137 status +=
check_kasp(kaspfile, repo_list, repo_count, verbose,
138 &policy_names, &policy_count);
140 status +=
check_zonelist(zonelistfile, verbose, policy_names, policy_count);
142 for (i = 0; i < policy_count; i++) {
143 free(policy_names[i]);
148 for (i = 0; i < repo_count; i++)
StrFree(repo_list[i]);
155 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)
void(* usage)(int sockfd)
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,...)