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/16 12:14:54 UTC
svn commit: r232974 - in /httpd/mod_smtpd/trunk: mod_smtpd.h smtp.h
smtp_core.c smtp_protocol.c
Author: soc-rian
Date: Tue Aug 16 03:13:49 2005
New Revision: 232974
URL: http://svn.apache.org/viewcvs?rev=232974&view=rev
Log:
Applied patch by Joe Schaefer that changes // style comments into /**/ style
Modified:
httpd/mod_smtpd/trunk/mod_smtpd.h
httpd/mod_smtpd/trunk/smtp.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=232974&r1=232973&r2=232974&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/mod_smtpd.h Tue Aug 16 03:13:49 2005
@@ -26,7 +26,7 @@
extern "C" {
#endif
- // Current version of the Plugin interface
+ /* Current version of the Plugin interface */
#define SMTPD_PLUGIN_VERSION 20050414
#if !defined(WIN32)
@@ -80,30 +80,30 @@
conn_rec *c;
server_rec *s;
- // spooled data file pointer
+ /* spooled data file pointer */
apr_file_t *tfp;
- // where are we in the current transaction
+ /* where are we in the current transaction */
smtpd_request_state state_vector;
- // is this esmtp or smtp
- // by default smtp
+ /* is this esmtp or smtp */
+ /* by default smtp */
smtpd_protocol_type extended;
apr_array_header_t *extensions;
- // string of who this mail is from
+ /* string of who this mail is from */
char *mail_from;
apr_array_header_t *rcpt_to;
- // hostname we were helo'd with
+ /* hostname we were helo'd with */
char *helo;
} smtpd_request_rec;
- // public
+ /* public */
SMTPD_DECLARE_NONSTD(smtpd_request_rec *)
smtpd_get_request_rec(request_rec *r);
Modified: httpd/mod_smtpd/trunk/smtp.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp.h?rev=232974&r1=232973&r2=232974&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp.h (original)
+++ httpd/mod_smtpd/trunk/smtp.h Tue Aug 16 03:13:49 2005
@@ -22,7 +22,7 @@
extern "C" {
#endif
- // SMTP handlers registration
+ /* SMTP handlers registration */
#define HANDLER_PROTOTYPE request_rec *r, char *buffer, smtpd_return_data *in_data, void *data
#define HANDLER_FUNC(name) smtpd_handler_##name
Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=232974&r1=232973&r2=232974&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Tue Aug 16 03:13:49 2005
@@ -44,105 +44,106 @@
static apr_hash_t *smtpd_handlers;
-// Implement 'smtpd_run_unrecognized_command'.
+/* Implement 'smtpd_run_unrecognized_command'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
unrecognized_command,
(request_rec *r, smtpd_return_data *in,
char *command, char *data),
(r, in, command, data),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_connect'.
+/* Implement 'smtpd_run_connect'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, connect,
(request_rec *r, smtpd_return_data *in),
(r, in),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_reset_transaction'.
+/* Implement 'smtpd_run_reset_transaction'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
reset_transaction,
(request_rec *r),
(r),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_helo'.
+/* Implement 'smtpd_run_helo'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, helo,
(request_rec *r, smtpd_return_data *in,
char *str),
(r, in, str),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_ehlo'.
+/* Implement 'smtpd_run_ehlo'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, ehlo,
(request_rec *r, smtpd_return_data *in,
char *str),
(r, in, str),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_mail'.
+/* Implement 'smtpd_run_mail'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, mail,
(request_rec *r, smtpd_return_data *in,
char *str),
(r, in, str),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_rcpt'.
+/* Implement 'smtpd_run_rcpt'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, rcpt,
(request_rec *r, smtpd_return_data *in,
char *str),
(r, in, str),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_vrfy'.
+/* Implement 'smtpd_run_vrfy'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, vrfy,
(request_rec *r, smtpd_return_data *in,
char *str),
(r, in, str),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_quit'.
+/* Implement 'smtpd_run_quit'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, quit,
(request_rec *r, smtpd_return_data *in),
(r, in),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_data'.
+/* Implement 'smtpd_run_data'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, data,
(request_rec *r, smtpd_return_data *in),
(r, in),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_data_post'.
+/* Implement 'smtpd_run_data_post'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
data_post,
(request_rec *r, smtpd_return_data *in),
(r, in),
SMTPD_DECLINED, SMTPD_DECLINED);
-// Implement 'smtpd_run_data_queue'.
+/* Implement 'smtpd_run_queue'. */
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, queue,
(request_rec *r, smtpd_return_data *in),
(r, in),
SMTPD_DECLINED, SMTPD_DECLINED);
-// public methods
-// functions other modules can use
+/* public methods */
+/* functions other modules can use */
-// accessor
+/* accessor */
SMTPD_DECLARE_NONSTD(smtpd_request_rec *)
smtpd_get_request_rec(request_rec *r) {
return ap_get_module_config(r->request_config, &smtpd_module);
}
-// should be called at smtpd_hook_connect
+/* should be called at smtpd_hook_connect */
SMTPD_DECLARE_NONSTD(void)
smtpd_register_extension(smtpd_request_rec *sr, const char *line)
{
(*((char **)apr_array_push(sr->extensions))) = apr_pstrdup(sr->p, line);
}
-// how to reset the transaction
+/* how to reset the transaction */
SMTPD_DECLARE_NONSTD(void)
smtpd_reset_transaction(request_rec *r) {
- // REVIEW: don't know whether to run clear request first
- // then run reset hooks, or run reset hooks then clear request
- // depends on whether hooks want to save info before it gets cleared out
- // or if they want to overwrite default values in the request rec
- smtpd_run_reset_transaction(r);
+ /* REVIEW: don't know whether to run clear request first
+ * then run reset hooks, or run reset hooks then clear request
+ * depends on whether hooks want to save info before it gets cleared out
+ * or if they want to overwrite default values in the request rec
+ * smtpd_run_reset_transaction(r);
+ */
smtpd_clear_request_rec(smtpd_get_request_rec(r));
}
-// friend methods
-// only our sources can call these
+/* friend methods */
+/* only our sources can call these */
void
smtpd_clear_request_rec(smtpd_request_rec *sr) {
@@ -161,10 +162,10 @@
return smtpd_handlers;
}
-// private methods
-// only used in this file
+/* private methods */
+/* only used in this file */
-// can overwrite currently registered handlers
+/* can overwrite currently registered handlers */
static void
smtpd_register_handler(char *key, smtpd_handler *func, const char *help_text,
void *data, apr_pool_t *p)
@@ -180,7 +181,7 @@
apr_hash_set(smtpd_handlers, dupkey, APR_HASH_KEY_STRING, hand);
}
-// Creates the main request record for the connection
+/* Creates the main request record for the connection */
static request_rec *
smtpd_create_request(conn_rec *conn)
{
@@ -206,7 +207,7 @@
r->err_headers_out = apr_table_make(r->pool, 5);
r->notes = apr_table_make(r->pool, 5);
- // Must be set before we run create request hook
+ /* Must be set before we run create request hook */
r->request_config = ap_create_request_config(r->pool);
r->proto_output_filters = conn->output_filters;
@@ -226,7 +227,7 @@
apr_socket_t *csd=((core_net_rec *)r->input_filters->ctx)->client_socket;
apr_socket_timeout_set(csd, APR_INT64_C(10000000000000));
- // create custom smtpd rec
+ /* create custom smtpd rec */
sr = apr_pcalloc(r->pool, sizeof(*sr));
apr_pool_create(&sp, r->pool);
@@ -240,7 +241,7 @@
return r;
}
-// process connection hook
+/* process connection hook */
static int
process_smtp_connection(conn_rec *c)
{
@@ -261,7 +262,7 @@
return OK;
}
-// creates server config
+/* creates server config */
static void *
smtpd_create_server_config(apr_pool_t *p, server_rec *s)
{
@@ -274,7 +275,7 @@
return pConfig;
}
-// sets protocol status in server config
+/* sets protocol status in server config */
static const char *
set_protocol_status(cmd_parms *cmd,
void *struct_ptr,
@@ -288,7 +289,7 @@
return NULL;
}
-// sets server id string in server config
+/* sets server id string in server config */
static const char *
set_id_string(cmd_parms *cmd,
void *struct_ptr,
@@ -303,7 +304,7 @@
return NULL;
}
-// sets server id string in server config
+/* sets server id string in server config */
static const char *
set_max_data_size(cmd_parms *cmd,
void *struct_ptr,
@@ -332,11 +333,11 @@
{ NULL }
};
-// registers httpd hooks
+/* registers httpd hooks */
static void
register_hooks (apr_pool_t *p)
{
- // register connection processor
+ /* register connection processor */
ap_hook_process_connection(process_smtp_connection, NULL,
NULL, APR_HOOK_MIDDLE);
@@ -355,10 +356,10 @@
module AP_MODULE_DECLARE_DATA smtpd_module = {
STANDARD20_MODULE_STUFF,
- NULL, // create per-directory config structure
- NULL, // merge per-directory config structures
- smtpd_create_server_config, // create per-server config structure
- NULL, // merge per-server config structures
- smtpd_cmds, // command apr_table_t
- register_hooks // register hooks
+ NULL, /* create per-directory config structure */
+ NULL, /* merge per-directory config structures */
+ smtpd_create_server_config, /* create per-server config structure */
+ NULL, /* merge per-server config structures */
+ smtpd_cmds, /* command apr_table_t */
+ register_hooks /* register hooks */
};
Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=232974&r1=232973&r2=232974&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Tue Aug 16 03:13:49 2005
@@ -90,7 +90,7 @@
handle_func = apr_hash_get(handlers, command, APR_HASH_KEY_STRING);
in_data.msg = NULL;
- // command not recognized
+ /* command not recognized */
if (!handle_func) {
if (!smtpd_handle_unrecognized_command(r, &in_data, command, buffer))
break;
@@ -104,7 +104,7 @@
}
end:
- // flush any output we may have before disconnecting
+ /* flush any output we may have before disconnecting */
ap_rflush(r);
return;
}
@@ -152,10 +152,10 @@
break;
}
- // default behavior:
+ /* default behavior: */
- // RFC 2821 states that when ehlo or helo is received, reset
- // state
+ /* RFC 2821 states that when ehlo or helo is received, reset */
+ /* state */
smtpd_reset_transaction(r);
sr->helo = apr_pstrdup(sr->p, buffer);
@@ -180,7 +180,7 @@
HANDLER_DECLARE(helo) {
smtpd_request_rec *sr = smtpd_get_request_rec(r);
- // bad syntax
+ /* bad syntax */
if (buffer[0] == '\0') {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: HELO hostname");
return 501;
@@ -201,8 +201,8 @@
break;
}
- // RFC 2821 states that when ehlo or helo is received, reset
- // state
+ /* RFC 2821 states that when ehlo or helo is received, reset */
+ /* state */
smtpd_reset_transaction(r);
sr->helo = apr_pstrdup(sr->p, buffer);
@@ -216,13 +216,13 @@
smtpd_request_rec *sr = smtpd_get_request_rec(r);
char *loc;
- // already got mail
+ /* already got mail */
if (sr->state_vector == SMTPD_STATE_GOT_MAIL) {
ap_rprintf(r, "%d %s\r\n", 503, "Error: Nested MAIL command");
return 503;
}
- // bad syntax
+ /* bad syntax */
if ((loc = ap_strcasestr(buffer, "from:")) == NULL) {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: MAIL FROM:<address>");
return 501;
@@ -237,7 +237,7 @@
case SMTPD_DONE:
return 1;
case SMTPD_DONE_DISCONNECT:
- // zero to disconnect
+ /* zero to disconnect */
return 0;
case SMTPD_DENY:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
@@ -268,7 +268,7 @@
} else {
ap_rprintf(r, "%d %s, denied\r\n", 550, loc);
}
- // zero to disconnect
+ /* zero to disconnect */
return 0;
case SMTPD_DENYSOFT_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server,
@@ -279,13 +279,13 @@
} else {
ap_rprintf(r, "%d %s, temporarily denied\r\n", 450, loc);
}
- // zero to disconnect
+ /* zero to disconnect */
return 0;
default:
break;
}
- // default handling
+ /* default handling */
sr->mail_from = apr_pstrdup(sr->p, loc);
sr->state_vector = SMTPD_STATE_GOT_MAIL;
ap_rprintf(r, "%d %s\r\n", 250, "Ok");
@@ -297,14 +297,14 @@
smtpd_request_rec *sr = smtpd_get_request_rec(r);
char *loc;
- // need mail first
+ /* 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");
return 503;
}
- // bad syntax
+ /* bad syntax */
if ((loc = ap_strcasestr(buffer, "to:")) == NULL) {
ap_rprintf(r, "%d %s\r\n", 501, "Syntax: RCPT TO:<address>");
return 501;
@@ -342,7 +342,7 @@
ap_rprintf(r, "%d %s\r\n", 450, in_data->msg ? in_data->msg :
"relaying temporarily denied");
return 0;
- case SMTPD_OK: // recipient is okay
+ case SMTPD_OK: /* recipient is okay */
break;
default:
ap_rprintf(r, "%d %s\r\n", 450, "No plugin decided if relaying is "
@@ -350,7 +350,7 @@
return 450;
}
- // add a recipient
+ /* 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");
@@ -403,14 +403,14 @@
case SMTPD_DONE_DISCONNECT:
return 0;
case SMTPD_DENY:
- // REVIEW: should we reset state here?
- // smtpd_clear_request_rec(sr);
+ /* 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");
return 554;
case SMTPD_DENYSOFT:
- // REVIEW: should we reset state here?
- // smtpd_clear_request_rec(sr);
+ /* 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");
return 451;
@@ -443,13 +443,13 @@
if (rv != APR_SUCCESS) {
ap_rprintf(r, "%d %s\r\n", 421, "Error: Internal");
- // file error close connection
+ /* file error close connection */
return 0;
}
- // just wait until we get the line with a dot.
- // or until we can't read anymore.
- // or until we have too much data
+ /* just wait until we get the line with a dot. */
+ /* or until we can't read anymore. */
+ /* or until we have too much data */
while ((ap_rgetline(&buffer, BUFFER_STR_LEN,
&len, r, 0, bb) == APR_SUCCESS) &&
(strcmp(buffer, ".")) &&
@@ -508,7 +508,7 @@
if (smtpd_run_quit(r, in_data) != SMTPD_DONE) {
ap_rprintf(r, "%d %s\r\n", 221, "Bye");
}
- // zero to disconnect
+ /* zero to disconnect */
return 0;
}
@@ -523,7 +523,7 @@
ap_rprintf(r, "%d %s\r\n", 554, in_data->msg ? in_data->msg :
"Address denied");
return 554;
- case SMTPD_OK: // user is okay
+ case SMTPD_OK: /* user is okay */
ap_rprintf(r, "%d %s\r\n", 250, in_data->msg ? in_data->msg :
"Address okay");
return 250;