On 2025-11-28 Andreas Metzler <[email protected]> wrote:
[...]
> there was a bug in exim 4.99 up to 4.99-4, expand_string was not
> available for local_scan. Also the ABI changed (expand_string is a macro
> now) and the API also changed:
> -extern int     smtp_fflush(void);
> +extern int     smtp_fflush(BOOL);

> As a side-effect of the change to expand_string() incorrect signedness
> of the args to expand_string() (signed char *) causes a compilation
> error.

> exim4 4.99-5 and newer bumped LOCAL_SCAN_ABI_VERSION_MINOR this version 
> cannot be installed together with sa-exim 4.2.1-22

Hello,

Find attached an (almost untested) patch to fix the FTBFS.

I do not intend to NMU since I would rather drop the localscan_dlopen
patch to exim (and sa-exim).

cu Andreas
Description: Do not pass signed char args to expand_string().
 Fixes FTBFS against exim4 >> 4.95-4.
Author: Andreas Metzler <[email protected]>
Bug-Debian: https://bugs.debian.org/1121023
Origin: vendor
Last-Update: 2025-12-03

--- sa-exim-4.2.1.orig/sa-exim.c
+++ sa-exim-4.2.1/sa-exim.c
@@ -83,8 +83,8 @@ static const char conffile[]=SPAMASSASSI
 /********************/
 static const char nospamstatus[]="<error finding status>";
 
-static char *buffera[4096];
-static char *buffer=(char *)buffera;
+static unsigned char *buffera[4096];
+static unsigned char *buffer=(unsigned char *)buffera;
 static int SAEximDebug=0;
 static int SAPrependArchiveWithFrom=1;
 static jmp_buf jmp_env;
@@ -173,7 +173,7 @@ static char *get_header(char *buffer)
 /* Rejected mails can be archived in a spool directory */
 /* filename will contain a double / before the filename, I prefer two to none */
 static int savemail(int readfd, off_t fdstart, char *dir, char *dirvarname, 
-			char *filename, int SAmaxarchivebody, char *condition)
+			char *filename, int SAmaxarchivebody, unsigned char *condition)
 {
     header_line *hl;
     int writefd=0;
@@ -555,11 +555,11 @@ int local_scan(volatile int fd, uschar *
     static char *SAspamcSockPath=NULL;
     static char *SAspamcPort=NULL;
     static char *SAspamcHost=NULL;
-    static char *SAspamcUser=NULL;
-    static char *SAEximRunCond="0";
-    static char *SAEximRejCond="1";
+    static unsigned char *SAspamcUser=NULL;
+    static unsigned char *SAEximRunCond="0";
+    static unsigned char *SAEximRejCond="1";
     static int SAmaxbody=250*1024;
-    static char *SATruncBodyCond="0";
+    static unsigned char *SATruncBodyCond="0";
     static int SARewriteBody=0;
     static int SAmaxarchivebody=20*1048576;
     static int SAerrmaxarchivebody=1024*1048576;
@@ -571,23 +571,23 @@ int local_scan(volatile int fd, uschar *
     static char *SAerrorsave=NULL;
     static char *SAerrorSavCond="1";
     static int SAtemprejectonerror=0;
-    static char *SAteergrube="1048576";
+    static unsigned char *SAteergrube="1048576";
     static float SAteergrubethreshold;
     /* This is obsolete, since SAteergrube (now a condition) can do the same */
-    static char *SAteergrubecond="1";
+    static unsigned char *SAteergrubecond="1";
     static int SAteergrubetime=900;
     static char *SAteergrubeSavCond="1";
     static char *SAteergrubesave=NULL;
     static int SAteergrubeoverwrite=1;
-    static char *SAdevnull="1048576";
+    static unsigned char *SAdevnull="1048576";
     static float SAdevnullthreshold;
     static char *SAdevnullSavCond="1";
     static char *SAdevnullsave=NULL;
-    static char *SApermreject="1048576";
+    static unsigned char *SApermreject="1048576";
     static float SApermrejectthreshold;
     static char *SApermrejectSavCond="1";
     static char *SApermrejectsave=NULL;
-    static char *SAtempreject="1048576";
+    static unsigned char *SAtempreject="1048576";
     static float SAtemprejectthreshold;
     static char *SAtemprejectSavCond="1";
     static char *SAtemprejectsave=NULL;
@@ -608,7 +608,7 @@ int local_scan(volatile int fd, uschar *
 
     /* This needs to be retrieved through expand_string in order
        not to violate the API. */
-    uschar *primary_hostname=expand_string("$primary_hostname");
+    uschar *primary_hostname=expand_string(US "$primary_hostname");
 
     /* New values we read from spamassassin */
     char *xspamstatus=NULL;
@@ -669,7 +669,7 @@ int local_scan(volatile int fd, uschar *
 	    }
 
 #define     M_CHECKFORVAR(VAR, TYPE) \
-	    if (strstr(buffer, #VAR ": ") == buffer) \
+	    if (US (strstr(buffer, #VAR ": ")) == buffer) \
 	    { \
 		if (sscanf(buffer, #VAR ": " TYPE, &VAR)) \
 		{ \
@@ -694,7 +694,7 @@ int local_scan(volatile int fd, uschar *
 	    } 
 
 #define	    M_CHECKFORSTR(VAR) \
-	    if (strstr(buffer, #VAR  ": ") == buffer) \
+	    if (US (strstr(buffer, #VAR  ": ")) == buffer) \
 	    { \
 		VAR = strdup(buffer+strlen( #VAR )+2); \
 		if (VAR == NULL) \
@@ -1402,7 +1402,7 @@ restart:
 	    for (i=0;i<SAteergrubetime/10;i++)
 	    {
 		smtp_printf("451-%s\r\n", FALSE, teergrubewaitstr);
-		ret=smtp_fflush();
+		ret=smtp_fflush(true);
 		if (ret != 0)
 		{
 		    log_write(0, LOG_MAIN | LOG_REJECT, "SA: Action: teergrubed sender for %d secs until it closed the connection: %s (scanned in %d/%d secs | Message-Id: %s). %s", i*10, spamstatus, scantime, fulltime, safemesgid, mailinfo);

Reply via email to