From f6edd17cc6e2467fe6860dff3798290d9fca9c58 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 27 Jun 2007 05:06:31 +0000 Subject: [PATCH] Removed the VRFY and EXPN commands from our SMTP server implementation because nobody uses these commands anymore except for spammers. --- citadel/file_ops.c | 2 +- citadel/serv_sieve.c | 8 ++-- citadel/serv_smtp.c | 96 ++------------------------------------------ 3 files changed, 8 insertions(+), 98 deletions(-) diff --git a/citadel/file_ops.c b/citadel/file_ops.c index bf4cee5b1..a6cf80b7a 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -280,7 +280,7 @@ void cmd_netf(char *cmdbuf) putc(255, ofp); putc(MES_NORMAL, ofp); putc(0, ofp); - fprintf(ofp, "Pcit%ld", CC->user.usernum); + fprintf(ofp, "P%s", CC->user.fullname); putc(0, ofp); time(&now); fprintf(ofp, "T%ld", (long) now); diff --git a/citadel/serv_sieve.c b/citadel/serv_sieve.c index e8277d697..3418ab8d9 100644 --- a/citadel/serv_sieve.c +++ b/citadel/serv_sieve.c @@ -1,5 +1,5 @@ /* - * $Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $ + * $Id$ * * This module glues libSieve to the Citadel server in order to implement * the Sieve mailbox filtering language (RFC 3028). @@ -59,7 +59,7 @@ char *msiv_extensions = NULL; */ int ctdl_debug(sieve2_context_t *s, void *my) { - static int ctdl_libsieve_debug = 0; + static int ctdl_libsieve_debug = 1; if (ctdl_libsieve_debug) { /* @@ -1231,7 +1231,7 @@ char *serv_sieve_init(void) { ctdl_sieve_init(); CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts"); - return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $"; + return "$Id$"; } #else /* HAVE_LIBSIEVE */ @@ -1239,7 +1239,7 @@ char *serv_sieve_init(void) char *serv_sieve_init(void) { lprintf(CTDL_INFO, "This server is missing libsieve. Mailbox filtering will be disabled.\n"); - return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $"; + return "$Id$"; } #endif /* HAVE_LIBSIEVE */ diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index d4ff45a83..a9e46f681 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -20,6 +20,9 @@ * RFC 2821 - Simple Mail Transfer Protocol * RFC 2822 - Internet Message Format * RFC 2920 - SMTP Service Extension for Command Pipelining + * + * The VRFY and EXPN commands have been removed from this implementation + * because nobody uses these commands anymore, except for spammers. * */ @@ -86,9 +89,6 @@ struct citsmtp { /* Information about the current session */ int command_state; char helo_node[SIZ]; - struct ctdluser vrfy_buffer; - int vrfy_count; - char vrfy_match[SIZ]; char from[SIZ]; char recipients[SIZ]; int number_of_recipients; @@ -295,7 +295,6 @@ void smtp_help(void) { cprintf("214-Commands accepted:\r\n"); cprintf("214- DATA\r\n"); cprintf("214- EHLO\r\n"); - cprintf("214- EXPN\r\n"); cprintf("214- HELO\r\n"); cprintf("214- HELP\r\n"); cprintf("214- MAIL\r\n"); @@ -303,7 +302,6 @@ void smtp_help(void) { cprintf("214- QUIT\r\n"); cprintf("214- RCPT\r\n"); cprintf("214- RSET\r\n"); - cprintf("214- VRFY\r\n"); cprintf("214 \r\n"); } @@ -422,86 +420,6 @@ void smtp_auth(char *argbuf) { } -/* - * Back end for smtp_vrfy() command - */ -void smtp_vrfy_backend(struct ctdluser *us, void *data) { - - if (!fuzzy_match(us, SMTP->vrfy_match)) { - ++SMTP->vrfy_count; - memcpy(&SMTP->vrfy_buffer, us, sizeof(struct ctdluser)); - } -} - - -/* - * Implements the VRFY (verify user name) command. - * Performs fuzzy match on full user names. - */ -void smtp_vrfy(char *argbuf) { - SMTP->vrfy_count = 0; - strcpy(SMTP->vrfy_match, argbuf); - ForEachUser(smtp_vrfy_backend, NULL); - - if (SMTP->vrfy_count < 1) { - cprintf("550 5.1.1 String does not match anything.\r\n"); - } - else if (SMTP->vrfy_count == 1) { - cprintf("250 %s \r\n", - SMTP->vrfy_buffer.fullname, - SMTP->vrfy_buffer.usernum, - config.c_fqdn); - } - else if (SMTP->vrfy_count > 1) { - cprintf("553 5.1.4 Request ambiguous: %d users matched.\r\n", - SMTP->vrfy_count); - } - -} - - - -/* - * Back end for smtp_expn() command - */ -void smtp_expn_backend(struct ctdluser *us, void *data) { - - if (!fuzzy_match(us, SMTP->vrfy_match)) { - - if (SMTP->vrfy_count >= 1) { - cprintf("250-%s \r\n", - SMTP->vrfy_buffer.fullname, - SMTP->vrfy_buffer.usernum, - config.c_fqdn); - } - - ++SMTP->vrfy_count; - memcpy(&SMTP->vrfy_buffer, us, sizeof(struct ctdluser)); - } -} - - -/* - * Implements the EXPN (expand user name) command. - * Performs fuzzy match on full user names. - */ -void smtp_expn(char *argbuf) { - SMTP->vrfy_count = 0; - strcpy(SMTP->vrfy_match, argbuf); - ForEachUser(smtp_expn_backend, NULL); - - if (SMTP->vrfy_count < 1) { - cprintf("550 5.1.1 String does not match anything.\r\n"); - } - else if (SMTP->vrfy_count >= 1) { - cprintf("250 %s \r\n", - SMTP->vrfy_buffer.fullname, - SMTP->vrfy_buffer.usernum, - config.c_fqdn); - } -} - - /* * Implements the RSET (reset state) command. * Currently this just zeroes out the state buffer. If pointers to data @@ -924,10 +842,6 @@ void smtp_command_loop(void) { smtp_data(); } - else if (!strncasecmp(cmdbuf, "EXPN", 4)) { - smtp_expn(&cmdbuf[5]); - } - else if (!strncasecmp(cmdbuf, "HELO", 4)) { smtp_hello(&cmdbuf[5], 0); } @@ -970,10 +884,6 @@ void smtp_command_loop(void) { smtp_starttls(); } #endif - else if (!strncasecmp(cmdbuf, "VRFY", 4)) { - smtp_vrfy(&cmdbuf[5]); - } - else { cprintf("502 5.0.0 I'm afraid I can't do that.\r\n"); } -- 2.30.2