Compare commits

..

16 Commits

62 changed files with 13282 additions and 11532 deletions

230
CHANGES
View File

@ -1,10 +1,232 @@
CHANGES CHANGES
======= =======
version 8.2.1 (Jun 2, 2015):
- added TCP keepalives between client and server - TCP-based consoles
already had the code - this was mostly an oversight
- patch for SEGV and task execution - patch by Artem Savkov
<asavkov@redhat.com>
- expanded break sequences from [1-9] to [1-9a-z] - based on patch by
Artem Savkov <asavkov@redhat.com>
version 8.2.0 (Apr 20, 2014):
- added --with-trust-uds-cred which uses getsockopt() to fetch and
trust the client uid, bypassing password lookups - patch by Anton
Lundin <glance@acc.umu.se>
- missing closedir() causing memory leak - patch by Anton Lundin
<glance@acc.umu.se>
- sending a break signal over IPMI was broken - based on patch by
Alexander Y. Fomichev <git.user@gmail.com>
- IPv6 support (marked as experimental at this point because it's
untested (except by the author), there's a lack of documentation, and
I'm hoping for non-getifaddrs() system support) - patch by Milos
Vyletel <milos.vyletel@gmail.com>
- no more K&R compiler support
version 8.1.20 (Apr 4, 2014):
- IPMI serial over LAN support via FreeIPMI - based on patch by Anton
D. Kachalov <mouse@yandex-team.ru>
- minor cleanup of code, removal of gcc warnings and such that should
have no fuctional change
version 8.1.19 (Sep 26, 2013):
- prevent select/read loop when EOF on non-pty input (console) -
reported by Chris Marget <chris@marget.com>
- "!" syntax prefixing use of group names not honored - reported by
Zonker <consoleteam@gmail.com>
- fixed memory leak using timestamps - patch by Karvendhan M.
<Karvendhan.M@netapp.com>
- deprecated --with-cycladests (noop now) - cross-compilation should
work without it as autologin now expects setpgrp() to take two
arugments instead of testing for it
- no automatic checks for an empty password when using PAM
authentication - based on discussion with Ryan Kirkpatrick
<linux@rkirkpat.net>
- added 'sslcacertificatefile' and 'sslcacertificatepath' client
configuration options - based on patch by Aki Tuomi <cmouse@cmouse.fi>
- added 'sslcacertificatefile' and 'sslreqclientcert' server
configuration options
- added --with-req-server-cert to force clients to require a certificate
from the server when using SSL - based on emails with Thor Simon
<tls@coyotepoint.com>
- added server-side tasks (see conserver.cf man page) that are invoked
by the client (useful for things like IPMI-based power control of
servers, invoking resets of terminal server ports, or anything else
that requires scripting) - ideas from patch by Anton Lundin
<glance@acc.umu.se> and discussion on mailing list (2011)
- added 'confirm' option to break sequences
- added 'breaklist' option to limit exposure of break sequences to
consoles
- sending of break signals is now announced to all attached clients
version 8.1.18 (Nov 11, 2010):
- install man pages read-only and improved the contributed redhat init
script - patches by Eric Biederman <ebiederm@aristanetworks.com>
- spec file improvements in contrib/redhat-rpm - patch by Jodok Ole
Muellers <jodok.muellers@aschendorff.de>
- GSS-API patch for client code - patch by Andras Horvath
<Andras.Horvath@cern.ch>
version 8.1.17 (Sep 29, 2009):
- fix for interface detection when HAVE_SA_LEN is defined - first
detected on NetBSD 5.0 and patched by Chris Ross
<cross+conserver@distal.com>
- first person to connect to a console wanting read/write now gets it
once the active user drops read/write - suggested by Thomas Gardner
<tmg@pobox.com>
- fix typo when setting nonblocking socket for client connections,
fixing stall issues - patch by Eric Biederman
<ebiederm@aristanetworks.com>
- GSS-API patch (--with-gssapi) to help with Kerberos tokens - patch by
Nate Straz <nstraz@redhat.com>
- authenticate username without @REALM when using GSS-API
(--with-striprealm) - based on patch by Andras Horvath
<Andras.Horvath@cern.ch>
- various contrib/redhat-rpm fixes - patch by Fabien Wernli
<wernli@in2p3.fr>
- fix handling of read(stdin) returning -1 in console client - patch by
Ed Swierk <eswierk@arastra.com>
version 8.1.16 (Apr 10, 2007):
- added 'replstring' substitution option - inspired by
conversation with Owen DeLong <owen@c2company.com>
- added '^Ecn' option for writing a note to the logfile - patch
by Bryan Schmersal <bschmer@yahoo.com>
- fixed leaking file descriptors when 'host' and 'uds' consoles
fail to connect - based on patch by Michael Heironimus
<michael_heironimus@archwayconcepts.com>
version 8.1.15 (Dec 31, 2006):
- protection again telnet option negotation loops - patch by
Robby Griffin <rmg@yakshavers.com>
- console now prints the attach/detach sequences when suspended
- added --with-cycladests configure option to allow
cross-compiling on a cyclades ts - patch by Matt Johnson
<mwj@doc.ic.ac.uk>
- added master conserver host to 'console -x' output for
'device' consoles - patch by Matt Johnson <mwj@doc.ic.ac.uk>
- fixed parsing error when dealing with encapsulated
client/server options
version 8.1.14 (Apr 9, 2006):
- fixed rpm conserver.spec file - based on patch by Martin Evans
<m.d.t.evans@qmul.ac.uk>
- added 'uds' console type for unix domain socket connections -
based on patch by DJ Gregor <dj@gregor.com>
- probing of interfaces under cygwin (and possibly others?) now
skips unconfigured interfaces (even if flagged as up!) -
reported by Chris Riddoch <chrisr@digeo.com>
- added the '!login' console option to prevent clients from
connecting to a console - suggested by Greg Tillman
<gregtillman@comcast.net>
- added a 'noop' console type for consoles you'd like to name,
but have no connection to - suggested by Greg Tillman
<gregtillman@comcast.net>
- deprecated escape commands removed from the code
- added '^EcP' and '^EcR' sequences to set the playback and
replay line lengths
- new console config options 'playback' and 'replay' to let the
client set prefered output lengths (with a special feature for
a size of zero)
- prefer strlcpy() over strcpy() - based on patch by Peter
Valchev <pvalchev@openbsd.org>
- fixed bug where '^Eco' by user on an 'exec' console with an
'initcmd' causes input by user to be ignored (could be other
console types as well) - reported by Mark Wedel
<Mark.Wedel@sun.com>
- made POSIX termios code in autologin a requirement (since
conserver requires it) and cleaned up a few other issues -
based on reports by Arthur Clune <ajc22@york.ac.uk>
version 8.1.13 (Jan 15, 2006):
- use SIOCGIFNUM for interface count (if available) and catch
EINVAL on Solaris - patch by Peter Jeremy
<peter.jeremy@alcatel.com.au>
- console output now resets idle timer - suggested by Peter
Saunders <pajs@fodder.org.uk>
- bug fix for conserver process running out of control and using
up cpu - debugged with Alexandra N. Kossovsky
<Alexandra.Kossovsky@oktetlabs.ru>
version 8.1.12 (Sep 5, 2005):
- printf() fix for autologin - patch by Menno Duursma
<druiloor@zonnet.nl>
- newly spawned (from SIGHUP) processes didn't properly close
primary socket
- SSL certificates now work again (anonymous ciphers are not
allowed if a certificate is used)
- client options -x, -u, -w, and -i can now take a console name
to restrict output - suggested by Evan McClure
<emcclure@internap.com>
- convert program now installed in $libdir/conserver - patch by
Petter Reinholdtsen <pere@hungry.com>
- we now ignore SIGXFSZ, if it exists
- added 'limited' access option to remove certain functionality
from users - suggested by Sven Michels <sven@darkman.de>
- added client option -z/-Z for sending commands to servers
(reload, quit, etc) - based on suggestion by Joshua Pincus
<Joshua.Pincus@Sun.COM>
- added 'execrunas' and 'initrunas' console options to allow
'exec' and 'initcmd' execution as another user and/or group -
based on patch by Gary Mills <mills@cc.umanitoba.ca>
- the east coast mirror had to shut down (for now, at least)
- crash from bad pointer manipulation during log replay - reported by
Ryan Kirkpatrick <linux@rkirkpat.net>
version 8.1.11 (Nov 9, 2004):
- fixed array bounds and stack tromping - reported by Emmett
Hogan <hogan@bigcityit.com>
- most recent client to ask for read-write now gets it (used to
be first client to connect)
- client read-write mode now separate from console up/down state
- 'make autologin.install' now compiles autologin - reported by
Graham Merrill <teddgram@sbcglobal.net>
- new 'autocomplete' option for controlling shortest-prefix
console name matching (which has always been on)
- client now blocks on ^Eco, waiting for status of connection
- added 'a' and 'A' for upper and lowercase alphanumeric
(0-9a-z) conversions to the *subst config items - based on
patch by Jonathan Chen <jon+conserver@spock.org>
version 8.1.10 (Sep 21, 2004):
- fix "forwarding level too deep" issue with '^Ec;' - reported
by Han Pilmeyer <han.pilmeyer@hp.com>
version 8.1.9 (Jul 14, 2004):
- fixed bug processing access lists when duplicates exist in the
list - reported by Phil Dibowitz <phil@usc.edu>
- fixed bug where 'idletimeout' was not recognized in default
blocks - reported by John Cagle <jcagle@gmail.com>
- added an 'autocomplete' config option to set the console name
autocompletion behavior - suggested by John Stoffel
<stoffel@lucent.com>
version 8.1.8 (Jun 9, 2004):
- added 'initspinmax' and 'initspintimer' console options to
help calm console initialization "spinning"
- fixed setsockopt() error on 64bit solaris - reported by Trond
Hagen <trond@basefarm.no>
version 8.1.7 (May 28, 2004):
- cleaned up the manpages a bit to make things clearer and more
standard - reported by Dave Stuit <djs@tellme.com>
- added an east coast mirror! http://conserver.syr.edu/ -
thanks to Christopher T. Beers <ctbeers@syr.edu>
- primary group of users not included in '@group' syntax -
reported by Phil Dibowitz <phil@usc.edu>
- changed '@group' behavior such that groups are checked when
needed, instead of cached at startup, which is more logical
- missing variables when building convert with tcp_wrappers -
reported by Nikolaos Papavassiliou
<Nikolaos.Papavassiliou@reuters.com>
- added --with-rpath option - suggested by Phil Dibowitz
<phil@usc.edu>
version 8.1.6 (May 25, 2004): version 8.1.6 (May 25, 2004):
- added ability to configure client via sytem-wide console.cf - added ability to configure client via system-wide console.cf
file and per-user .consolerc - suggested by Erik Sjolund file and per-user .consolerc - suggested (independently) by
<erik.sjolund@sbc.su.se> Erik Sjolund <erik.sjolund@sbc.su.se> and Trevor Fiatal
<trevor@fiatal.net>
- fixed bug where break strings were not properly sent - - fixed bug where break strings were not properly sent -
reported by Tim Small <tim@buttersideup.com> reported by Tim Small <tim@buttersideup.com>
- fixed bug in config file 'protocol' value handling - reported - fixed bug in config file 'protocol' value handling - reported
@ -738,5 +960,5 @@ before version 6.05:
and enhancements of various types were applied. and enhancements of various types were applied.
# #
# $Id: CHANGES,v 1.179 2004/05/26 00:14:07 bryan Exp $ # $Id: CHANGES,v 1.251 2015/06/02 17:33:29 bryan Exp $
# #

25
INSTALL
View File

@ -156,8 +156,9 @@ Detailed Instructions
--with-port=PORT Specify port number [conserver] --with-port=PORT Specify port number [conserver]
--with-base=PORT Base port for secondary channel [0] --with-base=PORT Base port for secondary channel [0]
--with-master=MASTER Specify master server hostname [console] --with-master=MASTER Specify master server hostname [console]
--with-cffile=CFFILE Specify config filename --with-ccffile=CFFILE Specify client config filename
[SYSCONFDIR/conserver.cf] [SYSCONFDIR/console.cf]
--with-cffile=CFFILE Specify config filename [SYSCONFDIR/conserver.cf]
--with-pwdfile=PWDFILE Specify password filename --with-pwdfile=PWDFILE Specify password filename
[SYSCONFDIR/conserver.passwd] [SYSCONFDIR/conserver.passwd]
--with-logfile=LOGFILE Specify log filename [/var/log/conserver] --with-logfile=LOGFILE Specify log filename [/var/log/conserver]
@ -166,12 +167,22 @@ Detailed Instructions
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10] --with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
--with-trustrevdns Trust reverse DNS information --with-trustrevdns Trust reverse DNS information
--with-extmsgs Produce extended messages --with-extmsgs Produce extended messages
--with-rpath Use -R as well as -L for libraries
--with-cycladests (deprecated - noop) Build for a Cyclades TS
--with-uds[=DIR] Use Unix domain sockets for client/server --with-uds[=DIR] Use Unix domain sockets for client/server
communication [/tmp/conserver] communication [/tmp/conserver]
--with-trust-uds-cred Trust UDS credentials obtained via socket
--with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support --with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support
--with-openssl[=PATH] Compile in OpenSSL support --with-openssl[=PATH] Compile in OpenSSL support
--with-req-server-cert Require server SSL certificate by client
--with-gssapi[=PATH] Compile in GSS-API support
--with-striprealm retry username without @REALM with gss-api
authentication
--with-freeipmi[=PATH] Compile in FreeIPMI support
--with-dmalloc[=PATH] Compile in dmalloc support --with-dmalloc[=PATH] Compile in dmalloc support
--with-pam Enable PAM support --with-pam Enable PAM support
--with-ipv6 (experimental) Use IPv6 for client/server
communication
Not surprisingly, some match the old conserver/cons.h items...here Not surprisingly, some match the old conserver/cons.h items...here
they are for reference: they are for reference:
@ -228,10 +239,10 @@ Detailed Instructions
step. step.
+ Next, make sure conserver runs during boot. The init script we + Next, make sure conserver runs during boot. The init script we
use under Solaris is installed in <PREFIX>/etc/conserver.rc. use under Solaris is installed in
Use that or some form of it for your own /etc/init.d script or <DATADIR>/examples/conserver/conserver.rc. Use that or some
an entry in startup files (/etc/rc, /etc/rc.local, or form of it for your own /etc/init.d script or an entry in
whatever). startup files (/etc/rc, /etc/rc.local, or whatever).
+ Now for the fun stuff. You need to create a conserver.cf and + Now for the fun stuff. You need to create a conserver.cf and
conserver.passwd file. Those are defined with the conserver.passwd file. Those are defined with the
@ -278,5 +289,5 @@ Other Information And Gotchas
# #
# $Id: INSTALL,v 1.38 2004/04/13 18:11:58 bryan Exp $ # $Id: INSTALL,v 1.41 2014/04/20 06:45:07 bryan Exp $
# #

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
bindir = @bindir@ bindir = @bindir@

View File

@ -106,10 +106,13 @@ Upon successful login, the commands available are:
groups provide ports for group leaders groups provide ports for group leaders
help this help message help this help message
master provide a list of master servers master provide a list of master servers
newlogs* close and open all logfiles (SIGUSR2)
pid provide pid of master process pid provide pid of master process
quit* terminate conserver (SIGTERM) quit* terminate conserver (SIGTERM)
restart* restart conserver (SIGHUP) restart* restart conserver (SIGHUP) - deprecated
reconfig* reread config file (SIGHUP)
version provide version info for server version provide version info for server
up* bring up all downed consoles (SIGUSR1)
* = requires admin privileges * = requires admin privileges
"exit" and "help" are the same as before the client logged login. "exit" and "help" are the same as before the client logged login.
@ -130,23 +133,36 @@ names. The list includes any hosts (including the possibility of the
local host) which have locally managed consoles. The client is not local host) which have locally managed consoles. The client is not
disconnected. disconnected.
The "newlogs" command reopens all logfiles used by conserver, assuming
the user has administrative access. It responds with a message starting
with "ok" if successful and an error message otherwise (like
"unauthorized command"). The client is disconnected if it's successful.
The "pid" command responds with the pid of the master process (in this The "pid" command responds with the pid of the master process (in this
case, the one the client is talking to). The client is not case, the one the client is talking to). The client is not
disconnected. disconnected.
The "quit" command will shut down conserver, assuming the user has The "quit" command will shut down conserver, assuming the user has
administrative access. It responds with a message starting with "ok" if administrative access. It responds with a message starting with "ok" if
successful, and an error message otherwise (like "unauthorized successful and an error message otherwise (like "unauthorized command").
command"). The client is disconnected if it's successful. The client is disconnected if it's successful.
The "restart" command will shut down conserver, assuming the user has The "restart" command has been deprecated. You should use "reconfig".
administrative access. It responds with a message starting with "ok" if
successful, and an error message otherwise (like "unauthorized The "reconfig" command will cause conserver to reread the configuration
command"). The client is not disconnected. file and apply any changes, assuming the user has administrative access.
It responds with a message starting with "ok" if successful and an error
message otherwise (like "unauthorized command"). The client is not
disconnected.
The "version" command responds with the version string. The client is The "version" command responds with the version string. The client is
not disconnected. not disconnected.
The "up" command tries to "bring up" all disconnected consoles, assuming
the user has administrative access. It responds with a message starting
with "ok" if successful and an error message otherwise (like
"unauthorized command"). The client is disconnected if it's successful.
"group" Mode "group" Mode
------------ ------------
@ -286,5 +302,5 @@ The more "interesting" escape sequences are the following.
" -- spy mode]" " -- spy mode]"
# #
# $Id: PROTOCOL,v 1.1 2004/04/16 16:50:55 bryan Exp $ # $Id: PROTOCOL,v 1.2 2005/09/05 21:54:03 bryan Exp $
# #

15
README
View File

@ -16,6 +16,14 @@ Documentation
Downloading Downloading
The latest version can be found at http://www.conserver.com/ The latest version can be found at http://www.conserver.com/
(US-West).
Mirrors of the site are at:
Australia http://planetmirror.com/pub/conserver/
Ireland http://conserver.oss-mirror.org/
Germany http://conserver.linux-mirror.org/
Russia http://conserver.rinet.ru/
Systems Tested Systems Tested
@ -29,7 +37,9 @@ Systems Tested
Cygwin (w2k),gcc 2.95.3 Cygwin (w2k),gcc 2.95.3
DEC Tru64 4.0, gcc DEC Tru64 4.0, gcc
DEC Tru64 4.0/5.1, native cc DEC Tru64 4.0/5.1, native cc
FreeBSD 4.2/4.8/5.1 (x86), gcc FreeBSD 4.x (i386) gcc
FreeBSD 5.x (i386/amd64/sparc64) gcc
FreeBSD 6.x/7.x (i386/amd64/sparc64/ia64) gcc
HP-UX 10.20, gcc HP-UX 10.20, gcc
HP-UX 11.10 parisc and ia64, native cc HP-UX 11.10 parisc and ia64, native cc
Irix 6.15, native cc Irix 6.15, native cc
@ -40,6 +50,7 @@ Systems Tested
MacOS X, native gcc MacOS X, native gcc
Solaris 2.5.1 thru 9 (sparc/x86), gcc Solaris 2.5.1 thru 9 (sparc/x86), gcc
Solaris 7/8, native cc Solaris 7/8, native cc
Solaris 10 and Solaris Express (build 33) (x86), gcc and native cc
Contributions Contributions
@ -55,5 +66,5 @@ Contributions
http://www.columbia.edu/acis/sy/unixdev/zinc http://www.columbia.edu/acis/sy/unixdev/zinc
# #
# $Id: README,v 1.22 2003/08/23 19:34:24 bryan Exp $ # $Id: README,v 1.26 2006/04/16 17:45:08 bryan Exp $
# #

25
TODO
View File

@ -54,8 +54,6 @@ Bryan Stansell
- cyclades ts1000/2000 port : "Moses, Joel" <jmoses@deloitte.com> - cyclades ts1000/2000 port : "Moses, Joel" <jmoses@deloitte.com>
- config file for client (list of masters, for example)
- strftime() idea for logfile names : Lars Kellogg-Stedman <lars@larsshack.org> - strftime() idea for logfile names : Lars Kellogg-Stedman <lars@larsshack.org>
- 9600baud log replay? - 9600baud log replay?
@ -86,14 +84,29 @@ Bryan Stansell
- not even sure if this is possible w/o confusing the client, - not even sure if this is possible w/o confusing the client,
but maybe with the new 8.1.0 client-server protocol, we can! but maybe with the new 8.1.0 client-server protocol, we can!
- allow for very long replays (hundres of lines) : John Stoffel
<stoffel@lucent.com>
- log rotation by date : Tom Pachla <tom.pachla@nlc-bnc.ca> - log rotation by date : Tom Pachla <tom.pachla@nlc-bnc.ca>
- strict file permission checks on conserver.passwd/conserver.cf : Erik - strict file permission checks on conserver.passwd/conserver.cf : Erik
Sjolund <erik.sjolund@sbc.su.se> Sjolund <erik.sjolund@sbc.su.se>
- netgroup support? : Nikolaos Papavassiliou
<Nikolaos.Papavassiliou@reuters.com> and Phil Dibowitz <phil@usc.edu>
- send sequences to console on client connect? (to repaint screen,
for example) : John Cagle <jcagle@gmail.com>
- uucp locks : Sebastian Zagrodzki <sebek@heron.net.icm.edu.pl>
- support more than 9 break sequences : Danish Mirza <Danish@lehman.com>
thought it was easy, but adding more than could break things with
current encoding. doable, will have to think harder about it.
- reintroduce console grouping : Martin Turba
<martin.turba@igd.fraunhofer.de>
- quick-recheck of down consoles (for uds) and possibly only log state
changes (instead of each try) : DJ Gregor <dj@gregor.com>
# #
# $Id: TODO,v 1.49 2004/05/25 00:38:11 bryan Exp $ # $Id: TODO,v 1.56 2006/04/03 22:20:34 bryan Exp $
# #

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@
@ -45,7 +46,7 @@ clean:
distclean: clean distclean: clean
rm -f Makefile rm -f Makefile
install: install: autologin
$(MKDIR) $(DESTDIR)$(bindir) $(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir)

View File

@ -34,13 +34,13 @@
* to change the /etc/security/audit_event line. * to change the /etc/security/audit_event line.
*/ */
#define AUE_autologin 32900 # define AUE_autologin 32900
#include <sys/unistd.h> # include <sys/unistd.h>
#include <netdb.h> # include <netdb.h>
#include <bsm/audit.h> # include <bsm/audit.h>
#include <bsm/libbsm.h> # include <bsm/libbsm.h>
#include <libintl.h> # include <libintl.h>
#endif #endif
#include <compat.h> #include <compat.h>
@ -69,11 +69,11 @@
*/ */
#ifndef lint #ifndef lint
char *rcsid = "$Id: autologin.c,v 1.23 2002/09/21 06:29:39 bryan Exp $"; char *rcsid = "$Id: autologin.c,v 1.28 2014/04/20 06:45:07 bryan Exp $";
#endif /* not lint */ #endif /* not lint */
extern char *progname; extern char *progname;
gid_t awGrps[NGROUPS_MAX]; gid_t awGrps[NGROUPS_MAX];
int iGrps = 0; int iGrps = 0;
/* /*
* External variables * External variables
@ -82,512 +82,435 @@ int iGrps = 0;
extern int optind; extern int optind;
extern char *optarg; extern char *optarg;
void make_utmp(); void make_utmp();
void usage(); void usage();
int int
Process() Process(void)
{ {
register int c; int iErrs = 0;
int iErrs = 0; int i, iNewGrp;
int i, iNewGrp; gid_t wGid;
gid_t wGid; uid_t wUid;
uid_t wUid; char *pcCmd = (char *)0, *pcDevTty = (char *)0;
char *pcCmd = (char *)0,
*pcDevTty = (char *)0;
char *pcTmp;
#ifdef HAVE_GETUSERATTR #ifdef HAVE_GETUSERATTR
char *pcGrps; char *pcGrps;
#endif
struct passwd *pwd;
struct stat st;
#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 #endif
struct passwd *pwd;
struct stat st;
struct termios n_tio;
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM) #if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
char my_hostname[MAXHOSTNAMELEN]; char my_hostname[MAXHOSTNAMELEN];
#endif #endif
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM) #if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
if (0 != gethostname(my_hostname, sizeof(my_hostname))) { if (0 != gethostname(my_hostname, sizeof(my_hostname))) {
(void) fprintf(stderr, "%s: gethostname: %s\n", strerror(errno)); (void)fprintf(stderr, "%s: gethostname: %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
}
#endif #endif
if ((char *)0 != pcCommand) { if ((char *)0 != pcCommand) {
if ((char *)0 == (pcCmd = (char *)malloc(strlen(pcCommand) + 4))) { if ((char *)0 == (pcCmd = (char *)malloc(strlen(pcCommand) + 4))) {
(void) fprintf(stderr, "%s: malloc: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: malloc: %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
(void)strcpy(pcCmd, "-c ");
(void)strcat(pcCmd, pcCommand);
} }
(void)strcpy(pcCmd, "-c ");
(void)strcat(pcCmd, pcCommand);
}
if ( (char *)0 != pcGroup ) { if ((char *)0 != pcGroup) {
iErrs += addgroup(pcGroup); iErrs += addgroup(pcGroup);
} }
if ( (char *)0 == pcLogin ) { if ((char *)0 == pcLogin) {
static char acLogin[17]; static char acLogin[17];
if ((struct passwd *)0 == (pwd = getpwuid(geteuid()))) { if ((struct passwd *)0 == (pwd = getpwuid(geteuid()))) {
(void) fprintf(stderr, "%s: %d: uid unknown\n", progname, geteuid()); (void)fprintf(stderr, "%s: %d: uid unknown\n", progname,
exit(1); geteuid());
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
pcLogin = strcpy(acLogin, pwd->pw_name);
} else if ((struct passwd *)0 == (pwd = getpwnam(pcLogin))) {
(void) fprintf(stderr, "%s: %s: login name unknown\n", progname, pcLogin);
exit(1);
/* NOTREACHED */
} }
wUid = pwd->pw_uid; pcLogin = strcpy(acLogin, pwd->pw_name);
wGid = pwd->pw_gid; } else if ((struct passwd *)0 == (pwd = getpwnam(pcLogin))) {
(void)endpwent(); (void)fprintf(stderr, "%s: %s: login name unknown\n", progname,
pcLogin);
exit(1);
/* NOTREACHED */
}
wUid = pwd->pw_uid;
wGid = pwd->pw_gid;
(void)endpwent();
#ifdef HAVE_GETUSERATTR #ifdef HAVE_GETUSERATTR
/* getuserattr() returns a funny list of groups: /* getuserattr() returns a funny list of groups:
* "grp1\0grp2\0grp3\0\0" * "grp1\0grp2\0grp3\0\0"
*/ */
if (0 == getuserattr(pcLogin, S_SUGROUPS, &pcGrps, SEC_LIST)) { if (0 == getuserattr(pcLogin, S_SUGROUPS, &pcGrps, SEC_LIST)) {
while ('\000' != *pcGrps) { while ('\000' != *pcGrps) {
/* ignore "ALL" and any group beginning with '!' */ /* ignore "ALL" and any group beginning with '!' */
if ('!' == *pcGrps || 0 != strcmp(pcGrps, "ALL")) { if ('!' == *pcGrps || 0 != strcmp(pcGrps, "ALL")) {
iErrs += addgroup(pcGrps); iErrs += addgroup(pcGrps);
} }
pcGrps = pcGrps + strlen(pcGrps) + 1; pcGrps = pcGrps + strlen(pcGrps) + 1;
}
} }
#endif /* HAVE_GETUSERATTR */ }
(void)endgrent(); #endif /* HAVE_GETUSERATTR */
(void)endgrent();
if ((char *)0 != pcTty) { if ((char *)0 != pcTty) {
if ( '/' == *pcTty ) { if ('/' == *pcTty) {
pcDevTty = pcTty; pcDevTty = pcTty;
} else { } else {
if ( (char *)0 == (pcDevTty = (char *)malloc(strlen(pcTty)+5+1) ) ) { if ((char *)0 ==
(void) fprintf(stderr, "%s: malloc: %s\n", progname, strerror(errno)); (pcDevTty = (char *)malloc(strlen(pcTty) + 5 + 1))) {
exit(1); (void)fprintf(stderr, "%s: malloc: %s\n", progname,
} strerror(errno));
sprintf(pcDevTty, "/dev/%s", pcTty); exit(1);
} }
sprintf(pcDevTty, "/dev/%s", pcTty);
}
if (0 != stat(pcDevTty, &st)) { if (0 != stat(pcDevTty, &st)) {
(void) fprintf(stderr, "%s: Can't stat %s: %s\n", progname, pcDevTty, strerror(errno)); (void)fprintf(stderr, "%s: Can't stat %s: %s\n", progname,
++iErrs; pcDevTty, strerror(errno));
++iErrs;
#if defined(VCHR) && defined(VMPC) #if defined(VCHR) && defined(VMPC)
} else if (VCHR != st.st_type && VMPC != st.st_type) { } else if (VCHR != st.st_type && VMPC != st.st_type) {
(void) fprintf(stderr, "%s: %s is not a character device\n", progname, pcDevTty); (void)fprintf(stderr, "%s: %s is not a character device\n",
++iErrs; progname, pcDevTty);
++iErrs;
#endif #endif
}
} else {
pcDevTty = (char *)0;
} }
} else {
pcDevTty = (char *)0;
}
if (iErrs) { if (iErrs) {
usage(); usage();
exit(1); exit(1);
/* NOTREACHED */ /* NOTREACHED */
} }
if (0 != geteuid()) { if (0 != geteuid()) {
(void) fprintf(stderr, "%s: Must be root!!!\n", progname); (void)fprintf(stderr, "%s: Must be root!!!\n", progname);
exit(1); exit(1);
/* NOTREACHED */ /* NOTREACHED */
} }
if (iGrps && 0 < setgroups(iGrps, awGrps)) { if (iGrps && 0 < setgroups(iGrps, awGrps)) {
(void) fprintf(stderr, "%s: Can't setgroups(): %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: Can't setgroups(): %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
}
/* Close open files /* Close open files
*/ */
for (i = (char *)0 == pcTty ? 3 : 0; i < getdtablesize(); ++i) { for (i = (char *)0 == pcTty ? 3 : 0; i < getdtablesize(); ++i) {
(void) close(i); (void)close(i);
} }
/* Make us a session leader so that when we open /dev/tty /* Make us a session leader so that when we open /dev/tty
* it will become our controlling terminal. * it will become our controlling terminal.
*/ */
if (-1 == (iNewGrp = getsid(getpid()))) { if (-1 == (iNewGrp = getsid(getpid()))) {
if (-1 == (iNewGrp = setsid())) { if (-1 == (iNewGrp = setsid())) {
(void) fprintf(stderr, "%s: setsid: %d: %s\n", progname, iNewGrp, strerror(errno)); (void)fprintf(stderr, "%s: setsid: %d: %s\n", progname,
iNewGrp = getpid(); iNewGrp, strerror(errno));
} iNewGrp = getpid();
} }
}
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM) #if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
if (!cannot_audit(0)) { if (!cannot_audit(0)) {
# if defined(HAVE_GETAUDIT_ADDR) # if defined(HAVE_GETAUDIT_ADDR)
struct auditinfo_addr audit_info; struct auditinfo_addr audit_info;
# else # else
struct auditinfo audit_info; struct auditinfo audit_info;
# endif # endif
au_mask_t audit_mask; au_mask_t audit_mask;
# if !defined(HAVE_GETAUDIT_ADDR) # if !defined(HAVE_GETAUDIT_ADDR)
struct hostent *hp; struct hostent *hp;
# endif # endif
int iAuditFile; int iAuditFile;
int fShowEvent = 1; int fShowEvent = 1;
token_t *ptAuditToken; token_t *ptAuditToken;
(void)memset(&audit_info, 0, sizeof(audit_info)); (void)memset(&audit_info, 0, sizeof(audit_info));
audit_info.ai_auid = wUid; audit_info.ai_auid = wUid;
audit_info.ai_asid = getpid(); audit_info.ai_asid = getpid();
audit_mask.am_success = audit_mask.am_failure = 0; audit_mask.am_success = audit_mask.am_failure = 0;
(void) au_user_mask(pcLogin, &audit_mask); (void)au_user_mask(pcLogin, &audit_mask);
audit_info.ai_mask.am_success = audit_mask.am_success; audit_info.ai_mask.am_success = audit_mask.am_success;
audit_info.ai_mask.am_failure = audit_mask.am_failure; audit_info.ai_mask.am_failure = audit_mask.am_failure;
# if defined(HAVE_GETAUDIT_ADDR) # if defined(HAVE_GETAUDIT_ADDR)
(void)aug_get_machine(my_hostname, (void)aug_get_machine(my_hostname,
&audit_info.ai_termid.at_addr[0], &audit_info.ai_termid.at_addr[0],
&audit_info.ai_termid.at_type); &audit_info.ai_termid.at_type);
# else # else
if ((char *)0 != (hp = gethostbyname(my_hostname)) if ((char *)0 != (hp = gethostbyname(my_hostname))
&& AF_INET == hp->h_addrtype) { && AF_INET == hp->h_addrtype) {
(void)memcpy(&audit_info.ai_termid.machine, (void)memcpy(&audit_info.ai_termid.machine, hp->h_addr,
hp->h_addr, sizeof(audit_info.ai_termid.machine));
sizeof(audit_info.ai_termid.machine));
}
# endif
# if defined(HAVE_GETAUDIT_ADDR)
if (0 > setaudit_addr(&audit_info, sizeof(audit_info)))
# else
if (0 > setaudit(&audit_info))
# endif
{
fprintf(stderr, "%s: setaudit failed: %s\n",
progname,
strerror(errno));
fShowEvent = 0;
}
if (fShowEvent) {
fShowEvent = au_preselect(AUE_autologin,
&audit_mask,
AU_PRS_SUCCESS,
AU_PRS_REREAD);
}
if (fShowEvent) {
iAuditFile = au_open();
# if defined(HAVE_GETAUDIT_ADDR)
ptAuditToken = au_to_subject_ex(wUid,
wUid,
wGid,
wUid,
wGid,
audit_info.ai_asid,
audit_info.ai_asid,
&audit_info.ai_termid),
# else
ptAuditToken = au_to_subject(wUid,
wUid,
wGid,
wUid,
wGid,
audit_info.ai_asid,
audit_info.ai_asid,
&audit_info.ai_termid),
# endif
(void)au_write(iAuditFile, ptAuditToken);
ptAuditToken = au_to_text(gettext("successful login"));
(void)au_write(iAuditFile, ptAuditToken);
if ((char *)0 != pcCmd) {
ptAuditToken = au_to_text(pcCmd);
(void)au_write(iAuditFile, ptAuditToken);
}
# if defined(HAVE_GETAUDIT_ADDR)
ptAuditToken = au_to_return32(0, 0);
# else
ptAuditToken = au_to_return(0, 0);
# endif
(void)au_write(iAuditFile, ptAuditToken);
if(0 > au_close(iAuditFile, AU_TO_WRITE, AUE_autologin)) {
fprintf(stderr, "%s: audit write failed",
progname,
strerror(errno));
}
}
} }
# endif
# if defined(HAVE_GETAUDIT_ADDR)
if (0 > setaudit_addr(&audit_info, sizeof(audit_info)))
# else
if (0 > setaudit(&audit_info))
# endif
{
fprintf(stderr, "%s: setaudit failed: %s\n", progname,
strerror(errno));
fShowEvent = 0;
}
if (fShowEvent) {
fShowEvent =
au_preselect(AUE_autologin, &audit_mask, AU_PRS_SUCCESS,
AU_PRS_REREAD);
}
if (fShowEvent) {
iAuditFile = au_open();
# if defined(HAVE_GETAUDIT_ADDR)
ptAuditToken =
au_to_subject_ex(wUid, wUid, wGid, wUid, wGid,
audit_info.ai_asid, audit_info.ai_asid,
&audit_info.ai_termid),
# else
ptAuditToken =
au_to_subject(wUid, wUid, wGid, wUid, wGid,
audit_info.ai_asid, audit_info.ai_asid,
&audit_info.ai_termid),
# endif
(void)au_write(iAuditFile, ptAuditToken);
ptAuditToken = au_to_text(gettext("successful login"));
(void)au_write(iAuditFile, ptAuditToken);
if ((char *)0 != pcCmd) {
ptAuditToken = au_to_text(pcCmd);
(void)au_write(iAuditFile, ptAuditToken);
}
# if defined(HAVE_GETAUDIT_ADDR)
ptAuditToken = au_to_return32(0, 0);
# else
ptAuditToken = au_to_return(0, 0);
# endif
(void)au_write(iAuditFile, ptAuditToken);
if (0 > au_close(iAuditFile, AU_TO_WRITE, AUE_autologin)) {
fprintf(stderr, "%s: audit write failed: %s", progname,
strerror(errno));
}
}
}
#endif #endif
/* Open the TTY for stdin, stdout and stderr /* Open the TTY for stdin, stdout and stderr
*/ */
if ((char *)0 != pcDevTty) { if ((char *)0 != pcDevTty) {
#ifdef TIOCNOTTY #ifdef TIOCNOTTY
if (-1 != (i = open("/dev/tty", 2, 0))) { if (-1 != (i = open("/dev/tty", 2, 0))) {
if ( ioctl(i, TIOCNOTTY, (char *)0) ) if (ioctl(i, TIOCNOTTY, (char *)0))
(void) fprintf(stderr, "%s: ioctl(%d, TIOCNOTTY, (char *)0): %s\n", progname, i, strerror(errno)); (void)fprintf(stderr,
(void) close(i); "%s: ioctl(%d, TIOCNOTTY, (char *)0): %s\n",
} progname, i, strerror(errno));
#endif (void)close(i);
if (0 != open(pcDevTty, O_RDWR, 0666)) {
exit(1);
/* NOTREACHED */
}
dup(0);
dup(0);
} }
#endif
if (0 != open(pcDevTty, O_RDWR, 0666)) {
exit(1);
/* NOTREACHED */
}
dup(0);
dup(0);
}
/* put the tty in out process group /* put the tty in out process group
*/ */
#ifdef HAVE_TCGETPGRP #ifdef HAVE_TCGETPGRP
if (-1 >= (i = tcgetpgrp(0))){ if (-1 >= (i = tcgetpgrp(0))) {
(void) fprintf(stderr, "%s: tcgetpgrp: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: tcgetpgrp: %s\n", progname,
} strerror(errno));
}
#endif #endif
#ifndef SETPGRP_VOID if (-1 != i && setpgrp(0, i)) {
if (-1 != i && setpgrp(0, i) ){ (void)fprintf(stderr, "%s: setpgrp: %s, i = %d\n", progname,
(void) fprintf(stderr, "%s: setpgrp: %s, i = %d\n", progname, strerror(errno), i); strerror(errno), i);
} }
#endif
#ifdef HAVE_TCSETPGRP #ifdef HAVE_TCSETPGRP
if (tcsetpgrp(0, iNewGrp)){ if (tcsetpgrp(0, iNewGrp)) {
(void) fprintf(stderr, "%s: tcsetpgrp: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: tcsetpgrp: %s\n", progname,
} strerror(errno));
#endif }
#ifndef SETPGRP_VOID
if (-1 != iNewGrp && setpgrp(0, iNewGrp)){
(void) fprintf(stderr, "%s: setpgrp: %s, iNewGrp = %d\n", progname, strerror(errno), iNewGrp);
}
#endif #endif
if (-1 != iNewGrp && setpgrp(0, iNewGrp)) {
(void)fprintf(stderr, "%s: setpgrp: %s, iNewGrp = %d\n", progname,
strerror(errno), iNewGrp);
}
/* put the tty in the correct mode /* put the tty in the correct mode
*/ */
#ifndef HAVE_TERMIOS_H
if (0 != ioctl(0, TIOCGETP, (char *)&n_sty)) {
fprintf(stderr, "%s: iotcl: getp: %s\n", progname, strerror(errno));
exit(10);
}
#ifdef O_CBREAK
n_sty.sg_flags &= ~(O_CBREAK);
n_sty.sg_flags |= (O_CRMOD|O_ECHO);
#else
n_sty.sg_flags &= ~(CBREAK);
n_sty.sg_flags |= (CRMOD|ECHO);
#endif
n_sty.sg_kill = '\025'; /* ^U */
n_sty.sg_erase = '\010'; /* ^H */
if (0 != ioctl(0, TIOCSETP, (char *)&n_sty)) {
fprintf(stderr, "%s: iotcl: setp: %s\n", progname, strerror(errno));
exit(10);
}
/* stty undef all tty chars
*/
#if 0
if (-1 == ioctl(0, TIOCGETC, (char *)&n_tchars)) {
fprintf(stderr, "%s: ioctl: getc: %s\n", progname, strerror(errno));
return;
}
n_tchars.t_intrc = -1;
n_tchars.t_quitc = -1;
if (-1 == ioctl(0, TIOCSETC, (char *)&n_tchars)) {
fprintf(stderr, "%s: ioctl: setc: %s\n", progname, strerror(errno));
return;
}
#endif
#ifdef TIOCGLTC
if (-1 == ioctl(0, TIOCGLTC, (char *)&n_ltchars)) {
fprintf(stderr, "%s: ioctl: gltc: %s\n", progname, strerror(errno));
return;
}
n_ltchars.t_suspc = -1;
n_ltchars.t_dsuspc = -1;
n_ltchars.t_flushc = -1;
n_ltchars.t_lnextc = -1;
if (-1 == ioctl(0, TIOCSLTC, (char *)&n_ltchars)) {
fprintf(stderr, "%s: ioctl: sltc: %s\n", progname, strerror(errno));
return;
}
#endif
#else /* not using ioctl, using POSIX or sun stuff */
#ifdef HAVE_TCGETATTR #ifdef HAVE_TCGETATTR
if (0 != tcgetattr(0, &n_tio)) { if (0 != tcgetattr(0, &n_tio)) {
(void) fprintf(stderr, "%s: tcgetattr: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: tcgetattr: %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
}
#else #else
if (0 != ioctl(0, TCGETS, &n_tio)) { if (0 != ioctl(0, TCGETS, &n_tio)) {
(void) fprintf(stderr, "%s: iotcl: TCGETS: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: iotcl: TCGETS: %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ exit(1);
} /* NOTREACHED */
}
#endif #endif
n_tio.c_iflag &= ~(IGNCR|IUCLC); n_tio.c_iflag &= ~(IGNCR | IUCLC);
n_tio.c_iflag |= ICRNL|IXON|IXANY; n_tio.c_iflag |= ICRNL | IXON | IXANY;
n_tio.c_oflag &= ~(OLCUC|ONOCR|ONLRET|OFILL|NLDLY|CRDLY|TABDLY|BSDLY); n_tio.c_oflag &=
n_tio.c_oflag |= OPOST|ONLCR|TAB3; ~(OLCUC | ONOCR | ONLRET | OFILL | NLDLY | CRDLY | TABDLY | BSDLY);
n_tio.c_lflag &= ~(XCASE|NOFLSH|ECHOK|ECHONL); n_tio.c_oflag |= OPOST | ONLCR | TAB3;
n_tio.c_lflag |= ISIG|ICANON|ECHO; n_tio.c_lflag &= ~(XCASE | NOFLSH | ECHOK | ECHONL);
n_tio.c_cc[VEOF] = '\004'; /* ^D */ n_tio.c_lflag |= ISIG | ICANON | ECHO;
n_tio.c_cc[VEOL] = '\000'; /* EOL */ n_tio.c_cc[VEOF] = '\004'; /* ^D */
n_tio.c_cc[VERASE] = '\010'; /* ^H */ n_tio.c_cc[VEOL] = '\000'; /* EOL */
n_tio.c_cc[VINTR] = '\003'; /* ^C */ n_tio.c_cc[VERASE] = '\010'; /* ^H */
n_tio.c_cc[VKILL] = '\025'; /* ^U */ n_tio.c_cc[VINTR] = '\003'; /* ^C */
/* MIN */ n_tio.c_cc[VKILL] = '\025'; /* ^U */
n_tio.c_cc[VQUIT] = '\034'; /* ^\ */ /* MIN */
n_tio.c_cc[VSTART] = '\021'; /* ^Q */ n_tio.c_cc[VQUIT] = '\034'; /* ^\ */
n_tio.c_cc[VSTOP] = '\023'; /* ^S */ n_tio.c_cc[VSTART] = '\021'; /* ^Q */
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */ n_tio.c_cc[VSTOP] = '\023'; /* ^S */
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */
#ifdef HAVE_TCSETATTR #ifdef HAVE_TCSETATTR
if (0 != tcsetattr(0, TCSANOW, &n_tio)) { if (0 != tcsetattr(0, TCSANOW, &n_tio)) {
(void) fprintf(stderr, "%s: tcsetattr: %s\n", progname, strerror(errno)); (void)fprintf(stderr, "%s: tcsetattr: %s\n", progname,
exit(1); strerror(errno));
/* NOTREACHED */ 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
#endif /* setup tty */
if (fMakeUtmp) { if (fMakeUtmp) {
extern char *ttyname(); extern char *ttyname();
make_utmp(pcLogin, (char *)0 != pcTty ? pcTty : ttyname(0)); make_utmp(pcLogin, (char *)0 != pcTty ? pcTty : ttyname(0));
} }
/* Change ownership and modes on the tty. /* Change ownership and modes on the tty.
*/ */
if ((char *)0 != pcDevTty) { if ((char *)0 != pcDevTty) {
(void) chown(pcDevTty, wUid, wGid); (void)chown(pcDevTty, wUid, wGid);
(void) chmod(pcDevTty, (mode_t) TTYMODE); (void)chmod(pcDevTty, (mode_t) TTYMODE);
} }
if ((char *)0 != pcCmd) { if ((char *)0 != pcCmd) {
execl(PATH_SU, "su", "-", pcLogin, pcCmd, (char *)0); execl(PATH_SU, "su", "-", pcLogin, pcCmd, (char *)0);
} else { } else {
execl(PATH_SU, "su", "-", pcLogin, (char *)0); execl(PATH_SU, "su", "-", pcLogin, (char *)0);
} }
} }
#ifndef HAVE_PUTENV #ifndef HAVE_PUTENV
int int
putenv(pcAssign) putenv(char *pcAssign)
char *pcAssign;
{ {
register char *pcEq; register char *pcEq;
if ((char *)0 != (pcEq = strchr(pcAssign, '='))) { if ((char *)0 != (pcEq = strchr(pcAssign, '='))) {
*pcEq++ = '\000'; *pcEq++ = '\000';
(void)setenv(pcAssign, pcEq, 1); (void)setenv(pcAssign, pcEq, 1);
*--pcEq = '='; *--pcEq = '=';
} else { } else {
unsetenv(pcAssign); unsetenv(pcAssign);
} }
} }
#endif #endif
int int
addgroup(pcGrp) addgroup(char *pcGrp)
char *pcGrp;
{ {
struct group *grp; struct group *grp;
grp = getgrnam(pcGrp); grp = getgrnam(pcGrp);
if ((struct group *)0 == grp) { if ((struct group *)0 == grp) {
(void) fprintf(stderr, "%s: Unknown group: %s\n", progname, pcGrp); (void)fprintf(stderr, "%s: Unknown group: %s\n", progname, pcGrp);
return(1); return (1);
} }
if (iGrps >= NGROUPS_MAX) { if (iGrps >= NGROUPS_MAX) {
(void) fprintf(stderr, "%s: Too many groups specified with \"%s\".\n", progname, pcGrp); (void)fprintf(stderr,
return(1); "%s: Too many groups specified with \"%s\".\n",
} progname, pcGrp);
awGrps[iGrps++] = grp->gr_gid; return (1);
return(0); }
awGrps[iGrps++] = grp->gr_gid;
return (0);
} }
/* install a utmp entry to show the use we know is here is here (ksb) /* install a utmp entry to show the use we know is here is here (ksb)
*/ */
void void
make_utmp(pclogin, pctty) make_utmp(char *pclogin, char *pctty)
char *pclogin;
char *pctty;
{ {
register int iFound, iPos; register int iFound, iPos;
register int fdUtmp; register int fdUtmp;
register char *pcDev; register char *pcDev;
register struct utmp *up; register struct utmp *up;
auto struct utmp outmp, utmp; auto struct utmp utmp;
if ((char *)0 == pctty) { if ((char *)0 == pctty) {
return; return;
}
if ((fdUtmp = open(UTMP_FILE, O_RDWR, 0664)) < 0) {
return;
}
/* create empty utmp entry
*/
(void)memset(&utmp, 0, sizeof(struct utmp));
/* Only the last portion of the tty is saved, unless it's
* all digits. Then back up and include the previous part
* /dev/pty/02 -> pty/02 (not just 02)
*/
if ((char *)0 != (pcDev = strrchr(pctty, '/'))) {
if (!*(pcDev + strspn(pcDev, "/0123456789"))) {
while (pcDev != pctty && *--pcDev != '/') {
}
} }
if (*pcDev == '/') {
if ((fdUtmp = open(UTMP_FILE, O_RDWR, 0664)) < 0) { ++pcDev;
return;
}
/* create empty utmp entry
*/
(void)memset(&utmp, 0, sizeof(struct utmp));
/* Only the last portion of the tty is saved, unless it's
* all digits. Then back up and include the previous part
* /dev/pty/02 -> pty/02 (not just 02)
*/
if ((char *)0 != (pcDev = strrchr(pctty, '/'))) {
if (! *(pcDev + strspn(pcDev, "/0123456789"))) {
while (pcDev != pctty && *--pcDev != '/') {
}
}
if (*pcDev == '/') {
++pcDev;
}
} else {
pcDev = pctty;
} }
} else {
pcDev = pctty;
}
#ifdef HAVE_GETUTENT #ifdef HAVE_GETUTENT
/* look through getutent's by pid /* look through getutent's by pid
*/ */
(void)setutent(); (void)setutent();
utmp.ut_pid = getpid(); utmp.ut_pid = getpid();
iFound = iPos = 0; iFound = iPos = 0;
while ((up = getutent()) != NULL) { while ((up = getutent()) != NULL) {
if (up->ut_pid == utmp.ut_pid) { if (up->ut_pid == utmp.ut_pid) {
utmp = *up; utmp = *up;
++iFound; ++iFound;
break; break;
}
iPos++;
}
(void)endutent();
/* we were an initprocess, now we are a login shell
*/
utmp.ut_type = USER_PROCESS;
(void)strncpy(utmp.ut_user, pclogin, sizeof(utmp.ut_user));
if ('\000' == utmp.ut_line[0]) {
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
} }
iPos++;
}
(void)endutent();
/* we were an initprocess, now we are a login shell
*/
utmp.ut_type = USER_PROCESS;
(void)strncpy(utmp.ut_user, pclogin, sizeof(utmp.ut_user));
if ('\000' == utmp.ut_line[0]) {
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
}
#else #else
#ifdef HAVE_SETTTYENT # ifdef HAVE_SETTTYENT
{ {
register struct ttyent *ty; register struct ttyent *ty;
/* look through ttyslots by line? /* look through ttyslots by line?
@ -595,56 +518,56 @@ char *pctty;
(void)setttyent(); (void)setttyent();
iFound = iPos = 0; iFound = iPos = 0;
while ((ty = getttyent()) != NULL) { while ((ty = getttyent()) != NULL) {
if (strcmp(ty->ty_name, pcDev) == 0) { if (strcmp(ty->ty_name, pcDev) == 0) {
++iFound; ++iFound;
break; break;
} }
iPos++; iPos++;
} }
/* fill in utmp from ty ZZZ */ /* fill in utmp from ty ZZZ */
(void)endttyent(); (void)endttyent();
}
(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;
} }
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line)); iPos++;
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name)); }
(void)strncpy(utmp.ut_host, "(autologin)", sizeof(utmp.ut_host)); (void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
#else # endif
/* 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
#endif utmp.ut_time = time((time_t *)0);
utmp.ut_time = time((time_t *) 0);
if (0 == iFound) { if (0 == iFound) {
fprintf(stderr, "%s: %s: no ttyslot\n", progname, pctty); fprintf(stderr, "%s: %s: no ttyslot\n", progname, pctty);
} else if (-1 == lseek(fdUtmp, (off_t)(iPos*sizeof(utmp)), 0)) { } else if (-1 == lseek(fdUtmp, (off_t) (iPos * sizeof(utmp)), 0)) {
fprintf(stderr, "%s: lseek: %s\n", progname, strerror(errno)); fprintf(stderr, "%s: lseek: %s\n", progname, strerror(errno));
} else { } else {
(void)write(fdUtmp, (char *)&utmp, sizeof(utmp)); (void)write(fdUtmp, (char *)&utmp, sizeof(utmp));
} }
(void)close(fdUtmp); (void)close(fdUtmp);
} }
void void
usage() usage(void)
{ {
char *u_pch; char *u_pch;
int u_loop; int u_loop;
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) { for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) {
fprintf(stdout, "%s: usage%s\n", progname, u_pch); fprintf(stdout, "%s: usage%s\n", progname, u_pch);
} }
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) { for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) {
fprintf(stdout, "%s\n", u_pch); fprintf(stdout, "%s\n", u_pch);
} }
} }

View File

@ -13,174 +13,172 @@
#ifndef HAVE_GETOPT #ifndef HAVE_GETOPT
static int static int
optopt; /* character checked for validity */ optopt; /* character checked for validity */
/* get option letter from argument vector, also does -number correctly /* get option letter from argument vector, also does -number correctly
* for nice, xargs, and stuff (these extras by ksb) * for nice, xargs, and stuff (these extras by ksb)
* does +arg if you give a last argument of "+", else give (char *)0 * does +arg if you give a last argument of "+", else give (char *)0
*/ */
static int static int
getopt(nargc, nargv, ostr) getopt(int nargc, char **nargv, char *ostr)
int nargc;
char **nargv, *ostr;
{ {
register char *oli; /* option letter list index */ register char *oli; /* option letter list index */
static char EMSG[] = ""; /* just a null place */ static char EMSG[] = ""; /* just a null place */
static char *place = EMSG; /* option letter processing */ static char *place = EMSG; /* option letter processing */
if ('\000' == *place) { /* update scanning pointer */ if ('\000' == *place) { /* update scanning pointer */
if (optind >= nargc) if (optind >= nargc)
return EOF; return EOF;
if (nargv[optind][0] != '-') { if (nargv[optind][0] != '-') {
register int iLen; register int iLen;
return EOF; return EOF;
}
place = nargv[optind];
if ('\000' == *++place) /* "-" (stdin) */
return EOF;
if (*place == '-' && '\000' == place[1]) {
/* found "--" */
++optind;
return EOF;
}
} /* option letter okay? */
/* if we find the letter, (not a `:')
* or a digit to match a # in the list
*/
if ((optopt = *place++) == ':' ||
((char *)0 == (oli = strchr(ostr,optopt)) &&
(!(isdigit(optopt)||'-'==optopt) || (char *)0 == (oli = strchr(ostr, '#'))))) {
if(!*place) ++optind;
return('?');
} }
if ('#' == *oli) { /* accept as -digits */ place = nargv[optind];
optarg = place -1; if ('\000' == *++place) /* "-" (stdin) */
++optind; return EOF;
place = EMSG; if (*place == '-' && '\000' == place[1]) {
return '#'; /* found "--" */
++optind;
return EOF;
} }
if (*++oli != ':') { /* don't need argument */ }
optarg = NULL; /* option letter okay? */
if ('\000' == *place) /* if we find the letter, (not a `:')
++optind; * or a digit to match a # in the list
} else { /* need an argument */ */
if (*place) { /* no white space */ if ((optopt = *place++) == ':' ||
optarg = place; ((char *)0 == (oli = strchr(ostr, optopt)) &&
} else if (nargc <= ++optind) { /* no arg!! */ (!(isdigit(optopt) || '-' == optopt) ||
place = EMSG; (char *)0 == (oli = strchr(ostr, '#'))))) {
return '*'; if (!*place)
} else { ++optind;
optarg = nargv[optind]; /* white space */ return ('?');
} }
place = EMSG; if ('#' == *oli) { /* accept as -digits */
++optind; optarg = place - 1;
++optind;
place = EMSG;
return '#';
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if ('\000' == *place)
++optind;
} else { /* need an argument */
if (*place) { /* no white space */
optarg = place;
} else if (nargc <= ++optind) { /* no arg!! */
place = EMSG;
return '*';
} else {
optarg = nargv[optind]; /* white space */
} }
return optopt; /* dump back option letter */ place = EMSG;
++optind;
}
return optopt; /* dump back option letter */
} }
#endif /* ! HAVE_GETOPT */ #endif /* ! HAVE_GETOPT */
char char
*progname = "$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $", *progname =
*au_terse[] = { "$Id: main.c,v 1.3 2014/04/20 06:45:07 bryan Exp $", *au_terse[] = {
" [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]", " [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]",
" -h", " -h",
" -V", " -V",
(char *)0 (char *)0
}, }, *u_help[] = {
*u_help[] = { "c cmd command to run",
"c cmd command to run", "e env=value environment variable to set",
"e env=value environment variable to set", "g group initial group",
"g group initial group", "h print this help message",
"h print this help message", "l login login name",
"l login login name", "t tty attach to this terminal",
"t tty attach to this terminal", "u do no make utmp entry",
"u do no make utmp entry", "V show version information", (char *)0}, *pcCommand =
"V show version information", (char *)0, *pcGroup = (char *)0, *pcLogin = (char *)0, *pcTty =
(char *)0 (char *)0;
},
*pcCommand = (char *)0,
*pcGroup = (char *)0,
*pcLogin = (char *)0,
*pcTty = (char *)0;
int int
fMakeUtmp = 1, fMakeUtmp = 1, iErrs = 0;
iErrs = 0;
#ifndef u_terse #ifndef u_terse
#define u_terse (au_terse[0]) # define u_terse (au_terse[0])
#endif #endif
static char *rcsid = static char *rcsid = "$Id: main.c,v 1.3 2014/04/20 06:45:07 bryan Exp $";
"$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $";
/* /*
* parser * parser
*/ */
int int
main(argc, argv) main(int argc, char **argv)
int argc;
char **argv;
{ {
static char static char
sbOpt[] = "c:e:g:hl:t:uV", sbOpt[] = "c:e:g:hl:t:uV", *u_pch = (char *)0;
*u_pch = (char *)0; static int
static int u_loop = 0;
u_loop = 0; register int u_curopt;
register int u_curopt; extern int atoi();
extern int atoi();
progname = strrchr(argv[0], '/'); progname = strrchr(argv[0], '/');
if ((char *)0 == progname) if ((char *)0 == progname)
progname = argv[0]; progname = argv[0];
else else
++progname; ++progname;
while (EOF != (u_curopt = getopt(argc, argv, sbOpt))) { while (EOF != (u_curopt = getopt(argc, argv, sbOpt))) {
switch (u_curopt) { switch (u_curopt) {
case '*': case '*':
fprintf(stderr, "%s: option `-%c\' needs a parameter\n", progname, optopt); fprintf(stderr, "%s: option `-%c\' needs a parameter\n",
exit(1); progname, optopt);
case '?': exit(1);
fprintf(stderr, "%s: unknown option `-%c\', use `-h\' for help\n", progname, optopt); case '?':
exit(1); fprintf(stderr,
case 'c': "%s: unknown option `-%c\', use `-h\' for help\n",
pcCommand = optarg; progname, optopt);
continue; exit(1);
case 'e': case 'c':
if (putenv(optarg) != 0) { pcCommand = optarg;
(void) fprintf(stderr, "%s: putenv(\"%s\"): failed\n", progname, optarg); continue;
exit(1); case 'e':
} if (putenv(optarg) != 0) {
continue; (void)fprintf(stderr, "%s: putenv(\"%s\"): failed\n",
case 'g': progname, optarg);
pcGroup = optarg; exit(1);
continue;
case 'h':
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) {
if ('\000' == *u_pch) {
fprintf(stdout, "%s: with no parameters\n", progname);
continue;
}
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
}
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) {
fprintf(stdout, "%s\n", u_pch);
}
exit(0);
case 'l':
pcLogin = optarg;
continue;
case 't':
pcTty = optarg;
continue;
case 'u':
fMakeUtmp = 0;
continue;
case 'V':
printf("%s: %s\n", progname, rcsid);
exit(0);
} }
break; continue;
case 'g':
pcGroup = optarg;
continue;
case 'h':
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]);
++u_loop) {
if ('\000' == *u_pch) {
fprintf(stdout, "%s: with no parameters\n",
progname);
continue;
}
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
}
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]);
++u_loop) {
fprintf(stdout, "%s\n", u_pch);
}
exit(0);
case 'l':
pcLogin = optarg;
continue;
case 't':
pcTty = optarg;
continue;
case 'u':
fMakeUtmp = 0;
continue;
case 'V':
printf("%s: %s\n", progname, rcsid);
exit(0);
} }
Process(); break;
exit(iErrs); }
Process();
exit(iErrs);
} }

View File

@ -4,7 +4,7 @@
extern char *progname, *au_terse[4], *u_help[9]; extern char *progname, *au_terse[4], *u_help[9];
#ifndef u_terse #ifndef u_terse
#define u_terse (au_terse[0]) # define u_terse (au_terse[0])
#endif #endif
extern int main(); extern int main();
extern int fMakeUtmp, iErrs; extern int fMakeUtmp, iErrs;
@ -12,4 +12,3 @@ extern char *pcCommand, *pcGroup, *pcLogin, *pcTty;
/* from std_help.m */ /* from std_help.m */
/* from std_version.m */ /* from std_version.m */
/* from autologin.m */ /* from autologin.m */

123
compat.h
View File

@ -8,9 +8,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <netinet/in.h> #include <netinet/in.h>
#if USE_UNIX_DOMAIN_SOCKETS
#include <sys/un.h> #include <sys/un.h>
#endif
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <ctype.h> #include <ctype.h>
@ -37,18 +35,29 @@
# define DEFESC 'c' # define DEFESC 'c'
#endif #endif
/* set the default length of the replay functions
* DEFREPLAY for 'r'
* DEFPLAYBACK for 'p'
*/
#if !defined(DEFREPLAY)
# define DEFREPLAY 20
#endif
#if !defined(PLAYBACK)
# define DEFPLAYBACK 60
#endif
/* For legacy compile-time setting of the port... /* For legacy compile-time setting of the port...
*/ */
#if ! defined(DEFPORT) #if ! defined(DEFPORT)
# if defined(SERVICENAME) # if defined(SERVICENAME)
# define DEFPORT SERVICENAME # define DEFPORT SERVICENAME
# else
# if defined(PORTNUMBER)
# define DEFPORT PORTNUMBER
# else # else
# if defined(PORTNUMBER) # define DEFPORT "conserver"
# define DEFPORT PORTNUMBER
# else
# define DEFPORT "conserver"
# endif
# endif # endif
# endif
#endif #endif
#if STDC_HEADERS #if STDC_HEADERS
@ -94,6 +103,18 @@ typedef long fd_set;
#include <termios.h> #include <termios.h>
#ifndef TAB3
# ifdef OXTABS
# define TAB3 OXTABS
# else
# ifdef XTABS
# define TAB3 XTABS
# else
# define TAB3 0
# endif
# endif
#endif
#ifdef HAVE_STROPTS_H #ifdef HAVE_STROPTS_H
# include <stropts.h> # include <stropts.h>
#endif #endif
@ -108,7 +129,7 @@ typedef long fd_set;
#endif #endif
#if HAVE_TYPES_H #if HAVE_TYPES_H
#include <sys/types.h> # include <sys/types.h>
#endif #endif
#if HAVE_SYS_WAIT_H #if HAVE_SYS_WAIT_H
@ -117,30 +138,30 @@ typedef long fd_set;
#define LO(s) ((unsigned)((s) & 0377)) #define LO(s) ((unsigned)((s) & 0377))
#define HI(s) ((unsigned)(((s) >> 8) & 0377)) #define HI(s) ((unsigned)(((s) >> 8) & 0377))
#if !defined(WIFEXITED) #if !defined(WIFEXITED)
#define WIFEXITED(s) (LO(s)==0) # define WIFEXITED(s) (LO(s)==0)
#endif #endif
#if !defined(WEXITSTATUS) #if !defined(WEXITSTATUS)
#define WEXITSTATUS(s) HI(s) # define WEXITSTATUS(s) HI(s)
#endif #endif
#if !defined(WIFSIGNALED) #if !defined(WIFSIGNALED)
#define WIFSIGNALED(s) ((LO(s)>0)&&(HI(s)==0)) # define WIFSIGNALED(s) ((LO(s)>0)&&(HI(s)==0))
#endif #endif
#if !defined(WTERMSIG) #if !defined(WTERMSIG)
#define WTERMSIG(s) (LO(s)&0177) # define WTERMSIG(s) (LO(s)&0177)
#endif #endif
#if !defined(WIFSTOPPED) #if !defined(WIFSTOPPED)
#define WIFSTOPPED(s) ((LO(s)==0177)&&(HI(s)!=0)) # define WIFSTOPPED(s) ((LO(s)==0177)&&(HI(s)!=0))
#endif #endif
#if !defined(WSTOPSIG) #if !defined(WSTOPSIG)
#define WSTOPSIG(s) HI(s) # define WSTOPSIG(s) HI(s)
#endif #endif
#if HAVE_SYSEXITS_H #if HAVE_SYSEXITS_H
#include <sysexits.h> # include <sysexits.h>
#else #else
#define EX_OK 0 # define EX_OK 0
#define EX_UNAVAILABLE 69 # define EX_UNAVAILABLE 69
#define EX_TEMPFAIL 75 # define EX_TEMPFAIL 75
#endif #endif
#include <errno.h> #include <errno.h>
@ -214,19 +235,19 @@ extern char *h_errlist[];
#endif #endif
#ifdef HAVE_USERSEC_H #ifdef HAVE_USERSEC_H
#include <usersec.h> # include <usersec.h>
#endif #endif
#ifdef HAVE_PTY_H #ifdef HAVE_PTY_H
#include <pty.h> # include <pty.h>
#endif #endif
#ifdef HAVE_LIBUTIL_H #ifdef HAVE_LIBUTIL_H
#include <libutil.h> # include <libutil.h>
#endif #endif
#ifdef HAVE_UTIL_H #ifdef HAVE_UTIL_H
#include <util.h> # include <util.h>
#endif #endif
@ -259,54 +280,66 @@ typedef int socklen_t;
* as legacy definitions. * as legacy definitions.
*/ */
#ifndef IUCLC #ifndef IUCLC
#define IUCLC 0 # define IUCLC 0
#endif #endif
#ifndef OLCUC #ifndef OLCUC
#define OLCUC 0 # define OLCUC 0
#endif #endif
#ifndef XCASE #ifndef XCASE
#define XCASE 0 # define XCASE 0
#endif #endif
/* Some systems don't have OFILL or *DLY. */ /* Some systems don't have OFILL or *DLY. */
#ifndef OFILL #ifndef OFILL
#define OFILL 0 # define OFILL 0
#endif #endif
#ifndef NLDLY #ifndef NLDLY
#define NLDLY 0 # define NLDLY 0
#endif #endif
#ifndef CRDLY #ifndef CRDLY
#define CRDLY 0 # define CRDLY 0
#endif #endif
#ifndef TABDLY #ifndef TABDLY
#define TABDLY 0 # define TABDLY 0
#endif #endif
#ifndef BSDLY #ifndef BSDLY
#define BSDLY 0 # define BSDLY 0
#endif #endif
#ifndef ONOCR #ifndef ONOCR
#define ONOCR 0 # define ONOCR 0
#endif #endif
#ifndef ONLRET #ifndef ONLRET
#define ONLRET 0 # define ONLRET 0
#endif #endif
#ifndef SEEK_SET #ifndef SEEK_SET
#define SEEK_SET L_SET # define SEEK_SET L_SET
#endif
#ifndef PARAMS
# if PROTOTYPES
# define PARAMS(protos) protos
# else /* no PROTOTYPES */
# define PARAMS(protos) ()
# endif /* no PROTOTYPES */
#endif #endif
/* setup a conditional debugging line */ /* setup a conditional debugging line */
#ifndef CONDDEBUG #ifndef CONDDEBUG
#define CONDDEBUG(line) if (fDebug) {debugFileName=__FILE__; debugLineNo=__LINE__; Debug line;} # define CONDDEBUG(line) if (fDebug) {debugFileName=__FILE__; debugLineNo=__LINE__; Debug line;}
#endif #endif
#if HAVE_DMALLOC #if HAVE_DMALLOC
#include <dmalloc.h> # include <dmalloc.h>
#endif
#if HAVE_FREEIPMI
# include <ipmiconsole.h>
#endif
#ifndef INADDR_STYPE
# if USE_IPV6
# define INADDR_STYPE struct sockaddr_storage
# else
# define INADDR_STYPE struct in_addr
# endif
#endif
#ifndef SOCKADDR_STYPE
# if USE_IPV6
# define SOCKADDR_STYPE struct sockaddr_storage
# else
# define SOCKADDR_STYPE struct sockaddr_in
# endif
#endif #endif

