diff options
author | Ermal <eri@pfsense.org> | 2011-06-28 19:26:41 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-06-28 19:26:41 +0000 |
commit | 84924e76c44950387e387af7927f63d5822dfda4 (patch) | |
tree | 02abe718f97831714113e9e042b3e9e08e289c7a /etc | |
parent | 3cedb66fdb85d35f49ec1f180a73a2bc7c120c07 (diff) | |
download | pfsense-84924e76c44950387e387af7927f63d5822dfda4.zip pfsense-84924e76c44950387e387af7927f63d5822dfda4.tar.gz |
Add proper checks in auth code for testing if the section has been set in the config. Also do the same in the ugprade code
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/auth.inc | 16 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 6 |
2 files changed, 16 insertions, 6 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 239d7de..92c3538 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -193,9 +193,11 @@ function & getUserEntry($name) { function & getUserEntryByUID($uid) { global $debug, $config; - foreach ($config['system']['user'] as & $user) - if ($user['uid'] == $uid) - return $user; + + if (is_array($config['system']['user'])) + foreach ($config['system']['user'] as & $user) + if ($user['uid'] == $uid) + return $user; return false; } @@ -208,9 +210,11 @@ function & getGroupEntry($name) { function & getGroupEntryByGID($gid) { global $debug, $config; - foreach ($config['system']['group'] as & $group) - if ($group['gid'] == $gid) - return $group; + + if (is_array($config['system']['group'])) + foreach ($config['system']['group'] as & $group) + if ($group['gid'] == $gid) + return $group; return false; } diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 8159638..685cb13 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -1341,6 +1341,8 @@ function upgrade_048_to_049() { $all['gid'] = 1998; $all['member'] = array(); + if (!is_array($config['system']['user'])) + $config['system']['user'] = array(); if (!is_array($config['system']['group'])) $config['system']['group'] = array(); @@ -1392,6 +1394,9 @@ function upgrade_048_to_049() { function upgrade_049_to_050() { global $config; + + if (!is_array($config['system']['user'])) + $config['system']['user'] = array(); /* update user privileges */ foreach ($config['system']['user'] as & $user) { $privs = array(); @@ -2098,6 +2103,7 @@ function upgrade_055_to_056() { function upgrade_056_to_057() { global $config; + if (!is_array($config['system']['user'])) $config['system']['user'] = array(); /* migrate captivate portal to user manager */ |