Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152203824
D6595.id18063.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D6595.id18063.diff
View Options
Index: Makefile
===================================================================
--- Makefile
+++ Makefile
@@ -44,7 +44,7 @@
BASEMAIL= /usr/libexec/sendmail/sendmail
MILTER_SOVER?= 6
-OPTIONS_DEFINE?= SHMEM SEM LA NIS IPV6 TLS SASL SASLAUTHD LDAP BDB SOCKETMAP CYRUSLOOKUP PICKY_HELO_CHECK MILTER DOCS
+OPTIONS_DEFINE?= SHMEM SEM LA NIS IPV6 TLS SASL SASLAUTHD LDAP BDB SOCKETMAP CYRUSLOOKUP BLACKLISTD PICKY_HELO_CHECK MILTER DOCS
OPTIONS_DEFAULT?= SHMEM SEM LA NIS IPV6 TLS SASL SASLAUTHD PICKY_HELO_CHECK MILTER
NO_OPTIONS_SORT=yes
SHMEM_DESC= System V shared memory support
@@ -53,6 +53,7 @@
SASLAUTHD_DESC= SASLAUTHD support
BDB_DESC= Berkeley DB version 4 support
SOCKETMAP_DESC= Enable socketmap feature
+BLACKLISTD_DESC= Enable blacklistd support
CYRUSLOOKUP_DESC= Enable cyruslookup feature
PICKY_HELO_CHECK_DESC= Enable picky HELO check
MILTER_DESC= Enable milter support
@@ -116,6 +117,9 @@
.if ${PORT_OPTIONS:MLDAP}
SITE+= ${FILESDIR}/site.config.m4.ldap
.endif
+.if ${PORT_OPTIONS:MBLACKLISTD}
+SITE+= ${FILESDIR}/site.config.m4.blacklistd
+.endif
.if ${PORT_OPTIONS:MMILTER}
SITE+= ${FILESDIR}/site.config.m4.milter
.endif
Index: files/patch-daemon.c
===================================================================
--- /dev/null
+++ files/patch-daemon.c
@@ -0,0 +1,13 @@
+--- sendmail/daemon.c.orig 2016-06-12 18:25:14.196269000 -0400
++++ sendmail/daemon.c 2016-06-12 18:31:47.159880000 -0400
+@@ -754,6 +754,10 @@
+ anynet_ntoa(&RealHostAddr));
+ }
+
++#ifdef USE_BLACKLIST
++ blacklist_init();
++#endif
++
+ if (pipefd[0] != -1)
+ {
+ auto char c;
Index: files/patch-main.c
===================================================================
--- /dev/null
+++ files/patch-main.c
@@ -0,0 +1,26 @@
+--- sendmail/main.c.orig 2016-06-12 18:24:56.170900000 -0400
++++ sendmail/main.c 2016-06-12 18:30:07.426701000 -0400
+@@ -4642,3 +4642,23 @@
+ sm_etype_printf,
+ "quick abort %0",
+ };
++
++#ifdef USE_BLACKLIST
++static struct blacklist *blstate;
++
++void
++blacklist_init(void)
++{
++ blstate = blacklist_open();
++}
++
++void
++blacklist_notify(int a, int fd, char *msg)
++{
++ if (blstate == NULL)
++ blacklist_init();
++ if (blstate == NULL)
++ return;
++ (void)blacklist_r(blstate, a, fd, msg);
++}
++#endif
Index: files/patch-sendmail.h
===================================================================
--- /dev/null
+++ files/patch-sendmail.h
@@ -0,0 +1,15 @@
+--- sendmail/sendmail.h.orig 2016-06-12 18:23:05.239106000 -0400
++++ sendmail/sendmail.h 2016-06-12 18:42:38.972341000 -0400
+@@ -2647,6 +2647,12 @@
+ extern char *milter_unknown __P((char *, ENVELOPE *, char *));
+ #endif /* MILTER */
+
++#if USE_BLACKLIST
++/* blacklistd functions */
++void blacklist_init(void);
++void blacklist_notify(int, int, char *);
++#endif
++
+ extern char *addquotes __P((char *, SM_RPOOL_T *));
+ extern char *arpadate __P((char *));
+ extern bool atobool __P((char *));
Index: files/patch-srvrsmtp.c
===================================================================
--- /dev/null
+++ files/patch-srvrsmtp.c
@@ -0,0 +1,44 @@
+--- sendmail/srvrsmtp.c.orig 2015-03-18 07:47:12.000000000 -0400
++++ sendmail/srvrsmtp.c 2016-06-12 18:36:01.372172000 -0400
+@@ -832,6 +832,9 @@
+ int n_badrcpts_adj;
+ #endif /* _FFR_BADRCPT_SHUTDOWN */
+
++#ifdef USE_BLACKLIST
++ int fd;
++#endif
+ SevenBitInput_Saved = SevenBitInput;
+ smtp.sm_nrcpts = 0;
+ #if MILTER
+@@ -1328,6 +1331,9 @@
+ (int) tp.tv_sec +
+ (tp.tv_usec >= 500000 ? 1 : 0)
+ );
++#ifdef USE_BLACKLIST
++ blacklist_notify(1, fd, "pre-greeting traffic");
++#endif
+ }
+ }
+ }
+@@ -1723,6 +1729,10 @@
+ {
+ /* not SASL_OK or SASL_CONT */
+ message("535 5.7.0 authentication failed");
++#ifdef USE_BLACKLIST
++ fd = sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL);
++ blacklist_notify(1, fd, "AUTH FAIL");
++#endif
+ if (LogLevel > 9)
+ sm_syslog(LOG_WARNING, e->e_id,
+ "AUTH failure (%s): %s (%d) %s, relay=%.100s",
+@@ -3524,6 +3534,10 @@
+ if (++n_badcmds > MAXBADCOMMANDS)
+ {
+ stopattack:
++#ifdef USE_BLACKLIST
++ fd = sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL);
++ blacklist_notify(1, fd, "too many bad commands");
++#endif
+ message("421 4.7.0 %s Too many bad commands; closing connection",
+ MyHostName);
+
Index: files/patch-usersmtp.c
===================================================================
--- /dev/null
+++ files/patch-usersmtp.c
@@ -0,0 +1,29 @@
+--- sendmail/usersmtp.c.orig 2014-12-05 10:42:28.000000000 -0500
++++ sendmail/usersmtp.c 2016-06-12 18:35:25.940865000 -0400
+@@ -1825,6 +1825,10 @@
+
+ if (saslresult != SASL_OK && saslresult != SASL_CONTINUE)
+ {
++#ifdef USE_BLACKLIST
++ int fd = sm_io_getinfo(mci->mci_in, SM_IO_WHAT_FD, NULL);
++ blacklist_notify(1, fd, "AUTH FAIL");
++#endif
+ if (tTd(95, 5))
+ sm_dprintf("AUTH FAIL=%s (%d)\n",
+ sasl_errstring(saslresult, NULL, NULL),
+@@ -1970,9 +1974,13 @@
+ do
+ {
+ result = attemptauth(m, mci, e, &(mci->mci_sai));
+- if (result == EX_OK)
++ if (result == EX_OK) {
++#ifdef USE_BLACKLIST
++ int fd = sm_io_getinfo(mci->mci_in, SM_IO_WHAT_FD, NULL);
++ blacklist_notify(0, fd, "AUTH OK");
++#endif
+ mci->mci_sasl_auth = true;
+- else if (result == EX_TEMPFAIL || result == EX_NOPERM)
++ } else if (result == EX_TEMPFAIL || result == EX_NOPERM)
+ {
+ mci->mci_saslcap = removemech((mci->mci_sai)[SASL_MECH],
+ mci->mci_saslcap,
Index: files/site.config.m4.blacklistd
===================================================================
--- /dev/null
+++ files/site.config.m4.blacklistd
@@ -0,0 +1,2 @@
+APPENDDEF(`conf_sendmail_ENVDEF', `-DUSE_BLACKLIST')
+APPENDDEF(`conf_sendmail_LIBS', `-lblacklist')
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 14, 10:00 AM (16 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31467021
Default Alt Text
D6595.id18063.diff (5 KB)
Attached To
Mode
D6595: Add blacklist support to sendmail
Attached
Detach File
Event Timeline
Log In to Comment