[SA-exim] FEATURE REQUEST - Line continuations in sa-exim.conf

Coax coax at cornernet.com
Thu Aug 21 00:35:29 PDT 2003


> Eh Chad, you used to be a C coder, when can I expect your patch? :-)

Right here, of course. :)

This is a patch against sa-exim.c from the sa-exim 3.1 package. (not sure
if its compatible with the CVS tail if its newer, but i'm sure you can
figure it out. :)

This is an absolute BRUTE HACK.

It merely combines lines if the last character before \n on the line is a
'\'.  If you add a space after it, it won't parse it correctly.  Feel free
to futz with that if you like. it would be easy to write a little
algorithm to deal with this a little better; i just don't have the time.

This patch makes the following work:

SAEximDebug: \
        3

I haven't tested anything else.

Lotsa luck. :)

Chad
-------------- next part --------------
--- sa-exim-3.1/sa-exim.c	Mon Aug 18 10:34:39 2003
+++ sa-exim-3.1-chad/sa-exim.c	Wed Aug 20 23:28:10 2003
@@ -563,6 +563,9 @@
     char *xspamprevcontenttransferencoding=NULL;
     char *xspamreport=NULL;
 
+    int buflen = 0;
+    int firstround = 1;
+    int offset = 0;
 
     /* Any error can write the faulty message to mesgfn, so we need to
        give it a value right now. We'll replace it with the real Message-ID later */
@@ -592,18 +595,34 @@
 	readfh=fdopen(ret, "r");
 	CHECKERR(readfh,"fdopen",__LINE__);
 	
-	while ((fgets((char *)buffer, sizeof(buffera), (FILE *)readfh)) != NULL)
+	while ((fgets((char *)buffer+offset, sizeof(buffera)-offset, (FILE *)readfh)) != NULL)
 	{
-	    if (*buffer == '#' || *buffer == '\n' )
-	    {
-		continue;
-	    }
+	   
+		if (firstround) { 
+	    		if (*buffer == '#' || *buffer == '\n' ) {
+				continue;
+	    		}
 		
-	    if (*buffer != 'S' || *(buffer+1) != 'A')
-	    {
-		log_write(0, LOG_MAIN, "SA: Warning: error while reading configuration file %s. Line does not begin with a SA directive: '%s', ignoring", conffile, buffer);
-		continue;
-	    }
+	    		if (*buffer != 'S' || *(buffer+1) != 'A') {
+				log_write(0, LOG_MAIN, "SA: Warning: error while reading configuration file %s. Line does not begin with a SA directive: '%s', ignoring", conffile, buffer);
+				continue;
+	    		}
+		} 
+
+
+	buflen = strlen(buffer);
+	//log_write (0, LOG_MAIN, "buffer = %s\n",buffer);
+
+	if ( *(buffer+(buflen-2)) == '\\') {
+		//log_write(0, LOG_MAIN, "SA: Debug: Command not finished! Lets do it again!\n");
+	offset = offset + buflen-2;
+	firstround = 0;
+	continue;
+	} else {
+		firstround = 1;
+		offset = 0;
+	}
+
 
 #define     M_CHECKFORVAR(VAR, TYPE) \
 	    if (strstr(buffer, #VAR ": ") == buffer) \


More information about the SA-Exim mailing list