summaryrefslogtreecommitdiff
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
parentd8cfda6bf6db6db50a4f644ad39138b7f1e3e33f (diff)
- (djm) Login fixes from Tom Bertelson <tbert@abac.com>
-rw-r--r--ChangeLog1
-rw-r--r--acconfig.h1
-rw-r--r--configure.in1
-rw-r--r--loginrec.c17
4 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d47d6c3a..06ed24d51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
120000701 120000701
2 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu> 2 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu>
3 - (djm) Login fixes from Tom Bertelson <tbert@abac.com>
3 4
420000628 520000628
5 - (djm) Fixes to lastlog code for Irix 6 - (djm) Fixes to lastlog code for Irix
diff --git a/acconfig.h b/acconfig.h
index 6f375212c..f10370df4 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -57,6 +57,7 @@
57#undef HAVE_TV_IN_UTMP 57#undef HAVE_TV_IN_UTMP
58#undef HAVE_TV_IN_UTMPX 58#undef HAVE_TV_IN_UTMPX
59#undef HAVE_ID_IN_UTMP 59#undef HAVE_ID_IN_UTMP
60#undef HAVE_ID_IN_UTMPX
60#undef HAVE_EXIT_IN_UTMP 61#undef HAVE_EXIT_IN_UTMP
61#undef HAVE_TIME_IN_UTMP 62#undef HAVE_TIME_IN_UTMP
62#undef HAVE_TIME_IN_UTMPX 63#undef HAVE_TIME_IN_UTMPX
diff --git a/configure.in b/configure.in
index 4dd08c71a..8e155f26b 100644
--- a/configure.in
+++ b/configure.in
@@ -636,6 +636,7 @@ OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
636OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX) 636OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
637OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP) 637OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
638OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP) 638OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
639OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
639OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP) 640OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
640OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX) 641OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
641OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP) 642OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
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) {