httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From soc-r...@apache.org
Subject svn commit: r239438 - in /httpd/mod_smtpd/trunk: mod_smtpd.h smtp.h smtp_core.c smtp_protocol.c
Date Tue, 23 Aug 2005 17:43:33 GMT
Author: soc-rian
Date: Tue Aug 23 10:43:29 2005
New Revision: 239438

URL: http://svn.apache.org/viewcvs?rev=239438&view=rev
Log:
conformed code to apache style guidelines

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=239438&r1=239437&r2=239438&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/mod_smtpd.h Tue Aug 23 10:43:29 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)
@@ -47,7 +47,7 @@
 #define SMTPD_DECLARE_DATA             __declspec(dllimport)
 #endif
 
-  typedef enum {
+typedef enum {
     SMTPD_DECLINED,
     SMTPD_DENY,
     SMTPD_DENYSOFT,
@@ -56,32 +56,32 @@
     SMTPD_DONE,
     SMTPD_DONE_DISCONNECT,
     SMTPD_OK
-  } smtpd_retcode;
+} smtpd_retcode;
 
-  typedef enum {
+typedef enum {
     SMTPD_STATE_GOT_NOTHING,
     SMTPD_STATE_GOT_HELO,
     SMTPD_STATE_GOT_MAIL,
     SMTPD_STATE_GOT_RCPT
-  } smtpd_trans_state;
+} smtpd_trans_state;
 
-  typedef enum {
+typedef enum {
     SMTPD_PROTOCOL_SMTP,
     SMTPD_PROTOCOL_ESMTP
-  } smtpd_protocol_type;
+} smtpd_protocol_type;
 
-  typedef struct smtpd_return_data {
+typedef struct smtpd_return_data {
     apr_pool_t *p;
     /* list of messages */
     apr_array_header_t *msgs;
-  } smtpd_return_data;
+} smtpd_return_data;
 
-  typedef struct smtpd_trans_rec {
+typedef struct smtpd_trans_rec {
     apr_pool_t *p;
-
+    
     /* where are we in the current transaction */
     smtpd_trans_state trans_state;
-
+    
     /* is this esmtp or smtp */
     /* by default smtp */
     smtpd_protocol_type protocol_type;
@@ -97,9 +97,9 @@
 
     /* spooled data file pointer */
     apr_file_t *tfp;
-  } smtpd_trans_rec;
+} smtpd_trans_rec;
 
-  typedef struct smtpd_conn_rec {
+typedef struct smtpd_conn_rec {
     apr_pool_t *p;
     conn_rec *c;
     server_rec *s;
@@ -115,47 +115,45 @@
 
     /* bb out */
     apr_bucket_brigade *bb_out;
-  } smtpd_conn_rec;
+} smtpd_conn_rec;
   
-  /* public */
-  SMTPD_DECLARE_NONSTD(void)
-  smtpd_register_extension(smtpd_conn_rec *scr, const char *line);
+/* public */
+SMTPD_DECLARE_NONSTD(void) smtpd_register_extension(smtpd_conn_rec *scr,
+                                                    const char *line);
        
-  SMTPD_DECLARE_NONSTD(void)
-  smtpd_reset_transaction(smtpd_conn_rec *scr);
+SMTPD_DECLARE_NONSTD(void) smtpd_reset_transaction(smtpd_conn_rec *scr);
 
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode,
-			    unrecognized_command,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *command, char *data));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, connect,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, reset_transaction,
-			    (smtpd_conn_rec *scr));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, helo,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *str));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, ehlo,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *str));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, mail,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *str));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, rcpt,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *str));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, vrfy,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in,
-			     char *str));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, quit,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, data,
-  			    (smtpd_conn_rec *scr, smtpd_return_data *in));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, data_post,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in));
-  APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, queue,
-			    (smtpd_conn_rec *scr, smtpd_return_data *in));
-  
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode,
+                          unrecognized_command,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *command, char *data));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, connect,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, reset_transaction,
+                          (smtpd_conn_rec *scr));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, helo,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *str));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, ehlo,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *str));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, mail,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *str));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, rcpt,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *str));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, vrfy,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in,
+                           char *str));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, quit,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, data,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, data_post,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in));
+APR_DECLARE_EXTERNAL_HOOK(smtpd, SMTPD, smtpd_retcode, queue,
+                          (smtpd_conn_rec *scr, smtpd_return_data *in));
 
 #ifdef __cplusplus
 }

Modified: httpd/mod_smtpd/trunk/smtp.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp.h?rev=239438&r1=239437&r2=239438&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp.h (original)
+++ httpd/mod_smtpd/trunk/smtp.h Tue Aug 23 10:43:29 2005
@@ -41,11 +41,12 @@
     { \
     ns##_LINK_##name##_t *pHook; \
     int n; \
-    ret rv; ret endrv = decline;\
+    ret rv; \
+    ret endrv = decline; \
     apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
 \
     if(!pHookArray) \
-	return ok; \
+	return endrv; \
 \
     pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
     for(n=0 ; n < pHookArray->nelts ; ++n) \
@@ -61,54 +62,51 @@
     return endrv; \
     }
 
-  /* SMTP handlers registration */
-#define HANDLER_PROTOTYPE smtpd_conn_rec *scr, char *buffer, smtpd_return_data *in_data, void *data
+/* SMTP handlers registration */
+#define HANDLER_PROTOTYPE smtpd_conn_rec *scr, char *buffer, \
+smtpd_return_data *in_data, void *data
 
 #define HANDLER_FUNC(name)  smtpd_handler_##name
-#define HANDLER_DECLARE(name) SMTPD_DECLARE(int) HANDLER_FUNC(name) (HANDLER_PROTOTYPE)
+#define HANDLER_DECLARE(name) SMTPD_DECLARE(int) HANDLER_FUNC(name) \
+(HANDLER_PROTOTYPE)
 
-  typedef SMTPD_DECLARE(int) smtpd_handler(HANDLER_PROTOTYPE);
+typedef SMTPD_DECLARE(int) smtpd_handler(HANDLER_PROTOTYPE);
 
-  typedef struct {
+typedef struct {
     int bEnabled; /* Is SMTP Enabled? */
     char *sId; /* Server ID String */
     apr_size_t max_data;
-  } smtpd_svr_config_rec;
+} smtpd_svr_config_rec;
 
-  typedef struct {
+typedef struct {
     smtpd_handler *func;
     const char *help_text;
     void *data;
-  } smtpd_handler_st;
+} smtpd_handler_st;
 
-  void
-  smtpd_process_connection_internal(smtpd_conn_rec *str);
+void smtpd_process_connection_internal(smtpd_conn_rec *str);
 
-  void
-  smtpd_clear_trans_rec(smtpd_trans_rec *);
+void smtpd_clear_trans_rec(smtpd_trans_rec *);
 
-  apr_hash_t *
-  smtpd_get_handlers(void);
+apr_hash_t *smtpd_get_handlers(void);
 
-  apr_status_t
-  smtpd_getline(smtpd_conn_rec *scr, char *data, apr_size_t dlen);
+apr_status_t smtpd_getline(smtpd_conn_rec *scr, char *data, apr_size_t dlen);
 
