Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to stable-0.62 grimoire by Vlad Glagolev (e1ed38f10f1b99e70ee2873f2028c4e00b3f3a19)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Vlad Glagolev <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to stable-0.62 grimoire by Vlad Glagolev (e1ed38f10f1b99e70ee2873f2028c4e00b3f3a19)
  • Date: Mon, 6 Apr 2015 07:24:16 -0500

GIT changes to stable-0.62 grimoire by Vlad Glagolev <stealth AT sourcemage.org>:

http/nginx/BUILD | 23 -
http/nginx/CONFIGURE | 7
http/nginx/DEPENDS | 10
http/nginx/DETAILS | 32 +
http/nginx/HISTORY | 24 -
http/nginx/PREPARE | 10
http/nginx/PRE_BUILD | 10
http/nginx/libressl.patch | 15
http/nginx/syslog-0.8-1.0.config | 5
http/nginx/syslog-0.8-1.0.patch | 686
---------------------------------------
http/nginx/syslog-0.8-1.6.config | 5
http/nginx/syslog-1.5.6.patch | 423 ++++++++++++++++++++++++
12 files changed, 510 insertions(+), 740 deletions(-)

New commits:
commit e1ed38f10f1b99e70ee2873f2028c4e00b3f3a19
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

nginx: => 1.6.2 (stable), 1.7.11 (devel) [security]

(cherry picked from commit cd526262c156ed40e5d396b4796e8c48f187634f)

commit b73ec0168652987793695c369ff1b56f325dbdca
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

Revert "nginx: Update stable to 1.6.2 and devel to 1.7.9"

This reverts commit 3e4b58c05457886d85c3bed88311d826f4545ae9.

Reason: this update doesn't have correct upgrading procedure steps from
older
branches, resets previously-defined user settings, breaks syslog support
in
stable branch and breaks default version display via gaze.

(cherry picked from commit b25f33ff12a7655ce05e1258517e8e358cb96014)

diff --git a/http/nginx/BUILD b/http/nginx/BUILD
index 540a54b..69000ce 100755
--- a/http/nginx/BUILD
+++ b/http/nginx/BUILD
@@ -1,5 +1,3 @@
-. "$GRIMOIRE/FUNCTIONS" &&
-
create_account nginx &&

persistent_add TEMP_DIR &&
@@ -15,32 +13,23 @@ if list_find "$NGINX_MODULES" "dav_ext"; then
OPTS="--add-module=$SOURCE_DIRECTORY5 $OPTS"
fi &&

-if [[ $NGINX_SYSLOG == n ]]; then
- OPTS="--http-log-path=$INSTALL_ROOT/var/log/nginx/access.log \
- --error-log-path=$INSTALL_ROOT/var/log/nginx/error.log \
- $OPTS"
-else
- if is_version_less $VERSION 0.8; then
- OPTS="--with-syslog $OPTS"
- else
- OPTS="--add-module=$SOURCE_DIRECTORY/syslog $OPTS"
- fi
-fi &&
-
-if ! is_version_less $VERSION 0.8; then
- OPTS="--http-uwsgi-temp-path=$TEMP_DIR/uwsgi_temp $OPTS" &&
- OPTS="--http-scgi-temp-path=$TEMP_DIR/scgi_temp $OPTS"
+if [[ $NGINX_SYSLOG == y ]]; then
+ OPTS="--add-module=$SOURCE_DIRECTORY/syslog $OPTS"
fi &&

./configure --prefix="$INSTALL_ROOT/etc/nginx" \
--conf-path="$INSTALL_ROOT/etc/nginx/nginx.conf" \
--sbin-path="$INSTALL_ROOT/usr/sbin/nginx" \
--pid-path="$INSTALL_ROOT/var/run/nginx.pid" \
+ --http-log-path="$INSTALL_ROOT/var/log/nginx/access.log" \
+ --error-log-path="$INSTALL_ROOT/var/log/nginx/error.log" \
--user=nginx \
--group=nginx \
--http-client-body-temp-path="$TEMP_DIR/client_body_temp" \
--http-proxy-temp-path="$TEMP_DIR/proxy_temp" \
--http-fastcgi-temp-path="$TEMP_DIR/fastcgi_temp" \
+ --http-uwsgi-temp-path="$TEMP_DIR/uwsgi_temp" \
+ --http-scgi-temp-path="$TEMP_DIR/scgi_temp" \
$NGINX_OPTS \
$OPTS &&

diff --git a/http/nginx/CONFIGURE b/http/nginx/CONFIGURE
index 40abfe6..9b12675 100755
--- a/http/nginx/CONFIGURE
+++ b/http/nginx/CONFIGURE
@@ -1,14 +1,17 @@
. "$GRIMOIRE/FUNCTIONS" &&

-if is_version_less $VERSION 1.1; then
+if is_version_less $VERSION 1.7.1; then
config_query NGINX_SYSLOG "Build with syslog support?" n
else
persistent_add NGINX_SYSLOG &&
local NGINX_SYSLOG="n"
fi &&

+config_query_option NGINX_OPTS "Build with IPv6 support?" n \
+ "--with-ipv6" "" &&
+
config_query_option NGINX_OPTS "Build with mail support?" n \
- "--with-mail" "" &&
+ "--with-mail --with-mail_ssl_module" "" &&

if list_find "$NGINX_MODULES" "dav_ext"; then
list_add "NGINX_OPTS" "--with-http_dav_module"
diff --git a/http/nginx/DEPENDS b/http/nginx/DEPENDS
index 5065f49..74aafcd 100755
--- a/http/nginx/DEPENDS
+++ b/http/nginx/DEPENDS
@@ -1,3 +1,5 @@
+. "$GRIMOIRE/FUNCTIONS" &&
+
depends SSL "--with-http_ssl_module" &&

optional_depends pcre \
@@ -9,8 +11,12 @@ optional_depends perl \
"--with-http_perl_module" "" \
"for embedded Perl support" &&

-if [[ $NGINX_SYSLOG == y ]]; then
- depends SYSTEM-LOGGER
+optional_depends libxslt \
+ "--with-http_xslt_module" "" \
+ "to enable HTTP XSLT module" &&
+
+if [[ $NGINX_SYSLOG == y ]] || is_version_less 1.7.0 $VERSION; then
+ suggest_depends SYSTEM-LOGGER "" "" "to use syslog"
fi &&

