# HG changeset patch # User Carl Byington # Date 1474501640 25200 # Node ID f7c5cfb76e8654a002ac1dfac94721e941944664 # Parent 6fbe3c81376b660e4ddc7257ce43e04eaebc2b20 better smtp verify logging diff -r 6fbe3c81376b -r f7c5cfb76e86 ChangeLog --- a/ChangeLog Mon Sep 19 13:22:53 2016 -0700 +++ b/ChangeLog Wed Sep 21 16:47:20 2016 -0700 @@ -1,3 +1,6 @@ +6.47 2016-09-21 + Better smtp verify logging + 6.46 2016-09-19 Enable smtp verify logging diff -r 6fbe3c81376b -r f7c5cfb76e86 NEWS --- a/NEWS Mon Sep 19 13:22:53 2016 -0700 +++ b/NEWS Wed Sep 21 16:47:20 2016 -0700 @@ -1,3 +1,4 @@ +6.47 2016-09-21 Better smtp verify logging 6.46 2016-09-19 Enable smtp verify logging 6.45 2015-04-09 Add bitcoin donation address 6.44 2014-10-13 Generic regex now matches against the reverse dns PTR value diff -r 6fbe3c81376b -r f7c5cfb76e86 configure.in --- a/configure.in Mon Sep 19 13:22:53 2016 -0700 +++ b/configure.in Wed Sep 21 16:47:20 2016 -0700 @@ -1,6 +1,6 @@ AC_PREREQ(2.59) -AC_INIT(dnsbl,6.46,carl@five-ten-sg.com) +AC_INIT(dnsbl,6.47,carl@five-ten-sg.com) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff -r 6fbe3c81376b -r f7c5cfb76e86 dnsbl.spec.in --- a/dnsbl.spec.in Mon Sep 19 13:22:53 2016 -0700 +++ b/dnsbl.spec.in Wed Sep 21 16:47:20 2016 -0700 @@ -103,6 +103,9 @@ %changelog +* Wed Sep 21 2016 Carl Byington - 6.47-1 +- Better smtp verify logging + * Mon Sep 19 2016 Carl Byington - 6.46-1 - Enable smtp verify logging diff -r 6fbe3c81376b -r f7c5cfb76e86 src/context.cpp --- a/src/context.cpp Mon Sep 19 13:22:53 2016 -0700 +++ b/src/context.cpp Wed Sep 21 16:47:20 2016 -0700 @@ -92,8 +92,7 @@ int SMTP::writer() { #ifdef VERIFY_DEBUG - log("writer(%d) sees buffer with %s", buffer); - log("writer(%d) sees error %d", (int)error); + log("writer(%d) sees buffer with '%s'", buffer); #endif int rs = 0; if (!error) { @@ -111,6 +110,9 @@ } } } + #ifdef VERIFY_DEBUG + log("writer(%d) sees error %d", (int)error); + #endif return rs; } @@ -138,7 +140,7 @@ } buffer[pending] = '\0'; #ifdef VERIFY_DEBUG - log("reader(%d) sees buffer with %s", buffer); + log("reader(%d) sees buffer with '%s'", buffer); #endif return pending; } @@ -166,16 +168,12 @@ buffer[pending] = '\0'; while (true) { int r = read_line(); - #ifdef VERIFY_DEBUG - log("read_response(%d) sees line with %s", buffer); - log("read_response(%d) sees line length %d", r); - #endif + log("verify::read_response(%d) sees line with '%s'", buffer); if (r == 0) return 0; // failed to read any bytes if ((r > 4) && (buffer[3] == '-')) { flush_line(r); continue; } - log("verify::read_response(%d) sees line with %s", buffer); return atoi(buffer); } return 0; @@ -203,9 +201,8 @@ int SMTP::rset() { - int rc = cmd("RSET"); efrom[0] = '\0'; - return rc; + return cmd("RSET"); } @@ -215,7 +212,6 @@ // except in the case of an empty return path, which was left as the two // character string <>. if (strncmp(efrom, f, maxlen)) { - rset(); strncpy(efrom, f, maxlen); efrom[maxlen-1] = '\0'; // ensure null termination init(); @@ -327,7 +323,13 @@ } } pthread_mutex_unlock(&mutex); - if (conn) return conn; + if (conn) { + int rc = conn->rset(); + conn->log("verify::getconnection(%d) rset sees %d", rc); + if (rc == 250) return conn; + put_connection(conn); + return NULL; + } int sock = NULL_SOCKET; if ((time(NULL) - last_err) > ERROR_SMTP_SOCKET_TIME) { // nothing recent, maybe this time it will work @@ -356,6 +358,7 @@ tv.tv_sec = 15; tv.tv_usec = 0; setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)); + setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval)); conn = new SMTP(sock); conn->set_id(queueid); #ifdef VERIFY_DEBUG diff -r 6fbe3c81376b -r f7c5cfb76e86 src/includes.h --- a/src/includes.h Mon Sep 19 13:22:53 2016 -0700 +++ b/src/includes.h Wed Sep 21 16:47:20 2016 -0700 @@ -8,7 +8,7 @@ #define VERIFY_DEBUG 1 #define RESOLVER_DEBUG 1 -//#undef VERIFY_DEBUG +#undef VERIFY_DEBUG #undef RESOLVER_DEBUG #ifdef HAVE_CONFIG_H