users(void)
{
struct utmpentry *ep;
- int nusers;
+ int nusers = 0;
getutentries(NULL, &ep);
for (; ep; ep = ep->next)
extern int lflag;
extern int Tflag;
extern sa_family_t family;
+struct utmpentry;
void enter_lastlog(PERSON *);
PERSON *enter_person(struct passwd *);
-void enter_where(struct utmp *, PERSON *);
+void enter_where(struct utmpentry *, PERSON *);
PERSON *find_person(char *);
int hide(struct passwd *);
void lflag_print(void);
continue;
pn = enter_person(pw);
}
- enter_where(&user, pn);
+ enter_where(ep, pn);
}
if (db && lflag)
for (sflag1 = R_FIRST;; sflag1 = R_NEXT) {
for (; ep; ep = ep->next) {
if ((pn = find_person(ep->name)) == NULL)
continue;
- enter_where(&user, pn);
+ enter_where(ep, pn);
}
if (db)
for (sflag1 = R_FIRST;; sflag1 = R_NEXT) {
short writable; /* tty is writable */
time_t loginat; /* time of (last) login */
time_t idletime; /* how long idle (if logged in) */
- char tty[UT_LINESIZE+1]; /* null terminated tty line */
- char host[UT_HOSTSIZE+1]; /* null terminated remote host name */
+ char *tty; /* null terminated tty line */
+ char *host; /* null terminated remote host name */
} WHERE;
#define UNPRIV_NAME "nobody" /* Preferred privilege level */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "utmpentry.h"
#include <utmp.h>
#include "finger.h"
#include "pathnames.h"
}
void
-enter_where(struct utmp *ut, PERSON *pn)
+enter_where(struct utmpentry *ep, PERSON *pn)
{
WHERE *w;
w = walloc(pn);
w->info = LOGGEDIN;
- bcopy(ut->ut_line, w->tty, UT_LINESIZE);
- w->tty[UT_LINESIZE] = 0;
- bcopy(ut->ut_host, w->host, UT_HOSTSIZE);
- w->host[UT_HOSTSIZE] = 0;
- w->loginat = (time_t)ut->ut_time;
+ w->tty = ep->line;
+ w->host = ep->host;
+ w->loginat = (time_t)ep->tv.tv_sec;
find_idle_and_ttywrite(w);
}
struct utmpentry *ep;
int ch;
int ingroup;
- FILE *fp;
struct wallgroup *g;
struct group *grp;
char **np;
ingroup = 1;
else if ((grp = getgrgid(g->gid)) != NULL) {
for (np = grp->gr_mem; *np; np++) {
- if (strcmp(*np, username) == 0) {
+ if (strcmp(*np, ep->name) == 0) {
ingroup = 1;
break;
}
#define PRI_GT 0x4
char *f_program; /* program this applies to */
union {
- char f_uname[MAXUNAMES][UT_NAMESIZE+1];
+ char f_uname[MAXUNAMES][32+1];
struct {
char f_hname[MAXHOSTNAMELEN];
struct addrinfo *f_addr;
getutentries(NULL, &ep);
if (ep == NULL) {
- logerror(_PATH_UTMP);
+ logerror("getutentries");
reenter = 0;
return;
}
for (i = 0; i < MAXUNAMES && *p; i++) {
for (q = p; *q && *q != ','; )
q++;
- strncpy(f->f_un.f_uname[i], p, UT_NAMESIZE);
- if ((q - p) > UT_NAMESIZE)
- f->f_un.f_uname[i][UT_NAMESIZE] = '\0';
+ strncpy(f->f_un.f_uname[i], p, 32);
+ if ((q - p) > 32)
+ f->f_un.f_uname[i][32] = '\0';
else
f->f_un.f_uname[i][q - p] = '\0';
while (*q == ',' || *q == ' ')