[24424] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r24016 - trunk/debathena/config/msmtp-config/debian

daemon@ATHENA.MIT.EDU (Evan Broder)
Sun Sep 20 20:57:25 2009

Date: Sun, 20 Sep 2009 20:57:14 -0400
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200909210057.n8L0vEEQ013450@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-09-20 20:57:14 -0400 (Sun, 20 Sep 2009)
New Revision: 24016

Modified:
   trunk/debathena/config/msmtp-config/debian/changelog
   trunk/debathena/config/msmtp-config/debian/control.in
   trunk/debathena/config/msmtp-config/debian/debathena-msmtp
Log:
In msmtp-config:
  * Replace shell script with Perl script that respects
    /etc/aliases. (Trac: #83)

Patch by David Wilson.


Modified: trunk/debathena/config/msmtp-config/debian/changelog
===================================================================
--- trunk/debathena/config/msmtp-config/debian/changelog	2009-09-21 00:13:39 UTC (rev 24015)
+++ trunk/debathena/config/msmtp-config/debian/changelog	2009-09-21 00:57:14 UTC (rev 24016)
@@ -1,3 +1,10 @@
+debathena-msmtp-config (1.6) unstable; urgency=low
+
+  * Replace shell script with Perl script that respects
+    /etc/aliases. (Trac: #83)
+
+ -- David Wilson <dwilson@mit.edu>  Sun, 20 Sep 2009 20:30:55 -0400
+
 debathena-msmtp-config (1.5) unstable; urgency=low
 
   * Move to the debathena-config component from the debathena component.

Modified: trunk/debathena/config/msmtp-config/debian/control.in
===================================================================
--- trunk/debathena/config/msmtp-config/debian/control.in	2009-09-21 00:13:39 UTC (rev 24015)
+++ trunk/debathena/config/msmtp-config/debian/control.in	2009-09-21 00:57:14 UTC (rev 24016)
@@ -7,7 +7,7 @@
 
 Package: debathena-msmtp-config
 Architecture: all
-Depends: msmtp, debathena-kerberos-config, ${misc:Depends}
+Depends: msmtp, debathena-kerberos-config, libmail-expandaliases-perl, ${misc:Depends}
 Conflicts: debathena-pine (<= 4.64-3debathena3)
 Description: msmtp configuration for Debathena
  This packages provides a script to send authenticated outgoing mail via 

Modified: trunk/debathena/config/msmtp-config/debian/debathena-msmtp
===================================================================
--- trunk/debathena/config/msmtp-config/debian/debathena-msmtp	2009-09-21 00:13:39 UTC (rev 24015)
+++ trunk/debathena/config/msmtp-config/debian/debathena-msmtp	2009-09-21 00:57:14 UTC (rev 24016)
@@ -1,16 +1,27 @@
-#!/bin/sh
-if [ -z "$DEBATHENA_SENDMAIL_AUTH" ]; then
-    if klist -s 2>/dev/null; then
-	DEBATHENA_SENDMAIL_AUTH=yes
-    fi
-fi
-if [ "$DEBATHENA_SENDMAIL_AUTH" = "yes" ]; then
-    kuser=$(klist 2>/dev/null | sed -n 's/^Default principal: \(.*\)@ATHENA\.MIT\.EDU/\1/ p')
-    if [ -z "$kuser" ]; then
-	echo "Could not find valid ATHENA.MIT.EDU Kerberos tickets." >&2
-	exit 1
-    fi
-    exec msmtp --host=outgoing.mit.edu --port=587 --auth=gssapi --user="$kuser" --auto-from=on --maildomain=mit.edu "$@"
-else
-    exec msmtp --host=outgoing.mit.edu --port=25 --auth=off --auto-from=on --maildomain=mit.edu "$@"
-fi
+#!/usr/bin/perl
+
+use Mail::ExpandAliases;
+
+$ticketlist = `klist 2>/dev/null`;
+$ticketlist =~ /Default principal: (.*?)\@ATHENA.MIT.EDU/;
+$kuser = $1;
+
+$parser = Mail::ExpandAliases->new;
+foreach $arg (@ARGV) {
+    push @aliases, $parser->expand($arg);
+}
+
+if ($kuser &&
+     (($ENV{'DEBATHENA_SENDMAIL_AUTH'} eq 'yes') ||
+      (!$ENV{'DEBATHENA_SENDMAIL_AUTH'}))) {
+    #send auth
+    exec(qw{msmtp --host=outgoing.mit.edu --port=587 --auth=gssapi}, "--user=$kuser", qw{--auto-from=on --maildomain=mit.edu}, @aliases);
+}
+elsif ($ENV{'DEBATHENA_SENDMAIL_AUTH'} eq 'yes') {
+    $! = 1;
+    die "Could not find valid ATHENA.MIT.EDU Kerberos tickets.\n";
+}
+else {
+    #send unauth
+    exec(qw{msmtp --host=outgoing.mit.edu --port=25 --auth=off --auto-from=on --maildomain=mit.edu}, @aliases);
+}


home help back first fref pref prev next nref lref last post