]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
apply patch from MODAPP-156
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 30 Oct 2008 00:52:11 +0000 (00:52 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 30 Oct 2008 00:52:11 +0000 (00:52 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10199 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

index 00ff00970abc63772edf18a3b5bdbcd7ea4e83ec..6f23642b02a3db644a90cbb2bf08bd47f02d3d07 100644 (file)
@@ -245,22 +245,24 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name)
                                        }
                                }
 
-                               if (!(mypass1 && mypass2)) {
+                               if (!switch_strlen_zero(mypass2) && !strcasecmp(mypass2, "user-choose")) {
+                                       mypass2 = NULL;
+                               }
+
+                               if (!mypass1) {
                                        r->requestInfo.user = strdup(user);
                                        goto authed;
                                } else {
-                                       if (mypass1) {
-                                               if (at) {
-                                                       switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
-                                               } else {
-                                                       switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
-                                               }
-                                               Base64Encode(z, t);
+                                       if (at) {
+                                               switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
+                                       } else {
+                                               switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
+                                       }
+                                       Base64Encode(z, t);
 
-                                               if (!strcmp(p, t)) {
-                                                       r->requestInfo.user = strdup(box ? box : user);
-                                                       goto authed;
-                                               }
+                                       if (!strcmp(p, t)) {
+                                               r->requestInfo.user = strdup(box ? box : user);
+                                               goto authed;
                                        }
 
                                        if (mypass2) {
@@ -278,18 +280,16 @@ static abyss_bool http_directory_auth(TSession * r, char *domain_name)
                                        }
 
                                        if (box) {
-                                               if (mypass1) {
-                                                       if (at) {
-                                                               switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
-                                                       } else {
-                                                               switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
-                                                       }
-                                                       Base64Encode(z, t);
+                                               if (at) {
+                                                       switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
+                                               } else {
+                                                       switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
+                                               }
+                                               Base64Encode(z, t);
 
-                                                       if (!strcmp(p, t)) {
-                                                               r->requestInfo.user = strdup(box);
-                                                               goto authed;
-                                                       }
+                                               if (!strcmp(p, t)) {
+                                                       r->requestInfo.user = strdup(box);
+                                                       goto authed;
                                                }
 
                                                if (mypass2) {