Go to the documentation of this file.
57 out =
alloc_buf_gc(strlen(name) + strlen(value) + 2, gc);
101 for (current = *list, prev = NULL; current != NULL; current = current->
next)
111 *list = current->
next;
208 return item ? item->
string : NULL;
228 msg(msglevel,
"ENV [%d] '%s'", i, e->
string);
270 snprintf(buf,
sizeof(buf),
"%d", value);
278 snprintf(buf,
sizeof(buf),
"%" PRIi64, (int64_t)value);
300 msg(
M_WARN,
"setenv_str_safe: name overflow");
307 unsigned int counter = 1;
308 const size_t tmpname_len = strlen(name) + 5;
309 char *tmpname =
gc_malloc(tmpname_len,
true, NULL);
310 strcpy(tmpname, name);
313 ASSERT(snprintf(tmpname, tmpname_len,
"%s_%u", name, counter));
338 const unsigned int name_include,
339 const unsigned int name_exclude,
340 const char name_replace,
341 const unsigned int value_include,
342 const unsigned int value_exclude,
343 const char value_replace)
346 const char *name_tmp;
347 const char *val_tmp = NULL;
349 ASSERT(name && strlen(name) > 1);
351 name_tmp =
string_mod_const(name, name_include, name_exclude, name_replace, &gc);
355 val_tmp =
string_mod_const(value, value_include, value_exclude, value_replace, &gc);
364 #if DEBUG_VERBOSE_SETENV
422 const bool check_allowed,
456 return (
const char **)ret;
static const char * setenv_format_indexed_name(const char *name, const int i, struct gc_arena *gc)
static bool env_string_equal(const char *s1, const char *s2)
static struct gc_arena gc_new(void)
void env_set_destroy(struct env_set *es)
void setenv_str_i(struct env_set *es, const char *name, const char *value, const int i)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
void setenv_int_i(struct env_set *es, const char *name, const int value, const int i)
void env_set_inherit(struct env_set *es, const struct env_set *src)
#define CC_NAME
alphanumeric plus underscore
void setenv_int(struct env_set *es, const char *name, int value)
void setenv_counter(struct env_set *es, const char *name, counter_type value)
void env_set_print(int msglevel, const struct env_set *es)
void env_set_add(struct env_set *es, const char *str)
char * string_alloc(const char *str, struct gc_arena *gc)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
static bool remove_env_item(const char *str, const bool do_free, struct env_item **list)
#define CC_PRINT
printable (>= 32, != 127)
#define ALLOC_ARRAY_CLEAR_GC(dptr, type, n, gc)
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
static char * construct_name_value(const char *name, const char *value, struct gc_arena *gc)
bool env_allowed(const char *str)
static bool is_password_env_var(const char *str)
Wrapper structure for dynamically allocated memory.
void setenv_str_incr(struct env_set *es, const char *name, const char *value)
Store the supplied name value pair in the env_set.
struct env_set * env_set_create(struct gc_arena *gc)
static void add_env_item(char *str, const bool do_alloc, struct env_item **list, struct gc_arena *gc)
Garbage collection arena used to keep track of dynamically allocated memory.
void setenv_str(struct env_set *es, const char *name, const char *value)
static void buf_set_write(struct buffer *buf, uint8_t *data, int size)
bool env_set_del(struct env_set *es, const char *str)
static void env_set_add_nolock(struct env_set *es, const char *str)
static bool check_debug_level(unsigned int level)
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
static void gc_free(struct gc_arena *a)
static bool env_set_del_nolock(struct env_set *es, const char *str)
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)
void setenv_del(struct env_set *es, const char *name)
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...
void setenv_str_safe(struct env_set *es, const char *name, const char *value)
const char * env_set_get(const struct env_set *es, const char *name)
void setenv_long_long(struct env_set *es, const char *name, long long value)
static bool env_safe_to_print(const char *str)
const char ** make_env_array(const struct env_set *es, const bool check_allowed, struct gc_arena *gc)
bool buf_printf(struct buffer *buf, const char *format,...)
int script_security(void)
#define ALLOC_OBJ_GC(dptr, type, gc)