Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
27/01/2024 version 1.4.3 Roberto Puzzanghera
- fixed several compilation warnings
- fixed several autotools warnings

06/12/2023 Roberto Puzzanghera
- added jms "debug" patch, to improve the debugging of simscan on
qmail-smtpd log;
Expand Down
29 changes: 0 additions & 29 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -719,35 +719,6 @@ else
fi
])

# -*- Autoconf -*-
# Obsolete and "removed" macros, that must however still report explicit
# error messages when used, to smooth transition.
#
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

AC_DEFUN([AM_CONFIG_HEADER],
[AC_DIAGNOSE([obsolete],
['$0': this macro is obsolete.
You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
AC_CONFIG_HEADERS($@)])

AC_DEFUN([AM_PROG_CC_STDC],
[AC_PROG_CC
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
AC_DIAGNOSE([obsolete],
['$0': this macro is obsolete.
You should simply use the 'AC][_PROG_CC' macro instead.
Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
but upon 'ac_cv_prog_cc_stdc'.])])

AC_DEFUN([AM_C_PROTOTYPES],
[AC_FATAL([automatic de-ANSI-fication support has been removed])])
AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])

# Helper functions for option handling. -*- Autoconf -*-

# Copyright (C) 2001-2020 Free Software Foundation, Inc.
Expand Down
3 changes: 2 additions & 1 deletion cdb/alloc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include "alloc.h"
#include "error.h"
extern char *malloc();
//extern char *malloc();
extern void free();

#define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */
Expand Down
1 change: 1 addition & 0 deletions cdb/seek_cur.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <unistd.h>
#include <sys/types.h>
#include "seek.h"

Expand Down
1 change: 1 addition & 0 deletions cdb/seek_set.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <unistd.h>
#include <sys/types.h>
#include "seek.h"

