diff options
Diffstat (limited to 'src/app/config/confparse.c')
-rw-r--r-- | src/app/config/confparse.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c index 6fa4fd1ea8..045cbc94fe 100644 --- a/src/app/config/confparse.c +++ b/src/app/config/confparse.c @@ -195,6 +195,19 @@ config_assign_value(const config_format_t *fmt, void *options, *(int *)lvalue = i; break; + case CONFIG_TYPE_UINT64: { + uint64_t u64 = tor_parse_uint64(c->value, 10, + 0, UINT64_MAX, &ok, NULL); + if (!ok) { + tor_asprintf(msg, + "uint64 keyword '%s %s' is malformed or out of bounds.", + c->key, c->value); + return -1; + } + *(uint64_t *)lvalue = u64; + break; + } + case CONFIG_TYPE_CSV_INTERVAL: { /* We used to have entire smartlists here. But now that all of our * download schedules use exponential backoff, only the first part @@ -574,6 +587,7 @@ config_get_assigned_option(const config_format_t *fmt, const void *options, tor_asprintf(&result->value, "%d", *(int*)value); escape_val = 0; /* Can't need escape. */ break; + case CONFIG_TYPE_UINT64: /* Fall through */ case CONFIG_TYPE_MEMUNIT: tor_asprintf(&result->value, "%"PRIu64, (*(uint64_t*)value)); @@ -781,6 +795,7 @@ config_clear(const config_format_t *fmt, void *options, case CONFIG_TYPE_AUTOBOOL: *(int*)lvalue = -1; break; + case CONFIG_TYPE_UINT64: case CONFIG_TYPE_MEMUNIT: *(uint64_t*)lvalue = 0; break; |