Bug in authprogs/ident.c

Gea-Suan Lin gslin at ccca.nctu.edu.tw
Fri Feb 17 10:42:13 UTC 2006


in authprogs/ident.c, SA_LEN(res->local) == sizeof(struct sockaddr)
because res->local comes from stdin, not AF_INET. That's the reason of
the following error msg:

Feb 17 18:10:00 csnews nnrpd[10730]: csbsd1.cs.nctu.edu.tw auth_err ident: cannot bind socket: Invalid argument

After patching authprogs/ident.c (sorry we don't have IPv6 environment),
ident(8) works fine.

Here is patch:

diff -ruN ident.c.orig ident.c
--- ident.c.orig        Fri Feb 17 18:28:12 2006
+++ ident.c     Fri Feb 17 18:26:02 2006
@@ -17,6 +17,8 @@
 
 #define IDENT_PORT 113
 
+#define        CSPATCH
+
 static void out(int sig UNUSED) {
     exit(1);
 }
@@ -101,9 +103,17 @@
     }
     if (sock < 0)
         sysdie("cannot create socket");
+#ifdef CSPATCH
+    if (bind(sock, res->local, sizeof(struct sockaddr_in)) < 0)
+#else
     if (bind(sock, res->local, SA_LEN(res->local)) < 0)
+#endif
         sysdie("cannot bind socket");
+#ifdef CSPATCH
+    if (connect(sock, res->client, sizeof(struct sockaddr_in)) < 0) {
+#else
     if (connect(sock, res->client, SA_LEN(res->local)) < 0) {
+#endif
         if (errno != ECONNREFUSED)
             sysdie("cannot connect to ident server");
         else

-- 
* Gea-Suan Lin  (public key: Using https://keyserver.pgp.com/ to search)
* If you cannot convince them, confuse them.           -- Harry S Truman


More information about the inn-workers mailing list