- (djm) Lastlog was not getting closed after writing login entry
This commit is contained in:
parent
61c5150861
commit
c1132e7759
|
@ -38,6 +38,7 @@
|
||||||
- markus@cvs.openbsd.org 2000/08/17 14:06:34
|
- markus@cvs.openbsd.org 2000/08/17 14:06:34
|
||||||
[session.c sshd.8 sshd.c]
|
[session.c sshd.8 sshd.c]
|
||||||
sshd -u len, similar to telnetd
|
sshd -u len, similar to telnetd
|
||||||
|
- (djm) Lastlog was not getting closed after writing login entry
|
||||||
|
|
||||||
20000816
|
20000816
|
||||||
- (djm) Replacement for inet_ntoa for Irix (which breaks on gcc)
|
- (djm) Replacement for inet_ntoa for Irix (which breaks on gcc)
|
||||||
|
|
12
loginrec.c
12
loginrec.c
|
@ -160,7 +160,7 @@
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "loginrec.h"
|
#include "loginrec.h"
|
||||||
|
|
||||||
RCSID("$Id: loginrec.c,v 1.20 2000/08/15 00:21:17 djm Exp $");
|
RCSID("$Id: loginrec.c,v 1.21 2000/08/18 04:08:38 djm Exp $");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** prototypes for helper functions in this file
|
** prototypes for helper functions in this file
|
||||||
|
@ -1403,17 +1403,19 @@ lastlog_perform_login(struct logininfo *li)
|
||||||
/* create our struct lastlog */
|
/* create our struct lastlog */
|
||||||
lastlog_construct(li, &last);
|
lastlog_construct(li, &last);
|
||||||
|
|
||||||
|
if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT))
|
||||||
|
return(0);
|
||||||
|
|
||||||
/* write the entry */
|
/* write the entry */
|
||||||
if (lastlog_openseek(li, &fd, O_RDWR|O_CREAT)) {
|
|
||||||
if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
|
if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
|
||||||
|
close(fd);
|
||||||
log("lastlog_write_filemode: Error writing to %s: %s",
|
log("lastlog_write_filemode: Error writing to %s: %s",
|
||||||
LASTLOG_FILE, strerror(errno));
|
LASTLOG_FILE, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue