Subject: bin/1848: [dM] identd prepends a space to usernames
To: None <gnats-bugs@gnats.netbsd.org>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 12/18/1995 12:47:21
>Number:         1848
>Category:       bin
>Synopsis:       [dM] identd prepends a space to usernames
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 18 13:05:00 1995
>Last-Modified:
>Originator:     der Mouse
>Organization:
Dis-
>Release:        -current sup as of last successful one (Dec 11th?)
>Environment:
	Any (noticed on SPARC IPC)
>Description:
	/usr/libexec/identd gratuitously prepends a space to all
	usernames returned.  (This is a common bug, but it is still a
	bug; RFC1413 makes it quite clear that in a USERID response,
	everything after the third colon is part of the username.
	While it does contain an example appearing to contradict this,
	the text (more authoritative than the examples) it is quite
	clear.  Page 4, near the top, says
	     The identifier is an unformatted octet string - - all
	     octets are permissible EXCEPT octal 000 (NUL), 012 (LF)
	     and 015 (CR).  N.B. - space characters (040) following the
	     colon separator ARE part of the identifier string and
	     may not be ignored. A response string is still
	     terminated normally by a CR/LF.  N.B. A string may be
	     printable, but is not *necessarily* printable.
	The "Notes on Syntax" section, item 1, reiterates this point.
>How-To-Repeat:
	Do a port-113 lookup on a NetBSD box.  Notice the space between
	the third colon in the response and the username.
>Fix:
	I have sent a similar patch (though I think it fixed only the
	username case, not either of the numeric cases) to Peter
	Eriksson; I believe it's made it into the current code up for
	ftp from the Swedish site.
+++ NEW/libexec/identd/parse.c  Thu Jan  1 00:00:00 1970
@@ -355,7 +355,7 @@
        syslog(LOG_WARNING, "getpwuid() could not map uid (%d) to name",
               uid);

-      printf("%d , %d : USERID : OTHER%s%s : %d\r\n",
+      printf("%d , %d : USERID : OTHER%s%s :%d\r\n",
             lport, fport,
             charset_name ? " , " : "",
             charset_name ? charset_name : "",
@@ -384,13 +384,13 @@
     }

     if (number_flag)
-      printf("%d , %d : USERID : OTHER%s%s : %d\r\n",
+      printf("%d , %d : USERID : OTHER%s%s :%d\r\n",
             lport, fport,
             charset_name ? " , " : "",
             charset_name ? charset_name : "",
             uid);
     else
-      printf("%d , %d : USERID : %s%s%s : %s\r\n",
+      printf("%d , %d : USERID : %s%s%s :%s\r\n",
             lport, fport,
             other_flag ? "OTHER" : "UNIX",
             charset_name ? " , " : "",

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
>Audit-Trail:
>Unformatted: