[PHP-CVS] com php-src: - Fixed bug #61026 (FPM pools can listen on the same address): NEWS sapi/fpm/fpm/fpm_conf.c

2012-05-23 Thread Jérôme Loyet
Commit:5d61e56dd7e19b82abde23f83b203449a48cc91a
Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:52:04 +0200
Parents:   812d2481935185eeeabb2c1fe2d7eafd76fc7359
Branches:  PHP-5.3

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5d61e56dd7e19b82abde23f83b203449a48cc91a

Log:
- Fixed bug #61026 (FPM pools can listen on the same address)

Bugs:
https://bugs.php.net/61026

Changed paths:
  M  NEWS
  M  sapi/fpm/fpm/fpm_conf.c


Diff:
diff --git a/NEWS b/NEWS
index 13ac964..7542724 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP 
   NEWS
. Fixed bug #61835 (php-fpm is not allowed to run as root). (fat)
   . Fixed bug #61295 (php-fpm should not fail with commented 'user'
 for non-root start). (fat)
+  . Fixed bug #61026 (FPM pools can listen on the same address). (fat)
 
 - XML Writer:
   . Fixed bug #62064 (memory leak in the XML Writer module). 
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 0b2c5ae..a4283a2 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -704,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct 
fpm_worker_pool_s *wp, cha
 
 static int fpm_conf_process_all_pools() /* {{{ */
 {
-   struct fpm_worker_pool_s *wp;
+   struct fpm_worker_pool_s *wp, *wp2;
 
if (!fpm_worker_all_pools) {
zlog(ZLOG_ERROR, No pool defined. at least one pool section 
must be specified in config file);
@@ -1044,6 +1044,20 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
}
}
+
+   /* ensure 2 pools do not use the same listening address */
+   for (wp = fpm_worker_all_pools; wp; wp = wp-next) {
+   for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2-next) {
+   if (wp == wp2) {
+   continue;
+   }
+
+   if (wp-config-listen_address  
*wp-config-listen_address  wp2-config-listen_address  
*wp2-config-listen_address  !strcmp(wp-config-listen_address, 
wp2-config-listen_address)) {
+   zlog(ZLOG_ERROR, [pool %s] unable to set 
listen address as it's already used in another pool '%s', wp2-config-name, 
wp-config-name);
+   return -1;
+   }
+   }
+   }
return 0;
 }
 /* }}} */


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



[PHP-CVS] com php-src: - Fixed bug #61026 (FPM pools can listen on the same address): NEWS sapi/fpm/fpm/fpm_conf.c

2012-05-23 Thread Jérôme Loyet
Commit:1299503936597ea873a3eb8272aa4deec2f31e5b
Author:Jerome Loyet f...@php.net Wed, 23 May 2012 11:53:04 +0200
Parents:   d236c1af8a5e1813e2667de969fa2ad39da74887
Branches:  PHP-5.4 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1299503936597ea873a3eb8272aa4deec2f31e5b

Log:
- Fixed bug #61026 (FPM pools can listen on the same address)

Bugs:
https://bugs.php.net/61026

Changed paths:
  M  NEWS
  M  sapi/fpm/fpm/fpm_conf.c


Diff:
diff --git a/NEWS b/NEWS
index 9b0a3ac..1db032a 100644
--- a/NEWS
+++ b/NEWS
@@ -60,6 +60,7 @@ PHP   
 NEWS
   . Fixed bug #61295 (php-fpm should not fail with commented 'user'
 for non-root start). (fat)
   . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat)
+  . Fixed bug #61026 (FPM pools can listen on the same address). (fat)
 
 - Libxml:
   . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)).
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 0b2c5ae..a4283a2 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -704,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct 
fpm_worker_pool_s *wp, cha
 
 static int fpm_conf_process_all_pools() /* {{{ */
 {
-   struct fpm_worker_pool_s *wp;
+   struct fpm_worker_pool_s *wp, *wp2;
 
if (!fpm_worker_all_pools) {
zlog(ZLOG_ERROR, No pool defined. at least one pool section 
must be specified in config file);
@@ -1044,6 +1044,20 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
}
}
+
+   /* ensure 2 pools do not use the same listening address */
+   for (wp = fpm_worker_all_pools; wp; wp = wp-next) {
+   for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2-next) {
+   if (wp == wp2) {
+   continue;
+   }
+
+   if (wp-config-listen_address  
*wp-config-listen_address  wp2-config-listen_address  
*wp2-config-listen_address  !strcmp(wp-config-listen_address, 
wp2-config-listen_address)) {
+   zlog(ZLOG_ERROR, [pool %s] unable to set 
listen address as it's already used in another pool '%s', wp2-config-name, 
wp-config-name);
+   return -1;
+   }
+   }
+   }
return 0;
 }
 /* }}} */


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