From: Bob Hauck To: jim@reptiles.org Subject: Smail 3.2.0.102 rbl patch Here's the patch I made for RBL against smail 3.2.0.102. They have made some changes that broke one part of your patch for 101. Thought you might want to add it to your web that's linked from vix.com. diff -u smail-3.2.0.102.orig/src/config.c smail-3.2.0.102/src/config.c --- smail-3.2.0.102.orig/src/config.c Sat Apr 11 17:30:13 1998 +++ smail-3.2.0.102/src/config.c Sat Aug 22 11:44:45 1998 @@ -28,6 +28,7 @@ #endif char *listen_name = NULL; /* DNS name of interface to listen on */ +char *rbl_domain = NULL; /* DNS domain for RBL lockout */ char *visible_name = VISIBLE_NAME; /* hostname used in outgoing addrs */ char *visible_domains = VISIBLE_DOMAINS; /* domain used in outgoing headers */ char *uucp_name = UUCP_NAME; /* hostname used in !-routes */ diff -u smail-3.2.0.102.orig/src/extern.h smail-3.2.0.102/src/extern.h --- smail-3.2.0.102.orig/src/extern.h Sun Feb 15 14:12:33 1998 +++ smail-3.2.0.102/src/extern.h Sat Aug 22 11:52:04 1998 @@ -25,6 +25,7 @@ /* external variables defined in config.c */ extern char *listen_name; /* DNS name of interface to listen on */ +extern char *rbl_domain; /* DNS name for RBL lockout */ extern char *visible_name; /* hostname used in outgoing addrs */ extern char *visible_domains; /* domain used in outgoing headers */ extern char *uucp_name; /* hostname used in !-routes */ diff -u smail-3.2.0.102.orig/src/smailconf.c smail-3.2.0.102/src/smailconf.c --- smail-3.2.0.102.orig/src/smailconf.c Sat Oct 18 08:57:54 1997 +++ smail-3.2.0.102/src/smailconf.c Sat Aug 22 11:44:45 1998 @@ -91,6 +91,7 @@ { "hostnames", t_string, NULL, (tup *)&hostnames, 0 }, { "hostname", t_string, NULL, (tup *)&hostnames, 0 }, { "listen_name", t_string, NULL, (tup *)&listen_name, 0 }, + { "rbl_domain", t_string, NULL, (tup *)&rbl_domain, 0 }, { "lock_by_name", t_boolean, NULL, (tup *)&lock_by_name, 0 }, { "lock_mode", t_mode, NULL, (tup *)&lock_mode, 0 }, { "log_mode", t_mode, NULL, (tup *)&log_mode, 0 }, diff -u smail-3.2.0.102.orig/src/smtprecv.c smail-3.2.0.102/src/smtprecv.c --- smail-3.2.0.102.orig/src/smtprecv.c Sun Jun 7 19:02:07 1998 +++ smail-3.2.0.102/src/smtprecv.c Sat Aug 22 11:54:20 1998 @@ -207,6 +207,9 @@ struct sockaddr_in from_sa; int from_sa_len = sizeof(from_sa); struct hostent *shp = NULL; /* result of gethostbyaddr() */ + char *rbl_addr; + char rbl_host[128]; + struct hostent *rbl_p = NULL; # ifndef OBSOLETE_RESOLVER extern int h_errno; /* import h_errno; many systems don't define it in */ @@ -324,7 +327,28 @@ sender_host_addr ? sender_host_addr : "", sender_host_really ? sender_host_really : "", smtp_local_net ? smtp_local_net : ""); + + if (sender_host_addr && rbl_domain) { + rbl_addr = (unsigned char *)&from_sa.sin_addr; + + sprintf(rbl_host, "%d.%d.%d.%d.%s", + rbl_addr[3] & 0xff, + rbl_addr[2] & 0xff, + rbl_addr[1] & 0xff, + rbl_addr[0] & 0xff, + rbl_domain); + + if ((rbl_p = gethostbyname(rbl_host)) != NULL) { + fprintf(out, "550 You are not permitted to send mail - %s\r\n", + rbl_host); + fflush(out); + write_log(WRITE_LOG_SYS, "connection refused from %s because of RBL", + inet_ntoa(from_sa.sin_addr)); + smtp_sig_unlink(1); + } +} #endif /* HAVE_BSD_NETWORKING */ + /* Set the protocol used - this used to be in the HELO code, but that gives * problems if the sender never says HELO