mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
change xml_lookups to take an event as params instead of url string this will break your xml_curl scripts please update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7333 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -95,7 +95,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
}
|
||||
|
||||
|
||||
static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, const char *params,
|
||||
static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
|
||||
void *user_data)
|
||||
{
|
||||
char filename[512] = "";
|
||||
@@ -111,7 +111,8 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
|
||||
long httpRes = 0;
|
||||
struct curl_slist *headers = NULL;
|
||||
char hostname[256] = "";
|
||||
|
||||
char basic_data[512];
|
||||
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
||||
if (!binding) {
|
||||
@@ -128,15 +129,18 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
|
||||
return xml;
|
||||
}
|
||||
|
||||
data = switch_mprintf("hostname=%s§ion=%s&tag_name=%s&key_name=%s&key_value=%s%s%s",
|
||||
hostname,
|
||||
section,
|
||||
switch_str_nil(tag_name),
|
||||
switch_str_nil(key_name),
|
||||
switch_str_nil(key_value),
|
||||
params ? strchr(params, '=') ? "&" : "¶ms=" : "", params ? params : "");
|
||||
switch_assert(data);
|
||||
|
||||
switch_snprintf(basic_data, sizeof(basic_data), "hostname=%s§ion=%s&tag_name=%s&key_name=%s&key_value=%s",
|
||||
hostname,
|
||||
section,
|
||||
switch_str_nil(tag_name),
|
||||
switch_str_nil(key_name),
|
||||
switch_str_nil(key_value));
|
||||
|
||||
data = switch_event_build_param_string(params, basic_data);
|
||||
|
||||
switch_assert(data);
|
||||
printf("XXXXXXXXXXXXXXXXXXXX\n%s\n", data);
|
||||
switch_uuid_get(&uuid);
|
||||
switch_uuid_format(uuid_str, &uuid);
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
|
||||
switch_xml_t x_domain, x_domain_root = NULL, x_user, x_params, x_param;
|
||||
const char *box;
|
||||
int at = 0;
|
||||
switch_event_t *params = NULL;
|
||||
|
||||
p = RequestHeaderValue(r, "authorization");
|
||||
|
||||
@@ -197,11 +198,17 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
|
||||
r->user=strdup(user);
|
||||
goto authed;
|
||||
}
|
||||
|
||||
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
|
||||
switch_assert(params);
|
||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", "check");
|
||||
|
||||
if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, "mailbox=check") != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, params) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_destroy(¶ms);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
switch_event_destroy(¶ms);
|
||||
box = switch_xml_attr_soft(x_user, "mailbox");
|
||||
|
||||
for (x_param = switch_xml_child(x_domain, "param"); x_param; x_param = x_param->next) {
|
||||
|
||||
Reference in New Issue
Block a user