unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Timmy Douglas via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 53547@debbugs.gnu.org
Subject: bug#53547: Error sending email with OpenSMTPD, fatal: time_to_text: bsnprintf
Date: Tue, 25 Jan 2022 21:51:27 -0800	[thread overview]
Message-ID: <87mtjjkpsw.fsf@timmydouglas.com> (raw)


I recently installed opensmtpd and have been trying to send email. It
appears there is an error with the bsnprintf function:

$ ./sendmail -t
To: timmy
From: me 
Subject: hi

aoeueou
(press ^D)
sendmail: time_to_text: bsnprintf

I reported this issue here:
https://github.com/OpenSMTPD/OpenSMTPD/issues/1166

mcron appears to invoke sendmail with `-t`, which is how I discovered
the issue.

If anyone is trying to figure out how to setup the setuid on Guix
system, here is my config.scm file (I couldn't find anything online so
maybe this will help):

(operating-system
 ; ...
   (append (list (setuid-program
                  (program (file-append opensmtpd "/sbin/smtpctl"))
		  (setuid? #f)
		  (setgid? #t)
		  (user "root")
		  (group "smtpq"))
		 (setuid-program
                  (program (file-append opensmtpd "/sbin/sendmail"))
		  (setuid? #f)
		  (setgid? #t)
		  (user "root")
		  (group "smtpq")))
           %setuid-programs))

I tried building the latest opensmtpd from git, which required a few
other changes to patch the bug:



diff --git a/usr.sbin/smtpd/smtpc.c b/usr.sbin/smtpd/smtpc.c
index 49750dca..4ed506dc 100644
--- a/usr.sbin/smtpd/smtpc.c
+++ b/usr.sbin/smtpd/smtpc.c
@@ -114,8 +114,8 @@ parse_tls_options(char *opt)
                        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 --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 00c49cb7..3630ef1d 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -52,6 +52,8 @@
 #endif
 #include <limits.h>
 
+#include <grp.h>
+
 #include "smtpd.h"
 #include "parser.h"
 #include "log.h"
diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c
index 3ea04d89..9928d09b 100644
--- a/usr.sbin/smtpd/to.c
+++ b/usr.sbin/smtpd/to.c
@@ -176,7 +176,7 @@ const char *
 time_to_text(time_t when)
 {
        struct tm *lt;
-       static char buf[40];
+       static char buf[50];
        char *day[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
        char *month[] = {"Jan","Feb","Mar","Apr","May","Jun",
                         "Jul","Aug","Sep","Oct","Nov","Dec"};
@@ -193,6 +193,9 @@ time_to_text(time_t when)
 #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*/




             reply	other threads:[~2022-01-26  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  5:51 Timmy Douglas via Bug reports for GNU Guix [this message]
2023-11-21  7:09 ` bug#53547: Error sending email with OpenSMTPD, fatal: time_to_text: bsnprintf Timmy Douglas via Bug reports for GNU Guix
2023-11-22 17:57   ` Nathan via Bug reports for GNU Guix
2023-11-23  0:03     ` Timmy Douglas via Bug reports for GNU Guix
     [not found]   ` <87plzq7zwa.fsf@nckx>
2023-12-02  5:15     ` Timmy Douglas via Bug reports for GNU Guix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtjjkpsw.fsf@timmydouglas.com \
    --to=bug-guix@gnu.org \
    --cc=53547@debbugs.gnu.org \
    --cc=mail@timmydouglas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).