Menu

#417 db_ext login fails when column_name_level is set

Major
closed
nobody
None
1
2018-10-15
2018-08-30
GedM
No

Hi,
I am running 2 MRBS sites dev3 and dev4. Both are version 1.7.1. I am trying to use the mrbs_users table to authenticate users logging into both sites. That is, creating an account on dev3 will allow the same credentials to be used on both dev3 and dev4.

Everything works correctly when using $auth["type"] = 'db_ext' in the dev 4 config.

$auth['type']  = 'db_ext';
// 'auth_db_ext' configuration settings
$auth['db_ext']['db_system'] = 'mysql';
$auth['db_ext']['db_username'] = 'dbuser';  //<-- not real
$auth['db_ext']['db_password'] = 'dbpasswd';  //<-- not real
$auth['db_ext']['db_name'] = 'dbname';  //<-- not real
$auth['db_ext']['db_table'] = 'mrbs_users';
// Either 'md5', 'sha1', 'crypt' or 'plaintext'
$auth['db_ext']['column_name_username'] = 'name';
$auth['db_ext']['column_name_password'] = 'password_hash';
$auth['db_ext']['password_format'] = 'crypt';

However, when I define the column_name_level setting MRBS fails to load after a successful login. The system seems to redirect to the day.php page but the page is blank with no source text and nothing in the php error_log.

$auth['type']  = 'db_ext';
// 'auth_db_ext' configuration settings
$auth['db_ext']['db_system'] = 'mysql';
$auth['db_ext']['db_username'] = 'dbuser'; //<-- not real
$auth['db_ext']['db_password'] = 'dbpasswd';  //<-- not real
$auth['db_ext']['db_name'] = 'dbname';  //<-- not real
$auth['db_ext']['db_table'] = 'mrbs_users';
// Either 'md5', 'sha1', 'crypt' or 'plaintext'
$auth['db_ext']['column_name_username'] = 'name';
$auth['db_ext']['column_name_password'] = 'password_hash';
$auth['db_ext']['password_format'] = 'crypt';
$auth['db_ext']['column_name_level'] = 'level';

Attepmting to load other pages by typing in the address e.g. help.php also display a blank page.
If I comment out the column_name_level line the page loads correctly with the user correctly logged in but no auth level is evident.

I added the following lines to config.inc.php and day.php in an attempt to produce some error logs. Unfortunately nothing was recorded in the log file.

ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);

Any ideas what I can do to narrow down the cause of this issue?

Thanks

Discussion

  • GedM

    GedM - 2018-08-30

    Please hold off on this. I may be using two different database versions. I'll get back to you.

     
  • GedM

    GedM - 2018-08-31

    I've confirmed both DBs are now at version 57. Source is V1.7.1 from tree [d64d31]. Still receiving a blank page.
    Any advice you can offer would be appreciated.

     

    Related

    Commit: [d64d31]


    Last edit: GedM 2018-08-31
  • Campbell Morrison

    These lines

    ini_set('display_startup_errors', '1');
    ini_set('display_errors', '1)';
    error_reporting(-1);
    

    should be added to the bottom of internalconfig.inc.php, not the config file, as internalconfig will override them.

     
    • GedM

      GedM - 2018-08-31

      Thanks Campbell. That's what I needed.

      $db_ext_conn
      

      is missing from the global declaration in function authGetUserLevel.
      Line 143 of auth_db_ext.inc.

      Cheers

       
      • Campbell Morrison

        Thanks. Now fixed in the default branch.

         
  • Campbell Morrison

    It won't be causing the problem, but I think you should also be using 'password_hash' instead of 'crypt' for the password format.

     
  • GedM

    GedM - 2018-08-31

    Without it I was getting

    E_NOTICE in /home/xxxxxxx/public_html/dev4/auth/auth_db_ext.inc at line 170
    Undefined variable: db_ext_conn
    

    Now it works correctly. crypt is working correctly but I'll try password_hash as well.

     
  • GedM

    GedM - 2018-08-31

    'password_hash' also works. As per your advice, I'll leave it as that.
    Thanks again.

     
  • Campbell Morrison

    • status: open --> closed