xinetd.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 <common/assume.h>`
`#include <alloc.h>`
`#include <bfind.h>`
`#include <common/debug_priv.h>`
`#include <netdb.h>`
`#include "../SEAP/generic/rbt/rbt.h"`

## Data Structures

struct | xiconf_attr
struct | xiconf_service_t
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) #s
#define | XICONF_ATTR(name, op_a, op_i, op_r) { STR(name), offsetof(xiconf_service_t, name), (op_a), (op_i), (op_r) }
#define | XICONF_SO_ATTR(name, op_a, op_i, op_r, op_c, op_m) { STR(name), offsetof(xiconf_service_t, name), (op_a), (op_i), (op_r), (op_c), (op_m), XIATTR_SECTION_SRV, XIATTR_OPARG_LOCAL }
#define | XICONF_DO_ATTR(name, op_a, op_i, op_r, op_c, op_m, off, arg) { STR(name), (off), (op_a), (op_i), (op_r), (op_c), (op_m), XIATTR_SECTION_DEF, (arg) }
#define | XICONF_SD_ATTR(name, op_a, op_i, op_r, op_c, op_m) { 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 }
#define | XIATTR_TABLE_COUNT (sizeof xiattr_table / sizeof(struct xiconf_attr))
#define | xiattr_ptr(ptr, off) ((void *)(((uint8_t *)(ptr))+(off)))
#define | NONNULL_FREE(p) if (service->p != NULL) oscap_free(service->p)
#define | tmpbuf_def(size) char __tmpbuf[size]
#define | tmpbuf_get(size) (((sizeof __tmpbuf)/sizeof(char))<(size)?oscap_alloc(sizeof(char)*(size)):__tmpbuf)
#define | tmpbuf_free(ptr) do { if ((ptr) != __tmpbuf) oscap_free(ptr); (ptr) = NULL; } while(0)
#define | XICONF_INCTYPE_FILE 0
#define | XICONF_INCTYPE_DIR 1
#define | XINETD_CONFPATH "/etc/xinetd.conf"
#define | XINETD_CONFDEPTH 32

## Functions

xiconf_t * | xiconf_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_t * | xiconf_getservice (xiconf_t *xiconf, char *name, char *prot)
xiconf_strans_t * | xiconf_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)
void * | probe_init (void)
| Dummy probe_fini function.
void | probe_fini (void *arg)
| Dummy probe_fini function.
int | 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