summaryrefslogtreecommitdiffstats
path: root/etc/inc/auth.inc
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2010-05-10 16:42:22 +0200
committersmos <seth.mos@dds.nl>2010-05-10 16:42:22 +0200
commit38564fde256e83e26f1f65d28ff064e835206ec9 (patch)
tree124a8d32da3d659ec6bb2eb7709487104db95b22 /etc/inc/auth.inc
parent6bccf4caa7cf4203ac06c3dfd4550d35803acf80 (diff)
downloadpfsense-38564fde256e83e26f1f65d28ff064e835206ec9.zip
pfsense-38564fde256e83e26f1f65d28ff064e835206ec9.tar.gz
Allow the webui admin account to have a duplicate user ID of 0.
Make sure to create that account before attempting to modify it's attributes
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r--etc/inc/auth.inc31
1 files changed, 17 insertions, 14 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index 83fd02c..20d100e 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -269,19 +269,8 @@ function local_user_set(& $user) {
fwrite($fd, $user['password']);
pclose($fd);
$user_group = "wheel";
- $user_home = "/root";
}
- /* admin user special handling */
- if ($user_uid == 0) {
- $cmd = "/usr/sbin/pw usermod -q -n admin -s /bin/sh -H 0";
- if($debug)
- log_error("Running: {$cmd}");
- $fd = popen($cmd, "w");
- fwrite($fd, $user['password']);
- pclose($fd);
- $user_group = "wheel";
- }
/* read from pw db */
$fd = popen("/usr/sbin/pw usershow {$user_name} 2>&1", "r");
@@ -289,15 +278,16 @@ function local_user_set(& $user) {
pclose($fd);
/* determine add or mod */
- if (!strncmp($pwread, "pw:", 3))
+ if (!strncmp($pwread, "pw:", 3)) {
$user_op = "useradd";
- else
+ } else {
$user_op = "usermod";
+ }
/* add or mod pw db */
$cmd = "/usr/sbin/pw {$user_op} -q -u {$user_uid} -n {$user_name}".
" -g {$user_group} -s {$user_shell} -d {$user_home}".
- " -c ".escapeshellarg($user['fullname'])." -H 0 2>&1";
+ " -c ".escapeshellarg($user['fullname'])." -H 0 -o 2>&1";
if($debug)
log_error("Running: {$cmd}");
@@ -305,6 +295,19 @@ function local_user_set(& $user) {
fwrite($fd, $user['password']);
pclose($fd);
+
+ /* admin user special handling */
+ if ($user_uid == 0) {
+ $cmd = "/usr/sbin/pw usermod -q -n {$user_name} -s /bin/sh -H 0";
+ log_error("Running {$cmd}");
+ if($debug)
+ log_error("Running: {$cmd}");
+ $fd = popen($cmd, "w");
+ fwrite($fd, $user['password']);
+ pclose($fd);
+ $user_group = "wheel";
+ }
+
/* create user directory if required */
if (!is_dir($user_home)) {
mkdir($user_home, 0700);
OpenPOWER on IntegriCloud