pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/mail/opendkim
Module Name: pkgsrc
Committed By: manu
Date: Fri Apr 21 13:03:09 UTC 2023
Modified Files:
pkgsrc/mail/opendkim: distinfo
Added Files:
pkgsrc/mail/opendkim/patches: patch-opendkim_opendkim-config.h
patch-opendkim_opendkim.c patch-opendkim_opendkim.conf.5
Log Message:
Add missing patch, as pointed by wiz@
Split patch as one per patched file, as requested by sketch@
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 pkgsrc/mail/opendkim/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim-config.h \
pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.c \
pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.conf.5
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/mail/opendkim/distinfo
diff -u pkgsrc/mail/opendkim/distinfo:1.25 pkgsrc/mail/opendkim/distinfo:1.26
--- pkgsrc/mail/opendkim/distinfo:1.25 Fri Apr 21 00:51:52 2023
+++ pkgsrc/mail/opendkim/distinfo Fri Apr 21 13:03:08 2023
@@ -1,9 +1,11 @@
-$NetBSD: distinfo,v 1.25 2023/04/21 00:51:52 manu Exp $
+$NetBSD: distinfo,v 1.26 2023/04/21 13:03:08 manu Exp $
BLAKE2s (opendkim-2.10.3.tar.gz) = b790b2fdcffd16372460f0d686845019c85d21e3530202792c5d601801030dc7
SHA512 (opendkim-2.10.3.tar.gz) = 97923e533d072c07ae4d16a46cbed95ee799aa50f19468d8bc6d1dc534025a8616c3b4b68b5842bc899b509349a2c9a67312d574a726b048c0ea46dd4fcc45d8
Size (opendkim-2.10.3.tar.gz) = 1210224 bytes
-SHA1 (patch-OmitHeadersDB) = 7aedd31a0572335ab2f60fc454e60bbf7806f79f
SHA1 (patch-configure.ac) = c9ae182ed2c5c2ec3018fe4c6066ed7fa0d3686f
SHA1 (patch-libopendkim_dkim-canon.c) = 3d15386a114639f2479505bc3b12c1de67dbb18a
+SHA1 (patch-opendkim_opendkim-config.h) = 26d8fc53c223cef7d7c2e8acbf9e6a085aebffaf
SHA1 (patch-opendkim_opendkim-crypto.c) = d7d08fda3dba5bf9cb834123218b1e89b78878e5
+SHA1 (patch-opendkim_opendkim.c) = 1e983a419d0b182bce371dfb24c4df959e0bbb1e
+SHA1 (patch-opendkim_opendkim.conf.5) = d6566b01203a92f6ab7e87572043d91fa0efa63a
Added files:
Index: pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim-config.h
diff -u /dev/null pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim-config.h:1.1
--- /dev/null Fri Apr 21 13:03:09 2023
+++ pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim-config.h Fri Apr 21 13:03:09 2023
@@ -0,0 +1,22 @@
+$NetBSD: patch-opendkim_opendkim-config.h,v 1.1 2023/04/21 13:03:09 manu Exp $
+
+Add OmitHeadersDB directive to specify file containing per-recipient
+list of headers to not use in signature. The file format is:
+
+user%doamin.tld@localhost header1,header2,header3
+domain.tld header4,header5
+
+From upstream https://github.com/trusteddomainproject/OpenDKIM/pull/173
+
+--- opendkim/opendkim-config.h.orig
++++ opendkim/opendkim-config.h
+@@ -114,8 +114,9 @@
+ { "MustBeSigned", CONFIG_TYPE_STRING, FALSE },
+ { "Nameservers", CONFIG_TYPE_STRING, FALSE },
+ { "NoHeaderB", CONFIG_TYPE_BOOLEAN, FALSE },
+ { "OmitHeaders", CONFIG_TYPE_STRING, FALSE },
++ { "OmitHeadersDB", CONFIG_TYPE_STRING, FALSE },
+ { "On-BadSignature", CONFIG_TYPE_STRING, FALSE },
+ { "On-Default", CONFIG_TYPE_STRING, FALSE },
+ { "On-DNSError", CONFIG_TYPE_STRING, FALSE },
+ { "On-InternalError", CONFIG_TYPE_STRING, FALSE },
Index: pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.c
diff -u /dev/null pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.c:1.1
--- /dev/null Fri Apr 21 13:03:09 2023
+++ pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.c Fri Apr 21 13:03:09 2023
@@ -0,0 +1,273 @@
+$NetBSD: patch-opendkim_opendkim.c,v 1.1 2023/04/21 13:03:09 manu Exp $
+
+Add OmitHeadersDB directive to specify file containing per-recipient
+list of headers to not use in signature. The file format is:
+
+user%doamin.tld@localhost header1,header2,header3
+domain.tld header4,header5
+
+From upstream https://github.com/trusteddomainproject/OpenDKIM/pull/173
+
+--- opendkim/opendkim.c.orig
++++ opendkim/opendkim.c
+@@ -390,6 +390,7 @@ struct dkimf_config
+ DKIMF_DB conf_domainsdb; /* domains to sign (DB) */
+ DKIMF_DB conf_omithdrdb; /* headers to omit (DB) */
+ char ** conf_omithdrs; /* headers to omit (array) */
++ DKIMF_DB conf_omithdrkdb; /* headers to omit (keyed DB) */
+ DKIMF_DB conf_signhdrsdb; /* headers to sign (DB) */
+ char ** conf_signhdrs; /* headers to sign (array) */
+ DKIMF_DB conf_senderhdrsdb; /* sender headers (DB) */
+@@ -519,6 +520,7 @@ struct msgctx
+ /* primary domain */
+ unsigned char mctx_dkimar[DKIM_MAXHEADER + 1];
+ /* DKIM Auth-Results content */
++ char ** mctx_omithdrs; /* headers to omit (array) */
+ };
+
+ /*
+@@ -1053,6 +1055,188 @@ dkimf_getsymval(SMFICTX *ctx, char *sym)
+ return smfi_getsymval(ctx, sym);
+ }
+
++
++/*
++** DKIMF_GET_OMITHEADERS -- Get per-recipient headers to not sign
++**
++** Parameters:
++** conf -- configuration handle
++** rcpt -- recipient
++** hdrs -- comma-separated list of headers (returned)
++** hdrslen -- size of hdrs buffer
++**
++** Return value:
++** 0 -- success
++** !0 -- error
++*/
++
++static int
++dkimf_get_omitheaders(struct dkimf_config *conf, const char *rcpt,
++ char *hdrs, size_t hdrslen)
++{
++ int status;
++ _Bool found;
++ unsigned char *user = NULL;
++ unsigned char *domain = NULL;
++ char tmp[MAXADDRESS + 1];
++ char addr[MAXADDRESS + 1];
++ struct dkimf_db_data req;
++
++ assert(conf != NULL);
++ assert(conf->conf_omithdrkdb != NULL);
++ assert(rcpt != NULL);
++ assert(hdrs != NULL);
++
++ strlcpy(tmp, rcpt, sizeof(tmp));
++ status = dkim_mail_parse(tmp, &user, &domain);
++ if (status != 0)
++ {
++ return -1;
++ }
++
++ memset(&req, '\0', sizeof req);
++ req.dbdata_buffer = hdrs;
++ req.dbdata_buflen = hdrslen;
++
++ /* first try full "user@host" */
++ found = FALSE;
++ (void)snprintf(addr, sizeof addr, "%s@%s", user, domain);
++ status = dkimf_db_get(conf->conf_omithdrkdb, addr, strlen(addr),
++ &req, 1, &found);
++ if (status != 0 ||
++ (found && (req.dbdata_buflen == 0 ||
++ req.dbdata_buflen == (size_t) -1)))
++ {
++ return -1;
++ }
++ else if (found)
++ {
++ req.dbdata_buffer[req.dbdata_buflen] = '\0';
++ return 0;
++ }
++
++ /* now just "host" */
++
++ memset(&req, '\0', sizeof req);
++ req.dbdata_buffer = hdrs;
++ req.dbdata_buflen = hdrslen;
++
++ found = FALSE;
++ status = dkimf_db_get(conf->conf_omithdrkdb, domain, strlen(domain),
++ &req, 1, &found);
++ if (status != 0 ||
++ (found && (req.dbdata_buflen == 0 ||
++ req.dbdata_buflen == (size_t) -1)))
++ {
++ return -1;
++ }
++ else if (found)
++ {
++ req.dbdata_buffer[req.dbdata_buflen] = '\0';
++ return 0;
++ }
++
++ return -1;
++}
++
++/*
++** DKIMF_APPEND_ARRAY -- Append an item to an string array
++** The item is only added if it is not
++** alreay present.
++**
++** Parameters:
++** arrayp -- pointer to array
++** item -- new string to append
++** init -- array of strings to insert if array is empty
++**
++** Return value:
++** None
++*/
++
++static void
++dkimf_append_array(char ***arrayp, char *item, const u_char **init)
++{
++ char **array;
++ int i;
++
++ assert(arrayp != NULL);
++ assert(*arrayp != NULL || init != NULL);
++
++ array = *arrayp;
++
++ if (array == NULL) {
++ for (i = 0; init[i]; i++);
++
++ array = calloc(i + 1, sizeof(*array));
++ if (array == NULL)
++ {
++ syslog(LOG_ERR, "calloc failed");
++ return;
++ }
++
++ for (i = 0; init[i]; i++)
++ array[i] = strdup(init[i]);
++ }
++
++ for (i = 0; array[i]; i++) {
++ if (strcasecmp(array[i], item) == 0)
++ return;
++ }
++
++ if ((array = realloc(array, (i + 2) * sizeof(*array))) == NULL)
++ {
++ syslog(LOG_ERR, "realloc failed");
++ return;
++ }
++
++ array[i] = strdup(item);
++ array[i + 1] = NULL;
++
++ *arrayp = array;
++
++ return;
++}
++
++/*
++** DKIMF_CONFIGURE_OMITHEADERS -- Configure per-recipient header to not sign
++**
++** Parameters:
++** conf -- configuration handle
++** omithdrs -- comma-separated list of headers to not sign
++**
++** Return value:
++** None
++*/
++
++static void
++dkimf_configure_omitheaders(msgctx mctx, struct dkimf_config *conf,
++ char *omithdrs)
++{
++ size_t count = 0;
++ const char *delim = " ,";
++ char *p;
++ char *last;
++
++ assert(conf != NULL);
++ assert(conf->conf_libopendkim != NULL);
++
++ if (omithdrs) {
++ for (p = strtok_r(omithdrs, delim, &last);
++ p != NULL;
++ p = strtok_r(NULL, delim, &last))
++ dkimf_append_array(&mctx->mctx_omithdrs, p,
++ dkim_should_not_signhdrs);
++ }
++
++ (void)dkim_options(conf->conf_libopendkim,
++ DKIM_OP_SETOPT,
++ DKIM_OPTS_SKIPHDRS,
++ mctx->mctx_omithdrs, sizeof(char **));
++
++ return;
++}
++
++
+ #ifdef USE_LUA
+ /*
+ ** LUA ACCESSOR FUNCTIONS
+@@ -5920,6 +6104,9 @@ dkimf_config_free(struct dkimf_config *conf)
+ if (conf->conf_omithdrdb != NULL)
+ dkimf_db_close(conf->conf_omithdrdb);
+
++ if (conf->conf_omithdrkdb != NULL)
++ dkimf_db_close(conf->conf_omithdrkdb);
++
+ if (conf->conf_thirdpartydb != NULL)
+ dkimf_db_close(conf->conf_thirdpartydb);
+
+@@ -7293,6 +7480,29 @@ dkimf_config_load(struct config *data, struct dkimf_config *conf,
+ }
+ }
+
++ str = NULL;
++ if (data != NULL)
++ {
++ (void) config_get(data, "OmitHeadersDB", &str, sizeof str);
++ if (str != NULL)
++ {
++ int status;
++ char *dberr = NULL;
++
++ status = dkimf_db_open(&conf->conf_omithdrkdb, str,
++ (dbflags |
++ DKIMF_DB_FLAG_ICASE |
++ DKIMF_DB_FLAG_READONLY),
++ NULL, &dberr);
++ if (status != 0)
++ {
++ snprintf(err, errlen, "%s: dkimf_db_open(): %s",
++ str, dberr);
++ return -1;
++ }
++ }
++ }
++
+ str = NULL;
+ if (data != NULL)
+ {
+@@ -11238,6 +11448,15 @@ mlfi_envrcpt(SMFICTX *ctx, char **envrcpt)
+ dfc->mctx_rcptlist = a;
+ }
+
++ if (conf->conf_omithdrkdb != NULL) {
++ char omithdrs[MAXBUFRSZ];
++ if (dkimf_get_omitheaders(conf, envrcpt[0],
++ omithdrs, sizeof omithdrs) != -1)
++ dkimf_configure_omitheaders(dfc, conf, omithdrs);
++ else
++ dkimf_configure_omitheaders(dfc, conf, NULL);
++ }
++
+ return SMFIS_CONTINUE;
+ }
+
Index: pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.conf.5
diff -u /dev/null pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.conf.5:1.1
--- /dev/null Fri Apr 21 13:03:09 2023
+++ pkgsrc/mail/opendkim/patches/patch-opendkim_opendkim.conf.5 Fri Apr 21 13:03:09 2023
@@ -0,0 +1,28 @@
+$NetBSD: patch-opendkim_opendkim.conf.5,v 1.1 2023/04/21 13:03:09 manu Exp $
+
+Add OmitHeadersDB directive to specify file containing per-recipient
+list of headers to not use in signature. The file format is:
+
+user%doamin.tld@localhost header1,header2,header3
+domain.tld header4,header5
+
+From upstream https://github.com/trusteddomainproject/OpenDKIM/pull/173
+
+--- opendkim/opendkim.conf.5.in.orig
++++ opendkim/opendkim.conf.5.in
+@@ -619,6 +619,15 @@ default; for example, "*,+foobar" will use the entire default list plus
+ the name "foobar", while "*,-Bcc" would use the entire default list except
+ for the "Bcc" entry.
+
++.TP
++.I OmitHeadersDB (string)
++Specify a file containing a per-recipient list of headers to omit
++when generating signatures. Return-Path, Received, Comments, and
++Keywoard are implicitely added to the list. The file should have
++two columns : a recipient as user%domain.tld@localhost or domain.tld, and
++a comma-separated lis of headers to omit. For example
++"list%example.net@localhost Subject,Bcc"
++
+ .TP
+ .I On-BadSignature (string)
+ Selects the action to be taken when a signature fails to validate.
Home |
Main Index |
Thread Index |
Old Index