if list_find "$NGINX_MODULES" "dav_ext"; then
diff --git a/http/nginx/DETAILS b/http/nginx/DETAILS
index ae14c8b..0f5cfcf 100755
--- a/http/nginx/DETAILS
+++ b/http/nginx/DETAILS
@@ -1,15 +1,19 @@
SPELL=nginx
-case "$NGINX_BRANCH" in
+
+if [[ -z $NGINX_RELEASE ]]; then
+ NGINX_RELEASE="stable"
+fi
+
+case "$NGINX_RELEASE" in
stable)
VERSION=1.6.2
- SECURITY_PATCH=4
+ SECURITY_PATCH=5
;;
devel)
- VERSION=1.7.9
- SECURITY_PATCH=4
+ VERSION=1.7.11
+ SECURITY_PATCH=5
;;
esac
- PATCHLEVEL=2
SOURCE=$SPELL-$VERSION.tar.gz
SOURCE2=$SPELL-$VERSION.tar.gz.asc
SOURCE_URL[0]=http://nginx.org/download/$SOURCE
@@ -20,24 +24,24 @@ SOURCE_DIRECTORY="$BUILD_DIRECTORY/$SPELL-$VERSION"

# optional modules
if list_find "$NGINX_MODULES" "push"; then
- ID_PUSH=nginx_http_push_module-0.692
+ ID_PUSH=nginx_http_push_module-0.73
SOURCE3=${ID_PUSH}.tar.gz
- SOURCE3_URL[0]=http://pushmodule.slact.net/downloads/$SOURCE3
-
SOURCE3_HASH=sha512:79821cacf5db4b1309e3f1c8d6980f83b1093dd3f291db5298bfdeb0d889fc0629625dcf3135d1cf7554b43308ef7172a4f40596928ab3069426801177ed3c1c
+
SOURCE3_URL[0]=https://github.com/slact/nginx_http_push_module/archive/v0.73.tar.gz
+
SOURCE3_HASH=sha512:ba0038af0e28f03f2201d26c10e356eceef5b188778be83a93c76c5969bc366da9d84edfd4ec93817a9c12029d494456a4c5ee40eaff10554cff9b6a9b7ca4e3
SOURCE_DIRECTORY3="$SOURCE_DIRECTORY/${ID_PUSH}"
fi
if list_find "$NGINX_MODULES" "auth_ldap"; then
- ID_AUTH_LDAP=ngx_http_auth_ldap_module-1.0-a3
+ ID_AUTH_LDAP=nginx-auth-ldap-0.1
SOURCE4=${ID_AUTH_LDAP}.tar.gz
- SOURCE4_URL[0]=http://nginx-auth-ldap.googlecode.com/files/$SOURCE4
-
SOURCE4_HASH=sha512:01629d1a002088da0fd3beb6fa73448a5e5f87838320253bb33f5a44292deca7b7ef9c185a7749a11f564a51cfbe7339b398012ec7a49f4973061702c0cae4c1
+ SOURCE4_URL[0]=https://github.com/kvspb/nginx-auth-ldap/archive/v0.1.tar.gz
+
SOURCE4_HASH=sha512:b748c34dca64ed768f615a11a3d8236746d9474e1f6f635cba5dab275155747c6b502176ad6b320203d3c8822802db7c6316a9b62d8b511fb6a1a887fd8713bc
SOURCE_DIRECTORY4="$SOURCE_DIRECTORY/${ID_AUTH_LDAP}"
fi
if list_find "$NGINX_MODULES" "dav_ext"; then
- ID_DAV_EXT=arut-nginx-dav-ext-module-0e07a3e
+ ID_DAV_EXT=nginx-dav-ext-module-0.0.3
SOURCE5=${ID_DAV_EXT}.tar.gz
- SOURCE5_URL[0]=https://github.com/arut/nginx-dav-ext-module/tarball/v0.0.2
-
SOURCE5_HASH=sha512:5580a58bb876e772c953e89c11cd7416f45c5528ee9dbbb8d77dd4e161342a4ded63015cf9350ac6a60369bd4b2ee9a45fb5e35923bc2092d263c9ee33e5c554
+
SOURCE5_URL[0]=https://github.com/arut/nginx-dav-ext-module/archive/v0.0.3.tar.gz
+
SOURCE5_HASH=sha512:4763b1c5e417248d80acfacf20bfc5ba3e06675ff08e37703867daef99a400980b536941e4955c259432905bd11ab998bc2e2489a50350413c7bf37e18eafb74
SOURCE_DIRECTORY5="$SOURCE_DIRECTORY/${ID_DAV_EXT}"
fi

diff --git a/http/nginx/HISTORY b/http/nginx/HISTORY
index 9986aa4..eaa3e17 100644
--- a/http/nginx/HISTORY
+++ b/http/nginx/HISTORY
@@ -1,11 +1,19 @@
-2015-01-17 Ismael Luceno <ismael AT sourcemage.org>
- * DETAILS, PREPARE: Use prepare_select_branch
- Remove "old" and legacy "branches" due to security issues
- * DETAILS: Update stable branch to 1.6.2
- * DETAILS: Update devel branch to 1.7.9
- * PRE_BUILD: Removed obsolete patches
- * space.patch: Removed, not needed anymore
- * syslog-0.7.patch: Removed, not needed anymore
+2015-04-06 Vlad Glagolev <stealth AT sourcemage.org>
+ * DETAILS: updated spell to 1.6.2 (stable), 1.7.11 (devel); updated
+ modules (nginx_http_push_module 0.73, nginx-auth-ldap 0.1,
+ nginx-dav-ext-module 0.0.3) and their urls; SECURITY_PATCH++
+ * PREPARE: flawlessly upgrade from legacy and old branches
+ * CONFIGURE: force mail_ssl_module for mail; added IPv6 option
+ * DEPENDS: added libxslt optional dependency; made SYSTEM-LOGGER
+ suggested dependency
+ * BUILD: removed FUNCTIONS usage (not needed); force log, uwsgi/scgi
+ temp paths
+ * PRE_BUILD: apply libressl patch; removed FUNCTIONS usage (not
needed)
+ * space.patch: removed, fixed by upstream
+ * syslog-0.8-1.0.config: renamed to syslog-0.8-1.6.config
+ * syslog-0.7.patch, syslog-0.8-1.0.patch: removed obsolete patches
+ * syslog-1.5.6.patch: added, for syslog support in stable branch
+ * libressl.patch: added, to fix build against libressl

2014-12-12 Vlad Glagolev <stealth AT sourcemage.org>
* DETAILS: PATCHLEVEL++
diff --git a/http/nginx/PREPARE b/http/nginx/PREPARE
index 0799787..c86d13d 100755
--- a/http/nginx/PREPARE
+++ b/http/nginx/PREPARE
@@ -1,7 +1,13 @@
-. "$GRIMOIRE/FUNCTIONS" &&
. "$GRIMOIRE/config_query_multi.function" &&

