OpenDNSSEC-enforcer  1.4.6
Macros | Functions | Variables
kc_helper.c File Reference
#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"
Include dependency graph for kc_helper.c:

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
 

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 26 of file kc_helper.c.

#define StrFree (   ptr)    {if(ptr != NULL) {free(ptr); (ptr) = NULL;}}

Function Documentation

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,
  ... 
)
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 
)
void* MemRealloc ( void *  ptr,
size_t  size 
)

Definition at line 1310 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 
)
char* StrStrdup ( const char *  string)
int StrStrtoi ( const char *  string,
int *  value 
)
int StrStrtol ( const char *  string,
long *  value 
)

Definition at line 1109 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 1289 of file kc_helper.c.

Referenced by DtParseDateTime(), StrArglistCreate(), StrStrtol(), and StrStrtoul().

void StrTrimR ( char *  text)

Variable Documentation

int verbose

Definition at line 49 of file kaspcheck.c.

Referenced by check_rng(), and main().