diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-03-20 00:16:26 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-03-20 00:16:26 -0500 |
commit | d3f3b75f1a1a7428600c078540a8ea46cb70f475 (patch) | |
tree | 4635f63c6a8cc92781d20fba347e9516f7495eab /src/etc/inc/upgrade_config.inc | |
parent | 7227efd6833683f0ca619a9b05f32fa120be0181 (diff) | |
download | pfsense-d3f3b75f1a1a7428600c078540a8ea46cb70f475.zip pfsense-d3f3b75f1a1a7428600c078540a8ea46cb70f475.tar.gz |
If there was a group with a space, delete all the user-defined groups before hitting local_sync_accounts so pw doesn't get hung up. Ticket #6012
Diffstat (limited to 'src/etc/inc/upgrade_config.inc')
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index eaa7ae1..131535e 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4725,8 +4725,10 @@ function upgrade_147_to_148() { $exgrps[] = $grp['name']; } + $cleargroups = false; foreach ($config['system']['group'] as $idx => $grp) { if (strstr($grp['name'], " ")) { + $cleargroups = true; $newgrpname = str_replace(" ", "_", $grp['name']); // In the unlikely event that there is already a group with this name // just replace the whole thing with a unique string @@ -4737,6 +4739,17 @@ function upgrade_147_to_148() { } } } + + // if there was a space in a group name, there may be multiple + // groups with the same name in the group file. To prevent pw + // from getting into a neverending loop, delete all user-defined + // groups here. local_sync_accounts will run shortly after this + // and add them back. redmine #6012 + if ($cleargroups) { + foreach ($config['system']['group'] as $grp) { + mwexec("/usr/sbin/pw groupdel -g {$grp['gid']}"); + } + } } } ?> |