[sam] Re: Development status of SAM module? Need a developer?

John Dalbec jpdalbec at ysu.edu
Wed Nov 5 11:34:50 PST 2003



Damian Gerow wrote:

> Thus spake Chuck Hagenbuch (chuck at horde.org) [08/10/03 15:59]:
> 
>>Quoting Taylor Dondich <tdondich at majiknetworks.com>:
>>
>>>I'm extremely interested in the SAM module but find there to be a lot of
>>>problems getting it to run on Horde 2.2.4, or even the latest CVS.  I've
>>>been going through the code and fixing various things and getting it to
>>>work.  I was wondering if there was any real development going on, if
>>>not, I'd like to help out if possible.
>>
>>The version in CVS is for Horde 3.0. If you'd like to work on the RELENG
>>version, for Horde 2.x, that'd be great.
> 
> 
> I still have my 2.x ported version (as ugly as it is) that people can use as
> a base:
> 
>     <http://www.sentex.net/~damian/sam-20030819-horde_2x.tar.gz>
> 
> (Again, kudos to someone else for doing most of the work.)
> 
> It's had some minor cleanups, it works with 2.50 and greater, and it uses
> FTP to set a 'flag' so that procmail can know whether or not the user wants
> to filter, at deliver time.
> 

The attached patch:

1) Makes the 'flag' filename, FTP hostname, and FTP port configuration items.
2) Updates the (en_US) help text for report_safe.
3) Converts the "report_safe" checkbox to radio buttons to allow selection of 
"report_safe 2" (the default here).  I thought about making it a drop-down 
selection but AFAIK this requires javascript and there's no javascript.inc file.

Thanks,
John
-------------- next part --------------
--- sam/templates/spamassassin/body.inc	Mon Aug 18 19:17:57 2003
+++ ./body.inc	Wed Nov  5 13:52:12 2003
@@ -50,7 +50,17 @@
          <tr>
           <th class="light" align="right" valign="middle" nowrap><?php echo _("Report Safe: ") ?></th>
           <td class="item" align="left" valign="middle">
-            <input type="checkbox" name="report_safe" <? if ($report_safe == 1) { print "checked"; } ?>>
+<!---
+            <input type="hidden" name="report_safe" value="<?php echo $report_safe ?>" />
+            <select name="report_safe_list" onchange="update_report_safe(0);">
+              <option value="0" <?php if ($report_safe == 0) { print "selected"; } ?>>0 (No attachment)</option>
+              <option value="1" <?php if ($report_safe == 1) { print "selected"; } ?>>1 (Message attachment)</option>
+              <option value="2" <?php if ($report_safe == 2) { print "selected"; } ?>>2 (Plain text attachment)</option>
+            </select>
+-->
+            0 <input type="radio" name="report_safe" value="0" <?php if ($report_safe == 0) { print "checked"; } ?> />
+            1 <input type="radio" name="report_safe" value="1" <?php if ($report_safe == 1) { print "checked"; } ?> />
+            2 <input type="radio" name="report_safe" value="2" <?php if ($report_safe == 2) { print "checked"; } ?> />
           </td>
           <?php if ($help): ?><td><?php echo Help::link('sam', 'report_safe') ?></td><?php endif; ?>
          </tr>
--- sam/config/conf.php	Tue Aug 19 11:56:22 2003
+++ ./conf.php	Wed Nov  5 14:12:19 2003
@@ -16,4 +16,8 @@
      'mysql','news','postfix','sshd','tty','www');
 
 $conf['menu']['apps'] = array('imp');
+
+$conf['enabledisable']['tagfilename'] = '.scanforspam';
+$conf['enabledisable']['ftphostspec'] = 'mail.example.org';
+$conf['enabledisable']['ftpport'] = '21';
 ?>
--- sam/config/conf.xml	Wed May 28 22:33:28 2003
+++ ./conf.xml	Wed Nov  5 14:13:17 2003
@@ -61,4 +61,9 @@
    <configboolean name="username" required="false" desc="Should we use a custom hook to determine what username SpamAssassin sees (if it needs to be different from the Horde username)? If so, make sure you define _sam_hook_username() in horde/config/hooks.php. The hook will be used to set the username field that SpamAssassin uses in the preferences database. There are examples in horde/config/hooks.php.dist.">false</configboolean>
   </configsection>
 
