[nginx] svn commit: r4354 - in branches/stable-1.0: . src/core src/mail src/os/unix

mdounin at mdounin.ru mdounin at mdounin.ru
Wed Dec 14 13:06:45 UTC 2011


Author: mdounin
Date: 2011-12-14 13:06:45 +0000 (Wed, 14 Dec 2011)
New Revision: 4354

Log:
Merge of r4227, r4228:

Fixed range checking for the "somaxconn" sysctl.  Fixed port range checking.


Modified:
   branches/stable-1.0/
   branches/stable-1.0/src/core/ngx_inet.c
   branches/stable-1.0/src/mail/ngx_mail_auth_http_module.c
   branches/stable-1.0/src/os/unix/ngx_darwin_init.c
   branches/stable-1.0/src/os/unix/ngx_freebsd_init.c


Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4229-4230,4232,4235-4237,4265,4268,4280,4283,4321,4342-4343
   + /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4230,4232,4235-4237,4265,4268,4280,4283,4321,4342-4343

Modified: branches/stable-1.0/src/core/ngx_inet.c
===================================================================
--- branches/stable-1.0/src/core/ngx_inet.c	2011-12-13 19:01:10 UTC (rev 4353)
+++ branches/stable-1.0/src/core/ngx_inet.c	2011-12-14 13:06:45 UTC (rev 4354)
@@ -671,7 +671,7 @@
 
         n = ngx_atoi(port, len);
 
-        if (n < 1 || n > 65536) {
+        if (n < 1 || n > 65535) {
             u->err = "invalid port";
             return NGX_ERROR;
         }
@@ -695,7 +695,7 @@
 
                 if (n != NGX_ERROR) {
 
-                    if (n < 1 || n > 65536) {
+                    if (n < 1 || n > 65535) {
                         u->err = "invalid port";
                         return NGX_ERROR;
                     }
@@ -835,7 +835,7 @@
 
             n = ngx_atoi(port, len);
 
-            if (n < 1 || n > 65536) {
+            if (n < 1 || n > 65535) {
                 u->err = "invalid port";
                 return NGX_ERROR;
             }

Modified: branches/stable-1.0/src/mail/ngx_mail_auth_http_module.c
===================================================================
--- branches/stable-1.0/src/mail/ngx_mail_auth_http_module.c	2011-12-13 19:01:10 UTC (rev 4353)
+++ branches/stable-1.0/src/mail/ngx_mail_auth_http_module.c	2011-12-14 13:06:45 UTC (rev 4354)
@@ -783,7 +783,7 @@
             sin->sin_family = AF_INET;
 
             port = ngx_atoi(ctx->port.data, ctx->port.len);
-            if (port == NGX_ERROR || port < 1 || port > 65536) {
+            if (port == NGX_ERROR || port < 1 || port > 65535) {
                 ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
                               "auth http server %V sent invalid server "
                               "port:\"%V\"",

Modified: branches/stable-1.0/src/os/unix/ngx_darwin_init.c
===================================================================
--- branches/stable-1.0/src/os/unix/ngx_darwin_init.c	2011-12-13 19:01:10 UTC (rev 4353)
+++ branches/stable-1.0/src/os/unix/ngx_darwin_init.c	2011-12-14 13:06:45 UTC (rev 4354)
@@ -58,7 +58,6 @@
 ngx_int_t
 ngx_os_specific_init(ngx_log_t *log)
 {
-    int         somaxconn;
     size_t      size;
     ngx_err_t   err;
     ngx_uint_t  i;
@@ -125,12 +124,9 @@
 
     ngx_ncpu = ngx_darwin_hw_ncpu;
 
-    somaxconn = 32676;
-
-    if (ngx_darwin_kern_ipc_somaxconn > somaxconn) {
+    if (ngx_darwin_kern_ipc_somaxconn > 32767) {
         ngx_log_error(NGX_LOG_ALERT, log, 0,
-                      "sysctl kern.ipc.somaxconn must be no more than %d",
-                      somaxconn);
+                      "sysctl kern.ipc.somaxconn must be less than 32768");
         return NGX_ERROR;
     }
 

Modified: branches/stable-1.0/src/os/unix/ngx_freebsd_init.c
===================================================================
--- branches/stable-1.0/src/os/unix/ngx_freebsd_init.c	2011-12-13 19:01:10 UTC (rev 4353)
+++ branches/stable-1.0/src/os/unix/ngx_freebsd_init.c	2011-12-14 13:06:45 UTC (rev 4354)
@@ -97,7 +97,7 @@
 ngx_int_t
 ngx_os_specific_init(ngx_log_t *log)
 {
-    int         version, somaxconn;
+    int         version;
     size_t      size;
     ngx_err_t   err;
     ngx_uint_t  i;
@@ -209,12 +209,9 @@
         ngx_ncpu = ngx_freebsd_hw_ncpu;
     }
 
-    somaxconn = version < 600008 ? 32676 : 65535;
-
-    if (ngx_freebsd_kern_ipc_somaxconn > somaxconn) {
+    if (version < 600008 && ngx_freebsd_kern_ipc_somaxconn > 32767) {
         ngx_log_error(NGX_LOG_ALERT, log, 0,
-                      "sysctl kern.ipc.somaxconn must be no more than %d",
-                      somaxconn);
+                      "sysctl kern.ipc.somaxconn must be less than 32768");
         return NGX_ERROR;
     }
 



More information about the nginx-devel mailing list