]> code.citadel.org Git - citadel.git/commitdiff
* Began RCPT command
authorArt Cancro <ajc@citadel.org>
Sun, 12 Dec 1999 05:28:40 +0000 (05:28 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 12 Dec 1999 05:28:40 +0000 (05:28 +0000)
citadel/serv_smtp.c

index 291f90064b12fc5883e08f1825ecd9fc091d1ef2..5d2136b559c19ab31a84d230091c01f047e59c7d 100644 (file)
@@ -92,6 +92,7 @@ void smtp_help(void) {
        cprintf("214-    MAIL\n");
        cprintf("214-    NOOP\n");
        cprintf("214-    QUIT\n");
+       cprintf("214-    RCPT\n");
        cprintf("214-    RSET\n");
        cprintf("214-    VRFY\n");
        cprintf("214 I could tell you more, but then I'd have to kill you.\n");
@@ -286,7 +287,6 @@ void smtp_mail(char *argbuf) {
         * the user only sends email from his/her own address.
         */
        if (CC->logged_in) {
-               lprintf(9, "Me-checking <%s>\n", SMTP->from);
                cvt = convert_internet_address(user, node, SMTP->from);
                lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
                if ( (cvt != 0) || (strcasecmp(user, CC->usersupp.fullname))) {
@@ -296,11 +296,45 @@ void smtp_mail(char *argbuf) {
                }
        }
 
+       /* Otherwise, make sure outsiders aren't trying to forge mail from
+        * this system.
+        */
+       else {
+               cvt = convert_internet_address(user, node, SMTP->from);
+               lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
+               if (!strcasecmp(node, config.c_nodename)) { /* FIX use fcn */
+                       cprintf("550 You must log in to send mail from %s\n",
+                               config.c_fqdn);
+                       return;
+               }
+       }
+
        cprintf("250 Sender ok.  Groovy.\n");
 }
 
 
 
+/*
+ * Implements the "RCPT To:" command
+ */
+void smtp_rcpt(char *argbuf) {
+
+       if (strlen(SMTP->from) == 0) {
+               cprintf("503 MAIL first, then RCPT.  Duh.\n");
+               return;
+       }
+
+       if (strncasecmp(argbuf, "To:", 3)) {
+               cprintf("501 Syntax error\n");
+               return;
+       }
+
+       cprintf("599 this is unfinished\n");
+}
+
+
+
+
 /* 
  * Main command loop for SMTP sessions.
  */
@@ -359,6 +393,10 @@ void smtp_command_loop(void) {
                return;
                }
 
+       else if (!strncasecmp(cmdbuf, "RCPT", 4)) {
+               smtp_rcpt(&cmdbuf[5]);
+       }
+
        else if (!strncasecmp(cmdbuf, "RSET", 4)) {
                smtp_rset();
        }