Merge of r4227, r4228:
Fixed range checking for the "somaxconn" sysctl. Fixed port range checking.
This commit is contained in:
parent
509f7ae156
commit
a78bab3b57
|
@ -671,7 +671,7 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
|
|||
|
||||
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 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
|
|||
|
||||
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 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
|
|||
|
||||
n = ngx_atoi(port, len);
|
||||
|
||||
if (n < 1 || n > 65536) {
|
||||
if (n < 1 || n > 65535) {
|
||||
u->err = "invalid port";
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
|
|
@ -783,7 +783,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
|
|||
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\"",
|
||||
|
|
|
@ -58,7 +58,6 @@ sysctl_t sysctls[] = {
|
|||
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_os_specific_init(ngx_log_t *log)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ ngx_debug_init()
|
|||
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_os_specific_init(ngx_log_t *log)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue