summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.am4
-rw-r--r--NEWS31
-rw-r--r--README-alpha2
-rw-r--r--README-hacking2
-rw-r--r--TODO2
-rw-r--r--am/anubis.m42
-rw-r--r--am/gnutls.m42
-rw-r--r--am/gpgme.m42
-rw-r--r--build/Makefile.am3
-rw-r--r--build/guile-1.6/.gitignore2
-rw-r--r--build/guile-1.6/Makefile.am21
-rwxr-xr-xbuild/guile-1.6/guile-doc-snarf72
-rw-r--r--build/guile-1.6/guile-doc-snarf.awk88
-rwxr-xr-xbuild/keygen.sh2
-rwxr-xr-xbuild/specgen.sh2
-rw-r--r--configure.ac66
-rw-r--r--contrib/Makefile.am2
-rwxr-xr-xcontrib/msg2smtp.pl2
-rw-r--r--doc/Makefile.am2
-rw-r--r--elisp/Makefile.am2
-rw-r--r--elisp/anubis-mode.el2
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/anubis.scm2
-rw-r--r--examples/pam/Makefile.am2
-rw-r--r--gnulib.modules1
-rw-r--r--guile/Makefile.am2
-rw-r--r--guile/entire-msg.scm2
-rw-r--r--guile/remailer.scm2
-rw-r--r--guile/rot-13.scm2
-rw-r--r--lib/.gitignore57
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/keyword.c2
-rw-r--r--lib/keyword.h2
-rw-r--r--po/POTFILES.in3
-rw-r--r--scripts/Makefile.am2
-rw-r--r--src/Makefile.am38
-rw-r--r--src/adm.opt2
-rw-r--r--src/anubisadm.c4
-rw-r--r--src/anubisadm.h2
-rw-r--r--src/anubisdb.c2
-rw-r--r--src/anubisusr.c7
-rw-r--r--src/anubisusr.h2
-rw-r--r--src/authmode.c2
-rw-r--r--src/daemon.c6
-rw-r--r--src/dbtext.c2
-rw-r--r--src/env.opt9
-rw-r--r--src/errs.c2
-rw-r--r--src/esmtp.c2
-rw-r--r--src/exec.c2
-rw-r--r--src/extern.h2
-rw-r--r--src/gdbm.c30
-rw-r--r--src/getopt.m44
-rw-r--r--src/gpg.c23
-rw-r--r--src/gsasl.c7
-rw-r--r--src/gsasl_srv.c2
-rw-r--r--src/guile.c25
-rw-r--r--src/headers.h8
-rw-r--r--src/help.c5
-rw-r--r--src/ident.c2
-rw-r--r--src/list.c2
-rw-r--r--src/list.h2
-rw-r--r--src/log.c2
-rw-r--r--src/logport.c240
-rw-r--r--src/main.c12
-rw-r--r--src/map.c2
-rw-r--r--src/mda.c2
-rw-r--r--src/message.c2
-rw-r--r--src/mime.c4
-rw-r--r--src/misc.c2
-rw-r--r--src/mysql.c2
-rw-r--r--src/net.c4
-rw-r--r--src/pgsql.c2
-rw-r--r--src/proclist.c2
-rw-r--r--src/quit.c2
-rw-r--r--src/rc-gram.y2
-rw-r--r--src/rc-lex.l2
-rw-r--r--src/rcfile.c18
-rw-r--r--src/rcfile.h2
-rw-r--r--src/regex.c2
-rw-r--r--src/smtprepl.c2
-rw-r--r--src/smtprepl.h2
-rw-r--r--src/socks.c2
-rw-r--r--src/sql.c2
-rw-r--r--src/sql.h2
-rw-r--r--src/stream.c8
-rw-r--r--src/tls.c5
-rw-r--r--src/transmode.c2
-rw-r--r--src/tunnel.c4
-rw-r--r--src/url.c2
-rw-r--r--src/usr.opt2
-rw-r--r--src/xdatabase.c2
-rw-r--r--tests/.gitignore8
-rw-r--r--tests/Makefile.am91
-rw-r--r--tests/anubisusr.at131
-rw-r--r--tests/anustart.c372
-rw-r--r--tests/atlocal.in14
-rw-r--r--tests/badd.at82
-rw-r--r--tests/bmod.at84
-rw-r--r--tests/cond.at89
-rw-r--r--tests/empty.at50
-rw-r--r--tests/fadd.at78
-rw-r--r--tests/gpgcrypt.at101
-rw-r--r--tests/gpgse.at102
-rw-r--r--tests/gpgsign.at105
-rw-r--r--tests/hadd00.at71
-rw-r--r--tests/hadd01.at (renamed from testsuite/etc/del2.pat)96
-rw-r--r--tests/hadd02.at (renamed from testsuite/etc/add3.pat)87
-rw-r--r--tests/hdel00.at71
-rw-r--r--tests/hdel01.at (renamed from testsuite/etc/add2.pat)101
-rw-r--r--tests/hdel02.at (renamed from testsuite/etc/del3.pat)88
-rw-r--r--tests/hdel03.at72
-rw-r--r--tests/hmod.at109
-rw-r--r--tests/mime00.at (renamed from testsuite/etc/mime1.pat)54
-rw-r--r--tests/mime01.at (renamed from testsuite/etc/mime2.pat)55
-rw-r--r--tests/mta.c (renamed from testsuite/mta.c)23
-rw-r--r--tests/mult.at (renamed from testsuite/etc/mult.pat)74
-rw-r--r--tests/no-backref.at72
-rw-r--r--tests/paolo.at71
-rw-r--r--tests/parse.at103
-rw-r--r--tests/remailer.at88
-rw-r--r--tests/rot-13.at145
-rw-r--r--tests/testsuite.at73
-rw-r--r--tests/tlsoneway.at80
-rw-r--r--tests/trigger.at101
-rw-r--r--testsuite/.gitignore9
-rw-r--r--testsuite/Makefile.am94
-rw-r--r--testsuite/anubis.authmode/DISTFILES5
-rw-r--r--testsuite/anubis.authmode/abase.exp107
-rw-r--r--testsuite/anubis.authmode/base.exp9
-rw-r--r--testsuite/anubis.authmode/gpg.exp9
-rw-r--r--testsuite/anubis.authmode/guile.exp9
-rw-r--r--testsuite/anubis.authmode/mime.exp9
-rw-r--r--testsuite/anubis/DISTFILES7
-rw-r--r--testsuite/anubis/abase.exp21
-rw-r--r--testsuite/anubis/base.exp59
-rw-r--r--testsuite/anubis/gpg.exp26
-rw-r--r--testsuite/anubis/guile.exp24
-rw-r--r--testsuite/anubis/mime.exp24
-rw-r--r--testsuite/anubis/no-backref.exp29
-rw-r--r--testsuite/anubis/paolo.exp3
-rw-r--r--testsuite/anubis/tls.exp23
-rw-r--r--testsuite/data/.gitignore5
-rw-r--r--testsuite/data/Makefile.am30
-rw-r--r--testsuite/data/anubis.pem33
-rw-r--r--testsuite/data/append.txt4
-rw-r--r--testsuite/data/pubring.asc24
-rw-r--r--testsuite/data/secring.asc26
-rw-r--r--testsuite/data/users5
-rw-r--r--testsuite/etc/.gitignore12
-rw-r--r--testsuite/etc/Makefile.am113
-rw-r--r--testsuite/etc/add-body-file.pat50
-rw-r--r--testsuite/etc/add-body.pat51
-rw-r--r--testsuite/etc/add.in42
-rw-r--r--testsuite/etc/add1.pat51
-rw-r--r--testsuite/etc/cond.in47
-rw-r--r--testsuite/etc/cond.pat53
-rw-r--r--testsuite/etc/del.in28
-rw-r--r--testsuite/etc/del1.pat53
-rw-r--r--testsuite/etc/del4.pat52
-rw-r--r--testsuite/etc/empty.in22
-rw-r--r--testsuite/etc/empty.pat43
-rw-r--r--testsuite/etc/entire.in23
-rw-r--r--testsuite/etc/gpg.in42
-rw-r--r--testsuite/etc/gpgcrypt.pat54
-rw-r--r--testsuite/etc/gpgse.pat55
-rw-r--r--testsuite/etc/gpgsign.pat57
-rw-r--r--testsuite/etc/interface.in.in31
-rw-r--r--testsuite/etc/mod-body.in30
-rw-r--r--testsuite/etc/mod-body.pat53
-rw-r--r--testsuite/etc/mod-header.in34
-rw-r--r--testsuite/etc/mod-header.pat68
-rw-r--r--testsuite/etc/net.rc6
-rw-r--r--testsuite/etc/no-backref.in26
-rw-r--r--testsuite/etc/no-backref.pat52
-rw-r--r--testsuite/etc/paolo.in27
-rw-r--r--testsuite/etc/paolo.pat56
-rw-r--r--testsuite/etc/remail.in50
-rw-r--r--testsuite/etc/remail.pat53
-rw-r--r--testsuite/etc/rot-13.pat98
-rw-r--r--testsuite/etc/simple.in29
-rw-r--r--testsuite/etc/std.in97
-rw-r--r--testsuite/etc/std.pin105
-rw-r--r--testsuite/etc/target.in.in41
-rw-r--r--testsuite/etc/tlsoneway.in23
-rw-r--r--testsuite/etc/tlsoneway.pat53
-rw-r--r--testsuite/etc/trigger.in35
-rw-r--r--testsuite/etc/trigger.pat74
-rw-r--r--testsuite/findport.c188
-rw-r--r--testsuite/lib/DISTFILES1
-rw-r--r--testsuite/lib/anubis.exp970
190 files changed, 3056 insertions, 4456 deletions
diff --git a/Makefile.am b/Makefile.am
index 7382036..64a66f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,11 @@
##
## Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
@@ -17,13 +17,13 @@
## You should have received a copy of the GNU General Public License along
## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
##
ACLOCAL_AMFLAGS = -I m4 -I am -I gint
SUBDIRS = build lib gint src po doc scripts examples guile contrib \
- elisp testsuite
+ elisp tests
AM_DISTCHECK_CONFIGURE_FLAGS =\
--with-gsasl\
--with-mysql\
--with-postgres\
--with-pam\
diff --git a/NEWS b/NEWS
index 16f46b2..c38cf1b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,23 +1,30 @@
-GNU Anubis NEWS -- history of user-visible changes. 2014-05-18
-Copyright (C) 2001-2014 The Anubis Team.
+GNU Anubis NEWS -- history of user-visible changes. 2020-06-06
+Copyright (C) 2001-2020 The Anubis Team.
See the end of file for copying conditions.
Please send your bug reports to <bug-anubis@gnu.org>.
+
+* Version 4.2.90 (Git)
+
+** Fix compilation with GDBM 1.18.1
+
+* Support for Guile version 2.2.0 and later
+Support for prior versions has been withdrawn.
-* Version 4.1.92 (Git)
+* Version 4.2, 2014-05-23
-* New operation mode: proxy
+** New operation mode: proxy
-* Command line option precedence
+** Command line option precedence
Command line options take precedence over configuration file
statements.
-* elif statement
+** elif statement
A familiar `elif' statement is supported, e.g.:
if condition-1
action-list-1
elif condition-2
@@ -25,20 +32,20 @@ elif condition-2
elif condition-3
action-list-3
else
action-list-4
fi
-* New CONTROL statement esmtp-auth-delayed.
+** New CONTROL statement esmtp-auth-delayed.
When set to `yes', this statement instructs Anubis to postpone ESMTP
authentication until MAIL command is issued by the client. This
allows to change authentication credentials in the SMTP section (see
below).
-* SMTP section
+** SMTP section
The new section "SMTP" is invoked each time an SMTP command
is received. This section may alter the command's argument, using the
"modify command", e.g.:
BEGIN SMTP
@@ -61,20 +68,20 @@ if command ["mail from:"] "<smith(\+.*)?@@example.net>"
esmtp-password guessme
else
esmtp-auth no
fi
END
-* New keywords: log-facility and log-tag
+** New keywords: log-facility and log-tag
-* Guile output
+** Guile output
By default Scheme's standard error and output ports are redirected to
syslog, using priorities `err' and `warning' correspondingly.
-* MySQL options file
+** MySQL options file
When using MySQL for Anubis user database, the database parameters and
access credentials are read from the file /etc/my.cnf, section
"anubis". Additionally, two URL parameters are provided:
"options-file", which sets the name of the options file, and
"options-group", which sets the name of the group.
@@ -503,13 +510,13 @@ translations.
----------------------------------------------------------------------
Copyright information:
- Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/README-alpha b/README-alpha
index 7210aeb..5cdbc77 100644
--- a/README-alpha
+++ b/README-alpha
@@ -36,13 +36,13 @@ contact the mailing list.
Read the file README-hacking for the instructions on bootstrapping the
Git version.
* Copyright information
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/README-hacking b/README-hacking
index 5df0ddc..8d4435d 100644
--- a/README-hacking
+++ b/README-hacking
@@ -50,13 +50,13 @@ files.
For more information about `bootstrap', run `bootstrap --help'.
* Copyright information
- Copyright (C) 2007-2014 The Anubis Team.
+ Copyright (C) 2007-2020 The Anubis Team.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/TODO b/TODO
index 8ad8dd7..a98ba77 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,8 @@
GNU Anubis TODO list. 2005-05-25
-Copyright (C) 2003-2014 The Anubis Team
+Copyright (C) 2003-2020 The Anubis Team
* Urgent:
** Get rid of global vs. local variable mess.
** Write general-purpose (e)smtp io functions and use them throughout
diff --git a/am/anubis.m4 b/am/anubis.m4
index 15c78e4..d758054 100644
--- a/am/anubis.m4
+++ b/am/anubis.m4
@@ -1,9 +1,9 @@
dnl
dnl This file is part of GNU Anubis.
-dnl Copyright (C) 2001-2014 The Anubis Team.
+dnl Copyright (C) 2001-2020 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
diff --git a/am/gnutls.m4 b/am/gnutls.m4
index 6d69467..a3cf946 100644
--- a/am/gnutls.m4
+++ b/am/gnutls.m4
@@ -1,8 +1,8 @@
dnl This file is part of GNU Anubis.
-dnl Copyright (C) 2001-2014 The Anubis Team.
+dnl Copyright (C) 2001-2020 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
diff --git a/am/gpgme.m4 b/am/gpgme.m4
index 21ac088..64d4cf4 100644
--- a/am/gpgme.m4
+++ b/am/gpgme.m4
@@ -1,9 +1,9 @@
dnl
dnl This file is part of GNU Anubis.
-dnl Copyright (C) 2001-2014 The Anubis Team.
+dnl Copyright (C) 2001-2020 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
diff --git a/build/Makefile.am b/build/Makefile.am
index d849cc3..9bfa70b 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,11 +1,11 @@
##
## build/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
@@ -15,11 +15,10 @@
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
##
-SUBDIRS = guile-1.6
EXTRA_DIST = keygen.sh specgen.sh cflow.rc
## EOF
diff --git a/build/guile-1.6/.gitignore b/build/guile-1.6/.gitignore
deleted file mode 100644
index 282522d..0000000
--- a/build/guile-1.6/.gitignore
+++ b/dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/build/guile-1.6/Makefile.am b/build/guile-1.6/Makefile.am
deleted file mode 100644
index c5b7cd5..0000000
--- a/build/guile-1.6/Makefile.am
+++ b/dev/null
@@ -1,21 +0,0 @@
-##
-## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
-##
-## GNU Anubis is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 3 of the License, or (at your
-## option) any later version.
-##
-## GNU Anubis is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License along
-## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-##
-
-EXTRA_DIST = \
- guile-doc-snarf\
- guile-doc-snarf.awk
diff --git a/build/guile-1.6/guile-doc-snarf b/build/guile-1.6/guile-doc-snarf
deleted file mode 100755
index b03be6b..0000000
--- a/build/guile-1.6/guile-doc-snarf
+++ b/dev/null
@@ -1,72 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002 Sergey Poznyakoff
-#
-# This is a snarfer for guile version 1.6
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-OUTFILE=/dev/tty
-DOCFILE=0
-BASEDIR=`dirname $0`
-test -n "${CPP+set}" || CPP="gcc -E"
-test -n "${AWK+set}" || AWK=awk
-temp=/tmp/snarf.$$
-trap "rm -f $temp" 0 1 2 15
-
-# process aruments
-while [ $# -gt 0 ];
-do
- case $1 in
- -o) OUTFILE=$2; shift 2;;
- -d) DOCFILE=1; shift;;
- *) break;;
- esac
-done
-
-INFILE=$1; shift
-
-cpp_exit=1
-
-snarf_x() {
- echo "/* source: $INFILE */" ;
- echo "/* cpp arguments: $@ */" ;
- $CPP -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp}
- cpp_exit=$?
- grep "^ *\^ *\^" ${temp} | sed -e "s/^ *\^ *\^//" -e "s/\^\ *:\ *\^.*/;/"
-}
-
-snarf_doc() {
- $CPP -DSCM_MAGIC_SNARF_DOCS "$@" > ${temp}
- cpp_exit=$?
- $AWK '
-NF<2 {next}
-state == 0 && /\^\^ {/ { state = 1; print; next }
-state == 0 && /\^\^/ { print }
-state == 1 && /\^\^ }/ { state = 0; print; next }
-state == 1 { print }
-state == 0 { next }' $temp |\
- tr -d '\n' | tr '^' '\n' |\
- awk -f $BASEDIR/guile-doc-snarf.awk > $OUTFILE
-}
-
-case "$DOCFILE" in
- 0) snarf_x $INFILE "$@" > $OUTFILE;;
- 1) snarf_doc $INFILE "$@" > $OUTFILE;;
-esac
-
-if [ $cpp_exit -ne 0 ]; then
- [ "$OUTFILE" != "/dev/tty" ] && rm $OUTFILE
-fi
-exit $cpp_exit
diff --git a/build/guile-1.6/guile-doc-snarf.awk b/build/guile-1.6/guile-doc-snarf.awk
deleted file mode 100644
index 7fafbd3..0000000
--- a/build/guile-1.6/guile-doc-snarf.awk
+++ b/dev/null
@@ -1,88 +0,0 @@
-# Copyright (C) 2002 Sergey Poznyakoff
-#
-# This is a snarfer for guile version 1.6
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-
-BEGIN {
- cname = ""
-}
-
-function flush() {
- if (cname == "")
- return;
- if (arg_req + arg_opt + arg_var != numargs)
- error(cname " incorrectly defined as taking " numargs " arguments")
-
- print "\f" cname
- print "@c snarfed from " loc_source ":" loc_line
- printf "@deffn {Scheme procedure} %s", cname
- for (i = 1; i <= numargs; i++)
- printf(" %s", arglist[i])
- print ""
- print docstring
- print "@end deffn\n"
-
- delete argpos
- delete arglist
- cname = ""
-}
-
-function error(s) {
- print loc_source ":" loc_line ": " s > "/dev/stderr"
- exit 1
-}
-
-state == 0 && /{/ {
- flush()
- cname = $3
- next
-}
-
-state == 0 && /fname/ { fname = $2; next }
-state == 0 && /type/ { type = $2; next }
-state == 0 && /location/ { loc_source = $2; loc_line = $3 }
-state == 0 && /arglist/ {
- match($0, "\\(.*\\)")
- s = substr($0,RSTART+1,RLENGTH-2)
- numargs = split(s, a, ",")
- for (i = 1; i <= numargs; i++) {
- m = split(a[i], b, "[ \t]*")
- if (b[1] == "") {
- t = b[2]
- n = b[3]
- m--
- } else {
- t = b[1]
- n = b[2]
- }
- if (m > 2 || t != "SCM")
- error(cname ": wrong argument type for arg " i " " t)
- arglist[i] = n
- }
-}
-state == 0 && /argsig/ { arg_req = $2; arg_opt = $3; arg_var = $4 }
-
-state == 0 && /.*\"/ {
- gsub("\"\"", "")
- gsub("\\\\n", "\n")
- match($0,"\".*\"")
- docstring = substr($0,RSTART+1,RLENGTH-2)
-}
-
-/argpos/ { argpos[$2] = $3 }
-
-END {
- flush()
-}
diff --git a/build/keygen.sh b/build/keygen.sh
index 1c2c028..b163e5a 100755
--- a/build/keygen.sh
+++ b/build/keygen.sh
@@ -1,12 +1,12 @@
#!/bin/sh
#
# keygen.sh
#
# This file is part of GNU Anubis.
-# Copyright (C) 2001-2014 The Anubis Team.
+# Copyright (C) 2001-2020 The Anubis Team.
#
# GNU Anubis is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
diff --git a/build/specgen.sh b/build/specgen.sh
index 977abc9..712dde1 100755
--- a/build/specgen.sh
+++ b/build/specgen.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
# This file is part of GNU Anubis.
-# Copyright (C) 2001-2014 The Anubis Team.
+# Copyright (C) 2001-2020 The Anubis Team.
#
# GNU Anubis is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
diff --git a/configure.ac b/configure.ac
index 40e76cf..f6091d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
dnl configure.ac -*- autoconf-*-
dnl
dnl This file is part of GNU Anubis.
-dnl Copyright (C) 2001-2014 The Anubis Team.
+dnl Copyright (C) 2001-2020 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
@@ -15,13 +15,13 @@ dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([GNU Anubis], [4.1.92], [bug-anubis@gnu.org])
+AC_INIT([GNU Anubis], [4.2.90], [bug-anubis@gnu.org])
AC_PREREQ([2.63])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules])
AC_GNU_SOURCE
@@ -36,12 +36,48 @@ AC_PROG_YACC
AM_PROG_LEX
AC_PATH_PROG(idecrypt_path,idecrypt,/usr/sbin/idecrypt,
$PATH:/sbin:/usr/sbin:/usr/local/sbin)
AC_DEFINE_UNQUOTED(IDECRYPT_PATH,"${idecrypt_path}",
[Define if IDECRYPT_PATH is present.])
+# *********************************************************************
+# GPG v2 (for the testsuite)
+# The testsuite needs to create GPG keys, which would be prohibitively
+# slow without the %transient-key statement, which appeared in GPG 2.1
+# *********************************************************************
+AC_ARG_VAR([GPG],[Name of the gpg version 2 binary])
+AC_MSG_CHECKING([for the GPG v2 binary])
+uGPG=$GPG
+unset GPG
+gpgver() {
+ GPG_VERSION_STRING=$($1 --version|head -n 1|sed -e 's/.* //')
+ oIFS=$IFS
+ IFS="."
+ set -- $GPG_VERSION_STRING
+ GPG_VERSION_MAJOR=$1
+ GPG_VERSION_MINOR=$2
+ IFS=$oIFS
+}
+for prog in $uGPG gpg2 gpg
+do
+ gpgver $prog
+ if test -n "$GPG_VERSION_MAJOR" -a -n "$GPG_VERSION_MINOR"; then
+ if test $GPG_VERSION_MAJOR -eq 2; then
+ if test $GPG_VERSION_MINOR -ge 1; then
+ GPG=$prog
+ break
+ fi
+ elif test $GPG_VERSION_MAJOR -gt 2; then
+ GPG=$prog
+ break
+ fi
+ fi
+done
+AC_MSG_RESULT([${GPG:-none}${GPG:+, $GPG_VERSION_STRING}])
+AM_CONDITIONAL([COND_GPG2],[test -n "$GPG"])
+
dnl Checks for header files.
AC_HEADER_STDC
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_CHECK_TYPE(u_char, unsigned char)
@@ -87,27 +123,25 @@ case $build in
esac
dnl Internationalization macros.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.16])
-AC_SUBST([M4_DEFS])
AC_SUBST([GUILE_SCRIPTS])
-GINT_INIT([gint],[1.8 with-guile nodoc std-site-dir],
+GINT_INIT([gint],[2.2.0 with-guile nodoc std-site-dir],
[useguile=yes
AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
- GUILE_SCRIPTS='$(GUILE_SCM)'
- M4_DEFS="$M4_DEFS -DWITH_GUILE"],
+ GUILE_SCRIPTS='$(GUILE_SCM)'],
[useguile=no])
if test "$useguile" = "no"; then
AC_MSG_RESULT([Disabling GUILE support...])
fi
+AM_CONDITIONAL([GUILE_COND], [test "$useguile" = "yes"])
dnl Use option --without-gpgme to NOT compile GnuPG (GPGME library) support.
-AC_SUBST(ANUBIS_GPGFILES)
AC_ARG_WITH(gpgme,
AC_HELP_STRING([--without-gpgme],
[without GnuPG (GPGME library) support]),
[with_gpgme=${withval}],
[with_gpgme=yes])
if test "$with_gpgme" = "no"; then
@@ -117,13 +151,12 @@ else
AC_CHECK_LIB(gpgme, main,, with_gpgme=no)
LIBS="$LIBS -lgpg-error"
fi
if test "$with_gpgme" = "no"; then
AC_MSG_RESULT([Disabling GPGME support...])
else
- AC_PATH_PROG(GPG, gpg)
findgpgmedir() { :
if test -f "$1/include/gpgme.h"; then
gpgmedir=1
ADD_INCLUDES="$ADD_INCLUDES -I$1/include"
AC_MSG_CHECKING(for $1/include/gpgme.h)
AC_MSG_RESULT([yes])
@@ -136,15 +169,14 @@ else
done
if test $gpgmedir; then
AC_DEFINE(HAVE_GPGME_H, 1, [Define to 1 if HAVE_GPGME_H is requested.])
else
AC_CHECK_HEADERS(gpgme.h)
fi
- ANUBIS_GPGFILES='$(GPGFILES)'
- M4_DEFS="$M4_DEFS -DWITH_GPG"
fi
+AM_CONDITIONAL([GPG_COND],[test "$with_gpgme" = "yes"])
AC_SUBST(GSASL_LIBS)
AC_CHECK_LIB(resolv, res_query)
# Needed for GpgME
AC_SYS_LARGEFILE
@@ -174,13 +206,12 @@ dnl Use option --with-gsasl to compile GSASL library support.
MU_CHECK_GSASL(0.2.3, [
WITH_GSASL=yes
AC_DEFINE(WITH_GSASL,1,[Define if Anubis is using GNU SASL])
AC_MSG_RESULT([Enabling GSASL support...])
ANUBIS_SBIN_ADM='$(adm_sbin_programs)'
ANUBIS_BIN_ADM='$(adm_bin_programs)'
- M4_DEFS="$M4_DEFS -DWITH_GSASL"
AC_CHECK_LIB(gdbm, gdbm_open,
[WITH_GDBM=yes
LIBS="$LIBS -lgdbm"
AC_DEFINE(HAVE_LIBGDBM,1,[Define if you have libgdbm])],
[AC_MSG_RESULT([Disabling GDBM support...])])
@@ -243,17 +274,19 @@ MU_CHECK_GSASL(0.2.3, [
if test "$WITH_SQL" = "yes"; then
AC_DEFINE(WITH_SQL, 1, [Define this if you use an SQL interface])
fi
AC_LIBOBJ(lbuf)])
+AM_CONDITIONAL([GSASL_COND],[test "$WITH_GSASL" = yes])
+AM_CONDITIONAL([GDBM_COND],[test "$WITH_GDBM" = yes])
ANUBIS_CHECK_TLS([
- M4_DEFS="$M4_DEFS -DWITH_SSL -DWITH_GNUTLS"
AC_DEFINE(USE_GNUTLS, 1, [Define to 1 if USE_GNUTLS is requested.])])
AM_CONDITIONAL([TLS_COND], [test $anubis_cv_gnutls = yes])
+AC_PATH_PROG([CERTTOOL],[certtool])
dnl Use option --with-socks-proxy to compile SOCKS v4/5 proxy support.
AC_ARG_WITH(socks-proxy,
AC_HELP_STRING([--with-socks-proxy],
[with SOCKS v4/5 proxy support]),
[with_socks_proxy=${withval}],
@@ -363,24 +396,25 @@ with_pcre=$with_pcre
with_pam=$with_pam
with_tcp_wrappers=$with_tcp_wrappers
with_unprivileged_user=$with_unprivileged_user])
AC_CONFIG_FILES([Makefile
build/Makefile
- build/guile-1.6/Makefile
contrib/Makefile
gint/Makefile
doc/Makefile
elisp/Makefile
examples/Makefile
examples/pam/Makefile
guile/Makefile
lib/Makefile
po/Makefile.in
scripts/Makefile
src/Makefile
- testsuite/Makefile
- testsuite/data/Makefile
- testsuite/etc/Makefile
])
+# Initialize the test suite.
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/Makefile tests/atlocal])
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+
AC_OUTPUT
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 405aa32..76efc95 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,11 +1,11 @@
##
## contrib/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/contrib/msg2smtp.pl b/contrib/msg2smtp.pl
index cc2a2b1..e85a91d 100755
--- a/contrib/msg2smtp.pl
+++ b/contrib/msg2smtp.pl
@@ -30,13 +30,13 @@ $0 -h HOST [options]
# 5. Send message via SMTP
#------------------------------------------
# 0. GPL License
#
# This file is part of GNU Anubis.
-# Copyright (C) 2001-2014 The Anubis Team.
+# Copyright (C) 2001-2020 The Anubis Team.
#
# GNU Anubis is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 2c89081..7f7add1 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,11 +1,11 @@
##
## doc/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/elisp/Makefile.am b/elisp/Makefile.am
index 71a4b12..25dbdca 100644
--- a/elisp/Makefile.am
+++ b/elisp/Makefile.am
@@ -1,9 +1,9 @@
##
## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
+## Copyright (C) 2003-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/elisp/anubis-mode.el b/elisp/anubis-mode.el
index 91a10e9..16456da 100644
--- a/elisp/anubis-mode.el
+++ b/elisp/anubis-mode.el
@@ -3,13 +3,13 @@
;; Authors: 2003 Sergey Poznyakoff
;; Version: 1.0
;; Keywords: anubis
;; $Id$
;; This file is part of GNU Anubis.
-;; Copyright (C) 2003-2014 The Anubis Team.
+;; Copyright (C) 2003-2020 The Anubis Team.
;; GNU Anubis is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the
;; Free Software Foundation; either version 3, or (at your option) any
;; later version.
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 58d1ebc..d44239e 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,11 +1,11 @@
##
## examples/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/examples/anubis.scm b/examples/anubis.scm
index 6d84e0d..0aa93da 100644
--- a/examples/anubis.scm
+++ b/examples/anubis.scm
@@ -1,11 +1,11 @@
;;;
;;; anubis.scm
;;;
;;; This file is part of GNU Anubis.
-;;; Copyright (C) 2003-2014 The Anubis Team.
+;;; Copyright (C) 2003-2020 The Anubis Team.
;;;
;;; GNU Anubis is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by the
;;; Free Software Foundation; either version 3 of the License, or (at your
;;; option) any later version.
;;;
diff --git a/examples/pam/Makefile.am b/examples/pam/Makefile.am
index 2e88c0a..1f6df10 100644
--- a/examples/pam/Makefile.am
+++ b/examples/pam/Makefile.am
@@ -1,11 +1,11 @@
##
## pam/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/gnulib.modules b/gnulib.modules
index 8fe0e0d..fe87dbf 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -2,12 +2,11 @@
# A module name per line. Empty lines and comments are ignored.
gettext
getline
gitlog-to-changelog
obstack
-getopt
getpass
regex
setenv
sysexits
xalloc
diff --git a/guile/Makefile.am b/guile/Makefile.am
index 152c075..9d8de38 100644
--- a/guile/Makefile.am
+++ b/guile/Makefile.am
@@ -1,11 +1,11 @@
##
## guile/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
+## Copyright (C) 2003-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/guile/entire-msg.scm b/guile/entire-msg.scm
index c906462..274f1f0 100644
--- a/guile/entire-msg.scm
+++ b/guile/entire-msg.scm
@@ -1,11 +1,11 @@
;;;
;;; entire-msg.scm
;;;
;;; This file is part of GNU Anubis.
-;;; Copyright (C) 2003-2014 The Anubis Team.
+;;; Copyright (C) 2003-2020 The Anubis Team.
;;;
;;; GNU Anubis is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by the
;;; Free Software Foundation; either version 3 of the License, or (at your
;;; option) any later version.
;;;
diff --git a/guile/remailer.scm b/guile/remailer.scm
index df95bca..b4dadd1 100644
--- a/guile/remailer.scm
+++ b/guile/remailer.scm
@@ -1,11 +1,11 @@
;;;
;;; remailer.scm
;;;
;;; This file is part of GNU Anubis.
-;;; Copyright (C) 2003-2014 The Anubis Team.
+;;; Copyright (C) 2003-2020 The Anubis Team.
;;;
;;; GNU Anubis is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by the
;;; Free Software Foundation; either version 3 of the License, or (at your
;;; option) any later version.
;;;
diff --git a/guile/rot-13.scm b/guile/rot-13.scm
index a48dbf7..42faf2c 100644
--- a/guile/rot-13.scm
+++ b/guile/rot-13.scm
@@ -1,11 +1,11 @@
;;;
;;; rot-13.scm
;;;
;;; This file is part of GNU Anubis.
-;;; Copyright (C) 2003-2014 The Anubis Team.
+;;; Copyright (C) 2003-2020 The Anubis Team.
;;;
;;; GNU Anubis is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by the
;;; Free Software Foundation; either version 3 of the License, or (at your
;;; option) any later version.
;;;
diff --git a/lib/.gitignore b/lib/.gitignore
index a3fb283..02b1d4b 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,70 +1,116 @@
+_Noreturn.h
+alignof.h
alloca.c
alloca.h
alloca.in.h
+arg-nonnull.h
+attribute.h
+basename-lgpl.c
btowc.c
+c++defs.h
+cdefs.h
charset.alias
+cloexec.c
+cloexec.h
+close.c
config.charset
configmake.h
+dirname-lgpl.c
+dirname.h
+dup2.c
errno.h
errno.in.h
error.c
error.h
exitfail.c
exitfail.h
+fcntl.c
+fcntl.h
+fcntl.in.h
+fd-hook.c
+fd-hook.h
+filename.h
+fopen.c
fseek.c
fseeko.c
fstat.c
getdelim.c
+getdtablesize.c
getline.c
getopt.c
getopt.h
getopt.in.h
getopt1.c
getopt_int.h
getpass.c
getpass.h
+getprogname.c
+getprogname.h
gettext.h
gettimeofday.c
gnulib.mk
+hard-locale.c
+hard-locale.h
intprops.h
+inttypes.h
+inttypes.in.h
langinfo.h
langinfo.in.h
+lc-charset-dispatch.c
+lc-charset-dispatch.h
+libc-config.h
+limits.h
+limits.in.h
localcharset.c
localcharset.h
locale.h
locale.in.h
localeconv.c
lseek.c
malloc.c
malloca.c
malloca.h
malloca.valgrind
+mbrtowc-impl-utf8.h
+mbrtowc-impl.h
mbrtowc.c
mbsinit.c
mbtowc-impl.h
+mbtowc-lock.c
+mbtowc-lock.h
mbtowc.c
msvc-inval.c
msvc-inval.h
msvc-nothrow.c
msvc-nothrow.h
nl_langinfo.c
obstack.c
obstack.h
+open.c
+pathmax.h
realloc.c
ref-add.sed
ref-add.sin
ref-del.sed
ref-del.sin
regcomp.c
regex.c
regex.h
regex_internal.c
regex_internal.h
regexec.c
setenv.c
+setlocale-lock.c
+setlocale_null.c
+setlocale_null.h
+stat-time.c
+stat-time.h
+stat-w32.c
+stat-w32.h
+stat.c
stdbool.h
stdbool.in.h
stddef.h
stddef.in.h
stdint.h
stdint.in.h
@@ -78,12 +124,13 @@ strdup.c
streq.h
strerror-override.c
strerror-override.h
strerror.c
string.h
string.in.h
+stripslash.c
sys
sys_stat.h
sys_stat.in.h
sys_time.h
sys_time.in.h
sys_types.h
@@ -93,16 +140,26 @@ sysexits.in.h
time.h
time.in.h
unistd.c
unistd.h
unistd.in.h
verify.h
+warn-on-use.h
wchar.h
wchar.in.h
wcrtomb.c
wctype-h.c
wctype.h
wctype.in.h
+windows-initguard.h
+windows-mutex.c
+windows-mutex.h
+windows-once.c
+windows-once.h
+windows-recmutex.c
+windows-recmutex.h
+windows-rwlock.c
+windows-rwlock.h
xalloc-die.c
xalloc-oversized.h
xalloc.h
xmalloc.c
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5d86d5d..c29651d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,11 +1,11 @@
##
## lib/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
+## Copyright (C) 2003-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/lib/keyword.c b/lib/keyword.c
index 77a517a..5009069 100644
--- a/lib/keyword.c
+++ b/lib/keyword.c
@@ -1,11 +1,11 @@
/*
Simple keyword translation.
This file is part of GNU Anubis.
- Copyright (C) 2009-2014 The Anubis Team.
+ Copyright (C) 2009-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/lib/keyword.h b/lib/keyword.h
index b51c7a9..355548d 100644
--- a/lib/keyword.h
+++ b/lib/keyword.h
@@ -1,9 +1,9 @@
/*
This file is part of GNU Anubis.
- Copyright (C) 2009-2014 The Anubis Team.
+ Copyright (C) 2009-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c45a35b..a6b34b4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,9 +1,9 @@
#
# List of source files containing translatable strings.
-# Copyright (C) 2001-2014 The Anubis Team.
+# Copyright (C) 2001-2020 The Anubis Team.
#
src/authmode.c
src/daemon.c
src/env.c
src/errs.c
@@ -28,11 +28,10 @@ src/rc-lex.l
src/rc-gram.y
src/regex.c
src/tls.c
src/transmode.c
src/tunnel.c
-lib/getopt.c
lib/obstack.c
# EOF
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 43dc640..c7003a9 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,11 +1,11 @@
##
## scripts/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
diff --git a/src/Makefile.am b/src/Makefile.am
index ca4d108..f35350b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,11 @@
##
## src/Makefile.am
##
## This file is part of GNU Anubis.
-## Copyright (C) 2001-2014 The Anubis Team.
+## Copyright (C) 2001-2020 The Anubis Team.
##
## GNU Anubis is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at your
## option) any later version.
##
@@ -33,15 +33,12 @@ anubis_SOURCES = \
daemon.c \
env.c \
errs.c \
esmtp.c \
exec.c \
extern.h \
- gpg.c \
- gsasl_srv.c \
- guile.c \
headers.h \
help.c \
ident.c \
log.c \
logport.c\
main.c \
@@ -61,26 +58,32 @@ anubis_SOURCES = \
regex.c \
socks.c \
transmode.c \
tunnel.c \
xdatabase.c
+if GSASL_COND
+ anubis_SOURCES += gsasl_srv.c
+endif
+
+if GPG_COND
+ anubis_SOURCES += gpg.c
+endif
+
+if GUILE_COND
+ anubis_SOURCES += guile.c
+endif
+
anubisadm_SOURCES = anubisadm.c anubisadm.h adm.c
anubisadm_LDADD = ./libanubisdb.a $(top_builddir)/lib/libanubis.a @LIBINTL@
anubisusr_SOURCES = anubisusr.c anubisusr.h usr.c
anubisusr_LDADD = ./libanubisdb.a $(top_builddir)/lib/libanubis.a @LIBINTL@ @LIBGNUTLS_LIBS@ @GSASL_LIBS@
-if TLS_COND
- TLS_C=tls.c
-endif
-
libanubisdb_a_SOURCES = \
anubisdb.c \
dbtext.c \
- gdbm.c \
- gsasl.c \
list.c \
list.h \
md5.c \
mysql.c \
pgsql.c \
sql.h \
@@ -88,21 +91,34 @@ libanubisdb_a_SOURCES = \
smtprepl.c \
smtprepl.h \
stream.c \
$(TLS_C) \
url.c
+if TLS_COND
+ libanubisdb_a_SOURCES += tls.c
+endif
+
+if GSASL_COND
+ libanubisdb_a_SOURCES += gsasl.c
+endif
+
+if GDBM_COND
+ libanubisdb_a_SOURCES += gdbm.c
+endif
+
+
AM_YFLAGS = -dtv
AM_LFLAGS = -dvp
EXTRA_DIST = getopt.m4 env.opt
BUILT_SOURCES = env.c
localedir = $(datadir)/locale
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
-AM_CPPFLAGS = @ADD_INCLUDES@ @LIBGNUTLS_INCLUDES@ -I$(top_srcdir)/lib
+AM_CPPFLAGS = @ADD_INCLUDES@ @GUILE_INCLUDES@ @LIBGNUTLS_INCLUDES@ -I$(top_srcdir)/lib
SUFFIXES=.opt .c
.opt.c:
m4 -s $(top_srcdir)/src/getopt.m4 $< | sed '1d' > $@
FLOWCHART_FILES=$(anubis_SOURCES) $(libanubisdb_a_SOURCES)
diff --git a/src/adm.opt b/src/adm.opt
index 643855f..3f2e948 100644
--- a/src/adm.opt
+++ b/src/adm.opt
@@ -1,9 +1,9 @@
/* -*- c -*-
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
diff --git a/src/anubisadm.c b/src/anubisadm.c
index 1eff9cb..d197cbc 100644
--- a/src/anubisadm.c
+++ b/src/anubisadm.c
@@ -1,9 +1,9 @@
/*
This file is part of GNU Anubis
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -350,13 +350,13 @@ main (int argc, char **argv)
progname = argv[0];
/* Initialize various database formats */
dbtext_init ();
# ifdef HAVE_LIBGDBM
- gdbm_db_init ();
+ db_gdbm_init ();
# endif
# ifdef WITH_MYSQL
mysql_db_init ();
# endif
# ifdef WITH_PGSQL
pgsql_db_init ();
diff --git a/src/anubisadm.h b/src/anubisadm.h
index ccc77e5..a1ea4a1 100644
--- a/src/anubisadm.h
+++ b/src/anubisadm.h
@@ -1,9 +1,9 @@
/*
This file is part of GNU Anubis
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/anubisdb.c b/src/anubisdb.c
index 5e9bf83..94334db 100644
--- a/src/anubisdb.c
+++ b/src/anubisdb.c
@@ -1,11 +1,11 @@
/*
anubisdb.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/anubisusr.c b/src/anubisusr.c
index 8cbbc71..8562880 100644
--- a/src/anubisusr.c
+++ b/src/anubisusr.c
@@ -1,10 +1,10 @@
/*
anubisusr.c
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -876,24 +876,24 @@ synch (void)
error (_("Could not connect to %s:%u: %s."),
smtp_host, smtp_port, strerror (errno));
return -1;
}
stream_create (&iostream);
- stream_set_io (iostream, (void *) fd, NULL, NULL, NULL, NULL, NULL);
+ stream_set_io (iostream, (void *) (ptrdiff_t) fd, NULL, NULL, NULL, NULL,
+ NULL);
repl = smtp_reply_new ();
smtp_get_reply (repl);
if (!smtp_reply_code_eq (repl, "220"))
{
error (_("Server refused connection"));
smtp_print_reply (stderr, repl);
smtp_reply_free (repl);
return 1;
}
- smtp_reply_free (repl);
smtp_ehlo (1);
#ifdef USE_GNUTLS
if (enable_tls && smtp_reply_has_capa (smtp_capa, "STARTTLS", NULL))
{
@@ -906,12 +906,13 @@ synch (void)
/* Get the capabilities */
smtp_ehlo (0);
if (!smtp_reply_has_capa (smtp_capa, "XDATABASE", NULL))
{
error (_("Remote party does not reveal XDATABASE capability"));
+ smtp_reply_free (repl);
smtp_quit ();
return 1;
}
send_line ("XDATABASE EXAMINE");
diff --git a/src/anubisusr.h b/src/anubisusr.h
index e94fee4..73b8b4e 100644
--- a/src/anubisusr.h
+++ b/src/anubisusr.h
@@ -1,10 +1,10 @@
/*
anubisusr.h
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/authmode.c b/src/authmode.c
index f81a0fe..4febfa2 100644
--- a/src/authmode.c
+++ b/src/authmode.c
@@ -1,11 +1,11 @@
/*
authmode.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/daemon.c b/src/daemon.c
index 97e84a9..92e0d09 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1,11 +1,11 @@
/*
daemon.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -310,13 +310,13 @@ loop (int sd_bind)
*********************************************/
static int
_stdio_write (void *sd, const char *data, size_t size, size_t * nbytes)
{
int rc;
- int fd = (int) sd;
+ int fd = (int) (ptrdiff_t) sd;
if (fd == 0)
fd = 1;
rc = write (fd, data, size);
if (rc > 0)
{
@@ -327,13 +327,13 @@ _stdio_write (void *sd, const char *data, size_t size, size_t * nbytes)
}
static int
_stdio_read (void *sd, char *data, size_t size, size_t * nbytes)
{
int n;
- int fd = (int) sd;
+ int fd = (int) (ptrdiff_t) sd;
fd_set rds;
errno = 0;
FD_ZERO (&rds);
FD_SET (fd, &rds);
do
diff --git a/src/dbtext.c b/src/dbtext.c
index d0fc083..63586eb 100644
--- a/src/dbtext.c
+++ b/src/dbtext.c
@@ -1,11 +1,11 @@
/*
dbtext.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/env.opt b/src/env.opt
index 487cc85..d21ff3e 100644
--- a/src/env.opt
+++ b/src/env.opt
@@ -1,9 +1,9 @@
/* -*- c -*-
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
@@ -91,12 +91,18 @@ OPTION(stdio, i,,
Use the SMTP protocol (OMP/Tunnel) as described
in RFC 821 on standard input and output))
BEGIN
topt |= T_STDINOUT;
END
+OPTION(,S,,
+ [<listen on file descriptor 3>])
+BEGIN
+ topt |= T_PASSFD;
+END
+
GROUP(Output options)
OPTION(silent, s,, Work silently)
BEGIN
options.termlevel = SILENT;
rc_disable_keyword (CF_INIT | CF_SUPERVISOR, "termlevel");
@@ -155,13 +161,12 @@ BEGIN
END
OPTION(pid-file,, FILE,
Store the PID of the running daemon in FILE)
BEGIN
pidfile = optarg;
- rc_disable_keyword (CF_INIT | CF_SUPERVISOR, "termlevel");
END
OPTIONS_END
int x_argc;
char **x_argv;
diff --git a/src/errs.c b/src/errs.c
index e18462f..87e6581 100644
--- a/src/errs.c
+++ b/src/errs.c
@@ -1,11 +1,11 @@
/*
errs.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/esmtp.c b/src/esmtp.c
index 02fda88..3b3ef6f 100644
--- a/src/esmtp.c
+++ b/src/esmtp.c
@@ -1,11 +1,11 @@
/*
esmtp.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/exec.c b/src/exec.c
index 3abfde5..43d7748 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -1,11 +1,11 @@
/*
exec.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/extern.h b/src/extern.h
index fb7afd7..23cc41e 100644
--- a/src/extern.h
+++ b/src/extern.h
@@ -1,11 +1,11 @@
/*
extern.h
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/gdbm.c b/src/gdbm.c
index 58153f8..9bd6193 100644
--- a/src/gdbm.c
+++ b/src/gdbm.c
@@ -1,11 +1,11 @@
/*
gdbm.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -30,13 +30,13 @@
password,username,rc-file
The last two items are optional */
static int
-gdbm_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
+db_gdbm_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
char const **errp)
{
GDBM_FILE dbf;
int flags;
char *path;
@@ -64,13 +64,13 @@ gdbm_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
}
*dp = dbf;
return ANUBIS_DB_SUCCESS;
}
static int
-gdbm_db_close (void *d)
+db_gdbm_close (void *d)
{
gdbm_close (d);
return ANUBIS_DB_SUCCESS;
}
static void
@@ -98,13 +98,13 @@ gdbm_content_to_record (char *keystr, datum content, ANUBIS_USER * rec)
}
else
rec->smtp_passwd = text;
}
static int
-gdbm_db_get (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
+db_gdbm_get (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
{
datum key, content;
key.dptr = (char *) keystr;
key.dsize = strlen (keystr);
content = gdbm_fetch ((GDBM_FILE) d, key);
@@ -115,13 +115,13 @@ gdbm_db_get (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
gdbm_content_to_record ((char *) keystr, content, rec);
free (content.dptr);
return ANUBIS_DB_SUCCESS;
}
static int
-gdbm_db_list (void *d, ANUBIS_LIST list, int *ecode)
+db_gdbm_list (void *d, ANUBIS_LIST list, int *ecode)
{
datum key, content;
key = gdbm_firstkey ((GDBM_FILE) d);
while (key.dptr)
{
@@ -144,13 +144,13 @@ gdbm_db_list (void *d, ANUBIS_LIST list, int *ecode)
key = nextkey;
}
return ANUBIS_DB_SUCCESS;
}
static int
-gdbm_db_put (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
+db_gdbm_put (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
{
size_t size, n;
char *text;
datum key, content;
int rc;
@@ -188,13 +188,13 @@ gdbm_db_put (void *d, const char *keystr, ANUBIS_USER * rec, int *errp)
rc = ANUBIS_DB_SUCCESS;
free (text);
return rc;
}
static int
-gdbm_db_delete (void *d, const char *keystr, int *ecode)
+db_gdbm_delete (void *d, const char *keystr, int *ecode)
{
int rc;
datum key;
key.dptr = (char *) keystr;
key.dsize = strlen (keystr);
@@ -205,26 +205,26 @@ gdbm_db_delete (void *d, const char *keystr, int *ecode)
}
else
rc = ANUBIS_DB_SUCCESS;
return rc;
}
-const char *
-gdbm_db_strerror (void *d, int rc)
+static const char *
+db_gdbm_strerror (void *d, int rc)
{
return gdbm_strerror (rc);
}
void
-gdbm_db_init (void)
+db_gdbm_init (void)
{
anubis_db_register ("gdbm",
- gdbm_db_open,
- gdbm_db_close,
- gdbm_db_get,
- gdbm_db_put,
- gdbm_db_delete, gdbm_db_list, gdbm_db_strerror);
+ db_gdbm_open,
+ db_gdbm_close,
+ db_gdbm_get,
+ db_gdbm_put,
+ db_gdbm_delete, db_gdbm_list, db_gdbm_strerror);
}
#endif /* HAVE_LIBGDBM */
/* EOF */
diff --git a/src/getopt.m4 b/src/getopt.m4
index 88e3ba4..68c8f30 100644
--- a/src/getopt.m4
+++ b/src/getopt.m4
@@ -1,8 +1,8 @@
dnl This file is part of GNU Anubis.
-dnl Copyright (C) 2007-2014 The Anubis Team.
+dnl Copyright (C) 2007-2020 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
@@ -217,13 +217,13 @@ indent (size_t start, size_t col)
static void
print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
{
while (*descr)
{
- size_t s = 0;
+ int s = 0;
size_t i;
size_t width = rmargin - lmargin;
while (*descr && (*descr == ' ' || *descr == '\t'))
descr++;
for (i = 0; ; i++)
diff --git a/src/gpg.c b/src/gpg.c
index 9ad3289..4eb4271 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -1,11 +1,11 @@
/*
gpg.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -18,14 +18,12 @@
with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
*/
#include "headers.h"
#include "extern.h"
#include "rcfile.h"
-
-#ifdef HAVE_GPG
#include <gpgme.h>
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
#include <obstack.h>
struct gpg_struct
@@ -234,31 +232,42 @@ create_key_array(gpgme_ctx_t ctx, struct obstack *stk)
while (!err)
{
err = gpgme_op_keylist_next (ctx, &tmpkey);
if (err)
break;
- gpgme_get_key (ctx, current_key, &tmpkey, 0);
+ err = gpgme_get_key (ctx, current_key, &tmpkey, 0);
+ if (err)
+ break;
obstack_grow (stk, &tmpkey, sizeof (tmpkey));
if (options.termlevel == DEBUG)
{
gpgme_user_id_t uid;
for (uid = tmpkey->uids; uid; uid = uid->next)
fprintf (stderr, "Using key %s: %s <%s>\n",
uid->uid, uid->name, uid->email);
}
}
- if (gpg_err_code (err) != GPG_ERR_EOF)
+
+ switch (gpg_err_code (err))
{
+ case GPG_ERR_EOF:
+ break;
+
+ case GPG_ERR_INV_VALUE:
+ fprintf (stderr, "key not found: %s\n", current_key);
+ exit (1);
+
+ default:
fprintf (stderr, "cannot list keys: %s\n",
gpgme_strerror (err));
exit (1);
}
- memset (current_key, 0, sizeof (current_key));
+ memset (current_key, 0, j);
j = 0;
}
else
current_key[j++] = gpg.encryption_keys[i];
}
xfree (current_key);
@@ -568,9 +577,7 @@ void
gpg_section_init (void)
{
struct rc_secdef *sp = anubis_add_section ("RULE");
rc_secdef_add_child (sp, &gpg_sect_child);
}
-#endif /* HAVE_GPG */
-
/* EOF */
diff --git a/src/gsasl.c b/src/gsasl.c
index b52bf3f..a0d5090 100644
--- a/src/gsasl.c
+++ b/src/gsasl.c
@@ -1,11 +1,11 @@
/*
gsasl.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -17,15 +17,12 @@
You should have received a copy of the GNU General Public License along
with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
*/
#include "headers.h"
#include "extern.h"
-
-#if defined(WITH_GSASL)
-
#include "lbuf.h"
/* Basic I/O Functions */
struct anubis_gsasl_stream
@@ -171,8 +168,6 @@ install_gsasl_stream (Gsasl_session *sess_ctx, NET_STREAM *stream)
stream_create (stream);
stream_set_io (*stream, s,
_gsasl_read, _gsasl_write,
_gsasl_close, _gsasl_destroy, _gsasl_strerror);
}
-
-#endif
diff --git a/src/gsasl_srv.c b/src/gsasl_srv.c
index 4846fcd..4e18b01 100644
--- a/src/gsasl_srv.c
+++ b/src/gsasl_srv.c
@@ -1,11 +1,11 @@
/*
gsasl_srv.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/guile.c b/src/guile.c
index 7c898d5..67e19fa 100644
--- a/src/guile.c
+++ b/src/guile.c
@@ -1,11 +1,11 @@
/*
guile.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -19,14 +19,12 @@
*/
#include "headers.h"
#include "extern.h"
#include "rcfile.h"
-#ifdef WITH_GUILE
-
static void guile_ports_open (void);
static void guile_ports_close (void);
static SCM
eval_catch_handler (void *data, SCM tag, SCM throw_args)
{
@@ -80,14 +78,13 @@ guile_debug (int val)
void
init_guile ()
{
scm_init_guile ();
scm_load_goops ();
- guile_init_anubis_info_port ();
- guile_init_anubis_error_port ();
+ guile_init_anubis_log_port ();
}
void
guile_ports_open ()
{
@@ -107,13 +104,13 @@ guile_ports_open ()
_("cannot open guile output file %s"),
options.glogfile);
}
if (fd >= 0)
{
- port = scm_fdes_to_port (fd, "a", scm_makfrom0str (name));
+ port = scm_fdes_to_port (fd, "a", scm_from_locale_string (name));
guile_ports_close ();
scm_set_current_error_port (port);
scm_set_current_output_port (port);
scm_close_input_port (scm_current_input_port ());
return;
}
@@ -154,13 +151,13 @@ guile_load_path_append_handler (void *data)
return SCM_UNSPECIFIED;
}
}
pscm = SCM_VARIABLE_LOC (scm_c_lookup ("%load-path"));
*pscm = scm_append (scm_list_3 (path_scm,
- scm_list_1 (scm_makfrom0str (path)),
+ scm_list_1 (scm_from_locale_string (path)),
SCM_EOL));
return SCM_UNSPECIFIED;
}
void
guile_load_path_append (ANUBIS_LIST arglist, MESSAGE msg /* unused */)
@@ -264,13 +261,13 @@ list_to_args (ANUBIS_LIST arglist)
if (p[0] == '#')
{
switch (p[1])
{
case ':':
- val = scm_c_make_keyword (p + 2);
+ val = scm_from_locale_keyword (p + 2);
break;
case 'f':
val = SCM_BOOL_F;
break;
@@ -488,16 +485,18 @@ guile_parser (EVAL_ENV env, int key, ANUBIS_LIST arglist, void *inv_data)
"please report"),
__FILE__, __LINE__,
key);
}
if (setjmp (jmp_env) == 0)
- scm_internal_lazy_catch (SCM_BOOL_T,
- inner_catch_body,
- &closure,
- eval_catch_handler, &jmp_env);
+ {
+ scm_c_catch (SCM_BOOL_T,
+ inner_catch_body, &closure,
+ eval_catch_handler, &jmp_env,
+ NULL, NULL);
+ }
}
static struct rc_secdef_child guile_secdef_child = {
NULL,
CF_CLIENT,
guile_kw,
@@ -519,9 +518,7 @@ guile_section_init (void)
struct rc_secdef *sp = anubis_add_section ("GUILE");
rc_secdef_add_child (sp, &guile_secdef_child);
sp = anubis_add_section ("RULE");
rc_secdef_add_child (sp, &guile_rule_secdef_child);
}
-#endif /* WITH_GUILE */
-
/* EOF */
diff --git a/src/headers.h b/src/headers.h
index 55665e2..9162ab6 100644
--- a/src/headers.h
+++ b/src/headers.h
@@ -1,11 +1,11 @@
/*
headers.h
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -236,12 +236,13 @@ ANUBIS_MODE;
#define T_SMTP_ERROR_CODES 0x02000000
#define T_TRACEFILE_SYS 0x04000000
#define T_TRACEFILE_USR 0x08000000
#define T_XELO 0x10000000
#define T_LOCATION_COLUMN 0x20000000
#define T_ESMTP_AUTH_DELAYED 0x40000000
+#define T_PASSFD 0x80000000
/* Regexp modifiers */
/* Basic types */
#define R_EXACT 0x00000001
#define R_POSIX 0x00000002
#define R_PERLRE 0x00000004
@@ -521,15 +522,14 @@ void gpg_section_init (void);
/* guile.c */
#ifdef WITH_GUILE
void init_guile (void);
void guile_debug (int);
void guile_section_init (void);
-void guile_init_anubis_error_port (void);
+void guile_init_anubis_log_port (void);
SCM guile_make_anubis_error_port (int err);
-void guile_init_anubis_info_port (void);
SCM guile_make_anubis_info_port (void);
#endif /* WITH_GUILE */
/* url.c */
typedef struct anubis_url
@@ -601,13 +601,13 @@ const char *anubis_db_strerror (void *dptr);
void anubis_db_free_record (ANUBIS_USER * rec);
/* dbtext.c */
void dbtext_init (void);
/* gdbm.c */
-void gdbm_db_init (void);
+void db_gdbm_init (void);
/* mysql.c */
void mysql_db_init (void);
/* pgsql.c */
void pgsql_db_init (void);
diff --git a/src/help.c b/src/help.c
index e22ba96..587b4c2 100644
--- a/src/help.c
+++ b/src/help.c
@@ -1,11 +1,11 @@
/*
help.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -34,12 +34,15 @@ static char *config_opts[] = {
#ifdef WITH_MYSQL
"MYSQL",
#endif /* WITH_MYSQL */
#ifdef WITH_PGSQL
"POSTGRES",
#endif /* WITH_PGSQL */
+#ifdef HAVE_LIBGDBM
+ "GDBM",
+#endif
#ifdef WITH_GUILE
"GUILE",
#endif /* WITH_GUILE */
#ifdef USE_GNUTLS
"GNUTLS",
#endif /* USE_GNUTLS */
diff --git a/src/ident.c b/src/ident.c
index 950f9a4..7144a99 100644
--- a/src/ident.c
+++ b/src/ident.c
@@ -1,11 +1,11 @@
/*
ident.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/list.c b/src/list.c
index fe980ba..0649422 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1,11 +1,11 @@
/*
list.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/list.h b/src/list.h
index 55f629e..0202a73 100644
--- a/src/list.h
+++ b/src/list.h
@@ -1,11 +1,11 @@
/*
list.h
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/log.c b/src/log.c
index 164326d..0963749 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,11 +1,11 @@
/*
log.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/logport.c b/src/logport.c
index d43d740..9e875c9 100644
--- a/src/logport.c
+++ b/src/logport.c
@@ -1,11 +1,11 @@
/*
Log and info output ports for Guile.
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -21,223 +21,83 @@
#include "headers.h"
#include "extern.h"
#include "rcfile.h"
#ifdef WITH_GUILE
-#ifndef HAVE_SCM_T_OFF
-typedef off_t scm_t_off;
-#endif
+static scm_t_port_type *scm_anubis_log_port_type;
-static scm_t_bits scm_tc16_anubis_error_port;
-static scm_t_bits scm_tc16_anubis_info_port;
+#define GET_LOG_PORT(x) ((struct anubis_log_port *) SCM_STREAM (x))
-typedef void (*log_flush_fn) (int flag, char *, size_t);
+enum { PORT_LOG_INFO, PORT_LOG_ERROR };
-struct _anubis_error_port {
+struct anubis_log_port {
+ int type;
int flag; /* For error ports: -1 if error, >=0 if warning;
For info ports: verbosity level */
- log_flush_fn flush;
};
-#define ANUBIS_ERROR_PORT_BUFSIZE 256
-
-static void
-log_flush (int flag, char *str, size_t size)
-{
- if (flag == -1)
- anubis_error (0, 0, "%*.*s", size, size, str);
- else
- anubis_warning (0, "%*.*s", size, size, str);
-}
-
-static void
-info_flush (int flag, char *str, size_t size)
-{
- info (flag, "%*.*s", size, size, str);
-}
-
-SCM
-_make_anubis_log_port (long type, const char *descr, int flag,
- log_flush_fn flush)
+static size_t
+log_port_write (SCM port, SCM src, size_t start, size_t count)
{
- struct _anubis_error_port *dp;
- SCM port;
- scm_port *pt;
-
- dp = scm_gc_malloc (sizeof (struct _anubis_error_port), descr);
- dp->flag = flag;
- dp->flush = flush;
-
- port = scm_new_port_table_entry (type);
- pt = SCM_PTAB_ENTRY(port);
- pt->rw_random = 0;
- pt->write_buf = scm_gc_malloc (ANUBIS_ERROR_PORT_BUFSIZE, "port buffer");
- pt->write_pos = pt->write_buf;
- pt->write_buf_size = ANUBIS_ERROR_PORT_BUFSIZE;
- pt->write_end = pt->write_buf + pt->write_buf_size;
-
- SCM_SET_CELL_TYPE (port, (type | SCM_OPN | SCM_WRTNG | SCM_BUFLINE));
- SCM_SETSTREAM (port, dp);
- return port;
-}
-
-SCM
-guile_make_anubis_error_port (int err)
-{
- return _make_anubis_log_port (scm_tc16_anubis_error_port,
- "anubis-error-port", err, log_flush);
-}
-
-SCM
-guile_make_anubis_info_port (void)
-{
- return _make_anubis_log_port (scm_tc16_anubis_info_port,
- "anubis-info-port", 0, info_flush);
-}
-
-#define ANUBIS_ERROR_PORT(x) ((struct _anubis_error_port *) SCM_STREAM (x))
-
-static SCM
-_anubis_error_port_mark (SCM port)
-{
- return SCM_BOOL_F;
-}
-
-static void
-_anubis_error_port_flush (SCM port)
-{
- struct _anubis_error_port *dp = ANUBIS_ERROR_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
- size_t size = pt->write_pos - pt->write_buf;
- unsigned char *nl = memchr (pt->write_buf, '\n', size);
- int wrsize;
-
- if (!nl)
- return;
-
- wrsize = nl - pt->write_buf;
-
- dp->flush (dp->flag, (char *) pt->write_buf, wrsize);
-
- if (wrsize < size)
+ struct anubis_log_port *lp = GET_LOG_PORT (port);
+ signed char *str = SCM_BYTEVECTOR_CONTENTS (src) + start;
+ int n = count;
+ if (str[n-1] == '\n')
+ n--;
+ switch (lp->type)
{
- size_t write_start;
-
- nl++;
- write_start = pt->write_pos - nl;
- memmove (pt->write_buf, nl, write_start);
- pt->write_pos = pt->write_buf + write_start;
+ case PORT_LOG_INFO:
+ info (lp->flag, "%*.*s", n, n, str);
+ break;
+
+ case PORT_LOG_ERROR:
+ if (lp->flag == -1)
+ anubis_error (0, 0, "%*.*s", n, n, str);
+ else
+ anubis_warning (0, "%*.*s", n, n, str);
+ break;
}
- else
- pt->write_pos = pt->write_buf;
+ return count;
}
static int
-_anubis_error_port_close (SCM port)
-{
- struct _anubis_error_port *dp = ANUBIS_ERROR_PORT (port);
-
- if (dp)
- {
- _anubis_error_port_flush (port);
- SCM_SETSTREAM (port, NULL);
- scm_gc_free (dp, sizeof(struct _anubis_error_port),
- "anubis-error-port");
- }
- return 0;
-}
-
-static scm_sizet
-_anubis_error_port_free (SCM port)
+log_port_print (SCM exp, SCM port, scm_print_state *pstate)
{
- _anubis_error_port_close (port);
- return 0;
+ scm_puts ("#<Anubis log port>", port);
+ return 1;
}
-static int
-_anubis_error_port_fill_input (SCM port)
+void
+guile_init_anubis_log_port (void)
{
- return EOF;
-}
+ scm_anubis_log_port_type = scm_make_port_type ("anubis-log",
+ NULL, log_port_write);
+ scm_set_port_print (scm_anubis_log_port_type, log_port_print);
+ scm_set_port_needs_close_on_gc (scm_anubis_log_port_type, 1);
+}
-static void
-_anubis_error_port_write (SCM port, const void *data, size_t size)
+static SCM
+_make_anubis_log_port (int type, int flag)
{
- scm_port *pt = SCM_PTAB_ENTRY (port);
- size_t space = pt->write_end - pt->write_pos;
- if (space < size)
- {
- size_t start = pt->write_pos - pt->write_buf;
- size_t new_size = pt->write_buf_size;
-
- do
- {
- /*FIXME*/
- new_size *= 2;
- }
- while (new_size - start < size);
-
- pt->write_buf = scm_gc_realloc (pt->write_buf,
- pt->write_buf_size,
- new_size, "write buffer");
- pt->write_buf_size = new_size;
- pt->write_end = pt->write_buf + pt->write_buf_size;
- pt->write_pos = pt->write_buf + start;
- }
- memcpy (pt->write_pos, data, size);
- pt->write_pos += size;
+ struct anubis_log_port *lp;
- if (memchr (data, '\n', size))
- _anubis_error_port_flush (port);
+ lp = scm_gc_typed_calloc (struct anubis_log_port);
+ lp->type = type;
+ lp->flag = flag;
+ return scm_c_make_port (scm_anubis_log_port_type,
+ SCM_WRTNG | SCM_BUFLINE, (scm_t_bits) lp);
}
-static scm_t_off
-_anubis_error_port_seek (SCM port, scm_t_off offset, int whence)
-{
- return -1;
-}
-
-static int
-_anubis_error_port_print (SCM exp, SCM port, scm_print_state *pstate)
+SCM
+guile_make_anubis_error_port (int err)
{
- scm_puts ("#<Anubis error port>", port);
- return 1;
+ return _make_anubis_log_port (PORT_LOG_ERROR, err);
}
-static int
-_anubis_info_port_print (SCM exp, SCM port, scm_print_state *pstate)
+SCM
+guile_make_anubis_info_port (void)
{
- scm_puts ("#<Anubis info port>", port);
- return 1;
+ return _make_anubis_log_port (PORT_LOG_INFO, NORMAL);
}
-
-void
-guile_init_anubis_error_port ()
-{
- scm_tc16_anubis_error_port =
- scm_make_port_type ("anubis-error-port",
- _anubis_error_port_fill_input,
- _anubis_error_port_write);
- scm_set_port_mark (scm_tc16_anubis_error_port, _anubis_error_port_mark);
- scm_set_port_free (scm_tc16_anubis_error_port, _anubis_error_port_free);
- scm_set_port_print (scm_tc16_anubis_error_port, _anubis_error_port_print);
- scm_set_port_flush (scm_tc16_anubis_error_port, _anubis_error_port_flush);
- scm_set_port_close (scm_tc16_anubis_error_port, _anubis_error_port_close);
- scm_set_port_seek (scm_tc16_anubis_error_port, _anubis_error_port_seek);
-}
-
-void
-guile_init_anubis_info_port ()
-{
- scm_tc16_anubis_info_port =
- scm_make_port_type ("anubis-info-port",
- _anubis_error_port_fill_input,
- _anubis_error_port_write);
- scm_set_port_mark (scm_tc16_anubis_info_port, _anubis_error_port_mark);
- scm_set_port_free (scm_tc16_anubis_info_port, _anubis_error_port_free);
- scm_set_port_print (scm_tc16_anubis_info_port, _anubis_info_port_print);
- scm_set_port_flush (scm_tc16_anubis_info_port, _anubis_error_port_flush);
- scm_set_port_close (scm_tc16_anubis_info_port, _anubis_error_port_close);
- scm_set_port_seek (scm_tc16_anubis_info_port, _anubis_error_port_seek);
-}
+
#endif
diff --git a/src/main.c b/src/main.c
index 708f859..d6aaa77 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,9 +1,9 @@
/*
GNU Anubis -- an SMTP message submission daemon.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -95,13 +95,13 @@ main (int argc, char *argv[])
Initialize various database formats
*/
#ifdef WITH_GSASL
dbtext_init ();
# ifdef HAVE_LIBGDBM
- gdbm_db_init ();
+ db_gdbm_init ();
# endif
# ifdef WITH_MYSQL
mysql_db_init ();
# endif
# ifdef WITH_PGSQL
pgsql_db_init ();
@@ -159,12 +159,20 @@ main (int argc, char *argv[])
/*
Enter the main core...
*/
if (anubis_mode == anubis_mda) /* Mail Delivery Agent */
mda ();
+ else if (topt & T_PASSFD)
+ {
+ int sd = 3;
+ if (listen (sd, 5))
+ anubis_error (EXIT_FAILURE, errno, _("listen(3) failed"));
+ kill (getppid (), SIGUSR1);
+ loop (sd);
+ }
else if (topt & T_STDINOUT) /* stdin/stdout */
stdinout ();
else
{ /* daemon */
int sd_bind;
sd_bind = bind_and_listen (session.anubis, session.anubis_port);
diff --git a/src/map.c b/src/map.c
index f9dde3c..2efed1f 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1,11 +1,11 @@
/*
map.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/mda.c b/src/mda.c
index e37dda0..ad0e5b6 100644
--- a/src/mda.c
+++ b/src/mda.c
@@ -1,11 +1,11 @@
/*
mda.c
This file is part of GNU Anubis.
- Copyright (C) 2005-2014 The Anubis Team.
+ Copyright (C) 2005-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/message.c b/src/message.c
index b6b70fe..003bef5 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1,11 +1,11 @@
/*
message.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/mime.c b/src/mime.c
index 3fc1e3c..f71a4db 100644
--- a/src/mime.c
+++ b/src/mime.c
@@ -1,11 +1,11 @@
/*
mime.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -93,13 +93,13 @@ message_append_signature_file (MESSAGE msg)
size_t n;
get_homedir (session.clientname, homedir, sizeof (homedir));
n = strlen (homedir) + strlen (signature_file) + 2;
signature_path = xmalloc (n);
- snprintf (signature_path, n - 1, "%s/%s", homedir, signature_file);
+ snprintf (signature_path, n, "%s/%s", homedir, signature_file);
message_append_text_file (msg, signature_path, "-- \n");
free (signature_path);
return;
}
diff --git a/src/misc.c b/src/misc.c
index 750ebe8..8444b85 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1,11 +1,11 @@
/*
misc.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/mysql.c b/src/mysql.c
index 5673aec..ebc0c01 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -1,11 +1,11 @@
/*
mysql.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/net.c b/src/net.c
index 95fc021..d3248d6 100644
--- a/src/net.c
+++ b/src/net.c
@@ -1,11 +1,11 @@
/*
net.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -338,11 +338,11 @@ net_close_stream (NET_STREAM *sd)
void
net_create_stream (NET_STREAM * str, int fd)
{
stream_create (str);
- stream_set_io (*str, (void *) fd, NULL, NULL, NULL, NULL, NULL);
+ stream_set_io (*str, (void *) (ptrdiff_t) fd, NULL, NULL, NULL, NULL, NULL);
}
/* EOF */
diff --git a/src/pgsql.c b/src/pgsql.c
index 0cb30fa..96b6408 100644
--- a/src/pgsql.c
+++ b/src/pgsql.c
@@ -1,11 +1,11 @@
/*
pgsql.c
This file is part of GNU Anubis.
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/proclist.c b/src/proclist.c
index 55441ac..01c567f 100644
--- a/src/proclist.c
+++ b/src/proclist.c
@@ -1,11 +1,11 @@
/*
proclist.c
This file is part of GNU Anubis.
- Copyright (C) 2005-2014 The Anubis Team.
+ Copyright (C) 2005-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/quit.c b/src/quit.c
index d6b2897..11690c4 100644
--- a/src/quit.c
+++ b/src/quit.c
@@ -1,11 +1,11 @@
/*
quit.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/rc-gram.y b/src/rc-gram.y
index d2aa080..dcf2595 100644
--- a/src/rc-gram.y
+++ b/src/rc-gram.y
@@ -1,12 +1,12 @@
%{
/*
rc-gram.y
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/rc-lex.l b/src/rc-lex.l
index 308989b..1a6aedc 100644
--- a/src/rc-lex.l
+++ b/src/rc-lex.l
@@ -1,12 +1,12 @@
%{
/*
rcfile.l
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/rcfile.c b/src/rcfile.c
index 27033c3..c52eb3d 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -1,11 +1,11 @@
/*
rcfile.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -325,28 +325,12 @@ parse_log_facility (const char *arg)
a debugger and setting it to 0 yourself. */
static volatile unsigned long _anubis_hang;
/* List of users who are allowed to use HANG in their profiles */
ANUBIS_LIST allow_hang_users;
-static struct rc_kwdef esmtp_kw[] = {
- { "esmtp-auth", KW_ESMTP_AUTH, KWF_HIDDEN },
- { "esmtp-anonymous-token", KW_ESMTP_ANONYMOUS_TOKEN, KWF_HIDDEN },
- { "esmtp-auth-id", KW_ESMTP_AUTH_ID, KWF_HIDDEN },
- { "esmtp-authz-id", KW_ESMTP_AUTHZ_ID, KWF_HIDDEN },
- { "esmtp-password", KW_ESMTP_PASSWORD, KWF_HIDDEN },
- { "esmtp-service", KW_ESMTP_SERVICE, KWF_HIDDEN },
- { "esmtp-hostname", KW_ESMTP_HOSTNAME, KWF_HIDDEN },
- { "esmtp-generic-service", KW_ESMTP_SERVICE, KWF_HIDDEN },
- { "esmtp-passcode", KW_ESMTP_PASSCODE, KWF_HIDDEN },
- { "esmtp-realm", KW_ESMTP_REALM, KWF_HIDDEN },
- { "esmtp-allowed-mech", KW_ESMTP_ALLOWED_MECH },
- { "esmtp-require-encryption", KW_ESMTP_REQUIRE_ENCRYPTION },
- { NULL }
-};
-
static int
parse_esmtp_kv (int key, ANUBIS_LIST arglist)
{
char *arg = list_item (arglist, 0);
switch (key)
{
diff --git a/src/rcfile.h b/src/rcfile.h
index 99d3679..2f72560 100644
--- a/src/rcfile.h
+++ b/src/rcfile.h
@@ -1,11 +1,11 @@
/*
rcfile.h
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/regex.c b/src/regex.c
index 4151e0a..be9f72e 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1,11 +1,11 @@
/*
regex.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/smtprepl.c b/src/smtprepl.c
index d4b6ac4..46cbb53 100644
--- a/src/smtprepl.c
+++ b/src/smtprepl.c
@@ -1,8 +1,8 @@
/* This file is part of GNU Anubis.
- Copyright (C) 2009-2014 The Anubis Team.
+ Copyright (C) 2009-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/smtprepl.h b/src/smtprepl.h
index 0b22bfc..1b4cc78 100644
--- a/src/smtprepl.h
+++ b/src/smtprepl.h
@@ -1,11 +1,11 @@
/*
headers.h
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/socks.c b/src/socks.c
index 9977c26..447d086 100644
--- a/src/socks.c
+++ b/src/socks.c
@@ -1,11 +1,11 @@
/*
socks.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/sql.c b/src/sql.c
index 2524ee5..398fce4 100644
--- a/src/sql.c
+++ b/src/sql.c
@@ -1,11 +1,11 @@
/*
sql.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/sql.h b/src/sql.h
index c6cfa76..19ecbaf 100644
--- a/src/sql.h
+++ b/src/sql.h
@@ -1,11 +1,11 @@
/*
sql.h
This file is part of GNU Anubis.
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/stream.c b/src/stream.c
index 3211aea..700937d 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1,11 +1,11 @@
/*
stream.c
This file is part of GNU Anubis.
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -50,37 +50,37 @@ _def_strerror (void *data, int rc)
return strerror (rc);
}
static int
_def_write (void *sd, const char *data, size_t size, size_t * nbytes)
{
- int rc = send ((int) sd, data, size, 0);
+ int rc = send ((int) (ptrdiff_t) sd, data, size, 0);
if (rc >= 0)
{
*nbytes = rc;
return 0;
}
return errno;
}
static int
_def_read (void *sd, char *data, size_t size, size_t * nbytes)
{
- int rc = recv ((int) sd, data, size, 0);
+ int rc = recv ((int) (ptrdiff_t) sd, data, size, 0);
if (rc >= 0)
{
*nbytes = rc;
return 0;
}
return errno;
}
static int
_def_close (void *sd)
{
- close ((int) sd);
+ close ((int) (ptrdiff_t) sd);
return 0;
}
void
stream_create (struct net_stream **str)
{
diff --git a/src/tls.c b/src/tls.c
index 59f4742..eea85e5 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -1,11 +1,11 @@
/*
tls.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -285,13 +285,14 @@ start_ssl_server (NET_STREAM sd_client, int verbose)
return stream;
}
static void
verify_certificate (gnutls_session_t session)
{
- int status, rc;
+ int rc;
+ unsigned status;
rc = gnutls_certificate_verify_peers2 (session, &status);
if (rc)
{
info (VERBOSE, "gnutls_certificate_verify_peers2: %s",
gnutls_strerror (rc));
diff --git a/src/transmode.c b/src/transmode.c
index 0cf12f4..715cf94 100644
--- a/src/transmode.c
+++ b/src/transmode.c
@@ -1,11 +1,11 @@
/*
transmode.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/tunnel.c b/src/tunnel.c
index 71495cc..7f94292 100644
--- a/src/tunnel.c
+++ b/src/tunnel.c
@@ -1,11 +1,11 @@
/*
tunnel.c
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -37,14 +37,12 @@ static ANUBIS_SMTP_REPLY ehlo_reply = NULL;
char *
get_ehlo_domain (void)
{
return smtp_ehlo_domain_name ? smtp_ehlo_domain_name : get_localname ();
}
-
-
/* Collect and send headers */
/* Headers spanning multiple lines are wrapped into a single line, preserving
the newlines. When sending to the server they are split again at newlines
diff --git a/src/url.c b/src/url.c
index 825b344..b3f7914 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1,11 +1,11 @@
/*
url.c
This file is part of GNU Anubis.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/src/usr.opt b/src/usr.opt
index fa9d859..d11ceb6 100644
--- a/src/usr.opt
+++ b/src/usr.opt
@@ -1,9 +1,9 @@
/* -*- c -*-
This file is part of GNU Anubis.
- Copyright (C) 2001-2014 The Anubis Team.
+ Copyright (C) 2001-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
diff --git a/src/xdatabase.c b/src/xdatabase.c
index 0ebb54a..ec51f31 100644
--- a/src/xdatabase.c
+++ b/src/xdatabase.c
@@ -1,11 +1,11 @@
/*
xdatabase.c
This file is part of GNU Anubis.
- Copyright (C) 2004-2014 The Anubis Team.
+ Copyright (C) 2004-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..d01dc9d
--- a/dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,8 @@
+atconfig
+atlocal
+package.m4
+testsuite
+testsuite.dir
+testsuite.log
+anustart
+mta
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..5687c53
--- a/dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,91 @@
+# This file is part of GNU Anubis.
+# Copyright (C) 2020 The Anubis Team.
+#
+# Anubis is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with anubis. If not, see <http://www.gnu.org/licenses/>.
+
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
+DISTCLEANFILES = atconfig $(check_SCRIPTS)
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+
+## ------------ ##
+## package.m4. ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ $(AM_V_GEN){ \
+ echo '# Signature of the current package.'; \
+ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
+ echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
+ echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
+ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+ } >$(srcdir)/package.m4
+
+#
+
+## ------------ ##
+## Test suite. ##
+## ------------ ##
+
+TESTSUITE_AT = \
+ anubisusr.at\
+ bmod.at\
+ cond.at\
+ empty.at\
+ badd.at\
+ fadd.at\
+ hadd00.at\
+ hadd01.at\
+ hadd02.at\
+ hdel00.at\
+ hdel01.at\
+ hdel02.at\
+ hdel03.at\
+ hmod.at\
+ gpgcrypt.at\
+ gpgsign.at\
+ gpgse.at\
+ mime00.at\
+ mime01.at\
+ mult.at\
+ no-backref.at\
+ parse.at\
+ paolo.at\
+ remailer.at\
+ rot-13.at\
+ testsuite.at\
+ tlsoneway.at\
+ trigger.at
+
+TESTSUITE = $(srcdir)/testsuite
+M4=m4
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+ $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+ $(AM_V_at)mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+ cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+ @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig atlocal $(TESTSUITE)
+ @$(SHELL) $(TESTSUITE)
+
+noinst_PROGRAMS=anustart mta
+mta_LDADD = @LIBGNUTLS_LIBS@
+AM_CPPFLAGS = @LIBGNUTLS_INCLUDES@
+
diff --git a/tests/anubisusr.at b/tests/anubisusr.at
new file mode 100644
index 0000000..657ce97
--- a/dev/null
+++ b/tests/anubisusr.at
@@ -0,0 +1,131 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Configuration upload])
+AT_KEYWORDS([anubisusr xdb00 upload])
+
+AT_CHECK([
+ANUBIS_PREREQ_GPG(GSASL)
+
+# First upload:
+# user.rc is missing, we upload one.rc
+# anubisusr should return 0. one.rc and user.rc should be identical
+# after this test
+
+mkdir etc
+
+
+echo "anubis:guessme:$(id -un):$PWD/etc/user.rc" > etc/user.db
+
+AT_DATA([etc/net.rc],
+[machine localhost login anubis password guessme
+])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+mode auth
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+termlevel debug
+logfile $PWD/etc/anubis.log
+loglevel all
+tracefile yes
+END
+
+BEGIN AUTH
+sasl-password-db text://$PWD/etc/user.db
+sasl-allowed-mech CRAM-MD5
+smtp-greeting-message "Hej, sloneczko"
+smtp-help-message "Czlowieku, dopomoz sobie sam!"
+END
+])
+
+AT_DATA([one.rc],
+[[BEGIN CONTROL
+logfile "anubis.log"
+remote-mta "localhost:25"
+END
+BEGIN RULE
+if command["mail from"] = ".*<?root@localhost>?"
+ STOP
+fi
+END
+]])
+
+anustart --relax-perm-check --altrc etc/anubis.rc -- \
+ /bin/sh -c 'anubisusr -v -d --netrc etc/net.rc --file one.rc localhost:$ANUBIS_PORT'
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([
+cmp etc/user.rc one.rc
+])
+
+AT_CHECK([
+# Second upload:
+# We upload the same file, running anubisusr in verbose mode.
+# Its output should contain string "File NOT changed",
+# otherwise we declare test failure.
+
+anustart --relax-perm-check --altrc etc/anubis.rc -- \
+ /bin/sh -c 'anubisusr -v -d --netrc etc/net.rc --file one.rc localhost:$ANUBIS_PORT'
+],
+[0],
+[stdout],
+[stderr])
+
+AT_CHECK([
+grep -q "File NOT changed" stdout
+])
+
+AT_CHECK([
+# Third upload:
+# Upload two.rc. After this test user.rc and add.rc must be identical.
+
+AT_DATA([two.rc],
+[BEGIN CONTROL
+logfile "anubis.log"
+remote-mta "localhost:25"
+END
+
+BEGIN RULE
+
+if header[[X-Command]] = "Complete"
+ add body <<-EOT
+ Text text text
+ EOT
+fi
+
+remove [[X-Command]]
+END
+])
+
+anustart --relax-perm-check --altrc etc/anubis.rc -- \
+ /bin/sh -c 'anubisusr -v -d --netrc etc/net.rc --file two.rc localhost:$ANUBIS_PORT'
+],
+[0],
+[stdout],
+[ignore])
+
+AT_CHECK([
+grep -q "File changed" stdout
+])
+
+AT_CHECK([
+cmp etc/user.rc two.rc
+])
+
+AT_CLEANUP
diff --git a/tests/anustart.c b/tests/anustart.c
new file mode 100644
index 0000000..f213f70
--- a/dev/null
+++ b/tests/anustart.c
@@ -0,0 +1,372 @@
+/*
+ NAME
+ anustart - test anubis in daemon mode
+
+ SYNOPSIS
+ anustart ANU_OPTIONS -- COMMAND ARGS ...
+
+ DESCRIPTION
+ Starts two programs: anubis -S -b PORT with additional options from
+ ANU_OPTIONS, and COMMAND with ARGS. PORT is selected as the first
+ unused TCP port in range 1025-65535. Environment variable ANUBIS_PORT
+ is set to the selected value. When anubis is up and running, it sends
+ the SIGUSR1 to anustart, which then starts COMMAND with ARGS and waits
+ for it to terminate. Then, it shuts down anubis and exits with the exit
+ code from COMMAND. If anubis fails to respond within 5 seconds, or
+ COMMAND fails to terminate within that amount of time, both are killed
+ and anustart exits with code 3.
+
+ EXIT STATUS
+ 0
+ Success.
+ 1
+ Failure.
+ 2
+ Command line usage error.
+ 3
+ Timeout waiting for anubis to respond.
+ 4
+ Anubis terminated prematurely.
+
+ Another value means error code from COMMAND.
+
+ LICENSE
+ This file is part of GNU Anubis testsuite.
+ Copyright (C) 2003-2020 The Anubis Team.
+
+ GNU Anubis is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ GNU Anubis is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <limits.h>
+
+char const *progname;
+
+/* Exit codes */
+enum
+ {
+ EX_OK = 0,
+ EX_ERROR = 1,
+ EX_USAGE = 2,
+ EX_TIMEOUT = 3,
+ EX_ANUTERM = 4
+ };
+
+
+static int
+open_socket (int *p_local_port, int max_port)
+{
+ int fd;
+ int true = 1;
+ struct sockaddr_in sin;
+ int local_port;
+
+ memset (&sin, 0, sizeof (sin));
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = INADDR_ANY;
+
+ fd = socket (AF_INET, SOCK_STREAM, 0);
+ if (fd < 0)
+ {
+ fprintf (stderr, "%s: can't open socket: %d\n", progname, errno);
+ return -1;
+ }
+
+ setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &true, sizeof (true));
+
+ local_port = *p_local_port;
+ while (++local_port < max_port)
+ {
+ sin.sin_port = htons((unsigned short)local_port);
+ if (bind (fd, (struct sockaddr *)&sin, sizeof (sin)) == 0)
+ {
+ *p_local_port = local_port;
+ return fd;
+ }
+ }
+
+ fprintf (stderr, "%s: no free port\n", progname);
+ close (fd);
+ fd = -1;
+ return fd;
+}
+
+pid_t
+runcom (char *prog, char **argv, char *out, char *err)
+{
+ pid_t pid;
+ int fd_out, fd_err;
+
+ if (out)
+ {
+ fd_out = open (out, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ if (!fd_out)
+ {
+ fprintf (stderr, "%s: can't open %s: %s\n",
+ progname, out, strerror(errno));
+ exit (EX_ERROR);
+ }
+ }
+ else
+ fd_out = -1;
+ if (err)
+ {
+ fd_err = open (err, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ if (!fd_err)
+ {
+ fprintf (stderr, "%s: can't open %s: %s\n",
+ progname, err, strerror(errno));
+ exit (EX_ERROR);
+ }
+ }
+ else
+ fd_err = -1;
+
+ pid = fork ();
+ if (pid == -1)
+ {
+ perror ("fork");
+ exit (EX_ERROR);
+ }
+
+ if (pid > 0)
+ return pid;
+
+ /* Child */
+ switch (fd_out)
+ {
+ case -1:
+ case 1:
+ break;
+
+ default:
+ if (dup2 (fd_out, 1) == -1)
+ {
+ perror ("dup2");
+ exit (EX_ERROR);
+ }
+ close (fd_out);
+ }
+
+ switch (fd_err)
+ {
+ case -1:
+ case 1:
+ break;
+
+ default:
+ if (dup2 (fd_err, 2) == -1)
+ {
+ perror ("dup2");
+ exit (EX_ERROR);
+ }
+ close (fd_err);
+ }
+
+ execvp (prog ? prog : argv[0], argv);
+ perror (argv[0]);
+ _exit (127);
+}
+
+int volatile signum;
+
+void
+sighan (int sig)
+{
+ signum = sig;
+}
+
+int
+main (int argc, char **argv)
+{
+ int i, j;
+ int fd;
+ char **argv_buf;
+ char **anu_argv;
+ char **com_argv;
+ int local_port = 1024;
+ int max_port = USHRT_MAX;
+ struct sigaction act;
+ sigset_t sigs, oldsigs;
+ int timeout = 5;
+ enum
+ {
+ ASTATE_INITIAL,
+ ASTATE_RUNNING,
+ ASTATE_CHLDEXIT,
+ ASTATE_STOP
+ } state = ASTATE_INITIAL;
+ int exit_code;
+ pid_t anu_pid, com_pid;
+ char portbuf[sizeof("localhost:65535")];
+
+ progname = argv[0];
+
+ /* Split command line */
+ anu_argv = argv;
+
+ for (i = 0; i < argc; i++)
+ if (strcmp (argv[i], "--") == 0)
+ break;
+
+ if (i == argc)
+ {
+ fprintf (stderr, "%s: no command given\n", progname);
+ return EX_USAGE;
+ }
+
+ /*
+ * . 1 extra slots for the -S option in anubis command line.
+ * . 1 slot for the terminating NULL in the user command.
+ */
+ argv_buf = calloc (argc + 3, sizeof (argv_buf[0]));
+ argv_buf[0] = "anubis";
+ for (j = 1; j < i; j++)
+ argv_buf[j] = argv[j];
+ argv_buf[i++] = "-S";
+ argv_buf[i++] = NULL;
+
+ anu_argv = argv_buf;
+ com_argv = argv_buf + i;
+
+ /* Now, j points to "--" */
+ while (++j < argc)
+ {
+ argv_buf[i++] = argv[j];
+ }
+ argv_buf[i] = NULL;
+
+ fd = open_socket (&local_port, max_port);
+ if (fd == -1)
+ return EX_ERROR;
+
+ if (fd != 3)
+ {
+ if (dup2 (fd, 3))
+ {
+ fprintf (stderr, "%s: can't open socket at fd 3\n", progname);
+ return EX_ERROR;
+ }
+ }
+
+ snprintf (portbuf, sizeof (portbuf), "%d", local_port);
+ setenv ("ANUBIS_PORT", portbuf, 1);
+
+ /* Install signals */
+ act.sa_flags = 0;
+ sigemptyset (&act.sa_mask);
+ act.sa_handler = sighan;
+
+ sigaction (SIGCHLD, &act, NULL);
+ sigaction (SIGALRM, &act, NULL);
+ sigaction (SIGUSR1, &act, NULL);
+
+ sigemptyset (&sigs);
+ sigaddset (&sigs, SIGCHLD);
+ sigaddset (&sigs, SIGALRM);
+ sigaddset (&sigs, SIGUSR1);
+ sigprocmask (SIG_BLOCK, &sigs, &oldsigs);
+
+ anu_pid = runcom (anu_argv[0], anu_argv, NULL, NULL);
+
+ /* Set timeout */
+ alarm (timeout);
+
+ state = ASTATE_INITIAL;
+ while (state != ASTATE_STOP)
+ {
+ pid_t pid;
+ int status;
+
+ sigsuspend (&oldsigs);
+ switch (signum)
+ {
+ case SIGUSR1:
+ /* Start command */
+ com_pid = runcom (NULL, com_argv, NULL, NULL);
+ state = ASTATE_RUNNING;
+ break;
+
+ case SIGCHLD:
+ while ((pid = waitpid ((pid_t)-1, &status, WNOHANG)) > 0)
+ {
+ if (pid == anu_pid)
+ {
+ anu_pid = -1;
+ switch (state)
+ {
+ case ASTATE_INITIAL:
+ exit_code = EX_ANUTERM;
+ state = ASTATE_STOP;
+ break;
+
+ case ASTATE_RUNNING:
+ kill (com_pid, SIGTERM);
+ exit_code = EX_ANUTERM;
+ state = ASTATE_CHLDEXIT;
+ break;
+
+ case ASTATE_CHLDEXIT:
+ state = ASTATE_STOP;
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ else if (pid == com_pid)
+ {
+ com_pid = -1;
+ switch (state)
+ {
+ case ASTATE_RUNNING:
+ kill (anu_pid, SIGTERM);
+ exit_code = WEXITSTATUS (status);
+ state = ASTATE_CHLDEXIT;
+ break;
+
+ case ASTATE_CHLDEXIT:
+ state = ASTATE_STOP;
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ }
+ break;
+
+ case SIGALRM:
+ state = ASTATE_STOP;
+ exit_code = EX_TIMEOUT;
+ }
+ }
+
+ return exit_code;
+}
+
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..1bfeff6
--- a/dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,14 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for Anubis test suite.
+# Copyright (C) 2020 Free Software Foundation, Inc.
+
+PATH=@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH
+GPG=@GPG@
+CERTTOOL=@CERTTOOL@
+@TLS_COND_TRUE@GNUTLS_SED='s/%TLS%//'
+@TLS_COND_FALSE@GNUTLS_SED='/%TLS%/d'
+@GPG_COND_TRUE@GPG_SED='s/%GPG%//'
+@GPG_COND_FALSE@GPG_SED='/%GPG%/d'
+@GUILE_COND_TRUE@GUILE_SED='s/%GUILE%//'
+@GUILE_COND_FALSE@GUILE_SED='/%GUILE%/d'
+
diff --git a/tests/badd.at b/tests/badd.at
new file mode 100644
index 0000000..cb5290c
--- a/dev/null
+++ b/tests/badd.at
@@ -0,0 +1,82 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Append a text to the message body])
+AT_KEYWORDS([add body])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[X-Command]] = "Complete"
+# NOTE: The text below up to and including EOT is indented with tabs.
+ add body <<-EOT
+ How cheerfully he seems to grin,
+ How neatly spread his claws,
+ And welcome little fishes in
+ With gently smiling jaws!
+ EOT
+fi
+
+remove [[X-Command]]
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: The Crocodile
+X-Command: Complete
+
+How doth the little crocodile
+Improve his shining tail,
+And pour the waters of the Nile
+On every golden scale!
+
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[8d7
+< X-Command: Complete
+14a14,17
+> How cheerfully he seems to grin,
+> How neatly spread his claws,
+> And welcome little fishes in
+> With gently smiling jaws!
+])
+AT_CLEANUP
+
diff --git a/tests/bmod.at b/tests/bmod.at
new file mode 100644
index 0000000..da8a532
--- a/dev/null
+++ b/tests/bmod.at
@@ -0,0 +1,84 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Modify the message body])
+AT_KEYWORDS([body modify])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+modify body :re [["a very \(old\)"]] "the new"
+modify body :re [["Xanadu"]] "/users3"
+modify body :re [["\(Alph\)"]] "/bin"
+modify body :re [["caverns"]] "Test Suites"
+modify body :re [["\(sea\)"]] "C"
+---END---
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: The Ancient Mariner Anew
+
+This is a very old text:
+
+In Xanadu did Kubla Khan
+A stately pleasure dome decree
+Where Alph, the sacred river ran
+Through caverns measureless to Man
+Down to a sunless sea.
+.
+QUIT
+])
+AT_DATA([expout],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: The Ancient Mariner Anew
+
+This is the new text:
+
+In /users3 did Kubla Khan
+A stately pleasure dome decree
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([cat etc/mta.log],[0],[expout])
+AT_CLEANUP
diff --git a/tests/cond.at b/tests/cond.at
new file mode 100644
index 0000000..f0695df
--- a/dev/null
+++ b/tests/cond.at
@@ -0,0 +1,89 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([conditional statements])
+AT_KEYWORDS([cond])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+add header[[X-Processed-By]] "Anubis"
+
+if header[[Subject]] "Be like water"
+ add header[[X-Comment1]] "Rule1 OK"
+fi
+
+if command[["mail from:"]] ".*<?.*@gnu\.org>?"
+ add header[[X-Comment2]] "Rule2 OK"
+fi
+
+if header[["mail from" ]] ".*<?.*@fsf\.org>?"
+ add header[[X-Comment]] "False"
+fi
+
+if command[["rcpt to:"]] ".*<?.*@fsf\.org>?"
+ add header[[X-Comment]] "False"
+else
+ add header[[X-Comment3]] "Rule3 OK"
+fi
+
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: Be like water
+
+"Empty your mind, be formless. Shapeless, like water.
+If you put water into a cup, it becomes the cup.
+You put water into a bottle and it becomes the bottle.
+You put it in a teapot it becomes the teapot.
+Now, water can flow or it can crash. Be water my friend."
+
+ -- Bruce Lee
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[7a8,11
+> X-Processed-By: Anubis
+> X-Comment1: Rule1 OK
+> X-Comment2: Rule2 OK
+> X-Comment3: Rule3 OK
+])
+AT_CLEANUP
diff --git a/tests/empty.at b/tests/empty.at
new file mode 100644
index 0000000..5e41ccc
--- a/dev/null
+++ b/tests/empty.at
@@ -0,0 +1,50 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Send a message unchanged])
+AT_KEYWORDS([send])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Testing unmodified message
+
+This message should go through Anubis unmodified.
+.
+QUIT
+])
+AT_ANUBIS_CONFIG([empty.rc],[
+BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/empty.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CLEANUP
diff --git a/tests/fadd.at b/tests/fadd.at
new file mode 100644
index 0000000..ef1764c
--- a/dev/null
+++ b/tests/fadd.at
@@ -0,0 +1,78 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Add a text file to the message body])
+AT_KEYWORDS([add body file])
+
+AT_DATA([append.txt],
+[Behind the curtain, in the pantomime
+Hold the line, does anybody want to take it anymore
+The show must go on,
+The show must go on...
+])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[X-Order]] = "Append file"
+ body-append "$PWD/append.txt"
+fi
+remove [[X-Command]]
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: The Show Must Go On
+X-Order: Append file
+
+Empty spaces -- what are we living for
+Abandoned places -- I guess we know the score
+On and on, does anybody know what we are looking for...
+Another hero, another mindless crime
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[13a14,17
+> Behind the curtain, in the pantomime
+> Hold the line, does anybody want to take it anymore
+> The show must go on,
+> The show must go on...
+])
+AT_CLEANUP
diff --git a/tests/gpgcrypt.at b/tests/gpgcrypt.at
new file mode 100644
index 0000000..ff596e0
--- a/dev/null
+++ b/tests/gpgcrypt.at
@@ -0,0 +1,101 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([GPG Encryption])
+AT_KEYWORDS([gpg encrypt])
+
+AT_CHECK([
+ANUBIS_PREREQ_GPG
+mkdir gpg
+if ! $GPG --homedir gpg --quiet --no-permission-warning --batch --gen-key
+then
+ AT_SKIP_TEST
+fi <<EOT
+Key-Type: RSA
+Key-Length: 2048
+Subkey-Type: ELG-E
+Subkey-Length: 2048
+Name-Real: GNU Anubis Team
+Name-Comment: (anubis)
+Name-Email: anubis-dev@gnu.org
+Expire-Date: 0
+%no-protection
+%transient-key
+%commit
+EOT
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+gpg-home $PWD/gpg
+
+trigger "encrypt:(.*)"
+ gpg-encrypt \1
+ add [[X-GPG-Comment]] "Encrypted for \1"
+done
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Does it work?@@encrypt:anubis-dev
+
+If you can read this, then it is working.
+.
+QUIT
+])
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([
+ sed -e '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE-----/d' etc/mta.log],
+[0],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Does it work?
+X-GPG-Comment: Encrypted for anubis-dev
+
+.
+QUIT
+])
+AT_CHECK([
+$GPG --homedir gpg --decrypt < etc/mta.log
+],
+[0],
+[If you can read this, then it is working.
+],
+[ignore])
+
+AT_CLEANUP
diff --git a/tests/gpgse.at b/tests/gpgse.at
new file mode 100644
index 0000000..52f1055
--- a/dev/null
+++ b/tests/gpgse.at
@@ -0,0 +1,102 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([GPG Sign and Encrypt])
+AT_KEYWORDS([gpg sign encrypt])
+
+AT_CHECK([
+ANUBIS_PREREQ_GPG
+mkdir gpg
+if ! $GPG --homedir gpg --quiet --no-permission-warning --batch --gen-key
+then
+ AT_SKIP_TEST
+fi <<EOT
+Key-Type: RSA
+Key-Length: 2048
+Subkey-Type: ELG-E
+Subkey-Length: 2048
+Name-Real: GNU Anubis Team
+Name-Comment: (anubis)
+Name-Email: anubis-dev@gnu.org
+Expire-Date: 0
+%no-protection
+%transient-key
+%commit
+EOT
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+gpg-home $PWD/gpg
+trigger "se:(.*):(.*)"
+ gpg-se \1:\2
+ add [[X-GPG-Comment1]] "Encrypted for \1"
+ add [[X-GPG-Comment2]]"Signed by \2"
+done
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: gpg-se test@@se:anubis-dev:anubis-dev
+
+If you can read this, then it is working.
+.
+QUIT
+])
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([
+ sed -e '/-----BEGIN PGP MESSAGE-----/,/-----END PGP MESSAGE-----/d' etc/mta.log],
+[0],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: gpg-se test
+X-GPG-Comment1: Encrypted for anubis-dev
+X-GPG-Comment2: Signed by anubis-dev
+
+.
+QUIT
+])
+AT_CHECK([
+$GPG --homedir gpg --decrypt < etc/mta.log
+],
+[0],
+[If you can read this, then it is working.
+],
+[ignore])
+AT_CLEANUP
diff --git a/tests/gpgsign.at b/tests/gpgsign.at
new file mode 100644
index 0000000..a58a946
--- a/dev/null
+++ b/tests/gpgsign.at
@@ -0,0 +1,105 @@
+># This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([GPG Sign])
+AT_KEYWORDS([gpg sign])
+
+AT_CHECK([
+ANUBIS_PREREQ_GPG
+mkdir gpg
+
+if ! $GPG --homedir gpg --quiet --no-permission-warning --batch --gen-key
+then
+ AT_SKIP_TEST
+fi <<EOT
+Key-Type: RSA
+Key-Length: 2048
+Subkey-Type: ELG-E
+Subkey-Length: 2048
+Name-Real: GNU Anubis Team
+Name-Comment: (anubis)
+Name-Email: anubis-dev@gnu.org
+Expire-Date: 0
+%no-protection
+%transient-key
+%commit
+EOT
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+gpg-home $PWD/gpg
+trigger "sign:(.*)"
+ gpg-sign "default"
+ add [[X-GPG-Comment]] "Signed by \1"
+done
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Signing messages@@sign:anubis-dev
+
+If you can read this, then it is working.
+.
+QUIT
+])
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([
+ sed -e '/-----BEGIN PGP SIGNATURE-----/,/-----END PGP SIGNATURE-----/d'\
+ -e 's/^Hash:.*/Hash: ???/' etc/mta.log],
+[0],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Signing messages
+X-GPG-Comment: Signed by anubis-dev
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: ???
+
+If you can read this, then it is working.
+.
+QUIT
+])
+AT_CHECK([
+$GPG --homedir gpg --verify < etc/mta.log
+],
+[0],
+[],
+[ignore])
+AT_CLEANUP
diff --git a/tests/hadd00.at b/tests/hadd00.at
new file mode 100644
index 0000000..3e33878
--- a/dev/null
+++ b/tests/hadd00.at
@@ -0,0 +1,71 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Add a header field])
+AT_KEYWORDS([hadd header])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[Subject]] = ".*Part (.*)"
+ add [[X-Part-Number]] "\1"
+fi
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: The Tao of Programming, Part I
+
+ A manager went to his programmers and told them: "As regards to your
+work hours: you are going to have to come in at nine in the morning and leave
+at five in the afternoon." At this, all of them became angry and several
+resigned on the spot.
+ So the manager said: "All right, in that case you may set your own
+working hours, as long as you finish your projects on schedule." The
+programmers, now satisfied, began to come in a noon and work to the wee
+hours of the morning.
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[7a8
+> X-Part-Number: I
+])
+
+AT_CLEANUP \ No newline at end of file
diff --git a/testsuite/etc/del2.pat b/tests/hadd01.at
index abea152..1340958 100644
--- a/testsuite/etc/del2.pat
+++ b/tests/hadd01.at
@@ -1,100 +1,118 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Add header to several messages])
+AT_KEYWORDS([hadd header])
-:TEST Removing headers from all messages
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE del.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[Subject]] = ".*Part (.*)"
+ add [[X-Part-Number]] "\1"
+fi
+END
+])
+
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
-:DEL X-Subject: Test of header removal. Message 1.
Subject: The Tao of Programming, Part I
-:DEL X-Part-Number: I
A manager went to his programmers and told them: "As regards to your
work hours: you are going to have to come in at nine in the morning and leave
at five in the afternoon." At this, all of them became angry and several
resigned on the spot.
So the manager said: "All right, in that case you may set your own
working hours, as long as you finish your projects on schedule." The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
-:DEL X-Subject: Test of header removal. Message 2.
Subject: The Tao of Programming, Part II
-:DEL X-Part-Number: II
A master was explaining the nature of the Tao to one of his novices,
"The Tao is embodied in all software -- regardless of how insignificant,"
said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is
over for today," he said.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
-:DEL X-Subject: Test of header removal. Message 3.
Subject: The Tao of Programming, Part III
-:DEL X-Part-Number: III
A novice asked the Master: "Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him one of
the best programmers in the world. Why is this?"
The Master replies: "That programmer has mastered the Tao. He has
gone beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond the
need for documentation; he no longer cares if anyone else sees his code. He
has gone beyond the need for testing; each of his programs are perfect within
themselves, serene and elegant, their purpose self-evident. Truly, he has
entered the mystery of the Tao."
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[7a8
+> X-Part-Number: I
+23a25
+> X-Part-Number: II
+41a44
+> X-Part-Number: III
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/testsuite/etc/add3.pat b/tests/hadd02.at
index 63f3e88..c756ffd 100644
--- a/testsuite/etc/add3.pat
+++ b/tests/hadd02.at
@@ -1,38 +1,42 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Add header to selected messages])
+AT_KEYWORDS([hadd header])
-:TEST Adding header to one from several messages
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE simple.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[Subject]] = ".*Part (.*)"
+ add [[X-Part-Number]] "\1"
+fi
+END
+])
+
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Chapter I
A manager went to his programmers and told them: "As regards to your
work hours: you are going to have to come in at nine in the morning and leave
@@ -40,42 +44,33 @@ at five in the afternoon." At this, all of them became angry and several
resigned on the spot.
So the manager said: "All right, in that case you may set your own
working hours, as long as you finish your projects on schedule." The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part II
-:ADD X-Part-Number: II
A master was explaining the nature of the Tao to one of his novices,
"The Tao is embodied in all software -- regardless of how insignificant,"
said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is
over for today," he said.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Section III
A novice asked the Master: "Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him one of
@@ -85,11 +80,35 @@ gone beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond the
need for documentation; he no longer cares if anyone else sees his code. He
has gone beyond the need for testing; each of his programs are perfect within
themselves, serene and elegant, their purpose self-evident. Truly, he has
entered the mystery of the Tao."
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[23a24
+> X-Part-Number: II
+])
+AT_CLEANUP
diff --git a/tests/hdel00.at b/tests/hdel00.at
new file mode 100644
index 0000000..1c80555
--- a/dev/null
+++ b/tests/hdel00.at
@@ -0,0 +1,71 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Remove message header])
+AT_KEYWORDS([header remove])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+remove :re [["^X-.*"]]
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+X-Subject: Test of header removal
+Subject: The Tao of Programming, Part I
+X-Part-Number: I
+X-Mailer: DejaGNU
+
+ A manager went to his programmers and told them: "As regards to your
+work hours: you are going to have to come in at nine in the morning and leave
+at five in the afternoon." At this, all of them became angry and several
+resigned on the spot.
+ So the manager said: "All right, in that case you may set your own
+working hours, as long as you finish your projects on schedule." The
+programmers, now satisfied, began to come in a noon and work to the wee
+hours of the morning.
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],[1],
+[7d6
+< X-Subject: Test of header removal
+9,10d7
+< X-Part-Number: I
+< X-Mailer: DejaGNU
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/testsuite/etc/add2.pat b/tests/hdel01.at
index df189e7..64e6807 100644
--- a/testsuite/etc/add2.pat
+++ b/tests/hdel01.at
@@ -1,97 +1,126 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Remove headers from all messages])
+AT_KEYWORDS([header remove])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
-:TEST Adding header to several messages
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE simple.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+BEGIN RULE
+remove :re [["^X-.*"]]
+END
+])
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
+X-Subject: Test of header removal. Message 1.
Subject: The Tao of Programming, Part I
-:ADD X-Part-Number: I
+X-Part-Number: I
A manager went to his programmers and told them: "As regards to your
work hours: you are going to have to come in at nine in the morning and leave
at five in the afternoon." At this, all of them became angry and several
resigned on the spot.
So the manager said: "All right, in that case you may set your own
working hours, as long as you finish your projects on schedule." The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
+X-Subject: Test of header removal. Message 2.
Subject: The Tao of Programming, Part II
-:ADD X-Part-Number: II
+X-Part-Number: II
A master was explaining the nature of the Tao to one of his novices,
"The Tao is embodied in all software -- regardless of how insignificant,"
said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is
over for today," he said.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
+X-Subject: Test of header removal. Message 3.
Subject: The Tao of Programming, Part III
-:ADD X-Part-Number: III
+X-Part-Number: III
A novice asked the Master: "Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him one of
the best programmers in the world. Why is this?"
The Master replies: "That programmer has mastered the Tao. He has
gone beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond the
need for documentation; he no longer cares if anyone else sees his code. He
has gone beyond the need for testing; each of his programs are perfect within
themselves, serene and elegant, their purpose self-evident. Truly, he has
entered the mystery of the Tao."
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[7d6
+< X-Subject: Test of header removal. Message 1.
+9d7
+< X-Part-Number: I
+25d22
+< X-Subject: Test of header removal. Message 2.
+27d23
+< X-Part-Number: II
+45d40
+< X-Subject: Test of header removal. Message 3.
+47d41
+< X-Part-Number: III
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/testsuite/etc/del3.pat b/tests/hdel02.at
index 98e4db8..3fb8fbf 100644
--- a/testsuite/etc/del3.pat
+++ b/tests/hdel02.at
@@ -1,38 +1,38 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Remove headers from selected messages])
+AT_KEYWORDS([header remove])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
-:TEST Removing headers from several messages
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE del.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+BEGIN RULE
+remove :re [["^X-.*"]]
+END
+])
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part I
A manager went to his programmers and told them: "As regards to your
work hours: you are going to have to come in at nine in the morning and leave
@@ -40,43 +40,35 @@ at five in the afternoon." At this, all of them became angry and several
resigned on the spot.
So the manager said: "All right, in that case you may set your own
working hours, as long as you finish your projects on schedule." The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
-:DEL X-Subject: Test of header removal. Message 2.
+X-Subject: Test of header removal. Message 2.
Subject: The Tao of Programming, Part II
-:DEL X-Part-Number: II
+X-Part-Number: II
A master was explaining the nature of the Tao to one of his novices,
"The Tao is embodied in all software -- regardless of how insignificant,"
said the master.
"Is the Tao in a hand-held calculator?" asked the novice.
"It is," came the reply.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is
over for today," he said.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part III
A novice asked the Master: "Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him one of
@@ -86,11 +78,37 @@ gone beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond the
need for documentation; he no longer cares if anyone else sees his code. He
has gone beyond the need for testing; each of his programs are perfect within
themselves, serene and elegant, their purpose self-evident. Truly, he has
entered the mystery of the Tao."
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[23d22
+< X-Subject: Test of header removal. Message 2.
+25d23
+< X-Part-Number: II
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/hdel03.at b/tests/hdel03.at
new file mode 100644
index 0000000..7e0fe7e
--- a/dev/null
+++ b/tests/hdel03.at
@@ -0,0 +1,72 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Remove all headers])
+AT_KEYWORDS([header remove])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+remove :re [["^X-.*"]]
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+X-From: <gray@gnu.org>
+X-To: <polak@gnu.org>
+X-Subject: The Tao of Programming, Part I
+X-Part-Number: I
+X-Mailer: DejaGNU
+
+ A manager went to his programmers and told them: "As regards to your
+work hours: you are going to have to come in at nine in the morning and leave
+at five in the afternoon." At this, all of them became angry and several
+resigned on the spot.
+ So the manager said: "All right, in that case you may set your own
+working hours, as long as you finish your projects on schedule." The
+programmers, now satisfied, began to come in a noon and work to the wee
+hours of the morning.
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[5,9d4
+< X-From: <gray@gnu.org>
+< X-To: <polak@gnu.org>
+< X-Subject: The Tao of Programming, Part I
+< X-Part-Number: I
+< X-Mailer: DejaGNU
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/hmod.at b/tests/hmod.at
new file mode 100644
index 0000000..9004159
--- a/dev/null
+++ b/tests/hmod.at
@@ -0,0 +1,109 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Modify the message header])
+AT_KEYWORDS([header modify])
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+if header[[Subject]] = :scase "Hybrid Theory"
+ modify [[Subject]] "Meteora"
+ modify header :re [["X-\(.*\)"]] [["X-Old-\1"]]
+ modify header [[X-Old-LP-InTheEnd]] [[X-LP-Faint]] "rules!"
+fi
+
+if header[[Subject]] = :scase "Renegades of Funk"
+ modify [[Subject]] "[[RATM \\\& music]] &"
+fi
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: Hybrid Theory
+Subject: Meteora
+X-Mailer: Fake MTA
+X-Old-Mailer: Fake MTA
+X-LP-InTheEnd: rocks
+X-LP-Faint: rules!
+
+I can't feel the way I did before
+Don't turn your back on me
+I won't be ignored
+Time won't heal this damage anymore
+Don't turn your back on me
+I won't be ignored
+.
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: Renegades of Funk
+
+No matter how hard you try,
+you can't stop us now!
+.
+QUIT
+])
+
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+
+AT_CHECK([diff input etc/mta.log],
+[1],
+[[7d6
+< Subject: Hybrid Theory
+9c8
+< X-Mailer: Fake MTA
+---
+> Subject: Meteora
+11c10
+< X-LP-InTheEnd: rocks
+---
+> X-Old-Old-Mailer: Fake MTA
+12a12
+> X-Old-LP-Faint: rules!
+26c26
+< Subject: Renegades of Funk
+---
+> Subject: [RATM & music] Renegades of Funk
+]])
+AT_CLEANUP
diff --git a/testsuite/etc/mime1.pat b/tests/mime00.at
index 4647cbd..2a7f588 100644
--- a/testsuite/etc/mime1.pat
+++ b/tests/mime00.at
@@ -1,38 +1,34 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Process a MIME encoded message
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE empty.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Pass a MIME encoded message])
+AT_KEYWORDS([mime])
+AT_ANUBIS_CONFIG([empty.rc],[
+BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+])
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
Received: from Mirddin.farlep.net (localhost [127.0.0.1])
by Mirddin.farlep.net with ESMTP id g6CLhIb05086
for <gray@mirddin.farlep.net>; Sat, 13 Jul 2002 00:43:18 +0300
Message-Id: <200207122143.g6CLhIb05086@Mirddin.farlep.net>
To: Foo Bar <foobar@nonexistent.net>
Subject: Simple MIME
@@ -70,12 +66,16 @@ dGFuZCBvbiB5b3VyIGhlYWQtLQpEbyB5b3UgdGhpbmssIGF0IHlvdXIgYWdlLCBpdCBpcyByaWdo
dD8nCgpgSW4gbXkgeW91dGgsJyBGYXRoZXIgV2lsbGlhbSByZXBsaWVkIHRvIGhpcyBzb24sCmBJ
IGZlYXJlZCBpdCBtaWdodCBpbmp1cmUgdGhlIGJyYWluOwpCdXQsIG5vdyB0aGF0IEknbSBwZXJm
ZWN0bHkgc3VyZSBJIGhhdmUgbm9uZSwKV2h5LCBJIGRvIGl0IGFnYWluIGFuZCBhZ2Fpbi4nCgo=
------- =_aaaaaaaaaa0--
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/empty.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([diff input etc/mta.log])
+AT_CLEANUP
diff --git a/testsuite/etc/mime2.pat b/tests/mime01.at
index 09a14df..5b193a2 100644
--- a/testsuite/etc/mime2.pat
+++ b/tests/mime01.at
@@ -1,38 +1,35 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Process a MIME encoded message (read-entire-body is set)
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE entire.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Pass a MIME encoded message (read-entire-body)])
+AT_KEYWORDS([mime])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+read-entire-body yes
+END
+])
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
Received: from Mirddin.farlep.net (localhost [127.0.0.1])
by Mirddin.farlep.net with ESMTP id g6CLhIb05086
for <gray@mirddin.farlep.net>; Sat, 13 Jul 2002 00:43:18 +0300
Message-Id: <200207122143.g6CLhIb05086@Mirddin.farlep.net>
To: Foo Bar <foobar@nonexistent.net>
Subject: Simple MIME
@@ -70,12 +67,16 @@ dGFuZCBvbiB5b3VyIGhlYWQtLQpEbyB5b3UgdGhpbmssIGF0IHlvdXIgYWdlLCBpdCBpcyByaWdo
dD8nCgpgSW4gbXkgeW91dGgsJyBGYXRoZXIgV2lsbGlhbSByZXBsaWVkIHRvIGhpcyBzb24sCmBJ
IGZlYXJlZCBpdCBtaWdodCBpbmp1cmUgdGhlIGJyYWluOwpCdXQsIG5vdyB0aGF0IEknbSBwZXJm
ZWN0bHkgc3VyZSBJIGhhdmUgbm9uZSwKV2h5LCBJIGRvIGl0IGFnYWluIGFuZCBhZ2Fpbi4nCgo=
------- =_aaaaaaaaaa0--
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([diff input etc/mta.log])
+AT_CLEANUP
diff --git a/testsuite/mta.c b/tests/mta.c
index 43761a0..28c2440 100644
--- a/testsuite/mta.c
+++ b/tests/mta.c
@@ -1,9 +1,9 @@
/*
This file is part of GNU Anubis testsuite.
- Copyright (C) 2003-2014 The Anubis Team.
+ Copyright (C) 2003-2020 The Anubis Team.
GNU Anubis is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -52,12 +52,13 @@
#include <unistd.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <fcntl.h>
@@ -217,35 +218,35 @@ _def_strerror (int rc)
return rc == -1 ? "end of file reached" : strerror (rc);
}
static int
_def_write (void *sd, char *data, size_t size, size_t * nbytes)
{
- int n = write ((int) sd, data, size);
+ int n = write ((int) (ptrdiff_t) sd, data, size);
if (n != size)
return errno;
if (nbytes)
*nbytes = n;
return 0;
}
static int
_def_read (void *sd, char *data, size_t size, size_t * nbytes)
{
- int n = read ((int) sd, data, size);
+ int n = read ((int) (ptrdiff_t) sd, data, size);
if (n != size)
return errno ? errno : -1;
if (nbytes)
*nbytes = n;
return 0;
}
static int
_def_close (void *sd)
{
- return close ((int) sd);
+ return close ((int) (ptrdiff_t) sd);
}
int (*_mta_read) (void *, char *, size_t, size_t *) = _def_read;
int (*_mta_write) (void *, char *, size_t, size_t *) = _def_write;
int (*_mta_close) (void *) = _def_close;
const char *(*_mta_strerror) (int) = _def_strerror;
@@ -299,25 +300,25 @@ tls_init (void)
static ssize_t
_tls_fd_pull (gnutls_transport_ptr_t fd, void *buf, size_t size)
{
int rc;
do
{
- rc = read ((int) fd, buf, size);
+ rc = read ((int) (ptrdiff_t) fd, buf, size);
}
while (rc == -1 && errno == EAGAIN);
return rc;
}
static ssize_t
_tls_fd_push (gnutls_transport_ptr_t fd, const void *buf, size_t size)
{
int rc;
do
{
- rc = write ((int) fd, buf, size);
+ rc = write ((int) (ptrdiff_t) fd, buf, size);
}
while (rc == -1 && errno == EAGAIN);
return rc;
}
static const char *
@@ -432,13 +433,13 @@ smtp_reply (int code, char *fmt, ...)
n += vsnprintf (obuf + n, sizeof obuf - n, fmt, ap);
va_end (ap);
n += snprintf (obuf + n, sizeof obuf - n, "\r\n");
rc = _mta_write (out, obuf, n, NULL);
if (rc)
{
- fprintf (stderr, "Write failed: %s", _mta_strerror (rc));
+ fprintf (stderr, "Write failed: %s\n", _mta_strerror (rc));
abort ();
}
}
int
get_input_line (char *buf, size_t bufsize)
@@ -448,13 +449,13 @@ get_input_line (char *buf, size_t bufsize)
for (i = 0; i < bufsize - 1; i++)
{
size_t n;
rc = _mta_read (in, buf + i, 1, &n);
if (rc)
{
- fprintf (stderr, "Read failed: %s", _mta_strerror (rc));
+ fprintf (stderr, "Read failed: %s\n", _mta_strerror (rc));
abort ();
}
if (n == 0)
break;
if (buf[i] == '\n')
break;
@@ -850,24 +851,24 @@ mta_daemon (int argc, char **argv)
if ((sfd = accept (fd, (struct sockaddr *) &his_addr, &len)) < 0)
{
perror ("accept");
return 1;
}
- in = out = (void *) fd;
+ in = out = (void *) (ptrdiff_t) fd;
smtp ();
break;
}
return 0;
}
int
mta_stdio (int argc, char **argv)
{
- in = (void *) fileno (stdin);
- out = (void *) fileno (stdout);
+ in = (void *) (ptrdiff_t) fileno (stdin);
+ out = (void *) (ptrdiff_t) fileno (stdout);
smtp ();
return 0;
}
/* EOF */
diff --git a/testsuite/etc/mult.pat b/tests/mult.at
index 0f5dcc8..3f62c12 100644
--- a/testsuite/etc/mult.pat
+++ b/tests/mult.at
@@ -1,38 +1,33 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
#
# GNU Anubis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Sending several messages in a single connection
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE empty.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Send multiple messages unchanged])
+AT_ANUBIS_CONFIG([empty.rc],[
+BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+])
+AT_DATA([input],
+[HELO localhost
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part I
A manger went to his programmers and told them: "As regards to your
work hours: you are going to have to come in at nine in the morning and leave
@@ -40,19 +35,15 @@ at five in the afternoon." At this, all of them became angry and several
resigned on the spot.
So the manager said: "All right, in that case you may set your own
working hours, as long as you finish your projects on schedule." The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part II
A master was explaining the nature of the Tao to one of his novices,
"The Tao is embodied in all software -- regardless of how insignificant,"
@@ -62,19 +53,15 @@ said the master.
"Is the Tao in a video game?" continued the novice.
"It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?"
The master coughed and shifted his position slightly. "The lesson is
over for today," he said.
.
-:EXPECT 250
MAIL FROM:<gray@gnu.org>
-:EXPECT 250
RCPT TO:<polak@gnu.org>
-:EXPECT 250
DATA
-:EXPECT 354
From: <gray@gnu.org>
To: <polak@gnu.org>
Subject: The Tao of Programming, Part III
A novice asked the Master: "Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him one of
@@ -84,11 +71,30 @@ gone beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond the
need for documentation; he no longer cares if anyone else sees his code. He
has gone beyond the need for testing; each of his programs are perfect within
themselves, serene and elegant, their purpose self-evident. Truly, he has
entered the mystery of the Tao."
.
-:EXPECT 250
QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/empty.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/no-backref.at b/tests/no-backref.at
new file mode 100644
index 0000000..9443615
--- a/dev/null
+++ b/tests/no-backref.at
@@ -0,0 +1,72 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+
+# Use of regular expressions without reference groups used to cause
+# segmentation fault unless the reference itself was a simple string
+# (without any macro-characters).
+# Reported by: Paolo <oopla@users.sourceforge.net>
+# References: <20041018203449.GA26021@pp>,<20041027225812.GA19951@pp>
+# http://lists.gnu.org/archive/html/bug-anubis/2004-10/msg00001.html
+
+AT_SETUP([Working regexp w/o reference groups])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+modify body :re [[".*foo.*"]] "bar"
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Regexp coredump
+
+foo
+a foobar
+.
+QUIT
+])
+AT_DATA([expout],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Regexp coredump
+
+bar
+bar
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([cat etc/mta.log],
+[0],
+[expout])
+AT_CLEANUP
diff --git a/tests/paolo.at b/tests/paolo.at
new file mode 100644
index 0000000..15e697a
--- a/dev/null
+++ b/tests/paolo.at
@@ -0,0 +1,71 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Removing substrings from the body])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+modify body :extended [["[[:blank:]]*X-Anomy:.*"]] ""
+modify body :extended [["X-Paren\\\\([^)]*\\\\)"]] ""
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Removing substrings from the body
+
+X-Anomy: This string is removed entirely
+This line is left untouched
+This X-Paren(garbage)lineX-Paren(text) has some garX-Paren(or more)bage removed
+
+Regards,
+Sergey
+.
+QUIT
+])
+AT_DATA([expout],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Removing substrings from the body
+
+
+This line is left untouched
+This line has some garbage removed
+
+Regards,
+Sergey
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([cat etc/mta.log],[0],[expout])
+AT_CLEANUP
diff --git a/tests/parse.at b/tests/parse.at
new file mode 100644
index 0000000..a8dbbcc
--- a/dev/null
+++ b/tests/parse.at
@@ -0,0 +1,103 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([configuration parser])
+AT_KEYWORDS([parse config])
+AT_ANUBIS_CONFIG([anubis.rc],
+[[BEGIN CONTROL
+logfile "anubis.log"
+remote-mta "localhost:25"
+END
+
+BEGIN RULE
+remove [Lines]
+
+if command["mail from"] = ".*<?root@localhost>?"
+ STOP
+fi
+
+if header[Subject] = "(.*)" and not header[Subject] = :scase "URGENT"
+ add [X-Comment] "This message is not URGENT (\1)."
+ add [X-Comment] "GNU's Not Unix! (\1)"
+fi
+
+if header[X-Mailer] = "(.*)"
+ add [X-Comment] "My love \1"
+ modify [X-Mailer] "The lousy mailer \1"
+fi
+
+if header[Subject] = "signature"
+ signature-file-append yes
+fi
+
+if header[Subject] = :scase "external"
+ external-body-processor "/usr/bin/formail"
+fi
+
+if header[Subject] = "body-append"
+ body-append "misc/notes.txt"
+fi
+
+if header[Subject] = "ALL"
+ body-append "misc/notes.txt"
+fi
+END
+]])
+
+AT_DATA([expout],
+[[BEGIN SECTION CONTROL
+ ASGN: logfile = anubis.log
+ ASGN: remote-mta = localhost:25
+END SECTION CONTROL
+BEGIN SECTION RULE
+ REMOVE HEADER :exact [Lines]
+ COND: COMMAND[mail from] :posix [.*<?root@localhost>?]
+ IFTRUE:
+ STOP
+ END COND
+ COND: AND (HEADER[Subject] :posix [(.*)],NOT (HEADER[Subject] :posix :scase [URGENT]))
+ IFTRUE:
+ ADD HEADER[X-Comment] "This message is not URGENT (\1)."
+ ADD HEADER[X-Comment] "GNU's Not Unix! (\1)"
+ END COND
+ COND: HEADER[X-Mailer] :posix [(.*)]
+ IFTRUE:
+ ADD HEADER[X-Comment] "My love \1"
+ MODIFY HEADER :exact [X-Mailer] "The lousy mailer \1"
+ END COND
+ COND: HEADER[Subject] :posix [signature]
+ IFTRUE:
+ ASGN: signature-file-append = yes
+ END COND
+ COND: HEADER[Subject] :posix :scase [external]
+ IFTRUE:
+ ASGN: external-body-processor = /usr/bin/formail
+ END COND
+ COND: HEADER[Subject] :posix [body-append]
+ IFTRUE:
+ ASGN: body-append = misc/notes.txt
+ END COND
+ COND: HEADER[Subject] :posix [ALL]
+ IFTRUE:
+ ASGN: body-append = misc/notes.txt
+ END COND
+END SECTION RULE
+]])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --check-config=1
+],
+[0],
+[expout])
+AT_CLEANUP
diff --git a/tests/remailer.at b/tests/remailer.at
new file mode 100644
index 0000000..66de131
--- a/dev/null
+++ b/tests/remailer.at
@@ -0,0 +1,88 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Remailer support])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN GUILE
+guile-output $PWD/etc/anubis.out
+guile-debug yes
+guile-load-path-append $abs_top_srcdir/examples
+guile-load-path-append $abs_top_srcdir/guile
+guile-load-program remailer.scm
+END
+
+BEGIN RULE
+trigger "remail:(.*)/(.*)"
+ guile-process remailer-I #:rrt gray@localhost \
+ #:post \1 \
+ #:latent \2 \
+ #:header "X-Processed-By: GNU Anubis & Remailer-I"
+done
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Testing remailer support@@remail:comp.os.unix/2:00
+
+USENET would be a better laboratory is there were
+more labor and less oratory.
+.
+QUIT
+])
+
+AT_DATA([expout],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: Testing remailer support
+
+::
+Anon-To: gray@localhost
+Anon-Post-To: comp.os.unix
+Latent-Time: +2:00
+##
+X-Processed-By: GNU Anubis & Remailer-I
+
+USENET would be a better laboratory is there were
+more labor and less oratory.
+.
+QUIT
+])
+
+AT_CHECK([
+ANUBIS_PREREQ_CAPA(GUILE)
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([cat etc/mta.log],
+[0],
+[expout])
+AT_CLEANUP
diff --git a/tests/rot-13.at b/tests/rot-13.at
new file mode 100644
index 0000000..b493501
--- a/dev/null
+++ b/tests/rot-13.at
@@ -0,0 +1,145 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([ROT-13 support])
+AT_KEYWORDS([rot-13 rot13])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN GUILE
+guile-output $PWD/etc/anubis.out
+guile-debug yes
+guile-load-path-append $abs_top_srcdir/examples
+guile-load-path-append $abs_top_srcdir/guile
+guile-load-program rot-13.scm
+END
+
+BEGIN RULE
+trigger "rot-13.*body"
+ guile-process rot-13 #:body
+done
+
+trigger "rot-13.*subj"
+ guile-process rot-13 #:subject
+done
+END
+])
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: rot-13 test@@rot-13 subject
+X-Comment: Anubis testsuite
+
+In /users3 did Kubla Khan
+A stately pleasure dome decree,
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+.
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: rot-13 test@@rot-13 body
+X-Comment: Anubis testsuite
+
+In /users3 did Kubla Khan
+A stately pleasure dome decree,
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+.
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: rot-13 test@@rot-13 body subject
+X-Comment: Anubis testsuite
+
+In /users3 did Kubla Khan
+A stately pleasure dome decree,
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+.
+QUIT
+])
+AT_DATA([expout],
+[HELO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: ebg-13 grfg
+X-Comment: Anubis testsuite
+
+In /users3 did Kubla Khan
+A stately pleasure dome decree,
+Where /bin, the sacred river ran
+Through Test Suites measureless to Man
+Down to a sunless C.
+.
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: rot-13 test
+X-Comment: Anubis testsuite
+
+Va /hfref3 qvq Xhoyn Xuna
+N fgngryl cyrnfher qbzr qrperr,
+Jurer /ova, gur fnperq evire ena
+Guebhtu Grfg Fhvgrf zrnfheryrff gb Zna
+Qbja gb n fhayrff P.
+.
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: ebg-13 grfg
+X-Comment: Anubis testsuite
+
+Va /hfref3 qvq Xhoyn Xuna
+N fgngryl cyrnfher qbzr qrperr,
+Jurer /ova, gur fnperq evire ena
+Guebhtu Grfg Fhvgrf zrnfheryrff gb Zna
+Qbja gb n fhayrff P.
+.
+QUIT
+])
+AT_CHECK([
+ANUBIS_PREREQ_CAPA(GUILE)
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+AT_CHECK([cat etc/mta.log],
+[0],
+[expout])
+AT_CLEANUP
+
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..91d7630
--- a/dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,73 @@
+# This file is part of GNU Anubis. -*- autotest -*-
+# Copyright (C) 2020 The Anubis Team.
+#
+# Anubis is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with anubis. If not, see <http://www.gnu.org/licenses/>.
+
+m4_version_prereq([2.52g])
+m4_define([AT_SKIP_TEST],[exit 77])
+m4_define([ANUBIS_PREREQ_CAPA],
+ [anubis --show-config-options|fgrep -q $1||AT_SKIP_TEST])
+m4_define([ANUBIS_PREREQ_GPG],
+ [ANUBIS_PREREQ_CAPA(GPG)
+ test -n "$GPG" || AT_SKIP_TEST])
+m4_define([ANUBIS_PREREQ_TLS],
+ [ANUBIS_PREREQ_CAPA(GNUTLS)
+ test -n "$CERTTOOL" || AT_SKIP_TEST])
+m4_define([AT_ANUBIS_CONFIG],
+[test -d etc || mkdir etc
+cat > etc/$1 <<__EOT__
+$2
+__EOT__
+])
+AT_INIT
+AT_TESTED([anubis])
+AT_BANNER([Basic tests])
+m4_include([parse.at])
+m4_include([empty.at])
+m4_include([mult.at])
+m4_include([hadd00.at])
+m4_include([hadd01.at])
+m4_include([hadd02.at])
+m4_include([badd.at])
+m4_include([fadd.at])
+m4_include([cond.at])
+m4_include([hmod.at])
+m4_include([bmod.at])
+m4_include([hdel00.at])
+m4_include([hdel01.at])
+m4_include([hdel02.at])
+m4_include([hdel03.at])
+m4_include([trigger.at])
+AT_BANNER([GPG])
+m4_include([gpgcrypt.at])
+m4_include([gpgsign.at])
+m4_include([gpgse.at])
+
+AT_BANNER([MIME])
+m4_include([mime00.at])
+m4_include([mime01.at])
+
+AT_BANNER([TLS])
+m4_include([tlsoneway.at])
+
+AT_BANNER([Guile])
+m4_include([rot-13.at])
+m4_include([remailer.at])
+
+AT_BANNER([anubisusr])
+m4_include([anubisusr.at])
+
+AT_BANNER([Other tests])
+m4_include([paolo.at])
+m4_include([no-backref.at])
diff --git a/tests/tlsoneway.at b/tests/tlsoneway.at
new file mode 100644
index 0000000..7f75bf5
--- a/dev/null
+++ b/tests/tlsoneway.at
@@ -0,0 +1,80 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([One-way TLS encryption])
+AT_KEYWORDS([tls])
+AT_CHECK([
+ANUBIS_PREREQ_TLS
+
+mkdir cfg
+
+AT_DATA([cfg/certtool.cfg],
+[organization = "GNU Anubis Team"
+unit = "testing"
+cn = anubis
+])
+
+$CERTTOOL -p --rsa --sec-param Low --outfile=cfg/privkey.pem || AT_SKIP_TEST
+$CERTTOOL -s --load-privkey=cfg/privkey.pem --template cfg/certtool.cfg --outfile cfg/cert.pem || AT_SKIP_TEST
+
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log -c $PWD/cfg/cert.pem -k $PWD/cfg/privkey.pem
+ssl-oneway yes
+END
+])
+
+AT_DATA([input],
+[EHLO localhost
+MAIL FROM:<gray@gnu.org>
+RCPT TO:<polak@gnu.org>
+DATA
+From: <gray@gnu.org>
+To: <polak@gnu.org>
+Subject: The Tao of Programming, Part I
+
+ A manager went to his programmers and told them: "As regards to your
+work hours: you are going to have to come in at nine in the morning and leave
+at five in the afternoon." At this, all of them became angry and several
+resigned on the spot.
+ So the manager said: "All right, in that case you may set your own
+working hours, as long as you finish your projects on schedule." The
+programmers, now satisfied, began to come in a noon and work to the wee
+hours of the morning.
+.
+QUIT
+])
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[ignore],
+[ignore])
+
+AT_CHECK([diff input etc/mta.log],
+[1],
+[1a2,3
+> STARTTLS
+> EHLO localhost
+])
+
+AT_CLEANUP
+
diff --git a/tests/trigger.at b/tests/trigger.at
new file mode 100644
index 0000000..236a414
--- a/dev/null
+++ b/tests/trigger.at
@@ -0,0 +1,101 @@
+# This file is part of GNU Anubis testsuite. -*- autotest -*-
+# Copyright (C) 2003-2020 The Anubis Team.
+#
+# GNU Anubis is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Anubis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Trigger mechanism])
+AT_KEYWORDS([trigger])
+AT_ANUBIS_CONFIG([anubis.rc],
+[BEGIN CONTROL
+logfile $PWD/etc/anubis.log
+local-mta $abs_builddir/mta -bs -d $PWD/etc/mta.log
+END
+
+BEGIN RULE
+trigger "^trigger1"
+ add [[X-Trigger-Test]] "is the true path to nirvana..."
+done
+
+trigger "^trigger2 (.*) (.*)"
+ add [[X-Trigger-Test]] "SMELLS LIKE \1 \2"
+done
+END
+])
+
+AT_DATA([input],
+[HELO localhost
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: COME AS YOU ARE@@trigger1
+
+Come as you are, as you were
+As I want you to to be.
+As a friend, as a friend
+As an old enemy
+Take your time
+Hurry up, the choice is yours
+Don't be late.
+Take a rest, as a friend
+As an old memoria...
+
+.
+MAIL FROM:<polak@gnu.org>
+RCPT TO:<gray@gnu.org>
+DATA
+From: <polak@gnu.org>
+To: <gray@gnu.org>
+Subject: YOU KNOW YOU'RE RIGHT@@trigger2 TEEN SPIRIT
+
+With the lights out, it's less dangerous
+Here we are now, entertain us
+I feel stupid, and contagious
+Here we are now, entertain us
+
+.
+QUIT
+])
+AT_CHECK([
+anubis --norc --relax-perm-check --altrc etc/anubis.rc --stdio < input | tr -d '\r'
+],
+[0],
+[220 localhost ([GNU Anubis v]AT_PACKAGE_VERSION) bitbucket ready
+250 pleased to meet you
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+250 Sender OK
+250 Recipient OK
+354 Enter mail, end with "." on a line by itself
+250 Mail accepted for delivery
+221 Done
+],
+[ignore])
+AT_CHECK([diff input etc/mta.log],
+[1],
+[7c7,8
+< Subject: COME AS YOU ARE@@trigger1
+---
+> Subject: COME AS YOU ARE
+> X-Trigger-Test: is the true path to nirvana...
+25c26,27
+< Subject: YOU KNOW YOU'RE RIGHT@@trigger2 TEEN SPIRIT
+---
+> Subject: YOU KNOW YOU'RE RIGHT
+> X-Trigger-Test: SMELLS LIKE TEEN SPIRIT
+])
+AT_CLEANUP
+
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
deleted file mode 100644
index 17766c7..0000000
--- a/testsuite/.gitignore
+++ b/dev/null
@@ -1,9 +0,0 @@
-Makefile
-Makefile.in
-.deps
-*.log
-*.sum
-site.exp
-remote.exp
-mta
-findport \ No newline at end of file
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
deleted file mode 100644
index f05c21b..0000000
--- a/testsuite/Makefile.am
+++ b/dev/null
@@ -1,94 +0,0 @@
-##
-## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
-##
-## GNU Anubis is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 3 of the License, or (at your
-## option) any later version.
-##
-## GNU Anubis is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License along
-## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-##
-
-AUTOMAKE_OPTIONS = dejagnu
-DEJATOOL = anubis
-RUNTESTFLAGS =
-CLEANFILES = *.log
-test_dirs = lib anubis anubis.authmode
-noinst_PROGRAMS = mta findport
-SUBDIRS = . etc data
-
-mta_LDADD = @LIBGNUTLS_LIBS@
-AM_CPPFLAGS = @LIBGNUTLS_INCLUDES@
-
-dist-hook:
- here=`cd $(top_builddir)/$(subdir) && pwd`; \
- srcdir=`cd $(srcdir) && pwd`; \
- distdir=`cd $(distdir) && pwd`; \
- for dir in $(test_dirs); \
- do \
- cd $$srcdir;\
- mkdir $$distdir/$$dir;\
- cd $$dir;\
- for file in DISTFILES `cat DISTFILES`; do \
- d=$$srcdir/$$dir; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $$distdir/$$dir/$$file; \
- else \
- test -f $$distdir/$$dir/$$file \
- || cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
- fi; \
- done;\
- done;\
- cd $$here
-
-site.exp: Makefile remote.exp
- @echo 'Making a new site.exp file...'
- @test ! -f site.bak || rm -f site.bak
- @echo '## these variables are automatically generated by make ##' > $@-t
- @echo '# Do not edit here. If you wish to override these values' >> $@-t
- @echo '# edit the last section' >> $@-t
- @echo 'set tool $(DEJATOOL)' >> $@-t
- @echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
- @echo "set top_builddir `cd $(top_builddir); pwd`" >> $@-t
- @echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
- @echo 'set objdir' `pwd` >> $@-t
- @echo 'set host_alias "$(host_alias)"' >> $@-t
- @echo 'set host_triplet $(host_triplet)' >> $@-t
- @echo 'set target_alias "$(target_alias)"' >> $@-t
- @echo 'set target_triplet $(target_triplet)' >> $@-t
- @echo 'set build_alias "$(build_alias)"' >> $@-t
- @echo 'set build_triplet $(build_triplet)' >> $@-t
- @echo 'set gpg_prog "$(GPG)"' >> $@-t
- @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
- @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
- @test ! -f site.exp || mv site.exp site.bak
- @mv $@-t site.exp
-
-remote.exp:;
- @echo 'Making a new remote.exp file...'
- @test ! -f remote.bak || rm -f remote.bak
- @echo '## These variables are used to set up for the remote testing.' >> $@-t
- @echo '## Please, read file README in this directory for instructions' >> $@-t
- @echo '## on how to use this file' >> $@-t
- @echo "set host_board `hostname`" >> $@-t
- @echo 'set board_info($$host_board,connect) rlogin' >> $@-t
- @echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
- @echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
- @echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
- @echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
- @echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
- @echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
- @echo "set board_info(\$$host_board,gpg_prog) '$(GPG)'" >> $@-t
- @test ! -f remote.exp || mv remote.exp remote.bak
- @mv $@-t remote.exp
-
-
-DISTCLEANFILES=*.exp *.log *.sum
-
diff --git a/testsuite/anubis.authmode/DISTFILES b/testsuite/anubis.authmode/DISTFILES
deleted file mode 100644
index cd9306c..0000000
--- a/testsuite/anubis.authmode/DISTFILES
+++ b/dev/null
@@ -1,5 +0,0 @@
-abase.exp
-base.exp
-gpg.exp
-guile.exp
-mime.exp
diff --git a/testsuite/anubis.authmode/abase.exp b/testsuite/anubis.authmode/abase.exp
deleted file mode 100644
index 65c9a6c..0000000
--- a/testsuite/anubis.authmode/abase.exp
+++ b/dev/null
@@ -1,107 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-if [anubis_check_capability "GSASL"] {
-
- set rmbin [findfile "/bin/rm" "/bin/rm" 0]
- set cmpbin [findfile "/usr/bin/cmp" "/usr/bin/cmp" 0]
- if {$rmbin == 0 || $cmpbin == 0} {
- untested "anubisusr"
- return
- }
-
- start_daemon
-
- remote_exec host "$rmbin" "$ANUBIS_RC_DIR/user.rc"
-
- # First upload:
- # user.rc is missing, we upload std.rc
- # anubisusr should return 0. std.rc and user.rc should be identical
- # after this test
- set message "anubisusr first upload"
- set res [remote_exec host "$ANUBIS_USR" \
- "--netrc $ANUBIS_ETC_DIR/net.rc \
- --file $ANUBIS_RC_DIR/std.rc localhost:$ANUBIS_PORT"]
- if {[llength $res] < 1 || [lindex $res 0]} {
- fail "$message"
- return
- }
-
- set res [remote_exec host "$cmpbin" \
- "$ANUBIS_RC_DIR/std.rc $ANUBIS_RC_DIR/user.rc"]
- if {[llength $res] < 1} {
- fail "$message: executing cmp failed"
- } elseif {[lindex $res 0]} {
- fail "$message: files differ"
- } else {
- pass "$message"
- }
-
- # Second upload:
- # We upload the same file, running anubisusr in verbose mode.
- # Its output should contain string "File NOT changed",
- # otherwise we declare test failure.
- set message "anubisusr second upload"
- set res [remote_exec host "$ANUBIS_USR" \
- "-v --netrc $ANUBIS_ETC_DIR/net.rc \
- --file $ANUBIS_RC_DIR/std.rc localhost:$ANUBIS_PORT"]
- if {[llength $res] < 1 || [lindex $res 0]} {
- fail $message
- } else {
- set output [split [lindex $res 1] "\r\n"]
- set passed 0
- for {set i 0} {$i < [llength $output]} {incr i} {
- verbose "LINE [lindex $output $i]"
- switch -exact -- "[lindex $output $i]" {
- "File NOT changed" { set passed 1; break }
- }
- }
-
- if {$passed} {
- pass $message
- } else {
- fail $message
- }
- }
-
- # Third upload:
- # Upload add.rc. After this test user.rc and add.rc must be identical.
- set message "anubisusr third upload"
- set res [remote_exec host "$ANUBIS_USR" \
- "--netrc $ANUBIS_ETC_DIR/net.rc \
- --file $ANUBIS_RC_DIR/add.rc localhost:$ANUBIS_PORT"]
- if {[llength $res] < 1 || [lindex $res 0]} {
- fail $message
- } else {
- set res [remote_exec host "$cmpbin" \
- "$ANUBIS_RC_DIR/add.rc $ANUBIS_RC_DIR/user.rc"]
- if {[llength $res] < 1} {
- fail "$message: executing cmp failed"
- } elseif {[lindex $res 0]} {
- fail "$message: files differ"
- } else {
- pass "$message"
- }
- }
-
- kill_daemon
-} else {
- unsupported "anubisusr tests"
-}
-
-# End of abase.exp
-
diff --git a/testsuite/anubis.authmode/base.exp b/testsuite/anubis.authmode/base.exp
deleted file mode 100644
index 2157c38..0000000
--- a/testsuite/anubis.authmode/base.exp
+++ b/dev/null
@@ -1,9 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This program is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-run_in_authmode $ANUBIS_SRCDIR/anubis/base.exp
diff --git a/testsuite/anubis.authmode/gpg.exp b/testsuite/anubis.authmode/gpg.exp
deleted file mode 100644
index cb2f98d..0000000
--- a/testsuite/anubis.authmode/gpg.exp
+++ b/dev/null
@@ -1,9 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This program is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-run_in_authmode $ANUBIS_SRCDIR/anubis/gpg.exp
diff --git a/testsuite/anubis.authmode/guile.exp b/testsuite/anubis.authmode/guile.exp
deleted file mode 100644
index c1ff901..0000000
--- a/testsuite/anubis.authmode/guile.exp
+++ b/dev/null
@@ -1,9 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This program is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-run_in_authmode $ANUBIS_SRCDIR/anubis/guile.exp
diff --git a/testsuite/anubis.authmode/mime.exp b/testsuite/anubis.authmode/mime.exp
deleted file mode 100644
index 916a12d..0000000
--- a/testsuite/anubis.authmode/mime.exp
+++ b/dev/null
@@ -1,9 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This program is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-run_in_authmode $ANUBIS_SRCDIR/anubis/mime.exp
diff --git a/testsuite/anubis/DISTFILES b/testsuite/anubis/DISTFILES
deleted file mode 100644
index 5332f3d..0000000
--- a/testsuite/anubis/DISTFILES
+++ b/dev/null
@@ -1,7 +0,0 @@
-abase.exp
-base.exp
-gpg.exp
-guile.exp
-mime.exp
-no-backref.exp
-tls.exp
diff --git a/testsuite/anubis/abase.exp b/testsuite/anubis/abase.exp
deleted file mode 100644
index c8897f0..0000000
--- a/testsuite/anubis/abase.exp
+++ b/dev/null
@@ -1,21 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-
-# Parse standard configuration file
-anubis_pat "${ANUBIS_RC_DIR}/std.pat"
diff --git a/testsuite/anubis/base.exp b/testsuite/anubis/base.exp
deleted file mode 100644
index b22f946..0000000
--- a/testsuite/anubis/base.exp
+++ b/dev/null
@@ -1,59 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-
-# Basic tests
-
-# Send a message without modifications
-anubis_pat empty.pat
-
-# Send multiple messages without modifications
-anubis_pat mult.pat
-# Add a header field to the message
-anubis_pat add1.pat
-# Add a header field to several messages
-anubis_pat add2.pat
-# Add a header field to one message from the several ones
-anubis_pat add3.pat
-# Append a text to the body
-anubis_pat add-body.pat
-# Append a text file to the body
-anubis_pat add-body-file.pat
-
-# More conditional tests
-anubis_pat cond.pat
-
-# Modify the header
-anubis_pat mod-header.pat
-# Modify the body
-anubis_pat mod-body.pat
-
-# Delete headers
-anubis_pat del1.pat
-# Delete headers from all messages
-anubis_pat del2.pat
-# Delete headers from some messages
-anubis_pat del3.pat
-# Delete all headers from a message
-anubis_pat del4.pat
-
-# Test the Trigger mechanism
-anubis_pat trigger.pat
-
-# End of parse.exp
-
diff --git a/testsuite/anubis/gpg.exp b/testsuite/anubis/gpg.exp
deleted file mode 100644
index 949d7a9..0000000
--- a/testsuite/anubis/gpg.exp
+++ b/dev/null
@@ -1,26 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-default_anubis_version
-
-if [anubis_check_capability GPG] {
- anubis_pat gpgcrypt.pat
- anubis_pat gpgsign.pat
- anubis_pat gpgse.pat
-}
-
diff --git a/testsuite/anubis/guile.exp b/testsuite/anubis/guile.exp
deleted file mode 100644
index 152184a..0000000
--- a/testsuite/anubis/guile.exp
+++ b/dev/null
@@ -1,24 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-default_anubis_version
-
-if [anubis_check_capability GUILE] {
- anubis_pat "rot-13.pat"
- anubis_pat remail.pat
-}
diff --git a/testsuite/anubis/mime.exp b/testsuite/anubis/mime.exp
deleted file mode 100644
index e728ab4..0000000
--- a/testsuite/anubis/mime.exp
+++ b/dev/null
@@ -1,24 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-
-anubis_pat mime1.pat
-
-anubis_pat mime2.pat
-
-# End of mime.exp
diff --git a/testsuite/anubis/no-backref.exp b/testsuite/anubis/no-backref.exp
deleted file mode 100644
index 2aca74c..0000000
--- a/testsuite/anubis/no-backref.exp
+++ b/dev/null
@@ -1,29 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-# Use of regular expressions without reference groups used to cause
-# segmentation fault unless the reference itself was a simple string
-# (without any macro-characters).
-# Reported by: Paolo <oopla@users.sourceforge.net>
-# References: <20041018203449.GA26021@pp>,<20041027225812.GA19951@pp>
-# http://lists.gnu.org/archive/html/bug-anubis/2004-10/msg00001.html
-
-anubis_init
-
-anubis_pat no-backref.pat
-
-# End of no-backref.exp
diff --git a/testsuite/anubis/paolo.exp b/testsuite/anubis/paolo.exp
deleted file mode 100644
index 1aec472..0000000
--- a/testsuite/anubis/paolo.exp
+++ b/dev/null
@@ -1,3 +0,0 @@
-anubis_init
-
-anubis_pat "${ANUBIS_RC_DIR}/paolo.pat" \ No newline at end of file
diff --git a/testsuite/anubis/tls.exp b/testsuite/anubis/tls.exp
deleted file mode 100644
index a84c470..0000000
--- a/testsuite/anubis/tls.exp
+++ b/dev/null
@@ -1,23 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-anubis_init
-default_anubis_version
-
-if [anubis_check_capability GNUTLS] {
- anubis_pat tlsoneway.pat
-}
diff --git a/testsuite/data/.gitignore b/testsuite/data/.gitignore
deleted file mode 100644
index c6f00ca..0000000
--- a/testsuite/data/.gitignore
+++ b/dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-random_seed
-*.gpg
-text.db \ No newline at end of file
diff --git a/testsuite/data/Makefile.am b/testsuite/data/Makefile.am
deleted file mode 100644
index bf6987e..0000000
--- a/testsuite/data/Makefile.am
+++ b/dev/null
@@ -1,30 +0,0 @@
-##
-## This file is part of GNU Anubis.
-## Copyright (C) 2003, 2007 The Anubis Team.
-##
-## GNU Anubis is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 3 of the License, or (at your
-## option) any later version.
-##
-## GNU Anubis is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License along
-## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-##
-
-GPGFILES = secring.gpg pubring.gpg
-noinst_DATA = @ANUBIS_GPGFILES@ text.db
-
-EXTRA_DIST = pubring.asc secring.asc anubis.pem append.txt users
-CLEANFILES = *.gpg random_seed *~ text.db
-
-pubring.gpg secring.gpg: $(srcdir)/pubring.asc $(srcdir)/secring.asc
- $(GPG) --homedir . --import < $(srcdir)/pubring.asc
- $(GPG) --homedir . --allow-secret-key-import --import < $(srcdir)/secring.asc
-
-text.db: $(srcdir)/users
- sed -e "`../findport -fs^USER^%u^`;s^ETCDIR^`cd ../etc;pwd`^" $(srcdir)/users > text.db
diff --git a/testsuite/data/anubis.pem b/testsuite/data/anubis.pem
deleted file mode 100644
index 9294114..0000000
--- a/testsuite/data/anubis.pem
+++ b/dev/null
@@ -1,33 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQCthRyoC0V96eFNPy/ccg55CwuT1Gyd7x6WE/OXxYWfj+QLjs0z
-BMjCEPF4GC776Qylh+SYSRCyOV5acCZSrNYIQB5pI5fCTLFd3GH5YPgnF32mnIJh
-oXqtc5q1r8sQdZivu5zJ/sfowPxyAKPd1WlzgEddjYCt/YVlYRaXiJjl9wIDAQAB
-AoGASIL23baQHLUu5LQCETJMoAKgnO9JUJqLgpXl1sfBNlPQLZBIagiWyJqB/fjF
-MZpLIaVvPsBRzNiyeEKjkSsO6YVIGHkQWHQP8yGJY1xzRxmnzQnQz8klisJmbXvK
-u8dNf2H71mzBPIa+jnX3m6H1PMjivqb6lYwrFcv+lnQ7ZCkCQQDfQObWVJRFe8tY
-57gww0iON5vdZx+mVtAU6tOZcKAQ4KvM4/zVZf1NO8k1yjxDbJB9l6sokzrWw9Yk
-sH/oLgn9AkEAxvi7MG+5o3yCOcbqGWIf7pUuR6pfJ6skg6UzNlQ8furSbHP7NhRe
-yCQbAS1Z4QWtAkK/J/rIpVyw4t1mTABoAwJAAy6Dm65c5pibD0tOHrPJxu0X9ZHQ
-q6g1Evc9yMQII/VvvV3KbqgjcgRWG8QkE7nqXT/aGpvujL0BwkgZqo9taQJAFyGl
-iW0DtOjtrs/cOVU6Bx+awMQiydbQqOlUudUzL0IXcnpNUy0tE7F23j0qfMmPInsm
-A/zYxLiw6773fJBzhwJBALDAf2JhHTT0rLg4a/PrrDf1XCk8d1EQafjAbHBJkTd8
-X0KAasxNfYtgiWaTmuKhMNyOodLerwsE3vmV9RyhuJo=
------END RSA PRIVATE KEY-----
-
------BEGIN CERTIFICATE-----
-MIICoDCCAgmgAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJBVTET
-MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
-dHkgTHRkMB4XDTAzMDUyNzEyMTIxMFoXDTA0MDUyNjEyMTIxMFowRTELMAkGA1UE
-BhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdp
-ZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArYUcqAtF
-fenhTT8v3HIOeQsLk9Rsne8elhPzl8WFn4/kC47NMwTIwhDxeBgu++kMpYfkmEkQ
-sjleWnAmUqzWCEAeaSOXwkyxXdxh+WD4Jxd9ppyCYaF6rXOata/LEHWYr7ucyf7H
-6MD8cgCj3dVpc4BHXY2Arf2FZWEWl4iY5fcCAwEAAaOBnzCBnDAdBgNVHQ4EFgQU
-1tnjQvF594SgLA9hrWKO41YxvJEwbQYDVR0jBGYwZIAU1tnjQvF594SgLA9hrWKO
-41YxvJGhSaRHMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEw
-HwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGSCAQAwDAYDVR0TBAUwAwEB
-/zANBgkqhkiG9w0BAQQFAAOBgQBGkdousv5fOlKYk3xS6jFDYfVXaizVz0dC5zLJ
-cLYAhBWxEU9KgygoYKVm564R7vnbvLeisdXh6DiCNqsGB3qD5870y9/3hCPZZvV8
-BwjrNZBp2Lc1O48oTHUft+XRst0coBRdZ2z5/6IpPf5P6HjM9q21zluUclsYfEPo
-MNnk9g==
------END CERTIFICATE-----
diff --git a/testsuite/data/append.txt b/testsuite/data/append.txt
deleted file mode 100644
index ea8e686..0000000
--- a/testsuite/data/append.txt
+++ b/dev/null
@@ -1,4 +0,0 @@
-Behind the curtain, in the pantomime
-Hold the line, does anybody want to take it anymore
-The show must go on,
-The show must go on...
diff --git a/testsuite/data/pubring.asc b/testsuite/data/pubring.asc
deleted file mode 100644
index e2d8282..0000000
--- a/testsuite/data/pubring.asc
+++ b/dev/null
@@ -1,24 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.2.1 (GNU/Linux)
-
-mQGiBD5UuPARBACg3NGeg59gl9q+EIVDnyFbjmyC9esqSBPuYxJ4icKYO7nudyL5
-wL2kM88l7/COCPoNdTjSY61Tw9dp8QTYMa9T/J6ytPG1hLPGxFDij5wVRLC+syEm
-aVw102Poq+jyxOdlL3fLKZp087pHim80QcCs/0rvXnMsd5EbGAR3lRyfIwCgsPjq
-bc7Brdl+TtwD/wu4ckMRvWED/RAm36KoJBp2vQ+8vep1dIRQxdBYgzISxMxDTnwl
-BC3FACyoZA9Y33o7zrVoQ6UvSXSAc6+8ZDZqBR1sMi97Lo+xArno1cZconhmaijB
-rtt/bqP+DYwa5aaYgLPEtCqKB4uBfSaAOtiGGYKUy6/wOpQmc2HDxrEEBfNy90wX
-Ee1kA/4ycoQnz0IMcuBpCSbZBL8XfXsrecw8fVXniuiO+AUXuxiUTbnNKdWB9FD4
-ZEhrioyPMAWjXu0PbHr1dMBMemOAWqKg9BT2+tL0wVLp3qGHL8TWTNIjwmxiDSAm
-4+IuPQKISq2Gzm7CSB9QT6NaJDYLtXIRGU2t4AgHKJwmsSKU8bQtR05VIEFudWJp
-cyBUZWFtIChBbnViaXMpIDxhbnViaXMtZGV2QGdudS5vcmc+iFkEExECABkFAj5U
-uPAECwcDAgMVAgMDFgIBAh4BAheAAAoJEA3VA/vc5zQCjLQAoKsI76RMLWx/LpmI
-10tKhV3WOOLjAJ0TlcWsRZvYZVqmziy7s6VrZuH5vbkBDQQ+VLj1EAQAmv6LQWMP
-iMUhuhy4wVPvR9c6vzoVUuVC+JOKEylsMBy76fwk4Bcqa8R8CgGhjqn/N1X2zR9a
-3LcvqwCdijNKIHf4jnuu2h6SMu+LUVbQepnBYXbucDIVaxvr27kbPw76H84O1z1h
-mSsK5gMEzD4zgUgVbZq2E58sFmKuKFwsAU8AAwUD+wTCWupnZLns13OUc7sKNPYa
-x2mYpg25wqKwQU0SfJ4bB+YK/6bIwgAhoXDFtHWIvLrZulQi1rR28Rpwj+Jda7lv
-5IwxseNlOFH5ZARLPDZA6796sg2GA/ESKBygj8JctcitOX0S4lIOs4CYIdj1yHsM
-KGSxQL7XAi7hvx4X/9D+iEYEGBECAAYFAj5UuPUACgkQDdUD+9znNAJ52gCfeEkR
-6+y2WNHgCapDNOO70D9VfPcAniukAqZEdyqgWPXq536agavncFiv
-=h3F4
------END PGP PUBLIC KEY BLOCK-----
diff --git a/testsuite/data/secring.asc b/testsuite/data/secring.asc
deleted file mode 100644
index d167760..0000000
--- a/testsuite/data/secring.asc
+++ b/dev/null
@@ -1,26 +0,0 @@
------BEGIN PGP PRIVATE KEY BLOCK-----
-Version: GnuPG v1.2.1 (GNU/Linux)
-
-lQG7BD5UuPARBACg3NGeg59gl9q+EIVDnyFbjmyC9esqSBPuYxJ4icKYO7nudyL5
-wL2kM88l7/COCPoNdTjSY61Tw9dp8QTYMa9T/J6ytPG1hLPGxFDij5wVRLC+syEm
-aVw102Poq+jyxOdlL3fLKZp087pHim80QcCs/0rvXnMsd5EbGAR3lRyfIwCgsPjq
-bc7Brdl+TtwD/wu4ckMRvWED/RAm36KoJBp2vQ+8vep1dIRQxdBYgzISxMxDTnwl
-BC3FACyoZA9Y33o7zrVoQ6UvSXSAc6+8ZDZqBR1sMi97Lo+xArno1cZconhmaijB
-rtt/bqP+DYwa5aaYgLPEtCqKB4uBfSaAOtiGGYKUy6/wOpQmc2HDxrEEBfNy90wX
-Ee1kA/4ycoQnz0IMcuBpCSbZBL8XfXsrecw8fVXniuiO+AUXuxiUTbnNKdWB9FD4
-ZEhrioyPMAWjXu0PbHr1dMBMemOAWqKg9BT2+tL0wVLp3qGHL8TWTNIjwmxiDSAm
-4+IuPQKISq2Gzm7CSB9QT6NaJDYLtXIRGU2t4AgHKJwmsSKU8QAAoJk3d595pjWp
-UWyhu7ZGhXqJOSGgChq0LUdOVSBBbnViaXMgVGVhbSAoQW51YmlzKSA8YW51Ymlz
-LWRldkBnbnUub3JnPohZBBMRAgAZBQI+VLjwBAsHAwIDFQIDAxYCAQIeAQIXgAAK
-CRAN1QP73Oc0Aoy0AJ0aspaHhddBUK4efDWPlM2PyHs++wCeKgA/0EM80KeY8IKm
-BTbT3huADlidATEEPlS49RAEAJr+i0FjD4jFIbocuMFT70fXOr86FVLlQviTihMp
-bDAcu+n8JOAXKmvEfAoBoY6p/zdV9s0fWty3L6sAnYozSiB3+I57rtoekjLvi1FW
-0HqZwWF27nAyFWsb69u5Gz8O+h/ODtc9YZkrCuYDBMw+M4FIFW2athOfLBZirihc
-LAFPAAMFA/sEwlrqZ2S57NdzlHO7CjT2GsdpmKYNucKisEFNEnyeGwfmCv+myMIA
-IaFwxbR1iLy62bpUIta0dvEacI/iXWu5b+SMMbHjZThR+WQESzw2QOu/erINhgPx
-EigcoI/CXLXIrTl9EuJSDrOAmCHY9ch7DChksUC+1wIu4b8eF//Q/gAA+Mvw9VpR
-EfeAk+1pXvC00uM/0u5Kui3NFN/SCfszuAsTN4hGBBgRAgAGBQI+VLj1AAoJEA3V
-A/vc5zQCedoAoKjzmJpPPTK2pxf5O9WHeHuxAFYCAJwMRlPMmJq6NPNluvqT4TOd
-A5+8vA==
-=sjC/
------END PGP PRIVATE KEY BLOCK-----
diff --git a/testsuite/data/users b/testsuite/data/users
deleted file mode 100644
index 0413e2f..0000000
--- a/testsuite/data/users
+++ b/dev/null
@@ -1,5 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This file is public domain. Do with it whatever you like to.
-anubis:guessme:USER:ETCDIR/user.rc \ No newline at end of file
diff --git a/testsuite/etc/.gitignore b/testsuite/etc/.gitignore
deleted file mode 100644
index d5c0614..0000000
--- a/testsuite/etc/.gitignore
+++ b/dev/null
@@ -1,12 +0,0 @@
-Makefile
-Makefile.in
-*.rc
-*.rc.tmp
-*.log
-std.pat
-anubis.out
-anubis.pid
-anubis.trace
-anubis.log
-user.rc
-net.rc
diff --git a/testsuite/etc/Makefile.am b/testsuite/etc/Makefile.am
deleted file mode 100644
index 3d2a846..0000000
--- a/testsuite/etc/Makefile.am
+++ b/dev/null
@@ -1,113 +0,0 @@
-##
-## This file is part of GNU Anubis.
-## Copyright (C) 2003-2014 The Anubis Team.
-##
-## GNU Anubis is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 3 of the License, or (at your
-## option) any later version.
-##
-## GNU Anubis is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License along
-## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-##
-
-EXTRA_DIST = \
- add1.pat\
- add2.pat\
- add3.pat\
- add-body.pat\
- add-body-file.pat\
- cond.pat\
- del1.pat\
- del2.pat\
- del3.pat\
- del4.pat\
- empty.pat\
- gpgcrypt.pat\
- gpgsign.pat\
- gpgse.pat\
- interface.in.in\
- mime1.pat\
- mime2.pat\
- mod-body.pat\
- mod-header.pat\
- mult.pat\
- net.rc\
- no-backref.pat\
- paolo.in\
- paolo.pat\
- remail.pat\
- rot-13.pat\
- std.pin\
- target.in.in\
- tlsoneway.pat\
- trigger.pat\
- add.in\
- cond.in\
- del.in\
- empty.in\
- entire.in\
- gpg.in\
- mod-body.in\
- mod-header.in\
- no-backref.in\
- remail.in\
- std.in\
- simple.in\
- tlsoneway.in\
- trigger.in
-
-RCFILES = \
- add.rc\
- cond.rc\
- del.rc\
- empty.rc\
- entire.rc\
- gpg.rc\
- interface.in.rc\
- mod-body.rc\
- mod-header.rc\
- no-backref.rc\
- paolo.rc\
- remail.rc\
- simple.rc\
- std.rc\
- target.in.rc\
- tlsoneway.rc\
- trigger.rc
-
-noinst_DATA = $(RCFILES) std.pat
-CLEANFILES = $(RCFILES) std.pat
-DISTCLEANFILES = *.log target.rc interface.rc anubis.pid anubis.trace *.tmp anubis.out user.rc
-
-$(RCFILES) std.pat: Makefile
-cond.rc: cond.in
-del.rc: del.in
-empty.rc: empty.in
-entire.rc: entire.in
-interface.in.rc: interface.in.in
-gpg.rc: gpg.in
-mod-body.rc: mod-body.in
-mod-header.rc: mod-header.in
-simple.rc: simple.in
-std.rc: std.in
-target.in.rc: target.in.in
-trigger.rc: trigger.in
-paolo.rc: paolo.in
-std.pat: std.pin
-
-SUFFIXES=.in .rc .pin .pat
-
-.in.rc:
- $(AM_V_GEN) m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
- -DTESTDIR=`cd ..; pwd` @M4_DEFS@ $< > $@
-
-.pin.pat:
- $(AM_V_GEN) m4 -DTOP_SRCDIR=`cd $(top_srcdir); pwd` \
- -DTESTDIR=`cd ..; pwd` \
- @M4_DEFS@ $< > $@
diff --git a/testsuite/etc/add-body-file.pat b/testsuite/etc/add-body-file.pat
deleted file mode 100644
index c2046bf..0000000
--- a/testsuite/etc/add-body-file.pat
+++ b/dev/null
@@ -1,50 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Appending a text file to the message body
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE add.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-Subject: The Show Must Go On
-X-Order: Append file
-
-Empty spaces -- what are we living for
-Abandoned places -- I guess we know the score
-On and on, does anybody know what we are looking for...
-Another hero, another mindless crime
-:ADD Behind the curtain, in the pantomime
-:ADD Hold the line, does anybody want to take it anymore
-:ADD The show must go on,
-:ADD The show must go on...
-.
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/add-body.pat b/testsuite/etc/add-body.pat
deleted file mode 100644
index da37dbd..0000000
--- a/testsuite/etc/add-body.pat
+++ b/dev/null
@@ -1,51 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Appending a text to the message body
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE add.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: The Crocodile
-:DEL X-Command: Complete
-
-How doth the little crocodile
-Improve his shining tail,
-And pour the waters of the Nile
-On every golden scale!
-
-:ADD How cheerfully he seems to grin,
-:ADD How neatly spread his claws,
-:ADD And welcome little fishes in
-:ADD With gently smiling jaws!
-.
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/add.in b/testsuite/etc/add.in
deleted file mode 100644
index c4449ca..0000000
--- a/testsuite/etc/add.in
+++ b/dev/null
@@ -1,42 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-
-if header[X-Command] = "Complete"
-# NOTE: The text below up to and including EOT is indented with tabs.
- add body <<-EOT
- How cheerfully he seems to grin,
- How neatly spread his claws,
- And welcome little fishes in
- With gently smiling jaws!
- EOT
-fi
-
-if header[X-Order] = "Append file"
- body-append "TOP_SRCDIR/testsuite/data/append.txt"
-fi
-
-remove [X-Command]
-
----END---
diff --git a/testsuite/etc/add1.pat b/testsuite/etc/add1.pat
deleted file mode 100644
index 139a6d6..0000000
--- a/testsuite/etc/add1.pat
+++ b/dev/null
@@ -1,51 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Adding header
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE simple.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: The Tao of Programming, Part I
-:ADD X-Part-Number: I
-
- A manager went to his programmers and told them: "As regards to your
-work hours: you are going to have to come in at nine in the morning and leave
-at five in the afternoon." At this, all of them became angry and several
-resigned on the spot.
- So the manager said: "All right, in that case you may set your own
-working hours, as long as you finish your projects on schedule." The
-programmers, now satisfied, began to come in a noon and work to the wee
-hours of the morning.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/cond.in b/testsuite/etc/cond.in
deleted file mode 100644
index e8c8db9..0000000
--- a/testsuite/etc/cond.in
+++ b/dev/null
@@ -1,47 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-
-add header[X-Processed-By] "Anubis"
-
-if header[Subject] "Be like water"
- add header[X-Comment1] "Rule1 OK"
-fi
-
-if command["mail from:"] ".*<?.*@gnu\.org>?"
- add header[X-Comment2] "Rule2 OK"
-fi
-
-if header["mail from" ]".*<?.*@fsf\.org>?"
- add header[X-Comment] "False"
-fi
-
-if command["rcpt to:"] ".*<?.*@fsf\.org>?"
- add header[X-Comment] "False"
-else
- add header[X-Comment3] "Rule3 OK"
-fi
-
----END---
-
diff --git a/testsuite/etc/cond.pat b/testsuite/etc/cond.pat
deleted file mode 100644
index b81ab5c..0000000
--- a/testsuite/etc/cond.pat
+++ b/dev/null
@@ -1,53 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Testing conditional statements
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE cond.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-Subject: Be like water
-:ADD X-Processed-By: Anubis
-:ADD X-Comment1: Rule1 OK
-:ADD X-Comment2: Rule2 OK
-:ADD X-Comment3: Rule3 OK
-
-"Empty your mind, be formless. Shapeless, like water.
-If you put water into a cup, it becomes the cup.
-You put water into a bottle and it becomes the bottle.
-You put it in a teapot it becomes the teapot.
-Now, water can flow or it can crash. Be water my friend."
-
- -- Bruce Lee
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/del.in b/testsuite/etc/del.in
deleted file mode 100644
index b69f6f4..0000000
--- a/testsuite/etc/del.in
+++ b/dev/null
@@ -1,28 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-
-remove :re ["^X-.*"]
-
----END---
diff --git a/testsuite/etc/del1.pat b/testsuite/etc/del1.pat
deleted file mode 100644
index 511a802..0000000
--- a/testsuite/etc/del1.pat
+++ b/dev/null
@@ -1,53 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Removing header
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE del.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL X-Subject: Test of header removal
-Subject: The Tao of Programming, Part I
-:DEL X-Part-Number: I
-:DEL X-Mailer: DejaGNU
-
- A manager went to his programmers and told them: "As regards to your
-work hours: you are going to have to come in at nine in the morning and leave
-at five in the afternoon." At this, all of them became angry and several
-resigned on the spot.
- So the manager said: "All right, in that case you may set your own
-working hours, as long as you finish your projects on schedule." The
-programmers, now satisfied, began to come in a noon and work to the wee
-hours of the morning.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/del4.pat b/testsuite/etc/del4.pat
deleted file mode 100644
index dfa5446..0000000
--- a/testsuite/etc/del4.pat
+++ b/dev/null
@@ -1,52 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Removing all headers
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE del.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-:DEL X-From: <gray@gnu.org>
-:DEL X-To: <polak@gnu.org>
-:DEL X-Subject: The Tao of Programming, Part I
-:DEL X-Part-Number: I
-:DEL X-Mailer: DejaGNU
-
- A manager went to his programmers and told them: "As regards to your
-work hours: you are going to have to come in at nine in the morning and leave
-at five in the afternoon." At this, all of them became angry and several
-resigned on the spot.
- So the manager said: "All right, in that case you may set your own
-working hours, as long as you finish your projects on schedule." The
-programmers, now satisfied, began to come in a noon and work to the wee
-hours of the morning.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/empty.in b/testsuite/etc/empty.in
deleted file mode 100644
index 52e6fb5..0000000
--- a/testsuite/etc/empty.in
+++ b/dev/null
@@ -1,22 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
diff --git a/testsuite/etc/empty.pat b/testsuite/etc/empty.pat
deleted file mode 100644
index ad8f442..0000000
--- a/testsuite/etc/empty.pat
+++ b/dev/null
@@ -1,43 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Empty script
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE empty.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: Testing unmodified message
-
-This message should go through Anubis unmodified.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/entire.in b/testsuite/etc/entire.in
deleted file mode 100644
index e4dba9d..0000000
--- a/testsuite/etc/entire.in
+++ b/dev/null
@@ -1,23 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
-read-entire-body yes
----END---
diff --git a/testsuite/etc/gpg.in b/testsuite/etc/gpg.in
deleted file mode 100644
index d979b66..0000000
--- a/testsuite/etc/gpg.in
+++ b/dev/null
@@ -1,42 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-gpg-home TESTDIR/data
-
-trigger "encrypt:(.*)"
- gpg-encrypt \1
- add [X-GPG-Comment] "Encrypted for \1"
-done
-
-trigger "sign:(.*)"
- gpg-sign "default"
- add [X-GPG-Comment] "Signed by \1"
-done
-
-trigger "se:(.*):(.*)"
- gpg-se \1:\2
- add [X-GPG-Comment1] "Encrypted for \1"
- add [X-GPG-Comment2] "Signed by \2"
-done
----END---
diff --git a/testsuite/etc/gpgcrypt.pat b/testsuite/etc/gpgcrypt.pat
deleted file mode 100644
index 1baba59..0000000
--- a/testsuite/etc/gpgcrypt.pat
+++ b/dev/null
@@ -1,54 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST GPG Encryption
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE gpg.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: Does it work?@@encrypt:anubis
-:ADD Subject: Does it work?
-:ADD X-GPG-Comment: Encrypted for anubis
-
-:DEL If you can read this, then it is working.
-:ADD -re -----BEGIN PGP MESSAGE-----.*-----END PGP MESSAGE-----
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
-:TEST
-:MODE CAT
-:OPTIONS $gpg_prog --homedir $ANUBIS_DATA_DIR --decrypt
-:PATTERN
--re .*encrypted with 1024-bit ELG-E key, ID E793A998, created 2003-02-20.*"GNU Anubis Team \(Anubis\) <anubis-dev@gnu.org>".*If you can read this, then it is working.
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/gpgse.pat b/testsuite/etc/gpgse.pat
deleted file mode 100644
index 7556016..0000000
--- a/testsuite/etc/gpgse.pat
+++ b/dev/null
@@ -1,55 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST GPG Signing & Encryption
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE gpg.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-:DEL Subject: gpg-se test@@se:anubis:anubis
-:ADD Subject: gpg-se test
-:ADD X-GPG-Comment1: Encrypted for anubis
-:ADD X-GPG-Comment2: Signed by anubis
-
-:DEL If you can read this, then it is working.
-:ADD -re -----BEGIN PGP MESSAGE-----.*-----END PGP MESSAGE-----
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
-:TEST
-:MODE CAT
-:OPTIONS $gpg_prog --homedir $ANUBIS_DATA_DIR --decrypt
-:PATTERN
--re .*encrypted with 1024-bit ELG-E key, ID E793A998, created 2003-02-20.*"GNU Anubis Team \(Anubis\) <anubis-dev@gnu.org>".*If you can read this, then it is working..*Signature made .* using DSA key ID DCE73402.*gpg: Good signature from "GNU Anubis Team \(Anubis\) <anubis-dev@gnu.org>".*Primary key fingerprint: 9D80 A493 F6C8 B63C FD84 E882 0DD5 03FB DCE7 3402
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/gpgsign.pat b/testsuite/etc/gpgsign.pat
deleted file mode 100644
index c8d6e39..0000000
--- a/testsuite/etc/gpgsign.pat
+++ b/dev/null
@@ -1,57 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST GPG Clear Signing
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE gpg.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: Signing messages@@sign:anubis
-:ADD Subject: Signing messages
-:ADD X-GPG-Comment: Signed by anubis
-
-:ADD -----BEGIN PGP SIGNED MESSAGE-----
-:ADD Hash: SHA1
-:ADD
-If you can read this, then it is working.
-:ADD -re -----BEGIN PGP SIGNATURE-----.*-----END PGP SIGNATURE-----
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
-:TEST
-:MODE CAT
-:OPTIONS $gpg_prog --homedir $ANUBIS_DATA_DIR --verify
-:PATTERN
--re .*Signature made .* using DSA key ID DCE73402.*gpg: Good signature from "GNU Anubis Team \(Anubis\) <anubis-dev@gnu.org>".*Primary key fingerprint: 9D80 A493 F6C8 B63C FD84 E882 0DD5 03FB DCE7 3402
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/interface.in.in b/testsuite/etc/interface.in.in
deleted file mode 100644
index 9f8ec16..0000000
--- a/testsuite/etc/interface.in.in
+++ b/dev/null
@@ -1,31 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-BEGIN CONTROL
-termlevel debug
-remote-mta localhost:@ANUBIS_PORT@
-ifdef(`WITH_GNUTLS',`ssl-oneway yes')
-esmtp-auth anubis:guessme
-END
-
-BEGIN RULE
-# Take care to preserve triggers.
-trigger "(.*)"
- modify [Subject] "&@@\1"
-done
-END
diff --git a/testsuite/etc/mod-body.in b/testsuite/etc/mod-body.in
deleted file mode 100644
index 6400b7b..0000000
--- a/testsuite/etc/mod-body.in
+++ b/dev/null
@@ -1,30 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-modify body :re ["a very \(old\)"] "the new"
-modify body :re ["Xanadu"] "/users3"
-modify body :re ["\(Alph\)"] "/bin"
-modify body :re ["caverns"] "Test Suites"
-modify body :re ["\(sea\)"] "C"
----END---
diff --git a/testsuite/etc/mod-body.pat b/testsuite/etc/mod-body.pat
deleted file mode 100644
index 3d567f2..0000000
--- a/testsuite/etc/mod-body.pat
+++ b/dev/null
@@ -1,53 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Modifying the message body
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE mod-body.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: The Ancient Mariner Anew
-
-:DEL This is a very old text:
-:ADD This is the new text:
-
-:DEL In Xanadu did Kubla Khan
-:ADD In /users3 did Kubla Khan
-A stately pleasure dome decree
-:DEL Where Alph, the sacred river ran
-:ADD Where /bin, the sacred river ran
-:DEL Through caverns measureless to Man
-:ADD Through Test Suites measureless to Man
-:DEL Down to a sunless sea.
-:ADD Down to a sunless C.
-.
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/mod-header.in b/testsuite/etc/mod-header.in
deleted file mode 100644
index 0a662a9..0000000
--- a/testsuite/etc/mod-header.in
+++ b/dev/null
@@ -1,34 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-if header[Subject] = :scase "Hybrid Theory"
- modify [Subject] "Meteora"
- modify header :re ["X-\(.*\)"] ["X-Old-\1"]
- modify header [X-Old-LP-InTheEnd] [X-LP-Faint] "rules!"
-fi
-
-if header[Subject] = :scase "Renegades of Funk"
- modify [Subject] "[RATM \\& music] &"
-fi
----END---
diff --git a/testsuite/etc/mod-header.pat b/testsuite/etc/mod-header.pat
deleted file mode 100644
index d52e5ff..0000000
--- a/testsuite/etc/mod-header.pat
+++ b/dev/null
@@ -1,68 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Modifying the message header
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE mod-header.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-:DEL Subject: Hybrid Theory
-:ADD Subject: Meteora
-:DEL X-Mailer: Fake MTA
-:ADD X-Old-Mailer: Fake MTA
-:DEL X-LP-InTheEnd: rocks
-:ADD X-LP-Faint: rules!
-
-I can't feel the way I did before
-Don't turn your back on me
-I won't be ignored
-Time won't heal this damage anymore
-Don't turn your back on me
-I won't be ignored
-.
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-:DEL Subject: Renegades of Funk
-:ADD Subject: [RATM & music] Renegades of Funk
-
-No matter how hard you try,
-you can't stop us now!
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/net.rc b/testsuite/etc/net.rc
deleted file mode 100644
index 3165abe..0000000
--- a/testsuite/etc/net.rc
+++ b/dev/null
@@ -1,6 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2004-2014 The Anubis Team.
-#
-# This file is public domain. Do with it whatever you like to.
-
-machine localhost login anubis password guessme
diff --git a/testsuite/etc/no-backref.in b/testsuite/etc/no-backref.in
deleted file mode 100644
index 06f4508..0000000
--- a/testsuite/etc/no-backref.in
+++ b/dev/null
@@ -1,26 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-modify body :re [".*foo.*"] "bar"
----END---
diff --git a/testsuite/etc/no-backref.pat b/testsuite/etc/no-backref.pat
deleted file mode 100644
index 0648aa6..0000000
--- a/testsuite/etc/no-backref.pat
+++ b/dev/null
@@ -1,52 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-# Use of regular expressions without reference groups used to cause
-# segmentation fault unless the reference itself was a simple string
-# (without any macro-characters).
-# Reported by: Paolo <oopla@users.sourceforge.net>
-# References: <20041018203449.GA26021@pp>,<20041027225812.GA19951@pp>
-# http://lists.gnu.org/archive/html/bug-anubis/2004-10/msg00001.html
-
-:TEST Working regexp w/o reference groups
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE no-backref.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: Regexp coredump
-
-:DEL foo
-:ADD bar
-:DEL a foobar
-:ADD bar
-.
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/paolo.in b/testsuite/etc/paolo.in
deleted file mode 100644
index 9c11dca..0000000
--- a/testsuite/etc/paolo.in
+++ b/dev/null
@@ -1,27 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2005-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-modify body :extended ["[[:blank:]]*X-Anomy:.*"] ""
-modify body :extended ["X-Paren\\([^)]*\\)"] ""
----END---
diff --git a/testsuite/etc/paolo.pat b/testsuite/etc/paolo.pat
deleted file mode 100644
index ab0245e..0000000
--- a/testsuite/etc/paolo.pat
+++ b/dev/null
@@ -1,56 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2005-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-# Anubis coredumped on `modify body' statements that shrunk the input
-# strings.
-# Reference: Reported by Paolo <oopla@users.sourceforge.net>. Messages
-# causing coredump and relevant configuration files were sent privately
-# to <gray@mirddin.farlep.net> on 2 Jan 2005 under message ID
-# <20050101214820.GC6075@pp>
-
-:TEST Removing substrings from the body
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE paolo.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: Removing substrings from the body
-
-:DEL X-Anomy: This string is removed entirely
-:ADD
-This line is left untouched
-:DEL This X-Paren(garbage)lineX-Paren(text) has some garX-Paren(or more)bage removed
-:ADD This line has some garbage removed
-
-Regards,
-Sergey
-.
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/remail.in b/testsuite/etc/remail.in
deleted file mode 100644
index 406996c..0000000
--- a/testsuite/etc/remail.in
+++ b/dev/null
@@ -1,50 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
-BEGIN GUILE
-guile-output TESTDIR/etc/anubis.out
-guile-debug yes
-guile-load-path-append TOP_SRCDIR/examples
-guile-load-path-append TOP_SRCDIR/guile
-guile-load-program rot-13.scm
-guile-load-program remailer.scm
-END
-
----BEGIN RULE---
-
-trigger "remail:(.*)/(.*)"
- guile-process remailer-I #:rrt gray@localhost \
- #:post \1 \
- #:latent \2 \
- #:header "X-Processed-By: GNU Anubis & Remailer-I"
-done
-
-trigger "rot-13.*body"
- guile-process rot-13 #:body
-done
-
-trigger "rot-13.*subj"
- guile-process rot-13 #:subject
-done
-
----END---
diff --git a/testsuite/etc/remail.pat b/testsuite/etc/remail.pat
deleted file mode 100644
index dcb2270..0000000
--- a/testsuite/etc/remail.pat
+++ b/dev/null
@@ -1,53 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Remailer support
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE remail.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: Testing remailer support@@remail:comp.os.unix/2:00
-:ADD Subject: Testing remailer support
-
-:ADD ::
-:ADD Anon-To: gray@localhost
-:ADD Anon-Post-To: comp.os.unix
-:ADD Latent-Time: +2:00
-:ADD ##
-:ADD X-Processed-By: GNU Anubis & Remailer-I
-:ADD
-USENET would be a better laboratory is there were
-more labor and less oratory.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
diff --git a/testsuite/etc/rot-13.pat b/testsuite/etc/rot-13.pat
deleted file mode 100644
index 28e3e57..0000000
--- a/testsuite/etc/rot-13.pat
+++ b/dev/null
@@ -1,98 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST ROT-13 support
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE remail.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: rot-13 test@@rot-13 subject
-:ADD Subject: ebg-13 grfg
-X-Comment: Anubis testsuite
-
-In /users3 did Kubla Khan
-A stately pleasure dome decree,
-Where /bin, the sacred river ran
-Through Test Suites measureless to Man
-Down to a sunless C.
-.
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: rot-13 test@@rot-13 body
-:ADD Subject: rot-13 test
-X-Comment: Anubis testsuite
-
-:DEL In /users3 did Kubla Khan
-:DEL A stately pleasure dome decree,
-:DEL Where /bin, the sacred river ran
-:DEL Through Test Suites measureless to Man
-:DEL Down to a sunless C.
-:ADD Va /hfref3 qvq Xhoyn Xuna
-:ADD N fgngryl cyrnfher qbzr qrperr,
-:ADD Jurer /ova, gur fnperq evire ena
-:ADD Guebhtu Grfg Fhvgrf zrnfheryrff gb Zna
-:ADD Qbja gb n fhayrff P.
-.
-:EXPECT 250
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-:DEL Subject: rot-13 test@@rot-13 body subject
-:ADD Subject: ebg-13 grfg
-X-Comment: Anubis testsuite
-
-:DEL In /users3 did Kubla Khan
-:DEL A stately pleasure dome decree,
-:DEL Where /bin, the sacred river ran
-:DEL Through Test Suites measureless to Man
-:DEL Down to a sunless C.
-:ADD Va /hfref3 qvq Xhoyn Xuna
-:ADD N fgngryl cyrnfher qbzr qrperr,
-:ADD Jurer /ova, gur fnperq evire ena
-:ADD Guebhtu Grfg Fhvgrf zrnfheryrff gb Zna
-:ADD Qbja gb n fhayrff P.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
diff --git a/testsuite/etc/simple.in b/testsuite/etc/simple.in
deleted file mode 100644
index 42b2cc9..0000000
--- a/testsuite/etc/simple.in
+++ b/dev/null
@@ -1,29 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-
-if header[Subject] = ".*Part (.*)"
- add [X-Part-Number] "\1"
-fi
----END---
diff --git a/testsuite/etc/std.in b/testsuite/etc/std.in
deleted file mode 100644
index 3c83ff8..0000000
--- a/testsuite/etc/std.in
+++ b/dev/null
@@ -1,97 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile "anubis.log"
-remote-mta "localhost:25"
-ifdef(`WITH_SSL',`ssl yes')
----END---
-
----BEGIN RULE---
-
-ifdef(`WITH_GPG',`gpg-passphrase "MYSECRETPASSPHRASE"')
-remove [Lines]
-
-if command["mail from"] = ".*<?root@localhost>?"
- STOP
-fi
-
-if header[Subject] = "(.*)" and not header[Subject] = :scase "URGENT"
- add [X-Comment] "This message is not URGENT (\1)."
- add [X-Comment] "GNU's Not Unix! (\1)"
-fi
-
-if header[X-Mailer] = "(.*)"
- add [X-Comment] "My love \1"
- modify [X-Mailer] "The lousy mailer \1"
-fi
-
-trigger "gpgd:(.*)"
- add [X-GPG-Comment] "Encrypted for \1"
- ifdef(`WITH_GPG', `gpg-encrypt = \1')
-done
-
-if header[Subject] = "signature"
- signature-file-append yes
-fi
-
-if header[Subject] = :scase "external"
- external-body-processor "/usr/bin/formail"
-fi
-
-ifdef(`WITH_GPG',`
-if header[Subject] = "gpg-all"
- gpg-encrypt "USERNAME"
- gpg-sign default
-fi
-
-if header[Subject] = gpg-encrypt
- gpg-encrypt = USERNAME-1,USERNAME-2,USERNAME-3
-fi
-
-if header[Subject] = gpg-sign
- gpg-sign default
-fi')
-
-ifdef(`WITH_GUILE',`
-if header[Subject] = "rot13-all"
- guile-process rot-13 #:body
- guile-process rot-13 #:subject
-fi
-
-if header[Subject] = "rot13-body"
- guile-process rot-13 #:body
-fi
-
-if header[Subject] = "rot13-subject"
- guile-process rot-13 #:subject
-fi')
-
-if header[Subject] = "body-append"
- body-append "misc/notes.txt"
-fi
-
-if header[Subject] = "ALL"
- body-append "misc/notes.txt"
- ifdef(`WITH_GPG', `gpg-encrypt "USERNAME"')
- ifdef(`WITH_GUILE', `guile-process rot-13 #:body
- guile-process rot-13 #:subject')
-fi
-
----END---
-
diff --git a/testsuite/etc/std.pin b/testsuite/etc/std.pin
deleted file mode 100644
index fb76faf..0000000
--- a/testsuite/etc/std.pin
+++ b/dev/null
@@ -1,105 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST parse
-:MODE EXEC
-:OPTIONS --check-config=1
-:RCFILE std.rc
-:RETCODE 0
-:PATTERN
-BEGIN SECTION CONTROL
- ASGN: logfile = anubis.log
- ASGN: remote-mta = localhost:25
-ifdef(`WITH_SSL',` ASGN: ssl = yes
-')`'dnl
-END SECTION CONTROL
-BEGIN SECTION RULE
-ifdef(`WITH_GPG',` ASGN: gpg-passphrase = ***
-')`'dnl
- REMOVE HEADER :exact [Lines]
- COND: COMMAND[mail from] :posix [.*<?root@localhost>?]
- IFTRUE:
- STOP
- END COND
- COND: AND (HEADER[Subject] :posix [(.*)],NOT (HEADER[Subject] :posix :scase [URGENT]))
- IFTRUE:
- ADD HEADER[X-Comment] "This message is not URGENT (\1)."
- ADD HEADER[X-Comment] "GNU's Not Unix! (\1)"
- END COND
- COND: HEADER[X-Mailer] :posix [(.*)]
- IFTRUE:
- ADD HEADER[X-Comment] "My love \1"
- MODIFY HEADER :exact [X-Mailer] "The lousy mailer \1"
- END COND
- RULE: HEADER :posix [gpgd:(.*)]
- BODY
- ADD HEADER[X-GPG-Comment] "Encrypted for \1"
-ifdef(`WITH_GPG',` ASGN: gpg-encrypt = \1
-')`'dnl
- END RULE
- COND: HEADER[Subject] :posix [signature]
- IFTRUE:
- ASGN: signature-file-append = yes
- END COND
- COND: HEADER[Subject] :posix :scase [external]
- IFTRUE:
- ASGN: external-body-processor = /usr/bin/formail
- END COND
-ifdef(`WITH_GPG',` COND: HEADER[Subject] :posix [gpg-all]
- IFTRUE:
- ASGN: gpg-encrypt = USERNAME
- ASGN: gpg-sign = default
- END COND
- COND: HEADER[Subject] :posix [gpg-encrypt]
- IFTRUE:
- ASGN: gpg-encrypt = USERNAME-1,USERNAME-2,USERNAME-3
- END COND
- COND: HEADER[Subject] :posix [gpg-sign]
- IFTRUE:
- ASGN: gpg-sign = default
- END COND
-')`'dnl
-ifdef(`WITH_GUILE',` COND: HEADER[Subject] :posix [rot13-all]
- IFTRUE:
- ASGN: guile-process = rot-13 #:body
- ASGN: guile-process = rot-13 #:subject
- END COND
- COND: HEADER[Subject] :posix [rot13-body]
- IFTRUE:
- ASGN: guile-process = rot-13 #:body
- END COND
- COND: HEADER[Subject] :posix [rot13-subject]
- IFTRUE:
- ASGN: guile-process = rot-13 #:subject
- END COND
-')`'dnl
- COND: HEADER[Subject] :posix [body-append]
- IFTRUE:
- ASGN: body-append = misc/notes.txt
- END COND
- COND: HEADER[Subject] :posix [ALL]
- IFTRUE:
- ASGN: body-append = misc/notes.txt
-ifdef(`WITH_GPG',` ASGN: gpg-encrypt = USERNAME
-')`'dnl
-ifdef(`WITH_GUILE',` ASGN: guile-process = rot-13 #:body
- ASGN: guile-process = rot-13 #:subject
-')`'dnl
- END COND
-END SECTION RULE
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/target.in.in b/testsuite/etc/target.in.in
deleted file mode 100644
index df374a8..0000000
--- a/testsuite/etc/target.in.in
+++ b/dev/null
@@ -1,41 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-BEGIN CONTROL
-mode auth
-bind @ANUBIS_PORT@
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log ifdef(`WITH_GNUTLS',`\
- -c TOP_SRCDIR/testsuite/data/anubis.pem \
- -k TOP_SRCDIR/testsuite/data/anubis.pem')
-termlevel debug
-# Make sure root won't receive any spurious messages via syslog. If
-# make check is run by root, the following directive is ignored.
-logfile TESTDIR/etc/target.log
-loglevel all
-tracefile TESTDIR/etc/anubis.trace
-ifdef(`WITH_GNUTLS',`ssl yes
-ssl-key TOP_SRCDIR/testsuite/data/anubis.pem
-ssl-cert TOP_SRCDIR/testsuite/data/anubis.pem')
-END
-
-BEGIN AUTH
-sasl-password-db text://TESTDIR/data/text.db
-sasl-allowed-mech CRAM-MD5
-smtp-greeting-message "Hej, sloneczko"
-smtp-help-message "Czlowieku, dopomoz sobie sam!"
-END
diff --git a/testsuite/etc/tlsoneway.in b/testsuite/etc/tlsoneway.in
deleted file mode 100644
index 4e6dc71..0000000
--- a/testsuite/etc/tlsoneway.in
+++ b/dev/null
@@ -1,23 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log -c TOP_SRCDIR/testsuite/data/anubis.pem -k TOP_SRCDIR/testsuite/data/anubis.pem
-ssl-oneway yes
----END---
diff --git a/testsuite/etc/tlsoneway.pat b/testsuite/etc/tlsoneway.pat
deleted file mode 100644
index 1b83ba8..0000000
--- a/testsuite/etc/tlsoneway.pat
+++ b/dev/null
@@ -1,53 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST One-way TLS encryption
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE tlsoneway.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-EHLO localhost
-:ADD STARTTLS
-:ADD EHLO localhost
-:EXPECT 250-pleased to meet you
-:EXPECT 250 HELP
-MAIL FROM:<gray@gnu.org>
-:EXPECT 250
-RCPT TO:<polak@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <gray@gnu.org>
-To: <polak@gnu.org>
-Subject: The Tao of Programming, Part I
-
- A manager went to his programmers and told them: "As regards to your
-work hours: you are going to have to come in at nine in the morning and leave
-at five in the afternoon." At this, all of them became angry and several
-resigned on the spot.
- So the manager said: "All right, in that case you may set your own
-working hours, as long as you finish your projects on schedule." The
-programmers, now satisfied, began to come in a noon and work to the wee
-hours of the morning.
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
diff --git a/testsuite/etc/trigger.in b/testsuite/etc/trigger.in
deleted file mode 100644
index 62eadb4..0000000
--- a/testsuite/etc/trigger.in
+++ b/dev/null
@@ -1,35 +0,0 @@
-# -*- anubis -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
----BEGIN CONTROL---
-logfile TESTDIR/etc/anubis.log
-local-mta TESTDIR/mta -bs -d TESTDIR/etc/mta.log
----END---
-
----BEGIN RULE---
-
-trigger "^trigger1"
- add [X-Trigger-Test] "is the true path to nirvana..."
-done
-
-trigger "^trigger2 (.*) (.*)"
- add [X-Trigger-Test] "SMELLS LIKE \1 \2"
-done
-
----END---
-
diff --git a/testsuite/etc/trigger.pat b/testsuite/etc/trigger.pat
deleted file mode 100644
index d9be3d2..0000000
--- a/testsuite/etc/trigger.pat
+++ b/dev/null
@@ -1,74 +0,0 @@
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Anubis; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-:TEST Trigger mechanism
-:MODE SPAWN
-:OPTIONS --stdio
-:RCFILE trigger.rc
-:RETCODE 0
-:PATTERN
-:EXPECT 220
-HELO localhost
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-:DEL Subject: COME AS YOU ARE@@trigger1
-:ADD Subject: COME AS YOU ARE
-:ADD X-Trigger-Test: is the true path to nirvana...
-
-Come as you are, as you were
-As I want you to to be.
-As a friend, as a friend
-As an old enemy
-Take your time
-Hurry up, the choice is yours
-Don't be late.
-Take a rest, as a friend
-As an old memoria...
-
-.
-:EXPECT 250
-MAIL FROM:<polak@gnu.org>
-:EXPECT 250
-RCPT TO:<gray@gnu.org>
-:EXPECT 250
-DATA
-:EXPECT 354
-From: <polak@gnu.org>
-To: <gray@gnu.org>
-:DEL Subject: YOU KNOW YOU'RE RIGHT@@trigger2 TEEN SPIRIT
-:ADD Subject: YOU KNOW YOU'RE RIGHT
-:ADD X-Trigger-Test: SMELLS LIKE TEEN SPIRIT
-
-With the lights out, it's less dangerous
-Here we are now, entertain us
-I feel stupid, and contagious
-Here we are now, entertain us
-
-.
-:EXPECT 250
-QUIT
-:EXPECT 221
-:END PATTERN
-:END TEST
-
diff --git a/testsuite/findport.c b/testsuite/findport.c
deleted file mode 100644
index f8ea150..0000000
--- a/testsuite/findport.c
+++ b/dev/null
@@ -1,188 +0,0 @@
-/* This file is part of GNU Anubis.
- Copyright (C) 2001, 2003, 2007 Free Software Foundation, Inc.
-
- Written by Sergey Poznyakoff
-
- GNU Anubis is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- GNU Anubis is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with GNU Anubis. If not, see <http://www.gnu.org/licenses/>. */
-
-/*
- * This program is a part of test suite. It determines first N available
- * UDP ports to be used.
- * usage: findport [-c N][-s P][-m P][-f F]
- * Options are:
- * -c N Find first N not-used ports (default 1)
- * -s P Start from port P+1 (default 1024)
- * -m P Finish when port P is reached (default 65535)
- * -f F Use format string F for output.
- * Any subsequent occurence of characters %d in format string is replaced
- * with the found port number. Usual C backslash sequences are recognized.
- * All other characters encountered in format string are reproduced
- * verbatim.
- * If no format string is specified, the port numbers are printed one per
- * line of output.
- * Return value: 0 if OK, 1 on error.
- * Bugs: No check is made to ensure that the number of %d markers in format
- * string coincides with number N.
- */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <pwd.h>
-
-char *format = NULL;
-
-char *
-who_am_i()
-{
- struct passwd *pw = getpwuid(getuid());
- if (pw)
- return pw->pw_name;
- return "nobody";
-}
-
-void
-output(int port)
-{
- if (!format) {
- if (port)
- printf("%d\n", port);
- return;
- }
-
- while (*format) {
- if (port && format[0] == '%' && format[1] == 'd') {
- printf("%d", port);
- format += 2;
- break;
- } else if (format[0] == '%' && format[1] == 'u') {
- printf("%s", who_am_i());
- format += 2;
- } else if (format[0] == '\\' && format[1]) {
- switch (format[1]) {
- case 'a':
- putchar('\a');
- break;
- case 'b':
- putchar('\b');
- break;
- case 'n':
- putchar('\n');
- break;
- case 't':
- putchar('\t');
- break;
- case 'v':
- putchar('\v');
- break;
- case '\\':
- putchar('\\');
- break;
- default:
- putchar(format[0]);
- putchar(format[2]);
- break;
- }
- format += 2;
- } else
- putchar(*format++);
- }
-}
-
-int
-main(int argc, char **argv)
-{
- char *progname = argv[0];
- int local_port, max_port, num_ports;
- struct sockaddr salocal;
- struct sockaddr_in *sin;
- int fd;
-
- /* Process command line */
- local_port = 1024;
- max_port = 65535;
- num_ports = 1;
-
-#define OPTARG (*argv)[2] ? *argv+2 : *++argv
- while (*++argv) {
- if (**argv == '-') {
- switch ((*argv)[1]) {
- case 's':
- local_port = atoi(OPTARG);
- break;
- case 'm':
- max_port = atoi(OPTARG);
- break;
- case 'c':
- num_ports = atoi(OPTARG);
- break;
- case 'f':
- format = OPTARG;
- break;
- default:
- fprintf(stderr,
- "%s: unknown switch: %s\n",
- progname, *argv);
- return 1;
- }
- } else {
- fprintf(stderr,
- "%s: stray argument %s\n", progname, *argv);
- return 1;
- }
- }
-
- while (num_ports--) {
- int true = 1;
-
- fd = socket(AF_INET, SOCK_STREAM, 0);
- if (fd < 0) {
- fprintf(stderr,
- "%s: can't open socket: %d\n",
- progname, errno);
- return 1;
- }
-
- setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &true, sizeof (true));
-
- sin = (struct sockaddr_in *) &salocal;
- memset(sin, 0, sizeof (salocal));
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = INADDR_ANY;
-
- do {
- if (++local_port > max_port) {
- fprintf(stderr, "%s: can't bind socket\n",
- progname);
- return 1;
- }
- sin->sin_port = htons((u_short)local_port);
- } while ((bind(fd, &salocal, sizeof(struct sockaddr_in)) < 0) &&
- local_port < max_port);
- output(local_port);
- close(fd);
- }
- output(0);
- return 0;
-}
-
diff --git a/testsuite/lib/DISTFILES b/testsuite/lib/DISTFILES
deleted file mode 100644
index 34310f3..0000000
--- a/testsuite/lib/DISTFILES
+++ b/dev/null
@@ -1 +0,0 @@
-anubis.exp \ No newline at end of file
diff --git a/testsuite/lib/anubis.exp b/testsuite/lib/anubis.exp
deleted file mode 100644
index a691211..0000000
--- a/testsuite/lib/anubis.exp
+++ b/dev/null
@@ -1,970 +0,0 @@
-# -*- tcl -*-
-# This file is part of GNU Anubis testsuite.
-# Copyright (C) 2003-2014 The Anubis Team.
-#
-# GNU Anubis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Anubis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
-
-# Authmode support
-proc repl_port {file port} {
- global ANUBIS_RC_DIR
-
- set chan [open $ANUBIS_RC_DIR/$file.in.rc r]
- set outchan [open $ANUBIS_RC_DIR/$file.rc w]
- for {gets $chan line} {![eof $chan]} {gets $chan line} {
- regsub -all "@ANUBIS_PORT@" $line "$port" tmp
- puts $outchan $tmp
- }
- close $chan
- close $outchan
-}
-
-proc anubis_authmode {} {
- global ANUBIS_PID
- if ![info exists ANUBIS_PID] {
- return 0
- }
- verbose "AUTHMODE"
- return $ANUBIS_PID
-}
-
-proc start_daemon {} {
- global ANUBIS_TESTDIR
- global ANUBIS_RC_DIR
- global ANUBIS_TOOL
- global ANUBIS_PORT
- global ANUBIS_PID
-
- set port [remote_exec host $ANUBIS_TESTDIR/findport "-c1 -s1024 -f%d"]
- set ANUBIS_PORT [lindex $port 1]
- repl_port "target" $ANUBIS_PORT
- repl_port "interface" $ANUBIS_PORT
- set pidfile $ANUBIS_RC_DIR/anubis.pid
- file delete $pidfile
- remote_exec host "$ANUBIS_TOOL" \
- "--relax-perm-check \
- --pid-file $pidfile \
- --altrc $ANUBIS_RC_DIR/target.rc"
- set attempt 0
- while {![file exists $pidfile]} {
- incr attempt
- if {$attempt > 10} {
- fail "Cannot start anubis daemon"
- exit 1
- }
- sleep 1
- }
- set chan [open $pidfile r]
- gets $chan ANUBIS_PID
- verbose "Daemon PID $ANUBIS_PID"
- close $chan
-}
-
-proc kill_daemon {} {
- global ANUBIS_PID
-
- if {![info exists ANUBIS_PID]} {
- return
- }
-
- # Tcl has no kill primitive. The following Ruby Goldberg trick is
- # borrowed from DejaGNU (see remote.exp)
- verbose "Killing anubis daemon $ANUBIS_PID"
- exec sh -c "exec > /dev/null 2>&1 && \
- (kill -2 $ANUBIS_PID || kill -2 $ANUBIS_PID) && \
- sleep 5 && (kill -15 $ANUBIS_PID || kill $ANUBIS_PID) && \
- sleep 5 && (kill -9 $ANUBIS_PID || kill -9 $ANUBIS_PID)" &;
-}
-
-proc update_config {name} {
- global ANUBIS_PORT
- global ANUBIS_USR
- global ANUBIS_DATA_DIR
- global ANUBIS_RC_DIR
- global ANUBIS_ETC_DIR
- global verbose
-
- set rcname $ANUBIS_RC_DIR/$name
- set chan [open $rcname r]
- set outchan [open $rcname.tmp w]
- for {gets $chan line} {![eof $chan]} {gets $chan line} {
- switch -regexp -- "$line" {
- "^ *local-mta" { }
- ".*" {
- puts $outchan "$line"
- }
- }
- }
- close $outchan
- close $chan
-
- if {$verbose > 2} {
- set vopt "-vvv"
- } else {
- set vopt ""
- }
- set res [remote_exec host "$ANUBIS_USR" \
- "$vopt --netrc $ANUBIS_ETC_DIR/net.rc \
- --file $rcname.tmp localhost:$ANUBIS_PORT"]
- verbose -log "ANUBISUSR RESULT: $res"
- if {[llength $res] < 1} {
- return -1
- }
- return [lindex $res 0]
-}
-
-# Run given test script ($name) in authmode.
-proc run_in_authmode {name} {
- if [anubis_check_capability "GSASL"] {
- if [anubis_check_capability "GNUTLS"] {
- clone_output "Running $name in authmode over TLS."
- }
- start_daemon
- source $name
- kill_daemon
- } else {
- unsupported "$name in authmode"
- }
-}
-
-
-
-proc anubis_init {args} {
- global TOOL_EXECUTABLE
- global ANUBIS_TOOL
- global ANUBIS_RC_DIR
- global ANUBIS_ETC_DIR
- global ANUBIS_TOOL_FLAGS
- global ANUBIS_DATA_DIR
- global ANUBIS_TESTDIR
- global ANUBIS_SRCDIR
- global ANUBIS_TOP_SRCDIR
- global ANUBIS_USR
- global ANUBIS_ADM
- global ANUBIS_AUTHMODE
- global tool
- global base_dir
- global top_srcdir
- global objdir
- global host_board
- global srcdir
-
- if [info exists TOOL_EXECUTABLE] {
- set ANUBIS_TOOL $TOOL_EXECUTABLE
- }
-
- if {$args == "-authmode"} {
- set ANUBIS_AUTHMODE 1
- }
-
- if ![info exists ANUBIS_TOOL] {
- if ![is_remote host] {
- set ANUBIS_ADM [findfile $base_dir/../src/anubisadm "$base_dir/../src/anubisadm" [transform anubisadm]]
- set ANUBIS_USR [findfile $base_dir/../src/anubisusr "$base_dir/../src/anubisusr" [transform anubisusr]]
- set ANUBIS_TOOL [findfile $base_dir/../src/$tool "$base_dir/../src/$tool" [transform $tool]]
- set ANUBIS_SRCDIR "$srcdir"
- set ANUBIS_TOP_SRCDIR "$top_srcdir"
- set ANUBIS_TESTDIR "$objdir"
- set ANUBIS_DATA_DIR "$objdir/data"
- set ANUBIS_ETC_DIR "$top_srcdir/testsuite/etc"
- set ANUBIS_RC_DIR "$objdir/etc"
- } else {
- if [info exists host_board] {
- if [board_info $host_board exists top_builddir] {
- append ANUBIS_TOOL "[board_info $host_board top_builddir]/$tool/$tool"
- } elseif [board_info $host_board exists top_srcdir] {
- append ANUBIS_TOOL "[board_info $host_board top_srcdir]/$tool/$tool"
- }
- }
-
- if ![info exists ANUBIS_TOOL] {
- perror "The test suite is not set up for the remote testing"
- perror "Please, read file README in $tool/testsuite subdirectory"
- perror "for instructions on how to set up it."
- exit 1
- }
- set ANUBIS_SRCDIR "[board_info $host_board srcdir]"
- set ANUBIS_TOP_SRCDIR "[board_info $host_board top_srcdir]"
- set ANUBIS_TESTDIR "[board_info $host_board objdir]"
- set ANUBIS_ETC_DIR "[board_info $host_board top_srcdir]/testsuite/etc"
- set ANUBIS_DATA_DIR "[board_info $host_board objdir]/data"
- set ANUBIS_RC_DIR "[board_info $host_board objdir]/etc"
- }
-
- set ANUBIS_TOOL_FLAGS "--norc --relax-perm-check"
- }
-
- if {[info exists ANUBIS_AUTHMODE] && $ANUBIS_AUTHMODE} {
- start_daemon
- }
-}
-
-proc default_anubis_start {args} {
- global verbose
- global ANUBIS_TOOL
- global ANUBIS_TOOL_FLAGS
- global expect_out
- global anubis_spawn_id
-
- if [info exists ANUBIS_TOOL_FLAGS] {
- set sw $ANUBIS_TOOL_FLAGS
- } else {
- set sw ""
- }
-
- verbose "SW $sw"
- verbose "ARGS $args"
- if [llength $args] {
- append sw " " $args
- }
-
- set cmd "$ANUBIS_TOOL $sw"
- verbose "Spawning $cmd"
-
- set anubis_spawn_id [remote_spawn host $cmd]
- if { $anubis_spawn_id < 0 || $anubis_spawn_id == "" } {
- perror "Spawning $cmd failed."
- return 1;
- }
-
- return 0
-}
-
-# anubis_exec [-retcode N][-message S][-default (FAIL | XFAIL)][-arg S...]
-# [-pattern PATTERN-LIST][PATTERN...]
-#
-# Executes $ANUBIS_TOOL and checks whether it returns with the given exit
-# status and its output matches supplied PATTERN.
-# Switches:
-# -retcode N Expect program to finish with exit code N instead of the
-# default 0 (search for word 'Pity' below, though).
-# -arg S Supply additional arguments to the program.
-# -message S Set message to output when printing results of the test.
-# -default Supply the expected testcase result
-proc anubis_exec {args} {
- global verbose
- global ANUBIS_TOOL
- global ANUBIS_TOOL_FLAGS
- global expect_out
-
- if [info exists ANUBIS_TOOL_FLAGS] {
- set sw $ANUBIS_TOOL_FLAGS
- } else {
- set sw ""
- }
-
- default_anubis_version
-
- set default 0
- set message ""
- set result 0
- set retcode 0
- for {set i 0} {$i < [llength $args]} {incr i} {
- set opt [lindex $args $i]
- if {"$opt" == "-retcode"} {
- incr i
- set retcode [lindex $args $i]
- verbose "RETCODE $retcode" 1
- } elseif {"$opt" == "-message"} {
- incr i
- set message [lindex $args $i]
- } elseif {"$opt" == "-default"} {
- incr i
- set default [lindex $args $i]
- } elseif {"$opt" == "-arg"} {
- incr i
- append sw " [lindex $args $i]"
- } elseif {"$opt" == "-arg-list"} {
- incr i
- set s [lindex $args $i]
- for {set j 0} {$j < [llength $s]} {incr j} {
- append sw " [lindex $s $j]"
- }
- } elseif {"$opt" == "-pattern"} {
- incr i
- set pattern [lindex $args $i]
- } else {
- break
- }
- }
-
- if [info exists pattern] {
- set args [concat $pattern [lrange $args $i end]]
- } else {
- set args [lrange $args $i end]
- }
-
- # Pity, dejagnu provides no way to retrieve exit status of the process.
- # This ugly construction is used to work around this. Hopefully, it
- # should execute on any decent platform...
- set cmd "sh -c \"$ANUBIS_TOOL $sw\; echo \$?\""
- verbose "Executing $cmd"
-
- set res [remote_exec host $cmd]
-
- lappend args "$retcode"
-
- set output [lindex $res 1]
-
- if {[llength $args] == 0 && [string length $output] != 0} {
- verbose "Expected \"[lindex $args 1]\" but founf EOF" 1
- set result 1
- }
-
- for {set i 0} {$result == 0 && $i < [llength $args]} {incr i} {
- if {[string length $output] == 0} {
- verbose "Not enough output from $cmd" 1
- verbose "Stopped waiting for \"[lindex $args $i]\"" 1
- set result 1
- break
- }
- set regexp 0
-
- switch -exact -- "[lindex $args $i]" {
- -re { set regexp 1; incr i }
- -ex -
- -- { incr i }
- }
-
- set pattern [lindex $args $i]
- verbose "PATTERN $pattern"
-
- if {$regexp} {
- verbose "does \"$output\" match regular expression \"$pattern\"?" 1
- if {![regexp -- "${pattern}(.*)" "$output" dummy output]} {
- set result 1
- }
- } else {
- verbose "does \"$output\" match exact string \"$pattern\"?" 1
- if {"$pattern" != ""} {
- if {[string first "$pattern" "$output"] != 0} {
- set result 1
- }
- set output [string range $output [string length $pattern] end]
- }
- }
-
- if {![regexp -- "\[ \t]*\r\n(.*)" "$output" dummy output]} {
- set result 1
- }
-
- if {$result} {
- verbose "NO" 1
- } else {
- verbose "yes" 1
- }
- }
-
- if {$result == 0} {
- pass "$message"
- } elseif {$result == 1} {
- if { "$default" == "" || "$default" != "FAIL" } {
- fail "$message"
- } else {
- xfail "$message"
- set result 0
- }
- } elseif {$result == -2} {
- fail "$message (timeout)"
- } elseif {$result == -3} {
- fail "$message (eof)"
- } else {
- fail "$message"
- }
-
- return $result
-}
-
-proc default_anubis_version {} {
- global ANUBIS_TOOL
- global ANUBIS_TOOL_FLAGS
- global ANUBIS_TOOL_VERSION
- global ANUBIS_CAPABILITY
-
- if [info exists ANUBIS_TOOL_VERSION] {
- return
- }
- set output [remote_exec host "$ANUBIS_TOOL --show-config-options"]
- set flg [split [lindex $output 1]]
- for {set i 0} {$i < [llength $flg]} {incr i} {
- if [regexp "(.*)=(.*)$" [lindex $flg $i] var name value] {
- set ANUBIS_CAPABILITY($name) $value
- } elseif {[lindex $flg $i] != ""} {
- set ANUBIS_CAPABILITY([lindex $flg $i]) 1
- }
- }
- if [info exists ANUBIS_CAPABILITY(VERSION)] {
- set ANUBIS_TOOL_VERSION $ANUBIS_CAPABILITY(VERSION)
- } else {
- set ANUBIS_TOOL_VERSION "UNKNOWN"
- }
-}
-
-proc anubis_version {} {
- default_anubis_version
-}
-
-proc anubis_check_capability {args} {
- global ANUBIS_CAPABILITY
-
- set name [lindex $args 0]
-
- if {![info exists ANUBIS_CAPABILITY]} {
- anubis_init
- default_anubis_version
- }
-
- if {![info exists ANUBIS_CAPABILITY] || \
- ![info exists ANUBIS_CAPABILITY($name)]} {
- return 0
- } else {
- return $ANUBIS_CAPABILITY($name)
- }
-}
-
-proc anubis_send { string } {
- global suppress_flag;
- if {[info exists suppress_flag] && $suppress_flag} {
- return "suppressed";
- }
- return [remote_send host "$string"]
-}
-
-proc anubis_command { cmd } {
- set res [anubis_send "$cmd\n"]
- anubis_expect 30 {
- -ex "\r\n" { }
- default {
- perror "anubis_command for target failed";
- return -1
- }
- }
- verbose "RESULT: $res" 2
- return $res
-}
-
-proc default_anubis_stop {} {
- global anubis_spawn_id
- verbose -log "STOPPING ANUBIS"
- if {[info exists anubis_spawn_id] && $anubis_spawn_id > 0} {
- remote_close host
- unset anubis_spawn_id
- }
-}
-
-proc anubis_exit {} {
- default_anubis_stop
-}
-
-proc anubis_expect { args } {
- global env
- if { [lindex $args 0] == "-notransfer" } {
- set notransfer -notransfer;
- set args [lrange $args 1 end];
- } else {
- set notransfer "";
- }
-
- if { [llength $args] == 2 && [lindex $args 0] != "-re" } {
- set gtimeout [lindex $args 0];
- set expcode [list [lindex $args 1]];
- } else {
- upvar timeout timeout;
-
- set expcode $args;
- if [target_info exists anubis,timeout] {
- if [info exists timeout] {
- if { $timeout < [target_info anubis,timeout] } {
- set gtimeout [target_info anubis,timeout];
- } else {
- set gtimeout $timeout;
- }
- } else {
- set gtimeout [target_info anubis,timeout];
- }
- }
-
- if ![info exists gtimeout] {
- global timeout;
- if [info exists timeout] {
- set gtimeout $timeout;
- } else {
- # Eeeeew.
- set gtimeout 60;
- }
- }
- }
-
- global suppress_flag;
- global remote_suppress_flag;
- global verbose
- if [info exists remote_suppress_flag] {
- set old_val $remote_suppress_flag;
- }
- if [info exists suppress_flag] {
- if { $suppress_flag } {
- set remote_suppress_flag 1;
- }
- }
-
- verbose "EXPCODE is $expcode" 4
- verbose "RUNNING remote_expect host $gtimeout $notransfer" 2
-
- set code [catch \
- {uplevel remote_expect host $gtimeout $notransfer $expcode} string];
- if [info exists old_val] {
- set remote_suppress_flag $old_val;
- } else {
- if [info exists remote_suppress_flag] {
- unset remote_suppress_flag;
- }
- }
-
- if {$code == 1} {
- global errorInfo errorCode;
-
- return -code error -errorinfo $errorInfo -errorcode $errorCode $string
- } elseif {$code == 2} {
- return -code return $string
- } elseif {$code == 3} {
- return
- } elseif {$code > 4} {
- return -code $code $string
- }
-}
-
-proc anubis_expect_list {args} {
- set tmt [lindex $args 0]
- set pattern [lindex $args 1]
-
- set result 0
- for {set i 0} {$i < [llength $pattern]} {incr i} {
- set regexp 0
- switch -exact -- "[lindex ${pattern} $i]" {
- -re { set regexp 1; incr i }
- -- { incr i }
- }
-
- regsub "\[ \t\]*$" [lindex ${pattern} $i] "" pat
- verbose "i=$i, pat=$pat, regexp=$regexp" 2
-
- if {$regexp} {
- verbose "REGEX for $pat / [llength $pat] " 3
- anubis_expect $tmt {
- -re $pat { }
- default {
- set result 1
- break
- }
- timeout {
- set result -2
- break
- }
- eof {
- set result -3
- break
- }
- }
- } else {
- anubis_expect $tmt {
- -ex "$pat" {
- if { $expect_out(buffer) != $expect_out(0,string) } {
- verbose "Got \"$expect_out(buffer)\"" 2
- verbose "instead of expected \"$pat\\r\\n\"" 2
- set result 1
- break
- }
- }
- default {
- set result 1
- break
- }
- timeout {
- set result -2
- break
- }
- eof {
- set result -3
- break
- }
- }
- }
- if {$result == 0} {
- anubis_expect $tmt {
- -re "^\[ \t]*\r\n" { }
- default { set result 1 }
- timeout { set result -2 }
- eof { set result -3 }
- }
- }
- }
- return $result
-}
-
-# anubis_test COMMAND PATTERN
-# COMMAND - Command to send to the program
-# PATTERN - A list of strings to expect in return
-# Return value:
-# -3 - eof
-# -2 - timeout
-# -1 - generic failure
-# 1 - test fails
-# 0 - test succeeds
-proc anubis_test { args } {
- global verbose
- global suppress_flag
- upvar timeout timeout
-
- set command [lindex $args 0]
- set pattern [lindex $args 1]
-
- if { [info exists suppress_flag] && $suppress_flag } {
- set do_suppress 1
- } else {
- set do_suppress 0
- }
-
- if $verbose>2 then {
- send_user "Command: \"$command\"\n"
- send_user "Pattern: \"$pattern\"\n"
- }
-
- set result -1
- if { "${command}" != "" } {
- set res [anubis_command "${command}"]
- if { $res != "" } {
- if { ! $do_suppress } {
- perror "Couldn't send \"$command\": $res.";
- }
- return $result;
- }
- }
-
- if [info exists timeout] {
- set tmt $timeout;
- } else {
- global timeout;
- if [info exists timeout] {
- set tmt $timeout;
- } else {
- set tmt 60;
- }
- }
-
- set result 0
- for {set i 0} {$result == 0 && $i < [llength $pattern]} {incr i} {
- verbose "NEXT ($i)"
- set regexp 0
- switch -exact -- "[lindex ${pattern} $i]" {
- -re { set regexp 1; incr i }
- -- { incr i }
- }
-
- regsub "\[ \t\]*$" [lindex ${pattern} $i] "" pat
- verbose "i=$i, pat=$pat, regexp=$regexp" 2
-
- if {$regexp} {
- anubis_expect $tmt {
- -re "$pat\[ \r\t\]*\r\n" { }
- default {
- set result 1
- break
- }
- timeout {
- set result -2
- break
- }
- eof {
- set result -3
- break
- }
- }
- } else {
- anubis_expect $tmt {
- -ex "$pat" {
- if { $expect_out(buffer) != $expect_out(0,string) } {
- verbose "Got \"$expect_out(buffer)\"" 2
- verbose "instead of expected \"$pat\\r\\n\"" 2
- set result 1
- break
- }
- }
- default {
- set result 1
- break
- }
- timeout {
- set result -2
- break
- }
- eof {
- set result -3
- break
- }
- }
-
- if {$result == 0} {
- anubis_expect $tmt {
- -re "^\[ \t]*\r\n" { }
- default { set result 1 }
- timeout { set result -2 }
- eof { set result -3 }
- }
- }
- }
- }
- return $result
-}
-
-proc anubis_test_file {args} {
- global verbose
-
- set default ""
- set message ""
- set catprog "/bin/cat"
-
- for {set i 0} {$i < [llength $args]} {incr i} {
- set a [lindex $args $i]
- if {"$a" == "-default"} {
- incr i
- set default [lindex $args $i]
- } elseif {"$a" == "-pattern"} {
- incr i
- set pattern [lindex $args $i]
- } elseif {"$a" == "-message"} {
- incr i
- set message [lindex $args $i]
- } elseif {"$a" == "-catprog"} {
- incr i
- set catprog [lindex $args $i]
- } else {
- set args [lrange $args $i end]
- break
- }
- }
-
- if {"$message" == ""} {
- set message "Contents of [lindex $args 0]"
- }
-
- if $verbose>2 then {
- send_user "Message is \"$message\"\n"
- }
-
- set filename [lindex $args 0]
- if ![info exists pattern] {
- set pattern [lrange $args 1 end]
- }
-
- set res [remote_spawn host "$catprog $filename"]
- if { $res < 0 || $res == "" } {
- perror "Reading $filename failed."
- return 1;
- }
- set result [anubis_test "" $pattern]
- if {$result == 0} {
- pass "$message"
- } elseif {$result == 1} {
- if { "$default" == "" || "$default" != "FAIL" } {
- fail "$message"
- } else {
- xfail "$message"
- set result 0
- }
- } elseif {$result == -2} {
- fail "$message (timeout)"
- } elseif {$result == -3} {
- fail "$message (eof)"
- } else {
- fail "$message"
- }
- remote_close host
- return $result
-}
-
-# State map:
-# 0 -- command
-# 1 -- pattern
-proc anubis_pat {patname} {
- global ANUBIS_DATA_DIR
- global ANUBIS_ETC_DIR
- global ANUBIS_RC_DIR
- global gpg_prog
-
- verbose "ANUBIS_PAT $patname" 1
- if ![regexp "^/.*" $patname x y] {
- set patname "$ANUBIS_ETC_DIR/$patname"
- }
- set chan [open $patname r]
- set state 0
- set options ""
- set testname ""
- set mode ""
- set retcode 0
- set rcfile ""
- for {gets $chan line} {![eof $chan]} {gets $chan line} {
- verbose "LINE $line" 1
- if { $state == 0 } {
- switch -regexp -- "$line" {
- "^#.*" { }
- "^:TEST" {
- regexp "^:TEST (.*)" $line dummy testname
- }
- "^:MODE" {
- regexp "^:MODE (.*)" $line dummy mode
- }
- "^:OPTIONS" {
- regexp "^:OPTIONS (.*)" $line dummy opt
- set x [split $opt]
- for {set n 0} {$n < [llength $x]} {incr n} {
- set opt [lindex $x $n]
- switch -re -- "$opt" {
- "^\\$.*" { lappend options [expr $opt] }
- default { if {$opt != ""} {
- lappend options $opt
- }
- }
- }
- }
- }
- "^:RCFILE" {
- regexp "^:RCFILE (.*)" $line dummy rcfile
- if [anubis_authmode] {
- # If we're acting in authmode, update the user's
- # config and use the interface configuration
- if [update_config $rcfile] {
- fail $testname
- return
- }
- set rcfile "interface.rc"
- }
- }
- "^:RETCODE" {
- regexp "^:RETCODE (.*)" $line dummy retcode
- }
- "^:PATTERN" {
- set state 1
- }
- "^:END" {
- verbose "MODE $mode"
- if {$mode == "EXEC"} {
- set inv anubis_exec
- if {$options != ""} {
- lappend inv -arg $options
- }
- if {$rcfile != ""} {
- lappend inv -arg "--altrc $ANUBIS_RC_DIR/$rcfile"
- }
- if {$retcode != 0} {
- lappend inv -retcode $retcode
- }
- if {$testname != ""} {
- lappend inv -message $testname
- }
- eval $inv $pattern
- } elseif {$mode == "SPAWN"} {
- set inv default_anubis_start
- if {$options != ""} {
- lappend inv $options
- }
- if {$rcfile != ""} {
- lappend inv --altrc "$ANUBIS_RC_DIR/$rcfile"
- }
- verbose "RUN $inv"
- eval $inv
-
- set file_pattern ""
- for {set pat $pattern} \
- {[llength $pat] > 0} \
- {set pat [lrange $pat 1 end]} {
-
- set line [lindex $pat 0]
- if [regexp "^:EXPECT (\[0-9\]\[0-9\]*)" $line dummy expect] {
- anubis_expect {-re "$expect \[^\n\]*\n"}
- } elseif [regexp "^:EXPECT (.*)" $line dummy expect] {
- anubis_expect {-re "$expect\[^\n\]*\n"}
- } elseif [regexp "^:ADD (.*)" $line dummy expect] {
- if [regexp "^-- (.*)" $expect dummy str] {
- lappend file_pattern "--"
- set expect $str
- } elseif [regexp "^-re (.*)" $expect dummy str] {
- lappend file_pattern "-re"
- set expect $str
- }
- lappend file_pattern "$expect"
- } elseif [regexp "^:DEL (.*)" $line dummy expect] {
- verbose "DEL:: $expect"
- anubis_command "$expect"
- } else {
- anubis_command "$line"
- lappend file_pattern $line
- }
- }
-
- default_anubis_stop
-
- set inv anubis_test_file
- if {$testname != ""} {
- lappend inv -message $testname
- }
- lappend inv "$ANUBIS_RC_DIR/mta.log"
- eval $inv $file_pattern
- } elseif {$mode == "CAT"} {
- verbose "OPT $options"
- set inv anubis_test_file
- lappend inv -catprog [concat $options]
- lappend inv "$ANUBIS_RC_DIR/mta.log"
- eval $inv $pattern
- }
- ## Reset all variables
- set pattern ""
- set file_pattern ""
- set options ""
- set testname ""
- set mode ""
- set retcode 0
- set rcfile ""
- }
- }
- } else {
- switch -regexp -- "$line" {
- "^HELO" {
- if {[anubis_authmode]} {
- regexp "^HELO *(\[^ \t\]*)" $line dummy rest
- verbose "REST $rest"
- lappend pattern "EHLO $rest"
- if [anubis_check_capability "GNUTLS"] {
- lappend pattern ":ADD STARTTLS"
- lappend pattern ":ADD EHLO $rest"
- }
- verbose "PATTERN $pattern"
- } else {
- lappend pattern $line
- }
- }
- "^:END" { set state 0 }
- "^-- (.*)" {
- regexp "^-- (.*)" $line dummy str
- lappend pattern "--" $str
- }
- "^-re (.*)" {
- regexp "^-re (.*)" $line dummy str
- lappend pattern "-re" $str
- }
- default { lappend pattern $line }
- }
- }
- }
-}
-
-# End of anubis.exp

Return to:

Send suggestions and report system problems to the System administrator.