summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2001-01-31 17:42:25 +0000
committerderaadt <deraadt@openbsd.org>2001-01-31 17:42:25 +0000
commitc264c362c67c6e1172dbee5e6cbd1e93669a574e (patch)
treebc7759efbed5fe3a8773744d732ca03501bce4e8
parentOpenBSD does have paddr_t, I can't explain why I thought it didn't; art@ (diff)
downloadwireguard-openbsd-c264c362c67c6e1172dbee5e6cbd1e93669a574e.tar.xz
wireguard-openbsd-c264c362c67c6e1172dbee5e6cbd1e93669a574e.zip
move utmp to large format, usernames to 32 chars; downsj
-rw-r--r--include/pwd.h3
-rw-r--r--include/utmp.h22
-rw-r--r--lib/libc/gen/getpwent.c17
-rw-r--r--lib/libc/gen/pwcache.c15
-rw-r--r--lib/libc/shlib_version4
-rw-r--r--lib/libc_r/shlib_version4
-rw-r--r--lib/libkvm/shlib_version4
-rw-r--r--lib/libutil/shlib_version2
-rw-r--r--sys/sys/param.h4
-rw-r--r--usr.bin/last/last.c31
-rw-r--r--usr.bin/w/w.c11
-rw-r--r--usr.bin/who/who.c19
12 files changed, 80 insertions, 56 deletions
diff --git a/include/pwd.h b/include/pwd.h
index 3aa7ae9c4da..0c3ec950a66 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd.h,v 1.9 2000/11/21 00:49:59 millert Exp $ */
+/* $OpenBSD: pwd.h,v 1.10 2001/01/31 17:42:25 deraadt Exp $ */
/* $NetBSD: pwd.h,v 1.9 1996/05/15 21:36:45 jtc Exp $ */
/*-
@@ -67,6 +67,7 @@
#define _PASSWORD_EFMT1 '_' /* extended encryption format */
#define _PASSWORD_LEN 128 /* max length, not counting NULL */
+#define _PW_NAME_LEN 32 /* max length, not counting NULL */
#define _PASSWORD_NOUID 0x01 /* flag for no specified uid. */
#define _PASSWORD_NOGID 0x02 /* flag for no specified gid. */
diff --git a/include/utmp.h b/include/utmp.h
index d0d21a9d8fe..1a6d0104657 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: utmp.h,v 1.3 1999/04/21 15:15:39 millert Exp $ */
+/* $OpenBSD: utmp.h,v 1.4 2001/01/31 17:42:25 deraadt Exp $ */
/* $NetBSD: utmp.h,v 1.6 1994/10/26 00:56:40 cgd Exp $ */
/*
@@ -48,9 +48,9 @@
#define _PATH_WTMP "/var/log/wtmp"
#define _PATH_LASTLOG "/var/log/lastlog"
-#define UT_NAMESIZE 8
+#define UT_NAMESIZE 32
#define UT_LINESIZE 8
-#define UT_HOSTSIZE 16
+#define UT_HOSTSIZE 256
/*
* Note that these are *not* C strings and thus are not
@@ -70,4 +70,20 @@ struct utmp {
time_t ut_time;
};
+/*
+ * These should not be used for writing out new data, for reference only.
+ */
+struct old_lastlog {
+ time_t ll_time;
+ char ll_line[8];
+ char ll_host[16];
+};
+
+struct old_utmp {
+ char ut_line[8];
+ char ut_name[8];
+ char ut_host[16];
+ time_t ut_time;
+};
+
#endif /* !_UTMP_H_ */
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 1ff377ee9ea..ce0d3734c4d 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -33,7 +33,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getpwent.c,v 1.19 2000/04/25 19:11:48 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: getpwent.c,v 1.20 2001/01/31 17:42:25 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -41,7 +41,6 @@ static char rcsid[] = "$OpenBSD: getpwent.c,v 1.19 2000/04/25 19:11:48 deraadt E
#include <db.h>
#include <syslog.h>
#include <pwd.h>
-#include <utmp.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
@@ -496,7 +495,7 @@ __has_yppw()
DBT key, data;
DBT pkey, pdata;
int len;
- char bf[UT_NAMESIZE];
+ char bf[_PW_NAME_LEN];
key.data = (u_char *)_PW_YPTOKEN;
key.size = strlen(_PW_YPTOKEN);
@@ -504,9 +503,9 @@ __has_yppw()
/* Pre-token database support. */
bf[0] = _PW_KEYBYNAME;
len = strlen("+");
- bcopy("+", bf + 1, MIN(len, UT_NAMESIZE));
+ bcopy("+", bf + 1, MIN(len, _PW_NAME_LEN));
pkey.data = (u_char *)bf;
- pkey.size = MIN(len, UT_NAMESIZE) + 1;
+ pkey.size = MIN(len, _PW_NAME_LEN) + 1;
if ((_pw_db->get)(_pw_db, &key, &data, 0)
&& (_pw_db->get)(_pw_db, &pkey, &pdata, 0))
@@ -572,7 +571,7 @@ getpwnam(name)
{
DBT key;
int len, rval;
- char bf[UT_NAMESIZE + 1];
+ char bf[_PW_NAME_LEN + 1];
if (!_pw_db && !__initdb())
return ((struct passwd *)NULL);
@@ -728,12 +727,12 @@ pwnam_netgrp:
bf[0] = _PW_KEYBYNAME;
len = strlen(name);
- if (len > UT_NAMESIZE)
+ if (len > _PW_NAME_LEN)
rval = 0;
else {
- bcopy(name, bf + 1, MIN(len, UT_NAMESIZE));
+ bcopy(name, bf + 1, MIN(len, _PW_NAME_LEN));
key.data = (u_char *)bf;
- key.size = MIN(len, UT_NAMESIZE) + 1;
+ key.size = MIN(len, _PW_NAME_LEN) + 1;
rval = __hashpw(&key);
}
diff --git a/lib/libc/gen/pwcache.c b/lib/libc/gen/pwcache.c
index 6b1997baced..509bdbb10b5 100644
--- a/lib/libc/gen/pwcache.c
+++ b/lib/libc/gen/pwcache.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: pwcache.c,v 1.3 1997/07/09 00:28:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: pwcache.c,v 1.4 2001/01/31 17:42:25 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -41,7 +41,6 @@ static char rcsid[] = "$OpenBSD: pwcache.c,v 1.3 1997/07/09 00:28:23 millert Exp
#include <pwd.h>
#include <stdio.h>
#include <string.h>
-#include <utmp.h>
#define NCACHE 64 /* power of 2 */
#define MASK (NCACHE - 1) /* bits to store with */
@@ -53,7 +52,7 @@ user_from_uid(uid, nouser)
{
static struct ncache {
uid_t uid;
- char name[UT_NAMESIZE + 1];
+ char name[_PW_NAME_LEN + 1];
} c_uid[NCACHE];
static int pwopen;
static char nbuf[15]; /* 32 bits == 10 digits */
@@ -73,8 +72,8 @@ user_from_uid(uid, nouser)
return (nbuf);
}
cp->uid = uid;
- (void)strncpy(cp->name, pw->pw_name, UT_NAMESIZE);
- cp->name[UT_NAMESIZE] = '\0';
+ (void)strncpy(cp->name, pw->pw_name, _PW_NAME_LEN);
+ cp->name[_PW_NAME_LEN] = '\0';
}
return (cp->name);
}
@@ -86,7 +85,7 @@ group_from_gid(gid, nogroup)
{
static struct ncache {
gid_t gid;
- char name[UT_NAMESIZE + 1];
+ char name[_PW_NAME_LEN + 1];
} c_gid[NCACHE];
static int gropen;
static char nbuf[15]; /* 32 bits == 10 digits */
@@ -106,8 +105,8 @@ group_from_gid(gid, nogroup)
return (nbuf);
}
cp->gid = gid;
- (void)strncpy(cp->name, gr->gr_name, UT_NAMESIZE);
- cp->name[UT_NAMESIZE] = '\0';
+ (void)strncpy(cp->name, gr->gr_name, _PW_NAME_LEN);
+ cp->name[_PW_NAME_LEN] = '\0';
}
return (cp->name);
}
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 9ee4bc78996..c622cb8cdf3 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,2 +1,2 @@
-major=25
-minor=4
+major=26
+minor=0
diff --git a/lib/libc_r/shlib_version b/lib/libc_r/shlib_version
index b25072f4e52..d9961ea9fef 100644
--- a/lib/libc_r/shlib_version
+++ b/lib/libc_r/shlib_version
@@ -1,2 +1,2 @@
-major=3
-minor=3
+major=4
+minor=0
diff --git a/lib/libkvm/shlib_version b/lib/libkvm/shlib_version
index 900b4048a96..9c1551636c5 100644
--- a/lib/libkvm/shlib_version
+++ b/lib/libkvm/shlib_version
@@ -1,2 +1,2 @@
-major=5
-minor=1
+major=6
+minor=0
diff --git a/lib/libutil/shlib_version b/lib/libutil/shlib_version
index 3066b9771e7..9c1551636c5 100644
--- a/lib/libutil/shlib_version
+++ b/lib/libutil/shlib_version
@@ -1,2 +1,2 @@
-major=5
+major=6
minor=0
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 45b9c5c5e78..d2b64d36ace 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.30 2000/08/21 21:13:37 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.31 2001/01/31 17:42:26 deraadt Exp $ */
/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
/*-
@@ -72,7 +72,7 @@
#define MAXCOMLEN 16 /* max command name remembered */
#define MAXINTERP 64 /* max interpreter file name length */
-#define MAXLOGNAME 12 /* max login name length */
+#define MAXLOGNAME 33 /* max login name length */
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS NGROUPS_MAX /* max number groups */
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 664525f7cb8..b187bf86a86 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.12 2000/12/12 09:16:03 deraadt Exp $ */
+/* $OpenBSD: last.c,v 1.13 2001/01/31 17:42:26 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: last.c,v 1.12 2000/12/12 09:16:03 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: last.c,v 1.13 2001/01/31 17:42:26 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -106,6 +106,9 @@ int want __P((struct utmp *, int));
void wtmp __P((void));
void checkargs __P((void));
+#define NAME_WIDTH 8
+#define HOST_WIDTH 32
+
int
main(argc, argv)
int argc;
@@ -286,18 +289,18 @@ wtmp()
if (want(bp, NO)) {
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld \n",
- UT_NAMESIZE, UT_NAMESIZE,
+ NAME_WIDTH, UT_NAMESIZE,
bp->ut_name, UT_LINESIZE,
UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE,
+ HOST_WIDTH, UT_HOSTSIZE,
bp->ut_host, bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
- UT_NAMESIZE, UT_NAMESIZE,
+ NAME_WIDTH, UT_NAMESIZE,
bp->ut_name, UT_LINESIZE,
UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE,
+ HOST_WIDTH, UT_HOSTSIZE,
bp->ut_host, ct, timesize,
timesize, ct + 11);
}
@@ -315,16 +318,16 @@ wtmp()
if (want(bp, NO)) {
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld \n",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
ct, timesize, timesize, ct + 11);
}
if (maxrec && !--maxrec)
@@ -354,16 +357,16 @@ wtmp()
snapfound = 1;
if (seconds) {
printf("%-*.*s %-*.*s %-*.*s %ld ",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s ",
- UT_NAMESIZE, UT_NAMESIZE, bp->ut_name,
+ NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
UT_LINESIZE, UT_LINESIZE, bp->ut_line,
- UT_HOSTSIZE, UT_HOSTSIZE, bp->ut_host,
+ HOST_WIDTH, UT_HOSTSIZE, bp->ut_host,
ct, timesize, timesize, ct + 11);
}
if (!T->logout)
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 67029faafa7..833f2008c90 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.31 2000/12/23 02:07:49 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.32 2001/01/31 17:42:26 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
#else
-static char *rcsid = "$OpenBSD: w.c,v 1.31 2000/12/23 02:07:49 deraadt Exp $";
+static char *rcsid = "$OpenBSD: w.c,v 1.32 2001/01/31 17:42:26 deraadt Exp $";
#endif
#endif /* not lint */
@@ -100,6 +100,9 @@ int sortidle; /* sort bu idle time */
char *sel_user; /* login of particular user selected */
char domain[MAXHOSTNAMELEN];
+#define NAME_WIDTH 8
+#define HOST_WIDTH 16
+
/*
* One of these per active utmp entry.
*/
@@ -337,10 +340,10 @@ main(argc, argv)
p = buf;
}
(void)printf("%-*.*s %-2.2s %-*.*s ",
- UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,
+ NAME_WIDTH, UT_NAMESIZE, ep->utmp.ut_name,
strncmp(ep->utmp.ut_line, "tty", 3) ?
ep->utmp.ut_line : ep->utmp.ut_line + 3,
- UT_HOSTSIZE, UT_HOSTSIZE, *p ? p : "-");
+ HOST_WIDTH, HOST_WIDTH, *p ? p : "-");
pr_attime(&ep->utmp.ut_time, &now);
pr_idle(ep->idle);
pr_args(ep->kp);
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index f6f9d3e4873..2ca1508355b 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: who.c,v 1.9 2000/03/22 17:07:37 millert Exp $ */
+/* $OpenBSD: who.c,v 1.10 2001/01/31 17:42:26 deraadt Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: who.c,v 1.9 2000/03/22 17:07:37 millert Exp $";
+static char rcsid[] = "$OpenBSD: who.c,v 1.10 2001/01/31 17:42:26 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -75,6 +75,9 @@ int show_idle; /* show idle time */
int show_labels; /* show column labels */
int show_quick; /* quick, names only */
+#define NAME_WIDTH 8
+#define HOST_WIDTH 32
+
int
main(argc, argv)
int argc;
@@ -131,7 +134,7 @@ main(argc, argv)
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (*usr.ut_name && *usr.ut_line) {
- (void)printf("%-*.*s ", UT_NAMESIZE,
+ (void)printf("%-*.*s ", NAME_WIDTH,
UT_NAMESIZE, usr.ut_name);
if ((++count % 8) == 0)
(void) printf("\n");
@@ -157,7 +160,7 @@ main(argc, argv)
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (*usr.ut_name && *usr.ut_line) {
- (void)printf("%-*.*s ", UT_NAMESIZE,
+ (void)printf("%-*.*s ", NAME_WIDTH,
UT_NAMESIZE, usr.ut_name);
if ((++count % 8) == 0)
(void) printf("\n");
@@ -241,7 +244,7 @@ output(up)
}
- (void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, up->ut_name);
+ (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, up->ut_name);
if (show_term) {
(void)printf("%c ", state);
@@ -262,14 +265,14 @@ output(up)
}
if (*up->ut_host)
- printf("\t(%.*s)", UT_HOSTSIZE, up->ut_host);
+ printf(" (%.*s)", HOST_WIDTH, up->ut_host);
(void)putchar('\n');
}
void
output_labels()
{
- (void)printf("%-*.*s ", UT_NAMESIZE, UT_NAMESIZE, "USER");
+ (void)printf("%-*.*s ", NAME_WIDTH, UT_NAMESIZE, "USER");
if (show_term)
(void)printf("S ");
@@ -280,7 +283,7 @@ output_labels()
if (show_idle)
(void)printf("IDLE ");
- (void)printf("\t%.*s", UT_HOSTSIZE, "FROM");
+ (void)printf(" %.*s", HOST_WIDTH, "FROM");
(void)putchar('\n');
}