mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-04 18:27:36 +00:00
fix jira issue (FSCORE-167)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9200 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
346ab37206
commit
5e5847f30e
@ -1455,53 +1455,65 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
|
|||||||
switch_xml_t *user,
|
switch_xml_t *user,
|
||||||
switch_event_t *params)
|
switch_event_t *params)
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
switch_event_t *my_params = NULL;
|
||||||
|
|
||||||
*root = NULL;
|
*root = NULL;
|
||||||
*user = NULL;
|
*user = NULL;
|
||||||
*domain = NULL;
|
*domain = NULL;
|
||||||
|
|
||||||
if (params) {
|
if (!params) {
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "key", key);
|
switch_event_create(&my_params, SWITCH_EVENT_MESSAGE);
|
||||||
|
switch_assert(my_params);
|
||||||
|
params = my_params;
|
||||||
|
}
|
||||||
|
|
||||||
if (user_name) {
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "key", key);
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "user", user_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (domain_name) {
|
if (user_name) {
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain_name);
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "user", user_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ip) {
|
if (domain_name) {
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "ip", ip);
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ip) {
|
||||||
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "ip", ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ip) {
|
if (ip) {
|
||||||
if ((*user = switch_xml_find_child(*domain, "user", "ip", ip))) {
|
if ((*user = switch_xml_find_child(*domain, "user", "ip", ip))) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_name) {
|
if (user_name) {
|
||||||
|
if (params != my_params && switch_event_get_header(params, (char *) "mailbox")) {
|
||||||
if (params && switch_event_get_header(params, (char *) "mailbox")) {
|
|
||||||
if ((*user = switch_xml_find_child(*domain, "user", "mailbox", user_name))) {
|
if ((*user = switch_xml_find_child(*domain, "user", "mailbox", user_name))) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*user = switch_xml_find_child(*domain, "user", key, user_name))) {
|
if ((*user = switch_xml_find_child(*domain, "user", key, user_name))) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
end:
|
||||||
|
|
||||||
|
if (my_params) {
|
||||||
|
switch_event_destroy(&my_params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_xml_t) switch_xml_root(void)
|
SWITCH_DECLARE(switch_xml_t) switch_xml_root(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user