OpenDNSSEC-enforcer
1.4.9
|
#include <syslog.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
#include <limits.h>
#include <ctype.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxml/relaxng.h>
#include "kc_helper.h"
Go to the source code of this file.
Macros | |
#define | _GNU_SOURCE |
#define | StrFree(ptr) {if(ptr != NULL) {free(ptr); (ptr) = NULL;}} |
Functions | |
void | log_init (int facility, const char *program_name) |
void | log_switch (int facility, const char *program_name) |
void | dual_log (const char *format,...) |
int | check_rng (const char *filename, const char *rngfilename) |
int | check_file (const char *filename, const char *log_string) |
int | check_file_from_xpath (xmlXPathContextPtr xpath_ctx, const char *log_string, const xmlChar *file_xexpr) |
int | check_path (const char *pathname, const char *log_string) |
int | check_path_from_xpath (xmlXPathContextPtr xpath_ctx, const char *log_string, const xmlChar *path_xexpr) |
int | check_user_group (xmlXPathContextPtr xpath_ctx, const xmlChar *user_xexpr, const xmlChar *group_xexpr) |
int | check_time_def (const char *time_expr, const char *location, const char *field, const char *filename, int *interval) |
int | check_time_def_from_xpath (xmlXPathContextPtr xpath_ctx, const xmlChar *time_xexpr, const char *location, const char *field, const char *filename) |
int | check_policy (xmlNode *curNode, const char *policy_name, char **repo_list, int repo_count, const char *kasp) |
int | DtXMLIntervalSeconds (const char *text, int *interval) |
int | StrStrtoi (const char *string, int *value) |
int | StrStrtol (const char *string, long *value) |
char * | StrStrdup (const char *string) |
void | StrAppend (char **str1, const char *str2) |
void | StrTrimR (char *text) |
char * | StrTrimL (char *text) |
void * | MemCalloc (size_t nmemb, size_t size) |
void * | MemRealloc (void *ptr, size_t size) |
Variables | |
int | verbose |
#define _GNU_SOURCE |
Definition at line 26 of file kc_helper.c.
#define StrFree | ( | ptr | ) | {if(ptr != NULL) {free(ptr); (ptr) = NULL;}} |
Definition at line 48 of file kc_helper.c.
Referenced by check_file_from_xpath(), check_path_from_xpath(), check_policy(), check_time_def_from_xpath(), check_user_group(), and StrStrtol().
int check_file | ( | const char * | filename, |
const char * | log_string | ||
) |
Definition at line 194 of file kc_helper.c.
References dual_log().
Referenced by check_conf(), check_file_from_xpath(), and check_rng().
int check_file_from_xpath | ( | xmlXPathContextPtr | xpath_ctx, |
const char * | log_string, | ||
const xmlChar * | file_xexpr | ||
) |
Definition at line 218 of file kc_helper.c.
References check_file(), dual_log(), and StrFree.
Referenced by check_conf().
int check_path | ( | const char * | pathname, |
const char * | log_string | ||
) |
Definition at line 251 of file kc_helper.c.
References dual_log().
Referenced by check_conf(), and check_path_from_xpath().
int check_path_from_xpath | ( | xmlXPathContextPtr | xpath_ctx, |
const char * | log_string, | ||
const xmlChar * | path_xexpr | ||
) |
Definition at line 274 of file kc_helper.c.
References check_path(), dual_log(), and StrFree.
Referenced by check_conf().
int check_policy | ( | xmlNode * | curNode, |
const char * | policy_name, | ||
char ** | repo_list, | ||
int | repo_count, | ||
const char * | kasp | ||
) |
Definition at line 410 of file kc_helper.c.
References check_time_def(), dual_log(), KC_NAME_LENGTH, repo_count, StrFree, and StrStrtoi().
Referenced by check_kasp().
int check_rng | ( | const char * | filename, |
const char * | rngfilename | ||
) |
Definition at line 92 of file kc_helper.c.
References check_file(), dual_log(), and verbose.
Referenced by check_conf(), and check_kasp().
int check_time_def | ( | const char * | time_expr, |
const char * | location, | ||
const char * | field, | ||
const char * | filename, | ||
int * | interval | ||
) |
Definition at line 350 of file kc_helper.c.
References DtXMLIntervalSeconds(), and dual_log().
Referenced by check_policy(), and check_time_def_from_xpath().
int check_time_def_from_xpath | ( | xmlXPathContextPtr | xpath_ctx, |
const xmlChar * | time_xexpr, | ||
const char * | location, | ||
const char * | field, | ||
const char * | filename | ||
) |
Definition at line 387 of file kc_helper.c.
References check_time_def(), dual_log(), and StrFree.
Referenced by check_conf().
int check_user_group | ( | xmlXPathContextPtr | xpath_ctx, |
const xmlChar * | user_xexpr, | ||
const xmlChar * | group_xexpr | ||
) |
Definition at line 300 of file kc_helper.c.
References dual_log(), and StrFree.
Referenced by check_conf().
int DtXMLIntervalSeconds | ( | const char * | text, |
int * | interval | ||
) |
Definition at line 889 of file kc_helper.c.
Referenced by check_time_def().
void dual_log | ( | const char * | format, |
... | |||
) |
Definition at line 63 of file kc_helper.c.
Referenced by check_conf(), check_file(), check_file_from_xpath(), check_kasp(), check_path(), check_path_from_xpath(), check_policy(), check_rng(), check_time_def(), check_time_def_from_xpath(), check_user_group(), main(), MemCalloc(), MemRealloc(), StrStrdup(), StrStrtoi(), and StrStrtol().
void log_init | ( | int | facility, |
const char * | program_name | ||
) |
Definition at line 50 of file kc_helper.c.
void log_switch | ( | int | facility, |
const char * | program_name | ||
) |
Definition at line 56 of file kc_helper.c.
void* MemCalloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Definition at line 1260 of file kc_helper.c.
References dual_log(), KSM_STMTALLOC, and MsgLog().
Referenced by DbExecuteSql(), DbFetchRow(), MsgRegister(), StrArglistAdd(), StrArglistCreate(), and StrStrdup().
void* MemRealloc | ( | void * | ptr, |
size_t | size | ||
) |
Definition at line 1270 of file kc_helper.c.
References dual_log(), KSM_STMTALLOC, and MsgLog().
Referenced by MsgRegister(), StrAppend(), and StrArglistAdd().
void StrAppend | ( | char ** | str1, |
const char * | str2 | ||
) |
Definition at line 1165 of file kc_helper.c.
References MemRealloc(), and StrStrdup().
Referenced by ChangeKeyState(), check_conf(), cmd_addzone(), cmd_control(), cmd_dbbackup(), cmd_delzone(), cmd_dsseen(), cmd_exportkeys(), cmd_import(), cmd_keypurge(), cmd_kskretire(), cmd_kskrevoke(), cmd_listkeys(), cmd_listrolls(), cmd_listzone(), cmd_purgepolicy(), cmd_rollzone(), cmd_setup(), commGenSignConf(), CountKeys(), createPidDir(), db_connect(), DdsInit(), DisAppendInt(), DisAppendString(), DisEnd(), DisInit(), DisSpecifyInit(), do_communication(), do_purge(), DqsConditionInt(), DqsConditionKeyword(), DqsConditionString(), DqsCountInit(), DqsInit(), DqsOrderBy(), DqsSpecifyInit(), DusInit(), DusSetInt(), DusSetString(), fix_file_perms(), get_db_details(), getPermsForDrop(), keyRoll(), KsmCheckNextRollover(), KsmDnssecKeyCreate(), KsmImportKeyPair(), KsmImportZone(), KsmKeyCountStillGood(), KsmListBackups(), KsmListPolicies(), KsmListRepos(), KsmListRollovers(), KsmMarkBackup(), KsmMarkPreBackup(), KsmRequestChangeState(), KsmRequestChangeStateN(), KsmRequestSetActiveExpectedRetire(), KsmRollbackMarkPreBackup(), ListDS(), ListKeys(), MarkDSSeen(), NewDSSet(), PurgeKeys(), read_filenames(), read_zonelist_filename(), rename_signconf(), RetireOldKey(), RevokeOldKey(), server_main(), update_policies(), update_repositories(), and update_zones().
char* StrStrdup | ( | const char * | string | ) |
Definition at line 1123 of file kc_helper.c.
References dual_log(), KSM_STMTALLOC, MemCalloc(), and MsgLog().
Referenced by check_conf(), cmd_addzone(), cmd_exportkeys(), cmd_import(), createPidDir(), DdsInit(), DisInit(), DisSpecifyInit(), DqsCountInit(), DqsInit(), DqsSpecifyInit(), DtGeneralString(), DtParseDateTime(), DtParseDateTimeString(), DusInit(), get_log_user(), getPermsForDrop(), KsmImportZone(), KsmKeyCountStillGood(), KsmRequestChangeState(), KsmRequestChangeStateN(), ListKeys(), main(), make_directory(), ReadConfig(), server_init(), StrAppend(), StrArglistAdd(), StrArglistCreate(), StrStrtol(), StrStrtoul(), and update_policies().
int StrStrtoi | ( | const char * | string, |
int * | value | ||
) |
Definition at line 1025 of file kc_helper.c.
References dual_log(), KSM_INVARG, MsgLog(), and StrStrtol().
Referenced by check_policy(), cmd_dsseen(), cmd_genkeys(), cmd_import(), cmd_kskretire(), cmd_kskrevoke(), DbInt(), DtIntervalSeconds(), SetParamOnPolicy(), and update_policies().
int StrStrtol | ( | const char * | string, |
long * | value | ||
) |
Definition at line 1069 of file kc_helper.c.
References dual_log(), KSM_INVARG, MsgLog(), StrFree, StrStrdup(), StrTrimL(), and StrTrimR().
Referenced by StrStrtoi().
char* StrTrimL | ( | char * | text | ) |
Definition at line 1249 of file kc_helper.c.
Referenced by DtParseDateTime(), StrArglistCreate(), StrStrtol(), and StrStrtoul().
void StrTrimR | ( | char * | text | ) |
Definition at line 1210 of file kc_helper.c.
Referenced by DtParseDateTime(), KsmParameterShow(), StrArglistCreate(), StrStrtol(), and StrStrtoul().
int verbose |
Definition at line 49 of file kaspcheck.c.
Referenced by check_rng(), and main().