Put the curl URL between quotation marks to make sure to include URLs that
contains strange characters such as ';'.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
For whatever reason, this commit was causing an issue with reloads and empty
services. So we should leave this bit alone.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
Because the counter is reduced by the size of a sessions struct, which may be
larger than the remaining count, thus causing a negative number. If using an
unsigned long integer then the counter would simply loop back.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
The mutex should only be unlocked (from the lookup lock) by the state release
function.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
Replacing unordered_map usage with list_head. This also includes the switch from
shared_ptr to a raw C pointer.
Yes, I moved around a lot of the functions, particularly in the header file, but
it was a mess and I was having difficulty keeping track of function
declarations. Please pardon the noise.
The refcnt variable was removed from zproxy_backend_state and
zproxy_service_state, since they should only ever be used directly in state.cpp.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
zproxy_session_add() has 4 steps: 1) check if session exists, 2) create new
session, 3) add session to the sessions list, 4) return the session. In the
previous procedure there were mutex locks around step 1 and step 3. This meant
that while one process was on step 2 creating a session, another process could
be in step 1 checking to see if it already exists, and then later creating the
same session. This race condition has been resolved by putting a mutex lock
around steps 1-3, and only releasing the mutex right before returning the
session in step 4.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
The test was somewhat unpredictable due to the configuration of zproxy_new.cfg.
This should make the test a little more predictable, and therefore not give a
false negative (falsely failing the test).
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
/root/zproxy/src/main.c: In function ‘int zproxy_cfg_file_reload()’:
/root/zproxy/src/main.c:155:21: warning: pointer ‘cfg’ used after ‘void free(void*)’ [-Wuse-after-free]
155 | free(cfg);
| ~~~~^~~~~
In function ‘int zproxy_cfg_reload(zproxy_cfg*)’,
inlined from ‘int zproxy_cfg_reload(zproxy_cfg*)’ at /root/zproxy/src/main.c:117:5,
inlined from ‘int zproxy_cfg_file_reload()’ at /root/zproxy/src/main.c:154:23:
/root/zproxy/src/main.c:126:21: note: call to ‘void free(void*)’ here
126 | free(cfg);
| ~~~~^~~~~
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
/root/zproxy/src/http_manager.cpp:215:30: error: ‘istream_iterator’ is not a member of ‘std’
215 | std::istream_iterator<std::string> begin(
| ^~~~~~~~~~~~~~~~
/root/zproxy/src/http_manager.cpp:29:1: note: ‘std::istream_iterator’ is defined in header ‘<iterator>’; did you forget to ‘#include <iterator>’?
28 | #include "session.h"
+++ |+#include <iterator>
29 |
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
These should be printed in syslog in the cases of parse errors during reloads,
in which there is no available stderr and stdout available.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
This test keeps failing for no reason. The difference is insignificant and
shouldn't affect anything.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
It wouldn't print the rules because they hadn't been loaded yet. This is a
remained from when the rules were loaded directly during the process of reading
the config file.
Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>