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/13 02:38:30 UTC
svn commit: r232410 - in /httpd/mod_smtpd/trunk: mod_smtpd.h smtp_core.c
smtp_protocol.c
Author: soc-rian
Date: Fri Aug 12 17:38:27 2005
New Revision: 232410
URL: http://svn.apache.org/viewcvs?rev=232410&view=rev
Log:
API robustification, removed debugging code
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=232410&r1=232409&r2=232410&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/mod_smtpd.h Fri Aug 12 17:38:27 2005
@@ -17,6 +17,11 @@
#ifndef _MOD_SMTPD_H
#define _MOD_SMTPD_H
+#include "apr_pools.h"
+#include "apr_hash.h"
+#include "apr_file_io.h"
+#include "httpd.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,6 +54,7 @@
SMTPD_DENY_DISCONNECT,
SMTPD_DENYSOFT_DISCONNECT,
SMTPD_DONE,
+ SMTPD_DONE_DISCONNECT,
SMTPD_OK
} smtpd_retcode;
Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=232410&r1=232409&r2=232410&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Fri Aug 12 17:38:27 2005
@@ -338,21 +338,6 @@
{ NULL }
};
-#define BUFFER_STR_LEN 1024
-static smtpd_retcode
-default_queue(request_rec *r, smtpd_return_data *in)
-{
- // do stuff
- return SMTPD_OK;
-}
-
-static smtpd_retcode
-default_rcpt(request_rec *r, smtpd_return_data *in, char *cool)
-{
- // do stuff
- return SMTPD_OK;
-}
-
// registers httpd hooks
static void
register_hooks (apr_pool_t *p)
Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=232410&r1=232409&r2=232410&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Fri Aug 12 17:38:27 2005
@@ -74,13 +74,13 @@
goto end;
case SMTPD_DONE:
break;
+ case SMTPD_DONE_DISCONNECT:
+ goto end;
default:
ap_rprintf(r, "%d %s %s\r\n", 220, ap_get_server_name(r), pConfig->sId);
ap_rflush(r);
}
-
-
while (ap_getline(buffer, BUFFER_STR_LEN,
r, 0) != -1) {
apr_pool_clear(p);
@@ -97,6 +97,8 @@
break;
case SMTPD_DONE:
break;
+ case SMTPD_DONE_DISCONNECT:
+ goto end;
default:
ap_rprintf(r, "%d %s\r\n", 500,
"Syntax error, command unrecognized");
@@ -131,6 +133,9 @@
case SMTPD_DONE:
retval = 1;
goto end;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto end;
case SMTPD_DENY:
retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg : "");
@@ -198,6 +203,9 @@
case SMTPD_DONE:
retval = 1;
goto end;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto end;
case SMTPD_DENY:
retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg : "");
@@ -258,6 +266,9 @@
case SMTPD_DONE:
retval = 1;
goto end;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto end;
case SMTPD_DENY:
retval = 550;
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
@@ -355,6 +366,9 @@
case SMTPD_DONE:
retval = 1;
goto end;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto end;
case SMTPD_DENY:
retval = 550;
ap_rprintf(r, "%d %s\r\n", 550, in_data->msg ? in_data->msg :
@@ -431,6 +445,9 @@
case SMTPD_DONE:
retval = 1;
goto end;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto end;
case SMTPD_DENY:
retval = 554;
// REVIEW: should we reset state here?
@@ -504,6 +521,9 @@
case SMTPD_DONE:
retval = 1;
goto cleanup;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ goto cleanup;
case SMTPD_DENY:
retval = 552;
ap_rprintf(r, "%d %s\r\n", 552, in_data->msg ? in_data->msg :
@@ -519,6 +539,9 @@
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 :
@@ -584,6 +607,9 @@
case SMTPD_DONE:
retval = 1;
break;
+ case SMTPD_DONE_DISCONNECT:
+ retval = 0;
+ break;
case SMTPD_DENY:
retval = 554;
ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
@@ -604,56 +630,3 @@
ap_rflush(r);
return retval;
}
-/*
-
- char *rexp = "^[-a-zA-Z0-9!#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\}\\|~]+"
- "(\\.[-a-zA-Z0-9!#\\$%&'\\*\\+\\/=\\?\\^_`\\{\\}\\|~]+)*@"
- "[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?"
- "(\\.[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?)*$";
-
- switch(smtpd_run_vrfy(r, in_data, buffer)) {
- case SMTPD_DONE:
- retval = 1;
- break;
- case SMTPD_DENY:
- retval = 554;
- ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
- "Address denied");
- break;
- 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;
- default:
- retval = 252;
- ap_rprintf(r, "%d %s\r\n", 250, in_data->msg ? in_data->msg :
- "Address seems fine, but we might not accept it.");
- break;
- }
-
- // just check if the email address is syntactically correc
-
- compiled = ap_pregcomp(r->pool, rexp,
- AP_REG_EXTENDED | AP_REG_NOSUB);
-
- // out of memory close connection
- if (!compiled) {
- ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- retval = 0;
- goto end;
- }
-
- error = ap_regexec(compiled, buffer, 0, NULL, 0);
- ap_pregfree(r->pool, compiled);
-
- if (error) {
- ap_rprintf(r, "%d %s\r\n", 554, "Invalid Address");
- retval = 554;
- } else {
- ap_rprintf(r, "%d %s\r\n", 252, "Valid Address");
- retval = 252;
- }
-
- end:
-*/