Imported from conserver-7.0.0.tar.gz

This commit is contained in:
Bryan Stansell 2001-02-18 22:50:29 -08:00
parent 38115d7b64
commit 25c97b698a
46 changed files with 4221 additions and 1704 deletions

12
CHANGES
View File

@ -1,6 +1,16 @@
CHANGES
=======
version 7.0.0 (Feb 18, 2001):
- GNU configure-based packaging!!!
All work done by Mark D. Roth <roth@feep.net>.
Thank you!
- Removed conserver/cons.h and moved options into --with
and --enable configure arguments
- ioctl() bug found by Ross Parker <parker@redback.com>
- Removed last of the "loopback preference" code in
console/console.c - should have been removed a long time ago
version 6.1.7 (Dec 14, 2000):
- Documented no parity option in conserver.cf.man
- Lowered default CONNECTTIMEOUT to 10 seconds
@ -91,5 +101,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.20 2000-12-14 16:32:46-08 bryan Exp $
# $Id: CHANGES,v 1.23 2001-02-18 22:36:45-08 bryan Exp $
#

93
INSTALL
View File

@ -3,24 +3,30 @@
Quickie Instructions
- Edit 'conserver/cons.h' (if necessary)
- Run './configure'
- Run 'make'
- If all is well, run 'make install install.man'
- If all is well, run 'make install'
- Now set up config files, etc. (see below)
Things will install in /usr/local. If you'd like to use a different
prefix, use 'make PREFIX=/your/path install'.
Detailed Instructions
- First thing to do is set up a custom conserver/cons.h file. If you
like all the defaults provided in conserver/port.h, your set.
Just use the default cons.h cons.h file. Here are some of the
more important #defines to look for:
- First thing to do is determine if you want different defaults. A
'./configure --help' will show you the basics. If you like all
the defaults shown, your set. If not, here are the conserver
unique options:
--with-port=PORT Specify port number [conserver]
--with-master=MASTER Specify master server hostname [console]
--with-cffile=CFFILE Specify config filename [conserver.cf]
--with-pwdfile=PWDFILE Specify password filename [conserver.passwd]
--with-maxmemb=MAXMEMB Specify maximum consoles per process [8]
--with-maxgrp=MAXGRP Specify maximum number of processes [32]
--enable-8bit Enable 8bit data path
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
Not surprisingly, some match the old conserver/cons.h items...here
they are for reference:
PORT or SERVICE - Socket used to communicate
HOST - Hostname of console server
@ -29,45 +35,52 @@ Detailed Instructions
MAXMEMB - Number of consoles per child process
MAXGRP - Number of child processes
- Now run 'make'. If you're platform is supported you'll get a nice
message about "Configuring for ..." and the programs should compile.
If not, you'll have to adjust the settings, or slightly worse,
port the software. For adjusting the settings (like using a
different compiler or something), check out the .settings file.
'make config', which is done for you, symlinks it to port/<ostype>.
If you have to port the software, follow the instructions you
received.
- Run './configure'. This will detect system specific
information. The --prefix option will redirect where things are
installed. Other options are available as well...try
'./configure --help'.
- Once things build, you can run 'make install install.man'.
This will put things into the /usr/local tree. If you'd like
things deposited elsewhere, you can use 'make PREFIX=/your/path
install install.man'. We like to use something like 'make
PREFIX=/tools/conserver install install.man'.
- Now run 'make'. Hopefully things will compile.
- Once things build, you can run 'make install'.
- If you'd like to build the autologin application, you'll need to
run 'make autologin'. If you'd like it installed, use 'make
autologin.install'.
- Now that the binaries are in place, we need to set up the
configuration files and such.
If you used a blank cons.h file or defined a service name (SERVICE
token above), you'll need to enter a definition in your services
file (directly, via NIS, or whatever). Here's what we use:
+ Does your conserver master hostname exist? This is the
hostname specified with the --with-master option. By default
the hostname is "console", so make sure it's in DNS, hosts
files, or whatever.
console 782/tcp conserver # console server
+ If you used a symbolic name for the --with-port option (by
default it uses "conserver", so the answer would be yes),
you'll need to enter a definition in your services file
(directly, via NIS, or whatever). Here's what we use:
If you defined PORT, you shouldn't have to worry about this step.
console 782/tcp conserver # console server
Next, make sure conserver runs during boot. The init script
we use under Solaris is installed in <PREFIX>/etc/conserver.rc.
Use that or some form of it for your own /etc/init.d script or an
entry in startup files (/etc/rc, /etc/rc.local, or whatever).
If you used a number, you shouldn't have to worry about this
step.
Now for the fun stuff. You need to create a conserver.cf and
conserver.passwd file. Those are defined with the CONFIG and
PASSWD_FILE settings. If you ever need to know what values
were compiled into conserver, run 'conserver -V'. See the
conserver.cf/INSTALL file for instructions on setup of these files.
+ Next, make sure conserver runs during boot. The init script we
use under Solaris is installed in <PREFIX>/etc/conserver.rc.
Use that or some form of it for your own /etc/init.d script or
an entry in startup files (/etc/rc, /etc/rc.local, or
whatever).
+ Now for the fun stuff. You need to create a conserver.cf and
conserver.passwd file. Those are defined with the
--with-cffile and --with-pwdfile settings. If you ever need to
know what values were compiled into conserver, run 'conserver
-V'. See the conserver.cf/INSTALL file for instructions on
setup of these files.
- That's it! Just start up the console server and enjoy!
#
# $Id: INSTALL,v 1.6 2000-03-02 02:26:50-08 bryan Exp $
# $Id: INSTALL,v 1.8 2001-02-18 21:50:14-08 bryan Exp $
#

View File

@ -1,42 +0,0 @@
# $Id: Makefile,v 1.8 2000-03-06 18:08:31-08 bryan Exp $
#
# Master Makefile
#
SUBDIRS=conserver console conserver.cf
all clean install install.man: FRC
@if [ ! -f .settings ]; then \
echo "Running a 'make config' for you"; \
${MAKE} config; \
fi
@if [ -f .settings ]; then \
s=`cat .settings | grep -v '^#'`; \
settings=`echo $$s`; \
if [ -n "${PREFIX}" ]; then settings="'PREFIX=${PREFIX}' $$settings"; fi; \
for s in ${SUBDIRS}; do \
( cd $$s; eval ${MAKE} $$settings $@ ) \
done; \
else \
echo; \
echo "There is a problem with your platform type. Try running"; \
echo "'make config' and look into the errors"; \
echo; \
exit; \
fi
@if [ "$@" = "clean" ]; then rm .settings; fi
config:
@p=`port/system 2>/dev/null`; \
if [ -n "$$p" ]; then \
rm -f .settings; \
ln -s port/$$p .settings; \
echo "Configured for $$p"; \
else \
echo "*** Can't determine system type."; \
echo "*** See ./port for porting issues."; \
fi
FRC:
SHELL=/bin/sh

43
Makefile.in Normal file
View File

@ -0,0 +1,43 @@
### Path settings
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
libdir = @libdir@
includedir = @includedir@
sysconfdir = @sysconfdir@
@SET_MAKE@
### Makefile rules - no user-servicable parts below
SUBDIRS = conserver console conserver.cf
all:
for n in $(SUBDIRS); do \
( cd $$n && $(MAKE) $@ $(MAKE_FLAGS) ) || exit 1; \
done
autologin:
( cd autologin && $(MAKE) $@ $(MAKE_FLAGS) ) || exit 1;
autologin.install:
( cd autologin && $(MAKE) install $(MAKE_FLAGS) ) || exit 1;
install:
for n in $(SUBDIRS); do \
( cd $$n && $(MAKE) $@ $(MAKE_FLAGS) ) || exit 1; \
done
clean:
for n in $(SUBDIRS); do \
( cd $$n && $(MAKE) $@ $(MAKE_FLAGS) ) || exit 1; \
done
distclean:
for n in $(SUBDIRS); do \
( cd $$n && $(MAKE) $@ $(MAKE_FLAGS) ) || exit 1; \
done
rm -f config.cache config.log config.status config.h Makefile

81
README
View File

