summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--loginrec.c20
2 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f5cee9a2..106c1459a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
38 - markus@cvs.openbsd.org 2000/08/17 14:06:34 38 - markus@cvs.openbsd.org 2000/08/17 14:06:34
39 [session.c sshd.8 sshd.c] 39 [session.c sshd.8 sshd.c]
40 sshd -u len, similar to telnetd 40 sshd -u len, similar to telnetd
41 - (djm) Lastlog was not getting closed after writing login entry
41 42
4220000816 4320000816
43 - (djm) Replacement for inet_ntoa for Irix (which breaks on gcc) 44 - (djm) Replacement for inet_ntoa for Irix (which breaks on gcc)
diff --git a/loginrec.c b/loginrec.c
index 6b87ba320..2c6330a04 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -160,7 +160,7 @@
160#include "xmalloc.h" 160#include "xmalloc.h"
161#include "loginrec.h" 161#include "loginrec.h"
162 162
163RCSID("$Id: loginrec.c,v 1.20 2000/08/15 00:21:17 djm Exp $"); 163RCSID("$Id: loginrec.c,v 1.21 2000/08/18 04:08:38 djm Exp $");
164 164
165/** 165/**
166 ** prototypes for helper functions in this file 166 ** prototypes for helper functions in this file
@@ -1403,17 +1403,19 @@ lastlog_perform_login(struct logininfo *li)
1403 /* create our struct lastlog */ 1403 /* create our struct lastlog */
1404 lastlog_construct(li, &last); 1404 lastlog_construct(li, &last);
1405 1405
1406 if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT))
1407 return(0);
1408
1406 /* write the entry */ 1409 /* write the entry */
1407 if (lastlog_openseek(li, &fd, O_RDWR|O_CREAT)) { 1410 if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
1408 if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) { 1411 close(fd);
1409 log("lastlog_write_filemode: Error writing to %s: %s", 1412 log("lastlog_write_filemode: Error writing to %s: %s",
1410 LASTLOG_FILE, strerror(errno)); 1413 LASTLOG_FILE, strerror(errno));
1411 return 0;
1412 }
1413 return 1;
1414 } else {
1415 return 0; 1414 return 0;
1416 } 1415 }
1416
1417 close(fd);
1418 return 1;
1417} 1419}
1418 1420
1419int 1421int