diff options
author | Clive Lin <clive@FreeBSD.org> | 2004-11-28 11:06:01 +0000 |
---|---|---|
committer | Clive Lin <clive@FreeBSD.org> | 2004-11-28 11:06:01 +0000 |
commit | e7468515ebe50afaeabfc2061f116d2c3fbe7a75 (patch) | |
tree | 62a9a5b216186e4a6db5d9e8c3b5a2d468c30871 /mail/nullmailer/files | |
parent | 1697ad658e6d114e515551340027638a5bbca878 (diff) | |
download | ports-e7468515ebe50afaeabfc2061f116d2c3fbe7a75.tar.gz ports-e7468515ebe50afaeabfc2061f116d2c3fbe7a75.zip |
Notes
Diffstat (limited to 'mail/nullmailer/files')
-rw-r--r-- | mail/nullmailer/files/patch-smtp_authentication | 130 | ||||
-rw-r--r-- | mail/nullmailer/files/patch-src-send.cc | 11 | ||||
-rw-r--r-- | mail/nullmailer/files/remotes.sample | 2 |
3 files changed, 142 insertions, 1 deletions
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 |