@ -1,32 +1,62 @@
README
======
Maintainer/Enhancer
Bryan Stansell (bryan@conserver.com) of Certainty Solutions, Inc. -
formerly Global Networking and Computing (GNAC)
formerly Global Networking and Computing (GNAC).
Big new version released!
7.0.0 is out! What's so great about 7.0.0? GNU's autoconf has been
integrated by Mark Roth (roth@feep.net)! I met Mark at the [1]LISA
conference last December and he (quite quickly) provided the patches.
I've been dragging my heels getting it out to others, but it's now
available.
Now that I have autoconf capabilities, I've taken out the need to edit
the conserver/cons.h file - everything is now a --with or --enable
configure argument (makes sense, doesn't it!?!). As with any X.0.0
release, I may have introduced something bad into the code for systems
I don't have access to, so be careful.
I've successfully built 7.0.0 on Solaris and Linux. I've been told the
client has built successfully under cygwin on NT (progress on the NT
front!). Last report shows FreeBSD as a failure (any coders out there
with FreeBSD have time to send me patches?). If anyone successfully
builds and installs the software under other operating systems, I'd
love to hear about it.
Finally, a FAQ!
Here's the start of a conserver [2]FAQ. Got any additions? Let me
know.
Mailing Lists
There are currently two mailing lists available at conserver.com.
announce@conserver.com is an announcement-only mailing list for
There are currently two mailing lists available.
[3]announce@conserver.com is an announcement-only mailing list for
informing of new versions, major developments, etc.
users@conserver.com is for general Q&A, discussions, ideas, etc for
conserver users. See http://www.conserver.com/ for pointers to
these and possibly future lists.
[4]users@conserver.com is for general Q&A, discussions, ideas, etc
for conserver users. You can sign up my sending a message to
list-request@conserver.com with a subject of "subscribe" or head
over to the online [5]web pages.
Origin
The console server software found here is a heavily modified
version originally written by Tom Fine (fine@cis.ohio-state.edu)
and then Kevin S Braunsdorf (ksb+conserver@sa.fedex.com). Patches
version originally written by Tom Fine (fine@head-cfa.harvard.edu)
and then Kevin S Braunsdorf (ksb+conserver@sa.fedex.com). Patches
from Robert Olson (olson@mcs.anl.gov) were then applied to get
network console support.
Arnold de Leon (arnold@corp.webtv.net) then fixed various bugs and
added enhancements while at Synopsys. I then took the result and
added enhancements while at Synopsys. I then took the result and
continued fixing things and adding features we found useful.
Certainty Solutions has been supporting my coding efforts (in too
many ways to list) since 1996.
@ -34,16 +64,16 @@ Origin
The conserver.com Distribution
The result is a combination of many people's work. This version is
being released in hopes that it will help others. There is no
The result is a combination of many people's work. This version is
being released in hopes that it will help others. There is no
warranty or support implied by the distribution of the software.
As of version 6.1.7, the packaging and numbering sheme has
changed. I used to package conserver as conserver-GNAC-v.vv.
Since GNAC (now Certainty Solutions) has changed it's name I've
As of version 6.1.7, the packaging and numbering scheme has
changed. I used to package conserver as conserver-GNAC-v.vv. Since
GNAC (now [6]Certainty Solutions) has changed it's name I've
decided to drop the GNAC portion and use a 3 digit version number
(conserver-v.v.v). Why change the version numbering? I need to
differenciate this thread of the code from the original authors and
(conserver-v.v.v). Why change the version numbering? I need to
differentiate this thread of the code from the original authors and
I couldn't come up with a good replacement for the GNAC name - sad,
but true.
@ -55,11 +85,20 @@ Downloading
Other Good Information
Zonker Harris has fabulous documents regarding the hookup
of consoles to terminal servers and other such devices. His
Greater Scroll of Console Knowledge is a great place to start
(http://www.conserver.com/consoles/).
Zonker Harris has fabulous documents regarding the hookup of
consoles to terminal servers and other such devices. His
[13]Greater Scroll of Console Knowledge is a great place to start.
References
1. http://www.usenix.org/publications/library/proceedings/lisa2000/
2. http://www.conserver.com/FAQ
3. mailto:announce@conserver.com
4. mailto:users@conserver.com
5. https://www.conserver.com/mailman/listinfo
6. http://www.certaintysolutions.com/
#
# $Id: README,v 1.12 2000-12-14 16:31:04-08 bryan Exp $
# $Id: README,v 1.14 2001-02-18 22:49:41-08 bryan Exp $
#

41
acconfig.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Socket used to communicate
* Choose either PORT or SERVICE...
*/
#undef SERVICENAME
#undef PORTNUMBER
/*
* Hostname of console server
*/
#undef MASTERHOST
/*
* Config file path
*/
#undef CONFIGFILE
/*
* Password file path
*/
#undef PASSWDFILE
/*
* Number of consoles per child process
*/
#undef MAXMEMB
/*
* Number of child processes
*/
#undef MAXGRP
/*
* Clear parity (high-bit) [true/false setting]
*/
#undef CPARITY
/*
* TCP connection timeout
*/
#undef CONNECTTIMEOUT

View File

@ -1,83 +0,0 @@
#
# $Id: Make.host,v 1.13 94/06/03 15:32:46 nuspl Exp $
#
# Makefile for autologin
#
# Jeff W. Stewart, Purdue University Computing Center
#
DESTDIR=
BINDIR= ${DESTDIR}/usr/local/etc
INCLUDE=
DEBUG= -g
DEFS= -DPUCC -DSUN5
CFLAGS= ${DEBUG} ${DEFS} ${INCLUDE}
GENC= main.c
GENH= main.h
GEN= ${GENC} ${GENH}
HDR=
SRC= autologin.c
OBJ= autologin.o main.o
SOURCE= README autologin.man autologin.m Makefile ${SRC} ${HDR}
all: autologin
autologin: ${OBJ}
${CC} ${CFLAGS} -o autologin ${OBJ}
main.h: main.c
main.c: autologin.m
mkcmd std_help.m std_version.m autologin.m
-(cmp -s prog.c main.c || (cp prog.c main.c && echo main.c updated))
-(cmp -s prog.h main.h || (cp prog.h main.h && echo main.h updated))
rm -f prog.[ch]
# On keep (EPIX), putenv.o is extracted (ar x) from /usr/lib/libc.a
# and setgroups.o is extracted from libbsd.a
#
putenv.o:
ar x /usr/lib/libc.a $@
setgroups.o:
ar x /usr/lib/libbsd.a $@
getut.o:
ar x /sysv/usr/lib/libc.a $@
clean: FRC
rm -f autologin *.o errs core Makefile.bak a.out lint.errs ${GEN}
lint: ${HDR} ${SRC} ${GEN} FRC
lint -h ${CDEFS} ${INCLUDE} ${GEN} ${SRC}
install: all
install -c -s -m 755 autologin ${BINDIR}
distrib:
distrib -c ${BINDIR}/autologin
depend: ${HDR} ${SRC} ${GEN}
maketd -a ${HDR} ${SRC} ${GEN}
spotless: clean
rcsclean Makefile ${HDR} ${SRC}
source: ${SOURCE}
${SOURCE}:
co -q $@
FRC:
# DO NOT DELETE THIS LINE - maketd DEPENDS ON IT
main.o: main.c
autologin.o: autologin.c main.h
# *** Do not add anything here - It will go away. ***

51
autologin/Makefile.in Normal file
View File

@ -0,0 +1,51 @@
### Path settings
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sysconfdir = @sysconfdir@
### Installation programs and flags
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
LN_S = @LN_S@
MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
CFLAGS = @CFLAGS@ # -DPUCC -DSUN5
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@SET_MAKE@
### Makefile rules - no user-servicable parts below
AUTOLOGIN_OBJS = main.o autologin.o
AUTOLOGIN_HDRS = ../config.h $(top_srcdir)/compat.h $(srcdir)/main.h
ALL = autologin
all: $(ALL)
.PHONY: clean distclean install
autologin: $(AUTOLOGIN_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o autologin $(AUTOLOGIN_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(AUTOLOGIN_HDRS)
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o $(ALL) core
distclean: clean
rm -f Makefile
install:
$(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir)

View File

@ -10,6 +10,8 @@
*
* This program was written to be run out of inittab.
*/
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
@ -18,165 +20,27 @@
#include <grp.h>
#include <pwd.h>
#include <utmp.h>
#include <string.h>
#include <compat.h>
#include <errno.h>
#if !defined IBMR2
extern char *sys_errlist[];
#define strerror(Me) (sys_errlist[Me])
#endif
#define NEED_PUTENV (!(defined(IBMR2) || defined(EPIX) || defined(SUNOS) || defined(SUN5)))
#if S81
#include <sys/vlimit.h>
#else
#include <limits.h>
#endif
#if SUN5
#define USE_UTENT 1
#include <sys/time.h>
#include <sys/resource.h>
static int
getdtablesize()
{
auto struct rlimit rl;
(void)getrlimit(RLIMIT_NOFILE, &rl);
return rl.rlim_cur;
}
#endif
/* yucky kludges
*/
#ifdef EPIX
#include "/bsd43/usr/include/ttyent.h"
#include <posix/sys/termios.h>
#define NGROUPS_MAX 8
#define getsid(Mp) (Mp)
#define getdtablesize() 64
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
typedef int mode_t;
extern struct passwd *getpwnam();
extern struct group *getgrnam();
#define USE_TC 1
#define USE_UTENT 1
#else
#if defined IBMR2
#include <termios.h>
#define setsid() getpid()
#define getsid(Mp) (Mp)
#define HAVE_GETUSERATTR 1
#define USE_TC 1
#define USE_UTENT 1
#else
#if defined V386
typedef int mode_t;
#define getdtablesize() OPEN_MAX
#define setsid() getpid()
#define getsid(Mp) (Mp)
#define setgroups(x, y) 0
#include <sys/ttold.h>
#include <sys/ioctl.h>
#define USE_IOCTL 1
#define USE_TC 1
#else
#if defined S81
#include <sys/time.h>
#include <sys/ioctl.h>
typedef int mode_t;
#define setsid() getpid()
#define getsid(Mp) (Mp)
#define USE_IOCTL 1
#define USE_TC 0
#define USE_OLD_UTENT 1
#else
#if defined(NETBSD)
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/proc.h>
#include <sys/ioctl_compat.h>
#define setsid() getpid()
#define getsid(Mp) (Mp)
#define USE_IOCTL 1
#define USE_OLD_UTENT 1
#define PATH_SU "/usr/ucb/su"
#define UTMP_PATH "/var/run/utmp"
#else
#if defined(FREEBSD)
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/proc.h>
#include <sys/ioctl_compat.h>
#define setsid() getpid()
#define getsid(Mp) (Mp)
#define USE_IOCTL 1
#define USE_OLD_UTENT 1
#define PATH_SU "/usr/ucb/su"
#else
#include <sys/termios.h>
#endif /* NETBSD */
#endif /* 386bsd or equiv */
#endif /* sequent */
#endif /* intel v386 */
#endif /* find termios */
#endif /* find any term stuff */
#ifdef SUNOS
#include <sys/time.h>
#include <ttyent.h>
#define setsid() getpid()
#define getsid(Mp) (Mp)
#endif
#if ! defined V386
#include <sys/vnode.h>
#endif
#ifdef IBMR2
#include <sys/ioctl.h>
#include <usersec.h>
#endif /* IBMR2 */
#include "main.h"
#include <main.h>
#define TTYMODE 0600
#ifndef O_RDWR
#define O_RDWR 2
# define O_RDWR 2
#endif
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 8
#ifndef UTMP_FILE
# if defined(_PATH_UTMP)
# define UTMP_FILE _PATH_UTMP
# else
# define UTMP_FILE "/etc/utmp"
# endif
#endif
#if !defined(UTMP_FILE)
#if defined(_PATH_UTMP)
#define UTMP_FILE _PATH_UTMP
#else
#define UTMP_FILE "/etc/utmp"
#endif
#endif
#if !defined(PATH_SU)
#define PATH_SU "/bin/su"
#endif
/*
* Global variables
@ -185,7 +49,7 @@ typedef int mode_t;
#ifndef lint
char *rcsid = "$Id: autologin.c,v 1.22 93/09/04 21:48:41 ksb Exp $";
#endif /* not lint */
char *progname;
extern char *progname;
gid_t awGrps[NGROUPS_MAX];
int iGrps = 0;
@ -210,23 +74,28 @@ Process()
char *pcCmd = (char *)0,
*pcDevTty = (char *)0;
char *pcTmp;
#ifdef IBMR2
#ifdef HAVE_GETUSERATTR
char *pcGrps;
#endif /* IBMR2 */
#endif
struct passwd *pwd;
struct stat st;
#if USE_IOCTL
auto struct sgttyb n_sty;
#if USE_TC
auto struct tc n_tchars;
#else
auto struct tchars n_tchars;
#endif
#if HAVE_JOBS
auto struct ltchars n_ltchars;
#endif
#else
#ifdef HAVE_TERMIOS_H
struct termios n_tio;
#else
# ifdef TIOCNOTTY
# ifdef O_CBREAK
auto struct tc n_tchars;
# else
auto struct tchars n_tchars;
# endif
# ifdef TIOCGLTC
auto struct ltchars n_ltchars;
# endif
# else
# ifdef TIOCGETP
auto struct sgttyb n_sty;
# endif
# endif
#endif
@ -289,7 +158,7 @@ Process()
if (0 != stat(pcDevTty, &st)) {
(void) fprintf(stderr, "%s: Can't stat %s: %s\n", progname, pcDevTty, strerror(errno));
++iErrs;
#ifdef IBMR2
#if defined(VCHR) && defined(VMPC)
} else if (VCHR != st.st_type && VMPC != st.st_type) {
(void) fprintf(stderr, "%s: %s is not a character device\n", progname, pcDevTty);
++iErrs;
@ -351,39 +220,36 @@ Process()
/* put the tty in out process group
*/
#if ! (EPIX || SUN5)
#if USE_TC
#ifdef HAVE_TCGETPGRP
if (-1 >= (i = tcgetpgrp(0))){
(void) fprintf(stderr, "%s: tcgetpgrp: %s\n", progname, strerror(errno));
}
#endif
#if USE_SETPGRP
#ifndef SETPGRP_VOID
if (-1 != i && setpgrp(0, i) ){
(void) fprintf(stderr, "%s: setpgrp: %s, i = %d\n", progname, strerror(errno), i);
}
#endif
#if USE_TC
#ifdef HAVE_TCSETPGRP
if (tcsetpgrp(0, iNewGrp)){
(void) fprintf(stderr, "%s: tcsetpgrp: %s\n", progname, strerror(errno));
}
#endif
#if USE_SETPGRP
#ifndef SETPGRP_VOID
if (-1 != iNewGrp && setpgrp(0, iNewGrp)){
(void) fprintf(stderr, "%s: setpgrp: %s, iNewGrp = %d\n", progname, strerror(errno), iNewGrp);
}
#endif
#endif
/* put the tty in the correct mode
*/
#if USE_IOCTL
#ifndef HAVE_TERMIOS_H
if (0 != ioctl(0, TIOCGETP, (char *)&n_sty)) {
fprintf(stderr, "%s: iotcl: getp: %s\n", progname, strerror(errno));
exit(10);
}
#if USE_TC
#ifdef O_CBREAK
n_sty.sg_flags &= ~(O_CBREAK);
n_sty.sg_flags |= (O_CRMOD|O_ECHO);
#else
@ -411,7 +277,7 @@ Process()
return;
}
#endif
#if HAVE_JOBS
#ifdef TIOCGLTC
if (-1 == ioctl(0, TIOCGLTC, (char *)&n_ltchars)) {
fprintf(stderr, "%s: ioctl: gltc: %s\n", progname, strerror(errno));
return;
@ -426,7 +292,7 @@ Process()
}
#endif
#else /* not using ioctl, using POSIX or sun stuff */
#if USE_TC
#ifdef HAVE_TCGETATTR
if (0 != tcgetattr(0, &n_tio)) {
(void) fprintf(stderr, "%s: tcgetattr: %s\n", progname, strerror(errno));
exit(1);
@ -455,19 +321,21 @@ Process()
n_tio.c_cc[VSTART] = '\021'; /* ^Q */
n_tio.c_cc[VSTOP] = '\023'; /* ^S */
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */
#if USE_TC
#ifdef HAVE_TCSETATTR
if (0 != tcsetattr(0, TCSANOW, &n_tio)) {
(void) fprintf(stderr, "%s: tcsetattr: %s\n", progname, strerror(errno));
exit(1);
/* NOTREACHED */
}
#else
#ifndef HAVE_TERMIOS_H
if (0 != ioctl(0, TCSETS, &n_tio)) {
(void) fprintf(stderr, "%s: ioctl: TCSETS: %s\n", progname, strerror(errno));
exit(1);
/* NOTREACHED */
}
#endif
#endif
#endif /* setup tty */
if (fMakeUtmp) {
@ -488,7 +356,7 @@ Process()
}
}
#if NEED_PUTENV
#ifndef HAVE_PUTENV
int
putenv(pcAssign)
char *pcAssign;
@ -567,20 +435,7 @@ char *pctty;
pcDev = pctty;
}
#if USE_OLD_UTENT
/* look through /etc/utmp by hand (sigh)
*/
iFound = iPos = 0;
while (sizeof(utmp) == read(fdUtmp, & utmp, sizeof(utmp))) {
if (0 == strncmp(utmp.ut_line, pcDev, sizeof(utmp.ut_line))) {
++iFound;
break;
}
iPos++;
}
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
#else
#if USE_UTENT
#ifdef HAVE_GETUTENT
/* look through getutent's by pid
*/
(void)setutent();
@ -603,6 +458,7 @@ char *pctty;
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
}
#else
#ifdef HAVE_SETTTYENT
{
register struct ttyent *ty;
@ -623,6 +479,18 @@ char *pctty;
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
(void)strncpy(utmp.ut_host, "(autologin)", sizeof(utmp.ut_host));
#else
/* look through /etc/utmp by hand (sigh)
*/
iFound = iPos = 0;
while (sizeof(utmp) == read(fdUtmp, & utmp, sizeof(utmp))) {
if (0 == strncmp(utmp.ut_line, pcDev, sizeof(utmp.ut_line))) {
++iFound;
break;
}
iPos++;
}
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
#endif
#endif
utmp.ut_time = time((time_t *) 0);

View File

@ -3,173 +3,15 @@
* built by mkcmd version 7.6 Gamma
*/
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
extern int errno;
extern char *malloc(), *calloc(), *realloc();
#define ENVOPT 0
#define GETARG 0
#define GETOPT 1
/* from std_help.m */
/* from std_version.m */
/* from autologin.m */
/* $Id: T.c,v 7.2 94/07/11 00:42:06 ksb Exp $
* literal text included from a tempate
* based on Keith Bostic's getopt in comp.sources.unix volume1
* modified for mkcmd use.... by ksb@cc.purdue.edu (Kevin Braunsdorf)
*/
#if GETOPT || GETARG
/* IBMR2 (AIX in the real world) defines
* optind and optarg in <stdlib.h> and confuses the hell out
* of the C compiler. So we use those externs. I guess we will
* have to stop using the old names. -- ksb
*/
#ifdef _AIX
#include <stdlib.h>
#else
static int
optind = 1; /* index into parent argv vector */
static char
*optarg; /* argument associated with option */
#endif
#endif /* only if we use them */
#if ENVOPT
/* breakargs - break a string into a string vector for execv.
*
* Note, when done with the vector, merely "free" the vector.
* Written by Stephen Uitti, PUCC, Nov '85 for the new version
* of "popen" - "nshpopen", that doesn't use a shell.
* (used here for the as filters, a newer option).
*
* breakargs is copyright (C) Purdue University, 1985
*
* Permission is hereby given for its free reproduction and
* modification for All purposes.
* This notice and all embedded copyright notices be retained.
*/
/* this trys to emulate shell quoting, but I doubt it does a good job (ksb)
* [[ but not substitution -- that would be silly ]]
*/
static char *
u_mynext(u_pcScan, u_pcDest)
register char *u_pcScan, *u_pcDest;
{
register int u_fQuote;
for (u_fQuote = 0; *u_pcScan != '\000' && (u_fQuote||(*u_pcScan != ' ' && *u_pcScan != '\t')); ++u_pcScan) {
switch (u_fQuote) {
default:
case 0:
if ('"' == *u_pcScan) {
u_fQuote = 1;
continue;
} else if ('\'' == *u_pcScan) {
u_fQuote = 2;
continue;
}
break;
case 1:
if ('"' == *u_pcScan) {
u_fQuote = 0;
continue;
}
break;
case 2:
if ('\'' == *u_pcScan) {
u_fQuote = 0;
continue;
}
break;
}
if ((char*)0 != u_pcDest) {
*u_pcDest++ = *u_pcScan;
}
}
if ((char*)0 != u_pcDest) {
*u_pcDest = '\000';
}
return u_pcScan;
}
/* given an envirionment variable insert it in the option list (ksb)
* (exploded with the above routine)
*/
static int
u_envopt(cmd, pargc, pargv)
char *cmd, *(**pargv);
int *pargc;
{
register char *p; /* tmp */
register char **v; /* vector of commands returned */
register unsigned sum; /* bytes for malloc */
register int i, j; /* number of args */
register char *s; /* save old position */
while (*cmd == ' ' || *cmd == '\t')
cmd++;
p = cmd; /* no leading spaces */
i = 1 + *pargc;
sum = sizeof(char *) * i;
while (*p != '\000') { /* space for argv[]; */
++i;
s = p;
p = u_mynext(p, (char *)0);
sum += sizeof(char *) + 1 + (unsigned)(p - s);
while (*p == ' ' || *p == '\t')
p++;
}
++i;
/* vector starts at v, copy of string follows NULL pointer
* the extra 7 bytes on the end allow use to be alligned
*/
v = (char **)malloc(sum+sizeof(char *)+7);
if (v == NULL)
return 0;
p = (char *)v + i * sizeof(char *); /* after NULL pointer */
i = 0; /* word count, vector index */
v[i++] = (*pargv)[0];
while (*cmd != '\000') {
v[i++] = p;
cmd = u_mynext(cmd, p);
p += strlen(p)+1;
while (*cmd == ' ' || *cmd == '\t')
++cmd;
}
for (j = 1; j < *pargc; ++j)
v[i++] = (*pargv)[j];
v[i] = NULL;
*pargv = v;
*pargc = i;
return i;
}
#endif /* u_envopt called */
#if GETARG
/*
* return each non-option argument one at a time, EOF for end of list
*/
static int
u_getarg(nargc, nargv)
int nargc;
char **nargv;
{
if (nargc <= optind) {
optarg = (char *) 0;
return EOF;
}
optarg = nargv[optind++];
return 0;
}
#endif /* u_getarg called */
#include <compat.h>
#if GETOPT
#ifndef HAVE_GETOPT
static int
optopt; /* character checked for validity */
@ -178,9 +20,9 @@ static int
* does +arg if you give a last argument of "+", else give (char *)0
*/
static int
u_getopt(nargc, nargv, ostr, estr)
getopt(nargc, nargv, ostr)
int nargc;
char **nargv, *ostr, *estr;
char **nargv, *ostr;
{
register char *oli; /* option letter list index */
static char EMSG[] = ""; /* just a null place */
@ -191,10 +33,6 @@ char **nargv, *ostr, *estr;
return EOF;
if (nargv[optind][0] != '-') {
register int iLen;
if ((char *)0 != estr && 0 == strncmp(estr, nargv[optind], iLen = strlen(estr))) {
optarg = nargv[optind++]+iLen;
return '+';
}
return EOF;
}
place = nargv[optind];
@ -239,10 +77,7 @@ char **nargv, *ostr, *estr;
}
return optopt; /* dump back option letter */
}
#endif /* u_getopt called */
#undef ENVOPT
#undef GETARG
#undef GETOPT
#endif /* ! HAVE_GETOPT */
char
*progname = "$Id$",
@ -274,12 +109,9 @@ int
#ifndef u_terse
#define u_terse (au_terse[0])
#endif
/* from std_help.m */
/* from std_version.m */
/* from autologin.m */
static char *rcsid =
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
/*
* parser
@ -302,7 +134,7 @@ char **argv;
progname = argv[0];
else
++progname;
while (EOF != (u_curopt = u_getopt(argc, argv, sbOpt, (char *)0))) {
while (EOF != (u_curopt = getopt(argc, argv, sbOpt))) {
switch (u_curopt) {
case '*':
fprintf(stderr, "%s: option `-%c\' needs a parameter\n", progname, optopt);

185
compat.h Normal file
View File

@ -0,0 +1,185 @@
#include <config.h>
/* hpux doesn't have getdtablesize() and they don't provide a macro
* in non-KERNEL cpp mode
*/
#ifndef HAVE_GETDTABLESIZE
# ifdef HAVE_GETRLIMIT
static int
getdtablesize()
{
auto struct rlimit rl;
(void)getrlimit(RLIMIT_NOFILE, &rl);
return rl.rlim_cur;
}
# else /* ! HAVE_GETRLIMIT */
# ifndef OPEN_MAX
# define OPEN_MAX 64
# endif
# define getdtablesize() OPEN_MAX
# endif /* HAVE_GETRLIMIT */
#endif /* ! HAVE_GETDTABLESIZE */
#if STDC_HEADERS
# include <string.h>
# include <stdlib.h>
#else
# include <strings.h>
# ifndef HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* if you do not have fd_set's here is a possible emulation
*/
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#ifndef FD_ZERO
typedef long fd_set;
# define FD_ZERO(a) {*(a)=0;}
# define FD_SET(d,a) {*(a) |= (1 << (d));}
# define FD_CLR(d,a) {*(a) &= ~(1 << (d));}
# define FD_ISSET(d,a) (*(a) & (1 << (d)))
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_IOCTL_COMPAT_H
# include <sys/ioctl_compat.h>
#endif
#ifdef HAVE_TERMIOS_H
# include <termios.h> /* POSIX */
#else
# ifdef HAVE_TERMIO_H
# include <termio.h> /* SysV */
# else
# ifdef HAVE_SGTTY_H
# include <sgtty.h> /* BSD */
# endif
# endif
#endif
#ifdef HAVE_STROPTS_H
# include <stropts.h>
#endif
#ifdef HAVE_TTYENT_H
# include <ttyent.h>
#endif
#ifdef HAVE_SYS_TTOLD_H
# include <sys/ttold.h>
#endif
/* which type does wait(2) take for status location
*/
#include <sys/types.h>
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifdef HAVE_SIGACTION
extern void Set_signal(int isg, RETSIGTYPE (*disp)(int));
#else
# define Set_signal(sig, disp) (void)signal((sig), (disp))
#endif
#include <errno.h>
#if !defined(HAVE_STRERROR)
extern int errno;
extern char *sys_errlist[];
# define strerror(Me) (sys_errlist[Me])
#endif
#if HAVE_H_ERRLIST
extern int h_errno;
extern char *h_errlist[];
# define hstrerror(Me) (h_errlist[Me])
#else
# define hstrerror(Me) "host lookup error"
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#if HAVE_SHADOW_H
# include <shadow.h>
#endif
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#endif
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#ifdef HAVE_SYS_VLIMIT_H
# include <sys/vlimit.h>
#else
# include <limits.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_PROC_H
# include <sys/proc.h>
#endif
#ifdef HAVE_SYS_AUDIT_H
# include <sys/audit.h>
#endif
#ifdef HAVE_USERSEC_H
#include <usersec.h>
#endif
#ifndef NGROUPS_MAX
# define NGROUPS_MAX 8
#endif
#ifndef HAVE_GETSID
# define getsid(Mp) (Mp)
#endif
#ifndef HAVE_SETSID
# define setsid() getpid()
#endif
#ifndef HAVE_SETGROUPS
# define setgroups(x, y) 0
#endif

234
config.h.in Normal file
View File

@ -0,0 +1,234 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/*
* Socket used to communicate
* Choose either PORT or SERVICE...
*/
#undef SERVICENAME
#undef PORTNUMBER
/*
* Hostname of console server
*/
#undef MASTERHOST
/*
* Config file path
*/
#undef CONFIGFILE
/*
* Password file path
*/
#undef PASSWDFILE
/*
* Number of consoles per child process
*/
#undef MAXMEMB
/*
* Number of child processes
*/
#undef MAXGRP
/*
* Clear parity (high-bit) [true/false setting]
*/
#undef CPARITY
/*
* TCP connection timeout
*/
#undef CONNECTTIMEOUT
/* Define if you have the flock function. */
#undef HAVE_FLOCK
/* Define if you have the getdtablesize function. */
#undef HAVE_GETDTABLESIZE
/* Define if you have the getopt function. */
#undef HAVE_GETOPT
/* Define if you have the getpseudo function. */
#undef HAVE_GETPSEUDO
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
/* Define if you have the getsid function. */
#undef HAVE_GETSID
/* Define if you have the getspnam function. */
#undef HAVE_GETSPNAM
/* Define if you have the getuserattr function. */
#undef HAVE_GETUSERATTR
/* Define if you have the getutent function. */
#undef HAVE_GETUTENT
/* Define if you have the memcmp function. */
#undef HAVE_MEMCMP
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memset function. */
#undef HAVE_MEMSET
/* Define if you have the ptsname function. */
#undef HAVE_PTSNAME
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setgroups function. */
#undef HAVE_SETGROUPS
/* Define if you have the setlinebuf function. */
#undef HAVE_SETLINEBUF
/* Define if you have the setpgrp function. */
#undef HAVE_SETPGRP
/* Define if you have the setsid function. */
#undef HAVE_SETSID
/* Define if you have the setsockopt function. */
#undef HAVE_SETSOCKOPT
/* Define if you have the setttyent function. */
#undef HAVE_SETTTYENT
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the tcgetpgrp function. */
#undef HAVE_TCGETPGRP
/* Define if you have the tcsendbreak function. */
#undef HAVE_TCSENDBREAK
/* Define if you have the tcsetattr function. */
#undef HAVE_TCSETATTR
/* Define if you have the tcsetpgrp function. */
#undef HAVE_TCSETPGRP
/* Define if you have the wait3 function. */
#undef HAVE_WAIT3
/* Define if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <shadow.h> header file. */
#undef HAVE_SHADOW_H
/* Define if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
/* Define if you have the <sys/audit.h> header file. */
#undef HAVE_SYS_AUDIT_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/ioctl_compat.h> header file. */
#undef HAVE_SYS_IOCTL_COMPAT_H
/* Define if you have the <sys/proc.h> header file. */
#undef HAVE_SYS_PROC_H
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/ttold.h> header file. */
#undef HAVE_SYS_TTOLD_H
/* Define if you have the <sys/uio.h> header file. */
#undef HAVE_SYS_UIO_H
/* Define if you have the <sys/vlimit.h> header file. */
#undef HAVE_SYS_VLIMIT_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <ttyent.h> header file. */
#undef HAVE_TTYENT_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <usersec.h> header file. */
#undef HAVE_USERSEC_H
/* Define if you have the crypt library (-lcrypt). */
#undef HAVE_LIBCRYPT
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if <signal.h> does not define sig_atomic_t */
#undef sig_atomic_t
/* Define if <sys/socket.h> does not define socklen_t */
#undef socklen_t

2462
configure vendored Executable file

File diff suppressed because it is too large Load Diff

200
configure.in Normal file
View File

@ -0,0 +1,200 @@
dnl ### Normal initialization. ######################################
AC_INIT(conserver/main.c)
AC_CONFIG_HEADER(config.h)
dnl ### Set some option defaults. ###################################
if test -z "$CFLAGS"; then
CFLAGS="-O"
fi
MKDIR="mkdir -p -m 755"
AC_SUBST(MKDIR)
dnl ### Custom settings. ############################################
AC_MSG_CHECKING(for port number specification)
AC_ARG_WITH(port,
[ --with-port=PORT Specify port number [conserver]],
[if test "$withval" != yes -a "$withval" != no; then
if expr "$withval" : '.*[[^0-9]]' >/dev/null 2>&1; then
AC_DEFINE_UNQUOTED(SERVICENAME, "$withval")
AC_MSG_RESULT(/etc/services name '$withval')
else
AC_DEFINE_UNQUOTED(PORTNUMBER, $withval)
AC_MSG_RESULT(port $withval)
fi
else
AC_DEFINE_UNQUOTED(SERVICENAME, "conserver")
AC_MSG_RESULT(/etc/services name 'conserver')
fi],
[AC_DEFINE_UNQUOTED(SERVICENAME, "conserver")
AC_MSG_RESULT(/etc/services name 'conserver')])
AC_MSG_CHECKING(for master conserver hostname)
AC_ARG_WITH(master,
[ --with-master=MASTER Specify master server hostname [console]],
[if test "$withval" != yes; then
AC_DEFINE_UNQUOTED(MASTERHOST, "$withval")
AC_MSG_RESULT('$withval')
else
AC_DEFINE_UNQUOTED(MASTERHOST, "console")
AC_MSG_RESULT('console')
fi],
[AC_DEFINE_UNQUOTED(MASTERHOST, "console")
AC_MSG_RESULT('console')])
AC_MSG_CHECKING(for configuration filename)
AC_ARG_WITH(cffile,
[ --with-cffile=CFFILE Specify config filename [conserver.cf] ],
[if test "$withval" != yes; then
AC_DEFINE_UNQUOTED(CONFIGFILE, "$withval")
AC_MSG_RESULT('$withval')
else
AC_DEFINE_UNQUOTED(CONFIGFILE, "conserver.cf")
AC_MSG_RESULT('conserver.cf')
fi],
[AC_DEFINE_UNQUOTED(CONFIGFILE, "conserver.cf")
AC_MSG_RESULT('conserver.cf')])
AC_MSG_CHECKING(for password filename)
AC_ARG_WITH(pwdfile,
[ --with-pwdfile=PWDFILE Specify password filename [conserver.passwd] ],
[if test "$withval" != yes; then
AC_DEFINE_UNQUOTED(PASSWDFILE, "$withval")
AC_MSG_RESULT('$withval')
else
AC_DEFINE_UNQUOTED(PASSWDFILE, "conserver.passwd")
AC_MSG_RESULT('conserver.passwd')
fi],
[AC_DEFINE_UNQUOTED(PASSWDFILE, "conserver.passwd")
AC_MSG_RESULT('conserver.passwd')])
AC_MSG_CHECKING(for MAXMEMB setting)
AC_ARG_WITH(maxmemb,
[ --with-maxmemb=MAXMEMB Specify maximum consoles per process [16]],
[if test "$withval" != yes; then
AC_DEFINE_UNQUOTED(MAXMEMB, $withval)
AC_MSG_RESULT($withval)
else
AC_DEFINE_UNQUOTED(MAXMEMB, 16)
AC_MSG_RESULT(16)
fi],
[AC_DEFINE_UNQUOTED(MAXMEMB, 16)
AC_MSG_RESULT(16)])
AC_MSG_CHECKING(for MAXGRP setting)
AC_ARG_WITH(maxgrp,
[ --with-maxgrp=MAXGRP Specify maximum number of processes [32]],
[if test "$withval" != yes; then
AC_DEFINE_UNQUOTED(MAXGRP, $withval)
AC_MSG_RESULT($withval)
else
AC_DEFINE_UNQUOTED(MAXGRP, 32)
AC_MSG_RESULT(32)
fi],
[AC_DEFINE_UNQUOTED(MAXGRP, 32)
AC_MSG_RESULT(32)])
AC_MSG_CHECKING(for 8bit setting)
AC_ARG_ENABLE(8bit,
[ --enable-8bit Enable 8bit data path ],
[AC_DEFINE_UNQUOTED(CPARITY, 0)
AC_MSG_RESULT(yes)],
[AC_DEFINE_UNQUOTED(CPARITY, 1)
AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for connect() timeout)
AC_ARG_WITH(timeout,
[ --with-timeout=TIMEOUT Specify connect() timeout in seconds [10]],
[if test "$withval" -gt 0 -o "$withval" -lt 300; then
AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, $withval)
AC_MSG_RESULT($withval)
else
AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, 10)
AC_MSG_RESULT(10)
fi],
[AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, 10)
AC_MSG_RESULT(10)])
dnl ### Check for compiler et al. ###################################
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl ### Compiler characteristics. ##################################
AC_AIX
AC_C_CONST
dnl ### Checks for header files. ###################################
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/ioctl.h)
dnl ### POSIX terminal I/O
AC_CHECK_HEADERS(termios.h)
if test "$ac_cv_header_termios_h" != "yes"; then
dnl ### SysV terminal I/O
AC_CHECK_HEADERS(termio.h)
if test "$ac_cv_header_termio_h" != "yes"; then
dnl ### BSD terminal I/O
AC_CHECK_HEADERS(sgtty.h)
if test "$ac_cv_header_sgtty_h" != "yes"; then
AC_MSG_ERROR([no usable terminal interface detected])
fi
fi
fi
AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/proc.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h)
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_TYPE_MODE_T
AC_TYPE_SIGNAL
AC_CACHE_CHECK([if sig_atomic_t is defined], ac_cv_type_sig_atomic_t,
AC_TRY_LINK([
#include <signal.h>
], [
sig_atomic_t sigatom;
sigatom = 1;
],
ac_cv_type_sig_atomic_t=yes,
ac_cv_type_sig_atomic_t=no
)
)
if test "$ac_cv_type_sig_atomic_t" != "yes"; then
AC_DEFINE(sig_atomic_t, volatile int, [Define if <signal.h> does not define sig_atomic_t])
fi
AC_CACHE_CHECK([if socklen_t is defined], ac_cv_type_socklen_t,
AC_TRY_LINK([
#include <sys/socket.h>
], [
socklen_t len = 0;
printf("len == %d\n", len);
],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no
)
)
if test "$ac_cv_type_socklen_t" != "yes"; then
AC_DEFINE(socklen_t, int, [Define if <sys/socket.h> does not define socklen_t])
fi
dnl ### Check for needed functions. ################################
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent wait3 getspnam setlinebuf setvbuf getpseudo ptsname flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp)
AC_FUNC_SETPGRP
dnl ### Check for libraries. #######################################
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_LIB(crypt,crypt)
dnl ### Create output files. #######################################
AC_SUBST(LIBOBJS)
AC_OUTPUT(Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile)

