summaryrefslogtreecommitdiff
path: root/libexec/talkd
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-07-19 03:09:42 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-07-19 03:09:42 +0000
commit36e99fda62f72596d70e71abd7664b85c83b252c (patch)
treec5d9e8f4a7e988a02c6bcd5d504e07b0f3433bc0 /libexec/talkd
parentbf9b1af160aa9959c54c2726dd88821cd8734e88 (diff)
Patch to catch non-printables in the announce string
(ala the 'flash' hack) from FreeBSD (cleanup of patch from Dima Ruban <dima@demos.su>). Also fixes a syslog() message--we use recvfrom now.
Diffstat (limited to 'libexec/talkd')
-rw-r--r--libexec/talkd/process.c12
-rw-r--r--libexec/talkd/talkd.c6
2 files changed, 13 insertions, 5 deletions
diff --git a/libexec/talkd/process.c b/libexec/talkd/process.c
index 2539be71e1a..e80e525bac5 100644
--- a/libexec/talkd/process.c
+++ b/libexec/talkd/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.7 1996/07/02 04:11:15 deraadt Exp $ */
+/* $OpenBSD: process.c,v 1.8 1996/07/19 03:09:41 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)process.c 5.10 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: process.c,v 1.7 1996/07/02 04:11:15 deraadt Exp $";
+static char rcsid[] = "$Id: process.c,v 1.8 1996/07/19 03:09:41 millert Exp $";
#endif /* not lint */
/*
@@ -56,6 +56,7 @@ static char rcsid[] = "$Id: process.c,v 1.7 1996/07/02 04:11:15 deraadt Exp $";
#include <syslog.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include <paths.h>
#include "talkd.h"
@@ -67,6 +68,7 @@ process_request(mp, rp)
register CTL_RESPONSE *rp;
{
register CTL_MSG *ptr;
+ char *s;
rp->vers = TALK_VERSION;
rp->type = mp->type;
@@ -89,6 +91,12 @@ process_request(mp, rp)
rp->answer = BADCTLADDR;
return;
}
+ for (s = mp->l_name; *s; s++)
+ if (!isprint(*s)) {
+ syslog(LOG_NOTICE, "Illegal user name. Aborting");
+ rp->answer = FAILED;
+ return;
+ }
if (memcmp(&satosin(&rp->addr)->sin_addr,
&satosin(&mp->ctl_addr)->sin_addr,
sizeof(struct in_addr))) {
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index b99bcb2b212..e5d4045ef7d 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.c,v 1.5 1996/07/18 00:18:54 deraadt Exp $ */
+/* $OpenBSD: talkd.c,v 1.6 1996/07/19 03:09:41 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)talkd.c 5.8 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: talkd.c,v 1.5 1996/07/18 00:18:54 deraadt Exp $";
+static char rcsid[] = "$Id: talkd.c,v 1.6 1996/07/19 03:09:41 millert Exp $";
#endif /* not lint */
/*
@@ -107,7 +107,7 @@ main(argc, argv)
(struct sockaddr *)&response.addr, &len);
if (cc != sizeof (request)) {
if (cc < 0 && errno != EINTR)
- syslog(LOG_WARNING, "recv: %m");
+ syslog(LOG_WARNING, "recvfrom: %m");
continue;
}
lastmsgtime = time(0);