-  apr_status_t
-  smtpd_respond_multiline(smtpd_conn_rec *scr, int code,
-			  apr_array_header_t *msgs);
+apr_status_t smtpd_respond_multiline(smtpd_conn_rec *scr, int code,
+                                     apr_array_header_t *msgs);
 
-  apr_status_t
-  smtpd_respond_oneline(smtpd_conn_rec *scr, int code, char *message);
+apr_status_t smtpd_respond_oneline(smtpd_conn_rec *scr, int code,
+                                   char *message);
     
-  HANDLER_DECLARE(ehlo);
-  HANDLER_DECLARE(helo);
-  HANDLER_DECLARE(mail);
-  HANDLER_DECLARE(rcpt);
-  HANDLER_DECLARE(data);
-  HANDLER_DECLARE(rset);
-  HANDLER_DECLARE(noop);
-  HANDLER_DECLARE(quit);
-  HANDLER_DECLARE(vrfy);
+HANDLER_DECLARE(ehlo);
+HANDLER_DECLARE(helo);
+HANDLER_DECLARE(mail);
+HANDLER_DECLARE(rcpt);
+HANDLER_DECLARE(data);
+HANDLER_DECLARE(rset);
+HANDLER_DECLARE(noop);
+HANDLER_DECLARE(quit);
+HANDLER_DECLARE(vrfy);
 
 #ifdef __cplusplus
 }

Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=239438&r1=239437&r2=239438&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Tue Aug 23 10:43:29 2005
@@ -126,322 +126,311 @@
 /* should be called at smtpd_hook_connect
  * at least by convention
  */
-SMTPD_DECLARE_NONSTD(void)
-smtpd_register_extension(smtpd_conn_rec *scr, const char *line)
+SMTPD_DECLARE_NONSTD(void) smtpd_register_extension(smtpd_conn_rec *scr,
+                                                    const char *line)
 {
-  (*((char **)apr_array_push(scr->extensions))) =
-    apr_pstrdup(scr->p, line);
+    (*((char **)apr_array_push(scr->extensions))) =
+      apr_pstrdup(scr->p, line);
 }
 
 /* how to reset the transaction */
