From c5a09528fba9e711250888b1515ab4473dc0cea7 Mon Sep 17 00:00:00 2001 From: pjotrp Date: Fri, 17 Apr 2026 12:27:42 +0200 Subject: Patch (opensmtp) because it fails on sendmail -t --- gn/packages/mail.scm | 20 ++++++++++++ gn/packages/patches/opensmtpd-gn-fixes.patch | 48 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 gn/packages/mail.scm create mode 100644 gn/packages/patches/opensmtpd-gn-fixes.patch diff --git a/gn/packages/mail.scm b/gn/packages/mail.scm new file mode 100644 index 0000000..1e3b888 --- /dev/null +++ b/gn/packages/mail.scm @@ -0,0 +1,20 @@ +(define-module (gn packages mail) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (gnu packages mail)) + +(define-public opensmtpd-patched + (package + (inherit opensmtpd) + (name "opensmtpd-patched") + (source + (origin + (inherit (package-source opensmtpd)) + (patches + (list (local-file "patches/opensmtpd-gn-fixes.patch"))))) + (synopsis "Lightweight SMTP daemon (with GN patches)") + (description + "OpenSMTPD with patches for missing grp.h include, TLS option +parsing fix, and timezone fallback for systems without tm_gmtoff."))) diff --git a/gn/packages/patches/opensmtpd-gn-fixes.patch b/gn/packages/patches/opensmtpd-gn-fixes.patch new file mode 100644 index 0000000..e310bbe --- /dev/null +++ b/gn/packages/patches/opensmtpd-gn-fixes.patch @@ -0,0 +1,48 @@ +diff -ruN opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/smtpc.c opensmtpd-7.7.0p0/usr.sbin/smtpd/smtpc.c +--- opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/smtpc.c 2026-04-17 10:19:15.152524476 +0000 ++++ opensmtpd-7.7.0p0/usr.sbin/smtpd/smtpc.c 2026-04-17 10:19:41.936756962 +0000 +@@ -114,8 +114,8 @@ + servname = value; + break; + case -1: +- if (suboptarg) +- fatalx("invalid TLS option \"%s\"", suboptarg); ++ //if (suboptarg) ++ // fatalx("invalid TLS option \"%s\"", suboptarg); + fatalx("missing TLS option"); + } + } +diff -ruN opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/smtpctl.c opensmtpd-7.7.0p0/usr.sbin/smtpd/smtpctl.c +--- opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/smtpctl.c 2026-04-17 10:19:15.156524511 +0000 ++++ opensmtpd-7.7.0p0/usr.sbin/smtpd/smtpctl.c 2026-04-17 10:19:15.212525001 +0000 +@@ -54,6 +54,8 @@ + #endif + #include + ++#include ++ + #include "smtpd.h" + #include "parser.h" + #include "log.h" +diff -ruN opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/to.c opensmtpd-7.7.0p0/usr.sbin/smtpd/to.c +--- opensmtpd-7.7.0p0.orig/usr.sbin/smtpd/to.c 2026-04-17 10:19:15.156524511 +0000 ++++ opensmtpd-7.7.0p0/usr.sbin/smtpd/to.c 2026-04-17 10:19:15.252525351 +0000 +@@ -152,7 +152,7 @@ + time_to_text(time_t when) + { + struct tm *lt; +- static char buf[40]; ++ static char buf[50]; + const char *day[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + const char *month[] = {"Jan","Feb","Mar","Apr","May","Jun", + "Jul","Aug","Sep","Oct","Nov","Dec"}; +@@ -169,6 +169,9 @@ + #elif defined HAVE_DECL_ALTZONE && defined HAVE_DECL_TIMEZONE + offset = lt->tm_isdst > 0 ? altzone : timezone; + tz = lt->tm_isdst > 0 ? tzname[1] : tzname[0]; ++#else ++ offset = 0; ++ tz = "GMT"; + #endif + + /* We do not use strftime because it is subject to locale substitution*/ -- cgit 1.4.1