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/23 08:10:27 UTC
svn commit: r239359 - in /httpd/mod_smtpd/trunk: mod_smtpd.h smtp.h
smtp_core.c smtp_protocol.c
Author: soc-rian
Date: Mon Aug 22 23:10:25 2005
New Revision: 239359
URL: http://svn.apache.org/viewcvs?rev=239359&view=rev
Log:
Changed in_data->msgs to be an apr_array_header_t instead of an c style array of string pointers
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=239359&r1=239358&r2=239359&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/mod_smtpd.h (original)
+++ httpd/mod_smtpd/trunk/mod_smtpd.h Mon Aug 22 23:10:25 2005
@@ -72,9 +72,8 @@
typedef struct smtpd_return_data {
apr_pool_t *p;
- /* list of messages
- null terminated */
- char **msgs;
+ /* list of messages */
+ apr_array_header_t *msgs;
} smtpd_return_data;
typedef struct smtpd_trans_rec {
Modified: httpd/mod_smtpd/trunk/smtp.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp.h?rev=239359&r1=239358&r2=239359&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp.h (original)
+++ httpd/mod_smtpd/trunk/smtp.h Mon Aug 22 23:10:25 2005
@@ -55,7 +55,8 @@
smtpd_getline(smtpd_conn_rec *scr, char *data, apr_size_t dlen);
apr_status_t
- smtpd_respond_multiline(smtpd_conn_rec *scr, int code, char *messages[]);
+ 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);
Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=239359&r1=239358&r2=239359&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Mon Aug 22 23:10:25 2005
@@ -215,16 +215,20 @@
}
apr_status_t
-smtpd_respond_multiline(smtpd_conn_rec *scr, int code, char *messages[])
+smtpd_respond_multiline(smtpd_conn_rec *scr, int code,
+ apr_array_header_t *msgs)
{
- char *str;
int i;
- for (i = 0; messages[i]; i++) {
- str = messages[i+1] ? "%d %s\r\n" : "%d-%s\r\n";
- ap_fprintf(scr->c->output_filters, scr->bb_out, str, code, messages[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);
return APR_SUCCESS;
}
Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=239359&r1=239358&r2=239359&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Mon Aug 22 23:10:25 2005
@@ -137,7 +137,6 @@
}
HANDLER_DECLARE(ehlo) {
- int i = 0;
smtpd_trans_rec *str = scr->transaction;
if (buffer[0] == '\0') {
@@ -179,16 +178,11 @@
str->protocol_type = SMTPD_PROTOCOL_ESMTP;
if (scr->extensions->nelts) {
- char **messages = apr_palloc(in_data->p, sizeof(char *) *
- (scr->extensions->nelts + 2));
+ 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);
- messages[0] = str->helo;
- for (i = 0; i < scr->extensions->nelts; ++i) {
- messages[i+1] = ((char **)scr->extensions->elts)[i];
- }
- messages[i] = 0;
-
- smtpd_respond_multiline(scr, 250, messages);
+ smtpd_respond_multiline(scr, 250, first);
} else {
smtpd_respond_oneline(scr, 250, str->helo);
}
@@ -269,7 +263,7 @@
case SMTPD_DENY:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"deny mail from %s (%s)", loc,
- in_data->msgs ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 550, in_data->msgs);
} else {
@@ -279,7 +273,7 @@
case SMTPD_DENYSOFT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"denysoft mail from %s (%s)", loc,
- in_data->msgs ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 450, in_data->msgs);
} else {
@@ -289,7 +283,7 @@
case SMTPD_DENY_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"deny mail from %s (%s)", loc,
- in_data->msgs ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 550, in_data->msgs);
} else {
@@ -300,7 +294,7 @@
case SMTPD_DENYSOFT_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"denysoft mail from %s (%s)", loc,
- in_data->msgs[0] ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 450, in_data->msgs);
} else {
@@ -361,7 +355,7 @@
case SMTPD_DENY_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"delivery denied (%s)",
- in_data->msgs ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 550, in_data->msgs);
} else {
@@ -371,7 +365,7 @@
case SMTPD_DENYSOFT_DISCONNECT:
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, scr->s,
"delivery denied (%s)",
- in_data->msgs ? in_data->msgs[0] : "");
+ in_data->msgs ? ((char **)in_data->msgs->elts)[0] : "");
if (in_data->msgs) {
smtpd_respond_multiline(scr, 450, in_data->msgs);
} else {