-SMTPD_DECLARE_NONSTD(void)
-smtpd_reset_transaction(smtpd_conn_rec *scr)
+SMTPD_DECLARE_NONSTD(void) smtpd_reset_transaction(smtpd_conn_rec *scr)
 {
   /* 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(scr);
+    smtpd_run_reset_transaction(scr);
 
-  smtpd_clear_trans_rec(scr->transaction);
+    smtpd_clear_trans_rec(scr->transaction);
 }
 
 /* friend methods */
 /* only our sources can call these */
 
-apr_status_t
-smtpd_getline(smtpd_conn_rec *scr, char *data, apr_size_t dlen)
+apr_status_t smtpd_getline(smtpd_conn_rec *scr, char *data, apr_size_t dlen)
 {
-  apr_status_t rc;
-  apr_bucket *e;
-  const char *str;
-  char *pos, *last_char = data;
-  apr_size_t len, bytes_handled = 0;
-
-  while (1) {
-    rc = ap_get_brigade(scr->c->input_filters, scr->bb_in, AP_MODE_GETLINE,
-			APR_BLOCK_READ, 0);
-    if (rc != APR_SUCCESS) return rc;
-    
-    while(!APR_BRIGADE_EMPTY(scr->bb_in)) {
-      e = APR_BRIGADE_FIRST(scr->bb_in);
-      
-      rc = apr_bucket_read(e, &str, &len, APR_BLOCK_READ);
-      if (rc != APR_SUCCESS) return rc;      
-      apr_bucket_delete(e);
-           
-      if (len == 0) continue;
- 
-      /* Would this overrun our buffer?  If so, we'll die. */
-      if (dlen < bytes_handled + len) {
-	if (data) {
-	  /* ensure this string is NUL terminated */
-	  if (bytes_handled > 0) {
-	    data[bytes_handled-1] = '\0';
-	  }
-	  else {
-	    data[0] = '\0';
-	  }
-	}
-	return APR_ENOSPC;
-      }
-
-      /* Just copy the rest of the data to the end of the old buffer. */
-      pos = data + bytes_handled;
-      memcpy(pos, str, len);
-      last_char = pos + len - 1;
+    apr_status_t rc;
+    apr_bucket *e;
+    const char *str;
+    char *pos, *last_char = data;
+    apr_size_t len, bytes_handled = 0;
+    
+    while (1) {
+        rc = ap_get_brigade(scr->c->input_filters, scr->bb_in, AP_MODE_GETLINE,
+                            APR_BLOCK_READ, 0);
+        if (rc != APR_SUCCESS)
+            return rc;
+        
+        while(!APR_BRIGADE_EMPTY(scr->bb_in)) {
+            e = APR_BRIGADE_FIRST(scr->bb_in);
+            
+            rc = apr_bucket_read(e, &str, &len, APR_BLOCK_READ);
+            if (rc != APR_SUCCESS)
+                return rc;      
+
+            apr_bucket_delete(e);
+            
+            if (len == 0) continue;
             
-      /* We've now processed that new data - update accordingly. */
-      bytes_handled += len;
+            /* Would this overrun our buffer?  If so, we'll die. */
+            if (dlen < bytes_handled + len) {
+                if (data) {
+                    /* ensure this string is NUL terminated */
+                    if (bytes_handled > 0) {
+                        data[bytes_handled-1] = '\0';
+                    }
+                    else {
+                        data[0] = '\0';
+                    }
+                }
+                return APR_ENOSPC;
+            }
+            
+            /* Just copy the rest of the data to the end of the old buffer. */
+            pos = data + bytes_handled;
+            memcpy(pos, str, len);
+            last_char = pos + len - 1;
+            
+            /* We've now processed that new data - update accordingly. */
+            bytes_handled += len;
+        }
+        
+        /* brigade was empty from the beginning, no block? */
+        if (!bytes_handled)
+            return APR_EGENERAL;
+        
+        /* If we got a full line of input, stop reading */
+        if (last_char && (*last_char == APR_ASCII_LF)) {
+            break;
+        }
     }
     
-    /* brigade was empty from the beginning, no block? */
-    if (!bytes_handled)
-      return APR_EGENERAL;
-
-    /* If we got a full line of input, stop reading */
-    if (last_char && (*last_char == APR_ASCII_LF)) {
-      break;
+    /* Now NUL-terminate the string at the end of the line; 
+     * if the last-but-one character is a CR, terminate there */
+    if (last_char > data && last_char[-1] == APR_ASCII_CR) {
+        last_char--;
     }
-  }
-
-  /* Now NUL-terminate the string at the end of the line; 
-   * if the last-but-one character is a CR, terminate there */
-  if (last_char > data && last_char[-1] == APR_ASCII_CR) {
-    last_char--;
-  }
-
-  *last_char = '\0';
-  return APR_SUCCESS;
+    
+    *last_char = '\0';
+    return APR_SUCCESS;
 }
 
-apr_status_t
-smtpd_respond_multiline(smtpd_conn_rec *scr, int code,
-			apr_array_header_t *msgs)
+apr_status_t smtpd_respond_multiline(smtpd_conn_rec *scr, int code,
+                                     apr_array_header_t *msgs)
 {
-  int i;
-
-  for (i = 0; i < msgs->nelts - 1; i++) {
-    ap_fprintf(scr->c->output_filters, scr->bb_out, "%d-%s\r\n",
-	       code, ((char **)msgs->elts)[i]);
+    int i;
+    
+    for (i = 0; i < msgs->nelts - 1; i++) {
+        ap_fprintf(scr->c->output_filters, scr->bb_out, "%d-%s\r\n",
+                   code, ((char **)msgs->elts)[i]);
+        ap_fflush(scr->c->output_filters, scr->bb_out);
+    }
+    
+    ap_fprintf(scr->c->output_filters, scr->bb_out, "%d %s\r\n",
+               code, ((char **)msgs->elts)[i]);
     ap_fflush(scr->c->output_filters, scr->bb_out);
-  }
-
-  ap_fprintf(scr->c->output_filters, scr->bb_out, "%d %s\r\n",
-	     code, ((char **)msgs->elts)[i]);
-  ap_fflush(scr->c->output_filters, scr->bb_out);
-
-  return APR_SUCCESS;
+    
+    return APR_SUCCESS;
 }
 
-apr_status_t
-smtpd_respond_oneline(smtpd_conn_rec *scr, int code, char *message)
+apr_status_t smtpd_respond_oneline(smtpd_conn_rec *scr, int code,
+                                   char *message)
 {
-  ap_fprintf(scr->c->output_filters, scr->bb_out, "%d %s\r\n", code, message);
-  ap_fflush(scr->c->output_filters, scr->bb_out);
-
-  return APR_SUCCESS;
+    ap_fprintf(scr->c->output_filters, scr->bb_out,
+               "%d %s\r\n", code, message);
+    ap_fflush(scr->c->output_filters, scr->bb_out);
+    
+    return APR_SUCCESS;
 }
 
-void
-smtpd_clear_trans_rec(smtpd_trans_rec *str)
+void smtpd_clear_trans_rec(smtpd_trans_rec *str)
 {
-  apr_pool_clear(str->p);
-  str->trans_state = SMTPD_STATE_GOT_NOTHING;
-  str->tfp = NULL;
-  str->protocol_type = SMTPD_PROTOCOL_SMTP;
-  str->rcpt_to = apr_array_make(str->p, 5, sizeof(char *));
-  str->mail_from = NULL;
-  str->helo = NULL;
+    apr_pool_clear(str->p);
+    str->trans_state = SMTPD_STATE_GOT_NOTHING;
+    str->tfp = NULL;
+    str->protocol_type = SMTPD_PROTOCOL_SMTP;
+    str->rcpt_to = apr_array_make(str->p, 5, sizeof(char *));
+    str->mail_from = NULL;
+    str->helo = NULL;
 }
 
-apr_hash_t *
-smtpd_get_handlers() {
-  return smtpd_handlers;
+apr_hash_t *smtpd_get_handlers() {
+    return smtpd_handlers;
 }
 
 /* private methods */
 /* only used in this file */
 
 /* 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)
-{
-  char *dupkey = apr_pstrdup(p, key);
-  smtpd_handler_st *hand = apr_palloc(p, sizeof(*hand));
-
-  hand->func = func;
-  hand->data = data;
-  hand->help_text = help_text;
-
-  ap_str_tolower(dupkey);
-  apr_hash_set(smtpd_handlers, dupkey, APR_HASH_KEY_STRING, hand);
+static void smtpd_register_handler(char *key, smtpd_handler *func,
+                                   const char *help_text, void *data,
+                                   apr_pool_t *p)
+{
+    char *dupkey = apr_pstrdup(p, key);
+    smtpd_handler_st *hand = apr_palloc(p, sizeof(*hand));
+    
+    hand->func = func;
+    hand->data = data;
+    hand->help_text = help_text;
+    
+    ap_str_tolower(dupkey);
+    apr_hash_set(smtpd_handlers, dupkey, APR_HASH_KEY_STRING, hand);
 }
 
 /* Creates the main request record for the connection */
-static smtpd_conn_rec *
-smtpd_create_conn_rec(conn_rec *conn)
+static smtpd_conn_rec *smtpd_create_conn_rec(conn_rec *conn)
 {
-  apr_pool_t *p;
-  smtpd_conn_rec *scr;
-  apr_pool_t *sp;
-  smtpd_trans_rec *str;
-
-  scr = apr_pcalloc(conn->pool, sizeof(*scr));
-  apr_pool_create(&p, conn->pool);
-  scr->p            = p;
-  scr->c            = conn;
-  scr->s            = conn->base_server;
-
-  scr->extensions = apr_array_make(scr->p, 5, sizeof(char *));
-
-  scr->bb_in = apr_brigade_create(scr->p, scr->c->bucket_alloc);
-  scr->bb_out = apr_brigade_create(scr->p, scr->c->bucket_alloc);
-
-  /* REVIEW: does scr need a request_config?
-   * r->request_config  = ap_create_request_config(r->pool);
-   */
-  
-  apr_socket_t *csd =
-    ((core_net_rec *)conn->input_filters->ctx)->client_socket;
-  apr_socket_timeout_set(csd, APR_INT64_C(10000000000000));
-
-  /* create transaction rec */
-  str = apr_pcalloc(scr->p, sizeof(*str));
-
-  apr_pool_create(&sp, scr->p);
-  str->p = sp;
-  smtpd_clear_trans_rec(str);
-
-  scr->transaction = str;
-
-  return scr;
+    apr_pool_t *p;
+    smtpd_conn_rec *scr;
+    apr_pool_t *sp;
+    smtpd_trans_rec *str;
+    
+    scr = apr_pcalloc(conn->pool, sizeof(*scr));
+    apr_pool_create(&p, conn->pool);
+    scr->p            = p;
+    scr->c            = conn;
+    scr->s            = conn->base_server;
+    
+    scr->extensions = apr_array_make(scr->p, 5, sizeof(char *));
+    
+    scr->bb_in = apr_brigade_create(scr->p, scr->c->bucket_alloc);
+    scr->bb_out = apr_brigade_create(scr->p, scr->c->bucket_alloc);
+    
+    /* REVIEW: does scr need a request_config?
+     * r->request_config  = ap_create_request_config(r->pool);
+     */
+    
+    apr_socket_t *csd =
+      ((core_net_rec *)conn->input_filters->ctx)->client_socket;
+    apr_socket_timeout_set(csd, APR_INT64_C(10000000000000));
+    
+    /* create transaction rec */
+    str = apr_pcalloc(scr->p, sizeof(*str));
+    
+    apr_pool_create(&sp, scr->p);
+    str->p = sp;
+    smtpd_clear_trans_rec(str);
+    
+    scr->transaction = str;
+    
+    return scr;
 }
 
 /* process connection hook */
-static int
-process_smtp_connection(conn_rec *c)
+static int process_smtp_connection(conn_rec *c)
 {
-  smtpd_conn_rec *scr;
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(c->base_server->module_config,
-			 &smtpd_module);
-
-  if (!pConfig->bEnabled) {
-    return DECLINED;
-  }
-
-  scr = smtpd_create_conn_rec(c);
-  /* REVIEW: is the status only for mod_status to know?
-   * shoudl we support stati ? 
-   * ap_update_child_status(scr->c->sbh, SERVER_BUSY_KEEPALIVE, r);
-   */
-
-  smtpd_process_connection_internal(scr);
-
-  return OK;
+    smtpd_conn_rec *scr;
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(c->base_server->module_config,
+                           &smtpd_module);
+    
+    if (!pConfig->bEnabled) {
+        return DECLINED;
+    }
+    
+    scr = smtpd_create_conn_rec(c);
+    /* REVIEW: is the status only for mod_status to know?
+     * shoudl we support stati ? 
+     * ap_update_child_status(scr->c->sbh, SERVER_BUSY_KEEPALIVE, r);
+     */
+    
+    smtpd_process_connection_internal(scr);
+    
+    return OK;
 }
 
 /* creates server config  */
-static void *
-smtpd_create_server_config(apr_pool_t *p, server_rec *s)
+static void *smtpd_create_server_config(apr_pool_t *p, server_rec *s)
 {
-  smtpd_svr_config_rec *pConfig = apr_pcalloc(p, sizeof(*pConfig));
-
-  pConfig->bEnabled = 0;
-  pConfig->sId = apr_pcalloc(p, 512);
-  apr_cpystrn(pConfig->sId, "mod_smtpd", 512);
-  pConfig->max_data = 0x80000;
-  return pConfig;
+    smtpd_svr_config_rec *pConfig = apr_pcalloc(p, sizeof(*pConfig));
+    
+    pConfig->bEnabled = 0;
+    pConfig->sId = apr_pcalloc(p, 512);
+    apr_cpystrn(pConfig->sId, "mod_smtpd", 512);
+    pConfig->max_data = 0x80000;
+    return pConfig;
 }
 
 /* sets protocol status in server config */
-static const char *
-set_protocol_status(cmd_parms *cmd, 
-		    void *struct_ptr, 
-		    int arg)
-{
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(cmd->server->module_config,
-			 &smtpd_module);
-  pConfig->bEnabled = arg ? 1 : 0;
+static const char *set_protocol_status(cmd_parms *cmd, void *struct_ptr,
+                                       int arg)
+{
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(cmd->server->module_config,
+                           &smtpd_module);
+    pConfig->bEnabled = arg ? 1 : 0;
 
-  return NULL;
+    return NULL;
 }
 
 /* sets server id string in server config */
-static const char *
-set_id_string(cmd_parms *cmd,
-	      void *struct_ptr,
-	      const char *arg)
-{
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(cmd->server->module_config,
-			 &smtpd_module);
-
-  apr_cpystrn(pConfig->sId, arg, 512);
+static const char *set_id_string(cmd_parms *cmd, void *struct_ptr,
+                                 const char *arg)
+{
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(cmd->server->module_config,
+                           &smtpd_module);
+    
+    apr_cpystrn(pConfig->sId, arg, 512);
     
-  return NULL;
+    return NULL;
 }
 
 /* sets server id string in server config */
-static const char *
-set_max_data_size(cmd_parms *cmd,
-		  void *struct_ptr,
-		  const char *arg)
-{
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(cmd->server->module_config,
-			 &smtpd_module);
-
-  pConfig->max_data = atoi(arg);
+static const char *set_max_data_size(cmd_parms *cmd, void *struct_ptr,
+                                     const char *arg)
+{
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(cmd->server->module_config,
+                           &smtpd_module);
     
-  return NULL;
+    pConfig->max_data = atoi(arg);
+    
+    return NULL;
 }
 
 static const command_rec smtpd_cmds[] = {
-  AP_INIT_FLAG("SmtpProtocol", set_protocol_status, NULL,  RSRC_CONF,
-	       "Whether this server is serving the SMTP protocol."
-	       "Default: Off"),
-  AP_INIT_TAKE1("SmtpServerId", set_id_string, NULL,  RSRC_CONF,
-		"Server identification to advertise."
-		"Default: mod_smtpd"),
-  AP_INIT_TAKE1("SmtpMaxDataSize", set_max_data_size, NULL,  RSRC_CONF,
-		"Maximum input to receive after data command in bytes."
-		"Default: 8388608"),
+    AP_INIT_FLAG("SmtpProtocol", set_protocol_status, NULL,  RSRC_CONF,
+                 "Whether this server is serving the SMTP protocol."
+                 "Default: Off"),
+    AP_INIT_TAKE1("SmtpServerId", set_id_string, NULL,  RSRC_CONF,
+                  "Server identification to advertise."
+                  "Default: mod_smtpd"),
+    AP_INIT_TAKE1("SmtpMaxDataSize", set_max_data_size, NULL,  RSRC_CONF,
+                  "Maximum input to receive after data command in bytes."
+                  "Default: 8388608"),
 
-  { NULL }
+    { NULL }
 };
 
 /* registers httpd hooks */
-static void
-register_hooks (apr_pool_t *p)
+static void register_hooks (apr_pool_t *p)
 {
-  /* register connection processor  */
-  ap_hook_process_connection(process_smtp_connection, NULL, 
-			     NULL, APR_HOOK_MIDDLE);
-
-  smtpd_handlers = apr_hash_make(p);
-
-  smtpd_register_handler("EHLO", HANDLER_FUNC(ehlo), "ehlo", NULL, p);
-  smtpd_register_handler("HELO", HANDLER_FUNC(helo), "helo", NULL, p);
-  smtpd_register_handler("MAIL", HANDLER_FUNC(mail), "mail", NULL, p);
-  smtpd_register_handler("RCPT", HANDLER_FUNC(rcpt), "rcpt", NULL, p);
-  smtpd_register_handler("DATA", HANDLER_FUNC(data), "data", NULL, p);
-  smtpd_register_handler("RSET", HANDLER_FUNC(rset), "rset", NULL, p);
-  smtpd_register_handler("NOOP", HANDLER_FUNC(noop), "noop", NULL, p);
-  smtpd_register_handler("QUIT", HANDLER_FUNC(quit), "quit", NULL, p);
-  smtpd_register_handler("VRFY", HANDLER_FUNC(vrfy), "vrfy", NULL, p);
+    /* register connection processor  */
+    ap_hook_process_connection(process_smtp_connection, NULL, 
+                               NULL, APR_HOOK_MIDDLE);
+    
+    smtpd_handlers = apr_hash_make(p);
+    
+    smtpd_register_handler("EHLO", HANDLER_FUNC(ehlo), "ehlo", NULL, p);
+    smtpd_register_handler("HELO", HANDLER_FUNC(helo), "helo", NULL, p);
+    smtpd_register_handler("MAIL", HANDLER_FUNC(mail), "mail", NULL, p);
+    smtpd_register_handler("RCPT", HANDLER_FUNC(rcpt), "rcpt", NULL, p);
+    smtpd_register_handler("DATA", HANDLER_FUNC(data), "data", NULL, p);
+    smtpd_register_handler("RSET", HANDLER_FUNC(rset), "rset", NULL, p);
+    smtpd_register_handler("NOOP", HANDLER_FUNC(noop), "noop", NULL, p);
+    smtpd_register_handler("QUIT", HANDLER_FUNC(quit), "quit", NULL, p);
+    smtpd_register_handler("VRFY", HANDLER_FUNC(vrfy), "vrfy", NULL, p);
 }
 
 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 */
+    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 */
 };

Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=239438&r1=239437&r2=239438&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Tue Aug 23 10:43:29 2005
@@ -36,569 +36,578 @@
 
 extern module AP_MODULE_DECLARE_DATA smtpd_module;
 
-inline static int
-smtpd_handle_unrecognized_command(smtpd_conn_rec *scr,
-				  smtpd_return_data *in_data,
-				  char *command, char *data);
+inline static int smtpd_handle_unrecognized_command(smtpd_conn_rec *scr,
+                                                    smtpd_return_data *in_data,
+                                                    char *command, char *data);
 
 #define BUFFER_STR_LEN 1024
-void
-smtpd_process_connection_internal(smtpd_conn_rec *scr)
+void smtpd_process_connection_internal(smtpd_conn_rec *scr)
 {
-  apr_pool_t *p;
-  apr_hash_t *handlers = smtpd_get_handlers();
-  char cmdbuff[BUFFER_STR_LEN];
-  smtpd_handler_st *handle_func;
-  char *buffer = cmdbuff;
-  char *command;
-  smtpd_return_data in_data;
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(scr->s->module_config,
-			 &smtpd_module);
-
-  apr_pool_create(&p, scr->p);
-  in_data.p = p;
-
-  in_data.msgs = NULL;
-  switch(smtpd_run_connect(scr, &in_data)) {
-  case SMTPD_DENY:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "Connection Denied");
-    if (in_data.msgs) {
-      smtpd_respond_multiline(scr, 550, in_data.msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "Connection from you denied, bye bye.");
-    }
-    goto end;
-  case SMTPD_DENYSOFT:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "Connection Denied");
-    if (in_data.msgs) {
-      smtpd_respond_multiline(scr, 450, in_data.msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "Connection from you temporarily "
-			    "denied, bye bye.");
-    }
-    goto end;
-  case SMTPD_DONE:
-    break;
-  case SMTPD_DONE_DISCONNECT:
-    goto end;
-  default:
-    sprintf(buffer, "%s %s", scr->s->server_hostname, pConfig->sId);
-    smtpd_respond_oneline(scr, 220, buffer);
-    break;
-  }
-
-  while (smtpd_getline(scr, buffer, BUFFER_STR_LEN) == APR_SUCCESS) {
-    apr_pool_clear(p);
-    command = ap_getword_white_nc(p, &buffer);
-    ap_str_tolower(command);
-    handle_func = apr_hash_get(handlers, command, APR_HASH_KEY_STRING);
-
+    apr_pool_t *p;
+    apr_hash_t *handlers = smtpd_get_handlers();
+    char cmdbuff[BUFFER_STR_LEN];
+    smtpd_handler_st *handle_func;
+    char *buffer = cmdbuff;
+    char *command;
+    smtpd_return_data in_data;
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(scr->s->module_config,
+                           &smtpd_module);
+    
+    apr_pool_create(&p, scr->p);
+    in_data.p = p;
+    
     in_data.msgs = NULL;
-    /* command not recognized */
-    if (!handle_func)  {
-      if (!smtpd_handle_unrecognized_command(scr, &in_data, command, buffer))
-	break;
-    } else {
-      if (!handle_func->func(scr, buffer, &in_data, handle_func->data))
-	break;
+    switch(smtpd_run_connect(scr, &in_data)) {
+    case SMTPD_DENY:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "Connection Denied");
+        if (in_data.msgs) {
+            smtpd_respond_multiline(scr, 550, in_data.msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550,
+                                  "Connection from you denied, bye bye.");
+        }
+        goto end;
+    case SMTPD_DENYSOFT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "Connection Denied");
+        if (in_data.msgs) {
+            smtpd_respond_multiline(scr, 450, in_data.msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "Connection from you temporarily "
+                                  "denied, bye bye.");
+        }
+        goto end;
+    case SMTPD_DONE:
+        break;
+    case SMTPD_DONE_DISCONNECT:
+        goto end;
+    default:
+        sprintf(buffer, "%s %s", scr->s->server_hostname, pConfig->sId);
+        smtpd_respond_oneline(scr, 220, buffer);
+        break;
+    }
+    
+    while (smtpd_getline(scr, buffer, BUFFER_STR_LEN) == APR_SUCCESS) {
+        apr_pool_clear(p);
+        command = ap_getword_white_nc(p, &buffer);
+        ap_str_tolower(command);
+        handle_func = apr_hash_get(handlers, command, APR_HASH_KEY_STRING);
+        
+        in_data.msgs = NULL;
+        /* command not recognized */
+        if (!handle_func)  {
+            if (!smtpd_handle_unrecognized_command(scr, &in_data, command,
+                                                   buffer))
+                break;
+        } else {
+            if (!handle_func->func(scr, buffer, &in_data, handle_func->data))
+                break;
+        }
+        
+        buffer = cmdbuff;
     }
     
-    buffer = cmdbuff;
-  }
-
  end:
-  return;
+    return;
 }
 
-inline static int
-smtpd_handle_unrecognized_command(smtpd_conn_rec *scr,
-				  smtpd_return_data *in_data,
-				  char *command, char *data) {
-  switch(smtpd_run_unrecognized_command(scr, in_data, command, data)) {
-  case SMTPD_DENY:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 521, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 521, "Command Denied");
-    }
+inline static int smtpd_handle_unrecognized_command(smtpd_conn_rec *scr,
+                                                    smtpd_return_data *in_data,
+                                                    char *command, char *data)
+{
+    switch(smtpd_run_unrecognized_command(scr, in_data, command, data)) {
+    case SMTPD_DENY:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 521, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 521, "Command Denied");
+        }
     return 521;
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  default:
-    smtpd_respond_oneline(scr, 500, "Syntax error, command unrecognized");
-    return 500;
-  }
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    default:
+        smtpd_respond_oneline(scr, 500, "Syntax error, command unrecognized");
+        return 500;
+    }
 
 }
 
