identd.c 2.6 2012-05-31 20:37:27 UTC Author: Tomi Ollila -- too ät iki fi Created: Sat Nov 25 15:34:07 EET 1995 too Last modified: Thu 31 May 2012 23:37:27 EEST too This program is standalone 'fake' ident daemon. This program does not fork() but is configured to handle up to 20 concurrent connections. Since one connection should not last long, if all 20 connections are in use, the next connection will close the oldest connection data has been read. This way this program is not very vulnerable to so called `denial of service' attack, thus making this ideal "identd" to be used in a firewall, IP masquerading hosts etc. Program takes one (or many) arguments, which if exist, determines the `user' name(s) that is returned for successful ident query. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. HISTORY Version 2.6 2012-05-31 20:37:27 UTC Applied patches from the wl500g project, including IPv6 support, with minor tweaks (patches provided by Daniel Gimpelevich. Thanks). Version 2.5 $Id: identd.c 862 2006-05-18 14:16:34Z too $ Minor build and readme updates. Version 2.4 identd.c 568 2005-09-07 20:18:39Z too More compilation warnings options set -- iov.base being non-const gives warnings that are hard to avoid... Version 2.3 identd.c 564 2005-09-06 19:15:20Z too Randident code from Matthias Jung tuned in. Version 2.2 identd.c 12 2004-09-08 21:46:54Z too Fixed getservbyname() to look port for "auth" instead of "identd" port. This "bug" also revealed port number byte order handling bug, which was fixed. Now this file is stored in subversion repository -- I entered $ svn propset svn:keywords Id identd.c -- let's see how it works... ... ``svn propset svn:keywords 'Id Rev' identd.c'' !!! Revision 2.1 2004/01/15 18:14:42 too Made BIND_ADDRESS definable (in compiler command line). Added some typecasts (using checked_cast() macro). Thanks to Jeffrey D. Wheelhouse for his content. Revision 2.0 2003/05/05 15:21:01 too Major update. Removed fdprintf(); replaced with use of writev() and newly added outputstrings(). Removed many now obsolete defines and converted one to constant character string. Added one assert() (and left room for more). Did some relativily small other adjustments. Revision 1.7 2002/09/29 07:50:20 too No longer chops up to IDSTR_MAX chars, but uses "%.*s" to limit length; now works also when XXXMULTI defined. Back-hacked self-compilable trick, with more tricks to avoid compiler warnings. Removed own define of FD_SETSIZE altogether; systems has it small to begin with. Line '415' (or whatever that is now) fixed. () -> (void) in func def. Some fine-tuning. Thanks to Cristian for his patches. Revision 1.6.1 2002-09-28 12:30:29 +0200 cii + added defines for IDSTR_MAX, IDENT_SUBSTR, IDSTR_BUFLEN and IDSTR_MAX (length limit on the id-string) + program arg 1 chopped after IDSTR_MAX characters (when applicable); reason is: - if the program is called with a relativelly long string as arg 1 (tested with about 400 chars), a segfault occurs due to an internal buffer overflow (buffer space reserved for id-string is 128 chars, but never verified) - it may trigger buffer overflows in clients + put a proper comment at the top of the file + sorted out FD_SETSIZE (on Linux it's already defined) - moved it down below all the includes + added time.h include + added some short comments + conditionals '{', '}' enclosed + variable index -> idx in function closeOldest (killed a warning) + splitted multiple statements on a singel line + splitted long lines + prototypes ending in '()' -> '(void)'; changed by protoize + corrected most warnings, but "function declaration isn't a prototype" which still occurs on line: 415 + added IDENT_PORT + added IDENT_SUBSTR Revision 1.6 2002/07/31 16:25:20 too Now works when started as root (in Linux). Stupid me, tested only starting as an ordinary loser. Revision 1.5 2002/07/29 14:02:42 too Added possibility to have multible reply users, one (pseudo)randomly chosen at each time. Revision 1.4 2001/02/09 08:45:42 too Now GID is also changed to nobody/nogroup. Revision 1.3 2000/06/07 05:55:44 too Fixed some Solaris compilation "bugs". Changed LOG_PERROR to LOG_CONS Revision 1.2 1999/07/30 04:08:42 too Added printing version string (and exit) with `-V' command line option. Revision 1.1 1999/04/21 17:23:20 too - Writes process id to /var/run/identd.pid. - Changes (effective) user id to `nobody' after initialization (binding socket etc.). - Ignores some signals (HUP and PIPE). - Handles some signals that aborts by default. The handler function tries to get rid of the pidfile. Revision 0.9b 1999/04/15 20:45:12 too Not so much spaghetti anymore. Added documentation and more replies. Revision 0.9 1999/04/12 18:30:00 too Version for unix systems. Standalone, supports 20 concurrent connections. The code is quite a spaghetti. But that does not matter.