[Freeswitch-svn] [commit] r10920 - freeswitch/trunk/src/mod/xml_int/mod_xml_rpc

FreeSWITCH SVN mikej at freeswitch.org
Tue Dec 23 10:14:58 PST 2008


Author: mikej
Date: Tue Dec 23 13:14:57 2008
New Revision: 10920

Log:
MDXMLINT-45 Allow setting of global realm without a global user

Modified:
   freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Tue Dec 23 13:14:57 2008
@@ -95,10 +95,12 @@
 	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 @@
 					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(&params, SWITCH_EVENT_REQUEST_PARAMS);
@@ -496,7 +500,7 @@
 		}
 	}
 
-	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) {



More information about the Freeswitch-svn mailing list