Browse Source

[Minor] Do not serve absent dkim private keys from LRU cache

tags/1.9.0
Vsevolod Stakhov 5 years ago
parent
commit
45df2c78a8
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/libserver/dkim.c

+ 7
- 2
src/libserver/dkim.c View File

@@ -2736,11 +2736,16 @@ rspamd_dkim_sign_key_maybe_invalidate (rspamd_dkim_sign_key_t *key,
if (type == RSPAMD_DKIM_SIGN_KEY_FILE) {
gchar fpath[PATH_MAX];

if (len >= PATH_MAX) {
/* Bad thing */
return TRUE;
}

rspamd_snprintf (fpath, sizeof (fpath), "%*s", (gint) len, what);

if (stat (fpath, &st) == -1) {
/* Prefer to use cached key since it is absent on FS */
return FALSE;
/* Wrong: do NOT prefer to use cached key since it is absent on FS */
return TRUE;
}

if (st.st_mtime > key->mtime) {

Loading…
Cancel
Save