Skip to content

Commit

Permalink
don't crash on semicolon in opendmarc-arcares. Patch from dilyanpalauzov
Browse files Browse the repository at this point in the history
  • Loading branch information
thegushi committed Mar 18, 2021
1 parent 67ec4e5 commit 6966743
Show file tree
Hide file tree
Showing 2 changed files with 214 additions and 0 deletions.
212 changes: 212 additions & 0 deletions conf_refcnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
m4/ac_pthread.m4:# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
opendmarc/opendmarc.c: conf->conf_authservid = strdup(myhostname);
opendmarc/opendmarc.c: conf->conf_authservid = strdup(str);
opendmarc/opendmarc.c: dmarcf_mkarray(str, ",", &conf->conf_trustedauthservids);
opendmarc/opendmarc.c: dmarcf_mkarray(str, ",", &conf->conf_ignoredomains);
opendmarc/opendmarc.c: &conf->conf_authservidwithjobid,
opendmarc/opendmarc.c: sizeof conf->conf_authservidwithjobid);
opendmarc/opendmarc.c: &conf->conf_copyfailsto,
opendmarc/opendmarc.c: sizeof conf->conf_copyfailsto);
opendmarc/opendmarc.c: if (conf->conf_dnstimeout == DEFTIMEOUT)
opendmarc/opendmarc.c: &conf->conf_dnstimeout,
opendmarc/opendmarc.c: sizeof conf->conf_dnstimeout);
opendmarc/opendmarc.c: &conf->conf_enablecores,
opendmarc/opendmarc.c: sizeof conf->conf_enablecores);
opendmarc/opendmarc.c: &conf->conf_spfignoreresults,
opendmarc/opendmarc.c: sizeof conf->conf_spfignoreresults);
opendmarc/opendmarc.c: &conf->conf_spfselfvalidate,
opendmarc/opendmarc.c: sizeof conf->conf_spfselfvalidate);
opendmarc/opendmarc.c: &conf->conf_rejectfail,
opendmarc/opendmarc.c: sizeof conf->conf_rejectfail);
opendmarc/opendmarc.c: &conf->conf_reqhdrs,
opendmarc/opendmarc.c: sizeof conf->conf_reqhdrs);
opendmarc/opendmarc.c: &conf->conf_afrf,
opendmarc/opendmarc.c: sizeof conf->conf_afrf);
opendmarc/opendmarc.c: &conf->conf_reject_multi_from,
opendmarc/opendmarc.c: sizeof conf->conf_reject_multi_from);
opendmarc/opendmarc.c: &conf->conf_afrfnone,
opendmarc/opendmarc.c: sizeof conf->conf_afrfnone);
opendmarc/opendmarc.c: &conf->conf_afrfas,
opendmarc/opendmarc.c: sizeof conf->conf_afrfas);
opendmarc/opendmarc.c: &conf->conf_afrfbcc,
opendmarc/opendmarc.c: sizeof conf->conf_afrfbcc);
opendmarc/opendmarc.c: &conf->conf_recordall,
opendmarc/opendmarc.c: sizeof conf->conf_recordall);
opendmarc/opendmarc.c: &conf->conf_holdquarantinedmessages,
opendmarc/opendmarc.c: sizeof conf->conf_holdquarantinedmessages);
opendmarc/opendmarc.c: &conf->conf_ignoreauthclients,
opendmarc/opendmarc.c: sizeof conf->conf_ignoreauthclients);
opendmarc/opendmarc.c: &conf->conf_reportcmd,
opendmarc/opendmarc.c: sizeof conf->conf_reportcmd);
opendmarc/opendmarc.c: &conf->conf_pslist,
opendmarc/opendmarc.c: sizeof conf->conf_pslist);
opendmarc/opendmarc.c: if (!conf->conf_dolog)
opendmarc/opendmarc.c: (void) config_get(data, "Syslog", &conf->conf_dolog,
opendmarc/opendmarc.c: sizeof conf->conf_dolog);
opendmarc/opendmarc.c: if (!conf->conf_addswhdr)
opendmarc/opendmarc.c: &conf->conf_addswhdr,
opendmarc/opendmarc.c: sizeof conf->conf_addswhdr);
opendmarc/opendmarc.c: &conf->conf_historyfile,
opendmarc/opendmarc.c: sizeof conf->conf_historyfile);
opendmarc/opendmarc.c: if (conf->conf_trustedauthservids == NULL &&
opendmarc/opendmarc.c: conf->conf_authservid != NULL)
opendmarc/opendmarc.c: dmarcf_mkarray(conf->conf_authservid, ",",
opendmarc/opendmarc.c: &conf->conf_trustedauthservids);
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_domainwhitelisthashcount = 0;
opendmarc/opendmarc.c: if (!dmarcf_addlist_csv(whitelist, ",", &conf->conf_domainwhitelist))
opendmarc/opendmarc.c: &conf->conf_domainwhitelist))
opendmarc/opendmarc.c: for (cur = conf->conf_domainwhitelist;
opendmarc/opendmarc.c: conf->conf_domainwhitelisthashcount++;
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_refcnt == 0)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: curconf->conf_refcnt++;
opendmarc/opendmarc.c: if (conf->conf_copyfailsto != NULL)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_refcnt--;
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: curconf->conf_refcnt++;
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (!conf->conf_spfselfvalidate)
opendmarc/opendmarc.c: if (conf->conf_ignoreauthclients &&
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (no_i_whine && conf->conf_dolog)
opendmarc/opendmarc.c: authservid = conf->conf_authservid;
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_reqhdrs && reqhdrs_error != NULL)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_reject_multi_from)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_reqhdrs)
opendmarc/opendmarc.c: if (conf->conf_ignoredomains != NULL &&
opendmarc/opendmarc.c: dmarcf_match(domain, conf->conf_ignoredomains, TRUE))
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: (conf->conf_trustedauthservids == NULL ||
opendmarc/opendmarc.c: !dmarcf_match(ar.ares_host, conf->conf_trustedauthservids,
opendmarc/opendmarc.c: if (!conf->conf_authservidwithjobid)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: (conf->conf_trustedauthservids == NULL ||
opendmarc/opendmarc.c: conf->conf_trustedauthservids,
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: && !conf->conf_spfignoreresults
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_domainwhitelisthashcount > 0)
opendmarc/opendmarc.c: && !conf->conf_spfignoreresults
opendmarc/opendmarc.c: if (conf->conf_spfselfvalidate)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: (conf->conf_afrfnone && policy == DMARC_POLICY_NONE)) &&
opendmarc/opendmarc.c: conf->conf_afrf &&
opendmarc/opendmarc.c: (conf->conf_afrfbcc != NULL || ruv != NULL))
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_afrfas != NULL)
opendmarc/opendmarc.c: conf->conf_afrfas);
opendmarc/opendmarc.c: if (conf->conf_afrfbcc != NULL)
opendmarc/opendmarc.c: conf->conf_afrfbcc);
opendmarc/opendmarc.c: if (ruv != NULL && conf->conf_afrfbcc != NULL)
opendmarc/opendmarc.c: conf->conf_afrfbcc);
opendmarc/opendmarc.c: out = popen(conf->conf_reportcmd, "w");
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (status != 0 && conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_rejectfail &&
opendmarc/opendmarc.c: if (status != MI_SUCCESS && conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_copyfailsto != NULL)
opendmarc/opendmarc.c: status = dmarcf_addrcpt(ctx, conf->conf_copyfailsto);
opendmarc/opendmarc.c: if (status != MI_SUCCESS && conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_rejectfail && conf->conf_holdquarantinedmessages && random() % 100 < pct)
opendmarc/opendmarc.c: if (status != MI_SUCCESS && conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_copyfailsto != NULL)
opendmarc/opendmarc.c: status = dmarcf_addrcpt(ctx, conf->conf_copyfailsto);
opendmarc/opendmarc.c: if (status != MI_SUCCESS && conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_authservidwithjobid ? "/" : "",
opendmarc/opendmarc.c: conf->conf_authservidwithjobid ? dfc->mctx_jobid : "",
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: if (conf->conf_historyfile != NULL &&
opendmarc/opendmarc.c: (conf->conf_recordall || ostatus != DMARC_DNS_ERROR_NO_RECORD))
opendmarc/opendmarc.c: f = fopen(conf->conf_historyfile, "a");
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_historyfile,
opendmarc/opendmarc.c: conf->conf_historyfile,
opendmarc/opendmarc.c: if (ferror(f) && conf->conf_dolog)
opendmarc/opendmarc.c: conf->conf_historyfile,
opendmarc/opendmarc.c: conf->conf_historyfile,
opendmarc/opendmarc.c: if (conf->conf_addswhdr)
opendmarc/opendmarc.c: if (conf->conf_dolog)
opendmarc/opendmarc.c: assert(conf->conf_refcnt == 0);
opendmarc/opendmarc.c: if (conf->conf_data != NULL)
opendmarc/opendmarc.c: config_free(conf->conf_data);
opendmarc/opendmarc.c: if (conf->conf_ignoredomains != NULL)
opendmarc/opendmarc.c: dmarcf_freearray(conf->conf_ignoredomains);
opendmarc/opendmarc.c: if (conf->conf_trustedauthservids != NULL)
opendmarc/opendmarc.c: dmarcf_freearray(conf->conf_trustedauthservids);
opendmarc/opendmarc.c: if (conf->conf_authservid != NULL)
opendmarc/opendmarc.c: free(conf->conf_authservid);
opendmarc/opendmarc.c: if (conf->conf_domainwhitelisthashcount > 0)
opendmarc/opendmarc.c: dmarcf_freelist(conf->conf_domainwhitelist);
opendmarc/opendmarc.c: curconf->conf_dolog = TRUE;
opendmarc/opendmarc.c: dolog = curconf->conf_dolog;
opendmarc/opendmarc.c: curconf->conf_data = cfg;
opendmarc/opendmarc.c: curconf->conf_dolog = FALSE;
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_enablecores)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: curconf->conf_dolog);
opendmarc/opendmarc.c: curconf->conf_dolog);
opendmarc/opendmarc.c: if (wpid != -1 && curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_pslist != NULL)
opendmarc/opendmarc.c: strncpy(libopendmarc.tld_source_file, curconf->conf_pslist,
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: curconf->conf_trustedauthservids != NULL &&
opendmarc/opendmarc.c: curconf->conf_trustedauthservids[c] != NULL;
opendmarc/opendmarc.c: curconf->conf_trustedauthservids[c],
opendmarc/opendmarc.c: curconf->conf_trustedauthservids[c],
opendmarc/opendmarc.c: if (curconf->conf_dolog)
opendmarc/opendmarc.c: if (curconf->conf_dolog)
2 changes: 2 additions & 0 deletions opendmarc/opendmarc-arcares.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ opendmarc_arcares_parse (u_char *hdr, struct arcares *aar)

leading_space_len = strspn(token, " \n\t");
token_ptr = token + leading_space_len;
if (*token_ptr == '\0')
return 0;
tag_label = strsep(&token_ptr, "=");
tag_value = token_ptr;
tag_code = opendmarc_arcares_convert(aar_tags, tag_label);
Expand Down

0 comments on commit 6966743

Please sign in to comment.