-prepare_select_branch stable devel &&
+# backporting legacy branch selection
+if [[ $NGINX_RELEASE == legacy ]] || [[ $NGINX_RELEASE == old ]]; then
+ NGINX_RELEASE="stable"
+fi &&
+
+config_query_list NGINX_RELEASE "Select which release to build:" \
+ stable \
+ devel &&

config_query_multi NGINX_MODULES "What additional modules to build?" \
none \
diff --git a/http/nginx/PRE_BUILD b/http/nginx/PRE_BUILD
index 8155684..557841c 100755
--- a/http/nginx/PRE_BUILD
+++ b/http/nginx/PRE_BUILD
@@ -1,12 +1,14 @@
-. "$GRIMOIRE/FUNCTIONS" &&
-
default_pre_build &&
cd "$SOURCE_DIRECTORY" &&

if [[ $NGINX_SYSLOG == y ]]; then
mkdir syslog &&
- cp "$SPELL_DIRECTORY/syslog-0.8-1.0.config" syslog/config &&
- patch -p1 < "$SPELL_DIRECTORY/syslog-0.8-1.0.patch"
+ cp "$SPELL_DIRECTORY/syslog-0.8-1.6.config" syslog/config &&
+ patch -p1 < "$SPELL_DIRECTORY/syslog-1.5.6.patch"
+fi &&
+
+if [[ $(get_spell_provider $SPELL SSL) == "libressl" ]]; then
+ patch -p0 < "$SPELL_DIRECTORY/libressl.patch"
fi &&

