summaryrefslogtreecommitdiffstats
path: root/usr.sbin/identd
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-04-23 21:18:56 +0000
committersthen <sthen@openbsd.org>2013-04-23 21:18:56 +0000
commit6b9316d1673c52cce36c2ce31b4b227bf581ed9d (patch)
tree6fcfab4c6267245d81642f9a14086e9ab277898f /usr.sbin/identd
parentDo a PC-relative relocation for _map rather than going through (diff)
downloadwireguard-openbsd-6b9316d1673c52cce36c2ce31b4b227bf581ed9d.tar.xz
wireguard-openbsd-6b9316d1673c52cce36c2ce31b4b227bf581ed9d.zip
support src/libexec/identd's -e option in src/usr.sbin/identd, ok dlg@
Diffstat (limited to 'usr.sbin/identd')
-rw-r--r--usr.sbin/identd/identd.812
-rw-r--r--usr.sbin/identd/identd.c19
2 files changed, 22 insertions, 9 deletions
diff --git a/usr.sbin/identd/identd.8 b/usr.sbin/identd/identd.8
index 477e2e26679..2bde9209c09 100644
--- a/usr.sbin/identd/identd.8
+++ b/usr.sbin/identd/identd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: identd.8,v 1.8 2013/04/23 05:43:04 dlg Exp $
+.\" $OpenBSD: identd.8,v 1.9 2013/04/23 21:18:56 sthen Exp $
.\"
.\" Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
.\"
@@ -22,7 +22,7 @@
.Nd Identification Protocol daemon
.Sh SYNOPSIS
.Nm
-.Op Fl 46dNn
+.Op Fl 46deNn
.Op Fl l Ar address
.Op Fl t Ar timeout
.Sh DESCRIPTION
@@ -49,6 +49,14 @@ Do not daemonize.
If this option is specified,
.Nm
will run in the foreground and log to stderr.
+.It Fl e
+Always return
+.Dq UNKNOWN-ERROR
+instead of the
+.Dq NO-USER
+or
+.Dq INVALID-PORT
+errors.
.It Fl l Ar address
Listen on the specified address.
By default
diff --git a/usr.sbin/identd/identd.c b/usr.sbin/identd/identd.c
index 3a82caaed38..7bf8563adb0 100644
--- a/usr.sbin/identd/identd.c
+++ b/usr.sbin/identd/identd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.c,v 1.16 2013/04/23 10:33:06 dlg Exp $ */
+/* $OpenBSD: identd.c,v 1.17 2013/04/23 21:18:57 sthen Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -178,7 +178,7 @@ __dead void
usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-46dNn] [-l address] [-t timeout]\n",
+ fprintf(stderr, "usage: %s [-46deNn] [-l address] [-t timeout]\n",
__progname);
exit(1);
}
@@ -187,6 +187,7 @@ struct timeval timeout = { TIMEOUT_DEFAULT, 0 };
int debug = 0;
int noident = 0;
int on = 1;
+int unknown_err = 0;
int (*parent_uprintf)(struct ident_resolver *, struct passwd *) =
parent_username;
@@ -217,7 +218,7 @@ main(int argc, char *argv[])
pid_t parent;
int sibling;
- while ((c = getopt(argc, argv, "46dl:Nnp:t:")) != -1) {
+ while ((c = getopt(argc, argv, "46del:Nnp:t:")) != -1) {
switch (c) {
case '4':
family = AF_INET;
@@ -228,6 +229,9 @@ main(int argc, char *argv[])
case 'd':
debug = 1;
break;
+ case 'e':
+ unknown_err = 1;
+ break;
case 'l':
addr = optarg;
break;
@@ -508,8 +512,9 @@ child_rd(int fd, short events, void *arg)
c->server.port, c->client.port, reply.buf);
break;
case E_NOUSER:
- n = asprintf(&c->buf, "%u , %u : ERROR : NO-USER\r\n",
- c->server.port, c->client.port);
+ n = asprintf(&c->buf, "%u , %u : ERROR : %s\r\n",
+ c->server.port, c->client.port,
+ unknown_err ? "UNKNOWN-ERROR" : "NO-USER");
break;
case E_UNKNOWN:
n = asprintf(&c->buf, "%u , %u : ERROR : UNKNOWN-ERROR\r\n",
@@ -715,7 +720,7 @@ identd_request(int fd, short events, void *arg)
struct ident_client *c = arg;
char buf[64];
ssize_t n, i;
- char *errstr = "INVALID-PORT";
+ char *errstr = unknown_err ? "UNKNOWN-ERROR" : "INVALID-PORT";
n = read(fd, buf, sizeof(buf));
switch (n) {
@@ -753,7 +758,7 @@ identd_request(int fd, short events, void *arg)
goto error;
if (fetchuid(c) == -1) {
- errstr = "NO-USER";
+ errstr = unknown_err ? "UNKNOWN-ERROR" : "NO-USER";
goto error;
}