You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by so...@apache.org on 2005/08/15 22:27:50 UTC
svn commit: r232869 - in /httpd/mod_smtpd/trunk: mod_smtpd.h smtp_core.c
smtp_protocol.c
Author: soc-rian
Date: Mon Aug 15 13:27:48 2005
New Revision: 232869
URL: http://svn.apache.org/viewcvs?rev=232869&view=rev
Log:
Removed superflous "out of memory" checks, removed most gotos, fixed unrecognized command handling.
Modified:
httpd/mod_smtpd/trunk/mod_smtpd.h
httpd/mod_smtpd/trunk/smtp_core.c
httpd/mod_smtpd/trunk/smtp_protocol.c
Modified: httpd/mod_smtpd/trunk/mod_smtpd.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/mod_smtpd.h?rev=232869&r1=232868&r2=232869&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/mod_smtpd.h Mon Aug 15 13:27:48 2005
@@ -90,15 +90,12 @@
// by default smtp
smtpd_protocol_type extended;
- // current max index of the extension hash
- int e_index;
- apr_hash_t *extensions;
+ apr_array_header_t *extensions;
// string of who this mail is from
char *mail_from;
- // current max index of the rcpt_to hash
- int r_index;
- apr_hash_t *rcpt_to;
+
+ apr_array_header_t *rcpt_to;
// hostname we were helo'd with
char *helo;
@@ -119,7 +116,7 @@
APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode,
unrecognized_command,
(request_rec *r, smtpd_return_data *in,
- char *str));
+ char *command, char *data));
APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, connect,
(request_rec *r, smtpd_return_data *in));
APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, reset_transaction,
Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=232869&r1=232868&r2=232869&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Mon Aug 15 13:27:48 2005
@@ -48,8 +48,8 @@
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
unrecognized_command,
(request_rec *r, smtpd_return_data *in,
- char *str),
- (r, in, str),
+ char *command, char *data),
+ (r, in, command, data),
SMTPD_DECLINED, SMTPD_DECLINED);
// Implement 'smtpd_run_connect'.
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, connect,
@@ -127,11 +127,7 @@
SMTPD_DECLARE_NONSTD(void)
smtpd_register_extension(smtpd_request_rec *sr, const char *line)
{
- int *cur = apr_palloc(sr->p, sizeof(int));
- *cur = sr->e_index;
-
- apr_hash_set(sr->extensions, cur, sizeof(*cur), line);
- (sr->e_index)++;
+ (*((char **)apr_array_push(sr->extensions))) = apr_pstrdup(sr->p, line);
}
// how to reset the transaction
@@ -154,10 +150,8 @@
sr->state_vector = SMTPD_STATE_GOT_NOTHING;
sr->tfp = NULL;
sr->extended = SMTPD_PROTOCOL_SMTP;
- sr->e_index = 0;
- sr->extensions = apr_hash_make(sr->p);
- sr->r_index = 0;
- sr->rcpt_to = apr_hash_make(sr->p);
+ sr->extensions = apr_array_make(sr->p, 5, sizeof(char *));
+ sr->rcpt_to = apr_array_make(sr->p, 5, sizeof(char *));
sr->mail_from = NULL;
sr->helo = NULL;
}
@@ -274,8 +268,8 @@
smtpd_svr_config_rec *pConfig = apr_pcalloc(p, sizeof(*pConfig));
pConfig->bEnabled = 0;
- pConfig->sId = apr_pcalloc(p, 1024);
- apr_cpystrn(pConfig->sId, "mod_smtpd", 1024);
+ pConfig->sId = apr_pcalloc(p, 512);
+ apr_cpystrn(pConfig->sId, "mod_smtpd", 512);
pConfig->max_data = 0x80000;
return pConfig;
}
@@ -304,7 +298,7 @@
ap_get_module_config(cmd->server->module_config,
&smtpd_module);
- apr_cpystrn(pConfig->sId, arg, 1024);
+ apr_cpystrn(pConfig->sId, arg, 512);
return NULL;
}
Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=232869&r1=232868&r2=232869&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Mon Aug 15 13:27:48 2005
@@ -36,6 +36,11 @@
extern module AP_MODULE_DECLARE_DATA smtpd_module;
+inline static int
+smtpd_handle_unrecognized_command(request_rec *r, smtpd_return_data *in_data,
+ char *command, char *data);
+
+
#define BUFFER_STR_LEN 1024
void
smtpd_process_connection_internal(request_rec *r)
@@ -51,11 +56,7 @@
ap_get_module_config(r->server->module_config,
&smtpd_module);
- if (apr_pool_create(&p, r->pool) == APR_ENOMEM) {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Out Of Memory");
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- goto end;
- }
+ apr_pool_create(&p, r->pool);
in_data.p = p;
in_data.msg = NULL;
@@ -90,27 +91,16 @@
in_data.msg = NULL;
// command not recognized
- if (handle_func == NULL) {
- switch(smtpd_run_unrecognized_command(r, &in_data, command)) {
- case SMTPD_DENY:
- ap_rprintf(r, "%d %s\r\n", 521, in_data.msg ? in_data.msg : "");
+ if (!handle_func) {
+ if (!smtpd_handle_unrecognized_command(r, &in_data, command, buffer))
break;
- case SMTPD_DONE:
+ } else {
+ if (!handle_func->func(r, buffer, &in_data, handle_func->data))
break;
- case SMTPD_DONE_DISCONNECT:
- goto end;
- default:
- ap_rprintf(r, "%d %s\r\n", 500,
- "Syntax error, command unrecognized");
- }
- ap_rflush(r);
- continue;
}
-
- in_data.msg = NULL;
- if (!handle_func->func(r, buffer, &in_data, handle_func->data))
- break;
+
buffer = cmdbuff;
+ ap_rflush(r);
}
end:
@@ -119,31 +109,45 @@
return;
}
+inline static int
+smtpd_handle_unrecognized_command(request_rec *r, smtpd_return_data *in_data,
+ char *command, char *data) {
+ switch(smtpd_run_unrecognized_command(r, in_data, command, data)) {
+ case SMTPD_DENY:
+ ap_rprintf(r, "%d %s\r\n", 521, in_data->msg ? in_data->msg : "");
+ return 521;
+ case SMTPD_DONE:
+ return 1;
+ case SMTPD_DONE_DISCONNECT:
+ return 0;
+ default:
+ ap_rprintf(r, "%d %s\r\n", 500,
+ "Syntax error, command unrecognized");
+ return 500;
+ }
+
+}
+
HANDLER_DECLARE(ehlo) {
- int i = 0, retval = 0;
- char *ext = NULL, *ext_next;
+ int i = 0;
smtpd_request_rec *sr = smtpd_get_request_rec(r);
if (buffer[0] == '\0') {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: EHLO hostname");
- goto end;
+ return 501;
}
switch(smtpd_run_ehlo(r, in_data, buffer)) {
case SMTPD_DONE:
- retval = 1;
- goto end;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- goto end;
+ return 0;
case SMTPD_DENY:
- retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg : "");
- goto end;
+ return 550;
case SMTPD_DENYSOFT:
- retval = 450;
ap_rprintf(r, "%d %s\r\n", 450, in_data->msg ? in_data->msg : "");
- goto end;
+ return 450;
default:
break;
}
@@ -154,66 +158,45 @@
// state
smtpd_reset_transaction(r);
- if ((sr->helo = apr_pstrdup(sr->p, buffer)) == NULL) {
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- retval = 0;
- goto end;
- }
-
- // print out extension
- ext = apr_hash_get(sr->extensions, &i, sizeof(i));
- retval = 250;
+ sr->helo = apr_pstrdup(sr->p, buffer);
+ sr->state_vector = SMTPD_STATE_GOT_HELO;
+ sr->extended = SMTPD_PROTOCOL_ESMTP;
- if (ext) {
+ if (sr->extensions->nelts) {
ap_rprintf(r, "%d-%s\r\n", 250, sr->helo);
-
- while (1) {
- i++;
- if ((ext_next = apr_hash_get(sr->extensions, &i, sizeof(i)))) {
- ap_rprintf(r, "%d-%s\r\n", 250, ext);
- } else {
- ap_rprintf(r, "%d %s\r\n", 250, ext);
- break;
- }
- ext = ext_next;
+
+ for (i = 0; i < sr->extensions->nelts - 1; ++i) {
+ ap_rprintf(r, "%d-%s\r\n", 250, ((char **)sr->extensions->nelts)[i]);
}
+ ap_rprintf(r, "%d %s\r\n", 250, ((char **)sr->extensions->nelts)[i]);
+
} else {
ap_rprintf(r, "%d %s\r\n", 250, sr->helo);
}
- sr->state_vector = SMTPD_STATE_GOT_HELO;
- sr->extended = SMTPD_PROTOCOL_ESMTP;
- end:
- ap_rflush(r);
- return retval;
+ return 250;
}
HANDLER_DECLARE(helo) {
smtpd_request_rec *sr = smtpd_get_request_rec(r);
- int retval = 0;
// bad syntax
if (buffer[0] == '\0') {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: HELO hostname");
- retval = 501;
- goto end;
+ return 501;
}
switch(smtpd_run_helo(r, in_data, buffer)) {
case SMTPD_DONE:
- retval = 1;
- goto end;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- goto end;
+ return 0;
case SMTPD_DENY:
- retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg : "");
- goto end;
+ return 550;
case SMTPD_DENYSOFT:
- retval = 450;
ap_rprintf(r, "%d %s\r\n", 450, in_data->msg ? in_data->msg : "");
- goto end;
+ return 450;
default:
break;
}
@@ -221,40 +204,28 @@
// RFC 2821 states that when ehlo or helo is received, reset
// state
smtpd_reset_transaction(r);
-
- // out of memory, close connection
- if ((sr->helo = apr_pstrdup(sr->p, buffer)) == NULL) {
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- retval = 0;
- goto end;
- }
-
- ap_rprintf(r, "%d %s\r\n", 250, sr->helo);
- retval = 250;
+
+ sr->helo = apr_pstrdup(sr->p, buffer);
sr->state_vector = SMTPD_STATE_GOT_HELO;
+ ap_rprintf(r, "%d %s\r\n", 250, sr->helo);
- end:
- ap_rflush(r);
- return retval;
+ return 250;
}
HANDLER_DECLARE(mail) {
smtpd_request_rec *sr = smtpd_get_request_rec(r);
char *loc;
- int retval = 0;
// already got mail
if (sr->state_vector == SMTPD_STATE_GOT_MAIL) {
ap_rprintf(r, "%d %s\r\n", 503, "Error: Nested MAIL command");
- retval = 503;
- goto end;
+ return 503;
}
// bad syntax
if ((loc = ap_strcasestr(buffer, "from:")) == NULL) {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: MAIL FROM:<address>");
- retval = 501;
- goto end;
+ return 501;
}
loc += sizeof("from:") - 1;
@@ -264,13 +235,11 @@
switch(smtpd_run_mail(r, in_data, loc)) {
case SMTPD_DONE:
- retval = 1;
- goto end;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- goto end;
+ // zero to disconnect
+ return 0;
case SMTPD_DENY:
- retval = 550;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"deny mail from %s (%s)", loc,
in_data->msg ? in_data->msg : "");
@@ -279,9 +248,8 @@
} else {
ap_rprintf(r, "%d %s, denied\r\n", 550, loc);
}
- goto end;
+ return 550;
case SMTPD_DENYSOFT:
- retval = 450;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"denysoft mail from %s (%s)", loc,
in_data->msg ? in_data->msg : "");
@@ -290,10 +258,8 @@
} else {
ap_rprintf(r, "%d %s, temporarily denied\r\n", 450, loc);
}
- goto end;
+ return 450;
case SMTPD_DENY_DISCONNECT:
- // zero to disconnect
- retval = 0;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"deny mail from %s (%s)", loc,
in_data->msg ? in_data->msg : "");
@@ -302,10 +268,9 @@
} else {
ap_rprintf(r, "%d %s, denied\r\n", 550, loc);
}
- goto end;
- case SMTPD_DENYSOFT_DISCONNECT:
// zero to disconnect
- retval = 0;
+ return 0;
+ case SMTPD_DENYSOFT_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"denysoft mail from %s (%s)", loc,
in_data->msg ? in_data->msg : "");
@@ -314,139 +279,119 @@
} else {
ap_rprintf(r, "%d %s, temporarily denied\r\n", 450, loc);
}
- goto end;
+ // zero to disconnect
+ return 0;
default:
break;
}
// default handling
-
- // out of memory, close connection
- if ((sr->mail_from = apr_pstrdup(sr->p, loc)) == NULL) {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Out Of Memory");
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- retval = 0;
- goto end;
- }
-
+ sr->mail_from = apr_pstrdup(sr->p, loc);
sr->state_vector = SMTPD_STATE_GOT_MAIL;
-
ap_rprintf(r, "%d %s\r\n", 250, "Ok");
- retval = 250;
- end:
- ap_rflush(r);
- return retval;
+ return 250;
}
HANDLER_DECLARE(rcpt) {
smtpd_request_rec *sr = smtpd_get_request_rec(r);
char *loc;
- char *allocated_string;
- int retval = 0;
- int *new_elt;
// need mail first
if ((sr->state_vector != SMTPD_STATE_GOT_MAIL) &&
(sr->state_vector != SMTPD_STATE_GOT_RCPT)) {
ap_rprintf(r, "%d %s\r\n", 503, "Error: need MAIL command");
- retval = 503;
- goto end;
+ return 503;
}
// bad syntax
if ((loc = ap_strcasestr(buffer, "to:")) == NULL) {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: RCPT TO:<address>");
- retval = 501;
- goto end;
+ return 501;
}
loc += sizeof("to:") - 1;
switch(smtpd_run_rcpt(r, in_data, loc)) {
case SMTPD_DONE:
- retval = 1;
- goto end;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- goto end;
+ return 0;
case SMTPD_DENY:
- retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg :
"relaying denied");
- goto end;
+ return 550;
case SMTPD_DENYSOFT:
- retval = 450;
if (in_data->msg) {
ap_rprintf(r, "%d %s\r\n", 450, in_data->msg);
} else {
ap_rprintf(r, "%d %s, relaying temporarily denied\r\n", 450, loc);
}
- goto end;
+ return 450;
case SMTPD_DENY_DISCONNECT:
- // zero to disconnect
- retval = 0;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"delivery denied (%s)",
in_data->msg ? in_data->msg : "");
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg :
"delivery denied");
- goto end;
+ return 0;
case SMTPD_DENYSOFT_DISCONNECT:
- // zero to disconnect
- retval = 0;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
"delivery denied (%s)",
in_data->msg ? in_data->msg : "");
ap_rprintf(r, "%d %s\r\n", 450, in_data->msg ? in_data->msg :
"relaying temporarily denied");
- goto end;
+ return 0;
case SMTPD_OK: // recipient is okay
break;
default:
- retval = 450;
ap_rprintf(r, "%d %s\r\n", 450, "No plugin decided if relaying is "
"allowed");
- goto end;
+ return 450;
}
// add a recipient
+ (*((char **)apr_array_push(sr->rcpt_to))) = apr_pstrdup(sr->p, loc);
+ sr->state_vector = SMTPD_STATE_GOT_RCPT;
+ ap_rprintf(r, "%d %s\r\n", 250, "Ok");
- if ((allocated_string = apr_pstrdup(sr->p, loc))) {
- new_elt = apr_palloc(sr->p, sizeof(int));
+ return 250;
+}
- if (!new_elt) {
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- // out of memory close connection
- retval = 0;
- goto end;
- }
- *new_elt = sr->r_index;
- apr_hash_set(sr->rcpt_to, new_elt,
- sizeof(*new_elt), allocated_string);
- sr->r_index++;
- sr->state_vector = SMTPD_STATE_GOT_RCPT;
-
- ap_rprintf(r, "%d %s\r\n", 250, "Ok");
- retval = 250;
- } else {
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- // out of memory close connection
- retval = 0;
- }
-
- end:
- ap_rflush(r);
- return retval;
+inline static int
+smtpd_queue(request_rec *r, smtpd_return_data *in_data) {
+ switch(smtpd_run_queue(r, in_data)) {
+ case SMTPD_DONE:
+ return 1;
+ case SMTPD_DONE_DISCONNECT:
+ return 0;
+ case SMTPD_OK:
+ ap_rprintf(r, "%d %s\r\n", 250, in_data->msg ? in_data->msg :
+ "Queued");
+ return 250;
+ case SMTPD_DENY:
+ ap_rprintf(r, "%d %s\r\n", 552, in_data->msg ? in_data->msg :
+ "Message denied");
+ return 552;
+ case SMTPD_DENYSOFT:
+ ap_rprintf(r, "%d %s\r\n", 452, in_data->msg ? in_data->msg :
+ "Message denied temporarily");
+ return 452;
+ default:
+ ap_rprintf(r, "%d %s\r\n", 451, in_data->msg ? in_data->msg :
+ "Queuing declined or disabled; try again later");
+ return 451;
+ }
}
+
HANDLER_DECLARE(data) {
smtpd_request_rec *sr = smtpd_get_request_rec(r);
smtpd_svr_config_rec *pConfig =
ap_get_module_config(r->server->module_config,
&smtpd_module);
- int retval = 0, rv;
+ int rv, retval = 0;
char *tempfile;
apr_bucket_brigade *bb;
apr_file_t *tfp;
@@ -454,51 +399,41 @@
switch(smtpd_run_data(r, in_data)) {
case SMTPD_DONE:
- retval = 1;
- goto end;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- goto end;
+ return 0;
case SMTPD_DENY:
- retval = 554;
// REVIEW: should we reset state here?
// smtpd_clear_request_rec(sr);
ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
"Message denied");
- goto end;
+ return 554;
case SMTPD_DENYSOFT:
- retval = 451;
// REVIEW: should we reset state here?
// smtpd_clear_request_rec(sr);
ap_rprintf(r, "%d %s\r\n", 451, in_data->msg ? in_data->msg :
"Message denied temporarily");
- goto end;
+ return 451;
case SMTPD_DENY_DISCONNECT:
- // zero to disconnect
- retval = 0;
ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
"Message denied");
- goto end;
+ return 0;
case SMTPD_DENYSOFT_DISCONNECT:
- // zero to disconnect
- retval = 0;
ap_rprintf(r, "%d %s\r\n", 451, in_data->msg ? in_data->msg :
"Message denied temporarily");
- goto end;
+ return 0;
default:
break;
}
if (sr->state_vector != SMTPD_STATE_GOT_RCPT) {
ap_rprintf(r, "%d %s\r\n", 503, "Error: need RCPT command");
- retval = 503;
- goto end;
+ return 503;
}
ap_rprintf(r, "%d %s\r\n", 354, "End data with <CR><LF>.<CR><LF>");
ap_rflush(r);
-
bb = apr_brigade_create(sr->p, r->connection->bucket_alloc);
tempfile = apr_pstrdup(sr->p, "/tmp/tmp.XXXXXX");
@@ -509,8 +444,7 @@
if (rv != APR_SUCCESS) {
ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
// file error close connection
- retval = 0;
- goto end;
+ return 0;
}
// just wait until we get the line with a dot.
@@ -546,42 +480,13 @@
"Message denied temporarily");
break;
default:
- switch(smtpd_run_queue(r, in_data)) {
- case SMTPD_DONE:
- retval = 1;
- break;
- case SMTPD_DONE_DISCONNECT:
- retval = 0;
- break;
- case SMTPD_OK:
- retval = 250;
- ap_rprintf(r, "%d %s\r\n", 250, in_data->msg ? in_data->msg :
- "Queued");
- break;
- case SMTPD_DENY:
- retval = 552;
- ap_rprintf(r, "%d %s\r\n", 552, in_data->msg ? in_data->msg :
- "Message denied");
- break;
- case SMTPD_DENYSOFT:
- retval = 452;
- ap_rprintf(r, "%d %s\r\n", 452, in_data->msg ? in_data->msg :
- "Message denied temporarily");
- break;
- default:
- retval = 451;
- ap_rprintf(r, "%d %s\r\n", 452, in_data->msg ? in_data->msg :
- "Queuing declined or disabled; try again later");
- break;
- }
+ retval = smtpd_queue(r, in_data);
}
smtpd_reset_transaction(r);
cleanup:
apr_file_close(tfp);
- end:
- ap_rflush(r);
return retval;
}
@@ -589,14 +494,12 @@
smtpd_reset_transaction(r);
ap_rprintf(r, "%d %s\r\n", 250, "Ok");
- ap_rflush(r);
return 250;
}
HANDLER_DECLARE(noop) {
ap_rprintf(r, "%d %s\r\n", 250, "Ok");
- ap_rflush(r);
return 250;
}
@@ -604,40 +507,29 @@
HANDLER_DECLARE(quit) {
if (smtpd_run_quit(r, in_data) != SMTPD_DONE) {
ap_rprintf(r, "%d %s\r\n", 221, "Bye");
- ap_rflush(r);
}
-
// zero to disconnect
return 0;
}
HANDLER_DECLARE(vrfy) {
- int retval = 0;
switch(smtpd_run_vrfy(r, in_data, buffer)) {
case SMTPD_DONE:
- retval = 1;
- break;
+ return 1;
case SMTPD_DONE_DISCONNECT:
- retval = 0;
- break;
+ return 0;
case SMTPD_DENY:
- retval = 554;
ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
"Address denied");
- break;
+ return 554;
case SMTPD_OK: // user is okay
- retval = 250;
ap_rprintf(r, "%d %s\r\n", 250, in_data->msg ? in_data->msg :
"Address okay");
- break;
+ return 250;
default:
- retval = 252;
ap_rprintf(r, "%d %s\r\n", 252, in_data->msg ? in_data->msg :
"Address seems fine, but we might not accept it.");
- break;
+ return 252;
}
-
- ap_rflush(r);
- return retval;
}