Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/identd Add a -L (lie brazenly) flag, to demonstrate ...



details:   https://anonhg.NetBSD.org/src/rev/368ece34d490
branches:  trunk
changeset: 473041:368ece34d490
user:      jwise <jwise%NetBSD.org@localhost>
date:      Tue May 18 04:49:41 1999 +0000

description:
Add a -L (lie brazenly) flag, to demonstrate the perils of proof by
assertion^W^W^W^W^W^W^Wprovide admins with a means of providing a
standard host-wide identd response.  From the man page:

The -L<user name> option instructs identd to lie  brazenly
about  the  identity  of the user in question.  You didn't
really intend to trust my assertion about who I  was  any-
way, right?
This  flag  provides  a way for a site to support services
requiring the ident protocol while  providing  a  standard
answer to all ident queries. All queries to identd will
respond with a host type of  `OTHER'  and  a  username  of
<user name>.

diffstat:

 libexec/identd/Makefile |   5 ++++-
 libexec/identd/identd.8 |  15 ++++++++++++++-
 libexec/identd/identd.c |  16 +++++++++++++++-
 libexec/identd/identd.h |   4 +++-
 libexec/identd/parse.c  |  15 ++++++++++++++-
 5 files changed, 50 insertions(+), 5 deletions(-)

diffs (151 lines):

diff -r ba140a559723 -r 368ece34d490 libexec/identd/Makefile
--- a/libexec/identd/Makefile   Tue May 18 03:30:02 1999 +0000
+++ b/libexec/identd/Makefile   Tue May 18 04:49:41 1999 +0000
@@ -1,9 +1,12 @@
-#      $NetBSD: Makefile,v 1.6 1998/07/15 07:31:55 msaitoh Exp $
+#      $NetBSD: Makefile,v 1.7 1999/05/18 04:49:41 jwise Exp $
 
 PROG=  identd
 MAN=   identd.8 
 
 CPPFLAGS+= -DINCLUDE_EXTENSIONS -DSTRONG_LOG -DALLOW_FORMAT
+.ifdef DEFAULT_LIE_USER
+CPPFLAGS+= -DDEFAULT_LIE_USER=\"${DEFAULT_LIE_USER}\"
+.endif
 LDADD+=        -lutil -lkvm
 DPADD+=        ${LIBUTIL} ${LIBKVM}
 
diff -r ba140a559723 -r 368ece34d490 libexec/identd/identd.8
--- a/libexec/identd/identd.8   Tue May 18 03:30:02 1999 +0000
+++ b/libexec/identd/identd.8   Tue May 18 04:49:41 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: identd.8,v 1.7 1998/07/15 07:31:56 msaitoh Exp $
+.\"    $NetBSD: identd.8,v 1.8 1999/05/18 04:49:41 jwise Exp $
 .\"
 .\" @(#)identd.8 1.9 92/02/11 Lysator
 .\" Copyright (c) 1992 Peter Eriksson, Lysator, Linkoping University.
@@ -25,6 +25,7 @@
 .RB [ \-N ]
 .RB [ \-d ]
 .RB [ \-F<format> ]
+.RB [ \-L<user name> ]
 .RB [ "kernelfile" [ "kmemfile" ] ]
 .SH DESCRIPTION
 .IX "identd daemon" "" \fLidentd\fP daemon"
@@ -279,6 +280,18 @@
 .in -.5i
 .fi
 .PP
+The
+.B \-L<user name>
+option instructs
+.B identd
+to lie brazenly about the identity of the user in question.  You didn't
+.I really
+intend to trust my assertion about who I was anyway, right?
+.br
+This flag provides a way for a site to support services requiring the ident
+protocol while providing a standard answer to all ident queries.  All queries
+to identd will respond with a host type of `OTHER' and a username of <user name>.
+.PP
 .B kernelfile
 defaults to the normally running kernel file.
 .PP
diff -r ba140a559723 -r 368ece34d490 libexec/identd/identd.c
--- a/libexec/identd/identd.c   Tue May 18 03:30:02 1999 +0000
+++ b/libexec/identd/identd.c   Tue May 18 04:49:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identd.c,v 1.9 1998/07/15 07:31:56 msaitoh Exp $       */
+/*     $NetBSD: identd.c,v 1.10 1999/05/18 04:49:41 jwise Exp $        */
 
 /*
 ** identd.c                       A TCP/IP link identification protocol server
@@ -107,6 +107,7 @@
 int unknown_flag = 0;
 int noident_flag = 0;
 int crypto_flag  = 0;
+int liar_flag    = 0;
 
 int lport = 0;
 int fport = 0;
@@ -114,6 +115,7 @@
 char *charset_name = (char *) NULL;
 char *indirect_host = (char *) NULL;
 char *indirect_password = (char *) NULL;
+char *lie_string = (char *) NULL;
 
 #ifdef ALLOW_FORMAT
     int format_flag = 0;
@@ -477,6 +479,18 @@
            break;
 #endif
 
+         case 'L':     /* lie brazenly */
+           liar_flag = 1;
+           if (*(argv[i]+2) != '\0')
+               lie_string = argv[i]+2;
+           else
+#ifdef DEFAULT_LIE_USER
+               lie_string = DEFAULT_LIE_USER;
+#else
+               ERROR("-L specified with no user name");
+#endif
+           break;
+
          default:
            ERROR1("Bad option %s", argv[i]);
            break;
diff -r ba140a559723 -r 368ece34d490 libexec/identd/identd.h
--- a/libexec/identd/identd.h   Tue May 18 03:30:02 1999 +0000
+++ b/libexec/identd/identd.h   Tue May 18 04:49:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identd.h,v 1.5 1998/07/15 07:31:56 msaitoh Exp $       */
+/*     $NetBSD: identd.h,v 1.6 1999/05/18 04:49:41 jwise Exp $ */
 
 /*
 ** identd.h                 Common variables for the Pidentd daemon
@@ -15,6 +15,7 @@
 #define __IDENTD_H__
 
 extern char version[];
+extern char *lie_string;
 
 extern char *path_unix;
 extern char *path_kmem;
@@ -27,6 +28,7 @@
 extern int unknown_flag;
 extern int noident_flag;
 extern int crypto_flag;
+extern int liar_flag;
 
 extern char *charset_name;
 extern char *indirect_host;
diff -r ba140a559723 -r 368ece34d490 libexec/identd/parse.c
--- a/libexec/identd/parse.c    Tue May 18 03:30:02 1999 +0000
+++ b/libexec/identd/parse.c    Tue May 18 04:49:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.11 1998/07/27 15:11:06 mycroft Exp $       */
+/*     $NetBSD: parse.c,v 1.12 1999/05/18 04:49:41 jwise Exp $ */
 
 /*
 ** parse.c                         This file contains the protocol parser
@@ -224,6 +224,19 @@
     /* Read query from client */
     rcode = fscanf(fp, " %d , %d", &lport, &fport);
 
+    if (liar_flag)
+    {
+      if (syslog_flag)
+        syslog(LOG_NOTICE, "User %s requested a user for host %s: %d, %d, and I lied",
+               pwp->pw_name,
+               gethost(faddr),
+               lport, fport);
+
+      printf("%d , %d : USER-ID : OTHER :%s\r\n",
+           lport, fport, lie_string);
+      continue;
+    }
+
 #ifdef INCLUDE_EXTENSIONS
     /*
     ** Do additional parsing in case of extended request



Home | Main Index | Thread Index | Old Index