-HANDLER_DECLARE(ehlo) {
-  smtpd_trans_rec *str = scr->transaction;
-
-  if (buffer[0] == '\0') {
-    smtpd_respond_oneline(scr, 501, "Syntax: EHLO hostname");
-    return 501;
-  }
-  
-  switch(smtpd_run_ehlo(scr, in_data, buffer)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  case SMTPD_DENY:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "");
+HANDLER_DECLARE(ehlo)
+{
+    smtpd_trans_rec *str = scr->transaction;
+    
+    if (buffer[0] == '\0') {
+        smtpd_respond_oneline(scr, 501, "Syntax: EHLO hostname");
+        return 501;
     }
-    return 550;
-  case SMTPD_DENYSOFT:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
+    
+    switch(smtpd_run_ehlo(scr, in_data, buffer)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    case SMTPD_DENY:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "");
+        }
+        return 550;
+    case SMTPD_DENYSOFT:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "");
+        }
+        return 450;
+    default:
+        break;
+    }
+    
+    /* default behavior: */
+    
+    /* RFC 2821 states that when ehlo or helo is received, reset */
+    /* state */
+    smtpd_reset_transaction(scr);
+    
+    str->helo = apr_pstrdup(str->p, buffer);
+    str->trans_state = SMTPD_STATE_GOT_HELO;
+    str->protocol_type = SMTPD_PROTOCOL_ESMTP;
+    
+    if (scr->extensions->nelts) {
+        apr_array_header_t *first  = apr_array_make(str->p, 1, sizeof(char *));
+        (*((char **)apr_array_push(first))) = str->helo;
+        apr_array_cat(first, scr->extensions);
+        
+        smtpd_respond_multiline(scr, 250, first);
     } else {
-      smtpd_respond_oneline(scr, 450, "");
+        smtpd_respond_oneline(scr, 250, str->helo);
     }
