Imported from conserver-7.0.2.tar.gz

This commit is contained in:
Bryan Stansell 2001-06-15 17:44:07 -07:00
parent 3e85064112
commit 8343145bcc
31 changed files with 1041 additions and 478 deletions

21
CHANGES
View File

@ -1,6 +1,25 @@
CHANGES
=======
version 7.0.2 (Jun 15, 2001):
- Bogus "ambiguous server abbreviation" with distributed server
setup fixed
- Hostname not passed with username from console client
- Fixed pseudo-terminal ('|' syntax in .cf file) bug with Solaris
and other STREAMS-based systems (actually works now in 7.X)
- Line-oriented timestamps in logfiles (see 'l' mark
specification) based on patch from Benn Oshrin
<benno@columbia.edu>
- Generalized debugging output, info messages and error messages
- Moved library search up in configure.in so function calls are
detected properly
- Permissions of install-sh were wrong
- Trimmed the README file and now distribute conserver.html
- Redhat RPM bundle (contrib/redhat-rpm) contributed by Paul
Heinlein <heinlein@measurecast.com>
- Cleaned up gcc warnings (for Solaris 7, at least)
- Makefiles now use .c.o: specification instead of %.o:
version 7.0.1 (May 3, 2001):
- 8bit on by default now (use --disable-8bit for old behavior)
- FreeBSD patches by Bill Fenner <fenner@research.att.com>
@ -109,5 +128,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.25 2001-05-03 06:44:01-07 bryan Exp $
# $Id: CHANGES,v 1.28 2001-06-15 17:36:53-07 bryan Exp $
#

View File

