- (djm) Fix fd leak in loginrec.c (ro fd to lastlog was left open).
Report from Michal Zalewski <lcamtuf@coredump.cx>
This commit is contained in:
parent
13aae5ee76
commit
3a8a5cd5b0
|
@ -1,3 +1,7 @@
|
||||||
|
20011022
|
||||||
|
- (djm) Fix fd leak in loginrec.c (ro fd to lastlog was left open).
|
||||||
|
Report from Michal Zalewski <lcamtuf@coredump.cx>
|
||||||
|
|
||||||
20011021
|
20011021
|
||||||
- (tim) [configure.in] Clean up library testing. Add optional PATH to
|
- (tim) [configure.in] Clean up library testing. Add optional PATH to
|
||||||
--with-pcre, --with-zlib, and --with-tcp-wrappers. Based on
|
--with-pcre, --with-zlib, and --with-tcp-wrappers. Based on
|
||||||
|
@ -6740,4 +6744,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1610 2001/10/22 00:53:58 tim Exp $
|
$Id: ChangeLog,v 1.1611 2001/10/22 06:49:22 djm Exp $
|
||||||
|
|
17
loginrec.c
17
loginrec.c
|
@ -163,7 +163,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "atomicio.h"
|
#include "atomicio.h"
|
||||||
|
|
||||||
RCSID("$Id: loginrec.c,v 1.35 2001/10/02 00:29:00 stevesk Exp $");
|
RCSID("$Id: loginrec.c,v 1.36 2001/10/22 06:49:23 djm Exp $");
|
||||||
|
|
||||||
#ifdef HAVE_UTIL_H
|
#ifdef HAVE_UTIL_H
|
||||||
# include <util.h>
|
# include <util.h>
|
||||||
|
@ -1487,17 +1487,20 @@ lastlog_get_entry(struct logininfo *li)
|
||||||
struct lastlog last;
|
struct lastlog last;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (lastlog_openseek(li, &fd, O_RDONLY)) {
|
if (!lastlog_openseek(li, &fd, O_RDONLY))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (atomicio(read, fd, &last, sizeof(last)) != sizeof(last)) {
|
if (atomicio(read, fd, &last, sizeof(last)) != sizeof(last)) {
|
||||||
|
close(fd);
|
||||||
log("lastlog_get_entry: Error reading from %s: %s",
|
log("lastlog_get_entry: Error reading from %s: %s",
|
||||||
LASTLOG_FILE, strerror(errno));
|
LASTLOG_FILE, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
lastlog_populate_entry(li, &last);
|
lastlog_populate_entry(li, &last);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* USE_LASTLOG */
|
#endif /* USE_LASTLOG */
|
||||||
|
|
Loading…
Reference in New Issue