-    return 450;
-  default:
-    break;
-  }
-
-  /* default behavior: */
-
-  /* RFC 2821 states that when ehlo or helo is received, reset */
-  /* state */
-  smtpd_reset_transaction(scr);
-
-  str->helo = apr_pstrdup(str->p, buffer);
-  str->trans_state = SMTPD_STATE_GOT_HELO;
-  str->protocol_type = SMTPD_PROTOCOL_ESMTP;
-
-  if (scr->extensions->nelts) {
-    apr_array_header_t *first  = apr_array_make(str->p, 1, sizeof(char *));
-    (*((char **)apr_array_push(first))) = str->helo;
-    apr_array_cat(first, scr->extensions);
     
-    smtpd_respond_multiline(scr, 250, first);
-  } else {
-    smtpd_respond_oneline(scr, 250, str->helo);
-  }
-
-  return 250;
+    return 250;
 }
 
-HANDLER_DECLARE(helo) {
-  smtpd_trans_rec *str = scr->transaction;
-
-  /* bad syntax */
-  if (buffer[0] == '\0') {
-    smtpd_respond_oneline(scr, 501, "Syntax: HELO hostname");
-    return 501;
-  }
-
-  switch(smtpd_run_helo(scr, in_data, buffer)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  case SMTPD_DENY:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "");
-    }
-    return 550;
-  case SMTPD_DENYSOFT:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "");
+HANDLER_DECLARE(helo)
+{
+    smtpd_trans_rec *str = scr->transaction;
+    
+    /* bad syntax */
+    if (buffer[0] == '\0') {
+        smtpd_respond_oneline(scr, 501, "Syntax: HELO hostname");
+        return 501;
     }
-    return 450;
-  default:
-    break;
-  }
-
-  /* RFC 2821 states that when ehlo or helo is received, reset */
-  /* state */
-  smtpd_reset_transaction(scr);
-  
-  str->helo = apr_pstrdup(str->p, buffer);
-  str->trans_state = SMTPD_STATE_GOT_HELO;
-  smtpd_respond_oneline(scr, 250, str->helo);
-
-  return 250;
-}
-
-HANDLER_DECLARE(mail) {
-  smtpd_trans_rec *str = scr->transaction;
-  char *loc;
-
-  /* already got mail */
-  if (str->trans_state == SMTPD_STATE_GOT_MAIL) {
-    smtpd_respond_oneline(scr, 503, "Error: Nested MAIL command");
-    return 503;
-  }
-
-  /* bad syntax */
-  if ((loc = ap_strcasestr(buffer, "from:")) == NULL) {
-    smtpd_respond_oneline(scr, 501,  "Syntax: MAIL FROM:<address>");
-    return 501;
-  }
-
-  loc += sizeof("from:") - 1;
-
-  ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-	       "full from_parameter: %s", loc);  
-
-  switch(smtpd_run_mail(scr, in_data, loc)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    /* zero to disconnect */
-    return 0;
-  case SMTPD_DENY:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "deny mail from %s (%s)", loc,
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "denied");
+    
+    switch(smtpd_run_helo(scr, in_data, buffer)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    case SMTPD_DENY:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "");
+        }
+        return 550;
+    case SMTPD_DENYSOFT:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "");
+        }
+        return 450;
+    default:
+        break;
     }
-    return 550;
-  case SMTPD_DENYSOFT:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "denysoft mail from %s (%s)", loc,
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "temporarily denied");
+    
+    /* RFC 2821 states that when ehlo or helo is received, reset */
+    /* state */
+    smtpd_reset_transaction(scr);
+    
+    str->helo = apr_pstrdup(str->p, buffer);
+    str->trans_state = SMTPD_STATE_GOT_HELO;
+    smtpd_respond_oneline(scr, 250, str->helo);
+    
+    return 250;
+}
+
+HANDLER_DECLARE(mail)
+{
+    smtpd_trans_rec *str = scr->transaction;
+    char *loc;
+    
+    /* already got mail */
+    if (str->trans_state == SMTPD_STATE_GOT_MAIL) {
+        smtpd_respond_oneline(scr, 503, "Error: Nested MAIL command");
+        return 503;
     }
-    return 450;
-  case SMTPD_DENY_DISCONNECT:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "deny mail from %s (%s)", loc,
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "denied");
+    
+    /* bad syntax */
+    if ((loc = ap_strcasestr(buffer, "from:")) == NULL) {
+        smtpd_respond_oneline(scr, 501,  "Syntax: MAIL FROM:<address>");
+        return 501;
     }
-    /* zero to disconnect */
-    return 0;
-  case SMTPD_DENYSOFT_DISCONNECT:
+    
+    loc += sizeof("from:") - 1;
+    
     ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "denysoft mail from %s (%s)", loc,
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "temporarily denied");
-    }
-    /* zero to disconnect */
-    return 0;
-  default:
-    break;
-  }
-
-  /* default handling */
-  str->mail_from = apr_pstrdup(str->p, loc);
-  str->trans_state = SMTPD_STATE_GOT_MAIL;
-  smtpd_respond_oneline(scr, 250, "Ok");
-
-  return 250;
-}
-
-HANDLER_DECLARE(rcpt) {
-  smtpd_trans_rec *str = scr->transaction;
-  char *loc;
-
-  /* need mail first */
-  if ((str->trans_state != SMTPD_STATE_GOT_MAIL) &&
-      (str->trans_state != SMTPD_STATE_GOT_RCPT)) {
-    smtpd_respond_oneline(scr, 503, "Error: need MAIL command");
-    return 503;
-  }
-
-  /* bad syntax */
-  if ((loc = ap_strcasestr(buffer, "to:")) == NULL) {
-    smtpd_respond_oneline(scr, 501, "Syntax: RCPT TO:<address>");
-    return 501;
-  }
-
-  loc += sizeof("to:") - 1;
-
-  switch(smtpd_run_rcpt(scr, in_data, loc)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  case SMTPD_DENY:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "relaying denied");
+                 "full from_parameter: %s", loc);  
+    
+    switch(smtpd_run_mail(scr, in_data, loc)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        /* zero to disconnect */
+        return 0;
+    case SMTPD_DENY:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "deny mail from %s (%s)", loc,
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "denied");
+        }
+        return 550;
+    case SMTPD_DENYSOFT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "denysoft mail from %s (%s)", loc,
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "temporarily denied");
+        }
+        return 450;
+    case SMTPD_DENY_DISCONNECT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "deny mail from %s (%s)", loc,
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "denied");
+        }
+        /* zero to disconnect */
+        return 0;
+    case SMTPD_DENYSOFT_DISCONNECT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "denysoft mail from %s (%s)", loc,
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");  
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "temporarily denied");
+        }
+        /* zero to disconnect */
+        return 0;
+    default:
+        break;
     }
