netkit-rwall-0.17/ 40700 144 144 0 7141142021 13243 5ustar dhollandpeoplenetkit-rwall-0.17/.cvsignore100644 144 144 10 7024703556 15321 0ustar dhollandpeopleMCONFIG netkit-rwall-0.17/BUGS100644 144 144 164 6321561630 14030 0ustar dhollandpeople - Report from Peter Tobias (tobias@et-inf.fho-emden.de) that rwall prints a strange character after the message. netkit-rwall-0.17/ChangeLog100644 144 144 3662 7136473752 15161 0ustar dhollandpeople14-Dec-1999: netkit-rwall-0.16 is released. 1-Aug-1999: Complete y2k and y2038 audit. 31-Jul-1999: Redid makefiles/config stuff for new confgen version. 23-Sep-1997: rwalld should now refuse to run as root and bail if it can't find "nobody". 12-Jun-1997: netkit-rwall-0.10 released. 05-Apr-1997: Added configure script to generate MCONFIG. 08-Mar-1997: Split from full NetKit package. Generated this change log from NetKit's. 29-Dec-1996 NetKit-0.09 released. 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(). Fixes to rpc.rwalld. (Pavel Krauz, kra@fsid.cvut.cz, and Basile STARYNKEVITCH, Basile.Starynkevitch@cea.fr) 22-Aug-1996 NetKit-B-0.08 released. fixed rusers and rwall to use rpcgen correctly. (almost) everything now compiles with lots of warnings turned on. 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. 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. date not known NetKit-B-0.05 released. date not known NetKit-B-0.04 released. date not known NetKit-B-0.03 released. Changed rusers, rpc.ruserd, rwall, rpc.rwalld, rwho, rwhod to not require to copy ./include/*.h files into /usr/include netkit-rwall-0.17/MCONFIG.in100644 144 144 243 7004603222 14746 0ustar dhollandpeople# Dirs INSTALLROOT BINDIR MANDIR SBINDIR # Modes BINMODE DAEMONMODE MANMODE # Compiling ALLWARNINGS CC CFLAGS LDFLAGS LIBS # Features BSDSIGNAL TYPE(socklen_t) netkit-rwall-0.17/MRULES100644 144 144 173 6310316170 14272 0ustar dhollandpeople# Standard compilation rules (don't use make builtins) %.o: %.c $(CC) $(CFLAGS) $< -c %.o: %.cc $(CC) $(CFLAGS) $< -c netkit-rwall-0.17/Makefile100644 144 144 753 7024720306 15007 0ustar dhollandpeople# 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 = rpc.rwalld rwall %.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 netkit-rwall-0.17/README100644 144 144 6656 7141137774 14272 0ustar dhollandpeopleThis is netkit-rwall-0.17 for Linux. This package updates netkit-rwall-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: rwall Remote write-all program. rpc.rwalld Daemon for receiving remote write-alls. Requires: Working compiler, libc, and kernel. Security: This release contains no security fixes relative to netkit-rwall-0.16. However, versions prior to NetKit-0.09 should not be used. 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 netkit-rwall-0.17/configure100755 144 144 14365 7136502701 15323 0ustar dhollandpeople#!/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 < __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 BSD signal semantics... ' cat <__conftest.c #include #include int count=0; void handle(int foo) { count++; } int main() { int pid=getpid(); signal(SIGINT, handle); kill(pid,SIGINT); kill(pid,SIGINT); kill(pid,SIGINT); if (count!=3) return 1; return 0; } EOF if ( $CC $CFLAGS __conftest.c -o __conftest || exit 1 ./__conftest || exit 1 ) >/dev/null 2>&1; then echo 'yes' else if ( $CC $CFLAGS -D__USE_BSD_SIGNAL __conftest.c -o __conftest || exit 1 ./__conftest || exit 1 ) >/dev/null 2>&1; then echo '-D__USE_BSD_SIGNAL' CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL" else echo 'no' echo 'This package needs BSD signal semantics to run.' rm -f __conftest* exit fi fi rm -f __conftest* ################################################## echo -n 'Checking for socklen_t... ' cat <__conftest.c #include #include #include 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 '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 netkit-rwall-0.17/version.h100644 144 144 146 7141140321 15172 0ustar dhollandpeople/* * String to embed in binaries to identify package */ char pkg[]="$NetKit: netkit-rwall-0.17 $"; netkit-rwall-0.17/include/ 40700 144 144 0 7141142021 14666 5ustar dhollandpeoplenetkit-rwall-0.17/include/rpcsvc/ 40700 144 144 0 7141142021 16166 5ustar dhollandpeoplenetkit-rwall-0.17/include/rpcsvc/rwall.x100644 144 144 3461 6172535447 17640 0ustar dhollandpeople/* * Copyright (c) 1993 Christopher G. Demetriou * All rights reserved. * * 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. The name of the author may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* * rpc protocol definition for (remote) wall protocol * * this has to be compatible with sun's definition */ #ifndef RPC_HDR %#ifndef lint %static char rcsid[] = "$Id: rwall.x,v 1.1 1996/07/15 21:41:59 dholland Exp $"; %#endif /* not lint */ #endif program WALLPROG { version WALLVERS { void WALLPROC_WALL(string) = 2; } = 1; } = 100008; netkit-rwall-0.17/rpc.rwalld/ 40700 144 144 0 7141142021 15313 5ustar dhollandpeoplenetkit-rwall-0.17/rpc.rwalld/.cvsignore100644 144 144 17 6774165236 17410 0ustar dhollandpeoplerwalld rwall.h netkit-rwall-0.17/rpc.rwalld/Makefile100644 144 144 753 7024761721 17065 0ustar dhollandpeopleall: rwalld include ../MCONFIG include ../MRULES RPCGEN=rpcgen rwalld: rwalld.o daemon.o $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ rwalld.o: rwall.h daemon.h ../version.h daemon.o: daemon.h install: rwalld install -s -m$(DAEMONMODE) rwalld $(INSTALLROOT)$(SBINDIR)/rpc.rwalld install -m$(MANMODE) rpc.rwalld.8 $(INSTALLROOT)$(MANDIR)/man8 ln -sf rpc.rwalld.8 $(INSTALLROOT)$(MANDIR)/man8/rwalld.8 clean: rm -f *.o rwalld rwall.h rwall.h: ../include/rpcsvc/rwall.x $(RPCGEN) -h -o $@ $< netkit-rwall-0.17/rpc.rwalld/daemon.3100644 144 144 5461 7141140321 16760 0ustar dhollandpeople.\" From: NetBSD: daemon.3,v 1.3 1995/02/25 13:41:12 cgd Exp .\" $Id: daemon.3,v 1.12 2000/07/30 23:57:05 dholland Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" 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. .\" .\" @(#)daemon.3 8.1 (Berkeley) 6/9/93 .\" .Dd June 9, 1993 .Dt DAEMON 3 .Os "Linux NetKit (0.17)" .Sh NAME .Nm daemon .Nd run in the background .Sh SYNOPSIS .Fd #include .Fn daemon "int nochdir" "int noclose" .Sh DESCRIPTION .Pp The .Fn daemon function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons. .Pp Unless the argument .Fa nochdir is non-zero, .Fn daemon changes the current working directory to the root (``/''). .Pp Unless the argument .Fa noclose is non-zero, .Fn daemon will redirect standard input, standard output and standard error to ``/dev/null''. .Sh ERRORS The function .Fn daemon may fail and set .Va errno for any of the errors specified for the library functions .Xr fork 2 and .Xr setsid 2 . .Sh SEE ALSO .Xr setsid 2 .Sh HISTORY The .Fn daemon function first appeared in .Bx 4.4 . netkit-rwall-0.17/rpc.rwalld/daemon.c100644 144 144 4714 6321540435 17051 0ustar dhollandpeople/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * 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. */ /* * From: @(#)daemon.c 8.1 (Berkeley) 6/4/93 * NetBSD: daemon.c,v 1.4 1995/02/25 13:41:16 cgd Exp */ char daemon_rcsid[] = "$Id: daemon.c,v 1.1 1997/04/05 21:16:13 dholland Exp $"; #include #include #include #include "daemon.h" int daemon(int nochdir, int noclose) { int fd; switch (fork()) { case -1: return -1; case 0: break; default: _exit(0); } if (setsid() == -1) return -1; if (!nochdir) chdir("/"); if (noclose) return 0; fd = open(_PATH_DEVNULL, O_RDWR, 0); if (fd != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > 2) close(fd); } return 0; } netkit-rwall-0.17/rpc.rwalld/daemon.h100644 144 144 47 6321540435 17011 0ustar dhollandpeopleint daemon(int nochdir, int noclose); netkit-rwall-0.17/rpc.rwalld/rpc.rwalld.8100644 144 144 5044 7141140321 17567 0ustar dhollandpeople.\" -*- nroff -*- .\" .\" Copyright (c) 1985, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" 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. .\" .\" $Id: rpc.rwalld.8,v 1.13 2000/07/30 23:57:05 dholland Exp $ .\" .Dd June 7, 1993 .Dt RPC.RWALLD 8 .Os "Linux NetKit (0.17)" .Sh NAME .Nm rpc.rwalld .Nd write messages to users currently logged in server .Sh SYNOPSIS .Nm /usr/sbin/rpc.rwalld .Sh DESCRIPTION .Nm rpc.rwalld is a server which will send a message to users currently logged in to the system. This server invokes the .Xr wall 1 command to actually write the messages to the system. .Pp Messages are sent to this server by the .Xr rwall 1 command. The .Nm rpc.rwalld daemon is normally invoked by .Xr inetd 8 . .Pp .Nm rpc.rwalld uses an RPC protocol defined in .Pa /usr/include/rpcsvc/rwall.x . .Sh SEE ALSO .Xr rwall 1 , .Xr wall 1 , .Xr inetd 8 netkit-rwall-0.17/rpc.rwalld/rwalld.c100644 144 144 14151 7024761721 17113 0ustar dhollandpeople/* * Copyright (c) 1993 Christopher G. Demetriou * All rights reserved. * * 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. The name of the author may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ char rcsid[] = "$Id: rwalld.c,v 1.14 1999/12/12 18:05:05 dholland Exp $"; #include #include #include #include #include #include #include #include #include #include #include /* work around bogus warning from linux includes */ #define __wait __wait_foo #include #include #undef __wait #include "rwall.h" #include "../version.h" /* from libbsd.a */ int daemon(int, int); /* * Note: check to see if your wall accepts -n or not (check the source, * it's not documented) and modify as necessary. The -n flag is supposed * to suppress the banner. The util-linux wall supports the -n flag. */ #ifdef OSF #define WALL_CMD "/usr/sbin/wall" #else #define WALL_CMD "/usr/bin/wall -n" #endif void wallprog_1(struct svc_req *rqstp, SVCXPRT *transp); void possess(void); void killkids(int); int nodaemon = 0; int from_inetd = 1; int main(int argc, char *argv[]) { SVCXPRT *transp; int s; socklen_t salen; struct sockaddr_in sa; int sock = 0; int proto = 0; if (argc == 2 && !strcmp(argv[1], "-n")) nodaemon = 1; if (argc != 1 && !nodaemon) { printf("usage: %s [-n]\n", argv[0]); exit(1); } if (getuid() == 0 || geteuid() == 0) { struct passwd *pwd = getpwnam("nobody"); if (pwd) { initgroups(pwd->pw_name, pwd->pw_gid); setgid(pwd->pw_gid); setuid(pwd->pw_uid); } seteuid(0); /* this should fail */ if (getuid() == 0 || geteuid() == 0) { syslog(LOG_CRIT, "can't drop root privileges"); exit(1); } } /* * See if inetd started us */ if (getsockname(0, (struct sockaddr *)&sa, &salen) < 0) { from_inetd = 0; sock = RPC_ANYSOCK; proto = IPPROTO_UDP; } if (!from_inetd) { if (!nodaemon) possess(); (void)pmap_unset(WALLPROG, WALLVERS); if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { perror("socket"); exit(1); } bzero((char *)&sa, sizeof sa); if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0) { perror("bind"); exit(1); } salen = sizeof sa; if (getsockname(s, (struct sockaddr *)&sa, &salen)) { perror("getsockname"); exit(1); } pmap_set(WALLPROG, WALLVERS, IPPROTO_UDP, ntohs(sa.sin_port)); if (dup2(s, 0) < 0) { perror("dup2"); exit(1); } (void)pmap_unset(WALLPROG, WALLVERS); } (void)signal(SIGCHLD, killkids); transp = svcudp_create(sock); if (transp == NULL) { (void)fprintf(stderr, "cannot create udp service.\n"); exit(1); } if (!svc_register(transp, WALLPROG, WALLVERS, wallprog_1, proto)) { (void)fprintf(stderr, "unable to register (WALLPROG, WALLVERS, udp).\n"); exit(1); } svc_run(); (void)fprintf(stderr, "svc_run returned\n"); exit(1); } void possess(void) { daemon(0, 0); } void killkids(int ignore) { (void)ignore; while(wait4(-1, NULL, WNOHANG, NULL) > 0); } void *wallproc_wall_1(char **s, CLIENT *tmp1) { static int retval = 0; (void)tmp1; retval++; /* fork, popen wall with special option, and send the message */ if (fork() == 0) { FILE *pfp; pfp = popen(WALL_CMD, "w"); if (pfp != NULL) { fprintf(pfp, "\007\007%s", *s); pclose(pfp); exit(0); } } return &retval; } void wallprog_1(struct svc_req *rqstp, SVCXPRT *transp) { union { char *wallproc_wall_1_arg; } argument; char *result; bool_t (*xdr_argument)(XDR *, char **); xdrproc_t xdr_result; void *(*local)(char **, CLIENT *); switch (rqstp->rq_proc) { case NULLPROC: (void)svc_sendreply(transp, (xdrproc_t) xdr_void, NULL); goto leave; case WALLPROC_WALL: xdr_argument = xdr_wrapstring; xdr_result = (xdrproc_t) xdr_void; local = wallproc_wall_1; break; default: svcerr_noproc(transp); goto leave; } memset(&argument, 0, sizeof(argument)); if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { svcerr_decode(transp); goto leave; } result = (*local)((char **)&argument, (CLIENT *)rqstp); if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { (void)fprintf(stderr, "unable to free arguments\n"); exit(1); } leave: if (from_inetd) exit(0); } netkit-rwall-0.17/rwall/ 40700 144 144 0 7141142021 14364 5ustar dhollandpeoplenetkit-rwall-0.17/rwall/.cvsignore100644 144 144 16 6774165236 16460 0ustar dhollandpeoplerwall rwall.h netkit-rwall-0.17/rwall/Makefile100644 144 144 561 7024761721 16133 0ustar dhollandpeopleall: rwall include ../MCONFIG include ../MRULES RPCGEN=rpcgen rwall: rwall.o $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ rwall.o: rwall.h ../version.h install: rwall install -s -m$(BINMODE) rwall $(INSTALLROOT)$(BINDIR) install -m$(MANMODE) rwall.1 $(INSTALLROOT)$(MANDIR)/man1/ clean: rm -f *.o rwall rwall.h rwall.h: ../include/rpcsvc/rwall.x $(RPCGEN) -h -o $@ $< netkit-rwall-0.17/rwall/rwall.1100644 144 144 5612 7141140321 15703 0ustar dhollandpeople.\" Copyright (c) 1983, 1990 The Regents of the University of California. .\" All rights reserved. .\" .\" 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. .\" .\" from: @(#)rwall.1 6.7 (Berkeley) 4/23/91 .\" $Id: rwall.1,v 1.11 2000/07/30 23:57:05 dholland Exp $ .\" .Dd August 15, 1999 .Dt RWALL 1 .Os "Linux NetKit (0.17)" .Sh NAME .Nm rwall .Nd send a message to users logged on a host .Sh SYNOPSIS .Nm rwall .Ar host .Op Ar file .Sh DESCRIPTION The .Nm rwall command sends a message to the users logged into the specified host. The message to be sent can be typed in and terminated with EOF or it can be in a .Ar file . .Sh DIAGNOSTICS .Bl -tag -width indent .It rwall: RPC: Program not registered The .Xr rpc.rwalld 8 daemon has not been started on the remote host. .It rwall: RPC: Timed out A communication error occurred. Either the network is excessively congested, or the .Xr rpc.rwalld 8 daemon has terminated on the remote host. .It rwall: RPC: Port mapper failure - RPC: Timed out The remote host is not running the portmapper (see .Xr portmap 8 ), and cannot accomodate any RPC-based services. The host may be down. .El .Sh SEE ALSO .Xr wall 1 , .Xr portmap 8 , .Xr rpc.rwalld 8 .Sh HISTORY The .Nm rwall command appeared in .Tn SunOS . netkit-rwall-0.17/rwall/rwall.c100644 144 144 12234 7024761721 16020 0ustar dhollandpeople/* * Copyright (c) 1993 Christopher G. Demetriou * Copyright (c) 1988, 1990 Regents of the University of California. * All rights reserved. * * 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. */ char copyright[] = "@(#) Copyright (c) 1988 Regents of the University of California.\n" "All rights reserved.\n"; /* * From: @(#)wall.c 5.14 (Berkeley) 3/2/91 */ char rcsid[] = "$Id: rwall.c,v 1.8 1999/12/12 18:05:05 dholland Exp $"; /* * This program is not related to David Wall, whose Stanford Ph.D. thesis * is entitled "Mechanisms for Broadcast and Selective Broadcast". */ #include #include #include #include #include #include #include #include #include #include #include #include "rwall.h" #include "../version.h" struct timeval timeout = { 25, 0 }; static unsigned mbufsize; static char *mbuf; static void makemsg(const char *); int main(int argc, char *argv[]) { char *wallhost, res; CLIENT *cl; if ((argc < 2) || (argc > 3)) { fprintf(stderr, "usage: %s hostname [file]\n", argv[0]); exit(1); } wallhost = argv[1]; makemsg(argv[2]); /* * Create client "handle" used for calling MESSAGEPROG on the * server designated on the command line. We tell the rpc package * to use the "tcp" protocol when contacting the server. */ cl = clnt_create(wallhost, WALLPROG, WALLVERS, "udp"); if (cl == NULL) { /* * Couldn't establish connection with server. * Print error message and die. */ clnt_pcreateerror(wallhost); exit(1); } if (clnt_call(cl, WALLPROC_WALL, (xdrproc_t) xdr_wrapstring, (char *)&mbuf, (xdrproc_t) xdr_void, &res, timeout) != RPC_SUCCESS) { /* * An error occurred while calling the server. * Print error message and die. */ clnt_perror(cl, wallhost); exit(1); } exit(0); } static void makemsg(const char *fname) { struct tm *lt; struct passwd *pw; struct stat sbuf; time_t now; FILE *fp; int fd; const char *whom; char hostname[MAXHOSTNAMELEN], lbuf[100], tmpname[32]; (void)strcpy(tmpname, _PATH_TMP); (void)strcat(tmpname, "/wall.XXXXXX"); if (!(fd = mkstemp(tmpname)) || !(fp = fdopen(fd, "r+"))) { (void)fprintf(stderr, "wall: can't open temporary file.\n"); exit(1); } (void)unlink(tmpname); if (!(whom = getlogin())) whom = (pw = getpwuid(getuid())) ? pw->pw_name : "???"; (void)gethostname(hostname, sizeof(hostname)); (void)time(&now); lt = localtime(&now); /* * all this stuff is to blank out a square for the message; * we wrap message lines at column 79, not 80, because some * terminals wrap after 79, some do not, and we can't tell. * Which means that we may leave a non-blank character * in column 80, but that can't be helped. */ (void)fprintf(fp, "Remote Broadcast Message from %s@%s\n", whom, hostname); (void)fprintf(fp, " (%s) at %d:%02d ...\n", ttyname(2), lt->tm_hour, lt->tm_min); putc('\n', fp); if (fname && !(freopen(fname, "r", stdin))) { (void)fprintf(stderr, "wall: can't read %s.\n", fname); exit(1); } while (fgets(lbuf, sizeof(lbuf), stdin)) fputs(lbuf, fp); rewind(fp); if (fstat(fd, &sbuf)) { (void)fprintf(stderr, "wall: can't stat temporary file.\n"); exit(1); } mbufsize = sbuf.st_size; if (!(mbuf = malloc(mbufsize))) { (void)fprintf(stderr, "wall: out of memory.\n"); exit(1); } if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize) { (void)fprintf(stderr, "wall: can't read temporary file.\n"); exit(1); } (void)close(fd); }