if list_find "$NGINX_MODULES" "push"; then
diff --git a/http/nginx/libressl.patch b/http/nginx/libressl.patch
new file mode 100644
index 0000000..eb52993
--- /dev/null
+++ b/http/nginx/libressl.patch
@@ -0,0 +1,15 @@
+# New version of the file generated with:
+# perl -i.orig -0p -e 's|(^#include <ngx_event.h>).*(typedef
struct)|$1\n#include <openssl\/rand\.h>\n\nint RAND_bytes\(unsigned char
\*buf, int num\);\nint RAND_pseudo_bytes\(unsigned char \*buf, int
num\);\n\n$2|ms' src/event/ngx_event_openssl.c;
+--- src/event/ngx_event_openssl.c.orig 2014-09-16 16:23:19.000000000 +0400
++++ src/event/ngx_event_openssl.c 2015-04-06 12:16:58.744021793 +0300
+@@ -8,7 +8,10 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
+ #include <ngx_event.h>
++#include <openssl/rand.h>
+
++int RAND_bytes(unsigned char *buf, int num);
++int RAND_pseudo_bytes(unsigned char *buf, int num);
+
+ typedef struct {
+ ngx_uint_t engine; /* unsigned engine:1; */
diff --git a/http/nginx/syslog-0.8-1.0.config
b/http/nginx/syslog-0.8-1.0.config
deleted file mode 100644
index 05bfcfe..0000000
--- a/http/nginx/syslog-0.8-1.0.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-ngx_feature="nginx_syslog_patch"
-ngx_feature_name="nginx_syslog_patch"
-ngx_feature_run=no
-have=NGX_ENABLE_SYSLOG . auto/have
diff --git a/http/nginx/syslog-0.8-1.0.patch b/http/nginx/syslog-0.8-1.0.patch
deleted file mode 100644
index 74262b8..0000000
--- a/http/nginx/syslog-0.8-1.0.patch
+++ /dev/null
@@ -1,686 +0,0 @@
-diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
-index 7986707..9902ef7 100644
---- a/src/core/ngx_cycle.c
-+++ b/src/core/ngx_cycle.c
-@@ -84,6 +84,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
- cycle->pool = pool;
- cycle->log = log;
- cycle->new_log.log_level = NGX_LOG_ERR;
-+#if (NGX_ENABLE_SYSLOG)
-+ cycle->new_log.facility = SYSLOG_FACILITY;
-+ cycle->new_log.facility = ERR_SYSLOG_PRIORITY;
-+ cycle->new_log.syslog_on = 0;
-+ cycle->new_log.syslog_set = 0;
-+#endif
- cycle->old_cycle = old_cycle;
-
- cycle->conf_prefix.len = old_cycle->conf_prefix.len;
-diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
-index 4433314..9411fc9 100644
---- a/src/core/ngx_log.c
-+++ b/src/core/ngx_log.c
-@@ -9,6 +9,15 @@
-
-
- static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-+#if (NGX_ENABLE_SYSLOG)
-+static char *ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-+void log_exit(ngx_cycle_t *cycle);
-+
-+typedef struct{
-+ ngx_str_t name;
-+ ngx_int_t macro;
-+} ngx_string_to_macro_t;
-+#endif
-
-
- static ngx_command_t ngx_errlog_commands[] = {
-@@ -20,6 +29,15 @@ static ngx_command_t ngx_errlog_commands[] = {
- 0,
- NULL},
-
-+#if (NGX_ENABLE_SYSLOG)
-+ {ngx_string("syslog"),
-+ NGX_MAIN_CONF|NGX_CONF_TAKE12,
-+ ngx_set_syslog,
-+ 0,
-+ 0,
-+ NULL},
-+#endif
-+
- ngx_null_command
- };
-
-@@ -42,7 +60,11 @@ ngx_module_t ngx_errlog_module = {
- NULL, /* init thread */
- NULL, /* exit thread */
- NULL, /* exit process */
-- NULL, /* exit master */
-+#if (NGX_ENABLE_SYSLOG)
-+ log_exit, /* exit master */
-+#else
-+ NULL,
-+#endif
- NGX_MODULE_V1_PADDING
- };
-
-@@ -51,6 +73,44 @@ static ngx_log_t ngx_log;
- static ngx_open_file_t ngx_log_file;
- ngx_uint_t ngx_use_stderr = 1;
-
-+#if (NGX_ENABLE_SYSLOG)
-+static ngx_string_to_macro_t ngx_syslog_facilities[] = {
-+ {ngx_string("auth"), LOG_AUTH},
-+ {ngx_string("authpriv"), LOG_AUTHPRIV},
-+ {ngx_string("cron"), LOG_CRON},
-+ {ngx_string("daemon"), LOG_DAEMON},
-+ {ngx_string("ftp"), LOG_FTP},
-+ {ngx_string("kern"), LOG_KERN},
-+ {ngx_string("local0"), LOG_LOCAL0},
-+ {ngx_string("local1"), LOG_LOCAL1},
-+ {ngx_string("local2"), LOG_LOCAL2},
-+ {ngx_string("local3"), LOG_LOCAL3},
-+ {ngx_string("local4"), LOG_LOCAL4},
-+ {ngx_string("local5"), LOG_LOCAL5},
-+ {ngx_string("local6"), LOG_LOCAL6},
-+ {ngx_string("local7"), LOG_LOCAL7},
-+ {ngx_string("lpr"), LOG_LPR},
-+ {ngx_string("mail"), LOG_MAIL},
-+ {ngx_string("news"), LOG_NEWS},
-+ {ngx_string("syslog"), LOG_SYSLOG},
-+ {ngx_string("user"), LOG_USER},
-+ {ngx_string("uucp"), LOG_UUCP},
-+ { ngx_null_string, 0}
-+};
-+
-+static ngx_string_to_macro_t ngx_syslog_priorities[] = {
-+ {ngx_string("emerg"), LOG_EMERG},
-+ {ngx_string("alert"), LOG_ALERT},
-+ {ngx_string("crit"), LOG_CRIT},
-+ {ngx_string("error"), LOG_ERR},
-+ {ngx_string("err"), LOG_ERR},
-+ {ngx_string("warn"), LOG_WARNING},
-+ {ngx_string("notice"),LOG_NOTICE},
-+ {ngx_string("info"), LOG_INFO},
-+ {ngx_string("debug"), LOG_DEBUG},
-+ { ngx_null_string, 0}
-+};
-+#endif
-
- static ngx_str_t err_levels[] = {
- ngx_null_string,
-@@ -88,11 +148,16 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log,
ngx_err_t err,
- va_list args;
- #endif
- u_char *p, *last, *msg;
-+#if (NGX_ENABLE_SYSLOG)
-+ u_char *errstr_syslog;
-+#endif
- u_char errstr[NGX_MAX_ERROR_STR];
-
-+#if !(NGX_ENABLE_SYSLOG)
- if (log->file->fd == NGX_INVALID_FILE) {
- return;
- }
-+#endif
-
- last = errstr + NGX_MAX_ERROR_STR;
-
-@@ -101,6 +166,10 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log,
ngx_err_t err,
-
- p = errstr + ngx_cached_err_log_time.len;
-
-+#if (NGX_ENABLE_SYSLOG)
-+ errstr_syslog = p;
-+#endif
-+
- p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]);
-
- /* pid#tid */
-@@ -139,11 +208,27 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log,
ngx_err_t err,
-
- ngx_linefeed(p);
-
-+#if (NGX_ENABLE_SYSLOG)
-+ if (log->file != NULL && log->file->name.len != 0) {
-+ (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
-+ }
-+
-+ /* Don't send the debug level info to syslog */
-+ if (log->syslog_on && level < NGX_LOG_DEBUG) {
-+ /* write to syslog */
-+ syslog(log->priority, "%.*s", (int)(p - errstr_syslog),
errstr_syslog);
-+ }
-+#else
- (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
-+#endif
-
- if (!ngx_use_stderr
- || level > NGX_LOG_WARN
-+#if (NGX_ENABLE_SYSLOG)
-+ || (log->file != NULL && log->file->fd == ngx_stderr))
-+#else
- || log->file->fd == ngx_stderr)
-+#endif
- {
- return;
- }
-@@ -364,6 +449,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name)
-
- return log;
- }
-+
-+
-+#if (NGX_ENABLE_SYSLOG)
-+ngx_int_t
-+ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority)
-+{
-+ ngx_int_t p = 0;
-+ ngx_uint_t n, match = 0;
-+
-+ for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) {
-+ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data,
-+ ngx_syslog_priorities[n].name.len) == 0) {
-+ p = ngx_syslog_priorities[n].macro;
-+ match = 1;
-+ }
-+ }
-+
-+ if (!match) {
-+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-+ "invalid syslog priority \"%V\"", priority);
-+ return -1;
-+ }
-+
-+ return p;
-+}
-+
-+
-+char *
-+ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log)
-+{
-+ log->priority = ERR_SYSLOG_PRIORITY;
-+
-+ if (priority->len == 0) {
-+ return NGX_CONF_OK;
-+ }
-+
-+ log->priority = ngx_log_get_priority(cf, priority);
-+ if (log->priority == (-1)) {
-+ return NGX_CONF_ERROR;
-+ }
-+
-+ return NGX_CONF_OK;
-+}
-+#endif
-
-
- char *
-@@ -424,6 +553,13 @@ static char *
- ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- {
- ngx_str_t *value, name;
-+#if (NGX_ENABLE_SYSLOG)
-+ u_char *off = NULL;
-+ ngx_str_t priority;
-+
-+ ngx_str_null(&name);
-+ ngx_str_null(&priority);
-+#endif
-
- if (cf->cycle->new_log.file) {
- return "is duplicate";
-@@ -431,7 +567,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void
*conf)
-
- value = cf->args->elts;
-
-+#if (NGX_ENABLE_SYSLOG)
-+ if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) {
-+ if (!cf->cycle->new_log.syslog_set) {
-+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-+ "You must set the syslog directive and enable it
first.");
-+ return NGX_CONF_ERROR;
-+ }
-+
-+ cf->cycle->new_log.syslog_on = 1;
-+
-+ if (value[1].data[sizeof("syslog") - 1] == ':') {
-+ priority.len = value[1].len - sizeof("syslog");
-+ priority.data = value[1].data + sizeof("syslog");
-+
-+ off = (u_char *)ngx_strchr(priority.data, (int) '|');
-+ if (off != NULL) {
-+ priority.len = off - priority.data;
-+
-+ off++;
-+ name.len = value[1].data + value[1].len - off;
-+ name.data = off;
-+ }
-+ }
-+ else {
-+ if (value[1].len > sizeof("syslog")) {
-+ name.len = value[1].len - sizeof("syslog");
-+ name.data = value[1].data + sizeof("syslog");
-+ }
-+ }
-+
-+ if (ngx_log_set_priority(cf, &priority, &cf->cycle->new_log) ==
NGX_CONF_ERROR) {
-+ return NGX_CONF_ERROR;
-+ }
-+ }
-+ else if (ngx_strcmp(value[1].data, "stderr") == 0) {
-+#else
- if (ngx_strcmp(value[1].data, "stderr") == 0) {
-+#endif
- ngx_str_null(&name);
-
- } else {
-@@ -452,3 +625,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void
*conf)
-
- return ngx_log_set_levels(cf, &cf->cycle->new_log);
- }
-+
-+
-+#if (NGX_ENABLE_SYSLOG)
-+
-+#define SYSLOG_IDENT_NAME "nginx"
-+
-+static char *
-+ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-+{
-+ char *program;
-+ ngx_str_t *value;
-+ ngx_int_t facility, match = 0;
-+ ngx_uint_t n;
-+
-+ value = cf->args->elts;
-+
-+ if (cf->cycle->new_log.syslog_set) {
-+ return "is duplicate";
-+ }
-+
-+ cf->cycle->new_log.syslog_set = 1;
-+
-+ for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) {
-+ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data,
-+ ngx_syslog_facilities[n].name.len) == 0) {
-+ facility = ngx_syslog_facilities[n].macro;
-+ match = 1;
-+ break;
-+ }
-+ }
-+
-+ if (match) {
-+ cf->cycle->new_log.facility = facility;
-+ cf->cycle->new_log.priority = ERR_SYSLOG_PRIORITY;
-+ }
-+ else {
-+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-+ "invalid syslog facility \"%V\"", &value[1]);
-+ return NGX_CONF_ERROR;
-+ }
-+
-+ program = SYSLOG_IDENT_NAME;
-+ if (cf->args->nelts > 2) {
-+ program = (char *) value[2].data;
-+ }
-+
-+ openlog(program, LOG_ODELAY, facility);
-+
-+ return NGX_CONF_OK;
-+}
-+
-+
-+void log_exit(ngx_cycle_t *cycle)
-+{
-+ if (cycle->new_log.syslog_set) {
-+ closelog();
-+ }
-+}
-+#endif
-+
-diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
-index 1054836..14288ee 100644
---- a/src/core/ngx_log.h
-+++ b/src/core/ngx_log.h
-@@ -11,6 +11,13 @@
- #include <ngx_config.h>
- #include <ngx_core.h>
-
-+#if (NGX_ENABLE_SYSLOG)
-+#include <syslog.h>
-+
-+#define SYSLOG_FACILITY LOG_LOCAL5
-+#define ERR_SYSLOG_PRIORITY LOG_ERR
-+#endif
-+
-
- #define NGX_LOG_STDERR 0
- #define NGX_LOG_EMERG 1
-@@ -60,6 +67,13 @@ struct ngx_log_s {
- */
-
- char *action;
-+
-+#if (NGX_ENABLE_SYSLOG)
-+ ngx_int_t priority;
-+ ngx_int_t facility;
-+ unsigned syslog_on:1; /* unsigned :1 syslog_on */
-+ unsigned syslog_set:1; /*unsigned :1 syslog_set */
-+#endif
- };
-
-
-@@ -197,6 +211,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log,
ngx_err_t err,
-
- ngx_log_t *ngx_log_init(u_char *prefix);
- ngx_log_t *ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name);
-+#if (NGX_ENABLE_SYSLOG)
-+ngx_int_t ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority);
-+char * ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t
*log);
-+#endif
- char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log);
- void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
- void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
-diff --git a/src/http/modules/ngx_http_log_module.c
b/src/http/modules/ngx_http_log_module.c
-index e6a7fdb..51c4384 100644
---- a/src/http/modules/ngx_http_log_module.c
-+++ b/src/http/modules/ngx_http_log_module.c
-@@ -8,6 +8,11 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_ENABLE_SYSLOG)
-+#include <syslog.h>
-+
-+#define HTTP_SYSLOG_PRIORITY LOG_NOTICE
-+#endif
-
- typedef struct ngx_http_log_op_s ngx_http_log_op_t;
-
-@@ -51,6 +56,11 @@ typedef struct {
- time_t disk_full_time;
- time_t error_log_time;
- ngx_http_log_fmt_t *format;
-+
-+#if (NGX_ENABLE_SYSLOG)
-+ ngx_int_t priority;
-+ unsigned syslog_on:1; /* unsigned :1 syslog_on
*/
-+#endif
- } ngx_http_log_t;
-
-
-@@ -318,11 +328,27 @@ ngx_http_log_write(ngx_http_request_t *r,
ngx_http_log_t *log, u_char *buf,
- time_t now;
- ssize_t n;
- ngx_err_t err;
--
-+
-+#if (NGX_ENABLE_SYSLOG)
-+ n = 0;
-+ if (log->syslog_on) {
-+ syslog(log->priority, "%.*s", (int)len, buf);
-+ }
-+#endif
-+
- if (log->script == NULL) {
- name = log->file->name.data;
-+#if (NGX_ENABLE_SYSLOG)
-+ if (name != NULL) {
-+ n = ngx_write_fd(log->file->fd, buf, len);
-+ }
-+ else {
-+ n = len;
-+ }
-+#else
- n = ngx_write_fd(log->file->fd, buf, len);
-
-+#endif
- } else {
- name = NULL;
- n = ngx_http_log_script_write(r, log->script, &name, buf, len);
-@@ -836,6 +862,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void
*parent, void *child)
- log->script = NULL;
- log->disk_full_time = 0;
- log->error_log_time = 0;
-+#if (NGX_ENABLE_SYSLOG)
-+ log->priority = HTTP_SYSLOG_PRIORITY;
-+ log->syslog_on = 0;
-+#endif
-
- lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
- fmt = lmcf->formats.elts;
-@@ -861,6 +891,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t
*cmd, void *conf)
- ngx_http_log_main_conf_t *lmcf;
- ngx_http_script_compile_t sc;
-
-+#if (NGX_ENABLE_SYSLOG)
-+ u_char *off;
-+ ngx_str_t priority;
-+ ngx_uint_t syslog_on = 0;
-+ name = priority = (ngx_str_t)ngx_null_string;
-+#endif
-+
- value = cf->args->elts;
-
- if (ngx_strcmp(value[1].data, "off") == 0) {
-@@ -873,6 +910,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t
*cmd, void *conf)
- "invalid parameter \"%V\"", &value[2]);
- return NGX_CONF_ERROR;
- }
-+#if (NGX_ENABLE_SYSLOG)
-+ else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) ==
0) {
-+ if (!cf->cycle->new_log.syslog_set) {
-+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-+ "You must set the syslog directive and
enable it first.");
-+ return NGX_CONF_ERROR;
-+ }
-+
-+ syslog_on = 1;
-+ if (value[1].data[sizeof("syslog") - 1] == ':') {
-+ priority.len = value[1].len - sizeof("syslog");
-+ priority.data = value[1].data + sizeof("syslog");
-+
-+ off = (u_char*) ngx_strchr(priority.data, '|');
-+ if (off != NULL) {
-+ priority.len = off - priority.data;
-+
-+ off++;
-+ name.len = value[1].data + value[1].len - off;
-+ name.data = off;
-+ }
-+ }
-+ else {
-+ if (value[1].len > sizeof("syslog")) {
-+ name.len = value[1].len - sizeof("syslog");
-+ name.data = value[1].data + sizeof("syslog");
-+ }
-+ }
-+ } else {
-+ name = value[1];
-+ }
-+#endif
-
- if (llcf->logs == NULL) {
- llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
-@@ -890,6 +959,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t
*cmd, void *conf)
-
- ngx_memzero(log, sizeof(ngx_http_log_t));
-
-+#if (NGX_ENABLE_SYSLOG)
-+ log->syslog_on = syslog_on;
-+
-+ if (priority.len == 0) {
-+ log->priority = HTTP_SYSLOG_PRIORITY;
-+ }
-+ else {
-+ log->priority = ngx_log_get_priority(cf, &priority);
-+ }
-+
-+ if (name.len != 0) {
-+ n = ngx_http_script_variables_count(&name);
-+
-+ if (n == 0) {
-+ log->file = ngx_conf_open_file(cf->cycle, &name);
-+ if (log->file == NULL) {
-+ return NGX_CONF_ERROR;
-+ }
-+ } else {
-+ if (ngx_conf_full_name(cf->cycle, &name, 0) != NGX_OK) {
-+ return NGX_CONF_ERROR;
-+ }
-+ log->script = ngx_pcalloc(cf->pool,
sizeof(ngx_http_log_script_t));
-+ if (log->script == NULL) {
-+ return NGX_CONF_ERROR;
-+ }
-+ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-+ sc.cf = cf;
-+ sc.source = &name;
-+ sc.lengths = &log->script->lengths;
-+ sc.values = &log->script->values;
-+ sc.variables = n;
-+ sc.complete_lengths = 1;
-+ sc.complete_values = 1;
-+ if (ngx_http_script_compile(&sc) != NGX_OK) {
-+ return NGX_CONF_ERROR;
-+ }
-+ }
-+ }
-+ else {
-+ log->file = ngx_conf_open_file(cf->cycle, &name);
-+ if (log->file == NULL) {
-+ return NGX_CONF_ERROR;
-+ }
-+ }
-+#else
- n = ngx_http_script_variables_count(&value[1]);
-
- if (n == 0) {
-@@ -897,7 +1012,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t
*cmd, void *conf)
- if (log->file == NULL) {
- return NGX_CONF_ERROR;
- }
--
-+
- } else {
- if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
- return NGX_CONF_ERROR;
-@@ -922,6 +1037,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t
*cmd, void *conf)
- return NGX_CONF_ERROR;
- }
- }
-+#endif
-
- if (cf->args->nelts >= 3) {
- name = value[2];
-diff --git a/src/http/ngx_http_core_module.c
b/src/http/ngx_http_core_module.c
-index 597b64c..d45beb7 100644
---- a/src/http/ngx_http_core_module.c
-+++ b/src/http/ngx_http_core_module.c
-@@ -1393,6 +1393,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)
-
- if (r == r->main) {
- r->connection->log->file = clcf->error_log->file;
-+#if (NGX_ENABLE_SYSLOG)
-+ r->connection->log->priority = clcf->error_log->priority;
-+#endif
-
- if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
- r->connection->log->log_level = clcf->error_log->log_level;
-@@ -4280,17 +4283,72 @@ ngx_http_core_error_log(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf)
-
- ngx_str_t *value;
-
-+#if (NGX_ENABLE_SYSLOG)
-+ u_char *off = NULL;
-+ ngx_int_t syslog_on = 0;
-+ ngx_str_t name, priority;
-+
-+ name = priority = (ngx_str_t) ngx_null_string;
-+#endif
-+
- if (clcf->error_log) {
- return "is duplicate";
- }
-
- value = cf->args->elts;
-
-+#if (NGX_ENABLE_SYSLOG)
-+ if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) {
-+ if (!cf->cycle->new_log.syslog_set) {
-+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-+ "You must set the syslog directive and enable it
first.");
-+ return NGX_CONF_ERROR;
-+ }
-+
-+ syslog_on = 1;
-+
-+ if (value[1].data[sizeof("syslog") - 1] == ':') {
-+ priority.len = value[1].len - sizeof("syslog");
-+ priority.data = value[1].data + sizeof("syslog");
-+
-+ off = (u_char*) ngx_strchr(priority.data, '|');
-+ if (off != NULL) {
-+ priority.len = off - priority.data;
-+
-+ off++;
-+ name.len = value[1].data + value[1].len - off;
-+ name.data = off;
-+ }
-+ }
-+ else {
-+ if (value[1].len > sizeof("syslog")) {
-+ name.len = value[1].len - sizeof("syslog");
-+ name.data = value[1].data + sizeof("syslog");
-+ }
-+ }
-+ } else {
-+ name = value[1];
-+ }
-+
-+ clcf->error_log = ngx_log_create(cf->cycle, &name);
-+#else
- clcf->error_log = ngx_log_create(cf->cycle, &value[1]);
-+#endif
- if (clcf->error_log == NULL) {
- return NGX_CONF_ERROR;
- }
-
-+#if (NGX_ENABLE_SYSLOG)
-+ if (syslog_on) {
-+ clcf->error_log->syslog_on = 1;
-+ if (ngx_log_set_priority(cf, &priority, clcf->error_log) ==
NGX_CONF_ERROR) {
-+ return NGX_CONF_ERROR;
-+ }
-+ }
-+
-+ clcf->error_log->log_level = 0;
-+#endif
-+
- if (cf->args->nelts == 2) {
- clcf->error_log->log_level = NGX_LOG_ERR;
- return NGX_CONF_OK;
-diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
-index 2cef4fa..d9debda 100644
---- a/src/http/ngx_http_request.c
-+++ b/src/http/ngx_http_request.c
-@@ -432,6 +432,9 @@ ngx_http_init_request(ngx_event_t *rev)
-
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- c->log->file = clcf->error_log->file;
-+#if (NGX_ENABLE_SYSLOG)
-+ c->log->priority = clcf->error_log->priority;
-+#endif
- if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
- c->log->log_level = clcf->error_log->log_level;
- }
-@@ -1768,6 +1771,9 @@ found:
-
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- r->connection->log->file = clcf->error_log->file;
-+#if (NGX_ENABLE_SYSLOG)
-+ r->connection->log->priority = clcf->error_log->priority;
-+#endif
-
- if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
- r->connection->log->log_level = clcf->error_log->log_level;
diff --git a/http/nginx/syslog-0.8-1.6.config
b/http/nginx/syslog-0.8-1.6.config
new file mode 100644
index 0000000..05bfcfe
--- /dev/null
+++ b/http/nginx/syslog-0.8-1.6.config
@@ -0,0 +1,5 @@
+
+ngx_feature="nginx_syslog_patch"
+ngx_feature_name="nginx_syslog_patch"
+ngx_feature_run=no
+have=NGX_ENABLE_SYSLOG . auto/have
diff --git a/http/nginx/syslog-1.5.6.patch b/http/nginx/syslog-1.5.6.patch
new file mode 100644
index 0000000..8cc3bbd
--- /dev/null
+++ b/http/nginx/syslog-1.5.6.patch
@@ -0,0 +1,423 @@
+--- nginx-orig/src/core/ngx_log.c Thu Nov 21 21:39:37 2013
++++ nginx/src/core/ngx_log.c Sun Nov 24 21:16:30 2013
+@@ -10,6 +10,15 @@
+
+
+ static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
++#if (NGX_ENABLE_SYSLOG)
++static char *ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
++void log_exit(ngx_cycle_t *cycle);
++
++typedef struct{
++ ngx_str_t name;
++ ngx_int_t macro;
++} ngx_string_to_macro_t;
++#endif
+ static char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log);
+ static void ngx_log_insert(ngx_log_t *log, ngx_log_t *new_log);
+
+@@ -23,6 +32,15 @@
+ 0,
+ NULL},
+
++#if (NGX_ENABLE_SYSLOG)
++ {ngx_string("syslog"),
++ NGX_MAIN_CONF|NGX_CONF_TAKE12,
++ ngx_set_syslog,
++ 0,
++ 0,
++ NULL},
++#endif
++
+ ngx_null_command
+ };
+
+@@ -45,7 +63,7 @@
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+- NULL, /* exit master */
++ NULL,
+ NGX_MODULE_V1_PADDING
+ };
+
+@@ -54,6 +72,48 @@
+ static ngx_open_file_t ngx_log_file;
+ ngx_uint_t ngx_use_stderr = 1;
+
++#if (NGX_ENABLE_SYSLOG)
++static ngx_string_to_macro_t ngx_syslog_facilities[] = {
++ {ngx_string("auth"), LOG_AUTH},
++#if !(NGX_SOLARIS)
++ {ngx_string("authpriv"), LOG_AUTHPRIV},
++#endif
++ {ngx_string("cron"), LOG_CRON},
++ {ngx_string("daemon"), LOG_DAEMON},
++#if !(NGX_SOLARIS)
++ {ngx_string("ftp"), LOG_FTP},
++#endif
++ {ngx_string("kern"), LOG_KERN},
++ {ngx_string("local0"), LOG_LOCAL0},
++ {ngx_string("local1"), LOG_LOCAL1},
++ {ngx_string("local2"), LOG_LOCAL2},
++ {ngx_string("local3"), LOG_LOCAL3},
++ {ngx_string("local4"), LOG_LOCAL4},
++ {ngx_string("local5"), LOG_LOCAL5},
++ {ngx_string("local6"), LOG_LOCAL6},
++ {ngx_string("local7"), LOG_LOCAL7},
++ {ngx_string("lpr"), LOG_LPR},
++ {ngx_string("mail"), LOG_MAIL},
++ {ngx_string("news"), LOG_NEWS},
++ {ngx_string("syslog"), LOG_SYSLOG},
++ {ngx_string("user"), LOG_USER},
++ {ngx_string("uucp"), LOG_UUCP},
++ { ngx_null_string, 0}
++};
++
++static ngx_string_to_macro_t ngx_syslog_priorities[] = {
++ {ngx_string("emerg"), LOG_EMERG},
++ {ngx_string("alert"), LOG_ALERT},
++ {ngx_string("crit"), LOG_CRIT},
++ {ngx_string("error"), LOG_ERR},
++ {ngx_string("err"), LOG_ERR},
++ {ngx_string("warn"), LOG_WARNING},
++ {ngx_string("notice"),LOG_NOTICE},
++ {ngx_string("info"), LOG_INFO},
++ {ngx_string("debug"), LOG_DEBUG},
++ { ngx_null_string, 0}
++};
++#endif
+
+ static ngx_str_t err_levels[] = {
+ ngx_null_string,
+@@ -479,6 +539,33 @@
+ }
+
+
++#if (NGX_ENABLE_SYSLOG)
++ngx_int_t
++ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority)
++{
++ ngx_int_t p = 0;
++ ngx_uint_t n, match = 0;
++
++ for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) {
++ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data,
++ ngx_syslog_priorities[n].name.len) == 0) {
++ p = ngx_syslog_priorities[n].macro;
++ match = 1;
++ }
++ }
++
++ if (!match) {
++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++ "invalid syslog priority \"%V\"", priority);
++ return -1;
++ }
++
++ return p;
++}
++
++#endif
++
++
+ char *
+ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head)
+ {
+@@ -526,6 +613,57 @@
+ return NGX_CONF_OK;
+ }
+
++#if (NGX_ENABLE_SYSLOG)
++
++#define SYSLOG_IDENT_NAME "nginx"
++
++static char *
++ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
++{
++ char *program;
++ ngx_str_t *value;
++ ngx_int_t facility, match = 0;
++ ngx_uint_t n;
++
++ value = cf->args->elts;
++
++ if (cf->cycle->new_log.syslog_set) {
++ return "is duplicate";
++ }
++
++ cf->cycle->new_log.syslog_set = 1;
++
++ for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) {
++ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data,
++ ngx_syslog_facilities[n].name.len) == 0) {
++ facility = ngx_syslog_facilities[n].macro;
++ match = 1;
++ break;
++ }
++ }
++
++ if (match) {
++ cf->cycle->new_log.facility = facility;
++ cf->cycle->new_log.priority = ERR_SYSLOG_PRIORITY;
++ }
++ else {
++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++ "invalid syslog facility \"%V\"", &value[1]);
++ return NGX_CONF_ERROR;
++ }
++
++ program = SYSLOG_IDENT_NAME;
++ if (cf->args->nelts > 2) {
++ program = (char *) value[2].data;
++ }
++
++ openlog(program, LOG_ODELAY, facility);
++
++ return NGX_CONF_OK;
++}
++
++#endif
++
+
+ static void
+ ngx_log_insert(ngx_log_t *log, ngx_log_t *new_log)
+@@ -558,4 +696,4 @@
+ }
+
+ log->next = new_log;
+-}
++}
+\ No newline at end of file
+--- nginx/src/http/modules/ngx_http_log_module.c Tue Nov 19 20:33:48
2013
++++ nginx/src/http/modules/ngx_http_log_module.c Sun Nov 24 21:12:04
2013
+@@ -13,6 +13,11 @@
+ #include <zlib.h>
+ #endif
+
++#if (NGX_ENABLE_SYSLOG)
++#include <syslog.h>
++
++#define HTTP_SYSLOG_PRIORITY LOG_NOTICE
++#endif
+
+ typedef struct ngx_http_log_op_s ngx_http_log_op_t;
+
+@@ -67,6 +72,11 @@
+ time_t disk_full_time;
+ time_t error_log_time;
+ ngx_http_log_fmt_t *format;
++
++#if (NGX_ENABLE_SYSLOG)
++ ngx_int_t priority;
++ unsigned syslog_on:1; /* unsigned :1 syslog_on
*/
++#endif
+ } ngx_http_log_t;
+
+
+@@ -348,13 +358,25 @@
+ time_t now;
+ ssize_t n;
+ ngx_err_t err;
++
+ #if (NGX_ZLIB)
+ ngx_http_log_buf_t *buffer;
+ #endif
+
++#if (NGX_ENABLE_SYSLOG)
++ n = 0;
++ if (log->syslog_on) {
++ syslog(log->priority, "%.*s", (int)len, buf);
++ }
++#endif
++
++
+ if (log->script == NULL) {
+ name = log->file->name.data;
+
++#if (NGX_ENABLE_SYSLOG)
++ if (name != NULL) {
++#endif
+ #if (NGX_ZLIB)
+ buffer = log->file->data;
+
+@@ -367,7 +389,11 @@
+ #else
+ n = ngx_write_fd(log->file->fd, buf, len);
+ #endif
+-
++#if (NGX_ENABLE_SYSLOG)
++ } else {
++ n = len;
++ }
++#endif
+ } else {
+ name = NULL;
+ n = ngx_http_log_script_write(r, log->script, &name, buf, len);
+@@ -1068,6 +1094,10 @@
+ log->script = NULL;
+ log->disk_full_time = 0;
+ log->error_log_time = 0;
++#if (NGX_ENABLE_SYSLOG)
++ log->priority = HTTP_SYSLOG_PRIORITY;
++ log->syslog_on = 0;
++#endif
+
+ lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
+ fmt = lmcf->formats.elts;
+@@ -1096,6 +1126,14 @@
+ ngx_http_log_main_conf_t *lmcf;
+ ngx_http_script_compile_t sc;
+
++#if (NGX_ENABLE_SYSLOG)
++ u_char *off;
++ ngx_str_t priority;
++ ngx_uint_t syslog_on = 0;
++ name.data = priority.data = NULL;
++ name.len = priority.len = 0;
++#endif
++
+ value = cf->args->elts;
+
+ if (ngx_strcmp(value[1].data, "off") == 0) {
+@@ -1108,6 +1146,38 @@
+ "invalid parameter \"%V\"", &value[2]);
+ return NGX_CONF_ERROR;
+ }
++#if (NGX_ENABLE_SYSLOG)
++ else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) ==
0) {
++ if (!cf->cycle->new_log.syslog_set) {
++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++ "You must set the syslog directive and
enable it first.");
++ return NGX_CONF_ERROR;
++ }
++
++ syslog_on = 1;
++ if (value[1].data[sizeof("syslog") - 1] == ':') {
++ priority.len = value[1].len - sizeof("syslog");
++ priority.data = value[1].data + sizeof("syslog");
++
++ off = (u_char*) ngx_strchr(priority.data, '|');
++ if (off != NULL) {
++ priority.len = off - priority.data;
++
++ off++;
++ name.len = value[1].data + value[1].len - off;
++ name.data = off;
++ }
++ }
++ else {
++ if (value[1].len > sizeof("syslog")) {
++ name.len = value[1].len - sizeof("syslog");
++ name.data = value[1].data + sizeof("syslog");
++ }
++ }
++ } else {
++ name = value[1];
++ }
++#endif
+
+ if (llcf->logs == NULL) {
+ llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
+@@ -1125,6 +1195,52 @@
+
+ ngx_memzero(log, sizeof(ngx_http_log_t));
+
++#if (NGX_ENABLE_SYSLOG)
++ log->syslog_on = syslog_on;
++
++ if (priority.len == 0) {
++ log->priority = HTTP_SYSLOG_PRIORITY;
++ }
++ else {
++ log->priority = ngx_log_get_priority(cf, &priority);
++ }
++
++ if (name.len != 0) {
++ n = ngx_http_script_variables_count(&name);
++
++ if (n == 0) {
++ log->file = ngx_conf_open_file(cf->cycle, &name);
++ if (log->file == NULL) {
++ return NGX_CONF_ERROR;
++ }
++ } else {
++ if (ngx_conf_full_name(cf->cycle, &name, 0) != NGX_OK) {
++ return NGX_CONF_ERROR;
++ }
++ log->script = ngx_pcalloc(cf->pool,
sizeof(ngx_http_log_script_t));
++ if (log->script == NULL) {
++ return NGX_CONF_ERROR;
++ }
++ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
++ sc.cf = cf;
++ sc.source = &name;
++ sc.lengths = &log->script->lengths;
++ sc.values = &log->script->values;
++ sc.variables = n;
++ sc.complete_lengths = 1;
++ sc.complete_values = 1;
++ if (ngx_http_script_compile(&sc) != NGX_OK) {
++ return NGX_CONF_ERROR;
++ }
++ }
++ }
++ else {
++ log->file = ngx_conf_open_file(cf->cycle, &name);
++ if (log->file == NULL) {
++ return NGX_CONF_ERROR;
++ }
++ }
++#else
+ n = ngx_http_script_variables_count(&value[1]);
+
+ if (n == 0) {
+@@ -1157,6 +1273,7 @@
+ return NGX_CONF_ERROR;
+ }
+ }
++#endif
+
+ if (cf->args->nelts >= 3) {
+ name = value[2];
+--- nginx-orig/src/core/ngx_log.h Thu Nov 21 21:39:37 2013
++++ nginx/src/core/ngx_log.h Sun Nov 24 21:42:16 2013
+@@ -12,6 +12,13 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
+
++#if (NGX_ENABLE_SYSLOG)
++#include <syslog.h>
++
++#define SYSLOG_FACILITY LOG_LOCAL5
++#define ERR_SYSLOG_PRIORITY LOG_ERR
++#endif
++
+
+ #define NGX_LOG_STDERR 0
+ #define NGX_LOG_EMERG 1
+@@ -62,6 +69,13 @@
+
+ char *action;
+
++ #if (NGX_ENABLE_SYSLOG)
++ ngx_int_t priority;
++ ngx_int_t facility;
++ unsigned syslog_on:1; /* unsigned :1
syslog_on */
++ unsigned syslog_set:1; /*unsigned :1
syslog_set */
++ #endif
++
+ ngx_log_t *next;
+ };
+
+@@ -222,6 +236,10 @@
+ /*********************************/
+
+ ngx_log_t *ngx_log_init(u_char *prefix);
++#if (NGX_ENABLE_SYSLOG)
++ngx_int_t ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority);
++char * ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t
*log);
++#endif
+ void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
+ void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
+ u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err);



  • [SM-Commit] GIT changes to stable-0.62 grimoire by Vlad Glagolev (e1ed38f10f1b99e70ee2873f2028c4e00b3f3a19), Vlad Glagolev, 04/06/2015

Archive powered by MHonArc 2.6.24.

Top of Page