OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

324 lines
11 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../nginx/nginx_syslog_patch-1.2.7-update.diff
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Patch for the nginx syslog patch to apply on top of nginx 1.2.7
  17. --- a/syslog_1.2.0.patch 2013-02-19 13:11:40.181033986 +0100
  18. +++ b/syslog_1.2.0.patch 2013-02-19 13:37:24.432836273 +0100
  19. @@ -1,5 +1,5 @@
  20. diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
  21. -index 2da0bf9..5d2c77a 100644
  22. +index dc4dc89..46c4b4f 100644
  23. --- a/src/core/ngx_cycle.c
  24. +++ b/src/core/ngx_cycle.c
  25. @@ -85,6 +85,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
  26. @@ -16,7 +16,7 @@
  27. cycle->conf_prefix.len = old_cycle->conf_prefix.len;
  28. diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
  29. -index d7830fb..b0a9733 100644
  30. +index d7830fb..39bfa91 100644
  31. --- a/src/core/ngx_log.c
  32. +++ b/src/core/ngx_log.c
  33. @@ -10,6 +10,15 @@
  34. @@ -169,12 +169,10 @@
  35. {
  36. return;
  37. }
  38. -@@ -365,6 +454,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name)
  39. -
  40. +@@ -366,6 +455,49 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name)
  41. return log;
  42. }
  43. -+
  44. -+
  45. +
  46. +#if (NGX_ENABLE_SYSLOG)
  47. +ngx_int_t
  48. +ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority)
  49. @@ -183,7 +181,7 @@
  50. + ngx_uint_t n, match = 0;
  51. +
  52. + for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) {
  53. -+ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data,
  54. ++ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data,
  55. + ngx_syslog_priorities[n].name.len) == 0) {
  56. + p = ngx_syslog_priorities[n].macro;
  57. + match = 1;
  58. @@ -217,10 +215,11 @@
  59. + return NGX_CONF_OK;
  60. +}
  61. +#endif
  62. -
  63. ++
  64. char *
  65. -@@ -429,6 +562,13 @@ static char *
  66. + ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
  67. +@@ -429,6 +561,13 @@ static char *
  68. ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  69. {
  70. ngx_str_t *value, name;
  71. @@ -234,7 +233,7 @@
  72. if (cf->cycle->new_log.file) {
  73. return "is duplicate";
  74. -@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  75. +@@ -436,7 +575,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  76. value = cf->args->elts;
  77. @@ -279,7 +278,7 @@
  78. ngx_str_null(&name);
  79. } else {
  80. -@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  81. +@@ -457,3 +633,62 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  82. return ngx_log_set_levels(cf, &cf->cycle->new_log);
  83. }
  84. @@ -306,7 +305,7 @@
  85. + cf->cycle->new_log.syslog_set = 1;
  86. +
  87. + for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) {
  88. -+ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data,
  89. ++ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data,
  90. + ngx_syslog_facilities[n].name.len) == 0) {
  91. + facility = ngx_syslog_facilities[n].macro;
  92. + match = 1;
  93. @@ -324,7 +323,7 @@
  94. + return NGX_CONF_ERROR;
  95. + }
  96. +
  97. -+ program = SYSLOG_IDENT_NAME;
  98. ++ program = SYSLOG_IDENT_NAME;
  99. + if (cf->args->nelts > 2) {
  100. + program = (char *) value[2].data;
  101. + }
  102. @@ -342,7 +341,6 @@
  103. + }
  104. +}
  105. +#endif
  106. -+
  107. diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
  108. index 3233647..5e7fdbf 100644
  109. --- a/src/core/ngx_log.h
  110. @@ -387,12 +385,12 @@
  111. void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
  112. void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
  113. diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
  114. -index 2d41285..fd3ce30 100644
  115. +index aa6a3fc..1fc3a91 100644
  116. --- a/src/http/modules/ngx_http_log_module.c
  117. +++ b/src/http/modules/ngx_http_log_module.c
  118. -@@ -9,6 +9,11 @@
  119. - #include <ngx_core.h>
  120. - #include <ngx_http.h>
  121. +@@ -13,6 +13,11 @@
  122. + #include <zlib.h>
  123. + #endif
  124. +#if (NGX_ENABLE_SYSLOG)
  125. +#include <syslog.h>
  126. @@ -402,7 +400,7 @@
  127. typedef struct ngx_http_log_op_s ngx_http_log_op_t;
  128. -@@ -52,6 +57,11 @@ typedef struct {
  129. +@@ -67,6 +72,11 @@ typedef struct {
  130. time_t disk_full_time;
  131. time_t error_log_time;
  132. ngx_http_log_fmt_t *format;
  133. @@ -414,36 +412,40 @@
  134. } ngx_http_log_t;
  135. -@@ -323,11 +333,27 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
  136. - time_t now;
  137. - ssize_t n;
  138. - ngx_err_t err;
  139. --
  140. -+
  141. +@@ -352,9 +362,19 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
  142. + ngx_http_log_buf_t *buffer;
  143. + #endif
  144. +
  145. +#if (NGX_ENABLE_SYSLOG)
  146. + n = 0;
  147. + if (log->syslog_on) {
  148. + syslog(log->priority, "%.*s", (int)len, buf);
  149. + }
  150. +#endif
  151. -+
  152. ++
  153. if (log->script == NULL) {
  154. name = log->file->name.data;
  155. +
  156. +#if (NGX_ENABLE_SYSLOG)
  157. + if (name != NULL) {
  158. -+ n = ngx_write_fd(log->file->fd, buf, len);
  159. -+ }
  160. -+ else {
  161. ++#endif
  162. + #if (NGX_ZLIB)
  163. + buffer = log->file->data;
  164. +
  165. +@@ -367,7 +387,11 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
  166. + #else
  167. + n = ngx_write_fd(log->file->fd, buf, len);
  168. + #endif
  169. +-
  170. ++#if (NGX_ENABLE_SYSLOG)
  171. ++ } else {
  172. + n = len;
  173. + }
  174. -+#else
  175. - n = ngx_write_fd(log->file->fd, buf, len);
  176. -
  177. +#endif
  178. } else {
  179. name = NULL;
  180. n = ngx_http_log_script_write(r, log->script, &name, buf, len);
  181. -@@ -859,6 +885,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
  182. +@@ -1068,6 +1092,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
  183. log->script = NULL;
  184. log->disk_full_time = 0;
  185. log->error_log_time = 0;
  186. @@ -454,7 +456,7 @@
  187. lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
  188. fmt = lmcf->formats.elts;
  189. -@@ -884,6 +914,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  190. +@@ -1096,6 +1124,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  191. ngx_http_log_main_conf_t *lmcf;
  192. ngx_http_script_compile_t sc;
  193. @@ -468,7 +470,7 @@
  194. value = cf->args->elts;
  195. if (ngx_strcmp(value[1].data, "off") == 0) {
  196. -@@ -896,6 +933,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  197. +@@ -1108,6 +1143,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  198. "invalid parameter \"%V\"", &value[2]);
  199. return NGX_CONF_ERROR;
  200. }
  201. @@ -485,10 +487,10 @@
  202. + priority.len = value[1].len - sizeof("syslog");
  203. + priority.data = value[1].data + sizeof("syslog");
  204. +
  205. -+ off = (u_char*) ngx_strchr(priority.data, '|');
  206. ++ off = (u_char*) ngx_strchr(priority.data, '|');
  207. + if (off != NULL) {
  208. + priority.len = off - priority.data;
  209. -+
  210. ++
  211. + off++;
  212. + name.len = value[1].data + value[1].len - off;
  213. + name.data = off;
  214. @@ -507,7 +509,7 @@
  215. if (llcf->logs == NULL) {
  216. llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
  217. -@@ -913,6 +982,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  218. +@@ -1125,6 +1192,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  219. ngx_memzero(log, sizeof(ngx_http_log_t));
  220. @@ -560,16 +562,7 @@
  221. n = ngx_http_script_variables_count(&value[1]);
  222. if (n == 0) {
  223. -@@ -920,7 +1035,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  224. - if (log->file == NULL) {
  225. - return NGX_CONF_ERROR;
  226. - }
  227. --
  228. -+
  229. - } else {
  230. - if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
  231. - return NGX_CONF_ERROR;
  232. -@@ -945,6 +1060,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  233. +@@ -1157,6 +1270,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  234. return NGX_CONF_ERROR;
  235. }
  236. }
  237. @@ -578,10 +571,10 @@
  238. if (cf->args->nelts >= 3) {
  239. name = value[2];
  240. diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
  241. -index 42dd664..a46c60d 100644
  242. +index 61439a1..b592a39 100644
  243. --- a/src/http/ngx_http_core_module.c
  244. +++ b/src/http/ngx_http_core_module.c
  245. -@@ -1450,6 +1450,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)
  246. +@@ -1451,6 +1451,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)
  247. if (r == r->main) {
  248. r->connection->log->file = clcf->error_log->file;
  249. @@ -591,7 +584,7 @@
  250. if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
  251. r->connection->log->log_level = clcf->error_log->log_level;
  252. -@@ -4657,6 +4660,15 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  253. +@@ -4764,6 +4767,15 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  254. ngx_str_t *value, name;
  255. @@ -607,7 +600,7 @@
  256. if (clcf->error_log) {
  257. return "is duplicate";
  258. }
  259. -@@ -4666,6 +4678,36 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  260. +@@ -4773,6 +4785,36 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  261. if (ngx_strcmp(value[1].data, "stderr") == 0) {
  262. ngx_str_null(&name);
  263. @@ -625,7 +618,7 @@
  264. + priority.len = value[1].len - sizeof("syslog");
  265. + priority.data = value[1].data + sizeof("syslog");
  266. +
  267. -+ off = (u_char*) ngx_strchr(priority.data, '|');
  268. ++ off = (u_char*) ngx_strchr(priority.data, '|');
  269. + if (off != NULL) {
  270. + priority.len = off - priority.data;
  271. +
  272. @@ -644,7 +637,7 @@
  273. } else {
  274. name = value[1];
  275. }
  276. -@@ -4675,6 +4717,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  277. +@@ -4782,6 +4824,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  278. return NGX_CONF_ERROR;
  279. }
  280. @@ -663,7 +656,7 @@
  281. clcf->error_log->log_level = NGX_LOG_ERR;
  282. return NGX_CONF_OK;
  283. diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
  284. -index 052f379..1d799d5 100644
  285. +index ee00fd3..e15e157 100644
  286. --- a/src/http/ngx_http_request.c
  287. +++ b/src/http/ngx_http_request.c
  288. @@ -433,6 +433,9 @@ ngx_http_init_request(ngx_event_t *rev)
  289. @@ -676,7 +669,7 @@
  290. if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
  291. c->log->log_level = clcf->error_log->log_level;
  292. }
  293. -@@ -1819,6 +1822,9 @@ found:
  294. +@@ -1834,6 +1837,9 @@ found:
  295. clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
  296. r->connection->log->file = clcf->error_log->file;