summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authordjm <djm>2000-07-01 03:17:42 +0000
committerdjm <djm>2000-07-01 03:17:42 +0000
commit473f40e831d0e524ee83c6f75ed80985b983aa2c (patch)
treefd77f577d73bef48330e77d2515f36125922ea02 /loginrec.c
parent0345ae923f58bcc44dff065fd05b9e16920592fd (diff)
downloadopenssh-473f40e831d0e524ee83c6f75ed80985b983aa2c.tar.gz
- (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 6a6443d2..5338847a 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -170,7 +170,7 @@
#include "xmalloc.h"
#include "loginrec.h"
-RCSID("$Id: loginrec.c,v 1.12 2000/06/27 14:50:50 djm Exp $");
+RCSID("$Id: loginrec.c,v 1.13 2000/07/01 03:17:42 djm Exp $");
/**
** prototypes for helper functions in this file
@@ -535,11 +535,18 @@ line_abbrevname(char *dst, const char *src, int dstsize)
memset(dst, '\0', dstsize);
+ /* Always skip prefix if present */
+ if (strncmp(src, "/dev/", 5) == 0)
+ src += 5;
+
len = strlen(src);
- if (len <= 0) {
- src += (len - dstsize);
- strncpy(dst, src, dstsize); /* note: _don't_ change this to strlcpy */
+ if (len > 0) {
+ if (((int)len - dstsize) > 0)
+ src += ((int)len - dstsize);
+
+ /* note: _don't_ change this to strlcpy */
+ strncpy(dst, src, (size_t)dstsize);
}
return dst;
@@ -647,7 +654,9 @@ void
construct_utmpx(struct logininfo *li, struct utmpx *utx)
{
memset(utx, '\0', sizeof(struct utmpx));
+# ifdef HAVE_ID_IN_UTMPX
line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
+# endif
/* this is done here to keep utmp constants out of loginrec.h */
switch (li->type) {