SF.net SVN: tmda: [2129] trunk/tmda/bin

[email protected] Tue, 14 Nov 2006 14:30:08 -0800
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2129
          http://svn.sourceforge.net/tmda/?rev=2129&view=rev
Author:   srwarren
Date:     2006-11-14 14:30:03 -0800 (Tue, 14 Nov 2006)

Log Message:
-----------
tmda-ofmipd: Add Robert P Thille's -L (log) option

Modified Paths:
--------------
    trunk/tmda/bin/ChangeLog
    trunk/tmda/bin/tmda-ofmipd

Modified: trunk/tmda/bin/ChangeLog
===================================================================
--- trunk/tmda/bin/ChangeLog	2006-11-14 22:22:16 UTC (rev 2128)
+++ trunk/tmda/bin/ChangeLog	2006-11-14 22:30:03 UTC (rev 2129)
@@ -1,6 +1,12 @@
 2006-11-14  Stephen Warren  <[email protected]>
 
 	* tmda-ofmipd: Import part of Robert P. Thille's patch;
+	Add a -L option, which acts the same as the existing -d debug option,
+	except that the raw SMTP dialog is not logged (i.e. the Data: lines)
+
+2006-11-14  Stephen Warren  <[email protected]>
+
+	* tmda-ofmipd: Import part of Robert P. Thille's patch;
 	Pass "-f sender" option to sendmail program, so the SMTP envelope
 	sender is passed along the chain from the MUA to the MTA.
 

Modified: trunk/tmda/bin/tmda-ofmipd
===================================================================
--- trunk/tmda/bin/tmda-ofmipd	2006-11-14 22:22:16 UTC (rev 2128)
+++ trunk/tmda/bin/tmda-ofmipd	2006-11-14 22:30:03 UTC (rev 2129)
@@ -97,6 +97,15 @@
 		  action="store_true", default=False, dest="debug",
 		  help="Turn on debugging prints.")
 
+gengroup.add_option("-L", "--log",
+		  action="store_true", default=False, dest="log",
+		  help= \
+"""Turn on logging prints.
+This option logs everything that -d logs, except for the raw SMTP protocol
+data. Hence, it is useful if you want to leave logging enabled permanently,
+but don't want your logs bloated with AUTH data and/or the content of large
+attachments.""")
+
 gengroup.add_option("-b", "--background",
 		  action="store_false", dest="foreground",
 		  help="Detach and run in the background (default).")
@@ -247,7 +256,7 @@
     sys.exit()
 if opts.vhomescript and opts.configdir:
     parser.error("options '--vhome-script' and '--configdir' are incompatible!")
-if opts.debug:
+if opts.debug or opts.log:
     DEBUGSTREAM = sys.stderr
 else:
     DEBUGSTREAM = Devnull()
@@ -745,7 +754,8 @@
     # Implementation of base class abstract method
     def found_terminator(self):
         line = EMPTYSTRING.join(self.__line)
-        print >> DEBUGSTREAM, 'Data:', repr(line)
+        if opts.debug:
+            print >> DEBUGSTREAM, 'Data:', repr(line)
         self.__line = []
         if self.__state == self.COMMAND:
             if not line:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.