Project

General

Profile

Actions

Bug #4620

closed

Cleanup code path when adding a new user

Added by Chris Buechler over 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
User Manager / Privileges
Target version:
Start date:
04/14/2015
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
All
Affected Architecture:

Description

There wasn't a ticket created for this, it's worth adding one. This fixed here: https://github.com/pfsense/pfsense/commit/5372d26d9d25d751d16865ed9d46869d3b0ec5e1

below description from Phil Davis:

1) Only attempt to delete the oldusername if it actually was non-empty - at the moment errors are logged in the system log when adding a new user, because the code was trying to delete the user name "".
2) Call local_user_set() first to create (change, whatever) the user record. This makes the user record exist for a new user. Then call local_user_set_groups() to sort out what groups the user should be in or not in. The existing code would fail to add a new user to the specified group/s because local_user_set_groups() was called too early, before the user actually existed.

Typical system log errors from the old code:

Mar 18 17:10:31     php-fpm[9542]: /system_usermanager.php: Tried to remove user but got user pw instead. Bailing.
Mar 18 17:10:31     php-fpm[9542]: /system_usermanager.php: The command '/usr/sbin/pw groupmod admins -g 1999 -M '0,2003,2006,2008' 2>&1' returned exit code '67', the output was 'pw: user `2008' does not exist'

No data to display

Actions

Also available in: Atom PDF