[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2009-06-21 Thread Ilia Alshanetsky
iliaa   Sun Jun 21 15:29:16 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   mail.c 
  Log:
  
  Fixed bug #48620 (X-PHP-Originating-Script assumes no trailing CRLF in
  existing headers)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.10&r2=1.87.2.1.2.7.2.11&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.10 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.11
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.10   Wed Apr 15 14:24:38 2009
+++ php-src/ext/standard/mail.c Sun Jun 21 15:29:16 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.10 2009/04/15 14:24:38 iliaa Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.11 2009/06/21 15:29:16 iliaa Exp $ */
 
 #include 
 #include 
@@ -241,7 +241,7 @@
php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC);
 
if (headers != NULL) {
-   spprintf(&hdr, 0, "%s\r\nX-PHP-Originating-Script: 
%ld:%s\n", headers, php_getuid(), f);
+   spprintf(&hdr, 0, "X-PHP-Originating-Script: 
%ld:%s\r\n%s", php_getuid(), f, headers);
} else {
spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", 
php_getuid(), f);
}



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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2009-04-16 Thread Ilia Alshanetsky


The initial type change does the trick for the formula itself.  And  
yes, the code relies on an integer being 64bit



Ilia Alshanetsky




On 15-Apr-09, at 2:05 PM, Matt Wilmas wrote:


Hi Ilia,

- Original Message -
From: "Ilia Alshanetsky"
Sent: Wednesday, April 15, 2009


iliaa Wed Apr 15 14:24:38 2009 UTC

Modified files:  (Branch: PHP_5_3)
  /php-src/ext/standard mail.c
Log:

Fixed bug #47969 (ezmlm_hash() returns different values depend on OS)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.9&r2=1.87.2.1.2.7.2.10&diff_format=u
[...]
@@ -76,7 +76,7 @@
PHP_FUNCTION(ezmlm_hash)
{
char *str = NULL;
- unsigned long h = 5381L;
+ unsigned int h = 5381;


You're relying on int being 32-bit?  Couldn't it be 64-bit as well? 
http://en.wikipedia.org/wiki/64-bit#64-bit_data_models

BTW, (unsigned long) cast is still used in the loop, although I  
guess it's not affecting that expression...  And the cast in  
RETURN_LONG((int) h); isn't needed, but that was true before.  Just  
noticed while checking if I was missing something else. :-)



- Matt



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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2009-04-15 Thread Matt Wilmas

Hi Ilia,

- Original Message -
From: "Ilia Alshanetsky"
Sent: Wednesday, April 15, 2009


iliaa Wed Apr 15 14:24:38 2009 UTC

 Modified files:  (Branch: PHP_5_3)
   /php-src/ext/standard mail.c
 Log:

 Fixed bug #47969 (ezmlm_hash() returns different values depend on OS)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.9&r2=1.87.2.1.2.7.2.10&diff_format=u
[...]
@@ -76,7 +76,7 @@
PHP_FUNCTION(ezmlm_hash)
{
 char *str = NULL;
- unsigned long h = 5381L;
+ unsigned int h = 5381;


You're relying on int being 32-bit?  Couldn't it be 64-bit as well? 
http://en.wikipedia.org/wiki/64-bit#64-bit_data_models


BTW, (unsigned long) cast is still used in the loop, although I guess it's 
not affecting that expression...  And the cast in RETURN_LONG((int) h); 
isn't needed, but that was true before.  Just noticed while checking if I 
was missing something else. :-)



- Matt 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2009-04-15 Thread Ilia Alshanetsky
iliaa   Wed Apr 15 14:24:38 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   mail.c 
  Log:
  
  Fixed bug #47969 (ezmlm_hash() returns different values depend on OS)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.9&r2=1.87.2.1.2.7.2.10&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.9 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.10
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.9Tue Jan 13 21:29:12 2009
+++ php-src/ext/standard/mail.c Wed Apr 15 14:24:38 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.9 2009/01/13 21:29:12 iliaa Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.10 2009/04/15 14:24:38 iliaa Exp $ */
 
 #include 
 #include 
@@ -76,7 +76,7 @@
 PHP_FUNCTION(ezmlm_hash)
 {
char *str = NULL;
-   unsigned long h = 5381L;
+   unsigned int h = 5381;
int j, str_len;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2009-01-09 Thread Antony Dovgal
tony2001Fri Jan  9 15:08:10 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   mail.c 
  Log:
  fix ZTS build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.7&r2=1.87.2.1.2.7.2.8&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.7 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.8
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.7Fri Jan  9 14:59:30 2009
+++ php-src/ext/standard/mail.c Fri Jan  9 15:08:10 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.7 2009/01/09 14:59:30 iliaa Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.8 2009/01/09 15:08:10 tony2001 Exp $ */
 
 #include 
 #include 
@@ -233,7 +233,7 @@
char *f;
size_t f_len;
 
-   php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len);
+   php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC);
 
if (headers != NULL) {
spprintf(&hdr, 0, "%s\r\nX-PHP-Originating-Script: 
%ld:%s\n", headers, php_getuid(), f);



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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2008-10-03 Thread Mikko Koppanen
> That Ilia's comment is bullshit. PHP_5_2 is not "critical fixes only"
> branch. It's normal bug fix branch til the day PHP 5.3 is released. We can
> reconsider it's status once there is 5.3.1 available.

Committed, closed bug and updated NEWS.


-- 
Mikko Koppanen

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2008-10-03 Thread Jani Taskinen

Mikko Koppanen wrote:

On Fri, Oct 3, 2008 at 2:50 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote:

It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too?
(and close the bug #14032 too..)


I will close the bug and update NEWS file. I am not sure about
committing to PHP_5_2 after reading http://news.php.net/php.cvs/53337


That Ilia's comment is bullshit. PHP_5_2 is not "critical fixes only" 
branch. It's normal bug fix branch til the day PHP 5.3 is released. We 
can reconsider it's status once there is 5.3.1 available.


--Jani




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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2008-10-03 Thread Mikko Koppanen
On Fri, Oct 3, 2008 at 2:50 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote:
> It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too?
> (and close the bug #14032 too..)
>
> --Jani

Hi,

I will close the bug and update NEWS file. I am not sure about
committing to PHP_5_2 after reading http://news.php.net/php.cvs/53337

-- 
Mikko Koppanen

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2008-10-03 Thread Jani Taskinen

It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too?
(and close the bug #14032 too..)

--Jani



Mikko Koppanen wrote:

mkoppanen   Fri Oct  3 13:32:42 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard	mail.c 
  Log:

  Adds signal handling around popen/pclose in mail.c.
  Related information on bugs #8992 and #14032
  Original patch by D. Parthey
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.3&r2=1.87.2.1.2.7.2.4&diff_format=u

Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.4
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/mail.c Fri Oct  3 13:32:41 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.3 2007/12/31 07:17:15 sebastian Exp $ */

+/* $Id: mail.c,v 1.87.2.1.2.7.2.4 2008/10/03 13:32:41 mkoppanen Exp $ */
 
 #include 

 #include 
@@ -31,6 +31,12 @@
 #include 
 #endif
 
+#if PHP_SIGCHILD

+#if HAVE_SIGNAL_H
+#include 
+#endif
+#endif
+
 #include "php_mail.h"
 #include "php_ini.h"
 #include "safe_mode.h"
@@ -193,6 +199,9 @@
int ret;
char *sendmail_path = INI_STR("sendmail_path");
char *sendmail_cmd = NULL;
+#if PHP_SIGCHILD
+   void (*sig_handler)() = NULL;
+#endif
 
 	if (!sendmail_path) {

 #if (defined PHP_WIN32 || defined NETWARE)
@@ -217,6 +226,16 @@
sendmail_cmd = sendmail_path;
}
 
+#if PHP_SIGCHILD

+   /* Set signal handler of SIGCHLD to default to prevent other signal 
handlers
+* from being called and reaping the return code when our child exits.
+* The original handler needs to be restored after pclose() */
+   sig_handler = (void *)signal(SIGCHLD, SIG_DFL);
+   if (sig_handler == SIG_ERR) {
+   sig_handler = NULL;
+   }
+#endif
+
 #ifdef PHP_WIN32
sendmail = popen(sendmail_cmd, "wb");
 #else
@@ -235,6 +254,13 @@
if (EACCES == errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission 
denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path);
pclose(sendmail);
+#if PHP_SIGCHILD
+   /* Restore handler in case of error on Windows
+  Not sure if this applicable on Win but just in case. 
*/
+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);
+   }
+#endif
return 0;
}
 #endif
@@ -246,6 +272,12 @@
fprintf(sendmail, "\n%s\n", message);
ret = pclose(sendmail);
 
+#if PHP_SIGCHILD

+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);
+   }
+#endif
+
 #ifdef PHP_WIN32
if (ret == -1)
 #else
@@ -264,6 +296,11 @@
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail 
delivery program '%s'", sendmail_path);
+#if PHP_SIGCHILD
+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);   

+   }
+#endif
return 0;
}
 







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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2008-10-03 Thread Mikko Koppanen
mkoppanen   Fri Oct  3 13:32:42 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   mail.c 
  Log:
  Adds signal handling around popen/pclose in mail.c.
  Related information on bugs #8992 and #14032
  Original patch by D. Parthey
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.3&r2=1.87.2.1.2.7.2.4&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.4
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/mail.c Fri Oct  3 13:32:41 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.3 2007/12/31 07:17:15 sebastian Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.4 2008/10/03 13:32:41 mkoppanen Exp $ */
 
 #include 
 #include 
