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

Freeswitch SVN anthm at freeswitch.org
Mon Dec 10 21:21:16 EST 2007


Author: anthm
Date: Mon Dec 10 21:21:15 2007
New Revision: 6619

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

Log:
fix xmlrpc

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	Mon Dec 10 21:21:15 2007
@@ -165,7 +165,7 @@
         NextToken(&p);
         x = GetToken(&p);
         if (x) {
-            if (!strcasecmp(x,"basic")) {
+            if (!strcasecmp(x, "basic")) {
 
 
                 NextToken(&p);
@@ -187,12 +187,18 @@
 				}
 
 				if (!domain_name) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s] no domain!\n", user);
 					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) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain_name);
 					goto fail;
 				}
 				
@@ -315,7 +321,7 @@
 		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);
     ResponseStatus(r, 401);
     return FALSE;
@@ -389,9 +395,6 @@
 		} else {
 			if (globals.realm && strncmp(r->uri, "/pub", 4)) {
 				ret = !http_directory_auth(r, NULL);
-				if (ret) {
-					ret = !RequestAuth(r, globals.realm, globals.user, globals.pass);
-				}
 			}
 		}
 
@@ -460,8 +463,12 @@
 		}
 	}
 
-	if (fs_user && fs_domain && !j) {
-		auth = 0;
+	if (!fs_user || !strcmp(fs_user, globals.user)) {
+		auth = 1;
+	} else {
+		if (!j) {
+			auth = 0;
+		} 
 	}
 	
 	if (auth) {



More information about the Freeswitch-svn mailing list