Show
Ignore:
Timestamp:
02/23/11 00:37:51 (2 years ago)
Author:
p_lindheimer
Message:

fixes #4857 set AMP_ACCESS_DB_CREDS true if no admin users and in database mode

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.9/upgrades/2.9.0alpha1/migrate_ampconf.php

    r11530 r11555  
    9090  $current_amp_conf['AUTHTYPE'] = 'none'; 
    9191} 
     92 
     93/* FreePBX has a 'back door' option that allows loging into the GUI with the dababase username/password as 
     94 * admin user. We have disabled this ability by default but it has the potential to lock people out of 
     95 * their systems on upgrade. Check to see if they have ANY admin users defined. If not, then set 
     96 * AMP_ACCESS_DB_CREDS to true overriding the default so they can still access their GUI. 
     97 */ 
     98if ($current_amp_conf['AUTHTYPE'] !='none') { 
     99  outn(_("Checking number of admin users..")); 
     100  $sql = "SELECT count(*) FROM ampusers WHERE sections = '*'"; 
     101  $admin_users = $db->getOne($sql); 
     102  if (DB::IsError($admin_users)) { 
     103    out(_("error reading ampusers table")); 
     104  } elseif (!$admin_users) { 
     105    out(_("0 admins")); 
     106  } 
     107  if (DB::IsError($admin_users) || !$admin_users) { 
     108    out(_("setting AMP_ACCESS_DB_CREDS to true")); 
     109    out(_("[WARNING] this is a security risk, you should create an admin user and disable this vulnerability.")); 
     110  } else { 
     111    out(sprintf(_("%s admins"),$admin_users)); 
     112  } 
     113} 
     114 
    92115out(_("Migrate current values into freepbx_conf..")); 
    93116foreach ($current_amp_conf as $key => $val) {