Loading...
Searching...
No Matches
sql_probe.c File Reference

sql probe More...

`#include "_seap.h"`
`#include <probe-api.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <common/debug_priv.h>`
`#include <common/bfind.h>`
`#include <time.h>`
`#include <errno.h>`
`#include <opendbx/api.h>`
`#include "sql_probe.h"`
Include dependency graph for sql_probe.c:

## Data Structures

struct | dbEngineMap_t
struct | dbURIInfo_t

## Macros

#define | SQLPROBE_DEFAULT_CONNTIMEOUT 30
#define | ENGINE_MAP_COUNT (sizeof engine_map / sizeof (dbEngineMap_t))
#define | skipspace(s)
#define | matchitem1(tok, first, rest, dst)
#define | matchitem2(tok, first, rest1, dst1, rest2, dst2)
#define | get_string(dst, obj, ent_name)

## Functions

int | sql_probe_main (probe_ctx *ctx, void *arg)

## Detailed Description

sql probe

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

## Macro Definition Documentation

## get_string

#define get_string | ( |  | dst,
|  |  | obj,
|  |  | ent_name )

Value:
do { \
SEXP_t *__sval; \
\
__sval = probe_obj_getentval (obj, ent_name, 1); \
\
if (__sval == NULL) { \
dE("Missing entity or value: obj=%p, ent=%s", obj, #ent_name); \
err = PROBE_ENOENT; \
goto __exit; \
} \
\
(dst) = SEXP_string_cstr (__sval); \
\
if ((dst) == NULL) { \
SEXP_free(__sval); \
err = PROBE_EINVAL; \
goto __exit; \
} \
\
SEXP_free(__sval); \
} while (0)
probe_obj_getentval
SEXP_t * probe_obj_getentval(const SEXP_t *obj, const char *name, uint32_t n)
Get the value of an object's entity.
Definition probe-api.c:454
PROBE_ENOENT
#define PROBE_ENOENT
Missing entity.
Definition probe-api.h:433
PROBE_EINVAL
#define PROBE_EINVAL
Invalid type/value/format.
Definition probe-api.h:421
SEXP_string_cstr
OSCAP_API char * SEXP_string_cstr(const SEXP_t *s_exp)
Get a C string from a sexp object.
Definition sexp-manip.c:755

## matchitem1

#define matchitem1 | ( |  | tok,
|  |  | first,
|  |  | rest,
|  |  | dst )

Value:
case first: \
if (strncasecmp((rest), ++(tok), strlen(rest)) == 0) { \
tok += strlen(rest); \
skipspace(tok); \
if (*(tok) != '=') goto __fail; \
else (dst) = strdup((tok) + 1); \
} \
else { \
dE("Unrecognized token: '%s'", (tok)-1); \
}

## matchitem2

#define matchitem2 | ( |  | tok,
|  |  | first,
|  |  | rest1,
|  |  | dst1,
|  |  | rest2,
|  |  | dst2 )

Value:
case first: \
if (strncasecmp((rest1), (tok)+1, strlen(rest1)) == 0) { \
tok += 1+strlen(rest1); \
skipspace(tok); \
if (*(tok) != '=') goto __fail; \
else (dst1) = strdup((tok) + 1); \
} \
else if (strncasecmp((rest2), (tok)+1, strlen(rest2)) == 0) { \
tok += 1+strlen(rest2); \
skipspace(tok); \
if (*(tok) != '=') goto __fail; \
else (dst2) = strdup((tok) + 1); \
} \
else { \
dE("Unrecognized token: '%s'", (tok)); \
}

## skipspace

#define skipspace | ( |  | s | ) |

Value:
while (isspace(*s)) ++s;