doc/share/security/patches/SA-01:59/rmuser.patch.v1.1
Bjoern A. Zeeb 3571e53040 Import FreeBSD Security Advisories and Errata Notices, as well as their
patches for easier mirroring, to eliminate a special copy, to make
www.freebsd.org/security a full copy of security.freebsd.org and be
eventually be the same.

For now files are just sitting there.   The symlinks are missing.

Discussed on:	www (repository location)
Discussed with:	simon (so)
2012-08-15 06:19:40 +00:00

59 lines
2.1 KiB
Groff

Index: rmuser.perl
===================================================================
RCS file: /home/ncvs/src/usr.sbin/adduser/rmuser.perl,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.2.2.2
diff -u -r1.8.2.2 -r1.8.2.2.2.2
--- rmuser.perl 2001/01/14 10:21:11 1.8.2.2
+++ rmuser.perl 2001/09/05 05:24:55 1.8.2.2.2.2
@@ -34,4 +34,6 @@
+use Fcntl;
+
sub LOCK_SH {0x01;}
sub LOCK_EX {0x02;}
sub LOCK_NB {0x04;}
@@ -42,7 +44,7 @@
umask(022);
$whoami = $0;
$passwd_file = "/etc/master.passwd";
-$new_passwd_file = "${passwd_file}.new.$$";
+$passwd_tmp = "/etc/ptmp";
$group_file = "/etc/group";
$new_group_file = "${group_file}.new.$$";
$mail_dir = "/var/mail";
@@ -311,10 +313,10 @@
print STDERR "Updating password file,";
seek(MASTER_PW, 0, 0);
- open(NEW_PW, ">$new_passwd_file") ||
- die "\n${whoami}: Error: Couldn't open file ${new_passwd_file}:\n $!\n";
- chmod(0600, $new_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";
+
+ sysopen(NEW_PW, $passwd_tmp, O_RDWR|O_CREAT|O_EXCL, 0600) ||
+ die "\n${whoami}: Error: Couldn't open file ${passwd_tmp}:\n $!\n";
+
$skipped = 0;
while (<MASTER_PW>) {
if (not /^\Q$login_name:/io) {
@@ -329,8 +331,8 @@
if ($skipped == 0) {
print STDERR "\n${whoami}: Whoops! Didn't find ${login_name}'s entry second time around!\n";
- unlink($new_passwd_file) ||
- print STDERR "\n${whoami}: Warning: couldn't unlink $new_passwd_file ($!)\n\tPlease investigate, as this file should not be left in the filesystem\n";
+ unlink($passwd_tmp) ||
+ print STDERR "\n${whoami}: Warning: couldn't unlink $passwd_tmp ($!)\n\tPlease investigate, as this file should not be left in the filesystem\n";
&unlockpw;
exit 1;
}
@@ -339,7 +341,7 @@
# Run pwd_mkdb to install the updated password files and databases
print STDERR " updating databases,";
- system('/usr/sbin/pwd_mkdb', '-p', ${new_passwd_file});
+ system('/usr/sbin/pwd_mkdb', '-p', ${passwd_tmp});
print STDERR " done.\n";
close(MASTER_PW); # Not useful anymore