If I rename the admin dir, I can't change sadmin password

Bug reports on core system for v1.2 STABLE only.

If I rename the admin dir, I can't change sadmin password

Postby Irihapeti » Fri Sep 07, 2012 6:00 am

I had renamed the admin directory on my local linux box to something odd, and I'd like to be able to use that on a working install.

Only thing is, if I try to change the super-admin password (haven't tried any others) I get an "error writing to file" message. Apache logs show a 404 error. Ownership and permissions of the admin_config.php file are the Apache user and 644.

Setting the admin directory name back to "admin" and reverting the changes in public_config.php solved the problem.

I suspect that something is hard-coded to "admin" somewhere, but I'm unlikely to find it -- php code makes my eyes bleed. :)
Irihapeti
 
Posts: 51
Joined: Sun Mar 25, 2012 8:08 am
Location: Auckland, NZ

Re: If I rename the admin dir, I can't change sadmin passwor

Postby Adminer » Wed Sep 12, 2012 4:33 pm

Hi!

Hint: try to use this software:
http://12g.com/ghosts/replace.htm
to find: admin
string in php code in RazorCMS :-)

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: If I rename the admin dir, I can't change sadmin passwor

Postby Irihapeti » Wed Sep 12, 2012 5:12 pm

Actually, I'm on Linux, so that software won't work for me.

However, it prompted me to look up "grep", and I think I may have found what I was looking for.

Now to try fixing it and see if that works. I'll report back later.

Many thanks
Irihapeti
 
Posts: 51
Joined: Sun Mar 25, 2012 8:08 am
Location: Auckland, NZ

Re: If I rename the admin dir, I can't change sadmin passwor

Postby Irihapeti » Wed Sep 12, 2012 11:18 pm

I've found what I think are the culprits:

File is /admin/core/admin_func.php

line 4575:
Code: Select all
    // new function to save new admin password when changing //
    function savePasswordCheck($newPassword, $userData) {
      global $sig,$invalidURL,$watchdog;
      if($invalidURL){
         die($watchdog);
      }
        $adminFile = getSystemRoot(RAZOR_ADMIN_FILENAME).'admin/core/admin_config.php';
        $adminProfile = file_get_contents( $adminFile );
        if (isset($adminProfile)) {
            $adminProfile = str_replace("RAZOR['".$userData['findpass']."'] = '".$userData['password']."'", "RAZOR['".$userData['findpass']."'] = '".$newPassword."'", $adminProfile);
        }
        $result = put2file('admin/core/admin_config.php', $adminProfile);
        if ($result) {
            $result = false;
        } else {
            $result = lt('Error writing data to file').'...';
        }
        return $result;
    }
    // end //

and

line 4630:
Code: Select all
    // new function to save username when changing //
    function saveUserCheck($adminUsername, $userData) {
      global $sig,$invalidURL,$watchdog;
      if($invalidURL){
         die($watchdog);
      }
        $adminFile = getSystemRoot(RAZOR_ADMIN_FILENAME).'admin/core/admin_config.php';
        $adminProfile = file_get_contents( $adminFile );
        if (isset($adminProfile)) {
            $adminProfile = str_replace("RAZOR['".$userData['finduser']."'] = '".$userData['username']."'", "RAZOR['".$userData['finduser']."'] = '".$adminUsername."'", $adminProfile);
        }
        $result = put2file('admin/core/admin_config.php', $adminProfile);
        if ($result) {
            $result = false;
        } else {
            $result = lt('Error writing data to file').'...';
        }
        return $result;
    }
    // end //


How would one change that so that it's reading from /core/public_config.php instead of using the hard-coded value?

My current knowledge of php is limited to "include", so please, nothing too technical. :)

Thanks in advance
Irihapeti
 
Posts: 51
Joined: Sun Mar 25, 2012 8:08 am
Location: Auckland, NZ

Re: If I rename the admin dir, I can't change sadmin passwor

Postby Adminer » Fri Sep 14, 2012 3:44 pm

Irihapeti wrote:Actually, I'm on Linux, so that software won't work for me.

Probably you can use linux Wine to run this software, and then you can trace all "admin" in php code.
But, if you have "admin/core/admin_config.php" - it's a folder structure, so you must be very rigorous in your job to reneme or remove what you want :-)
IMHO, bad way... ;-)

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland


Return to Bugs - Core V1.2 STABLE [DEPRECATED]

Who is online

Users browsing this forum: No registered users and 1 guest