Subject: Re: New Identd
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 01/30/2004 19:03:24
In article <401A92C9.1040100@chello.nl>,
Peter Postma <peter.postma@chello.nl> wrote:
>Hello,
>
>I've written a new identd for NetBSD.
>It's for 1.6ZG or newer, because it uses a new sysctl method
>for looking up uid's.
>
>This identd has the following new features:
>
>- IPv6 support.
>- user ident files (to return user specified replies).
>- returning random tokens.
>- a 'fallback' username (for when the lookup fails), which might be 
>useful on NAT gateways.
>
>Here it is: http://www.nedbsd.nl/~ppostma/identd-20040130.tar.gz
>
>I've also done some work to add NAT forward/proxy support, but this is 
>not finished yet.
>If anyone is interested in this then please let me know and I'll send 
>you the source.

Looks nice! A few comments:

1. The current identd is public domain, yours has an advertising clause.
2. Passing char to isdigit() can lead to core-dumps; cast to unsigned char.
3. Further, use strtol() instead of atoi() so we can properly detect errors.
   Your case will treat 23foo as 23.
4. Style says while (); is nono, use while () continue;
5. You forgot to cast some functions to void [snprintf]
6. All functions in there and globals should be static.

christos