@ -3,6 +3,8 @@
Quickie Instructions
- Download conserver (http://www.conserver.com/) and unpack
- Run './configure'
- If all is well, run 'make install'
@ -20,9 +22,10 @@ Detailed Instructions
--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-pidfile=PIDFILE Specify PID filepath [/var/run/conserver.pid]
--with-maxmemb=MAXMEMB Specify maximum consoles per process [8]
--with-maxgrp=MAXGRP Specify maximum number of processes [32]
--enable-8bit Enable 8bit data path
--disable-8bit Disable 8bit data path
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
Not surprisingly, some match the old conserver/cons.h items...here
@ -82,5 +85,5 @@ Detailed Instructions
- That's it! Just start up the console server and enjoy!
#
# $Id: INSTALL,v 1.8 2001-02-18 21:50:14-08 bryan Exp $
# $Id: INSTALL,v 1.10 2001-06-15 09:48:58-07 bryan Exp $
#

115
LICENSE Normal file
View File

@ -0,0 +1,115 @@
Since this piece of software has had many contiributors, there is a
"chain" of licensing information embedded in the files. I've copied
what I could find here so that it's easy to reference. The entire
bundle of software is guided by these licensing statements.
----------------------------------------------------------------------------
Copyright (c) 2000, conserver.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
- Neither the name of conserver.com nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------------
Copyright (c) 1988, GNAC, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
- Neither the name of GNAC, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------------
Copyright 1992 Purdue Research Foundation, West Lafayette, Indiana
47907. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it freely, subject
to the following restrictions:
1. Neither the authors nor Purdue University are responsible for any
consequences of the use of this software.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Credit to the authors and Purdue
University must appear in documentation and sources.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. This notice may not be removed or altered.
----------------------------------------------------------------------------
Copyright (c) 1990 The Ohio State University.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that: (1) source distributions retain this entire copyright
notice and comment, and (2) distributions including binaries display
the following acknowledgement: ``This product includes software
developed by The Ohio State University and its contributors''
in the documentation or other materials provided with the distribution
and in all advertising materials mentioning features or use of this
software. Neither the name of the University nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------

93
README
View File

@ -4,101 +4,20 @@
Maintainer/Enhancer
Bryan Stansell (bryan@conserver.com) of Certainty Solutions, Inc. -
formerly Global Networking and Computing (GNAC).
Bryan Stansell (bryan@conserver.com)
Big new version released!
Documentation
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.
[3]announce@conserver.com is an announcement-only mailing list for
informing of new versions, major developments, etc.
[4]users@conserver.com is for general Q&A, discussions, ideas, etc
for conserver users. You can sign up my sending a message to
listname-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@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
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.
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
warranty or support implied by the distribution of the software.
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
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.
See the INSTALL file for installation, the conserver.html file for
an overview, and the man pages for specifics.
Downloading
The latest version can be found at http://www.conserver.com/.
The latest version can be found at http://www.conserver.com/
Other Good Information
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.15 2001-03-05 02:41:56-08 bryan Exp $
# $Id: README,v 1.16 2001-06-15 04:34:31-07 bryan Exp $
#

View File

@ -39,3 +39,8 @@
* TCP connection timeout
*/
#undef CONNECTTIMEOUT
/*
* pidfile to write to
*/
#undef PIDFILE

View File

@ -36,7 +36,7 @@ all: $(ALL)
autologin: $(AUTOLOGIN_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o autologin $(AUTOLOGIN_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(AUTOLOGIN_HDRS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:

View File

@ -50,11 +50,6 @@
*/
#undef PASSWDFILE
/*
* Process ID file path
*/
#undef PIDFILE
/*
* Number of consoles per child process
*/
@ -75,6 +70,11 @@
*/
#undef CONNECTTIMEOUT
/*
* pidfile to write to
*/
#undef PIDFILE
/* Define if you have the flock function. */
#undef HAVE_FLOCK

236
configure vendored
View File

@ -1884,117 +1884,8 @@ fi
for ac_func in 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
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1891: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1896 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:1919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
echo "configure:1944: checking whether setpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1952 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
* If this system has a BSD-style setpgrp, which takes arguments, exit
* successfully.
*/
main()
{
if (setpgrp(1,1) == -1)
exit(0);
else
exit(1);
}
EOF
if { (eval echo configure:1972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_setpgrp_void=no
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_func_setpgrp_void=yes
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_func_setpgrp_void" 1>&6
if test $ac_cv_func_setpgrp_void = yes; then
cat >> confdefs.h <<\EOF
#define SETPGRP_VOID 1
EOF
fi
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
echo "configure:1998: checking for socket in -lsocket" >&5
echo "configure:1889: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2002,7 +1893,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2006 "configure"
#line 1897 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2013,7 +1904,7 @@ int main() {
socket()
; return 0; }
EOF
if { (eval echo configure:2017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2041,7 +1932,7 @@ else
fi
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
echo "configure:2045: checking for gethostbyname in -lnsl" >&5
echo "configure:1936: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2049,7 +1940,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2053 "configure"
#line 1944 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2060,7 +1951,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
if { (eval echo configure:2064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2088,7 +1979,7 @@ else
fi
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
echo "configure:2092: checking for crypt in -lcrypt" >&5
echo "configure:1983: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2096,7 +1987,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2100 "configure"
#line 1991 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2107,7 +1998,7 @@ int main() {
crypt()
; return 0; }
EOF
if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2136,6 +2027,115 @@ fi
for ac_func in 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
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2034: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2039 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:2062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
echo "configure:2087: checking whether setpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 2095 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/*
* If this system has a BSD-style setpgrp, which takes arguments, exit
* successfully.
*/
main()
{
if (setpgrp(1,1) == -1)
exit(0);
else
exit(1);
}
EOF
if { (eval echo configure:2115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_setpgrp_void=no
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_func_setpgrp_void=yes
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_func_setpgrp_void" 1>&6
if test $ac_cv_func_setpgrp_void = yes; then
cat >> confdefs.h <<\EOF
#define SETPGRP_VOID 1
EOF
fi
trap '' 1 2 15
cat > confcache <<\EOF

View File

@ -203,17 +203,17 @@ 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 ### 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 ### Create output files. #######################################
AC_SUBST(LIBOBJS)
AC_OUTPUT(Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile)

View File

@ -1,4 +1,4 @@
.\" $Id: conserver.cf.man,v 1.6 2000-12-11 17:49:08-08 bryan Exp $
.\" $Id: conserver.cf.man,v 1.7 2001-06-15 07:11:37-07 bryan Exp $
.\" @(#)constab.5 01/06/91 OSU CIS; Thomas A. Fine
.TH CONSERVER.CF 4 "Local"
.SH NAME
@ -7,11 +7,11 @@ conserver.cf \- table of server console terminals used by conserver(8L)
.br
LOGDIR=\fIlogdirectory\fP
.br
\fIserver\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d\fP]
\fIserver\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP]
.br
\fIserver\fP:!\fIhost\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d\fP]
\fIserver\fP:!\fIhost\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP]
.br
\fIserver\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d\fP]
\fIserver\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fImark-interval\fP[\fIm|h|d|l\fP]
.br
\fB%%\fP
.br
@ -49,9 +49,14 @@ this server is logged. Any occurance of `&' will be replaced with
the \fIserver\fP name. Any path that doesn't begin with a `/' will
have \fIlogdirectory\fP (value of LOGDIR) prepended to it.
.PP
\fImark-interval\fP[\fIm|h|d\fP] - specifies the time between
\fImark-interval\fP[\fIm|h|d|l\fP] - specifies the time between
timestamps applied to the console log file. The timestamps look like
`[-- MARK -- Mon Jan 25 14:46:56 PST 1999]'.
`[-- MARK -- Mon Jan 25 14:46:56 PST 1999]'. The `m', `h', and `d' tags
specify `minutes', `hours', and `days'. The `l' tag specifies `lines'
and will cause timestamps of the form `[Mon Jan 25 14:46:56 PST 1999]' to
be placed every \fImark-interval\fP lines (a newline character signifies
a new line). So, `5h' specifies every 5 hours and `2l' specifies every
two lines.
.PP
This section is terminated with a `%%' token on a line by itself.
.PP

163
conserver.html Normal file
View File

@ -0,0 +1,163 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META NAME="keywords" CONTENT="conserver,serial,console,serial
console,unix,tty,ttya,ttyb, rs-232,rs232,bryan
stansell,stansell,console server,terminal server,headless">
<META NAME="author" CONTENT="Bryan Stansell &lt;bryan@conserver.com&gt;">
<TITLE>Conserver</TITLE>
<STYLE type="text/css">
body {
background-color: #EEEEEE;
color: black;
}
</STYLE>
</HEAD>
<BODY>
<TABLE SUMMARY="Logo" BGCOLOR="black" WIDTH="100%" ALIGN="CENTER"><TR><TD ALIGN="CENTER">
<BR><IMG SRC="conserver.gif" ALT="Conserver"><BR><BR></TD></TR></TABLE><BR>
<TABLE SUMMARY="Conserver Page" WIDTH="80%" ALIGN="CENTER"><TR><TD>
<H3>What is conserver?</H3>
<P>
From an email I once sent...
</P>
<P>
Conserver is an application that allows multiple users to watch a
serial console at the same time. It can log the data, allows users to
take write-access of a console (one at a time), and has a variety of
bells and whistles to accentuate that basic functionality. The idea is
that conserver will log all your serial traffic so you can go back and
review why something crashed, look at changes (if done on the console),
or tie the console logs into a monitoring system (just watch the
logfiles it creates). With multi-user capabilities you can work on
equipment with others, mentor, train, etc. It also does all that
client-server stuff so that, assuming you have a network connection,
you can interact with any of the equipment from home or wherever.
</P>
<H3>A FAQ!</H3>
Here's the start of a conserver <A
HREF="http://www.conserver.com/FAQ">FAQ</A>. Got any additions? Let
me know.
<H3>Mailing Lists</H3>
<P>
There are currently two mailing lists available. <A
HREF="mailto:announce@conserver.com">announce@conserver.com</A> is an
announcement-only mailing list for informing of new versions, major
developments, etc. <A
HREF="mailto:users@conserver.com">users@conserver.com</A> is for
general Q&amp;A, discussions, ideas, etc for conserver users. You can
sign up my sending a message to <A
HREF="mailto:announce-request@conserver.com">announce-request@conserver.com</A>
or <A
HREF="mailto:users-request@conserver.com">users-request@conserver.com</A>
with a subject of "subscribe" or head over to the online <A
HREF="https://www.conserver.com/mailman/listinfo">web pages</A>.
</P>
<H3>Wanna Search?</H3>
<P>
Give the <A HREF="http://www.conserver.com/htdig/">search engine</A> a
try. You can hunt through the mailing list archives as well as the
files referenced here.
</P>
<H3>Origin</H3>
<P>
The console server software found here is a heavily modified 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.
</P>
<P>
Arnold de Leon (arnold@corp.webtv.net) then fixed various bugs and
added enhancements while at <A
HREF="http://www.synopsys.com/">Synopsys</A>. I then took the result,
continued fixing things, and added features we found useful.
</P>
<P>
<A HREF="http://www.certaintysolutions.com/">Certainty Solutions</A>
(formerly Global Networking and Computing - GNAC) has been supporting
my coding efforts (in too many ways to list) since 1996.
</P>
<H3>The conserver.com Distribution</H3>
<P>
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.
</P>
<P>
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 <A
HREF="http://www.certaintysolutions.com/">Certainty Solutions</A>) 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 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.
</P>
<H3>Downloading</H3>
<P>
The current version is <A
HREF="http://www.conserver.com/7.0.2.tar.gz">
7.0.2.tar.gz</A>. You can get it via <A
HREF="ftp://ftp.conserver.com/conserver/7.0.2.tar.gz">FTP</A>
or <A HREF="http://www.conserver.com/7.0.2.tar.gz">HTTP</A>.
See the <A HREF="http://www.conserver.com/CHANGES">CHANGES</A> file for
information on the latest updates.
</P>
<H3>Installation</H3>
<P>
Check the
<A HREF="http://www.conserver.com/INSTALL">INSTALL</A>
file for instructions.
</P>
<H3>Other Good Information</H3>
<P>
Zonker Harris has fabulous documents regarding the hookup of
consoles to terminal servers and other such devices. His <A
HREF="http://www.conserver.com/consoles/"> Greater Scroll
of Console Knowledge</A> is a great place to start.
</P>
<HR NOSHADE><ADDRESS>Bryan Stansell
(<A HREF = "mailto:bryan@conserver.com">bryan@conserver.com</A>)<BR></ADDRESS>
</TD></TR></TABLE>
</BODY>
</HTML>

View File

@ -26,10 +26,11 @@ LIBS = @LIBS@
### 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 \
readcfg.o fallback.o output.o
CONSERVER_HDRS = ../config.h $(top_srcdir)/compat.h $(srcdir)/access.h \
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/group.h \
$(srcdir)/main.h $(srcdir)/master.h $(srcdir)/readcfg.h
$(srcdir)/main.h $(srcdir)/master.h $(srcdir)/readcfg.h \
$(srcdir)/output.h
ALL = conserver
@ -40,7 +41,7 @@ all: $(ALL)
conserver: $(CONSERVER_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(CONSERVER_HDRS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
@ -49,7 +50,7 @@ clean:
distclean: clean
rm -f Makefile
install:
install: conserver
$(MKDIR) $(DESTDIR)$(sbindir)
$(INSTALL_PROGRAM) conserver $(DESTDIR)$(sbindir)
$(MKDIR) $(DESTDIR)$(mandir)/man8

View File

@ -1,5 +1,5 @@
/*
* $Id: access.c,v 5.18 2001-02-21 17:26:06-08 bryan Exp $
* $Id: access.c,v 5.21 2001-06-15 09:02:02-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -47,6 +47,7 @@ static char copyright[] =
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
@ -62,6 +63,7 @@ static char copyright[] =
#include <group.h>
#include <readcfg.h>
#include <main.h>
#include <output.h>
@ -136,6 +138,9 @@ char *pattern;
if (~netmask & pattern_addr)
netmask = 0xffffffff; /* compare entire addresses */
hostaddr = *(unsigned long int*)hp->h_addr;
Debug( "Access check: host=%lx(%lx/%lx)", hostaddr & netmask, hostaddr, netmask );
Debug( "Access check: acl=%lx(%lx/%lx)", pattern_addr & netmask, pattern_addr, netmask );
return (hostaddr & netmask) != (pattern_addr & netmask);
}
@ -154,17 +159,15 @@ struct hostent *hp;
if ( fDebug ) {
puc = (unsigned char *)hp->h_addr;
sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]);
fprintf( stderr, "%s: Access check: hostname=%s, ip=%s\n", progname, hp->h_name, acAddr );
Debug( "Access check: hostname=%s, ip=%s", hp->h_name, acAddr );
}
#if ORIGINAL_CODE
puc = (unsigned char *)hp->h_addr;
sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]);
#endif
for (i = 0; i < iAccess; ++i) {
if ( fDebug ) {
fprintf( stderr, "%s: Access check: who=%s, trust=%c\n", progname, pACList[i].pcwho, pACList[i].ctrust );
}
if (isdigit(pACList[i].pcwho[0])) {
Debug( "Access check: who=%s, trust=%c", pACList[i].pcwho, pACList[i].ctrust );
if (isdigit((int)(pACList[i].pcwho[0]))) {
#if ORIGINAL_CODE
/* we could allow 128.210.7 to match all on that subnet
* here...
@ -182,6 +185,7 @@ struct hostent *hp;
pcName = hp->h_name;
len = strlen(pcName);
while (len >= pACList[i].ilen) {
Debug( "Access check: name=%s", pcName );
if (0 == strcmp(pcName, pACList[i].pcwho)) {
return pACList[i].ctrust;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.41 2001-05-03 06:31:33-07 bryan Exp $
* $Id: consent.c,v 5.47 2001-06-15 11:33:49-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -63,6 +63,7 @@ static char copyright[] =
#include <consent.h>
#include <client.h>
#include <main.h>
#include <output.h>
struct hostcache *hostcachelist=NULL;
@ -136,11 +137,11 @@ char *pcMode;
register int i;
auto char acFirst;
while (isdigit(*pcMode)) {
while (isdigit((int)(*pcMode))) {
++pcMode;
}
acFirst = *pcMode;
if (isupper(acFirst))
if (isupper((int)(acFirst)))
acFirst = tolower(acFirst);
for (i = 0; i < sizeof(parity)/sizeof(struct parity); ++i) {
if (acFirst != parity[i].ckey)
@ -164,7 +165,7 @@ CONSENT *pCE;
/* here we should fstat for `read-only' checks
*/
if (-1 == fstat(pCE->fdtty, & stPerm)) {
fprintf(stderr, "%s: fstat: %s: %s\n", progname, pCE->dfile, strerror(errno));
Error( "fstat: %s: %s", pCE->dfile, strerror(errno));
} else if (0 == (stPerm.st_mode & 0222)) {
/* any device that is read-only we won't write to
*/
@ -175,7 +176,7 @@ CONSENT *pCE;
* Get terminal attributes
*/
if (-1 == tcgetattr(pCE->fdtty, &termp)) {
fprintf(stderr, "%s: tcgetattr: %s(%d): %s\n", progname, pCE->dfile, pCE->fdtty, strerror(errno));
Error( "tcgetattr: %s(%d): %s", pCE->dfile, pCE->fdtty, strerror(errno));
return -1;
}
@ -201,11 +202,11 @@ CONSENT *pCE;
termp.c_cc[VTIME] = 1;
if (-1 == cfsetospeed(&termp,pCE->pbaud->irate)) {
fprintf(stderr, "%s: cfsetospeed: %s(%d): %s\n", progname, pCE->dfile, pCE->fdtty, strerror(errno));
Error( "cfsetospeed: %s(%d): %s", pCE->dfile, pCE->fdtty, strerror(errno));
return -1;
}
if (-1 == cfsetispeed(&termp,pCE->pbaud->irate)) {
fprintf(stderr, "%s: cfsetispeed: %s(%d): %s\n", progname, pCE->dfile, pCE->fdtty, strerror(errno));
Error( "cfsetispeed: %s(%d): %s", pCE->dfile, pCE->fdtty, strerror(errno));
return -1;
}
@ -213,7 +214,7 @@ CONSENT *pCE;
* Set terminal attributes
*/
if (-1 == tcsetattr(pCE->fdtty, TCSADRAIN, &termp)) {
fprintf(stderr, "%s: tcsetattr: %s(%d): %s\n", progname, pCE->dfile, pCE->fdtty, strerror(errno));
Error( "tcsetattr: %s(%d): %s", pCE->dfile, pCE->fdtty, strerror(errno));
return -1;
}
@ -247,7 +248,7 @@ CONSENT *pCE;
/* here we should fstat for `read-only' checks
*/
if (-1 == fstat(pCE->fdtty, & stPerm)) {
fprintf(stderr, "%s: fstat: %s: %s\n", progname, pCE->dfile, strerror(errno));
Error( "fstat: %s: %s", pCE->dfile, strerror(errno));
} else if (0 == (stPerm.st_mode & 0222)) {
/* any device that is read-only we won't write to
*/
@ -256,7 +257,7 @@ CONSENT *pCE;
# if defined(TIOCSSOFTCAR)
if (-1 == ioctl(pCE->fdtty, TIOCSSOFTCAR, &fSoftcar)) {
fprintf(stderr, "%s: softcar: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "softcar: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
# endif
@ -264,7 +265,7 @@ CONSENT *pCE;
/* stty 9600 raw cs7
*/
if (-1 == ioctl(pCE->fdtty, TIOCGETP, (char *)&sty)) {
fprintf(stderr, "%s: ioctl1: %s(%d): %s\n", progname, pCE->dfile, pCE->fdtty, strerror(errno));
Error( "ioctl1: %s(%d): %s", pCE->dfile, pCE->fdtty, strerror(errno));
return -1;
}
sty.sg_flags &= ~(ECHO|CRMOD|pCE->pparity->iclr);
@ -274,7 +275,7 @@ CONSENT *pCE;
sty.sg_ispeed = pCE->pbaud->irate;
sty.sg_ospeed = pCE->pbaud->irate;
if (-1 == ioctl(pCE->fdtty, TIOCSETP, (char *)&sty)) {
fprintf(stderr, "%s: ioctl2: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl2: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
@ -282,7 +283,7 @@ CONSENT *pCE;
* (in cbreak mode we may not need to this... but we do)
*/
if (-1 == ioctl(pCE->fdtty, TIOCGETC, (char *)&m_tchars)) {
fprintf(stderr, "%s: ioctl3: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl3: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
m_tchars.t_intrc = -1;
@ -292,11 +293,11 @@ CONSENT *pCE;
m_tchars.t_eofc = -1;
m_tchars.t_brkc = -1;
if (-1 == ioctl(pCE->fdtty, TIOCSETC, (char *)&m_tchars)) {
fprintf(stderr, "%s: ioctl4: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl4: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
if (-1 == ioctl(pCE->fdtty, TIOCGLTC, (char *)&m_ltchars)) {
fprintf(stderr, "%s: ioctl5: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl5: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
m_ltchars.t_werasc = -1;
@ -305,7 +306,7 @@ CONSENT *pCE;
m_ltchars.t_suspc = -1;
m_ltchars.t_dsuspc = -1;
if (-1 == ioctl(pCE->fdtty, TIOCSLTC, (char *)&m_ltchars)) {
fprintf(stderr, "%s: ioctl6: %d: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl6: %d: %s", pCE->fdtty, strerror(errno));
return -1;
}
# if HAVE_STROPTS_H
@ -339,11 +340,10 @@ CONSENT *pCE;
auto struct ltchars m_ltchars;
# endif
# endif
# if HAVE_RLIMIT
# if HAVE_GETRLIMIT
auto struct rlimit rl;
# endif
auto int i, iNewGrp;
auto int fd;
extern char **environ;
register char *pcShell, **ppcArgv;
@ -353,9 +353,10 @@ CONSENT *pCE;
case -1:
return -1;
case 0:
thepid = getpid();
break;
default:
fprintf(stderr, "%s: %d is the pid on %s\n", progname, pCE->ipid, pCE->acslave);
Error( "%d is the pid on %s", pCE->ipid, pCE->acslave);
(void)fflush(stderr);
pCE->fup = 1;
sleep(2); /* chance to open line */
@ -370,7 +371,7 @@ CONSENT *pCE;
/* setup new process with clean filew descriptors
*/
# if HAVE_RLIMIT
# if HAVE_GETRLIMIT
getrlimit(RLIMIT_NOFILE, &rl);
i = rl.rlim_cur;
# else
@ -393,7 +394,7 @@ CONSENT *pCE;
# if HAVE_SETSID
iNewGrp = setsid();
if (-1 == iNewGrp) {
fprintf(stderr, "%s: %s: setsid: %s\n", progname, pCE->server, strerror(errno));
Error( "%s: setsid: %s", pCE->server, strerror(errno));
iNewGrp = getpid();
}
# else
@ -401,7 +402,7 @@ CONSENT *pCE;
# endif
if (0 != open(pCE->acslave, 2, 0) || 1 != dup(0)) {
fprintf(stderr, "%s: %s: fd sync error\n", progname, pCE->server);
Error( "%s: fd sync error", pCE->server);
exit(1);
}
# if HAVE_PTSNAME
@ -410,10 +411,6 @@ CONSENT *pCE;
* streams modules `ptem' and `ld'
*/
(void)ioctl(0, I_PUSH, "ptem");
(void)ioctl(0, I_PUSH, "ld");
# endif
# if HAVE_LDTERM
(void)ioctl(0, I_PUSH, "ptem");
(void)ioctl(0, I_PUSH, "ldterm");
# endif
# if HAVE_STTY_LD
@ -427,7 +424,7 @@ CONSENT *pCE;
if (0 != ioctl(0, TCGETS, & n_tio))
# endif
{
fprintf(stderr, "%s: iotcl: getsw: %s\n", progname, strerror(errno));
Error( "iotcl: getsw: %s", strerror(errno));
exit(1);
}
n_tio.c_iflag &= ~(IGNCR|IUCLC);
@ -452,7 +449,7 @@ CONSENT *pCE;
if (0 != ioctl(0, TCSETS, & n_tio))
# endif
{
fprintf(stderr, "%s: getarrt: %s\n", progname, strerror(errno));
Error( "getarrt: %s", strerror(errno));
exit(1);
}
@ -461,7 +458,7 @@ CONSENT *pCE;
/* stty 9600 raw cs7
*/
if (-1 == ioctl(0, TIOCGETP, (char *)&sty)) {
fprintf(stderr, "%s: ioctl1: %s: %s\n", progname, pCE->fdtty, strerror(errno));
Error( "ioctl1: %s: %s", pCE->fdtty, strerror(errno));
exit(1);
}
sty.sg_flags &= ~(CBREAK|TANDEM|pCE->pparity->iclr);
@ -471,7 +468,7 @@ CONSENT *pCE;
sty.sg_ispeed = pCE->pbaud->irate;
sty.sg_ospeed = pCE->pbaud->irate;
if (-1 == ioctl(0, TIOCSETP, (char *)&sty)) {
fprintf(stderr, "%s: ioctl2: %s\n", progname, strerror(errno));
Error( "ioctl2: %s", strerror(errno));
exit(1);
}
@ -479,7 +476,7 @@ CONSENT *pCE;
* (in cbreak mode we may not need to this... but we do)
*/
if (-1 == ioctl(0, TIOCGETC, (char *)&m_tchars)) {
fprintf(stderr, "%s: ioctl3: %s\n", progname, strerror(errno));
Error( "ioctl3: %s", strerror(errno));
exit(1);
}
m_tchars.t_intrc = '\003';
@ -489,11 +486,11 @@ CONSENT *pCE;
m_tchars.t_eofc = '\004';
m_tchars.t_brkc = '\033';
if (-1 == ioctl(0, TIOCSETC, (char *)&m_tchars)) {
fprintf(stderr, "%s: ioctl4: %s\n", progname, strerror(errno));
Error( "ioctl4: %s", strerror(errno));
exit(1);
}
if (-1 == ioctl(0, TIOCGLTC, (char *)&m_ltchars)) {
fprintf(stderr, "%s: ioctl5: %s\n", progname, strerror(errno));
Error( "ioctl5: %s", strerror(errno));
exit(1);
}
m_ltchars.t_werasc = '\027';
@ -502,7 +499,7 @@ CONSENT *pCE;
m_ltchars.t_suspc = '\032';
m_ltchars.t_dsuspc = '\031';
if (-1 == ioctl(0, TIOCSLTC, (char *)&m_ltchars)) {
fprintf(stderr, "%s: ioctl6: %s\n", progname, strerror(errno));
Error( "ioctl6: %s", strerror(errno));
exit(1);
}
@ -544,7 +541,7 @@ CONSENT *pCE;
ppcArgv = apcArgv;
}
execve(pcShell, ppcArgv, environ);
fprintf(stderr, "execve: %s\n", strerror(errno));
Error("execve: %s", strerror(errno));
exit(1);
/*NOTREACHED*/
}
@ -608,7 +605,7 @@ const char *hostname;
{
struct hostcache *n;
if ((struct hostcache *)0 == (n = (struct hostcache *)malloc(sizeof(struct hostcache)))) {
fprintf(stderr, "%s: malloc failure: %s\n", progname, strerror(errno));
Error( "malloc failure: %s", strerror(errno));
return;
}
(void)strncpy(n->hostname, hostname, MAXSERVLEN);
@ -659,9 +656,7 @@ int useHostCache;
if (-1 ==
(pCE->fdlog = open(pCE->lfile, O_RDWR|O_CREAT|O_APPEND, 0644)))
{
fprintf(stderr,
"%s: open: %s: %s\n",
progname, pCE->lfile, strerror(errno));
Error( "open: %s: %s", pCE->lfile, strerror(errno));
return;
}
@ -681,8 +676,8 @@ int useHostCache;
struct timeval tv;
if ( CheckHostCache( pCE->networkConsoleHost ) ) {
fprintf(stderr, "%s: cached previous timeout: %s (%d@%s): forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "cached previous timeout: %s (%d@%s): forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost);
ConsDown(pCE, pfdSet);
return;
@ -692,48 +687,54 @@ int useHostCache;
usleep( USLEEP_FOR_SLOW_PORTS ); /* Sleep for slow network ports */
# endif
bzero(&port, sizeof(port));
#if HAVE_MEMSET
(void)memset((void *)&port, 0, sizeof(port));
#else
(void)bzero((char *)&port, sizeof(port));
#endif
if ((hp = gethostbyname(pCE->networkConsoleHost)) == NULL)
{
fprintf(stderr, "%s: gethostbyname %s failed\n",
progname, pCE->networkConsoleHost);
Error( "gethostbyname(%s): %s", pCE->networkConsoleHost, hstrerror(h_errno));
exit(1);
}
bcopy(hp->h_addr, &port.sin_addr, hp->h_length);
#if HAVE_MEMCPY
(void)memcpy(&port.sin_addr, hp->h_addr, hp->h_length);
#else
(void)bcopy(hp->h_addr, &port.sin_addr, hp->h_length);
#endif
port.sin_family = hp->h_addrtype;
port.sin_port = htons(pCE->networkConsolePort);
if ((pCE->fdtty = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
fprintf(stderr, "%s: socket: %s\n", progname, strerror(errno));
Error( "socket: %s", strerror(errno));
exit(1);
}
if (setsockopt(pCE->fdtty, SOL_SOCKET, SO_KEEPALIVE,
(char *) &one, sizeof(one)) < 0)
{
fprintf(stderr, "%s: setsockopt SO_KEEPALIVE: %s\n",
progname, strerror(errno));
Error( "setsockopt SO_KEEPALIVE: %s",
strerror(errno));
}
if ( (flags = fcntl(pCE->fdtty, F_GETFL)) >= 0 )
{
flags |= O_NONBLOCK;
if ( fcntl(pCE->fdtty, F_SETFL, flags) < 0 ) {
fprintf( stderr, "%s: fcntl O_NONBLOCK: %s\n",
progname, strerror(errno));
Error( "fcntl O_NONBLOCK: %s", strerror(errno));
}
} else {
fprintf( stderr, "%s: fcntl: %s\n", progname, strerror(errno));
Error( "fcntl: %s", strerror(errno));
}
if (connect(pCE->fdtty,
(struct sockaddr *)&port, sizeof(port)) < 0)
{
if (errno != EINPROGRESS ) {
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "connect: %s (%d@%s): %s: forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
@ -746,8 +747,8 @@ int useHostCache;
FD_SET(pCE->fdtty, &fds);
if ( (one=select( pCE->fdtty+1, NULL, &fds, NULL, &tv )) < 0 ) {
fprintf(stderr, "%s: select: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "select: %s (%d@%s): %s: forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
@ -755,8 +756,8 @@ int useHostCache;
if (one == 0) { /* Timeout */
AddHostCache(pCE->networkConsoleHost);
fprintf(stderr, "%s: timeout: %s (%d@%s): forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "timeout: %s (%d@%s): forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost);
ConsDown(pCE, pfdSet);
return;
@ -769,16 +770,16 @@ int useHostCache;
if (getsockopt(pCE->fdtty, SOL_SOCKET, SO_ERROR,
(char*)&flags, &one) < 0)
{
fprintf(stderr, "%s: getsockopt SO_ERROR: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "getsockopt SO_ERROR: %s (%d@%s): %s: forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
}
if (flags != 0)
{
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
Error( "connect: %s (%d@%s): %s: forcing down",
pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(flags));
ConsDown(pCE, pfdSet);
return;
@ -793,7 +794,7 @@ int useHostCache;
write(pCE->fdtty, "\r\n", 2);
# 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));
Error( "open: %s: %s", pCE->dfile, strerror(errno));
(void)close(pCE->fdlog);
pCE->fdlog = -1;
return;
@ -815,7 +816,7 @@ int useHostCache;
}
#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));
Error( "open: %s: %s", pCE->dfile, strerror(errno));
(void)close(pCE->fdlog);
pCE->fdlog = -1;
return;

View File

@ -1,5 +1,5 @@
/*
* $Id: fallback.c,v 5.25 2001-02-21 17:26:06-08 bryan Exp $
* $Id: fallback.c,v 5.27 2001-06-15 11:33:49-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -37,12 +37,12 @@
#if DO_VIRTUAL && ! HAVE_PTYD
#if 0
static char *__pty_host;
static char *__pty_fmt;
#endif
static int iLogPri = LOG_DEBUG;
#if ! HAVE_PTSNAME
/*
* Below is the string for finding /dev/ptyXX. For each architecture we
* leave some pty's world writable because we don't have source for
@ -71,6 +71,8 @@ static char charone[] =
static char chartwo[] =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
#endif /* ! HAVE_PTSNAME */
# if (defined(_AIX) || defined(PTX4))
static char acMaster[] =
"/dev/ptc/XXXXXXXXX";
@ -93,7 +95,7 @@ getpseudotty(slave, master)
char **master, **slave;
{
int fd;
char *pcName, *pcTmp;
char *pcName;
if (0 > (fd = open("/dev/ptc", O_RDWR|O_NDELAY, 0))) {
return -1;
@ -122,7 +124,7 @@ getpseudotty(slave, master)
char **master, **slave;
{
int fd;
char *pcName, *pcTmp;
char *pcName;
if (0 > (fd = open("/dev/ptmx", O_RDWR, 0))) {
return -1;
@ -130,9 +132,10 @@ char **master, **slave;
grantpt(fd); /* change permission of slave */
unlockpt(fd); /* unlock slave */
if ((char *)0 == (pcName = ttyname(fd))) {
return -1;
}
(void)strcpy(acMaster, "/dev/ptmx");
} else {
(void)strcpy(acMaster, pcName);
}
*master = acMaster;
if ((char *) 0 == (pcName = ptsname(fd))) {

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.66 2001-02-21 17:26:06-08 bryan Exp $
* $Id: group.c,v 5.72 2001-06-15 11:33:49-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -82,6 +82,7 @@ All rights reserved.\n";
#include <group.h>
#include <version.h>
#include <main.h>
#include <output.h>
#if DO_VIRTUAL
# if HAVE_PTYD
@ -225,7 +226,7 @@ Mark()
if (-1 == pCE->fdlog) {
continue;
}
if ( pCE->nextMark && (tyme >= pCE->nextMark) ) {
if ( (pCE->nextMark > 0) && (tyme >= pCE->nextMark) ) {
(void)write(pCE->fdlog, acOut, strlen(acOut));
pCE->nextMark = tyme + pCE->mark;
}
@ -233,6 +234,49 @@ Mark()
alarm(ALARMTIME);
}
void
writeLog(pCE, s, len)
CONSENT *pCE;
char *s;
int len;
{
time_t tyme;
char styme[26];
char acOut[BUFSIZ];
int i = 0;
int j;
if (-1 == pCE->fdlog) {
return;
}
if ( pCE->mark >= 0 ) { /* no line marking */
(void)write(pCE->fdlog, s, len);
return;
}
acOut[0] = '\000';
for (j=0; j<len; j++) {
if (s[j] == '\n') {
(pCE->nextMark)++;
Debug( "Found newline for %s (nextMark=%d, mark=%d)", pCE->server, pCE->nextMark, pCE->mark );
if (pCE->nextMark == 0) {
(void)write(pCE->fdlog, s+i, j-i+1);
i=j+1;
if ( acOut[0] == '\000' ) {
tyme = time((time_t *)0);
(void)strcpy(styme, ctime(&tyme));
styme[24] = '\000';
sprintf(acOut, "[%s]", styme);
}
(void)write(pCE->fdlog, acOut, strlen(acOut));
pCE->nextMark = pCE->mark;
}
}
}
if ( i <= j ) {
(void)write(pCE->fdlog, s+i, j-i+1);
}
}
void
SendClientsMsg(pGE, message)
GRPENT *pGE;
@ -265,16 +309,6 @@ int sig;
fSawGoAway = 1;
}
static void
GoAway()
{
SendShutdownMsg(pGEHup);
exit(0);
_exit(0);
abort();
}
#if DO_VIRTUAL
/* on a TERM we have to cleanup utmp entries (ask ptyd to do it) (ksb)
*/
@ -314,8 +348,7 @@ static RETSIGTYPE
ReapVirt(sig)
int sig;
{
register int i, pid;
auto long tyme;
register int pid;
auto int UWbuf;
# if HAVE_WAIT3
@ -333,7 +366,20 @@ int sig;
}
}
}
#endif /* DO_VIRUAL */
#else /* DO_VIRTUAL */
static void
GoAway()
{
SendShutdownMsg(pGEHup);
exit(0);
_exit(0);
abort();
}
#endif /* DO_VIRTUAL */
static char acStop[] = { /* buffer for oob stop command */
@ -354,12 +400,12 @@ char *pw_string;
#endif
strcpy(username, pCLServing->acid);
if ( user = strchr(username, '@') )
if ( (user = strchr(username, '@')) )
*user = '\000';
if ((fp = fopen(pcPasswd, "r")) == NULL) {
printf("%s: Cannot open passwd file %s: %s\n",
progname, pcPasswd, strerror(errno));
Info("Cannot open passwd file %s: %s",
pcPasswd, strerror(errno));
if ((struct passwd *)0 == (pwd = getpwuid(0))) {
CSTROUT(pCLServing->fd, "no root passwd?\r\n");
@ -367,8 +413,8 @@ char *pw_string;
}
if (0 != CheckPass(pwd, pw_string, pCLServing->accmd)) {
if (fVerbose) {
printf("%s: User %s logging into server %s via root or console passwd\n",
progname, pCLServing->acid, pCLServing->pCEwant->server);
Info("User %s logging into server %s via root or console passwd",
pCLServing->acid, pCLServing->pCEwant->server);
}
return 1;
}
@ -416,8 +462,8 @@ char *pw_string;
while ( server ) { /* For each server */
if (strcmp(server, "any") == 0) {
if (fVerbose) {
printf("%s: User %s logging into server %s\n",
progname, pCLServing->acid, pCLServing->pCEwant->server);
Info("User %s logging into server %s",
pCLServing->acid, pCLServing->pCEwant->server);
}
fclose(fp);
return 1;
@ -429,8 +475,8 @@ char *pw_string;
while ( strlen(p) >= max ) {
if (strcmp(server, p) == 0) {
if (fVerbose) {
printf("%s: User %s logging into server %s\n",
progname, pCLServing->acid, pCLServing->pCEwant->server);
Info("User %s logging into server %s",
pCLServing->acid, pCLServing->pCEwant->server);
}
fclose(fp);
return 1;
@ -468,11 +514,11 @@ register long tyme;
minutes = minutes % 60;
if ( hours < 24 )
sprintf( timestr, "%2d:%02d", hours, minutes );
sprintf( timestr, "%2ld:%02ld", hours, minutes );
else if ( hours < 48 )
sprintf( timestr, "%d day", hours / 24 );
sprintf( timestr, "%ld day", hours / 24 );
else
sprintf( timestr, "%ddays", hours / 24 );
sprintf( timestr, "%lddays", hours / 24 );
return timestr;
}
@ -520,8 +566,6 @@ int sfd;
register int iConsole;
register int i, nr;
register struct hostent *hpPeer;
register struct passwd *pwd;
register char *pcPass;
register long tyme;
time_t tymee;
char stymee[26];
@ -531,7 +575,7 @@ int sfd;
auto fd_set rmask, rinit;
auto char acOut[BUFSIZ], acIn[BUFSIZ], acNote[132*2];
auto CONSCLIENT dude[MAXMEMB]; /* alloc one set per console */
#if HAVE_RLIMIT
#if HAVE_GETRLIMIT
struct rlimit rl;
#endif
#if HAVE_TERMIOS_H
@ -598,7 +642,7 @@ int sfd;
* we used to do in the loop, but we have to mod rinit whenever
* we add a connection or drop one... (ksb)
*/
#if HAVE_RLIMIT
#if HAVE_GETRLIMIT
getrlimit(RLIMIT_NOFILE, &rl);
maxfd = rl.rlim_cur;
#else
@ -665,7 +709,7 @@ int sfd;
if (-1 == select(maxfd, &rmask, (fd_set *)0, (fd_set *)0, (struct timeval *)0)) {
if ( errno != EINTR ) {
fprintf(stderr, "%s: select: %s\n", progname, strerror(errno));
Error( "select: %s", strerror(errno));
}
continue;
}
@ -680,7 +724,7 @@ int sfd;
/* read terminal line */
if ((nr = read(pCEServing->fdtty, acIn, sizeof(acIn))) <= 0) {
/* carrier lost */
fprintf(stderr, "%s: lost carrier on %s (%s)!\n", progname, pCEServing->server, pCEServing->dfile);
Error( "lost carrier on %s (%s)!", pCEServing->server, pCEServing->dfile);
#if DO_VIRTUAL
if (pCEServing->fvirtual) {
FD_CLR(pCEServing->fdtty, &rinit);
@ -705,7 +749,7 @@ int sfd;
/* log it and write to all connections on this server
*/
if ( !pCEServing->nolog ) {
(void)write(pCEServing->fdlog, acIn, nr);
(void)writeLog(pCEServing, acIn, nr);
}
/* output all console info nobody is attached
@ -745,7 +789,7 @@ int sfd;
pCEServing = pCLServing->pCEto;
#if DEBUG
if ((pCLServing->fwr != 0) != (pCEServing->pCLwr == pCLServing)) {
fprintf(stderr, "%s: internal check failed %s on %s\n", progname, pCLServing->acid, pCEServing->server);
Error( "internal check failed %s on %s", pCLServing->acid, pCEServing->server);
}
#endif
/* read connection */
@ -761,7 +805,7 @@ drop:
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);
Info("%s: logout %s [%s]", pCEServing->server, pCLServing->acid, stymee);
}
if (fNoinit && (CONSCLIENT *)0 ==
pCLServing->pCEto->pCLon->pCLnext)
@ -853,7 +897,7 @@ drop:
CSTROUT(pCLServing->fd, "Name too long.\r\n");
goto drop;
}
if (!isspace(acIn[i])) {
if (!isspace((int)(acIn[i]))) {
pCLServing->acid[pCLServing->icursor++] = acIn[i];
continue;
}
@ -874,7 +918,7 @@ drop:
CSTROUT(pCLServing->fd, "Host too long.\r\n");
goto drop;
}
if (!isspace(acIn[i])) {
if (!isspace((int)(acIn[i]))) {
pCLServing->accmd[pCLServing->icursor++] = acIn[i];
continue;
}
@ -931,20 +975,9 @@ drop:
}
pCLServing->icursor = 0;
/* in the CONFIGFILE file gave this group a
* password use it before root's
* password (for malowany)
*/
/*
if ((struct passwd *)0 == (pwd = getpwuid(0))) {
CSTROUT(pCLServing->fd, "no root passwd?\r\n");
goto drop;
}
if (0 == CheckPass(pwd, pGE->passwd, pCLServing->accmd)) {
}*/
if (0 == CheckPasswd( pCLServing, pGE->passwd)) {
CSTROUT(pCLServing->fd, "Sorry.\r\n");
printf("%s: %s: %s: bad passwd\n", progname, pCLServing->pCEwant->server, pCLServing->acid);
Info("%s: %s: bad passwd", pCLServing->pCEwant->server, pCLServing->acid);
goto drop;
}
shift_console:
@ -967,9 +1000,9 @@ drop:
(void)strcpy(stymee, ctime(&tymee));
stymee[24] = '\000';
if (&CECtl == pCEServing) {
printf("%s: %s: login %s [%s]\n", progname, pCLServing->pCEwant->server, pCLServing->acid, stymee);
Info("%s: login %s [%s]", pCLServing->pCEwant->server, pCLServing->acid, stymee);
} else {
printf("%s: %s moves from %s to %s [%s]\n", progname, pCLServing->acid, pCEServing->server, pCLServing->pCEwant->server, stymee);
Info("%s moves from %s to %s [%s]", pCLServing->acid, pCEServing->server, pCLServing->pCEwant->server, stymee);
}
/* } */
@ -1008,7 +1041,7 @@ drop:
case S_QUOTE: /* send octal code */
/* must type in 3 octal digits */
if (isdigit(acIn[i])) {
if (isdigit((int)(acIn[i]))) {
pCLServing->accmd[0] *= 8;
pCLServing->accmd[0] += acIn[i] - '0';
if (++(pCLServing->icursor) < 3) {
@ -1207,9 +1240,9 @@ drop:
}
} else if (pCL == pCLServing) {
if ( pCEServing->nolog ) {
sprintf(acOut, "ok (nologging)]\r\n", pCL->acid);
sprintf(acOut, "ok (nologging)]\r\n");
} else {
sprintf(acOut, "ok]\r\n", pCL->acid);
sprintf(acOut, "ok]\r\n");
}
} else {
pCLServing->fwantwr = 1;
@ -1433,7 +1466,7 @@ drop:
pCLServing->fwr = 1;
sprintf(acOut, "up -- attached]\r\n");
} else if (pCL == pCLServing) {
sprintf(acOut, "up]\r\n", pCL->acid);
sprintf(acOut, "up]\r\n");
} else {
sprintf(acOut, "up, %s is attached]\r\n", pCL->acid);
}
@ -1627,7 +1660,7 @@ unknown:
so = sizeof(struct sockaddr_in);
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));
Error( "accept: %s", strerror(errno));
continue;
}
@ -1659,7 +1692,7 @@ unknown:
/* init the identification stuff
*/
sprintf(pCL->acid, "client@%.*s", sizeof(pCL->acid)-10, hpPeer->h_name);
sprintf(pCL->acid, "client@%.*s", (int)(sizeof(pCL->acid)-10), hpPeer->h_name);
pCL->typetym = pCL->tym = time((time_t *)0);
(void)strcpy(pCL->actym, ctime(&(pCL->tym)));
pCL->actym[24] = '\000';
@ -1744,23 +1777,23 @@ GRPENT *pGE;
* (prepared by master so he can see the port number of the kid)
*/
if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
fprintf(stderr, "%s: socket: %s\n", progname, strerror(errno));
Error( "socket: %s", strerror(errno));
exit(9);
}
#if HAVE_SETSOCKOPT
if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true, sizeof(true))<0) {
fprintf(stderr, "%s: setsockopt: %s\n", progname, strerror(errno));
Error( "setsockopt: %s", strerror(errno));
exit(9);
}
#endif
if (bind(sfd, (struct sockaddr *)&lstn_port, sizeof(lstn_port))<0) {
fprintf(stderr, "%s: bind: %s\n", progname, strerror(errno));
Error( "bind: %s", strerror(errno));
exit(9);
}
so = sizeof(lstn_port);
if (-1 == getsockname(sfd, (struct sockaddr *)&lstn_port, (socklen_t *)&so)) {
fprintf(stderr, "%s: getsockname: %s\n", progname, strerror(errno));
Error( "getsockname: %s", strerror(errno));
exit(9);
}
pGE->port = lstn_port.sin_port;
@ -1769,7 +1802,7 @@ GRPENT *pGE;
(void)fflush(stdout);
switch (pid = fork()) {
case -1:
fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
Error( "fork: %s", strerror(errno));
exit(1);
default:
(void)close(sfd);
@ -1777,10 +1810,11 @@ GRPENT *pGE;
return;
case 0:
sleep(1); /* pause to let master get ready */
thepid = getpid();
break;
}
if (listen(sfd, SOMAXCONN) < 0) {
fprintf(stderr, "%s: listen: %s\n", progname, strerror(errno));
Error( "listen: %s", strerror(errno));
exit(9);
}
Kiddie(pGE, sfd);
@ -1788,7 +1822,7 @@ GRPENT *pGE;
/* should never get here...
*/
(void)close(sfd);
fprintf(stderr, "%s: internal flow error\n", progname);
Error( "internal flow error" );
exit(1);
/*NOTREACHED*/
}

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.42 2001-05-03 06:39:43-07 bryan Exp $
* $Id: main.c,v 5.47 2001-06-15 09:04:08-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -52,14 +52,16 @@
#include <access.h>
#include <readcfg.h>
#include <version.h>
#include <output.h>
char rcsid[] =
"$Id: main.c,v 5.42 2001-05-03 06:39:43-07 bryan Exp $";
"$Id: main.c,v 5.47 2001-06-15 09:04:08-07 bryan Exp $";
char *progname =
rcsid;
int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fDebug = 0, fVersion = 0;
int fDaemon = 0;
char chDefAcc = 'r';
int thepid = 0;
#define FULLCFPATH SYSCONFDIR "/" CONFIGFILE;
#define FULLPDPATH SYSCONFDIR "/" PASSWDFILE;
@ -81,8 +83,11 @@ char acMyHost[256]; /* staff.cc.purdue.edu */
static void
daemonize()
{
int res, td;
int res;
FILE *fp;
#if !HAVE_SETSID
int td;
#endif
(void) signal(SIGQUIT, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
@ -95,9 +100,10 @@ daemonize()
switch (res = fork()) {
case -1:
(void) fprintf(stderr, "%s: fork: %m\n", progname, strerror(errno));
Error( "fork: %s", strerror(errno));
exit(1);
case 0:
thepid = getpid();
break;
default:
sleep(1);
@ -108,7 +114,7 @@ daemonize()
*/
close(0);
if (0 != open("/dev/null", 2, 0644)) {
fprintf(stderr, "%s: open: /dev/null: %s\n", progname, strerror(errno));
Error( "open: /dev/null: %s", strerror(errno));
exit(1);
}
@ -134,7 +140,7 @@ daemonize()
fprintf(fp, "%d\n", (int) getpid());
fclose(fp);
} else {
fprintf(stderr,"%s: can't write pid to %s\n", progname, PIDFILE);
Error("can't write pid to %s", PIDFILE);
}
}
@ -170,37 +176,41 @@ static void
Version()
{
auto char acA1[16], acA2[16];
#if defined(SERVICENAME)
char acOut[BUFSIZ];
#endif
printf("%s: %s\n", progname, THIS_VERSION);
printf("%s: default access type `%c\'\n", progname, chDefAcc);
printf("%s: default escape sequence `%s%s\'\n", progname, FmtCtl(DEFATTN, acA1), FmtCtl(DEFESC, acA2));
printf("%s: configuration in `%s\'\n", progname, pcConfig);
printf("%s: password in `%s\'\n", progname, pcPasswd);
printf("%s: pidfile in `%s\'\n", progname, PIDFILE);
printf("%s: limited to %d group%s with %d member%s\n", progname, MAXGRP, MAXGRP == 1 ? "" : "s", MAXMEMB, MAXMEMB == 1 ? "" : "s");
Info("%s", THIS_VERSION);
Info("default access type `%c\'", chDefAcc);
Info("default escape sequence `%s%s\'", FmtCtl(DEFATTN, acA1), FmtCtl(DEFESC, acA2));
Info("configuration in `%s\'", pcConfig);
Info("password in `%s\'", pcPasswd);
Info("pidfile in `%s\'", PIDFILE);
Info("limited to %d group%s with %d member%s", MAXGRP, MAXGRP == 1 ? "" : "s", MAXMEMB, MAXMEMB == 1 ? "" : "s");
#if CPARITY
printf("%s: high-bit of data stripped (7-bit clean)\n", progname);
Info("high-bit of data stripped (7-bit clean)");
#else
printf("%s: high-bit of data *not* stripped (8-bit clean)\n", progname);
Info("high-bit of data *not* stripped (8-bit clean)");
#endif
#if defined(SERVICENAME)
{
struct servent *pSE;
if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) {
fprintf(stderr, "%s: getservbyname: %s: %s\n", progname, acService, strerror(errno));
Error( "getservbyname: %s: %s", acService, strerror(errno));
return;
}
printf("%s: service name `%s\'", progname, pSE->s_name);
sprintf(acOut, "service name `%s\'", pSE->s_name);
if (0 != strcmp(pSE->s_name, acService)) {
printf(" (which we call `%s\')", acService);
sprintf(acOut, " (which we call `%s\')", acService);
}
printf(" on port %d\n", ntohs((u_short)pSE->s_port));
sprintf(acOut, " on port %d", ntohs((u_short)pSE->s_port));
Info( "%s", acOut );
}
#else
#if defined(PORTNUMBER)
printf("%s: on port %d\n", progname, PORTNUMBER);
Info("on port %d", PORTNUMBER);
#else
printf("%s: no service or port compiled in\n", progname);
Info("no service or port compiled in");
exit(1);
#endif
#endif
@ -229,6 +239,7 @@ char **argv;
auto REMOTE
*pRCUniq; /* list of uniq console servers */
thepid = getpid();
if ((char *)0 == (progname = strrchr(argv[0], '/'))) {
progname = argv[0];
} else {
@ -245,11 +256,11 @@ char **argv;
(void)gethostname(acMyHost, sizeof(acMyHost));
if ((struct hostent *)0 == (hpMe = gethostbyname(acMyHost))) {
fprintf(stderr, "%s: gethostbyname: %s\n", progname, hstrerror(h_errno));
Error( "gethostbyname(%s): %s", acMyHost, hstrerror(h_errno));
exit(1);
}
if (4 != hpMe->h_length || AF_INET != hpMe->h_addrtype) {
fprintf(stderr, "%s: wrong address size (4 != %d) or adress family (%d != %d)\n", progname, hpMe->h_length, AF_INET, hpMe->h_addrtype);
Error( "wrong address size (4 != %d) or adress family (%d != %d)", hpMe->h_length, AF_INET, hpMe->h_addrtype);
exit(1);
}
#if HAVE_MEMCPY
@ -262,7 +273,7 @@ char **argv;
switch (i) {
case 'a':
chDefAcc = '\000' == *optarg ? 'r' : *optarg;
if (isupper(chDefAcc)) {
if (isupper((int)(chDefAcc))) {
chDefAcc = tolower(chDefAcc);
}
switch (chDefAcc) {
@ -271,7 +282,7 @@ char **argv;
case 't':
break;
default:
fprintf(stderr, "%s: unknown access type `%s\'\n", progname, optarg);
Error( "unknown access type `%s\'", optarg);
exit(3);
}
break;
@ -288,7 +299,7 @@ char **argv;
fDebug = 1;
break;
case 'h':
fprintf(stderr, "%s: usage%s\n", progname, u_terse);
Error( "usage%s", u_terse);
Usage(stdout, apcLong);
exit(0);
case 'i':
@ -307,10 +318,10 @@ char **argv;
fVerbose = 1;
break;
case '\?':
fprintf(stderr, "%s: usage%s\n", progname, u_terse);
Error( "usage%s", u_terse);
exit(1);
default:
fprintf(stderr, "%s: option %c needs a parameter\n", progname, optopt);
Error( "option %c needs a parameter", optopt);
exit(1);
}
}
@ -323,7 +334,7 @@ char **argv;
#if HAVE_GETSPNAM
/* Why force root??? Cause of getsp*() calls... */
if (0 != geteuid()) {
fprintf(stderr, "%s: must be the superuser\n", progname);
Error( "must be the superuser" );
exit(1);
}
#endif
@ -331,7 +342,7 @@ char **argv;
/* read the config file
*/
if ((FILE *)0 == (fpConfig = fopen(pcConfig, "r"))) {
fprintf(stderr, "%s: fopen: %s: %s\n", progname, pcConfig, strerror(errno));
Error( "fopen: %s: %s", pcConfig, strerror(errno));
exit(1);
}
ReadCfg(pcConfig, fpConfig);
@ -342,7 +353,7 @@ char **argv;
* different configurations can run on the same host).
*/
if (-1 == flock(fileno(fpConfig), LOCK_NB|LOCK_EX)) {
fprintf(stderr, "%s: %s is locked, won\'t run more than one conserver?\n", progname, pcConfig);
Error( "%s is locked, won\'t run more than one conserver?", pcConfig);
exit(3);
}
#endif
@ -374,7 +385,7 @@ char **argv;
Spawn(& aGroups[i]);
}
if (fVerbose) {
printf("%s: group %d on port %d\n", progname, i, ntohs((u_short)aGroups[i].port));
Info("group %d on port %d", i, ntohs((u_short)aGroups[i].port));
}
for (j = 0; j < aGroups[i].imembers; ++j) {
if (-1 != aGroups[i].pCElist[j].fdtty)
@ -384,7 +395,7 @@ char **argv;
if (fVerbose) {
for (i = 0; i < iAccess; ++i) {
printf("%s: access type '%c' for \"%s\"\n", progname, pACList[i].ctrust, pACList[i].pcwho);
Info("access type '%c' for \"%s\"", pACList[i].ctrust, pACList[i].pcwho);
}
}
@ -394,7 +405,7 @@ char **argv;
if (fVerbose) {
register REMOTE *pRC;
for (pRC = pRCUniq; (REMOTE *)0 != pRC; pRC = pRC->pRCuniq) {
printf("%s: peer server on `%s'\n", progname, pRC->rhost);
Info("peer server on `%s'", pRC->rhost);
}
}
@ -414,7 +425,7 @@ char **argv;
if (0 == aGroups[i].imembers)
continue;
if (-1 == kill(aGroups[i].pid, SIGTERM)) {
fprintf(stderr, "%s: kill: %s\n", progname, strerror(errno));
Error( "kill: %s", strerror(errno));
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: main.h,v 5.17 2001-02-21 17:26:06-08 bryan Exp $
* $Id: main.h,v 5.18 2001-06-12 19:18:58-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -46,6 +46,7 @@ extern struct sockaddr_in in_port;
extern char acMyHost[];
extern char acMyAddr[];
extern int domainHack;
extern int thepid;
#if defined(SERVICENAME)
extern char acService[];

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.30 2001-02-21 17:26:06-08 bryan Exp $
* $Id: master.c,v 5.36 2001-06-15 09:12:01-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -52,6 +52,7 @@
#include <readcfg.h>
#include <version.h>
#include <main.h>
#include <output.h>
@ -77,6 +78,7 @@ FixKids()
register int i, pid;
auto time_t tyme;
auto int UWbuf;
char styme[26];
#if HAVE_WAIT3
while (-1 != (pid = wait3(& UWbuf, WNOHANG, (struct rusage *)0))) {
@ -102,7 +104,9 @@ FixKids()
*/
Spawn(& aGroups[i]);
tyme = time((time_t *)0);
printf("%s: %s: exit(%d), restarted %s", progname, aGroups[i].pCElist[0].server, WEXITSTATUS(UWbuf), ctime(&tyme));
(void)strcpy(styme, ctime(&tyme));
styme[24] = '\000';
Info("%s: exit(%d), restarted %s", aGroups[i].pCElist[0].server, WEXITSTATUS(UWbuf), styme);
}
}
}
@ -148,7 +152,7 @@ SignalKids(arg)
if (0 == aGroups[i].imembers)
continue;
if (-1 == kill(aGroups[i].pid, arg)) {
fprintf(stderr, "%s: kill: %s\n", progname, strerror(errno));
Error("%s: kill: %s", strerror(errno));
}
}
}
@ -164,7 +168,7 @@ REMOTE
register char *pcArgs;
register int i, j, cfd;
register REMOTE *pRC, *pRCFound;
register int nr, prnum, found, msfd;
register int nr, prnum = 0, found, msfd;
register struct hostent *hpPeer;
auto char cType;
auto int so;
@ -195,7 +199,7 @@ REMOTE
{
struct servent *pSE;
if ((struct servent *)0 == (pSE = getservbyname(acService, "tcp"))) {
fprintf(stderr, "%s: getservbyname: %s: %s\n", progname, acService, strerror(errno));
Error("%s: getservbyname: %s: %s", acService, strerror(errno));
return;
}
master_port.sin_port = pSE->s_port;
@ -204,26 +208,26 @@ REMOTE
# if defined(PORTNUMBER)
master_port.sin_port = htons((u_short)PORTNUMBER);
# else
fprintf(stderr, "%s: no port or service compiled in?\n", progname);
Error("%s: no port or service compiled in?");
# endif
#endif
if ((msfd=socket(AF_INET, SOCK_STREAM, 0)) < 0) {
fprintf(stderr, "%s: socket: %s\n", progname, strerror(errno));
Error("%s: socket: %s", strerror(errno));
return;
}
#if HAVE_SETSOCKOPT
if (setsockopt(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true, sizeof(true))<0) {
fprintf(stderr, "%s: setsockopt: %s\n", progname, strerror(errno));
Error("%s: setsockopt: %s", strerror(errno));
return;
}
#endif
if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port))<0) {
fprintf(stderr, "%s: bind: %s\n", progname, strerror(errno));
Error("%s: bind: %s", strerror(errno));
return;
}
if (listen(msfd, SOMAXCONN) < 0) {
fprintf(stderr, "%s: listen: %s\n", progname, strerror(errno));
Error("%s: listen: %s", strerror(errno));
}
FD_ZERO(&rmaster);
@ -246,7 +250,7 @@ REMOTE
if (-1 == select(msfd+1, &rmask, (fd_set *)0, (fd_set *)0, (struct timeval *)0)) {
if ( errno != EINTR ) {
fprintf(stderr, "%s: select: %s\n", progname, strerror(errno));
Error("%s: select: %s", strerror(errno));
}
continue;
}
@ -256,7 +260,7 @@ REMOTE
so = sizeof(response_port);
cfd = accept(msfd, (struct sockaddr *)&response_port, (socklen_t *)&so);
if (cfd < 0) {
fprintf(stderr, "%s: accept: %s\n", progname, strerror(errno));
Error("%s: accept: %s", strerror(errno));
continue;
}
@ -291,6 +295,7 @@ REMOTE
(void)close(cfd);
continue;
case 0:
thepid = getpid();
break;
}
#endif
@ -317,7 +322,7 @@ REMOTE
acIn[--i] = '\000';
}
if (0 == i) {
fprintf(stderr, "%s: lost connection\n", progname);
Error("%s: lost connection");
(void)close(cfd);
#if TEST_FORK
exit(1);
@ -385,12 +390,13 @@ REMOTE
}
if (0 == strcmp(acIn, "pid")) {
#if TEST_FORK
sprintf(acOut, "%d\r\n", getppid());
sprintf(acOut, "%d\r\n", (int)getppid());
(void)write(cfd, acOut, strlen(acOut));
exit(0);
#else
sprintf(acOut, "%d\r\n", getpid());
sprintf(acOut, "%d\r\n", (int)getpid());
(void)write(cfd, acOut, strlen(acOut));
(void)close(cfd);
continue;
#endif
}
@ -436,6 +442,7 @@ REMOTE
if (0 == strcmp(acIn, "version")) {
sprintf(acOut, "version `%s\'\r\n", THIS_VERSION);
(void)write(cfd, acOut, strlen(acOut));
(void)close(cfd);
#if TEST_FORK
exit(0);
#else
@ -452,6 +459,16 @@ REMOTE
#endif
}
if ((char *)0 == pcArgs) {
CSTROUT(cfd, "call requires argument\r\n");
(void)close(cfd);
#if TEST_FORK
exit(0);
#else
continue;
#endif
}
/* look up the machine to call
*/
found = 0;
@ -468,6 +485,17 @@ REMOTE
++found;
}
}
/* Purposefully hunt for another match - this will detect
* duplicates - a bad state to be in.
* Does the readcfg.c code even check for dups?
*/
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
if (0 != strcmp(pcArgs, pRC->rserver)) {
continue;
}
++found;
pRCFound = pRC;
}
if ( found == 0 ) { /* Then look for substring matches */
for (i = 0; i < MAXGRP; ++i) {
if (0 == aGroups[i].imembers)
@ -480,8 +508,8 @@ REMOTE
++found;
}
}
}
/* look for a remote server */
/* again, looks for dups with local consoles */
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) {
if (0 != strncmp(pcArgs, pRC->rserver, strlen(pcArgs))) {
continue;
@ -489,13 +517,14 @@ REMOTE
++found;
pRCFound = pRC;
}
}
switch (found) {
case 0:
sprintf(acOut, "server %s not found\r\n", pcArgs);
break;
case 1:
if ((REMOTE *)0 != pRCFound) {
sprintf(acOut, "@%s\r\n", pRCFound->rhost, pcArgs);
sprintf(acOut, "@%s\r\n", pRCFound->rhost);
} else {
sprintf(acOut, "%d\r\n", prnum);
}

49
conserver/output.c Normal file
View File

@ -0,0 +1,49 @@
/*
* $Id: output.c,v 1.5 2001-06-15 07:16:51-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
#include <stdio.h>
#include <varargs.h>
#include <main.h>
#include <output.h>
void Debug(fmt, va_alist)
char *fmt;
va_dcl
{
va_list ap;
va_start(ap);
if (!fDebug) return;
fprintf(stderr, "%s (%d): DEBUG: ", progname, thepid );
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n" );
va_end(ap);
}
void Error(fmt, va_alist)
char *fmt;
va_dcl
{
va_list ap;
va_start(ap);
fprintf(stderr, "%s (%d): ", progname, thepid );
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n" );
va_end(ap);
}
void Info(fmt, va_alist)
char *fmt;
va_dcl
{
va_list ap;
va_start(ap);
fprintf(stdout, "%s (%d): ", progname, thepid );
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n" );
va_end(ap);
}

11
conserver/output.h Normal file
View File

@ -0,0 +1,11 @@
/*
* $Id: output.h,v 1.1 2001-06-14 09:28:05-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
extern void Debug();
extern void Error();
extern void Info();

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.31 2001-02-21 17:26:06-08 bryan Exp $
* $Id: readcfg.c,v 5.35 2001-06-15 09:04:41-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -55,6 +55,7 @@
#include <readcfg.h>
#include <master.h>
#include <main.h>
#include <output.h>
GRPENT
@ -103,7 +104,7 @@ register FILE *fp;
++iLine;
for (pcRem = acIn+strlen(acIn)-1; pcRem >= acIn; --pcRem) {
if (!isspace(*pcRem))
if (!isspace((int)(*pcRem)))
break;
*pcRem = '\000';
if (pcRem == acIn)
@ -124,14 +125,14 @@ register FILE *fp;
domainHack = 1;
} else {
*pcLine = '=';
fprintf(stderr, "%s: %s(%d) bad variable line `%s'\n", progname, pcFile, iLine, acIn);
Error( "%s(%d) bad variable line `%s'", pcFile, iLine, acIn);
}
continue;
}
if ( (char *)0 == (pcLine = strchr(acIn, ':')) ||
(char *)0 == (pcMode = strchr(pcLine+1, ':')) ||
(char *)0 == (pcLog = strchr(pcMode+1, ':'))) {
fprintf(stderr, "%s: %s(%d) bad config line `%s'\n", progname, pcFile, iLine, acIn);
Error( "%s(%d) bad config line `%s'", pcFile, iLine, acIn);
continue;
}
*pcLine++ = '\000';
@ -156,12 +157,12 @@ register FILE *fp;
if ((struct hostent *)0 ==
(hpMe = gethostbyname(pcRem))) {
fprintf(stderr, "%s: gethostbyname: %s\n", progname, hstrerror(h_errno));
Error( "gethostbyname(%s): %s", pcRem, hstrerror(h_errno));
exit(1);
}
if (4 != hpMe->h_length ||
AF_INET != hpMe->h_addrtype) {
fprintf(stderr, "%s: wrong address size (4 != %d) or address family (%d != %d)\n", progname, hpMe->h_length, AF_INET, hpMe->h_addrtype);
Error( "wrong address size (4 != %d) or address family (%d != %d)", hpMe->h_length, AF_INET, hpMe->h_addrtype);
exit(1);
}
@ -184,7 +185,7 @@ register FILE *fp;
*ppRC = pRCTemp;
ppRC = & pRCTemp->pRCnext;
if (fVerbose) {
printf("%s: %s remote on %s\n", progname, acIn, pcRem);
Info("%s remote on %s", acIn, pcRem);
}
continue;
}
@ -196,7 +197,7 @@ register FILE *fp;
++iG;
}
if (iG < minG || iG >= MAXGRP) {
fprintf(stderr, "%s: %s(%d) group number out of bounds %d <= %d < %d\n", progname, pcFile, iLine, minG, iG, MAXGRP);
Error( "%s(%d) group number out of bounds %d <= %d < %d", pcFile, iLine, minG, iG, MAXGRP);
exit(1);
}
minG = iG;
@ -205,13 +206,13 @@ register FILE *fp;
pGE->pCElist = pCE;
}
if (pGE->imembers > MAXMEMB) {
fprintf(stderr, "%s: %s(%d) group %d has more than %d members -- but we'll give it a spin\n", progname, pcFile, iLine, iG, MAXMEMB);
Error( "%s(%d) group %d has more than %d members -- but we'll give it a spin", pcFile, iLine, iG, MAXMEMB);
}
/* fill in the console entry
*/
if (sizeof(aConsoles)/sizeof(CONSENT) == iLocal) {
fprintf(stderr, "%s: %s(%d) %d is too many consoles for hard coded tables, adjust MAXGRP or MAXMEMB\n", progname, pcFile, iLine, iLocal);
Error( "%s(%d) %d is too many consoles for hard coded tables, adjust MAXGRP or MAXMEMB", pcFile, iLine, iLocal);
exit(1);
}
(void)strcpy(pCE->server, acIn);
@ -239,28 +240,34 @@ register FILE *fp;
}
if ( pcMark ) {
int factor;
int factor = 0;
char *p;
p = pcMark + strlen(pcMark) - 1;
if ( *p == 'm' ) {
if ( *p == 'm' || *p == 'M' ) {
factor = 60;
} else if ( *p == 'h' ) {
} else if ( *p == 'h' || *p == 'H' ) {
factor = 60 * 60;
} else if ( *p == 'd' ) {
} else if ( *p == 'd' || *p == 'D') {
factor = 60 * 60 * 24;
} else if ( *p == 'l' || *p == 'L') {
factor = -1;
} else {
fprintf(stderr, "%s: %s(%d) bad mark specification `%s'\n", progname, pcFile, iLine, pcMark);
Error( "%s(%d) bad mark specification `%s'", pcFile, iLine, pcMark);
pcMark = 0;
factor = 0;
}
if ( factor ) {
*p = '\000';
pCE->mark = atoi(pcMark) * factor;
pCE->nextMark = tyme + pCE->mark;
pCE->mark = atoi(pcMark);
if ( pCE->mark < 0 ) {
fprintf(stderr, "%s: %s(%d) negative mark specification `%s'\n", progname, pcFile, iLine, pcMark);
Error( "%s(%d) negative mark specification `%s'", pcFile, iLine, pcMark);
pcMark = 0;
}
pCE->mark = pCE->mark * factor;
if ( factor > 0 ) {
pCE->nextMark = tyme + pCE->mark;
} else {
pCE->nextMark = pCE->mark;
}
}
}
if ( !pcMark ) {
@ -275,8 +282,8 @@ register FILE *fp;
pCE->networkConsolePort = atoi(pcMode);
if (fVerbose) {
printf("%s: %d: %s is network on %s/%d logged to %s\n",
progname, iG, acIn, pCE->networkConsoleHost,
Info("%d: %s is network on %s/%d logged to %s",
iG, acIn, pCE->networkConsoleHost,
pCE->networkConsolePort, pCE->lfile);
}
pCE->fvirtual = 0;
@ -300,7 +307,7 @@ register FILE *fp;
pCE->ipid = -1;
#else
if ('|' == pcLine[0]) {
fprintf(stderr, "%s: %s(%d) this server doesn't provide any virtual console support\n", progname, pcFile, iLine);
Error( "%s(%d) this server doesn't provide any virtual console support", pcFile, iLine);
exit(9);
}
(void)strcpy(pCE->dfile, pcLine);
@ -316,10 +323,10 @@ register FILE *fp;
if (fVerbose) {
#if DO_VIRTUAL
if (pCE->fvirtual)
printf("%s: %d: %s with command `%s' logged to %s\n", progname, iG, acIn, pCE->pccmd, pCE->lfile);
Info("%d: %s with command `%s' logged to %s", iG, acIn, pCE->pccmd, pCE->lfile);
else
#endif
printf("%s: %d: %s is on %s (%s%c) logged to %s\n", progname, iG, acIn, pCE->dfile, pCE->pbaud->acrate, pCE->pparity->ckey, pCE->lfile);
Info("%d: %s is on %s (%s%c) logged to %s", iG, acIn, pCE->dfile, pCE->pbaud->acrate, pCE->pparity->ckey, pCE->lfile);
}
}
++pCE, ++iLocal;
@ -337,7 +344,7 @@ register FILE *fp;
++iLine;
for (pcRem = acIn+strlen(acIn)-1; pcRem >= acIn; --pcRem) {
if (!isspace(*pcRem))
if (!isspace((int)(*pcRem)))
break;
*pcRem = '\000';
if (pcRem == acIn)
@ -350,12 +357,12 @@ register FILE *fp;
break;
}
if ((char *)0 == (pcNext = strchr(acIn, ':'))) {
fprintf(stderr, "%s: %s(%d) missing colon?\n", progname, pcFile, iLine);
Error( "%s(%d) missing colon?", pcFile, iLine);
exit(3);
}
do {
*pcNext++ = '\000';
} while (isspace(*pcNext));
} while (isspace((int)(*pcNext)));
switch (acIn[0]) {
case 'a': /* allowed, allow, allows */
case 'A':
@ -370,14 +377,14 @@ register FILE *fp;
cType = 't';
break;
default:
fprintf(stderr, "%s: %s(%d) unknown access key `%s\'\n", progname, pcFile, iLine, acIn);
Error( "%s(%d) unknown access key `%s\'", pcFile, iLine, acIn);
exit(3);
}
while ('\000' != *(pcMach = pcNext)) {
while ('\000' != *pcNext && !isspace(*pcNext)) {
while ('\000' != *pcNext && !isspace((int)(*pcNext))) {
++pcNext;
}
while ('\000' != *pcNext && isspace(*pcNext)) {
while ('\000' != *pcNext && isspace((int)(*pcNext))) {
*pcNext++ = '\000';
}
if (iAccess < iG) {

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.22 2001-05-03 06:32:16-07 bryan Exp $
* $Id: version.h,v 1.23 2001-06-15 09:34:40-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -8,4 +8,4 @@
* Copyright GNAC, Inc., 1998
*/
#define THIS_VERSION "conserver.com version 7.0.1"
#define THIS_VERSION "conserver.com version 7.0.2"

View File

@ -37,7 +37,7 @@ all: $(ALL)
console: $(CONSOLE_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
%.o: $(srcdir)/%.c $(CONSOLE_HDRS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
@ -46,7 +46,7 @@ clean:
distclean: clean
rm -f Makefile
install:
install: console
$(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) console $(DESTDIR)$(bindir)
$(MKDIR) $(DESTDIR)$(mandir)/man1

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.37 2001-05-03 06:04:11-07 bryan Exp $
* $Id: console.c,v 5.39 2001-06-15 08:53:48-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -47,7 +47,7 @@
static char rcsid[] =
"$Id: console.c,v 5.37 2001-05-03 06:04:11-07 bryan Exp $";
"$Id: console.c,v 5.39 2001-06-15 08:53:48-07 bryan Exp $";
static char *progname =
rcsid;
int fVerbose = 0, fReplay = 0, fRaw = 0;
@ -70,6 +70,7 @@ OutOfMem()
/*
* remove from "host1" those domains common to "host1" and "host2"
*/
/*
static char *
whittle(host1, host2)
char *host1, *host2;
@ -88,6 +89,7 @@ char *host1, *host2;
}
return host1;
}
*/
static char
acMesg[8192+2], /* the buffer for startup negotiation */
@ -260,6 +262,7 @@ short sPort;
#else
(void)bzero((char *)pPort, sizeof(*pPort));
#endif
strcpy(acThisHost, acMyName);
/*
if (0 == strcmp(pcToHost, strcpy(acThisHost, acMyName))) {
(void)strcpy(pcToHost, acLocalhost);
@ -528,7 +531,7 @@ char *pcBuf, *pcWant;
* (s/[ \t\r\n]*$//)
*/
if ((char *)0 == pcWant) {
while (0 != j && isspace(pcBuf[j-1])) {
while (0 != j && isspace((int)(pcBuf[j-1]))) {
pcBuf[--j] = '\000';
}
return j;
@ -584,7 +587,7 @@ char *pcPorts, *pcMaster, *pcTo, *pcCmd, *pcWho;
exit(8);
# endif
#endif
} else if (!isdigit(pcPorts[0])) {
} else if (!isdigit((int)(pcPorts[0]))) {
fprintf(stderr, "%s: %s: %s\n", progname, pcMaster, pcPorts);
exit(2);
} else {
@ -680,7 +683,7 @@ int s;
char *pcMaster, *pcMach, *pcHow, *pcUser;
{
register int nc;
register int fIn;
register int fIn = '-';
auto fd_set rmask, rinit;
extern int atoi();
@ -1021,7 +1024,7 @@ char *pcMaster, *pcMach, *pcCmd, *pcWho;
/* send request for master list
*/
(void)sprintf(acPorts, "groups\r\n", pcCmd);
(void)sprintf(acPorts, "groups\r\n");
SendOut(s, acPorts, strlen(acPorts));
/* get the ports number */
@ -1140,7 +1143,7 @@ char **argv;
auto int fLocal;
auto char acPorts[1024];
auto char *pcUser;
auto char *pcMsg;
auto char *pcMsg = '\000';
auto int (*pfiCall)();
static char acOpts[] = "b:aAdDsSfFe:hl:M:pvVwWUqQrux";
extern long atol();
@ -1166,7 +1169,7 @@ char **argv;
getuid() == pwdMe->pw_uid) {
/* use the login $USER is set to, if it is our (real) uid */;
} else if ((struct passwd *)0 == (pwdMe = getpwuid(getuid()))) {
fprintf(stderr, "%s: getpwuid: %d: %s\n", progname, getuid(), strerror(errno));
fprintf(stderr, "%s: getpwuid: %d: %s\n", progname, (int)(getuid()), strerror(errno));
exit(1);
}
pcUser = pwdMe->pw_name;

View File

@ -4,11 +4,15 @@ Various contributions by folks....
Author: Michael Sullivan <mike@trdlnk.com>
Synopsis: Creates a solaris package
redhat-rpm
Author: Paul Heinlein <heinlein@measurecast.com>
Synopsis: Files for a Redhat-tuned RPM
I can't verify that these scripts will work for everyone. Hopefully they
will be helpful.
Bryan Stansell
#
# $Id: README,v 1.1 1999-08-24 14:24:41-07 bryan Exp $
# $Id: README,v 1.2 2001-06-15 06:02:59-07 bryan Exp $
#

25
contrib/redhat-rpm/README Normal file
View File

@ -0,0 +1,25 @@
Bits of some relavent communication from Paul Heinlein:
Date: Tue, 17 Apr 2001 13:19:46 -0700 (PDT)
From: Paul Heinlein <heinlein@measurecast.com>
To: Bryan Stansell <bryan@conserver.com>
Subject: Red Hat conserver init script for Linux
Below my sig I've pasted an init script that will start and stop
conserver on Red Hat Linux. It's set up to work with the chkconfig
runlevel manager that ships with Red Hat.
----------------------------------------------
Date: Tue, 17 Apr 2001 15:58:18 -0700 (PDT)
From: Paul Heinlein <heinlein@measurecast.com>
To: Bryan Stansell <bryan@conserver.com>
Subject: Re: Conserver patch
If this spec file goes in the root directory of the distribution as
conserver.spec, then Red Hat users will be able to build rpms by doing no
more than
% rpm -ta conserver-7.x.x.tar.gz
I'll be happy to do any tweaking necessary to get this to work.

View File

@ -0,0 +1,49 @@
#!/bin/sh
#
# conserver -- serial-port console daemon
#
# chkconfig: 2345 92 08
# description: conserver is a serial-port console daemon
# config: /etc/conserver.cf
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# make sure conserver is installed and executable
[ -x /usr/sbin/conserver ] || exit 1
# See how we were called.
case "$1" in
start)
echo -n "Starting conserver: "
daemon conserver -d -n
echo
touch /var/lock/subsys/conserver
;;
stop)
echo -n "Shutting down conserver: "
killproc conserver
echo
rm -f /var/lock/subsys/conserver
;;
status)
status conserver
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: conserver {start|stop|restart|status}"
exit 1
esac
exit 0

View File

@ -0,0 +1,102 @@
#
# rpm spec file for conserver, but I don't think it'll work on any
# platform that doesn't have red hat rpm >= 4.0.2 installed.
#
%define pkg conserver
%define ver 7.0.2
# define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default
# hostname (console)
%define master console
# what red hat (or other distibution) version are you running?
%define distver 6
Summary: Serial console server daemon/client
Name: %{pkg}
Version: %{ver}
Release: 1.%{distver}x
Copyright: distributable
Group: System Environment/Daemons
URL: http://www.conserver.com/
Source: http://www.conserver.com/%{pkg}-%{ver}.tar.gz
BuildRoot: %{_tmppath}/%{pkg}-buildroot
Prefix: %{_prefix}
%description
Conserver is an application that allows multiple users to watch a
serial console at the same time. It can log the data, allows users to
take write-access of a console (one at a time), and has a variety of
bells and whistles to accentuate that basic functionality.
%prep
%{__rm} -rf %{buildroot}
%setup -q
%build
# we don't want to install the solaris conserver.rc file
f="conserver/Makefile.in"
%{__mv} $f $f.orig
%{__sed} -e 's/^.*conserver\.rc.*$//' < $f.orig > $f
%configure --with-master=%{master}
make
%install
%{makeinstall}
# put commented copies of the sample configure files in the
# system configuration directory
%{__mkdir_p} %{buildroot}/%{_sysconfdir}
%{__sed} -e 's/^/#/' \
< conserver.cf/conserver.cf \
> %{buildroot}/%{_sysconfdir}/conserver.cf
%{__sed} -e 's/^/#/' \
< conserver.cf/conserver.passwd \
> %{buildroot}/%{_sysconfdir}/conserver.passwd
# install copy of init script
%{__mkdir_p} %{buildroot}/%{_initrddir}
%{__cp} contrib/redhat-rpm/conserver.init %{buildroot}/%{_initrddir}/conserver
%clean
%{__rm} -rf %{buildroot}
%post
if [ -x %{_initrddir}/conserver ]; then
/sbin/chkconfig --add conserver
fi
# make sure /etc/services has a conserver entry
if ! egrep '\<conserver\>' /etc/services > /dev/null 2>&1 ; then
echo "console 782/tcp conserver" >> /etc/services
fi
%preun
if [ "$1" = 0 ]; then
if [ -x %{_initrddir}/conserver ]; then
%{_initrddir}/conserver stop
/sbin/chkconfig --del conserver
fi
fi
%files
%defattr(-,root,root)
%doc CHANGES FAQ INSTALL README conserver.cf
%config(noreplace) %{_sysconfdir}/conserver.cf
%config(noreplace) %{_sysconfdir}/conserver.passwd
%attr(555,root,root) %{_initrddir}/conserver
%{prefix}/bin/console
%{prefix}/man/man1/console.1.gz
%{prefix}/man/man8/conserver.8.gz
%{prefix}/man/man8/conserver.cf.8.gz
%{prefix}/sbin/conserver

View File

@ -1,9 +1,9 @@
PKG="conserver"
NAME="Console server and client"
CATEGORY="system"
VERSION="GNAC-6.12"
VERSION="7.0.2"
DESC="Console server and client"
CLASSES=none
ARCH=sparc
VENDOR="GNAC"
VENDOR="conserver.com"
BASEDIR=/opt

0
install-sh Normal file → Executable file
View File