Skip to content

Commit

Permalink
Merge branch pull request trusteddomainproject#230 from futatuki/issu…
Browse files Browse the repository at this point in the history
…e229-fix-signingtable-verification

Fix issue trusteddomainproject#229: fix db handling on verification of SigningTable
in dkimf_config_load

- check error on calling dkimf_db_walk()
- fix request parameter for "signer" field in SigningTable

trusteddomainproject#230
trusteddomainproject#229
  • Loading branch information
futatuki committed Oct 7, 2024
2 parents 38f16f9 + 6245d29 commit 720ca95
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions opendkim/opendkim.c
Original file line number Diff line number Diff line change
Expand Up @@ -8352,20 +8352,23 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
char keydata[BUFRSZ + 1];
char signalgstr[BUFRSZ + 1];
char signer[BUFRSZ + 1];
int db_stat;

dbd[0].dbdata_flags = 0;

memset(keyname, '\0', sizeof keyname);
/*
** As we don't care signer values here,
** we don't need to clear it.
*/

dbd[0].dbdata_buffer = keyname;
dbd[0].dbdata_buflen = sizeof keyname - 1;
dbd[0].dbdata_flags = 0;
dbd[1].dbdata_buffer = signer;
dbd[1].dbdata_buflen = sizeof signer - 1;
dbd[1].dbdata_flags = 0;
dbd[1].dbdata_flags = DKIMF_DB_DATA_OPTIONAL;

while (dkimf_db_walk(conf->conf_signtabledb, first,
NULL, NULL, dbd, 2) == 0)
while ((db_stat = dkimf_db_walk(conf->conf_signtabledb,
first, NULL, NULL, dbd, 2)) == 0)
{
first = FALSE;
found = FALSE;
Expand All @@ -8381,6 +8384,11 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
dbd[3].dbdata_buffer = signalgstr;
dbd[3].dbdata_buflen = sizeof signalgstr - 1;
dbd[3].dbdata_flags = DKIMF_DB_DATA_OPTIONAL;
/*
** As we don't care for values of the entry
** in KeyTable here, we don't need to clear
** buffers for them.
*/

if (dkimf_db_get(conf->conf_keytabledb,
keyname, strlen(keyname),
Expand All @@ -8401,6 +8409,16 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
dbd[0].dbdata_buffer = keyname;
dbd[0].dbdata_buflen = sizeof keyname - 1;
dbd[0].dbdata_flags = 0;
dbd[1].dbdata_buffer = signer;
dbd[1].dbdata_buflen = sizeof signer - 1;
dbd[1].dbdata_flags = DKIMF_DB_DATA_OPTIONAL;
}
if (db_stat == -1)
{
snprintf(err, errlen,
"error on retrieving an entry from \"%s\"",
conf->conf_signtable);
return -1;
}
}
}
Expand Down

0 comments on commit 720ca95

Please sign in to comment.