From ff48868dc410077e027b5b7706c7101548fc8e38 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 5 Apr 2020 20:15:12 +0000 Subject: [PATCH] [mod_verto] add param to have verto send pass over xml_curl --- src/mod/endpoints/mod_verto/mod_verto.c | 8 ++++++++ src/mod/endpoints/mod_verto/mod_verto.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index b92693870a..4d02fee4f8 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -984,6 +984,10 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * } } + if (jsock->profile->send_passwd || verto_globals.send_passwd) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "user_supplied_pass", passwd); + } + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate"); if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) { @@ -4953,6 +4957,8 @@ static switch_status_t parse_config(const char *cf) profile->userauth = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "root-password") && !zstr(val)) { profile->root_passwd = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "send-auth-password") && !zstr(val)) { + profile->send_passwd = switch_true(val); } else if (!strcasecmp(var, "context") && !zstr(val)) { profile->context = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "dialplan") && !zstr(val)) { @@ -5148,6 +5154,8 @@ static switch_status_t parse_config(const char *cf) } } else if (!strcasecmp(var, "enable-presence") && val) { verto_globals.enable_presence = switch_true(val); + } else if (!strcasecmp(var, "send-auth-password") && !zstr(val)) { + verto_globals.send_passwd = switch_true(val); } else if (!strcasecmp(var, "enable-fs-events") && val) { verto_globals.enable_fs_events = switch_true(val); } else if (!strcasecmp(var, "detach-timeout-sec") && val) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index bbf0114503..9018f6ce95 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -246,6 +246,8 @@ struct verto_profile_s { char *userauth; char *root_passwd; + int send_passwd; + char *context; char *dialplan; @@ -307,6 +309,7 @@ struct globals_s { int debug; int ready; + int send_passwd; int profile_threads; int enable_presence; int enable_fs_events;