From c071132041ad69ea992b21a4f17a71a1bb8c1558 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 23 Dec 2008 18:14:57 +0000 Subject: [PATCH] MDXMLINT-45 Allow setting of global realm without a global user git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10920 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index c80169c936..4b4624b69a 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -95,10 +95,12 @@ static switch_status_t do_config(void) if (!globals.port) { globals.port = 8080; } - if (user && pass && realm) { + if (realm) { set_global_realm(realm); - set_global_user(user); - set_global_pass(pass); + if (user && pass) { + set_global_user(user); + set_global_pass(pass); + } } switch_xml_free(xml); @@ -194,12 +196,14 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name) goto fail; } - switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass); - Base64Encode(z, t); + if (!switch_strlen_zero(globals.user)) { + switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass); + Base64Encode(z, t); - if (!strcmp(p, t)) { - r->requestInfo.user = strdup(user); - goto authed; + if (!strcmp(p, t)) { + r->requestInfo.user = strdup(user); + goto authed; + } } switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); @@ -496,7 +500,7 @@ abyss_bool handler_hook(TSession * r) } } - if (!fs_user || !strcmp(fs_user, globals.user)) { + if (!fs_user || (!switch_strlen_zero(globals.user) && !strcmp(fs_user, globals.user))) { auth = 1; } else { if (!j) {