* msgbase.c: validate_recipients() now rejects Internet addresses in
authorArt Cancro <ajc@citadel.org>
Wed, 28 May 2003 03:08:38 +0000 (03:08 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 28 May 2003 03:08:38 +0000 (03:08 +0000)
  domains belonging to the local system or an attached Citadel network,
  when it fails to translate to a Citadel address.

citadel/ChangeLog
citadel/locate_host.c
citadel/msgbase.c
citadel/serv_smtp.c

index c96f4709c6d2cb207eb25914aa3e3ee649c2bf46..9bfe0cae832f68324801328a8b86e2faf19d6c3a 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 606.5  2003/05/28 03:08:38  ajc
+ * msgbase.c: validate_recipients() now rejects Internet addresses in
+   domains belonging to the local system or an attached Citadel network,
+   when it fails to translate to a Citadel address.
+
  Revision 606.4  2003/05/26 05:36:25  ajc
  * citadel.h: changed internal version number to 6.07
  * file_ops.c: #include <ctype.h>
@@ -4729,4 +4734,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 18a5dc907711da123908d9f8effdf08c7174ea52..c95569dcf7cdb7a2d0adf7cfa08d4b32f16c7482 100644 (file)
@@ -103,7 +103,7 @@ int rbl_check_addr(struct in_addr *addr, char *message_to_spammer)
        num_rbl = get_hosts(rbl_domains, "rbl");
        if (num_rbl < 1) return(0);
 
-       /* Try all configured RBL */
+       /* Try all configured RBL's */
         for (rbl=0; rbl<num_rbl; ++rbl) {
                snprintf(tbuf, sizeof tbuf,
                        "%d.%d.%d.%d.",
@@ -112,7 +112,7 @@ int rbl_check_addr(struct in_addr *addr, char *message_to_spammer)
 
                if (gethostbyname(tbuf) != NULL) {
                        strcpy(message_to_spammer,
-                               "Message rejected due to "
+                               "5.7.1 Message rejected due to "
                                "known spammer source IP address"
                        );
                        return(1);
index d68451b140f5939eddb9f9e845ce8dade5e73f22..7f7e1ccf3f968383029e6c1802ac08b38d8686d3 100644 (file)
@@ -2525,11 +2525,23 @@ struct recptypes *validate_recipients(char *recipients) {
                                }
                                break;
                        case MES_INTERNET:
-                               ++ret->num_internet;
-                               if (strlen(ret->recp_internet) > 0) {
-                                       strcat(ret->recp_internet, "|");
+                               /* Yes, you're reading this correctly: if the target
+                                * domain points back to the local system or an attached
+                                * Citadel directory, the address is invalid.  That's
+                                * because if the address were valid, we would have
+                                * already translated it to a local address by now.
+                                */
+                               if (IsDirectory(this_recp)) {
+                                       ++ret->num_error;
+                                       invalid = 1;
+                               }
+                               else {
+                                       ++ret->num_internet;
+                                       if (strlen(ret->recp_internet) > 0) {
+                                               strcat(ret->recp_internet, "|");
+                                       }
+                                       strcat(ret->recp_internet, this_recp);
                                }
-                               strcat(ret->recp_internet, this_recp);
                                break;
                        case MES_IGNET:
                                ++ret->num_ignet;
@@ -3074,7 +3086,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
        rewind(fp);
        lprintf(9, "Raw length is %ld\n", (long)raw_length);
 
-       raw_message = mallok((size_t)raw_length);
+       raw_message = mallok((size_t)raw_length + 2);
        fread(raw_message, (size_t)raw_length, 1, fp);
        fclose(fp);
 
index 958441bc4dbcdd9e882b2b296058d2cdfa359de2..28b582632ddd22fd4ee95021105cd5e2ad010f1b 100644 (file)
@@ -445,7 +445,7 @@ void smtp_rcpt(char *argbuf) {
 
        if (valid->num_internet > 0) {
                if (SMTP->message_originated_locally == 0) {
-                       cprintf("551 5.7.1 Relaying denied <%s>\r\n", recp);
+                       cprintf("551 5.7.1 <%s> - relaying denied\r\n", recp);
                        phree(valid);
                        return;
                }