summaryrefslogtreecommitdiffstats
path: root/usr.sbin/identd
diff options
context:
space:
mode:
authorokan <okan@openbsd.org>2013-07-17 15:38:47 +0000
committerokan <okan@openbsd.org>2013-07-17 15:38:47 +0000
commit4cc355a66b0c8b31fa554f01d9b77ac30d59f757 (patch)
tree06f3e08f45893f75741240c7c3d2dd7d3756b65f /usr.sbin/identd
parentmy PowerBook5,8 currently does not support asms, but the PowerBook5,6 does, as found in dmesglog (diff)
downloadwireguard-openbsd-4cc355a66b0c8b31fa554f01d9b77ac30d59f757.tar.xz
wireguard-openbsd-4cc355a66b0c8b31fa554f01d9b77ac30d59f757.zip
implement -H, which hides existing and non-existent users, as well as
implying -h. feedback and ok from jmc@ and dlg@
Diffstat (limited to 'usr.sbin/identd')
-rw-r--r--usr.sbin/identd/identd.810
-rw-r--r--usr.sbin/identd/identd.c21
2 files changed, 21 insertions, 10 deletions
diff --git a/usr.sbin/identd/identd.8 b/usr.sbin/identd/identd.8
index 84d0559ba6c..f02828ef28b 100644
--- a/usr.sbin/identd/identd.8
+++ b/usr.sbin/identd/identd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: identd.8,v 1.10 2013/04/29 04:17:58 dlg Exp $
+.\" $OpenBSD: identd.8,v 1.11 2013/07/17 15:38:47 okan Exp $
.\"
.\" Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 29 2013 $
+.Dd $Mdocdate: July 17 2013 $
.Dt IDENTD 8
.Os
.Sh NAME
@@ -22,7 +22,7 @@
.Nd Identification Protocol daemon
.Sh SYNOPSIS
.Nm
-.Op Fl 46dehNn
+.Op Fl 46deHhNn
.Op Fl l Ar address
.Op Fl t Ar timeout
.Sh DESCRIPTION
@@ -57,6 +57,10 @@ instead of the
or
.Dq INVALID-PORT
errors.
+.It Fl H
+Hide information about existing and non-existent users.
+This flag implies
+.Fl h .
.It Fl h
Hide the actual information about the user by providing an opaque
token instead.
diff --git a/usr.sbin/identd/identd.c b/usr.sbin/identd/identd.c
index 64bae013d5b..3f3e452d4d8 100644
--- a/usr.sbin/identd/identd.c
+++ b/usr.sbin/identd/identd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: identd.c,v 1.19 2013/04/29 06:32:11 jmc Exp $ */
+/* $OpenBSD: identd.c,v 1.20 2013/07/17 15:38:48 okan Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -180,7 +180,7 @@ __dead void
usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-46dehNn] [-l address] [-t timeout]\n",
+ fprintf(stderr, "usage: %s [-46deHhNn] [-l address] [-t timeout]\n",
__progname);
exit(1);
}
@@ -190,6 +190,7 @@ int debug = 0;
int noident = 0;
int on = 1;
int unknown_err = 0;
+int hideall = 0;
int (*parent_uprintf)(struct ident_resolver *, struct passwd *) =
parent_username;
@@ -220,7 +221,7 @@ main(int argc, char *argv[])
pid_t parent;
int sibling;
- while ((c = getopt(argc, argv, "46dehl:Nnp:t:")) != -1) {
+ while ((c = getopt(argc, argv, "46deHhl:Nnp:t:")) != -1) {
switch (c) {
case '4':
family = AF_INET;
@@ -234,6 +235,9 @@ main(int argc, char *argv[])
case 'e':
unknown_err = 1;
break;
+ case 'H':
+ hideall = 1;
+ /* FALLTHROUGH */
case 'h':
parent_uprintf = parent_token;
break;
@@ -375,12 +379,12 @@ parent_rd(int fd, short events, void *arg)
lerr(1, "resolver alloc");
pw = getpwuid(uid);
- if (pw == NULL) {
+ if (pw == NULL && !hideall) {
r->error = E_NOUSER;
goto done;
}
- if (noident) {
+ if (noident && !hideall) {
parent_noident(r, pw);
if (r->error != E_NONE)
goto done;
@@ -420,8 +424,11 @@ parent_token(struct ident_resolver *r, struct passwd *pw)
token = gentoken();
rv = asprintf(&r->buf, "%s", token);
if (rv != -1) {
- lnotice("token %s == uid %u (%s)", token,
- (u_int)pw->pw_uid, pw->pw_name);
+ if (pw)
+ lnotice("token %s == uid %u (%s)", token,
+ (u_int)pw->pw_uid, pw->pw_name);
+ else
+ lnotice("token %s == NO USER", token);
}
return (rv);