[PHP-CVS] cvs: php4(PHP_4_3) /ext/standard mail.c
pollita Tue Apr 1 01:23:22 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard mail.c Log: MFH(r1.71) Bug #22962 Index: php4/ext/standard/mail.c diff -u php4/ext/standard/mail.c:1.66.2.3 php4/ext/standard/mail.c:1.66.2.4 --- php4/ext/standard/mail.c:1.66.2.3 Mon Feb 24 14:41:40 2003 +++ php4/ext/standard/mail.cTue Apr 1 01:23:22 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.66.2.3 2003/02/24 19:41:40 iliaa Exp $ */ +/* $Id: mail.c,v 1.66.2.4 2003/04/01 06:23:22 pollita Exp $ */ #include stdlib.h #include ctype.h @@ -212,10 +212,10 @@ return 0; } #endif - fprintf(sendmail, To: %s\n, to); - fprintf(sendmail, Subject: %s\n, subject); + fprintf(sendmail, To: %s\r\n, to); + fprintf(sendmail, Subject: %s\r\n, subject); if (headers != NULL) { - fprintf(sendmail, %s\n, headers); + fprintf(sendmail, %s\r\n, headers); } fprintf(sendmail, \n%s\n, message); ret = pclose(sendmail); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/standard mail.c
iliaa Mon Feb 24 14:41:40 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard mail.c Log: MFH Index: php4/ext/standard/mail.c diff -u php4/ext/standard/mail.c:1.66.2.2 php4/ext/standard/mail.c:1.66.2.3 --- php4/ext/standard/mail.c:1.66.2.2 Tue Dec 31 11:35:31 2002 +++ php4/ext/standard/mail.cMon Feb 24 14:41:40 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.66.2.2 2002/12/31 16:35:31 sebastian Exp $ */ +/* $Id: mail.c,v 1.66.2.3 2003/02/24 19:41:40 iliaa Exp $ */ #include stdlib.h #include ctype.h @@ -46,6 +46,15 @@ #include netware/sysexits.h /* For exit status codes like EX_OK */ #endif +#define SKIP_LONG_HEADER_SEP(str, pos) \ + if (str[pos] == '\r' str[pos + 1] == '\n' (str[pos + 2] == ' ' || str[pos + 2] == '\t')) {\ + pos += 3; \ + while (str[pos] == ' ' || str[pos] == '\t') { \ + pos++; \ + } \ + continue; \ + } \ + /* {{{ proto int ezmlm_hash(string addr) Calculate EZMLM list hash value. */ PHP_FUNCTION(ezmlm_hash) @@ -102,6 +111,12 @@ } for (i = 0; to[i]; i++) { if (iscntrl((unsigned char) to[i])) { + /* According to RFC 822, section 3.1.1 long headers may be separated into +* parts using CRLF followed at least one linear-white-space character ('\t' or ' '). +* To prevent these separators from being replaced with a space, we use the +* SKIP_LONG_HEADER_SEP to skip over them. +*/ + SKIP_LONG_HEADER_SEP(to, i); to[i] = ' '; } } @@ -116,6 +131,7 @@ } for(i = 0; subject[i]; i++) { if (iscntrl((unsigned char) subject[i])) { + SKIP_LONG_HEADER_SEP(subject, i); subject[i] = ' '; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php