-    return 550;
-  case SMTPD_DENYSOFT:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "relaying temporarily denied");
+    
+    /* default handling */
+    str->mail_from = apr_pstrdup(str->p, loc);
+    str->trans_state = SMTPD_STATE_GOT_MAIL;
+    smtpd_respond_oneline(scr, 250, "Ok");
+    
+    return 250;
+}
+
+HANDLER_DECLARE(rcpt)
+{
+    smtpd_trans_rec *str = scr->transaction;
+    char *loc;
+    
+    /* need mail first */
+    if ((str->trans_state != SMTPD_STATE_GOT_MAIL) &&
+        (str->trans_state != SMTPD_STATE_GOT_RCPT)) {
+        smtpd_respond_oneline(scr, 503, "Error: need MAIL command");
+        return 503;
     }
-    return 450;
-  case SMTPD_DENY_DISCONNECT:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "delivery denied (%s)",
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 550, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 550, "relaying denied");
+    
+    /* bad syntax */
+    if ((loc = ap_strcasestr(buffer, "to:")) == NULL) {
+        smtpd_respond_oneline(scr, 501, "Syntax: RCPT TO:<address>");
+        return 501;
     }
-    return 0;
-  case SMTPD_DENYSOFT_DISCONNECT:
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
-		 "delivery denied (%s)",
-		 in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 450, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 450, "relaying temporarily denied");
+    
+    loc += sizeof("to:") - 1;
+    
+    switch(smtpd_run_rcpt(scr, in_data, loc)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    case SMTPD_DENY:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "relaying denied");
+        }
+        return 550;
+    case SMTPD_DENYSOFT:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "relaying temporarily denied");
+        }
+        return 450;
+    case SMTPD_DENY_DISCONNECT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "delivery denied (%s)",
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 550, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 550, "relaying denied");
+        }
+        return 0;
+    case SMTPD_DENYSOFT_DISCONNECT:
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
+                     "delivery denied (%s)",
+                     in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 450, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 450, "relaying temporarily denied");
+        }
+        return 0;
+    case SMTPD_OK: /* recipient is okay */
+        break;
+    default:
+        smtpd_respond_oneline(scr, 450,
+                              "No plugin decided if relaying is allowed");
+        return 450;
     }
-    return 0;
-  case SMTPD_OK: /* recipient is okay */
-    break;
-  default:
-    smtpd_respond_oneline(scr, 450,
-			  "No plugin decided if relaying is allowed");
-    return 450;
-  }
-
-  /* add a recipient */
-  (*((char **)apr_array_push(str->rcpt_to))) = apr_pstrdup(str->p, loc);
-  str->trans_state = SMTPD_STATE_GOT_RCPT;
-  smtpd_respond_oneline(scr, 250, "Ok");
-
-  return 250;
+    
+    /* add a recipient */
+    (*((char **)apr_array_push(str->rcpt_to))) = apr_pstrdup(str->p, loc);
+    str->trans_state = SMTPD_STATE_GOT_RCPT;
+    smtpd_respond_oneline(scr, 250, "Ok");
+    
+    return 250;
 }
 
 
-inline static int
-smtpd_queue(smtpd_conn_rec *scr, smtpd_return_data *in_data) {
+inline static int smtpd_queue(smtpd_conn_rec *scr, smtpd_return_data *in_data)
+{
     switch(smtpd_run_queue(scr, in_data)) {
     case SMTPD_DONE:
-      return 1;
+        return 1;
     case SMTPD_DONE_DISCONNECT:
-      return 0;
+        return 0;
     case SMTPD_OK:
-      if (in_data->msgs) {
-	smtpd_respond_multiline(scr, 250, in_data->msgs);
-      } else {
-	smtpd_respond_oneline(scr, 250, "Queued");
-      }
-      return 250;
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 250, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 250, "Queued");
+        }
+        return 250;
     case SMTPD_DENY:
-      if (in_data->msgs) {
-	smtpd_respond_multiline(scr, 552, in_data->msgs);
-      } else {
-	smtpd_respond_oneline(scr, 552, "Message denied");
-      }
-      return 552;
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 552, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 552, "Message denied");
+        }
+        return 552;
     case SMTPD_DENYSOFT:
-      if (in_data->msgs) {
-	smtpd_respond_multiline(scr, 452, in_data->msgs);
-      } else {
-	smtpd_respond_oneline(scr, 452, "Message denied temporarily");
-      }
-      return 452;
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 452, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 452, "Message denied temporarily");
+        }
+        return 452;
     default:
-      if (in_data->msgs) {
-	smtpd_respond_multiline(scr, 451, in_data->msgs);
-      } else {
-	smtpd_respond_oneline(scr, 451,
-			      "Queuing declined or disabled; try again later");
-      }
-      return 451;
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 451, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 451,
+                                  "Queuing declined or disabled; "
+                                  "try again later");
+        }
+        return 451;
     }
 }
 
 
-HANDLER_DECLARE(data) {
-  smtpd_trans_rec *str = scr->transaction;
-  smtpd_svr_config_rec *pConfig =
-    ap_get_module_config(scr->s->module_config,
-			 &smtpd_module);
-  int rv, retval = 0;
-  char *tempfile;
-  apr_bucket_brigade *bb;
-  apr_file_t *tfp;
-  apr_size_t len, total_data = 0;
-
-  switch(smtpd_run_data(scr, in_data)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  case SMTPD_DENY:
-    /* REVIEW: should we reset state here? */
-    /* smtpd_clear_request_rec(sr); */
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 554, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 554, "Message denied");
+HANDLER_DECLARE(data)
+{
+    smtpd_trans_rec *str = scr->transaction;
+    smtpd_svr_config_rec *pConfig =
+      ap_get_module_config(scr->s->module_config,
+                           &smtpd_module);
+    int rv, retval = 0;
+    char *tempfile;
+    apr_bucket_brigade *bb;
+    apr_file_t *tfp;
+    apr_size_t len, total_data = 0;
+    
+    switch(smtpd_run_data(scr, in_data)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    case SMTPD_DENY:
+        /* REVIEW: should we reset state here? */
+        /* smtpd_clear_request_rec(sr); */
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 554, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 554, "Message denied");
+        }
+        return 554;
+    case SMTPD_DENYSOFT:
+        /* REVIEW: should we reset state here? */
+        /* smtpd_clear_request_rec(sr); */
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 451, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 451, "Message denied temporarily");
+        }
+        return 451;
+    case SMTPD_DENY_DISCONNECT:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 554, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 554, "Message denied");
+        }
+        return 0;
+    case SMTPD_DENYSOFT_DISCONNECT:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 451, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 451, "Message denied temporarily");
+        }
+        return 0;
+    default:
+        break;
     }
