[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php4 /ext/imap php_imap.c
From:       "Frank M. Kromann" <frank () kromann ! info>
Date:       2002-11-30 21:49:20
[Download RAW message or body]

fmk		Sat Nov 30 16:49:20 2002 EDT

  Modified files:              
    /php4/ext/imap	php_imap.c 
  Log:
  Fix the use of "personal" information in To and Cc headers
  
  
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.145 php4/ext/imap/php_imap.c:1.146
--- php4/ext/imap/php_imap.c:1.145	Wed Nov 27 13:52:31 2002
+++ php4/ext/imap/php_imap.c	Sat Nov 30 16:49:20 2002
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <zeev@zend.com>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.145 2002/11/27 18:52:31 fmk Exp $ */
+/* $Id: php_imap.c,v 1.146 2002/11/30 21:49:20 fmk Exp $ */
 
 #define IMAP41
 
@@ -3144,10 +3144,22 @@
 	char *tempMailTo;
 	char *tsm_errmsg = NULL;
 	ADDRESS *addr;
-	char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL;
-	int offset;
+	char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL;
+	int offset, bufferLen = 0;;
 
+	if (headers)
+		bufferLen += strlen(headers);
+	if (to)
+		bufferLen += strlen(to) + 6;
+	if (cc)
+		bufferLen += strlen(cc) + 6;
+
+	bufferHeader = (char *)emalloc(bufferLen);
+	memset(bufferHeader, 0, bufferLen);
 	if (to && *to) {
+		strcat(bufferHeader, "To: ");
+		strcat(bufferHeader, to);
+		strcat(bufferHeader, "\r\n");
 		tempMailTo = estrdup(to);
 		bufferTo = (char *)emalloc(strlen(to));
 		offset = 0;
@@ -3168,6 +3180,9 @@
 	}
 
 	if (cc && *cc) {
+		strcat(bufferHeader, "Cc: ");
+		strcat(bufferHeader, cc);
+		strcat(bufferHeader, "\r\n");
 		tempMailTo = estrdup(cc);
 		bufferCc = (char *)emalloc(strlen(cc));
 		offset = 0;
@@ -3207,8 +3222,9 @@
 		}
 	}
 
+	strcat(bufferHeader, headers);
 
-	if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, headers, subject, bufferTo, \
message, bufferCc, bufferBcc, rpath) != SUCCESS) { +	if (TSendMail(INI_STR("SMTP"), \
&tsm_err, &tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, \
rpath) != SUCCESS) {  if (tsm_errmsg) {
 			php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), tsm_errmsg);
 			efree(tsm_errmsg);
@@ -3225,6 +3241,9 @@
 	}
 	if (bufferBcc) {
 		efree(bufferBcc);
+	}
+	if (bufferHeader) {
+		efree(bufferHeader);
 	}
 #else
 	if (!INI_STR("sendmail_path")) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic