comparison src/dnsbl.cpp @ 310:802e2b779ed1

enable smtp verify logging
author Carl Byington <carl@five-ten-sg.com>
date Sun, 18 Sep 2016 18:32:37 -0700
parents 13905d36ca82
children f5547e7b3a09
comparison
equal deleted inserted replaced
309:358b764a862e 310:802e2b779ed1
746 746
747 747
748 //////////////////////////////////////////////// 748 ////////////////////////////////////////////////
749 // syslog a message 749 // syslog a message
750 // 750 //
751 void my_syslog(mlfiPriv *priv, const char *text) { 751 void my_syslog(const char *queueid, const char *text) {
752 char buf[maxlen]; 752 char buf[maxlen];
753 if (priv) { 753 if (queueid) {
754 snprintf(buf, sizeof(buf), "%s: %s", priv->queueid, text); 754 snprintf(buf, sizeof(buf), "%s: %s", queueid, text);
755 text = buf; 755 text = buf;
756 } 756 }
757 if (use_syslog) { 757 if (use_syslog) {
758 pthread_mutex_lock(&syslog_mutex); 758 pthread_mutex_lock(&syslog_mutex);
759 if (!syslog_opened) { 759 if (!syslog_opened) {
764 pthread_mutex_unlock(&syslog_mutex); 764 pthread_mutex_unlock(&syslog_mutex);
765 } 765 }
766 else { 766 else {
767 printf("%s \n", text); 767 printf("%s \n", text);
768 } 768 }
769 }
770
771 void my_syslog(mlfiPriv *priv, const char *text) {
772 if (priv) my_syslog(priv->queueid, text);
773 else my_syslog((const char *)NULL, text);
769 } 774 }
770 775
771 void my_syslog(mlfiPriv *priv, const string text) { 776 void my_syslog(mlfiPriv *priv, const string text) {
772 if (debug_syslog > 3) { 777 if (debug_syslog > 3) {
773 char buf[maxlen]; 778 char buf[maxlen];
776 my_syslog(priv, buf); 781 my_syslog(priv, buf);
777 } 782 }
778 } 783 }
779 784
780 void my_syslog(const char *text) { 785 void my_syslog(const char *text) {
781 my_syslog(NULL, text); 786 my_syslog((const char *)NULL, text);
782 } 787 }
783 788
784 789
785 //////////////////////////////////////////////// 790 ////////////////////////////////////////////////
786 // read a resolver request from the socket, process it, and 791 // read a resolver request from the socket, process it, and
1336 return SMFIS_REJECT; 1341 return SMFIS_REJECT;
1337 } 1342 }
1338 if (ver) { 1343 if (ver) {
1339 // try to verify this from/to pair of addresses even if it might be explicitly whitelisted 1344 // try to verify this from/to pair of addresses even if it might be explicitly whitelisted
1340 const char *loto = to_lower_string(rcptaddr); 1345 const char *loto = to_lower_string(rcptaddr);
1341 bool rc = ver->ok(priv.mailaddr, loto); 1346 bool rc = ver->ok(priv.queueid, priv.mailaddr, loto);
1342 free((void*)loto); 1347 free((void*)loto);
1343 if (!rc) { 1348 if (!rc) {
1344 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"no such user"); 1349 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"no such user");
1345 return SMFIS_REJECT; 1350 return SMFIS_REJECT;
1346 } 1351 }