mod_netconf: BUGFIX sigsegv if no host/user sent
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index d3e7fbc..c049d47 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -749,8 +749,13 @@
user = json_object_get_string(json_object_object_get(request, "user"));
pass = json_object_get_string(json_object_object_get(request, "pass"));
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "host: %s, port: %s, user: %s", host, port, user);
- session_key = netconf_connect(server, pool, netconf_sessions_list, host, port, user, pass);
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "hash: %s", session_key);
+ if ((host == NULL) || (user == NULL)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Cannot connect - insufficient input.");
+ session_key = NULL;
+ } else {
+ session_key = netconf_connect(server, pool, netconf_sessions_list, host, port, user, pass);
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "hash: %s", session_key);
+ }
reply = json_object_new_object();
if (session_key == NULL) {