summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2005-06-02 04:58:37 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2005-06-02 04:58:37 +0000
commit15742ad795afbc5fd29de9ac2512a6f0a2642b7d (patch)
tree7498d9b7b1e4a7b7168531c394bc8705bfe6370d /mail-mta/nullmailer/files
parentadd patch for alpha, some patches from crosstool, and clean up a few patches ... (diff)
downloadgentoo-2-15742ad795afbc5fd29de9ac2512a6f0a2642b7d.tar.gz
gentoo-2-15742ad795afbc5fd29de9ac2512a6f0a2642b7d.tar.bz2
gentoo-2-15742ad795afbc5fd29de9ac2512a6f0a2642b7d.zip
Bug #74903 and #83574, bump version, and make nullmailer compile with GCC3.4 (including under FreeBSD).
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'mail-mta/nullmailer/files')
-rw-r--r--mail-mta/nullmailer/files/digest-nullmailer-1.001
-rw-r--r--mail-mta/nullmailer/files/nullmailer-1.00-gcc34-fix.patch24
-rw-r--r--mail-mta/nullmailer/files/nullmailer-1.00-smtp-auth.patch143
-rw-r--r--mail-mta/nullmailer/files/nullmailer-1.00-syslog.patch301
-rw-r--r--mail-mta/nullmailer/files/remotes.sample6
5 files changed, 474 insertions, 1 deletions
diff --git a/mail-mta/nullmailer/files/digest-nullmailer-1.00 b/mail-mta/nullmailer/files/digest-nullmailer-1.00
new file mode 100644
index 000000000000..af23048d4c3a
--- /dev/null
+++ b/mail-mta/nullmailer/files/digest-nullmailer-1.00
@@ -0,0 +1 @@
+MD5 ead32b3543ef652891edf3856ec759dd nullmailer-1.00.tar.gz 170605
diff --git a/mail-mta/nullmailer/files/nullmailer-1.00-gcc34-fix.patch b/mail-mta/nullmailer/files/nullmailer-1.00-gcc34-fix.patch
new file mode 100644
index 000000000000..15aa0e7fb3e3
--- /dev/null
+++ b/mail-mta/nullmailer/files/nullmailer-1.00-gcc34-fix.patch
@@ -0,0 +1,24 @@
+--- lib/fdbuf/fdobuf.h~ Sat Mar 5 01:12:32 2005
++++ lib/fdbuf/fdobuf.h Sat Mar 5 01:12:53 2005
+@@ -17,6 +17,8 @@
+ #ifndef FDBUF__FDOBUF__H__
+ #define FDBUF__FDOBUF__H__
+
++#include <pwd.h>
++
+ class fdobuf : protected fdbuf
+ {
+ public:
+--- lib/list.h~ Sat Mar 5 01:16:28 2005
++++ lib/list.h Sat Mar 5 01:13:35 2005
+@@ -18,8 +18,8 @@
+ typedef list_node<T> node;
+ typedef list_iterator<T> iter;
+ typedef const_list_iterator<T> const_iter;
+- friend class iter;
+- friend class const_iter;
++ friend class list_iterator<T>;;
++ friend class const_list_iterator<T>;;
+
+ list()
+ : head(0), tail(0), cnt(0)
diff --git a/mail-mta/nullmailer/files/nullmailer-1.00-smtp-auth.patch b/mail-mta/nullmailer/files/nullmailer-1.00-smtp-auth.patch
new file mode 100644
index 000000000000..23aa47837114
--- /dev/null
+++ b/mail-mta/nullmailer/files/nullmailer-1.00-smtp-auth.patch
@@ -0,0 +1,143 @@
+--- doc/nullmailer-send.8~ Sat Mar 5 10:13:38 2005
++++ doc/nullmailer-send.8 Sat Mar 5 10:16:51 2005
+@@ -57,10 +57,11 @@
+ The protocol name defaults to
+ .IR smtp ,
+ and may be followed by command-line arguments for that module.
+-For example, to connect to port 2525 on your SMTP smart host, use:
++For example, to connect to port 2525 on your SMTP smart host,
++which also requires SMTP authentication, use:
+
+ .EX
+- smarthost.dom smtp --port=2525
++ smarthost.dom smtp --port=2525 --auth=user,pass
+ .EE
+
+ Blank lines and lines starting with a pound are ignored.
+--- protocols/protocol.cc~ Sat Mar 5 09:38:23 2005
++++ protocols/protocol.cc Sat Mar 5 09:39:42 2005
+@@ -30,10 +30,12 @@
+ const char* cli_help_suffix = "";
+ const char* cli_args_usage = "remote-address < mail-file";
+ const int cli_args_min = 1;
+-const int cli_args_max = 1;
++const int cli_args_max = 2;
+ cli_option cli_options[] = {
+ { 'p', "port", cli_option::integer, 0, &port,
+ "Set the port number on the remote host to connect to", 0 },
++ { 'a', "auth", cli_option::string, 0, &auth,
++ "Set the user and password for authentication (user,pass)", 0 },
+ {0, 0, cli_option::flag, 0, 0, 0, 0}
+ };
+
+--- protocols/protocol.h~ Sat Mar 5 09:40:15 2005
++++ protocols/protocol.h Sat Mar 5 09:40:46 2005
+@@ -8,6 +8,7 @@
+
+ // This must be provided by the protocol, but will be set by the lib.
+ extern int port;
++extern char* auth;
+
+ extern void protocol_prep(fdibuf* in);
+ extern void protocol_send(fdibuf* in, int fd);
+--- protocols/qmqp.cc~ Sat Mar 5 09:40:59 2005
++++ protocols/qmqp.cc Sat Mar 5 09:41:21 2005
+@@ -31,6 +31,7 @@
+ #include "protocol.h"
+
+ int port = 628;
++char* auth = "";
+ const char* cli_program = "qmqp";
+ const char* cli_help_prefix = "Send an emal message via QMQP\n";
+
+--- protocols/smtp.cc~ Sat Mar 5 09:41:31 2005
++++ protocols/smtp.cc Sat Mar 5 09:44:58 2005
+@@ -30,6 +30,7 @@
+ #include "protocol.h"
+
+ int port = 25;
++char* auth = "";
+ const char* cli_program = "smtp";
+ const char* cli_help_prefix = "Send an email message via SMTP\n";
+
+@@ -136,6 +137,11 @@
+ {
+ }
+
++void to64(char* infile, char* outfile);
++void to64(const mystring& infile, mystring& outfile);
++void output64chunk(int c1, int c2, int c3, int pads, char** outfile);
++void output64chunk(int c1, int c2, int c3, int pads, mystring& outfile);
++
+ void protocol_send(fdibuf* in, int fd)
+ {
+ mystring hh = getenv("HELOHOST");
+@@ -143,5 +149,68 @@
+ smtp conn(fd);
+ conn.docmd("", 200);
+ conn.docmd("HELO " + hh, 200);
++
++ if ( strlen(auth) > 0 )
++ {
++ mystring authstr = auth;
++ mystring uname = authstr.left(authstr.find_first(','));
++ mystring pass = authstr.sub(authstr.find_first(',')+1,authstr.length());
++ mystring plain = uname + "\1" + uname + "\1" + pass;
++ mystring encoded = "AUTH PLAIN ";
++ to64(plain,encoded);
++ conn.docmd(encoded,200);
++ }
++
+ conn.send(in);
+ }
++
++static char basis_64[] =
++ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
++
++void to64(const mystring& infile, mystring& outfile)
++{
++ int c1, c2, c3;
++ size_t inpos = 0;
++ while ((c1 = infile[inpos++])) {
++ c2 = infile[inpos++];
++ if (!c2) {
++ output64chunk(c1, 0, 0, 2, outfile);
++ } else {
++ c3 = infile[inpos++];
++ if (!c3) {
++ output64chunk(c1, c2, 0, 1, outfile);
++ } else {
++ output64chunk(c1, c2, c3, 0, outfile);
++ }
++ }
++ }
++}
++
++void output64chunk(int c1, int c2, int c3, int pads, mystring& outfile)
++{
++ if (c1==1) c1 = 0;
++ if (c2==1) c2 = 0;
++ if (c3==1) c3 = 0;
++
++ char out[5];
++ out[0] = basis_64[c1>>2];
++ out[1] = basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
++ switch (pads)
++ {
++ case 0:
++ out[2] = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
++ out[3] = basis_64[c3 & 0x3F];
++ break;
++ case 1:
++ out[2] = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
++ out[3] = '=';
++ break;
++ case 2:
++ out[2] = '=';
++ out[3] = '=';
++ break;
++ };
++ out[4] = 0;
++ outfile += out;
++}
++
diff --git a/mail-mta/nullmailer/files/nullmailer-1.00-syslog.patch b/mail-mta/nullmailer/files/nullmailer-1.00-syslog.patch
new file mode 100644
index 000000000000..33a6cdfb79cb
--- /dev/null
+++ b/mail-mta/nullmailer/files/nullmailer-1.00-syslog.patch
@@ -0,0 +1,301 @@
+diff -NuarwbB nullmailer-1.00.orig/doc/nullmailer-send.8 nullmailer-1.00/doc/nullmailer-send.8
+--- nullmailer-1.00.orig/doc/nullmailer-send.8 2005-06-01 20:47:27.000000000 -0700
++++ nullmailer-1.00/doc/nullmailer-send.8 2005-06-01 20:47:59.000000000 -0700
+@@ -3,6 +3,7 @@
+ nullmailer-send \- Send queued messages
+ .SH SYNOPSIS
+ .B nullmailer-send
++.RB [ \-\-daemon ]\ [ \-\-syslog ]
+ .SH DESCRIPTION
+ This program is responsible for coordinating the transmission of
+ messages that have been queued by
+@@ -37,6 +38,15 @@
+ sleeps for a number of seconds specified by
+ .B pausetime
+ before retrying sending the contents of the queue.
++.SH OPTIONS
++.TP
++.BR \-d ,\ \-\-daemon
++Fork into the background, implies --syslog.
++.TP
++.BR \-s ,\ \-\-syslog
++Use syslog for error and log messages.
++With --daemon, syslog will be used exclusively, without --daemon,
++syslog will be used additionally.
+ .SH CONTROL FILES
+ All the control files are reread each time the queue is run.
+ .TP
+diff -NuarwbB nullmailer-1.00.orig/protocols/protocol.cc nullmailer-1.00/protocols/protocol.cc
+--- nullmailer-1.00.orig/protocols/protocol.cc 2005-06-01 20:47:27.000000000 -0700
++++ nullmailer-1.00/protocols/protocol.cc 2005-06-01 20:52:54.000000000 -0700
+@@ -22,11 +22,15 @@
+ #include <config.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <sys/syslog.h>
+ #include "connect.h"
+ #include "errcodes.h"
+ #include "protocol.h"
+ #include "cli++.h"
+
++static int use_syslog = 0;
++static int daemonize = 0;
++
+ const char* cli_help_suffix = "";
+ const char* cli_args_usage = "remote-address < mail-file";
+ const int cli_args_min = 1;
+@@ -36,23 +40,35 @@
+ "Set the port number on the remote host to connect to", 0 },
+ { 'a', "auth", cli_option::string, 0, &auth,
+ "Set the user and password for authentication (user,pass)", 0 },
++ { 'd', "daemon", cli_option::flag, 1, &daemonize, "use syslog exclusively ", 0 },
++ { 's', "syslog", cli_option::flag, 1, &use_syslog, "use syslog additionally", 0 },
+ {0, 0, cli_option::flag, 0, 0, 0, 0}
+ };
+
+ void protocol_fail(int e, const char* msg)
+ {
++ if (use_syslog)
++ syslog(LOG_ERR, "%s: Failed: %s", cli_program, msg);
++ if (!daemonize)
+ ferr << cli_program << ": Failed: " << msg << endl;
+ exit(e);
+ }
+
+ void protocol_succ(const char* msg)
+ {
++ if (use_syslog)
++ syslog(LOG_ERR, "%s: Succeeded: %s", cli_program, msg);
++ if (!daemonize)
+ ferr << cli_program << ": Succeeded: " << msg << endl;
+ exit(0);
+ }
+
+ int cli_main(int, char* argv[])
+ {
++ if (daemonize)
++ use_syslog = 1;
++ if (use_syslog)
++ openlog("nullmailer", LOG_CONS | LOG_PID, LOG_MAIL);
+ const char* remote = argv[0];
+ fdibuf in(0, true);
+ protocol_prep(&in);
+diff -NuarwbB nullmailer-1.00.orig/src/Makefile.in nullmailer-1.00/src/Makefile.in
+--- nullmailer-1.00.orig/src/Makefile.in 2005-02-28 09:39:50.000000000 -0800
++++ nullmailer-1.00/src/Makefile.in 2005-06-01 20:51:15.000000000 -0700
+@@ -65,7 +65,7 @@
+ nullmailer_queue_DEPENDENCIES = ../lib/libnullmailer.a
+ am_nullmailer_send_OBJECTS = send.$(OBJEXT)
+ nullmailer_send_OBJECTS = $(am_nullmailer_send_OBJECTS)
+-nullmailer_send_DEPENDENCIES = ../lib/libnullmailer.a
++nullmailer_send_DEPENDENCIES = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+ am_sendmail_OBJECTS = sendmail.$(OBJEXT)
+ sendmail_OBJECTS = $(am_sendmail_OBJECTS)
+ sendmail_DEPENDENCIES = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+@@ -173,13 +173,13 @@
+ #noinst_PROGRAMS = address
+ INCLUDES = -I../lib -I../lib/cli++
+ mailq_SOURCES = mailq.cc
+-mailq_LDADD = ../lib/libnullmailer.a
++mailq_LDADD = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+ nullmailer_inject_SOURCES = inject.cc
+ nullmailer_inject_LDADD = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+ nullmailer_queue_SOURCES = queue.cc
+ nullmailer_queue_LDADD = ../lib/libnullmailer.a
+ nullmailer_send_SOURCES = send.cc
+-nullmailer_send_LDADD = ../lib/libnullmailer.a
++nullmailer_send_LDADD = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+ sendmail_SOURCES = sendmail.cc
+ sendmail_LDADD = ../lib/cli++/libcli++.a ../lib/libnullmailer.a
+ all: all-am
+diff -NuarwbB nullmailer-1.00.orig/src/send.cc nullmailer-1.00/src/send.cc
+--- nullmailer-1.00.orig/src/send.cc 2005-02-28 09:48:54.000000000 -0800
++++ nullmailer-1.00/src/send.cc 2005-06-01 20:47:59.000000000 -0700
+@@ -27,6 +27,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/stat.h>
++#include <sys/syslog.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
+@@ -38,11 +39,27 @@
+ #include "hostname.h"
+ #include "itoa.h"
+ #include "list.h"
++#include "cli++/cli++.h"
+
+ typedef list<mystring> slist;
+
+-#define fail(MSG) do { ferr << MSG << endl; return false; } while(0)
+-#define fail_sys(MSG) do{ ferr << MSG << strerror(errno) << endl; return false; }while(0)
++static int use_syslog = 0;
++static int daemonize = 0;
++
++const char* cli_program = "nullmailer-send";
++const char* cli_help_prefix = "nullmailer daemon\n";
++const char* cli_help_suffix = "";
++const char* cli_args_usage = "";
++const int cli_args_min = 0;
++const int cli_args_max = 0;
++cli_option cli_options[] = {
++ { 'd', "daemon", cli_option::flag, 1, &daemonize, "daemonize , implies --syslog", 0 },
++ { 's', "syslog", cli_option::flag, 1, &use_syslog, "use syslog", 0 },
++ { 0, 0, cli_option::flag, 0, 0, 0, 0 }
++};
++
++#define fail(MSG) do { if (use_syslog) syslog(LOG_ERR, "%s", MSG); if (!daemonize) ferr << MSG << endl; return false; } while (0)
++#define fail_sys(MSG) do { if (use_syslog) syslog(LOG_ERR, "%s %s", MSG, strerror(errno)); if (!daemonize) ferr << MSG << strerror(errno) << endl; return false; } while (0)
+
+ struct remote
+ {
+@@ -141,6 +158,9 @@
+ bool load_files()
+ {
+ reload_files = false;
++ if (use_syslog)
++ syslog(LOG_INFO, "Rescanning queue.");
++ if (!daemonize)
+ fout << "Rescanning queue." << endl;
+ DIR* dir = opendir(".");
+ if(!dir)
+@@ -159,12 +179,19 @@
+
+ void exec_protocol(int fd, remote& remote)
+ {
+- if(close(0) == -1 || dup2(fd, 0) == -1 || close(fd) == -1)
++ if (!daemonize && close(STDIN_FILENO) < 0)
++ return;
++ if (fd != STDIN_FILENO)
++ if (dup2(fd, STDIN_FILENO) < 0 || close(fd) < 0)
+ return;
+ mystring program = PROTOCOL_DIR + remote.proto;
+- const char* args[3+remote.options.count()];
++ const char* args[5+remote.options.count()];
+ unsigned i = 0;
+ args[i++] = program.c_str();
++ if (daemonize)
++ args[i++] = "-d";
++ if (use_syslog)
++ args[i++] = "-s";
+ for(slist::const_iter opt(remote.options); opt; opt++)
+ args[i++] = strdup((*opt).c_str());
+ args[i++] = remote.host.c_str();
+@@ -173,8 +200,8 @@
+ }
+
+ #undef fail
+-#define fail(MSG) do { fout << MSG << endl; return false; } while(0)
+-#define fail2(MSG1,MSG2) do{ fout << MSG1 << MSG2 << endl; return false; }while(0)
++#define fail(MSG) do { if (use_syslog) syslog(LOG_ERR, "%s", MSG); if (!daemonize) fout << MSG << endl; return false; } while (0)
++#define fail2(MSG1,MSG2) do { if (use_syslog) syslog(LOG_ERR, "%s %s", MSG1, MSG2); if (!daemonize) fout << MSG1 << MSG2 << endl; return false; } while (0)
+
+ bool catchsender(pid_t pid)
+ {
+@@ -187,6 +214,9 @@
+ if(status)
+ fail2("Sending failed: ", errorstr[status]);
+ else {
++ if (use_syslog)
++ syslog(LOG_INFO, "Sent file.");
++ if (!daemonize)
+ fout << "Sent file." << endl;
+ return true;
+ }
+@@ -200,9 +230,16 @@
+ {
+ int fd = open(filename.c_str(), O_RDONLY);
+ if(fd == -1) {
++ if (use_syslog)
++ syslog(LOG_ERR, "Can't open file '%s'", filename.c_str());
++ if (!daemonize)
+ fout << "Can't open file '" << filename << "'" << endl;
+ return false;
+ }
++ if (use_syslog)
++ syslog(LOG_INFO, "Starting delivery: protocol: %s host: %s file: %s",
++ remote.proto.c_str(), remote.host.c_str(), filename.c_str());
++ if (!daemonize)
+ fout << "Starting delivery: protocol: " << remote.proto
+ << " host: " << remote.host
+ << " file: " << filename << endl;
+@@ -231,6 +268,9 @@
+ fail("No remote hosts listed for delivery");
+ if(files.count() == 0)
+ return true;
++ if (use_syslog)
++ syslog(LOG_INFO, "Starting delivery, %d message(s) in queue.", files.count());
++ if (!daemonize)
+ fout << "Starting delivery, "
+ << itoa(files.count()) << " message(s) in queue." << endl;
+ for(rlist::iter remote(remotes); remote; remote++) {
+@@ -242,6 +282,9 @@
+ file++;
+ }
+ }
++ if (use_syslog)
++ syslog(LOG_INFO, "Delivery complete, %d message(s) remain.", files.count());
++ if (!daemonize)
+ fout << "Delivery complete, "
+ << itoa(files.count()) << " message(s) remain." << endl;
+ return true;
+@@ -287,6 +330,9 @@
+ int s = select(trigger+1, &readfds, 0, 0,
+ (files.count() == 0) ? 0 : &timeout);
+ if(s == 1) {
++ if (use_syslog)
++ syslog(LOG_INFO, "Trigger pulled.");
++ if (!daemonize)
+ fout << "Trigger pulled." << endl;
+ read_trigger();
+ reload_files = true;
+@@ -300,21 +346,46 @@
+ return true;
+ }
+
+-int main(int, char*[])
++int cli_main(int, char*[])
+ {
+ mystring hh;
++ pid_t pid;
++
++ if (daemonize)
++ use_syslog = 1;
++ if (use_syslog)
++ openlog("nullmailer", LOG_CONS | LOG_PID, LOG_MAIL);
+
+ read_hostnames();
+ if (!config_read("helohost", hh)) hh = me;
+ setenv("HELOHOST", hh.c_str(), 1);
+
+- if(!open_trigger())
++ if(!open_trigger()) {
++ if (use_syslog)
++ syslog(LOG_CRIT, "Could not open trigger.");
++ if (!daemonize)
++ ferr << "Could not open trigger." << endl;
+ return 1;
++ }
+ if(chdir(QUEUE_MSG_DIR) == -1) {
+- fout << "Could not chdir to queue message directory." << endl;
++ if (use_syslog)
++ syslog(LOG_CRIT, "Could not chdir to queue message directory.");
++ if (!daemonize)
++ ferr << "Could not chdir to queue message directory." << endl;
+ return 1;
+ }
+
++ if (daemonize) {
++ if ((pid = fork()) < 0) {
++ syslog(LOG_CRIT, "Could not fork.");
++ return 1;
++ }
++ if (pid)
++ return 0;
++ close(STDIN_FILENO);
++ close(STDOUT_FILENO);
++ close(STDERR_FILENO);
++ }
+ signal(SIGALRM, catch_alrm);
+ signal(SIGHUP, SIG_IGN);
+ load_config();
diff --git a/mail-mta/nullmailer/files/remotes.sample b/mail-mta/nullmailer/files/remotes.sample
index cf4bd7c59d90..ebcf5dc2cbe1 100644
--- a/mail-mta/nullmailer/files/remotes.sample
+++ b/mail-mta/nullmailer/files/remotes.sample
@@ -1,6 +1,7 @@
-# Format is: HOST PROTOCOL
+# Format is: HOST PROTOCOL [OPTIONS]
# HOST = IP or DNS
# PROTOCOL = smtp | qmtp
+# OPTIONS = [--port=NUMBER] [--auth=user,pass]
#
# Examples:
# A standard SMTP server:
@@ -11,3 +12,6 @@
#
# A nonstandard SMTP server setup:
# someotherserver.domain.com smtp --port=2525
+#
+# As of 1.00, nullmailer also supports SMTP AUTH
+# mailserver smtp --auth=user,pass