@@ -31,6 +31,12 @@
 #include 
 #endif
 
+#if PHP_SIGCHILD
+#if HAVE_SIGNAL_H
+#include 
+#endif
+#endif
+
 #include "php_mail.h"
 #include "php_ini.h"
 #include "safe_mode.h"
@@ -193,6 +199,9 @@
int ret;
char *sendmail_path = INI_STR("sendmail_path");
char *sendmail_cmd = NULL;
+#if PHP_SIGCHILD
+   void (*sig_handler)() = NULL;
+#endif
 
if (!sendmail_path) {
 #if (defined PHP_WIN32 || defined NETWARE)
@@ -217,6 +226,16 @@
sendmail_cmd = sendmail_path;
}
 
+#if PHP_SIGCHILD
+   /* Set signal handler of SIGCHLD to default to prevent other signal 
handlers
+* from being called and reaping the return code when our child exits.
+* The original handler needs to be restored after pclose() */
+   sig_handler = (void *)signal(SIGCHLD, SIG_DFL);
+   if (sig_handler == SIG_ERR) {
+   sig_handler = NULL;
+   }
+#endif
+
 #ifdef PHP_WIN32
sendmail = popen(sendmail_cmd, "wb");
 #else
@@ -235,6 +254,13 @@
if (EACCES == errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission 
denied: unable to execute shell to run mail delivery binary '%s'", 
sendmail_path);
pclose(sendmail);
+#if PHP_SIGCHILD
+   /* Restore handler in case of error on Windows
+  Not sure if this applicable on Win but just in case. 
*/
+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);
+   }
+#endif
return 0;
}
 #endif
@@ -246,6 +272,12 @@
fprintf(sendmail, "\n%s\n", message);
ret = pclose(sendmail);
 
+#if PHP_SIGCHILD
+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);
+   }
+#endif
+
 #ifdef PHP_WIN32
if (ret == -1)
 #else
@@ -264,6 +296,11 @@
}
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute 
mail delivery program '%s'", sendmail_path);
+#if PHP_SIGCHILD
+   if (sig_handler) {
+   signal(SIGCHLD, sig_handler);   

+   }
+#endif
return 0;
}
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c

2007-11-06 Thread Jani Taskinen
janiTue Nov  6 17:58:53 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   mail.c 
  Log:
  MFH: ws + cs
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.1&r2=1.87.2.1.2.7.2.2&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.1 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.2
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.1Sun Sep 30 05:49:45 2007
+++ php-src/ext/standard/mail.c Tue Nov  6 17:58:53 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.1 2007/09/30 05:49:45 jani Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.2 2007/11/06 17:58:53 jani Exp $ */
 
 #include 
 #include 
@@ -45,22 +45,21 @@
 #define EX_TEMPFAIL 75  /* temp failure; user is invited to retry */
 #endif
 
-#define SKIP_LONG_HEADER_SEP(str, pos) 
\
+#define SKIP_LONG_HEADER_SEP(str, pos) 

\
if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || 
str[pos + 2] == '\t')) {\
-   pos += 2;   
\
-   while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {   
\
-   pos++;  
\
-   }   
\
-   continue;   
\
-   }   
\
-
-#define MAIL_ASCIIZ_CHECK(str, len)\
-   p = str;\
-   e = p + len;\
+   pos += 2;   

\
+   while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {   
\
+   pos++;  

\
+   }   

\
+   continue;   

\
+   }   

\
+
+#define MAIL_ASCIIZ_CHECK(str, len)\
+   p = str;
\
+   e = p + len;
\
while ((p = memchr(p, '\0', (e - p {\
-   *p = ' ';   \
-   }   \
-
+   *p = ' ';   
\
+   }   
\
 
 /* {{{ proto int ezmlm_hash(string addr)
Calculate EZMLM list hash value. */
@@ -69,18 +68,17 @@
char *str = NULL;
unsigned long h = 5381L;
int j, str_len;
-   
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
- &str, &str_len) == 
FAILURE) {
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
return;
}
 
for (j = 0; j < str_len; j++) {
h = (h + (h << 5)) ^ (unsigned long) (unsigned char) 
tolower(str[j]);
}
-   
+
h = (h % 53);
-   
+
RETURN_LONG((int) h);
 }
 /* }}} */
@@ -100,15 +98,11 @@
if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE 
Restriction in effect.  The fifth parameter is disabled in SAFE MODE");
RETURN_FALSE;
-   }   
-   
-   if (zend_pars