Expand Down
23 changes: 13 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for simscan 1.4.2.
# Generated by GNU Autoconf 2.71 for simscan 1.4.3.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
Expand Down Expand Up @@ -607,8 +607,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='simscan'
PACKAGE_TARNAME='simscan'
PACKAGE_VERSION='1.4.2'
PACKAGE_STRING='simscan 1.4.2'
PACKAGE_VERSION='1.4.3'
PACKAGE_STRING='simscan 1.4.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1340,7 +1340,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures simscan 1.4.2 to adapt to many kinds of systems.
\`configure' configures simscan 1.4.3 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1411,7 +1411,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of simscan 1.4.2:";;
short | recursive ) echo "Configuration of simscan 1.4.3:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1539,7 +1539,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
simscan configure 1.4.2
simscan configure 1.4.3
generated by GNU Autoconf 2.71

Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1800,7 +1800,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by simscan $as_me 1.4.2, which was
It was created by simscan $as_me 1.4.3, which was
generated by GNU Autoconf 2.71. Invocation command line was

$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3075,7 +3075,7 @@ fi

# Define the identity of the package.
PACKAGE='simscan'
VERSION='1.4.2'
VERSION='1.4.3'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -6632,6 +6632,7 @@ DEFS=-DHAVE_CONFIG_H

ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
Expand Down Expand Up @@ -7064,7 +7065,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by simscan $as_me 1.4.2, which was
This file was extended by simscan $as_me 1.4.3, which was
generated by GNU Autoconf 2.71. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -7132,7 +7133,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
simscan config.status 1.4.2
simscan config.status 1.4.3
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

Expand Down Expand Up @@ -7995,6 +7996,8 @@ fi


echo ""
echo "---------------------------------------"
echo " $PACKAGE_NAME $PACKAGE_VERSION"
echo " Current settings"
echo "---------------------------------------"
echo " user = $ENABLE_USER"
Expand Down
27 changes: 14 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
dnl Process this file with autoconf to produce a configure script.

AC_INIT([simscan], [1.4.2])
AC_PREREQ([2.71])
AC_INIT([simscan],[1.4.3])
AC_CONFIG_SRCDIR([simscan.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE()
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AC_CHECK_FUNCS([strsep])

Expand All @@ -22,24 +23,21 @@ AC_ARG_ENABLE(user, [ --enable-user=<user> Change the user for simscan. Defaul
[
ENABLE_USER="simscan"
])

AC_MSG_CHECKING(whether the $ENABLE_USER user exists)
AC_TRY_RUN( [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <pwd.h>

int main() {
struct passwd *pw;
if (( pw=getpwnam("$ENABLE_USER")) != 0 ) return 0;
if (( pw=getpwnam("$ENABLE_USER")) != 0 ) return 0;
else return 1;
return -1;
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.),
AC_MSG_RESULT(no)
]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.)],[AC_MSG_RESULT(no)
AC_MSG_ERROR(could not find the $ENABLE_USER user. Please add the $ENABLE_USER user and try again.)
)
])

AC_SUBST(ENABLE_USER)

Expand Down Expand Up @@ -748,9 +746,12 @@ esac
#----------------------------------------------------------------------


AC_OUTPUT(Makefile)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

echo ""
echo "---------------------------------------"
echo " $PACKAGE_NAME $PACKAGE_VERSION"
echo " Current settings"
echo "---------------------------------------"
echo " user = $ENABLE_USER"
Expand Down
35 changes: 21 additions & 14 deletions simscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ char *spamc_args[MAX_SPAMC_ARGS];
/* Global work buffers */
#define BUFFER_SIZE 2048
char buffer[BUFFER_SIZE];
char message_name[BUFFER_SIZE];
char message_name[BUFFER_SIZE+10];
char workdir[BUFFER_SIZE];
char unique_ext[BUFFER_SIZE];

Expand All @@ -110,7 +110,7 @@ char *viri_args[] = { "clamdscan", "--stdout", message_name, NULL };
/* To/From address processing globals */
#define MAX_RCPT_TO 255
#define MAX_EMAIL 500
char addr_name[BUFFER_SIZE];
char addr_name[BUFFER_SIZE+5];
char *addr_buff;
int MaxRcptTo;
char MailFrom[MAX_EMAIL];
Expand Down Expand Up @@ -148,7 +148,7 @@ void per_domain_email_lookup (char *email);

/* Customer Smtp reject message globals */
#ifdef ENABLE_CUSTOM_SMTP_REJECT
char RejectMsg[500];
char RejectMsg[BUFFER_SIZE+100];
#endif

/* Generic virus scanner globals */
Expand Down Expand Up @@ -194,7 +194,7 @@ float DSpamConf=0.0;
#if defined(ENABLE_DSPAM)
int InHeaders;
int IsSpam;
char spam_message_name[BUFFER_SIZE];
char spam_message_name[BUFFER_SIZE+10];
int check_dspam();
int is_dspam(char *spambuf);
#endif
Expand All @@ -207,7 +207,7 @@ float SAReqHits;
char spamuser[BUFFER_SIZE];
int InHeaders;
int IsSpam;
char spam_message_name[BUFFER_SIZE];
char spam_message_name[BUFFER_SIZE+10];
int check_spam();
int is_spam(char *spambuf);
#endif
Expand Down Expand Up @@ -645,7 +645,8 @@ if (msgsize >= size_limit) {
/* spamassassin processed message and no spam detected */
case 0:
/* open the spam file read only */
strncpy(message_name,spam_message_name,BUFFER_SIZE);
// strncpy(message_name,spam_message_name,BUFFER_SIZE);
memcpy(message_name,spam_message_name,BUFFER_SIZE);
break;
/* errors , return temporary error */
default:
Expand Down Expand Up @@ -1111,7 +1112,8 @@ int is_clam(char *clambuf)
}

if ( (tmpstr=strstr(&clambuf[j], "FOUND")) != NULL ) {
while(*tmpstr!=':' && tmpstr>clambuf) --tmpstr; ++tmpstr;
while(*tmpstr!=':' && tmpstr>clambuf) --tmpstr;
++tmpstr;
virus_name = strtok(tmpstr, " ");
memset(VirusName,0,sizeof(VirusName));
strncpy(VirusName, virus_name, sizeof(VirusName)-1);
Expand Down Expand Up @@ -1546,7 +1548,7 @@ void format_dir(char *workdir)
snprintf(unique_ext, sizeof(unique_ext),"%ld.%ld.%ld",
mytime.tv_sec, mytime.tv_usec, (long int)getpid());

snprintf(workdir,BUFFER_SIZE, "%s/%s", WORKDIR, unique_ext);
snprintf(workdir,BUFFER_SIZE+100, "%s/%s", WORKDIR, unique_ext);

}

Expand Down Expand Up @@ -1756,7 +1758,8 @@ void add_attach (char *list)
MaxAttach = 0;
if ( DebugFlag > 3 ) fprintf(stderr, "simscan:[%d]: add_attach called with %s\n", getppid(), list);
while( ( found = strsep(&list,":") ) != NULL) {
strncpy(bk_attachments[MaxAttach], found, strlen(found));
// strncpy(bk_attachments[MaxAttach], found, strlen(found));
memcpy(bk_attachments[MaxAttach], found, strlen(found));
if ( DebugFlag > 1 ) {
fprintf(stderr, "simscan:[%d]: %s is attachment number %d\n", getppid(),
bk_attachments[MaxAttach], MaxAttach);
Expand Down Expand Up @@ -1798,7 +1801,7 @@ int check_attach()
return(1);
}
} else {
if ( DebugFlag > 2 ) fprintf(stderr, "simscan: attachment name '%s' (%d) is shorter than '%s' (%d). IGNORED\n", mydirent->d_name, strlen( mydirent->d_name ), bk_attachments[i], strlen( bk_attachments[i] ) );
if ( DebugFlag > 2 ) fprintf(stderr, "simscan: attachment name '%s' (%lu) is shorter than '%s' (%lu). IGNORED\n", mydirent->d_name, strlen( mydirent->d_name ), bk_attachments[i], strlen( bk_attachments[i] ) );
}
}
}
Expand All @@ -1818,8 +1821,10 @@ int str_rstr(register char *h,register char *n)
register char *sh;
register char *sn;

for(sh=h;*h!=0;++h); --h;
for(sn=n;*n!=0;++n); --n;
for(sh=h;*h!=0;++h);
--h;
for(sn=n;*n!=0;++n);
--n;

for(;h>=sh && n>=sn;--h,--n) {
if ( *h!=*n ) {
Expand Down Expand Up @@ -1895,7 +1900,8 @@ void per_domain_lookup( char *key )

#ifdef ENABLE_SPAM
} else if ( strcasecmp(parm,"spamuser") == 0 ) {
strncpy(spamuser,val,BUFFER_SIZE);
// strncpy(spamuser,val,BUFFER_SIZE);
memcpy(spamuser,val,BUFFER_SIZE);
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: spamuser = %s\n", getppid(), spamuser);
#endif

Expand Down Expand Up @@ -1980,7 +1986,8 @@ void per_domain_email_lookup (char *email) {
per_domain_lookup( domain );
}

strncpy(local,email, sizeof(local));
// strncpy(local,email, sizeof(local));
memcpy(local,email, sizeof(local));
for(l_ptr=local; l_ptr!=NULL && *l_ptr!='@' && *l_ptr!='\0'; ++l_ptr );
*l_ptr='\0';
if ( DebugFlag > 1 ) fprintf(stderr, "simscan:[%d]: pelookup: local part is %s\n", getppid(), local);
Expand Down