Commit 7ae5b6b5 authored by Karel Slaný's avatar Karel Slaný Committed by Ondřej Surý

Removed cookie cache TTL from configuration.

parent f59982b8
......@@ -28,6 +28,4 @@ void kr_cookie_ctx_init(struct kr_cookie_ctx *ctx)
ctx->clnt.current.alg_id = ctx->clnt.recent.alg_id = -1;
ctx->srvr.current.alg_id = ctx->srvr.recent.alg_id = -1;
ctx->cache_ttl = DFLT_COOKIE_TTL;
}
......@@ -28,9 +28,6 @@ struct kr_cookie_secret {
uint8_t data[]; /*!< Secret quantity data. */
};
/** Default cookie TTL. */
#define DFLT_COOKIE_TTL 72000
/** Holds settings that have direct influence on cookie values computation. */
struct kr_cookie_comp {
struct kr_cookie_secret *secr; /*!< Secret data. */
......@@ -49,8 +46,6 @@ struct kr_cookie_settings {
struct kr_cookie_ctx {
struct kr_cookie_settings clnt; /**< Client settings. */
struct kr_cookie_settings srvr; /**< Server settings. */
uint32_t cache_ttl; /**< TTL used when caching cookies */
};
/**
......
......@@ -18,9 +18,6 @@ Example Configuration
cookiectl.config( { ['client_secret'] = { 0, 1, 2, 3, 4, 5, 6, 7 },
['client_cookie_alg'] = 'FNV-64' } )
-- Cache received server cookies for 12 hours.
cookiectl.config( { ['cache_ttl'] = 43200 } )
-- Configure the server part of the resolver. Sets a string to be used
-- as server secret. Also chooses the hashing algorithm to be used.
cookiectl.config( { ['server_secret'] = 'secret key',
......
......@@ -38,8 +38,6 @@
#define NAME_SERVER_COOKIE_ALG "server_cookie_alg"
#define NAME_AVAILABLE_SERVER_COOKIE_ALGS "available_server_cookie_algs"
#define NAME_CACHE_TTL "cache_ttl"
static bool aply_enabled(bool *enabled, const JsonNode *node)
{
assert(enabled && node);
......@@ -161,18 +159,6 @@ static bool apply_hash_func(int *alg_id, const JsonNode *node,
return false;
}
static bool apply_cache_ttl(uint32_t *cache_ttl, const JsonNode *node)
{
assert(cache_ttl && node);
if (node->tag == JSON_NUMBER) {
*cache_ttl = node->number_;
return true;
}
return false;
}
static bool apply_configuration(struct kr_cookie_ctx *cntrl,
const JsonNode *node)
{
......@@ -190,8 +176,6 @@ static bool apply_configuration(struct kr_cookie_ctx *cntrl,
} else if (strcmp(node->key, NAME_CLIENT_COOKIE_ALG) == 0) {
return apply_hash_func(&cntrl->clnt.current.alg_id, node,
kr_cc_alg_names);
} else if (strcmp(node->key, NAME_CACHE_TTL) == 0) {
return apply_cache_ttl(&cntrl->cache_ttl, node);
} else if (strcmp(node->key, NAME_SERVER_ENABLED) == 0) {
return aply_enabled(&cntrl->srvr.enabled, node);
} else if (strcmp(node->key, NAME_SERVER_SECRET) == 0) {
......@@ -296,7 +280,6 @@ static void apply_from_copy(struct kr_cookie_ctx *running,
}
/* Direct application. */
running->cache_ttl = shallow->cache_ttl;
running->clnt.enabled = shallow->clnt.enabled;
running->srvr.enabled = shallow->srvr.enabled;
}
......@@ -370,9 +353,6 @@ char *read_config(struct kr_cookie_ctx *ctx)
read_available_hashes(root_node, NAME_AVAILABLE_CLIENT_COOKIE_ALGS,
kr_cc_alg_names);
json_append_member(root_node, NAME_CACHE_TTL,
json_mknumber(ctx->cache_ttl));
json_append_member(root_node, NAME_SERVER_ENABLED,
json_mkbool(ctx->srvr.enabled));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment