101 for (current = *list, prev = NULL; current != NULL; current = current->
next)
111 *list = current->
next;
208 return item ? item->
string : NULL;
243 msg(
M_ERR,
"could not write env set to '%s'", path);
294 snprintf(buf,
sizeof(buf),
"%d", value);
302 snprintf(buf,
sizeof(buf),
"%" PRIi64, (int64_t)value);
324 msg(
M_WARN,
"setenv_str_safe: name overflow");
365 const char *name_tmp;
366 const char *val_tmp = NULL;
368 ASSERT(name && strlen(name) > 1);
383#if DEBUG_VERBOSE_SETENV
473 return (
const char **)ret;
bool buf_printf(struct buffer *buf, const char *format,...)
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
const char * string_mod_const(const char *str, const unsigned int inclusive, const unsigned int exclusive, const char replace, struct gc_arena *gc)
Returns a copy of a string with certain classes of characters of it replaced with a specified charact...
char * string_alloc(const char *str, struct gc_arena *gc)
#define ALLOC_ARRAY_CLEAR_GC(dptr, type, n, gc)
static void buf_set_write(struct buffer *buf, uint8_t *data, int size)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
#define ALLOC_OBJ_GC(dptr, type, gc)
#define CC_NAME
alphanumeric plus underscore
static void gc_free(struct gc_arena *a)
#define CC_PRINT
printable (>= 32, != 127)
static struct gc_arena gc_new(void)
void setenv_counter(struct env_set *es, const char *name, counter_type value)
void env_set_print(int msglevel, const struct env_set *es)
static bool env_set_del_nolock(struct env_set *es, const char *str)
void env_set_destroy(struct env_set *es)
void setenv_int(struct env_set *es, const char *name, int value)
void setenv_int_i(struct env_set *es, const char *name, const int value, const int i)
static const char * setenv_format_indexed_name(const char *name, const int i, struct gc_arena *gc)
void setenv_str_i(struct env_set *es, const char *name, const char *value, const int i)
static void env_set_add_nolock(struct env_set *es, const char *str)
void env_set_write_file(const char *path, const struct env_set *es)
Write a struct env_set to a file.
static char * construct_name_value(const char *name, const char *value, struct gc_arena *gc)
void setenv_str(struct env_set *es, const char *name, const char *value)
const char ** make_env_array(const struct env_set *es, const bool check_allowed, struct gc_arena *gc)
void env_set_add(struct env_set *es, const char *str)
static bool env_string_equal(const char *s1, const char *s2)
static void add_env_item(char *str, const bool do_alloc, struct env_item **list, struct gc_arena *gc)
void setenv_str_ex(struct env_set *es, const char *name, const char *value, const unsigned int name_include, const unsigned int name_exclude, const char name_replace, const unsigned int value_include, const unsigned int value_exclude, const char value_replace)
const char * env_set_get(const struct env_set *es, const char *name)
void env_set_inherit(struct env_set *es, const struct env_set *src)
void setenv_str_incr(struct env_set *es, const char *name, const char *value)
Store the supplied name value pair in the env_set.
void setenv_str_safe(struct env_set *es, const char *name, const char *value)
struct env_set * env_set_create(struct gc_arena *gc)
bool env_allowed(const char *str)
bool env_set_del(struct env_set *es, const char *str)
void setenv_long_long(struct env_set *es, const char *name, long long value)
static bool remove_env_item(const char *str, const bool do_free, struct env_item **list)
void setenv_del(struct env_set *es, const char *name)
static bool is_password_env_var(const char *str)
static bool env_safe_to_print(const char *str)
static bool check_debug_level(unsigned int level)
int script_security(void)
#define SSEC_PW_ENV
allow calling of built-in programs and user-defined scripts that may receive a password as an environ...
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Garbage collection arena used to keep track of dynamically allocated memory.