Skip to content

Correctly parse the value set via OIDCMemCacheConnectionsTTL#1346

Merged
zandbelt merged 1 commit intoOpenIDC:masterfrom
rpluem-vf:ttl_in_secs_discussion_1345
Aug 18, 2025
Merged

Correctly parse the value set via OIDCMemCacheConnectionsTTL#1346
zandbelt merged 1 commit intoOpenIDC:masterfrom
rpluem-vf:ttl_in_secs_discussion_1345

Conversation

@rpluem-vf
Copy link
Copy Markdown
Contributor

Currently the value set via OIDCMemCacheConnectionsTTL is interpreted as microseconds and not as seconds. Correctly interpret this value as seconds via ap_timeout_parameter_parse and create the needed infrastructure to parse similar timeout fields in the future.

  • src/cache/memcache.c:

    • Change type of ttl to apr_interval_time_t.
    • The default value is now returned via oidc_cfg_cache_memcache_ttl_get.
    • Adjust format strings for apr_interval_time_t printing.
  • src/cfg/cache.c:

    • Generalize OIDC_CFG_MEMBER_FUNCS_CACHE_INT_EXT macro to OIDC_CFG_MEMBER_FUNCS_CACHE_PARSE which allows to specify the parsed type.
    • Add OIDC_CFG_MEMBER_FUNCS_CACHE_TIMEOUT macro which parses apr_interval_time_t values via oidc_cfg_parse_timeout_min_max.
    • Shorten maximum TTL via OIDC_CACHE_MEMCACHE_CONNECTIONS_TTL_MAX to 4292 seconds.
    • Change default via OIDC_DEFAULT_CACHE_MEMCACHE_CONNECTIONS_TTL from 0 to 60 seconds.
    • Use OIDC_CFG_MEMBER_FUNCS_CACHE_TIMEOUT instead of OIDC_CFG_MEMBER_FUNCS_CACHE_INT macro for memcache_ttl field.
  • src/cfg/cache.h:

    • Change type of memcache_ttl from int to apr_interval_time_t.
  • src/cfg/cfg.h:

    • Define OIDC_CONFIG_POS_TIMEOUT_UNSET to -2 (-1 might be used for unlimited timeout).
  • src/cfg/cfg_int.h:

    • Change type of memcache_ttl from int to apr_interval_time_t.
  • src/cfg/parse.c:

    • Add oidc_cfg_parse_timeout_min_max to parse a timeout string via ap_timeout_parameter_parse into an apr_interval_time_t if it is in a valid min/max range.
  • src/cfg/parse.h:

    • Add prototype for oidc_cfg_parse_timeout_min_max

Currently the value set via OIDCMemCacheConnectionsTTL is interpreted as
microseconds and not as seconds. Correctly interpret this value as seconds
via ap_timeout_parameter_parse and create the needed infrastructure to parse
similar timeout fields in the future.

* src/cache/memcache.c:
  - Change type of ttl to apr_interval_time_t.
  - The default value is now returned via oidc_cfg_cache_memcache_ttl_get.
  - Adjust format strings for apr_interval_time_t printing.

* src/cfg/cache.c:
  - Generalize  OIDC_CFG_MEMBER_FUNCS_CACHE_INT_EXT macro to
    OIDC_CFG_MEMBER_FUNCS_CACHE_PARSE which allows to specify the parsed
    type.
  - Add OIDC_CFG_MEMBER_FUNCS_CACHE_TIMEOUT macro which parses
    apr_interval_time_t values via oidc_cfg_parse_timeout_min_max.
  - Shorten maximum TTL via OIDC_CACHE_MEMCACHE_CONNECTIONS_TTL_MAX to 4292
    seconds.
  - Change default via OIDC_DEFAULT_CACHE_MEMCACHE_CONNECTIONS_TTL from 0
    to 60 seconds.
  - Use OIDC_CFG_MEMBER_FUNCS_CACHE_TIMEOUT instead of
    OIDC_CFG_MEMBER_FUNCS_CACHE_INT macro for memcache_ttl field.

* src/cfg/cache.h:
  - Change type of memcache_ttl from int to apr_interval_time_t.

* src/cfg/cfg.h:
  - Define OIDC_CONFIG_POS_TIMEOUT_UNSET to -2 (-1 might be used for unlimited
    timeout).

* src/cfg/cfg_int.h:
  - Change type of memcache_ttl from int to apr_interval_time_t.

* src/cfg/parse.c:
  - Add oidc_cfg_parse_timeout_min_max to parse a timeout string via
    ap_timeout_parameter_parse into an apr_interval_time_t if it is in a valid
    min/max range.

* src/cfg/parse.h:
  - Add prototype for oidc_cfg_parse_timeout_min_max

Signed-off-by: Ruediger Pluem <[email protected]>
@zandbelt zandbelt merged commit 01e7096 into OpenIDC:master Aug 18, 2025
3 checks passed
zandbelt added a commit that referenced this pull request Aug 18, 2025
Signed-off-by: Hans Zandbelt <[email protected]>
@rpluem-vf rpluem-vf deleted the ttl_in_secs_discussion_1345 branch August 18, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants