mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-05 02:34:18 +00:00
fix xmlrpc
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6619 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fbd34b0360
commit
7171254a9d
@ -165,7 +165,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
|
|||||||
NextToken(&p);
|
NextToken(&p);
|
||||||
x = GetToken(&p);
|
x = GetToken(&p);
|
||||||
if (x) {
|
if (x) {
|
||||||
if (!strcasecmp(x,"basic")) {
|
if (!strcasecmp(x, "basic")) {
|
||||||
|
|
||||||
|
|
||||||
NextToken(&p);
|
NextToken(&p);
|
||||||
@ -187,12 +187,18 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!domain_name) {
|
if (!domain_name) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s] no domain!\n", user);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
|
||||||
|
Base64Encode(z, t);
|
||||||
|
|
||||||
|
if (!strcmp(p, t)) {
|
||||||
|
r->user=strdup(user);
|
||||||
|
goto authed;
|
||||||
|
}
|
||||||
|
|
||||||
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, "mailbox=check") != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain_name);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +321,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
|
|||||||
switch_xml_free(x_domain_root);
|
switch_xml_free(x_domain_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name);
|
snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
|
||||||
ResponseAddField(r, "WWW-Authenticate", z);
|
ResponseAddField(r, "WWW-Authenticate", z);
|
||||||
ResponseStatus(r, 401);
|
ResponseStatus(r, 401);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -389,9 +395,6 @@ abyss_bool auth_hook(TSession * r)
|
|||||||
} else {
|
} else {
|
||||||
if (globals.realm && strncmp(r->uri, "/pub", 4)) {
|
if (globals.realm && strncmp(r->uri, "/pub", 4)) {
|
||||||
ret = !http_directory_auth(r, NULL);
|
ret = !http_directory_auth(r, NULL);
|
||||||
if (ret) {
|
|
||||||
ret = !RequestAuth(r, globals.realm, globals.user, globals.pass);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,8 +463,12 @@ abyss_bool handler_hook(TSession * r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs_user && fs_domain && !j) {
|
if (!fs_user || !strcmp(fs_user, globals.user)) {
|
||||||
auth = 0;
|
auth = 1;
|
||||||
|
} else {
|
||||||
|
if (!j) {
|
||||||
|
auth = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user