[dokuwiki] Re: phpbb

Hey!
> Could you post your SQL statements used in your configfile?
> 
> As stated on wiki:auth_mysql: In the devel version the passcheck string needs 
> to return the crypted password from the database. The %p parameter now 
> contains the crypted password
> 
> So you probably need to change the passcheck option.

Welcome back from vacation :)
This is what I have in my local.php. In $conf['passcrypt'] I've tried to set 
all possible values listed below as crypt method, but with no luck.

$conf['authtype']    = 'mysql';          //which authentication backend should 
be used
$conf['auth']['mysql']['server']   = 'localhost';              // mySQL host, 
usually localhost
$conf['auth']['mysql']['user']     = 'username';     // mySQL database user for 
the database that is used by phpBB
$conf['auth']['mysql']['password'] = 'password'; // mySQL database password for 
the database that is used by phpBB
$conf['auth']['mysql']['database'] = 'database';          // mySQL database 
that is used by phpBB

$conf['auth']['mysql']['passcheck']= "SELECT username AS login FROM phpbb_users 
WHERE username='%u' AND user_password=MD5('%p')";
$conf['auth']['mysql']['userinfo'] = "SELECT username AS name, user_email AS 
email FROM phpbb_users WHERE username='%u'";
$conf['auth']['mysql']['groups']   = "SELECT group_name AS `group` FROM 
phpbb_groups a, phpbb_users b, phpbb_user_group c WHERE b.user_id = c.user_id 
AND a.group_id = c.group_id AND b.username='%u'";
$conf['passcrypt']   = 'mysql';           //Used crypt method 
(smd5,md5,sha1,ssha,crypt,mysql,my411)

I found a temporary solution (but not a very good one). If I open 
auth_mysql.php in the inc/ folder, and find this:

function auth_checkPass($user,$pass){
  global $conf;
  $cnf = $conf['auth']['mysql'];

  $sql    = str_replace('%u',addslashes($user),$cnf['passcheck']);
  $sql    = str_replace('%p',addslashes($pass),$sql);
  $result = auth_mysql_runsql($sql);
  return(count($result));
}

and change that with:

function auth_checkPass($user,$pass){
  global $conf;
  $cnf = $conf['auth']['mysql'];

  $sql    = str_replace('%u',addslashes($user),$cnf['passcheck']);
  $sql    = str_replace('%g',addslashes($conf['defaultgroup']),$sql);
  $sql    = str_replace('%p',addslashes($pass),$sql);

  $result = auth_mysql_runsql($sql);

  return(count($result));
}

then everything works fine. Perhaps this is a bug? I've asked around, and no 
one seems to use a mysql database with dokuwiki. So difficult to find out if 
I'm the only one having this problem. Thanks in advance!

--
Jorge
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: