mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
bsdconfig: Fix a bug when editing users
The usermgmt API was stomping on a global ($user_gid to be specific) so things would appear to work fine until you tried to make a second pass into the API with the now-tainted variable contents. Fixed by localizing menu-specific contents as to not leak outside API. PR: bin/208774 Reported by: Martin Waschbuesch <martin@waschbuesch.de> MFC after: 1 week X-MFC-to: stable/11, stable/10 Sponsored by: Smule, Inc.
This commit is contained in:
parent
8f2433eb44
commit
389e494006
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335308
@ -1020,13 +1020,6 @@ f_dialog_menu_user_add()
|
||||
user_password_expires_on="$user_password_expire"
|
||||
fi
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$user_gid"; then
|
||||
local user_group
|
||||
user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
|
||||
user_gid="$user_gid (${user_group%%:*})"
|
||||
fi
|
||||
|
||||
# Localize potentially hostile variables and escape their values
|
||||
# to the local variable (see f_shell_escape() of `strings.subr')
|
||||
local var
|
||||
@ -1038,6 +1031,14 @@ f_dialog_menu_user_add()
|
||||
eval f_shell_escape \"\$user_$var\" _user_$var
|
||||
done
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$_user_gid"; then
|
||||
local _user_group
|
||||
_user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
|
||||
_user_group="${_user_group%%:*}" &&
|
||||
f_shell_escape "$_user_gid ($_user_group)" _user_gid
|
||||
fi
|
||||
|
||||
menu_list="
|
||||
'X' '$msg_add/$msg_exit'
|
||||
'1' '$msg_login: $_user_name'
|
||||
@ -1137,13 +1138,6 @@ f_dialog_menu_user_delete()
|
||||
user_password_expires_on="$user_password_expire"
|
||||
fi
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$user_gid"; then
|
||||
local user_group
|
||||
user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
|
||||
user_gid="$user_gid (${user_group%%:*})"
|
||||
fi
|
||||
|
||||
# Localize potentially hostile variables and escape their values
|
||||
# to the local variable (see f_shell_escape() of `strings.subr')
|
||||
local var
|
||||
@ -1155,6 +1149,14 @@ f_dialog_menu_user_delete()
|
||||
eval f_shell_escape \"\$user_$var\" _user_$var
|
||||
done
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$_user_gid"; then
|
||||
local _user_group
|
||||
_user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
|
||||
_user_group="${_user_group%%:*}" &&
|
||||
f_shell_escape "$_user_gid ($_user_group)" _user_gid
|
||||
fi
|
||||
|
||||
menu_list="
|
||||
'X' '$msg_delete/$msg_exit'
|
||||
'1' '$msg_login: $_user_name'
|
||||
@ -1254,13 +1256,6 @@ f_dialog_menu_user_edit()
|
||||
user_password_expires_on="$user_password_expire"
|
||||
fi
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$user_gid"; then
|
||||
local user_group
|
||||
user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
|
||||
user_gid="$user_gid (${user_group%%:*})"
|
||||
fi
|
||||
|
||||
# Localize potentially hostile variables and escape their values
|
||||
# to the local variable (see f_shell_escape() of `strings.subr')
|
||||
local var
|
||||
@ -1272,6 +1267,14 @@ f_dialog_menu_user_edit()
|
||||
eval f_shell_escape \"\$user_$var\" _user_$var
|
||||
done
|
||||
|
||||
# Attempt to translate a numeric GID into `number (name)'
|
||||
if f_isinteger "$_user_gid"; then
|
||||
local _user_group
|
||||
_user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
|
||||
_user_group="${_user_group%%:*}" &&
|
||||
f_shell_escape "$_user_gid ($_user_group)" _user_gid
|
||||
fi
|
||||
|
||||
menu_list="
|
||||
'X' '$msg_save/$msg_exit'
|
||||
'1' '$msg_login: $_user_name'
|
||||
|
Loading…
Reference in New Issue
Block a user