Found a single point where rmuser(8) wasn't robust to strange

characters in a username:  where it was inserted into a regexp.
Fix it by escaping metacharacters in the name with \Q-\E.
This commit is contained in:
Yaroslav Tykhiy 2002-02-11 15:26:20 +00:00
parent d740688b87
commit c7bb2e64aa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90532

View File

@ -380,7 +380,7 @@ sub update_group_file {
chown($group_uid, $group_gid, $new_group_file) ||
print STDERR "\n${whoami}: Warning: could not set owner/group of new group file to ${group_uid}/${group_gid} ($!)\n\rContinuing, but please check ownership of $group_file!\n";
while ($i = <GROUP>) {
if (!($i =~ /$login_name/)) {
if (!($i =~ /\Q$login_name\E/)) {
# Line doesn't contain any references to the user, so just add it
# to the new file
print NEW_GROUP $i;