From: Frank M. Kromann Date: Tue, 2 Jul 2002 23:44:06 +0000 (+0000) Subject: Oops. Last commit reverted some of sebastians changes. X-Git-Tag: xmlrpc_epi_0_51_merge_pt~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2c5462d9147c7552ff922bf93e180c8a5b6a487;p=php Oops. Last commit reverted some of sebastians changes. --- diff --git a/win32/sendmail.c b/win32/sendmail.c index 721dd57843..fe809a1053 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -56,10 +56,12 @@ static char *months[] = response is ecalloc()d in Ack() itself and efree()d here because the content is in *error_message now */ #define SMTP_ERROR_RESPONSE(response) { \ - if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \ - snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \ + if (response && error_message) { \ + if (NULL != (*error_message = ecalloc(1, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response)))) { \ + snprintf(*error_message, sizeof(SMTP_ERROR_RESPONSE_SPEC) + strlen(response), SMTP_ERROR_RESPONSE_SPEC, response); \ + } \ + efree(response); \ } \ - efree(response); \ } #ifndef THREAD_SAFE @@ -393,7 +395,6 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB return W32_SM_SENDMAIL_FROM_MALFORMED; } - tempMailTo = estrdup(mailTo); /* Send mail to all rcpt's */ token = strtok(tempMailTo, ","); @@ -431,14 +432,11 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB token = strtok(tempMailTo, ","); while(token != NULL) { - snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token); - if ((res = Post(Buffer)) != SUCCESS) { - efree(tempMailTo); + sprintf(Buffer, "RCPT TO:<%s>\r\n", token); + if ((res = Post(Buffer)) != SUCCESS) return (res); - } if ((res = Ack(&server_response)) != SUCCESS) { SMTP_ERROR_RESPONSE(server_response); - efree(tempMailTo); return (res); } token = strtok(NULL, ","); @@ -527,6 +525,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailB } } } + if (mailBcc && *mailBcc) { tempMailTo = estrdup(mailBcc); /* Send mail to all rcpt's */ @@ -695,7 +694,7 @@ int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders, char *m } } if(xheaders){ - if (!addToHeader(&header_buffer, "%s", xheaders)) { + if (!addToHeader(&header_buffer, "%s\r\n", xheaders)) { goto PostHeader_outofmem; } }