summaryrefslogtreecommitdiff
path: root/usr.sbin/nginx
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2012-10-08 10:44:44 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2012-10-08 10:44:44 +0000
commit67c0fab681d2964d05a3f58d939718713a369357 (patch)
treeee17b5947a19868c583c61d61f4a02fbb095d341 /usr.sbin/nginx
parent58b182a33f7522bcec2dd51152f7f8d0bccd4349 (diff)
update to 1.2.4
Diffstat (limited to 'usr.sbin/nginx')
-rw-r--r--usr.sbin/nginx/CHANGES28
-rw-r--r--usr.sbin/nginx/CHANGES.ru27
-rw-r--r--usr.sbin/nginx/auto/cc/clang98
-rw-r--r--usr.sbin/nginx/auto/install2
-rw-r--r--usr.sbin/nginx/auto/lib/libatomic/make2
-rw-r--r--usr.sbin/nginx/auto/lib/perl/make2
-rw-r--r--usr.sbin/nginx/auto/lib/zlib/makefile.bcc8
-rw-r--r--usr.sbin/nginx/auto/lib/zlib/makefile.msvc7
-rw-r--r--usr.sbin/nginx/auto/lib/zlib/makefile.owc4
-rw-r--r--usr.sbin/nginx/html/50x.html25
-rw-r--r--usr.sbin/nginx/html/index.html21
-rw-r--r--usr.sbin/nginx/src/core/nginx.c2
-rw-r--r--usr.sbin/nginx/src/core/nginx.h4
-rw-r--r--usr.sbin/nginx/src/core/ngx_conf_file.c3
-rw-r--r--usr.sbin/nginx/src/core/ngx_conf_file.h1
-rw-r--r--usr.sbin/nginx/src/core/ngx_crypt.c11
-rw-r--r--usr.sbin/nginx/src/core/ngx_cycle.c16
-rw-r--r--usr.sbin/nginx/src/core/ngx_radix_tree.c2
-rw-r--r--usr.sbin/nginx/src/core/ngx_resolver.c18
-rw-r--r--usr.sbin/nginx/src/core/ngx_slab.c4
-rw-r--r--usr.sbin/nginx/src/core/ngx_string.c2
-rw-r--r--usr.sbin/nginx/src/core/ngx_string.h2
-rw-r--r--usr.sbin/nginx/src/core/ngx_times.c4
-rw-r--r--usr.sbin/nginx/src/event/ngx_event.c2
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_fastcgi_module.c3
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_geo_module.c19
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_geoip_module.c11
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c4
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_limit_req_module.c11
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_map_module.c22
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_ssi_filter_module.c1
-rw-r--r--usr.sbin/nginx/src/http/modules/perl/nginx.pm2
-rw-r--r--usr.sbin/nginx/src/http/ngx_http_core_module.c21
-rw-r--r--usr.sbin/nginx/src/http/ngx_http_write_filter_module.c18
-rw-r--r--usr.sbin/nginx/src/mail/ngx_mail.c11
-rw-r--r--usr.sbin/nginx/src/mail/ngx_mail_auth_http_module.c2
-rw-r--r--usr.sbin/nginx/src/mail/ngx_mail_core_module.c34
-rw-r--r--usr.sbin/nginx/src/mail/ngx_mail_handler.c2
-rw-r--r--usr.sbin/nginx/src/os/unix/ngx_files.c2
39 files changed, 339 insertions, 119 deletions
diff --git a/usr.sbin/nginx/CHANGES b/usr.sbin/nginx/CHANGES
index 1bfebf38d89..072053235be 100644
--- a/usr.sbin/nginx/CHANGES
+++ b/usr.sbin/nginx/CHANGES
@@ -1,4 +1,32 @@
+Changes with nginx 1.2.4 25 Sep 2012
+
+ *) Bugfix: in the "limit_req" directive; the bug had appeared in 1.1.14.
+ Thanks to Charles Chen.
+
+ *) Bugfix: nginx could not be built by gcc 4.7 with -O2 optimization if
+ the --with-ipv6 option was used.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if the
+ "map" directive was used with variables as values.
+
+ *) Bugfix: a segmentation fault might occur in a worker process if the
+ "geo" directive was used with the "ranges" parameter but without the
+ "default" parameter; the bug had appeared in 0.8.43.
+ Thanks to Zhen Chen and Weibin Yao.
+
+ *) Bugfix: in the -p command-line parameter handling.
+
+ *) Bugfix: in the mail proxy server.
+
+ *) Bugfix: of minor potential bugs.
+ Thanks to Coverity.
+
+ *) Bugfix: nginx/Windows could not be built with Visual Studio 2005
+ Express.
+ Thanks to HAYASHI Kentaro.
+
+
Changes with nginx 1.2.3 07 Aug 2012
*) Feature: the Clang compiler support.
diff --git a/usr.sbin/nginx/CHANGES.ru b/usr.sbin/nginx/CHANGES.ru
index d85b2f9297d..f04fc0c9b22 100644
--- a/usr.sbin/nginx/CHANGES.ru
+++ b/usr.sbin/nginx/CHANGES.ru
@@ -1,4 +1,31 @@
+Изменения в nginx 1.2.4 25.09.2012
+
+ *) Исправление: в директиве "limit_req"; ошибка появилась в 1.1.14.
+ Спасибо Charles Chen.
+
+ *) Исправление: nginx не собирался gcc 4.7 с оптимизацией -O2 если
+ использовался параметр --with-ipv6.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если в директиве map в качестве значений использовались переменные.
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault при
+ использовании директивы geo с параметром ranges, но без параметра
+ default; ошибка появилась в 0.8.43.
+ Спасибо Zhen Chen и Weibin Yao.
+
+ *) Исправление: в обработке параметра командной строки -p.
+
+ *) Исправление: в почтовом прокси-сервере.
+
+ *) Исправление: незначительных потенциальных ошибок.
+ Спасибо Coverity.
+
+ *) Исправление: nginx/Windows не собирался с Visual Studio 2005 Express.
+ Спасибо HAYASHI Kentaro.
+
+
Изменения в nginx 1.2.3 07.08.2012
*) Добавление: поддержка компилятора Clang.
diff --git a/usr.sbin/nginx/auto/cc/clang b/usr.sbin/nginx/auto/cc/clang
new file mode 100644
index 00000000000..9f60d7b3a2b
--- /dev/null
+++ b/usr.sbin/nginx/auto/cc/clang
@@ -0,0 +1,98 @@
+
+# Copyright (C) Nginx, Inc.
+
+
+# clang
+
+
+NGX_CLANG_VER=`$CC -v 2>&1 | grep 'clang version' 2>&1 \
+ | sed -e 's/^.*clang version \(.*\)/\1/'`
+
+echo " + clang version: $NGX_CLANG_VER"
+
+have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
+
+
+CC_TEST_FLAGS="-pipe"
+
+
+# optimizations
+
+#NGX_CLANG_OPT="-O2"
+#NGX_CLANG_OPT="-Oz"
+NGX_CLANG_OPT="-O"
+
+case $CPU in
+ pentium)
+ # optimize for Pentium
+ CPU_OPT="-march=pentium"
+ NGX_CPU_CACHE_LINE=32
+ ;;
+
+ pentiumpro | pentium3)
+ # optimize for Pentium Pro, Pentium II and Pentium III
+ CPU_OPT="-march=pentiumpro"
+ NGX_CPU_CACHE_LINE=32
+ ;;
+
+ pentium4)
+ # optimize for Pentium 4
+ CPU_OPT="-march=pentium4"
+ NGX_CPU_CACHE_LINE=128
+ ;;
+
+ athlon)
+ # optimize for Athlon
+ CPU_OPT="-march=athlon"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ opteron)
+ # optimize for Opteron
+ CPU_OPT="-march=opteron"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+esac
+
+CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
+
+
+CFLAGS="$CFLAGS -pipe $CPU_OPT"
+
+if [ ".$PCRE_OPT" = "." ]; then
+ PCRE_OPT="-O2 -pipe $CPU_OPT"
+else
+ PCRE_OPT="$PCRE_OPT -pipe"
+fi
+
+if [ ".$MD5_OPT" = "." ]; then
+ MD5_OPT="-O2 -pipe $CPU_OPT"
+else
+ MD5_OPT="$MD5_OPT -pipe"
+fi
+
+if [ ".$ZLIB_OPT" = "." ]; then
+ ZLIB_OPT="-O2 -pipe $CPU_OPT"
+else
+ ZLIB_OPT="$ZLIB_OPT -pipe"
+fi
+
+
+# warnings
+
+CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith"
+#CFLAGS="$CFLAGS -Wmissing-prototypes"
+
+# we have a lot of unused function arguments
+CFLAGS="$CFLAGS -Wno-unused-parameter"
+
+# stop on warning
+#CFLAGS="$CFLAGS -Werror"
+
+# debug
+CFLAGS="$CFLAGS -g"
+
+if [ ".$CPP" = "." ]; then
+ CPP="$CC -E"
+fi
diff --git a/usr.sbin/nginx/auto/install b/usr.sbin/nginx/auto/install
index 7c7dc6bbc06..a9cca350454 100644
--- a/usr.sbin/nginx/auto/install
+++ b/usr.sbin/nginx/auto/install
@@ -8,7 +8,7 @@ if [ $USE_PERL = YES ]; then
cat << END >> $NGX_MAKEFILE
install_perl_modules:
- cd $NGX_OBJS/src/http/modules/perl && \${MAKE} install
+ cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) install
END
NGX_INSTALL_PERL_MODULES=install_perl_modules
diff --git a/usr.sbin/nginx/auto/lib/libatomic/make b/usr.sbin/nginx/auto/lib/libatomic/make
index f3cd83281af..023ed18fb98 100644
--- a/usr.sbin/nginx/auto/lib/libatomic/make
+++ b/usr.sbin/nginx/auto/lib/libatomic/make
@@ -6,7 +6,7 @@
cat << END >> $NGX_MAKEFILE
$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile
- cd $NGX_LIBATOMIC && \${MAKE}
+ cd $NGX_LIBATOMIC && \$(MAKE)
$NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE
cd $NGX_LIBATOMIC && ./configure
diff --git a/usr.sbin/nginx/auto/lib/perl/make b/usr.sbin/nginx/auto/lib/perl/make
index 248be9e3f02..5f13bb29ce0 100644
--- a/usr.sbin/nginx/auto/lib/perl/make
+++ b/usr.sbin/nginx/auto/lib/perl/make
@@ -12,7 +12,7 @@ $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so: \
$NGX_OBJS/src/http/modules/perl/Makefile
cp -p src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/
- cd $NGX_OBJS/src/http/modules/perl && \${MAKE}
+ cd $NGX_OBJS/src/http/modules/perl && \$(MAKE)
rm -rf $NGX_OBJS/install_perl
diff --git a/usr.sbin/nginx/auto/lib/zlib/makefile.bcc b/usr.sbin/nginx/auto/lib/zlib/makefile.bcc
index 56f8356884e..97a30ea3951 100644
--- a/usr.sbin/nginx/auto/lib/zlib/makefile.bcc
+++ b/usr.sbin/nginx/auto/lib/zlib/makefile.bcc
@@ -8,8 +8,10 @@ CFLAGS = -q -O2 -tWM -w-8004 -w-8012 $(CPU_OPT)
zlib.lib:
cd $(ZLIB)
- bcc32 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c \
- compress.c
+ bcc32 -c $(CFLAGS) adler32.c crc32.c deflate.c \
+ trees.c zutil.c compress.c \
+ inflate.c inffast.c inftrees.c
tlib zlib.lib +adler32.obj +crc32.obj +deflate.obj \
- +trees.obj +zutil.obj +compress.obj
+ +trees.obj +zutil.obj +compress.obj \
+ +inflate.obj +inffast.obj +inftrees.obj
diff --git a/usr.sbin/nginx/auto/lib/zlib/makefile.msvc b/usr.sbin/nginx/auto/lib/zlib/makefile.msvc
index 2c7c1ae1025..6fbd6918c2f 100644
--- a/usr.sbin/nginx/auto/lib/zlib/makefile.msvc
+++ b/usr.sbin/nginx/auto/lib/zlib/makefile.msvc
@@ -8,7 +8,10 @@ CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT)
zlib.lib:
cd $(ZLIB)
- cl -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c compress.c
+ cl -c $(CFLAGS) adler32.c crc32.c deflate.c \
+ trees.c zutil.c compress.c \
+ inflate.c inffast.c inftrees.c
link -lib -out:zlib.lib adler32.obj crc32.obj deflate.obj \
- trees.obj zutil.obj compress.obj
+ trees.obj zutil.obj compress.obj \
+ inflate.obj inffast.obj inftrees.obj
diff --git a/usr.sbin/nginx/auto/lib/zlib/makefile.owc b/usr.sbin/nginx/auto/lib/zlib/makefile.owc
index f75e66d4f5b..9e123be83e9 100644
--- a/usr.sbin/nginx/auto/lib/zlib/makefile.owc
+++ b/usr.sbin/nginx/auto/lib/zlib/makefile.owc
@@ -9,6 +9,6 @@ zlib.lib:
cd $(ZLIB)
wcl386 -c $(CFLAGS) adler32.c crc32.c deflate.c trees.c zutil.c &
- compress.c
+ compress.c inflate.c inffast.c inftrees.c
wlib -n zlib.lib adler32.obj crc32.obj deflate.obj trees.obj &
- zutil.obj compress.obj
+ zutil.obj compress.obj inflate.obj inffast.obj inftrees.obj
diff --git a/usr.sbin/nginx/html/50x.html b/usr.sbin/nginx/html/50x.html
index 836fb2d5aa6..f60f5e72d17 100644
--- a/usr.sbin/nginx/html/50x.html
+++ b/usr.sbin/nginx/html/50x.html
@@ -1,18 +1,21 @@
+<!DOCTYPE html>
<html>
<head>
-<title>The page is temporarily unavailable</title>
+<title>Error</title>
<style>
-body { font-family: Tahoma, Verdana, Arial, sans-serif; }
+ body {
+ width: 35em;
+ margin: 0 auto;
+ font-family: Tahoma, Verdana, Arial, sans-serif;
+ }
</style>
</head>
-<body bgcolor="white" text="black">
-<table width="100%" height="100%">
-<tr>
-<td align="center" valign="middle">
-The page you are looking for is temporarily unavailable.<br/>
-Please try again later.
-</td>
-</tr>
-</table>
+<body>
+<h1>An error occurred.</h1>
+<p>Sorry, the page you are looking for is currently unavailable.<br/>
+Please try again later.</p>
+<p>If you are the system administrator of this resource then you should check
+the <a href="http://nginx.org/r/error_log">error log</a> for details.</p>
+<p><em>Faithfully yours, nginx.</em></p>
</body>
</html>
diff --git a/usr.sbin/nginx/html/index.html b/usr.sbin/nginx/html/index.html
index 1f7927539a2..2ca3b9543c0 100644
--- a/usr.sbin/nginx/html/index.html
+++ b/usr.sbin/nginx/html/index.html
@@ -1,8 +1,25 @@
+<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
+<style>
+ body {
+ width: 35em;
+ margin: 0 auto;
+ font-family: Tahoma, Verdana, Arial, sans-serif;
+ }
+</style>
</head>
-<body bgcolor="white" text="black">
-<center><h1>Welcome to nginx!</h1></center>
+<body>
+<h1>Welcome to nginx!</h1>
+<p>If you see this page, the nginx web server is successfully installed and
+working. Further configuration is required.</p>
+
+<p>For online documentation and support please refer to
+<a href="http://nginx.org/">nginx.org</a>.<br/>
+Commercial support is available at
+<a href="http://nginx.com/">nginx.com</a>.</p>
+
+<p><em>Thank you for using nginx.</em></p>
</body>
</html>
diff --git a/usr.sbin/nginx/src/core/nginx.c b/usr.sbin/nginx/src/core/nginx.c
index a59de2dbedf..0fb0202d93f 100644
--- a/usr.sbin/nginx/src/core/nginx.c
+++ b/usr.sbin/nginx/src/core/nginx.c
@@ -842,7 +842,7 @@ ngx_process_options(ngx_cycle_t *cycle)
len = ngx_strlen(ngx_prefix);
p = ngx_prefix;
- if (!ngx_path_separator(*p)) {
+ if (len && !ngx_path_separator(p[len - 1])) {
p = ngx_pnalloc(cycle->pool, len + 1);
if (p == NULL) {
return NGX_ERROR;
diff --git a/usr.sbin/nginx/src/core/nginx.h b/usr.sbin/nginx/src/core/nginx.h
index c807c9a1200..88f5f2b8441 100644
--- a/usr.sbin/nginx/src/core/nginx.h
+++ b/usr.sbin/nginx/src/core/nginx.h
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1002003
-#define NGINX_VERSION "1.2.3"
+#define nginx_version 1002004
+#define NGINX_VERSION "1.2.4"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
diff --git a/usr.sbin/nginx/src/core/ngx_conf_file.c b/usr.sbin/nginx/src/core/ngx_conf_file.c
index 0aa659cd8bb..6da2dae809d 100644
--- a/usr.sbin/nginx/src/core/ngx_conf_file.c
+++ b/usr.sbin/nginx/src/core/ngx_conf_file.c
@@ -12,7 +12,6 @@
static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
-static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name);
static void ngx_conf_flush_files(ngx_cycle_t *cycle);
@@ -731,7 +730,7 @@ ngx_conf_read_token(ngx_conf_t *cf)
}
-static char *
+char *
ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
char *rv;
diff --git a/usr.sbin/nginx/src/core/ngx_conf_file.h b/usr.sbin/nginx/src/core/ngx_conf_file.h
index 41bacaa9875..64a9e8fc8d9 100644
--- a/usr.sbin/nginx/src/core/ngx_conf_file.h
+++ b/usr.sbin/nginx/src/core/ngx_conf_file.h
@@ -317,6 +317,7 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
char *ngx_conf_param(ngx_conf_t *cf);
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
+char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
diff --git a/usr.sbin/nginx/src/core/ngx_crypt.c b/usr.sbin/nginx/src/core/ngx_crypt.c
index 365f9c82a8e..b2e25b90101 100644
--- a/usr.sbin/nginx/src/core/ngx_crypt.c
+++ b/usr.sbin/nginx/src/core/ngx_crypt.c
@@ -194,6 +194,7 @@ static ngx_int_t
ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
{
size_t len;
+ ngx_int_t rc;
ngx_str_t encoded, decoded;
ngx_sha1_t sha1;
@@ -204,12 +205,18 @@ ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
encoded.data = salt + sizeof("{SSHA}") - 1;
encoded.len = ngx_strlen(encoded.data);
- decoded.data = ngx_pnalloc(pool, ngx_base64_decoded_length(encoded.len));
+ len = ngx_max(ngx_base64_decoded_length(encoded.len), 20);
+
+ decoded.data = ngx_pnalloc(pool, len);
if (decoded.data == NULL) {
return NGX_ERROR;
}
- ngx_decode_base64(&decoded, &encoded);
+ rc = ngx_decode_base64(&decoded, &encoded);
+
+ if (rc != NGX_OK || decoded.len < 20) {
+ decoded.len = 20;
+ }
/* update SHA1 from key and salt */
diff --git a/usr.sbin/nginx/src/core/ngx_cycle.c b/usr.sbin/nginx/src/core/ngx_cycle.c
index 4b04d320c1c..9334b031115 100644
--- a/usr.sbin/nginx/src/core/ngx_cycle.c
+++ b/usr.sbin/nginx/src/core/ngx_cycle.c
@@ -1289,14 +1289,6 @@ ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
continue;
}
- if (size && size != shm_zone[i].shm.size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "the size %uz of shared memory zone \"%V\" "
- "conflicts with already declared size %uz",
- size, &shm_zone[i].shm.name, shm_zone[i].shm.size);
- return NULL;
- }
-
if (tag != shm_zone[i].tag) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the shared memory zone \"%V\" is "
@@ -1305,6 +1297,14 @@ ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
return NULL;
}
+ if (size && size != shm_zone[i].shm.size) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "the size %uz of shared memory zone \"%V\" "
+ "conflicts with already declared size %uz",
+ size, &shm_zone[i].shm.name, shm_zone[i].shm.size);
+ return NULL;
+ }
+
return &shm_zone[i];
}
diff --git a/usr.sbin/nginx/src/core/ngx_radix_tree.c b/usr.sbin/nginx/src/core/ngx_radix_tree.c
index b95cbc01303..5b35d1e498d 100644
--- a/usr.sbin/nginx/src/core/ngx_radix_tree.c
+++ b/usr.sbin/nginx/src/core/ngx_radix_tree.c
@@ -60,7 +60,7 @@ ngx_radix_tree_create(ngx_pool_t *pool, ngx_int_t preallocate)
*/
if (preallocate == -1) {
- switch (ngx_pagesize / sizeof(ngx_radix_tree_t)) {
+ switch (ngx_pagesize / sizeof(ngx_radix_node_t)) {
/* amd64 */
case 128:
diff --git a/usr.sbin/nginx/src/core/ngx_resolver.c b/usr.sbin/nginx/src/core/ngx_resolver.c
index 3e75e05a378..178e0831d56 100644
--- a/usr.sbin/nginx/src/core/ngx_resolver.c
+++ b/usr.sbin/nginx/src/core/ngx_resolver.c
@@ -113,15 +113,6 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
return NULL;
}
- if (n) {
- if (ngx_array_init(&r->udp_connections, cf->pool, n,
- sizeof(ngx_udp_connection_t))
- != NGX_OK)
- {
- return NULL;
- }
- }
-
cln->data = r;
r->event = ngx_calloc(sizeof(ngx_event_t), cf->log);
@@ -153,6 +144,15 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
r->log = &cf->cycle->new_log;
r->log_level = NGX_LOG_ERR;
+ if (n) {
+ if (ngx_array_init(&r->udp_connections, cf->pool, n,
+ sizeof(ngx_udp_connection_t))
+ != NGX_OK)
+ {
+ return NULL;
+ }
+ }
+
for (i = 0; i < n; i++) {
if (ngx_strncmp(names[i].data, "valid=", 6) == 0) {
s.len = names[i].len - 6;
diff --git a/usr.sbin/nginx/src/core/ngx_slab.c b/usr.sbin/nginx/src/core/ngx_slab.c
index 782792d79ef..ae9d6f3fc0e 100644
--- a/usr.sbin/nginx/src/core/ngx_slab.c
+++ b/usr.sbin/nginx/src/core/ngx_slab.c
@@ -162,8 +162,8 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0,
"slab alloc: %uz", size);
- page = ngx_slab_alloc_pages(pool, (size + ngx_pagesize - 1)
- >> ngx_pagesize_shift);
+ page = ngx_slab_alloc_pages(pool, (size >> ngx_pagesize_shift)
+ + ((size % ngx_pagesize) ? 1 : 0));
if (page) {
p = (page - pool->pages) << ngx_pagesize_shift;
p += (uintptr_t) pool->start;
diff --git a/usr.sbin/nginx/src/core/ngx_string.c b/usr.sbin/nginx/src/core/ngx_string.c
index 53cb946fee0..a42ee861f03 100644
--- a/usr.sbin/nginx/src/core/ngx_string.c
+++ b/usr.sbin/nginx/src/core/ngx_string.c
@@ -1827,7 +1827,7 @@ ngx_sort(void *base, size_t n, size_t size,
#if (NGX_MEMCPY_LIMIT)
void *
-ngx_memcpy(void *dst, void *src, size_t n)
+ngx_memcpy(void *dst, const void *src, size_t n)
{
if (n > NGX_MEMCPY_LIMIT) {
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, "memcpy %uz bytes", n);
diff --git a/usr.sbin/nginx/src/core/ngx_string.h b/usr.sbin/nginx/src/core/ngx_string.h
index e140fb86da8..52c6f338d89 100644
--- a/usr.sbin/nginx/src/core/ngx_string.h
+++ b/usr.sbin/nginx/src/core/ngx_string.h
@@ -89,7 +89,7 @@ ngx_strlchr(u_char *p, u_char *last, u_char c)
#if (NGX_MEMCPY_LIMIT)
-void *ngx_memcpy(void *dst, void *src, size_t n);
+void *ngx_memcpy(void *dst, const void *src, size_t n);
#define ngx_cpymem(dst, src, n) (((u_char *) ngx_memcpy(dst, src, n)) + (n))
#else
diff --git a/usr.sbin/nginx/src/core/ngx_times.c b/usr.sbin/nginx/src/core/ngx_times.c
index ed1bf64bc08..77490faf045 100644
--- a/usr.sbin/nginx/src/core/ngx_times.c
+++ b/usr.sbin/nginx/src/core/ngx_times.c
@@ -211,6 +211,10 @@ ngx_time_sigsafe_update(void)
slot++;
}
+ tp = &cached_time[slot];
+
+ tp->sec = 0;
+
ngx_gmtime(sec + cached_gmtoff * 60, &tm);
p = &cached_err_log_time[slot][0];
diff --git a/usr.sbin/nginx/src/event/ngx_event.c b/usr.sbin/nginx/src/event/ngx_event.c
index 600a433942f..976bd646581 100644
--- a/usr.sbin/nginx/src/event/ngx_event.c
+++ b/usr.sbin/nginx/src/event/ngx_event.c
@@ -1214,7 +1214,7 @@ ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf)
fd = epoll_create(100);
if (fd != -1) {
- close(fd);
+ (void) close(fd);
module = &ngx_epoll_module;
} else if (ngx_errno != NGX_ENOSYS) {
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_fastcgi_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_fastcgi_module.c
index 55c3aef2931..e8ff24cac94 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_fastcgi_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_fastcgi_module.c
@@ -1626,6 +1626,9 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
}
part = ngx_array_push(f->split_parts);
+ if (part == NULL) {
+ return NGX_ERROR;
+ }
part->start = part_start;
part->end = part_end;
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_geo_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_geo_module.c
index 189d8ed508f..fce87a8cb46 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_geo_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_geo_module.c
@@ -233,12 +233,21 @@ ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx)
#if (NGX_HAVE_INET6)
if (addr.sockaddr->sa_family == AF_INET6) {
+ u_char *p;
+ in_addr_t inaddr;
struct in6_addr *inaddr6;
inaddr6 = &((struct sockaddr_in6 *) addr.sockaddr)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
- return ntohl(*(in_addr_t *) &inaddr6->s6_addr[12]);
+ p = inaddr6->s6_addr;
+
+ inaddr = p[12] << 24;
+ inaddr += p[13] << 16;
+ inaddr += p[14] << 8;
+ inaddr += p[15];
+
+ return inaddr;
}
}
@@ -400,15 +409,15 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
}
+ if (ctx.high.default_value == NULL) {
+ ctx.high.default_value = &ngx_http_variable_null_value;
+ }
+
geo->u.high = ctx.high;
var->get_handler = ngx_http_geo_range_variable;
var->data = (uintptr_t) geo;
- if (ctx.high.default_value == NULL) {
- ctx.high.default_value = &ngx_http_variable_null_value;
- }
-
ngx_destroy_pool(ctx.temp_pool);
ngx_destroy_pool(pool);
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_geoip_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_geoip_module.c
index 0ce3bf1e59b..7ff4f10fb2a 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_geoip_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_geoip_module.c
@@ -226,12 +226,21 @@ ngx_http_geoip_addr(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf)
#if (NGX_HAVE_INET6)
if (addr.sockaddr->sa_family == AF_INET6) {
+ u_char *p;
+ in_addr_t inaddr;
struct in6_addr *inaddr6;
inaddr6 = &((struct sockaddr_in6 *) addr.sockaddr)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
- return ntohl(*(in_addr_t *) &inaddr6->s6_addr[12]);
+ p = inaddr6->s6_addr;
+
+ inaddr = p[12] << 24;
+ inaddr += p[13] << 16;
+ inaddr += p[14] << 8;
+ inaddr += p[15];
+
+ return inaddr;
}
}
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c
index 106da7a535e..e82ca493dab 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_limit_conn_module.c
@@ -721,6 +721,10 @@ ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
limit = ngx_array_push(&lccf->limits);
+ if (limit == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
limit->conn = n;
limit->shm_zone = shm_zone;
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_limit_req_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_limit_req_module.c
index 18db7154958..31a8b987a65 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_limit_req_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_limit_req_module.c
@@ -444,17 +444,17 @@ ngx_http_limit_req_lookup(ngx_http_limit_req_limit_t *limit, ngx_uint_t hash,
node->key = hash;
- ngx_rbtree_insert(&ctx->sh->rbtree, node);
-
lr = (ngx_http_limit_req_node_t *) &node->color;
- ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
-
lr->len = (u_char) len;
lr->excess = 0;
ngx_memcpy(lr->data, data, len);
+ ngx_rbtree_insert(&ctx->sh->rbtree, node);
+
+ ngx_queue_insert_head(&ctx->sh->queue, &lr->queue);
+
if (account) {
lr->last = now;
lr->count = 0;
@@ -937,6 +937,9 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
limit = ngx_array_push(&lrcf->limits);
+ if (limit == NULL) {
+ return NGX_CONF_ERROR;
+ }
limit->shm_zone = shm_zone;
limit->burst = burst * 1000;
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c
index e8a4ab4cc18..371737b2eac 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_map_module.c
@@ -369,7 +369,7 @@ static char *
ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
{
ngx_int_t rc, index;
- ngx_str_t *value, file, name;
+ ngx_str_t *value, name;
ngx_uint_t i, key;
ngx_http_map_conf_ctx_t *ctx;
ngx_http_variable_value_t *var, **vp;
@@ -391,15 +391,7 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
}
if (ngx_strcmp(value[0].data, "include") == 0) {
- file = value[1];
-
- if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
-
- return ngx_conf_parse(cf, &file);
+ return ngx_conf_include(cf, dummy, conf);
}
if (value[1].data[0] == '$') {
@@ -416,11 +408,12 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
for (i = 0; i < ctx->var_values.nelts; i++) {
if (index == (ngx_int_t) var[i].data) {
+ var = &var[i];
goto found;
}
}
- var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t));
+ var = ngx_array_push(&ctx->var_values);
if (var == NULL) {
return NGX_CONF_ERROR;
}
@@ -431,13 +424,6 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
var->len = 0;
var->data = (u_char *) index;
- vp = ngx_array_push(&ctx->var_values);
- if (vp == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *vp = var;
-
goto found;
}
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_ssi_filter_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_ssi_filter_module.c
index 219465ae909..6c2d0a9b042 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_ssi_filter_module.c
@@ -1024,6 +1024,7 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
switch (state) {
case ssi_start_state:
+ /* not reached */
break;
case ssi_tag_state:
diff --git a/usr.sbin/nginx/src/http/modules/perl/nginx.pm b/usr.sbin/nginx/src/http/modules/perl/nginx.pm
index 7f825475adb..dccbbd9c146 100644
--- a/usr.sbin/nginx/src/http/modules/perl/nginx.pm
+++ b/usr.sbin/nginx/src/http/modules/perl/nginx.pm
@@ -50,7 +50,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.2.3';
+our $VERSION = '1.2.4';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/usr.sbin/nginx/src/http/ngx_http_core_module.c b/usr.sbin/nginx/src/http/ngx_http_core_module.c
index 1776d432e7c..3c28e7e33f9 100644
--- a/usr.sbin/nginx/src/http/ngx_http_core_module.c
+++ b/usr.sbin/nginx/src/http/ngx_http_core_module.c
@@ -2733,7 +2733,15 @@ ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr,
if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
family = AF_INET;
- inaddr = *(in_addr_t *) &inaddr6->s6_addr[12];
+
+ p = inaddr6->s6_addr;
+
+ inaddr = p[12] << 24;
+ inaddr += p[13] << 16;
+ inaddr += p[14] << 8;
+ inaddr += p[15];
+
+ inaddr = htonl(inaddr);
}
}
#endif
@@ -3193,7 +3201,7 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
{
ngx_http_core_loc_conf_t *clcf = conf;
- ngx_str_t *value, *content_type, *old, file;
+ ngx_str_t *value, *content_type, *old;
ngx_uint_t i, n, hash;
ngx_hash_key_t *type;
@@ -3206,15 +3214,8 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
" in \"include\" directive");
return NGX_CONF_ERROR;
}
- file = value[1];
-
- if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
- return ngx_conf_parse(cf, &file);
+ return ngx_conf_include(cf, dummy, conf);
}
content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t));
diff --git a/usr.sbin/nginx/src/http/ngx_http_write_filter_module.c b/usr.sbin/nginx/src/http/ngx_http_write_filter_module.c
index 72b1f9b2fd7..fd44bc65948 100644
--- a/usr.sbin/nginx/src/http/ngx_http_write_filter_module.c
+++ b/usr.sbin/nginx/src/http/ngx_http_write_filter_module.c
@@ -185,18 +185,14 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
if (size == 0 && !(c->buffered & NGX_LOWLEVEL_BUFFERED)) {
- if (last) {
- r->out = NULL;
- c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
-
- return NGX_OK;
- }
-
- if (flush) {
- do {
- r->out = r->out->next;
- } while (r->out);
+ if (last || flush) {
+ for (cl = r->out; cl; /* void */) {
+ ln = cl;
+ cl = cl->next;
+ ngx_free_chain(r->pool, ln);
+ }
+ r->out = NULL;
c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
return NGX_OK;
diff --git a/usr.sbin/nginx/src/mail/ngx_mail.c b/usr.sbin/nginx/src/mail/ngx_mail.c
index 49ec2e05b4d..3812e15179e 100644
--- a/usr.sbin/nginx/src/mail/ngx_mail.c
+++ b/usr.sbin/nginx/src/mail/ngx_mail.c
@@ -263,6 +263,12 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
break;
#endif
+#if (NGX_HAVE_UNIX_DOMAIN)
+ case AF_UNIX:
+ p = 0;
+ break;
+#endif
+
default: /* AF_INET */
sin = (struct sockaddr_in *) sa;
p = sin->sin_port;
@@ -539,6 +545,11 @@ ngx_mail_cmp_conf_addrs(const void *one, const void *two)
return 1;
}
+ if (second->wildcard) {
+ /* a wildcard must be the last resort, shift it to the end */
+ return -1;
+ }
+
if (first->bind && !second->bind) {
/* shift explicit bind()ed addresses to the start */
return -1;
diff --git a/usr.sbin/nginx/src/mail/ngx_mail_auth_http_module.c b/usr.sbin/nginx/src/mail/ngx_mail_auth_http_module.c
index c23c4bad73d..d2bd4ad61a8 100644
--- a/usr.sbin/nginx/src/mail/ngx_mail_auth_http_module.c
+++ b/usr.sbin/nginx/src/mail/ngx_mail_auth_http_module.c
@@ -1332,7 +1332,7 @@ ngx_mail_auth_http_merge_conf(ngx_conf_t *cf, void *parent, void *child)
if (conf->peer == NULL) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "no \"http_auth\" is defined for server in %s:%ui",
+ "no \"auth_http\" is defined for server in %s:%ui",
conf->file, conf->line);
return NGX_CONF_ERROR;
diff --git a/usr.sbin/nginx/src/mail/ngx_mail_core_module.c b/usr.sbin/nginx/src/mail/ngx_mail_core_module.c
index f79913b0a46..6509b989b1c 100644
--- a/usr.sbin/nginx/src/mail/ngx_mail_core_module.c
+++ b/usr.sbin/nginx/src/mail/ngx_mail_core_module.c
@@ -340,6 +340,14 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
break;
#endif
+#if (NGX_HAVE_UNIX_DOMAIN)
+ case AF_UNIX:
+ off = offsetof(struct sockaddr_un, sun_path);
+ len = sizeof(((struct sockaddr_un *) sa)->sun_path);
+ port = 0;
+ break;
+#endif
+
default: /* AF_INET */
off = offsetof(struct sockaddr_in, sin_addr);
len = 4;
@@ -374,21 +382,23 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->wildcard = u.wildcard;
ls->ctx = cf->ctx;
- for (m = 0; ngx_modules[m]; m++) {
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
- continue;
- }
+ if (cscf->protocol == NULL) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
+ continue;
+ }
- module = ngx_modules[m]->ctx;
+ module = ngx_modules[m]->ctx;
- if (module->protocol == NULL) {
- continue;
- }
+ if (module->protocol == NULL) {
+ continue;
+ }
- for (i = 0; module->protocol->port[i]; i++) {
- if (module->protocol->port[i] == u.port) {
- cscf->protocol = module->protocol;
- break;
+ for (i = 0; module->protocol->port[i]; i++) {
+ if (module->protocol->port[i] == u.port) {
+ cscf->protocol = module->protocol;
+ break;
+ }
}
}
}
diff --git a/usr.sbin/nginx/src/mail/ngx_mail_handler.c b/usr.sbin/nginx/src/mail/ngx_mail_handler.c
index a1c4464f7e5..ae955f9c6ae 100644
--- a/usr.sbin/nginx/src/mail/ngx_mail_handler.c
+++ b/usr.sbin/nginx/src/mail/ngx_mail_handler.c
@@ -38,8 +38,6 @@ ngx_mail_init_connection(ngx_connection_t *c)
/* find the server configuration for the address:port */
- /* AF_INET only */
-
port = c->listening->servers;
if (port->naddrs > 1) {
diff --git a/usr.sbin/nginx/src/os/unix/ngx_files.c b/usr.sbin/nginx/src/os/unix/ngx_files.c
index 2dfa1b7a1ab..d71aec316d4 100644
--- a/usr.sbin/nginx/src/os/unix/ngx_files.c
+++ b/usr.sbin/nginx/src/os/unix/ngx_files.c
@@ -139,7 +139,7 @@ ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access)
access ? access : 0600);
if (fd != -1 && !persistent) {
- unlink((const char *) name);
+ (void) unlink((const char *) name);
}
return fd;