#!/bin/sh
# This is a shell archive (shar 3.24)
# made 03/05/1994 10:46 UTC by root@mamunx
# Source directory /tmp
#
# existing files WILL be overwritten
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1482 -rw-rw-rw- README
# 6163 -rw------- patch.recv
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= README ==============
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XUeberwachung von Zieladressen bei ankommenden SMTP Verbindungen
X
XProgramm:
X smail 3.1-28 mit Patches fuer ESMTP
X
XFunktion:
X Adressen aus der <RCPT TO:> Liste werden auf Auslieferbarkeit
X geprueft und die Mail wird ggf. *vor* der Uebertragung abgelehnt.
X
XVorteile:
X Normalerweise nimmt smail jede Mail an und delivered im Hinter-
X grund.
X Ist eine Mail nicht zustellbar, so generiert er eine Fehlermail
X an den Absender und an den Postmaster.
X
X Da viele Provider fuer internationalen Transfer Kosten erheben,
X entstehen im Fehlerfalle sogar doppelte Gebuehren.
X Wird die Mail gar nicht uebertragen, generiert der Provider die
X Fehlermeldung und die Volumengebuehren entfallen.
X Bei Waehlleitungen spart man ausserdem noch ein paar Einheiten...
X
X
XNachteile:
X Um die Adresse zu verifizieren muss expand_addr() aufgerufen
X werden (expand_addr() ueberprueft auch lokale Namen, verify_addr()
X nur externe Connectivity).
X Leider scheint expand_addr() interne Variablen zu modifizieren,
X so dass nach einmaligem Aufruf die Mail nicht mehr ausgeliefert
X werden kann.
X Deshalb forked der Patch und wertet den Exit Wert des Kindes aus.
X (war einfacher, als die Seiteneffekte zu suchen :-) )
X Da alle Datenbanken durchsucht werden, kann die Aktion speicher-
X und rechenintensiv sein, vor langsamen Maschinen wird gewarnt...
X
XInstallation:
X man gehe in das smail Source Verzeichnis und rufe
X patch -p0 <patch.recv
X auf.
X Danach noch ein nettes
X make install
X und man sollte fertig sein...
X
X
SHAR_EOF
$TOUCH -am 0305114594 README &&
chmod 0666 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "1482"; then
echo original size 1482, current size $Wc_c
fi
# ============= patch.recv ==============
echo "x - extracting patch.recv (Text)"
sed 's/^X//' << 'SHAR_EOF' > patch.recv &&
Xstart of patch 05-Mar-1994
X(suggested archive name: pch05Mar94.Z)
XIt should be applied by changing directory to the root
Xof the source tree and using the command:
X patch -p0 < this_file
X
X*** src/smtprecv.c.old Fri Mar 4 19:53:56 1994
X--- src/smtprecv.c Fri Mar 4 20:25:59 1994
X***************
X*** 52,59 ****
X /* functions local to this file */
X static void reset_state();
X static enum e_smtp_commands read_smtp_command();
X! static void expand_addr();
X! static void verify_addr();
X static void smtp_input_signals();
X static void smtp_processing_signals();
X static void set_term_signal();
X--- 52,59 ----
X /* functions local to this file */
X static void reset_state();
X static enum e_smtp_commands read_smtp_command();
X! static int expand_addr();
X! static int verify_addr();
X static void smtp_input_signals();
X static void smtp_processing_signals();
X static void set_term_signal();
X***************
X*** 395,403 ****
X--- 395,415 ----
X cur = alloc_addr();
X if (out) {
X if (cur->work_addr = preparse_address(data, &error)) {
X+ /* MAM 4.12.93 check for delivery chance */
X+ if (test_addr(cur->work_addr, out)==FALSE)
X+ {
X+ fflush(out);
X+ write_log(LOG_SYS, "SMTP message from %s to %s deferred.",
X+ sender,
X+ cur->work_addr);
X+ xfree(cur);
X+ break;
X+ }
X+ /*
X fprintf(out, "250 <%s> ... Recipient Okay\r\n",
X cur->work_addr);
X fflush(out);
X+ */
X } else {
X fprintf(out, "501 <%s> ... %s\r\n", data, error);
X fflush(out);
X***************
X*** 730,736 ****
X *
X * display the list of items that an address expands to.
X */
X! static void
X expand_addr(in_addr, out)
X char *in_addr; /* input address string */
X FILE *out; /* write expansion here */
X--- 742,748 ----
X *
X * display the list of items that an address expands to.
X */
X! static int
X expand_addr(in_addr, out)
X char *in_addr; /* input address string */
X FILE *out; /* write expansion here */
X***************
X*** 747,753 ****
X if (addr->work_addr == NULL) {
X fprintf(out, "501 %s ... %s\r\n", in_addr, error);
X fflush(out);
X! return;
X }
X
X /* cache directors and routers on the assumption we will need them again */
X--- 759,765 ----
X if (addr->work_addr == NULL) {
X fprintf(out, "501 %s ... %s\r\n", in_addr, error);
X fflush(out);
X! return FALSE;
X }
X
X /* cache directors and routers on the assumption we will need them again */
X***************
X*** 774,782 ****
X }
X /* the last one should not begin with 250- */
X fprintf(out, "250 %s\r\n", cur->in_addr);
X } else {
X /* just say we couldn't find it */
X! fprintf(out, "550 %s ... not matched\r\n", in_addr);
X }
X }
X
X--- 786,798 ----
X }
X /* the last one should not begin with 250- */
X fprintf(out, "250 %s\r\n", cur->in_addr);
X+ fflush(out);
X+ return TRUE;
X } else {
X /* just say we couldn't find it */
X! fprintf(out, "550 %s ... not deliverable\r\n", in_addr);
X! fflush(out);
X! return FALSE;
X }
X }
X
X***************
X*** 785,791 ****
X *
X * redisplay the input address if it is a valid address.
X */
X! static void
X verify_addr(in_addr, out)
X char *in_addr; /* input address string */
X FILE *out; /* write expansion here */
X--- 801,807 ----
X *
X * redisplay the input address if it is a valid address.
X */
X! static int
X verify_addr(in_addr, out)
X char *in_addr; /* input address string */
X FILE *out; /* write expansion here */
X***************
X*** 802,808 ****
X if (addr->work_addr == NULL) {
X fprintf(out, "501 %s ... %s\r\n", in_addr, error);
X fflush(out);
X! return;
X }
X
X /* cache directors and routers on the assumption we will need them again */
X--- 818,824 ----
X if (addr->work_addr == NULL) {
X fprintf(out, "501 %s ... %s\r\n", in_addr, error);
X fflush(out);
X! return FALSE;
X }
X
X /* cache directors and routers on the assumption we will need them again */
X***************
X*** 818,823 ****
X--- 834,842 ----
X
X if (okay) {
X fprintf(out, "250 %s\r\n", in_addr);
X+ fflush(out);
X+ return TRUE;
X+
X } else if (defer) {
X fprintf(out, "550 %s ... cannot verify: %s\r\n", in_addr,
X defer->error->message);
X***************
X*** 828,833 ****
X--- 847,855 ----
X /* hmmm, it should have been in one of the lists */
X fprintf(out, "550 %s ... not matched\r\n", in_addr);
X }
X+ fflush(out);
X+ return FALSE;
X+
X }
X #endif /* NO_VERIFY */
X
X***************
X*** 925,928 ****
X--- 947,977 ----
X }
X unlink_spool();
X exit(EX_OSFILE);
X+ }
X+
X+ static int test_addr(in_addr, out)
X+ char *in_addr; /* input address string */
X+ FILE *out; /* write expansion here */
X+ {
X+ /* MAM: brute force! expand_addr() seems to modify static data
X+ thus preventing the message to be delivered :-(((
X+ cannot find side effect, so fork() is the last resort
X+ the output of expand_addr will go to our smtp channel
X+ because fork() dups the out file!
X+ */
X+ int pid,status,ret;
X+
X+ switch (pid=fork()) {
X+ case -1: write_log(LOG_SYS,"FATAL: fork failed at test_addr");
X+ return TRUE; /* pretend to be friendly */
X+ case 0: exit(expand_addr(in_addr,out,550)==FALSE);
X+ default: while((ret=wait(&status))!=pid) {
X+ if (ret<0) {
X+ write_log(LOG_SYS,"FATAL: wait returned -1 Errno=%d",errno);
X+ return TRUE;
X+ }
X+ }
X+ return ((status>>8)==0);
X+ }
X+ return FALSE;
X }
SHAR_EOF
$TOUCH -am 0305113294 patch.recv &&
chmod 0600 patch.recv ||
echo "restore of patch.recv failed"
set `wc -c patch.recv`;Wc_c=$1
if test "$Wc_c" != "6163"; then
echo original size 6163, current size $Wc_c
fi
exit 0
--
* /\/\ichael /\ndreas /\/\eiszl | Tomsonstr 25 | 59071 Hamm | Tel
+492381980131 *
*
m...@mamunx.garmhausen.de <EUNET X.400 EUNET>
m...@werries.de *
* \C=US \A=ATTMAIL \P=Garmhausen \O=GuPS \G=Michael \I=A \S=Meiszl *