diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-03-19 17:02:11 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-03-19 17:06:21 -0500 |
commit | 7cb01159934f0fa24c0c0050917cef1ad9bb9f2b (patch) | |
tree | 6fe5d81b09417702db49a4a82610148328b2c8ff /src | |
parent | e5ef7ae26b32d18b7aa1a117605ccbbfafefca14 (diff) | |
download | pfsense-7cb01159934f0fa24c0c0050917cef1ad9bb9f2b.zip pfsense-7cb01159934f0fa24c0c0050917cef1ad9bb9f2b.tar.gz |
Check whether group exists using GID rather than name. Users can change the name, but not the GID. Check return code of pw for whether group exists. Ticket #6013
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/auth.inc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index dc8e437..8c2c9a9 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -742,16 +742,11 @@ function local_group_set($group, $reset = false) { return; } - /* read from group db */ - $fd = popen("/usr/sbin/pw groupshow {$group_name} 2>&1", "r"); - $pwread = fgets($fd); - pclose($fd); - /* determine add or mod */ - if (!strncmp($pwread, "pw:", 3)) { - $group_op = "groupadd"; + if (mwexec("/usr/sbin/pw groupshow -g {$group_gid} 2>&1") == 0) { + $group_op = "groupmod -l"; } else { - $group_op = "groupmod"; + $group_op = "groupadd -n"; } /* add or mod group db */ |