-    return 554;
-  case SMTPD_DENYSOFT:
-    /* REVIEW: should we reset state here? */
-    /* smtpd_clear_request_rec(sr); */
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 451, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 451, "Message denied temporarily");
+    
+    if (str->trans_state != SMTPD_STATE_GOT_RCPT) {
+        smtpd_respond_oneline(scr, 503, "Error: need RCPT command");
+        return 503;
     }
-    return 451;
-  case SMTPD_DENY_DISCONNECT:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 554, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 554, "Message denied");
+    
+    smtpd_respond_oneline(scr, 354, "End data with <CR><LF>.<CR><LF>");
+    
+    bb = apr_brigade_create(scr->p, scr->c->bucket_alloc);
+    
+    tempfile = apr_pstrdup(str->p, "/tmp/tmp.XXXXXX");
+    rv = apr_file_mktemp(&tfp, tempfile,
+                         APR_CREATE | APR_WRITE | APR_READ |
+                         APR_DELONCLOSE, scr->p);
+    
+    if (rv != APR_SUCCESS) {
+        smtpd_respond_oneline(scr, 421, "Error: Internal");
+        /* file error close connection */
+        return 0;
     }
-    return 0;
-  case SMTPD_DENYSOFT_DISCONNECT:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 451, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 451, "Message denied temporarily");
+    
+    /* 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 ((smtpd_getline(scr, buffer, BUFFER_STR_LEN) == APR_SUCCESS) &&
+           (strcmp(buffer, ".")) &&
+           (total_data < pConfig->max_data)) {
+        apr_file_write(tfp, buffer, &len);
+        len = sizeof("\n");
+        apr_file_write(tfp, "\n", &len);
+        total_data += len;
     }
-    return 0;
-  default:
-    break;
-  }
-
-  if (str->trans_state != SMTPD_STATE_GOT_RCPT) {
-    smtpd_respond_oneline(scr, 503, "Error: need RCPT command");
-    return 503;
-  }
-
-  smtpd_respond_oneline(scr, 354, "End data with <CR><LF>.<CR><LF>");
-  
-  bb = apr_brigade_create(scr->p, scr->c->bucket_alloc);
-
-  tempfile = apr_pstrdup(str->p, "/tmp/tmp.XXXXXX");
-  rv = apr_file_mktemp(&tfp, tempfile,
-		       APR_CREATE | APR_WRITE | APR_READ |
-		       APR_DELONCLOSE, scr->p);
-
-  if (rv != APR_SUCCESS) {
-    smtpd_respond_oneline(scr, 421, "Error: Internal");
-    /* 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 */
-  while ((smtpd_getline(scr, buffer, BUFFER_STR_LEN) == APR_SUCCESS) &&
-	 (strcmp(buffer, ".")) &&
-	 (total_data < pConfig->max_data)) {
-    apr_file_write(tfp, buffer, &len);
-    len = sizeof("\n");
-    apr_file_write(tfp, "\n", &len);
-    total_data += len;
-  }
-
-  str->tfp = tfp;
+    
+    str->tfp = tfp;
   
-  switch(smtpd_run_data_post(scr, in_data)) {
-  case SMTPD_DONE:
-    retval = 1;
-    goto cleanup;
-  case SMTPD_DONE_DISCONNECT:
-    retval = 0;
-    goto cleanup;
-  case SMTPD_DENY:
-    retval = 552;
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 552, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 552, "Message denied");
-    }
-    break;
-  case SMTPD_DENYSOFT:
-    retval = 452;
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 452, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 452, "Message denied temporarily");
+    switch(smtpd_run_data_post(scr, in_data)) {
+    case SMTPD_DONE:
+        retval = 1;
+        goto cleanup;
+    case SMTPD_DONE_DISCONNECT:
+        retval = 0;
+        goto cleanup;
+    case SMTPD_DENY:
+        retval = 552;
+        if (in_data->msgs) {
+        smtpd_respond_multiline(scr, 552, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 552, "Message denied");
+        }
+        break;
+    case SMTPD_DENYSOFT:
+        retval = 452;
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 452, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 452, "Message denied temporarily");
+        }
+        break;
+    default:
+        retval = smtpd_queue(scr, in_data);
     }
-    break;
-  default:
-    retval = smtpd_queue(scr, in_data);
-  }
-
-  smtpd_reset_transaction(scr);
-
+    
+    smtpd_reset_transaction(scr);
+    
  cleanup:
-  apr_file_close(tfp);
-  return retval;
+    apr_file_close(tfp);
+    return retval;
 }
 
-HANDLER_DECLARE(rset) {
-  smtpd_reset_transaction(scr);
-
-  smtpd_respond_oneline(scr, 250, "Ok");
-
-  return 250;
+HANDLER_DECLARE(rset)
+{
+    smtpd_reset_transaction(scr);
+    smtpd_respond_oneline(scr, 250, "Ok");
+    
+    return 250;
 }
 
-HANDLER_DECLARE(noop) {
-  smtpd_respond_oneline(scr, 250, "Ok");
-
-  return 250;
+HANDLER_DECLARE(noop)
+{
+    smtpd_respond_oneline(scr, 250, "Ok");
+    
+    return 250;
 }
 
-HANDLER_DECLARE(quit) {
-  if (smtpd_run_quit(scr, in_data) != SMTPD_DONE) {
-    smtpd_respond_oneline(scr, 221, "Bye");
-  }
-  /* zero to disconnect */
-  return 0;
+HANDLER_DECLARE(quit)
+{
+    if (smtpd_run_quit(scr, in_data) != SMTPD_DONE) {
+        smtpd_respond_oneline(scr, 221, "Bye");
+    }
+    /* zero to disconnect */
+    return 0;
 }
 
-HANDLER_DECLARE(vrfy) {
- 
-  switch(smtpd_run_vrfy(scr, in_data, buffer)) {
-  case SMTPD_DONE:
-    return 1;
-  case SMTPD_DONE_DISCONNECT:
-    return 0;
-  case SMTPD_DENY:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 554, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 554, "Address denied");
-    }
-    return 554;
-  case SMTPD_OK: /* user is okay */
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 250, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 250, "Address okay");
-    }
-    return 250;
-  default:
-    if (in_data->msgs) {
-      smtpd_respond_multiline(scr, 252, in_data->msgs);
-    } else {
-      smtpd_respond_oneline(scr, 252,
-			    "Address seems fine, but we might not accept it.");
+HANDLER_DECLARE(vrfy)
+{
+    switch(smtpd_run_vrfy(scr, in_data, buffer)) {
+    case SMTPD_DONE:
+        return 1;
+    case SMTPD_DONE_DISCONNECT:
+        return 0;
+    case SMTPD_DENY:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 554, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 554, "Address denied");
+        }
+        return 554;
+    case SMTPD_OK: /* user is okay */
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 250, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 250, "Address okay");
+        }
+        return 250;
+    default:
+        if (in_data->msgs) {
+            smtpd_respond_multiline(scr, 252, in_data->msgs);
+        } else {
+            smtpd_respond_oneline(scr, 252,
+                                  "Address seems fine, "
+                                  "but we might not accept it.");
+        }
+        return 252;
     }
-    return 252;
-  }
 }



Mime
View raw message