unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53547: Error sending email with OpenSMTPD, fatal: time_to_text: bsnprintf
@ 2022-01-26  5:51 Timmy Douglas via Bug reports for GNU Guix
  2023-11-21  7:09 ` Timmy Douglas via Bug reports for GNU Guix
  0 siblings, 1 reply; 5+ messages in thread
From: Timmy Douglas via Bug reports for GNU Guix @ 2022-01-26  5:51 UTC (permalink / raw)
  To: 53547


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*/




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-02  5:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  5:51 bug#53547: Error sending email with OpenSMTPD, fatal: time_to_text: bsnprintf Timmy Douglas via Bug reports for GNU Guix
2023-11-21  7:09 ` 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

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).