Commit 2da9c570 authored by Josué Ortega's avatar Josué Ortega

Import Upstream version 0.17

parents
finger:
- add option to issue CRs so fingerd doesn't need to fork
- Some nameservers hose on "", patch finger to work around it
fingerd:
- rejection of finger forwarding should be optional
22-Jul-2000:
Document ~/.pgpkey. (Herbert Xu, herbert@gondor.apana.org.au)
18-Dec-1999:
Add support for ~/.nofinger files.
14-Dec-1999:
bsd-finger-0.16 is released.
12-Dec-1999:
Withdrew -R option; finger can figure out on its own if it needs
to emit CRs.
Also, make printing of pts/* ttys work right.
14-Sep-1999:
Rewrote output handling of finger to deal with 8-bit characters
correctly. Also fixed what I think was some uninitialized data
displaying ":0" utmp entries.
Backed out patch 1.15 of finger/util.c because it was completely
wrong. Fixed gecos processing _again_.
Added -R option to finger that causes it to emit CR before every
LF. Changed fingerd to use it. This means fingerd no longer
needs to fork.
1-Aug-1999:
Complete y2k and y2038 audit.
31-Jul-1999:
Redid makefiles/config stuff for new confgen version.
23-Sep-1997:
fingerd should now refuse to run as root and bail if it can't find
"nobody".
22-Sep-1997:
Fix finger to not destroy gethostbyname() results with
getservbyname().
02-Aug-1997:
Fix fingerd to complain if it can't switch from root.
12-Jun-1997:
bsd-finger-0.10 released.
08-Jun-1997:
More adjustments for glibc.
13-May-1997:
Do dynamic column width formatting in short format printout. (HJ Lu)
05-Apr-1997:
Added configure script to generate MCONFIG.
glibc fixes from HJ Lu.
Display .pgpkey file in finger (Edward S. Marshall,
emarshal@common.net)
Better utmp handling.
08-Mar-1997:
Split from full NetKit package.
Generated this change log from NetKit's.
07-Mar-1997:
Fixed finger to reject .plans that aren't regular files. (Thomas
Roessler, roessler@sobolev.rhein.de)
01-Feb-1997:
Fixed finger's timezone handling. Now gets daylight time right.
29-Dec-1996
NetKit-0.09 released.
Fix doc bugs in fingerd.
Fingerd accepts -p as equivalent to -L for compatibility with
"fingerd-extlog.tar.gz".
Assorted alpha/glibc patches. (Erik Troan, ewt@redhat.com)
Assorted bug fixes from Debian. (Peter Tobias,
tobias@et-inf.fho-emden.de)
Hardened programs against DNS h_length spoofing attacks.
Use inet_aton() everywhere instead of inet_addr().
Fixed bug in finger's processing of &'s in full names that probably has
security implications.
Finger doesn't follow symlinks now.
22-Aug-1996
NetKit-B-0.08 released.
fingerd uses fork instead of system for running uptime (with -w flag).
fingerd supports -L flag to run alternate finger client.
(almost) everything now compiles with lots of warnings turned on.
fingerd now accepts a new -u flag to reject "finger @host" queries.
fix bug in finger that prevented matching full names
(fix from James Jones <james@richland.cc.il.us>.)
25-Jul-1996
NetKit-B-0.07A released.
23-Jul-1996
NetKit-B-0.07 released.
Integrated a collection of patches that had been lurking on the net,
including the 256-ptys support for telnetd and passive mode ftp.
Major security fixes, including to fingerd, lpr, rlogin, rsh, talkd,
and telnetd. Do *not* use the sliplogin from earlier versions of this
package, either.
Several of the daemons support better logging.
Much of the code builds without libbsd.a or bsd includes.
Massive code cleanup. Almost everything compiles clean with gcc
-Wall now. rusers and rusersd do not; patches to rpcgen to fix
this would be appreciated if anyone feels like it.
New maintainer: David A. Holland, dholland@hcs.harvard.edu
date not known
NetKit-B-0.06 released.
Added a missing argument in a printf to the finger source
code. Phil Edge
"finger -l" prints the standard timezone when it should print the
daylight savings timezone. tzname[0] is standard timezone and
tzname[1] is daylight savings timezone. This patch is from Phil
Edge. He wasn't too sure about this patch, and I haven't looked
into it. Anyone who really knows about this stuff? Look into
lprint.c in the finger source. I changed all "1 - daylight" into
"daylight"... You could also verify all Linux-specific changes
to timezone things. Other parts look also like duplicate work.
(Maybe even wrong...)
date not known
NetKit-B-0.05 released.
Fixed finger/util.c to cope with XDM login entry in utmp (Leonard
Zubkoff)
date not known
NetKit-B-0.04 released.
date not known
NetKit-B-0.03 released.
Fixed fingerd to not use 'getdomainname' to get the FQDN.
# Dirs
INSTALLROOT
BINDIR
SBINDIR
MANDIR
# Modes
BINMODE
DAEMONMODE
MANMODE
# Compiling
ALLWARNINGS
CC
CFLAGS
LDFLAGS
LIBS
# Features
FN(snprintf)
TYPE(socklen_t)
# Standard compilation rules (don't use make builtins)
%.o: %.c
$(CC) $(CFLAGS) $< -c
%.o: %.cc
$(CC) $(CFLAGS) $< -c
# You can do "make SUB=blah" to make only a few, or edit here, or both
# You can also run make directly in the subdirs you want.
SUB = finger fingerd
%.build:
(cd $(patsubst %.build, %, $@) && $(MAKE))
%.install:
(cd $(patsubst %.install, %, $@) && $(MAKE) install)
%.clean:
(cd $(patsubst %.clean, %, $@) && $(MAKE) clean)
all: $(patsubst %, %.build, $(SUB))
install: $(patsubst %, %.install, $(SUB))
clean: $(patsubst %, %.clean, $(SUB))
distclean: clean
rm -f MCONFIG
This is bsd-finger-0.17 for Linux.
This package updates bsd-finger-0.16.
If you're reading this off a CD, go right away and check the net
archives for later versions and security fixes. As of this writing the
home site for NetKit is
ftp://ftp.uk.linux.org/pub/linux/Networking/netkit
Contents:
finger Program for printing user information
fingerd Daemon for remote finger access
Requires:
Working compiler, libc, and kernel.
Security:
bsd-finger-0.17 contains no new security fixes.
bsd-finger-0.16 fixes some possible denial of service attacks
against fingerd.
bsd-finger-0.10 fixed a denial of service situation where
users' .plan or .project files are named pipes.
The NetKit-0.09 and earlier versions of this code fixed a
number of now well-known security problems. Please don't use
older versions.
Note:
If you are using the finger daemon from this package with a
custom finger client, rather than the finger client in this
package, you will need to update your client to send carriage
returns (CR, or '\r' in C) before line feeds (LF, or '\n' in
C) if the finger client's standard output is a socket.
This is because as of bsd-finger-0.15, finger probes this
condition and sends CRs itself instead of expecting fingerd
to make an extra copy of all the data through a pipe just to
add CRs in.
Ignoring this circumstance and always sending LF instead of
CR/LF will in most cases work, but is not RFC-compliant.
Installation:
Do "./configure --help" and decide what options you want. The
defaults should be suitable for most Linux systems. Then run
the configure script.
Do "make" to compile.
Then (as root) do "make install".
Save a backup copy of any mission-critical program in case the
new one doesn't work, and so forth. We warned you.
If you get gcc warnings from files in /usr/include, they are
due to problems in your libc, not netkit. (You may only see
them when compiling netkit because netkit turns on a lot of
compiler warnings.)
DEC CC:
The DEC compiler for the Alpha is now freely available. This
is a much better compiler with gcc, that is, it generates much
better code. If you have the DEC compiler, you can explicitly
use the DEC compiler instead of gcc by configuring like this:
./configure --with-c-compiler=ccc
It is known to generate spurious warnings on some files. Also,
some headers from some versions of glibc confuse it; that may
prevent netkit from working. Other problems should be reported
as bugs.
Bugs:
Please make sure the header files in /usr/include match the
libc version installed in /lib and /usr/lib. If you have weird
problems this is the most likely culprit.
Also, before reporting a bug, be sure you're working with the
latest version.
If something doesn't compile for you, fix it and send diffs.
If you can't, send the compiler's error output.
If it compiles but doesn't work, send as complete a bug report as
you can. Patches and fixes are welcome, as long as you describe
adequately what they're supposed to fix. Please, one patch per
distinct fix. Please do NOT send the whole archive back or
reindent the source.
Be sure to send all correspondence in e-mail to the netkit address.
Postings to netnews or mailing lists will not be seen due to the
enormous volume. Also, anything that doesn't get filed in the bug
database is quite likely to end up forgotten.
Please don't report known bugs (see the BUGS file(s)) unless you
are including fixes. :-)
Mail should be sent to: netbug@ftp.uk.linux.org
Early in April 2000, a hacker broke into the machine that was hosting
the netkit bug database for me and trashed it. Unfortunately, it seems
backups hadn't gotten done for a while, so three months of mail (since
mid-January) was lost. So, if you sent something and didn't hear back,
or you sent something, heard back, but the changes failed to appear in
this release (unlikely but possible) - please resend.
Please see http://www.hcs.harvard.edu/~dholland/computers/netkit.html
if you are curious why it was so long between the 0.10 and 0.16 releases.
Future plans for netkit maintenance are still up in the air, but in the
meantime new releases will still appear from time to time. I don't have
a whole lot of cycles to spare to work on netkit, so things are likely
to continue to be fairly slow.
David A. Holland
23 July 2000
#!/bin/sh
#
# This file was generated by confgen version 2.
# Do not edit.
#
PREFIX='/usr'
#EXECPREFIX='$PREFIX'
INSTALLROOT=''
BINMODE='755'
#DAEMONMODE='$BINMODE'
MANMODE='644'
while [ x$1 != x ]; do case $1 in
--help)
cat <<EOF
Usage: configure [options]
--help Show this message
--with-debug Enable debugging
--prefix=path Prefix for location of files [/usr]
--exec-prefix=path Location for arch-depedent files [prefix]
--installroot=root Top of filesystem tree to install in [/]
--binmode=mode Mode for binaries [755]
--daemonmode=mode Mode for daemon binaries [same as binmode]
--manmode=mode Mode for manual pages [644]
--with-c-compiler=cc Program for compiling C source [guessed]
EOF
exit 0;;
--verbose) ;;
--quiet) ;;
--subdir) . ../configure.defs;;
--with-debug|--debug) DEBUG=1;;
--prefix=*) PREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
--exec-prefix=*) EXECPREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
--installroot=*) INSTALLROOT=`echo $1 | sed 's/^[^=]*=//'` ;;
--binmode=*) BINMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
--daemonmode=*) DAEMONMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
--manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
--with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;;
*) echo "Unrecognized option: $1"; exit 1;;
esac
shift
done
if [ x$EXECPREFIX = x ]; then
EXECPREFIX="$PREFIX"
fi
if [ x$DAEMONMODE = x ]; then
DAEMONMODE="$BINMODE"
fi
BINDIR="$EXECPREFIX/bin"
SBINDIR="$EXECPREFIX/sbin"
MANDIR="$PREFIX/man"
echo "Directories: $BINDIR $SBINDIR $MANDIR "
if [ x$INSTALLROOT != x ]; then
echo "Installing in chroot tree rooted at $INSTALLROOT"
fi
##################################################
WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline '
cat << EOF > __conftest.c
int main() { int class=0; return class; }
EOF
if [ x"$CC" = x ]; then
echo -n 'Looking for a C compiler... '
for TRY in egcs gcc g++ CC c++ cc; do
(
$TRY __conftest.c -o __conftest || exit 1;
./__conftest || exit 1;
) >/dev/null 2>&1 || continue;
CC=$TRY
break;
done
if [ x"$CC" = x ]; then
echo 'failed.'
echo 'Cannot find a C compiler. Run configure with --with-c-compiler.'
rm -f __conftest*
exit
fi
echo "$CC"
else
echo -n 'Checking if C compiler works... '
if (
$CC __conftest.c -o __conftest || exit 1
./__conftest || exit 1
) >/dev/null 2>&1; then
echo 'yes'
else
echo 'no'
echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.'
rm -f __conftest*
exit
fi
fi
echo -n "Checking if $CC accepts gcc warnings... "
if (
$CC $WARNINGS __conftest.c -o __conftest || exit 1
) >/dev/null 2>&1; then
echo 'yes'
CC_WARNINGS=1
else
echo 'no'
fi
if [ x$DEBUG = x ]; then
echo -n "Checking if $CC accepts -O2... "
if (
$CC -O2 __conftest.c -o __conftest
) >/dev/null 2>&1; then
echo 'yes'
CFLAGS="$CFLAGS -O2"
else
echo 'no'
echo -n "Checking if $CC accepts -O... "
if (
$CC -O __conftest.c -o __conftest
) >/dev/null 2>&1; then
echo 'yes'
CFLAGS="$CFLAGS -O"
else
echo 'no'
fi
fi
else
echo -n "Checking if $CC accepts -g... "
if (
$CC -g __conftest.c -o __conftest
) >/dev/null 2>&1; then
echo 'yes'
CFLAGS="$CFLAGS -g"
else
echo 'no'
fi
fi
LDFLAGS=
LIBS=
rm -f __conftest*
##################################################
echo -n 'Checking for socklen_t... '
cat <<EOF >__conftest.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {
struct sockaddr_in sn;
socklen_t len = sizeof(sn);
getpeername(0, (struct sockaddr *)&sn, &len);
return 0;
}
EOF
if (
$CC $CFLAGS __conftest.c -o __conftest || exit 1
) >/dev/null 2>&1; then
echo 'yes'
else
if (
$CC $CFLAGS -Dsocklen_t=int __conftest.c -o __conftest || exit 1
) >/dev/null 2>&1; then
echo 'int'
CFLAGS="$CFLAGS -Dsocklen_t=int"
else
if (
$CC $CFLAGS -Dsocklen_t=size_t __conftest.c -o __conftest || exit 1
) >/dev/null 2>&1; then
echo 'size_t'
CFLAGS="$CFLAGS -Dsocklen_t=size_t"
else
echo 'no'
echo 'Cannot work out what to use for socklen_t. Help...'
rm -f __conftest*
exit
fi
fi
fi
rm -f __conftest*
##################################################
echo -n 'Checking for snprintf declaration... '
cat <<EOF >__conftest.c
#include <stdio.h>
int main() {
void *x = (void *)snprintf;
printf("%lx", (long)x);
return 0;
}
EOF
if (
$CC $CFLAGS __conftest.c -o __conftest || exit 1
) >/dev/null 2>&1; then
echo 'ok'
else
if (
$CC $CFLAGS -D_GNU_SOURCE __conftest.c -o __conftest || exit 1
./__conftest || exit 1
) >/dev/null 2>&1; then
echo '-D_GNU_SOURCE'
CFLAGS="$CFLAGS -D_GNU_SOURCE"
else
echo 'manual'
CFLAGS="$CFLAGS -DDECLARE_SNPRINTF"
fi
fi
rm -f __conftest*
echo -n 'Checking for snprintf implementation... '
cat <<EOF >__conftest.c
#include <stdio.h>
#include <string.h>
#ifdef DECLARE_SNPRINTF
#ifdef __cplusplus
extern "C"
#endif /*__cplusplus*/
int snprintf(char *, int, const char *, ...);
#endif /*DECLARE_SNPRINTF*/
int main() {
char buf[32];
snprintf(buf, 8, "%s", "1234567890");
if (strlen(buf)!=7) return 1;
return 0;
}
EOF
if (
$CC $CFLAGS __conftest.c $LIBBSD -o __conftest || exit 1
./__conftest || exit 1
) >/dev/null 2>&1; then
echo 'ok'
else
if (
$CC $CFLAGS __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1
./__conftest || exit 1
) >/dev/null 2>&1; then
echo '-lsnprintf'
LIBS="$LIBS -lsnprintf"
else
if (
$CC $CFLAGS __conftest.c -ldb $LIBBSD -o __conftest || exit 1
./__conftest || exit 1
) >/dev/null 2>&1; then
echo '-ldb'
LIBS="$LIBS -ldb"
else
echo 'missing'
echo 'This package requires snprintf.'
rm -f __conftest*
exit
fi
fi
fi
rm -f __conftest*
##################################################
## libbsd should go last in case it's broken
if [ "x$LIBBSD" != x ]; then
LIBS="$LIBS $LIBBSD"
fi
echo 'Generating MCONFIG...'
(
echo -n '# Generated by configure (confgen version 2) on '
date
echo '#'
echo
echo "BINDIR=$BINDIR"
echo "SBINDIR=$SBINDIR"
echo "MANDIR=$MANDIR"
echo "BINMODE=$BINMODE"
echo "DAEMONMODE=$DAEMONMODE"
echo "MANMODE=$MANMODE"
echo "PREFIX=$PREFIX"
echo "EXECPREFIX=$EXECPREFIX"
echo "INSTALLROOT=$INSTALLROOT"
echo "CC=$CC"
if [ x$CC_WARNINGS != x ]; then
CFLAGS="$CFLAGS $WARNINGS"
fi
echo "CFLAGS=$CFLAGS" | sed 's/= */=/'
echo "LDFLAGS=$LDFLAGS" | sed 's/= */=/'
echo "LIBS=$LIBS" | sed 's/= */=/'
) > MCONFIG
all: finger
include ../MCONFIG
include ../MRULES
finger: finger.o lprint.o net.o sprint.o util.o display.o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
finger.o lprint.o net.o sprint.o util.o display.o: finger.h
finger.o: ../version.h
install: finger
install -s -m$(BINMODE) finger $(INSTALLROOT)$(BINDIR)
install -m$(MANMODE) finger.1 $(INSTALLROOT)$(MANDIR)/man1
clean:
rm -f *.o finger
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "finger.h"
int
getscreenwidth(void)
{
#if defined(TIOCGWINSZ)
struct winsize ws;
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0 || ws.ws_col==0) {
return 80;
}
return ws.ws_col;
#elif defined(TIOCGSIZE)
struct ttysize ts;
if (ioctl(STDIN_FILENO, TIOCGSIZE, &ts) < 0 || ts.ts_cols==0) {
return 80;
}
return ts.ts_cols;
#else
const char *e = getenv("COLUMNS");
int col = e ? atoi(e) : 0;
if (col==0) col = 80;
return col;
#endif
}
int
is8bit(void)
{
static int cache=-1;
struct termios tios;
if (cache>=0) return cache;
if (tcgetattr(STDIN_FILENO, &tios)<0) {
/* assume 8-bit; it's 1999 now, not 1972 */
cache = 1;
}
else {
cache = (tios.c_cflag & CSIZE)==CS8;
}
return cache;
}
/************/
static int send_crs=0;
void
set_crmode(void)
{
send_crs = 1;
}
static
void
fxputc(FILE *f, int ch)
{
/* drop any sign */
ch = ch&0xff;
/* on 7-bit terminals, strip high bit */
if (!is8bit()) ch &= 0x7f;
/*
* Assume anything that isn't a control character is printable.
* We can't count on locale stuff to tell us what's printable
* because we might be looking at someone who uses different
* locale settings or is on the other side of the planet. So,
* strip 0-31, 127, 128-159, and 255. Note that not stripping
* 128-159 is asking for trouble, as 155 (M-esc) is interpreted
* as esc-[ by most terminals. Hopefully this won't break anyone's
* charset.
*
* It would be nice if we could set the terminal to display in the
* right charset, but we have no way to know what it is. feh.
*/
if (((ch&0x7f) >= 32 && (ch&0x7f) != 0x7f) || ch=='\t') {
putc(ch, f);
return;
}
if (ch=='\n') {
if (send_crs) putc('\r', f);
putc('\n', f);
return;
}
if (ch&0x80) {