X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/9e6c445da6f6ec7571635e5ee14581d3662d90ad..a80fe344f7ddbd9dd320dd8303d9dc054f918d65:/lib/configuration.c diff --git a/lib/configuration.c b/lib/configuration.c index 45f2329..932c54b 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -240,6 +240,7 @@ static int set_string(const struct config_state *cs, cs->path, cs->line, whoami->name); return -1; } + xfree(VALUE(cs->config, char *)); VALUE(cs->config, char *) = xstrdup(vec[0]); return 0; } @@ -520,8 +521,7 @@ static int set_rights(const struct config_state *cs, cs->path, cs->line, vec[0]); return -1; } - *ADDRESS(cs->config, char *) = vec[0]; - return 0; + return set_string(cs, whoami, nvec, vec); } static int set_netaddress(const struct config_state *cs, @@ -644,7 +644,7 @@ static const struct conftype type_namepart = { set_namepart, free_namepartlist }, type_transform = { set_transform, free_transformlist }, type_netaddress = { set_netaddress, free_netaddress }, - type_rights = { set_rights, free_none }; + type_rights = { set_rights, free_string }; /* specific validation routine */ @@ -835,9 +835,7 @@ static int validate_positive(const struct config_state *cs, static int validate_isauser(const struct config_state *cs, int attribute((unused)) nvec, char **vec) { - struct passwd *pw; - - if(!(pw = getpwnam(vec[0]))) { + if(!getpwnam(vec[0])) { disorder_error(0, "%s:%d: no such user as '%s'", cs->path, cs->line, vec[0]); return -1; } @@ -1047,6 +1045,7 @@ static int validate_destaddr(const struct config_state attribute((unused)) *cs, disorder_error(0, "%s:%d: destination address required", cs->path, cs->line); return -1; } + xfree(na->address); return 0; } @@ -1080,6 +1079,7 @@ static const struct conf conf[] = { { C(lock), &type_boolean, validate_any }, { C(mail_sender), &type_string, validate_any }, { C(mixer), &type_string, validate_any }, + { C(mount_rescan), &type_boolean, validate_any }, { C(multicast_loop), &type_boolean, validate_any }, { C(multicast_ttl), &type_integer, validate_non_negative }, { C(namepart), &type_namepart, validate_any }, @@ -1106,6 +1106,7 @@ static const struct conf conf[] = { { C(replay_min), &type_integer, validate_non_negative }, { C2(restrict, restrictions), &type_restrict, validate_any }, { C(rtp_delay_threshold), &type_integer, validate_positive }, + { C(rtp_verbose), &type_boolean, validate_any }, { C(sample_format), &type_sample_format, validate_sample_format }, { C(scratch), &type_string_accum, validate_isreg }, { C(sendmail), &type_string, validate_isabspath }, @@ -1175,7 +1176,9 @@ static int config_set_args(const struct config_state *cs, vector_append(v, s); va_end(ap); vector_terminate(v); - return config_set(cs, v->nvec, v->vec); + int rc = config_set(cs, v->nvec, v->vec); + xfree(v->vec); + return rc; } /** @brief Error callback used by config_include() @@ -1373,6 +1376,7 @@ static struct config *config_default(void) { c->sox_generation = DEFAULT_SOX_GENERATION; c->playlist_max = INT_MAX; /* effectively no limit */ c->playlist_lock_timeout = 10; /* 10s */ + c->mount_rescan = 1; /* Default stopwords */ if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords)) exit(1); @@ -1417,7 +1421,7 @@ static void set_configfile(void) { * * @p c is indeterminate after this function is called. */ -static void config_free(struct config *c) { +void config_free(struct config *c) { int n; if(c) {