Open SCAP Library
Loading...
Searching...
No Matches
xinetd_probe.c File Reference

xinetd probe More...

#include <probe-api.h>
#include <probe/probe.h>
#include <probe/entcmp.h>
#include <probe/option.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fnmatch.h>
#include <bfind.h>
#include <common/debug_priv.h>
#include <netdb.h>
#include "../SEAP/generic/rbt/rbt.h"
#include "xinetd_probe.h"

Data Structures

struct  xiconf_attr
struct  xiconf_service
struct  xiconf_strans_t
struct  xiconf_file_t
struct  xiconf_t

Macros

#define PATH_SEPARATOR   '/'
#define XICFG_PARSER_IGNORE_UNKNOWN   1
#define XICFG_PARSER_IGNORE_INVSECT   0
#define XICFG_PARSER_MAXFILESIZE   655360
 hard limit for configuration file size; 640K ought to be enough for anybody
#define XICFG_PARSER_MAXFILECOUNT   128
 a reasonable high limit for the number of configuration files to be opened at one time
#define XIATTR_SECTION_NIL   0x01
#define XIATTR_SECTION_DEF   0x02
#define XIATTR_SECTION_SRV   0x04
#define XIATTR_OPARG_LOCAL   0 /* local service attribute */
#define XIATTR_OPARG_GLOBAL   1 /* xiconf_t structure */
#define XIATTR_MERGE_DEFAULTS   1
#define XICONF_SECTION_DEFAULTS   XIATTR_SECTION_DEF
#define XICONF_SECTION_SERVICE   XIATTR_SECTION_SRV
#define OPRES_SUCCESS   0
#define OPRES_ESYNTAX   1 /* Invalid syntax */
#define OPRES_EINVAL   2 /* Invalid operation */
#define OPRES_EFAULT   3 /* Invalid memory access */
#define OPRES_ELIMIT   4 /* Limit reached */
#define XICFG_STRANS_MAXKEYLEN   256
#define XICONF_FILE_MMAPED   0x00000001
 try to mmap the file
#define XICONF_FILE_PERSIST   0x00000002
 keep the file open/mmaped
#define XICONF_FILE_DEAD   0x00000004
 this item can be skipped/deleted/reused for a different file
#define STR(s)
#define XICONF_ATTR(name, op_a, op_i, op_r)
#define XICONF_SO_ATTR(name, op_a, op_i, op_r, op_c, op_m)
#define XICONF_DO_ATTR(name, op_a, op_i, op_r, op_c, op_m, off, arg)
#define XICONF_SD_ATTR(name, op_a, op_i, op_r, op_c, op_m)
#define XIATTR_TABLE_COUNT   (sizeof xiattr_table / sizeof(struct xiconf_attr))
#define xiattr_ptr(ptr, off)
#define NONNULL_FREE(p)
#define tmpbuf_def(size)
#define tmpbuf_get(size)
#define tmpbuf_free(ptr)
#define XICONF_INCTYPE_FILE   0
#define XICONF_INCTYPE_DIR   1
#define XINETD_CONFPATH   "/etc/xinetd.conf"
#define XINETD_CONFDEPTH   32

Typedefs

typedef struct xiconf_service xiconf_service_t

Functions

xiconf_txiconf_parse (const char *path, unsigned int max_depth)
void xiconf_free (xiconf_t *xiconf)
int xiconf_update (xiconf_t *xiconf)
int xiconf_parse_section (xiconf_t *xiconf, xiconf_file_t *xifile, int type, char *name)
int xiconf_parse_service (xiconf_file_t *file, xiconf_service_t *service)
int xiconf_parse_defaults (xiconf_file_t *file, xiconf_service_t *defaults, rbt_t *stree)
xiconf_strans_txiconf_getservice (xiconf_t *xiconf, char *name, char *prot)
xiconf_strans_txiconf_dump (xiconf_t *xiconf)
void xiconf_strans_free (xiconf_strans_t *strans)
int op_assign_bool (void *var, char *val)
int op_assign_u16 (void *var, char *val)
int op_merge_u16 (void *dst, void *src, int type)
int op_assign_str (void *var, char *val)
int op_merge_str (void *dst, void *src, int type)
int op_assign_strl (void *var, char *val)
int op_insert_strl (void *var, char *val)
int op_remove_strl (void *var, char *val)
int op_assign_disabled (void *var, char *val)
int op_assign_enabled (void *var, char *val)
int xinetd_probe_offline_mode_supported ()
void * xinetd_probe_init (void)
void xinetd_probe_fini (void *arg)
int xinetd_probe_main (probe_ctx *ctx, void *arg)

Variables

struct xiconf_attr xiattr_table []

Detailed Description

xinetd probe

Author
"Daniel Kopecek" dkope.nosp@m.cek@.nosp@m.redha.nosp@m.t.co.nosp@m.m

Macro Definition Documentation

◆ NONNULL_FREE

#define NONNULL_FREE ( p)
Value:
if (service->p != NULL) free(service->p)

◆ STR

#define STR ( s)
Value:
#s

◆ tmpbuf_def

#define tmpbuf_def ( size)
Value:
char __tmpbuf[size]

◆ tmpbuf_free

#define tmpbuf_free ( ptr)
Value:
do { if ((ptr) != __tmpbuf) free(ptr); (ptr) = NULL; } while(0)

◆ tmpbuf_get

#define tmpbuf_get ( size)
Value:
(((sizeof __tmpbuf)/sizeof(char))<(size)?malloc(sizeof(char)*(size)):__tmpbuf)

◆ xiattr_ptr

#define xiattr_ptr ( ptr,
off )
Value:
((void *)(((uint8_t *)(ptr))+(off)))

◆ XICONF_ATTR

#define XICONF_ATTR ( name,
op_a,
op_i,
op_r )
Value:
{ STR(name), offsetof(xiconf_service_t, name), (op_a), (op_i), (op_r) }

◆ XICONF_DO_ATTR

#define XICONF_DO_ATTR ( name,
op_a,
op_i,
op_r,
op_c,
op_m,
off,
arg )
Value:
{ STR(name), (off), (op_a), (op_i), (op_r), (op_c), (op_m), XIATTR_SECTION_DEF, (arg) }

◆ XICONF_SD_ATTR

#define XICONF_SD_ATTR ( name,
op_a,
op_i,
op_r,
op_c,
op_m )
Value:
{ STR(name), offsetof(xiconf_service_t, name), (op_a), (op_i), (op_r), (op_c), (op_m), XIATTR_SECTION_SRV|XIATTR_SECTION_DEF, XIATTR_OPARG_LOCAL }

◆ XICONF_SO_ATTR

#define XICONF_SO_ATTR ( name,
op_a,
op_i,
op_r,
op_c,
op_m )
Value:
{ STR(name), offsetof(xiconf_service_t, name), (op_a), (op_i), (op_r), (op_c), (op_m), XIATTR_SECTION_SRV, XIATTR_OPARG_LOCAL }