+ <configsection name="enabledisable">
+   <configstring name="tagfilename" desc="File name to use to trigger SPAM tagging">.scanforspam</configstring>
+   <configstring name="ftphostspec" desc="FTP server hostname">mail.example.org</configstring>
+   <configinteger name="ftpport" desc="FTP server port number">21</configinteger>
+ </configsection>
 </configuration>
--- sam/enabledisable.php	Tue Aug 19 11:57:10 2003
+++ ./enabledisable.php	Wed Nov  5 14:17:23 2003
@@ -34,6 +34,19 @@
 $username = @$split[0];
 $realm = @$split[1];
 
+$tagfilename = $conf['enabledisable']['tagfilename'];
+if (!$tagfilename) {
+    $tagfilename = '.scanforspam';
+}
+$ftphostspec = $conf['enabledisable']['ftphostspec'];
+if (!$ftphostspec) {
+    $ftphostspec = 'mail.example.org';
+}
+$ftpport = $conf['enabledisable']['ftpport'];
+if (!$ftpport) {
+    $ftpport = '21';
+}
+
 $submit = Horde::getFormData('submit', false);
 // Update like a good little boy, now.
 if ($submit) {
@@ -47,7 +60,7 @@
 	$password = Horde::getFormData('mypassword', false);
 
 	// Open an FTP connection to the server.
-	if (!($ftpConn = @ftp_connect("mail.example.org", "21"))) {
+	if (!($ftpConn = @ftp_connect($ftphostspec, $ftpport))) {
 		Horde::raiseMessage(_("Could not open an FTP connection to the server."), HORDE_ERROR);
 	}
 	ftp_pasv($ftpConn,TRUE);
@@ -71,7 +84,7 @@
 		if (!file_exists($blankFile)) return false;
 	
 		// And create the file
-		if (!(@ftp_put($ftpConn, ".scanforspam", $blankFile, FTP_ASCII))) {
+		if (!(@ftp_put($ftpConn, $tagfilename, $blankFile, FTP_ASCII))) {
 			Horde::raiseMessage(_("Could not upload file to initiate tagging."), HORDE_ERROR);
 			@ftp_quit($ftpConn);
 		}
@@ -81,7 +94,7 @@
 
 	case "disable":
 		// Delete the file
-		if (!(@ftp_delete($ftpConn, ".scanforspam"))) {
+		if (!(@ftp_delete($ftpConn, $tagfilename))) {
 			Horde::raiseMessage(_("Could not delete the tagging control file -- perhaps your tagging wasn't enabled?"), HORDE_ERROR);
 		}
 		@ftp_quit($ftpConn);
@@ -114,11 +127,11 @@
   <td>
     <br />
     <?php echo _("You currently have spam tagging: <STRONG>");
-    if ($ftpConn = @ftp_connect("mail.example.org", "21") ) {
+    if ($ftpConn = @ftp_connect($ftphostspec, $ftpport) ) {
         if (@ftp_login($ftpConn, $username, Auth::getCredential('password'))) {
             ftp_pasv($ftpConn,TRUE);
             $tempFile = tempnam("/tmp", "sam");
-            if (@ftp_get($ftpConn, $tempFile, ".scanforspam", FTP_ASCII)) {
+            if (@ftp_get($ftpConn, $tempFile, $tagfilename, FTP_ASCII)) {
                 echo _("enabled");
                 @unlink($tempFile);
             } else {
--- sam/locale/en_US/help.xml	Mon Aug 18 19:17:52 2003
+++ ./help.xml	Wed Nov  5 13:18:06 2003
@@ -3,16 +3,24 @@
 <help>
 
 <entry id="report_safe">
-    <title>General Options: DeFang MIME</title>
-    <heading>DeFang MIME</heading>
+    <title>General Options: Report Safe</title>
+    <heading>Report Safe</heading>
     <para>
            For safety reasons, SpamAssassin can make its report
            the body of the message, and make the original
            message an attachment.  To leave the message alone,
-           set this to zero.
+           set this to zero.  If this is 1, the original message
+           will be attached as an e-mail message.  Some e-mail
+           clients display e-mail message attachments inline,
+           triggering web bugs and other nastiness.  For this
+           reason, setting this item to 2 will attach the
+           original message as a plain text file.  To recover
+           the original message (under Windows at least), save
+           the attachment to disk, then change the filename
+           extension from .txt to .eml and open the file.
     </para>
     <para>
-    <B>Default: On</B>
+    <B>Default: 2 (Plain Text Attachment)</B>
     </para>
 </entry>
 


More information about the sam mailing list