Re: spamc -U /foo/bar

Richard Lithvall <[email protected]>
Newsgroups gmane.mail.exim.spamassassin
Message-ID <[email protected]>
Richard Salts wrote:
> I was wondering if it is possible to have sa-exim pass arguments to spamc. I
> have spamd running on a Unix socket so wanted to run spamc -U /foo/bar so I 
> changed SAspamcpath to that. However I get this as a result:
> 
> 2003-12-02 19:21:20 1AR5mR-0003nE-7g SA: PANIC: Unexpected error on exec /usr/bi
> n/spamc -U /tmp/spamd (but message was accepted), file sa-exim.c, line 848: No s
> uch file or directory
> 
> Yet it works fine when using spamc with no arguments.

Strange. Did you start spamd with the --socketpath option?
Here's my patch (that i sent Marc a while ago in hope that he would 
adopt it) verified and working in my environment.

/Richard



diff -ur sa-exim-3.1/sa-exim.c sa-exim-3.1-rich/sa-exim.c
--- sa-exim-3.1/sa-exim.c	Mon Aug 18 17:34:39 2003
+++ sa-exim-3.1-rich/sa-exim.c	Wed Sep 24 16:16:36 2003
@@ -505,6 +505,7 @@

      /* Options we read from /etc/mail/sa-exim.conf */
      static char *SAspamcpath=SPAMC_LOCATION;
+    static char *SAspamcSockPath=NULL;
      static char *SAEximRunCond="0";
      static char *SAEximRejCond="1";
      static int SAmaxbody=250*1024;
@@ -653,6 +654,7 @@

  	    M_CHECKFORVAR(SAEximDebug, "%d");
  	    M_CHECKFORSTR(SAspamcpath);
+	    M_CHECKFORSTR(SAspamcSockPath);
  	    M_CHECKFORSTR(SAEximRunCond);
  	    M_CHECKFORSTR(SAEximRejCond);
  	    M_CHECKFORVAR(SAmaxbody, "%d");
@@ -845,7 +847,11 @@
  	/* Ok, we cheat, spamc cares about how big the whole message is and
           * we only know  about the body size, so I'll  give an extra 16K
           * to account for any headers that can accompany the message */
-	ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", 
SAmaxbody+16384), NULL);
+	if(SAspamcSockPath){
+		ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", 
SAmaxbody+16384), "-U", SAspamcSockPath, NULL);
+	} else {
+		ret=execl(SAspamcpath, "spamc", "-s", string_sprintf("%d", 
SAmaxbody+16384), NULL);
+	}
  	CHECKERR(ret,string_sprintf("exec %s", SAspamcpath),__LINE__);
      }

diff -ur sa-exim-3.1/sa-exim.conf sa-exim-3.1-rich/sa-exim.conf
--- sa-exim-3.1/sa-exim.conf	Wed Aug 20 18:11:13 2003
+++ sa-exim-3.1-rich/sa-exim.conf	Wed Sep 24 16:28:19 2003
@@ -25,7 +25,10 @@
  # Default path is /usr/bin/spamc, but you can change it here
  SAspamcpath: /usr/bin/spamc

-
+# If SAspamcSockPath is set spamc uses socket to connect to spamd,
+# use --socketpath pathname as argument to spamd (new in SA 2.60).
+# Leave it unset if you want spamc to connect(AF_INET) to spamd at 
127.0.0.1 (this is the default).
+#SAspamcSockPath: /var/run/spamd.sock

  # Exim configuration string to run before running SA against the message
  # You should not put double quotes around the expression
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.