httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From soc-r...@apache.org
Subject svn commit: r374089 - in /httpd/mod_smtpd/trunk/src: mod_smtpd.h smtp_core.c smtp_protocol.c
Date Wed, 01 Feb 2006 15:51:04 GMT
Author: soc-rian
Date: Wed Feb  1 07:51:00 2006
New Revision: 374089

URL: http://svn.apache.org/viewcvs?rev=374089&view=rev
Log:
Framework for implementing bouncing.


Modified:
    httpd/mod_smtpd/trunk/src/mod_smtpd.h
    httpd/mod_smtpd/trunk/src/smtp_core.c
    httpd/mod_smtpd/trunk/src/smtp_protocol.c

Modified: httpd/mod_smtpd/trunk/src/mod_smtpd.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/mod_smtpd.h?rev=374089&r1=374088&r2=374089&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/src/mod_smtpd.h Wed Feb  1 07:51:00 2006
@@ -93,7 +93,7 @@
     apr_table_t *mail_parameters;
 
     /* recipient list */
-    apr_array_header_t *rcpt_to;
+    apr_table_t *rcpt_to;
 
     /* rcpt-parameters */
     apr_table_t *rcpt_parameters;

Modified: httpd/mod_smtpd/trunk/src/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/smtp_core.c?rev=374089&r1=374088&r2=374089&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/src/smtp_core.c Wed Feb  1 07:51:00 2006
@@ -53,7 +53,7 @@
     apr_pool_clear(str->p);
     str->trans_state = SMTPD_STATE_GOT_NOTHING;
     str->tfp = NULL;
-    str->rcpt_to = apr_array_make(str->p, 5, sizeof(char *));
+    str->rcpt_to = apr_table_make(str->p, 5);
     str->mail_from = NULL;
     str->headers = apr_table_make(str->p, 5);
     str->mail_parameters = apr_table_make(str->p, 5);

Modified: httpd/mod_smtpd/trunk/src/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/smtp_protocol.c?rev=374089&r1=374088&r2=374089&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/src/smtp_protocol.c Wed Feb  1 07:51:00 2006
@@ -60,7 +60,7 @@
 static void smtpd_respond_msgs(smtpd_session_rec *scr, int status,
                                char *default_string, apr_array_header_t *msgs)
 {
-    if (msgs != NULL && msgs->nelts > 0) {
+    if (msgs != NULL && apr_is_empty_array(msgs) == 0) {
         smtpd_respond_multiline(scr, status, msgs);
     }
     else {
@@ -417,8 +417,7 @@
     rcpt_parameters = apr_table_copy(str->p, rcpt_parameters);
     apr_table_overlap(str->rcpt_parameters, rcpt_parameters,
                       APR_OVERLAP_TABLES_SET);
-    (*((char **)apr_array_push(str->rcpt_to))) =
-      apr_pstrdup(str->p, email_address);
+    apr_table_set(str->rcpt_to, email_address, NULL);
     str->trans_state = SMTPD_STATE_GOT_RCPT;
     smtpd_respond_oneline(scr, 250, "Ok");
 }
@@ -497,13 +496,34 @@
     return disconnect;
 }
 
+static void smtpd_bounce_unqueued(smtpd_session_rec *scr) {
+}
 
 static void smtpd_queue(smtpd_session_rec *scr)
 {
+    int i, amount_unqueued = 0;
+    apr_array_header_t *rcpts;
+
     smtpd_run_on_queue(scr);
 
-    /* simple for now */
-    smtpd_respond_msgs(scr, 220, "Queued", scr->queued_greeting);
+    rcpts = apr_table_elts(scr->envelope->rcpt_to);
+
+    for (i = rcpts->nelts-1; i >= 0; i++) {
+        if (apr_table_get(scr->envelope->rcpt_to,
+                          APR_ARRAY_IDX(rcpts, i, char *)) == NULL) {
+            amount_unqueued++;
+        }
+    }
+
+    if (amount_unqueued > 0) {
+        smtpd_bounce_unqueued(scr);
+    }
+    
+    if (amount_unqueued == rcpts->nelts) {
+        smtpd_respond_oneline(scr, 550, "Message could not be delivered");
+    } else {
+        smtpd_respond_msgs(scr, 220, "Queued", scr->queued_greeting);
+    }
 }
 
 /* for debugging



Mime
View raw message