--- nullidentd-1.0.orig/Makefile +++ nullidentd-1.0/Makefile @@ -1,5 +1,9 @@ -INSTALL=/usr/local/sbin +# Edited for Debian GNU/Linux. +DESTDIR= + +INSTALL=$(DESTDIR)/usr/sbin + nullidentd: nullidentd.c version.h gcc -O2 -o nullidentd nullidentd.c @@ -21,9 +25,10 @@ rm -f .version version.h nullidentd install: nullidentd - rm -f $(INSTALL)/nullidentd + #rm -f $(INSTALL)/nullidentd cp nullidentd $(INSTALL)/nullidentd chown root.root $(INSTALL)/nullidentd - chmod a-rw $(INSTALL)/nullidentd - chmod a+x $(INSTALL)/nullidentd + #chmod a-rw $(INSTALL)/nullidentd + #chmod a+x $(INSTALL)/nullidentd + chmod 0755 $(INSTALL)/nullidentd --- nullidentd-1.0.orig/nullidentd.c +++ nullidentd-1.0/nullidentd.c @@ -7,9 +7,11 @@ */ #include +#include #include #include #include +#include #include "version.h" @@ -18,6 +20,7 @@ #define MAX_RESPONSE 200 #define MAX_REQUEST 100 #define MAX_USERID 50 +#define MAX_RANDOMID 8 void usage() { @@ -46,7 +49,6 @@ int read_request( int fd, char *request, int maxlen ) { - int retval; char c; int bytesread = 0; @@ -76,6 +78,22 @@ return 1; } +char *random_userid( void ) +{ + static char buf[MAX_RANDOMID+1]; + size_t i; + static const char valid[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + for (i = 0 ; i < MAX_RANDOMID ; i++) + buf[i] = valid[rand() % (sizeof(valid) - 1)]; + + buf[i] = '\0'; + + return buf; +} + + void session_timeout( int foo ) { exit( 0 ); @@ -84,12 +102,12 @@ int main( int argc, const char *argv[] ) { const char * userid = "foobar"; - char c; int infd; int outfd; int response_len; char response[MAX_RESPONSE]; char request[MAX_REQUEST]; + int gen_random = 0; if( getgid() == 0 ) { fprintf( stderr, "Group id is root, exitting.\n" ); @@ -114,6 +132,10 @@ } } + if (strcmp(userid, "RANDOM") == 0) { + gen_random = 1; + } + infd = fileno( stdin ); outfd = fileno( stdout ); @@ -121,6 +143,8 @@ signal( SIGALRM, session_timeout ); alarm( SESSION_TIMEOUT ); + srand(getpid() ^ time(NULL)); + for( ;; ) { /* read the request */ if( !read_request( infd, request, MAX_REQUEST ) ) { @@ -128,6 +152,10 @@ goto done; } + if (gen_random) { + userid = random_userid(); + } + /* format the response */ response_len = snprintf( response, sizeof( response ), "%.20s : USERID : UNIX : %.20s\r\n", request, userid ); @@ -140,4 +168,3 @@ done: return 0; } - --- nullidentd-1.0.orig/debian/dirs +++ nullidentd-1.0/debian/dirs @@ -0,0 +1 @@ +usr/sbin --- nullidentd-1.0.orig/debian/docs +++ nullidentd-1.0/debian/docs @@ -0,0 +1 @@ +README --- nullidentd-1.0.orig/debian/control +++ nullidentd-1.0/debian/control @@ -0,0 +1,14 @@ +Source: nullidentd +Section: net +Priority: optional +Maintainer: John H. Robinson, IV +Build-Depends: debhelper +Standards-Version: 3.6.1 + +Package: nullidentd +Provides: ident-server +Architecture: any +Depends: ${shlibs:Depends}, netbase +Description: small, fast identd daemon + nullidentd is a small, fast and secure identd daemon. It returns a static + string for every query. --- nullidentd-1.0.orig/debian/nullidentd.8 +++ nullidentd-1.0/debian/nullidentd.8 @@ -0,0 +1,44 @@ +.\" +.TH "nullidentd" "8" "January 24, 2001" "" "" +.SH "NAME" +nullidentd \- a bare minimum identd server + +.SH "SYNOPSIS" +.B nullidentd +.RI [uid] +.br + +.SH "DESCRIPTION" +This manual page documents briefly the +.B nullidentd +command. This manual page was written for the Debian GNU/Linux distribution +because the original program does not have a manual page. +.PP +.B Nullidentd +is intended to be a bare minimum identd server, suitable for a firewall or IP +Masq/NAT gateway. + +.SH "OPTIONS" +.B nullidentd +takes only one optional argument, the username to answer with. +If this is omitted, +.B nullidentd +will reply with the username \*(lqfoobar\*(rq. +If the username is RANDOM, a random string is generated. + +.SH "USAGE" +.B nullidentd +is typically invoked from inetd. The following +is a typical inetd.conf example: +.br +.nh +auth stream tcp nowait nobody /usr/sbin/nullidentd nullidentd +.hy + +.SH "AUTHOR" +.B +nullidentd +is written by Brian Young +.PP +This manual page was written by John H. Robinson, IV , +for the Debian GNU/Linux system (but may be used by others). --- nullidentd-1.0.orig/debian/prerm +++ nullidentd-1.0/debian/prerm @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + update-inetd --pattern "/usr/sbin/nullidentd" --disable ident +fi + +#DEBHELPER# --- nullidentd-1.0.orig/debian/rules +++ nullidentd-1.0/debian/rules @@ -0,0 +1,77 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatability version to use. +export DH_COMPAT=1 + +build: build-stamp +build-stamp: + dh_testdir + + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp. + $(MAKE) install DESTDIR=`pwd`/debian/tmp + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install +# dh_testversion + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installemacsen +# dh_installpam +# dh_installinit + dh_installcron + dh_installmanpages + dh_installinfo +# dh_undocumented + dh_installchangelogs CHANGELOG + dh_link + dh_strip + dh_compress + dh_fixperms + # You may want to make some executables suid here. +# dh_suidregister +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- nullidentd-1.0.orig/debian/changelog +++ nullidentd-1.0/debian/changelog @@ -0,0 +1,40 @@ +nullidentd (1.0-3) unstable; urgency=low + + * Compiles -Wall -pedantic clean + * Random ID's are all eight characters long + * Many thanks to Petter Reinholdtsen and Marc Brockschmidt for their NMU's + + -- John H. Robinson, IV Tue, 17 Aug 2004 21:40:18 -0700 + +nullidentd (1.0-2.2) unstable; urgency=low + + * Non-maintainer upload. + * Add missing dependency on netbase. (Closes: #230641) + * Correct email address of upstream author. (Closes: #230644) + * Add support for returning random usernames. (Closes: #115204) + + -- Petter Reinholdtsen Thu, 5 Feb 2004 16:35:16 +0100 + +nullidentd (1.0-2.1) unstable; urgency=low + + * Non-maintainer upload. + * debian/{postinst,prerm,postrm}: Fixed update-inetd calls to leave user + config untouched. (Closes: #206253) + * debian/changelog: Removed Emacs user settings at end of file. + * debian/copyright: Removed boilerplate "(s)" to make lintian happy. + * debian/control: Bumped Standards-Version to 3.6.1 (no changes) + + -- Marc Brockschmidt Sun, 21 Dec 2003 23:49:31 +0100 + +nullidentd (1.0-2) unstable; urgency=low + + * Added Provides: ident-server (closes: Bug#95270) + + -- John H. Robinson, IV Sat, 28 Apr 2001 00:21:58 -0700 + +nullidentd (1.0-1) unstable; urgency=low + + * Initial Release. (closes: Bug#83333) + * Modified toplevel Makefile to support $(DESTDIR) + + -- John H. Robinson, IV Tue, 16 Jan 2001 20:21:00 -0800 --- nullidentd-1.0.orig/debian/postinst +++ nullidentd-1.0/debian/postinst @@ -0,0 +1,52 @@ +#! /bin/sh +# postinst script for nullidentd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see /usr/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + update-inetd --disable ident # don't destroy other's config + update-inetd --group INFO --add 'ident\t\tstream\ttcp\tnowait\tnobody\t/usr/sbin/nullidentd\tnullidentd' + update-inetd --pattern "/usr/sbin/nullidentd" --enable ident + + ;; + + + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- nullidentd-1.0.orig/debian/postrm +++ nullidentd-1.0/debian/postrm @@ -0,0 +1,28 @@ +#! /bin/sh +# postrm script for nullidentd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see /usr/doc/packaging-manual/ + +if [ "$1" = "purge" ]; then + update-inetd --remove "/usr/sbin/nullidentd" +fi + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + + --- nullidentd-1.0.orig/debian/copyright +++ nullidentd-1.0/debian/copyright @@ -0,0 +1,15 @@ +This package was debianized by John H. Robinson IV on +Tue, 16 Jan 2001 20:21:00 -0800. + +It was downloaded from http://www.tildeslash.org/nullidentd.html + +Upstream Author: Brian Young + +Copyright: + +Copyright 1999 Brian Young + +You are free to distribute this software under the terms of +the GNU General Public License. +On Debian systems, the complete text of the GNU General Public +License can be found in /usr/share/common-licenses/GPL file.