summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-07-01 13:17:42 +1000
committerDamien Miller <djm@mindrot.org>2000-07-01 13:17:42 +1000
commit8e81ed3081412b3525d6819216ec3eb3f8b65c7e (patch)
treec2394e20a5c5222848f0b7e5ed63677e7d59b1b2 /loginrec.c
parentd8cfda6bf6db6db50a4f644ad39138b7f1e3e33f (diff)
- (djm) Login fixes from Tom Bertelson <tbert@abac.com>
Diffstat (limited to 'loginrec.c')
-rw-r--r--loginrec.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/loginrec.c b/loginrec.c
index 6a6443d2b..5338847aa 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -170,7 +170,7 @@
170#include "xmalloc.h" 170#include "xmalloc.h"
171#include "loginrec.h" 171#include "loginrec.h"
172 172
173RCSID("$Id: loginrec.c,v 1.12 2000/06/27 14:50:50 djm Exp $"); 173RCSID("$Id: loginrec.c,v 1.13 2000/07/01 03:17:42 djm Exp $");
174 174
175/** 175/**
176 ** prototypes for helper functions in this file 176 ** prototypes for helper functions in this file
@@ -535,11 +535,18 @@ line_abbrevname(char *dst, const char *src, int dstsize)
535 535
536 memset(dst, '\0', dstsize); 536 memset(dst, '\0', dstsize);
537 537
538 /* Always skip prefix if present */
539 if (strncmp(src, "/dev/", 5) == 0)
540 src += 5;
541
538 len = strlen(src); 542 len = strlen(src);
539 543
540 if (len <= 0) { 544 if (len > 0) {
541 src += (len - dstsize); 545 if (((int)len - dstsize) > 0)
542 strncpy(dst, src, dstsize); /* note: _don't_ change this to strlcpy */ 546 src += ((int)len - dstsize);
547
548 /* note: _don't_ change this to strlcpy */
549 strncpy(dst, src, (size_t)dstsize);
543 } 550 }
544 551
545 return dst; 552 return dst;
@@ -647,7 +654,9 @@ void
647construct_utmpx(struct logininfo *li, struct utmpx *utx) 654construct_utmpx(struct logininfo *li, struct utmpx *utx)
648{ 655{
649 memset(utx, '\0', sizeof(struct utmpx)); 656 memset(utx, '\0', sizeof(struct utmpx));
657# ifdef HAVE_ID_IN_UTMPX
650 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id)); 658 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
659# endif
651 660
652 /* this is done here to keep utmp constants out of loginrec.h */ 661 /* this is done here to keep utmp constants out of loginrec.h */
653 switch (li->type) { 662 switch (li->type) {