commit 4d040055ccd610324934399a607cb916b1e4a185
Author: Jacek Konieczny <j.koniec...@eggsoft.pl>
Date:   Wed May 15 13:59:20 2019 +0200

    patch for http poller added
    
    https://support.zabbix.com/browse/ZBX-16050
    
https://github.com/zabbix/zabbix/commit/364571cb0a0dfa1cd88a1347e759d5836962a5cd

 http_poller_crash.patch | 117 ++++++++++++++++++++++++++++++++++++++++++++++++
 zabbix.spec             |   2 +
 2 files changed, 119 insertions(+)
---
diff --git a/zabbix.spec b/zabbix.spec
index 8a3ae74..b4702a9 100644
--- a/zabbix.spec
+++ b/zabbix.spec
@@ -30,6 +30,7 @@ Source7:      %{name}_agentd.init
 Patch0:                config.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
+Patch3:                http_poller_crash.patch
 URL:           http://zabbix.sourceforge.net/
 BuildRequires: OpenIPMI-devel
 BuildRequires: autoconf
@@ -293,6 +294,7 @@ This package provides the Zabbix Java Gateway.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__libtoolize}
diff --git a/http_poller_crash.patch b/http_poller_crash.patch
new file mode 100644
index 0000000..2c78b13
--- /dev/null
+++ b/http_poller_crash.patch
@@ -0,0 +1,117 @@
+From 459ee438244f7d1b7907e44738c40bdc8f23660d Mon Sep 17 00:00:00 2001
+From: Aleksejs Sestakovs <aleksejs.sestak...@zabbix.com>
+Date: Mon, 29 Apr 2019 15:09:07 +0300
+Subject: [PATCH] .......PS. [ZBX-16050] fixed HTTP poller crashes
+
+---
+ src/zabbix_server/httppoller/httptest.c | 64 +++++++++----------------
+ 1 file changed, 23 insertions(+), 41 deletions(-)
+
+diff --git a/src/zabbix_server/httppoller/httptest.c 
b/src/zabbix_server/httppoller/httptest.c
+index b0a833bad86..bd1ca503643 100644
+--- a/src/zabbix_server/httppoller/httptest.c
++++ b/src/zabbix_server/httppoller/httptest.c
+@@ -507,58 +507,30 @@ static int       httpstep_load_pairs(DC_HOST *host, 
zbx_httpstep_t *httpstep)
+  *                                                                            
*
+  * Function: add_http_headers                                                 
*
+  *                                                                            
*
+- * Purpose: add http headers and cookies to CURL handle                       
*
++ * Purpose: adds HTTP headers to curl_slist and prepares cookie header string 
*
+  *                                                                            
*
+- * Parameters: easyhandle      - [IN] host to be used in macro expansion      
*
+- *             headers         - [IN] HTTP headers as string                  
*
+- *             headers_slist   - [IN/OUT] empty curl_slist to be freed after  
*
+- *                                        curl_easy_perform is called         
*
+- *             error           - [OUT] error string (if any)                  
*
+- *                                                                            
*
+- * Return value: SUCCEED if headers (and cookies) were set without errors.    
*
+- *               FAIL on error.                                               
*
++ * Parameters: headers         - [IN] HTTP headers as string                  
*
++ *             headers_slist   - [IN/OUT] curl_slist                          
*
++ *             header_cookie   - [IN/OUT] cookie header as string             
*
+  *                                                                            
*
+  
******************************************************************************/
+-static int    add_http_headers(CURL *easyhandle, char *headers, struct 
curl_slist **headers_slist, char **error)
++static void   add_http_headers(char *headers, struct curl_slist 
**headers_slist, char **header_cookie)
+ {
+ #define COOKIE_HEADER_STR     "Cookie:"
+ #define COOKIE_HEADER_STR_LEN ZBX_CONST_STRLEN(COOKIE_HEADER_STR)
+-      CURLcode        err;
+-      char            *line;
+-      int             ret = SUCCEED;
++
++      char    *line;
+ 
+       while (NULL != (line = zbx_http_get_header(&headers)))
+       {
+               if (0 == strncmp(COOKIE_HEADER_STR, line, 
COOKIE_HEADER_STR_LEN))
+-              {
+-                      if (CURLE_OK != (err = curl_easy_setopt(easyhandle, 
CURLOPT_COOKIE, (line +
+-                                                              
COOKIE_HEADER_STR_LEN * sizeof(char)))))
+-                      {
+-                              ret = FAIL;
+-
+-                              if (NULL != error)
+-                                      *error = zbx_strdup(*error, 
curl_easy_strerror(err));
+-
+-                              zbx_free(line);
+-                              goto out;
+-                      }
+-              }
++                      *header_cookie = zbx_strdup(*header_cookie, line + 
COOKIE_HEADER_STR_LEN);
+               else
+                       *headers_slist = curl_slist_append(*headers_slist, 
line);
+ 
+               zbx_free(line);
+       }
+ 
+-      if (CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, 
*headers_slist)))
+-      {
+-              ret = FAIL;
+-
+-              if (NULL != error)
+-                      *error = zbx_strdup(*error, curl_easy_strerror(err));
+-      }
+-
+-out:
+-      return ret;
+ #undef COOKIE_HEADER_STR
+ #undef COOKIE_HEADER_STR_LEN
+ }
+@@ -746,6 +718,7 @@ static void        process_httptest(DC_HOST *host, 
zbx_httptest_t *httptest)
+       while (NULL != (row = DBfetch(result)))
+       {
+               struct curl_slist       *headers_slist = NULL;
++              char                    *header_cookie = NULL;
+ 
+               /* NOTE: do not break or return from this block! */
+               /*       process_step_data() call is required! */
+@@ -840,14 +813,23 @@ static void      process_httptest(DC_HOST *host, 
zbx_httptest_t *httptest)
+ 
+               /* headers defined in a step overwrite headers defined in 
scenario */
+               if (NULL != httpstep.headers && '\0' != *httpstep.headers)
++                      add_http_headers(httpstep.headers, &headers_slist, 
&header_cookie);
++              else if (NULL != httptest->headers && '\0' != 
*httptest->headers)
++                      add_http_headers(httptest->headers, &headers_slist, 
&header_cookie);
++
++              err = curl_easy_setopt(easyhandle, CURLOPT_COOKIE, 
header_cookie);
++              zbx_free(header_cookie);
++
++              if (CURLE_OK != err)
+               {
+-                      if (FAIL == add_http_headers(easyhandle, 
httpstep.headers, &headers_slist, &err_str))
+-                              goto httpstep_error;
++                      err_str = zbx_strdup(err_str, curl_easy_strerror(err));
++                      goto httpstep_error;
+               }
+-              else if (NULL != httptest->headers && '\0' != 
*httptest->headers)
++
++              if (CURLE_OK != (err = curl_easy_setopt(easyhandle, 
CURLOPT_HTTPHEADER, headers_slist)))
+               {
+-                      if (FAIL == add_http_headers(easyhandle, 
httptest->headers, &headers_slist, &err_str))
+-                              goto httpstep_error;
++                      err_str = zbx_strdup(err_str, curl_easy_strerror(err));
++                      goto httpstep_error;
+               }
+ 
+               /* enable/disable fetching the body */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zabbix.git/commitdiff/4d040055ccd610324934399a607cb916b1e4a185

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to