From 613cf46cdfe979c939307eefd9230b4d995c718f Mon Sep 17 00:00:00 2001 From: Matthew Grooms Date: Fri, 1 Aug 2008 23:20:28 +0000 Subject: [PATCH] When performing a user configuration upgrade, make sure the all group gets created before syncing accounts to the system. --- etc/inc/auth.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index c057d30644..c46a0977f7 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -93,6 +93,15 @@ function & getGroupEntry($name) { return $config['system']['group'][$groupindex[$name]]; } +function & getGroupEntryByGID($gid) { + global $config; + foreach ($config['system']['group'] as & $group) + if ($group['gid'] == $gid) + return $group; + + return false; +} + function sync_local_accounts() { global $config; @@ -129,6 +138,10 @@ function sync_local_accounts() { pclose($fd); } + /* make sure the all group exists */ + $allgrp = getGroupEntryByGID(1998); + set_local_group($allgrp); + /* sync all local users */ if (is_array($config['system']['user'])) foreach ($config['system']['user'] as $user)