mirror of
https://github.com/SlackBuildsOrg/slackbuilds
synced 2024-09-28 15:21:00 +02:00
network/nullidentd: Added (small, fast identd daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
f63274a5c8
commit
c6ceb80611
9 changed files with 318 additions and 0 deletions
106
network/nullidentd/01_random_usernames.diff
Normal file
106
network/nullidentd/01_random_usernames.diff
Normal file
|
@ -0,0 +1,106 @@
|
|||
From: Jason Thomas <jason@topic.com.au>
|
||||
Subject: Add support for returning random usernames
|
||||
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=115204
|
||||
--- nullidentd-1.0.orig/nullidentd.c
|
||||
+++ nullidentd-1.0/nullidentd.c
|
||||
@@ -7,9 +7,11 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
+#include <time.h>
|
||||
|
||||
#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 write_response( int fd, char *respon
|
||||
|
||||
int read_request( int fd, char *request, int maxlen )
|
||||
{
|
||||
- int retval;
|
||||
char c;
|
||||
int bytesread = 0;
|
||||
|
||||
@@ -76,6 +78,22 @@ int read_request( int fd, char *request,
|
||||
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 @@ void session_timeout( int foo )
|
||||
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 @@ int main( int argc, const char *argv[] )
|
||||
}
|
||||
}
|
||||
|
||||
+ if (strcmp(userid, "RANDOM") == 0) {
|
||||
+ gen_random = 1;
|
||||
+ }
|
||||
+
|
||||
infd = fileno( stdin );
|
||||
outfd = fileno( stdout );
|
||||
|
||||
@@ -121,6 +143,8 @@ int main( int argc, const char *argv[] )
|
||||
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 @@ int main( int argc, const char *argv[] )
|
||||
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 @@ int main( int argc, const char *argv[] )
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
-
|
29
network/nullidentd/02_makefile.diff
Normal file
29
network/nullidentd/02_makefile.diff
Normal file
|
@ -0,0 +1,29 @@
|
|||
From: John H. Robinson, IV <jaqque@debian.org>
|
||||
Subject: Modified toplevel Makefile to support $(DESTDIR)
|
||||
--- 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 @@ clean:
|
||||
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
|
||||
|
17
network/nullidentd/README
Normal file
17
network/nullidentd/README
Normal file
|
@ -0,0 +1,17 @@
|
|||
nullidentd (bare minimum identd server)
|
||||
|
||||
nullidentd is intended to be a bare minimum identd server. It
|
||||
implements the auth protocol from RFC 1413. This protocol
|
||||
is used to identify active TCP connections. It depends on the
|
||||
trustworthiness of the server and as such is completely useless as
|
||||
a method of identification.
|
||||
|
||||
Unfortunately, some applications still require that an identd
|
||||
server is available to query about incoming connections. nullidentd
|
||||
implements the absolute minimum server to allow these applications to
|
||||
function. It returns a fake response for any request.
|
||||
|
||||
nullidentd is typically invoked from inetd. The following is a typical
|
||||
/etc/inetd.conf example:
|
||||
|
||||
auth stream tcp nowait nobody /usr/sbin/nullidentd nullidentd
|
3
network/nullidentd/doinst.sh
Normal file
3
network/nullidentd/doinst.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
if [ -x usr/bin/mandb ]; then
|
||||
chroot . /usr/bin/mandb -f /usr/man/man8/nullidentd.8.gz &> /dev/null
|
||||
fi
|
3
network/nullidentd/douninst.sh
Normal file
3
network/nullidentd/douninst.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
if [ -x usr/bin/mandb ]; then
|
||||
chroot . /usr/bin/mandb &> /dev/null
|
||||
fi
|
44
network/nullidentd/nullidentd.8
Normal file
44
network/nullidentd/nullidentd.8
Normal file
|
@ -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 <bayoung@acm.org>
|
||||
.PP
|
||||
This manual page was written by John H. Robinson, IV <jaqque@debian.org>,
|
||||
for the Debian GNU/Linux system (but may be used by others).
|
87
network/nullidentd/nullidentd.SlackBuild
Normal file
87
network/nullidentd/nullidentd.SlackBuild
Normal file
|
@ -0,0 +1,87 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for nullidentd
|
||||
|
||||
# Written by B. Watson (urchlay@slackware.uk)
|
||||
|
||||
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
||||
|
||||
# This is "mature" software. It's feature-complete, and hasn't been
|
||||
# updated since last century. I'm effectively repackaging the Debian
|
||||
# package, which is maintained and would receive security updates, if
|
||||
# any were needed. The _5 in VERSION matches the -5 Debian patchlevel.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=nullidentd
|
||||
VERSION=${VERSION:-1.0_5}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
SRCVER="$( echo $VERSION | cut -d_ -f1 )"
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$SRCVER
|
||||
tar xvf $CWD/${PRGNAM}_$SRCVER.orig.tar.gz
|
||||
cd $PRGNAM-$SRCVER
|
||||
chown -R root:root .
|
||||
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
|
||||
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
|
||||
|
||||
# 20240907 bkw: patches came from Debian's -5 build.
|
||||
patch -p1 < $CWD/01_random_usernames.diff
|
||||
patch -p1 < $CWD/02_makefile.diff
|
||||
|
||||
# 20240907 bkw: use our flags, build stripped binary, fix a warning.
|
||||
sed -i "s/-O2/$SLKCFLAGS -Wl,-s/" Makefile
|
||||
sed -i '1i#include <string.h>' $PRGNAM.c
|
||||
|
||||
mkdir -p $PKG/usr/{sbin,man/man8}
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
gzip -9 < $CWD/$PRGNAM.8 > $PKG/usr/man/man8/$PRGNAM.8.gz
|
||||
|
||||
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
mkdir -p $PKGDOC
|
||||
cp -a CHANGELOG COPYING README $PKGDOC
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
cat $CWD/douninst.sh > $PKG/install/douninst.sh
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
10
network/nullidentd/nullidentd.info
Normal file
10
network/nullidentd/nullidentd.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="nullidentd"
|
||||
VERSION="1.0_5"
|
||||
HOMEPAGE="https://packages.debian.org/sid/nullidentd"
|
||||
DOWNLOAD="http://deb.debian.org/debian/pool/main/n/nullidentd/nullidentd_1.0.orig.tar.gz"
|
||||
MD5SUM="80afbac3c40e12a1ee7a0b55922bf439"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
MAINTAINER="B. Watson"
|
||||
EMAIL="urchlay@slackware.uk"
|
19
network/nullidentd/slack-desc
Normal file
19
network/nullidentd/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
nullidentd: nullidentd (bare minimum identd server)
|
||||
nullidentd:
|
||||
nullidentd: nullidentd is intended to be a bare minimum identd server. It
|
||||
nullidentd: implements the auth protocol from RFC 1413. This protocol
|
||||
nullidentd: is used to identify active TCP connections. It depends on the
|
||||
nullidentd: trustworthiness of the server and as such is completely useless as
|
||||
nullidentd: a method of identification.
|
||||
nullidentd:
|
||||
nullidentd:
|
||||
nullidentd:
|
||||
nullidentd:
|
Loading…
Reference in a new issue