]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: Authorization at ejabberd only worked for uid=1
authorMichael Vogel <icarus@dabo.de>
Sun, 25 Oct 2015 09:17:23 +0000 (10:17 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 25 Oct 2015 09:17:23 +0000 (10:17 +0100)
include/auth_ejabberd.php

index 5d69f1de7fbea3081c5fa8346d3e4cbb05a36403..9a9d9accad83ef002b3f398f701b4e95ac3508da 100755 (executable)
@@ -140,6 +140,7 @@ class exAuth
                                                                $sQuery = "SELECT `uid`, `password` FROM `user` WHERE `nickname`='". $db->escape($sUser) ."'";
                                                                $this->writeDebugLog("[debug] using query ". $sQuery);
                                                                if ($oResult = q($sQuery)){
+                                                                       $uid = $oResult[0]["uid"];
                                                                        $Error = ($oResult[0]["password"] != hash('whirlpool',$aCommand[3]));
 /*
                                                                        if ($oResult[0]["password"] == hash('whirlpool',$aCommand[3])) {
@@ -156,9 +157,10 @@ class exAuth
                                                                } else {
                                                                        $this->writeLog("[MySQL] invalid query: ". $sQuery);
                                                                        $Error = true;
+                                                                       $uid = -1;
                                                                }
                                                                if ($Error) {
-                                                                       $oConfig = q("SELECT `v` FROM `pconfig` WHERE `uid`=1 AND `cat` = 'xmpp' AND `k`='password' LIMIT 1;");
+                                                                       $oConfig = q("SELECT `v` FROM `pconfig` WHERE `uid`=%d AND `cat` = 'xmpp' AND `k`='password' LIMIT 1;", intval($uid));
                                                                        $this->writeLog("[exAuth] got password ".$oConfig[0]["v"]);
                                                                        $Error = ($aCommand[3] != $oConfig[0]["v"]);
                                                                }