summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-07-17 17:04:47 +1000
committerDamien Miller <djm@mindrot.org>2005-07-17 17:04:47 +1000
commit94cf4c8448bab8f1ad563868089bb0ea1ff92213 (patch)
tree1a0752ba64d6b7ccfdcd824ad55a76523e659a87 /loginrec.c
parent46d38de48b1018c74040d2399bafbedf50247529 (diff)
- (djm) [acss.c auth-pam.c auth-shadow.c auth-skey.c auth1.c canohost.c]
[cipher-acss.c loginrec.c ssh-rand-helper.c sshd.c] Fix whitespace at EOL in portable too ("perl -p -i -e 's/\s+$/\n/' *.[ch]")
Diffstat (limited to 'loginrec.c')
-rw-r--r--loginrec.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/loginrec.c b/loginrec.c
index 2543617ba..5d6e120c4 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -165,7 +165,7 @@
165# include <libutil.h> 165# include <libutil.h>
166#endif 166#endif
167 167
168RCSID("$Id: loginrec.c,v 1.68 2005/06/19 00:19:43 djm Exp $"); 168RCSID("$Id: loginrec.c,v 1.69 2005/07/17 07:04:47 djm Exp $");
169 169
170/** 170/**
171 ** prototypes for helper functions in this file 171 ** prototypes for helper functions in this file
@@ -362,7 +362,7 @@ login_init_entry(struct logininfo *li, int pid, const char *username,
362 strlcpy(li->username, username, sizeof(li->username)); 362 strlcpy(li->username, username, sizeof(li->username));
363 pw = getpwnam(li->username); 363 pw = getpwnam(li->username);
364 if (pw == NULL) { 364 if (pw == NULL) {
365 fatal("%s: Cannot find user \"%s\"", __func__, 365 fatal("%s: Cannot find user \"%s\"", __func__,
366 li->username); 366 li->username);
367 } 367 }
368 li->uid = pw->pw_uid; 368 li->uid = pw->pw_uid;
@@ -374,7 +374,7 @@ login_init_entry(struct logininfo *li, int pid, const char *username,
374 return (1); 374 return (1);
375} 375}
376 376
377/* 377/*
378 * login_set_current_time(struct logininfo *) - set the current time 378 * login_set_current_time(struct logininfo *) - set the current time
379 * 379 *
380 * Set the current time in a logininfo structure. This function is 380 * Set the current time in a logininfo structure. This function is
@@ -443,7 +443,7 @@ login_write(struct logininfo *li)
443 wtmpx_write_entry(li); 443 wtmpx_write_entry(li);
444#endif 444#endif
445#ifdef CUSTOM_SYS_AUTH_RECORD_LOGIN 445#ifdef CUSTOM_SYS_AUTH_RECORD_LOGIN
446 if (li->type == LTYPE_LOGIN && 446 if (li->type == LTYPE_LOGIN &&
447 !sys_auth_record_login(li->username,li->hostname,li->line, &loginmsg)) 447 !sys_auth_record_login(li->username,li->hostname,li->line, &loginmsg))
448 logit("Writing login record failed for %s", li->username); 448 logit("Writing login record failed for %s", li->username);
449#endif 449#endif
@@ -558,7 +558,7 @@ line_stripname(char *dst, const char *src, int dstsize)
558 return (dst); 558 return (dst);
559} 559}
560 560
561/* 561/*
562 * line_abbrevname(): Return the abbreviated (usually four-character) 562 * line_abbrevname(): Return the abbreviated (usually four-character)
563 * form of the line (Just use the last <dstsize> characters of the 563 * form of the line (Just use the last <dstsize> characters of the
564 * full name.) 564 * full name.)
@@ -808,7 +808,7 @@ utmp_write_library(struct logininfo *li, struct utmp *ut)
808} 808}
809# else /* UTMP_USE_LIBRARY */ 809# else /* UTMP_USE_LIBRARY */
810 810
811/* 811/*
812 * Write a utmp entry direct to the file 812 * Write a utmp entry direct to the file
813 * This is a slightly modification of code in OpenBSD's login.c 813 * This is a slightly modification of code in OpenBSD's login.c
814 */ 814 */
@@ -852,7 +852,7 @@ utmp_write_direct(struct logininfo *li, struct utmp *ut)
852 return (0); 852 return (0);
853 } 853 }
854 if (ret != pos) { 854 if (ret != pos) {
855 logit("%s: Couldn't seek to tty %d slot in %s", 855 logit("%s: Couldn't seek to tty %d slot in %s",
856 __func__, tty, UTMP_FILE); 856 __func__, tty, UTMP_FILE);
857 return (0); 857 return (0);
858 } 858 }
@@ -1052,7 +1052,7 @@ utmpx_write_entry(struct logininfo *li)
1052 1052
1053#ifdef USE_WTMP 1053#ifdef USE_WTMP
1054 1054
1055/* 1055/*
1056 * Write a wtmp entry direct to the end of the file 1056 * Write a wtmp entry direct to the end of the file
1057 * This is a slight modification of code in OpenBSD's logwtmp.c 1057 * This is a slight modification of code in OpenBSD's logwtmp.c
1058 */ 1058 */
@@ -1113,7 +1113,7 @@ wtmp_write_entry(struct logininfo *li)
1113} 1113}
1114 1114
1115 1115
1116/* 1116/*
1117 * Notes on fetching login data from wtmp/wtmpx 1117 * Notes on fetching login data from wtmp/wtmpx
1118 * 1118 *
1119 * Logouts are usually recorded with (amongst other things) a blank 1119 * Logouts are usually recorded with (amongst other things) a blank
@@ -1157,12 +1157,12 @@ wtmp_get_entry(struct logininfo *li)
1157 li->tv_sec = li->tv_usec = 0; 1157 li->tv_sec = li->tv_usec = 0;
1158 1158
1159 if ((fd = open(WTMP_FILE, O_RDONLY)) < 0) { 1159 if ((fd = open(WTMP_FILE, O_RDONLY)) < 0) {
1160 logit("%s: problem opening %s: %s", __func__, 1160 logit("%s: problem opening %s: %s", __func__,
1161 WTMP_FILE, strerror(errno)); 1161 WTMP_FILE, strerror(errno));
1162 return (0); 1162 return (0);
1163 } 1163 }
1164 if (fstat(fd, &st) != 0) { 1164 if (fstat(fd, &st) != 0) {
1165 logit("%s: couldn't stat %s: %s", __func__, 1165 logit("%s: couldn't stat %s: %s", __func__,
1166 WTMP_FILE, strerror(errno)); 1166 WTMP_FILE, strerror(errno));
1167 close(fd); 1167 close(fd);
1168 return (0); 1168 return (0);
@@ -1177,7 +1177,7 @@ wtmp_get_entry(struct logininfo *li)
1177 1177
1178 while (!found) { 1178 while (!found) {
1179 if (atomicio(read, fd, &ut, sizeof(ut)) != sizeof(ut)) { 1179 if (atomicio(read, fd, &ut, sizeof(ut)) != sizeof(ut)) {
1180 logit("%s: read of %s failed: %s", __func__, 1180 logit("%s: read of %s failed: %s", __func__,
1181 WTMP_FILE, strerror(errno)); 1181 WTMP_FILE, strerror(errno));
1182 close (fd); 1182 close (fd);
1183 return (0); 1183 return (0);
@@ -1235,7 +1235,7 @@ wtmpx_write(struct logininfo *li, struct utmpx *utx)
1235 int fd, ret = 1; 1235 int fd, ret = 1;
1236 1236
1237 if ((fd = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) { 1237 if ((fd = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
1238 logit("%s: problem opening %s: %s", __func__, 1238 logit("%s: problem opening %s: %s", __func__,
1239 WTMPX_FILE, strerror(errno)); 1239 WTMPX_FILE, strerror(errno));
1240 return (0); 1240 return (0);
1241 } 1241 }
@@ -1322,12 +1322,12 @@ wtmpx_get_entry(struct logininfo *li)
1322 li->tv_sec = li->tv_usec = 0; 1322 li->tv_sec = li->tv_usec = 0;
1323 1323
1324 if ((fd = open(WTMPX_FILE, O_RDONLY)) < 0) { 1324 if ((fd = open(WTMPX_FILE, O_RDONLY)) < 0) {
1325 logit("%s: problem opening %s: %s", __func__, 1325 logit("%s: problem opening %s: %s", __func__,
1326 WTMPX_FILE, strerror(errno)); 1326 WTMPX_FILE, strerror(errno));
1327 return (0); 1327 return (0);
1328 } 1328 }
1329 if (fstat(fd, &st) != 0) { 1329 if (fstat(fd, &st) != 0) {
1330 logit("%s: couldn't stat %s: %s", __func__, 1330 logit("%s: couldn't stat %s: %s", __func__,
1331 WTMPX_FILE, strerror(errno)); 1331 WTMPX_FILE, strerror(errno));
1332 close(fd); 1332 close(fd);
1333 return (0); 1333 return (0);
@@ -1342,13 +1342,13 @@ wtmpx_get_entry(struct logininfo *li)
1342 1342
1343 while (!found) { 1343 while (!found) {
1344 if (atomicio(read, fd, &utx, sizeof(utx)) != sizeof(utx)) { 1344 if (atomicio(read, fd, &utx, sizeof(utx)) != sizeof(utx)) {
1345 logit("%s: read of %s failed: %s", __func__, 1345 logit("%s: read of %s failed: %s", __func__,
1346 WTMPX_FILE, strerror(errno)); 1346 WTMPX_FILE, strerror(errno));
1347 close (fd); 1347 close (fd);
1348 return (0); 1348 return (0);
1349 } 1349 }
1350 /* 1350 /*
1351 * Logouts are recorded as a blank username on a particular 1351 * Logouts are recorded as a blank username on a particular
1352 * line. So, we just need to find the username in struct utmpx 1352 * line. So, we just need to find the username in struct utmpx
1353 */ 1353 */
1354 if (wtmpx_islogin(li, &utx)) { 1354 if (wtmpx_islogin(li, &utx)) {