const poisoning.

This commit is contained in:
mycroft 1998-07-26 21:35:28 +00:00
parent a5b2c458ca
commit d92a424ade
2 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.5 1998/01/09 08:05:35 perry Exp $ */
/* $NetBSD: extern.h,v 1.6 1998/07/26 21:35:28 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -47,7 +47,7 @@ extern int pplan;
void enter_lastlog __P((PERSON *));
PERSON *enter_person __P((struct passwd *));
void enter_where __P((struct utmp *, PERSON *));
void expandusername __P((char *, char *, char *, int));
void expandusername __P((const char *, const char *, char *, int));
PERSON *find_person __P((char *));
int hash __P((char *));
void lflag_print __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.11 1997/10/19 08:13:50 mrg Exp $ */
/* $NetBSD: util.c,v 1.12 1998/07/26 21:35:29 mycroft Exp $ */
/*
* Copyright (c) 1989, 1993
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: util.c,v 1.11 1997/10/19 08:13:50 mrg Exp $");
__RCSID("$NetBSD: util.c,v 1.12 1998/07/26 21:35:29 mycroft Exp $");
#endif
#endif /* not lint */
@ -74,20 +74,21 @@ match(pw, user)
struct passwd *pw;
char *user;
{
char *p, *t;
char name[1024];
char *p;
char *bp, name[1024];
if (!strcasecmp(pw->pw_name, user))
return(1);
(void)strncpy(p = tbuf, pw->pw_gecos, sizeof(tbuf));
(void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf));
/* Ampersands get replaced by the login name. */
if ((p = strtok(p, ",")) == NULL)
if (!(p = strsep(&bp, ",")))
return(0);
expandusername(p, pw->pw_name, name, sizeof(name));
for (t = name; (p = strtok(t, "\t ")) != NULL; t = NULL)
bp = name;
while ((p = strsep(&bp, "\t ")))
if (!strcasecmp(p, user))
return(1);
return(0);
@ -96,12 +97,13 @@ match(pw, user)
/* inspired by usr.sbin/sendmail/util.c::buildfname */
void
expandusername(gecos, login, buf, buflen)
char *gecos;
char *login;
const char *gecos;
const char *login;
char *buf;
int buflen;
{
char *p, *bp;
const char *p;
char *bp;
/* why do we skip asterisks!?!? */
if (*gecos == '*')
@ -210,7 +212,7 @@ enter_person(pw)
err(1, NULL);
#endif
key.data = pw->pw_name;
key.data = (char *)pw->pw_name;
key.size = strlen(pw->pw_name);
switch ((*db->get)(db, &key, &data, 0)) {