aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorclive <clive@FreeBSD.org>2004-11-28 19:06:01 +0800
committerclive <clive@FreeBSD.org>2004-11-28 19:06:01 +0800
commitf833d73b314a153b174177666c91c97cdc3f4a8a (patch)
tree2c397f420567fe3f5e6e2d61afc5ef9ac3c8cf8d /mail
parent460b1bbc91eac478d8bc7a9d441f785e1edbff24 (diff)
downloadfreebsd-ports-gnome-f833d73b314a153b174177666c91c97cdc3f4a8a.tar.gz
freebsd-ports-gnome-f833d73b314a153b174177666c91c97cdc3f4a8a.tar.zst
freebsd-ports-gnome-f833d73b314a153b174177666c91c97cdc3f4a8a.zip
+ Add smtp authentication support.
- files/patch-smtp_authentication - files/remotes.sample (READ THIS) + fix a argument passing bug. - files/patch-src-send.cc Obtained from: Nullmailer Mailing List
Diffstat (limited to 'mail')
-rw-r--r--mail/nullmailer/Makefile2
-rw-r--r--mail/nullmailer/files/patch-smtp_authentication130
-rw-r--r--mail/nullmailer/files/patch-src-send.cc11
-rw-r--r--mail/nullmailer/files/remotes.sample2
4 files changed, 143 insertions, 2 deletions
diff --git a/mail/nullmailer/Makefile b/mail/nullmailer/Makefile
index 8aa02d4d44a7..f8efd9402886 100644
--- a/mail/nullmailer/Makefile
+++ b/mail/nullmailer/Makefile
@@ -8,7 +8,7 @@
PORTNAME= nullmailer
# PORTVERSION= 1.00RC7
PORTVERSION= 1.00r7
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= mail
MASTER_SITES= http://untroubled.org/nullmailer/ \
ftp://mirrors.dataloss.nl/mirrors/bgware/nullmailer/%SUBDIR%/
diff --git a/mail/nullmailer/files/patch-smtp_authentication b/mail/nullmailer/files/patch-smtp_authentication
new file mode 100644
index 000000000000..1868d5a828c7
--- /dev/null
+++ b/mail/nullmailer/files/patch-smtp_authentication
@@ -0,0 +1,130 @@
+diff -u protocols/protocol.cc protocols/protocol.cc
+--- protocols/protocol.cc 2003-01-03 13:00:29.000000000 -0800
++++ protocols/protocol.cc 2004-08-04 12:20:34.000000000 -0700
+@@ -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}
+ };
+
+diff -u protocols/protocol.h protocols/protocol.h
+--- protocols/protocol.h 2002-12-23 10:14:53.000000000 -0800
++++ protocols/protocol.h 2004-08-04 12:21:25.000000000 -0700
+@@ -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);
+diff -u protocols/qmqp.cc protocols/qmqp.cc
+--- protocols/qmqp.cc 2003-01-03 13:00:31.000000000 -0800
++++ protocols/qmqp.cc 2004-08-04 12:21:13.000000000 -0700
+@@ -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";
+
+diff -u protocols/smtp.cc protocols/smtp.cc
+--- protocols/smtp.cc 2003-01-03 13:00:32.000000000 -0800
++++ protocols/smtp.cc 2004-08-04 20:46:15.605469184 -0700
+@@ -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,67 @@
+ 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;
++}
++// vim:cin:si:ai:et:ts=2:sw=2:
diff --git a/mail/nullmailer/files/patch-src-send.cc b/mail/nullmailer/files/patch-src-send.cc
new file mode 100644
index 000000000000..825586519359
--- /dev/null
+++ b/mail/nullmailer/files/patch-src-send.cc
@@ -0,0 +1,11 @@
+--- src/send.cc.orig Sat Jan 4 04:58:31 2003
++++ src/send.cc Sun Nov 28 18:49:02 2004
+@@ -166,7 +166,7 @@
+ unsigned i = 0;
+ args[i++] = program.c_str();
+ for(slist::const_iter opt(remote.options); opt; opt++)
+- args[i++] = (*opt).c_str();
++ args[i++] = strdup((*opt).c_str());
+ args[i++] = remote.host.c_str();
+ args[i++] = 0;
+ execv(args[0], (char**)args);
diff --git a/mail/nullmailer/files/remotes.sample b/mail/nullmailer/files/remotes.sample
index 458605c64a88..ed99b002be5c 100644
--- a/mail/nullmailer/files/remotes.sample
+++ b/mail/nullmailer/files/remotes.sample
@@ -1 +1 @@
-localhost smtp
+localhost smtp --port=25 --auth=user,pass