diff options
author | dougb <dougb@FreeBSD.org> | 2001-04-15 20:43:49 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2001-04-15 20:43:49 +0000 |
commit | 82c5492b1c98cac1a21f52151237dcbbca7164d8 (patch) | |
tree | 8e745e9090420d5cc932f055c8ad4a5eca8bfaf8 /usr.sbin | |
parent | 1b63140ffd9da01fc7e6ae3d7934db36dfaf61cf (diff) | |
download | FreeBSD-src-82c5492b1c98cac1a21f52151237dcbbca7164d8.zip FreeBSD-src-82c5492b1c98cac1a21f52151237dcbbca7164d8.tar.gz |
Add a more useful solution to the problem of password files with more than
one user who differs only by case. The other perl tools assume (or enforce)
the all lowercase requirement, therefore making the search through
master.passwd case insensitive seemed a reasonable optimization, IMO.
I understand, although I do not sympathize with, the argument that someone
might want to do this on purpose, and might subsequently want to use the
wrong tool for the job. So, this fix should hopefully satisfy both camps.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/adduser/rmuser.perl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/adduser/rmuser.perl b/usr.sbin/adduser/rmuser.perl index 96a4ed1..07ba499 100644 --- a/usr.sbin/adduser/rmuser.perl +++ b/usr.sbin/adduser/rmuser.perl @@ -317,11 +317,22 @@ sub update_passwd_file { print STDERR "\n${whoami}: Warning: couldn't set mode of $new_passwd_file to 0600 ($!)\n\tcontinuing, but please check mode of /etc/master.passwd!\n"; $skipped = 0; while (<MASTER_PW>) { - if (not /^\Q$login_name:/o) { - print NEW_PW; - } else { + if (/^\Q$login_name:/o) { print STDERR "Dropped entry for $login_name\n" if $debug; $skipped = 1; + } else { + print NEW_PW; + # The other perl password tools assume all lowercase entries. + # Add a warning to help unsuspecting admins who might be + # using the wrong tool for the job, or might otherwise + # be unwittingly holding a loaded foot-shooting device. + if (/^\Q$login_name:/io) { + my $name = $_; + $name =~ s#\:.*\n##; + print STDERR "\n\n\tThere is also an entry for $name in your", + "password file.\n\tThis can cause problems in some ", + "situations.\n\n"; + } } } close(NEW_PW); |