From aab938bba006c41985710a0b43b8f49b91fea0cd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Nov 2020 03:49:30 +0000 Subject: [PATCH] [core, mod_commands, mod_verto] small tweaks to cache stuff to allow clear from verto and allow no domain to imply the default domain --- src/mod/applications/mod_commands/mod_commands.c | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 1 + src/switch_xml.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index b5f7f5ff8e..a86cea3538 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -6742,7 +6742,7 @@ SWITCH_STANDARD_API(xml_flush_function) argc = switch_split(mycmd, ' ', argv); } - if (argc == 3) { + if (argc > 1) { r = switch_xml_clear_user_cache(argv[0], argv[1], argv[2]); } else { r = switch_xml_clear_user_cache(NULL, NULL, NULL); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index d145dcaac0..dc352bcb0c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1118,6 +1118,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_snprintf(message, mlen, "Authentication Failure"); jsock->uid = NULL; login_fire_custom_event(jsock, params, 0, "Authentication Failure"); + switch_xml_clear_user_cache("id", id, domain); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"auth using %s\n",a1_hash ? "a1-hash" : "username & password"); r = SWITCH_TRUE; diff --git a/src/switch_xml.c b/src/switch_xml.c index bd0e7c8c38..6467758b72 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2010,6 +2010,10 @@ SWITCH_DECLARE(uint32_t) switch_xml_clear_user_cache(const char *key, const char switch_mutex_lock(CACHE_MUTEX); + if (key && user_name && !domain_name) { + domain_name = switch_core_get_variable("domain"); + } + if (key && user_name && domain_name) { switch_snprintf(mega_key, sizeof(mega_key), "%s%s%s", key, user_name, domain_name);