Skip to content

Commit

Permalink
Remove order dependent comparisons with the cookie_secrets_source enum
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop committed Oct 22, 2024
1 parent ec858b9 commit b090af7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,7 +2388,7 @@ can_dump_cookie_secrets(RES* ssl, nsd_type* const nsd)
if(!cookie_secret_file(nsd->options))
(void)ssl_printf(ssl, "error: empty cookie-secret-file\n");

else if(nsd->cookie_secrets_source > COOKIE_SECRETS_FROM_FILE)
else if(nsd->cookie_secrets_source == COOKIE_SECRETS_FROM_CONFIG)
(void)ssl_printf(ssl, "error: cookie secrets are already "
"configured. Remove \"cookie-secret:\" and "
"\"cookie-staging-secret:\" entries from configuration "
Expand Down Expand Up @@ -2524,7 +2524,8 @@ do_add_cookie_secret(RES* ssl, xfrd_state_type* xrfd, char* arg) {
backup_cookie_count = nsd->cookie_count;
memcpy( backup_cookie_secrets, nsd->cookie_secrets
, sizeof(cookie_secrets_type));
if(nsd->cookie_secrets_source < COOKIE_SECRETS_FROM_FILE) {
if(nsd->cookie_secrets_source != COOKIE_SECRETS_FROM_FILE
&& nsd->cookie_secrets_source != COOKIE_SECRETS_FROM_CONFIG) {
nsd->cookie_count = 0;
}
add_cookie_secret(nsd, secret);
Expand Down

0 comments on commit b090af7

Please sign in to comment.