summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-06-28 19:26:41 +0000
committerErmal <eri@pfsense.org>2011-06-28 19:26:41 +0000
commit84924e76c44950387e387af7927f63d5822dfda4 (patch)
tree02abe718f97831714113e9e042b3e9e08e289c7a /etc
parent3cedb66fdb85d35f49ec1f180a73a2bc7c120c07 (diff)
downloadpfsense-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.inc16
-rw-r--r--etc/inc/upgrade_config.inc6
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 */
OpenPOWER on IntegriCloud