667
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,9 @@
/* Socket used to communicate */ /* Socket used to communicate */
#undef DEFPORT #undef DEFPORT
/* Defined if building for a Cyclades TS */
#undef FOR_CYCLADES_TS
/* Define to 1 if you have the `bigcrypt' function. */ /* Define to 1 if you have the `bigcrypt' function. */
#undef HAVE_BIGCRYPT #undef HAVE_BIGCRYPT
@ -30,6 +33,9 @@
/* have dmalloc support */ /* have dmalloc support */
#undef HAVE_DMALLOC #undef HAVE_DMALLOC
/* have freeipmi support */
#undef HAVE_FREEIPMI
/* Define to 1 if you have the `getaudit' function. */ /* Define to 1 if you have the `getaudit' function. */
#undef HAVE_GETAUDIT #undef HAVE_GETAUDIT
@ -60,6 +66,9 @@
/* Define to 1 if you have the `getspnam' function. */ /* Define to 1 if you have the `getspnam' function. */
#undef HAVE_GETSPNAM #undef HAVE_GETSPNAM
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `getuserattr' function. */ /* Define to 1 if you have the `getuserattr' function. */
#undef HAVE_GETUSERATTR #undef HAVE_GETUSERATTR
@ -69,6 +78,9 @@
/* Define to 1 if you have the `grantpt' function. */ /* Define to 1 if you have the `grantpt' function. */
#undef HAVE_GRANTPT #undef HAVE_GRANTPT
/* have gss-api support */
#undef HAVE_GSSAPI
/* Define to 1 if you have the <hpsecurity.h> header file. */ /* Define to 1 if you have the <hpsecurity.h> header file. */
#undef HAVE_HPSECURITY_H #undef HAVE_HPSECURITY_H
@ -192,6 +204,9 @@
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <stropts.h> header file. */ /* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H #undef HAVE_STROPTS_H
@ -240,6 +255,9 @@
/* Define to 1 if you have the <sys/uio.h> header file. */ /* Define to 1 if you have the <sys/uio.h> header file. */
#undef HAVE_SYS_UIO_H #undef HAVE_SYS_UIO_H
/* Define to 1 if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have the <sys/vlimit.h> header file. */ /* Define to 1 if you have the <sys/vlimit.h> header file. */
#undef HAVE_SYS_VLIMIT_H #undef HAVE_SYS_VLIMIT_H
@ -300,6 +318,9 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
@ -309,49 +330,89 @@
/* pidfile to write to */ /* pidfile to write to */
#undef PIDFILE #undef PIDFILE
/* Define to 1 if the C compiler supports function prototypes. */ /* Defined if client requires server SSL certificate */
#undef PROTOTYPES #undef REQ_SERVER_CERT
/* Define as the return type of signal handlers (`int' or `void'). */ /* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE #undef RETSIGTYPE
/* Define to 1 if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* retry username without @REALM with gss-api authentication */
#undef STRIP_REALM
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME #undef TIME_WITH_SYS_TIME
/* Defined if we trust reverse DNS */ /* Defined if we trust reverse DNS */
#undef TRUST_REVERSE_DNS #undef TRUST_REVERSE_DNS
/* Defined if we trust credentials from UDS client */
#undef TRUST_UDS_CRED
/* Directory for Unix domain sockets */ /* Directory for Unix domain sockets */
#undef UDSDIR #undef UDSDIR
/* Defined to UDS credential socket option */
#undef UDS_CRED_SO
/* Defined to UDS credential structure name */
#undef UDS_CRED_STYPE
/* Defined to UDS credential structure uid field */
#undef UDS_CRED_UID
/* Defined if we produce extended messages */ /* Defined if we produce extended messages */
#undef USE_EXTENDED_MESSAGES #undef USE_EXTENDED_MESSAGES
/* Defined if building with IPv6 support */
#undef USE_IPV6
/* use tcp_wrappers libwrap */ /* use tcp_wrappers libwrap */
#undef USE_LIBWRAP #undef USE_LIBWRAP
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Defined if we use Unix domain sockets */ /* Defined if we use Unix domain sockets */
#undef USE_UNIX_DOMAIN_SOCKETS #undef USE_UNIX_DOMAIN_SOCKETS
/* Define to 1 if on AIX 3. /* Define to 1 if on MINIX. */
System headers sometimes define this. #undef _MINIX
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Define like PROTOTYPES; this can be used by system headers. */ /* Define to 2 if the system does not provide POSIX.1 features except with
#undef __PROTOTYPES this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
#undef const #undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef mode_t #undef mode_t
@ -361,5 +422,8 @@
/* Define if <signal.h> does not define sig_atomic_t */ /* Define if <signal.h> does not define sig_atomic_t */
#undef sig_atomic_t #undef sig_atomic_t
/* Define to `unsigned' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t

227
config.sub vendored
View File

@ -1,9 +1,10 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2004-03-12' timestamp='2008-01-16'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +22,15 @@ timestamp='2004-03-12'
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# Boston, MA 02111-1307, USA. # 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry. # diff and a properly formatted ChangeLog entry.
# #
@ -70,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
Free Software Foundation, Inc. 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -83,11 +85,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do while test $# -gt 0 ; do
case $1 in case $1 in
--time-stamp | --time* | -t ) --time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;; echo "$timestamp" ; exit ;;
--version | -v ) --version | -v )
echo "$version" ; exit 0 ;; echo "$version" ; exit ;;
--help | --h* | -h ) --help | --h* | -h )
echo "$usage"; exit 0 ;; echo "$usage"; exit ;;
-- ) # Stop option processing -- ) # Stop option processing
shift; break ;; shift; break ;;
- ) # Use stdin as input. - ) # Use stdin as input.
@ -99,7 +101,7 @@ while test $# -gt 0 ; do
*local*) *local*)
# First pass through any local machine types. # First pass through any local machine types.
echo $1 echo $1
exit 0;; exit ;;
* ) * )
break ;; break ;;
@ -118,8 +120,9 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
@ -145,7 +148,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis) -apple | -axis | -knuth | -cray)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
@ -170,6 +173,10 @@ case $os in
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5) -sco5)
os=-sco3.2v5 os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -186,6 +193,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer. # Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*) -sco*)
os=-sco3.2v2 os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -230,14 +241,16 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| fr30 | frv \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| m32r | m32rle | m68000 | m68k | m88k | mcore \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
@ -246,6 +259,7 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \ | mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \ | mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \ | mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \ | mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \ | mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \ | mipsisa64 | mipsisa64el \
@ -254,20 +268,24 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| mt \
| msp430 \ | msp430 \
| nios | nios2 \
| ns16k | ns32k \ | ns16k | ns32k \
| openrisc | or32 \ | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \ | pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| strongarm \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \ | v850 | v850e \
| we32k \ | we32k \
| x86 | xscale | xstormy16 | xtensa \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k) | z8k)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
@ -278,6 +296,9 @@ case $basic_machine in
;; ;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;; ;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
@ -297,20 +318,20 @@ case $basic_machine in
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \ | avr-* | avr32-* \
| bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \ | m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@ -319,6 +340,7 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \ | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \ | mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \ | mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \ | mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \ | mipsisa64-* | mipsisa64el-* \
@ -326,27 +348,35 @@ case $basic_machine in
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \ | msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \ | tron-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xtensa-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-*) | z8k-*)
;; ;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
386bsd) 386bsd)
@ -417,6 +447,14 @@ case $basic_machine in
basic_machine=ns32k-sequent basic_machine=ns32k-sequent
os=-dynix os=-dynix
;; ;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
@ -445,13 +483,20 @@ case $basic_machine in
basic_machine=j90-cray basic_machine=j90-cray
os=-unicos os=-unicos
;; ;;
cr16c) craynv)
basic_machine=cr16c-unknown basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
crds | unos) crds | unos)
basic_machine=m68k-crds basic_machine=m68k-crds
;; ;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*) cris | cris-* | etrax*)
basic_machine=cris-axis basic_machine=cris-axis
;; ;;
@ -481,6 +526,10 @@ case $basic_machine in
basic_machine=m88k-motorola basic_machine=m88k-motorola
os=-sysv3 os=-sysv3
;; ;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*) dpx20 | dpx20-*)
basic_machine=rs6000-bull basic_machine=rs6000-bull
os=-bosx os=-bosx
@ -631,6 +680,14 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*) m88k-omron*)
basic_machine=m88k-omron basic_machine=m88k-omron
;; ;;
@ -646,6 +703,10 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
;; ;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe) miniframe)
basic_machine=m68000-convergent basic_machine=m68000-convergent
;; ;;
@ -659,10 +720,6 @@ case $basic_machine in
mips3*) mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;; ;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor) monitor)
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
@ -675,6 +732,9 @@ case $basic_machine in
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
;; ;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
@ -743,10 +803,6 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@ -754,9 +810,8 @@ case $basic_machine in
basic_machine=hppa1.1-oki basic_machine=hppa1.1-oki
os=-proelf os=-proelf
;; ;;
or32 | or32-*) openrisc | openrisc-*)
basic_machine=or32-unknown basic_machine=or32-unknown
os=-coff
;; ;;
os400) os400)
basic_machine=powerpc-ibm basic_machine=powerpc-ibm
@ -778,6 +833,14 @@ case $basic_machine in
basic_machine=i860-intel basic_machine=i860-intel
os=-osf os=-osf
;; ;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd) pbd)
basic_machine=sparc-tti basic_machine=sparc-tti
;; ;;
@ -787,6 +850,12 @@ case $basic_machine in
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3) pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc basic_machine=i586-pc
;; ;;
@ -843,6 +912,10 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k) rom68k)
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
@ -869,6 +942,10 @@ case $basic_machine in
sb1el) sb1el)
basic_machine=mipsisa64sb1el-unknown basic_machine=mipsisa64sb1el-unknown
;; ;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei) sei)
basic_machine=mips-sei basic_machine=mips-sei
os=-seiux os=-seiux
@ -880,6 +957,9 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64) sh64)
basic_machine=sh64-unknown basic_machine=sh64-unknown
;; ;;
@ -969,6 +1049,10 @@ case $basic_machine in
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
os=-coff os=-coff
;; ;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39) tx39)
basic_machine=mipstx39-unknown basic_machine=mipstx39-unknown
;; ;;
@ -1029,6 +1113,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond basic_machine=hppa1.1-winbond
os=-proelf os=-proelf
;; ;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
@ -1059,6 +1147,9 @@ case $basic_machine in
romp) romp)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
mmix)
basic_machine=mmix-knuth
;;
rs6000) rs6000)
basic_machine=rs6000-ibm basic_machine=rs6000-ibm
;; ;;
@ -1075,13 +1166,10 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sh64) sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sh64-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
@ -1154,20 +1242,23 @@ case $os in
| -aos* \ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@ -1185,7 +1276,7 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'` os=`echo $os | sed -e 's|nto|nto-qnx|'`
;; ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;; ;;
-mac*) -mac*)
@ -1294,6 +1385,9 @@ case $os in
-kaos*) -kaos*)
os=-kaos os=-kaos
;; ;;
-zvmoe)
os=-zvmoe
;;
-none) -none)
;; ;;
*) *)
@ -1316,6 +1410,12 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn) *-acorn)
os=-riscix1.2 os=-riscix1.2
;; ;;
@ -1325,9 +1425,9 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=-tops20
@ -1353,6 +1453,9 @@ case $basic_machine in
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*)
os=-elf
;;
mips*-cisco) mips*-cisco)
os=-elf os=-elf
;; ;;
@ -1371,9 +1474,15 @@ case $basic_machine in
*-be) *-be)
os=-beos os=-beos
;; ;;
*-haiku)
os=-haiku
;;
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth)
os=-mmixware
;;
*-wec) *-wec)
os=-proelf os=-proelf
;; ;;
@ -1539,7 +1648,7 @@ case $basic_machine in
esac esac
echo $basic_machine$os echo $basic_machine$os
exit 0 exit
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)

10515
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -14,12 +14,19 @@ AH_TEMPLATE([USE_LIBWRAP], [use tcp_wrappers libwrap])
dnl AH_TEMPLATE([HAVE_POSIX_REGCOMP], [have POSIX regcomp]) dnl AH_TEMPLATE([HAVE_POSIX_REGCOMP], [have POSIX regcomp])
AH_TEMPLATE([HAVE_PAM], [have PAM support]) AH_TEMPLATE([HAVE_PAM], [have PAM support])
AH_TEMPLATE([HAVE_OPENSSL], [have openssl support]) AH_TEMPLATE([HAVE_OPENSSL], [have openssl support])
AH_TEMPLATE([HAVE_GSSAPI], [have gss-api support])
AH_TEMPLATE([HAVE_FREEIPMI], [have freeipmi support])
AH_TEMPLATE([STRIP_REALM], [retry username without @REALM with gss-api authentication])
AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support]) AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
AH_TEMPLATE([HAVE_SA_LEN],[Defined if sa_len member exists in struct sockaddr]) AH_TEMPLATE([HAVE_SA_LEN],[Defined if sa_len member exists in struct sockaddr])
AH_TEMPLATE([TRUST_REVERSE_DNS],[Defined if we trust reverse DNS]) AH_TEMPLATE([TRUST_REVERSE_DNS],[Defined if we trust reverse DNS])
AH_TEMPLATE([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages]) AH_TEMPLATE([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages])
AH_TEMPLATE([USE_UNIX_DOMAIN_SOCKETS],[Defined if we use Unix domain sockets]) AH_TEMPLATE([USE_UNIX_DOMAIN_SOCKETS],[Defined if we use Unix domain sockets])
AH_TEMPLATE([USE_IPV6], [Defined if building with IPv6 support])
AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets]) AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets])
AH_TEMPLATE([FOR_CYCLADES_TS], [Defined if building for a Cyclades TS])
AH_TEMPLATE([REQ_SERVER_CERT], [Defined if client requires server SSL certificate])
AH_TEMPLATE([TRUST_UDS_CRED], [Defined if we trust credentials from UDS client])
dnl ### Normal initialization. ###################################### dnl ### Normal initialization. ######################################
AC_INIT AC_INIT
@ -253,35 +260,35 @@ AC_ARG_WITH(extmsgs,
;; ;;
esac],[AC_MSG_RESULT(no)]) esac],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(whether to use Unix domain sockets) use_dash_r=no
cons_with_uds="NO" AC_MSG_CHECKING(whether to use -R paths as well as -L)
AC_ARG_WITH(uds, AC_ARG_WITH(rpath,
AS_HELP_STRING([--with-uds@<:@=DIR@:>@ ], AS_HELP_STRING([--with-rpath],[Use -R as well as -L for libraries]),
[Use Unix domain sockets for client/server communication @<:@/tmp/conserver@:>@]),
[case "$withval" in [case "$withval" in
yes) yes|no)
AC_DEFINE_UNQUOTED(UDSDIR, "/tmp/conserver") AC_MSG_RESULT($withval)
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS) use_dash_r=$withval
AC_MSG_RESULT([/tmp/conserver])
cons_with_uds="YES"
;;
no)
AC_MSG_RESULT(no)
;; ;;
*) *)
AC_DEFINE_UNQUOTED(UDSDIR, "$withval") AC_MSG_RESULT(no)
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS) ;;
AC_MSG_RESULT('$withval') esac],
cons_with_uds="YES" [AC_MSG_RESULT(no)])
if expr "$withval" : '/' >/dev/null 2>&1; then
: AC_MSG_CHECKING(whether we are building for a Cyclades TS)
else AC_ARG_WITH(cycladests,
echo "*** WARNING *** you may have better success using a fully-qualified path" AS_HELP_STRING([--with-cycladests],[(deprecated - noop) Build for a Cyclades TS]),
echo "*** WARNING *** instead of '$withval'" [case "$withval" in
fi yes)
AC_DEFINE(FOR_CYCLADES_TS)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;; ;;
esac],[AC_MSG_RESULT(no)]) esac],[AC_MSG_RESULT(no)])
dnl ### Check for compiler et al. ################################### dnl ### Check for compiler et al. ###################################
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
@ -291,7 +298,6 @@ AC_PROG_MAKE_SET
dnl ### Compiler characteristics. ################################## dnl ### Compiler characteristics. ##################################
AC_AIX AC_AIX
AC_C_CONST AC_C_CONST
AC_C_PROTOTYPES
dnl AC_CHECK_SIZEOF(long) dnl AC_CHECK_SIZEOF(long)
dnl if test "$ac_cv_sizeof_long" -gt 4; then dnl if test "$ac_cv_sizeof_long" -gt 4; then
@ -311,7 +317,7 @@ if test "$ac_cv_sys_posix_termios" != "yes"; then
AC_MSG_ERROR([POSIX termios interface required]) AC_MSG_ERROR([POSIX termios interface required])
fi fi
AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h sys/sockio.h sys/param.h) AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h sys/sockio.h sys/param.h sys/un.h)
dnl sys/proc.h needs sys/param.h on openbsd, apparently dnl sys/proc.h needs sys/param.h on openbsd, apparently
AC_CHECK_HEADERS(sys/proc.h, [], [], AC_CHECK_HEADERS(sys/proc.h, [], [],
[#if HAVE_SYS_PARAM_H [#if HAVE_SYS_PARAM_H
@ -324,6 +330,7 @@ AC_TYPE_MODE_T
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_TYPE_PID_T AC_TYPE_PID_T
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE([sig_atomic_t],, AC_CHECK_TYPE([sig_atomic_t],,
AC_DEFINE(sig_atomic_t, volatile int, AC_DEFINE(sig_atomic_t, volatile int,
@ -367,6 +374,81 @@ AC_SEARCH_LIBS(crypt,crypt)
AC_SUBST(CONSLIBS) AC_SUBST(CONSLIBS)
AC_SUBST(CONSCPPFLAGS) AC_SUBST(CONSCPPFLAGS)
AC_SUBST(CONSLDFLAGS) AC_SUBST(CONSLDFLAGS)
AC_MSG_CHECKING(whether to use Unix domain sockets)
cons_with_uds="NO"
AC_ARG_WITH(uds,
AS_HELP_STRING([--with-uds@<:@=DIR@:>@ ],
[Use Unix domain sockets for client/server communication @<:@/tmp/conserver@:>@]),
[case "$withval" in
yes)
AC_DEFINE_UNQUOTED(UDSDIR, "/tmp/conserver")
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
AC_MSG_RESULT([/tmp/conserver])
cons_with_uds="YES"
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_DEFINE_UNQUOTED(UDSDIR, "$withval")
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
AC_MSG_RESULT('$withval')
cons_with_uds="YES"
if expr "$withval" : '/' >/dev/null 2>&1; then
:
else
echo "*** WARNING *** you may have better success using a fully-qualified path"
echo "*** WARNING *** instead of '$withval'"
fi
;;
esac
if test $cons_with_uds = YES; then
AC_MSG_CHECKING(whether to trust UDS credentials)
AC_ARG_WITH(trust-uds-cred,
AS_HELP_STRING([--with-trust-uds-cred],[Trust UDS credentials obtained via socket]),
[case "$withval" in
yes)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[
struct ucred u;
u.uid = 0;
#if !defined(SO_PEERCRED)
#error "no SO_PEERCRED defined"
#endif
],
[AC_MSG_RESULT(yes)
AC_DEFINE(UDS_CRED_STYPE, ucred, [Defined to UDS credential structure name])
AC_DEFINE(UDS_CRED_UID, uid, [Defined to UDS credential structure uid field])
AC_DEFINE(UDS_CRED_SO, SO_PEERCRED, [Defined to UDS credential socket option])
AC_DEFINE(TRUST_UDS_CRED)],
[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[
struct peercred_struct u;
u.euid = 0;
#if !defined(SO_PEERID)
#error "no SO_PEERID defined"
#endif
],
[AC_MSG_RESULT(yes)
AC_DEFINE(UDS_CRED_STYPE, peercred_struct, [Defined to UDS credential structure name])
AC_DEFINE(UDS_CRED_UID, euid, [Defined to UDS credential structure uid field])
AC_DEFINE(UDS_CRED_SO, SO_PEERID, [Defined to UDS credential socket option])
AC_DEFINE(TRUST_UDS_CRED)],
[AC_MSG_RESULT(no)])
])
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
fi
],[AC_MSG_RESULT(no)])
cons_with_libwrap="NO" cons_with_libwrap="NO"
AC_ARG_WITH(libwrap, AC_ARG_WITH(libwrap,
AS_HELP_STRING([--with-libwrap@<:@=PATH@:>@], AS_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
@ -374,7 +456,11 @@ AC_ARG_WITH(libwrap,
[if test "$withval" != "no"; then [if test "$withval" != "no"; then
if test "$withval" != "yes"; then if test "$withval" != "yes"; then
WRAPCPPFLAGS="-I$withval/include" WRAPCPPFLAGS="-I$withval/include"
WRAPLDFLAGS="-L$withval/lib" if test "$use_dash_r" != "yes"; then
WRAPLDFLAGS="-L$withval/lib"
else
WRAPLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else else
WRAPCPPFLAGS="" WRAPCPPFLAGS=""
WRAPLDFLAGS="" WRAPLDFLAGS=""
@ -427,7 +513,11 @@ AC_ARG_WITH(openssl,
[if test "$withval" != "no"; then [if test "$withval" != "no"; then
if test "$withval" != "yes"; then if test "$withval" != "yes"; then
OPENSSLCPPFLAGS="-I$withval/include" OPENSSLCPPFLAGS="-I$withval/include"
OPENSSLLDFLAGS="-L$withval/lib" if test "$use_dash_r" != "yes"; then
OPENSSLLDFLAGS="-L$withval/lib"
else
OPENSSLLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else else
OPENSSLCPPFLAGS="" OPENSSLCPPFLAGS=""
OPENSSLLDFLAGS="" OPENSSLLDFLAGS=""
@ -457,6 +547,141 @@ AC_ARG_WITH(openssl,
CPPFLAGS="$oCPPFLAGS" CPPFLAGS="$oCPPFLAGS"
LDFLAGS="$oLDFLAGS" LDFLAGS="$oLDFLAGS"
fi fi
AC_MSG_CHECKING(whether to require server cert)
AC_ARG_WITH(req-server-cert,
AS_HELP_STRING([--with-req-server-cert],[Require server SSL certificate by client]),
[case "$withval" in
yes)
AC_DEFINE(REQ_SERVER_CERT)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
fi]
)
cons_with_gssapi="NO"
cons_strip_realm="NO"
AC_ARG_WITH(gssapi,
AS_HELP_STRING([--with-gssapi@<:@=PATH@:>@],
[Compile in GSS-API support]),
[if test "$withval" != "no"; then
if test "$withval" != "yes"; then
GSSAPICPPFLAGS="-I$withval/include"
if test "$use_dash_r" != "yes"; then
GSSAPILDFLAGS="-L$withval/lib"
else
GSSAPILDFLAGS="-L$withval/lib -R$withval/lib"
fi
else
GSSAPICPPFLAGS=""
GSSAPILDFLAGS=""
fi
oCPPFLAGS="$CPPFLAGS"
oLDFLAGS="$LDFLAGS"
oLIBS="$LIBS"
have_gssapi=no
CPPFLAGS="$CPPFLAGS $GSSAPICPPFLAGS"
LDFLAGS="$LDFLAGS $GSSAPILDFLAGS"
AC_CHECK_HEADER([gssapi/gssapi.h],
[LIBS="$oLIBS -lgssapi"
AC_MSG_CHECKING(for gssapi library -lgssapi)
AC_TRY_LINK([#include <gssapi/gssapi.h>
],[gss_create_empty_oid_set(NULL, NULL)],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
have_gssapi=yes],
[AC_MSG_RESULT(no)
LIBS="$oLIBS -lgssglue"
AC_MSG_CHECKING(for gssapi library -lgssglue)
AC_TRY_LINK([#include <gssapi/gssapi.h>
],[gss_create_empty_oid_set(NULL, NULL)],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
have_gssapi=yes],
[AC_MSG_RESULT(no)
LIBS="$oLIBS -lgss"
AC_MSG_CHECKING(for gssapi library -lgss)
AC_TRY_LINK([#include <gssapi/gssapi.h>
],[gss_create_empty_oid_set(NULL, NULL)],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
have_gssapi=yes],
[AC_MSG_RESULT(no)])])])],)
if test $have_gssapi = no; then
LIBS="$oLIBS"
CPPFLAGS="$oCPPFLAGS"
LDFLAGS="$oLDFLAGS"
else
AC_MSG_CHECKING(whether to fallback to username without @REALM)
AC_ARG_WITH(striprealm,
AS_HELP_STRING([--with-striprealm],[retry username without @REALM with gss-api authentication]),
[case "$withval" in
yes)
AC_DEFINE(STRIP_REALM)
AC_MSG_RESULT(yes)
cons_strip_realm="YES"
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
fi
fi]
)
cons_with_freeipmi="NO"
AC_ARG_WITH(freeipmi,
AS_HELP_STRING([--with-freeipmi@<:@=PATH@:>@],
[Compile in FreeIPMI support]),
[if test "$withval" != "no"; then
if test "$withval" != "yes"; then
FREEIPMICPPFLAGS="-I$withval/include"
if test "$use_dash_r" != "yes"; then
FREEIPMILDFLAGS="-L$withval/lib"
else
FREEIPMILDFLAGS="-L$withval/lib -R$withval/lib"
fi
else
FREEIPMICPPFLAGS=""
FREEIPMILDFLAGS=""
fi
oCPPFLAGS="$CPPFLAGS"
oLDFLAGS="$LDFLAGS"
oLIBS="$LIBS"
have_freeipmi=no
CPPFLAGS="$CPPFLAGS $FREEIPMICPPFLAGS"
LDFLAGS="$LDFLAGS $FREEIPMILDFLAGS"
AC_CHECK_HEADER([ipmiconsole.h],
[LIBS="$LIBS -lipmiconsole"
AC_MSG_CHECKING(for freeipmi libraries -lipmiconsole)
AC_TRY_LINK([#include <ipmiconsole.h>
],[ipmiconsole_ctx_fd(0)],
[AC_MSG_RESULT(yes)
cons_with_freeipmi="YES"
AC_DEFINE(HAVE_FREEIPMI)
CONSLIBS="$CONSLIBS -lipmiconsole"
have_freeipmi=yes],
[AC_MSG_RESULT(no)])],)
LIBS="$oLIBS"
if test $have_freeipmi = no; then
CPPFLAGS="$oCPPFLAGS"
LDFLAGS="$oLDFLAGS"
fi
fi] fi]
) )
@ -467,7 +692,11 @@ AC_ARG_WITH(dmalloc,
[if test "$withval" != "no"; then [if test "$withval" != "no"; then
if test "$withval" != "yes"; then if test "$withval" != "yes"; then
DMALLOCCPPFLAGS="-I$withval/include" DMALLOCCPPFLAGS="-I$withval/include"
DMALLOCLDFLAGS="-L$withval/lib" if test "$use_dash_r" != "yes"; then
DMALLOCLDFLAGS="-L$withval/lib"
else
DMALLOCLDFLAGS="-L$withval/lib -R$withval/lib"
fi
else else
DMALLOCCPPFLAGS="" DMALLOCCPPFLAGS=""
DMALLOCLDFLAGS="" DMALLOCLDFLAGS=""
@ -567,6 +796,23 @@ AC_ARG_WITH(pam,
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi],[AC_MSG_RESULT(no)]) fi],[AC_MSG_RESULT(no)])
cons_with_ipv6="NO"
AC_MSG_CHECKING(whether to support IPv6)
AC_ARG_WITH(ipv6,
AS_HELP_STRING([--with-ipv6],
[(experimental) Use IPv6 for client/server communication]),
[case "$withval" in
yes)
AC_DEFINE(USE_IPV6)
AC_MSG_RESULT(yes)
cons_with_ipv6="YES"
;;
*)
AC_MSG_RESULT(no)
;;
esac],[AC_MSG_RESULT(no)])
dnl Checks for pty allocation... dnl Checks for pty allocation...
dnl According to the xemacs distribution: dnl According to the xemacs distribution:
dnl getpt() is the preferred pty allocation method on glibc systems. dnl getpt() is the preferred pty allocation method on glibc systems.
@ -582,8 +828,7 @@ AC_CHECK_HEADERS(pty.h libutil.h util.h)
AC_CHECK_LIB(util, openpty) AC_CHECK_LIB(util, openpty)
AC_CHECK_FUNCS(openpty) AC_CHECK_FUNCS(openpty)
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle) AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle gettimeofday strlcpy)
AC_FUNC_SETPGRP
AC_CHECK_FUNC(strcasecmp, AC_CHECK_FUNC(strcasecmp,
[AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])], [AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])],
[AC_CHECK_FUNC(stricmp, [AC_CHECK_FUNC(stricmp,
@ -605,11 +850,17 @@ AC_OUTPUT
echo "==============================================================" echo "=============================================================="
echo " Feature Summary" echo " Feature Summary"
echo "" echo ""
echo " Unix domain sockets (--with-uds) : $cons_with_uds" echo " Unix domain sockets (--with-uds) : $cons_with_uds"
echo " TCP wrappers (--with-libwrap): $cons_with_libwrap" echo " TCP wrappers (--with-libwrap) : $cons_with_libwrap"
echo " OpenSSL (--with-openssl): $cons_with_openssl" echo " OpenSSL (--with-openssl) : $cons_with_openssl"
echo " dmalloc (--with-dmalloc): $cons_with_dmalloc" echo " GSS-API (--with-gssapi) : $cons_with_gssapi"
echo " PAM support (--with-pam) : $cons_with_pam" echo " FreeIPMI (--with-freeipmi) : $cons_with_freeipmi"
if [ $cons_with_gssapi = "YES" ]; then
echo " strip @REALM (--with-striprealm): $cons_strip_realm"
fi
echo " dmalloc (--with-dmalloc) : $cons_with_dmalloc"
echo " PAM support (--with-pam) : $cons_with_pam"
echo " IPv6 support (--with-ipv6) : $cons_with_ipv6"
echo "" echo ""
echo "==============================================================" echo "=============================================================="
] ]

View File

@ -1,11 +1,11 @@
The two files you need to set up are the conserver.cf and conserver.passwd The two files you need to set up are the conserver.cf and conserver.passwd
files. See the sample conserver.cf and conserver.passwd files files. See the sample conserver.cf and conserver.passwd files for examples
for examples. You can start with those and then modify extensively. (installed in <DATADIR>/examples/conserver). You can start with those and
The man page for conserver.cf and conserver.passwd should explain the then modify extensively. The man page for conserver.cf and conserver.passwd
files with enough detail to get you going. should explain the files with enough detail to get you going.
That's about it. Good luck. That's about it. Good luck.
# #
# $Id: INSTALL,v 1.3 2003/07/04 18:21:21 bryan Exp $ # $Id: INSTALL,v 1.4 2005/05/21 13:47:18 bryan Exp $
# #

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
prefix = @prefix@ prefix = @prefix@
mandir = @mandir@ mandir = @mandir@
@ -24,8 +25,8 @@ distclean: clean
install: install:
$(MKDIR) $(DESTDIR)$(mandir)/man5 $(MKDIR) $(DESTDIR)$(mandir)/man5
$(INSTALL) conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5 $(INSTALL) -m 0644 conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5
$(INSTALL) conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5 $(INSTALL) -m 0644 conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5
$(MKDIR) $(DESTDIR)$(exampledir) $(MKDIR) $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.cf $(DESTDIR)$(exampledir) $(INSTALL) -m 0644 conserver.cf $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.passwd $(DESTDIR)$(exampledir) $(INSTALL) -m 0644 conserver.passwd $(DESTDIR)$(exampledir)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.passwd.man,v 1.10 2004/01/08 16:12:33 bryan Exp $ .\" $Id: conserver.passwd.man,v 1.10 2004/01/08 16:12:33 bryan Exp $
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.1.6" "conserver" .TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.2.1" "conserver"
.SH NAME .SH NAME
conserver.passwd \- user access information for conserver.passwd \- user access information for
.BR conserver (8) .BR conserver (8)

View File

@ -1,273 +1,280 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<META name="generator" content= <META name="generator" content=
"HTML Tidy for Solaris (vers 1st May 2002), see www.w3.org"> "HTML Tidy for Solaris (vers 25 March 2009), see www.w3.org">
<META name="keywords" content= <META name="keywords" content=
"conserver,serial,console,serial console,unix,tty,ttya,ttyb, rs-232,rs232,bryan stansell,stansell,console server,terminal server,headless"> "conserver,serial,console,serial console,unix,tty,ttya,ttyb, rs-232,rs232,bryan stansell,stansell,console server,terminal server,headless">
<META name="author" content= <META name="author" content=
"Bryan Stansell &lt;bryan@conserver.com&gt;"> "Bryan Stansell &lt;bryan@conserver.com&gt;">
<LINK rel="SHORTCUT ICON" href="conserver.ico"> <LINK rel="SHORTCUT ICON" href="conserver.ico">
<LINK rel="icon" href="conserver.ico"> <LINK rel="icon" href="conserver.ico">
<TITLE>Conserver</TITLE> <TITLE>Conserver</TITLE>
<STYLE type="text/css">
<STYLE type="text/css"> body {
body {
background-color: #EEEEEE; background-color: #EEEEEE;
color: black; color: black;
} }
</STYLE> </STYLE>
</HEAD> </HEAD>
<BODY> <BODY>
<TABLE summary="Logo" bgcolor="black" width="100%" align= <TABLE summary="Logo" bgcolor="black" width="100%" align=
"center"> "center">
<TR> <TR>
<TD align="center"><IMG src="conserver.jpg" alt= <TD align="center"><IMG src="conserver.jpg" alt=
"Conserver"><BR> "Conserver"><BR></TD>
</TD> </TR>
</TR> </TABLE>
</TABLE>
<TABLE summary="Conserver Page" width="80%" align="center"> <TABLE summary="Conserver Page" width="80%" align="center">
<TR> <TR>
<TD colspan="2" align="center">Please pick your closest <TD colspan="2" align="center">Please pick your closest
mirror: &nbsp;&nbsp;<A href= mirror: &nbsp;&nbsp;<A href=
"http://planetmirror.com/pub/conserver/">Australia</A> "http://planetmirror.com/pub/conserver/">Australia</A>
&nbsp;&nbsp;<A href="http://www.conserver.com/">US &nbsp;&nbsp;<A href=
(Primary)</A><BR> "http://conserver.linux-mirror.org/">Germany</A>
<BR> &nbsp;&nbsp;<A href="http://conserver.rayba.co/">Germany</A>
</TD> &nbsp;&nbsp;<A href=
</TR> "http://conserver.cybermirror.org/">Germany</A>
&nbsp;&nbsp;<A href=
"http://conserver.oss-mirror.org/">Ireland</A>
&nbsp;&nbsp;<A href="http://conserver.shape.ws/">Malaysia</A>
&nbsp;&nbsp;<A href="http://conserver.rinet.ru/">Russia</A>
&nbsp;&nbsp;<A href="http://www.conserver.com/">US-West
(Primary)</A><BR>
<BR></TD>
</TR>
<TR> <TR>
<TD> <TD>
<!-- empty cell here, then search box on right spans two rows, <!-- empty cell here, then search box on right spans two rows,
then we have the text that appears on the left, so things then we have the text that appears on the left, so things
appear in the right order so they look right in lynx appear in the right order so they look right in lynx
--> --></TD>
</TD>
<TD rowspan="2" align="right"> <TD rowspan="2" align="right">
<FORM method="post" action= <FORM method="get" action=
"http://www.conserver.com/cgi-bin/htsearch"> "http://www.conserver.com/cgi-bin/omega">
<INPUT type="HIDDEN" name="method" value="and"> <INPUT <INPUT type="hidden" name="DEFAULTOP" value="and">
type="HIDDEN" name="format" value="builtin-long"> <INPUT type="text" size="20" name="P" value="">
<INPUT type="HIDDEN" name="sort" value="score"> <INPUT <INPUT type="submit" value="Search">
type="HIDDEN" name="config" value="conserver.com"> </FORM>
<INPUT type="HIDDEN" name="restrict" value=""> <INPUT </TD>
type="HIDDEN" name="exclude" value=""> <INPUT type= </TR>
"TEXT" size="20" name="words" value=""> <INPUT type=
"SUBMIT" value="Search">
</FORM>
</TD>
</TR>
<TR> <TR>
<TD> <TD>
<H3>What is conserver?</H3> <H3>What is conserver?</H3>
</TD> </TD>
</TR> </TR>
<TR> <TR>
<TD colspan="2"> <TD colspan="2">
<P>From an email I once sent...</P> <P>From an email I once sent...</P>
<P>Conserver is an application that allows multiple users <P>Conserver is an application that allows multiple users
to watch a serial console at the same time. It can log to watch a serial console at the same time. It can log the
the data, allows users to take write-access of a console data, allows users to take write-access of a console (one
(one at a time), and has a variety of bells and whistles at a time), and has a variety of bells and whistles to
to accentuate that basic functionality. The idea is that accentuate that basic functionality. The idea is that
conserver will log all your serial traffic so you can go conserver will log all your serial traffic so you can go
back and review why something crashed, look at changes back and review why something crashed, look at changes (if
(if done on the console), or tie the console logs into a done on the console), or tie the console logs into a
monitoring system (just watch the logfiles it creates). monitoring system (just watch the logfiles it creates).
With multi-user capabilities you can work on equipment With multi-user capabilities you can work on equipment with
with others, mentor, train, etc. It also does all that others, mentor, train, etc. It also does all that
client-server stuff so that, assuming you have a network client-server stuff so that, assuming you have a network
connection, you can interact with any of the equipment connection, you can interact with any of the equipment from
from home or wherever.</P> home or wherever.</P>
<H3>The FAQ</H3> <H3>The FAQ</H3>Here's the conserver <A href="FAQ">FAQ</A>.
Here's the conserver <A href="FAQ">FAQ</A>. Got any Got any additions? Let me know.
additions? Let me know.
<H3>Mailing Lists</H3> <H3>Mailing Lists</H3>
<P>There are currently two mailing lists available. <A <P>There are currently two mailing lists available.
href= <A href="mailto:announce@conserver.com">announce@conserver.com</A>
"mailto:announce@conserver.com">announce@conserver.com</A> is an announcement-only mailing list for informing of new
is an announcement-only mailing list for informing of new versions, major developments, etc. <A href=
versions, major developments, etc. <A href= "mailto:users@conserver.com">users@conserver.com</A> is for
"mailto:users@conserver.com">users@conserver.com</A> is general Q&amp;A, discussions, ideas, etc. for conserver
for general Q&amp;A, discussions, ideas, etc. for users. You can sign up by sending a message to <A href=
conserver users. You can sign up by sending a message to "mailto:announce-request@conserver.com">announce-request@conserver.com</A>
<A href= or <A href=
"mailto:announce-request@conserver.com">announce-request@conserver.com</A> "mailto:users-request@conserver.com">users-request@conserver.com</A>
or <A href= with a subject of "subscribe" or head over to the online
"mailto:users-request@conserver.com">users-request@conserver.com</A> <A href="https://www.conserver.com/mailman/listinfo">web
with a subject of "subscribe" or head over to the online pages</A>.</P>
<A href="https://www.conserver.com/mailman/listinfo">web
pages</A>.</P>
<H3>Origin</H3> <H3>Origin</H3>
<P>The console server software found here is a heavily <P>The console server software found here is a heavily
modified version originally written by <A href= modified version originally written by <A href=
"http://hea-www.harvard.edu/~fine/">Tom Fine</A> (<A "http://hea-www.harvard.edu/~fine/">Tom Fine</A> (<A href=
href= "mailto:fine@head-cfa.harvard.edu">fine@head-cfa.harvard.edu</A>)
"mailto:fine@head-cfa.harvard.edu">fine@head-cfa.harvard.edu</A>) at <A href="http://www.ohio-state.edu/">Ohio State</A> and
at <A href="http://www.ohio-state.edu/">Ohio State</A> then Kevin S Braunsdorf (<A href=
and then Kevin S Braunsdorf (<A href= "mailto:ksb+conserver@sa.fedex.com">ksb+conserver@sa.fedex.com</A>)
"mailto:ksb+conserver@sa.fedex.com">ksb+conserver@sa.fedex.com</A>) at <A href="http://www.purdue.edu/">Purdue University</A>.
at <A href="http://www.purdue.edu/">Purdue Patches from Robert Olson (<A href=
University</A>. Patches from Robert Olson (<A href= "mailto:olson@mcs.anl.gov">olson@mcs.anl.gov</A>) at
"mailto:olson@mcs.anl.gov">olson@mcs.anl.gov</A>) at <A <A href="http://www.anl.gov/">Argonne National
href="http://www.anl.gov/">Argonne National Laboratory</A> were then applied to get network console
Laboratory</A> were then applied to get network console support.</P>
support.</P>
<P>Arnold de Leon (<A href= <P>Arnold de Leon (<A href=
"mailto:arnold@corp.webtv.net">arnold@corp.webtv.net</A>) "mailto:arnold@corp.webtv.net">arnold@corp.webtv.net</A>)
then fixed various bugs and added enhancements while at then fixed various bugs and added enhancements while at
<A href="http://www.synopsys.com/">Synopsys</A>. I then <A href="http://www.synopsys.com/">Synopsys</A>. I then
took the result, continued fixing things, and added took the result, continued fixing things, and added
features we found useful.</P> features we found useful.</P>
<P><A href="http://www.gnac.com/">GNAC</A> (Global <P><A href="http://www.gnac.com/">GNAC</A> (Global
Networking and Computing - currently <A href= Networking and Computing - currently <A href=
"http://www.certaintysolutions.com/">Certainty "http://www.certaintysolutions.com/">Certainty
Solutions</A>) has been supporting my coding efforts (in Solutions</A>) has been supporting my coding efforts (in
too many ways to list) since 1996.</P> too many ways to list) since 1996.</P>
<H3>The conserver.com Distribution</H3> <H3>The conserver.com Distribution</H3>
<P>The result is a combination of many people's work. <P>The result is a combination of many people's work. This
This version is being released in hopes that it will help version is being released in hopes that it will help
others. There is no warranty or support implied by the others. There is no warranty or support implied by the
distribution of the software.</P> distribution of the software.</P>
<P>So, what the heck is up with all the different <P>So, what the heck is up with all the different conserver
conserver versions? Well, the original authors are versions? Well, the original authors are continuing to
continuing to distribute their own threads of the distribute their own threads of the software so you have
software so you have three main threads (as far as I three main threads (as far as I know). First, there's Tom
know). First, there's Tom Fine's thread at <A href= Fine's thread at <A href=
"http://hea-www.harvard.edu/~fine/Tech/console-server.html"> "http://hea-www.harvard.edu/~fine/Tech/console-server.html">
http://hea-www.harvard.edu/~fine/Tech/console-server.html</A>. http://hea-www.harvard.edu/~fine/Tech/console-server.html</A>.
He isn't actively developing it, however, according to He isn't actively developing it, however, according to the
the website. Next, there's Kevin Braunsdorf's version at website. Next, there's Kevin Braunsdorf's version at
<A href= <A href=
"ftp://ftp.physics.purdue.edu/pub/pundits/">ftp://ftp.physics.purdue.edu/pub/pundits/</A>. "http://www.npcguild.org/software/pundits/">http://www.npcguild.org/software/pundits/</A>.
It doesn't look like Kevin is working on his thread ony It doesn't look like Kevin is working on his thread ony
more either. No new versions have been out since August more either. No new versions have been out since August
2000 (version 8.5), but maybe this info will be out of 2000 (version 8.5), but maybe this info will be out of date
date by the time you read this (I last checked Feb 10, by the time you read this (I last checked Feb 10, 2004).
2004). Lastly, the conserver.com version is based on Lastly, the conserver.com version is based on Kevin's
Kevin's "5.21-Beta" distribution, but since "5.21-Beta" distribution, but since <B>HEAVILY</B> modified
<B>HEAVILY</B> modified and enhanced (more details in the and enhanced (more details in the "Origin" section
"Origin" section above).</P> above).</P>
<P>If I were looking for a conserver package I would <P>If I were looking for a conserver package I would
definitely use the conserver.com distribution. Why? It's definitely use the conserver.com distribution. Why? It's
actively maintained, has many more features than the actively maintained, has many more features than the other
other versions (see <A href="CHANGES">CHANGES</A> for a versions (see <A href="CHANGES">CHANGES</A> for a
semi-scary history), and has an active user community. semi-scary history), and has an active user community.
Kevin's version does have UPS support (basic serial port Kevin's version does have UPS support (basic serial port
line toggling bits) which is missing in the conserver.com line toggling bits) which is missing in the conserver.com
version, but no one has asked me for it, so does anyone version, but no one has asked me for it, so does anyone
actually need it?</P> actually need it?</P>
<H3>Downloading</H3> <H3>Downloading</H3>
<P>The current version, released on May 25, 2004, is <A <P>The current version, released on Jun 2, 2015, is
href="8.1.6.tar.gz">8.1.6.tar.gz</A>. You can get it via <A href="8.2.1.tar.gz">8.2.1.tar.gz</A>. See the <A href=
<A href= "CHANGES">CHANGES</A> file for information on the latest
"ftp://ftp.conserver.com/conserver/8.1.6.tar.gz">FTP</A> updates.</P>
or <A href="8.1.6.tar.gz">HTTP</A>. See the <A href=
"CHANGES">CHANGES</A> file for information on the latest
updates.</P>
<P>As of version 6.1.7, the packaging and numbering <P>For those worried about legal issues, the <A href=
scheme has changed. I used to package conserver as "LICENSE">LICENSE</A> file should help show it's
conserver-GNAC-v.vv. Since <A href= distributed under a <A href=
"http://www.gnac.com/">GNAC</A> (now <A href= "http://www.opensource.org/licenses/bsd-license.php">BSD
"http://www.certaintysolutions.com/">Certainty license.</A></P>
Solutions</A>) has changed its name I've decided to drop
the GNAC portion and use a three-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>Installation</H3> <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 <A href=
"http://www.gnac.com/">GNAC</A> (now <A href=
"http://www.certaintysolutions.com/">Certainty
Solutions</A>) has changed its name I've decided to drop
the GNAC portion and use a three-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>
<P>Check the <A href="INSTALL">INSTALL</A> file for <H3>Installation</H3>
instructions.</P>
<H3>Online Documentation</H3> <P>Check the <A href="INSTALL">INSTALL</A> file for
instructions.</P>
<P>I've put a small set of documentation <A href= <H3>Online Documentation</H3>
"docs/">here</A>. I'm hoping to expand it over time.</P>
<H3>Systems Tested</H3> <P>I've put a small set of documentation <A href=
"docs/">here</A>. I'm hoping to expand it over time.</P>
<P>Here's a list of systems that I've been told can <H3>Systems Tested</H3>
successfully compile conserver. If anyone has more to add
to this list (or something on the list doesn't work any
more), please let me know.</P>
<UL> <P>Here's a list of systems that I've been told can
<LI>AIX 4.3.3/5.1/5.2, native cc</LI> successfully compile conserver. If anyone has more to add
to this list (or something on the list doesn't work any
more), please let me know.</P>
<LI>BSDI BSD/OS 3.X, gcc</LI> <UL>
<LI>AIX 4.3.3/5.1/5.2, native cc</LI>
<LI>Cygwin (w2k),gcc 2.95.3</LI> <LI>BSDI BSD/OS 3.X, gcc</LI>
<LI>DEC Tru64 4.0, gcc</LI> <LI>Cygwin (w2k),gcc 2.95.3</LI>
<LI>DEC Tru64 4.0/5.1, native cc</LI> <LI>DEC Tru64 4.0, gcc</LI>
<LI>FreeBSD 4.2/4.8/5.1 (x86), gcc</LI> <LI>DEC Tru64 4.0/5.1, native cc</LI>
<LI>HP-UX 10.20, gcc</LI> <LI>FreeBSD 4.x (i386) gcc</LI>
<LI>HP-UX 11.10 parisc and ia64, native cc</LI> <LI>FreeBSD 5.x (i386/amd64/sparc64) gcc</LI>
<LI>Irix 6.15, native cc</LI> <LI>FreeBSD 6.x/7.x (i386/amd64/sparc64/ia64) gcc</LI>
<LI>Linux 2.2.18 (x86), gcc</LI> <LI>HP-UX 10.20, gcc</LI>
<LI>Linux 2.4.2 (x86), gcc</LI> <LI>HP-UX 11.10 parisc and ia64, native cc</LI>
<LI>Linux ia64, native gcc</LI> <LI>Irix 6.15, native cc</LI>
<LI>Linux RedHat 6.2 and 7.2 (x86), native gcc</LI> <LI>Linux 2.2.18 (x86), gcc</LI>
<LI>MacOS X, native gcc</LI> <LI>Linux 2.4.2 (x86), gcc</LI>
<LI>Solaris 2.5.1 thru 9 (sparc/x86), gcc</LI> <LI>Linux ia64, native gcc</LI>
<LI>Solaris 7/8, native cc</LI> <LI>Linux RedHat 6.2 and 7.2 (x86), native gcc</LI>
</UL>
<H3>Other Good Information</H3> <LI>MacOS X, native gcc</LI>
<P>Zonker Harris has fabulous documents regarding the <LI>Solaris 2.5.1 thru 9 (sparc/x86), gcc</LI>
hookup of consoles to terminal servers and other such
devices. His <A href="consoles/">Greater Scroll of
Console Knowledge</A> is a great place to start.</P>
<HR noshade>
<ADDRESS> <LI>Solaris 7/8, native cc</LI>
Bryan Stansell (<A href=
"mailto:bryan@conserver.com">bryan@conserver.com</A>)<BR>
</ADDRESS> <LI>Solaris 10 and Solaris Express (build 33) (x86), gcc
</TD> and native cc</LI>
</TR> </UL>
</TABLE>
</BODY> <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="consoles/">Greater Scroll of Console
Knowledge</A> is a great place to start.</P>
<P>User community <A href="contrib/">contributions</A>
contain a variety of helpful items.</P>
<HR noshade>
<ADDRESS>
Bryan Stansell (<A href=
"mailto:bryan@conserver.com">bryan@conserver.com</A>)<BR>
</ADDRESS>
</TD>
</TR>
</TABLE>
</BODY>
</HTML> </HTML>

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@
@ -7,6 +8,8 @@ sbindir = @sbindir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
mandir = @mandir@ mandir = @mandir@
datadir = @datadir@ datadir = @datadir@
libdir = @libdir@
pkglibdir = $(libdir)/conserver
exampledir = $(datadir)/examples/conserver exampledir = $(datadir)/examples/conserver
### Installation programs and flags ### Installation programs and flags
@ -60,8 +63,10 @@ install: conserver
$(MKDIR) $(DESTDIR)$(sbindir) $(MKDIR) $(DESTDIR)$(sbindir)
$(INSTALL_PROGRAM) conserver $(DESTDIR)$(sbindir) $(INSTALL_PROGRAM) conserver $(DESTDIR)$(sbindir)
$(MKDIR) $(DESTDIR)$(mandir)/man8 $(MKDIR) $(DESTDIR)$(mandir)/man8
$(INSTALL) conserver.man $(DESTDIR)$(mandir)/man8/conserver.8 $(INSTALL) -m 0644 conserver.man $(DESTDIR)$(mandir)/man8/conserver.8
$(MKDIR) $(DESTDIR)$(exampledir) $(MKDIR) $(DESTDIR)$(exampledir)
$(INSTALL) conserver.rc $(DESTDIR)$(exampledir) $(INSTALL) conserver.rc $(DESTDIR)$(exampledir)
$(MKDIR) $(DESTDIR)$(pkglibdir)
$(INSTALL) convert $(DESTDIR)$(pkglibdir)/convert
.PHONY: clean distclean install .PHONY: clean distclean install

View File

@ -1,5 +1,5 @@
/* /*
* $Id: access.c,v 5.73 2004/05/23 16:44:25 bryan Exp $ * $Id: access.c,v 5.74 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -44,7 +44,14 @@
#include <readcfg.h> #include <readcfg.h>
#include <main.h> #include <main.h>
#if USE_IPV6
# include <net/if.h>
# include <ifaddrs.h>
# include <sys/socket.h>
# include <netdb.h>
#endif
#if !USE_IPV6
/* Compare an Internet address (IPv4 expected), with an address pattern /* Compare an Internet address (IPv4 expected), with an address pattern
* passed as a character string representing an address in the Internet * passed as a character string representing an address in the Internet
* standard `.' notation, optionally followed by a slash and an integer * standard `.' notation, optionally followed by a slash and an integer
@ -58,20 +65,14 @@
* Returns 0 if the addresses match, else returns 1. * Returns 0 if the addresses match, else returns 1.
*/ */
int int
#if PROTOTYPES
AddrCmp(struct in_addr *addr, char *pattern) AddrCmp(struct in_addr *addr, char *pattern)
#else
AddrCmp(addr, pattern)
struct in_addr *addr;
char *pattern;
#endif
{ {
in_addr_t hostaddr, pattern_addr, netmask; in_addr_t hostaddr, pattern_addr, netmask;
char *p, *slash_posn; char *p, *slash_posn;
static STRING *buf = (STRING *)0; static STRING *buf = (STRING *)0;
#if HAVE_INET_ATON # if HAVE_INET_ATON
struct in_addr inetaddr; struct in_addr inetaddr;
#endif # endif
if (buf == (STRING *)0) if (buf == (STRING *)0)
buf = AllocString(); buf = AllocString();
@ -84,15 +85,15 @@ AddrCmp(addr, pattern)
} else } else
p = pattern; p = pattern;
#if HAVE_INET_ATON # if HAVE_INET_ATON
if (inet_aton(p, &inetaddr) == 0) if (inet_aton(p, &inetaddr) == 0)
return 1; return 1;
pattern_addr = inetaddr.s_addr; pattern_addr = inetaddr.s_addr;
#else # else
pattern_addr = inet_addr(p); pattern_addr = inet_addr(p);
if (pattern_addr == (in_addr_t) (-1)) if (pattern_addr == (in_addr_t) (-1))
return 1; /* malformed address */ return 1; /* malformed address */
#endif # endif
if (slash_posn) { if (slash_posn) {
/* convert explicit netmask */ /* convert explicit netmask */
@ -121,33 +122,70 @@ AddrCmp(addr, pattern)
pattern_addr & netmask, pattern_addr, netmask)); pattern_addr & netmask, pattern_addr, netmask));
return (hostaddr & netmask) != (pattern_addr & netmask); return (hostaddr & netmask) != (pattern_addr & netmask);
} }
#endif /* USE_IPV6 */
/* return the access type for a given host entry (ksb) /* return the access type for a given host entry (ksb)
*/ */
char char
#if PROTOTYPES AccType(INADDR_STYPE *addr, char **peername)
AccType(struct in_addr *addr, char **peername)
#else
AccType(addr, peername)
struct in_addr *addr;
char **peername;
#endif
{ {
ACCESS *pACtmp; ACCESS *pACtmp;
socklen_t so; socklen_t so;
char ret;
#if USE_IPV6
int error;
char host[NI_MAXHOST];
char ipaddr[NI_MAXHOST];
#else
struct hostent *he = (struct hostent *)0; struct hostent *he = (struct hostent *)0;
int a; int a;
char ret; # if TRUST_REVERSE_DNS
#if TRUST_REVERSE_DNS
char **revNames = (char **)0; char **revNames = (char **)0;
#endif # endif
CONDDEBUG((1, "AccType(): ip=%s", inet_ntoa(*addr))); CONDDEBUG((1, "AccType(): ip=%s", inet_ntoa(*addr)));
#endif /* USE_IPV6 */
ret = config->defaultaccess; ret = config->defaultaccess;
so = sizeof(*addr); so = sizeof(*addr);
#if TRUST_REVERSE_DNS #if USE_IPV6
error =
getnameinfo((struct sockaddr *)addr, so, ipaddr, sizeof(ipaddr),
NULL, 0, NI_NUMERICHOST);
if (error) {
Error("AccType(): getnameinfo failed: %s", gai_strerror(error));
goto common_ret;
}
CONDDEBUG((1, "AccType(): ip=%s", ipaddr));
error =
getnameinfo((struct sockaddr *)addr, so, host, sizeof(host), NULL,
0, 0);
if (!error)
CONDDEBUG((1, "AccType(): host=%s", host));
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
pACtmp->ctrust));
if (strstr(ipaddr, pACtmp->pcwho) != NULL) {
CONDDEBUG((1, "AccType(): match for ip=%s", ipaddr));
ret = pACtmp->ctrust;
goto common_ret;
}
if (!error && strstr(host, pACtmp->pcwho) != NULL) {
CONDDEBUG((1, "AccType(): match for host=%s", host));
ret = pACtmp->ctrust;
goto common_ret;
}
}
common_ret:
if (config->loghostnames == FLAGTRUE && !error)
*peername = StrDup(host);
#else
# if TRUST_REVERSE_DNS
/* if we trust reverse dns, we get the names associated with /* if we trust reverse dns, we get the names associated with
* the address we're checking and then check each of those * the address we're checking and then check each of those
* against the access list entries (below). * against the access list entries (below).
@ -177,7 +215,7 @@ AccType(addr, peername)
} }
} }
} }
#endif # endif
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) { for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho, CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
@ -203,20 +241,20 @@ AccType(addr, peername)
inet_ntoa(*(struct in_addr *) inet_ntoa(*(struct in_addr *)
(he->h_addr_list[a])))); (he->h_addr_list[a]))));
if ( if (
#if HAVE_MEMCMP # if HAVE_MEMCMP
memcmp(&(addr->s_addr), he->h_addr_list[a], memcmp(&(addr->s_addr), he->h_addr_list[a],
he->h_length) he->h_length)
#else # else
bcmp(&(addr->s_addr), he->h_addr_list[a], bcmp(&(addr->s_addr), he->h_addr_list[a],
he->h_length) he->h_length)
#endif # endif
== 0) { == 0) {
ret = pACtmp->ctrust; ret = pACtmp->ctrust;
goto common_ret; goto common_ret;
} }
} }
} }
#if TRUST_REVERSE_DNS # if TRUST_REVERSE_DNS
/* we chop bits off client names so that we can put domain /* we chop bits off client names so that we can put domain
* names in access lists or even top-level domains. * names in access lists or even top-level domains.
* allowed conserver.com, net; * allowed conserver.com, net;
@ -245,43 +283,49 @@ AccType(addr, peername)
} }
} }
} }
#endif # endif
} }
common_ret: common_ret:
if (config->loghostnames == FLAGTRUE && peername != (char **)0) { if (config->loghostnames == FLAGTRUE && peername != (char **)0) {
#if TRUST_REVERSE_DNS # if TRUST_REVERSE_DNS
if (revNames != (char **)0 && revNames[0] != (char *)0) if (revNames != (char **)0 && revNames[0] != (char *)0)
*peername = StrDup(revNames[0]); *peername = StrDup(revNames[0]);
#else # else
if ((he = if ((he =
gethostbyaddr((char *)addr, so, gethostbyaddr((char *)addr, so,
AF_INET)) != (struct hostent *)0) { AF_INET)) != (struct hostent *)0) {
*peername = StrDup(he->h_name); *peername = StrDup(he->h_name);
} }
#endif # endif
} }
#if TRUST_REVERSE_DNS # if TRUST_REVERSE_DNS
common_ret2: common_ret2:
if (revNames != (char **)0) { if (revNames != (char **)0) {
for (a = 0; revNames[a] != (char *)0; a++) for (a = 0; revNames[a] != (char *)0; a++)
free(revNames[a]); free(revNames[a]);
free(revNames); free(revNames);
} }
#endif # endif
#endif /* USE_IPV6 */
return ret; return ret;
} }
void void
#if PROTOTYPES SetDefAccess(
SetDefAccess(struct in_addr *pAddr, char *pHost) #if USE_IPV6
void
#else #else
SetDefAccess(pAddr, pHost) struct in_addr *pAddr, char *pHost
struct in_addr *pAddr;
char *pHost;
#endif #endif
)
{ {
ACCESS *a; ACCESS *a;
#if USE_IPV6
int error;
char addr[NI_MAXHOST];
struct ifaddrs *myAddrs, *ifa;
#endif /* USE_IPV6 */
while (pACList != (ACCESS *)0) { while (pACList != (ACCESS *)0) {
a = pACList->pACnext; a = pACList->pACnext;
@ -289,7 +333,39 @@ SetDefAccess(pAddr, pHost)
pACList = a; pACList = a;
} }
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6
/* get list of all addresses on system */
error = getifaddrs(&myAddrs);
if (error) {
Error("SetDefAccess(): getifaddrs: %s", strerror(errno));
return;
}
for (ifa = myAddrs; ifa != NULL; ifa = ifa->ifa_next) {
/* skip interfaces without address or in down state */
if (ifa->ifa_addr == NULL || !(ifa->ifa_flags & IFF_UP))
continue;
error =
getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_storage),
addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
if (error)
continue;
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
OutOfMem();
if ((a->pcwho = StrDup(addr)) == (char *)0)
OutOfMem();
a->ctrust = 'a';
a->pACnext = pACList;
pACList = a;
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
pACList->pcwho));
}
freeifaddrs(myAddrs);
#elif USE_UNIX_DOMAIN_SOCKETS
if ((pACList = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0) if ((pACList = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
OutOfMem(); OutOfMem();
if ((pACList->pcwho = StrDup("127.0.0.1")) == (char *)0) if ((pACList->pcwho = StrDup("127.0.0.1")) == (char *)0)
@ -318,12 +394,7 @@ SetDefAccess(pAddr, pHost)
} }
void void
#if PROTOTYPES
DestroyAccessList(ACCESS *pACList) DestroyAccessList(ACCESS *pACList)
#else
DestroyAccessList(pACList)
ACCESS *pACList;
#endif
{ {
if (pACList == (ACCESS *)0) if (pACList == (ACCESS *)0)
return; return;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: access.h,v 5.26 2003/08/10 18:11:20 bryan Exp $ * $Id: access.h,v 5.27 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -44,6 +44,12 @@ typedef struct access {
struct access *pACnext; /* next access list */ struct access *pACnext; /* next access list */
} ACCESS; } ACCESS;
extern char AccType PARAMS((struct in_addr *, char **)); extern char AccType(INADDR_STYPE *, char **);
extern void SetDefAccess PARAMS((struct in_addr *, char *)); extern void SetDefAccess(
extern void DestroyAccessList PARAMS((ACCESS *)); #if USE_IPV6
void
#else
struct in_addr *, char *
#endif
);
extern void DestroyAccessList(ACCESS *);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: client.c,v 5.83 2004/04/13 18:12:00 bryan Exp $ * $Id: client.c,v 5.98 2015/06/02 17:19:31 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -41,10 +41,16 @@
#include <access.h> #include <access.h>
#include <client.h> #include <client.h>
#include <group.h> #include <group.h>
#include <readcfg.h>
#if USE_IPV6
# include <sys/socket.h>
# include <netdb.h>
#endif /* USE_IPV6 */
#if defined(USE_LIBWRAP) #if defined(USE_LIBWRAP)
#include <syslog.h> # include <syslog.h>
#include <tcpd.h> # include <tcpd.h>
int allow_severity = LOG_INFO; int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING; int deny_severity = LOG_WARNING;
#endif #endif
@ -53,214 +59,171 @@ int deny_severity = LOG_WARNING;
/* find the next guy who wants to write on the console (ksb) /* find the next guy who wants to write on the console (ksb)
*/ */
void void
#if PROTOTYPES
FindWrite(CONSENT *pCE) FindWrite(CONSENT *pCE)
#else
FindWrite(pCE)
CONSENT *pCE;
#endif
{ {
CONSCLIENT *pCLfound = (CONSCLIENT *)0;
CONSCLIENT *pCL; CONSCLIENT *pCL;
/* make the first guy to have the `want write' bit set the writer /* make the first guy (last on the list) to have the `want write' bit set
* (tell him of the promotion, too) we could look for the * the writer (tell him of the promotion, too) we could look for the most
* most recent or some such... I guess it doesn't matter that * recent or some such... I guess it doesn't matter that much.
* much.
*/ */
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly || if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly)
!(pCE->fup && pCE->ioState == ISNORMAL &&
pCE->initfile == (CONSFILE *)0))
return; return;
for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) { for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
if (!pCL->fwantwr || pCL->fro) if (pCL->fwantwr && !pCL->fro)
continue; pCLfound = pCL;
pCL->fwantwr = 0; }
pCL->fwr = 1;
if (pCLfound != (CONSCLIENT *)0) {
pCLfound->fwantwr = 0;
pCLfound->fwr = 1;
if (pCE->nolog) { if (pCE->nolog) {
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached (nologging)]\r\n", FileWrite(pCLfound->fd, FLAGFALSE,
-1); "\r\n[attached (nologging)]\r\n", -1);
} else { } else {
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached]\r\n", -1); FileWrite(pCLfound->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
} }
TagLogfileAct(pCE, "%s attached", pCL->acid->string); TagLogfileAct(pCE, "%s attached", pCLfound->acid->string);
pCE->pCLwr = pCL; pCE->pCLwr = pCLfound;
return;
} }
} }
/* replay last iBack lines of the log file upon connect to console (ksb) void
BumpClient(CONSENT *pCE, char *message)
{
if ((CONSCLIENT *)0 == pCE->pCLwr)
return;
if ((char *)0 != message)
FileWrite(pCE->pCLwr->fd, FLAGFALSE, message, -1);
pCE->pCLwr->fwantwr = 0;
pCE->pCLwr->fwr = 0;
pCE->pCLwr = (CONSCLIENT *)0;
}
/* replay last 'back' lines of the log file upon connect to console (ksb)
* *
* NB: we know the console might be spewing when the replay happens, * NB: we know the console might be spewing when the replay happens,
* we want to just output what is in the log file and get out, * we want to just output what is in the log file and get out,
* so we don't drop chars... * so we don't drop chars...
*/ */
#define REPLAYBUFFER 4096
void void
#if PROTOTYPES Replay(CONSENT *pCE, CONSFILE *fdOut, unsigned short back)
Replay(CONSENT *pCE, CONSFILE *fdOut, int iBack)
#else
Replay(pCE, fdOut, iBack)
CONSENT *pCE;
CONSFILE *fdOut;
int iBack;
#endif
{ {
CONSFILE *fdLog = (CONSFILE *)0; CONSFILE *fdLog = (CONSFILE *)0;
STRING *line = (STRING *)0;
off_t file_pos; off_t file_pos;
off_t buf_pos; off_t buf_pos;
char *buf; char *buf = (char *)0;
char *bp = (char *)0; char *bp = (char *)0;
char *s;
int r;
int ch; int ch;
struct stat stLog; struct stat stLog;
struct lines {
int is_mark;
STRING *line;
STRING *mark_end;
} *lines;
int n_lines;
int ln; int ln;
int i; int was_mark = 0;
int j;
int u;
int is_mark;
char dummy[4];
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY #if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
unsigned long dmallocMarkReplay = 0; unsigned long dmallocMarkReplay = 0;
#endif #endif
if (pCE != (CONSENT *)0) { if (pCE != (CONSENT *)0 && pCE->logfile != (char *)0)
fdLog = pCE->fdlog; fdLog = FileOpen(pCE->logfile, O_RDONLY, 0644);
/* no logfile and down and logfile defined? try and open it */
if (fdLog == (CONSFILE *)0 && !pCE->fup &&
pCE->logfile != (char *)0)
fdLog = FileOpen(pCE->logfile, O_RDONLY, 0644);
}
if (fdLog == (CONSFILE *)0) { if (fdLog == (CONSFILE *)0) {
FileWrite(fdOut, FLAGFALSE, "[no log file on this console]\r\n", FileWrite(fdOut, FLAGFALSE, "[no log file on this console]\r\n",
-1); -1);
return; return;
} }
/* find the size of the file
*/
if (0 != FileStat(fdLog, &stLog)) {
return;
}
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY #if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
dmallocMarkReplay = dmalloc_mark(); dmallocMarkReplay = dmalloc_mark();
#endif #endif
file_pos = stLog.st_size - 1; /* find the size of the file
*/
if (0 != FileStat(fdLog, &stLog))
goto common_exit;
file_pos = stLog.st_size - 1; /* point at last byte */
buf_pos = file_pos + 1; buf_pos = file_pos + 1;
/* get space for the line information and initialize it if ((char *)0 == (buf = malloc(REPLAYBUFFER)))
*
* we allocate room for one more line than requested to be able to
* do the mark ranges
*/
if ((char *)0 == (buf = malloc(BUFSIZ))) {
OutOfMem(); OutOfMem();
} bp = buf + 1; /* just give it something - it resets below */
n_lines = iBack + 1;
lines = (struct lines *)calloc(n_lines, sizeof(*lines)); line = AllocString();
if ((struct lines *)0 == lines) {
OutOfMem();
}
for (i = 0; i < n_lines; i++) {
lines[i].mark_end = AllocString();
lines[i].line = AllocString();
}
ln = -1;
/* loop as long as there is data in the file or we have not found /* loop as long as there is data in the file or we have not found
* the requested number of lines * the requested number of lines
*/ */
while (file_pos >= 0) { ln = -1;
for (; file_pos >= 0; file_pos--, bp--) {
if (file_pos < buf_pos) { if (file_pos < buf_pos) {
int r;
/* read one buffer worth of data a buffer boundary /* read one buffer worth of data a buffer boundary
* *
* the first read will probably not get a full buffer but * the first read will probably not get a full buffer but
* the rest (as we work our way back in the file) should be * the rest (as we work our way back in the file) should be
*/ */
buf_pos = (file_pos / BUFSIZ) * BUFSIZ; buf_pos = (file_pos / REPLAYBUFFER) * REPLAYBUFFER;
if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) { if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
goto common_exit; goto common_exit;
} }
if ((r = FileRead(fdLog, buf, BUFSIZ)) < 0) { if ((r = FileRead(fdLog, buf, REPLAYBUFFER)) < 0) {
goto common_exit; goto common_exit;
} }
bp = buf + r; bp = buf + r - 1;
} }
/* process the next character /* process the next character
*/ */
--file_pos; if ((ch = *bp) == '\n') {
if ((ch = *--bp) == '\n') {
if (ln >= 0) { if (ln >= 0) {
int i;
int u;
int is_mark = 0;
/* reverse the text to put it in forward order /* reverse the text to put it in forward order
*/ */
u = lines[ln].line->used - 1; u = line->used - 1;
for (i = 0; i < u / 2; i++) { for (i = 0; i < u / 2; i++) {
int temp; int temp;
temp = lines[ln].line->string[i]; temp = line->string[i];
lines[ln].line->string[i] line->string[i] = line->string[u - i - 1];
= lines[ln].line->string[u - i - 1]; line->string[u - i - 1] = temp;
lines[ln].line->string[u - i - 1] = temp;
} }
/* see if this line is a MARK /* see if this line is a MARK
*/ */
if (lines[ln].line->used > 0 && if (line->used > 0 && line->string[0] == '[') {
lines[ln].line->string[0] == '[') { char dummy[4];
i = sscanf(lines[ln].line->string + 1, int j;
i = sscanf(line->string + 1,
"-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n", "-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n",
dummy, dummy, &j, &j, &j, &j, &j); dummy, dummy, &j, &j, &j, &j, &j);
is_mark = (i == 7); is_mark = (i == 7);
} else {
is_mark = 0;
} }
/* process this line /* process this line
*/ */
if (is_mark && ln > 0 && lines[ln - 1].is_mark) { if (is_mark && was_mark) {
/* this is a mark and the previous line is also /* this is a mark and the previous line is also
* a mark, so make (or continue) that range * a mark, so reduce the line count 'cause it'll
* go up by one and we're joining them on output.
*/ */
if (0 == lines[ln - 1].mark_end->allocated) {
/* this is a new range - shuffle pointers
*
* remember that we are moving backward
*/
*(lines[ln - 1].mark_end) = *(lines[ln - 1].line);
InitString(lines[ln - 1].line);
}
/* if unallocated, cheat and shuffle pointers */
if (0 == lines[ln - 1].line->allocated) {
*(lines[ln - 1].line) = *(lines[ln].line);
InitString(lines[ln].line);
} else {
BuildString((char *)0, lines[ln - 1].line);
BuildStringN(lines[ln].line->string,
lines[ln].line->used - 1,
lines[ln - 1].line);
BuildString((char *)0, lines[ln].line);
}
ln--; ln--;
} }
lines[ln].is_mark = is_mark; was_mark = is_mark;
} }
/* advance to the next line and break if we have enough /* advance to the next line and break if we have enough
*/ */
ln++; ln++;
if (ln >= n_lines - 1) { BuildString((char *)0, line);
if (ln >= back) {
break; break;
} }
} }
@ -271,90 +234,122 @@ Replay(pCE, fdOut, iBack)
if (ln < 0) { if (ln < 0) {
ln = 0; ln = 0;
} }
BuildStringChar(ch, lines[ln].line); BuildStringChar(ch, line);
/* if we've processed "a lot" of data for a line, then bail /* if we've processed "a lot" of data for a line, then bail
* why? there must be some very long non-newline terminated * why? there must be some very long non-newline terminated
* strings and if we just keep going back, we could spew lots * strings and if we just keep going back, we could spew lots
* of data and chew up lots of memory * of data and chew up lots of memory
*/ */
if (lines[ln].line->used > MAXREPLAYLINELEN) { if (line->used > MAXREPLAYLINELEN) {
break; break;
} }
} }
free(buf);
buf = (char *)0;
/* if we got back to beginning of file but saw some data, include it /* move forward. either we hit the beginning of the file and we
* move to the first byte, or we hit a \n and we move past it
*/ */
if (ln >= 0 && lines[ln].line->used > 0) { file_pos++;
/* reverse the text to put it in forward order /* Now output the lines, starting from where we stopped */
*/ if (FileSeek(fdLog, file_pos, SEEK_SET) >= 0) {
u = lines[ln].line->used - 1; int eof = 0;
for (i = 0; i < u / 2; i++) { int i = 0;
int temp; int r = 0;
STRING *mark_beg = (STRING *)0;
STRING *mark_end = (STRING *)0;
temp = lines[ln].line->string[i]; mark_beg = AllocString();
lines[ln].line->string[i] mark_end = AllocString();
= lines[ln].line->string[u - i - 1];
lines[ln].line->string[u - i - 1] = temp; ln = 0; /* number of lines output */
BuildString((char *)0, line);
while (ln < back && !eof) {
if (r <= 0) {
if ((r = FileRead(fdLog, buf, REPLAYBUFFER)) < 0)
eof = 1;
i = 0;
}
if (!eof)
BuildStringChar(buf[i], line);
if (buf[i] == '\n' || eof) {
int is_mark = 0;
if (line->used > 0 && line->string[0] == '[') {
char dummy[4];
int j;
int i;
i = sscanf(line->string + 1,
"-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n",
dummy, dummy, &j, &j, &j, &j, &j);
is_mark = (i == 7);
}
if (is_mark) {
if (mark_beg->used > 1) {
BuildString((char *)0, mark_end);
BuildString(line->string, mark_end);
} else
BuildString(line->string, mark_beg);
} else {
if (mark_beg->used > 1) {
if (mark_end->used > 1) {
char *s;
/* output the start of the range, stopping at the ']' */
s = strrchr(mark_beg->string, ']');
if ((char *)0 != s)
*s = '\000';
FileWrite(fdOut, FLAGTRUE, mark_beg->string,
-1);
FileWrite(fdOut, FLAGTRUE, " .. ", 4);
/* build the end string by removing the leading "[-- MARK -- "
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
*/
s = strrchr(mark_end->string, ']');
if ((char *)0 != s)
*s = '\000';
FileWrite(fdOut, FLAGTRUE,
mark_end->string +
sizeof("[-- MARK -- ") - 1, -1);
FileWrite(fdOut, FLAGFALSE, " -- MARK --]\r\n",
-1);
} else {
FileWrite(fdOut, FLAGFALSE, mark_beg->string,
mark_beg->used - 1);
}
BuildString((char *)0, mark_beg);
BuildString((char *)0, mark_end);
ln++;
if (ln >= back)
break;
}
FileWrite(fdOut, FLAGFALSE, line->string,
line->used - 1);
ln++;
}
BuildString((char *)0, line);
}
/* move the counters */
i++;
r--;
} }
ln++; DestroyString(mark_end);
} DestroyString(mark_beg);
/* copy the lines into the buffer and put them in order
*/
for (i = ln - 1; i >= 0; i--) {
if (lines[i].is_mark && 0 != lines[i].mark_end->used) {
int mark_len;
/* output the start of the range, stopping at the ']'
*/
s = strrchr(lines[i].line->string, ']');
if ((char *)0 != s) {
*s = '\000';
}
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
FileWrite(fdOut, FLAGTRUE, " .. ", 4);
/* build the end string by removing the leading "[-- MARK -- "
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
*/
mark_len = sizeof("[-- MARK -- ") - 1;
s = strrchr(lines[i].mark_end->string + mark_len, ']');
if ((char *)0 != s) {
*s = '\000';
}
FileWrite(fdOut, FLAGTRUE,
lines[i].mark_end->string + mark_len, -1);
FileWrite(fdOut, FLAGFALSE, " -- MARK --]\r\n", -1);
u = lines[i].mark_end->used;
s = lines[i].mark_end->string;
} else
FileWrite(fdOut, FLAGFALSE, lines[i].line->string,
lines[i].line->used - 1);
} }
common_exit: common_exit:
/* if we opened the logfile, close it */ if (line != (STRING *)0)
if (fdLog != pCE->fdlog) DestroyString(line);
if (buf != (char *)0)
free(buf);
if (fdLog != (CONSFILE *)0)
FileClose(&fdLog); FileClose(&fdLog);
if ((struct lines *)0 != lines) {
for (i = 0; i < n_lines; i++) {
DestroyString(lines[i].mark_end);
DestroyString(lines[i].line);
}
free(lines);
lines = (struct lines *)0;
}
if ((char *)0 != buf) {
free(buf);
buf = (char *)0;
}
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY #if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
CONDDEBUG((1, "Replay(): dmalloc / MarkReplay")); CONDDEBUG((1, "Replay(): dmalloc / MarkReplay"));
dmalloc_log_changed(dmallocMarkReplay, 1, 0, 1); dmalloc_log_changed(dmallocMarkReplay, 1, 0, 1);
@ -368,6 +363,7 @@ Replay(pCE, fdOut, iBack)
#define WHEN_ATTACH 0x02 #define WHEN_ATTACH 0x02
#define WHEN_EXPERT 0x04 /* ZZZ no way to set his yet */ #define WHEN_EXPERT 0x04 /* ZZZ no way to set his yet */
#define WHEN_ALWAYS 0x40 #define WHEN_ALWAYS 0x40
#define IS_LIMITED 0x100
#define HALFLINE 40 #define HALFLINE 40
@ -377,48 +373,45 @@ typedef struct HLnode {
} HELP; } HELP;
static HELP aHLTable[] = { static HELP aHLTable[] = {
{WHEN_ALWAYS, ". disconnect"}, {WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS, "; move to another console"}, {WHEN_ALWAYS | IS_LIMITED, "; move to another console"},
{WHEN_ALWAYS, "a attach read/write"}, {WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"}, {WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"}, {WHEN_ATTACH, "c toggle flow control"},
{WHEN_ATTACH, "d down a console"}, {WHEN_ATTACH, "d down a console"},
{WHEN_ALWAYS, "e change escape sequence"}, {WHEN_ALWAYS, "e change escape sequence"},
{WHEN_ALWAYS, "f force attach read/write"}, {WHEN_ALWAYS, "f force attach read/write"},
{WHEN_ALWAYS, "g group info"}, {WHEN_ALWAYS, "g group info"},
{WHEN_ALWAYS, "i information dump"}, {WHEN_ALWAYS, "i information dump"},
{WHEN_ATTACH, "L toggle logging on/off"}, {WHEN_ATTACH, "L toggle logging on/off"},
{WHEN_ATTACH, "l? break sequence list"}, {WHEN_ATTACH, "l? break sequence list"},
{WHEN_ATTACH, "l0 send break per config file"}, {WHEN_ATTACH, "l0 send break per config file"},
{WHEN_ATTACH, "l1-9 send specific break sequence"}, {WHEN_ATTACH, "l1-9a-z send specific break sequence"},
{WHEN_ALWAYS, "m display the message of the day"}, {WHEN_ALWAYS, "m display message of the day"},
{WHEN_ALWAYS, "o (re)open the tty and log file"}, {WHEN_ALWAYS, "n write a note to the logfile"},
{WHEN_ALWAYS, "p replay the last 60 lines"}, {WHEN_ALWAYS, "o (re)open the tty and log file"},
{WHEN_ALWAYS, "r replay the last 20 lines"}, {WHEN_ALWAYS, "p playback the last %hu lines"},
{WHEN_ATTACH, "s spy read only"}, {WHEN_ALWAYS, "P set number of playback lines"},
{WHEN_ALWAYS, "u show host status"}, {WHEN_ALWAYS, "r replay the last %hu lines"},
{WHEN_ALWAYS, "v show version info"}, {WHEN_ALWAYS, "R set number of replay lines"},
{WHEN_ALWAYS, "w who is on this console"}, {WHEN_ATTACH, "s spy mode (read only)"},
{WHEN_ALWAYS, "x show console baud info"}, {WHEN_ALWAYS, "u show host status"},
{WHEN_ALWAYS, "z suspend the connection"}, {WHEN_ALWAYS, "v show version info"},
{WHEN_ATTACH, "| attach local command"}, {WHEN_ALWAYS, "w who is on this console"},
{WHEN_ALWAYS, "? print this message"}, {WHEN_ALWAYS, "x show console baud info"},
{WHEN_ALWAYS, "<cr> ignore/abort command"}, {WHEN_ALWAYS | IS_LIMITED, "z suspend the connection"},
{WHEN_ALWAYS, "^R replay the last line"}, {WHEN_ATTACH, "! invoke task"},
{WHEN_ATTACH, "\\ooo send character by octal code"}, {WHEN_ATTACH | IS_LIMITED, "| attach local command"},
{WHEN_EXPERT, "^I toggle tab expansion"}, {WHEN_ALWAYS, "? print this message"},
{WHEN_EXPERT, "+(-) do (not) drop line"}, {WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "^R replay the last line"},
{WHEN_ATTACH, "\\ooo send character by octal code"},
}; };
/* list the commands we know for the user (ksb) /* list the commands we know for the user (ksb)
*/ */
void void
#if PROTOTYPES
HelpUser(CONSCLIENT *pCL) HelpUser(CONSCLIENT *pCL)
#else
HelpUser(pCL)
CONSCLIENT *pCL;
#endif
{ {
int i, j, iCmp; int i, j, iCmp;
static char static char
@ -439,15 +432,30 @@ HelpUser(pCL)
BuildString((char *)0, acLine); BuildString((char *)0, acLine);
for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) { for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) {
if (0 == (aHLTable[i].iwhen & iCmp)) { char *text;
if (aHLTable[i].iwhen & IS_LIMITED &&
ConsentUserOk(pLUList, pCL->username->string) == 1)
continue; continue;
if (0 == (aHLTable[i].iwhen & iCmp))
continue;
text = aHLTable[i].actext;
if (text[0] == 'p') {
BuildTmpString((char *)0);
text = BuildTmpStringPrint(text, pCL->playback);
} else if (text[0] == 'r') {
BuildTmpString((char *)0);
text = BuildTmpStringPrint(text, pCL->replay);
} }
if (acLine->used != 0) { /* second part of line */ if (acLine->used != 0) { /* second part of line */
if (strlen(aHLTable[i].actext) < HALFLINE) { if (strlen(text) < HALFLINE) {
for (j = acLine->used; j <= HALFLINE; ++j) { for (j = acLine->used; j <= HALFLINE; ++j) {
BuildStringChar(' ', acLine); BuildStringChar(' ', acLine);
} }
BuildString(aHLTable[i].actext, acLine); BuildString(text, acLine);
BuildString(acEoln, acLine); BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, FileWrite(pCL->fd, FLAGTRUE, acLine->string,
acLine->used - 1); acLine->used - 1);
@ -462,7 +470,7 @@ HelpUser(pCL)
} }
if (acLine->used == 0) { /* at new line */ if (acLine->used == 0) { /* at new line */
BuildStringChar(' ', acLine); BuildStringChar(' ', acLine);
BuildString(aHLTable[i].actext, acLine); BuildString(text, acLine);
if (acLine->used > HALFLINE) { if (acLine->used > HALFLINE) {
BuildString(acEoln, acLine); BuildString(acEoln, acLine);
FileWrite(pCL->fd, FLAGTRUE, acLine->string, FileWrite(pCL->fd, FLAGTRUE, acLine->string,
@ -479,34 +487,19 @@ HelpUser(pCL)
} }
int int
#if PROTOTYPES
ClientAccessOk(CONSCLIENT *pCL) ClientAccessOk(CONSCLIENT *pCL)
#else
ClientAccessOk(pCL)
CONSCLIENT *pCL;
#endif
{ {
char *peername = (char *)0; char *peername = (char *)0;
int retval = 1; int retval = 1;
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
struct in_addr addr;
# if HAVE_INET_ATON
inet_aton("127.0.0.1", &addr);
# else
addr.s_addr = inet_addr("127.0.0.1");
# endif
pCL->caccess = AccType(&addr, &peername);
if (pCL->caccess == 'r') {
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
-1);
retval = 0;
}
#else
socklen_t so; socklen_t so;
int cfd; int cfd;
struct sockaddr_in in_port; # if USE_IPV6
int error;
char addr[NI_MAXHOST];
# endif
SOCKADDR_STYPE in_port;
int getpeer = -1; int getpeer = -1;
cfd = FileFDNum(pCL->fd); cfd = FileFDNum(pCL->fd);
@ -514,6 +507,7 @@ ClientAccessOk(pCL)
# if defined(USE_LIBWRAP) # if defined(USE_LIBWRAP)
{ {
struct request_info request; struct request_info request;
CONDDEBUG((1, "ClientAccessOk(): doing tcpwrappers check"));
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0); request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
fromhost(&request); fromhost(&request);
if (!hosts_access(&request)) { if (!hosts_access(&request)) {
@ -532,20 +526,56 @@ ClientAccessOk(pCL)
retval = 0; retval = 0;
goto setpeer; goto setpeer;
} }
pCL->caccess = AccType(&in_port.sin_addr, &peername); pCL->caccess = AccType(
# if USE_IPV6
&in_port,
# else
&in_port.sin_addr,
# endif
&peername);
if (pCL->caccess == 'r') { if (pCL->caccess == 'r') {
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n", FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
-1); -1);
retval = 0; retval = 0;
} }
setpeer: setpeer:
#else
struct in_addr addr;
# if HAVE_INET_ATON
inet_aton("127.0.0.1", &addr);
# else
addr.s_addr = inet_addr("127.0.0.1");
# endif
pCL->caccess = AccType(&addr, &peername);
if (pCL->caccess == 'r') {
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
-1);
retval = 0;
}
#endif #endif
if (pCL->peername != (STRING *)0) { if (pCL->peername != (STRING *)0) {
BuildString((char *)0, pCL->peername); BuildString((char *)0, pCL->peername);
if (peername != (char *)0) if (peername != (char *)0)
BuildString(peername, pCL->peername); BuildString(peername, pCL->peername);
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6
else if (getpeer != -1) {
error =
getnameinfo((struct sockaddr *)&in_port, so, addr,
sizeof(addr), NULL, 0, NI_NUMERICHOST);
if (error) {
FileWrite(pCL->fd, FLAGFALSE, "getnameinfo failed\r\n",
-1);
Error("ClientAccessOk(): gatenameinfo: %s",
gai_strerror(error));
retval = 0;
}
BuildString(addr, pCL->peername);
} else
BuildString("<unknown>", pCL->peername);
#elif USE_UNIX_DOMAIN_SOCKETS
else else
BuildString("127.0.0.1", pCL->peername); BuildString("127.0.0.1", pCL->peername);
#else #else

View File

@ -1,5 +1,5 @@
/* /*
* $Id: client.h,v 5.36 2003/12/25 19:22:00 bryan Exp $ * $Id: client.h,v 5.45 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -48,7 +48,12 @@ typedef enum clientState {
S_QUOTE, /* send any character we can spell */ S_QUOTE, /* send any character we can spell */
S_BCAST, /* send a broadcast message to all clients */ S_BCAST, /* send a broadcast message to all clients */
S_CWAIT, /* wait for client */ S_CWAIT, /* wait for client */
S_CEXEC /* client execing a program */ S_CEXEC, /* client execing a program */
S_REPLAY, /* set replay length for 'r' */
S_PLAYBACK, /* set replay length for 'p' */
S_NOTE, /* send a note to the logfile */
S_TASK, /* invoke a task on the server side */
S_CONFIRM /* confirm input */
} CLIENTSTATE; } CLIENTSTATE;
typedef struct client { /* Connection Information: */ typedef struct client { /* Connection Information: */
@ -58,6 +63,7 @@ typedef struct client { /* Connection Information: */
short fwantwr; /* (client) wants to write */ short fwantwr; /* (client) wants to write */
short fro; /* read-only permission */ short fro; /* read-only permission */
short fecho; /* echo commands (not set by machines) */ short fecho; /* echo commands (not set by machines) */
short fiwait; /* client wanting for console init */
STRING *acid; /* login and location of client */ STRING *acid; /* login and location of client */
STRING *peername; /* location of client */ STRING *peername; /* location of client */
STRING *username; /* login of client */ STRING *username; /* login of client */
@ -74,17 +80,21 @@ typedef struct client { /* Connection Information: */
*pCLnext; /* next person on this list */ *pCLnext; /* next person on this list */
/* next lists link clients on a console */ /* next lists link clients on a console */
char ic[2]; /* two character escape sequence */ char ic[2]; /* two character escape sequence */
unsigned short replay; /* lines to replay for 'r' */
unsigned short playback; /* lines to replay for 'p' */
CLIENTSTATE iState; /* state for fsm in server */ CLIENTSTATE iState; /* state for fsm in server */
char caccess; /* did we trust the remote machine */ char caccess; /* did we trust the remote machine */
IOSTATE ioState; /* state of the socket */ IOSTATE ioState; /* state of the socket */
time_t stateTimer; /* timer for various ioState states */ time_t stateTimer; /* timer for various ioState states */
STRING *accmd; /* the command the user issued */ STRING *accmd; /* the command the user issued */
STRING *msg; /* the broadcast message */ INADDR_STYPE cnct_port; /* where from */
struct sockaddr_in FLAG confirmed; /* confirm state */
cnct_port; /* where from */ CLIENTSTATE cState; /* state needing confirmation */
char cOption; /* option initiating the confirmation */
} CONSCLIENT; } CONSCLIENT;
extern void Replay PARAMS((CONSENT *, CONSFILE *, int)); extern void Replay(CONSENT *, CONSFILE *, unsigned short);
extern void HelpUser PARAMS((CONSCLIENT *)); extern void HelpUser(CONSCLIENT *);
extern void FindWrite PARAMS((CONSENT *)); extern void FindWrite(CONSENT *);
extern int ClientAccessOk PARAMS((CONSCLIENT *)); extern int ClientAccessOk(CONSCLIENT *);
extern void BumpClient(CONSENT *, char *);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* $Id: consent.h,v 5.57 2004/05/21 04:38:02 bryan Exp $ * $Id: consent.h,v 5.76 2015/06/02 17:19:31 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -55,9 +55,21 @@ typedef enum consType {
UNKNOWNTYPE = 0, UNKNOWNTYPE = 0,
DEVICE, DEVICE,
EXEC, EXEC,
HOST HOST,
NOOP,
UDS,
#if HAVE_FREEIPMI
IPMI,
#endif
} CONSTYPE; } CONSTYPE;
#if HAVE_FREEIPMI
# define IPMIL_UNKNOWN (0)
# define IPMIL_USER (IPMICONSOLE_PRIVILEGE_USER+1)
# define IPMIL_OPERATOR (IPMICONSOLE_PRIVILEGE_OPERATOR+1)
# define IPMIL_ADMIN (IPMICONSOLE_PRIVILEGE_ADMIN+1)
#endif
typedef struct names { typedef struct names {
char *name; char *name;
struct names *next; struct names *next;
@ -89,6 +101,17 @@ typedef struct consent { /* console information */
FLAG ixoff; /* XON/XOFF flow control on input */ FLAG ixoff; /* XON/XOFF flow control on input */
#if defined(CRTSCTS) #if defined(CRTSCTS)
FLAG crtscts; /* use hardware flow control */ FLAG crtscts; /* use hardware flow control */
#endif
#if HAVE_FREEIPMI
/* type == IPMI */
int ipmiprivlevel; /* IPMI authentication level */
ipmiconsole_ctx_t ipmictx; /* IPMI ctx */
unsigned int ipmiworkaround; /* IPMI workaround flags */
short ipmiwrkset; /* workaround flags set in config */
int ipmiciphersuite; /* IPMI cipher suite */
char *username; /* Username to log as */
char *password; /* Login Password */
STRING *ipmikg; /* IPMI k_g auth key */
#endif #endif
/* type == HOST */ /* type == HOST */
char *host; /* hostname */ char *host; /* hostname */
@ -100,27 +123,41 @@ typedef struct consent { /* console information */
/* type == EXEC */ /* type == EXEC */
char *exec; /* exec command */ char *exec; /* exec command */
char *execsubst; /* exec substitution pattern */ char *execsubst; /* exec substitution pattern */
uid_t execuid; /* user to run exec as */
gid_t execgid; /* group to run exec as */
/* type == UDS */
char *uds; /* socket file */
char *udssubst; /* socket file substitution pattern */
/* global stuff */ /* global stuff */
char *master; /* master hostname */ char *master; /* master hostname */
unsigned short breakNum; /* break type [1-9] */ unsigned short breakNum; /* break type [1-35] */
char *logfile; /* logfile */ char *logfile; /* logfile */
off_t logfilemax; /* size limit for rolling logfile */ off_t logfilemax; /* size limit for rolling logfile */
char *initcmd; /* initcmd command */ char *initcmd; /* initcmd command */
char *initsubst; /* initcmd substitution pattern */ char *initsubst; /* initcmd substitution pattern */
uid_t inituid; /* user to run initcmd as */
gid_t initgid; /* group to run initcmd as */
char *motd; /* motd */ char *motd; /* motd */
time_t idletimeout; /* idle timeout */ time_t idletimeout; /* idle timeout */
char *idlestring; /* string to print when idle */ char *idlestring; /* string to print when idle */
unsigned short spinmax; /* initialization spin maximum */
unsigned short spintimer; /* initialization spin timer */
char *replstring; /* generic string for replacements */
char *tasklist; /* list of valid tasks */
char *breaklist; /* list of valid break sequences */
/* timestamp stuff */ /* timestamp stuff */
int mark; /* Mark (chime) interval */ int mark; /* Mark (chime) interval */
long nextMark; /* Next mark (chime) time */ long nextMark; /* Next mark (chime) time */
FLAG activitylog; /* log attach/detach/bump */ FLAG activitylog; /* log attach/detach/bump */
FLAG breaklog; /* log breaks sent */ FLAG breaklog; /* log breaks sent */
FLAG tasklog; /* log tasks invoked */
/* options */ /* options */
FLAG ondemand; /* bring up on-demand */ FLAG ondemand; /* bring up on-demand */
FLAG reinitoncc; /* open if down on client connect */ FLAG reinitoncc; /* open if down on client connect */
FLAG striphigh; /* strip high-bit of console data */ FLAG striphigh; /* strip high-bit of console data */
FLAG autoreinit; /* auto-reinitialize if failed */ FLAG autoreinit; /* auto-reinitialize if failed */
FLAG unloved; /* copy "unloved" data to stdout */ FLAG unloved; /* copy "unloved" data to stdout */
FLAG login; /* allow logins to the console */
/*** runtime settings ***/ /*** runtime settings ***/
CONSFILE *fdlog; /* the local log file */ CONSFILE *fdlog; /* the local log file */
@ -130,16 +167,26 @@ typedef struct consent { /* console information */
pid_t ipid; /* pid of virtual command */ pid_t ipid; /* pid of virtual command */
pid_t initpid; /* pid of initcmd command */ pid_t initpid; /* pid of initcmd command */
CONSFILE *initfile; /* the command run on init */ CONSFILE *initfile; /* the command run on init */
pid_t taskpid; /* pid of task running */
CONSFILE *taskfile; /* the output from the task (read-only) */
STRING *wbuf; /* write() buffer */ STRING *wbuf; /* write() buffer */
int wbufIAC; /* next IAC location in wbuf */ int wbufIAC; /* next IAC location in wbuf */
IOSTATE ioState; /* state of the socket */ IOSTATE ioState; /* state of the socket */
time_t stateTimer; /* timer for ioState states */ time_t stateTimer; /* timer for ioState states */
time_t lastWrite; /* time of last data sent to console */ time_t lastWrite; /* time of last data sent to console */
#if HAVE_GETTIMEOFDAY
struct timeval lastInit; /* time of last initialization */
#else
time_t lastInit; /* time of last initialization */
#endif
unsigned short spincount; /* initialization spin counter */
/*** state information ***/ /*** state information ***/
char acline[132 * 2 + 2]; /* max chars we will call a line */ char acline[132 * 2 + 2]; /* max chars we will call a line */
int iend; /* length of data stored in acline */ int iend; /* length of data stored in acline */
int telnetState; /* state for telnet negotiations */ int telnetState; /* state for telnet negotiations */
FLAG sentDoEcho; /* have we sent telnet DO ECHO cmd? */
FLAG sentDoSGA; /* have we sent telnet DO SGA cmd? */
unsigned short autoReUp; /* is it coming back up automatically? */ unsigned short autoReUp; /* is it coming back up automatically? */
FLAG downHard; /* did it go down unexpectedly? */ FLAG downHard; /* did it go down unexpectedly? */
unsigned short nolog; /* don't log output */ unsigned short nolog; /* don't log output */
@ -162,11 +209,13 @@ typedef struct remote { /* console at another host */
NAMES *aliases; /* aliases for remote server name */ NAMES *aliases; /* aliases for remote server name */
} REMOTE; } REMOTE;
extern PARITY *FindParity PARAMS((char *)); extern PARITY *FindParity(char *);
extern BAUD *FindBaud PARAMS((char *)); extern BAUD *FindBaud(char *);
extern void ConsInit PARAMS((CONSENT *)); extern void ConsInit(CONSENT *);
extern void ConsDown PARAMS((CONSENT *, FLAG, FLAG)); extern void ConsDown(CONSENT *, FLAG, FLAG);
extern REMOTE *FindUniq PARAMS((REMOTE *)); extern REMOTE *FindUniq(REMOTE *);
extern void DestroyRemoteConsole PARAMS((REMOTE *)); extern void DestroyRemoteConsole(REMOTE *);
extern void StartInit PARAMS((CONSENT *)); extern void StartInit(CONSENT *);
extern void StopInit PARAMS((CONSENT *)); extern void StopInit(CONSENT *);
extern char *ConsState(CONSENT *);
extern void SetupTty(CONSENT *, int);

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine .\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.47 2004/05/21 04:15:17 bryan Exp $ .\" $Id: conserver.man,v 1.54 2006/12/31 02:02:48 bryan Exp $
.TH CONSERVER 8 "2004/05/21" "conserver-8.1.6" "conserver" .TH CONSERVER 8 "2006/12/31" "conserver-8.2.1" "conserver"
.SH NAME .SH NAME
conserver \- console server daemon conserver \- console server daemon
.SH SYNOPSIS .SH SYNOPSIS
@ -33,20 +33,32 @@ conserver \- console server daemon
is the daemon that manages is the daemon that manages
remote access to system consoles by multiple users via the remote access to system consoles by multiple users via the
.BR console (1) .BR console (1)
client program and logs all console output. client program and (optionally) log the console output.
It can connect to consoles via local serial ports, terminal It can connect to consoles via local serial ports, Unix domain sockets, TCP
servers that allow network access, or to any external program. sockets (for terminal servers and the like), or any external program.
.PP .PP
When started, When started,
.B conserver .B conserver
reads its reads the
.BR conserver.cf (5) .BR conserver.cf (5)
file for details of each console it should manage, file for details of each console.
including serial port or network parameters and logging options. The console type, logging options, serial or network parameters, and user access
(Also, in environments where multiple servers share a cf file, levels are just a few of the things that can be specified.
any server is able to refer clients to the particular server Command-line options are then applied, possibly overriding
managing a requested console, so that the client need not have .BR conserver.cf (5)
knowledge of the distribution of consoles among servers.) settings.
.B Conserver
categorizes consoles into two types: those it should actively manage, and
those it should just know about, so it can refer clients to other
.B conserver
instances.
If the
.B master
value of a console matches the hostname or ip address of the local machine,
.B conserver
will actively manage the console.
Otherwise, it's considered a ``remote'' console and managed by a different
server.
.B Conserver .B Conserver
forks a child for each group of consoles it must manage forks a child for each group of consoles it must manage
and assigns each process a port number to listen on. and assigns each process a port number to listen on.
@ -89,10 +101,10 @@ The server will
.B not .B not
remove any files in the directory itself, just in case the directory is remove any files in the directory itself, just in case the directory is
accidentally specified as ``/etc'' or some other critical location. accidentally specified as ``/etc'' or some other critical location.
The server will do it's best to remove all the sockets when it shuts down, The server will do its best to remove all the sockets when it shuts down,
but it could stop ungracefully (crash, ``kill -9'', etc) but it could stop ungracefully (crash, ``kill -9'', etc)
and leave files behind. and leave files behind.
It's would then be up to the admin (or a creative startup script) to clean It would then be up to the admin (or a creative startup script) to clean
up the directory before the server will start again. up the directory before the server will start again.
.PP .PP
.B Conserver .B Conserver
@ -318,6 +330,9 @@ Enable periodic attempts (every
.I min .I min
minutes) to open (``bring up'') all downed minutes) to open (``bring up'') all downed
consoles (similar to sending a SIGUSR1). consoles (similar to sending a SIGUSR1).
Without this option, or if
.I min
is zero, no periodic attempts occur.
.TP .TP
.BI \-p port .BI \-p port
Set the TCP port for the master process to listen on. Set the TCP port for the master process to listen on.
@ -377,13 +392,16 @@ The console aliases in a comma-separated list.
.I type .I type
The type of console. The type of console.
Values will be a `/' for a local device, `|' for Values will be a `/' for a local device, `|' for
a command, or `!' for a remote port. a command, `!' for a remote port, `%' for a Unix domain socket,
and `#' for a noop console.
.TP .TP
.I details .I details
Multiple values are comma-separated and depend on the type of the console. Multiple values are comma-separated and depend on the type of the console.
Local devices will have the values of the device file and baud rate/parity. Local devices will have the values of the device file and baud rate/parity.
Commands will have string to invoke. Commands will have string to invoke.
Remote ports will have the values of the remote hostname and port number. Remote ports will have the values of the remote hostname and port number.
Unix domain sockets will have the path to the socket.
Noop consoles will have nothing.
.RE .RE
.TP .TP
.B \-u .B \-u
@ -424,7 +442,7 @@ The second style is the character-based, escape-sequence mode, while
connected to a console. connected to a console.
.PP .PP
The initial line-based mode begins the same for both the master process The initial line-based mode begins the same for both the master process
and it's children. and its children.
Upon a successful (non-rejected) client connection, an ``ok'' is sent. Upon a successful (non-rejected) client connection, an ``ok'' is sent.
The client then issues a command and the server responds to it with a The client then issues a command and the server responds to it with a
result string (``ok'' being the sign of success for most commands). result string (``ok'' being the sign of success for most commands).
@ -432,7 +450,7 @@ The commands available are ``help'', ``ssl'' (if
SSL was built into the code), ``login'', and ``exit''. SSL was built into the code), ``login'', and ``exit''.
Using the ``login'' command, the client authenticates and gains access to Using the ``login'' command, the client authenticates and gains access to
the extended command set. the extended command set.
This is where the master process and it's children differ. This is where the master process and its children differ.
The master process gives the client access to global commands, and the The master process gives the client access to global commands, and the
child provides commands for interacting with the consoles it manages. child provides commands for interacting with the consoles it manages.
The ``help'' command, in both cases, will provide a complete The ``help'' command, in both cases, will provide a complete
@ -448,7 +466,9 @@ any interaction with the server is done with the default escape sequence.
This is, by no means, a complete description of the entire client/server This is, by no means, a complete description of the entire client/server
interaction. interaction.
It is, however, a brief explanation in order to give a idea of It is, however, a brief explanation in order to give a idea of
what the program does. what the program does. See the
.B \s-1PROTOCOL\s0
file in the distribution for further details.
.SH FILES .SH FILES
.PP .PP
The following default file locations may be overridden The following default file locations may be overridden

View File

@ -1,5 +1,5 @@
/* /*
* $Id: convert.c,v 1.9 2004/05/21 04:15:17 bryan Exp $ * $Id: convert.c,v 1.14 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -41,6 +41,12 @@
#include <master.h> #include <master.h>
#include <main.h> #include <main.h>
#if defined(USE_LIBWRAP)
/* we don't use it...but we link to it */
int allow_severity;
int deny_severity;
#endif
SECTION sections[] = { SECTION sections[] = {
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0} {(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
@ -52,19 +58,12 @@ DestroyDataStructures()
} }
char * char *
#if PROTOTYPES
ReadLine2(FILE *fp, STRING *save, int *iLine) ReadLine2(FILE *fp, STRING *save, int *iLine)
#else
ReadLine2(fp, save, iLine)
FILE *fp;
STRING *save;
int *iLine;
#endif
{ {
static char buf[1024]; static char buf[1024];
char *wholeline = (char *)0; char *wholeline = (char *)0;
char *ret = (char *)0; char *ret = (char *)0;
int i, buflen, peek, commentCheck = 1, comment = 0; int i, buflen, peek, commentCheck = 1;
static STRING *bufstr = (STRING *)0; static STRING *bufstr = (STRING *)0;
static STRING *wholestr = (STRING *)0; static STRING *wholestr = (STRING *)0;
@ -80,7 +79,7 @@ ReadLine2(fp, save, iLine)
|| peek) { || peek) {
/* If we have a previously saved line, use it instead */ /* If we have a previously saved line, use it instead */
if (save->used) { if (save->used) {
strcpy(buf, save->string); StrCpy(buf, save->string, sizeof(buf));
BuildString((char *)0, save); BuildString((char *)0, save);
} }
@ -106,7 +105,6 @@ ReadLine2(fp, save, iLine)
if (!isspace((int)buf[i])) if (!isspace((int)buf[i]))
break; break;
if (buf[i] == '#') { if (buf[i] == '#') {
comment = 1;
commentCheck = 0; commentCheck = 0;
} else if (buf[i] != '\000') { } else if (buf[i] != '\000') {
commentCheck = 0; commentCheck = 0;
@ -117,14 +115,11 @@ ReadLine2(fp, save, iLine)
buflen = strlen(buf); buflen = strlen(buf);
if ((buflen >= 1) && (buf[buflen - 1] == '\n')) { if ((buflen >= 1) && (buf[buflen - 1] == '\n')) {
(*iLine)++; /* Finally have a whole line */ (*iLine)++; /* Finally have a whole line */
/* if (comment == 0 && commentCheck == 0) { */
/* Finish off the chunk without the \n */ /* Finish off the chunk without the \n */
buf[buflen - 1] = '\000'; buf[buflen - 1] = '\000';
BuildString(buf, bufstr); BuildString(buf, bufstr);
wholeline = BuildString(bufstr->string, wholestr); wholeline = BuildString(bufstr->string, wholestr);
/* }*/
peek = 1; peek = 1;
comment = 0;
commentCheck = 1; commentCheck = 1;
BuildString((char *)0, bufstr); BuildString((char *)0, bufstr);
} else { } else {
@ -136,10 +131,6 @@ ReadLine2(fp, save, iLine)
/* If we hit the EOF and weren't peeking ahead /* If we hit the EOF and weren't peeking ahead
* and it's not a comment * and it's not a comment
*/ */
/*
if (!peek && (ret == (char *)0) && (comment == 0) &&
(commentCheck == 0)) {
*/
if (!peek && (ret == (char *)0)) { if (!peek && (ret == (char *)0)) {
(*iLine)++; (*iLine)++;
wholeline = BuildString(bufstr->string, wholestr); wholeline = BuildString(bufstr->string, wholestr);
@ -156,13 +147,7 @@ ReadLine2(fp, save, iLine)
* to manage the consoles * to manage the consoles
*/ */
void void
#if PROTOTYPES
ReadCfg(char *pcFile, FILE *fp) ReadCfg(char *pcFile, FILE *fp)
#else
ReadCfg(pcFile, fp)
char *pcFile;
FILE *fp;
#endif
{ {
int iLine; int iLine;
unsigned char *acIn; unsigned char *acIn;
@ -426,7 +411,6 @@ ReadCfg(pcFile, fp)
(unsigned char *)ReadLine2(fp, acInSave, (unsigned char *)ReadLine2(fp, acInSave,
&iLine)) != (unsigned char *)0) { &iLine)) != (unsigned char *)0) {
char *pcNext; char *pcNext;
char cType;
acStart = PruneSpace((char *)acIn); acStart = PruneSpace((char *)acIn);
if (acStart[0] == '#') { if (acStart[0] == '#') {
@ -472,7 +456,6 @@ ReadCfg(pcFile, fp)
printf("\ttrusted %s;\n", pcNext); printf("\ttrusted %s;\n", pcNext);
break; break;
default: default:
cType = ' ';
Error("%s(%d) unknown access key `%s'", pcFile, iLine, Error("%s(%d) unknown access key `%s'", pcFile, iLine,
acStart); acStart);
break; break;
@ -484,13 +467,7 @@ ReadCfg(pcFile, fp)
} }
int int
#if PROTOTYPES
main(int argc, char **argv) main(int argc, char **argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{ {
char *pcFile; char *pcFile;
FILE *fp; FILE *fp;

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,18 @@
/* /*
* $Id: cutil.h,v 1.63 2004/05/25 00:38:15 bryan Exp $ * $Id: cutil.h,v 1.70 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com) * Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/ */
#if PROTOTYPES
#include <stdarg.h> #include <stdarg.h>
#else
#include <varargs.h>
#endif
#if HAVE_OPENSSL #if HAVE_OPENSSL
#include <openssl/ssl.h> # include <openssl/ssl.h>
#include <openssl/err.h> # include <openssl/err.h>
#endif
#if HAVE_GSSAPI
# include <gssapi/gssapi.h>
#endif #endif
/* communication constants /* communication constants
@ -45,6 +44,9 @@ typedef enum IOState {
#if HAVE_OPENSSL #if HAVE_OPENSSL
INSSLACCEPT, INSSLACCEPT,
INSSLSHUTDOWN, INSSLSHUTDOWN,
#endif
#if HAVE_GSSAPI
INGSSACCEPT,
#endif #endif
ISFLUSHING ISFLUSHING
} IOSTATE; } IOSTATE;
@ -70,6 +72,7 @@ typedef struct consFile {
int fd; int fd;
int fdout; /* only used when a simplePipe */ int fdout; /* only used when a simplePipe */
STRING *wbuf; STRING *wbuf;
FLAG errored;
FLAG quoteiac; FLAG quoteiac;
FLAG sawiac; FLAG sawiac;
FLAG sawiacsusp; FLAG sawiacsusp;
@ -91,15 +94,15 @@ typedef struct consFile {
typedef struct item { typedef struct item {
char *id; char *id;
void (*reg) PARAMS((char *)); void (*reg) (char *);
} ITEM; } ITEM;
typedef struct section { typedef struct section {
char *id; char *id;
void (*begin) PARAMS((char *)); void (*begin) (char *);
void (*end) PARAMS((void)); void (*end) (void);
void (*abort) PARAMS((void)); void (*abort) (void);
void (*destroy) PARAMS((void)); void (*destroy) (void);
ITEM *items; ITEM *items;
} SECTION; } SECTION;
@ -110,14 +113,16 @@ typedef enum substToken {
} SUBSTTOKEN; } SUBSTTOKEN;
typedef struct subst { typedef struct subst {
SUBSTTOKEN tokens[255]; /* function to retrieve a token type based on a character
*/
SUBSTTOKEN (*token) (char);
/* data for callback function /* data for callback function
*/ */
void *data; void *data;
/* function to retrieve a value (as a char* or int or both) for /* function to retrieve a value (as a char* or int or both) for
* a substitution * a substitution
*/ */
int (*callback) PARAMS((char, char **, int *)); int (*value) (char, char **, int *);
} SUBST; } SUBST;
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted; extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;
@ -125,7 +130,9 @@ extern char *progname;
extern pid_t thepid; extern pid_t thepid;
#define MAXHOSTNAME 1024 #define MAXHOSTNAME 1024
extern char myHostname[]; extern char myHostname[];
#if !USE_IPV6
extern struct in_addr *myAddrs; extern struct in_addr *myAddrs;
#endif
extern fd_set rinit; extern fd_set rinit;
extern fd_set winit; extern fd_set winit;
extern int maxfd; extern int maxfd;
@ -136,70 +143,74 @@ extern char *file; /* used by ParseFile */
extern SECTION sections[]; /* used by ParseFile */ extern SECTION sections[]; /* used by ParseFile */
extern int isMaster; extern int isMaster;
extern const char *StrTime PARAMS((time_t *)); extern const char *StrTime(time_t *);
extern void Debug PARAMS((int, char *, ...)); extern void Debug(int, char *, ...);
extern void Error PARAMS((char *, ...)); extern void Error(char *, ...);
extern void Msg PARAMS((char *, ...)); extern void Msg(char *, ...);
extern void Verbose PARAMS((char *, ...)); extern void Verbose(char *, ...);
extern void SimpleSignal PARAMS((int, RETSIGTYPE(*)(int))); extern void SimpleSignal(int, RETSIGTYPE(*)(int));
extern int GetMaxFiles PARAMS(()); extern int GetMaxFiles();
extern char *FmtCtl PARAMS((int, STRING *)); extern char *FmtCtl(int, STRING *);
extern void FmtCtlStr PARAMS((char *, int, STRING *)); extern void FmtCtlStr(char *, int, STRING *);
extern CONSFILE *FileOpenFD PARAMS((int, enum consFileType)); extern CONSFILE *FileOpenFD(int, enum consFileType);
extern CONSFILE *FileOpenPipe PARAMS((int, int)); extern CONSFILE *FileOpenPipe(int, int);
extern CONSFILE *FileOpen PARAMS((const char *, int, int)); extern CONSFILE *FileOpen(const char *, int, int);
extern int FileClose PARAMS((CONSFILE **)); extern int FileClose(CONSFILE **);
extern int FileRead PARAMS((CONSFILE *, void *, int)); extern int FileRead(CONSFILE *, void *, int);
extern int FileWrite PARAMS((CONSFILE *, FLAG, char *, int)); extern int FileWrite(CONSFILE *, FLAG, char *, int);
extern void FileVWrite PARAMS((CONSFILE *, FLAG, char *, va_list)); extern void FileVWrite(CONSFILE *, FLAG, char *, va_list);
extern void FilePrint PARAMS((CONSFILE *, FLAG, char *, ...)); extern void FilePrint(CONSFILE *, FLAG, char *, ...);
extern int FileStat PARAMS((CONSFILE *, struct stat *)); extern int FileStat(CONSFILE *, struct stat *);
extern int FileSeek PARAMS((CONSFILE *, off_t, int)); extern int FileSeek(CONSFILE *, off_t, int);
extern int FileSend PARAMS((CONSFILE *, const void *, size_t, int)); extern int FileSend(CONSFILE *, const void *, size_t, int);
extern int FileFDNum PARAMS((CONSFILE *)); extern int FileFDNum(CONSFILE *);
extern int FileFDOutNum PARAMS((CONSFILE *)); extern int FileFDOutNum(CONSFILE *);
extern int FileUnopen PARAMS((CONSFILE *)); extern int FileUnopen(CONSFILE *);
extern void OutOfMem PARAMS(()); extern void OutOfMem();
extern char *BuildTmpString PARAMS((const char *)); extern char *BuildTmpString(const char *);
extern char *BuildTmpStringChar PARAMS((const char)); extern char *BuildTmpStringChar(const char);
extern char *BuildTmpStringPrint PARAMS((char *, ...)); extern char *BuildTmpStringPrint(char *, ...);
extern char *BuildString PARAMS((const char *, STRING *)); extern char *BuildString(const char *, STRING *);
extern char *BuildStringChar PARAMS((const char, STRING *)); extern char *BuildStringChar(const char, STRING *);
extern char *BuildStringPrint PARAMS((STRING *, char *, ...)); extern char *BuildStringPrint(STRING *, char *, ...);
extern char *BuildStringN PARAMS((const char *, int, STRING *)); extern char *BuildStringN(const char *, int, STRING *);
extern char *ShiftString PARAMS((STRING *, int)); extern char *ShiftString(STRING *, int);
extern void InitString PARAMS((STRING *)); extern void InitString(STRING *);
extern void DestroyString PARAMS((STRING *)); extern void DestroyString(STRING *);
extern void DestroyStrings PARAMS((void)); extern void DestroyStrings(void);
extern STRING *AllocString PARAMS((void)); extern STRING *AllocString(void);
extern char *ReadLine PARAMS((FILE *, STRING *, int *)); extern char *ReadLine(FILE *, STRING *, int *);
extern enum consFileType FileGetType PARAMS((CONSFILE *)); extern enum consFileType FileGetType(CONSFILE *);
extern void FileSetType PARAMS((CONSFILE *, enum consFileType)); extern void FileSetType(CONSFILE *, enum consFileType);
extern void FileSetQuoteIAC PARAMS((CONSFILE *, FLAG)); extern void FileSetQuoteIAC(CONSFILE *, FLAG);
extern FLAG FileSawQuoteSusp PARAMS((CONSFILE *)); extern FLAG FileSawQuoteSusp(CONSFILE *);
extern FLAG FileSawQuoteExec PARAMS((CONSFILE *)); extern FLAG FileSawQuoteExec(CONSFILE *);
extern FLAG FileSawQuoteAbrt PARAMS((CONSFILE *)); extern FLAG FileSawQuoteAbrt(CONSFILE *);
extern FLAG FileSawQuoteGoto PARAMS((CONSFILE *)); extern FLAG FileSawQuoteGoto(CONSFILE *);
extern void Bye PARAMS((int)); extern void Bye(int);
extern void DestroyDataStructures PARAMS((void)); extern void DestroyDataStructures(void);
extern int IsMe PARAMS((char *)); extern int IsMe(char *);
extern char *PruneSpace PARAMS((char *)); extern char *PruneSpace(char *);
extern int FileCanRead PARAMS((CONSFILE *, fd_set *, fd_set *)); extern int FileCanRead(CONSFILE *, fd_set *, fd_set *);
extern int FileCanWrite PARAMS((CONSFILE *, fd_set *, fd_set *)); extern int FileCanWrite(CONSFILE *, fd_set *, fd_set *);
extern int FileBufEmpty PARAMS((CONSFILE *)); extern int FileBufEmpty(CONSFILE *);
extern int SetFlags PARAMS((int, int, int)); extern int SetFlags(int, int, int);
extern char *StrDup PARAMS((char *)); extern char *StrDup(const char *);
extern int ParseIACBuf PARAMS((CONSFILE *, void *, int *)); extern int ParseIACBuf(CONSFILE *, void *, int *);
extern void *MemMove PARAMS((void *, void *, size_t)); extern void *MemMove(void *, void *, size_t);
extern char *StringChar PARAMS((STRING *, int, char)); extern char *StringChar(STRING *, int, char);
extern void ParseFile PARAMS((char *, FILE *, int)); extern void ParseFile(char *, FILE *, int);
extern void ProbeInterfaces PARAMS((in_addr_t)); #if !USE_IPV6
extern void ProcessSubst extern void ProbeInterfaces(in_addr_t);
PARAMS((SUBST *, char **, char **, char *, char *)); #endif
#if HAVE_OPENSSL extern void ProcessSubst(SUBST *, char **, char **, char *, char *);
extern SSL *FileGetSSL PARAMS((CONSFILE *)); extern char *MyVersion(void);
extern void FileSetSSL PARAMS((CONSFILE *, SSL *)); extern unsigned int AtoU(char *);
extern int SSLVerifyCallback PARAMS((int, X509_STORE_CTX *)); extern void StrCpy(char *, const char *, unsigned int);
extern int FileSSLAccept PARAMS((CONSFILE *)); #if HAVE_OPENSSL
extern int FileCanSSLAccept PARAMS((CONSFILE *, fd_set *, fd_set *)); extern SSL *FileGetSSL(CONSFILE *);
extern void FileSetSSL(CONSFILE *, SSL *);
extern int SSLVerifyCallback(int, X509_STORE_CTX *);
extern int FileSSLAccept(CONSFILE *);
extern int FileCanSSLAccept(CONSFILE *, fd_set *, fd_set *);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: fallback.c,v 5.61 2004/04/16 16:58:09 bryan Exp $ * $Id: fallback.c,v 5.62 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -27,44 +27,38 @@
* packages, i think things are ok...hopefully it's true! * packages, i think things are ok...hopefully it's true!
*/ */
static int static int
#if PROTOTYPES
GetPseudoTTY(STRING *slave, int *slaveFD) GetPseudoTTY(STRING *slave, int *slaveFD)
#else
GetPseudoTTY(slave, slaveFD)
STRING *slave;
int *slaveFD;
#endif
{ {
#if HAVE_OPENPTY #if HAVE_OPENPTY
int fd = -1; int fd = -1;
int sfd = -1; int sfd = -1;
int opty = 0; int opty = 0;
char *pcName; char *pcName;
#if HAVE_SIGACTION # if HAVE_SIGACTION
sigset_t oldmask, newmask; sigset_t oldmask, newmask;
#else # else
extern RETSIGTYPE FlagReapVirt PARAMS((int)); extern RETSIGTYPE FlagReapVirt(int);
#endif # endif
#if HAVE_SIGACTION # if HAVE_SIGACTION
sigemptyset(&newmask); sigemptyset(&newmask);
sigaddset(&newmask, SIGCHLD); sigaddset(&newmask, SIGCHLD);
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s", Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s",
strerror(errno)); strerror(errno));
#else # else
SimpleSignal(SIGCHLD, SIG_DFL); SimpleSignal(SIGCHLD, SIG_DFL);
#endif # endif
opty = openpty(&fd, &sfd, NULL, NULL, NULL); opty = openpty(&fd, &sfd, NULL, NULL, NULL);
#if HAVE_SIGACTION # if HAVE_SIGACTION
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s", Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s",
strerror(errno)); strerror(errno));
#else # else
SimpleSignal(SIGCHLD, FlagReapVirt); SimpleSignal(SIGCHLD, FlagReapVirt);
#endif # endif
if (opty != 0) { if (opty != 0) {
if (fd >= 0) if (fd >= 0)
@ -84,15 +78,15 @@ GetPseudoTTY(slave, slaveFD)
*slaveFD = sfd; *slaveFD = sfd;
return fd; return fd;
#else #else
#if (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) # if (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX)
int fd = -1; int fd = -1;
int sfd = -1; int sfd = -1;
char *pcName; char *pcName;
#if HAVE_SIGACTION # if HAVE_SIGACTION
sigset_t oldmask, newmask; sigset_t oldmask, newmask;
#else # else
extern RETSIGTYPE FlagReapVirt PARAMS((int)); extern RETSIGTYPE FlagReapVirt(int);
#endif # endif
int c; int c;
/* clone list and idea stolen from xemacs distribution */ /* clone list and idea stolen from xemacs distribution */
static char *clones[] = { static char *clones[] = {
@ -111,48 +105,48 @@ GetPseudoTTY(slave, slaveFD)
if (fd < 0) if (fd < 0)
return -1; return -1;
#if HAVE_SIGACTION # if HAVE_SIGACTION
sigemptyset(&newmask); sigemptyset(&newmask);
sigaddset(&newmask, SIGCHLD); sigaddset(&newmask, SIGCHLD);
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s", Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s",
strerror(errno)); strerror(errno));
#else # else
SimpleSignal(SIGCHLD, SIG_DFL); SimpleSignal(SIGCHLD, SIG_DFL);
#endif # endif
#if HAVE_GRANTPT # if HAVE_GRANTPT
grantpt(fd); /* change permission of slave */ grantpt(fd); /* change permission of slave */
#endif # endif
#if HAVE_SIGACTION # if HAVE_SIGACTION
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s", Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s",
strerror(errno)); strerror(errno));
#else # else
SimpleSignal(SIGCHLD, FlagReapVirt); SimpleSignal(SIGCHLD, FlagReapVirt);
#endif # endif
#if HAVE_UNLOCKPT # if HAVE_UNLOCKPT
unlockpt(fd); /* unlock slave */ unlockpt(fd); /* unlock slave */
#endif # endif
#if defined(_AIX) # if defined(_AIX)
if ((pcName = ttyname(fd)) == (char *)0) { if ((pcName = ttyname(fd)) == (char *)0) {
close(fd); close(fd);
return -1; return -1;
} }
#else # else
# if HAVE_PTSNAME # if HAVE_PTSNAME
if ((pcName = ptsname(fd)) == (char *)0) { if ((pcName = ptsname(fd)) == (char *)0) {
close(fd); close(fd);
return -1; return -1;
} }
# else # else
close(fd); close(fd);
return -1; return -1;
# endif # endif
#endif # endif
/* go ahead and open the slave */ /* go ahead and open the slave */
if ((sfd = open(pcName, O_RDWR, 0)) < 0) { if ((sfd = open(pcName, O_RDWR, 0)) < 0) {
@ -166,7 +160,7 @@ GetPseudoTTY(slave, slaveFD)
*slaveFD = sfd; *slaveFD = sfd;
return fd; return fd;
#else # else
/* /*
* Below is the string for finding /dev/ptyXX. For each architecture we * 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 * leave some pty's world writable because we don't have source for
@ -234,7 +228,7 @@ GetPseudoTTY(slave, slaveFD)
*slaveFD = sfd; *slaveFD = sfd;
return fd; return fd;
#endif /* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */ # endif /* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */
#endif /* HAVE_OPENPTY */ #endif /* HAVE_OPENPTY */
} }
@ -242,13 +236,7 @@ GetPseudoTTY(slave, slaveFD)
* get a pty using the GetPseudoTTY code above * get a pty using the GetPseudoTTY code above
*/ */
int int
#if PROTOTYPES
FallBack(char **slave, int *sfd) FallBack(char **slave, int *sfd)
#else
FallBack(slave, sfd)
char **slave;
int *sfd;
#endif
{ {
int fd; int fd;
static STRING *pcTSlave = (STRING *)0; static STRING *pcTSlave = (STRING *)0;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* $Id: group.h,v 5.46 2004/05/25 00:38:15 bryan Exp $ * $Id: group.h,v 5.52 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -64,23 +64,24 @@ typedef struct grpent { /* group info */
extern time_t timers[]; extern time_t timers[];
extern void Spawn PARAMS((GRPENT *)); extern void Spawn(GRPENT *, int);
extern int CheckPass PARAMS((char *, char *)); extern int CheckPass(char *, char *, FLAG);
extern void TagLogfile PARAMS((const CONSENT *, char *, ...)); extern void TagLogfile(const CONSENT *, char *, ...);
extern void TagLogfileAct PARAMS((const CONSENT *, char *, ...)); extern void TagLogfileAct(const CONSENT *, char *, ...);
extern void DestroyGroup PARAMS((GRPENT *)); extern void DestroyGroup(GRPENT *);
extern void DestroyConsent PARAMS((GRPENT *, CONSENT *)); extern void DestroyConsent(GRPENT *, CONSENT *);
extern void SendClientsMsg PARAMS((CONSENT *, char *)); extern void SendClientsMsg(CONSENT *, char *);
extern void ResetMark PARAMS((void)); extern void ResetMark(void);
extern void DestroyConsentUsers PARAMS((CONSENTUSERS **)); extern void DestroyConsentUsers(CONSENTUSERS **);
extern CONSENTUSERS *ConsentFindUser PARAMS((CONSENTUSERS *, char *)); extern CONSENTUSERS *ConsentFindUser(CONSENTUSERS *, char *);
extern int ConsentUserOk PARAMS((CONSENTUSERS *, char *)); extern int ConsentUserOk(CONSENTUSERS *, char *);
extern void DisconnectClient extern void DisconnectClient(GRPENT *, CONSCLIENT *, char *, FLAG);
PARAMS((GRPENT *, CONSCLIENT *, char *, FLAG)); extern int ClientAccess(CONSENT *, char *);
extern int ClientAccess PARAMS((CONSENT *, char *)); extern void DestroyClient(CONSCLIENT *);
extern void DestroyClient PARAMS((CONSCLIENT *)); extern int CheckPasswd(CONSCLIENT *, char *, FLAG);
extern int CheckPasswd PARAMS((CONSCLIENT *, char *)); extern void DeUtmp(GRPENT *, int);
extern void DeUtmp PARAMS((GRPENT *, int)); extern void ClientWantsWrite(CONSCLIENT *);
extern void SendIWaitClientsMsg(CONSENT *, char *);
#if HAVE_OPENSSL #if HAVE_OPENSSL
extern int AttemptSSL PARAMS((CONSCLIENT *)); extern int AttemptSSL(CONSCLIENT *);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: main.c,v 5.185 2004/05/25 23:03:01 bryan Exp $ * $Id: main.c,v 5.213 2015/06/02 17:19:31 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -44,6 +44,9 @@
#if HAVE_OPENSSL #if HAVE_OPENSSL
# include <openssl/opensslv.h> # include <openssl/opensslv.h>
#endif #endif
#if HAVE_GSSAPI
# include <gssapi/gssapi.h>
#endif
int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen = int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen =
@ -51,25 +54,31 @@ int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen =
char *pcConfig = CONFIGFILE; char *pcConfig = CONFIGFILE;
int cMaxMemb = MAXMEMB; int cMaxMemb = MAXMEMB;
#if USE_IPV6
struct addrinfo *bindAddr;
struct addrinfo *bindBaseAddr;
#else
in_addr_t bindAddr = INADDR_ANY; in_addr_t bindAddr = INADDR_ANY;
unsigned short bindPort; unsigned short bindPort;
unsigned short bindBasePort; unsigned short bindBasePort;
struct sockaddr_in in_port;
#endif
static STRING *startedMsg = (STRING *)0; static STRING *startedMsg = (STRING *)0;
CONFIG *optConf = (CONFIG *)0; CONFIG *optConf = (CONFIG *)0;
CONFIG *config = (CONFIG *)0; CONFIG *config = (CONFIG *)0;
char *interface = (char *)0; char *interface = (char *)0;
CONFIG defConfig = CONFIG defConfig =
{ (STRING *)0, 'r', FLAGFALSE, LOGFILEPATH, PASSWDFILE, DEFPORT, { (STRING *)0, FLAGTRUE, 'r', FLAGFALSE, LOGFILEPATH, PASSWDFILE,
DEFPORT,
FLAGTRUE, FLAGTRUE, 0, DEFBASEPORT, (char *)0, 0 FLAGTRUE, FLAGTRUE, 0, DEFBASEPORT, (char *)0, 0
#if HAVE_SETPROCTITLE #if HAVE_SETPROCTITLE
, FLAGFALSE , FLAGFALSE
#endif #endif
#if HAVE_OPENSSL #if HAVE_OPENSSL
, (char *)0, FLAGTRUE , (char *)0, FLAGTRUE, FLAGFALSE, (char *)0
#endif #endif
}; };
struct sockaddr_in in_port;
CONSFILE *unifiedlog = (CONSFILE *)0; CONSFILE *unifiedlog = (CONSFILE *)0;
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN #if HAVE_DMALLOC && DMALLOC_MARK_MAIN
@ -85,11 +94,7 @@ DH *dh4096 = (DH *)0;
DH * DH *
#if PROTOTYPES
GetDH512(void) GetDH512(void)
#else
GetDH512()
#endif
{ {
static unsigned char dh512_p[] = { static unsigned char dh512_p[] = {
0xF5, 0x2A, 0xFF, 0x3C, 0xE1, 0xB1, 0x29, 0x40, 0x18, 0x11, 0x8D, 0xF5, 0x2A, 0xFF, 0x3C, 0xE1, 0xB1, 0x29, 0x40, 0x18, 0x11, 0x8D,
@ -117,11 +122,7 @@ GetDH512()
} }
DH * DH *
#if PROTOTYPES
GetDH1024(void) GetDH1024(void)
#else
GetDH1024()
#endif
{ {
static unsigned char dh1024_p[] = { static unsigned char dh1024_p[] = {
0xF4, 0x88, 0xFD, 0x58, 0x4E, 0x49, 0xDB, 0xCD, 0x20, 0xB4, 0x9D, 0xF4, 0x88, 0xFD, 0x58, 0x4E, 0x49, 0xDB, 0xCD, 0x20, 0xB4, 0x9D,
@ -155,11 +156,7 @@ GetDH1024()
} }
DH * DH *
#if PROTOTYPES
GetDH2048(void) GetDH2048(void)
#else
GetDH2048()
#endif
{ {
static unsigned char dh2048_p[] = { static unsigned char dh2048_p[] = {
0xF6, 0x42, 0x57, 0xB7, 0x08, 0x7F, 0x08, 0x17, 0x72, 0xA2, 0xBA, 0xF6, 0x42, 0x57, 0xB7, 0x08, 0x7F, 0x08, 0x17, 0x72, 0xA2, 0xBA,
@ -206,11 +203,7 @@ GetDH2048()
} }
DH * DH *
#if PROTOTYPES
GetDH4096(void) GetDH4096(void)
#else
GetDH4096()
#endif
{ {
static unsigned char dh4096_p[] = { static unsigned char dh4096_p[] = {
0xFA, 0x14, 0x72, 0x52, 0xC1, 0x4D, 0xE1, 0x5A, 0x49, 0xD4, 0xEF, 0xFA, 0x14, 0x72, 0x52, 0xC1, 0x4D, 0xE1, 0x5A, 0x49, 0xD4, 0xEF,
@ -283,14 +276,7 @@ GetDH4096()
} }
DH * DH *
#if PROTOTYPES
TmpDHCallback(SSL *ssl, int is_export, int keylength) TmpDHCallback(SSL *ssl, int is_export, int keylength)
#else
TmpDHCallback(ssl, is_export, keylength)
SSL *ssl;
int is_export;
int keylength;
#endif
{ {
CONDDEBUG((1, "TmpDHCallback(): asked for a DH key length %u", CONDDEBUG((1, "TmpDHCallback(): asked for a DH key length %u",
keylength)); keylength));
@ -315,13 +301,11 @@ TmpDHCallback(ssl, is_export, keylength)
} }
void void
#if PROTOTYPES
SetupSSL(void) SetupSSL(void)
#else
SetupSSL()
#endif
{ {
if (ctx == (SSL_CTX *)0) { if (ctx == (SSL_CTX *)0) {
char *ciphers;
int verifymode;
SSL_load_error_strings(); SSL_load_error_strings();
if (!SSL_library_init()) { if (!SSL_library_init()) {
Error("SetupSSL(): SSL_library_init() failed"); Error("SetupSSL(): SSL_library_init() failed");
@ -351,8 +335,35 @@ SetupSSL()
config->sslcredentials); config->sslcredentials);
Bye(EX_SOFTWARE); Bye(EX_SOFTWARE);
} }
ciphers = "ALL:!LOW:!EXP:!MD5:!aNULL:@STRENGTH";
} else {
ciphers = "ALL:!LOW:!EXP:!MD5:@STRENGTH";
} }
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, SSLVerifyCallback); if (config->sslcacertificatefile != (char *)0) {
STACK_OF(X509_NAME) * cert_names;
cert_names =
SSL_load_client_CA_file(config->sslcacertificatefile);
if (cert_names != NULL) {
SSL_CTX_set_client_CA_list(ctx, cert_names);
if (SSL_CTX_load_verify_locations
(ctx, config->sslcacertificatefile, NULL) != 1) {
Error("Could not setup CA certificate file to '%s'",
config->sslcacertificatefile);
Bye(EX_UNAVAILABLE);
}
} else {
Error
("SetupSSL(): could not load SSL client CA list from `%s'",
config->sslcacertificatefile);
Bye(EX_SOFTWARE);
}
}
verifymode = SSL_VERIFY_PEER;
if (config->sslreqclientcert == FLAGTRUE)
verifymode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
SSL_CTX_set_verify(ctx, verifymode, SSLVerifyCallback);
SSL_CTX_set_options(ctx, SSL_CTX_set_options(ctx,
SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_ALL | SSL_OP_NO_SSLv2 |
SSL_OP_SINGLE_DH_USE); SSL_OP_SINGLE_DH_USE);
@ -361,8 +372,7 @@ SetupSSL()
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
SSL_MODE_AUTO_RETRY); SSL_MODE_AUTO_RETRY);
SSL_CTX_set_tmp_dh_callback(ctx, TmpDHCallback); SSL_CTX_set_tmp_dh_callback(ctx, TmpDHCallback);
if (SSL_CTX_set_cipher_list(ctx, "ALL:!LOW:!EXP:!MD5:@STRENGTH") != if (SSL_CTX_set_cipher_list(ctx, ciphers) != 1) {
1) {
Error("SetupSSL(): setting SSL cipher list failed"); Error("SetupSSL(): setting SSL cipher list failed");
Bye(EX_SOFTWARE); Bye(EX_SOFTWARE);
} }
@ -374,12 +384,40 @@ SetupSSL()
} }
#endif #endif
#if HAVE_GSSAPI
gss_name_t gss_myname = GSS_C_NO_NAME;
gss_cred_id_t gss_mycreds = GSS_C_NO_CREDENTIAL;
void void
#if PROTOTYPES SetupGSSAPI(void)
ReopenLogfile(void) {
#else OM_uint32 stmaj, stmin;
ReopenLogfile() char namestr[128];
gss_buffer_desc namebuf;
snprintf(namestr, 128, "host@%s", myHostname);
namebuf.value = namestr;
namebuf.length = strlen(namestr) + 1;
stmaj =
gss_import_name(&stmin, &namebuf, GSS_C_NT_HOSTBASED_SERVICE,
&gss_myname);
/* XXX: handle error */
if (stmaj != GSS_S_COMPLETE) {
Error("gss_import_name failed");
}
/* Get some initial credentials */
stmaj =
gss_acquire_cred(&stmin, gss_myname, 0, GSS_C_NULL_OID_SET,
GSS_C_ACCEPT, &gss_mycreds, NULL, NULL);
if (stmaj != GSS_S_COMPLETE) {
Error("Could not acquire GSS-API credentials");
}
}
#endif #endif
void
ReopenLogfile(void)
{ {
static int tag = 1; static int tag = 1;
/* redirect stdout and stderr to the logfile. /* redirect stdout and stderr to the logfile.
@ -414,18 +452,14 @@ ReopenLogfile()
close(2); close(2);
dup(1); dup(1);
if (isMaster && tag) { if (isMaster && tag) {
Msg("%s", THIS_VERSION); Msg(MyVersion());
Msg("%s", startedMsg->string); Msg(startedMsg->string);
} }
tag = 0; tag = 0;
} }
void void
#if PROTOTYPES
ReopenUnifiedlog(void) ReopenUnifiedlog(void)
#else
ReopenUnifiedlog()
#endif
{ {
/* close any existing */ /* close any existing */
if (unifiedlog != (CONSFILE *)0) if (unifiedlog != (CONSFILE *)0)
@ -448,11 +482,7 @@ ReopenUnifiedlog()
/* become a daemon (ksb) /* become a daemon (ksb)
*/ */
static void static void
#if PROTOTYPES Daemonize(void)
Daemonize()
#else
Daemonize()
#endif
{ {
int res; int res;
#if !HAVE_SETSID #if !HAVE_SETSID
@ -471,6 +501,9 @@ Daemonize()
#if defined(SIGTSTP) #if defined(SIGTSTP)
SimpleSignal(SIGTSTP, SIG_IGN); SimpleSignal(SIGTSTP, SIG_IGN);
#endif #endif
#if defined(SIGXFSZ)
SimpleSignal(SIGXFSZ, SIG_IGN);
#endif
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
@ -510,12 +543,7 @@ Daemonize()
/* output a long message to the user (ksb) /* output a long message to the user (ksb)
*/ */
static void static void
#if PROTOTYPES
Usage(int wantfull) Usage(int wantfull)
#else
Usage(wantfull)
int wantfull;
#endif
{ {
static char u_terse[] = static char u_terse[] =
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M master] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]"; "[-7dDEFhinoRSuvV] [-a type] [-m max] [-M master] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]";
@ -574,11 +602,7 @@ Usage(wantfull)
/* show the user our version info (ksb) /* show the user our version info (ksb)
*/ */
static void static void
#if PROTOTYPES Version(void)
Version()
#else
Version()
#endif
{ {
static STRING *acA1 = (STRING *)0; static STRING *acA1 = (STRING *)0;
static STRING *acA2 = (STRING *)0; static STRING *acA2 = (STRING *)0;
@ -587,6 +611,9 @@ Version()
#if HAVE_DMALLOC #if HAVE_DMALLOC
"dmalloc", "dmalloc",
#endif #endif
#if HAVE_FREEIPMI
"freeipmi",
#endif
#if USE_LIBWRAP #if USE_LIBWRAP
"libwrap", "libwrap",
#endif #endif
@ -612,7 +639,7 @@ Version()
isMultiProc = 0; isMultiProc = 0;
Msg("%s", THIS_VERSION); Msg(MyVersion());
Msg("default access type `%c'", defConfig.defaultaccess); Msg("default access type `%c'", defConfig.defaultaccess);
Msg("default escape sequence `%s%s'", FmtCtl(DEFATTN, acA1), Msg("default escape sequence `%s%s'", FmtCtl(DEFATTN, acA1),
FmtCtl(DEFESC, acA2)); FmtCtl(DEFESC, acA2));
@ -649,14 +676,23 @@ Version()
BuildStringChar('0' + DMALLOC_VERSION_MINOR, acA1); BuildStringChar('0' + DMALLOC_VERSION_MINOR, acA1);
BuildStringChar('.', acA1); BuildStringChar('.', acA1);
BuildStringChar('0' + DMALLOC_VERSION_PATCH, acA1); BuildStringChar('0' + DMALLOC_VERSION_PATCH, acA1);
#if defined(DMALLOC_VERSION_BETA) # if defined(DMALLOC_VERSION_BETA)
if (DMALLOC_VERSION_BETA != 0) { if (DMALLOC_VERSION_BETA != 0) {
BuildString("-b", acA1); BuildString("-b", acA1);
BuildStringChar('0' + DMALLOC_VERSION_BETA, acA1); BuildStringChar('0' + DMALLOC_VERSION_BETA, acA1);
} }
#endif # endif
Msg("dmalloc version: %s", acA1->string); Msg("dmalloc version: %s", acA1->string);
#endif #endif
#if HAVE_FREEIPMI
BuildString((char *)0, acA1);
BuildStringChar('0' + LIBIPMICONSOLE_VERSION_MAJOR, acA1);
BuildStringChar('.', acA1);
BuildStringChar('0' + LIBIPMICONSOLE_VERSION_MINOR, acA1);
BuildStringChar('.', acA1);
BuildStringChar('0' + LIBIPMICONSOLE_VERSION_PATCH, acA1);
Msg("freeipmi version: %s", acA1->string);
#endif
#if HAVE_OPENSSL #if HAVE_OPENSSL
Msg("openssl version: %s", OPENSSL_VERSION_TEXT); Msg("openssl version: %s", OPENSSL_VERSION_TEXT);
#endif #endif
@ -668,11 +704,7 @@ Version()
} }
void void
#if PROTOTYPES
DestroyDataStructures(void) DestroyDataStructures(void)
#else
DestroyDataStructures()
#endif
{ {
GRPENT *pGE; GRPENT *pGE;
REMOTE *pRC; REMOTE *pRC;
@ -696,6 +728,7 @@ DestroyDataStructures()
pACList = pAC; pACList = pAC;
} }
DestroyConsentUsers(&pADList); DestroyConsentUsers(&pADList);
DestroyConsentUsers(&pLUList);
DestroyConfig(pConfig); DestroyConfig(pConfig);
DestroyConfig(optConf); DestroyConfig(optConf);
@ -714,22 +747,25 @@ DestroyDataStructures()
DH_free(dh4096); DH_free(dh4096);
#endif #endif
#if USE_IPV6
/* clean up addrinfo stucts */
freeaddrinfo(bindAddr);
freeaddrinfo(bindBaseAddr);
#else
if (myAddrs != (struct in_addr *)0) if (myAddrs != (struct in_addr *)0)
free(myAddrs); free(myAddrs);
#endif
DestroyBreakList(); DestroyBreakList();
DestroyTaskList();
DestroyStrings(); DestroyStrings();
DestroyUserList(); DestroyUserList();
if (substData != (SUBST *) 0) if (substData != (SUBST *)0)
free(substData); free(substData);
} }
void void
#if PROTOTYPES
SummarizeDataStructures(void) SummarizeDataStructures(void)
#else
SummarizeDataStructures()
#endif
{ {
GRPENT *pGE; GRPENT *pGE;
REMOTE *pRC; REMOTE *pRC;
@ -775,12 +811,26 @@ SummarizeDataStructures()
size += strlen(pCE->motd); size += strlen(pCE->motd);
if (pCE->idlestring != (char *)0) if (pCE->idlestring != (char *)0)
size += strlen(pCE->idlestring); size += strlen(pCE->idlestring);
if (pCE->replstring != (char *)0)
size += strlen(pCE->replstring);
if (pCE->tasklist != (char *)0)
size += strlen(pCE->tasklist);
if (pCE->breaklist != (char *)0)
size += strlen(pCE->breaklist);
#if HAVE_FREEIPMI
if (pCE->username != (char *)0)
size += strlen(pCE->username);
if (pCE->password != (char *)0)
size += strlen(pCE->password);
#endif
if (pCE->fdlog != (CONSFILE *)0) if (pCE->fdlog != (CONSFILE *)0)
size += sizeof(CONSFILE); size += sizeof(CONSFILE);
if (pCE->cofile != (CONSFILE *)0) if (pCE->cofile != (CONSFILE *)0)
size += sizeof(CONSFILE); size += sizeof(CONSFILE);
if (pCE->initfile != (CONSFILE *)0) if (pCE->initfile != (CONSFILE *)0)
size += sizeof(CONSFILE); size += sizeof(CONSFILE);
if (pCE->taskfile != (CONSFILE *)0)
size += sizeof(CONSFILE);
if (pCE->aliases != (NAMES *)0) { if (pCE->aliases != (NAMES *)0) {
NAMES *n; NAMES *n;
for (n = pCE->aliases; n != (NAMES *)0; n = n->next) { for (n = pCE->aliases; n != (NAMES *)0; n = n->next) {
@ -844,15 +894,18 @@ SummarizeDataStructures()
} }
void void
#if PROTOTYPES
DumpDataStructures(void) DumpDataStructures(void)
#else
DumpDataStructures()
#endif
{ {
GRPENT *pGE; GRPENT *pGE;
CONSENT *pCE; CONSENT *pCE;
REMOTE *pRC; REMOTE *pRC;
int i;
TASKS *t;
#if HAVE_FREEIPMI
static STRING *tmpString = (STRING *)0;
if (tmpString == (STRING *)0)
tmpString = AllocString();
#endif
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN #if HAVE_DMALLOC && DMALLOC_MARK_MAIN
CONDDEBUG((1, "DumpDataStructures(): dmalloc / MarkMain")); CONDDEBUG((1, "DumpDataStructures(): dmalloc / MarkMain"));
@ -891,8 +944,32 @@ DumpDataStructures()
EMPTYSTR(pCE->execSlave), EMPTYSTR(pCE->execSlave),
EMPTYSTR(pCE->exec), EMPTYSTR(pCE->exec),
(unsigned long)pCE->ipid)); (unsigned long)pCE->ipid));
CONDDEBUG((1,
"DumpDataStructures(): execuid=%d, execgid=%d",
pCE->execuid, pCE->execgid));
break; break;
#if HAVE_FREEIPMI
case IPMI:
CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=IPMI",
EMPTYSTR(pCE->server)));
CONDDEBUG((1,
"DumpDataStructures(): host=%s, username=%s, password=%s, ipmiprivlevel=%d",
EMPTYSTR(pCE->host),
EMPTYSTR(pCE->username),
EMPTYSTR(pCE->password),
pCE->ipmiprivlevel));
CONDDEBUG((1,
"DumpDataStructures(): ipmiwrkset=%d, ipmiworkaround=%u, ipmiciphersuite=%d",
pCE->ipmiwrkset, pCE->ipmiworkaround,
pCE->ipmiciphersuite));
FmtCtlStr(pCE->ipmikg->string, pCE->ipmikg->used - 1,
tmpString);
CONDDEBUG((1, "DumpDataStructures(): ipmikg=%s",
EMPTYSTR(tmpString->string)));
break;
#endif
case HOST: case HOST:
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=HOST", "DumpDataStructures(): server=%s, type=HOST",
@ -902,6 +979,18 @@ DumpDataStructures()
EMPTYSTR(pCE->host), FLAGSTR(pCE->raw), EMPTYSTR(pCE->host), FLAGSTR(pCE->raw),
pCE->netport, pCE->port, pCE->telnetState)); pCE->netport, pCE->port, pCE->telnetState));
break; break;
case NOOP:
CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=NOOP",
EMPTYSTR(pCE->server)));
break;
case UDS:
CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=UDS",
EMPTYSTR(pCE->server)));
CONDDEBUG((1, "DumpDataStructures(): uds=%s",
EMPTYSTR(pCE->uds)));
break;
case UNKNOWNTYPE: case UNKNOWNTYPE:
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): server=%s, type=UNKNOWNTYPE", "DumpDataStructures(): server=%s, type=UNKNOWNTYPE",
@ -928,9 +1017,9 @@ DumpDataStructures()
pCE->nolog, FileFDNum(pCE->cofile), pCE->nolog, FileFDNum(pCE->cofile),
FLAGSTR(pCE->activitylog), FLAGSTR(pCE->breaklog))); FLAGSTR(pCE->activitylog), FLAGSTR(pCE->breaklog)));
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): ixon=%s, ixany=%s, ixoff=%s", "DumpDataStructures(): tasklog=%s, ixon=%s, ixany=%s, ixoff=%s",
FLAGSTR(pCE->ixon), FLAGSTR(pCE->ixany), FLAGSTR(pCE->tasklog), FLAGSTR(pCE->ixon),
FLAGSTR(pCE->ixoff))); FLAGSTR(pCE->ixany), FLAGSTR(pCE->ixoff)));
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): autoreinit=%s, hupcl=%s, cstopb=%s, ondemand=%s", "DumpDataStructures(): autoreinit=%s, hupcl=%s, cstopb=%s, ondemand=%s",
FLAGSTR(pCE->autoreinit), FLAGSTR(pCE->hupcl), FLAGSTR(pCE->autoreinit), FLAGSTR(pCE->hupcl),
@ -940,17 +1029,26 @@ DumpDataStructures()
FLAGSTR(pCE->crtscts))); FLAGSTR(pCE->crtscts)));
#endif #endif
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): reinitoncc=%s, striphigh=%s, unloved=%s", "DumpDataStructures(): reinitoncc=%s, striphigh=%s",
FLAGSTR(pCE->reinitoncc), FLAGSTR(pCE->striphigh), FLAGSTR(pCE->reinitoncc), FLAGSTR(pCE->striphigh)));
FLAGSTR(pCE->unloved))); CONDDEBUG((1, "DumpDataStructures(): unloved=%s, login=%s",
FLAGSTR(pCE->unloved), FLAGSTR(pCE->login)));
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): initpid=%lu, initcmd=%s, initfile=%d", "DumpDataStructures(): initpid=%lu, initcmd=%s, initfile=%d",
(unsigned long)pCE->initpid, EMPTYSTR(pCE->initcmd), (unsigned long)pCE->initpid, EMPTYSTR(pCE->initcmd),
FileFDNum(pCE->initfile))); FileFDNum(pCE->initfile)));
CONDDEBUG((1, "DumpDataStructures(): inituid=%d, initgid=%d",
pCE->inituid, pCE->initgid));
CONDDEBUG((1, CONDDEBUG((1,
"DumpDataStructures(): motd=%s, idletimeout=%d, idlestring=%s", "DumpDataStructures(): motd=%s, idletimeout=%d, idlestring=%s, replstring=%s",
EMPTYSTR(pCE->motd), pCE->idletimeout, EMPTYSTR(pCE->motd), pCE->idletimeout,
EMPTYSTR(pCE->idlestring))); EMPTYSTR(pCE->idlestring),
EMPTYSTR(pCE->replstring)));
CONDDEBUG((1,
"DumpDataStructures(): tasklist=%s, breaklist=%s, taskpid=%lu, taskfile=%d",
EMPTYSTR(pCE->tasklist), EMPTYSTR(pCE->breaklist),
(unsigned long)pCE->taskpid,
FileFDNum(pCE->taskfile)));
if (pCE->ro) { if (pCE->ro) {
CONSENTUSERS *u; CONSENTUSERS *u;
for (u = pCE->ro; u != (CONSENTUSERS *)0; u = u->next) { for (u = pCE->ro; u != (CONSENTUSERS *)0; u = u->next) {
@ -978,6 +1076,20 @@ DumpDataStructures()
} }
} }
} }
for (i = 0; i < BREAKLISTSIZE; i++) {
CONDDEBUG((1,
"DumpDataStructures(): break: #%c, string=%s, delay=%d, confirm=%s",
'1' + i + (i > 8 ? BREAKALPHAOFFSET : 0),
EMPTYSTR(breakList[i].seq->string), breakList[i].delay,
FLAGSTR(breakList[i].confirm)));
}
for (t = taskList; t != (TASKS *)0; t = t->next) {
CONDDEBUG((1,
"DumpDataStructures(): task: id=%c, cmd=%s, descr=%s, uid=%d, gid=%d, subst=%s, confirm=%s",
t->id, EMPTYSTR(t->cmd->string),
EMPTYSTR(t->descr->string), t->uid, t->gid,
EMPTYSTR(t->subst), FLAGSTR(t->confirm)));
}
} }
/* This makes sure a directory exists and tries to create it if it /* This makes sure a directory exists and tries to create it if it
@ -985,17 +1097,14 @@ DumpDataStructures()
*/ */
#if USE_UNIX_DOMAIN_SOCKETS #if USE_UNIX_DOMAIN_SOCKETS
int int
#if PROTOTYPES
VerifyEmptyDirectory(char *d) VerifyEmptyDirectory(char *d)
#else
VerifyEmptyDirectory(d)
char *d;
#endif
{ {
struct stat dstat; struct stat dstat;
DIR *dir; DIR *dir;
struct dirent *de; struct dirent *de;
# if 0 /* See below */
STRING *path = (STRING *)0; STRING *path = (STRING *)0;
# endif
int retval = 0; int retval = 0;
while (1) { while (1) {
@ -1036,7 +1145,7 @@ VerifyEmptyDirectory(d)
* database, config files, etc. too many important files could be * database, config files, etc. too many important files could be
* shredded with a small typo. * shredded with a small typo.
*/ */
#if 0 # if 0
if (path == (STRING *)0) if (path == (STRING *)0)
path = AllocString(); path = AllocString();
BuildStringPrint(path, "%s/%s", d, de->d_name); BuildStringPrint(path, "%s/%s", d, de->d_name);
@ -1058,11 +1167,16 @@ VerifyEmptyDirectory(d)
break; break;
} }
} }
#endif # endif
} }
# if 0 /* See above */
if (path != (STRING *)0) if (path != (STRING *)0)
DestroyString(path); DestroyString(path);
# endif
/* free dir data structure */
closedir(dir);
return retval; return retval;
} }
@ -1077,13 +1191,7 @@ VerifyEmptyDirectory(d)
* exit happy * exit happy
*/ */
int int
#if PROTOTYPES
main(int argc, char **argv) main(int argc, char **argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{ {
int i; int i;
FILE *fpConfig = (FILE *)0; FILE *fpConfig = (FILE *)0;
@ -1096,9 +1204,14 @@ main(argc, argv)
int curuid = 0; int curuid = 0;
GRPENT *pGE = (GRPENT *)0; GRPENT *pGE = (GRPENT *)0;
#if !USE_UNIX_DOMAIN_SOCKETS #if !USE_UNIX_DOMAIN_SOCKETS
#if HAVE_INET_ATON # if USE_IPV6
int s;
struct addrinfo hints;
# else
# if HAVE_INET_ATON
struct in_addr inetaddr; struct in_addr inetaddr;
#endif # endif
# endif
#endif #endif
isMultiProc = 1; /* make sure stuff has the pid */ isMultiProc = 1; /* make sure stuff has the pid */
@ -1129,6 +1242,9 @@ main(argc, argv)
setvbuf(stderr, NULL, _IOLBF, BUFSIZ); setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
#endif #endif
/* Initialize the break list */
InitBreakList();
/* prep the config options */ /* prep the config options */
if ((optConf = (CONFIG *)calloc(1, sizeof(CONFIG))) if ((optConf = (CONFIG *)calloc(1, sizeof(CONFIG)))
== (CONFIG *)0) == (CONFIG *)0)
@ -1258,7 +1374,7 @@ main(argc, argv)
Bye(EX_OK); Bye(EX_OK);
} }
Msg("%s", THIS_VERSION); Msg(MyVersion());
#if HAVE_GETLOGIN #if HAVE_GETLOGIN
origuser = getlogin(); origuser = getlogin();
@ -1296,7 +1412,115 @@ main(argc, argv)
if (fSyntaxOnly) if (fSyntaxOnly)
Msg("performing configuration file syntax check"); Msg("performing configuration file syntax check");
#if USE_UNIX_DOMAIN_SOCKETS /* must do all this so IsMe() works right */
if (gethostname(myHostname, MAXHOSTNAME) != 0) {
Error("gethostname(): %s", strerror(errno));
Bye(EX_OSERR);
}
#if !USE_IPV6
ProbeInterfaces(bindAddr);
#endif
/* initialize the timers */
for (i = 0; i < T_MAX; i++)
timers[i] = (time_t)0;
/* read the config file */
if ((FILE *)0 == (fpConfig = fopen(pcConfig, "r"))) {
Error("fopen(%s): %s", pcConfig, strerror(errno));
Bye(EX_NOINPUT);
}
ReadCfg(pcConfig, fpConfig);
fclose(fpConfig);
#if !USE_UNIX_DOMAIN_SOCKETS
/* set up the port to bind to */
if (optConf->primaryport != (char *)0)
config->primaryport = StrDup(optConf->primaryport);
else if (pConfig->primaryport != (char *)0)
config->primaryport = StrDup(pConfig->primaryport);
else
config->primaryport = StrDup(defConfig.primaryport);
if (config->primaryport == (char *)0)
OutOfMem();
# if !USE_IPV6
/* Look for non-numeric characters */
for (i = 0; config->primaryport[i] != '\000'; i++)
if (!isdigit((int)config->primaryport[i]))
break;
if (config->primaryport[i] == '\000') {
/* numeric only */
bindPort = atoi(config->primaryport);
} else {
/* non-numeric only */
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->primaryport, "tcp"))) {
Error("getservbyname(%s) failed", config->primaryport);
Bye(EX_OSERR);
} else {
bindPort = ntohs((unsigned short)pSE->s_port);
}
}
# endif
/* set up the secondary port to bind to */
if (optConf->secondaryport != (char *)0)
config->secondaryport = StrDup(optConf->secondaryport);
else if (pConfig->secondaryport != (char *)0)
config->secondaryport = StrDup(pConfig->secondaryport);
else
config->secondaryport = StrDup(defConfig.secondaryport);
if (config->secondaryport == (char *)0)
OutOfMem();
# if !USE_IPV6
/* Look for non-numeric characters */
for (i = 0; config->secondaryport[i] != '\000'; i++)
if (!isdigit((int)config->secondaryport[i]))
break;
if (config->secondaryport[i] == '\000') {
/* numeric only */
bindBasePort = atoi(config->secondaryport);
} else {
/* non-numeric only */
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->secondaryport, "tcp"))) {
Error("getservbyname(%s) failed", config->secondaryport);
Bye(EX_OSERR);
} else {
bindBasePort = ntohs((unsigned short)pSE->s_port);
}
}
# endif
#endif
#if USE_IPV6
/* set up the address to bind to */
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags |= AI_PASSIVE;
/* create list or IPs suitable for primaryport */
s = getaddrinfo(interface, config->primaryport, &hints, &bindAddr);
if (s) {
Error("getaddrinfo(%s): %s", interface, gai_strerror(s));
Bye(EX_OSERR);
}
/* create list or IPs suitable for secondaryport */
s = getaddrinfo(interface, config->secondaryport, &hints,
&bindBaseAddr);
if (s) {
Error("getaddrinfo(%s): %s", interface, gai_strerror(s));
Bye(EX_OSERR);
}
#elif USE_UNIX_DOMAIN_SOCKETS
/* Don't do any redirects if we're purely local /* Don't do any redirects if we're purely local
* (but it allows them to see where remote consoles are) * (but it allows them to see where remote consoles are)
*/ */
@ -1330,87 +1554,6 @@ main(argc, argv)
} }
#endif #endif
/* must do all this so IsMe() works right */
if (gethostname(myHostname, MAXHOSTNAME) != 0) {
Error("gethostname(): %s", strerror(errno));
Bye(EX_OSERR);
}
ProbeInterfaces(bindAddr);
/* initialize the timers */
for (i = 0; i < T_MAX; i++)
timers[i] = (time_t)0;
/* read the config file */
if ((FILE *)0 == (fpConfig = fopen(pcConfig, "r"))) {
Error("fopen(%s): %s", pcConfig, strerror(errno));
Bye(EX_NOINPUT);
}
ReadCfg(pcConfig, fpConfig);
fclose(fpConfig);
#if !USE_UNIX_DOMAIN_SOCKETS
/* set up the port to bind to */
if (optConf->primaryport != (char *)0)
config->primaryport = StrDup(optConf->primaryport);
else if (pConfig->primaryport != (char *)0)
config->primaryport = StrDup(pConfig->primaryport);
else
config->primaryport = StrDup(defConfig.primaryport);
if (config->primaryport == (char *)0)
OutOfMem();
/* Look for non-numeric characters */
for (i = 0; config->primaryport[i] != '\000'; i++)
if (!isdigit((int)config->primaryport[i]))
break;
if (config->primaryport[i] == '\000') {
/* numeric only */
bindPort = atoi(config->primaryport);
} else {
/* non-numeric only */
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->primaryport, "tcp"))) {
Error("getservbyname(%s) failed", config->primaryport);
Bye(EX_OSERR);
} else {
bindPort = ntohs((unsigned short)pSE->s_port);
}
}
/* set up the secondary port to bind to */
if (optConf->secondaryport != (char *)0)
config->secondaryport = StrDup(optConf->secondaryport);
else if (pConfig->secondaryport != (char *)0)
config->secondaryport = StrDup(pConfig->secondaryport);
else
config->secondaryport = StrDup(defConfig.secondaryport);
if (config->secondaryport == (char *)0)
OutOfMem();
/* Look for non-numeric characters */
for (i = 0; config->secondaryport[i] != '\000'; i++)
if (!isdigit((int)config->secondaryport[i]))
break;
if (config->secondaryport[i] == '\000') {
/* numeric only */
bindBasePort = atoi(config->secondaryport);
} else {
/* non-numeric only */
struct servent *pSE;
if ((struct servent *)0 ==
(pSE = getservbyname(config->secondaryport, "tcp"))) {
Error("getservbyname(%s) failed", config->secondaryport);
Bye(EX_OSERR);
} else {
bindBasePort = ntohs((unsigned short)pSE->s_port);
}
}
#endif
if (optConf->passwdfile != (char *)0) if (optConf->passwdfile != (char *)0)
config->passwdfile = StrDup(optConf->passwdfile); config->passwdfile = StrDup(optConf->passwdfile);
else if (pConfig->passwdfile != (char *)0) else if (pConfig->passwdfile != (char *)0)
@ -1457,6 +1600,13 @@ main(argc, argv)
else else
config->redirect = defConfig.redirect; config->redirect = defConfig.redirect;
if (optConf->autocomplete != FLAGUNKNOWN)
config->autocomplete = optConf->autocomplete;
else if (pConfig->autocomplete != FLAGUNKNOWN)
config->autocomplete = pConfig->autocomplete;
else
config->autocomplete = defConfig.autocomplete;
if (optConf->loghostnames != FLAGUNKNOWN) if (optConf->loghostnames != FLAGUNKNOWN)
config->loghostnames = optConf->loghostnames; config->loghostnames = optConf->loghostnames;
else if (pConfig->loghostnames != FLAGUNKNOWN) else if (pConfig->loghostnames != FLAGUNKNOWN)
@ -1493,12 +1643,29 @@ main(argc, argv)
else else
config->sslrequired = defConfig.sslrequired; config->sslrequired = defConfig.sslrequired;
if (optConf->sslreqclientcert != FLAGUNKNOWN)
config->sslreqclientcert = optConf->sslreqclientcert;
else if (pConfig->sslreqclientcert != FLAGUNKNOWN)
config->sslreqclientcert = pConfig->sslreqclientcert;
else
config->sslreqclientcert = defConfig.sslreqclientcert;
if (optConf->sslcredentials != (char *)0) if (optConf->sslcredentials != (char *)0)
config->sslcredentials = StrDup(optConf->sslcredentials); config->sslcredentials = StrDup(optConf->sslcredentials);
else if (pConfig->sslcredentials != (char *)0) else if (pConfig->sslcredentials != (char *)0)
config->sslcredentials = StrDup(pConfig->sslcredentials); config->sslcredentials = StrDup(pConfig->sslcredentials);
else else
config->sslcredentials = StrDup(defConfig.sslcredentials); config->sslcredentials = StrDup(defConfig.sslcredentials);
if (optConf->sslcacertificatefile != (char *)0)
config->sslcacertificatefile =
StrDup(optConf->sslcacertificatefile);
else if (pConfig->sslcacertificatefile != (char *)0)
config->sslcacertificatefile =
StrDup(pConfig->sslcacertificatefile);
else
config->sslcacertificatefile =
StrDup(defConfig.sslcacertificatefile);
#endif #endif
#if HAVE_SETPROCTITLE #if HAVE_SETPROCTITLE
@ -1527,6 +1694,9 @@ main(argc, argv)
/* Prep the SSL layer */ /* Prep the SSL layer */
SetupSSL(); SetupSSL();
#endif #endif
#if HAVE_GSSAPI
SetupGSSAPI();
#endif
if (config->daemonmode == FLAGTRUE) if (config->daemonmode == FLAGTRUE)
Daemonize(); Daemonize();
@ -1536,7 +1706,11 @@ main(argc, argv)
/* if no one can use us we need to come up with a default /* if no one can use us we need to come up with a default
*/ */
if (pACList == (ACCESS *)0) if (pACList == (ACCESS *)0)
#if USE_IPV6
SetDefAccess();
#else
SetDefAccess(myAddrs, myHostname); SetDefAccess(myAddrs, myHostname);
#endif
/* spawn all the children, so fix kids has an initial pid /* spawn all the children, so fix kids has an initial pid
*/ */
@ -1544,7 +1718,7 @@ main(argc, argv)
if (pGE->imembers == 0) if (pGE->imembers == 0)
continue; continue;
Spawn(pGE); Spawn(pGE, -1);
Verbose("group #%d pid %lu on port %hu", pGE->id, Verbose("group #%d pid %lu on port %hu", pGE->id,
(unsigned long)pGE->pid, pGE->port); (unsigned long)pGE->pid, pGE->port);
} }
@ -1558,13 +1732,15 @@ main(argc, argv)
local += pGE->imembers; local += pGE->imembers;
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext) for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
remote++; remote++;
# if USE_UNIX_DOMAIN_SOCKETS setproctitle("master: port %hu, %d local, %d remote",
setproctitle("master: port 0, %d local, %d remote", local, # if USE_IPV6
remote); config->primaryport,
#else # elif USE_UNIX_DOMAIN_SOCKETS
setproctitle("master: port %hu, %d local, %d remote", bindPort, 0,
# else
bindPort,
# endif
local, remote); local, remote);
#endif
} }
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: main.h,v 5.53 2004/05/21 04:15:17 bryan Exp $ * $Id: main.h,v 5.55 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -39,11 +39,16 @@
extern char rcsid[]; extern char rcsid[];
extern int fAll, fNoinit, fInteractive, fStrip, fDaemon, fReopen, extern int fAll, fNoinit, fInteractive, fStrip, fDaemon, fReopen,
fNoautoreup, fSyntaxOnly; fNoautoreup, fSyntaxOnly;
#if USE_IPV6
extern struct addrinfo *bindAddr;
extern struct addrinfo *bindBaseAddr;
#else
extern in_addr_t bindAddr; extern in_addr_t bindAddr;
extern struct sockaddr_in in_port;
#endif
extern unsigned short bindPort, bindBasePort; extern unsigned short bindPort, bindBasePort;
extern char *pcConfig; extern char *pcConfig;
extern int cMaxMemb; extern int cMaxMemb;
extern struct sockaddr_in in_port;
extern CONFIG *optConf; extern CONFIG *optConf;
extern CONFIG *config; extern CONFIG *config;
extern CONFIG defConfig; extern CONFIG defConfig;
@ -54,6 +59,10 @@ extern char *interface;
#if HAVE_OPENSSL #if HAVE_OPENSSL
extern SSL_CTX *ctx; extern SSL_CTX *ctx;
#endif #endif
extern void ReopenLogfile PARAMS((void)); #if HAVE_GSSAPI
extern void ReopenUnifiedlog PARAMS((void)); extern gss_name_t gss_myname;
extern void DumpDataStructures PARAMS((void)); extern gss_cred_id_t gss_mycreds;
#endif
extern void ReopenLogfile(void);
extern void ReopenUnifiedlog(void);
extern void DumpDataStructures(void);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: master.c,v 5.126 2004/05/06 02:09:07 bryan Exp $ * $Id: master.c,v 5.141 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -36,7 +36,6 @@
#include <access.h> #include <access.h>
#include <master.h> #include <master.h>
#include <readcfg.h> #include <readcfg.h>
#include <version.h>
#include <main.h> #include <main.h>
@ -50,12 +49,7 @@ static unsigned long dmallocMarkClientConnection = 0;
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagSawCHLD(int sig) FlagSawCHLD(int sig)
#else
FlagSawCHLD(sig)
int sig;
#endif
{ {
fSawCHLD = 1; fSawCHLD = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -67,11 +61,7 @@ FlagSawCHLD(sig)
* Called when master process receives SIGCHLD * Called when master process receives SIGCHLD
*/ */
static void static void
#if PROTOTYPES FixKids(int msfd)
FixKids()
#else
FixKids()
#endif
{ {
pid_t pid; pid_t pid;
int UWbuf; int UWbuf;
@ -124,7 +114,7 @@ FixKids()
/* this kid kid is dead, start another /* this kid kid is dead, start another
*/ */
Spawn(pGE); Spawn(pGE, msfd);
Verbose("group #%d pid %lu on port %hu", pGE->id, Verbose("group #%d pid %lu on port %hu", pGE->id,
(unsigned long)pGE->pid, pGE->port); (unsigned long)pGE->pid, pGE->port);
} }
@ -135,12 +125,7 @@ FixKids()
* Called when master process receives SIGTERM * Called when master process receives SIGTERM
*/ */
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagQuitIt(int arg) FlagQuitIt(int arg)
#else
FlagQuitIt(arg)
int arg;
#endif
{ {
fSawQuit = 1; fSawQuit = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -152,12 +137,7 @@ FlagQuitIt(arg)
* want to do something special on SIGINT at some point. * want to do something special on SIGINT at some point.
*/ */
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagSawINT(int arg) FlagSawINT(int arg)
#else
FlagSawINT(arg)
int arg;
#endif
{ {
fSawQuit = 1; fSawQuit = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -166,12 +146,7 @@ FlagSawINT(arg)
} }
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagSawHUP(int arg) FlagSawHUP(int arg)
#else
FlagSawHUP(arg)
int arg;
#endif
{ {
fSawHUP = 1; fSawHUP = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -180,12 +155,7 @@ FlagSawHUP(arg)
} }
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagSawUSR2(int arg) FlagSawUSR2(int arg)
#else
FlagSawUSR2(arg)
int arg;
#endif
{ {
fSawUSR2 = 1; fSawUSR2 = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -194,12 +164,7 @@ FlagSawUSR2(arg)
} }
static RETSIGTYPE static RETSIGTYPE
#if PROTOTYPES
FlagSawUSR1(int arg) FlagSawUSR1(int arg)
#else
FlagSawUSR1(arg)
int arg;
#endif
{ {
fSawUSR1 = 1; fSawUSR1 = 1;
#if !HAVE_SIGACTION #if !HAVE_SIGACTION
@ -210,12 +175,7 @@ FlagSawUSR1(arg)
/* Signal all the kids... /* Signal all the kids...
*/ */
void void
#if PROTOTYPES
SignalKids(int arg) SignalKids(int arg)
#else
SignalKids(arg)
int arg;
#endif
{ {
GRPENT *pGE; GRPENT *pGE;
@ -232,12 +192,7 @@ SignalKids(arg)
} }
REMOTE * REMOTE *
#if PROTOTYPES
FindRemoteConsole(char *args) FindRemoteConsole(char *args)
#else
FindRemoteConsole(args)
char *args;
#endif
{ {
REMOTE *pRC; REMOTE *pRC;
NAMES *name; NAMES *name;
@ -254,13 +209,7 @@ FindRemoteConsole(args)
} }
void void
#if PROTOTYPES
CommandCall(CONSCLIENT *pCL, char *args) CommandCall(CONSCLIENT *pCL, char *args)
#else
CommandCall(pCL, args)
CONSCLIENT *pCL;
char *args;
#endif
{ {
int found; int found;
REMOTE *pRC, *pRCFound; REMOTE *pRC, *pRCFound;
@ -292,7 +241,8 @@ CommandCall(pCL, args)
pRCFound = pRC; pRCFound = pRC;
} }
} }
if (found == 0) { /* Then look for substring matches */ if (found == 0 && config->autocomplete == FLAGTRUE) {
/* Then look for substring matches */
NAMES *name = (NAMES *)0; NAMES *name = (NAMES *)0;
int foundOne = 0; int foundOne = 0;
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) { for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
@ -382,13 +332,7 @@ CommandCall(pCL, args)
} }
void void
#if PROTOTYPES
DropMasterClient(CONSCLIENT *pCLServing, FLAG force) DropMasterClient(CONSCLIENT *pCLServing, FLAG force)
#else
DropMasterClient(pCLServing, force)
CONSCLIENT *pCLServing;
FLAG force;
#endif
{ {
/* if we have data buffered and aren't forced to close, /* if we have data buffered and aren't forced to close,
* we can't close quite yet * we can't close quite yet
@ -424,12 +368,7 @@ DropMasterClient(pCLServing, force)
} }
void void
#if PROTOTYPES
DoNormalRead(CONSCLIENT *pCLServing) DoNormalRead(CONSCLIENT *pCLServing)
#else
DoNormalRead(pCLServing)
CONSCLIENT *pCLServing;
#endif
{ {
char *pcCmd; char *pcCmd;
char *pcArgs; char *pcArgs;
@ -460,8 +399,9 @@ DoNormalRead(pCLServing)
/* process password here...before we corrupt accmd */ /* process password here...before we corrupt accmd */
if (pCLServing->iState == S_PASSWD) { if (pCLServing->iState == S_PASSWD) {
if (CheckPasswd(pCLServing, pCLServing->accmd->string) != if (CheckPasswd
AUTH_SUCCESS) { (pCLServing, pCLServing->accmd->string, FLAGFALSE)
!= AUTH_SUCCESS) {
FileWrite(pCLServing->fd, FLAGFALSE, FileWrite(pCLServing->fd, FLAGFALSE,
"invalid password\r\n", -1); "invalid password\r\n", -1);
BuildString((char *)0, pCLServing->accmd); BuildString((char *)0, pCLServing->accmd);
@ -492,19 +432,25 @@ DoNormalRead(pCLServing)
"login log in\r\n", "login log in\r\n",
#if HAVE_OPENSSL #if HAVE_OPENSSL
"ssl start ssl session\r\n", "ssl start ssl session\r\n",
#endif
#if HAVE_GSSAPI
"gssapi log in with gssapi\r\n",
#endif #endif
(char *)0 (char *)0
}; };
static char *apcHelp2[] = { static char *apcHelp2[] = {
"call provide port for given console\r\n", "call provide port for given console\r\n",
"exit disconnect\r\n", "exit disconnect\r\n",
"groups provide ports for group leaders\r\n", "groups provide ports for group leaders\r\n",
"help this help message\r\n", "help this help message\r\n",
"master provide a list of master servers\r\n", "master provide a list of master servers\r\n",
"pid provide pid of master process\r\n", "newlogs* close and open all logfiles (SIGUSR2)\r\n",
"quit* terminate conserver (SIGTERM)\r\n", "pid provide pid of master process\r\n",
"restart* restart conserver (SIGHUP)\r\n", "quit* terminate conserver (SIGTERM)\r\n",
"version provide version info for server\r\n", "restart* restart conserver (SIGHUP) - deprecated\r\n",
"reconfig* reread config file (SIGHUP)\r\n",
"version provide version info for server\r\n",
"up* bring up all downed consoles (SIGUSR1)\r\n",
"* = requires admin privileges\r\n", "* = requires admin privileges\r\n",
(char *)0 (char *)0
}; };
@ -527,6 +473,14 @@ DoNormalRead(pCLServing)
DropMasterClient(pCLServing, FLAGFALSE); DropMasterClient(pCLServing, FLAGFALSE);
return; return;
} }
#endif
#if HAVE_GSSAPI
} else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "gssapi") == 0) {
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
/* Change the I/O mode right away, we'll do the read
* and accept when the select gets back to us */
pCLServing->ioState = INGSSACCEPT;
#endif #endif
} else if (pCLServing->iState == S_IDENT && } else if (pCLServing->iState == S_IDENT &&
strcmp(pcCmd, "login") == 0) { strcmp(pcCmd, "login") == 0) {
@ -549,7 +503,8 @@ DoNormalRead(pCLServing)
BuildString(pCLServing->peername->string, BuildString(pCLServing->peername->string,
pCLServing->acid); pCLServing->acid);
if (pCLServing->caccess == 't' || if (pCLServing->caccess == 't' ||
CheckPasswd(pCLServing, "") == AUTH_SUCCESS) { CheckPasswd(pCLServing, "",
FLAGTRUE) == AUTH_SUCCESS) {
pCLServing->iState = S_NORMAL; pCLServing->iState = S_NORMAL;
Verbose("<master> login %s", Verbose("<master> login %s",
pCLServing->acid->string); pCLServing->acid->string);
@ -569,11 +524,9 @@ DoNormalRead(pCLServing)
int iSep = 1; int iSep = 1;
if ((GRPENT *)0 != pGroups) { if ((GRPENT *)0 != pGroups) {
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
FilePrint(pCLServing->fd, FLAGTRUE, "@0"); SOCKADDR_STYPE lcl;
iSep = 0;
#else
struct sockaddr_in lcl;
socklen_t so = sizeof(lcl); socklen_t so = sizeof(lcl);
if (-1 == if (-1 ==
getsockname(FileFDNum(pCLServing->fd), getsockname(FileFDNum(pCLServing->fd),
@ -585,10 +538,25 @@ DoNormalRead(pCLServing)
FileFDNum(pCLServing->fd), strerror(errno)); FileFDNum(pCLServing->fd), strerror(errno));
iSep = -1; iSep = -1;
} else { } else {
# if USE_IPV6
int error;
char addr[NI_MAXHOST];
error =
getnameinfo((struct sockaddr *)&lcl, so, addr,
sizeof(addr), NULL, 0,
NI_NUMERICHOST);
if (!error)
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
addr);
# else
FilePrint(pCLServing->fd, FLAGTRUE, "@%s", FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
inet_ntoa(lcl.sin_addr)); inet_ntoa(lcl.sin_addr));
# endif
iSep = 0; iSep = 0;
} }
#else
FilePrint(pCLServing->fd, FLAGTRUE, "@0");
iSep = 0;
#endif #endif
} }
if (iSep >= 0) { if (iSep >= 0) {
@ -610,7 +578,7 @@ DoNormalRead(pCLServing)
} else if (pCLServing->iState == S_NORMAL && } else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "version") == 0) { strcmp(pcCmd, "version") == 0) {
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n", FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
THIS_VERSION); MyVersion());
} else if (pCLServing->iState == S_NORMAL && } else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "quit") == 0) { strcmp(pcCmd, "quit") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) == if (ConsentUserOk(pADList, pCLServing->username->string) ==
@ -637,6 +605,41 @@ DoNormalRead(pCLServing)
} else } else
FileWrite(pCLServing->fd, FLAGFALSE, FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1); "unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "reconfig") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- reconfiguring\r\n", -1);
Verbose("reconfig command by %s",
pCLServing->acid->string);
kill(thepid, SIGHUP);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "up") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- bringing up consoles\r\n", -1);
Verbose("up command by %s", pCLServing->acid->string);
kill(thepid, SIGUSR1);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "newlogs") == 0) {
if (ConsentUserOk(pADList, pCLServing->username->string) ==
1) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok -- opening new logfiles\r\n", -1);
Verbose("newlogs command by %s",
pCLServing->acid->string);
kill(thepid, SIGUSR2);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
"unauthorized command\r\n", -1);
} else if (pCLServing->iState == S_NORMAL && } else if (pCLServing->iState == S_NORMAL &&
strcmp(pcCmd, "groups") == 0) { strcmp(pcCmd, "groups") == 0) {
int iSep = 1; int iSep = 1;
@ -671,22 +674,24 @@ DoNormalRead(pCLServing)
/* this routine is used by the master console server process (ksb) /* this routine is used by the master console server process (ksb)
*/ */
void void
#if PROTOTYPES
Master(void) Master(void)
#else
Master()
#endif
{ {
int cfd; int cfd;
int msfd; int msfd;
socklen_t so; socklen_t so;
fd_set rmask, wmask; fd_set rmask, wmask;
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
# if USE_IPV6
struct addrinfo *rp;
# else
struct sockaddr_in master_port;
# endif
# if HAVE_SETSOCKOPT
int true = 1;
# endif
#else
struct sockaddr_un master_port; struct sockaddr_un master_port;
static STRING *portPath = (STRING *)0; static STRING *portPath = (STRING *)0;
#else
struct sockaddr_in master_port;
int true = 1;
#endif #endif
FILE *fp; FILE *fp;
CONSCLIENT *pCLServing = (CONSCLIENT *)0; CONSCLIENT *pCLServing = (CONSCLIENT *)0;
@ -704,6 +709,9 @@ Master()
#endif #endif
#if defined(SIGPOLL) #if defined(SIGPOLL)
SimpleSignal(SIGPOLL, SIG_IGN); SimpleSignal(SIGPOLL, SIG_IGN);
#endif
#if defined(SIGXFSZ)
SimpleSignal(SIGXFSZ, SIG_IGN);
#endif #endif
SimpleSignal(SIGCHLD, FlagSawCHLD); SimpleSignal(SIGCHLD, FlagSawCHLD);
SimpleSignal(SIGTERM, FlagQuitIt); SimpleSignal(SIGTERM, FlagQuitIt);
@ -723,13 +731,44 @@ Master()
/* set up port for master to listen on /* set up port for master to listen on
*/ */
#if HAVE_MEMSET #if !USE_IPV6
# if HAVE_MEMSET
memset((void *)&master_port, 0, sizeof(master_port)); memset((void *)&master_port, 0, sizeof(master_port));
#else # else
bzero((char *)&master_port, sizeof(master_port)); bzero((char *)&master_port, sizeof(master_port));
# endif
#endif #endif
#if USE_UNIX_DOMAIN_SOCKETS #if USE_IPV6
for (rp = bindAddr; rp != NULL; rp = rp->ai_next) {
if ((msfd =
socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) < 0)
continue;
# if HAVE_SETSOCKOPT
if (setsockopt
(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true,
sizeof(true)) < 0)
goto fail;
# endif
if (!SetFlags(msfd, O_NONBLOCK, 0))
goto fail;
if (bind(msfd, rp->ai_addr, rp->ai_addrlen) == 0)
break;
fail:
close(msfd);
}
if (listen(msfd, SOMAXCONN) < 0) {
Error("Master(): listen(): %s", strerror(errno));
return;
}
/* save addrlen for accept */
so = rp->ai_addrlen;
#elif USE_UNIX_DOMAIN_SOCKETS
master_port.sun_family = AF_UNIX; master_port.sun_family = AF_UNIX;
if (portPath == (STRING *)0) if (portPath == (STRING *)0)
@ -739,7 +778,8 @@ Master()
Error("Master(): path to socket too long: %s", portPath->string); Error("Master(): path to socket too long: %s", portPath->string);
return; return;
} }
strcpy(master_port.sun_path, portPath->string); StrCpy(master_port.sun_path, portPath->string,
sizeof(master_port.sun_path));
if ((msfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { if ((msfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Error("Master(): socket(AF_UNIX,SOCK_STREAM): %s", Error("Master(): socket(AF_UNIX,SOCK_STREAM): %s",
@ -761,6 +801,11 @@ Master()
strerror(errno)); strerror(errno));
return; return;
} }
# ifdef TRUST_UDS_CRED
/* Allow everyone to connect, but we later auth them via SO_PEERCRED */
chmod(master_port.sun_path, 0666);
# endif
#else #else
master_port.sin_family = AF_INET; master_port.sin_family = AF_INET;
master_port.sin_addr.s_addr = bindAddr; master_port.sin_addr.s_addr = bindAddr;
@ -813,7 +858,7 @@ Master()
for (fSawQuit = 0; !fSawQuit; /* can't close here :-( */ ) { for (fSawQuit = 0; !fSawQuit; /* can't close here :-( */ ) {
if (fSawCHLD) { if (fSawCHLD) {
fSawCHLD = 0; fSawCHLD = 0;
FixKids(); FixKids(msfd);
} }
if (fSawHUP) { if (fSawHUP) {
fSawHUP = 0; fSawHUP = 0;
@ -821,7 +866,7 @@ Master()
ReopenLogfile(); ReopenLogfile();
ReopenUnifiedlog(); ReopenUnifiedlog();
SignalKids(SIGHUP); SignalKids(SIGHUP);
ReReadCfg(msfd); ReReadCfg(msfd, msfd);
/* fix up the client descriptors since ReReadCfg() doesn't /* fix up the client descriptors since ReReadCfg() doesn't
* see them like it can in the child processes */ * see them like it can in the child processes */
for (pCL = pCLmall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) { for (pCL = pCLmall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
@ -875,6 +920,17 @@ Master()
pCLServing->ioState = ISNORMAL; pCLServing->ioState = ISNORMAL;
} }
break; break;
#endif
#if HAVE_GSSAPI
case INGSSACCEPT:
{
int r;
if ((r = AttemptGSSAPI(pCLServing)) < 0)
DropMasterClient(pCLServing, FLAGFALSE);
else if (r == 1)
pCLServing->ioState = ISNORMAL;
}
break;
#endif #endif
case ISNORMAL: case ISNORMAL:
if (FileCanRead(pCLServing->fd, &rmask, &wmask)) if (FileCanRead(pCLServing->fd, &rmask, &wmask))
@ -916,7 +972,9 @@ Master()
dmallocMarkClientConnection = dmalloc_mark(); dmallocMarkClientConnection = dmalloc_mark();
#endif #endif
#if !USE_IPV6
so = sizeof(struct sockaddr_in); so = sizeof(struct sockaddr_in);
#endif
for (cfd = 0; cfd == 0;) { for (cfd = 0; cfd == 0;) {
cfd = cfd =
accept(msfd, (struct sockaddr *)&pCLmfree->cnct_port, &so); accept(msfd, (struct sockaddr *)&pCLmfree->cnct_port, &so);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: master.h,v 5.17 2003/10/03 14:23:37 bryan Exp $ * $Id: master.h,v 5.18 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -39,5 +39,5 @@
*/ */
extern CONSCLIENT *pCLmall; extern CONSCLIENT *pCLmall;
extern CONSCLIENT *pCLmfree; extern CONSCLIENT *pCLmfree;
extern void Master PARAMS((void)); extern void Master(void);
extern void SignalKids PARAMS((int)); extern void SignalKids(int);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* $Id: readcfg.h,v 5.40 2004/05/25 23:03:01 bryan Exp $ * $Id: readcfg.h,v 5.51 2015/06/02 17:19:31 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -7,9 +7,12 @@
*/ */
#define BREAKDELAYDEFAULT 250 #define BREAKDELAYDEFAULT 250
#define BREAKLISTSIZE 35 /* ('z'-('a'-1))+('9'-('1'-1)) */
#define BREAKALPHAOFFSET 39 /* ('a'-('9'+1)) */
typedef struct config { typedef struct config {
STRING *name; STRING *name;
FLAG autocomplete;
char defaultaccess; char defaultaccess;
FLAG daemonmode; FLAG daemonmode;
char *logfile; char *logfile;
@ -27,29 +30,48 @@ typedef struct config {
#if HAVE_OPENSSL #if HAVE_OPENSSL
char *sslcredentials; char *sslcredentials;
FLAG sslrequired; FLAG sslrequired;
FLAG sslreqclientcert;
char *sslcacertificatefile;
#endif #endif
} CONFIG; } CONFIG;
typedef struct breaks { typedef struct breaks {
STRING *seq; STRING *seq;
int delay; int delay;
FLAG confirm;
} BREAKS; } BREAKS;
typedef struct tasks {
char id;
STRING *cmd;
STRING *descr;
uid_t uid;
gid_t gid;
char *subst;
FLAG confirm;
struct tasks *next;
} TASKS;
extern NAMES *userList; /* user list */ extern NAMES *userList; /* user list */
extern GRPENT *pGroups; /* group info */ extern GRPENT *pGroups; /* group info */
extern REMOTE *pRCList; /* list of remote consoles we know about */ extern REMOTE *pRCList; /* list of remote consoles we know about */
extern REMOTE *pRCUniq; /* list of uniq console servers */ extern REMOTE *pRCUniq; /* list of uniq console servers */
extern ACCESS *pACList; /* `who do you love' (or trust) */ extern ACCESS *pACList; /* `who do you love' (or trust) */
extern CONSENTUSERS *pADList; /* list of admin users */ extern CONSENTUSERS *pADList; /* list of admin users */
extern BREAKS breakList[9]; /* list of break sequences */ extern CONSENTUSERS *pLUList; /* list of limited users */
extern BREAKS breakList[BREAKLISTSIZE]; /* list of break sequences */
extern TASKS *taskList; /* list of tasks */
extern SUBST *taskSubst; /* substitution function data for tasks */
extern CONFIG *pConfig; /* settings seen by config parser */ extern CONFIG *pConfig; /* settings seen by config parser */
extern SUBST *substData; /* substitution function data */ extern SUBST *substData; /* substitution function data */
extern void ReadCfg PARAMS((char *, FILE *)); extern void ReadCfg(char *, FILE *);
extern void ReReadCfg PARAMS((int)); extern void ReReadCfg(int, int);
extern void DestroyBreakList PARAMS((void)); extern void DestroyBreakList(void);
extern void DestroyUserList PARAMS((void)); extern void InitBreakList(void);
extern void DestroyConfig PARAMS((CONFIG *)); extern void DestroyTaskList(void);
extern NAMES *FindUserList PARAMS((char *)); extern void DestroyUserList(void);
extern NAMES *AddUserList PARAMS((char *)); extern void DestroyConfig(CONFIG *);
extern CONSENT *FindConsoleName PARAMS((CONSENT *, char *)); extern NAMES *FindUserList(char *);
extern NAMES *AddUserList(char *);
extern CONSENT *FindConsoleName(CONSENT *, char *);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: version.h,v 1.62 2004/05/23 16:44:45 bryan Exp $ * $Id: version.h,v 1.82 2015/06/01 15:36:59 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -14,4 +14,8 @@
@(#) Copyright 2000 conserver.com.\n\ @(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n" All rights reserved.\n"
#define THIS_VERSION "conserver.com version 8.1.6" #define VERSION_MAJOR 8
#define VERSION_MINOR 2
#define VERSION_REV 1
#define VERSION_TEXT "conserver.com version"
#define VERSION_UINT (VERSION_MAJOR * 1000000 + VERSION_MINOR * 1000 + VERSION_REV)

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@
@ -56,6 +57,6 @@ install: console
$(MKDIR) $(DESTDIR)$(bindir) $(MKDIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) console $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) console $(DESTDIR)$(bindir)
$(MKDIR) $(DESTDIR)$(mandir)/man1 $(MKDIR) $(DESTDIR)$(mandir)/man1
$(INSTALL) console.man $(DESTDIR)$(mandir)/man1/console.1 $(INSTALL) -m 0644 console.man $(DESTDIR)$(mandir)/man1/console.1
.PHONY: clean distclean install .PHONY: clean distclean install

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,34 @@
.\" $Id: console.man,v 1.51 2004/05/25 00:38:15 bryan Exp $ .\" $Id: console.man,v 1.66 2015/06/02 17:19:31 bryan Exp $
.TH CONSOLE 1 "2004/05/25" "conserver-8.1.6" "conserver" .TH CONSOLE 1 "2015/06/02" "conserver-8.2.1" "conserver"
.SH NAME .SH NAME
console \- console server client program console \- console server client program
.SH SYNOPSIS .SH SYNOPSIS
.B console .B console
.RI [ generic-args ]
.RB [ \-aAfFsS ] .RB [ \-aAfFsS ]
.BR [ \-e
.IR esc ]
.I console
.br
.B console
.RI [ generic-args ]
.RB [ \-iIuwWx ]
.RI [ console ]
.br
.B console
.RI [ generic-args ]
.RB [ \-hPqQrRV ]
.RB [ \- [ bB ]
.IR message ]
.RB [ \-d
.RI [ user ][\f3@\fP console ]]
.RB [ \-t
.RI [ user ][\f3@\fP console ]
.IR message ]
.RB [ \- [ zZ ]
.IR cmd ]
.PP
.IR generic-args :
.RB [ \-7DEnUv ] .RB [ \-7DEnUv ]
.RB [ \-c .RB [ \-c
.IR cred ] .IR cred ]
@ -14,42 +38,8 @@ console \- console server client program
.IR master ] .IR master ]
.BR [ \-p .BR [ \-p
.IR port ] .IR port ]
.BR [ \-e
.IR esc ]
.BR [ \-l .BR [ \-l
.IR user ] .IR user ]
.I console
.br
.B console
.RB [ \-hiIPrRuVwWx ]
.RB [ \-7DEnUv ]
.RB [ \-c
.IR cred ]
.RB [ \-C
.IR config ]
.RB [ \-M
.IR master ]
.RB [ \-p
.IR port ]
.RB [ \-d
.RI [ user ][\f3@\fP console ]]
.RB [ \- [ bB ]
.IR message ]
.RB [ \-t
.RI [ user ][\f3@\fP console ]
.IR message ]
.br
.B console
.RB [ \-qQ ]
.RB [ \-7DEnUv ]
.RB [ \-c
.IR cred ]
.RB [ \-C
.IR config ]
.RB [ \-M
.IR master ]
.RB [ \-p
.IR port ]
.SH DESCRIPTION .SH DESCRIPTION
.B Console .B Console
is used to manipulate console terminals remotely or to poll running is used to manipulate console terminals remotely or to poll running
@ -61,7 +51,8 @@ In the first form above,
asks the user's password before asks the user's password before
granting interactive access to a console (on a non-trusted system), granting interactive access to a console (on a non-trusted system),
since such a session may provide single-user access. since such a session may provide single-user access.
Only as much of the console name as is required to If the server's autocompletion feature is enabled,
only as much of the console name as is required to
identify it uniquely to the server is required. identify it uniquely to the server is required.
.PP .PP
For non-interactive options, For non-interactive options,
@ -128,7 +119,7 @@ Load an SSL certificate and key from the PEM encoded file
.TP .TP
.BI \-C config .BI \-C config
Use the per-user configuration file Use the per-user configuration file
.IR conf . .IR config .
.TP .TP
.B \-d .B \-d
Disconnect the users specified by Disconnect the users specified by
@ -181,7 +172,7 @@ except it will force any existing connection into spy mode.
Display a brief help message. Display a brief help message.
.TP .TP
.B \-i .B \-i
Display information in a machine-parseable format (see below for the details). Display status information in a machine-parseable format (see below for the details).
.TP .TP
.B \-I .B \-I
Same as Same as
@ -337,6 +328,72 @@ but just acts on the primary server.
.TP .TP
.B \-x .B \-x
Show a list of consoles and devices. Show a list of consoles and devices.
.TP
.BI \-z cmd
Sends a command
.RI ( cmd )
to each server and displays the result.
The valid commands are:
.RS
.sp
.PD 0
.TP 12
.B bringup
Try to connect all consoles marked as down (this is equivalent
to sending the server a SIGUSR1)
.TP
.B SIGUSR1
Same as
.B bringup
.TP
.B help
Displays the help message
.TP
.B pid
Returns the pid of the server (this is equivalent to
.BR \-P )
.TP
.B quit
Instructs the server to shut down (this is equivalent to
.B \-q
or sending the server a SIGTERM)
.TP
.B SIGTERM
Same as
.B quit
.TP
.B reconfig
Instructs the server to reload the configuration file, then
perform the actions of
.B reopen
(this is equivalent to sending the server a SIGHUP)
.TP
.B SIGHUP
Same as
.B reconfig
.TP
.B reopen
Instructs the server to reopen all logfiles, then
perform the actions of
.B bringup
(this is equivalent to sending the server a SIGUSR2)
.TP
.B SIGUSR2
Same as
.B reopen
.TP
.B version
Returns the version of the server (this is equivalent to
.BR \-V )
.PD
.RE
.TP
.BI \-Z cmd
Same as
.B \-z
but just sends
.I cmd
to the primary server.
.PP .PP
The The
.BR \-A , .BR \-A ,
@ -349,8 +406,15 @@ making the connection (as if
were typed). were typed).
.PP .PP
The The
.BR \-i ,
.BR \-u ,
.BR \-w ", and"
.B \-x
options can be given a console name, which will limit their output to that console.
.PP
The
.B \-i .B \-i
option outputs information regarding each console in 15 colon-separated fields. option outputs status information regarding each console in 15 colon-separated fields.
.TP .TP
.I name .I name
The name of the console. The name of the console.
@ -362,7 +426,8 @@ the console.
.I type .I type
The type of console. The type of console.
Values will be a `/' for a local device, `|' for Values will be a `/' for a local device, `|' for
a command, or `!' for a remote port. a command, `!' for a remote port, `%' for a Unix domain socket,
and `#' for a noop console.
.TP .TP
.I console-details .I console-details
The details regarding the console. The details regarding the console.
@ -373,6 +438,9 @@ Commands will have values of the command, the command's pid, the
pseudo-tty, and file descriptor for the pseudo-tty. pseudo-tty, and file descriptor for the pseudo-tty.
Remote ports will have values of the remote hostname, remote port number, Remote ports will have values of the remote hostname, remote port number,
``raw'' or ``telnet'' protocol, and file descriptor for the socket connection. ``raw'' or ``telnet'' protocol, and file descriptor for the socket connection.
Unix domain sockets will have the path to the socket and the file
descriptor for the socket connection.
Noop consoles will have nothing.
.TP .TP
.I users-list .I users-list
The details of each user connected to the console. The details of each user connected to the console.
@ -441,27 +509,24 @@ The configuration file is read using the same parser as
and you should check that manpage for parser details. and you should check that manpage for parser details.
.B Console .B Console
recognizes the following configuration blocks. recognizes the following configuration blocks.
.TP 8 .TP
.B config \f3config\fP \f2hostname\fP|\f2ipaddr\fP
.RI [ " hostname " | " ipaddr " ]
.br .br
Define a configuration block for the host named Define a configuration block for the client host named
.I hostname .I hostname
or using the address or using the address
.IR ipaddr . .IR ipaddr .
If the value of ``*'' is used, the configuration block will be applied to If the value of ``*'' is used, the configuration block will be applied to
all hosts. all client hosts.
.RS .RS
.TP 15 .TP
.B escape \f3escape\fP \f2esc\fP
.I esc
.br .br
Set the escape sequence (see the Set the escape sequence (see the
.B \-e .B \-e
command-line flag). command-line flag).
.TP .TP
.B master \f3master\fP \f2master\fP
.I master
.br .br
Set the default master to Set the default master to
.I master .I master
@ -469,8 +534,18 @@ Set the default master to
.B \-M .B \-M
command-line flag). command-line flag).
.TP .TP
.B port \f3playback\fP \f2num\fP|\f3""\fP
.I port .br
Override the playback length for the
.B p
escape command to
.I num
lines (if the server supports it).
Using the special value of ``0'' will cause the client to use the number
of lines of the current terminal (if that can be determined).
If the null string (``""'') is used, the playback length will not be overridden.
.TP
\f3port\fP \f2port\fP
.br .br
Set the default port to Set the default port to
.I port .I port
@ -478,8 +553,30 @@ Set the default port to
.B \-p .B \-p
command-line flag). command-line flag).
.TP .TP
.B sslcredentials \f3replay\fP \f2num\fP|\f3""\fP
.I filename .br
Override the replay length for the
.B r
escape command to
.I num
lines (if the server supports it).
Using the special value of ``0'' will cause the client to use the number
of lines of the current terminal (if that can be determined).
If the null string (``""'') is used, the replay length will not be overridden.
.TP
\f3sslcacertificatefile\fP \f2filename\fP
.br
Load the valid CA certificates for the
.SM SSL
connection from the PEM encoded file.
.TP
\f3sslcacertificatepath\fP \f2directory\fP
.br
Load the valid CA certificates for the
.SM SSL
connection from the PEM encoded files in the directory.
.TP
\f3sslcredentials\fP \f2filename\fP
.br .br
Set the Set the
.SM SSL .SM SSL
@ -487,36 +584,26 @@ credentials file location (see the
.B \-c .B \-c
command-line flag). command-line flag).
.TP .TP
.B sslenabled \f3sslenabled\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br .br
Set whether or not encryption is attempted when talking to servers (see the Set whether or not encryption is attempted when talking to servers (see the
.B \-E .B \-E
command-line flag). command-line flag).
.TP .TP
.B sslrequired \f3sslrequired\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br .br
Set whether or not encryption is required when talking to servers (see the Set whether or not encryption is required when talking to servers (see the
.B \-U .B \-U
command-line flag). command-line flag).
.TP .TP
.B striphigh \f3striphigh\fP \f3yes\fP|\f3true\fP|\f3on\fP|\f3no\fP|\f3false\fP|\f3off\fP
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br .br
Set whether or not to strip the high bit off all data received Set whether or not to strip the high bit off all data received
(see the (see the
.B \-7 .B \-7
command-line flag). command-line flag).
.TP .TP
.B username \f3username\fP \f2user\fP
.I user
.br .br
Set the username passed to the server to Set the username passed to the server to
.I user .I user
@ -524,19 +611,16 @@ Set the username passed to the server to
.B \-l .B \-l
command-line flag). command-line flag).
.RE .RE
.TP 8 .TP
.B terminal \f3terminal\fP \f2type\fP
.I type
.br .br
Define a configuration block when using a terminal of type Define a configuration block when using a terminal of type
.IR type . .IR type .
If the value of ``*'' is used, the configuration block will be applied to If the value of ``*'' is used, the configuration block will be applied to
all terminal types. all terminal types.
.RS .RS
.TP 15 .TP
.B attach \f3attach\fP \f2string\fP|\f3""\fP
.RI [ " string "
| "" ]
.br .br
Set a Set a
.I string .I string
@ -546,7 +630,7 @@ Character substitions will be performed based on the
value and occur value and occur
.I before .I before
interpretation of the special characters below. interpretation of the special characters below.
If the null string (``""'') is used, no string will be printed. If the null string (``\f3""\fP'') is used, no string will be printed.
.I string .I string
is a simple character string with the exception of `\e' is a simple character string with the exception of `\e'
and `^': and `^':
@ -619,16 +703,14 @@ terminal xterm {
.ft .ft
.RE .RE
.TP .TP
.B attachsubst \f3attachsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
| "" ]
.br .br
Perform character substitutions on the Perform character substitutions on the
.B attach .B attach
value. value.
A series of replacements can be defined by specifying a A series of replacements can be defined by specifying a
comma-separated list of comma-separated list of
\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP
sequences where sequences where
.I c .I c
is any printable character, is any printable character,
@ -680,11 +762,9 @@ begins with a 0, and space characters otherwise.
.I f .I f
must be either `d', `x' or `X', specifying a decimal, lower-case must be either `d', `x' or `X', specifying a decimal, lower-case
hexadecimal, or an uppercase hexadecimal conversion. hexadecimal, or an uppercase hexadecimal conversion.
If the null string (``""'') is used, no replacements will be done. If the null string (``\f3""\fP'') is used, no replacements will be done.
.TP 15 .TP
.B detach \f3detach\fP \f2string\fP|\f3""\fP
.RI [ " string "
| "" ]
.br .br
Set a Set a
.I string .I string
@ -696,11 +776,9 @@ See the
.B attach .B attach
option for an explanation of option for an explanation of
.IR string . .IR string .
If the null string (``""'') is used, no string will be printed. If the null string (``\f3""\fP'') is used, no string will be printed.
.TP .TP
.B detachsubst \f3detachsubst\fP \f2c\fP\f3=\fP\f2t\fP[\f2n\fP]\f2f\fP[\f3,\fP...]|\f3""\fP
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
| "" ]
.br .br
Perform character substitutions on the Perform character substitutions on the
.B detach .B detach
@ -779,7 +857,7 @@ list the break sequences available
.B l0 .B l0
send the break sequence associated with this console send the break sequence associated with this console
.TP .TP
.B l1-9 .B l1-9a-z
send the specific break sequence send the specific break sequence
.TP .TP
.B m .B m
@ -790,13 +868,19 @@ close (if open) and reopen the line (to clear errors (silo overflows))
and the log file and the log file
.TP .TP
.B p .B p
replay the last 60 lines of output playback the last 60 lines of output
.TP
.B P
set number of playback lines
.TP .TP
.B r .B r
replay the last 20 lines of output replay the last 20 lines of output
.TP .TP
.B R
set number of replay lines
.TP
.B s .B s
switch to spy mode (read-only) switch to spy mode (read only)
.TP .TP
.B u .B u
show status of hosts/users in this group show status of hosts/users in this group
@ -813,6 +897,9 @@ examine this group's devices and modes
.B z .B z
suspend this connection suspend this connection
.TP .TP
.B !
invoke task
.TP
.B | .B |
attach a local command to the console attach a local command to the console
.TP .TP
@ -834,7 +921,7 @@ specify three octal digits)
If any other character is hit after the escape sequence, all three characters If any other character is hit after the escape sequence, all three characters
will be discarded. will be discarded.
Note that a line break or a down command Note that a line break or a down command
can only be sent from a full two-way attachment. can only be sent from a read-write connection.
To send the escape sequence through the connection one must redefine To send the escape sequence through the connection one must redefine
the outer escape sequence, or use the outer escape sequence, or use
.BI ^Ec\e ooo .BI ^Ec\e ooo
@ -845,16 +932,16 @@ In the
.B \-u .B \-u
output, the login ``<none>'' indicates no one is output, the login ``<none>'' indicates no one is
viewing that console, and the login ``<spies>'' indicates that viewing that console, and the login ``<spies>'' indicates that
no one has a full two-way attachment. no one has a read-write connection (only read-only).
.PP .PP
When running a local command via When running a local command via
.RB `` ^Ec| '', .RB `` ^Ec| '',
you can type you can type
.B ^C .RB ` ^C '
to send the command a SIGHUP, to send the command a SIGHUP,
.B ^\e .RB ` ^\e '
to send the command a SIGKILL, and to send the command a SIGKILL, and
.B o .RB ` o '
to toggle the display of the console data. to toggle the display of the console data.
.SH EXAMPLES .SH EXAMPLES
.TP 15 .TP 15
@ -920,7 +1007,7 @@ to see the defaults set at compile time.
.B /etc/console.cf .B /etc/console.cf
system-wide configuration file system-wide configuration file
.TP .TP
.B $HOME/.consolerc .B \s-1$HOME\s0/.consolerc
per-user configuration file per-user configuration file
.PD .PD
.SH BUGS .SH BUGS

View File

@ -1,5 +1,5 @@
/* /*
* $Id: getpassword.c,v 1.8 2003/11/20 13:56:41 bryan Exp $ * $Id: getpassword.c,v 1.9 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -31,12 +31,7 @@ static STRING *pass = (STRING *)0;
* we really use cbreak at PUCC because we need even parity... * we really use cbreak at PUCC because we need even parity...
*/ */
static void static void
#if PROTOTYPES
C2Raw(int fd) C2Raw(int fd)
#else
C2Raw(fd)
int fd;
#endif
{ {
struct termios n_tios; struct termios n_tios;
@ -64,12 +59,7 @@ C2Raw(fd)
* put the tty back as it was, however that was * put the tty back as it was, however that was
*/ */
static void static void
#if PROTOTYPES
C2Normal(int fd) C2Normal(int fd)
#else
C2Normal(fd)
int fd;
#endif
{ {
if (!screwy) if (!screwy)
return; return;
@ -78,12 +68,7 @@ C2Normal(fd)
} }
char * char *
#if PROTOTYPES
GetPassword(char *prompt) GetPassword(char *prompt)
#else
GetPassword(prompt)
char *prompt;
#endif
{ {
int fd; int fd;
int nc; int nc;
@ -140,11 +125,7 @@ GetPassword(prompt)
} }
void void
#if PROTOTYPES
ClearPassword(void) ClearPassword(void)
#else
ClearPassword()
#endif
{ {
if (pass == (STRING *)0 || pass->allocated == 0) if (pass == (STRING *)0 || pass->allocated == 0)
return; return;

View File

@ -1,10 +1,10 @@
/* /*
* $Id: getpassword.h,v 1.3 2003/09/11 09:10:58 bryan Exp $ * $Id: getpassword.h,v 1.4 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com) * Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/ */
extern char *GetPassword PARAMS((char *)); extern char *GetPassword(char *);
extern void *ClearPassword PARAMS((void)); extern void *ClearPassword(void);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: readconf.c,v 5.2 2004/05/25 00:38:15 bryan Exp $ * $Id: readconf.c,v 5.8 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -19,12 +19,7 @@ TERM *parserTermDefault = (TERM *)0;
TERM *pTerm = (TERM *)0; TERM *pTerm = (TERM *)0;
void void
#if PROTOTYPES
DestroyConfig(CONFIG *c) DestroyConfig(CONFIG *c)
#else
DestroyConfig(c)
CONFIG *c;
#endif
{ {
if (c == (CONFIG *)0) if (c == (CONFIG *)0)
return; return;
@ -39,17 +34,16 @@ DestroyConfig(c)
#if HAVE_OPENSSL #if HAVE_OPENSSL
if (c->sslcredentials != (char *)0) if (c->sslcredentials != (char *)0)
free(c->sslcredentials); free(c->sslcredentials);
if (c->sslcacertificatefile != (char *)0)
free(c->sslcacertificatefile);
if (c->sslcacertificatepath != (char *)0)
free(c->sslcacertificatepath);
#endif #endif
free(c); free(c);
} }
void void
#if PROTOTYPES
ApplyConfigDefault(CONFIG *c) ApplyConfigDefault(CONFIG *c)
#else
ApplyConfigDefault(c)
CONFIG *c;
#endif
{ {
if (parserConfigDefault == (CONFIG *)0) if (parserConfigDefault == (CONFIG *)0)
return; return;
@ -81,6 +75,10 @@ ApplyConfigDefault(c)
} }
if (parserConfigDefault->striphigh != FLAGUNKNOWN) if (parserConfigDefault->striphigh != FLAGUNKNOWN)
c->striphigh = parserConfigDefault->striphigh; c->striphigh = parserConfigDefault->striphigh;
if (parserConfigDefault->replay != FLAGUNKNOWN)
c->replay = parserConfigDefault->replay;
if (parserConfigDefault->playback != FLAGUNKNOWN)
c->playback = parserConfigDefault->playback;
#if HAVE_OPENSSL #if HAVE_OPENSSL
if (parserConfigDefault->sslcredentials != (char *)0) { if (parserConfigDefault->sslcredentials != (char *)0) {
if (c->sslcredentials != (char *)0) if (c->sslcredentials != (char *)0)
@ -89,6 +87,22 @@ ApplyConfigDefault(c)
StrDup(parserConfigDefault->sslcredentials)) == (char *)0) StrDup(parserConfigDefault->sslcredentials)) == (char *)0)
OutOfMem(); OutOfMem();
} }
if (parserConfigDefault->sslcacertificatefile != (char *)0) {
if (c->sslcacertificatefile != (char *)0)
free(c->sslcacertificatefile);
if ((c->sslcacertificatefile =
StrDup(parserConfigDefault->sslcacertificatefile)) ==
(char *)0)
OutOfMem();
}
if (parserConfigDefault->sslcacertificatepath != (char *)0) {
if (c->sslcacertificatepath != (char *)0)
free(c->sslcacertificatepath);
if ((c->sslcacertificatepath =
StrDup(parserConfigDefault->sslcacertificatepath)) ==
(char *)0)
OutOfMem();
}
if (parserConfigDefault->sslrequired != FLAGUNKNOWN) if (parserConfigDefault->sslrequired != FLAGUNKNOWN)
c->sslrequired = parserConfigDefault->sslrequired; c->sslrequired = parserConfigDefault->sslrequired;
if (parserConfigDefault->sslenabled != FLAGUNKNOWN) if (parserConfigDefault->sslenabled != FLAGUNKNOWN)
@ -97,12 +111,7 @@ ApplyConfigDefault(c)
} }
void void
#if PROTOTYPES
ConfigBegin(char *id) ConfigBegin(char *id)
#else
ConfigBegin(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigBegin(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigBegin(%s) [%s:%d]", id, file, line));
if (id == (char *)0 || id[0] == '\000') { if (id == (char *)0 || id[0] == '\000') {
@ -120,11 +129,7 @@ ConfigBegin(id)
} }
void void
#if PROTOTYPES
ConfigEnd(void) ConfigEnd(void)
#else
ConfigEnd()
#endif
{ {
CONDDEBUG((1, "ConfigEnd() [%s:%d]", file, line)); CONDDEBUG((1, "ConfigEnd() [%s:%d]", file, line));
@ -146,11 +151,7 @@ ConfigEnd()
} }
void void
#if PROTOTYPES
ConfigAbort(void) ConfigAbort(void)
#else
ConfigAbort()
#endif
{ {
CONDDEBUG((1, "ConfigAbort() [%s:%d]", file, line)); CONDDEBUG((1, "ConfigAbort() [%s:%d]", file, line));
if (parserConfigTemp == (CONFIG *)0) if (parserConfigTemp == (CONFIG *)0)
@ -161,11 +162,7 @@ ConfigAbort()
} }
void void
#if PROTOTYPES
ConfigDestroy(void) ConfigDestroy(void)
#else
ConfigDestroy()
#endif
{ {
CONDDEBUG((1, "ConfigDestroy() [%s:%d]", file, line)); CONDDEBUG((1, "ConfigDestroy() [%s:%d]", file, line));
@ -182,12 +179,7 @@ ConfigDestroy()
} }
void void
#if PROTOTYPES
DestroyTerminal(TERM *t) DestroyTerminal(TERM *t)
#else
DestroyTerminal(t)
TERM *t;
#endif
{ {
if (t == (TERM *)0) if (t == (TERM *)0)
return; return;
@ -203,12 +195,7 @@ DestroyTerminal(t)
} }
void void
#if PROTOTYPES
ApplyTermDefault(TERM *t) ApplyTermDefault(TERM *t)
#else
ApplyTermDefault(t)
TERM *t;
#endif
{ {
if (parserTermDefault == (TERM *)0) if (parserTermDefault == (TERM *)0)
return; return;
@ -242,12 +229,7 @@ ApplyTermDefault(t)
} }
void void
#if PROTOTYPES
TerminalBegin(char *id) TerminalBegin(char *id)
#else
TerminalBegin(id)
char *id;
#endif
{ {
CONDDEBUG((1, "TerminalBegin(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "TerminalBegin(%s) [%s:%d]", id, file, line));
if (id == (char *)0 || id[0] == '\000') { if (id == (char *)0 || id[0] == '\000') {
@ -265,11 +247,7 @@ TerminalBegin(id)
} }
void void
#if PROTOTYPES
TerminalEnd(void) TerminalEnd(void)
#else
TerminalEnd()
#endif
{ {
static char *term = (char *)0; static char *term = (char *)0;
@ -299,11 +277,7 @@ TerminalEnd()
} }
void void
#if PROTOTYPES
TerminalAbort(void) TerminalAbort(void)
#else
TerminalAbort()
#endif
{ {
CONDDEBUG((1, "TerminalAbort() [%s:%d]", file, line)); CONDDEBUG((1, "TerminalAbort() [%s:%d]", file, line));
if (parserTermTemp == (TERM *)0) if (parserTermTemp == (TERM *)0)
@ -314,11 +288,7 @@ TerminalAbort()
} }
void void
#if PROTOTYPES
TerminalDestroy(void) TerminalDestroy(void)
#else
TerminalDestroy()
#endif
{ {
CONDDEBUG((1, "TerminalDestroy() [%s:%d]", file, line)); CONDDEBUG((1, "TerminalDestroy() [%s:%d]", file, line));
@ -335,13 +305,7 @@ TerminalDestroy()
} }
void void
#if PROTOTYPES
ProcessYesNo(char *id, FLAG *flag) ProcessYesNo(char *id, FLAG *flag)
#else
ProcessYesNo(id, flag)
char *id;
FLAG *flag;
#endif
{ {
if (id == (char *)0 || id[0] == '\000') if (id == (char *)0 || id[0] == '\000')
*flag = FLAGFALSE; *flag = FLAGFALSE;
@ -354,12 +318,7 @@ ProcessYesNo(id, flag)
} }
void void
#if PROTOTYPES
ConfigItemEscape(char *id) ConfigItemEscape(char *id)
#else
ConfigItemEscape(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemEscape(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemEscape(%s) [%s:%d]", id, file, line));
@ -375,12 +334,7 @@ ConfigItemEscape(id)
} }
void void
#if PROTOTYPES
ConfigItemMaster(char *id) ConfigItemMaster(char *id)
#else
ConfigItemMaster(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemMaster(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemMaster(%s) [%s:%d]", id, file, line));
@ -396,12 +350,31 @@ ConfigItemMaster(id)
} }
void void
#if PROTOTYPES ConfigItemPlayback(char *id)
{
int i;
CONDDEBUG((1, "ConfigItemPlayback(%s) [%s:%d]", id, file, line));
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->playback = 0;
return;
}
for (i = 0; id[i] != '\000'; i++) {
if (!isdigit((int)id[i])) {
Error("invalid playback value [%s:%d]", file, line);
return;
}
}
if (i > 4) {
Error("playback value too large [%s:%d]", file, line);
return;
}
parserConfigTemp->playback = (unsigned short)atoi(id) + 1;
}
void
ConfigItemPort(char *id) ConfigItemPort(char *id)
#else
ConfigItemPort(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemPort(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemPort(%s) [%s:%d]", id, file, line));
@ -417,12 +390,31 @@ ConfigItemPort(id)
} }
void void
#if PROTOTYPES ConfigItemReplay(char *id)
{
int i;
CONDDEBUG((1, "ConfigItemReplay(%s) [%s:%d]", id, file, line));
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->replay = 0;
return;
}
for (i = 0; id[i] != '\000'; i++) {
if (!isdigit((int)id[i])) {
Error("invalid replay value [%s:%d]", file, line);
return;
}
}
if (i > 4) {
Error("replay value too large [%s:%d]", file, line);
return;
}
parserConfigTemp->replay = (unsigned short)atoi(id) + 1;
}
void
ConfigItemSslcredentials(char *id) ConfigItemSslcredentials(char *id)
#else
ConfigItemSslcredentials(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemSslcredentials(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemSslcredentials(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL #if HAVE_OPENSSL
@ -443,12 +435,51 @@ ConfigItemSslcredentials(id)
} }
void void
#if PROTOTYPES ConfigItemSslcacertificatefile(char *id)
ConfigItemSslrequired(char *id) {
CONDDEBUG((1, "ConfigItemSslcacertificatefile(%s) [%s:%d]", id, file,
line));
#if HAVE_OPENSSL
if (parserConfigTemp->sslcacertificatefile != (char *)0)
free(parserConfigTemp->sslcacertificatefile);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->sslcacertificatefile = (char *)0;
return;
}
if ((parserConfigTemp->sslcacertificatefile = StrDup(id)) == (char *)0)
OutOfMem();
#else #else
ConfigItemSslrequired(id) Error
char *id; ("sslcacertificatefile ignored - encryption not compiled into code [%s:%d]",
file, line);
#endif #endif
}
void
ConfigItemSslcacertificatepath(char *id)
{
CONDDEBUG((1, "ConfigItemSslcacertificatepath(%s) [%s:%d]", id, file,
line));
#if HAVE_OPENSSL
if (parserConfigTemp->sslcacertificatepath != (char *)0)
free(parserConfigTemp->sslcacertificatepath);
if ((id == (char *)0) || (*id == '\000')) {
parserConfigTemp->sslcacertificatepath = (char *)0;
return;
}
if ((parserConfigTemp->sslcacertificatepath = StrDup(id)) == (char *)0)
OutOfMem();
#else
Error
("sslcacertificatepath ignored - encryption not compiled into code [%s:%d]",
file, line);
#endif
}
void
ConfigItemSslrequired(char *id)
{ {
CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL #if HAVE_OPENSSL
@ -461,12 +492,7 @@ ConfigItemSslrequired(id)
} }
void void
#if PROTOTYPES
ConfigItemSslenabled(char *id) ConfigItemSslenabled(char *id)
#else
ConfigItemSslenabled(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemSslenabled(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemSslenabled(%s) [%s:%d]", id, file, line));
#if HAVE_OPENSSL #if HAVE_OPENSSL
@ -478,24 +504,14 @@ ConfigItemSslenabled(id)
} }
void void
#if PROTOTYPES
ConfigItemStriphigh(char *id) ConfigItemStriphigh(char *id)
#else
ConfigItemStriphigh(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemStriphigh(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemStriphigh(%s) [%s:%d]", id, file, line));
ProcessYesNo(id, &(parserConfigTemp->striphigh)); ProcessYesNo(id, &(parserConfigTemp->striphigh));
} }
void void
#if PROTOTYPES
ConfigItemUsername(char *id) ConfigItemUsername(char *id)
#else
ConfigItemUsername(id)
char *id;
#endif
{ {
CONDDEBUG((1, "ConfigItemUsername(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemUsername(%s) [%s:%d]", id, file, line));
@ -510,29 +526,25 @@ ConfigItemUsername(id)
OutOfMem(); OutOfMem();
} }
SUBST *substData = (SUBST *) 0; SUBST *substData = (SUBST *)0;
SUBSTTOKEN
SubstToken(char c)
{
switch (c) {
case 'u':
case 'c':
return ISSTRING;
default:
return ISNOTHING;
}
}
int int
#if PROTOTYPES SubstValue(char c, char **s, int *i)
SubstCallback(char c, char **s, int *i)
#else
SubstCallback(c, s, i)
char c;
char **s;
int *i;
#endif
{ {
int retval = 0; int retval = 0;
if (substData == (SUBST *) 0) {
if ((substData =
(SUBST *) calloc(1, sizeof(SUBST))) == (SUBST *) 0)
OutOfMem();
substData->callback = &SubstCallback;
substData->tokens['u'] = ISSTRING;
substData->tokens['c'] = ISSTRING;
}
if (s != (char **)0) { if (s != (char **)0) {
CONFIG *pc; CONFIG *pc;
if (substData->data == (void *)0) if (substData->data == (void *)0)
@ -552,12 +564,19 @@ SubstCallback(c, s, i)
} }
void void
#if PROTOTYPES InitSubstCallback(void)
{
if (substData == (SUBST *)0) {
if ((substData = (SUBST *)calloc(1, sizeof(SUBST))) == (SUBST *)0)
OutOfMem();
substData->value = &SubstValue;
substData->token = &SubstToken;
}
}
void
TerminalItemAttach(char *id) TerminalItemAttach(char *id)
#else
TerminalItemAttach(id)
char *id;
#endif
{ {
CONDDEBUG((1, "TerminalItemAttach(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "TerminalItemAttach(%s) [%s:%d]", id, file, line));
@ -573,12 +592,7 @@ TerminalItemAttach(id)
} }
void void
#if PROTOTYPES
TerminalItemAttachsubst(char *id) TerminalItemAttachsubst(char *id)
#else
TerminalItemAttachsubst(id)
char *id;
#endif
{ {
CONDDEBUG((1, "TerminalItemAttachsubst(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "TerminalItemAttachsubst(%s) [%s:%d]", id, file, line));
ProcessSubst(substData, (char **)0, &(parserTermTemp->attachsubst), ProcessSubst(substData, (char **)0, &(parserTermTemp->attachsubst),
@ -586,12 +600,7 @@ TerminalItemAttachsubst(id)
} }
void void
#if PROTOTYPES
TerminalItemDetach(char *id) TerminalItemDetach(char *id)
#else
TerminalItemDetach(id)
char *id;
#endif
{ {
CONDDEBUG((1, "TerminalItemDetach(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "TerminalItemDetach(%s) [%s:%d]", id, file, line));
@ -607,12 +616,7 @@ TerminalItemDetach(id)
} }
void void
#if PROTOTYPES
TerminalItemDetachsubst(char *id) TerminalItemDetachsubst(char *id)
#else
TerminalItemDetachsubst(id)
char *id;
#endif
{ {
CONDDEBUG((1, "TerminalItemDetachsubst(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "TerminalItemDetachsubst(%s) [%s:%d]", id, file, line));
ProcessSubst(substData, (char **)0, &(parserTermTemp->detachsubst), ProcessSubst(substData, (char **)0, &(parserTermTemp->detachsubst),
@ -622,8 +626,12 @@ TerminalItemDetachsubst(id)
ITEM keyConfig[] = { ITEM keyConfig[] = {
{"escape", ConfigItemEscape}, {"escape", ConfigItemEscape},
{"master", ConfigItemMaster}, {"master", ConfigItemMaster},
{"playback", ConfigItemPlayback},
{"port", ConfigItemPort}, {"port", ConfigItemPort},
{"replay", ConfigItemReplay},
{"sslcredentials", ConfigItemSslcredentials}, {"sslcredentials", ConfigItemSslcredentials},
{"sslcacertificatefile", ConfigItemSslcacertificatefile},
{"sslcacertificatepath", ConfigItemSslcacertificatepath},
{"sslrequired", ConfigItemSslrequired}, {"sslrequired", ConfigItemSslrequired},
{"sslenabled", ConfigItemSslenabled}, {"sslenabled", ConfigItemSslenabled},
{"striphigh", ConfigItemStriphigh}, {"striphigh", ConfigItemStriphigh},
@ -648,13 +656,7 @@ SECTION sections[] = {
}; };
void void
#if PROTOTYPES
ReadConf(char *filename, FLAG verbose) ReadConf(char *filename, FLAG verbose)
#else
ReadConf(filename, verbose)
char *filename;
FLAG verbose;
#endif
{ {
FILE *fp; FILE *fp;
@ -665,7 +667,7 @@ ReadConf(filename, verbose)
} }
/* initialize the substition bits */ /* initialize the substition bits */
SubstCallback('\000', (char **)0, (int *)0); InitSubstCallback();
parserConfigDefault = pConfig; parserConfigDefault = pConfig;
pConfig = (CONFIG *)0; pConfig = (CONFIG *)0;
@ -700,9 +702,15 @@ ReadConf(filename, verbose)
CONDDEBUG((1, "pConfig->escape = %s", EMPTYSTR(pConfig->escape))); CONDDEBUG((1, "pConfig->escape = %s", EMPTYSTR(pConfig->escape)));
CONDDEBUG((1, "pConfig->striphigh = %s", CONDDEBUG((1, "pConfig->striphigh = %s",
FLAGSTR(pConfig->striphigh))); FLAGSTR(pConfig->striphigh)));
CONDDEBUG((1, "pConfig->replay = %hu", pConfig->replay));
CONDDEBUG((1, "pConfig->playback = %hu", pConfig->playback));
#if HAVE_OPENSSL #if HAVE_OPENSSL
CONDDEBUG((1, "pConfig->sslcredentials = %s", CONDDEBUG((1, "pConfig->sslcredentials = %s",
EMPTYSTR(pConfig->sslcredentials))); EMPTYSTR(pConfig->sslcredentials)));
CONDDEBUG((1, "pConfig->sslcacertificatefile = %s",
EMPTYSTR(pConfig->sslcacertificatefile)));
CONDDEBUG((1, "pConfig->sslcacertificatepath = %s",
EMPTYSTR(pConfig->sslcacertificatepath)));
CONDDEBUG((1, "pConfig->sslrequired = %s", CONDDEBUG((1, "pConfig->sslrequired = %s",
FLAGSTR(pConfig->sslrequired))); FLAGSTR(pConfig->sslrequired)));
CONDDEBUG((1, "pConfig->sslenabled = %s", CONDDEBUG((1, "pConfig->sslenabled = %s",

View File

@ -1,5 +1,5 @@
/* /*
* $Id: readconf.h,v 5.3 2004/05/25 23:03:25 bryan Exp $ * $Id: readconf.h,v 5.7 2014/04/20 06:45:07 bryan Exp $
* *
* Copyright conserver.com, 2000 * Copyright conserver.com, 2000
* *
@ -14,8 +14,12 @@ typedef struct config {
char *port; char *port;
char *escape; char *escape;
FLAG striphigh; FLAG striphigh;
unsigned short replay;
unsigned short playback;
#if HAVE_OPENSSL #if HAVE_OPENSSL
char *sslcredentials; char *sslcredentials;
char *sslcacertificatefile;
char *sslcacertificatepath;
FLAG sslrequired; FLAG sslrequired;
FLAG sslenabled; FLAG sslenabled;
#endif #endif
@ -33,6 +37,6 @@ extern CONFIG *pConfig;
extern TERM *pTerm; extern TERM *pTerm;
extern SUBST *substData; extern SUBST *substData;
extern void ReadConf PARAMS((char *, FLAG)); extern void ReadConf(char *, FLAG);
extern void DestroyConfig PARAMS((CONFIG *)); extern void DestroyConfig(CONFIG *);
extern void DestroyTerminal PARAMS((TERM *)); extern void DestroyTerminal(TERM *);

View File

@ -1,4 +1,5 @@
### Path settings ### Path settings
datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@

View File

@ -6,12 +6,13 @@
# outside of my own purposes. If this helps, cool. In the end I put the # outside of my own purposes. If this helps, cool. In the end I put the
# rootcert.pem file in my global certs directory (OPENSSL_ROOT/ssl/certs), # rootcert.pem file in my global certs directory (OPENSSL_ROOT/ssl/certs),
# point the server to server.pem and point the client at client.pem. I # point the server to server.pem and point the client at client.pem. I
# then run the c_rehash command (I supposed it helps or is important). # then run the c_rehash command.
# When it asks for a passphrase, use 'pass', otherwise this script won't #
# work. Ugly, yeah, but it's an ok test. # You can also use the sslcacertificatefile options to point the client/server
# at rootcert.pem instead of populating the global repository
# #
[ -f rootreq.pem -a -f rootkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem -passin pass:pass -passout pass:pass [ -f rootreq.pem -a -f rootkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem -nodes
US US
California California
Folsom Folsom
@ -25,7 +26,7 @@ EOD
[ -f rootcert.pem ] || openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem [ -f rootcert.pem ] || openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem
[ -f root.pem ] || cat rootcert.pem rootkey.pem > root.pem [ -f root.pem ] || cat rootcert.pem rootkey.pem > root.pem
[ -f serverreq.pem -a -f serverkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout serverkey.pem -out serverreq.pem -passin pass:pass -passout pass:pass [ -f serverreq.pem -a -f serverkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout serverkey.pem -out serverreq.pem -nodes
US US
California California
Folsom Folsom
@ -39,7 +40,7 @@ EOD
[ -f servercert.pem ] || openssl x509 -req -in serverreq.pem -sha1 -extensions usr_cert -CA root.pem -CAkey root.pem -CAcreateserial -out servercert.pem [ -f servercert.pem ] || openssl x509 -req -in serverreq.pem -sha1 -extensions usr_cert -CA root.pem -CAkey root.pem -CAcreateserial -out servercert.pem
[ -f server.pem ] || cat servercert.pem serverkey.pem rootcert.pem > server.pem [ -f server.pem ] || cat servercert.pem serverkey.pem rootcert.pem > server.pem
[ -f clientreq.pem -a -f clientkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout clientkey.pem -out clientreq.pem -passin pass:pass -passout pass:pass [ -f clientreq.pem -a -f clientkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout clientkey.pem -out clientreq.pem -nodes
US US
California California
Folsom Folsom

View File

@ -0,0 +1,5 @@
# server options
#OPTIONS="-p 33000 -d"
# run as different user that root
#RUNAS=conservr

View File

@ -7,44 +7,66 @@
# config: /etc/conserver.cf # config: /etc/conserver.cf
# #
DAEMON=/usr/sbin/conserver
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
# Source networking configuration. # Source networking configuration.
. /etc/sysconfig/network . /etc/sysconfig/network
# Source defaults
. /etc/default/conserver
# Check that networking is up. # Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0 [ ${NETWORKING} = "no" ] && exit 0
# make sure conserver is installed and executable # make sure conserver is installed and executable
[ -x /usr/sbin/conserver ] || exit 1 [ -x $DAEMON ] || exit 1
start()
{
echo -n "Starting conserver: "
daemon --user "${RUNAS-}" $DAEMON ${OPTIONS--d}
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/conserver
echo
}
stop()
{
echo -n "Shutting down conserver: "
killproc conserver
RETVAL=$?
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/conserver
echo
}
# See how we were called. # See how we were called.
case "$1" in case "$1" in
start) start)
echo -n "Starting conserver: " start
daemon conserver -d
echo
touch /var/lock/subsys/conserver
;; ;;
stop) stop)
echo -n "Shutting down conserver: " stop
killproc conserver
echo
rm -f /var/lock/subsys/conserver
;; ;;
status) status)
status conserver status conserver
;; ;;
restart) restart)
echo -n "Restarting conserver: " stop
start
;;
reload)
echo -n "Reloading conserver: "
killproc conserver -HUP killproc conserver -HUP
RETVAL=$?
echo echo
;; ;;
*) *)
echo "Usage: conserver {start|stop|restart|status}" echo "Usage: conserver {start|stop|restart|reload|status}"
exit 1 RETVAL=1
esac esac
exit 0 exit $RETVAL

View File

@ -4,7 +4,7 @@
# #
%define pkg conserver %define pkg conserver
%define ver 8.1.6 %define ver 8.2.1
# define the name of the machine on which the main conserver # define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default # daemon will be running if you don't want to use the default
@ -12,26 +12,71 @@
%define master console %define master console
# what red hat (or other distibution) version are you running? # what red hat (or other distibution) version are you running?
%define distver 6 %define distver 1
# compile arguments. defaults to 0
# example: rpmbuild -bb conserver.spec --with openssl
%define with_openssl %{?_with_openssl: 1} %{?!_with_openssl: 0}
%define with_libwrap %{?_with_libwrap: 1} %{?!_with_libwrap: 0}
%define with_pam %{?_with_pam: 1} %{?!_with_pam: 0}
%define with_dmalloc %{?_with_dmalloc: 1} %{?!_with_dmalloc: 0}
%define with_freeipmi %{?_with_freeipmi: 1} %{?!_with_freeipmi: 0}
# additionally you can use macros logfile pidfile
# example: rpmbuild -bb conserver.spec --define "pidfile /var/run/conserver/pid"
Summary: Serial console server daemon/client
Name: %{pkg} Name: %{pkg}
Version: %{ver} Version: %{ver}
Release: 1.%{distver} Release: %{distver}
Copyright: distributable License: BSD
Summary: Serial console server daemon/client
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.conserver.com/ URL: http://www.conserver.com/
Source: http://www.conserver.com/%{pkg}-%{ver}.tar.gz Source: http://www.conserver.com/%{pkg}-%{ver}.tar.gz
BuildRoot: %{_tmppath}/%{pkg}-buildroot BuildRoot: %{_tmppath}/%{pkg}-buildroot
%if %{with_openssl}
Requires: openssl
BuildRequires: openssl-devel
%endif
%if %{with_pam}
BuildRequires: pam-devel
%endif
%if %{with_libwrap}
Requires: tcp_wrappers
%endif
%if %{with_dmalloc}
Requires: dmalloc
BuildRequires: dmalloc
%endif
%if %{with_freeipmi}
Requires: freeipmi
BuildRequires: freeipmi-devel
%endif
Prefix: %{_prefix} Prefix: %{_prefix}
%package server
Summary: Serial console server daemon
Group: System Environment/Daemons
%package client
Summary: Serial console server client
Group: Applications/Internet
%description %description
Conserver is an application that allows multiple users to watch a Conserver is a daemon that allows multiple users to watch a
serial console at the same time. It can log the data, allows users to 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 take write-access of a console (one at a time), and has a variety of
bells and whistles to accentuate that basic functionality. bells and whistles to accentuate that basic functionality.
%description server
conserver-server is a daemon 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.
%description client
conserver-client to connect to conserver-server using a tcp port.
Allows multiple users to watch a serial console at the same time.
%prep %prep
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
@ -44,7 +89,8 @@ f="conserver/Makefile.in"
%{__mv} $f $f.orig %{__mv} $f $f.orig
%{__sed} -e 's/^.*conserver\.rc.*$//' < $f.orig > $f %{__sed} -e 's/^.*conserver\.rc.*$//' < $f.orig > $f
%configure --with-master=%{master} %configure %{?_with_openssl} %{?_with_libwrap} %{?_with_dmalloc} %{?_with_freeipmi} %{?_with_pam} %{?logfile: --with-logfile=%{logfile}} %{?pidfile: --with-pidfile=%{pidfile}} %{?master: --with-master=%{master}}
make make
@ -65,12 +111,15 @@ make
%{__mkdir_p} %{buildroot}/%{_initrddir} %{__mkdir_p} %{buildroot}/%{_initrddir}
%{__cp} contrib/redhat-rpm/conserver.init %{buildroot}/%{_initrddir}/conserver %{__cp} contrib/redhat-rpm/conserver.init %{buildroot}/%{_initrddir}/conserver
# install copy of init script defaults
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/default
%{__cp} contrib/redhat-rpm/conserver.defaults %{buildroot}/%{_sysconfdir}/default/conserver
%clean %clean
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
%post %post server
if [ -x %{_initrddir}/conserver ]; then if [ -x %{_initrddir}/conserver ]; then
/sbin/chkconfig --add conserver /sbin/chkconfig --add conserver
fi fi
@ -80,7 +129,7 @@ if ! egrep '\<conserver\>' /etc/services > /dev/null 2>&1 ; then
fi fi
%preun %preun server
if [ "$1" = 0 ]; then if [ "$1" = 0 ]; then
if [ -x %{_initrddir}/conserver ]; then if [ -x %{_initrddir}/conserver ]; then
%{_initrddir}/conserver stop %{_initrddir}/conserver stop
@ -88,18 +137,37 @@ if [ "$1" = 0 ]; then
fi fi
fi fi
# we need this even if empty
#%files
%files %files server
%defattr(-,root,root) %defattr(-,root,root)
%doc CHANGES FAQ INSTALL README conserver.cf %doc CHANGES FAQ INSTALL README conserver.cf
%config(noreplace) %{_sysconfdir}/conserver.cf %config(noreplace) %{_sysconfdir}/conserver.cf
%config(noreplace) %{_sysconfdir}/conserver.passwd %config(noreplace) %{_sysconfdir}/conserver.passwd
%config(noreplace) %{_sysconfdir}/default/conserver
%attr(555,root,root) %{_initrddir}/conserver %attr(555,root,root) %{_initrddir}/conserver
%{prefix}/bin/console %{_libdir}/conserver/convert
%{prefix}/share/man/man1/console.1.gz %{_mandir}/man8/conserver.8.gz
%{prefix}/share/man/man8/conserver.8.gz %{_mandir}/man5/conserver.cf.5.gz
%{prefix}/share/man/man5/conserver.cf.5.gz %{_mandir}/man5/conserver.passwd.5.gz
%{prefix}/share/man/man5/conserver.passwd.5.gz %{_datadir}/examples/conserver/conserver.cf
%{prefix}/share/examples/conserver/conserver.cf %{_datadir}/examples/conserver/conserver.passwd
%{prefix}/share/examples/conserver/conserver.passwd %{_sbindir}/conserver
%{prefix}/sbin/conserver
%files client
%defattr(-,root,root)
%doc CHANGES FAQ INSTALL README
%{_bindir}/console
%{_mandir}/man1/console.1.gz
%changelog
* Wed Oct 14 2009 Jodok Ole Muellers <muellejo@aschendorff.de>
- Changed the conserver.spec file to create separate subpackages
for client and server by using the %package directive.
* Wed Sep 25 2009 Fabien Wernli
- added configure prerequisites
* Thu Sep 24 2009 Fabien Wernli
- added prefix to configure
- changed some hardcoded values to proper macros:
didn't work on x64 lib -> lib64

View File

@ -1,7 +1,7 @@
PKG="conserver" PKG="conserver"
NAME="Console server and client" NAME="Console server and client"
CATEGORY="system" CATEGORY="system"
VERSION="8.1.6" VERSION="8.2.1"
DESC="Console server and client" DESC="Console server and client"
CLASSES=none CLASSES=none
ARCH=sparc ARCH=sparc

View File

@ -33,7 +33,7 @@ dotest()
mv test.out results/test$testnum mv test.out results/test$testnum
else else
if [ -f results/test$testnum ]; then if [ -f results/test$testnum ]; then
if diff -i test.out results/test$testnum >test$testnum.diff 2>&1; then if diff -i results/test$testnum >test$testnum.diff test.out 2>&1; then
echo "succeeded" echo "succeeded"
rm -f test$testnum.diff rm -f test$testnum.diff
else else
@ -89,10 +89,12 @@ dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e
dotest 'c?c.' dotest 'c?c.'
dotest 'cl?c.' dotest 'cl?c.'
dotest 'cdc.' dotest 'cdc.'
dotest 'coc.' dotest 'cocacoc.'
dotest EVAL "echo 'tu.' | ../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -e 'tu' shell" dotest EVAL "echo 'tu.' | ../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -e 'tu' shell"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -R | sed -e 's/ [^ ]*$//'" dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -R | sed -e 's/ [^ ]*$//'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'" dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x sh | sed -e '1s/^[^:]*//'"
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x shell | sed -e 's/ on [^ ]* */ on /'"
cleanup cleanup

View File

@ -1,4 +1,6 @@
console: shell is down [`shell' -- console is down]
[Enter `^Ec?' for help] [Enter `^Ec?' for help]
[up -- attached] [up]
[ok]
[up]
[disconnect] [disconnect]

2
test/results/test14 Normal file
View File

@ -0,0 +1,2 @@
: ambiguous console abbreviation, `sh'
choices are shellb, shella, shell

1
test/results/test15 Normal file
View File

@ -0,0 +1 @@
shell on at Local

View File

@ -1,18 +1,20 @@
[Enter `^Ec?' for help] [Enter `^Ec?' for help]
[help] [help]
. disconnect ; move to another console . disconnect ; move to another console
a attach read/write b send broadcast message a attach read/write b send broadcast message
c toggle flow control d down a console c toggle flow control d down a console
e change escape sequence f force attach read/write e change escape sequence f force attach read/write
g group info i information dump g group info i information dump
L toggle logging on/off l? break sequence list L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence l0 send break per config file l1-9a-z send specific break sequence
m display the message of the day o (re)open the tty and log file m display message of the day n write a note to the logfile
p replay the last 60 lines r replay the last 20 lines o (re)open the tty and log file p playback the last 60 lines
s spy read only u show host status P set number of playback lines r replay the last 20 lines
v show version info w who is on this console R set number of replay lines s spy mode (read only)
x show console baud info z suspend the connection u show host status v show version info
| attach local command ? print this message w who is on this console x show console baud info
<cr> ignore/abort command ^R replay the last line z suspend the connection ! invoke task
\ooo send character by octal code | attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect] [disconnect]

View File

@ -1,4 +1,4 @@
console: shell is down [`shell' -- console is down]
[Enter `^Ec?' for help] [Enter `^Ec?' for help]
[up -- attached] [up]
[disconnect] [disconnect]

View File

@ -1,18 +1,20 @@
[Enter `^Ec?' for help] [Enter `^Ec?' for help]
[help] [help]
. disconnect ; move to another console . disconnect ; move to another console
a attach read/write b send broadcast message a attach read/write b send broadcast message
c toggle flow control d down a console c toggle flow control d down a console
e change escape sequence f force attach read/write e change escape sequence f force attach read/write
g group info i information dump g group info i information dump
L toggle logging on/off l? break sequence list L toggle logging on/off l? break sequence list
l0 send break per config file l1-9 send specific break sequence l0 send break per config file l1-9a-z send specific break sequence
m display the message of the day o (re)open the tty and log file m display message of the day n write a note to the logfile
p replay the last 60 lines r replay the last 20 lines o (re)open the tty and log file p playback the last 60 lines
s spy read only u show host status P set number of playback lines r replay the last 20 lines
v show version info w who is on this console R set number of replay lines s spy mode (read only)
x show console baud info z suspend the connection u show host status v show version info
| attach local command ? print this message w who is on this console x show console baud info
<cr> ignore/abort command ^R replay the last line z suspend the connection ! invoke task
\ooo send character by octal code | attach local command ? print this message
<cr> ignore/abort command ^R replay the last line
\ooo send character by octal code
[disconnect] [disconnect]