=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/finger/util.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/finger/util.c 2000/06/30 16:00:13 1.12 --- src/usr.bin/finger/util.c 2001/01/10 20:10:36 1.13 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.12 2000/06/30 16:00:13 millert Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.13 2001/01/10 20:10:36 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. *************** *** 39,45 **** #ifndef lint /*static char sccsid[] = "from: @(#)util.c 5.14 (Berkeley) 1/17/91";*/ ! static char rcsid[] = "$OpenBSD: util.c,v 1.12 2000/06/30 16:00:13 millert Exp $"; #endif /* not lint */ #include --- 39,45 ---- #ifndef lint /*static char sccsid[] = "from: @(#)util.c 5.14 (Berkeley) 1/17/91";*/ ! static char rcsid[] = "$OpenBSD: util.c,v 1.13 2001/01/10 20:10:36 deraadt Exp $"; #endif /* not lint */ #include *************** *** 60,65 **** --- 60,67 ---- #include "finger.h" #include "extern.h" + char *estrdup(char *); + void find_idle_and_ttywrite(w) WHERE *w; *************** *** 80,85 **** --- 82,96 ---- w->writable = ((sb.st_mode & TALKABLE) == TALKABLE); } + char * + estrdup(char *s) + { + char *p = strdup(s); + if (p) + err(1, "stdup"); + return (p); + } + void userinfo(pn, pw) PERSON *pn; *************** *** 92,100 **** pn->realname = pn->office = pn->officephone = pn->homephone = NULL; pn->uid = pw->pw_uid; ! pn->name = strdup(pw->pw_name); ! pn->dir = strdup(pw->pw_dir); ! pn->shell = strdup(pw->pw_shell); (void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf)); --- 103,111 ---- pn->realname = pn->office = pn->officephone = pn->homephone = NULL; pn->uid = pw->pw_uid; ! pn->name = estrdup(pw->pw_name); ! pn->dir = estrdup(pw->pw_dir); ! pn->shell = estrdup(pw->pw_shell); (void)strncpy(bp = tbuf, pw->pw_gecos, sizeof(tbuf)); *************** *** 102,114 **** if (!(p = strsep(&bp, ","))) return; expandusername(p, pw->pw_name, name, sizeof(name)); ! pn->realname = strdup(name); pn->office = ((p = strsep(&bp, ",")) && *p) ? ! strdup(p) : NULL; pn->officephone = ((p = strsep(&bp, ",")) && *p) ? ! strdup(p) : NULL; pn->homephone = ((p = strsep(&bp, ",")) && *p) ? ! strdup(p) : NULL; (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_MAILSPOOL, pw->pw_name); pn->mailrecv = -1; /* -1 == not_valid */ --- 113,125 ---- if (!(p = strsep(&bp, ","))) return; expandusername(p, pw->pw_name, name, sizeof(name)); ! pn->realname = estrdup(name); pn->office = ((p = strsep(&bp, ",")) && *p) ? ! estrdup(p) : NULL; pn->officephone = ((p = strsep(&bp, ",")) && *p) ? ! estrdup(p) : NULL; pn->homephone = ((p = strsep(&bp, ",")) && *p) ? ! estrdup(p) : NULL; (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_MAILSPOOL, pw->pw_name); pn->mailrecv = -1; /* -1 == not_valid */