View File

@ -1,30 +0,0 @@
# $Id: Makefile,v 1.6 1999-04-12 21:29:57-07 bryan Exp $
#
# Makefile for conserver.cf
#
PREFIX=/usr/local
BIN=${PREFIX}/bin
ETC=${PREFIX}/etc
MAN=${PREFIX}/man
MANSECT=4
all:
clean: FRC
rm -f Makefile.bak *.tbl core errs lint.out tags
depend:
dirs:
install:
${MAN}/man${MANSECT}:
${INSTALL} -d $@
install.man: ${MAN}/man${MANSECT}
tbl conserver.cf.man > conserver.cf.tbl
${INSTALL} -c conserver.cf.tbl ${MAN}/man${MANSECT}/conserver.cf.${MANSECT}
FRC:

28
conserver.cf/Makefile.in Normal file
View File

@ -0,0 +1,28 @@
### Path settings
srcdir = @srcdir@
prefix = @prefix@
mandir = @mandir@
sysconfdir = @sysconfdir@
### Installation programs and flags
INSTALL = @INSTALL@
MKDIR = @MKDIR@
@SET_MAKE@
### Makefile rules - no user-servicable parts below
all:
.PHONY: clean distclean install
clean:
rm -f *~ *.o $(ALL) core
distclean: clean
rm -f Makefile
install:
$(MKDIR) $(DESTDIR)$(mandir)/man8
$(INSTALL) conserver.cf.man $(DESTDIR)$(mandir)/man8/conserver.cf.8

View File

@ -1,71 +0,0 @@
# $Id: Makefile,v 1.12 1999-02-02 17:02:25-08 bryan Exp $
#
# Makefile for console server
#
PROG=conserver
PREFIX=/usr/local
BIN=${PREFIX}/bin
ETC=${PREFIX}/etc
MAN=${PREFIX}/man
MANSECT=8
CFLAGS= ${DEBUG} ${CDEFS} ${INCLUDE}
HDR= cons.h \
access.h client.h consent.h group.h main.h master.h \
readcfg.h
SRC= access.c client.c consent.c group.c main.c master.c \
readcfg.c fallback.c
OBJ= access.o client.o consent.o group.o main.o master.o \
readcfg.o fallback.o
INIT= conserver.rc
all: ${PROG}
${PROG}: ${OBJ}
${CC} -o $@ ${CFLAGS} ${OBJ} ${LIBS}
clean: FRC
rm -f Makefile.bak ${PROG} *.tbl a.out *.o core errs lint.out tags
depend: ${HDR} ${SRC} FRC
makedepend ${CDEFS} ${INCLUDE} ${SRC}
dirs: ${BIN} ${ETC}
install: all dirs ${INIT} FRC
${INSTALL} -cs ${PROG} ${BIN}/${PROG}
${INSTALL} -c ${INIT} ${ETC}/${INIT}
${MAN}/man${MANSECT}:
${INSTALL} -d $@
install.man: ${MAN}/man${MANSECT}
tbl conserver.man > conserver.tbl
${INSTALL} -c conserver.tbl ${MAN}/man${MANSECT}/conserver.${MANSECT}
lint: ${HDR} ${SRC} FRC
lint -h ${CDEFS} ${INCLUDE} ${SRC}
tags: ${HDR} ${SRC}
ctags -t ${HDR} ${SRC}
/ ${BIN} ${ETC}:
${INSTALL} -d $@
FRC:
# DO NOT DELETE THIS LINE -- make depend depends on it.
access.o: cons.h port.h access.h consent.h client.h group.h readcfg.h main.h
client.o: cons.h port.h consent.h client.h
consent.o: cons.h port.h consent.h client.h main.h
fallback.o: cons.h port.h
group.o: cons.h port.h consent.h client.h access.h group.h version.h main.h
main.o: cons.h port.h consent.h client.h group.h master.h access.h readcfg.h
main.o: version.h
master.o: cons.h port.h consent.h client.h group.h access.h master.h
master.o: readcfg.h version.h main.h
readcfg.o: cons.h port.h consent.h client.h group.h access.h readcfg.h
readcfg.o: master.h main.h

