diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-15 10:15:28 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-09-15 10:15:28 +0000 |
commit | 7ec33c5b4ee04184b0df48a607ffeab9d7eedf05 (patch) | |
tree | b22260577a0a4ef97c6f5ec3a9aec64e7377d3d3 /usr.sbin/pwd_mkdb/pwd_mkdb.c | |
parent | af2bf1bbf40aba573142ccf57e8511eab7ac9bb5 (diff) |
When the disk gets full, abort properly instead of creating empty
passwd databases. I found this while analysing netbsd pr#1328 from
August 10, 1995 by hag@gnu.ai.mit.edu. A sample fix was supplied on
14, May 96 by greywolf@defender.VAS.viewlogic.com. The PR mentioned
about 6 or 7 places where this could happen. Greywolf and I had made
all of the fixes ourselves in openbsd a while back (except one subtle
one which he pointed out but I had missed), but not a single one of
the fixes is found in the netbsd source tree... I wonder if Perry has
an exploit for this problem, and perhaps he's using it?
Another damn good reason for making /tmp and /var seperate partitions.
Diffstat (limited to 'usr.sbin/pwd_mkdb/pwd_mkdb.c')
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index c487b932b00..e315da14a7a 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwd_mkdb.c,v 1.10 1997/01/16 03:58:23 millert Exp $ */ +/* $OpenBSD: pwd_mkdb.c,v 1.11 1997/09/15 10:15:27 deraadt Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.10 1997/01/16 03:58:23 millert Exp $"; +static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.11 1997/09/15 10:15:27 deraadt Exp $"; #endif #endif /* not lint */ @@ -356,7 +356,8 @@ main(argc, argv) /* Set master.passwd permissions, in case caller forgot. */ (void)fchmod(fileno(fp), S_IRUSR|S_IWUSR); - (void)fclose(fp); + if (fclose(fp) != 0) + error("fclose"); /* Install as the real password files. */ (void)snprintf(buf, sizeof(buf), "%s.tmp", |