]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_smtp.c
* Added support for any standard RBL
[citadel.git] / citadel / serv_smtp.c
index c0147df1155c2096ef9ce95f1cbb09323bfd1ca1..2cb0ed4aa7fbb3869b29ac950e41b1cce31c6546 100644 (file)
@@ -31,6 +31,9 @@
 #include <ctype.h>
 #include <string.h>
 #include <limits.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
 #include "sysdep_decls.h"
@@ -49,6 +52,7 @@
 #include "genstamp.h"
 #include "domain.h"
 #include "clientsocket.h"
+#include "locate_host.h"
 
 
 #ifndef HAVE_SNPRINTF
@@ -401,7 +405,8 @@ void smtp_mail(char *argbuf) {
  */
 void smtp_rcpt(char *argbuf) {
        char recp[SIZ];
-       struct recptypes *valid;
+       char message_to_spammer[SIZ];
+       struct recptypes *valid = NULL;
 
        if (strlen(SMTP->from) == 0) {
                cprintf("503 Need MAIL before RCPT\r\n");
@@ -422,6 +427,15 @@ void smtp_rcpt(char *argbuf) {
                return;
        }
 
+       /* RBL check */
+       if ( (!CC->logged_in) && (!CC->is_local_socket) ) {
+               if (rbl_check(message_to_spammer)) {
+                       cprintf("552 %s\r\n", message_to_spammer);
+                       /* no need to phree(valid), it's not allocated yet */
+                       return;
+               }
+       }
+
        valid = validate_recipients(recp);
        if (valid->num_error > 0) {
                cprintf("599 Error: %s\r\n", valid->errormsg);