59
conserver/Makefile.in Normal file
View File

@ -0,0 +1,59 @@
### Path settings
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
### Installation programs and flags
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
LN_S = @LN_S@
MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
CFLAGS = @CFLAGS@ # -DPUCC -DSUN5
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@SET_MAKE@
### Makefile rules - no user-servicable parts below
CONSERVER_OBJS = access.o client.o consent.o group.o main.o master.o \
readcfg.o fallback.o
CONSERVER_HDRS = ../config.h $(top_srcdir)/compat.h $(srcdir)/cons.h $(srcdir)/access.h \
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/group.h \
$(srcdir)/main.h $(srcdir)/master.h $(srcdir)/readcfg.h
ALL = conserver
all: $(ALL)
.PHONY: clean distclean install
conserver: $(CONSERVER_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(CONSERVER_HDRS)
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o $(ALL) core
distclean: clean
rm -f Makefile
install:
$(MKDIR) $(DESTDIR)$(sbindir)
$(INSTALL_PROGRAM) conserver $(DESTDIR)$(sbindir)
$(MKDIR) $(DESTDIR)$(mandir)/man8
$(INSTALL) conserver.man $(DESTDIR)$(mandir)/man8/conserver.8
$(MKDIR) $(DESTDIR)$(sysconfdir)
$(INSTALL) conserver.rc $(DESTDIR)$(sysconfdir)

View File

@ -1,5 +1,5 @@
/*
* $Id: access.c,v 5.15 2000-12-13 12:31:07-08 bryan Exp $
* $Id: access.c,v 5.17 2001-02-08 15:31:07-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -38,37 +38,31 @@ static char copyright[] =
"@(#) Copyright 1992 Purdue Research Foundation.\nAll rights reserved.\n";
#endif
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "access.h"
#include "consent.h"
#include "client.h"
#include "group.h"
#include "readcfg.h"
#include "main.h"
#include <compat.h>
#include <port.h>
#include <access.h>
#include <consent.h>
#include <client.h>
#include <group.h>
#include <readcfg.h>
#include <main.h>
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
/* in the routines below (the init code) we can bomb if malloc fails (ksb)

View File

@ -1,5 +1,5 @@
/*
* $Id: client.c,v 5.22 2000-12-13 12:31:07-08 bryan Exp $
* $Id: client.c,v 5.24 2001-02-08 15:31:40-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -37,46 +37,41 @@
static char copyright[] =
"@(#) Copyright 1992 Purdue Research Foundation.\nAll rights reserved.\n";
#endif
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include <compat.h>
#include <port.h>
#include <consent.h>
#include <client.h>
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
/* find the next guy who wants to write on the console (ksb)
*/
CLIENT *
CONSCLIENT *
FindWrite(pCL)
CLIENT *pCL;
CONSCLIENT *pCL;
{
/* return the first guy to have the `want write' bit set
* (tell him of the promotion, too) we could look for the
* most recent or some such... I guess it doesn't matter that
* much.
*/
for (/*passed in*/; (CLIENT *)0 != pCL; pCL = pCL->pCLnext) {
for (/*passed in*/; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
if (!pCL->fwantwr)
continue;
if (!pCL->pCEto->fup || pCL->pCEto->fronly)
@ -90,7 +85,7 @@ CLIENT *pCL;
}
return pCL;
}
return (CLIENT *)0;
return (CONSCLIENT *)0;
}
#if HAVE_IDENTD
@ -99,7 +94,7 @@ CLIENT *pCL;
* limits. We call identd/tap/auth to get info and compare
*/
IdentifyMe(pCL)
CLIENT *pCL;
CONSCLIENT *pCL;
{
/* ZZZ */
/* we would have to getsockname(fdClient)
@ -261,7 +256,7 @@ static HELP aHLTable[] = {
*/
void
HelpUser(pCL)
CLIENT *pCL;
CONSCLIENT *pCL;
{
register int i, j, iCmp;
static char

View File

@ -1,5 +1,5 @@
/*
* $Id: client.h,v 5.14 2000-12-13 12:31:07-08 bryan Exp $
* $Id: client.h,v 5.15 2001-02-03 20:17:02-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -55,8 +55,8 @@ typedef struct client { /* Connection Information: */
short fwantwr; /* (client) wants to write */
short fecho; /* echo commands (not set by machines) */
char acid[128]; /* login and location of client */
long tym; /* time of connect */
long typetym; /* time of last keystroke */
time_t tym; /* time of connect */
time_t typetym; /* time of last keystroke */
char actym[32]; /* pre-formatted time */
struct consent
*pCEwant, /* what machine we would like to be on */
@ -75,9 +75,9 @@ typedef struct client { /* Connection Information: */
int mcursor; /* the length of the message */
struct sockaddr_in
cnct_port; /* where from */
} CLIENT;
} CONSCLIENT;
extern char *FmtCtl();
extern void Replay();
extern void HelpUser();
extern CLIENT *FindWrite();
extern CONSCLIENT *FindWrite();

View File

@ -1,51 +0,0 @@
/*
* $Id: cons-default.h,v 1.7 2000-12-13 12:31:07-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
* Copyright GNAC, Inc., 1998
*/
/*
* Socket used to communicate
* Choose either PORT or SERVICE...
*/
/*#define PORT 782*/
#define SERVICE "conserver"
/*
* Hostname of console server
*/
#define HOST "console"
/*
* Config file path
*/
#define CONFIG "/etc/conserver.cf"
/*
* Password file path
*/
#define PASSWD_FILE "/etc/conserver.passwd"
/*
* Number of consoles per child process
*/
#define MAXMEMB 8
/*
* Number of child processes
*/
#define MAXGRP 32
/*
* Clear parity (high-bit) [true/false setting]
*/
#define CPARITY 1
/*
* TCP connection timeout
*/
#define CONNECTTIMEOUT 10

View File

@ -1,9 +0,0 @@
/*
* $Id: cons-gnac.h,v 5.44 2000-12-13 12:31:07-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
* Copyright GNAC, Inc., 1998
*/

View File

@ -1,14 +0,0 @@
/*
* $Id: cons-test.h,v 1.6 2000-12-13 12:31:07-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
* Copyright GNAC, Inc., 1998
*/
#define PORT 7777
#define HOST "localhost"
#define CONFIG "../conserver.cf/test.cf"
#define PASSWD_FILE "./conserver.passwd"

View File

@ -1 +0,0 @@
cons-default.h

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.36 2000-12-13 12:31:07-08 bryan Exp $
* $Id: consent.c,v 5.39 2001-02-17 08:36:13-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -42,52 +42,27 @@ static char copyright[] =
"@(#) Copyright 1992 Purdue Research Foundation.\nAll rights reserved.\n";
#endif
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include "main.h"
#include <compat.h>
#if USE_TERMIO
#include <termio.h>
#else
#if USE_TERMIOS
#include <termios.h>
#include <unistd.h>
#else /* use ioctl stuff */
#include <sgtty.h>
#include <sys/ioctl.h>
#endif
#endif
#if USE_STREAMS
#include <stropts.h>
#endif
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <port.h>
#include <consent.h>
#include <client.h>
#include <main.h>
struct hostcache *hostcachelist=NULL;
@ -131,24 +106,23 @@ char *pcMode;
PARITY parity[] = {
#if USE_TERMIOS
#if !defined(PAREXT)
#define PAREXT 0
#endif
#if HAVE_TERMIOS_H
{' ', 0, 0}, /* Blank for network */
# if !defined(PAREXT)
# define PAREXT 0
# endif
{'e', PARENB|CS7, 0}, /* even */
{'m', PARENB|CS7|PARODD|PAREXT, 0}, /* mark */
{'o', PARENB|CS7|PARODD, 0}, /* odd */
{'p', CS8, 0}, /* pass 8 bits, no parity */
{'s', PARENB|CS7|PAREXT, 0}, /* space */
#else
{' ', 0, 0}, /* Blank for network */
#else /* ! HAVE_TERMIOS_H */
{'e', EVENP, ODDP}, /* even */
{'m', EVENP|ODDP, 0}, /* mark */
{'o', ODDP, EVENP}, /* odd */
#if defined(PASS8)
# if defined(PASS8)
{'p', PASS8,EVENP|ODDP},/* pass 8 bits, no parity */
#endif
# endif
{'s', 0, EVENP|ODDP} /* space */
#endif
};
@ -177,7 +151,7 @@ char *pcMode;
}
#if USE_TERMIOS
#if HAVE_TERMIOS_H
/* setup a tty device (ksb)
*/
static int
@ -243,18 +217,21 @@ CONSENT *pCE;
return -1;
}
#if USE_STREAMS
# if HAVE_STROPTS_H
/*
* eat all the streams modules upto and including ttcompat
*/
while (ioctl(pCE->fdtty, I_FIND, "ttcompat") == 0) {
while (ioctl(pCE->fdtty, I_FIND, "ttcompat") == 1) {
(void)ioctl(pCE->fdtty, I_POP, 0);
}
#endif
# endif
pCE->fup = 1;
return 0;
}
#else
#else /* ! HAVE_TERMIOS_H */
# ifdef HAVE_SGTTY_H
/* setup a tty device (ksb)
*/
@ -277,14 +254,12 @@ CONSENT *pCE;
pCE->fronly = 1;
}
#if USE_SOFTCAR
#if defined(TIOCSSOFTCAR)
# if defined(TIOCSSOFTCAR)
if (-1 == ioctl(pCE->fdtty, TIOCSSOFTCAR, &fSoftcar)) {
fprintf(stderr, "%s: softcar: %d: %s\n", progname, pCE->fdtty, strerror(errno));
return -1;
}
#endif
#endif
# endif
/* stty 9600 raw cs7
*/
@ -333,18 +308,20 @@ CONSENT *pCE;
fprintf(stderr, "%s: ioctl6: %d: %s\n", progname, pCE->fdtty, strerror(errno));
return -1;
}
#if USE_STREAMS
# if HAVE_STROPTS_H
/* pop off the un-needed streams modules (on a sun3 machine esp.)
* (Idea by jrs@ecn.purdue.edu)
*/
while (ioctl(pCE->fdtty, I_POP, 0) == 0) {
/* eat all the streams modules */;
}
#endif
# endif
pCE->fup = 1;
return 0;
}
#endif
# endif /* HAVE_SGTTY_H */
#endif /* HAVE_TERMIOS_H */
#if DO_VIRTUAL
/* setup a virtual device (ksb)
@ -353,16 +330,18 @@ static int
VirtDev(pCE)
CONSENT *pCE;
{
#if USE_TERMIOS
# if HAVE_TERMIOS_H
static struct termios n_tio;
#else
# else
# ifdef HAVE_SGTTY_H
auto struct sgttyb sty;
auto struct tchars m_tchars;
auto struct ltchars m_ltchars;
#endif
#if HAVE_RLIMIT
# endif
# endif
# if HAVE_RLIMIT
auto struct rlimit rl;
#endif
# endif
auto int i, iNewGrp;
auto int fd;
extern char **environ;
@ -391,12 +370,12 @@ CONSENT *pCE;
/* setup new process with clean filew descriptors
*/
#if HAVE_RLIMIT
# if HAVE_RLIMIT
getrlimit(RLIMIT_NOFILE, &rl);
i = rl.rlim_cur;
#else
# else
i = getdtablesize();
#endif
# endif
for (/* i above */; i-- > 2; ) {
close(i);
}
@ -404,45 +383,50 @@ CONSENT *pCE;
*/
close(1);
close(0);
#if defined(TIOCNOTTY)
# if defined(TIOCNOTTY)
if (-1 != (i = open("/dev/tty", 2, 0))) {
ioctl(i, TIOCNOTTY, (char *)0);
close(i);
}
#endif
# endif
#if HAVE_SETSID
# if HAVE_SETSID
iNewGrp = setsid();
if (-1 == iNewGrp) {
fprintf(stderr, "%s: %s: setsid: %s\n", progname, pCE->server, strerror(errno));
iNewGrp = getpid();
}
#else
# else
iNewGrp = getpid();
#endif
# endif
if (0 != open(pCE->acslave, 2, 0) || 1 != dup(0)) {
fprintf(stderr, "%s: %s: fd sync error\n", progname, pCE->server);
exit(1);
}
#if HAVE_PTSNAME
# if HAVE_PTSNAME
/* SYSVr4 semantics for opening stream ptys (gregf)
* under PTX (others?) we have to push the compatibility
* streams modules `ptem' and `ld'
*/
(void)ioctl(0, I_PUSH, "ptem");
(void)ioctl(0, I_PUSH, "ld");
#endif
#if HAVE_LDTERM
# endif
# if HAVE_LDTERM
(void)ioctl(0, I_PUSH, "ptem");
(void)ioctl(0, I_PUSH, "ldterm");
#endif
#if HAVE_STTY_LD
# endif
# if HAVE_STTY_LD
(void)ioctl(0, I_PUSH, "stty_ld");
#endif
# endif
#if USE_TERMIOS
if (0 != ioctl(0, TCGETS, & n_tio)) {
# if HAVE_TERMIOS_H
# ifdef HAVE_TCGETATTR
if (0 != tcgetattr(0, &n_tio))
# else
if (0 != ioctl(0, TCGETS, & n_tio))
# endif
{
fprintf(stderr, "%s: iotcl: getsw: %s\n", progname, strerror(errno));
exit(1);
}
@ -462,13 +446,18 @@ CONSENT *pCE;
n_tio.c_cc[VSTART] = '\021';
n_tio.c_cc[VSTOP] = '\023';
n_tio.c_cc[VSUSP] = '\032';
if (0 != ioctl(0, TCSETS, & n_tio)) {
# ifdef HAVE_TCSETATTR
if (0 != tcsetattr(0, TCSANOW, & n_tio))
# else
if (0 != ioctl(0, TCSETS, & n_tio))
# endif
{
fprintf(stderr, "%s: getarrt: %s\n", progname, strerror(errno));
exit(1);
}
tcsetpgrp(0, iNewGrp);
#else
# else /* ! HAVE_TERMIOS_H */
/* stty 9600 raw cs7
*/
if (-1 == ioctl(0, TIOCGETP, (char *)&sty)) {
@ -520,10 +509,14 @@ CONSENT *pCE;
/* give us a process group to work in
*/
ioctl(0, TIOCGPGRP, (char *)&i);
# ifndef SETPGRP_VOID
setpgrp(0, i);
# endif
ioctl(0, TIOCSPGRP, (char *)&iNewGrp);
# ifndef SETPGRP_VOID
setpgrp(0, iNewGrp);
#endif
# endif
# endif /* HAVE_TERMIOS_H */
close(2);
(void)dup(1); /* better be 2, but it is too late now */
@ -555,7 +548,7 @@ CONSENT *pCE;
exit(1);
/*NOTREACHED*/
}
#endif
#endif /* DO_VIRTUAL */
/* down a console, virtual or real (ksb)
*/
@ -682,7 +675,7 @@ int useHostCache;
{
struct sockaddr_in port;
struct hostent *hp;
int one = 1;
size_t one = 1;
int flags;
fd_set fds;
struct timeval tv;
@ -695,9 +688,9 @@ int useHostCache;
return;
}
#if USLEEP_FOR_SLOW_PORTS
# if USLEEP_FOR_SLOW_PORTS
usleep( USLEEP_FOR_SLOW_PORTS ); /* Sleep for slow network ports */
#endif
# endif
bzero(&port, sizeof(port));
@ -776,11 +769,7 @@ int useHostCache;
if (getsockopt(pCE->fdtty, SOL_SOCKET, SO_ERROR,
(char*)&flags, &one) < 0)
{
#if defined(SUN5)
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
#else
fprintf(stderr, "%s: getsockopt SO_ERROR: %s (%d@%s): %s: forcing down\n",
#endif
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
@ -800,9 +789,9 @@ int useHostCache;
* Poke the connection to get the annex to wake up and
* register this connection.
*/
#ifdef POKE_ANNEX
# ifdef POKE_ANNEX
write(pCE->fdtty, "\r\n", 2);
#endif
# endif
} else if (-1 == (pCE->fdtty = open(pCE->dfile, O_RDWR|O_NDELAY, 0600))) {
fprintf(stderr, "%s: open: %s: %s\n", progname, pCE->dfile, strerror(errno));
(void)close(pCE->fdlog);
@ -824,7 +813,7 @@ int useHostCache;
{
TtyDev(pCE);
}
#else
#else /* ! DO_VIRTUAL */
if (-1 == (pCE->fdtty = open(pCE->dfile, O_RDWR|O_NDELAY, 0600))) {
fprintf(stderr, "%s: open: %s: %s\n", progname, pCE->dfile, strerror(errno));
(void)close(pCE->fdlog);
@ -836,5 +825,5 @@ int useHostCache;
/* ok, now setup the device
*/
TtyDev(pCE);
#endif
#endif /* DO_VIRTUAL */
}

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.15 2000-12-13 12:31:07-08 bryan Exp $
* $Id: consent.h,v 5.16 2001-02-03 20:19:14-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -84,7 +84,7 @@ typedef struct consent { /* console information */
int fdtty; /* the port to talk to machine on */
short int fup; /* we setup this line? */
short int fronly; /* we can only read this console */
short int iend; /* like icursor in CLIENT */
short int iend; /* like icursor in CONSCLIENT */
short int inamelen; /* strlen(server) */
struct client *pCLon; /* clients on this console */
struct client *pCLwr; /* client that is writting on console */

View File

@ -1,5 +1,5 @@
/*
* $Id: fallback.c,v 5.22 2000-12-13 12:31:07-08 bryan Exp $
* $Id: fallback.c,v 5.24 2001-02-08 15:31:58-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -13,6 +13,9 @@
*
* Mike Rowan (mtr@mace.cc.purdue.edu)
*/
#include <config.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -20,7 +23,6 @@
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <syslog.h>
@ -29,34 +31,12 @@
#include <stdio.h>
#include <ctype.h>
#include "cons.h"
#include "port.h"
#include <compat.h>
#if HAVE_PTSNAME
/* for grantpt() and unlockpt() (gregf)
*/
#include <stdlib.h>
#endif
#if NEED_UNISTD_H
#include <unistd.h>
#endif
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <port.h>
#if DO_VIRTUAL && ! HAVE_PTYD
extern int errno;
#if !HAVE_STRERROR
extern char *sys_errlist[], *strchr();
#define strerror(Me) (sys_errlist[Me])
#endif
static char *__pty_host;
static char *__pty_fmt;
@ -69,42 +49,42 @@ static int iLogPri = LOG_DEBUG;
* everything that uses pty's. For the most part, we'll be trying to
* make /dev/ptyq* the "free" pty's.
*/
#if defined(sun)
# if defined(sun)
static char charone[] =
"prstuvwxyzPQRSTUVWq";
#else
#if defined(dynix)
# else
# if defined(dynix)
static char charone[] =
"prstuvwxyzPQRSTUVWq";
#else
#if defined(ultrix)
# else
# if defined(ultrix)
static char charone[] =
"prstuvwxyzPQRSTUVWq";
#else
# else
/* all the world's a vax ;-) */
static char charone[] =
"prstuvwxyzPQRSTUVWq";
#endif
#endif
#endif
# endif
# endif
# endif
static char chartwo[] =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
#if (defined(_AIX) || defined(PTX4))
# if (defined(_AIX) || defined(PTX4))
static char acMaster[] =
"/dev/ptc/XXXXXXXXX";
static char acSlave[] =
"/dev/pts/XXXXXXXXX";
#else
# else
static char acMaster[] =
"/dev/ptyXX";
static char acSlave[] =
"/dev/ttyXX";
#endif /* _AIX */
# endif /* _AIX */
#if !HAVE_GETPSEUDO
#ifdef _AIX
# if !HAVE_GETPSEUDO
# ifdef _AIX
/*
* get a pty for the user (emulate the neato sequent call) (mm)
*/
@ -131,8 +111,8 @@ char **master, **slave;
return fd;
}
#else
#if HAVE_PTSNAME
# else
# if HAVE_PTSNAME
/* get a pty for the user -- emulate the neato sequent call under (gregf)
* DYNIX/ptx v4.0
@ -165,7 +145,7 @@ char **master, **slave;
return fd;
}
#else
# else
/*
* get a pty for the user (emulate the neato sequent call) (ksb)
*/
@ -218,9 +198,9 @@ char **master, **slave;
*slave = acSlave;
return fd;
}
#endif /* PTX version */
#endif /* _AIX */
#endif /* !HAVE_GETPSEUDO */
# endif /* PTX version */
# endif /* _AIX */
# endif /* !HAVE_GETPSEUDO */
/*
* get a Joe pty bacause the daemon is not with us, sadly. (ksb)

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.63 2000-12-13 12:31:07-08 bryan Exp $
* $Id: group.c,v 5.65 2001-02-08 15:31:40-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -57,80 +57,45 @@ static char copyright[] =
@(#) Copyright 1992 Purdue Research Foundation.\n\
All rights reserved.\n";
#endif
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include "access.h"
#include "group.h"
#include "version.h"
#include "main.h"
#include <compat.h>
#include <port.h>
#include <consent.h>
#include <client.h>
#include <access.h>
#include <group.h>
#include <version.h>
#include <main.h>
#if DO_VIRTUAL
#if HAVE_PTYD
#include "local/openpty.h"
#else
# if HAVE_PTYD
# include "local/openpty.h"
# else
extern int FallBack();
#endif /* ptyd */
# endif /* ptyd */
#endif /* virtual consoles */
#if USE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#include <sys/resource.h>
#if USE_TERMIO
#include <termio.h>
#else
#if USE_TERMIOS
#include <termios.h>
#include <unistd.h>
#else /* use ioctl stuff */
#include <sgtty.h>
#include <sys/ioctl.h>
#endif
#endif
#if USE_STREAMS
#include <stropts.h>
#endif
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <arpa/telnet.h>
#if HAVE_SHADOW
#include <shadow.h>
#endif
extern char *crypt(), *calloc();
extern time_t time();
/* flags that a signal has occurred */
static SIGFLAG fSawReOpen, fSawReUp, fSawMark, fSawGoAway;
static sig_atomic_t fSawReOpen, fSawReUp, fSawMark, fSawGoAway;
/* Is this passwd a match for this user's passwd? (gregf/ksb)
* look up passwd in shadow file if we have to, if we are
@ -141,7 +106,7 @@ CheckPass(pwd, pcEPass, pcWord)
struct passwd *pwd;
char *pcEPass, *pcWord;
{
#if HAVE_SHADOW
#if HAVE_GETSPNAM
register struct spwd *spwd;
#endif
@ -150,7 +115,7 @@ char *pcEPass, *pcWord;
return 1;
}
}
#if HAVE_SHADOW
#if HAVE_GETSPNAM
if ('x' == pwd->pw_passwd[0] && '\000' == pwd->pw_passwd[1]) {
if ((struct spwd *)0 != (spwd = getspnam(pwd->pw_name)))
return 0 == strcmp(spwd->sp_pwdp, crypt(pcWord, spwd->sp_pwdp));
@ -163,12 +128,12 @@ char *pcEPass, *pcWord;
/* on an HUP close and re-open log files so lop can trim them (ksb)
* lucky for us: log file fd's can change async from the group driver!
*/
static SIGRETS
static RETSIGTYPE
FlagReOpen(sig)
int sig;
{
fSawReOpen = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
(void)signal(SIGHUP, FlagReOpen);
#endif
}
@ -196,12 +161,12 @@ ReOpen()
}
}
static SIGRETS
static RETSIGTYPE
FlagReUp(sig)
int sig;
{
fSawReUp = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
(void)signal(SIGUSR1, FlagReUp);
#endif
}
@ -227,12 +192,12 @@ ReUp()
}
}
static SIGRETS
static RETSIGTYPE
FlagMark(sig)
int sig;
{
fSawMark = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
signal(SIGALRM, FlagMark);
#endif
}
@ -240,7 +205,7 @@ FlagMark(sig)
static void
Mark()
{
long tyme;
time_t tyme;
char acOut[BUFSIZ];
char styme[26];
register int i;
@ -250,7 +215,7 @@ Mark()
return;
}
tyme = time((long *)0);
tyme = time((time_t *)0);
(void)strcpy(styme, ctime(&tyme));
styme[24] = '\000';
/* [-- MARK -- `date`] */
@ -273,13 +238,13 @@ SendClientsMsg(pGE, message)
GRPENT *pGE;
char *message;
{
register CLIENT *pCL;
register CONSCLIENT *pCL;
if ((GRPENT *)0 == pGE) {
return;
}
for (pCL = pGE->pCLall; (CLIENT *)0 != pCL; pCL = pCL->pCLscan) {
for (pCL = pGE->pCLall; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLscan) {
if (pCL->fcon) {
(void)write(pCL->fd, message, strlen(message));
}
@ -293,7 +258,7 @@ GRPENT *pGE;
SendClientsMsg(pGE, "[-- Console server shutting down --]\r\n");
}
static SIGRETS
static RETSIGTYPE
FlagGoAway(sig)
int sig;
{
@ -329,11 +294,11 @@ DeUtmp()
if (-1 == pCE->fdtty || 0 == pCE->fvirtual) {
continue;
}
#if HAVE_PTYD
# if HAVE_PTYD
(void)closepty(pCE->acslave, pCE->dfile, OPTY_UTMP, pCE->fdlog);
#else
# else
(void)close(pCE->fdlog);
#endif
# endif
}
exit(0);
_exit(0);
@ -345,19 +310,19 @@ DeUtmp()
* which will send us here to clean up the exit code. The lack of a
* reader on the pseudo will cause us to notice the death in Kiddie...
*/
static SIGRETS
static RETSIGTYPE
ReapVirt(sig)
int sig;
{
register int i, pid;
auto long tyme;
auto WAIT_T UWbuf;
auto int UWbuf;
#if HAVE_WAIT3
# if HAVE_WAIT3
while (-1 != (pid = wait3(& UWbuf, WNOHANG, (struct rusage *)0))) {
#else
# else
while (-1 != (pid = wait(& UWbuf))) {
#endif
# endif
if (0 == pid) {
break;
}
@ -368,7 +333,7 @@ int sig;
}
}
}
#endif
#endif /* DO_VIRUAL */
static char acStop[] = { /* buffer for oob stop command */
@ -376,7 +341,7 @@ static char acStop[] = { /* buffer for oob stop command */
};
int CheckPasswd(pCLServing, pw_string)
CLIENT *pCLServing;
CONSCLIENT *pCLServing;
char *pw_string;
{
struct passwd *pwd;
@ -384,7 +349,7 @@ char *pw_string;
char buf[100];
char *server, *servers, *this_pw, *user;
char username[64]; /* same as acid */
#if HAVE_SHADOW
#if HAVE_GETSPNAM
register struct spwd *spwd;
#endif
@ -421,7 +386,7 @@ char *pw_string;
if (strcmp(this_pw, "*passwd*") == 0) {
this_pw = NULL;
if ((struct passwd *)0 != (pwd = getpwnam(user))) {
#if HAVE_SHADOW
#if HAVE_GETSPNAM
if ('x' == pwd->pw_passwd[0] && '\000' == pwd->pw_passwd[1]) {
if ((struct spwd *)0 != (spwd = getspnam(pwd->pw_name))) {
this_pw = spwd->sp_pwdp;
@ -429,9 +394,9 @@ char *pw_string;
} else {
this_pw = pwd->pw_passwd;
}
#else
#else
this_pw = pwd->pw_passwd;
#endif
#endif
}
}
if (this_pw == NULL)
@ -545,7 +510,7 @@ Kiddie(pGE, sfd)
register GRPENT *pGE;
int sfd;
{
register CLIENT
register CONSCLIENT
*pCL, /* console we must scan/notify */
*pCLServing, /* client we are serving */
*pCLFree; /* head of free list */
@ -558,25 +523,23 @@ int sfd;
register struct passwd *pwd;
register char *pcPass;
register long tyme;
long tymee;
time_t tymee;
char stymee[26];
auto CONSENT CECtl; /* our control `console' */
auto char cType;
auto int maxfd, so;
auto fd_set rmask, rinit;
auto char acOut[BUFSIZ], acIn[BUFSIZ], acNote[132*2];
auto CLIENT dude[MAXMEMB]; /* alloc one set per console */
auto CONSCLIENT dude[MAXMEMB]; /* alloc one set per console */
#if HAVE_RLIMIT
struct rlimit rl;
#endif
#if USE_TERMIO
auto struct sgttyb sty;
#else
#if USE_TERMIOS
#if HAVE_TERMIOS_H
auto struct termios sbuf;
#else /* ioctl, like BSD4.2 */
#else
# if HAVE_SGTTY_H
auto struct sgttyb sty;
#endif
# endif
#endif
/* turn off signals that master() might have turned on
@ -595,7 +558,7 @@ int sfd;
pCE = pGE->pCElist;
for (iConsole = 0; iConsole < pGE->imembers; ++iConsole) {
pCE[iConsole].fup = 0;
pCE[iConsole].pCLon = pCE[iConsole].pCLwr = (CLIENT *)0;
pCE[iConsole].pCLon = pCE[iConsole].pCLwr = (CONSCLIENT *)0;
#if DO_VIRTUAL
pCE[iConsole].fdlog = -1;
if (0 == pCE[iConsole].fvirtual) {
@ -604,13 +567,13 @@ int sfd;
}
/* open a pty for each vitrual console
*/
#if HAVE_PTYD
# if HAVE_PTYD
pCE[iConsole].fdtty = openpty(pCE[iConsole].acslave, pCE[iConsole].dfile, OPTY_UTMP, 0);
#else /* oops, get ptyd soon */
# else /* oops, get ptyd soon */
/* we won't get a utmp entry... *sigh*
*/
pCE[iConsole].fdtty = FallBack(pCE[iConsole].acslave, pCE[iConsole].dfile);
#endif /* find openpty */
# endif /* find openpty */
#else
pCE[iConsole].fdlog = pCE[iConsole].fdtty = -1;
#endif
@ -658,7 +621,7 @@ int sfd;
for (i = 0; i < MAXMEMB-1; ++i) {
dude[i].pCLnext = & dude[i+1];
}
dude[MAXMEMB-1].pCLnext = (CLIENT *)0;
dude[MAXMEMB-1].pCLnext = (CONSCLIENT *)0;
/* on a SIGHUP we should close and reopen our log files
*/
@ -675,7 +638,7 @@ int sfd;
/* the MAIN loop a group server
*/
pGE->pCLall = (CLIENT *)0;
pGE->pCLall = (CONSCLIENT *)0;
while (1) {
/* check signal flags */
if (fSawGoAway) {
@ -747,7 +710,7 @@ int sfd;
/* output all console info nobody is attached
*/
if (fAll && (CLIENT *)0 == pCEServing->pCLwr) {
if (fAll && (CONSCLIENT *)0 == pCEServing->pCLwr) {
/* run through the console ouptut,
* add each character to the output line
* drop and reset if we have too much
@ -765,7 +728,7 @@ int sfd;
/* write console info to clients (not suspended)
*/
for (pCL = pCEServing->pCLon; (CLIENT *)0 != pCL; pCL = pCL->pCLnext) {
for (pCL = pCEServing->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
if (pCL->fcon) {
(void)write(pCL->fd, acIn, nr);
}
@ -775,7 +738,7 @@ int sfd;
/* anything from a connection?
*/
for (pCLServing = pGE->pCLall; (CLIENT *)0 != pCLServing; pCLServing = pCLServing->pCLscan) {
for (pCLServing = pGE->pCLall; (CONSCLIENT *)0 != pCLServing; pCLServing = pCLServing->pCLscan) {
if (!FD_ISSET(pCLServing->fd, &rmask)) {
continue;
}
@ -795,12 +758,12 @@ drop:
* close gap in table, restart loop
*/
if (&CECtl != pCEServing) {
tymee = time((long *)0);
tymee = time((time_t *)0);
(void)strcpy(stymee, ctime(&tymee));
stymee[24] = '\000';
printf("%s: %s: logout %s [%s]\n", progname, pCEServing->server, pCLServing->acid, stymee);
}
if (fNoinit && (CLIENT *)0 ==
if (fNoinit && (CONSCLIENT *)0 ==
pCLServing->pCEto->pCLon->pCLnext)
ConsDown(pCLServing->pCEto, &rinit);
@ -826,11 +789,11 @@ drop:
* lists (all clients, and this console)
*/
pCLServing->fcon = 0;
if ((CLIENT *)0 != pCLServing->pCLnext) {
if ((CONSCLIENT *)0 != pCLServing->pCLnext) {
pCLServing->pCLnext->ppCLbnext = pCLServing->ppCLbnext;
}
*(pCLServing->ppCLbnext) = pCLServing->pCLnext;
if ((CLIENT *)0 != pCLServing->pCLscan) {
if ((CONSCLIENT *)0 != pCLServing->pCLscan) {
pCLServing->pCLscan->ppCLbscan = pCLServing->ppCLbscan;
}
*(pCLServing->ppCLbscan) = pCLServing->pCLscan;
@ -847,7 +810,7 @@ drop:
/* update last keystroke time
*/
pCLServing->typetym = tyme = time((long *)0);
pCLServing->typetym = tyme = time((time_t *)0);
#if CPARITY
/* clear parity from the network
@ -968,7 +931,7 @@ drop:
}
pCLServing->icursor = 0;
/* in the CONFIG file gave this group a
/* in the CONFIGFILE file gave this group a
* password use it before root's
* password (for malowany)
*/
@ -987,7 +950,7 @@ drop:
shift_console:
/* remove from current host
*/
if ((CLIENT *)0 != pCLServing->pCLnext) {
if ((CONSCLIENT *)0 != pCLServing->pCLnext) {
pCLServing->pCLnext->ppCLbnext = pCLServing->ppCLbnext;
}
*(pCLServing->ppCLbnext) = pCLServing->pCLnext;
@ -1000,7 +963,7 @@ drop:
/* inform operators of the change
*/
/* if (fVerbose) { */
tymee = time((long *)0);
tymee = time((time_t *)0);
(void)strcpy(stymee, ctime(&tymee));
stymee[24] = '\000';
if (&CECtl == pCEServing) {
@ -1016,7 +979,7 @@ drop:
pCLServing->pCEto = pCEServing;
pCLServing->pCLnext = pCEServing->pCLon;
pCLServing->ppCLbnext = & pCEServing->pCLon;
if ((CLIENT *)0 != pCLServing->pCLnext) {
if ((CONSCLIENT *)0 != pCLServing->pCLnext) {
pCLServing->pCLnext->ppCLbnext = & pCLServing->pCLnext;
}
pCEServing->pCLon = pCLServing;
@ -1030,7 +993,7 @@ drop:
CSTROUT(pCLServing->fd, "line to host is down]\r\n");
} else if (pCEServing->fronly) {
CSTROUT(pCLServing->fd, "host is read-only]\r\n");
} else if ((CLIENT *)0 == pCEServing->pCLwr) {
} else if ((CONSCLIENT *)0 == pCEServing->pCLwr) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
CSTROUT(pCLServing->fd, "attached]\r\n");
@ -1067,7 +1030,7 @@ drop:
CSTROUT(pCLServing->fd, " -- line down]\r\n");
} else if (pCEServing->fronly) {
CSTROUT(pCLServing->fd, " -- read-only]\r\n");
} else if ((CLIENT *)0 == pCEServing->pCLwr) {
} else if ((CONSCLIENT *)0 == pCEServing->pCLwr) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
if ( pCEServing->nolog ) {
@ -1126,19 +1089,19 @@ drop:
}
else
{
#if USE_TERMIO
#if HAVE_TERMIO_H
if (-1 == ioctl(pCEServing->fdtty, TCSBRK, (char *)0)) {
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
}
#else
#if USE_TCBREAK
# if HAVE_TCSENDBREAK
if (-1 == tcsendbreak(pCEServing->fdtty, 0)) {
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
}
#else
#if USE_TERMIOS
# else
# if HAVE_TERMIOS_H
if (-1 == ioctl(pCEServing->fdtty, TIOCSBRK, (char *)0)) {
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
@ -1149,8 +1112,8 @@ drop:
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
}
#endif
#endif
# endif
# endif
#endif
}
CSTROUT(pCLServing->fd, "sent]\r\n");
@ -1234,7 +1197,7 @@ drop:
sprintf(acOut, "line to host is down]\r\n");
} else if (pCEServing->fronly) {
sprintf(acOut, "host is read-only]\r\n");
} else if ((CLIENT *)0 == (pCL = pCEServing->pCLwr)) {
} else if ((CONSCLIENT *)0 == (pCL = pCEServing->pCLwr)) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
if ( pCEServing->nolog ) {
@ -1266,7 +1229,7 @@ drop:
}
#endif
#if USE_TERMIOS
#if HAVE_TERMIOS_H
if (-1 == tcgetattr(pCEServing->fdtty, & sbuf)) {
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
@ -1314,13 +1277,13 @@ drop:
}
pCLServing->fwr = 0;
pCEServing->pCLwr = (CLIENT *)0;
pCEServing->pCLwr = (CONSCLIENT *)0;
ConsDown(pCEServing, &rinit);
CSTROUT(pCLServing->fd, "line down]\r\n");
/* tell all who closed it */
sprintf(acOut, "[line down by %s]\r\n", pCLServing->acid);
for (pCL = pCEServing->pCLon; (CLIENT *)0 != pCL; pCL = pCL->pCLnext) {
for (pCL = pCEServing->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
if (pCL == pCLServing)
continue;
if (pCL->fcon) {
@ -1352,7 +1315,7 @@ drop:
} else {
sprintf(acOut, "attached]\r\n");
}
if ((CLIENT *)0 != (pCL = pCEServing->pCLwr)) {
if ((CONSCLIENT *)0 != (pCL = pCEServing->pCLwr)) {
if (pCL == pCLServing) {
if ( pCEServing->nolog ) {
CSTROUT(pCLServing->fd, "ok (nologging)]\r\n");
@ -1383,7 +1346,7 @@ drop:
*/
sprintf(acOut, "group %s]\r\n", CECtl.server);
(void)write(pCLServing->fd, acOut, strlen(acOut));
for (pCL = pGE->pCLall; (CLIENT *)0 != pCL; pCL = pCL->pCLscan) {
for (pCL = pGE->pCLall; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLscan) {
if (&CECtl == pCL->pCEto)
continue;
sprintf(acOut, " %-24.24s %c %-7.7s %5s %.32s\r\n", pCL->acid, pCL == pCLServing ? '*' : ' ', pCL->fcon ? (pCL->fwr ? "attach" : "spy") : "stopped", IdleTyme(tyme - pCL->typetym), pCL->pCEto->server);
@ -1465,7 +1428,7 @@ drop:
sprintf(acOut, "line to host is still down]\r\n");
} else if (pCEServing->fronly) {
sprintf(acOut, "up read-only]\r\n");
} else if ((CLIENT *)0 == (pCL = pCEServing->pCLwr)) {
} else if ((CONSCLIENT *)0 == (pCL = pCEServing->pCLwr)) {
pCEServing->pCLwr = pCLServing;
pCLServing->fwr = 1;
sprintf(acOut, "up -- attached]\r\n");
@ -1528,7 +1491,7 @@ drop:
case 'W':
sprintf(acOut, "who %s]\r\n", pCEServing->server);
(void)write(pCLServing->fd, acOut, strlen(acOut));
for (pCL = pCEServing->pCLon; (CLIENT *)0 != pCL; pCL = pCL->pCLnext) {
for (pCL = pCEServing->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
sprintf(acOut, " %-24.24s %c %-7.7s %5s %s\r\n", pCL->acid, pCL == pCLServing ? '*' : ' ', pCL->fcon ? (pCL->fwr ? "attach" : "spy") : "stopped", IdleTyme(tyme - pCL->typetym), pCL->actym);
(void)write(pCLServing->fd, acOut, strlen(acOut));
}
@ -1554,23 +1517,23 @@ drop:
if (pCEServing->pCLwr == pCLServing) {
pCLServing->fwr = 0;
pCLServing->fwantwr = 0;
pCEServing->pCLwr = (CLIENT *)0;
pCEServing->pCLwr = (CONSCLIENT *)0;
}
break;
case '\t': /* toggle tab expand */
CSTROUT(pCLServing->fd, "tabs]\r\n");
#if USE_TERMIO
#if HAVE_TERMIO_H
/* ZZZ */
#else
#if USE_TERMIOS
# if HAVE_TERMIOS_H
if (-1 == tcgetattr(pCEServing->fdtty, & sbuf)) {
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
}
#if !defined(XTABS) /* XXX hack */
#define XTABS TAB3
#endif
# if !defined(XTABS) /* XXX hack */
# define XTABS TAB3
# endif
if (XTABS == (TABDLY&sbuf.c_oflag)) {
sbuf.c_oflag &= ~TABDLY;
sbuf.c_oflag |= TAB0;
@ -1582,9 +1545,9 @@ drop:
CSTROUT(pCLServing->fd, "failed]\r\n");
continue;
}
#else
# else
/* ZZZ */
#endif
# endif
#endif
break;
@ -1606,7 +1569,7 @@ drop:
}
#endif
#if USE_TERMIOS
#if HAVE_TERMIOS_H
if (-1 == tcgetattr(pCEServing->fdtty, & sbuf)) {
CSTROUT(pCLServing->fd, "[failed]\r\n");
continue;
@ -1662,7 +1625,7 @@ unknown:
/* accept new connections and deal with them
*/
so = sizeof(struct sockaddr_in);
pCLFree->fd = accept(sfd, (struct sockaddr *)&pCLFree->cnct_port, &so);
pCLFree->fd = accept(sfd, (struct sockaddr *)&pCLFree->cnct_port, (socklen_t *)&so);
if (pCLFree->fd < 0) {
fprintf(stderr, "%s: accept: %s\n", progname, strerror(errno));
continue;
@ -1672,7 +1635,7 @@ unknown:
* the source machine as being local.
*/
so = sizeof(in_port);
if (-1 == getpeername(pCLFree->fd, (struct sockaddr *)&in_port, &so)) {
if (-1 == getpeername(pCLFree->fd, (struct sockaddr *)&in_port, (socklen_t *)&so)) {
CSTROUT(pCLFree->fd, "getpeername failed\r\n");
(void)close(pCLFree->fd);
continue;
@ -1697,7 +1660,7 @@ unknown:
/* init the identification stuff
*/
sprintf(pCL->acid, "client@%.*s", sizeof(pCL->acid)-10, hpPeer->h_name);
pCL->typetym = pCL->tym = time((long *)0);
pCL->typetym = pCL->tym = time((time_t *)0);
(void)strcpy(pCL->actym, ctime(&(pCL->tym)));
pCL->actym[24] = '\000';
@ -1706,7 +1669,7 @@ unknown:
pCL->pCEto = & CECtl;
pCL->pCLnext = CECtl.pCLon;
pCL->ppCLbnext = & CECtl.pCLon;
if ((CLIENT *)0 != pCL->pCLnext) {
if ((CONSCLIENT *)0 != pCL->pCLnext) {
pCL->pCLnext->ppCLbnext = & pCL->pCLnext;
}
CECtl.pCLon = pCL;
@ -1715,7 +1678,7 @@ unknown:
*/
pCL->pCLscan = pGE->pCLall;
pCL->ppCLbscan = & pGE->pCLall;
if ((CLIENT *)0 != pCL->pCLscan) {
if ((CONSCLIENT *)0 != pCL->pCLscan) {
pCL->pCLscan->ppCLbscan = & pCL->pCLscan;
}
pGE->pCLall = pCL;
@ -1743,9 +1706,9 @@ unknown:
/* remove from the free list
* if we ran out of static connections calloc some...
*/
if ((CLIENT *)0 == pCLFree) {
pCLFree = (CLIENT *)calloc(2, sizeof(CLIENT));
if ((CLIENT *)0 == pCLFree) {
if ((CONSCLIENT *)0 == pCLFree) {
pCLFree = (CONSCLIENT *)calloc(2, sizeof(CONSCLIENT));
if ((CONSCLIENT *)0 == pCLFree) {
CSTROUT(2, "no memory in console server, help\n");
} else {
pCLFree->pCLnext = &pCLFree[1];
@ -1768,10 +1731,10 @@ GRPENT *pGE;
/* get a socket for listening
*/
#if USE_STRINGS
(void)bzero((char *)&lstn_port, sizeof(lstn_port));
#else
#if HAVE_MEMSET
(void)memset((void *)&lstn_port, 0, sizeof(lstn_port));
#else
(void)bzero((char *)&lstn_port, sizeof(lstn_port));
#endif
lstn_port.sin_family = AF_INET;
*(u_long *)&lstn_port.sin_addr = INADDR_ANY;
@ -1796,7 +1759,7 @@ GRPENT *pGE;
}
so = sizeof(lstn_port);
if (-1 == getsockname(sfd, (struct sockaddr *)&lstn_port, &so)) {
if (-1 == getsockname(sfd, (struct sockaddr *)&lstn_port, (socklen_t *)&so)) {
fprintf(stderr, "%s: getsockname: %s\n", progname, strerror(errno));
exit(9);
}
@ -1830,10 +1793,10 @@ GRPENT *pGE;
/*NOTREACHED*/
}
#if USE_SIGACTION
#ifdef HAVE_SIGACTION
void Set_signal(sig, disp)
int sig;
SIGRETS (*disp)(int);
RETSIGTYPE (*disp)(int);
{
struct sigaction sa;

View File

@ -1,5 +1,5 @@
/*
* $Id: group.h,v 5.11 2000-12-13 12:31:07-08 bryan Exp $
* $Id: group.h,v 5.12 2001-02-03 20:21:00-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -41,7 +41,7 @@ typedef struct grpent { /* group info */
int pid; /* pid of server for group */
int imembers; /* number of consoles in this group */
CONSENT *pCElist; /* list of consoles in this group */
CLIENT *pCLall; /* all clients to scan after select */
CONSCLIENT *pCLall; /* all clients to scan after select */
char passwd[MAXPSWDLEN];/* encrypted password for this group */
} GRPENT;

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.37 2000-12-13 12:31:07-08 bryan Exp $
* $Id: main.c,v 5.39 2001-02-08 15:31:58-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -26,52 +26,50 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include "group.h"
#include "master.h"
#include "access.h"
#include "readcfg.h"
#include "version.h"
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <compat.h>
#include <port.h>
#include <consent.h>
#include <client.h>
#include <group.h>
#include <master.h>
#include <access.h>
#include <readcfg.h>
#include <version.h>
char rcsid[] =
"$Id: main.c,v 5.37 2000-12-13 12:31:07-08 bryan Exp $";
"$Id: main.c,v 5.39 2001-02-08 15:31:58-08 bryan Exp $";
char *progname =
rcsid;
int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fDebug = 0, fVersion = 0;
int fDaemon = 0;
char chDefAcc = 'r';
char *pcConfig = CONFIG;
char *pcPasswd = PASSWD_FILE;
#define FULLCFPATH SYSCONFDIR "/" CONFIGFILE;
#define FULLPDPATH SYSCONFDIR "/" PASSWDFILE;
char *pcConfig = FULLCFPATH;
char *pcPasswd = FULLPDPATH;
int domainHack = 0;
#if defined(SERVICE)
char acService[] = SERVICE;
#if defined(SERVICENAME)
char acService[] = SERVICENAME;
#endif
struct sockaddr_in in_port;
@ -175,7 +173,7 @@ Version()
#else
printf("%s: high-bit of data *not* stripped (8-bit clean)\n", progname);
#endif
#if defined(SERVICE)
#if defined(SERVICENAME)
{
struct servent *pSE;
if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) {
@ -189,8 +187,8 @@ Version()
printf(" on port %d\n", ntohs((u_short)pSE->s_port));
}
#else
#if defined(PORT)
printf("%s: on port %d\n", progname, PORT);
#if defined(PORTNUMBER)
printf("%s: on port %d\n", progname, PORTNUMBER);
#else
printf("%s: no service or port compiled in\n", progname);
exit(1);
@ -228,10 +226,10 @@ char **argv;
}
(void)setpwent();
#if USE_SETLINEBUF
#if HAVE_SETLINEBUF
setlinebuf(stderr);
#endif
#if USE_SETVBUF
#if HAVE_SETVBUF
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
#endif
@ -244,10 +242,10 @@ char **argv;
fprintf(stderr, "%s: wrong address size (4 != %d) or adress family (%d != %d)\n", progname, hpMe->h_length, AF_INET, hpMe->h_addrtype);
exit(1);
}
#if USE_STRINGS
(void)bcopy(hpMe->h_addr, &acMyAddr[0], hpMe->h_length);
#else
#if HAVE_MEMCPY
(void)memcpy(&acMyAddr[0], hpMe->h_addr, hpMe->h_length);
#else
(void)bcopy(hpMe->h_addr, &acMyAddr[0], hpMe->h_length);
#endif
while (EOF != (i = getopt(argc, argv, acOpts))) {
@ -312,7 +310,7 @@ char **argv;
exit(0);
}
#if HAVE_SHADOW
#if HAVE_GETSPNAM
/* Why force root??? Cause of getsp*() calls... */
if (0 != geteuid()) {
fprintf(stderr, "%s: must be the superuser\n", progname);
@ -328,7 +326,7 @@ char **argv;
}
ReadCfg(pcConfig, fpConfig);
#if USE_FLOCK
#if HAVE_FLOCK
/* we lock the configuration file so that two identical
* conservers will not be running together (but two with
* different configurations can run on the same host).
@ -345,10 +343,10 @@ char **argv;
SetDefAccess(hpMe);
}
#if USE_SETLINEBUF
#if HAVE_SETLINEBUF
setlinebuf(stdout);
#endif
#if USE_SETVBUF
#if HAVE_SETVBUF
setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: main.h,v 5.15 2000-12-13 12:31:07-08 bryan Exp $
* $Id: main.h,v 5.16 2001-02-08 15:31:58-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -47,7 +47,7 @@ extern char acMyHost[];
extern char acMyAddr[];
extern int domainHack;
#if defined(SERVICE)
#if defined(SERVICENAME)
extern char acService[];
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.27 2000-12-13 12:31:07-08 bryan Exp $
* $Id: master.c,v 5.29 2001-02-08 15:32:28-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -26,58 +26,44 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include "group.h"
#include "access.h"
#include "master.h"
#include "readcfg.h"
#include "version.h"
#include "main.h"
#include <compat.h>
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#if USE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#include <sys/resource.h>
extern char *crypt();
extern time_t time();
static SIGFLAG fSawQuit, fSawHUP, fSawUSR1, fSawCHLD;
#include <port.h>
#include <consent.h>
#include <client.h>
#include <group.h>
#include <access.h>
#include <master.h>
#include <readcfg.h>
#include <version.h>
#include <main.h>
static SIGRETS
static sig_atomic_t fSawQuit, fSawHUP, fSawUSR1, fSawCHLD;
static RETSIGTYPE
FlagSawCHLD(sig)
int sig;
{
fSawCHLD = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
(void)signal(SIGCHLD, FlagSawCHLD);
#endif
}
@ -89,8 +75,8 @@ static void
FixKids()
{
register int i, pid;
auto long tyme;
auto WAIT_T UWbuf;
auto time_t tyme;
auto int UWbuf;
#if HAVE_WAIT3
while (-1 != (pid = wait3(& UWbuf, WNOHANG, (struct rusage *)0))) {
@ -115,7 +101,7 @@ FixKids()
/* this kid kid is dead, start another
*/
Spawn(& aGroups[i]);
tyme = time((long *)0);
tyme = time((time_t *)0);
printf("%s: %s: exit(%d), restarted %s", progname, aGroups[i].pCElist[0].server, WEXITSTATUS(UWbuf), ctime(&tyme));
}
}
@ -124,29 +110,29 @@ FixKids()
/* kill all the kids and exit.
* Called when master process receives SIGTERM
*/
static SIGRETS
static RETSIGTYPE
QuitIt(arg)
int arg;
{
fSawQuit = 1;
}
static SIGRETS
static RETSIGTYPE
FlagSawHUP(arg)
int arg;
{
fSawHUP = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
(void)signal(SIGHUP, FlagSawHUP);
#endif
}
static SIGRETS
static RETSIGTYPE
FlagSawUSR1(arg)
int arg;
{
fSawUSR1 = 1;
#if !USE_SIGACTION
#if !HAVE_SIGACTION
(void)signal(SIGUSR1, FlagSawUSR1);
#endif
}
@ -198,14 +184,14 @@ REMOTE
/* set up port for master to listen on
*/
#if USE_STRINGS
(void)bzero((char *)&master_port, sizeof(master_port));
#else
#if HAVE_MEMSET
(void)memset((void *)&master_port, 0, sizeof(master_port));
#else
(void)bzero((char *)&master_port, sizeof(master_port));
#endif
master_port.sin_family = AF_INET;
*(u_long *)&master_port.sin_addr = INADDR_ANY;
#if defined(SERVICE)
#if defined(SERVICENAME)
{
struct servent *pSE;
if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) {
@ -215,11 +201,11 @@ REMOTE
master_port.sin_port = pSE->s_port;
}
#else
#if defined(PORT)
master_port.sin_port = htons((u_short)PORT);
#else
# if defined(PORTNUMBER)
master_port.sin_port = htons((u_short)PORTNUMBER);
# else
fprintf(stderr, "%s: no port or service compiled in?\n", progname);
#endif
# endif
#endif
if ((msfd=socket(AF_INET, SOCK_STREAM, 0)) < 0) {
@ -268,7 +254,7 @@ REMOTE
continue;
}
so = sizeof(response_port);
cfd = accept(msfd, (struct sockaddr *)&response_port, &so);
cfd = accept(msfd, (struct sockaddr *)&response_port, (socklen_t *)&so);
if (cfd < 0) {
fprintf(stderr, "%s: accept: %s\n", progname, strerror(errno));
continue;
@ -276,7 +262,7 @@ REMOTE
so = sizeof(in_port);
if (-1 == getpeername(cfd, (struct sockaddr *)&in_port, &so)) {
if (-1 == getpeername(cfd, (struct sockaddr *)&in_port, (socklen_t *)&so)) {
CSTROUT(cfd, "getpeername failed\r\n");
(void)close(cfd);
continue;

View File

@ -1,5 +1,5 @@
/*
* $Id: port.h,v 1.17 2000-12-13 12:31:07-08 bryan Exp $
* $Id: port.h,v 1.20 2001-02-08 15:32:49-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -8,6 +8,8 @@
* Copyright GNAC, Inc., 1998
*/
#include <config.h>
/*
* Copyright 1992 Purdue Research Foundation, West Lafayette, Indiana
* 47907. All rights reserved.
@ -34,131 +36,27 @@
* 4. This notice may not be removed or altered.
*/
/*
* this is the configuration file for the Ohio State/PUCC console
* server. Just define the macros below to somehting that looks good
* and give it a go. It'll complain (under conserver -V) if things
* look really bad.
*
* all PTX, PTX2, and PTX4 code added by gregf@sequent.com (gregf)
*/
#if !( defined(SUN5) || defined(BSDOS3) || defined(LINUX2) || defined(IRIX6) )
#error "Platform needs to be defined. See port.h"
#endif
#if (defined(PTX2) || defined(PTX4))
#define PTX
#endif
/* some machine specific details
*/
#if !defined(USE_OLDSEL)
#if defined(IBMR2)
#include <sys/select.h>
#endif
#endif
#if !defined(HAVE_UWAIT)
#define HAVE_UWAIT !(defined(IBMR2)||defined(SUN5)||defined(HPUX8)||defined(HPUX9)||defined(PTX)||defined(IRIX5)||defined(BSDOS3)||defined(IRIX6))
#endif
#if !defined(HAVE_WAIT3)
#define HAVE_WAIT3 !(defined(SUN5)||defined(PTX))
#endif
/* This is the port number used in the connection. It can use either
* /etc/services or a hardcoded port (SERVICE name has precedence).
* (You can -D one in the Makefile to override these.)
*/
/* #define PORT 782 /* only if you cannot put in /etc/services */
#if !defined(SERVICE)
#if !defined(PORT)
#define SERVICE "conserver"
#endif
#endif
/* Wait for a part of a second before slapping console server.
* Good for CISCO terminal servers that get upset when you
* attack with intense socket connections
*/
#if !defined(USLEEP_FOR_SLOW_PORTS)
#define USLEEP_FOR_SLOW_PORTS 100000
#endif
/* The name of the host which will act as the console server
*/
#if !defined(HOST)
#define HOST "console"
#endif
/* How long should we wait for a TCP socket to be created when talking
* to network terminal servers? 10 second default
*/
#if !defined(CONNECTTIMEOUT)
#define CONNECTTIMEOUT 10
# define USLEEP_FOR_SLOW_PORTS 100000
#endif
/* the default escape sequence used to give meta commands
*/
#if !defined(DEFATTN)
#define DEFATTN '\005'
# define DEFATTN '\005'
#endif
#if !defined(DEFESC)
#define DEFESC 'c'
#endif
/* Location of the configuration file
*/
#if !defined(CONFIG)
#define CONFIG "/etc/conserver.cf"
#endif
/* Location of ANL designed passwd file */
#if !defined(PASSWD_FILE)
#define PASSWD_FILE "/etc/conserver.passwd"
#endif
/* The maximum number of serial lines that can be handled by a child process
*/
#if !defined(MAXMEMB)
#define MAXMEMB 8
#endif
/* The maximum number of child processes spawned.
*/
#if !defined(MAXGRP)
#define MAXGRP 32
# define DEFESC 'c'
#endif
/* the max number of characters conserver will replay for you (the r command)
*/
#if !defined(MAXREPLAY)
#define MAXREPLAY (80*25)
#endif
/* if the encrypted passwd is in a shadow file, define HAVE_SHADOW (gregf)
*/
#if !defined(HAVE_SHADOW)
#define HAVE_SHADOW (defined(PTX)||defined(SUN5)||defined(IRIX6))
#endif
/* we'd like to line buffer our output, if we know how
*/
#if !defined(USE_SETLINEBUF)
#define USE_SETLINEBUF (!(defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(PTX)))
#endif
/* we'd like to line buffer our output, if we know how; PTX uses setvbuf (gregf)
*/
#if !defined(USE_SETVBUF)
#define USE_SETVBUF (defined(PTX))
#endif
/* hpux doesn't have getdtablesize() and they don't provide a macro
* in non-KERNEL cpp mode
*/
#if defined(HPUX7)||defined(HPUX8)||defined(HPUX9)
#define getdtablesize() 64
# define MAXREPLAY (80*25)
#endif
/* the console server will provide a pseudo-device console which
@ -167,7 +65,7 @@
* might wanna use it). Turn this on only if you (might) need it.
*/
#if !defined(DO_VIRTUAL)
#define DO_VIRTUAL 1
# define DO_VIRTUAL 1
#endif
#if DO_VIRTUAL
@ -176,188 +74,11 @@
* on some emulation code?? (XXX)
*/
#if !defined(HAVE_PTYD)
#define HAVE_PTYD (defined(S81)||defined(VAX8800))
#endif
#if !defined(HAVE_GETPSEUDO)
#define HAVE_GETPSEUDO (defined(PTX2))
#endif
#if !defined(HAVE_PTSNAME)
#define HAVE_PTSNAME (defined(PTX4))
#endif
#if !defined(HAVE_LDTERM)
#define HAVE_LDTERM (defined(SUN5))
#endif
#if !defined(HAVE_STTY_LD)
#define HAVE_STTY_LD (defined(IRIX5))
# define HAVE_PTYD (defined(S81)||defined(VAX8800))
#endif
#endif /* virtual (process on a pseudo-tty) console support */
#if !defined(HAVE_SETSID)
#define HAVE_SETSID (defined(IBMR2)||defined(SUN5)||defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3))
#endif
/* should we use flock to keep multiple conservers from hurting each other?
* PTX has lockf... should probably port code to work with this (gregf)
*/
#if !defined(USE_FLOCK)
#define USE_FLOCK (!(defined(IBMR2)||defined(SUN5)||defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(PTX)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3)))
#endif
/* should we try to pop streams modules off?
*/
#if !defined(USE_STREAMS)
#define USE_STREAMS (defined(SUN4)||defined(SUN5)||defined(PTX)||defined(IRIX5)||defined(IRIX6))
#endif
/* if we do not have old style tty emulation use termios.h
*/
#if !defined(USE_TERMIO)
#define USE_TERMIO (defined(ETA10)||defined(V386))
#endif
#if !defined(USE_TERMIOS)
#define USE_TERMIOS (defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(SUN5)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(SUN4))
#endif
#if !defined(USE_TCBREAK)
#define USE_TCBREAK (defined(PTX)||defined(BSDOS3)||defined(LINUX2)||defined(SUN5))
#endif
/* if we have <strings.h> define this to 1, else define to 0
*/
#if !defined(USE_STRINGS)
#define USE_STRINGS (defined(SUN4)||defined(DYNIX)||defined(EPIX)||defined(IRIX5)||defined(IRIX6)||defined(BSDOS3))
#endif
#if !defined(NEED_UNISTD_H)
#define NEED_UNISTD_H (defined(SUN5)||defined(PTX))
#endif
#if !defined(USE_SYS_TIME_H)
#define USE_SYS_TIME_H (!defined(PTX))
#endif
#if USE_STRINGS
#if !defined(strchr)
#define strchr index
#endif
#if !defined(strrchr)
#define strrchr rindex
#endif
#endif
/* used to force the server process to clear parity, which is for farmers
*/
#if !defined(CPARITY)
#define CPARITY 1
#endif
/* if you do not have fd_set's here is a possible emulation
*/
#if USE_OLDSEL
typedef long fd_set;
#define FD_ZERO(a) {*(a)=0;}
#define FD_SET(d,a) {*(a) |= (1 << (d));}
#define FD_CLR(d,a) {*(a) &= ~(1 << (d));}
#define FD_ISSET(d,a) (*(a) & (1 << (d)))
#endif
#if USE_TERMIOS
#if defined(LINUX2)
#include <sys/ioctl.h>
#endif
#if defined(HPUX7)||defined(HPUX8)||defined(HPUX9)
#define TCGETS _IOR('T', 16, struct termios)
#define TCSETS _IOW('T', 17, struct termios)
#endif
#if defined(PTX2)
#define TCGETS TCGETP
#define TCSETS TCSETP
#endif
#endif
/* which type does wait(2) take for status location
*/
#if HAVE_UWAIT
#define WAIT_T union wait
#if ! defined WEXITSTATUS
#define WEXITSTATUS(x) ((x).w_retcode)
#endif
#else
#define WAIT_T int
#endif
/* which type signal handlers return on this machine
*/
#if defined(sun) || defined(NEXT2) || defined(SUN5) || defined(PTX) || defined(IRIX5) || defined(BSDOS3) || defined(LINUX2) || defined(IRIX6)
#define SIGRETS void
#else
#define SIGRETS int
#endif
/* which type to use for global flags set by signal handlers */
#if defined(SUN5)
#define SIGFLAG volatile sig_atomic_t
#else
#define SIGFLAG int
#endif
#if !defined(USE_SIGACTION)
#define USE_SIGACTION (defined(SUN4)||defined(SUN5)||defined(LINUX2))
#endif
#if USE_SIGACTION
extern void Set_signal(int isg, SIGRETS (*disp)(int));
#else
#define Set_signal(sig, disp) (void)signal((sig), (disp))
#endif
/* do we have a (working) setsockopt call
*/
#if !defined(HAVE_SETSOCKOPT)
#define HAVE_SETSOCKOPT (defined(sun)||defined(PTX)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3))
#endif
/* does this system have the ANSI strerror() function?
*/
#if !defined(HAVE_STRERROR)
#define HAVE_STRERROR (defined(IBMR2)||defined(ETA10)||defined(V386)||defined(SUN5)||defined(NEXT2)||defined(HPUX8)||defined(HPUX9)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3))
#endif
#if ! HAVE_STRERROR
extern int errno;
extern char *sys_errlist[];
#define strerror(Me) (sys_errlist[Me])
#endif
#if !defined(HAVE_H_ERRLIST)
#define HAVE_H_ERRLIST (defined(SUN4)||defined(SUN3)||defined(FREEBSD)|defined(NETBSD)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3))
#endif
#if HAVE_H_ERRLIST
extern int h_errno;
extern char *h_errlist[];
#define hstrerror(Me) (h_errlist[Me])
#else
#define hstrerror(Me) "host lookup error"
#endif
#if !defined(HAVE_RLIMIT)
#if (defined(SUN5)||defined(PTX4)||defined(LINUX2)||defined(BSDOS3)||defined(IRIX6))
#define HAVE_RLIMIT 1
#else
#define HAVE_RLIMIT 0
#endif
#endif
/* that's all. just run
* make
* ./conserver -V
*/
/* communication constants
*/
#define OB_SUSP 'Z' /* suspended by server */
@ -378,7 +99,7 @@ extern char *h_errlist[];
#if defined(lint)
extern int shut_up_lint;
#else
#define shut_up_lint 0
# define shut_up_lint 0
#endif
/* this macro efficently outputs a constant string to a fd
@ -389,4 +110,3 @@ extern int shut_up_lint;
write(Mfd, _ac, sizeof(_ac)-1); \
} while (shut_up_lint)
extern char *calloc(), *malloc(), *realloc();

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.28 2000-12-13 12:31:07-08 bryan Exp $
* $Id: readcfg.c,v 5.30 2001-02-08 15:32:28-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -29,38 +29,32 @@
/*
* Network console modifications by Robert Olson, olson@mcs.anl.gov.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include "cons.h"
#include "port.h"
#include "consent.h"
#include "client.h"
#include "group.h"
#include "access.h"
#include "readcfg.h"
#include "master.h"
#include "main.h"
#include <compat.h>
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <port.h>
#include <consent.h>
#include <client.h>
#include <group.h>
#include <access.h>
#include <readcfg.h>
#include <master.h>
#include <main.h>
GRPENT
@ -93,9 +87,9 @@ register FILE *fp;
register CONSENT *pCE;
register REMOTE **ppRC;
char LogDirectory[MAXLOGLEN];
long tyme;
time_t tyme;
tyme = time((long *)0);
tyme = time((time_t *)0);
LogDirectory[0] = '\000';
pGEAll = aGroups; /* fill in these structs */
pCE = aConsoles;
@ -172,10 +166,10 @@ register FILE *fp;
}
if ( 0 !=
#if USE_STRINGS
bcmp(&acMyAddr[0], hpMe->h_addr, hpMe->h_length)
#else
#if HAVE_MEMCMP
memcmp(&acMyAddr[0], hpMe->h_addr, hpMe->h_length)
#else
bcmp(&acMyAddr[0], hpMe->h_addr, hpMe->h_length)
#endif
) {

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.19 2000-12-14 16:21:18-08 bryan Exp $
* $Id: version.h,v 1.20 2001-02-17 08:37:24-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -8,4 +8,4 @@
* Copyright GNAC, Inc., 1998
*/
#define THIS_VERSION "conserver.com version 6.1.7"
#define THIS_VERSION "conserver.com version 7.0.0"

View File

@ -1,58 +0,0 @@
# $Id: Makefile,v 1.11 1999-01-25 15:38:39-08 bryan Exp $
#
# Makefile for console client progran
#
PROG=console
PREFIX=/usr/local
BIN=${PREFIX}/bin
ETC=${PREFIX}/etc
MAN=${PREFIX}/man
MANSECT=8
C=../conserver
LINCLUDE= ${INCLUDE} -I$C
CFLAGS= ${DEBUG} ${CDEFS} ${LINCLUDE}
HDR=
SRC= console.c
OBJ= console.o
all: ${PROG}
${PROG}: ${OBJ}
${CC} -o $@ ${CFLAGS} ${OBJ} ${LIBS}
clean: FRC
rm -f Makefile.bak ${PROG} *.tbl a.out *.o core errs lint.out tags
depend: ${HDR} ${SRC} FRC
makedepend ${CDEFS} ${LINCLUDE} ${SRC}
dirs: ${BIN}
install: all dirs FRC
${INSTALL} -cs ${PROG} ${BIN}/${PROG}
${MAN}/man${MANSECT}:
${INSTALL} -d $@
install.man: ${MAN}/man${MANSECT}
tbl console.man > console.tbl
${INSTALL} -c console.tbl ${MAN}/man${MANSECT}/console.${MANSECT}
lint: ${HDR} ${SRC} FRC
lint -h ${CDEFS} ${LINCLUDE} ${SRC}
tags: ${HDR} ${SRC}
ctags -t ${HDR} ${SRC}
/ ${BIN}:
${INSTALL} -d $@
FRC:
# DO NOT DELETE THIS LINE -- make depend depends on it.
console.o: ../conserver/cons.h ../conserver/port.h ../conserver/version.h

54
console/Makefile.in Normal file
View File

@ -0,0 +1,54 @@
### Path settings
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
### Installation programs and flags
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
LN_S = @LN_S@
MKDIR = @MKDIR@
### Compiler and link options
CC = @CC@
CFLAGS = @CFLAGS@ # -DPUCC -DSUN5
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/conserver $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@SET_MAKE@
### Makefile rules - no user-servicable parts below
CONSOLE_OBJS = console.o
CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h $(top_srcdir)/conserver/port.h
ALL = console
all: $(ALL)
.PHONY: clean distclean install
console: $(CONSOLE_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(CONSOLE_HDRS)
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o $(ALL) core
distclean: clean
rm -f Makefile
install:
$(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) console $(DESTDIR)$(bindir)
$(MKDIR) $(DESTDIR)$(mandir)/man1
$(INSTALL) console.man $(DESTDIR)$(mandir)/man8/console.1

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.31 2000-12-13 12:31:56-08 bryan Exp $
* $Id: console.c,v 5.35 2001-02-18 22:00:47-08 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -27,62 +27,32 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <netdb.h>
#include <pwd.h>
#include <errno.h>
#include <ctype.h>
#include "cons.h"
#include "port.h"
#include "version.h"
#include <compat.h>
#if USE_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif
#include <port.h>
#include <version.h>
#if USE_TERMIOS
#include <termios.h>
#include <unistd.h>
#else
#if USE_TERMIO
#include <termio.h>
#else /* use ioctl stuff */
#include <sgtty.h>
#include <sys/ioctl.h>
#endif
#endif
extern char *getenv();
extern char *getpass();
extern char *calloc(), *realloc();
/* extern short htons(); */
extern int errno;
#if !HAVE_STRERROR
extern char *sys_errlist[];
#define strerror(Me) (sys_errlist[Me])
#endif
static char rcsid[] =
"$Id: console.c,v 5.31 2000-12-13 12:31:56-08 bryan Exp $";
"$Id: console.c,v 5.35 2001-02-18 22:00:47-08 bryan Exp $";
static char *progname =
rcsid;
int fVerbose = 0, fReplay = 0, fRaw = 0;
int chAttn = -1, chEsc = -1;
char *pcInMaster = /* which machine is current */
HOST;
MASTERHOST;
/* panic -- we have no more momory
*/
@ -187,7 +157,7 @@ char **ppc;
static void
Version()
{
register unsigned char *puc;
/* register unsigned char *puc; */
printf("%s: %s\n", progname, THIS_VERSION);
printf("%s: initial master server `%s\'\n", progname, pcInMaster);
@ -195,8 +165,8 @@ Version()
putCtlc(DEFATTN, stdout);
putCtlc(DEFESC, stdout);
printf("\'\n");
puc = (unsigned char *)&local_port.sin_addr;
printf("%s: loopback address for %s is %d.%d.%d.%d\n", progname, acMyName, puc[0], puc[1], puc[2], puc[3]);
/* puc = (unsigned char *)&local_port.sin_addr;
printf("%s: loopback address for %s is %d.%d.%d.%d\n", progname, acMyName, puc[0], puc[1], puc[2], puc[3]); */
}
@ -284,23 +254,25 @@ short sPort;
register int s;
register struct hostent *hp;
#if USE_STRINGS
(void)bzero((char *)pPort, sizeof(*pPort));
#else
#if HAVE_MEMSET
memset((void *)pPort, '\000', sizeof(*pPort));
#else
(void)bzero((char *)pPort, sizeof(*pPort));
#endif
/*
if (0 == strcmp(pcToHost, strcpy(acThisHost, acMyName))) {
(void)strcpy(pcToHost, acLocalhost);
#if USE_STRINGS
(void)bcopy((char *)&local_port.sin_addr, (char *)&pPort->sin_addr, sizeof(local_port.sin_addr));
#else
#if HAVE_MEMCPY
memcpy((char *)&pPort->sin_addr, (char *)&local_port.sin_addr, sizeof(local_port.sin_addr));
#endif
} else if ((struct hostent *)0 != (hp = gethostbyname(pcToHost))) {
#if USE_STRINGS
(void)bcopy((char *)hp->h_addr, (char *)&pPort->sin_addr, hp->h_length);
#else
(void)bcopy((char *)&local_port.sin_addr, (char *)&pPort->sin_addr, sizeof(local_port.sin_addr));
#endif
} else */
if ((struct hostent *)0 != (hp = gethostbyname(pcToHost))) {
#if HAVE_MEMCPY
memcpy((char *)&pPort->sin_addr, (char *)hp->h_addr, hp->h_length);
#else
(void)bcopy((char *)hp->h_addr, (char *)&pPort->sin_addr, hp->h_length);
#endif
} else {
fprintf(stderr, "%s: gethostbyname: %s: %s\n", progname, pcToHost, hstrerror(h_errno));
@ -340,16 +312,16 @@ short sPort;
* correct mode for us to do our thing
*/
static int screwy = 0;
#if USE_TERMIOS
#if HAVE_TERMIOS_H
static struct termios o_tios;
#else
#if USE_TERMIO
# if HAVE_TERMIO_H
static struct termio o_tio;
#else
# else
static struct sgttyb o_sty;
static struct tchars o_tchars;
static struct ltchars o_ltchars;
#endif
# endif
#endif
@ -361,23 +333,28 @@ static struct ltchars o_ltchars;
static void
c2raw()
{
#if USE_TERMIOS
#if HAVE_TERMIOS_H
auto struct termios n_tios;
#else
#if USE_TERMIO
# if HAVE_TERMIO_H
auto struct termio n_tio;
#else
# else
auto struct sgttyb n_sty;
auto struct tchars n_tchars;
auto struct ltchars n_ltchars;
#endif
# endif
#endif
if (!isatty(0) || 0 != screwy)
return;
#if USE_TERMIOS
if (0 != ioctl(0, TCGETS, & o_tios)) {
#ifdef HAVE_TERMIOS_H
# ifdef HAVE_TCGETATTR
if (0 != tcgetattr(0, & o_tios))
# else
if (0 != ioctl(0, TCGETS, & o_tios))
# endif
{
fprintf(stderr, "%s: iotcl: getsw: %s\n", progname, strerror(errno));
exit(10);
}
@ -387,12 +364,17 @@ c2raw()
n_tios.c_lflag &= ~(ICANON|ISIG|ECHO);
n_tios.c_cc[VMIN] = 1;
n_tios.c_cc[VTIME] = 0;
if (0 != ioctl(0, TCSETS, & n_tios)) {
# ifdef HAVE_TCSETATTR
if (0 != tcsetattr(0, TCSANOW, & n_tios))
# else
if (0 != ioctl(0, TCSETS, & n_tios))
# endif
{
fprintf(stderr, "%s: getarrt: %s\n", progname, strerror(errno));
exit(10);
}
#else
#if USE_TERMIO
# ifdef HAVE_TERMIO_H
if (0 != ioctl(0, TCGETA, & o_tio)) {
fprintf(stderr, "%s: iotcl: geta: %s\n", progname, strerror(errno));
exit(10);
@ -407,7 +389,7 @@ c2raw()
fprintf(stderr, "%s: iotcl: seta: %s\n", progname, strerror(errno));
exit(10);
}
#else
# else
if (0 != ioctl(0, TIOCGETP, (char *)&o_sty)) {
fprintf(stderr, "%s: iotcl: getp: %s\n", progname, strerror(errno));
exit(10);
@ -449,7 +431,7 @@ c2raw()
fprintf(stderr, "%s: ioctl: sltc: %s\n", progname, strerror(errno));
return;
}
#endif
# endif
#endif
screwy = 1;
}
@ -462,16 +444,20 @@ c2cooked()
{
if (!screwy)
return;
#if USE_TERMIOS
#ifdef HAVE_TERMIOS_H
# ifdef HAVE_TCSETATTR
tcsetattr(0, TCSANOW, &o_tios);
# else
(void)ioctl(0, TCSETS, (char *)&o_tios);
# endif
#else
#if USE_TERMIO
# ifdef HAVE_TERMIO_H
(void)ioctl(0, TCSETA, (char *)&o_tio);
#else
# else
(void)ioctl(0, TIOCSETP, (char *)&o_sty);
(void)ioctl(0, TIOCSETC, (char *)&o_tchars);
(void)ioctl(0, TIOCSLTC, (char *)&o_ltchars);
#endif
# endif
#endif
screwy = 0;
}
@ -549,7 +535,7 @@ char *pcBuf, *pcWant;
return strcmp(pcBuf, pcWant);
}
#if defined(SERVICE)
#if defined(SERVICENAME)
static struct servent *pSE;
#endif
@ -586,16 +572,16 @@ char *pcPorts, *pcMaster, *pcTo, *pcCmd, *pcWho;
}
if ('\000' == *pcPorts) {
#if defined(SERVICE)
#if defined(SERVICENAME)
/* in net order -- ksb */
j = pSE->s_port;
#else
#if defined(PORT)
j = htons(PORT);
#else
# if defined(PORTNUMBER)
j = htons(PORTNUMBER);
# else
fprintf(stderr, "%s: no port or service compiled in?\n", progname);
exit(8);
#endif
# endif
#endif
} else if (!isdigit(pcPorts[0])) {
fprintf(stderr, "%s: %s: %s\n", progname, pcMaster, pcPorts);
@ -627,7 +613,7 @@ static int SawUrg = 0;
* an out of band command to suspend ourself. We just tell the reader
* routine we saw one
*/
SIGRETS
RETSIGTYPE
oob(sig)
int sig;
{
@ -705,7 +691,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser;
fprintf(stderr, "%s: fcntl: %d: %s\n", progname, s, strerror(errno));
}
#else
#if defined(SIOCSPGRP)
# if defined(SIOCSPGRP)
{
auto int iTemp;
/* on the HP-UX systems if different
@ -715,7 +701,7 @@ char *pcMaster, *pcMach, *pcHow, *pcUser;
fprintf(stderr, "%s: ioctl: %d: %s\n", progname, s, strerror(errno));
}
}
#endif
# endif
#endif
#if defined(SIGURG)
(void)signal(SIGURG, oob);
@ -1167,9 +1153,9 @@ char **argv;
++progname;
}
#if defined(SERVICE)
if ((struct servent *)0 == (pSE = getservbyname(SERVICE, "tcp"))) {
fprintf(stderr, "%s: getservbyname: %s: %s\n", progname, SERVICE, strerror(errno));
#if defined(SERVICENAME)
if ((struct servent *)0 == (pSE = getservbyname(SERVICENAME, "tcp"))) {
fprintf(stderr, "%s: getservbyname: %s: %s\n", progname, SERVICENAME, strerror(errno));
exit(1);
}
#endif
@ -1192,10 +1178,10 @@ char **argv;
exit(2);
}
if ((struct hostent *)0 != (hp = gethostbyname(acLocalhost))) {
#if USE_STRINGS
(void)bcopy((char *)hp->h_addr, (char *)&local_port.sin_addr, hp->h_length);
#else
#if HAVE_MEMCPY
memcpy((char *)&local_port.sin_addr, (char *)hp->h_addr, hp->h_length);
#else
(void)bcopy((char *)hp->h_addr, (char *)&local_port.sin_addr, hp->h_length);
#endif
} else {
acLocalhost[0] = '\000';

251
install-sh Normal file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View File

@ -1,8 +0,0 @@
# $Id: BSDOS3,v 1.2 1999-01-14 13:33:09-08 bryan Exp $
#
'CC=gcc'
'INSTALL=/usr/ucb/install'
'INCLUDE='
'DEBUG=-O'
'CDEFS=-DBSDOS3'
'LIBS='

View File

@ -1,8 +0,0 @@
# $Id: IRIX6,v 1.1 1999-01-15 15:28:51-08 bryan Exp $
#
'CC=cc'
'INSTALL=/sbin/install'
'INCLUDE='
'DEBUG=-O'
'CDEFS=-DIRIX6'
'LIBS='

View File

@ -1,8 +0,0 @@
# $Id: Linux2,v 1.1 1999-01-14 22:25:08-08 bryan Exp $
#
'CC=gcc'
'INSTALL=/usr/bin/install'
'INCLUDE='
'DEBUG=-O'
'CDEFS=-DLINUX2'
'LIBS=-lcrypt'

View File

@ -1,48 +0,0 @@
Porting
=======
Well, porting should be a fairly simple process. There are three things
that need to be set up to get things to work. First, you need to modify
the 'system' script so that it can properly detect your system and
associate it with a name. Next, create a file in this directory of the
same name with the proper makefile definitions. You should be able to
just copy the SunOS5 file to the name you created and modify the values
defined. One of the important things to do is create a token name to be
used during compilation (see the CDEFS lines - Solaris 5.X uses SUN5, for
example). This token will then be used in the ../conserver/port.h file.
So, as an example, say you're porting to the "Unix OS" version 6.4.
You'd add a line like the following to the system script:
UnixOS-6.*) p="UnixOS6" ;;
Then you'd create a UnixOS6 file in this directory with the contents of:
# Sample UnixOS6 file
#
'CC=gcc'
'INSTALL=/usr/ucb/install'
'INCLUDE='
'DEBUG=-O'
'CDEFS=-DUNIXOS6'
'LIBS='
Again, the key is the -DUNIXOS6 line...the others should be whatever is
required to get things to build.
Now you need to go define UNIXOS6 in ../conserver/port.h and have
it define the appropriate things. You'll need to add UNIXOS6 to the
line above '#error "Platform needs to be defined. See port.h"' and
then work through the file inserting UNIXOS6 at the appropriate spots.
Hopefully that's all you'll need to get the software to build. If, for
some reason, a porting issue is not dealt with properly in the source
files, you may need to adjust other .c and .h files. But, hopefully not.
Most of the tricky stuff can be adjusted via the port.h file.
That's about all the instructions I have. If I've missed anything
important, I'll be more than happy to supplement these instructions.
Just let me know. Just let me know.
#
# $Id: README,v 1.1 1999-01-22 13:24:21-08 bryan Exp $
#

View File

@ -1,8 +0,0 @@
# $Id: SunOS5,v 1.2 1999-01-14 13:33:09-08 bryan Exp $
#
'CC=gcc'
'INSTALL=/usr/ucb/install'
'INCLUDE='
'DEBUG=-O'
'CDEFS=-DSUN5'
'LIBS=-lsocket -lnsl'

View File

@ -1,19 +0,0 @@
#!/bin/sh
#
# $Id: system,v 1.4 1999-01-15 15:35:44-08 bryan Exp $
#
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb
s=`uname -s`
r=`uname -r`
case "$s-$r" in
SunOS-5.*) p="SunOS5" ;;
BSD/OS-3.*) p="BSDOS3" ;;
Linux-2.*) p="Linux2" ;;
IRIX-6.*) p="IRIX6" ;;
*) p="" ;;
esac
echo $p