+2001-02-06 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+
+ * Released as version 1.9.
+
+ * ywho.c: Killed a Y2K bug. Lots of cosmetic changes.
+ (readutmp): Better formatting of tty names.
+
+ * nwho.c, nwhod.c, net.h: Pass longer tty names. Unfortunately
+ this required a change of packet format, hence addition of magic
+ numbers at the start of the packet.
+
Sun Mar 28 22:39:37 1999 Martin Mares <mj@albireo.ucw.cz>
* ywho.c: Miscellaneous fixes based on bug reports and patch
# Makefile for the ywho toolkit
-CFLAGS=-O2 -m486 -fomit-frame-pointer -Wall -Wno-parentheses -malign-loops=0 -malign-jumps=0 -malign-functions=2
+CFLAGS=-O2 -Wall -Wno-parentheses
LDFLAGS=-s
ROOT=/
REL=ywho-1.9
+ywho (1.9-2) unstable; urgency=low
+
+ * Synced with master CVS.
+
+ -- Martin Mares <mj@atrey.karlin.mff.cuni.cz> Tue, 6 Feb 2001 21:33:21 +0100
+
+ywho (1.9-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Martin Mares <mj@atrey.karlin.mff.cuni.cz> Tue, 6 Feb 2001 21:21:35 +0100
+
ywho (1.0) unstable; urgency=low
* First released version.
/*
* The Remote User Info Distribution Protocol
*
- * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * (c) 1997--2001 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU General Public License. See file COPYING in any of the GNU packages.
struct userinfo {
char name[10];
- char con[4];
+ char con[8];
char mesg_y;
char pad;
__u32 login_time;
};
struct rywho_pkt {
+ __u32 magic; /* Guard against ancient nwho versions */
__u32 local_time;
__u32 server_time; /* Reserved for use by the server */
__u32 num_users;
struct userinfo users[MAX_USERS];
};
-#define YWHO_SPOOL_DIR "/var/spool/nwho"
+#define NWHO_SPOOL_DIR "/var/spool/nwho"
+#define NWHO_MAGIC 0x21913332
#define DEFAULT_SEND_TIME 30
#define DEFAULT_PRUNE_TIME 30
/*
- * The Remote User Information Lister 1.8
+ * The Remote User Information Lister 1.9
*
- * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * (c) 1997--2001 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU General Public License. See file COPYING in any of the GNU packages.
for(u=0; u<m; u++)
{
i = &p->users[u];
- printf("%-8.8s %-3s %c %-16s ", i->name, i->con, (i->mesg_y ? ' ' : '-'), name);
+ printf("%-8.8s %-7s %c %-16s ", i->name, i->con, (i->mesg_y ? ' ' : '-'), name);
puttime(ntohl(i->login_time));
putchar(' ');
puttime(ntohl(i->idle_time));
int fd, r;
int is = 0;
- if (chdir(YWHO_SPOOL_DIR) < 0)
+ if (chdir(NWHO_SPOOL_DIR) < 0)
{
- fprintf(stderr, "chdir(" YWHO_SPOOL_DIR "): %m\n");
+ fprintf(stderr, "chdir(" NWHO_SPOOL_DIR "): %m\n");
exit(1);
}
d = opendir(".");
r = read(fd, &pkt, sizeof(pkt));
close(fd);
if (r < sizeof(struct rywho_pkt) - MAX_USERS*sizeof(struct userinfo)
+ || pkt.magic != htonl(NWHO_MAGIC)
|| r != sizeof(struct rywho_pkt) - (MAX_USERS - ntohl(pkt.num_users))*sizeof(struct userinfo))
{
fprintf(stderr, "%s: Malformed record\n", e->d_name);
return 1;
}
if (!is_uptime)
- puts("Name Li M Where LogT IdleT");
+ puts("Name Li M Where LogT IdleT");
scan();
return 0;
}
/*
- * The Remote User Information Daemon 1.8
+ * The Remote User Information Daemon 1.9
*
- * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * (c) 1997--2001 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU General Public License. See file COPYING in any of the GNU packages.
name[9] = 0;
strcpy(h->name, name);
h->login_time = htonl(now - u->ut_time);
- if (u->ut_id[0])
- {
- h->con[0] = u->ut_id[0];
- h->con[1] = u->ut_id[1];
- h->con[2] = 0;
- }
- else
- {
- char *z = u->ut_line;
- if (!strncmp(z, "tty", 3))
- z += 3;
- sprintf(h->con, "%.3s", z);
- }
+ sprintf(h->con, "%.7s", u->ut_line);
sprintf(device, "/dev/%s", u->ut_line);
if (stat(device, &st) < 0)
{
make_pkt(struct rywho_pkt *pkt)
{
bzero(pkt, sizeof(pkt));
+ pkt->magic = htonl(NWHO_MAGIC);
pkt->local_time = htonl(now);
scan_utmp(pkt, now);
scan_load(pkt);
return;
}
+ if (pkt.magic != htonl(NWHO_MAGIC))
+ {
+ syslog(LOG_WARNING, "Received ancient nwho packet from %s", inet_ntoa(sa.sin_addr));
+ return;
+ }
+
for(e=first_host; e; e=e->next)
if (e->addr == sa.sin_addr.s_addr)
break;
static struct sigaction sigact;
net_init(NULL);
- if (chdir(YWHO_SPOOL_DIR) < 0)
- die("chdir(" YWHO_SPOOL_DIR "): %m");
+ if (chdir(NWHO_SPOOL_DIR) < 0)
+ die("chdir(" NWHO_SPOOL_DIR "): %m");
cleanup();
bzero(&sigact, sizeof(sigact));
sigact.sa_handler = tick;