mirror of
https://github.com/bstansell/conserver.git
synced 2025-06-24 17:55:08 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
cf461c7ce8 | |||
5c430d220b | |||
8cd506c093 | |||
29b909ee59 | |||
aea0e2a547 | |||
9eed9f2d8f | |||
25a4dcb0fd | |||
75cfd02f7a | |||
ad7a90dd69 | |||
691c3102c9 | |||
eafae7c27d |
156
CHANGES
156
CHANGES
@ -1,7 +1,159 @@
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
version 8.0.5 (Oct 31,2003):
|
||||
version 8.1.6 (May 25, 2004):
|
||||
- added ability to configure client via sytem-wide console.cf
|
||||
file and per-user .consolerc - suggested by Erik Sjolund
|
||||
<erik.sjolund@sbc.su.se>
|
||||
- fixed bug where break strings were not properly sent -
|
||||
reported by Tim Small <tim@buttersideup.com>
|
||||
- fixed bug in config file 'protocol' value handling - reported
|
||||
by Kees Cook <kees@osdl.org>
|
||||
- conserver no longer uses the local domain name in the default
|
||||
access list (the default list is only created if no access
|
||||
list is specified in the configuration file) - inspired by
|
||||
William P LePera <lepera@us.ibm.com>
|
||||
- added a 'terminal' console configuration block for printing
|
||||
strings when attaching and detaching from consoles - suggested
|
||||
by Richard Threadgill <richardt@tellme.com>
|
||||
|
||||
version 8.1.5 (May 7, 2004):
|
||||
- changed remaining O_NDELAY flags to O_NONBLOCK
|
||||
- added PROTOCOLS file to describe the client/server protocol
|
||||
- added '#include' capability to conserver.cf file
|
||||
- added '@group' syntax to conserver.cf file to support use of
|
||||
system groups
|
||||
- added -U client option to allow client to ask for encryption
|
||||
but fall back to non-encrypted connections otherwise -
|
||||
suggested by Mike Hendon <mike.hendon@uk.nomura.com>
|
||||
- fixed bug where socket not properly deleted on exit - reported
|
||||
by William P LePera <lepera@us.ibm.com>
|
||||
- added 'initdelay' option for throttling startup of consoles -
|
||||
suggested by Jay McCanta <mccantaj@amgen.com>
|
||||
|
||||
version 8.1.4 (Apr 13, 2004):
|
||||
- fixed macro use in manpages to hopefully be more compatible
|
||||
- removed extra newline of --MARK-- range output
|
||||
- fixed bug where server -b option wasn't working - reported by
|
||||
Nathan R. Hruby <nhruby@uga.edu>
|
||||
- fixed client segfault when using -R, -t, -d, and -b options
|
||||
- added a --with-uds configure option to have all client/server
|
||||
communication happen via unix domain sockets - suggested by
|
||||
William P LePera <lepera@us.ibm.com>
|
||||
|
||||
version 8.1.3 (Mar 22, 2004):
|
||||
- fixed small memory and file descriptor leak in client when
|
||||
using '^Ec;'
|
||||
- '^Ec;' now only disconnects from the previous console only
|
||||
after a successfully move to a new console, allowing you to
|
||||
abort the move - suggested by Christopher T. Beers
|
||||
<ctbeers@syr.edu>
|
||||
|
||||
version 8.1.2 (Mar 11, 2004):
|
||||
- better handling of client command (^Ec|) when user is bumped,
|
||||
conserver is reconfigured, etc
|
||||
- added 'initsubst' option for 'initcmd' substitutions like
|
||||
'devicesubst' and 'execsubst' - based on patch by Bill
|
||||
Sommerfeld <sommerfeld@east.sun.com>
|
||||
- modified and added to *subst (initsubst, etc) syntax to allow
|
||||
for flexibility and future enhancement
|
||||
- changed 'port' and 'portinc' minimums from 1 to 0 - it allows
|
||||
more flexibility and helps with 0-based counting
|
||||
- removed unportable sys/cdefs.h from contrib/chat/chat.c -
|
||||
patch by Bill Sommerfeld <sommerfeld@east.sun.com>
|
||||
- added --with-extmsgs configure switch to enable entertaining
|
||||
messages
|
||||
- marked various undocumented client commands as deprecated so
|
||||
that they can be removed in a future version
|
||||
- added ability to "move" to a new console via '^Ec;' -
|
||||
suggested by Christopher T. Beers <ctbeers@syr.edu>
|
||||
- added a dump of console information when -S is used twice -
|
||||
suggested by Todd Stansell <todd@stansell.org>
|
||||
|
||||
version 8.1.1 (Feb 10, 2004):
|
||||
- fixed mistake in Makefiles where rpmbuild fails - reported by
|
||||
Martin Evans <m.d.t.evans@qmul.ac.uk>
|
||||
- fixed a couple typos - reported by Matt Selsky
|
||||
<selsky@columbia.edu>
|
||||
|
||||
version 8.1.0 (Jan 18, 2004):
|
||||
- fixes for HP-UX compilation - patch by Petter Reinholdtsen
|
||||
<pere@hungry.com>
|
||||
- fixes for compilation under various operating systems -
|
||||
patch by Albert Chin <conserver-users@mlists.thewrittenword.com>
|
||||
- added a 'protocol' option for either 'telnet' or 'raw' socket
|
||||
communication - also reflected in -i output
|
||||
- changed the client/server protocol to use 0xff as a command
|
||||
character for sending control commands - similiar to the
|
||||
telnet protocol - improves the ^Ec| interaction
|
||||
- client -E option now disables ssl encryption attempts, useful
|
||||
for broken SSL environents - suggested by Graydon Dodson
|
||||
<grdodson@lexmark.com>
|
||||
- bad error message connecting non-ssl client with ssl-required
|
||||
server - reported by Graydon Dodson <grdodson@lexmark.com>
|
||||
- added note about pam configuration to conserver.passwd.man -
|
||||
suggested by Erik Sjolund <erik.sjolund@sbc.su.se>
|
||||
- improved telnet protocol option handling such that connections
|
||||
to standard telnet ports should work properly
|
||||
|
||||
version 8.0.9 (Dec 10, 2003):
|
||||
- fixed major bug in connect() handling which causes most
|
||||
socket-based consoles to timeout after 10 seconds - reported
|
||||
by Tom Rataski <trataski@intlsteel.com>
|
||||
- added a couple details to the 'logfilemax' manpage entry
|
||||
|
||||
version 8.0.8 (Dec 2, 2003):
|
||||
- added client ^Ec| sequence for running a command on the client
|
||||
and having it's I/O directed to the console - inspired by
|
||||
discussions with David Williamson
|
||||
<david+conserver@williamsons.net> years ago ;-)
|
||||
- touched up Makefiles to test against .h files
|
||||
- fixed inability to replay the console log while the console is
|
||||
down - reported by Matt Selsky <selsky@columbia.edu>
|
||||
- added a console 'logfilemax' option for rotating the console
|
||||
logfile once the file is greater than the specified size
|
||||
- added sample configuration files to conserver.cf/samples
|
||||
- tweaked some failure messages and initcmd notifications
|
||||
|
||||
version 8.0.7 (Nov 20, 2003):
|
||||
- renamed util.[ch] to cutil.[ch] to prevent name conflict with
|
||||
system util.h, reordered some #includes, and fixed a configure
|
||||
test for sys/proc.h to build on OpenBSD 3.4 (and probably
|
||||
others) - reported by Kurt Raschke <kurt@raschke.net>
|
||||
- fixed missing semi-colon for cygwin build - reported by
|
||||
Raymond Richmond <raymond.richmond@ualberta.ca>
|
||||
|
||||
version 8.0.6 (Nov 16, 2003):
|
||||
- code was missing regarding the 'setproctitle' option - patch
|
||||
by Dmitry Morozovsky <marck@rinet.ru>
|
||||
- fixed the order of access list checking when
|
||||
--with-trustrevdns is used
|
||||
- fixed various spelling errors - patches by Matt Selsky
|
||||
<selsky@columbia.edu>
|
||||
- added console 'idletimeout' and 'idlestring' options to
|
||||
trigger the sending of 'idlestring' after a lack of activity
|
||||
for 'idletimeout' seconds - suggested by Ian Potts
|
||||
<ian.potts@db.com>
|
||||
- added console 'portbase' and 'portinc' options to allow
|
||||
specifying a formula for referencing ports - inspired by Todd
|
||||
Stansell <todd@stansell.org>
|
||||
- fixed problem where console 'port' option didn't take port
|
||||
names (manpage said it did)
|
||||
- added server -U option and configuration option 'unifiedlog'
|
||||
to allow a copy of all console activity to go to a single file
|
||||
- removed all sprintf() calls
|
||||
- added 'devicesubst' and 'execsubst' console options for doing
|
||||
replacements with calculated port numbers on the 'device' and
|
||||
'exec' values
|
||||
- NULL characters in console data caused data loss because of
|
||||
strlen() usage - reported by Toby Gerhart <toby.gerhart@eds.com>
|
||||
- fixed a couple errors in contrib/redhat-rpm/conserver.spec -
|
||||
reported by Martin Evans <m.d.t.evans@qmul.ac.uk>
|
||||
- added capability to use '!' in user access lists to prevent a
|
||||
user from having access - suggested by Matt Selsky
|
||||
<selsky@columbia.edu>
|
||||
|
||||
version 8.0.5 (Oct 31, 2003):
|
||||
- added 'loghostnames' config option (default is on) to log
|
||||
client hostnames instead of ip addresses (like pre-8.0.0) -
|
||||
suggested by Han Pilmeyer <han@zk3.dec.com>
|
||||
@ -586,5 +738,5 @@ before version 6.05:
|
||||
and enhancements of various types were applied.
|
||||
|
||||
#
|
||||
# $Id: CHANGES,v 1.120 2003-10-31 10:04:12-08 bryan Exp $
|
||||
# $Id: CHANGES,v 1.179 2004/05/26 00:14:07 bryan Exp $
|
||||
#
|
||||
|
2
FAQ
2
FAQ
@ -186,5 +186,5 @@ directed to faq@conserver.com. The FAQ answers the following questions:
|
||||
through the same problem?
|
||||
|
||||
#
|
||||
# $Id: FAQ,v 1.9 2003-08-23 12:27:10-07 bryan Exp $
|
||||
# $Id: FAQ,v 1.9 2003/08/23 19:27:10 bryan Exp $
|
||||
#
|
||||
|
33
INSTALL
33
INSTALL
@ -10,6 +10,25 @@ Upgrading?
|
||||
new features added to the client if you're considering *not*
|
||||
upgrading.
|
||||
|
||||
Version 8.1.3
|
||||
- The '^Ec;' sequence won't work correctly with 8.1.2 (where it
|
||||
was introduced).
|
||||
|
||||
Version 8.1.2
|
||||
- The 'devicesubst' and 'execsubst' formats have changed from
|
||||
8.1.1. It's fairly simple to update your config file to the
|
||||
new format...just check the conserver.cf manpage. Sorry for
|
||||
having to change things, but it's for a good reason (I should
|
||||
have though ahead when designing the original format).
|
||||
|
||||
Version 8.1.0
|
||||
|
||||
- The client/server protocol has changed to better protect 8-bit
|
||||
data and to allow programs invoked with '^Ec|' not have to
|
||||
worry about accidentally sending the escape sequence to the
|
||||
server. Though it will look like things are mostly
|
||||
backward-compatible, don't count on it and just upgrade.
|
||||
|
||||
Version 8.0.2
|
||||
|
||||
- I've added a '^Ec;' sequence to allow the client to signal the
|
||||
@ -146,6 +165,9 @@ Detailed Instructions
|
||||
--with-maxmemb=MAXMEMB Specify maximum consoles per process [16]
|
||||
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
|
||||
--with-trustrevdns Trust reverse DNS information
|
||||
--with-extmsgs Produce extended messages
|
||||
--with-uds[=DIR] Use Unix domain sockets for client/server
|
||||
communication [/tmp/conserver]
|
||||
--with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support
|
||||
--with-openssl[=PATH] Compile in OpenSSL support
|
||||
--with-dmalloc[=PATH] Compile in dmalloc support
|
||||
@ -163,10 +185,11 @@ Detailed Instructions
|
||||
A couple of notes. First, --with-libwrap will add tcp_wrappers
|
||||
lookups to all socket connections in the server. --with-openssl
|
||||
will add encryption between the client and server when you connect
|
||||
to a console. things such as 'console -q', 'console -w', etc. are
|
||||
still unencrypted, as well as connections from conserver to any
|
||||
terminal servers. --with-dmalloc should only be used to do memory
|
||||
allocation debugging and not used in production.
|
||||
to a console. --with-uds will cause the client and server to use
|
||||
unix domain sockets for their communication, eliminating the
|
||||
tcp communication they normally do (which means --with-master and
|
||||
--with-port are not used). --with-dmalloc should only be used to
|
||||
do memory allocation debugging and not used in production.
|
||||
|
||||
- Run './configure'. This will detect system specific
|
||||
information. The --prefix option will redirect where things are
|
||||
@ -255,5 +278,5 @@ Other Information And Gotchas
|
||||
|
||||
|
||||
#
|
||||
# $Id: INSTALL,v 1.34 2003-10-03 10:52:31-07 bryan Exp $
|
||||
# $Id: INSTALL,v 1.38 2004/04/13 18:11:58 bryan Exp $
|
||||
#
|
||||
|
290
PROTOCOL
Normal file
290
PROTOCOL
Normal file
@ -0,0 +1,290 @@
|
||||
Conserver Protocol
|
||||
==================
|
||||
|
||||
|
||||
What Is This?
|
||||
-------------
|
||||
|
||||
The following is an attempt to describe the client/server protocol used
|
||||
between the server (conserver) and the client (console). This document
|
||||
bases it's information on conserver version 8.1.4, as it's the release
|
||||
currently available. If there are changes to the client/server
|
||||
protocol, the INSTALL file should reference them and, ideally, this
|
||||
document will be updated.
|
||||
|
||||
The information is looked at from the point of the server, since it's
|
||||
the server that controls all information and triggers actions on the
|
||||
client (like a suspend). The client's perspective should be obvious
|
||||
from this information.
|
||||
|
||||
|
||||
SSL
|
||||
---
|
||||
|
||||
The client and server can negotiate an SSL connection. As far as the
|
||||
code is concerned, the SSL "layer" is transparent. Data is sent and
|
||||
received just as if it was unencrypted. Therefore, aside bringing up
|
||||
the SSL connection, the SSL bits are unimportant from a protocol
|
||||
standpoint. The client and server still send and receive the same
|
||||
information - it just happens to be encrypted to everyone else.
|
||||
|
||||
|
||||
"On-The-Wire" Data
|
||||
------------------
|
||||
|
||||
The low-level, "on-the-wire" data is encapsulated similar to the telnet
|
||||
protocol. All data is sent "as-is" with the exception of 0xFF. 0xFF is
|
||||
used as a "command character" and both the client and server expect to
|
||||
see a predefined option after it. The possible options are: 0xFF, 'E',
|
||||
'G', 'Z', and '.'.
|
||||
|
||||
The 0xFF option says to use the literal character 0xFF. So, if there is
|
||||
a 0xFF character in the data stream to be sent, the code will send two
|
||||
0xFF characters (it's similar to using '\\' in C strings to embed a
|
||||
'\').
|
||||
|
||||
The other options are used in various contexts, which will be described
|
||||
in detail below.
|
||||
|
||||
|
||||
Life As A Server
|
||||
----------------
|
||||
|
||||
There are three different interfaces presented to clients by the server.
|
||||
I'm going to name the three modes "master", "group", and "console". The
|
||||
first two are line-based, and the third is character-based.
|
||||
|
||||
To understand the differences, I must outline how conserver manages
|
||||
consoles. When conserver starts, it reads the configuration file,
|
||||
listens on the master socket, and, for each group of consoles it must
|
||||
manage (where the group size is set by -m), it forks off a copy of
|
||||
itself. Those child processes are what actually connect to the consoles
|
||||
and they each listen on a new socket for client connections. So, you
|
||||
end up with a parent process (that knows about all consoles) that
|
||||
manages the child processes (that know only about consoles it manages),
|
||||
and everyone is listening on an individual socket for connections from
|
||||
clients.
|
||||
|
||||
The parent process interacts with clients in "master" mode. That mode
|
||||
expects line-based commands and responds similarly. Because it's the
|
||||
master, it understands a certain set of commands that are different than
|
||||
in "group" mode.
|
||||
|
||||
The child processes interact with clients in "group" mode first, and
|
||||
negotiate a change to "console" mode when a client requests a connection
|
||||
to a specific console.
|
||||
|
||||
|
||||
"master" Mode
|
||||
-------------
|
||||
|
||||
When parent process gets a connection from a client, it either sends an
|
||||
"ok" string to signal it's ready or an error message (like "access from
|
||||
your host is refused") and the connection is dropped. At this point,
|
||||
there are a small number of commands recognized by the server, since
|
||||
most are restricted to "logged in" clients. Here's the list of
|
||||
available commands:
|
||||
|
||||
exit disconnect
|
||||
help this help message
|
||||
login log in
|
||||
ssl start ssl session
|
||||
|
||||
An "exit" is sent a "goodbye" response and the connection is dropped. A
|
||||
"help" is sent the list above. A "ssl" is sent an "ok" response and
|
||||
then the server expects the client to negotiate an ssl connection. A
|
||||
"login" requires one argument (the username) and is either sent an "ok",
|
||||
meaning the client is logged in, or a "passwd?" followed by the local
|
||||
hostname, asking for the user's password, which it expects next. If the
|
||||
client sends a valid password, an "ok" is sent, otherwise an error
|
||||
message and the connection is dropped.
|
||||
|
||||
Upon successful login, the commands available are:
|
||||
|
||||
call provide port for given console
|
||||
exit disconnect
|
||||
groups provide ports for group leaders
|
||||
help this help message
|
||||
master provide a list of master servers
|
||||
pid provide pid of master process
|
||||
quit* terminate conserver (SIGTERM)
|
||||
restart* restart conserver (SIGHUP)
|
||||
version provide version info for server
|
||||
* = requires admin privileges
|
||||
|
||||
"exit" and "help" are the same as before the client logged login.
|
||||
|
||||
The "call" command expects one argument, the console name to connect to.
|
||||
The server will respond with either a port number (if it's a locally
|
||||
managed console), an "@hostname" where hostname is the name of the
|
||||
remote conserver host managing the console (if it's a remotely managed
|
||||
console), or an error message (possibly multi-line). The client is not
|
||||
disconnected, whatever the response.
|
||||
|
||||
The "groups" command responds with a colon-separated list of port
|
||||
numbers, which correspond to each of the child processes running on the
|
||||
local host. The client is not disconnected.
|
||||
|
||||
The "master" command responds with a colon-separated list of "@hostname"
|
||||
names. The list includes any hosts (including the possibility of the
|
||||
local host) which have locally managed consoles. The client is not
|
||||
disconnected.
|
||||
|
||||
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
|
||||
disconnected.
|
||||
|
||||
The "quit" command will shut down 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 "restart" command will shut down 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 not disconnected.
|
||||
|
||||
The "version" command responds with the version string. The client is
|
||||
not disconnected.
|
||||
|
||||
|
||||
"group" Mode
|
||||
------------
|
||||
|
||||
When a child process gets a connection from a client, it either sends an
|
||||
"ok" string to signal it's ready or an error message (like "access from
|
||||
your host is refused") and the connection is dropped. At this point,
|
||||
"group" mode acts just like "master" mode. Once the client successfully
|
||||
logs in, however, "group" mode has the recognizes the following
|
||||
commands:
|
||||
|
||||
broadcast send broadcast message
|
||||
call connect to given console
|
||||
disconnect* disconnect the given user(s)
|
||||
examine examine port and baud rates
|
||||
exit disconnect
|
||||
group show users in this group
|
||||
help this help message
|
||||
hosts show host status and user
|
||||
info show console information
|
||||
textmsg send a text message
|
||||
* = requires admin privileges
|
||||
|
||||
The "exit" and "help" commands are like the others documented above.
|
||||
|
||||
The "broadcast" command expects a text string of the message to be sent
|
||||
to all users connected to this process. An "ok" is sent as a response.
|
||||
|
||||
The "call" command expects one argument, the console name to connect to,
|
||||
just like in "master" mode. The difference here is that this requests
|
||||
the server to attach the client to the console and go into "console"
|
||||
mode. If the attachment is successful, the response will begin with a
|
||||
'[' character. If not, an error message is returned. The success
|
||||
responses are:
|
||||
|
||||
[console is read-only] - console is read only
|
||||
[read-only -- initializing] - console is initializing, and
|
||||
read-only for the time being
|
||||
[line to console is down] - console is down
|
||||
[attached] - attached read-write
|
||||
[spy] - attached read-only
|
||||
|
||||
|
||||
The "disconnect" command expects an argument of the form "user@console"
|
||||
where either the "user" or "@console" part may be omitted. Upon
|
||||
success, a response of the form "ok -- disconnected X users" is sent,
|
||||
where X is the number of users disconnected. If a user is unauthorized
|
||||
or some other problem occurs, an error message (like "unauthorized
|
||||
command") is sent.
|
||||
|
||||
The "examine" command returns a list of console information of the form
|
||||
that 'console -x' shows.
|
||||
|
||||
The "group" command returns a list of console information of the form
|
||||
that 'console -w' shows.
|
||||
|
||||
The "hosts" command returns a list of console information of the form
|
||||
that 'console -u' shows.
|
||||
|
||||
The "info" command returns a list of console information of the form
|
||||
that 'console -i' shows.
|
||||
|
||||
The "textmsg" command expects two arguments, the first being the
|
||||
recipient of the message in the form "user@console" (again, where the
|
||||
"user" or "@console" portion may be omitted) and the second being the
|
||||
string, like the "broadcast" command. The server returns "ok".
|
||||
|
||||
|
||||
"console" Mode
|
||||
--------------
|
||||
|
||||
As mentioned above, "console" mode is obtained by using the "call"
|
||||
command when connected to a child processes operating in "group" mode.
|
||||
|
||||
"console" mode should look very familiar to a user of conserver, as it's
|
||||
what the user interacts with when connected to a console. There's
|
||||
really nothings special here. Each character received from the client
|
||||
is compared to the escape sequence, and if it matches, an action occurs
|
||||
on the server side. If it doesn't match the escape sequence, the data
|
||||
is sent on to the console. All data received from the console is sent
|
||||
to the client(s). Of course, there are certain exceptions to these
|
||||
rules, based on the state of the console and the state of the client.
|
||||
And, certain escape sequences cause special behaviors to occur.
|
||||
|
||||
Most escape sequences cause the server to send information back to the
|
||||
user. Stuff like "^Ecw", "^Eci", and "^Ecu" are examples. The escape
|
||||
sequence is absorbed by the server, the server sends the client a
|
||||
variety of information, and things continue as before.
|
||||
|
||||
The more "interesting" escape sequences are the following.
|
||||
|
||||
"^Ec;" The server sends a 0xFF,'G' command sequence to the client, to
|
||||
signal a wish to move to a new console. The client then gets
|
||||
put into the same state as the "^Ecz" sequence (paused), which
|
||||
gives the client a chance to either resume the connection or
|
||||
disconnect.
|
||||
|
||||
"^Ec|" The server sends a 0xFF,'E' command sequence to the client, to
|
||||
signal a wish to have the client program interact with a
|
||||
program, as opposed to the user. The server discards all data
|
||||
until it receives one of the following command sequences from
|
||||
the client:
|
||||
|
||||
0xFF,'E' Signals successful redirection of interaction to
|
||||
a program. The server then responds with "[rw]"
|
||||
or "[ro]" to tell the client whether or not they
|
||||
have read-write access. If not, the client
|
||||
should abort the program and send the abort
|
||||
command sequence below, as other data received by
|
||||
the server will just get dropped.
|
||||
|
||||
0xFF,'.' Abort the operation. The server assumes the
|
||||
redirection didn't happen and returns the client
|
||||
to it's normal mode.
|
||||
|
||||
The server keeps the client in the "redirected" state until it
|
||||
receives a 0xFF,'.' command sequence from the client (which
|
||||
usually occurs when the client command terminates).
|
||||
|
||||
If the client is "bumped" from read-write to read-only by
|
||||
another user, the server will send the client a 0xFF,'.' command
|
||||
sequence to tell it to abort the redirection and return control
|
||||
back to the user.
|
||||
|
||||
"^Ecz" The server sends a 0xFF,'Z' command sequence to the client, to
|
||||
signal a wish to suspend to client process. The client is then
|
||||
put into a "paused" state where it receives no more data from
|
||||
the server. When the client is ready to resume receiving data,
|
||||
it sends a character of data to the server, at which point the
|
||||
server discards the character and sends back a status message of
|
||||
the form " -- MSG]". The current set of possible messages are:
|
||||
|
||||
" -- line down]"
|
||||
" -- read-only]"
|
||||
" -- attached (nologging)]"
|
||||
" -- attached]"
|
||||
" -- spy mode]"
|
||||
|
||||
#
|
||||
# $Id: PROTOCOL,v 1.1 2004/04/16 16:50:55 bryan Exp $
|
||||
#
|
2
README
2
README
@ -55,5 +55,5 @@ Contributions
|
||||
http://www.columbia.edu/acis/sy/unixdev/zinc
|
||||
|
||||
#
|
||||
# $Id: README,v 1.22 2003-08-23 12:34:24-07 bryan Exp $
|
||||
# $Id: README,v 1.22 2003/08/23 19:34:24 bryan Exp $
|
||||
#
|
||||
|
33
TODO
33
TODO
@ -10,17 +10,11 @@ Bryan Stansell
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
- Singular logging so that swatch/logsurfer can watch for errors across
|
||||
the board - unloved output comes close
|
||||
|
||||
- Telnet protocol should be improved
|
||||
- Not even RFC 854 compliant
|
||||
- Option negotiation ignored - should we negotiate anything?
|
||||
- Not even RFC 854 compliant...or maybe it is (as of 8.1.0)
|
||||
- Option negotiation semi-ignored - should we negotiate anything more?
|
||||
- Others?
|
||||
|
||||
- better shadow file support
|
||||
- what does this mean? i've forgotten.
|
||||
|
||||
- syslog?
|
||||
Daniel E. Singer <des@cs.duke.edu> would like to see it - especially
|
||||
in regards to --use-libwrap code
|
||||
@ -30,14 +24,20 @@ Bryan Stansell
|
||||
- hpux has bigcrypt() also, which we support, so maybe we're covered
|
||||
|
||||
- config file examples for various configurations
|
||||
- sample conserver.cf has some...but it's not explained well
|
||||
|
||||
- per-line timestamps
|
||||
- only when not connected?
|
||||
|
||||
- pipe input/output (console <-> program) via 'console'
|
||||
- some apps (net-ups thing, gdb) might need to talk to user
|
||||
- ^Ec| does this, but the interact with user bits might not work
|
||||
- actually, ^Ec| does work right with 8.1.0...one change that might
|
||||
be nice is the ability to NOT watch the i/o pass to the local
|
||||
command - try sending a big file to the local host with xmodem.
|
||||
|
||||
- autologout? setting per console? gack, would have to interpret data.
|
||||
- this will never happen...i don't want to interpret data
|
||||
|
||||
- "listen" capability (watch all/multiple consoles)
|
||||
|
||||
@ -50,6 +50,7 @@ Bryan Stansell
|
||||
- passphrase...hmmm..could really use some sort of send/expect
|
||||
thing here. you could write a wrapper script of sorts, but it
|
||||
really would be nice to have a raw socket and do the right thing.
|
||||
- this does work, using the 'initcmd' option, so, all done?
|
||||
|
||||
- cyclades ts1000/2000 port : "Moses, Joel" <jmoses@deloitte.com>
|
||||
|
||||
@ -61,8 +62,7 @@ Bryan Stansell
|
||||
|
||||
- server -M flag should accept multiple addresses (comma separated)
|
||||
- should client as well?
|
||||
|
||||
- logfile rotation based on size
|
||||
- this may never happen...does anyone really need it?
|
||||
|
||||
- automatic log rotation in general : Egan Ford <egan@us.ibm.com>
|
||||
|
||||
@ -73,6 +73,7 @@ Bryan Stansell
|
||||
|
||||
- suggestions by Trevor Fiatal <trevor@seven.com>
|
||||
- include server hostname on 'console -x' output
|
||||
- i think the -i output covers it, but maybe not
|
||||
|
||||
- ability to configure strings to be sent to a console periodically :
|
||||
Greg A. Woods <woods@planix.com>
|
||||
@ -82,7 +83,17 @@ Bryan Stansell
|
||||
|
||||
- redefine client escape sequence in conserver.cf : Toby Gerhart
|
||||
<toby.gerhart@eds.com>
|
||||
- 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!
|
||||
|
||||
- allow for very long replays (hundres of lines) : John Stoffel
|
||||
<stoffel@lucent.com>
|
||||
|
||||
- log rotation by date : Tom Pachla <tom.pachla@nlc-bnc.ca>
|
||||
|
||||
- strict file permission checks on conserver.passwd/conserver.cf : Erik
|
||||
Sjolund <erik.sjolund@sbc.su.se>
|
||||
|
||||
#
|
||||
# $Id: TODO,v 1.38 2003-10-31 09:53:46-08 bryan Exp $
|
||||
# $Id: TODO,v 1.49 2004/05/25 00:38:11 bryan Exp $
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: INSTALL,v 1.3 94/07/11 12:38:19 ksb Exp $
|
||||
# $Id: INSTALL.old,v 1.1 2003/11/04 02:36:24 bryan Exp $
|
||||
|
||||
To install this program you need root access and access to the physical
|
||||
console of the machine (either through the console server or via the physical
|
||||
|
@ -31,6 +31,8 @@ ALL = autologin
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
$(AUTOLOGIN_OBJS): $(AUTOLOGIN_HDRS)
|
||||
|
||||
autologin: $(AUTOLOGIN_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o autologin $(AUTOLOGIN_OBJS) $(LIBS)
|
||||
|
||||
|
@ -17,5 +17,5 @@ Good luck.
|
||||
Bryan Stansell
|
||||
|
||||
#
|
||||
# $Id: README,v 1.2 2002-09-23 14:08:42-07 bryan Exp $
|
||||
# $Id: README,v 1.2 2002/09/23 21:08:42 bryan Exp $
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: README,v 1.3 93/04/21 16:13:37 ksb Exp $
|
||||
# $Id: README.old,v 1.1 2003/11/04 02:36:24 bryan Exp $
|
||||
|
||||
This program can be used to put a root shell on the console at boot time.
|
||||
See the manual page.
|
||||
|
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char *rcsid = "$Id: autologin.c,v 1.23 2002-09-20 23:29:39-07 bryan Exp $";
|
||||
char *rcsid = "$Id: autologin.c,v 1.23 2002/09/21 06:29:39 bryan Exp $";
|
||||
#endif /* not lint */
|
||||
extern char *progname;
|
||||
gid_t awGrps[NGROUPS_MAX];
|
||||
|
@ -1,7 +1,7 @@
|
||||
# mkcmd parser for autologin program
|
||||
%%
|
||||
static char *rcsid =
|
||||
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
|
||||
"$Id: autologin.m,v 1.1 2003/11/04 02:36:24 bryan Exp $";
|
||||
%%
|
||||
|
||||
integer variable "iErrs" {
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: autologin.man,v 1.3 93/03/16 16:41:45 ksb Exp $
|
||||
.\" $Id: autologin.man,v 1.2 2004/03/23 18:32:06 bryan Exp $
|
||||
.TH AUTOLOGIN 8L PUCC
|
||||
.SH NAME
|
||||
autologin \- create an automatic login session from /etc/inittab
|
||||
@ -112,12 +112,21 @@ environment variable set to
|
||||
ss10:2:respawn:/usr/local/etc/autologin \-e TERM=reg20 \-t/dev/tty10 \-lssinfo
|
||||
.ad
|
||||
.PP
|
||||
Adding the following line to \fI/etc/ttytab\fP on a Sun 4.1.\fIx\fP
|
||||
Adding the following line to
|
||||
.I /etc/ttytab
|
||||
on a Sun
|
||||
.RI 4.1. x
|
||||
machine establishes a root login on the console device:
|
||||
.br
|
||||
.na
|
||||
console "/usr/local/etc/autologin \-lroot \-t" xterm on local secure
|
||||
.ad
|
||||
Note that \fIinit\fP provides the \fItty\fP argument on the end of the command.
|
||||
.PP
|
||||
Note that
|
||||
.I init
|
||||
provides the
|
||||
.I tty
|
||||
argument on the end of the command.
|
||||
.SH FILES
|
||||
/bin/su
|
||||
.br
|
||||
|
@ -80,7 +80,7 @@ char **nargv, *ostr;
|
||||
#endif /* ! HAVE_GETOPT */
|
||||
|
||||
char
|
||||
*progname = "$Id$",
|
||||
*progname = "$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $",
|
||||
*au_terse[] = {
|
||||
" [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]",
|
||||
" -h",
|
||||
@ -111,7 +111,7 @@ int
|
||||
#endif
|
||||
|
||||
static char *rcsid =
|
||||
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
|
||||
"$Id: main.c,v 1.1 2003/11/04 02:36:24 bryan Exp $";
|
||||
|
||||
/*
|
||||
* parser
|
||||
|
9
compat.h
9
compat.h
@ -7,8 +7,11 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
@ -287,6 +290,10 @@ typedef int socklen_t;
|
||||
#define ONLRET 0
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET L_SET
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if PROTOTYPES
|
||||
# define PARAMS(protos) protos
|
||||
|
65
config.guess
vendored
65
config.guess
vendored
@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2003-08-18'
|
||||
timestamp='2004-03-12'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -197,12 +197,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit 0 ;;
|
||||
amd64:OpenBSD:*:*)
|
||||
echo x86_64-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
cats:OpenBSD:*:*)
|
||||
echo arm-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -221,6 +227,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
mvmeppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pegasos:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -236,10 +245,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:ekkoBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
macppc:MirBSD:*:*)
|
||||
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
case $UNAME_RELEASE in
|
||||
*4.0)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
fi
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
# OSF/1 and Tru64 systems produced since 1995. I hope that
|
||||
# covers most systems running today. This code pipes the CPU
|
||||
@ -277,11 +300,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
"EV7.9 (21364A)")
|
||||
UNAME_MACHINE="alphaev79" ;;
|
||||
esac
|
||||
# A Pn.n version is a patched version.
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit 0 ;;
|
||||
Alpha*:OpenVMS:*:*)
|
||||
echo alpha-hp-vms
|
||||
@ -307,6 +331,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
@ -399,6 +426,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -742,6 +772,11 @@ EOF
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -751,7 +786,7 @@ EOF
|
||||
*:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
|
||||
*:FreeBSD:*:*)
|
||||
# Determine whether the default compiler uses glibc.
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
@ -763,7 +798,7 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
# GNU/FreeBSD systems have a "k" prefix to indicate we are using
|
||||
# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
|
||||
# FreeBSD's kernel, but not the complete OS.
|
||||
case ${LIBC} in gnu) kernel_only='k' ;; esac
|
||||
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
|
||||
@ -799,8 +834,13 @@ EOF
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit 0 ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit 0 ;;
|
||||
@ -813,6 +853,9 @@ EOF
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
@ -981,6 +1024,9 @@ EOF
|
||||
i*86:atheos:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-atheos
|
||||
exit 0 ;;
|
||||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit 0 ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@ -1052,7 +1098,7 @@ EOF
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
|
||||
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
@ -1167,7 +1213,7 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit 0 ;;
|
||||
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
echo nsr-tandem-nsk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:NonStop-UX:*:*)
|
||||
@ -1211,6 +1257,9 @@ EOF
|
||||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
18
config.h.in
18
config.h.in
@ -1,5 +1,8 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Client config file path */
|
||||
#undef CLIENTCONFIGFILE
|
||||
|
||||
/* Config file path */
|
||||
#undef CONFIGFILE
|
||||
|
||||
@ -207,6 +210,9 @@
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/proc.h> header file. */
|
||||
#undef HAVE_SYS_PROC_H
|
||||
|
||||
@ -321,9 +327,18 @@
|
||||
/* Defined if we trust reverse DNS */
|
||||
#undef TRUST_REVERSE_DNS
|
||||
|
||||
/* Directory for Unix domain sockets */
|
||||
#undef UDSDIR
|
||||
|
||||
/* Defined if we produce extended messages */
|
||||
#undef USE_EXTENDED_MESSAGES
|
||||
|
||||
/* use tcp_wrappers libwrap */
|
||||
#undef USE_LIBWRAP
|
||||
|
||||
/* Defined if we use Unix domain sockets */
|
||||
#undef USE_UNIX_DOMAIN_SOCKETS
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
@ -345,3 +360,6 @@
|
||||
|
||||
/* Define if <signal.h> does not define sig_atomic_t */
|
||||
#undef sig_atomic_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
63
config.sub
vendored
63
config.sub
vendored
@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2003-08-18'
|
||||
timestamp='2004-03-12'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -118,7 +118,8 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -236,7 +237,7 @@ case $basic_machine in
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@ -248,6 +249,7 @@ case $basic_machine in
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
@ -260,7 +262,7 @@ case $basic_machine in
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
@ -306,7 +308,7 @@ case $basic_machine in
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
@ -320,6 +322,7 @@ case $basic_machine in
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
@ -333,7 +336,7 @@ case $basic_machine in
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
@ -360,6 +363,9 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
@ -377,6 +383,9 @@ case $basic_machine in
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@ -436,12 +445,20 @@ case $basic_machine in
|
||||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@ -741,6 +758,10 @@ case $basic_machine in
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-os400
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
@ -961,6 +982,10 @@ case $basic_machine in
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
tpf)
|
||||
basic_machine=s390x-ibm
|
||||
os=-tpf
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@ -1056,7 +1081,7 @@ case $basic_machine in
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@ -1129,19 +1154,20 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1180,6 +1206,9 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@ -1201,6 +1230,9 @@ case $os in
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-syllable*)
|
||||
os=-syllable
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
@ -1223,6 +1255,9 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
@ -1471,9 +1506,15 @@ case $basic_machine in
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-os400*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-tpf*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
vendor=wrs
|
||||
;;
|
||||
|
127
configure.in
127
configure.in
@ -4,6 +4,7 @@ AH_TEMPLATE([DEFPORT], [Socket used to communicate])
|
||||
AH_TEMPLATE([DEFBASEPORT], [Base socket used for secondary channel])
|
||||
AH_TEMPLATE([MASTERHOST], [Hostname of console server])
|
||||
AH_TEMPLATE([CONFIGFILE], [Config file path])
|
||||
AH_TEMPLATE([CLIENTCONFIGFILE], [Client config file path])
|
||||
AH_TEMPLATE([PASSWDFILE], [Password file path])
|
||||
AH_TEMPLATE([LOGFILEPATH], [Logfile path])
|
||||
AH_TEMPLATE([MAXMEMB], [Number of consoles per child process])
|
||||
@ -16,9 +17,13 @@ AH_TEMPLATE([HAVE_OPENSSL], [have openssl support])
|
||||
AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
|
||||
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([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages])
|
||||
AH_TEMPLATE([USE_UNIX_DOMAIN_SOCKETS],[Defined if we use Unix domain sockets])
|
||||
AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets])
|
||||
|
||||
dnl ### Normal initialization. ######################################
|
||||
AC_INIT
|
||||
AC_PREREQ(2.59)
|
||||
AC_CONFIG_SRCDIR([conserver/main.c])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
@ -48,7 +53,7 @@ dnl AC_MSG_RESULT($with_64bit)
|
||||
|
||||
AC_MSG_CHECKING(for port number specification)
|
||||
AC_ARG_WITH(port,
|
||||
AC_HELP_STRING([--with-port=PORT],[Specify port number @<:@conserver@:>@]),
|
||||
AS_HELP_STRING([--with-port=PORT],[Specify port number @<:@conserver@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(DEFPORT, "conserver")
|
||||
@ -64,7 +69,7 @@ AC_ARG_WITH(port,
|
||||
|
||||
AC_MSG_CHECKING(for secondary channel base port)
|
||||
AC_ARG_WITH(base,
|
||||
AC_HELP_STRING([--with-base=PORT], [Base port for secondary channel @<:@0@:>@]),
|
||||
AS_HELP_STRING([--with-base=PORT], [Base port for secondary channel @<:@0@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(DEFBASEPORT, "0")
|
||||
@ -80,7 +85,7 @@ AC_ARG_WITH(base,
|
||||
|
||||
AC_MSG_CHECKING(for master conserver hostname)
|
||||
AC_ARG_WITH(master,
|
||||
AC_HELP_STRING([--with-master=MASTER],[Specify master server hostname @<:@console@:>@]),
|
||||
AS_HELP_STRING([--with-master=MASTER],[Specify master server hostname @<:@console@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(MASTERHOST, "console")
|
||||
@ -94,9 +99,29 @@ AC_ARG_WITH(master,
|
||||
[AC_DEFINE_UNQUOTED(MASTERHOST, "console")
|
||||
AC_MSG_RESULT('console')])
|
||||
|
||||
AC_MSG_CHECKING(for client configuration filename)
|
||||
AC_ARG_WITH(ccffile,
|
||||
AS_HELP_STRING([--with-ccffile=CFFILE],[Specify client config filename @<:@SYSCONFDIR/console.cf@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/console.cf"])
|
||||
AC_MSG_RESULT('$sysconfdir/console.cf')
|
||||
;;
|
||||
[[\\/]]* | ?:[[\\/]]* )
|
||||
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, ["$withval"])
|
||||
AC_MSG_RESULT('$withval')
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/$withval"])
|
||||
AC_MSG_RESULT('$sysconfdir/$withval')
|
||||
;;
|
||||
esac],
|
||||
[AC_DEFINE_UNQUOTED(CLIENTCONFIGFILE, [SYSCONFDIR "/console.cf"])
|
||||
AC_MSG_RESULT('$sysconfdir/console.cf')])
|
||||
|
||||
AC_MSG_CHECKING(for configuration filename)
|
||||
AC_ARG_WITH(cffile,
|
||||
AC_HELP_STRING([--with-cffile=CFFILE],[Specify config filename @<:@SYSCONFDIR/conserver.cf@:>@]),
|
||||
AS_HELP_STRING([--with-cffile=CFFILE],[Specify config filename @<:@SYSCONFDIR/conserver.cf@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(CONFIGFILE, [SYSCONFDIR "/conserver.cf"])
|
||||
@ -116,7 +141,7 @@ AC_ARG_WITH(cffile,
|
||||
|
||||
AC_MSG_CHECKING(for password filename)
|
||||
AC_ARG_WITH(pwdfile,
|
||||
AC_HELP_STRING([--with-pwdfile=PWDFILE],[Specify password filename @<:@SYSCONFDIR/conserver.passwd@:>@]),
|
||||
AS_HELP_STRING([--with-pwdfile=PWDFILE],[Specify password filename @<:@SYSCONFDIR/conserver.passwd@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(PASSWDFILE, [SYSCONFDIR "/conserver.passwd"])
|
||||
@ -136,7 +161,7 @@ AC_ARG_WITH(pwdfile,
|
||||
|
||||
AC_MSG_CHECKING(for log filename)
|
||||
AC_ARG_WITH(logfile,
|
||||
AC_HELP_STRING([--with-logfile=LOGFILE],[Specify log filename @<:@/var/log/conserver@:>@]),
|
||||
AS_HELP_STRING([--with-logfile=LOGFILE],[Specify log filename @<:@/var/log/conserver@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/conserver")
|
||||
@ -153,7 +178,7 @@ AC_ARG_WITH(logfile,
|
||||
AC_SUBST(PIDFILE)
|
||||
AC_MSG_CHECKING(for PID filename)
|
||||
AC_ARG_WITH(pidfile,
|
||||
AC_HELP_STRING([--with-pidfile=PIDFILE],[Specify PID filepath @<:@/var/run/conserver.pid@:>@]),
|
||||
AS_HELP_STRING([--with-pidfile=PIDFILE],[Specify PID filepath @<:@/var/run/conserver.pid@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
PIDFILE="/var/run/conserver.pid"
|
||||
@ -168,7 +193,7 @@ AC_MSG_RESULT('$PIDFILE')
|
||||
|
||||
AC_MSG_CHECKING(for MAXMEMB setting)
|
||||
AC_ARG_WITH(maxmemb,
|
||||
AC_HELP_STRING([--with-maxmemb=MAXMEMB],[Specify maximum consoles per process @<:@16@:>@]),
|
||||
AS_HELP_STRING([--with-maxmemb=MAXMEMB],[Specify maximum consoles per process @<:@16@:>@]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_DEFINE_UNQUOTED(MAXMEMB, 16)
|
||||
@ -190,7 +215,7 @@ AC_ARG_WITH(maxmemb,
|
||||
|
||||
AC_MSG_CHECKING(for connect() timeout)
|
||||
AC_ARG_WITH(timeout,
|
||||
AC_HELP_STRING([--with-timeout=TIMEOUT],[Specify connect() timeout in seconds @<:@10@:>@]),
|
||||
AS_HELP_STRING([--with-timeout=TIMEOUT],[Specify connect() timeout in seconds @<:@10@:>@]),
|
||||
[if expr "$withval" : '[[0-9]]*$' >/dev/null 2>&1 &&
|
||||
test "$withval" -gt 0 -a "$withval" -lt 300; then
|
||||
AC_DEFINE_UNQUOTED(CONNECTTIMEOUT, $withval)
|
||||
@ -204,7 +229,7 @@ AC_ARG_WITH(timeout,
|
||||
|
||||
AC_MSG_CHECKING(whether to trust reverse DNS)
|
||||
AC_ARG_WITH(trustrevdns,
|
||||
AC_HELP_STRING([--with-trustrevdns],[Trust reverse DNS information]),
|
||||
AS_HELP_STRING([--with-trustrevdns],[Trust reverse DNS information]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(TRUST_REVERSE_DNS)
|
||||
@ -215,6 +240,48 @@ AC_ARG_WITH(trustrevdns,
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(whether to display extended messages)
|
||||
AC_ARG_WITH(extmsgs,
|
||||
AS_HELP_STRING([--with-extmsgs],[Produce extended messages]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(USE_EXTENDED_MESSAGES)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
|
||||
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],[AC_MSG_RESULT(no)])
|
||||
|
||||
dnl ### Check for compiler et al. ###################################
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
@ -244,12 +311,19 @@ if test "$ac_cv_sys_posix_termios" != "yes"; then
|
||||
AC_MSG_ERROR([POSIX termios interface required])
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(unistd.h getopt.h sys/vlimit.h sys/resource.h ttyent.h sys/ttold.h sys/uio.h sys/proc.h sys/ioctl_compat.h usersec.h sys/select.h stropts.h sys/audit.h shadow.h sys/time.h crypt.h sysexits.h types.h sys/sockio.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)
|
||||
dnl sys/proc.h needs sys/param.h on openbsd, apparently
|
||||
AC_CHECK_HEADERS(sys/proc.h, [], [],
|
||||
[#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
])
|
||||
AC_HEADER_TIME
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
AC_CHECK_TYPE([sig_atomic_t],,
|
||||
AC_DEFINE(sig_atomic_t, volatile int,
|
||||
@ -293,8 +367,9 @@ AC_SEARCH_LIBS(crypt,crypt)
|
||||
AC_SUBST(CONSLIBS)
|
||||
AC_SUBST(CONSCPPFLAGS)
|
||||
AC_SUBST(CONSLDFLAGS)
|
||||
cons_with_libwrap="NO"
|
||||
AC_ARG_WITH(libwrap,
|
||||
AC_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
|
||||
AS_HELP_STRING([--with-libwrap@<:@=PATH@:>@],
|
||||
[Compile in libwrap (tcp_wrappers) support]),
|
||||
[if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
@ -320,6 +395,7 @@ AC_ARG_WITH(libwrap,
|
||||
int deny_severity = 0;
|
||||
],[hosts_access((void *)0)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_libwrap="YES"
|
||||
AC_DEFINE(USE_LIBWRAP)
|
||||
CONSLIBS="$CONSLIBS -lwrap"
|
||||
CONSLDFLAGS="$CONSLDFLAGS $WRAPLDFLAGS"
|
||||
@ -332,6 +408,7 @@ AC_ARG_WITH(libwrap,
|
||||
int deny_severity = 0;
|
||||
],[hosts_access((void *)0)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_libwrap="YES"
|
||||
AC_DEFINE(USE_LIBWRAP)
|
||||
CONSLIBS="$CONSLIBS -lwrap -lnsl"
|
||||
CONSLDFLAGS="$CONSLDFLAGS $WRAPLDFLAGS"
|
||||
@ -343,8 +420,9 @@ AC_ARG_WITH(libwrap,
|
||||
fi]
|
||||
)
|
||||
|
||||
cons_with_openssl="NO"
|
||||
AC_ARG_WITH(openssl,
|
||||
AC_HELP_STRING([--with-openssl@<:@=PATH@:>@],
|
||||
AS_HELP_STRING([--with-openssl@<:@=PATH@:>@],
|
||||
[Compile in OpenSSL support]),
|
||||
[if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
@ -369,6 +447,7 @@ AC_ARG_WITH(openssl,
|
||||
AC_TRY_LINK([#include <openssl/ssl.h>
|
||||
],[SSL_library_init()],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_openssl="YES"
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
have_openssl=yes],
|
||||
[AC_MSG_RESULT(no)])],)
|
||||
@ -381,8 +460,9 @@ AC_ARG_WITH(openssl,
|
||||
fi]
|
||||
)
|
||||
|
||||
cons_with_dmalloc="NO"
|
||||
AC_ARG_WITH(dmalloc,
|
||||
AC_HELP_STRING([--with-dmalloc@<:@=PATH@:>@],
|
||||
AS_HELP_STRING([--with-dmalloc@<:@=PATH@:>@],
|
||||
[Compile in dmalloc support]),
|
||||
[if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
@ -407,6 +487,7 @@ AC_ARG_WITH(dmalloc,
|
||||
AC_TRY_LINK([#include <dmalloc.h>
|
||||
],[dmalloc_debug(0)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_dmalloc="YES"
|
||||
AC_DEFINE(HAVE_DMALLOC)
|
||||
have_dmalloc=yes],
|
||||
[AC_MSG_RESULT(no)])],)
|
||||
@ -455,9 +536,10 @@ dnl else
|
||||
dnl AC_MSG_RESULT(no)
|
||||
dnl fi],[AC_MSG_RESULT(no)])
|
||||
|
||||
cons_with_pam="NO"
|
||||
AC_MSG_CHECKING(for PAM support)
|
||||
AC_ARG_WITH(pam,
|
||||
AC_HELP_STRING([--with-pam],
|
||||
AS_HELP_STRING([--with-pam],
|
||||
[Enable PAM support]),
|
||||
[if test "$withval" = yes; then
|
||||
oLIBS="$LIBS"
|
||||
@ -467,6 +549,7 @@ AC_ARG_WITH(pam,
|
||||
AC_MSG_CHECKING(for PAM library -lpam)
|
||||
AC_TRY_LINK_FUNC([pam_start],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_pam="YES"
|
||||
AC_DEFINE(HAVE_PAM)
|
||||
CONSLIBS="$CONSLIBS -lpam"],
|
||||
[LIBS="$LIBS -ldl"
|
||||
@ -474,6 +557,7 @@ AC_ARG_WITH(pam,
|
||||
AC_MSG_CHECKING(for PAM library -lpam with -ldl)
|
||||
AC_TRY_LINK_FUNC([pam_end],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_pam="YES"
|
||||
AC_DEFINE(HAVE_PAM)
|
||||
CONSLIBS="$CONSLIBS -lpam -ldl"],
|
||||
[AC_MSG_RESULT(no)])])],)
|
||||
@ -516,3 +600,16 @@ dnl ### Create output files. #######################################
|
||||
AC_CONFIG_FILES([Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile contrib/chat/Makefile])
|
||||
AC_CONFIG_FILES([conserver/conserver.rc], [chmod +x conserver/conserver.rc])
|
||||
AC_OUTPUT
|
||||
|
||||
[
|
||||
echo "=============================================================="
|
||||
echo " Feature Summary"
|
||||
echo ""
|
||||
echo " Unix domain sockets (--with-uds) : $cons_with_uds"
|
||||
echo " TCP wrappers (--with-libwrap): $cons_with_libwrap"
|
||||
echo " OpenSSL (--with-openssl): $cons_with_openssl"
|
||||
echo " dmalloc (--with-dmalloc): $cons_with_dmalloc"
|
||||
echo " PAM support (--with-pam) : $cons_with_pam"
|
||||
echo ""
|
||||
echo "=============================================================="
|
||||
]
|
||||
|
@ -7,5 +7,5 @@ files with enough detail to get you going.
|
||||
That's about it. Good luck.
|
||||
|
||||
#
|
||||
# $Id: INSTALL,v 1.3 2003-07-04 11:21:21-07 bryan Exp $
|
||||
# $Id: INSTALL,v 1.3 2003/07/04 18:21:21 bryan Exp $
|
||||
#
|
||||
|
@ -3,7 +3,8 @@ srcdir = @srcdir@
|
||||
prefix = @prefix@
|
||||
mandir = @mandir@
|
||||
sysconfdir = @sysconfdir@
|
||||
exampledir = $(prefix)/share/examples/conserver
|
||||
datadir = @datadir@
|
||||
exampledir = $(datadir)/examples/conserver
|
||||
|
||||
### Installation programs and flags
|
||||
INSTALL = @INSTALL@
|
||||
|
@ -1,54 +1,114 @@
|
||||
#
|
||||
# $Id: conserver.cf,v 1.5 2003-07-04 11:05:04-07 bryan Exp $
|
||||
# Sample conserver.cf file, to give you ideas of what you can do with
|
||||
# the various configuration items.
|
||||
#
|
||||
# The character '&' in logfile names are substituted with the console
|
||||
# name.
|
||||
#
|
||||
default full {
|
||||
rw *;
|
||||
}
|
||||
|
||||
### set up global access
|
||||
default full { rw *; }
|
||||
|
||||
### define some terminal server specifics
|
||||
# we set portbase and portinc so we can reference the ports in a
|
||||
# physical representation and let conserver do the math to figure
|
||||
# out the actual socket address
|
||||
default cisco { type host; portbase 2000; portinc 1; }
|
||||
default xyplex { type host; portbase 2000; portinc 100; }
|
||||
default iolan { type host; portbase 10000; portinc 1; }
|
||||
|
||||
### set up some custom break sequences
|
||||
break 4 { string "+\d+\d+"; delay 300; }
|
||||
break 5 { string "\033c"; }
|
||||
|
||||
### set the defaults for all the consoles
|
||||
# these get applied before anything else
|
||||
default * {
|
||||
# The '&' character is substituted with the console name
|
||||
logfile /var/consoles/&;
|
||||
timestamp "";
|
||||
# timestamps every hour with activity and break logging
|
||||
timestamp 1hab;
|
||||
# include the 'full' default
|
||||
include full;
|
||||
}
|
||||
#
|
||||
# list of consoles we serve
|
||||
#
|
||||
console tweety {
|
||||
# master server is localhost
|
||||
master localhost;
|
||||
type host;
|
||||
host ts1;
|
||||
port 2002;
|
||||
}
|
||||
console bambam {
|
||||
master localhost;
|
||||
type host;
|
||||
host ts1;
|
||||
port 2003;
|
||||
|
||||
### define the first terminal server
|
||||
default ts1.conserver.com {
|
||||
# use the xyplex defaults
|
||||
include xyplex;
|
||||
# host to connect to is ts1.conserver.com
|
||||
host ts1.conserver.com;
|
||||
# run login-xyplex when connecting to the term server
|
||||
initcmd /usr/local/sbin/login-xyplex;
|
||||
}
|
||||
console shell {
|
||||
master localhost;
|
||||
logfile /dev/null;
|
||||
|
||||
# now define the consoles on ts1.conserver.com
|
||||
# bryan isn't allowed on web1.conserver.com
|
||||
console web1.conserver.com { include ts1.conserver.com; port 2; rw !bryan; }
|
||||
console ns1.conserver.com { include ts1.conserver.com; port 10; }
|
||||
console ns2.conserver.com { include ts1.conserver.com; port 8; }
|
||||
|
||||
### define the second terminal server
|
||||
# this one is a cisco, with simple socket connections
|
||||
default ts2.conserver.com { include cisco; host ts2.conserver.com; }
|
||||
|
||||
# and the consoles on ts2.conserver.com
|
||||
console ldap1.conserver.com { include ts2.conserver.com; port 7; }
|
||||
|
||||
### and now some one-off consoles
|
||||
# we still inherit the '*' default set
|
||||
# a simple ssh invocation
|
||||
console ssh {
|
||||
type exec;
|
||||
exec "";
|
||||
}
|
||||
console telnet {
|
||||
master localhost;
|
||||
logfile /dev/null;
|
||||
type exec;
|
||||
exec telnet host;
|
||||
exec ssh localhost;
|
||||
# provide a 'message-of-the-day'
|
||||
motd "just a simple ssh to localhost";
|
||||
}
|
||||
|
||||
# connect to /dev/ttya
|
||||
console ttya {
|
||||
master localhost;
|
||||
type device;
|
||||
device /dev/ttya;
|
||||
device /dev/ttya; parity none; baud 9600;
|
||||
idlestring "#";
|
||||
idletimeout 5m; # send a '#' every 5 minutes of idle
|
||||
timestamp ""; # no timestamps on this console
|
||||
}
|
||||
|
||||
### define a group of users
|
||||
group sysadmin {
|
||||
users bryan, todd;
|
||||
users dave;
|
||||
}
|
||||
|
||||
### reset the defaults for the next set of consoles
|
||||
# again, these get applied before anything else
|
||||
default * {
|
||||
# The '&' character is substituted with the console name
|
||||
logfile /var/consoles/&;
|
||||
timestamp 5m;
|
||||
rw sysadmin; # use the group defined above
|
||||
master localhost;
|
||||
}
|
||||
|
||||
default cyclades {
|
||||
# sets up /dev/ttyC0 through /dev/ttyC31, for a 32 port card
|
||||
# referenced as ports 1 through 32
|
||||
type device;
|
||||
device /dev/ttyC.;
|
||||
devicesubst .=Pd;
|
||||
portbase -1;
|
||||
portinc 1;
|
||||
host none; # not really used, since devicesubst doesn't use it
|
||||
baud 9600;
|
||||
parity none;
|
||||
}
|
||||
#
|
||||
# list of clients we allow
|
||||
#
|
||||
|
||||
console modem1.conserver.com { include cyclades; port 2; break 4; }
|
||||
# todd isn't allowed on modem2.conserver.com
|
||||
console modem2.conserver.com { include cyclades; port 6; rw !todd; }
|
||||
|
||||
### list of clients we allow
|
||||
access * {
|
||||
allowed 127.0.0.1 gnac.com;
|
||||
allowed 10.0.0.0/8 192.168.0.0/16;
|
||||
allowed cs1.conserver.com cs2.conserver.com cs3.conserver.com;
|
||||
trusted 127.0.0.1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $Id: conserver.cf.man,v 1.44 2003-10-31 09:54:19-08 bryan Exp $
|
||||
.TH CONSERVER.CF 5 "2003-10-31" "conserver-8.0.5" "conserver"
|
||||
.\" $Id: conserver.cf.man,v 1.63 2004/05/07 03:42:51 bryan Exp $
|
||||
.TH CONSERVER.CF 5 "2004/05/07" "conserver-8.1.6" "conserver"
|
||||
.SH NAME
|
||||
conserver.cf \- console configuration file for
|
||||
.BR conserver (8)
|
||||
@ -65,12 +65,12 @@ The parser has six characters that it considers special.
|
||||
These are: ``{'', ``}'', ``;'', ``#'', ``\e'', and ``"''.
|
||||
The first three (hereby called tokens) define the format of the
|
||||
configuration blocks and are used as word
|
||||
seperators, the next is the comment character, and the last two are
|
||||
separators, the next is the comment character, and the last two are
|
||||
quoting characters.
|
||||
.PP
|
||||
Word seperation occurs when the parser encounters an unquoted token
|
||||
Word separation occurs when the parser encounters an unquoted token
|
||||
and, in certain cases, whitespace.
|
||||
Whitespace is only used as a word seperator when the parser is
|
||||
Whitespace is only used as a word separator when the parser is
|
||||
looking for a block-type or keyword.
|
||||
When it's looking for a block-name or value, whitespace is like any
|
||||
other character, which allows you to embed whitespace in a block-name
|
||||
@ -107,6 +107,24 @@ of things, we have:
|
||||
"defa"ult my\e defs { rw *; in\eclude "other defs" ; }
|
||||
.fi
|
||||
.ft
|
||||
.PP
|
||||
There is one special line the parser recognizes: a ``#include'' statement.
|
||||
It is of the form:
|
||||
.IP
|
||||
.B #include
|
||||
.I filename
|
||||
.PP
|
||||
Any whitespace around
|
||||
.I filename
|
||||
is ignored, but whitespace embedded inside is preserved.
|
||||
Everything in
|
||||
.I filename
|
||||
is taken literally, so none of the normal parser quoting applies.
|
||||
The
|
||||
.B #include
|
||||
must begin in ``column 0'' - no whitespace is allowed between it and
|
||||
the start of the physical line.
|
||||
There is an include file depth limit of 10 to prevent infinite recursion.
|
||||
.SH BLOCKS
|
||||
.TP 8
|
||||
.B access
|
||||
@ -123,14 +141,27 @@ fashion (top down), so order is important.
|
||||
.RS
|
||||
.TP 15
|
||||
.B admin
|
||||
.RI [ " username" ,...
|
||||
.RI "[ [\f3!\fP]" username ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the admin list for the console server.
|
||||
If
|
||||
.I username
|
||||
matches a previously defined group name, all members of the previous
|
||||
group are added to the admin list.
|
||||
group are applied to the admin list (with access reversed if prefixed
|
||||
with a `!').
|
||||
If
|
||||
.I username
|
||||
doesn't match a previously defined group and
|
||||
.I username
|
||||
begins with `@', the name (minus the `@') is checked against the
|
||||
host's group database.
|
||||
All users found in the group will be granted (or denied, if prefixed
|
||||
with `!') access.
|
||||
If
|
||||
.I username
|
||||
doesn't match a previous group and doesn't begin with `@', the users
|
||||
will be granted (or denied, if prefixed with `!') access.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for the console servers's admin list are removed.
|
||||
.TP
|
||||
@ -202,7 +233,9 @@ alert
|
||||
backspace
|
||||
.TP
|
||||
.B \ed
|
||||
0.33 second delay
|
||||
delay specified by the
|
||||
.B delay
|
||||
option.
|
||||
.TP
|
||||
.B \ef
|
||||
form-feed
|
||||
@ -260,7 +293,8 @@ all conserver hosts.
|
||||
.RS
|
||||
.TP 15
|
||||
.B defaultaccess
|
||||
.RB [ " rejected " | " trusted " | " allowed " ]
|
||||
.RB [ " rejected " | " trusted "
|
||||
.RB | " allowed " ]
|
||||
.br
|
||||
Set the default access permission for all hosts not matched by
|
||||
an access list (see the
|
||||
@ -268,12 +302,41 @@ an access list (see the
|
||||
command-line flag).
|
||||
.TP
|
||||
.B daemonmode
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not to become a daemon when run (see the
|
||||
.B \-d
|
||||
command-line flag).
|
||||
.TP
|
||||
.B initdelay
|
||||
.I number
|
||||
.br
|
||||
Set the number of seconds between console initializations.
|
||||
All consoles with the same
|
||||
.B host
|
||||
value will be throttled as a group (those without a
|
||||
.B host
|
||||
value are their own group).
|
||||
In other words, each console within a group will only be initialized after
|
||||
.I number
|
||||
seconds passes from the previous initialization of a console in that group.
|
||||
Different throttle groups are initialized simultaneously.
|
||||
One warning: since consoles are split up and managed by seperate conserver
|
||||
processes, it's possible for more than one conserver process to
|
||||
have a throttle group based on a particular
|
||||
.B host
|
||||
value.
|
||||
If this happens, each conserver process will throttle their groups
|
||||
independently of the other conserver processes, which results in a
|
||||
more rapid initialization (per
|
||||
.B host
|
||||
value) than one might otherwise expect.
|
||||
If
|
||||
.I number
|
||||
is zero, all consoles are initialized without delay.
|
||||
.TP
|
||||
.B logfile
|
||||
.I filename
|
||||
.br
|
||||
@ -296,7 +359,9 @@ Set the port used by the master conserver process (see the
|
||||
command-line flag).
|
||||
.TP
|
||||
.B redirect
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Turn redirection on or off (see the
|
||||
.B \-R
|
||||
@ -305,7 +370,7 @@ command-line flag).
|
||||
.B reinitcheck
|
||||
.I number
|
||||
.br
|
||||
Set the number of seconds used between reinitialization checks (see the
|
||||
Set the number of minutes used between reinitialization checks (see the
|
||||
.B \-O
|
||||
command-line flag).
|
||||
.TP
|
||||
@ -317,7 +382,9 @@ Set the base port number used by child processes (see the
|
||||
command-line flag).
|
||||
.TP
|
||||
.B setproctitle
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not the process title shows master/group functionality
|
||||
as well as the port number the process is listening on and how many
|
||||
@ -336,11 +403,22 @@ credentials file location (see the
|
||||
command-line flag).
|
||||
.TP
|
||||
.B sslrequired
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not encryption is required when talking to clients (see the
|
||||
.B \-E
|
||||
command-line flag).
|
||||
.TP
|
||||
.B unifiedlog
|
||||
.I filename
|
||||
.br
|
||||
Set the location of the unified log to
|
||||
.IR filename .
|
||||
See the
|
||||
.B \-U
|
||||
command-line flag for details.
|
||||
.RE
|
||||
.TP 8
|
||||
.B console
|
||||
@ -370,13 +448,16 @@ Define a block of defaults identified as
|
||||
If
|
||||
.I name
|
||||
is ``*'', the automatically applied default block is defined (basically
|
||||
all consoles have an implicit ``include "*";'' at the begining
|
||||
all consoles have an implicit ``include "*";'' at the beginning
|
||||
of their definition).
|
||||
.RS
|
||||
.TP 15
|
||||
.B baud
|
||||
.RB [ " 300 " | " 600 " | " 1800 " | " 2400 " | " 4800"
|
||||
.RB | " 9600 " | " 19200 " | " 38400 " | " 57600 " | " 115200 " ]
|
||||
.RB [ " 300 " | " 600 "
|
||||
.RB | " 1800 " | " 2400 "
|
||||
.RB | " 4800 " | " 9600 "
|
||||
.RB | " 19200 " | " 38400 "
|
||||
.RB | " 57600 " | " 115200 " ]
|
||||
.br
|
||||
Assign the baud rate to the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
@ -397,6 +478,76 @@ Assign the serial device
|
||||
as the access to the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
.TP
|
||||
.B devicesubst
|
||||
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
|
||||
| "" ]
|
||||
.br
|
||||
Perform character substitutions on the
|
||||
.B device
|
||||
value.
|
||||
A series of replacements can be defined by specifying a
|
||||
comma-separated list of
|
||||
\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP
|
||||
sequences where
|
||||
.I c
|
||||
is any printable character,
|
||||
.I t
|
||||
specifies the replacement value,
|
||||
.I n
|
||||
is a field length (optional),
|
||||
and
|
||||
.I f
|
||||
is the format string.
|
||||
.I t
|
||||
can be one of the characters below, catagorized as a string replacement
|
||||
or a numeric replacement, which dictates the use of the
|
||||
.I n
|
||||
and
|
||||
.I f
|
||||
fields.
|
||||
.RS
|
||||
.RS
|
||||
.sp
|
||||
.PD 0
|
||||
.TP
|
||||
String Replacement
|
||||
.TP
|
||||
.B h
|
||||
.B host
|
||||
value
|
||||
.TP
|
||||
.B c
|
||||
console name
|
||||
.sp
|
||||
.PP
|
||||
Numeric Replacement
|
||||
.TP
|
||||
.B p
|
||||
config
|
||||
.B port
|
||||
value
|
||||
.TP
|
||||
.B P
|
||||
calculated port value
|
||||
.PD
|
||||
.RE
|
||||
.RE
|
||||
.IP
|
||||
For string replacements, if the replacement isn't at least
|
||||
.I n
|
||||
characters, it will be padded with space characters on the left.
|
||||
.I f
|
||||
must be `s'.
|
||||
For numeric replacements, the value will be formatted to at least
|
||||
.I n
|
||||
characters, padded with 0s if
|
||||
.I n
|
||||
begins with a 0, and space characters otherwise.
|
||||
.I f
|
||||
must be either `d', `x' or `X', specifying a decimal, lower-case
|
||||
hexadecimal, or an uppercase hexadecimal conversion.
|
||||
If the null string (``""'') is used, no replacements will be done.
|
||||
.TP
|
||||
.B exec
|
||||
.RI [ " command "
|
||||
| "" ]
|
||||
@ -405,11 +556,23 @@ Assign the string
|
||||
.I command
|
||||
as the command to access the console.
|
||||
Conserver will run the command by
|
||||
invoking ``/bin/sh -ce "\fIcommand\fP"''.
|
||||
invoking ``/bin/sh -ce "\f2command\fP"''.
|
||||
If the null string (``""'') is used or no
|
||||
.B exec
|
||||
keyword is specified, conserver will use the command ``/bin/sh -i''.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
Only consoles of type ``exec'' will use this value.
|
||||
.TP
|
||||
.B execsubst
|
||||
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
|
||||
| "" ]
|
||||
.br
|
||||
Perform character substitutions on the
|
||||
.B exec
|
||||
value.
|
||||
See the
|
||||
.B devicesubst
|
||||
option for an explanation of the format string.
|
||||
If the null string (``""'') is used, no replacements will be done.
|
||||
.TP
|
||||
.B host
|
||||
.I hostname
|
||||
@ -420,7 +583,43 @@ as the host to connect to for accessing the console.
|
||||
You must also set the
|
||||
.B port
|
||||
option as well.
|
||||
Only consoles of type ``host'' will use this value.
|
||||
Normally, only consoles of type ``host'' will use this value, however
|
||||
if the
|
||||
.BR devicesubst ,
|
||||
.BR execsubst ,
|
||||
or
|
||||
.B initsubst
|
||||
keywords are used in any console type, this value is used.
|
||||
.TP
|
||||
.B idlestring
|
||||
.RI [ " string "
|
||||
| "" ]
|
||||
.br
|
||||
Assign the
|
||||
.I string
|
||||
that is sent to the console once the console is idle for an
|
||||
.I idletimeout
|
||||
amount of time.
|
||||
If the null string (``""'') is used, the string is unset and
|
||||
the default is used.
|
||||
The string is interpreted just as a
|
||||
.B break
|
||||
string is interpreted (see the
|
||||
.B break
|
||||
configuration items for details) where all delays specified (via ``\ed'')
|
||||
use the default delay time.
|
||||
The default string is ``\en''.
|
||||
.TP
|
||||
.B idletimeout
|
||||
\f2number\fP[\f3s\fP|\f3m\fP|\f3h\fP]
|
||||
.br
|
||||
Set the idle timeout of the console to
|
||||
.I number
|
||||
seconds.
|
||||
If an `s', `m', or `h' is used after
|
||||
.IR number ,
|
||||
the specified time is interpreted as seconds, minutes, or hours.
|
||||
Set the timeout to zero to disable the idle timeout (the default).
|
||||
.TP
|
||||
.B include
|
||||
.I default
|
||||
@ -445,18 +644,65 @@ is passed as an argument to ``/bin/sh -ce''.
|
||||
If the null string (``""'') is used, the command is unset and
|
||||
nothing is invoked.
|
||||
.TP
|
||||
.B initsubst
|
||||
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
|
||||
| "" ]
|
||||
.br
|
||||
Perform character substitutions on the
|
||||
.B initcmd
|
||||
value.
|
||||
See the
|
||||
.B devicesubst
|
||||
option for an explanation of the format string.
|
||||
If the null string (``""'') is used, no replacements will be done.
|
||||
.TP
|
||||
.B logfile
|
||||
.RI [ " filename "
|
||||
| "" ]
|
||||
.br
|
||||
Assign the logfile specified by
|
||||
.I filename
|
||||
to the console. Any occurance of ``&'' in
|
||||
to the console.
|
||||
Any occurrence of ``&'' in
|
||||
.I filename
|
||||
will be replaced with the name of the console.
|
||||
If the null string (``""'') is used, the logfile name is unset and
|
||||
no logging will occur.
|
||||
.TP
|
||||
.B logfilemax
|
||||
\f2number\fP[\f3k\fP|\f3m\fP]
|
||||
.br
|
||||
Enable automatic rotation of
|
||||
.B logfile
|
||||
once it's size exceeds
|
||||
.I number
|
||||
bytes.
|
||||
Specifying
|
||||
.B k
|
||||
or
|
||||
.B m
|
||||
interpret
|
||||
.I number
|
||||
as kilobytes and megabytes.
|
||||
.I number
|
||||
must be at least 2048 bytes.
|
||||
A value of zero will turn off automatic rotation of
|
||||
.BR logfile .
|
||||
The
|
||||
.B logfile
|
||||
.I filename
|
||||
will be renamed
|
||||
.IR filename -\s-1YYYYMMDD\s0-\s-1HHMMSS\s0,
|
||||
where the extension is the current GMT year, month, day, hour,
|
||||
minute, and second (to prevent issues with clock rollbacks).
|
||||
File sizes are checked every 5 minutes with an additional initial
|
||||
pseudo-random delay of up to one minute (to help prevent all processes
|
||||
checking all consoles simultaneously).
|
||||
2.5% (minimum 100 bytes, maximum 4000 bytes) of the old
|
||||
logfile is read from the end of the file.
|
||||
All data past the first newline is moved (not copied) to the new logfile
|
||||
so that a replay of the console works and starts on a line boundary.
|
||||
.TP
|
||||
.B master
|
||||
.RI [ " hostname " | " ipaddr " ]
|
||||
.br
|
||||
@ -554,7 +800,7 @@ The conserver option
|
||||
.B \-7
|
||||
will set this flag for all consoles.
|
||||
Default is
|
||||
.BR !stiphigh .
|
||||
.BR !striphigh .
|
||||
.TP
|
||||
.B reinitoncc
|
||||
Automatically reinitialize (``bring up'') a downed console when a client
|
||||
@ -594,7 +840,9 @@ Default is
|
||||
.RE
|
||||
.TP
|
||||
.B parity
|
||||
.RB [ " even " | " mark " | " none " | " odd " | " space " ]
|
||||
.RB [ " even " | " mark "
|
||||
.RB | " none " | " odd "
|
||||
.RB | " space " ]
|
||||
.br
|
||||
Set the parity option for the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
@ -606,17 +854,81 @@ Set the port used to access the console.
|
||||
The port may be specified as a
|
||||
.I number
|
||||
or a
|
||||
.IR name ,
|
||||
in which case it will use
|
||||
.IR name .
|
||||
A
|
||||
.I name
|
||||
will cause a
|
||||
.BR getservbyname (3)
|
||||
to look up a port number.
|
||||
call to look up the port number.
|
||||
The
|
||||
.BR port ,
|
||||
.BR portbase ,
|
||||
and
|
||||
.B portinc
|
||||
values are all used to calculate the final port number to connect to.
|
||||
The formula used is
|
||||
.IR finalport " = "
|
||||
.BR portbase " + "
|
||||
.BR portinc " * " port .
|
||||
By using proper values in the formula, you can reference ports on a
|
||||
terminal server by their physical numbering of
|
||||
.RI 0.. n
|
||||
or
|
||||
.RI 1.. n
|
||||
(depending on if you like zero-based or one-based numbering).
|
||||
Warning: you can generate a \-1 value with this formula,
|
||||
which will become a very high numbered positive
|
||||
value (since things are stored unsigned).
|
||||
You must also set the
|
||||
.B host
|
||||
option as well.
|
||||
Only consoles of type ``host'' will use this value.
|
||||
Normally, only consoles of type ``host'' will use this value, however
|
||||
if the
|
||||
.BR devicesubst ,
|
||||
.BR execsubst ,
|
||||
or
|
||||
.B initsubst
|
||||
keywords are used in any console type, this value is used.
|
||||
.TP
|
||||
.B portbase
|
||||
.I number
|
||||
.br
|
||||
Set the base value for the port calculation formula.
|
||||
.I number
|
||||
must be 0 or greater.
|
||||
The default is zero.
|
||||
See
|
||||
.B port
|
||||
for the details of the formula.
|
||||
.TP
|
||||
.B portinc
|
||||
.I number
|
||||
.br
|
||||
Set the increment value for the port calculation formula.
|
||||
.I number
|
||||
must be 0 or greater.
|
||||
The default is one.
|
||||
See
|
||||
.B port
|
||||
for the details of the formula.
|
||||
.TP
|
||||
.B protocol
|
||||
.RB [ " telnet " | " raw " ]
|
||||
.br
|
||||
Set the protocol used to send and receive data from the console.
|
||||
If
|
||||
.B raw
|
||||
is used, all data is sent ``as is'', unprotected by any protocol specification.
|
||||
If
|
||||
.B telnet
|
||||
is used (which is the default), data is encapsulated in the telnet protocol.
|
||||
The
|
||||
.B striphigh
|
||||
console option still applies when data is read by the server, and if enabled,
|
||||
can impact the encapsulation process.
|
||||
.TP
|
||||
.B ro
|
||||
.RI [ " username" ,...
|
||||
.RI "[ [\f3!\fP]" username ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the read-only access list
|
||||
@ -624,12 +936,25 @@ for the console.
|
||||
If
|
||||
.I username
|
||||
matches a previously defined group name, all members of the previous
|
||||
group are added to the read-only access list.
|
||||
group are applied to the read-only access list (with access reversed
|
||||
if prefixed with a `!').
|
||||
If
|
||||
.I username
|
||||
doesn't match a previously defined group and
|
||||
.I username
|
||||
begins with `@', the name (minus the `@') is checked against the
|
||||
host's group database.
|
||||
All users found in the group will be granted (or denied, if prefixed
|
||||
with `!') read-only access.
|
||||
If
|
||||
.I username
|
||||
doesn't match a previous group and doesn't begin with `@', the users
|
||||
will be granted (or denied, if prefixed with `!') read-only access.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for the console's read-only list are removed.
|
||||
.TP
|
||||
.B rw
|
||||
.RI [ " username" ,...
|
||||
.RI "[ [\f3!\fP]" username ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the read-write access list
|
||||
@ -637,13 +962,26 @@ for the console.
|
||||
If
|
||||
.I username
|
||||
matches a previously defined group name, all members of the previous
|
||||
group are added to the read-write access list.
|
||||
group are applied to the read-write access list (with access reversed
|
||||
if prefixed with a `!').
|
||||
If
|
||||
.I username
|
||||
doesn't match a previously defined group and
|
||||
.I username
|
||||
begins with `@', the name (minus the `@') is checked against the
|
||||
host's group database.
|
||||
All users found in the group will be granted (or denied, if prefixed
|
||||
with `!') read-write access.
|
||||
If
|
||||
.I username
|
||||
doesn't match a previous group and doesn't begin with `@', the users
|
||||
will be granted (or denied, if prefixed with `!') read-write access.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for the console's read-write list are removed.
|
||||
.TP
|
||||
.B timestamp
|
||||
[
|
||||
.RB [ \fInumber\fP [ m | h | d | l ]][ a ][ b ]
|
||||
[\f2number\fP[\f3m\fP|\f3h\fP|\f3d\fP|\f3l\fP]][\f3a\fP][\f3b\fP]
|
||||
| "" ]
|
||||
.br
|
||||
Specifies the time between timestamps applied to the console
|
||||
@ -674,9 +1012,11 @@ A
|
||||
can be specified to add logging of break sequences sent to the console.
|
||||
.TP
|
||||
.B type
|
||||
.RB [ " device " | " exec " | " host " ]
|
||||
.RB [ " device " | " exec "
|
||||
.RB | " host " ]
|
||||
.br
|
||||
Set the type of console. The type
|
||||
Set the type of console.
|
||||
The type
|
||||
.RB `` device ''
|
||||
should be used for local serial ports (also set the
|
||||
.B device
|
||||
@ -702,7 +1042,7 @@ Define a user group identified as
|
||||
.RS
|
||||
.TP 15
|
||||
.B users
|
||||
.RI [ " username" ,...
|
||||
.RI "[ [\f3!\fP]" username ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the group
|
||||
@ -710,7 +1050,20 @@ Define a list of users making up the group
|
||||
If
|
||||
.I username
|
||||
matches a previously defined group name, all members of the previous
|
||||
group are added to the current group.
|
||||
group are applied to the current group (with access reversed
|
||||
if prefixed with a `!').
|
||||
If
|
||||
.I username
|
||||
doesn't match a previously defined group and
|
||||
.I username
|
||||
begins with `@', the name (minus the `@') is checked against the
|
||||
host's group database.
|
||||
All users found in the group will be recorded with (or without, if prefixed
|
||||
with `!') access.
|
||||
If
|
||||
.I username
|
||||
doesn't match a previous group and doesn't begin with `@', the users
|
||||
will be recorded with (or without, if prefixed with `!') access.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for this group are removed.
|
||||
.RE
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $Id: conserver.passwd.man,v 1.9 2003-07-04 13:20:52-07 bryan Exp $
|
||||
.TH CONSERVER.PASSWD 5 "2003-07-04" "conserver-8.0.5" "conserver"
|
||||
.\" $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"
|
||||
.SH NAME
|
||||
conserver.passwd \- user access information for
|
||||
.BR conserver (8)
|
||||
@ -59,7 +59,8 @@ in the system
|
||||
If PAM support has been enabled
|
||||
.RB ( --with-pam ),
|
||||
PAM lookups will be done instead of
|
||||
.BR passwd " (or " shadow ") lookups."
|
||||
.BR passwd " (or " shadow ") lookups"
|
||||
(you may need to edit /etc/pam.conf or create /etc/pam.d/conserver).
|
||||
If this field is empty, password checking is bypassed for this user.
|
||||
.SH EXAMPLE
|
||||
.TP 24
|
||||
|
@ -1,5 +1,5 @@
|
||||
%!PS-Adobe-2.0 EPSF-1.2
|
||||
%%$Id: label.ps,v 1.8 94/01/21 09:37:42 ksb Exp $
|
||||
%%$Id: label.ps,v 1.1 2003/11/04 02:36:26 bryan Exp $
|
||||
%%Title: RJ-11
|
||||
%%Creator: A Braunsdorf
|
||||
%%CreationDate:
|
||||
|
21
conserver.cf/samples/README
Normal file
21
conserver.cf/samples/README
Normal file
@ -0,0 +1,21 @@
|
||||
I put together the sample configuration files in this directory in hopes
|
||||
that it would help folks see some of the possibilities of the
|
||||
configuration file format. Each of the files are syntatically correct,
|
||||
but have never actually been used.
|
||||
|
||||
Each file is basically built upon the previous...theoretically, if not
|
||||
actually. Hopefully they'll help show some of the cool things you can
|
||||
do with the configuration file and help those trying to figure out how
|
||||
they should even start.
|
||||
|
||||
simple.cf - A very simple, one console config file
|
||||
|
||||
basic.cf - A config with a couple consoles, mostly using defaults
|
||||
|
||||
average.cf - A config for many consoles, using breaks, user lists,
|
||||
etc...bascially customizing each area
|
||||
|
||||
average-distributed.cf - Taking average.cf to multiple conserver
|
||||
hosts with overrides on those hosts
|
||||
|
||||
Bryan Stansell
|
109
conserver.cf/samples/average-distributed.cf
Normal file
109
conserver.cf/samples/average-distributed.cf
Normal file
@ -0,0 +1,109 @@
|
||||
#
|
||||
# I took the average.cf file and expanded it to use a distributed
|
||||
# conserver setup...two conserver hosts (conserver1 and conserver2), but
|
||||
# the basic philosophy would hold for many more console and/or conserver
|
||||
# hosts.
|
||||
#
|
||||
|
||||
# ------ define a user group ------
|
||||
group sysadmin {
|
||||
users bryan, todd, dave;
|
||||
}
|
||||
# helpers is everyone but the sysadmin group
|
||||
group helpers {
|
||||
users *, !sysadmin;
|
||||
}
|
||||
|
||||
|
||||
# ------ make sure breaks are the way we want --------
|
||||
break 1 { string "\z"; }
|
||||
break 2 { string "\r\d~\d^b"; delay 600; }
|
||||
break 3 { string "#."; }
|
||||
|
||||
|
||||
# ----- define some console types ------
|
||||
# yeah, just setting a break doesn't quite seem worth it, but perhaps,
|
||||
# some day, there will be more host-specific stuff.
|
||||
default sun-std { break 1; }
|
||||
default sun-alt { break 2; }
|
||||
default sun-lom { break 3; }
|
||||
|
||||
|
||||
# ------ defaults ------
|
||||
# we set a 'global' default so we can reuse the bits below. we're going
|
||||
# to set the '*' default, then define consoles, reset the '*' default,
|
||||
# define more consoles, etc.
|
||||
default global {
|
||||
logfile /var/consoles/&; # '&' is replaced with console name
|
||||
timestamp 1hab; # write timestamps
|
||||
rw sysadmin; # allow sysadmins full access
|
||||
ro helpers; # allow helpers to watch
|
||||
include sun-std;
|
||||
}
|
||||
|
||||
|
||||
# --------- define our terminal attributes ----------
|
||||
# simple tcp connections are "easy"
|
||||
default cisco { type host; portbase 2000; portinc 1; }
|
||||
default xyplex { type host; portbase 2000; portinc 100; }
|
||||
|
||||
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
|
||||
# (referenced as ports 1 through 32 in conserver.cf)
|
||||
# we set the various port calculation bits and pattern substitution to
|
||||
# come up with a generic definition
|
||||
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
|
||||
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
|
||||
|
||||
## this is a term server accessed with an ssh command
|
||||
# it too uses pattern substitution and such to get the job done
|
||||
default ciscossh { type exec; portbase 2000; portinc 1;
|
||||
exec /usr/local/bin/ssh -p P -l tsuser H;
|
||||
execsubst H=hs,P=Pd; }
|
||||
|
||||
|
||||
# ------- set the global default for the first conserver host -------
|
||||
# the consoles below (until the default is reset) are managed
|
||||
# by conserver1.conserver.com
|
||||
default * { include global; master conserver1.conserver.com; }
|
||||
|
||||
# ------- define the consoles on ts1.conserver.com --------
|
||||
default ts1.conserver.com { include cisco; host ts1.conserver.com; }
|
||||
console web1.conserver.com { include ts1.conserver.com; port 2; }
|
||||
console ns1.conserver.com { include ts1.conserver.com; port 10; }
|
||||
|
||||
# ------- define the consoles on ts2.conserver.com --------
|
||||
default ts2.conserver.com { include xyplex; host ts2.conserver.com; }
|
||||
console web2.conserver.com { include ts2.conserver.com; port 4; }
|
||||
console ns2.conserver.com { include ts2.conserver.com; port 22; }
|
||||
|
||||
# ------- set the global default for the second conserver host -------
|
||||
# the following consoles are managed by conserver2.conserver.com
|
||||
default * { include global; master conserver2.conserver.com; }
|
||||
|
||||
# ------- define the consoles on ts3.conserver.com --------
|
||||
default ts3.conserver.com { include ciscossh; host ts3.conserver.com; }
|
||||
console ftp1.conserver.com { include ts3.conserver.com; include sun-lom;
|
||||
port 7; }
|
||||
|
||||
# ------- set up the an access list to avoid the default -------
|
||||
# anything *not* matched here will fallback to the default access mode
|
||||
access * {
|
||||
trusted 127.0.0.1;
|
||||
allowed 10.0.0.0/8;
|
||||
}
|
||||
|
||||
# conserver2 has an extra leg that is trusted
|
||||
access conserver2.conserver.com { trusted 192.168.0.0/16; }
|
||||
|
||||
# ------- do some server configuration ---------
|
||||
# both conserver1.conserver.com and conserver2.conserver.com use the same
|
||||
# set of defaults
|
||||
config * {
|
||||
defaultaccess rejected;
|
||||
daemonmode on;
|
||||
logfile /var/log/conserver;
|
||||
}
|
||||
|
||||
# we're going to set the default access on conserver2 to allowed, because
|
||||
# it's in a higher-trust network
|
||||
config conserver2.conserver.com { defaultaccess allowed; }
|
91
conserver.cf/samples/average.cf
Normal file
91
conserver.cf/samples/average.cf
Normal file
@ -0,0 +1,91 @@
|
||||
#
|
||||
# This would be what i'd expect a more common configuration file would
|
||||
# look like. There are consoles attached to multiple devices, simple
|
||||
# access lists, etc.
|
||||
#
|
||||
|
||||
# ------ define a user group ------
|
||||
group sysadmin {
|
||||
users bryan, todd, dave;
|
||||
}
|
||||
# helpers is everyone but the sysadmin group
|
||||
group helpers {
|
||||
users *, !sysadmin;
|
||||
}
|
||||
|
||||
|
||||
# ------ make sure breaks are the way we want --------
|
||||
break 1 { string "\z"; }
|
||||
break 2 { string "\r\d~\d^b"; delay 600; }
|
||||
break 3 { string "#."; }
|
||||
|
||||
|
||||
# ----- define some console types ------
|
||||
# yeah, just setting a break doesn't quite seem worth it, but perhaps,
|
||||
# some day, there will be more host-specific stuff.
|
||||
default sun-std { break 1; }
|
||||
default sun-alt { break 2; }
|
||||
default sun-lom { break 3; }
|
||||
|
||||
|
||||
# ------ defaults ------
|
||||
# now for some generic console defaults so that we don't have to
|
||||
# duplicate them for each console.
|
||||
default * {
|
||||
logfile /var/consoles/&; # '&' is replaced with console name
|
||||
timestamp 1hab; # write timestamps
|
||||
rw sysadmin; # allow sysadmins full access
|
||||
ro helpers; # allow helpers to watch
|
||||
master localhost;
|
||||
include sun-std;
|
||||
}
|
||||
|
||||
|
||||
# --------- define our terminal attributes ----------
|
||||
# simple tcp connections are "easy"
|
||||
default cisco { type host; portbase 2000; portinc 1; }
|
||||
default xyplex { type host; portbase 2000; portinc 100; }
|
||||
|
||||
# this is a cyclades card referenced with /dev/ttyC0 through /dev/ttyC31
|
||||
# (referenced as ports 1 through 32 in conserver.cf)
|
||||
# we set the various port calculation bits and pattern substitution to
|
||||
# come up with a generic definition
|
||||
default cyclades { type device; device /dev/ttyC&; baud 9600; parity none;
|
||||
devicesubst &=Pd; portbase -1; portinc 1; host unused; }
|
||||
|
||||
## this is a term server accessed with an ssh command
|
||||
# it too uses pattern substitution and such to get the job done
|
||||
default ciscossh { type exec; portbase 2000; portinc 1;
|
||||
exec /usr/local/bin/ssh -p P -l tsuser H;
|
||||
execsubst H=hs,P=Pd; }
|
||||
|
||||
|
||||
# ------- define the consoles on ts1.conserver.com --------
|
||||
default ts1.conserver.com { include cisco; host ts1.conserver.com; }
|
||||
console web1.conserver.com { include ts1.conserver.com; port 2; }
|
||||
console ns1.conserver.com { include ts1.conserver.com; port 10; }
|
||||
|
||||
# ------- define the consoles on ts2.conserver.com --------
|
||||
default ts2.conserver.com { include xyplex; host ts2.conserver.com; }
|
||||
console web2.conserver.com { include ts2.conserver.com; port 4; }
|
||||
console ns2.conserver.com { include ts2.conserver.com; port 22; }
|
||||
|
||||
# ------- define the consoles on ts3.conserver.com --------
|
||||
default ts3.conserver.com { include ciscossh; host ts3.conserver.com; }
|
||||
console ftp1.conserver.com { include ts3.conserver.com; include sun-lom;
|
||||
port 7; }
|
||||
|
||||
|
||||
# ------- set up the an access list to avoid the default -------
|
||||
# anything *not* matched here will fallback to the default access mode
|
||||
access * {
|
||||
trusted 127.0.0.1;
|
||||
allowed 10.0.0.0/8;
|
||||
}
|
||||
|
||||
# ------- do some server configuration ---------
|
||||
config * {
|
||||
defaultaccess rejected;
|
||||
daemonmode on;
|
||||
logfile /var/log/conserver;
|
||||
}
|
28
conserver.cf/samples/basic.cf
Normal file
28
conserver.cf/samples/basic.cf
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# This is a fairly basic configuration file that interacts with one
|
||||
# terminal server.
|
||||
#
|
||||
|
||||
# first, we're going to set some generic console defaults so that we
|
||||
# don't have to duplicate them for each console.
|
||||
default * {
|
||||
logfile /var/consoles/&; # '&' is replaced with console name
|
||||
timestamp 1hab; # write timestamps
|
||||
rw *; # allow all users
|
||||
master localhost;
|
||||
type host;
|
||||
host ts1.conserver.com; # consoles on ts1.conserver.co
|
||||
portbase 2000; # port numbers start at 2001 and
|
||||
portinc 1; # go up by 1 (port #1 == 2001, etc)
|
||||
}
|
||||
|
||||
# define two consoles on the terminal server
|
||||
console web1.conserver.com { port 2; } # calculates to tcp port 2002
|
||||
console ns1.conserver.com { port 10; } # calculates to tcp port 2010
|
||||
|
||||
# set up the an access list to avoid the default
|
||||
# anything *not* matched here will fallback to the default access (-a)
|
||||
# mode
|
||||
access * {
|
||||
trusted 127.0.0.1;
|
||||
}
|
11
conserver.cf/samples/simple.cf
Normal file
11
conserver.cf/samples/simple.cf
Normal file
@ -0,0 +1,11 @@
|
||||
#
|
||||
# I believe this is the smallest configuration file that is also fully
|
||||
# functional. You have to be happy with the default access type (-a)
|
||||
# as well as the default access list that gets used.
|
||||
#
|
||||
|
||||
console simple {
|
||||
master localhost;
|
||||
type exec;
|
||||
rw *;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
# dummy conserver config file
|
||||
#
|
||||
# $Id: test.cf,v 1.2 2003-07-04 11:04:05-07 bryan Exp $
|
||||
# $Id: test.cf,v 1.2 2003/07/04 18:04:05 bryan Exp $
|
||||
#
|
||||
default full {
|
||||
rw *;
|
||||
|
@ -9,6 +9,7 @@
|
||||
<META name="author" content=
|
||||
"Bryan Stansell <bryan@conserver.com>">
|
||||
<LINK rel="SHORTCUT ICON" href="conserver.ico">
|
||||
<LINK rel="icon" href="conserver.ico">
|
||||
|
||||
<TITLE>Conserver</TITLE>
|
||||
|
||||
@ -55,11 +56,11 @@
|
||||
<INPUT type="HIDDEN" name="method" value="and"> <INPUT
|
||||
type="HIDDEN" name="format" value="builtin-long">
|
||||
<INPUT type="HIDDEN" name="sort" value="score"> <INPUT
|
||||
type="HIDDEN" name="config" value="htdig"> <INPUT type=
|
||||
"HIDDEN" name="restrict" value=""> <INPUT type="HIDDEN"
|
||||
name="exclude" value=""> <INPUT type="TEXT" size="20"
|
||||
name="words" value=""> <INPUT type="SUBMIT" value=
|
||||
"Search">
|
||||
type="HIDDEN" name="config" value="conserver.com">
|
||||
<INPUT type="HIDDEN" name="restrict" value=""> <INPUT
|
||||
type="HIDDEN" name="exclude" value=""> <INPUT type=
|
||||
"TEXT" size="20" name="words" value=""> <INPUT type=
|
||||
"SUBMIT" value="Search">
|
||||
</FORM>
|
||||
</TD>
|
||||
</TR>
|
||||
@ -159,35 +160,32 @@
|
||||
the website. Next, there's Kevin Braunsdorf's version at
|
||||
<A href=
|
||||
"ftp://ftp.physics.purdue.edu/pub/pundits/">ftp://ftp.physics.purdue.edu/pub/pundits/</A>.
|
||||
Kevin is semi-actively working on his thread. Doesn't
|
||||
look like any new versions have been out since August
|
||||
It doesn't look like Kevin is working on his thread ony
|
||||
more either. No new versions have been out since August
|
||||
2000 (version 8.5), but maybe this info will be out of
|
||||
date by the time you read this. Lastly, the conserver.com
|
||||
version is based on Kevin's "5.21-Beta" distribution, but
|
||||
since <B>HEAVILY</B> modified and enhanced (more details
|
||||
in the "Origin" section above).</P>
|
||||
date by the time you read this (I last checked Feb 10,
|
||||
2004). Lastly, the conserver.com version is based on
|
||||
Kevin's "5.21-Beta" distribution, but since
|
||||
<B>HEAVILY</B> modified and enhanced (more details in the
|
||||
"Origin" section above).</P>
|
||||
|
||||
<P>If I were looking for a conserver package I would
|
||||
either use Kevin's latest distribution or the
|
||||
conserver.com distribution. Which one? Well, obviously
|
||||
I'm biased and believe the conserver.com distribution
|
||||
should be your choice, but Kevin's does have UPS (serial
|
||||
port line toggling bits) that the conserver.com version
|
||||
doesn't have. What does the conserver.com distribution
|
||||
have? Well, in reality, too many things to list. You'll
|
||||
have to look at the <A href="CHANGES">CHANGES</A> file
|
||||
and see the enhancements, bug fixes, and general
|
||||
development since the original. Don't let the version
|
||||
numbers fool you - you'll have to compare and contrast
|
||||
for yourself.</P>
|
||||
definitely use the conserver.com distribution. Why? It's
|
||||
actively maintained, has many more features than the
|
||||
other versions (see <A href="CHANGES">CHANGES</A> for a
|
||||
semi-scary history), and has an active user community.
|
||||
Kevin's version does have UPS support (basic serial port
|
||||
line toggling bits) which is missing in the conserver.com
|
||||
version, but no one has asked me for it, so does anyone
|
||||
actually need it?</P>
|
||||
|
||||
<H3>Downloading</H3>
|
||||
|
||||
<P>The current version, released on Oct 31,2003, is <A
|
||||
href="8.0.5.tar.gz">8.0.5.tar.gz</A>. You can get it via
|
||||
<P>The current version, released on May 25, 2004, is <A
|
||||
href="8.1.6.tar.gz">8.1.6.tar.gz</A>. You can get it via
|
||||
<A href=
|
||||
"ftp://ftp.conserver.com/conserver/8.0.5.tar.gz">FTP</A>
|
||||
or <A href="8.0.5.tar.gz">HTTP</A>. See the <A href=
|
||||
"ftp://ftp.conserver.com/conserver/8.1.6.tar.gz">FTP</A>
|
||||
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>
|
||||
|
||||
@ -208,6 +206,11 @@
|
||||
<P>Check the <A href="INSTALL">INSTALL</A> file for
|
||||
instructions.</P>
|
||||
|
||||
<H3>Online Documentation</H3>
|
||||
|
||||
<P>I've put a small set of documentation <A href=
|
||||
"docs/">here</A>. I'm hoping to expand it over time.</P>
|
||||
|
||||
<H3>Systems Tested</H3>
|
||||
|
||||
<P>Here's a list of systems that I've been told can
|
||||
|
@ -6,7 +6,8 @@ exec_prefix = @exec_prefix@
|
||||
sbindir = @sbindir@
|
||||
sysconfdir = @sysconfdir@
|
||||
mandir = @mandir@
|
||||
exampledir = $(prefix)/share/examples/conserver
|
||||
datadir = @datadir@
|
||||
exampledir = $(datadir)/examples/conserver
|
||||
|
||||
### Installation programs and flags
|
||||
INSTALL = @INSTALL@
|
||||
@ -27,21 +28,24 @@ LIBS = @LIBS@ @CONSLIBS@
|
||||
### Makefile rules - no user-servicable parts below
|
||||
|
||||
CONSERVER_OBJS = access.o client.o consent.o group.o main.o master.o \
|
||||
readcfg.o fallback.o util.o
|
||||
readcfg.o fallback.o cutil.o
|
||||
CONSERVER_HDRS = ../config.h $(top_srcdir)/compat.h $(srcdir)/access.h \
|
||||
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/group.h \
|
||||
$(srcdir)/main.h $(srcdir)/master.h $(srcdir)/readcfg.h \
|
||||
$(srcdir)/util.h
|
||||
$(srcdir)/client.h $(srcdir)/consent.h $(srcdir)/cutil.h \
|
||||
$(srcdir)/group.h $(srcdir)/main.h $(srcdir)/master.h \
|
||||
$(srcdir)/readcfg.h $(srcdir)/version.h
|
||||
|
||||
ALL = conserver convert
|
||||
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
$(CONSERVER_OBJS): $(CONSERVER_HDRS)
|
||||
|
||||
conserver: $(CONSERVER_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
|
||||
|
||||
convert: convert.o util.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o util.o $(LIBS)
|
||||
convert: convert.o cutil.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o cutil.o $(LIBS)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Sun-serial,v 2.1 93/02/09 11:45:12 ldv Exp $
|
||||
# $Id: Sun-serial,v 1.1 2003/11/04 02:36:25 bryan Exp $
|
||||
|
||||
If you are going to be hooking Sun consoles to your console server, you
|
||||
will run into a problem: The sun will halt whenever the cable is unplugged.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: access.c,v 5.68 2003-10-19 22:52:21-07 bryan Exp $
|
||||
* $Id: access.c,v 5.73 2004/05/23 16:44:25 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <access.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
@ -137,28 +137,55 @@ AccType(addr, peername)
|
||||
socklen_t so;
|
||||
struct hostent *he = (struct hostent *)0;
|
||||
int a;
|
||||
char ret;
|
||||
#if TRUST_REVERSE_DNS
|
||||
char *pcName;
|
||||
int wlen;
|
||||
char *hname;
|
||||
int len;
|
||||
char **revNames = (char **)0;
|
||||
#endif
|
||||
|
||||
CONDDEBUG((1, "AccType(): ip=%s", inet_ntoa(*addr)));
|
||||
|
||||
ret = config->defaultaccess;
|
||||
so = sizeof(*addr);
|
||||
|
||||
#if TRUST_REVERSE_DNS
|
||||
/* if we trust reverse dns, we get the names associated with
|
||||
* the address we're checking and then check each of those
|
||||
* against the access list entries (below).
|
||||
*/
|
||||
if ((he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) == (struct hostent *)0) {
|
||||
Error("AccType(): gethostbyaddr(%s): %s", inet_ntoa(*addr),
|
||||
hstrerror(h_errno));
|
||||
} else {
|
||||
char *hname;
|
||||
if (he->h_name != (char *)0) {
|
||||
/* count up the number of names */
|
||||
for (a = 0, hname = he->h_aliases[a]; hname != (char *)0;
|
||||
hname = he->h_aliases[++a]);
|
||||
a += 2; /* h_name + (char *)0 */
|
||||
/* now duplicate them */
|
||||
if ((revNames =
|
||||
(char **)calloc(a, sizeof(char *))) != (char **)0) {
|
||||
for (hname = he->h_name, a = 0; hname != (char *)0;
|
||||
hname = he->h_aliases[a++]) {
|
||||
if ((revNames[a] = StrDup(hname)) == (char *)0)
|
||||
break;
|
||||
CONDDEBUG((1, "AccType(): revNames[%d]='%s'", a,
|
||||
hname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
|
||||
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
|
||||
pACtmp->ctrust));
|
||||
if (pACtmp->isCIDR != 0) {
|
||||
if (AddrCmp(addr, pACtmp->pcwho) == 0) {
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
}
|
||||
return pACtmp->ctrust;
|
||||
ret = pACtmp->ctrust;
|
||||
goto common_ret;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -166,82 +193,83 @@ AccType(addr, peername)
|
||||
if ((he = gethostbyname(pACtmp->pcwho)) == (struct hostent *)0) {
|
||||
Error("AccType(): gethostbyname(%s): %s", pACtmp->pcwho,
|
||||
hstrerror(h_errno));
|
||||
continue;
|
||||
}
|
||||
if (4 != he->h_length || AF_INET != he->h_addrtype) {
|
||||
} else if (4 != he->h_length || AF_INET != he->h_addrtype) {
|
||||
Error
|
||||
("AccType(): gethostbyname(%s): wrong address size (4 != %d) or address family (%d != %d)",
|
||||
pACtmp->pcwho, he->h_length, AF_INET, he->h_addrtype);
|
||||
continue;
|
||||
}
|
||||
for (a = 0; he->h_addr_list[a] != (char *)0; a++) {
|
||||
CONDDEBUG((1, "AccType(): addr=%s",
|
||||
inet_ntoa(*(struct in_addr *)
|
||||
(he->h_addr_list[a]))));
|
||||
if (
|
||||
} else {
|
||||
for (a = 0; he->h_addr_list[a] != (char *)0; a++) {
|
||||
CONDDEBUG((1, "AccType(): addr=%s",
|
||||
inet_ntoa(*(struct in_addr *)
|
||||
(he->h_addr_list[a]))));
|
||||
if (
|
||||
#if HAVE_MEMCMP
|
||||
memcmp(&(addr->s_addr), he->h_addr_list[a],
|
||||
he->h_length)
|
||||
memcmp(&(addr->s_addr), he->h_addr_list[a],
|
||||
he->h_length)
|
||||
#else
|
||||
bcmp(&(addr->s_addr), he->h_addr_list[a], he->h_length)
|
||||
bcmp(&(addr->s_addr), he->h_addr_list[a],
|
||||
he->h_length)
|
||||
#endif
|
||||
== 0) {
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
== 0) {
|
||||
ret = pACtmp->ctrust;
|
||||
goto common_ret;
|
||||
}
|
||||
return pACtmp->ctrust;
|
||||
}
|
||||
}
|
||||
#if TRUST_REVERSE_DNS
|
||||
/* we chop bits off client names so that we can put domain
|
||||
* names in access lists or even top-level domains.
|
||||
* allowed conserver.com, net;
|
||||
* this allows anything from conserver.com and anything in
|
||||
* the .net top-level. without TRUST_REVERSE_DNS, those names
|
||||
* better map to ip addresses for them to take effect.
|
||||
*/
|
||||
if (revNames != (char **)0) {
|
||||
char *pcName;
|
||||
int wlen;
|
||||
int len;
|
||||
wlen = strlen(pACtmp->pcwho);
|
||||
for (a = 0; revNames[a] != (char *)0; a++) {
|
||||
for (pcName = revNames[a], len = strlen(pcName);
|
||||
len >= wlen; len = strlen(++pcName)) {
|
||||
CONDDEBUG((1, "AccType(): name=%s", pcName));
|
||||
if (strcasecmp(pcName, pACtmp->pcwho) == 0) {
|
||||
if (peername != (char **)0)
|
||||
*peername = StrDup(revNames[a]);
|
||||
ret = pACtmp->ctrust;
|
||||
goto common_ret2;
|
||||
}
|
||||
pcName = strchr(pcName, '.');
|
||||
if (pcName == (char *)0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
common_ret:
|
||||
if (config->loghostnames == FLAGTRUE && peername != (char **)0) {
|
||||
#if TRUST_REVERSE_DNS
|
||||
/* if we trust reverse dns, we get the names associated with
|
||||
* the address we're checking and then check each of those
|
||||
* against the access list entries.
|
||||
* we chop bits off client names so that we can put domain
|
||||
* names in access lists or even top-level domains.
|
||||
* allowed conserver.com, net;
|
||||
* this allows anything from conserver.com and anything in
|
||||
* the .net top-level. without TRUST_REVERSE_DNS, those names
|
||||
* better map to ip addresses for them to take effect.
|
||||
*/
|
||||
if ((he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) == (struct hostent *)0) {
|
||||
Error("AccType(): gethostbyaddr(%s): %s", inet_ntoa(*addr),
|
||||
hstrerror(h_errno));
|
||||
return config->defaultaccess;
|
||||
}
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
|
||||
if (pACtmp->isCIDR != 0)
|
||||
continue;
|
||||
wlen = strlen(pACtmp->pcwho);
|
||||
for (hname = he->h_name, a = 0; hname != (char *)0;
|
||||
hname = he->h_aliases[a++]) {
|
||||
for (pcName = hname, len = strlen(pcName); len >= wlen;
|
||||
len = strlen(++pcName)) {
|
||||
CONDDEBUG((1, "AccType(): name=%s", pcName));
|
||||
if (strcasecmp(pcName, pACtmp->pcwho) == 0) {
|
||||
*peername = hname;
|
||||
return pACtmp->ctrust;
|
||||
}
|
||||
pcName = strchr(pcName, '.');
|
||||
if (pcName == (char *)0)
|
||||
break;
|
||||
}
|
||||
if (revNames != (char **)0 && revNames[0] != (char *)0)
|
||||
*peername = StrDup(revNames[0]);
|
||||
#else
|
||||
if ((he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = StrDup(he->h_name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if TRUST_REVERSE_DNS
|
||||
common_ret2:
|
||||
if (revNames != (char **)0) {
|
||||
for (a = 0; revNames[a] != (char *)0; a++)
|
||||
free(revNames[a]);
|
||||
free(revNames);
|
||||
}
|
||||
#endif
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
}
|
||||
return config->defaultaccess;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
@ -253,11 +281,26 @@ SetDefAccess(pAddr, pHost)
|
||||
char *pHost;
|
||||
#endif
|
||||
{
|
||||
char *pcDomain;
|
||||
char *addr;
|
||||
ACCESS *a;
|
||||
|
||||
while (pACList != (ACCESS *)0) {
|
||||
a = pACList->pACnext;
|
||||
DestroyAccessList(pACList);
|
||||
pACList = a;
|
||||
}
|
||||
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
if ((pACList = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((pACList->pcwho = StrDup("127.0.0.1")) == (char *)0)
|
||||
OutOfMem();
|
||||
pACList->ctrust = 'a';
|
||||
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
|
||||
pACList->pcwho));
|
||||
#else
|
||||
while (pAddr->s_addr != (in_addr_t) 0) {
|
||||
char *addr;
|
||||
|
||||
addr = inet_ntoa(*pAddr);
|
||||
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
@ -271,21 +314,7 @@ SetDefAccess(pAddr, pHost)
|
||||
pACList->pcwho));
|
||||
pAddr++;
|
||||
}
|
||||
|
||||
if ((char *)0 == (pcDomain = strchr(pHost, '.')))
|
||||
return;
|
||||
++pcDomain;
|
||||
|
||||
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((a->pcwho = StrDup(pcDomain)) == (char *)0)
|
||||
OutOfMem();
|
||||
a->ctrust = 'a';
|
||||
a->pACnext = pACList;
|
||||
pACList = a;
|
||||
|
||||
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
|
||||
pACList->pcwho));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: access.h,v 5.26 2003-08-10 11:11:20-07 bryan Exp $
|
||||
* $Id: access.h,v 5.26 2003/08/10 18:11:20 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: client.c,v 5.72 2003-10-02 18:49:13-07 bryan Exp $
|
||||
* $Id: client.c,v 5.83 2004/04/13 18:12:00 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <access.h>
|
||||
#include <client.h>
|
||||
@ -97,15 +97,15 @@ FindWrite(pCE)
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
Replay(CONSFILE *fdLog, CONSFILE *fdOut, int iBack)
|
||||
Replay(CONSENT *pCE, CONSFILE *fdOut, int iBack)
|
||||
#else
|
||||
Replay(fdLog, fdOut, iBack)
|
||||
CONSFILE *fdLog;
|
||||
Replay(pCE, fdOut, iBack)
|
||||
CONSENT *pCE;
|
||||
CONSFILE *fdOut;
|
||||
int iBack;
|
||||
#endif
|
||||
{
|
||||
|
||||
CONSFILE *fdLog = (CONSFILE *)0;
|
||||
off_t file_pos;
|
||||
off_t buf_pos;
|
||||
char *buf;
|
||||
@ -130,7 +130,16 @@ Replay(fdLog, fdOut, iBack)
|
||||
unsigned long dmallocMarkReplay = 0;
|
||||
#endif
|
||||
|
||||
if ((CONSFILE *)0 == fdLog) {
|
||||
if (pCE != (CONSENT *)0) {
|
||||
fdLog = pCE->fdlog;
|
||||
|
||||
/* 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) {
|
||||
FileWrite(fdOut, FLAGFALSE, "[no log file on this console]\r\n",
|
||||
-1);
|
||||
return;
|
||||
@ -179,17 +188,9 @@ Replay(fdLog, fdOut, iBack)
|
||||
* the rest (as we work our way back in the file) should be
|
||||
*/
|
||||
buf_pos = (file_pos / BUFSIZ) * BUFSIZ;
|
||||
#if defined(SEEK_SET)
|
||||
/* PTX and maybe other Posix systems
|
||||
*/
|
||||
if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#else
|
||||
if (FileSeek(fdLog, buf_pos, L_SET) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#endif
|
||||
if ((r = FileRead(fdLog, buf, BUFSIZ)) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
@ -246,8 +247,9 @@ Replay(fdLog, fdOut, iBack)
|
||||
InitString(lines[ln].line);
|
||||
} else {
|
||||
BuildString((char *)0, lines[ln - 1].line);
|
||||
BuildString(lines[ln].line->string,
|
||||
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--;
|
||||
@ -314,7 +316,7 @@ Replay(fdLog, fdOut, iBack)
|
||||
*s = '\000';
|
||||
}
|
||||
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, FLAGTRUE, " .. ", -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"
|
||||
@ -331,11 +333,16 @@ Replay(fdLog, fdOut, iBack)
|
||||
u = lines[i].mark_end->used;
|
||||
s = lines[i].mark_end->string;
|
||||
} else
|
||||
FileWrite(fdOut, FLAGFALSE, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, FLAGFALSE, lines[i].line->string,
|
||||
lines[i].line->used - 1);
|
||||
}
|
||||
|
||||
common_exit:
|
||||
|
||||
/* if we opened the logfile, close it */
|
||||
if (fdLog != pCE->fdlog)
|
||||
FileClose(&fdLog);
|
||||
|
||||
if ((struct lines *)0 != lines) {
|
||||
for (i = 0; i < n_lines; i++) {
|
||||
DestroyString(lines[i].mark_end);
|
||||
@ -359,8 +366,7 @@ Replay(fdLog, fdOut, iBack)
|
||||
*/
|
||||
#define WHEN_SPY 0x01
|
||||
#define WHEN_ATTACH 0x02
|
||||
#define WHEN_VT100 0x04
|
||||
#define WHEN_EXPERT 0x08 /* ZZZ no way to set his yet */
|
||||
#define WHEN_EXPERT 0x04 /* ZZZ no way to set his yet */
|
||||
#define WHEN_ALWAYS 0x40
|
||||
|
||||
#define HALFLINE 40
|
||||
@ -372,6 +378,7 @@ typedef struct HLnode {
|
||||
|
||||
static HELP aHLTable[] = {
|
||||
{WHEN_ALWAYS, ". disconnect"},
|
||||
{WHEN_ALWAYS, "; move to another console"},
|
||||
{WHEN_ALWAYS, "a attach read/write"},
|
||||
{WHEN_ALWAYS, "b send broadcast message"},
|
||||
{WHEN_ATTACH, "c toggle flow control"},
|
||||
@ -394,17 +401,13 @@ static HELP aHLTable[] = {
|
||||
{WHEN_ALWAYS, "w who is on this console"},
|
||||
{WHEN_ALWAYS, "x show console baud info"},
|
||||
{WHEN_ALWAYS, "z suspend the connection"},
|
||||
{WHEN_ALWAYS, "<cr> ignore/abort command"},
|
||||
{WHEN_ATTACH, "| attach local command"},
|
||||
{WHEN_ALWAYS, "? print this message"},
|
||||
{WHEN_ALWAYS, "<cr> ignore/abort command"},
|
||||
{WHEN_ALWAYS, "^R replay the last line"},
|
||||
{WHEN_ATTACH, "\\ooo send character by octal code"},
|
||||
{WHEN_EXPERT, "^I toggle tab expansion"},
|
||||
{WHEN_EXPERT, "; change to another console"},
|
||||
{WHEN_EXPERT, "+(-) do (not) drop line"},
|
||||
{WHEN_VT100, "PF1 print this message"},
|
||||
{WHEN_VT100, "PF2 disconnect"},
|
||||
{WHEN_VT100, "PF3 replay the last 20 lines"},
|
||||
{WHEN_VT100, "PF4 spy read only"}
|
||||
};
|
||||
|
||||
/* list the commands we know for the user (ksb)
|
||||
@ -433,9 +436,6 @@ HelpUser(pCL)
|
||||
} else {
|
||||
FileWrite(pCL->fd, FLAGTRUE, acH2, sizeof(acH2) - 1);
|
||||
}
|
||||
if ('\033' == pCL->ic[0] && 'O' == pCL->ic[1]) {
|
||||
iCmp |= WHEN_VT100;
|
||||
}
|
||||
|
||||
BuildString((char *)0, acLine);
|
||||
for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) {
|
||||
@ -449,12 +449,14 @@ HelpUser(pCL)
|
||||
}
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
|
||||
acLine->used - 1);
|
||||
BuildString((char *)0, acLine);
|
||||
continue;
|
||||
} else {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
|
||||
acLine->used - 1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
@ -463,14 +465,15 @@ HelpUser(pCL)
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
if (acLine->used > HALFLINE) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string,
|
||||
acLine->used - 1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (acLine->used != 0) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, -1);
|
||||
FileWrite(pCL->fd, FLAGTRUE, acLine->string, acLine->used - 1);
|
||||
}
|
||||
FileWrite(pCL->fd, FLAGFALSE, (char *)0, 0);
|
||||
}
|
||||
@ -484,15 +487,31 @@ ClientAccessOk(pCL)
|
||||
#endif
|
||||
{
|
||||
char *peername = (char *)0;
|
||||
int retval = 1;
|
||||
|
||||
#if 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;
|
||||
int cfd;
|
||||
struct sockaddr_in in_port;
|
||||
int retval = 1;
|
||||
int getpeer = -1;
|
||||
|
||||
cfd = FileFDNum(pCL->fd);
|
||||
pCL->caccess = 'r';
|
||||
#if defined(USE_LIBWRAP)
|
||||
# if defined(USE_LIBWRAP)
|
||||
{
|
||||
struct request_info request;
|
||||
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
|
||||
@ -504,7 +523,7 @@ ClientAccessOk(pCL)
|
||||
goto setpeer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
so = sizeof(in_port);
|
||||
if (-1 ==
|
||||
@ -519,16 +538,24 @@ ClientAccessOk(pCL)
|
||||
-1);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
setpeer:
|
||||
#endif
|
||||
|
||||
if (pCL->peername != (STRING *)0) {
|
||||
BuildString((char *)0, pCL->peername);
|
||||
if (peername != (char *)0)
|
||||
BuildString(peername, pCL->peername);
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
else
|
||||
BuildString("127.0.0.1", pCL->peername);
|
||||
#else
|
||||
else if (getpeer != -1)
|
||||
BuildString(inet_ntoa(in_port.sin_addr), pCL->peername);
|
||||
else
|
||||
BuildString("<unknown>", pCL->peername);
|
||||
#endif
|
||||
}
|
||||
if (peername != (char *)0)
|
||||
free(peername);
|
||||
return retval;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: client.h,v 5.33 2003-10-10 03:28:49-07 bryan Exp $
|
||||
* $Id: client.h,v 5.36 2003/12/25 19:22:00 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -46,7 +46,9 @@ typedef enum clientState {
|
||||
S_IDENT, /* probational connection (who is this) */
|
||||
S_PASSWD, /* still needs a passwd to connect */
|
||||
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_CEXEC /* client execing a program */
|
||||
} CLIENTSTATE;
|
||||
|
||||
typedef struct client { /* Connection Information: */
|
||||
@ -82,7 +84,7 @@ typedef struct client { /* Connection Information: */
|
||||
cnct_port; /* where from */
|
||||
} CONSCLIENT;
|
||||
|
||||
extern void Replay PARAMS((CONSFILE *, CONSFILE *, int));
|
||||
extern void Replay PARAMS((CONSENT *, CONSFILE *, int));
|
||||
extern void HelpUser PARAMS((CONSCLIENT *));
|
||||
extern void FindWrite PARAMS((CONSENT *));
|
||||
extern int ClientAccessOk PARAMS((CONSCLIENT *));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.c,v 5.128 2003-09-30 13:14:04-07 bryan Exp $
|
||||
* $Id: consent.c,v 5.138 2004/04/16 16:58:09 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
@ -236,6 +236,23 @@ TtyDev(pCE)
|
||||
ConsDown(pCE, FLAGTRUE, FLAGTRUE);
|
||||
return -1;
|
||||
}
|
||||
if (fDebug >= 2) {
|
||||
int i;
|
||||
Debug(2, "TtyDev(): [%s] termp.c_iflag=%lu", pCE->server,
|
||||
(unsigned long)termp.c_iflag);
|
||||
Debug(2, "TtyDev(): [%s] termp.c_oflag=%lu", pCE->server,
|
||||
(unsigned long)termp.c_oflag);
|
||||
Debug(2, "TtyDev(): [%s] termp.c_cflag=%lu", pCE->server,
|
||||
(unsigned long)termp.c_cflag);
|
||||
Debug(2, "TtyDev(): [%s] termp.c_lflag=%lu", pCE->server,
|
||||
(unsigned long)termp.c_lflag);
|
||||
#if defined(NCCS)
|
||||
for (i = 0; i < NCCS; i++) {
|
||||
Debug(2, "TtyDev(): [%s] termp.c_cc[%d]=%lu", pCE->server, i,
|
||||
(unsigned long)termp.c_cc[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
# if HAVE_STROPTS_H
|
||||
/*
|
||||
* eat all the streams modules upto and including ttcompat
|
||||
@ -261,12 +278,12 @@ StopInit(pCE)
|
||||
|
||||
if (pCE->initpid != 0) {
|
||||
kill(pCE->initpid, SIGHUP);
|
||||
pCE->initpid = 0;
|
||||
Verbose("[%s] initcmd terminated: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
TagLogfileAct(pCE, "initcmd terminated");
|
||||
CONDDEBUG((1, "StopInit(): sending initcmd pid %lu signal %d",
|
||||
(unsigned long)pCE->initpid, SIGHUP));
|
||||
Msg("[%s] initcmd terminated: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
TagLogfileAct(pCE, "initcmd terminated");
|
||||
pCE->initpid = 0;
|
||||
}
|
||||
|
||||
if (pCE->initfile != (CONSFILE *)0) {
|
||||
@ -359,8 +376,8 @@ StartInit(pCE)
|
||||
pCE->initpid = 0;
|
||||
return;
|
||||
}
|
||||
Verbose("[%s] initcmd started: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
Msg("[%s] initcmd started: pid %lu", pCE->server,
|
||||
(unsigned long)pCE->initpid);
|
||||
TagLogfileAct(pCE, "initcmd started");
|
||||
FD_SET(pin[0], &rinit);
|
||||
if (maxfd < pin[0] + 1)
|
||||
@ -691,7 +708,7 @@ ConsInit(pCE)
|
||||
TagLogfile(pCE, "Console up");
|
||||
|
||||
switch (pCE->type) {
|
||||
case UNKNOWN: /* shut up gcc */
|
||||
case UNKNOWNTYPE: /* shut up gcc */
|
||||
break;
|
||||
case EXEC:
|
||||
if ((cofile =
|
||||
@ -741,7 +758,7 @@ ConsInit(pCE)
|
||||
hp->h_length);
|
||||
#endif
|
||||
port.sin_family = hp->h_addrtype;
|
||||
port.sin_port = htons(pCE->port);
|
||||
port.sin_port = htons(pCE->netport);
|
||||
|
||||
if ((cofile = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
Error
|
||||
@ -792,12 +809,15 @@ ConsInit(pCE)
|
||||
} else {
|
||||
pCE->ioState = INCONNECT;
|
||||
pCE->stateTimer = time((time_t *)0) + CONNECTTIMEOUT;
|
||||
if (timers[T_STATE] == (time_t)0 ||
|
||||
timers[T_STATE] > pCE->stateTimer)
|
||||
timers[T_STATE] = pCE->stateTimer;
|
||||
pCE->fup = 1;
|
||||
}
|
||||
break;
|
||||
case DEVICE:
|
||||
if (-1 ==
|
||||
(cofile = open(pCE->device, O_RDWR | O_NDELAY, 0600))) {
|
||||
(cofile = open(pCE->device, O_RDWR | O_NONBLOCK, 0600))) {
|
||||
|
||||
Error("[%s] open(%s): %s: forcing down", pCE->server,
|
||||
pCE->device, strerror(errno));
|
||||
@ -823,14 +843,14 @@ ConsInit(pCE)
|
||||
}
|
||||
|
||||
switch (pCE->type) {
|
||||
case UNKNOWN: /* shut up gcc */
|
||||
case UNKNOWNTYPE: /* shut up gcc */
|
||||
break;
|
||||
case EXEC:
|
||||
Verbose("[%s] pid %lu on %s", pCE->server, pCE->ipid,
|
||||
pCE->execSlave);
|
||||
break;
|
||||
case HOST:
|
||||
Verbose("[%s] port %hu on %s", pCE->server, pCE->port,
|
||||
Verbose("[%s] port %hu on %s", pCE->server, pCE->netport,
|
||||
pCE->host);
|
||||
break;
|
||||
case DEVICE:
|
||||
@ -839,13 +859,28 @@ ConsInit(pCE)
|
||||
break;
|
||||
}
|
||||
|
||||
FD_SET(cofile, &rinit);
|
||||
/* if we're waiting for connect() to finish, watch the
|
||||
* write bit, otherwise watch for the read bit
|
||||
*/
|
||||
if (pCE->ioState == INCONNECT)
|
||||
FD_SET(cofile, &winit);
|
||||
else
|
||||
FD_SET(cofile, &rinit);
|
||||
if (maxfd < cofile + 1)
|
||||
maxfd = cofile + 1;
|
||||
|
||||
tyme = time((time_t *)0);
|
||||
|
||||
if (pCE->ioState == ISNORMAL) {
|
||||
pCE->lastWrite = tyme;
|
||||
if (pCE->idletimeout != (time_t)0 &&
|
||||
(timers[T_CIDLE] == (time_t)0 ||
|
||||
timers[T_CIDLE] > pCE->lastWrite + pCE->idletimeout))
|
||||
timers[T_CIDLE] = pCE->lastWrite + pCE->idletimeout;
|
||||
}
|
||||
|
||||
/* If we have marks, adjust the next one so that it's in the future */
|
||||
if (pCE->nextMark > 0) {
|
||||
tyme = time((time_t *)0);
|
||||
if (tyme >= pCE->nextMark) {
|
||||
/* Add as many pCE->mark values as necessary so that we move
|
||||
* beyond the current time.
|
||||
@ -856,7 +891,10 @@ ConsInit(pCE)
|
||||
}
|
||||
|
||||
if (pCE->downHard == FLAGTRUE) {
|
||||
Msg("[%s] console up", pCE->server);
|
||||
if (pCE->ioState == ISNORMAL)
|
||||
Msg("[%s] console up", pCE->server);
|
||||
else
|
||||
Msg("[%s] console initializing", pCE->server);
|
||||
pCE->downHard = FLAGFALSE;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.h,v 5.48 2003-10-02 18:49:03-07 bryan Exp $
|
||||
* $Id: consent.h,v 5.57 2004/05/21 04:38:02 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -52,7 +52,7 @@ typedef struct parity { /* a parity bits table */
|
||||
} PARITY;
|
||||
|
||||
typedef enum consType {
|
||||
UNKNOWN = 0,
|
||||
UNKNOWNTYPE = 0,
|
||||
DEVICE,
|
||||
EXEC,
|
||||
HOST
|
||||
@ -65,6 +65,7 @@ typedef struct names {
|
||||
|
||||
typedef struct consentUsers {
|
||||
NAMES *user;
|
||||
short not;
|
||||
struct consentUsers *next;
|
||||
} CONSENTUSERS;
|
||||
|
||||
@ -78,6 +79,7 @@ typedef struct consent { /* console information */
|
||||
NAMES *aliases; /* aliases for server name */
|
||||
/* type == DEVICE */
|
||||
char *device; /* device file */
|
||||
char *devicesubst; /* device substitution pattern */
|
||||
BAUD *baud; /* the baud on this console port */
|
||||
PARITY *parity; /* the parity on this line */
|
||||
FLAG hupcl; /* use HUPCL */
|
||||
@ -90,15 +92,24 @@ typedef struct consent { /* console information */
|
||||
#endif
|
||||
/* type == HOST */
|
||||
char *host; /* hostname */
|
||||
unsigned short port; /* port number */
|
||||
unsigned short netport; /* final port | netport = portbase + */
|
||||
unsigned short port; /* port number | portinc * port */
|
||||
unsigned short portbase; /* port base */
|
||||
unsigned short portinc; /* port increment */
|
||||
FLAG raw; /* raw or telnet protocol? */
|
||||
/* type == EXEC */
|
||||
char *exec; /* exec command */
|
||||
char *execsubst; /* exec substitution pattern */
|
||||
/* global stuff */
|
||||
char *master; /* master hostname */
|
||||
unsigned short breakNum; /* break type [1-9] */
|
||||
char *logfile; /* logfile */
|
||||
off_t logfilemax; /* size limit for rolling logfile */
|
||||
char *initcmd; /* initcmd command */
|
||||
char *initsubst; /* initcmd substitution pattern */
|
||||
char *motd; /* motd */
|
||||
time_t idletimeout; /* idle timeout */
|
||||
char *idlestring; /* string to print when idle */
|
||||
/* timestamp stuff */
|
||||
int mark; /* Mark (chime) interval */
|
||||
long nextMark; /* Next mark (chime) time */
|
||||
@ -123,6 +134,7 @@ typedef struct consent { /* console information */
|
||||
int wbufIAC; /* next IAC location in wbuf */
|
||||
IOSTATE ioState; /* state of the socket */
|
||||
time_t stateTimer; /* timer for ioState states */
|
||||
time_t lastWrite; /* time of last data sent to console */
|
||||
|
||||
/*** state information ***/
|
||||
char acline[132 * 2 + 2]; /* max chars we will call a line */
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
|
||||
.\" $Id: conserver.man,v 1.38 2003-09-22 08:33:41-07 bryan Exp $
|
||||
.TH CONSERVER 8 "2003-09-22" "conserver-8.0.5" "conserver"
|
||||
.\" $Id: conserver.man,v 1.47 2004/05/21 04:15:17 bryan Exp $
|
||||
.TH CONSERVER 8 "2004/05/21" "conserver-8.1.6" "conserver"
|
||||
.SH NAME
|
||||
conserver \- console server daemon
|
||||
.SH SYNOPSIS
|
||||
@ -11,7 +11,7 @@ conserver \- console server daemon
|
||||
.RB [ \-m
|
||||
.IR max ]
|
||||
.RB [ \-M
|
||||
.IR addr ]
|
||||
.IR master ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.RB [ \-b
|
||||
@ -26,6 +26,8 @@ conserver \- console server daemon
|
||||
.IR logfile ]
|
||||
.RB [ \-O
|
||||
.IR min ]
|
||||
.RB [ \-U
|
||||
.IR logfile ]
|
||||
.SH DESCRIPTION
|
||||
.B Conserver
|
||||
is the daemon that manages
|
||||
@ -48,7 +50,7 @@ knowledge of the distribution of consoles among servers.)
|
||||
.B Conserver
|
||||
forks a child for each group of consoles it must manage
|
||||
and assigns each process a port number to listen on.
|
||||
The maximum number of consoles managed by each child process is set using
|
||||
The maximum number of consoles managed by each child process is set using the
|
||||
.B \-m
|
||||
option.
|
||||
The
|
||||
@ -74,14 +76,31 @@ the
|
||||
.BR conserver.cf (5)
|
||||
access list.
|
||||
.PP
|
||||
When Unix domain sockets are used between the client and
|
||||
server (enabled using
|
||||
.BR --with-uds ),
|
||||
authentication checks are done on the hardcoded address ``127.0.0.1''.
|
||||
Automatic client redirection is also disabled (as if the
|
||||
.B \-R
|
||||
option was used) since the client cannot communicate with remote servers.
|
||||
The directory used to hold the sockets is checked to make sure it's empty
|
||||
when the server starts.
|
||||
The server will
|
||||
.B not
|
||||
remove any files in the directory itself, just in case the directory is
|
||||
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,
|
||||
but it could stop ungracefully (crash, ``kill -9'', etc)
|
||||
and leave files behind.
|
||||
It's would then be up to the admin (or a creative startup script) to clean
|
||||
up the directory before the server will start again.
|
||||
.PP
|
||||
.B Conserver
|
||||
completely controls any connection to a console.
|
||||
All escape sequences given by the user to
|
||||
.B console
|
||||
are passed to the server without interpretation.
|
||||
The server recognizes and processes all escape sequences,
|
||||
The suspend sequence is recognized by the server and sent back to the
|
||||
client as a TCP out-of-band command, which the client processes.
|
||||
The server recognizes and processes all escape sequences.
|
||||
.PP
|
||||
The
|
||||
.B conserver
|
||||
@ -93,7 +112,7 @@ Close all connections and exit.
|
||||
.TP
|
||||
SIGHUP
|
||||
Reread the configuration file.
|
||||
New consoles are managed by forking off new childen, deleted
|
||||
New consoles are managed by forking off new children, deleted
|
||||
consoles (and their clients) are dropped,
|
||||
and changes to consoles are done "in place", resetting the console
|
||||
port (bringing it down and up) only when necessary.
|
||||
@ -147,7 +166,7 @@ the signing certificate must be properly trusted, which usually means
|
||||
the public portion is in
|
||||
.IB OPENSSL_ROOT /ssl/certs
|
||||
(on both the client and server sides).
|
||||
See the sample self-signing certficate making script
|
||||
See the sample self-signing certificate making script
|
||||
.B contrib/maketestcerts
|
||||
for further clues.
|
||||
To allow
|
||||
@ -215,7 +234,7 @@ option.
|
||||
.B \-d
|
||||
Become a daemon.
|
||||
Disconnects from the controlling terminal and sends
|
||||
all output to the logfile (see
|
||||
all output (including any debug output) to the logfile (see
|
||||
.BR \-L ).
|
||||
.TP
|
||||
.B \-D
|
||||
@ -269,11 +288,21 @@ may be changed at compile time using the
|
||||
.B --with-maxmemb
|
||||
option.
|
||||
.TP
|
||||
.BI \-M addr
|
||||
Set the address to listen on.
|
||||
This allows conserver to bind to a
|
||||
.BI \-M master
|
||||
Normally, this allows conserver to bind to a
|
||||
particular IP address (like `127.0.0.1') instead of all interfaces.
|
||||
The default is to bind to all addresses.
|
||||
However, if
|
||||
.B --with-uds
|
||||
was used to enable Unix domain sockets for client/server communication,
|
||||
this points conserver to the directory where it should store the sockets.
|
||||
The default
|
||||
.I master
|
||||
directory
|
||||
.RB (`` /tmp/conserver '')
|
||||
may be changed at compile time using the
|
||||
.B --with-uds
|
||||
option.
|
||||
.TP
|
||||
.B \-n
|
||||
Obsolete (now a no-op); see
|
||||
@ -299,6 +328,9 @@ The default
|
||||
may be changed at compile time using the
|
||||
.B --with-port
|
||||
option.
|
||||
If the
|
||||
.B --with-uds
|
||||
option was used, this option is ignored.
|
||||
.TP
|
||||
.BI \-P passwd
|
||||
Read the table of authorized user data from the file
|
||||
@ -322,6 +354,37 @@ connect to remote consoles will result in an informative message to the user.
|
||||
.B \-S
|
||||
Do not run the server, just perform a syntax check of configuration file and
|
||||
exit with a non-zero value if there is an error.
|
||||
Using more than one
|
||||
.B \-S
|
||||
will cause conserver to output various information about each console in 5
|
||||
colon-separated fields, enclosed in curly-braces.
|
||||
The philosophy behind the output is to provide information to allow external
|
||||
detection of multiple consoles access the same physical port.
|
||||
Since this is
|
||||
.I highly
|
||||
environment-specific, conserver cannot do the check internally.
|
||||
.RS
|
||||
.TP 9
|
||||
.I name
|
||||
The name of the console.
|
||||
.TP
|
||||
.I master
|
||||
The hostname of the master conserver host for the console.
|
||||
.TP
|
||||
.I aliases
|
||||
The console aliases in a comma-separated list.
|
||||
.TP
|
||||
.I type
|
||||
The type of console.
|
||||
Values will be a `/' for a local device, `|' for
|
||||
a command, or `!' for a remote port.
|
||||
.TP
|
||||
.I details
|
||||
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.
|
||||
Commands will have string to invoke.
|
||||
Remote ports will have the values of the remote hostname and port number.
|
||||
.RE
|
||||
.TP
|
||||
.B \-u
|
||||
Send unloved console output to
|
||||
@ -332,6 +395,17 @@ independent of whether logging of individual consoles is enabled via
|
||||
.B conserver.cf
|
||||
entries.
|
||||
.TP
|
||||
.BI \-U logfile
|
||||
Copy all console data to the ``unified''
|
||||
.IR logfile .
|
||||
The output is the same as the
|
||||
.B \-u
|
||||
output, but all consoles, not
|
||||
just those without a user, are logged.
|
||||
Each line of output is prefixed with the console name.
|
||||
If a user is attached read/write, a `*' is appended to the console name,
|
||||
to allow log watching utilites to ignore potential user-introduced alarms.
|
||||
.TP
|
||||
.B \-v
|
||||
Echo the configuration as it is being read (be verbose).
|
||||
.TP
|
||||
@ -381,7 +455,7 @@ The following default file locations may be overridden
|
||||
at compile time or by the command-line options described above.
|
||||
Run
|
||||
.B conserver \-V
|
||||
(with no other options) to see the defaults set at compile time.
|
||||
to see the defaults set at compile time.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP 25
|
||||
@ -399,6 +473,9 @@ the master conserver process ID
|
||||
.TP
|
||||
.B /var/log/conserver
|
||||
log of errors and informational messages
|
||||
.TP
|
||||
.B /tmp/conserver
|
||||
directory to hold Unix domain sockets (if enabled)
|
||||
.PD
|
||||
.PP
|
||||
Additionally, output from individual consoles may be logged
|
||||
|
@ -1,4 +0,0 @@
|
||||
bryan:r71mXjfALB5Ak:any
|
||||
djs:r71mXjfALB5Ak:login
|
||||
chogan:*passwd*:foobar,login,shell
|
||||
hogan:*passwd*:any
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: convert.c,v 1.7 2003-08-15 14:24:39-07 bryan Exp $
|
||||
* $Id: convert.c,v 1.9 2004/05/21 04:15:17 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
@ -42,6 +42,10 @@
|
||||
#include <main.h>
|
||||
|
||||
|
||||
SECTION sections[] = {
|
||||
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
|
||||
};
|
||||
|
||||
void
|
||||
DestroyDataStructures()
|
||||
{
|
||||
@ -139,7 +143,7 @@ ReadLine2(fp, save, iLine)
|
||||
if (!peek && (ret == (char *)0)) {
|
||||
(*iLine)++;
|
||||
wholeline = BuildString(bufstr->string, wholestr);
|
||||
if (wholeline[0] == '\000')
|
||||
if (wholeline != (char *)0 && wholeline[0] == '\000')
|
||||
wholeline = (char *)0;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: util.h,v 1.55 2003-10-03 06:32:34-07 bryan Exp $
|
||||
* $Id: cutil.h,v 1.63 2004/05/25 00:38:15 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -18,8 +18,11 @@
|
||||
|
||||
/* communication constants
|
||||
*/
|
||||
#define OB_IAC 0xff /* quote char */
|
||||
#define OB_EXEC 'E' /* exec a command on the client */
|
||||
#define OB_GOTO 'G' /* goto next console */
|
||||
#define OB_SUSP 'Z' /* suspended by server */
|
||||
#define OB_DROP '.' /* dropped by server */
|
||||
#define OB_ABRT '.' /* abort */
|
||||
|
||||
/* Struct to wrap information about a "file"...
|
||||
* This can be a socket, local file, whatever. We do this so
|
||||
@ -67,6 +70,12 @@ typedef struct consFile {
|
||||
int fd;
|
||||
int fdout; /* only used when a simplePipe */
|
||||
STRING *wbuf;
|
||||
FLAG quoteiac;
|
||||
FLAG sawiac;
|
||||
FLAG sawiacsusp;
|
||||
FLAG sawiacexec;
|
||||
FLAG sawiacabrt;
|
||||
FLAG sawiacgoto;
|
||||
#if HAVE_OPENSSL
|
||||
/* SSL stuff */
|
||||
SSL *ssl;
|
||||
@ -74,8 +83,43 @@ typedef struct consFile {
|
||||
FLAG waitForRead;
|
||||
#endif
|
||||
/* Add crypto stuff to suit */
|
||||
#if DEBUG_CONSFILE_IO
|
||||
int debugrfd;
|
||||
int debugwfd;
|
||||
#endif
|
||||
} CONSFILE;
|
||||
|
||||
typedef struct item {
|
||||
char *id;
|
||||
void (*reg) PARAMS((char *));
|
||||
} ITEM;
|
||||
|
||||
typedef struct section {
|
||||
char *id;
|
||||
void (*begin) PARAMS((char *));
|
||||
void (*end) PARAMS((void));
|
||||
void (*abort) PARAMS((void));
|
||||
void (*destroy) PARAMS((void));
|
||||
ITEM *items;
|
||||
} SECTION;
|
||||
|
||||
typedef enum substToken {
|
||||
ISNOTHING = 0,
|
||||
ISNUMBER,
|
||||
ISSTRING
|
||||
} SUBSTTOKEN;
|
||||
|
||||
typedef struct subst {
|
||||
SUBSTTOKEN tokens[255];
|
||||
/* data for callback function
|
||||
*/
|
||||
void *data;
|
||||
/* function to retrieve a value (as a char* or int or both) for
|
||||
* a substitution
|
||||
*/
|
||||
int (*callback) PARAMS((char, char **, int *));
|
||||
} SUBST;
|
||||
|
||||
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;
|
||||
extern char *progname;
|
||||
extern pid_t thepid;
|
||||
@ -87,6 +131,10 @@ extern fd_set winit;
|
||||
extern int maxfd;
|
||||
extern int debugLineNo;
|
||||
extern char *debugFileName;
|
||||
extern int line; /* used by ParseFile */
|
||||
extern char *file; /* used by ParseFile */
|
||||
extern SECTION sections[]; /* used by ParseFile */
|
||||
extern int isMaster;
|
||||
|
||||
extern const char *StrTime PARAMS((time_t *));
|
||||
extern void Debug PARAMS((int, char *, ...));
|
||||
@ -114,6 +162,7 @@ extern int FileUnopen PARAMS((CONSFILE *));
|
||||
extern void OutOfMem PARAMS(());
|
||||
extern char *BuildTmpString PARAMS((const char *));
|
||||
extern char *BuildTmpStringChar PARAMS((const char));
|
||||
extern char *BuildTmpStringPrint PARAMS((char *, ...));
|
||||
extern char *BuildString PARAMS((const char *, STRING *));
|
||||
extern char *BuildStringChar PARAMS((const char, STRING *));
|
||||
extern char *BuildStringPrint PARAMS((STRING *, char *, ...));
|
||||
@ -126,6 +175,11 @@ extern STRING *AllocString PARAMS((void));
|
||||
extern char *ReadLine PARAMS((FILE *, STRING *, int *));
|
||||
extern enum consFileType FileGetType PARAMS((CONSFILE *));
|
||||
extern void FileSetType PARAMS((CONSFILE *, enum consFileType));
|
||||
extern void FileSetQuoteIAC PARAMS((CONSFILE *, FLAG));
|
||||
extern FLAG FileSawQuoteSusp PARAMS((CONSFILE *));
|
||||
extern FLAG FileSawQuoteExec PARAMS((CONSFILE *));
|
||||
extern FLAG FileSawQuoteAbrt PARAMS((CONSFILE *));
|
||||
extern FLAG FileSawQuoteGoto PARAMS((CONSFILE *));
|
||||
extern void Bye PARAMS((int));
|
||||
extern void DestroyDataStructures PARAMS((void));
|
||||
extern int IsMe PARAMS((char *));
|
||||
@ -135,6 +189,13 @@ extern int FileCanWrite PARAMS((CONSFILE *, fd_set *, fd_set *));
|
||||
extern int FileBufEmpty PARAMS((CONSFILE *));
|
||||
extern int SetFlags PARAMS((int, int, int));
|
||||
extern char *StrDup PARAMS((char *));
|
||||
extern int ParseIACBuf PARAMS((CONSFILE *, void *, int *));
|
||||
extern void *MemMove PARAMS((void *, void *, size_t));
|
||||
extern char *StringChar PARAMS((STRING *, int, char));
|
||||
extern void ParseFile PARAMS((char *, FILE *, int));
|
||||
extern void ProbeInterfaces PARAMS((in_addr_t));
|
||||
extern void ProcessSubst
|
||||
PARAMS((SUBST *, char **, char **, char *, char *));
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *FileGetSSL PARAMS((CONSFILE *));
|
||||
extern void FileSetSSL PARAMS((CONSFILE *, SSL *));
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fallback.c,v 5.59 2003-10-03 06:32:34-07 bryan Exp $
|
||||
* $Id: fallback.c,v 5.61 2004/04/16 16:58:09 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
|
||||
/*
|
||||
* get a pty for the user
|
||||
@ -210,7 +210,7 @@ GetPseudoTTY(slave, slaveFD)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (0 > (fd = open(acMaster, O_RDWR | O_NDELAY, 0))) {
|
||||
if (0 > (fd = open(acMaster, O_RDWR | O_NONBLOCK, 0))) {
|
||||
continue;
|
||||
}
|
||||
acSlave[iIndex] = *pcOne;
|
||||
|
3453
conserver/group.c
3453
conserver/group.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: group.h,v 5.38 2003-09-19 08:58:18-07 bryan Exp $
|
||||
* $Id: group.h,v 5.46 2004/05/25 00:38:15 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -34,6 +34,16 @@
|
||||
* 4. This notice may not be removed or altered.
|
||||
*/
|
||||
|
||||
/* timers used to have various things happen */
|
||||
#define T_STATE 0
|
||||
#define T_CIDLE 1
|
||||
#define T_MARK 2
|
||||
#define T_REINIT 3
|
||||
#define T_AUTOUP 4
|
||||
#define T_ROLL 5
|
||||
#define T_INITDELAY 6
|
||||
#define T_MAX 7 /* T_MAX *must* be last */
|
||||
|
||||
/* return values used by CheckPass()
|
||||
*/
|
||||
#define AUTH_SUCCESS 0 /* ok */
|
||||
@ -52,22 +62,25 @@ typedef struct grpent { /* group info */
|
||||
struct grpent *pGEnext; /* next group entry */
|
||||
} GRPENT;
|
||||
|
||||
extern time_t timers[];
|
||||
|
||||
extern void Spawn PARAMS((GRPENT *));
|
||||
extern int CheckPass PARAMS((char *, char *));
|
||||
extern void TagLogfile PARAMS((const CONSENT *, char *, ...));
|
||||
extern void TagLogfileAct PARAMS((const CONSENT *, char *, ...));
|
||||
extern void CleanupBreak PARAMS((short));
|
||||
extern void DestroyGroup PARAMS((GRPENT *));
|
||||
extern void DestroyConsent PARAMS((GRPENT *, CONSENT *));
|
||||
extern void SendClientsMsg PARAMS((CONSENT *, char *));
|
||||
extern void ResetMark PARAMS((void));
|
||||
extern void DestroyConsentUsers PARAMS((CONSENTUSERS **));
|
||||
extern CONSENTUSERS *ConsentFindUser PARAMS((CONSENTUSERS *, char *));
|
||||
extern int ConsentUserOk PARAMS((CONSENTUSERS *, char *));
|
||||
extern void DisconnectClient
|
||||
PARAMS((GRPENT *, CONSCLIENT *, char *, FLAG));
|
||||
extern int ClientAccess PARAMS((CONSENT *, char *));
|
||||
extern void DestroyClient PARAMS((CONSCLIENT *));
|
||||
extern int CheckPasswd PARAMS((CONSCLIENT *, char *));
|
||||
extern void DeUtmp PARAMS((GRPENT *, int));
|
||||
#if HAVE_OPENSSL
|
||||
extern int AttemptSSL PARAMS((CONSCLIENT *));
|
||||
#endif
|
||||
|
463
conserver/main.c
463
conserver/main.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.c,v 5.163 2003-10-31 09:55:04-08 bryan Exp $
|
||||
* $Id: main.c,v 5.185 2004/05/25 23:03:01 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
@ -40,10 +40,7 @@
|
||||
#include <readcfg.h>
|
||||
#include <version.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#if HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
#if HAVE_OPENSSL
|
||||
# include <openssl/opensslv.h>
|
||||
#endif
|
||||
@ -53,9 +50,8 @@ int fAll = 0, fNoinit = 0, fVersion = 0, fStrip = 0, fReopen =
|
||||
0, fNoautoreup = 0, fSyntaxOnly = 0;
|
||||
|
||||
char *pcConfig = CONFIGFILE;
|
||||
int isMaster = 1;
|
||||
int cMaxMemb = MAXMEMB;
|
||||
in_addr_t bindAddr;
|
||||
in_addr_t bindAddr = INADDR_ANY;
|
||||
unsigned short bindPort;
|
||||
unsigned short bindBasePort;
|
||||
static STRING *startedMsg = (STRING *)0;
|
||||
@ -64,8 +60,7 @@ CONFIG *config = (CONFIG *)0;
|
||||
char *interface = (char *)0;
|
||||
CONFIG defConfig =
|
||||
{ (STRING *)0, 'r', FLAGFALSE, LOGFILEPATH, PASSWDFILE, DEFPORT,
|
||||
FLAGTRUE,
|
||||
FLAGTRUE, 0, DEFBASEPORT
|
||||
FLAGTRUE, FLAGTRUE, 0, DEFBASEPORT, (char *)0, 0
|
||||
#if HAVE_SETPROCTITLE
|
||||
, FLAGFALSE
|
||||
#endif
|
||||
@ -75,6 +70,7 @@ CONFIG defConfig =
|
||||
};
|
||||
|
||||
struct sockaddr_in in_port;
|
||||
CONSFILE *unifiedlog = (CONSFILE *)0;
|
||||
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
|
||||
unsigned long dmallocMarkMain = 0;
|
||||
@ -424,6 +420,31 @@ ReopenLogfile()
|
||||
tag = 0;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ReopenUnifiedlog(void)
|
||||
#else
|
||||
ReopenUnifiedlog()
|
||||
#endif
|
||||
{
|
||||
/* close any existing */
|
||||
if (unifiedlog != (CONSFILE *)0)
|
||||
FileClose(&unifiedlog);
|
||||
|
||||
/* return if we aren't opening again */
|
||||
if (config->unifiedlog == (char *)0)
|
||||
return;
|
||||
|
||||
/* open a new one */
|
||||
if ((unifiedlog =
|
||||
FileOpen(config->unifiedlog, O_WRONLY | O_CREAT | O_APPEND,
|
||||
0644)) == (CONSFILE *)0) {
|
||||
Error("ReopenUnifiedlog(): open(%s): %s", config->unifiedlog,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* become a daemon (ksb)
|
||||
*/
|
||||
static void
|
||||
@ -497,7 +518,7 @@ Usage(wantfull)
|
||||
#endif
|
||||
{
|
||||
static char u_terse[] =
|
||||
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M addr] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min]";
|
||||
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M master] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]";
|
||||
static char *full[] = {
|
||||
"7 strip the high bit off all console data",
|
||||
"a type set the default access type",
|
||||
@ -520,15 +541,24 @@ Usage(wantfull)
|
||||
"i initialize console connections on demand",
|
||||
"L logfile give a new logfile path to the server process",
|
||||
"m max maximum consoles managed per process",
|
||||
"M addr address to listen on (all addresses by default)",
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
"M master directory that holds the Unix domain sockets",
|
||||
#else
|
||||
"M master address to listen on (all addresses by default)",
|
||||
#endif
|
||||
"n obsolete - see -u",
|
||||
"o reopen downed console on client connect",
|
||||
"O min reopen all downed consoles every <min> minutes",
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
"p port ignored - Unix domain sockets compiled into code",
|
||||
#else
|
||||
"p port port to listen on",
|
||||
#endif
|
||||
"P passwd give a new passwd file to the server process",
|
||||
"R disable automatic client redirection",
|
||||
"S syntax check of configuration file",
|
||||
"u copy \"unloved\" console data to stdout",
|
||||
"U logfile copy all console data to the \"unified\" logfile",
|
||||
"v be verbose on startup",
|
||||
"V output version info",
|
||||
(char *)0
|
||||
@ -565,6 +595,12 @@ Version()
|
||||
#endif
|
||||
#if HAVE_PAM
|
||||
"pam",
|
||||
#endif
|
||||
#if TRUST_REVERSE_DNS
|
||||
"trustrevdns",
|
||||
#endif
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
"uds",
|
||||
#endif
|
||||
(char *)0
|
||||
};
|
||||
@ -586,9 +622,13 @@ Version()
|
||||
Msg("default pidfile is `%s'", PIDFILE);
|
||||
Msg("default limit is %d member%s per group", MAXMEMB,
|
||||
MAXMEMB == 1 ? "" : "s");
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
Msg("default socket directory `%s'", UDSDIR);
|
||||
#else
|
||||
Msg("default primary port referenced as `%s'", defConfig.primaryport);
|
||||
Msg("default secondary base port referenced as `%s'",
|
||||
defConfig.secondaryport);
|
||||
#endif
|
||||
|
||||
BuildString((char *)0, acA1);
|
||||
if (optionlist[0] == (char *)0)
|
||||
@ -609,10 +649,12 @@ Version()
|
||||
BuildStringChar('0' + DMALLOC_VERSION_MINOR, acA1);
|
||||
BuildStringChar('.', acA1);
|
||||
BuildStringChar('0' + DMALLOC_VERSION_PATCH, acA1);
|
||||
#if defined(DMALLOC_VERSION_BETA)
|
||||
if (DMALLOC_VERSION_BETA != 0) {
|
||||
BuildString("-b", acA1);
|
||||
BuildStringChar('0' + DMALLOC_VERSION_BETA, acA1);
|
||||
}
|
||||
#endif
|
||||
Msg("dmalloc version: %s", acA1->string);
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
@ -678,6 +720,8 @@ DestroyDataStructures()
|
||||
DestroyBreakList();
|
||||
DestroyStrings();
|
||||
DestroyUserList();
|
||||
if (substData != (SUBST *) 0)
|
||||
free(substData);
|
||||
}
|
||||
|
||||
void
|
||||
@ -727,6 +771,10 @@ SummarizeDataStructures()
|
||||
size += strlen(pCE->initcmd);
|
||||
if (pCE->execSlave != (char *)0)
|
||||
size += strlen(pCE->execSlave);
|
||||
if (pCE->motd != (char *)0)
|
||||
size += strlen(pCE->motd);
|
||||
if (pCE->idlestring != (char *)0)
|
||||
size += strlen(pCE->idlestring);
|
||||
if (pCE->fdlog != (CONSFILE *)0)
|
||||
size += sizeof(CONSFILE);
|
||||
if (pCE->cofile != (CONSFILE *)0)
|
||||
@ -805,13 +853,13 @@ DumpDataStructures()
|
||||
GRPENT *pGE;
|
||||
CONSENT *pCE;
|
||||
REMOTE *pRC;
|
||||
char *empty = "<empty>";
|
||||
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
|
||||
CONDDEBUG((1, "DumpDataStructures(): dmalloc / MarkMain"));
|
||||
dmalloc_log_changed(dmallocMarkMain, 1, 0, 1);
|
||||
#endif
|
||||
#define EMPTYSTR(x) x == (char *)0 ? empty : x
|
||||
#define EMPTYSTR(x) x == (char *)0 ? "(null)" : x
|
||||
#define FLAGSTR(x) x == FLAGTRUE ? "true" : (x == FLAGFALSE ? "false" : "unset")
|
||||
if (!fDebug)
|
||||
return;
|
||||
|
||||
@ -819,7 +867,7 @@ DumpDataStructures()
|
||||
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): group: id=%u pid=%lu, port=%hu, imembers=%d",
|
||||
"DumpDataStructures(): group: id=%u port=%hu, pid=%lu, imembers=%d",
|
||||
pGE->id, pGE->port, (unsigned long)pGE->pid,
|
||||
pGE->imembers));
|
||||
|
||||
@ -830,8 +878,9 @@ DumpDataStructures()
|
||||
"DumpDataStructures(): server=%s, type=DEVICE",
|
||||
EMPTYSTR(pCE->server)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): baud=%s, parity=%s",
|
||||
pCE->baud->acrate, pCE->parity->key));
|
||||
"DumpDataStructures(): baud=%s, parity=%s, device=%s",
|
||||
pCE->baud->acrate, pCE->parity->key,
|
||||
EMPTYSTR(pCE->device)));
|
||||
break;
|
||||
case EXEC:
|
||||
CONDDEBUG((1,
|
||||
@ -849,13 +898,13 @@ DumpDataStructures()
|
||||
"DumpDataStructures(): server=%s, type=HOST",
|
||||
EMPTYSTR(pCE->server)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): host=%s, port=%hu, telnetState=%d",
|
||||
EMPTYSTR(pCE->host), pCE->port,
|
||||
pCE->telnetState));
|
||||
"DumpDataStructures(): host=%s, raw=%s, netport=%hu, port=%hu, telnetState=%d",
|
||||
EMPTYSTR(pCE->host), FLAGSTR(pCE->raw),
|
||||
pCE->netport, pCE->port, pCE->telnetState));
|
||||
break;
|
||||
case UNKNOWN:
|
||||
case UNKNOWNTYPE:
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): server=%s, type=UNKNOWN",
|
||||
"DumpDataStructures(): server=%s, type=UNKNOWNTYPE",
|
||||
EMPTYSTR(pCE->server)));
|
||||
break;
|
||||
}
|
||||
@ -873,48 +922,47 @@ DumpDataStructures()
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): mark=%d, nextMark=%ld, autoReup=%hu, downHard=%s",
|
||||
pCE->mark, pCE->nextMark, pCE->autoReUp,
|
||||
pCE->downHard == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->downHard)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): nolog=%d, cofile=%d, activitylog=%s, breaklog=%s",
|
||||
pCE->nolog, FileFDNum(pCE->cofile),
|
||||
pCE->activitylog == FLAGTRUE ? "true" : "false",
|
||||
pCE->breaklog == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->activitylog), FLAGSTR(pCE->breaklog)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): ixon=%s, ixany=%s, ixoff=%s",
|
||||
pCE->ixon == FLAGTRUE ? "true" : "false",
|
||||
pCE->ixany == FLAGTRUE ? "true" : "false",
|
||||
pCE->ixoff == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->ixon), FLAGSTR(pCE->ixany),
|
||||
FLAGSTR(pCE->ixoff)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): autoreinit=%s, hupcl=%s, cstopb=%s, ondemand=%s",
|
||||
pCE->autoreinit == FLAGTRUE ? "true" : "false",
|
||||
pCE->hupcl == FLAGTRUE ? "true" : "false",
|
||||
pCE->cstopb == FLAGTRUE ? "true" : "false",
|
||||
pCE->ondemand == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->autoreinit), FLAGSTR(pCE->hupcl),
|
||||
FLAGSTR(pCE->cstopb), FLAGSTR(pCE->ondemand)));
|
||||
#if defined(CRTSCTS)
|
||||
CONDDEBUG((1, "DumpDataStructures(): crtscts=%s",
|
||||
pCE->crtscts == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->crtscts)));
|
||||
#endif
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): reinitoncc=%s, striphigh=%s, unloved=%s",
|
||||
pCE->reinitoncc == FLAGTRUE ? "true" : "false",
|
||||
pCE->striphigh == FLAGTRUE ? "true" : "false",
|
||||
pCE->unloved == FLAGTRUE ? "true" : "false"));
|
||||
FLAGSTR(pCE->reinitoncc), FLAGSTR(pCE->striphigh),
|
||||
FLAGSTR(pCE->unloved)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): initpid=%lu, initcmd=%s, initfile=%d",
|
||||
(unsigned long)pCE->initpid, EMPTYSTR(pCE->initcmd),
|
||||
FileFDNum(pCE->initfile)));
|
||||
CONDDEBUG((1,
|
||||
"DumpDataStructures(): motd=%s, idletimeout=%d, idlestring=%s",
|
||||
EMPTYSTR(pCE->motd), pCE->idletimeout,
|
||||
EMPTYSTR(pCE->idlestring)));
|
||||
if (pCE->ro) {
|
||||
CONSENTUSERS *u;
|
||||
for (u = pCE->ro; u != (CONSENTUSERS *)0; u = u->next) {
|
||||
CONDDEBUG((1, "DumpDataStructures(): ro=%s",
|
||||
u->user->name));
|
||||
CONDDEBUG((1, "DumpDataStructures(): ro=%s%s",
|
||||
(u->not ? "!" : ""), u->user->name));
|
||||
}
|
||||
}
|
||||
if (pCE->rw) {
|
||||
CONSENTUSERS *u;
|
||||
for (u = pCE->rw; u != (CONSENTUSERS *)0; u = u->next) {
|
||||
CONDDEBUG((1, "DumpDataStructures(): rw=%s",
|
||||
u->user->name));
|
||||
CONDDEBUG((1, "DumpDataStructures(): rw=%s%s",
|
||||
(u->not ? "!" : ""), u->user->name));
|
||||
}
|
||||
}
|
||||
CONDDEBUG((1, "DumpDataStructures(): ------"));
|
||||
@ -932,187 +980,93 @@ DumpDataStructures()
|
||||
}
|
||||
}
|
||||
|
||||
/* fills the myAddrs array with host interface addresses */
|
||||
void
|
||||
/* This makes sure a directory exists and tries to create it if it
|
||||
* doesn't. returns 0 for success, -1 for error
|
||||
*/
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
int
|
||||
#if PROTOTYPES
|
||||
ProbeInterfaces(void)
|
||||
VerifyEmptyDirectory(char *d)
|
||||
#else
|
||||
ProbeInterfaces()
|
||||
VerifyEmptyDirectory(d)
|
||||
char *d;
|
||||
#endif
|
||||
{
|
||||
#ifdef SIOCGIFCONF
|
||||
struct ifconf ifc;
|
||||
struct ifreq *ifr;
|
||||
#ifdef SIOCGIFFLAGS
|
||||
struct ifreq ifrcopy;
|
||||
#endif
|
||||
int sock;
|
||||
int r = 0, m = 0;
|
||||
int bufsize = 2048;
|
||||
int count = 0;
|
||||
struct stat dstat;
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
STRING *path = (STRING *)0;
|
||||
int retval = 0;
|
||||
|
||||
/* if we use -M, just fill the array with that interface */
|
||||
if (bindAddr != INADDR_ANY) {
|
||||
myAddrs = (struct in_addr *)calloc(2, sizeof(struct in_addr));
|
||||
if (myAddrs == (struct in_addr *)0)
|
||||
OutOfMem();
|
||||
#if HAVE_MEMCPY
|
||||
memcpy(&(myAddrs[0].s_addr), &bindAddr, sizeof(in_addr_t));
|
||||
#else
|
||||
bcopy(&bindAddr, &(myAddrs[0].s_addr), sizeof(in_addr_t));
|
||||
#endif
|
||||
Verbose("interface address %s (-M option)", inet_ntoa(myAddrs[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
Error("ProbeInterfaces(): socket(): %s", strerror(errno));
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
|
||||
while (bufsize) {
|
||||
ifc.ifc_len = bufsize;
|
||||
ifc.ifc_req = (struct ifreq *)malloc(ifc.ifc_len);
|
||||
if (ifc.ifc_req == (struct ifreq *)0)
|
||||
OutOfMem();
|
||||
if (ioctl(sock, SIOCGIFCONF, &ifc) != 0) {
|
||||
free(ifc.ifc_req);
|
||||
close(sock);
|
||||
Error("ProbeInterfaces(): ioctl(SIOCGIFCONF): %s",
|
||||
strerror(errno));
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
/* if the return size plus a 512 byte "buffer zone" is less than
|
||||
* the buffer we passed in (bufsize), we're done. otherwise
|
||||
* allocate a bigger buffer and try again. with a too-small
|
||||
* buffer, some implementations (freebsd) will fill the buffer
|
||||
* best it can (leaving a gap - returning <=bufsize) and others
|
||||
* (linux) will return a buffer length the same size as passed
|
||||
* in (==bufsize). so, we'll assume a 512 byte gap would have
|
||||
* been big enough to put one more record and as long as we have
|
||||
* that "buffer zone", we should have all the interfaces.
|
||||
*/
|
||||
if (ifc.ifc_len + 512 < bufsize)
|
||||
break;
|
||||
free(ifc.ifc_req);
|
||||
bufsize += 2048;
|
||||
}
|
||||
|
||||
/* this is probably way overkill, but better to kill a few bytes
|
||||
* than loop through looking for valid interfaces that are up
|
||||
* twice, huh?
|
||||
*/
|
||||
count = ifc.ifc_len / sizeof(*ifr);
|
||||
CONDDEBUG((1, "ProbeInterfaces(): ifc_len==%d max_count==%d",
|
||||
ifc.ifc_len, count));
|
||||
|
||||
/* set up myAddrs array */
|
||||
if (myAddrs != (struct in_addr *)0)
|
||||
free(myAddrs);
|
||||
myAddrs = (struct in_addr *)0;
|
||||
if (count == 0) {
|
||||
free(ifc.ifc_req);
|
||||
close(sock);
|
||||
return;
|
||||
}
|
||||
myAddrs = (struct in_addr *)calloc(count + 1, sizeof(struct in_addr));
|
||||
if (myAddrs == (struct in_addr *)0)
|
||||
OutOfMem();
|
||||
|
||||
for (m = r = 0; r < ifc.ifc_len;) {
|
||||
struct sockaddr *sa;
|
||||
ifr = (struct ifreq *)&ifc.ifc_buf[r];
|
||||
sa = (struct sockaddr *)&ifr->ifr_addr;
|
||||
/* don't use less than a ifreq sized chunk */
|
||||
if ((ifc.ifc_len - r) < sizeof(*ifr))
|
||||
break;
|
||||
#ifdef HAVE_SA_LEN
|
||||
if (sa->sa_len > sizeof(ifr->ifr_addr))
|
||||
r += sizeof(ifr->ifr_name) + sa->sa_len;
|
||||
else
|
||||
#endif
|
||||
r += sizeof(*ifr);
|
||||
|
||||
if (sa->sa_family == AF_INET) {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
#ifdef SIOCGIFFLAGS
|
||||
/* make sure the interface is up */
|
||||
ifrcopy = *ifr;
|
||||
if ((ioctl(sock, SIOCGIFFLAGS, &ifrcopy) == 0) &&
|
||||
((ifrcopy.ifr_flags & IFF_UP) == 0))
|
||||
while (1) {
|
||||
if (stat(d, &dstat) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
if (mkdir(d, 0755) == -1) {
|
||||
Error("mkdir(%s): %s", d, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
CONDDEBUG((1, "VerifyEmptyDirectory: created `%s'", d));
|
||||
continue;
|
||||
#endif
|
||||
CONDDEBUG((1, "ProbeInterfaces(): name=%s addr=%s",
|
||||
ifr->ifr_name, inet_ntoa(sin->sin_addr)));
|
||||
#if HAVE_MEMCPY
|
||||
memcpy(&myAddrs[m], &(sin->sin_addr), sizeof(struct in_addr));
|
||||
#else
|
||||
bcopy(&(sin->sin_addr), &myAddrs[m], sizeof(struct in_addr));
|
||||
#endif
|
||||
Verbose("interface address %s (%s)", inet_ntoa(myAddrs[m]),
|
||||
ifr->ifr_name);
|
||||
m++;
|
||||
} else {
|
||||
Error("stat(%s): %s", d, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m == 0) {
|
||||
free(myAddrs);
|
||||
myAddrs = (struct in_addr *)0;
|
||||
}
|
||||
close(sock);
|
||||
free(ifc.ifc_req);
|
||||
#else /* use the hostname like the old code did (but use all addresses!) */
|
||||
int count;
|
||||
struct hostent *he;
|
||||
|
||||
/* if we use -M, just fill the array with that interface */
|
||||
if (bindAddr != INADDR_ANY) {
|
||||
myAddrs = (struct in_addr *)calloc(2, sizeof(struct in_addr));
|
||||
if (myAddrs == (struct in_addr *)0)
|
||||
OutOfMem();
|
||||
#if HAVE_MEMCPY
|
||||
memcpy(&(myAddrs[0].s_addr), &bindAddr, sizeof(in_addr_t));
|
||||
#else
|
||||
bcopy(&bindAddr, &(myAddrs[0].s_addr), sizeof(in_addr_t));
|
||||
#endif
|
||||
Verbose("interface address %s (-M option)", inet_ntoa(myAddrs[0]));
|
||||
return;
|
||||
if (S_ISDIR(dstat.st_mode))
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Verbose("using hostname for interface addresses");
|
||||
if ((struct hostent *)0 == (he = gethostbyname(myHostname))) {
|
||||
Error("ProbeInterfaces(): gethostbyname(%s): %s", myHostname,
|
||||
hstrerror(h_errno));
|
||||
return;
|
||||
}
|
||||
if (4 != he->h_length || AF_INET != he->h_addrtype) {
|
||||
Error
|
||||
("ProbeInterfaces(): gethostbyname(%s): wrong address size (4 != %d) or address family (%d != %d)",
|
||||
myHostname, he->h_length, AF_INET, he->h_addrtype);
|
||||
return;
|
||||
/* now make sure it's empty...erase anything you see, etc */
|
||||
if ((dir = opendir(d)) == (DIR *) 0) {
|
||||
Error("opendir(%s): %s", d, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (count = 0; he->h_addr_list[count] != (char *)0; count++);
|
||||
if (myAddrs != (struct in_addr *)0)
|
||||
free(myAddrs);
|
||||
myAddrs = (struct in_addr *)0;
|
||||
if (count == 0)
|
||||
return;
|
||||
myAddrs = (struct in_addr *)calloc(count + 1, sizeof(struct in_addr));
|
||||
if (myAddrs == (struct in_addr *)0)
|
||||
OutOfMem();
|
||||
for (count--; count >= 0; count--) {
|
||||
#if HAVE_MEMCPY
|
||||
memcpy(&(myAddrs[count].s_addr), he->h_addr_list[count],
|
||||
he->h_length);
|
||||
#else
|
||||
bcopy(he->h_addr_list[count], &(myAddrs[count].s_addr),
|
||||
he->h_length);
|
||||
while ((de = readdir(dir)) != (struct dirent *)0) {
|
||||
if ((strcmp(de->d_name, ".") == 0) ||
|
||||
(strcmp(de->d_name, "..") == 0))
|
||||
continue;
|
||||
/* we're going to just let the user deal with non-empty directories */
|
||||
Error("non-empty directory `%s'", d);
|
||||
retval = -1;
|
||||
break;
|
||||
/* this is probably too extreme. if someone happens to point conserver
|
||||
* at /etc, for example, it could (if running as root) nuke the password
|
||||
* database, config files, etc. too many important files could be
|
||||
* shredded with a small typo.
|
||||
*/
|
||||
#if 0
|
||||
if (path == (STRING *)0)
|
||||
path = AllocString();
|
||||
BuildStringPrint(path, "%s/%s", d, de->d_name);
|
||||
if (stat(path->string, &dstat) == -1) {
|
||||
Error("stat(%s): %s", path->string, strerror(errno));
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
if (S_ISDIR(dstat.st_mode)) {
|
||||
if (rmdir(path->string) != 0) {
|
||||
Error("rmdir(%s): %s", path->string, strerror(errno));
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (unlink(path->string) != 0) {
|
||||
Error("unlink(%s): %s", path->string, strerror(errno));
|
||||
retval = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Verbose("interface address %s (hostname address)",
|
||||
inet_ntoa(myAddrs[count]));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (path != (STRING *)0)
|
||||
DestroyString(path);
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* find out where/who we are (ksb)
|
||||
* parse optons
|
||||
@ -1133,7 +1087,7 @@ main(argc, argv)
|
||||
{
|
||||
int i;
|
||||
FILE *fpConfig = (FILE *)0;
|
||||
static char acOpts[] = "7a:b:c:C:dDEFhiL:m:M:noO:p:P:RSuVv";
|
||||
static char acOpts[] = "7a:b:c:C:dDEFhiL:m:M:noO:p:P:RSuU:Vv";
|
||||
extern int optopt;
|
||||
extern char *optarg;
|
||||
struct passwd *pwd;
|
||||
@ -1141,17 +1095,19 @@ main(argc, argv)
|
||||
char *curuser = (char *)0;
|
||||
int curuid = 0;
|
||||
GRPENT *pGE = (GRPENT *)0;
|
||||
#if !USE_UNIX_DOMAIN_SOCKETS
|
||||
#if HAVE_INET_ATON
|
||||
struct in_addr inetaddr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
isMultiProc = 1; /* make sure stuff has the pid */
|
||||
|
||||
thepid = getpid();
|
||||
if ((char *)0 == (progname = strrchr(argv[0], '/'))) {
|
||||
progname = StrDup(argv[0]);
|
||||
progname = argv[0];
|
||||
} else {
|
||||
progname = StrDup(++progname);
|
||||
++progname;
|
||||
}
|
||||
|
||||
setpwent();
|
||||
@ -1213,7 +1169,7 @@ main(argc, argv)
|
||||
#endif
|
||||
break;
|
||||
case 'C':
|
||||
pcConfig = StrDup(optarg);
|
||||
pcConfig = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
optConf->daemonmode = FLAGTRUE;
|
||||
@ -1273,11 +1229,15 @@ main(argc, argv)
|
||||
optConf->redirect = FLAGFALSE;
|
||||
break;
|
||||
case 'S':
|
||||
fSyntaxOnly = 1;
|
||||
fSyntaxOnly++;
|
||||
break;
|
||||
case 'u':
|
||||
fAll = 1;
|
||||
break;
|
||||
case 'U':
|
||||
if ((optConf->unifiedlog = StrDup(optarg)) == (char *)0)
|
||||
OutOfMem();
|
||||
break;
|
||||
case 'V':
|
||||
fVersion = 1;
|
||||
break;
|
||||
@ -1336,38 +1296,50 @@ main(argc, argv)
|
||||
if (fSyntaxOnly)
|
||||
Msg("performing configuration file syntax check");
|
||||
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
/* Don't do any redirects if we're purely local
|
||||
* (but it allows them to see where remote consoles are)
|
||||
*/
|
||||
optConf->redirect = FLAGFALSE;
|
||||
if (interface == (char *)0)
|
||||
interface = UDSDIR;
|
||||
#else
|
||||
/* set up the address to bind to */
|
||||
if (interface == (char *)0 ||
|
||||
(interface[0] == '*' && interface[1] == '\000'))
|
||||
bindAddr = INADDR_ANY;
|
||||
else {
|
||||
#if HAVE_INET_ATON
|
||||
# if HAVE_INET_ATON
|
||||
if (inet_aton(interface, &inetaddr) == 0) {
|
||||
Error("inet_aton(%s): %s", interface, "invalid IP address");
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
bindAddr = inetaddr.s_addr;
|
||||
#else
|
||||
# else
|
||||
bindAddr = inet_addr(interface);
|
||||
if (bindAddr == (in_addr_t) (-1)) {
|
||||
Error("inet_addr(%s): %s", interface, "invalid IP address");
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
if (fDebug) {
|
||||
struct in_addr ba;
|
||||
ba.s_addr = bindAddr;
|
||||
CONDDEBUG((1, "main(): bind address set to `%s'", inet_ntoa(ba)));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* must do all this so IsMe() works right */
|
||||
if (gethostname(myHostname, MAXHOSTNAME) != 0) {
|
||||
Error("gethostname(): %s", interface, strerror(errno));
|
||||
Error("gethostname(): %s", strerror(errno));
|
||||
Bye(EX_OSERR);
|
||||
}
|
||||
ProbeInterfaces();
|
||||
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"))) {
|
||||
@ -1377,6 +1349,7 @@ main(argc, argv)
|
||||
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);
|
||||
@ -1400,8 +1373,7 @@ main(argc, argv)
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 ==
|
||||
(pSE = getservbyname(config->primaryport, "tcp"))) {
|
||||
Error("getservbyname(%s): %s", config->primaryport,
|
||||
strerror(errno));
|
||||
Error("getservbyname(%s) failed", config->primaryport);
|
||||
Bye(EX_OSERR);
|
||||
} else {
|
||||
bindPort = ntohs((unsigned short)pSE->s_port);
|
||||
@ -1431,13 +1403,13 @@ main(argc, argv)
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 ==
|
||||
(pSE = getservbyname(config->secondaryport, "tcp"))) {
|
||||
Error("getservbyname(%s): %s", config->secondaryport,
|
||||
strerror(errno));
|
||||
Error("getservbyname(%s) failed", config->secondaryport);
|
||||
Bye(EX_OSERR);
|
||||
} else {
|
||||
bindBasePort = ntohs((unsigned short)pSE->s_port);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (optConf->passwdfile != (char *)0)
|
||||
config->passwdfile = StrDup(optConf->passwdfile);
|
||||
@ -1492,6 +1464,27 @@ main(argc, argv)
|
||||
else
|
||||
config->loghostnames = defConfig.loghostnames;
|
||||
|
||||
if (optConf->unifiedlog != (char *)0) {
|
||||
config->unifiedlog = StrDup(optConf->unifiedlog);
|
||||
if (config->unifiedlog == (char *)0)
|
||||
OutOfMem();
|
||||
} else if (pConfig->unifiedlog != (char *)0) {
|
||||
config->unifiedlog = StrDup(pConfig->unifiedlog);
|
||||
if (config->unifiedlog == (char *)0)
|
||||
OutOfMem();
|
||||
} else if (defConfig.unifiedlog != (char *)0) {
|
||||
config->unifiedlog = StrDup(defConfig.unifiedlog);
|
||||
if (config->unifiedlog == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
if (optConf->initdelay != 0)
|
||||
config->initdelay = optConf->initdelay;
|
||||
else if (pConfig->initdelay != 0)
|
||||
config->initdelay = pConfig->initdelay;
|
||||
else
|
||||
config->initdelay = defConfig.initdelay;
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
if (optConf->sslrequired != FLAGUNKNOWN)
|
||||
config->sslrequired = optConf->sslrequired;
|
||||
@ -1508,13 +1501,28 @@ main(argc, argv)
|
||||
config->sslcredentials = StrDup(defConfig.sslcredentials);
|
||||
#endif
|
||||
|
||||
#if HAVE_SETPROCTITLE
|
||||
if (optConf->setproctitle != FLAGUNKNOWN)
|
||||
config->setproctitle = optConf->setproctitle;
|
||||
else if (pConfig->setproctitle != FLAGUNKNOWN)
|
||||
config->setproctitle = pConfig->setproctitle;
|
||||
else
|
||||
config->setproctitle = defConfig.setproctitle;
|
||||
#endif
|
||||
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_MAIN
|
||||
dmallocMarkMain = dmalloc_mark();
|
||||
#endif
|
||||
|
||||
if (pGroups == (GRPENT *)0 && pRCList == (REMOTE *)0) {
|
||||
Error("no consoles found in configuration file");
|
||||
} else if (!fSyntaxOnly) {
|
||||
} else if (fSyntaxOnly) {
|
||||
/* short-circuit */
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
} else if (VerifyEmptyDirectory(interface) == -1) {
|
||||
Error("Master(): %s: unusable socket directory", interface);
|
||||
#endif
|
||||
} else {
|
||||
#if HAVE_OPENSSL
|
||||
/* Prep the SSL layer */
|
||||
SetupSSL();
|
||||
@ -1523,6 +1531,8 @@ main(argc, argv)
|
||||
if (config->daemonmode == FLAGTRUE)
|
||||
Daemonize();
|
||||
|
||||
ReopenUnifiedlog();
|
||||
|
||||
/* if no one can use us we need to come up with a default
|
||||
*/
|
||||
if (pACList == (ACCESS *)0)
|
||||
@ -1535,7 +1545,6 @@ main(argc, argv)
|
||||
continue;
|
||||
|
||||
Spawn(pGE);
|
||||
|
||||
Verbose("group #%d pid %lu on port %hu", pGE->id,
|
||||
(unsigned long)pGE->pid, pGE->port);
|
||||
}
|
||||
@ -1549,8 +1558,13 @@ main(argc, argv)
|
||||
local += pGE->imembers;
|
||||
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
|
||||
remote++;
|
||||
# if USE_UNIX_DOMAIN_SOCKETS
|
||||
setproctitle("master: port 0, %d local, %d remote", local,
|
||||
remote);
|
||||
#else
|
||||
setproctitle("master: port %hu, %d local, %d remote", bindPort,
|
||||
local, remote);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1584,6 +1598,9 @@ main(argc, argv)
|
||||
SignalKids(SIGTERM);
|
||||
}
|
||||
|
||||
if (unifiedlog != (CONSFILE *)0)
|
||||
FileClose(&unifiedlog);
|
||||
|
||||
DumpDataStructures();
|
||||
|
||||
Msg("terminated");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.h,v 5.50 2003-10-19 22:52:37-07 bryan Exp $
|
||||
* $Id: main.h,v 5.53 2004/05/21 04:15:17 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -44,12 +44,16 @@ extern unsigned short bindPort, bindBasePort;
|
||||
extern char *pcConfig;
|
||||
extern int cMaxMemb;
|
||||
extern struct sockaddr_in in_port;
|
||||
extern int isMaster;
|
||||
extern CONFIG *optConf;
|
||||
extern CONFIG *config;
|
||||
extern CONFIG defConfig;
|
||||
extern CONSFILE *unifiedlog;
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
extern char *interface;
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL_CTX *ctx;
|
||||
#endif
|
||||
extern void ReopenLogfile PARAMS((void));
|
||||
extern void ReopenUnifiedlog PARAMS((void));
|
||||
extern void DumpDataStructures PARAMS((void));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.c,v 5.118 2003-10-10 03:29:21-07 bryan Exp $
|
||||
* $Id: master.c,v 5.126 2004/05/06 02:09:07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
@ -433,7 +433,7 @@ DoNormalRead(pCLServing)
|
||||
{
|
||||
char *pcCmd;
|
||||
char *pcArgs;
|
||||
int nr, i;
|
||||
int nr, i, l;
|
||||
unsigned char acIn[BUFSIZ];
|
||||
|
||||
/* read connection */
|
||||
@ -442,212 +442,229 @@ DoNormalRead(pCLServing)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < nr; ++i) {
|
||||
if ('\n' != acIn[i]) {
|
||||
BuildStringChar(acIn[i], pCLServing->accmd);
|
||||
while ((l = ParseIACBuf(pCLServing->fd, acIn, &nr)) >= 0) {
|
||||
if (l == 0) /* we ignore special OB_IAC stuff */
|
||||
continue;
|
||||
}
|
||||
if ((pCLServing->accmd->used > 1) &&
|
||||
('\r' ==
|
||||
pCLServing->accmd->string[pCLServing->accmd->used - 2])) {
|
||||
pCLServing->accmd->string[pCLServing->accmd->used - 2] =
|
||||
'\000';
|
||||
pCLServing->accmd->used--;
|
||||
}
|
||||
for (i = 0; i < l; ++i) {
|
||||
if ('\n' != acIn[i]) {
|
||||
BuildStringChar(acIn[i], pCLServing->accmd);
|
||||
continue;
|
||||
}
|
||||
if ((pCLServing->accmd->used > 1) &&
|
||||
('\r' ==
|
||||
pCLServing->accmd->string[pCLServing->accmd->used - 2])) {
|
||||
pCLServing->accmd->string[pCLServing->accmd->used - 2] =
|
||||
'\000';
|
||||
pCLServing->accmd->used--;
|
||||
}
|
||||
|
||||
/* process password here...before we corrupt accmd */
|
||||
if (pCLServing->iState == S_PASSWD) {
|
||||
if (CheckPasswd(pCLServing, pCLServing->accmd->string) !=
|
||||
AUTH_SUCCESS) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"invalid password\r\n", -1);
|
||||
/* process password here...before we corrupt accmd */
|
||||
if (pCLServing->iState == S_PASSWD) {
|
||||
if (CheckPasswd(pCLServing, pCLServing->accmd->string) !=
|
||||
AUTH_SUCCESS) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"invalid password\r\n", -1);
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
}
|
||||
Verbose("<master> login %s", pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", 4);
|
||||
pCLServing->iState = S_NORMAL;
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
Verbose("<master> login %s", pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
pCLServing->iState = S_NORMAL;
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((char *)0 != (pcArgs = strchr(pCLServing->accmd->string, ':'))) {
|
||||
*pcArgs++ = '\000';
|
||||
} else if ((char *)0 !=
|
||||
(pcArgs = strchr(pCLServing->accmd->string, ' '))) {
|
||||
*pcArgs++ = '\000';
|
||||
}
|
||||
if (pcArgs != (char *)0)
|
||||
pcArgs = PruneSpace(pcArgs);
|
||||
pcCmd = PruneSpace(pCLServing->accmd->string);
|
||||
if (strcmp(pcCmd, "help") == 0) {
|
||||
static char *apcHelp1[] = {
|
||||
"exit disconnect\r\n",
|
||||
"help this help message\r\n",
|
||||
"login log in\r\n",
|
||||
#if HAVE_OPENSSL
|
||||
"ssl start ssl session\r\n",
|
||||
#endif
|
||||
(char *)0
|
||||
};
|
||||
static char *apcHelp2[] = {
|
||||
"call provide port for given console\r\n",
|
||||
"exit disconnect\r\n",
|
||||
"groups provide ports for group leaders\r\n",
|
||||
"help this help message\r\n",
|
||||
"master provide a list of master servers\r\n",
|
||||
"pid provide pid of master process\r\n",
|
||||
"quit* terminate conserver (SIGTERM)\r\n",
|
||||
"restart* restart conserver (SIGHUP)\r\n",
|
||||
"version provide version info for server\r\n",
|
||||
"* = requires admin privileges\r\n",
|
||||
(char *)0
|
||||
};
|
||||
char **ppc;
|
||||
for (ppc =
|
||||
(pCLServing->iState == S_IDENT ? apcHelp1 : apcHelp2);
|
||||
(char *)0 != *ppc; ++ppc) {
|
||||
FileWrite(pCLServing->fd, FLAGTRUE, *ppc, -1);
|
||||
if ((char *)0 !=
|
||||
(pcArgs = strchr(pCLServing->accmd->string, ':'))) {
|
||||
*pcArgs++ = '\000';
|
||||
} else if ((char *)0 !=
|
||||
(pcArgs = strchr(pCLServing->accmd->string, ' '))) {
|
||||
*pcArgs++ = '\000';
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, (char *)0, 0);
|
||||
} else if (strcmp(pcCmd, "exit") == 0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "goodbye\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
if (pcArgs != (char *)0)
|
||||
pcArgs = PruneSpace(pcArgs);
|
||||
pcCmd = PruneSpace(pCLServing->accmd->string);
|
||||
if (strcmp(pcCmd, "help") == 0) {
|
||||
static char *apcHelp1[] = {
|
||||
"exit disconnect\r\n",
|
||||
"help this help message\r\n",
|
||||
"login log in\r\n",
|
||||
#if HAVE_OPENSSL
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "ssl") == 0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
if (!AttemptSSL(pCLServing)) {
|
||||
"ssl start ssl session\r\n",
|
||||
#endif
|
||||
(char *)0
|
||||
};
|
||||
static char *apcHelp2[] = {
|
||||
"call provide port for given console\r\n",
|
||||
"exit disconnect\r\n",
|
||||
"groups provide ports for group leaders\r\n",
|
||||
"help this help message\r\n",
|
||||
"master provide a list of master servers\r\n",
|
||||
"pid provide pid of master process\r\n",
|
||||
"quit* terminate conserver (SIGTERM)\r\n",
|
||||
"restart* restart conserver (SIGHUP)\r\n",
|
||||
"version provide version info for server\r\n",
|
||||
"* = requires admin privileges\r\n",
|
||||
(char *)0
|
||||
};
|
||||
char **ppc;
|
||||
for (ppc =
|
||||
(pCLServing->iState == S_IDENT ? apcHelp1 : apcHelp2);
|
||||
(char *)0 != *ppc; ++ppc) {
|
||||
FileWrite(pCLServing->fd, FLAGTRUE, *ppc, -1);
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, (char *)0, 0);
|
||||
} else if (strcmp(pcCmd, "exit") == 0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "goodbye\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "login") == 0) {
|
||||
#if HAVE_OPENSSL
|
||||
if (config->sslrequired == FLAGTRUE &&
|
||||
FileGetType(pCLServing->fd) != SSLSocket) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"encryption required\r\n", -1);
|
||||
} else {
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "ssl") == 0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
if (!AttemptSSL(pCLServing)) {
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (pcArgs == (char *)0) {
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "login") == 0) {
|
||||
#if HAVE_OPENSSL
|
||||
if (config->sslrequired == FLAGTRUE &&
|
||||
FileGetType(pCLServing->fd) != SSLSocket) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"login requires argument\r\n", -1);
|
||||
"encryption required\r\n", -1);
|
||||
} else {
|
||||
BuildString((char *)0, pCLServing->username);
|
||||
BuildString((char *)0, pCLServing->acid);
|
||||
BuildString(pcArgs, pCLServing->username);
|
||||
BuildString(pcArgs, pCLServing->acid);
|
||||
BuildStringChar('@', pCLServing->acid);
|
||||
BuildString(pCLServing->peername->string,
|
||||
pCLServing->acid);
|
||||
if (pCLServing->caccess == 't' ||
|
||||
CheckPasswd(pCLServing, "") == AUTH_SUCCESS) {
|
||||
pCLServing->iState = S_NORMAL;
|
||||
Verbose("<master> login %s",
|
||||
pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
} else {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE,
|
||||
"passwd? %s\r\n", myHostname);
|
||||
pCLServing->iState = S_PASSWD;
|
||||
}
|
||||
}
|
||||
#if HAVE_OPENSSL
|
||||
}
|
||||
#endif
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "master") == 0) {
|
||||
int iSep = 1;
|
||||
|
||||
if ((GRPENT *)0 != pGroups) {
|
||||
struct sockaddr_in lcl;
|
||||
socklen_t so = sizeof(lcl);
|
||||
if (-1 ==
|
||||
getsockname(FileFDNum(pCLServing->fd),
|
||||
(struct sockaddr *)&lcl, &so)) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"getsockname failed, try again later\r\n",
|
||||
-1);
|
||||
Error("Master(): getsockname(%u): %s",
|
||||
FileFDNum(pCLServing->fd), strerror(errno));
|
||||
Bye(EX_OSERR);
|
||||
if (pcArgs == (char *)0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"login requires argument\r\n", -1);
|
||||
} else {
|
||||
BuildString((char *)0, pCLServing->username);
|
||||
BuildString((char *)0, pCLServing->acid);
|
||||
BuildString(pcArgs, pCLServing->username);
|
||||
BuildString(pcArgs, pCLServing->acid);
|
||||
BuildStringChar('@', pCLServing->acid);
|
||||
BuildString(pCLServing->peername->string,
|
||||
pCLServing->acid);
|
||||
if (pCLServing->caccess == 't' ||
|
||||
CheckPasswd(pCLServing, "") == AUTH_SUCCESS) {
|
||||
pCLServing->iState = S_NORMAL;
|
||||
Verbose("<master> login %s",
|
||||
pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n",
|
||||
4);
|
||||
} else {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE,
|
||||
"passwd? %s\r\n", myHostname);
|
||||
pCLServing->iState = S_PASSWD;
|
||||
}
|
||||
}
|
||||
#if HAVE_OPENSSL
|
||||
}
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
|
||||
inet_ntoa(lcl.sin_addr));
|
||||
iSep = 0;
|
||||
}
|
||||
if (config->redirect == FLAGTRUE) {
|
||||
REMOTE *pRC;
|
||||
for (pRC = pRCUniq; (REMOTE *)0 != pRC; pRC = pRC->pRCuniq) {
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, ":@%s" + iSep,
|
||||
pRC->rhost);
|
||||
#endif
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "master") == 0) {
|
||||
int iSep = 1;
|
||||
|
||||
if ((GRPENT *)0 != pGroups) {
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@0");
|
||||
iSep = 0;
|
||||
#else
|
||||
struct sockaddr_in lcl;
|
||||
socklen_t so = sizeof(lcl);
|
||||
if (-1 ==
|
||||
getsockname(FileFDNum(pCLServing->fd),
|
||||
(struct sockaddr *)&lcl, &so)) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"getsockname failed, try again later\r\n",
|
||||
-1);
|
||||
Error("Master(): getsockname(%u): %s",
|
||||
FileFDNum(pCLServing->fd), strerror(errno));
|
||||
iSep = -1;
|
||||
} else {
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
|
||||
inet_ntoa(lcl.sin_addr));
|
||||
iSep = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (iSep >= 0) {
|
||||
if (config->redirect == FLAGTRUE) {
|
||||
REMOTE *pRC;
|
||||
for (pRC = pRCUniq; (REMOTE *)0 != pRC;
|
||||
pRC = pRC->pRCuniq) {
|
||||
FilePrint(pCLServing->fd, FLAGTRUE,
|
||||
":@%s" + iSep, pRC->rhost);
|
||||
iSep = 0;
|
||||
}
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
|
||||
}
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "pid") == 0) {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "%lu\r\n",
|
||||
(unsigned long)thepid);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "version") == 0) {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
|
||||
THIS_VERSION);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "quit") == 0) {
|
||||
if (ConsentUserOk(pADList, pCLServing->username->string) ==
|
||||
1) {
|
||||
Verbose("quit command by %s",
|
||||
pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- terminated\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
kill(thepid, SIGTERM);
|
||||
return;
|
||||
} else
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "restart") == 0) {
|
||||
if (ConsentUserOk(pADList, pCLServing->username->string) ==
|
||||
1) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- restarting\r\n", -1);
|
||||
Verbose("restart 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, "groups") == 0) {
|
||||
int iSep = 1;
|
||||
GRPENT *pGE;
|
||||
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers)
|
||||
continue;
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, ":%hu" + iSep,
|
||||
pGE->port);
|
||||
iSep = 0;
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", 2);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "call") == 0) {
|
||||
if (pcArgs == (char *)0)
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"call requires argument\r\n", -1);
|
||||
else
|
||||
CommandCall(pCLServing, pcArgs);
|
||||
} else {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "unknown command\r\n",
|
||||
-1);
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "pid") == 0) {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "%lu\r\n",
|
||||
(unsigned long)thepid);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "version") == 0) {
|
||||
FilePrint(pCLServing->fd, FLAGFALSE, "version `%s'\r\n",
|
||||
THIS_VERSION);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "quit") == 0) {
|
||||
if (ConsentFindUser(pADList, pCLServing->username->string) !=
|
||||
(CONSENTUSERS *)0 ||
|
||||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
|
||||
Verbose("quit command by %s", pCLServing->acid->string);
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- terminated\r\n", -1);
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
kill(thepid, SIGTERM);
|
||||
return;
|
||||
} else
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "restart") == 0) {
|
||||
if (ConsentFindUser(pADList, pCLServing->username->string) !=
|
||||
(CONSENTUSERS *)0 ||
|
||||
ConsentFindUser(pADList, "*") != (CONSENTUSERS *)0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- restarting\r\n", -1);
|
||||
Verbose("restart 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, "groups") == 0) {
|
||||
int iSep = 1;
|
||||
GRPENT *pGE;
|
||||
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers)
|
||||
continue;
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, ":%hu" + iSep,
|
||||
pGE->port);
|
||||
iSep = 0;
|
||||
}
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "call") == 0) {
|
||||
if (pcArgs == (char *)0)
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"call requires argument\r\n", -1);
|
||||
else
|
||||
CommandCall(pCLServing, pcArgs);
|
||||
} else {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "unknown command\r\n",
|
||||
-1);
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
}
|
||||
BuildString((char *)0, pCLServing->accmd);
|
||||
nr -= l;
|
||||
MemMove(acIn, acIn + l, nr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,8 +681,13 @@ Master()
|
||||
int msfd;
|
||||
socklen_t so;
|
||||
fd_set rmask, wmask;
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
struct sockaddr_un master_port;
|
||||
static STRING *portPath = (STRING *)0;
|
||||
#else
|
||||
struct sockaddr_in master_port;
|
||||
int true = 1;
|
||||
#endif
|
||||
FILE *fp;
|
||||
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCL = (CONSCLIENT *)0;
|
||||
@ -706,6 +728,40 @@ Master()
|
||||
#else
|
||||
bzero((char *)&master_port, sizeof(master_port));
|
||||
#endif
|
||||
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
master_port.sun_family = AF_UNIX;
|
||||
|
||||
if (portPath == (STRING *)0)
|
||||
portPath = AllocString();
|
||||
BuildStringPrint(portPath, "%s/0", interface);
|
||||
if (portPath->used > sizeof(master_port.sun_path)) {
|
||||
Error("Master(): path to socket too long: %s", portPath->string);
|
||||
return;
|
||||
}
|
||||
strcpy(master_port.sun_path, portPath->string);
|
||||
|
||||
if ((msfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
Error("Master(): socket(AF_UNIX,SOCK_STREAM): %s",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SetFlags(msfd, O_NONBLOCK, 0))
|
||||
return;
|
||||
|
||||
if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port)) <
|
||||
0) {
|
||||
Error("Master(): bind(%s): %s", master_port.sun_path,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
if (listen(msfd, SOMAXCONN) < 0) {
|
||||
Error("Master(): listen(%s): %s", master_port.sun_path,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
master_port.sin_family = AF_INET;
|
||||
master_port.sin_addr.s_addr = bindAddr;
|
||||
master_port.sin_port = htons(bindPort);
|
||||
@ -715,7 +771,7 @@ Master()
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#if HAVE_SETSOCKOPT
|
||||
# if HAVE_SETSOCKOPT
|
||||
if (setsockopt
|
||||
(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true,
|
||||
sizeof(true)) < 0) {
|
||||
@ -723,7 +779,7 @@ Master()
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (!SetFlags(msfd, O_NONBLOCK, 0))
|
||||
return;
|
||||
@ -739,6 +795,7 @@ Master()
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
fp = fopen(PIDFILE, "w");
|
||||
if (fp) {
|
||||
@ -762,6 +819,7 @@ Master()
|
||||
fSawHUP = 0;
|
||||
Msg("processing SIGHUP");
|
||||
ReopenLogfile();
|
||||
ReopenUnifiedlog();
|
||||
SignalKids(SIGHUP);
|
||||
ReReadCfg(msfd);
|
||||
/* fix up the client descriptors since ReReadCfg() doesn't
|
||||
@ -783,6 +841,7 @@ Master()
|
||||
fSawUSR2 = 0;
|
||||
Msg("processing SIGUSR2");
|
||||
ReopenLogfile();
|
||||
ReopenUnifiedlog();
|
||||
SignalKids(SIGUSR2);
|
||||
}
|
||||
if (fSawQuit) { /* Something above set the quit flag */
|
||||
@ -874,9 +933,10 @@ Master()
|
||||
}
|
||||
|
||||
/* set to non-blocking and wrap in a File object */
|
||||
if (SetFlags(cfd, O_NONBLOCK, 0))
|
||||
if (SetFlags(cfd, O_NONBLOCK, 0)) {
|
||||
pCLmfree->fd = FileOpenFD(cfd, simpleSocket);
|
||||
else
|
||||
FileSetQuoteIAC(pCLmfree->fd, FLAGTRUE);
|
||||
} else
|
||||
pCLmfree->fd = (CONSFILE *)0;
|
||||
|
||||
if ((CONSFILE *)0 == pCLmfree->fd) {
|
||||
@ -925,11 +985,16 @@ Master()
|
||||
if (ClientAccessOk(pCL)) {
|
||||
pCL->ioState = ISNORMAL;
|
||||
/* say hi to start */
|
||||
FileWrite(pCL->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
FileWrite(pCL->fd, FLAGFALSE, "ok\r\n", 4);
|
||||
} else
|
||||
DropMasterClient(pCL, FLAGFALSE);
|
||||
}
|
||||
|
||||
close(msfd);
|
||||
#if USE_UNIX_DOMAIN_SOCKETS
|
||||
unlink(master_port.sun_path);
|
||||
#endif
|
||||
|
||||
/* clean up the free list */
|
||||
while (pCLmfree != (CONSCLIENT *)0) {
|
||||
pCL = pCLmfree->pCLnext;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.h,v 5.17 2003-10-03 07:23:37-07 bryan Exp $
|
||||
* $Id: master.h,v 5.17 2003/10/03 14:23:37 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
|
1436
conserver/readcfg.c
1436
conserver/readcfg.c
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,13 @@
|
||||
/*
|
||||
* $Id: readcfg.h,v 5.36 2003-10-31 09:54:44-08 bryan Exp $
|
||||
* $Id: readcfg.h,v 5.40 2004/05/25 23:03:01 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#define BREAKDELAYDEFAULT 250
|
||||
|
||||
typedef struct config {
|
||||
STRING *name;
|
||||
char defaultaccess;
|
||||
@ -17,6 +19,8 @@ typedef struct config {
|
||||
FLAG loghostnames;
|
||||
int reinitcheck;
|
||||
char *secondaryport;
|
||||
char *unifiedlog;
|
||||
int initdelay;
|
||||
#if HAVE_SETPROCTITLE
|
||||
FLAG setproctitle;
|
||||
#endif
|
||||
@ -39,6 +43,7 @@ extern ACCESS *pACList; /* `who do you love' (or trust) */
|
||||
extern CONSENTUSERS *pADList; /* list of admin users */
|
||||
extern BREAKS breakList[9]; /* list of break sequences */
|
||||
extern CONFIG *pConfig; /* settings seen by config parser */
|
||||
extern SUBST *substData; /* substitution function data */
|
||||
|
||||
extern void ReadCfg PARAMS((char *, FILE *));
|
||||
extern void ReReadCfg PARAMS((int));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: version.h,v 1.51 2003-10-31 10:04:19-08 bryan Exp $
|
||||
* $Id: version.h,v 1.62 2004/05/23 16:44:45 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -14,4 +14,4 @@
|
||||
@(#) Copyright 2000 conserver.com.\n\
|
||||
All rights reserved.\n"
|
||||
|
||||
#define THIS_VERSION "conserver.com version 8.0.5"
|
||||
#define THIS_VERSION "conserver.com version 8.1.6"
|
||||
|
@ -15,7 +15,7 @@ MKDIR = @MKDIR@
|
||||
|
||||
### Compiler and link options
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ # -DPUCC -DSUN5
|
||||
CFLAGS = @CFLAGS@
|
||||
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/conserver $(DEFS) @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
@ -25,18 +25,23 @@ LIBS = @LIBS@
|
||||
|
||||
### Makefile rules - no user-servicable parts below
|
||||
|
||||
CONSOLE_OBJS = console.o getpassword.o ../conserver/util.o
|
||||
CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h $(top_srcdir)/conserver/port.h
|
||||
CONSOLE_OBJS = console.o getpassword.o readconf.o ../conserver/cutil.o
|
||||
CONSOLE_HDRS = ../config.h $(top_srcdir)/compat.h \
|
||||
$(top_srcdir)/conserver/cutil.h \
|
||||
$(top_srcdir)/conserver/version.h \
|
||||
$(srcdir)/getpassword.h $(srcdir)/readconf.h
|
||||
ALL = console
|
||||
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
$(CONSOLE_OBJS): $(CONSOLE_HDRS)
|
||||
|
||||
console: $(CONSOLE_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
|
||||
|
||||
../conserver/util.o:
|
||||
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) util.o ) || exit 1;
|
||||
../conserver/cutil.o:
|
||||
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) cutil.o ) || exit 1;
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
1317
console/console.c
1317
console/console.c
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,17 @@
|
||||
.\" $Id: console.man,v 1.37 2003-10-02 19:00:45-07 bryan Exp $
|
||||
.TH CONSOLE 1 "2003-10-02" "conserver-8.0.5" "conserver"
|
||||
.\" $Id: console.man,v 1.51 2004/05/25 00:38:15 bryan Exp $
|
||||
.TH CONSOLE 1 "2004/05/25" "conserver-8.1.6" "conserver"
|
||||
.SH NAME
|
||||
console \- console server client program
|
||||
.SH SYNOPSIS
|
||||
.B console
|
||||
.RB [ \-aAEfFsS ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-aAfFsS ]
|
||||
.RB [ \-7DEnUv ]
|
||||
.RB [ \-c
|
||||
.IR cred ]
|
||||
.RB [ \-C
|
||||
.IR config ]
|
||||
.BR [ \-M
|
||||
.IR mach ]
|
||||
.IR master ]
|
||||
.BR [ \-p
|
||||
.IR port ]
|
||||
.BR [ \-e
|
||||
@ -20,24 +22,32 @@ console \- console server client program
|
||||
.br
|
||||
.B console
|
||||
.RB [ \-hiIPrRuVwWx ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-7DEnUv ]
|
||||
.RB [ \-c
|
||||
.IR cred ]
|
||||
.RB [ \-C
|
||||
.IR config ]
|
||||
.RB [ \-M
|
||||
.IR mach ]
|
||||
.IR master ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.RB [ \-d
|
||||
.RI [ user ][\fB@\fP console ]]
|
||||
.RI [ user ][\f3@\fP console ]]
|
||||
.RB [ \- [ bB ]
|
||||
.IR message ]
|
||||
.RB [ \-t
|
||||
.RI [ user ][\fB@\fP console ]
|
||||
.RI [ user ][\f3@\fP console ]
|
||||
.IR message ]
|
||||
.br
|
||||
.B console
|
||||
.RB [ \-qQ ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-7DEnUv ]
|
||||
.RB [ \-c
|
||||
.IR cred ]
|
||||
.RB [ \-C
|
||||
.IR config ]
|
||||
.RB [ \-M
|
||||
.IR mach ]
|
||||
.IR master ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.SH DESCRIPTION
|
||||
@ -116,6 +126,10 @@ to users on the primary server.
|
||||
Load an SSL certificate and key from the PEM encoded file
|
||||
.IR cred .
|
||||
.TP
|
||||
.BI \-C config
|
||||
Use the per-user configuration file
|
||||
.IR conf .
|
||||
.TP
|
||||
.B \-d
|
||||
Disconnect the users specified by
|
||||
.IR user @ console .
|
||||
@ -150,9 +164,13 @@ The default value is
|
||||
.B \-E
|
||||
If encryption has been built into the code
|
||||
.RB ( --with-openssl ),
|
||||
encrypted client connections are a requirement.
|
||||
This option allows the client to connect to a console
|
||||
over a non-encrypted connection.
|
||||
encrypted client connections are, by default, a requirement.
|
||||
This option disables any attempt at creating an
|
||||
encrypted connection.
|
||||
If you'd like to use encrypted connections when your server
|
||||
supports it, but fallback to non-encrypted otherwise, the
|
||||
.B \-U
|
||||
option is what you want.
|
||||
.TP
|
||||
.B \-f
|
||||
Same as
|
||||
@ -179,19 +197,34 @@ uses $USER if its uid matches the user's real uid,
|
||||
or $LOGNAME if its uid matches the user's real uid,
|
||||
or else the name associated with the user's real uid.
|
||||
.TP
|
||||
.BI \-M mach
|
||||
.BI \-M master
|
||||
The
|
||||
.B console
|
||||
client program polls
|
||||
.I mach
|
||||
.I master
|
||||
as the primary server,
|
||||
rather than the default set at compile time (typically
|
||||
.RB `` console '').
|
||||
The default
|
||||
.I mach
|
||||
.I master
|
||||
may be changed at compile time using the
|
||||
.B --with-master
|
||||
option.
|
||||
If
|
||||
.B --with-uds
|
||||
is used to enable Unix domain sockets, however, this option points
|
||||
.B console
|
||||
to the directory which holds those sockets.
|
||||
The default
|
||||
.I master
|
||||
directory
|
||||
.RB (`` /tmp/conserver '')
|
||||
may be changed at compile time using the
|
||||
.B --with-uds
|
||||
option.
|
||||
.TP
|
||||
.BI \-n
|
||||
Do not read the system-wide configuration file.
|
||||
.TP
|
||||
.BI \-p port
|
||||
Set the port to connect to.
|
||||
@ -203,6 +236,9 @@ may be changed at compile time
|
||||
using the
|
||||
.B --with-port
|
||||
option.
|
||||
If the
|
||||
.B --with-uds
|
||||
option was used, this option is ignored.
|
||||
.TP
|
||||
.B \-P
|
||||
Display the pid of the master daemon process on each server.
|
||||
@ -264,6 +300,18 @@ and attached users
|
||||
.RI ( user @ host
|
||||
if attached read-write, `<spies>' if only users in spy mode, or `<none>').
|
||||
.TP
|
||||
.B \-U
|
||||
If encryption has been built into the code
|
||||
.RB ( --with-openssl ),
|
||||
encrypted client connections are, by default, a requirement.
|
||||
This option allows the client to attempt an encrypted connection
|
||||
but fall back to a non-encrypted connection if the server doesn't
|
||||
support encryption.
|
||||
If the encryption handshake is failing, disabling encryption on the
|
||||
client with the
|
||||
.B \-E
|
||||
option is probably what you want.
|
||||
.TP
|
||||
.B \-v
|
||||
Be more verbose when building the connection(s).
|
||||
Use this option in combination with any of `show' options (below)
|
||||
@ -297,12 +345,12 @@ The
|
||||
options have the same effect as their lower-case variants.
|
||||
In addition, they each request the last 20 lines of the console output after
|
||||
making the connection (as if
|
||||
.RB ` ^Ecr '
|
||||
.RB `` ^Ecr ''
|
||||
were typed).
|
||||
.PP
|
||||
The
|
||||
.B \-i
|
||||
option outputs information regarding each console in 13 colon-separated fields.
|
||||
option outputs information regarding each console in 15 colon-separated fields.
|
||||
.TP
|
||||
.I name
|
||||
The name of the console.
|
||||
@ -318,22 +366,22 @@ a command, or `!' for a remote port.
|
||||
.TP
|
||||
.I console-details
|
||||
The details regarding the console.
|
||||
The values here (all comma seperated) depend on the type of the console.
|
||||
Local devices will have values of the device file, baud rate, and
|
||||
The values here (all comma-separated) depend on the type of the console.
|
||||
Local devices will have values of the device file, baud rate/parity, and
|
||||
file descriptor for the device.
|
||||
Commands will have values of the command, the command's pid, the
|
||||
pseudo-tty, and file descriptor for the pseudo-tty.
|
||||
Remote ports will have values of the remote hostname, remote port number,
|
||||
and file descriptor for the socket connection.
|
||||
``raw'' or ``telnet'' protocol, and file descriptor for the socket connection.
|
||||
.TP
|
||||
.I users-list
|
||||
The details of each user connected to the console.
|
||||
The details for each
|
||||
user are an `@' seperated list of `w', `r', or `s' (for read-write, read-only,
|
||||
user are an `@' separated list of `w', `r', or `s' (for read-write, read-only,
|
||||
or suspended), username, hostname the user is on, the user's idle time,
|
||||
and (for `r' and `s' users only) ``rw'' or ``ro'' (if the user wants
|
||||
read-write mode or not).
|
||||
Each user bundle is seperated by commas.
|
||||
Each user bundle is separated by commas.
|
||||
.TP
|
||||
.I state
|
||||
The state of the console.
|
||||
@ -347,9 +395,9 @@ that the server can open the file for read, but not write.
|
||||
.TP
|
||||
.I logfile-details
|
||||
The details regarding the logging for the console.
|
||||
The comma seperated
|
||||
The comma-separated
|
||||
values will be the logfile, ``log'' or ``nolog'' (if logging is on
|
||||
or not - toggled via ^EcL), ``act'' or ``noact'' (if activity logging is
|
||||
or not - toggled via ``^EcL''), ``act'' or ``noact'' (if activity logging is
|
||||
enabled or not - the `a' timestamp option), the timestamp interval, and
|
||||
the file descriptor of the logfile.
|
||||
.TP
|
||||
@ -362,13 +410,324 @@ is at work, it will have the value of ``autoup'', otherwise it
|
||||
will be ``noautoup''.
|
||||
.TP
|
||||
.I aliases
|
||||
The console aliases are presented in a comma seperated list.
|
||||
The console aliases are presented in a comma-separated list.
|
||||
.TP
|
||||
.I options
|
||||
The active options for the console are presented in a comma seperated list.
|
||||
The active options for the console are presented in a comma-separated list.
|
||||
.TP
|
||||
.I initcmd
|
||||
The initcmd configuration option for the console.
|
||||
.TP
|
||||
.I idletimeout
|
||||
The idletimeout configuration option for the console.
|
||||
.TP
|
||||
.I idlestring
|
||||
The idlestring configuration option for the console.
|
||||
.SH CONFIGURATION
|
||||
.B Console
|
||||
reads configuration information from the system-wide configuration file
|
||||
.RB ( console.cf ),
|
||||
then the per-user configuration file
|
||||
.RB ( .consolerc ),
|
||||
and then applies command-line arguments.
|
||||
Each configuration location can override the previous.
|
||||
The same happens when parsing an individual file - the later entries
|
||||
always override the earlier entries.
|
||||
Because of that, you should put ``global'' defaults first and
|
||||
more specific defaults second.
|
||||
.PP
|
||||
The configuration file is read using the same parser as
|
||||
.BR conserver.cf (5),
|
||||
and you should check that manpage for parser details.
|
||||
.B Console
|
||||
recognizes the following configuration blocks.
|
||||
.TP 8
|
||||
.B config
|
||||
.RI [ " hostname " | " ipaddr " ]
|
||||
.br
|
||||
Define a configuration block for the host named
|
||||
.I hostname
|
||||
or using the address
|
||||
.IR ipaddr .
|
||||
If the value of ``*'' is used, the configuration block will be applied to
|
||||
all hosts.
|
||||
.RS
|
||||
.TP 15
|
||||
.B escape
|
||||
.I esc
|
||||
.br
|
||||
Set the escape sequence (see the
|
||||
.B \-e
|
||||
command-line flag).
|
||||
.TP
|
||||
.B master
|
||||
.I master
|
||||
.br
|
||||
Set the default master to
|
||||
.I master
|
||||
(see the
|
||||
.B \-M
|
||||
command-line flag).
|
||||
.TP
|
||||
.B port
|
||||
.I port
|
||||
.br
|
||||
Set the default port to
|
||||
.I port
|
||||
(see the
|
||||
.B \-p
|
||||
command-line flag).
|
||||
.TP
|
||||
.B sslcredentials
|
||||
.I filename
|
||||
.br
|
||||
Set the
|
||||
.SM SSL
|
||||
credentials file location (see the
|
||||
.B \-c
|
||||
command-line flag).
|
||||
.TP
|
||||
.B sslenabled
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not encryption is attempted when talking to servers (see the
|
||||
.B \-E
|
||||
command-line flag).
|
||||
.TP
|
||||
.B sslrequired
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not encryption is required when talking to servers (see the
|
||||
.B \-U
|
||||
command-line flag).
|
||||
.TP
|
||||
.B striphigh
|
||||
.RB [ " yes " | " true "
|
||||
.RB | " on " | " no "
|
||||
.RB | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not to strip the high bit off all data received
|
||||
(see the
|
||||
.B \-7
|
||||
command-line flag).
|
||||
.TP
|
||||
.B username
|
||||
.I user
|
||||
.br
|
||||
Set the username passed to the server to
|
||||
.I user
|
||||
(see the
|
||||
.B \-l
|
||||
command-line flag).
|
||||
.RE
|
||||
.TP 8
|
||||
.B terminal
|
||||
.I type
|
||||
.br
|
||||
Define a configuration block when using a terminal of type
|
||||
.IR type .
|
||||
If the value of ``*'' is used, the configuration block will be applied to
|
||||
all terminal types.
|
||||
.RS
|
||||
.TP 15
|
||||
.B attach
|
||||
.RI [ " string "
|
||||
| "" ]
|
||||
.br
|
||||
Set a
|
||||
.I string
|
||||
to print when successfully attached to a console.
|
||||
Character substitions will be performed based on the
|
||||
.B attachsubst
|
||||
value and occur
|
||||
.I before
|
||||
interpretation of the special characters below.
|
||||
If the null string (``""'') is used, no string will be printed.
|
||||
.I string
|
||||
is a simple character string with the exception of `\e'
|
||||
and `^':
|
||||
.RS
|
||||
.RS
|
||||
.sp
|
||||
.PD 0
|
||||
.TP 6
|
||||
.B \ea
|
||||
alert
|
||||
.TP
|
||||
.B \eb
|
||||
backspace
|
||||
.TP
|
||||
.B \ef
|
||||
form-feed
|
||||
.TP
|
||||
.B \en
|
||||
newline
|
||||
.TP
|
||||
.B \er
|
||||
carriage-return
|
||||
.TP
|
||||
.B \et
|
||||
tab
|
||||
.TP
|
||||
.B \ev
|
||||
vertical-tab
|
||||
.TP
|
||||
.B \e\e
|
||||
backslash
|
||||
.TP
|
||||
.B \e^
|
||||
circumflex
|
||||
.TP
|
||||
.BI \e ooo
|
||||
octal representation of a character (where
|
||||
.I ooo
|
||||
is one to three octal digits)
|
||||
.TP
|
||||
.BI \e c
|
||||
character
|
||||
.I c
|
||||
.TP
|
||||
.B ^?
|
||||
delete
|
||||
.TP
|
||||
.BI ^ c
|
||||
control character
|
||||
.RI ( c
|
||||
is ``and''ed with 0x1f)
|
||||
.PD
|
||||
.RE
|
||||
.RE
|
||||
.IP
|
||||
An interesting use of
|
||||
.B attach
|
||||
and
|
||||
.B attachsubst
|
||||
would be:
|
||||
.RS
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
terminal xterm {
|
||||
attach "^[]0;conserver: U@C^G";
|
||||
attachsubst U=us,C=cs;
|
||||
}
|
||||
.fi
|
||||
.ft
|
||||
.RE
|
||||
.TP
|
||||
.B attachsubst
|
||||
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
|
||||
| "" ]
|
||||
.br
|
||||
Perform character substitutions on the
|
||||
.B attach
|
||||
value.
|
||||
A series of replacements can be defined by specifying a
|
||||
comma-separated list of
|
||||
\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP
|
||||
sequences where
|
||||
.I c
|
||||
is any printable character,
|
||||
.I t
|
||||
specifies the replacement value,
|
||||
.I n
|
||||
is a field length (optional),
|
||||
and
|
||||
.I f
|
||||
is the format string.
|
||||
.I t
|
||||
can be one of the characters below, catagorized as a string replacement
|
||||
or a numeric replacement, which dictates the use of the
|
||||
.I n
|
||||
and
|
||||
.I f
|
||||
fields.
|
||||
.RS
|
||||
.RS
|
||||
.sp
|
||||
.PD 0
|
||||
.TP
|
||||
String Replacement
|
||||
.TP
|
||||
.B u
|
||||
username
|
||||
.TP
|
||||
.B c
|
||||
console name
|
||||
.sp
|
||||
.PP
|
||||
Numeric Replacement
|
||||
.TP
|
||||
none available (yet)
|
||||
.PD
|
||||
.RE
|
||||
.RE
|
||||
.IP
|
||||
For string replacements, if the replacement isn't at least
|
||||
.I n
|
||||
characters, it will be padded with space characters on the left.
|
||||
.I f
|
||||
must be `s'.
|
||||
For numeric replacements, the value will be formatted to at least
|
||||
.I n
|
||||
characters, padded with 0s if
|
||||
.I n
|
||||
begins with a 0, and space characters otherwise.
|
||||
.I f
|
||||
must be either `d', `x' or `X', specifying a decimal, lower-case
|
||||
hexadecimal, or an uppercase hexadecimal conversion.
|
||||
If the null string (``""'') is used, no replacements will be done.
|
||||
.TP 15
|
||||
.B detach
|
||||
.RI [ " string "
|
||||
| "" ]
|
||||
.br
|
||||
Set a
|
||||
.I string
|
||||
to print once detached from a console.
|
||||
Character substitions will be performed based on the
|
||||
.B detachsubst
|
||||
value.
|
||||
See the
|
||||
.B attach
|
||||
option for an explanation of
|
||||
.IR string .
|
||||
If the null string (``""'') is used, no string will be printed.
|
||||
.TP
|
||||
.B detachsubst
|
||||
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
|
||||
| "" ]
|
||||
.br
|
||||
Perform character substitutions on the
|
||||
.B detach
|
||||
value.
|
||||
See the
|
||||
.B attachsubst
|
||||
option for an explanation of the format string.
|
||||
.RE
|
||||
.PP
|
||||
A simple configuration to set a new default escape sequence and override
|
||||
the master location would be:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
# override options for all hosts
|
||||
config * {
|
||||
master localhost;
|
||||
escape ^Ee;
|
||||
}
|
||||
# set things more specific to host1
|
||||
# note: if the entries were reversed, host1
|
||||
# would also use localhost.
|
||||
config host1 {
|
||||
master console1;
|
||||
}
|
||||
.fi
|
||||
.ft
|
||||
.SH "ESCAPE SEQUENCES"
|
||||
The connection can be controlled by a two-character escape sequence, followed
|
||||
by a command.
|
||||
@ -381,6 +740,12 @@ Commands are:
|
||||
.sp
|
||||
.PD 0
|
||||
.TP 13
|
||||
.B \.
|
||||
disconnect
|
||||
.TP
|
||||
.B ;
|
||||
move to another console
|
||||
.TP
|
||||
.B a
|
||||
attach read-write if nobody already is
|
||||
.TP
|
||||
@ -402,6 +767,9 @@ forcibly attach read-write
|
||||
.B g
|
||||
group info
|
||||
.TP
|
||||
.B i
|
||||
information dump
|
||||
.TP
|
||||
.B L
|
||||
toggle logging on/off
|
||||
.TP
|
||||
@ -445,6 +813,9 @@ examine this group's devices and modes
|
||||
.B z
|
||||
suspend this connection
|
||||
.TP
|
||||
.B |
|
||||
attach a local command to the console
|
||||
.TP
|
||||
.B ?
|
||||
display list of commands
|
||||
.TP
|
||||
@ -458,8 +829,6 @@ replay the last line only
|
||||
send character having octal code
|
||||
.IR ooo " (must"
|
||||
specify three octal digits)
|
||||
.IP \.
|
||||
disconnect
|
||||
.PD
|
||||
.PP
|
||||
If any other character is hit after the escape sequence, all three characters
|
||||
@ -477,12 +846,16 @@ In the
|
||||
output, the login ``<none>'' indicates no one is
|
||||
viewing that console, and the login ``<spies>'' indicates that
|
||||
no one has a full two-way attachment.
|
||||
When no one is attached to
|
||||
a console its output is cloned to the stdout of the server process if
|
||||
.B conserver
|
||||
was started with the
|
||||
.B \-u
|
||||
option.
|
||||
.PP
|
||||
When running a local command via
|
||||
.RB `` ^Ec| '',
|
||||
you can type
|
||||
.B ^C
|
||||
to send the command a SIGHUP,
|
||||
.B ^\e
|
||||
to send the command a SIGKILL, and
|
||||
.B o
|
||||
to toggle the display of the console data.
|
||||
.SH EXAMPLES
|
||||
.TP 15
|
||||
console \-u
|
||||
@ -534,6 +907,22 @@ or number of days is displayed.
|
||||
console \-e "^[1" lv426
|
||||
Requests a connection to the host ``lv426'' with the escape characters
|
||||
set to ``escape one''.
|
||||
.SH FILES
|
||||
.PP
|
||||
The following default file locations may be overridden
|
||||
at compile time or by the command-line options described above.
|
||||
Run
|
||||
.B console \-V
|
||||
to see the defaults set at compile time.
|
||||
.PP
|
||||
.PD 0
|
||||
.TP 25
|
||||
.B /etc/console.cf
|
||||
system-wide configuration file
|
||||
.TP
|
||||
.B $HOME/.consolerc
|
||||
per-user configuration file
|
||||
.PD
|
||||
.SH BUGS
|
||||
It is possible to create a loop of console connections, with ugly results.
|
||||
Never run
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: getpassword.c,v 1.7 2003-09-28 12:29:17-07 bryan Exp $
|
||||
* $Id: getpassword.c,v 1.8 2003/11/20 13:56:41 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <version.h>
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: getpassword.h,v 1.3 2003-09-11 02:10:58-07 bryan Exp $
|
||||
* $Id: getpassword.h,v 1.3 2003/09/11 09:10:58 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
|
720
console/readconf.c
Normal file
720
console/readconf.c
Normal file
@ -0,0 +1,720 @@
|
||||
/*
|
||||
* $Id: readconf.c,v 5.2 2004/05/25 00:38:15 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <cutil.h>
|
||||
#include <readconf.h>
|
||||
|
||||
CONFIG *parserConfigTemp = (CONFIG *)0;
|
||||
CONFIG *parserConfigDefault = (CONFIG *)0;
|
||||
CONFIG *pConfig = (CONFIG *)0;
|
||||
TERM *parserTermTemp = (TERM *)0;
|
||||
TERM *parserTermDefault = (TERM *)0;
|
||||
TERM *pTerm = (TERM *)0;
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DestroyConfig(CONFIG *c)
|
||||
#else
|
||||
DestroyConfig(c)
|
||||
CONFIG *c;
|
||||
#endif
|
||||
{
|
||||
if (c == (CONFIG *)0)
|
||||
return;
|
||||
if (c->username != (char *)0)
|
||||
free(c->username);
|
||||
if (c->master != (char *)0)
|
||||
free(c->master);
|
||||
if (c->port != (char *)0)
|
||||
free(c->port);
|
||||
if (c->escape != (char *)0)
|
||||
free(c->escape);
|
||||
#if HAVE_OPENSSL
|
||||
if (c->sslcredentials != (char *)0)
|
||||
free(c->sslcredentials);
|
||||
#endif
|
||||
free(c);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ApplyConfigDefault(CONFIG *c)
|
||||
#else
|
||||
ApplyConfigDefault(c)
|
||||
CONFIG *c;
|
||||
#endif
|
||||
{
|
||||
if (parserConfigDefault == (CONFIG *)0)
|
||||
return;
|
||||
|
||||
if (parserConfigDefault->username != (char *)0) {
|
||||
if (c->username != (char *)0)
|
||||
free(c->username);
|
||||
if ((c->username =
|
||||
StrDup(parserConfigDefault->username)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->master != (char *)0) {
|
||||
if (c->master != (char *)0)
|
||||
free(c->master);
|
||||
if ((c->master = StrDup(parserConfigDefault->master)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->port != (char *)0) {
|
||||
if (c->port != (char *)0)
|
||||
free(c->port);
|
||||
if ((c->port = StrDup(parserConfigDefault->port)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->escape != (char *)0) {
|
||||
if (c->escape != (char *)0)
|
||||
free(c->escape);
|
||||
if ((c->escape = StrDup(parserConfigDefault->escape)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->striphigh != FLAGUNKNOWN)
|
||||
c->striphigh = parserConfigDefault->striphigh;
|
||||
#if HAVE_OPENSSL
|
||||
if (parserConfigDefault->sslcredentials != (char *)0) {
|
||||
if (c->sslcredentials != (char *)0)
|
||||
free(c->sslcredentials);
|
||||
if ((c->sslcredentials =
|
||||
StrDup(parserConfigDefault->sslcredentials)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->sslrequired != FLAGUNKNOWN)
|
||||
c->sslrequired = parserConfigDefault->sslrequired;
|
||||
if (parserConfigDefault->sslenabled != FLAGUNKNOWN)
|
||||
c->sslenabled = parserConfigDefault->sslenabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigBegin(char *id)
|
||||
#else
|
||||
ConfigBegin(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigBegin(%s) [%s:%d]", id, file, line));
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
Error("empty config name [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
if (parserConfigTemp != (CONFIG *)0)
|
||||
DestroyConfig(parserConfigTemp);
|
||||
if ((parserConfigTemp = (CONFIG *)calloc(1, sizeof(CONFIG)))
|
||||
== (CONFIG *)0)
|
||||
OutOfMem();
|
||||
ApplyConfigDefault(parserConfigTemp);
|
||||
parserConfigTemp->name = AllocString();
|
||||
BuildString(id, parserConfigTemp->name);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigEnd(void)
|
||||
#else
|
||||
ConfigEnd()
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigEnd() [%s:%d]", file, line));
|
||||
|
||||
if (parserConfigTemp == (CONFIG *)0)
|
||||
return;
|
||||
|
||||
if (parserConfigTemp->name->used > 1) {
|
||||
if ((parserConfigTemp->name->string[0] == '*' &&
|
||||
parserConfigTemp->name->string[1] == '\000') ||
|
||||
IsMe(parserConfigTemp->name->string)) {
|
||||
DestroyConfig(parserConfigDefault);
|
||||
parserConfigDefault = parserConfigTemp;
|
||||
parserConfigTemp = (CONFIG *)0;
|
||||
}
|
||||
}
|
||||
|
||||
DestroyConfig(parserConfigTemp);
|
||||
parserConfigTemp = (CONFIG *)0;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigAbort(void)
|
||||
#else
|
||||
ConfigAbort()
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigAbort() [%s:%d]", file, line));
|
||||
if (parserConfigTemp == (CONFIG *)0)
|
||||
return;
|
||||
|
||||
DestroyConfig(parserConfigTemp);
|
||||
parserConfigTemp = (CONFIG *)0;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigDestroy(void)
|
||||
#else
|
||||
ConfigDestroy()
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigDestroy() [%s:%d]", file, line));
|
||||
|
||||
if (parserConfigTemp != (CONFIG *)0) {
|
||||
DestroyConfig(parserConfigTemp);
|
||||
parserConfigTemp = (CONFIG *)0;
|
||||
}
|
||||
|
||||
if (parserConfigDefault != (CONFIG *)0) {
|
||||
DestroyConfig(pConfig);
|
||||
pConfig = parserConfigDefault;
|
||||
parserConfigDefault = (CONFIG *)0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DestroyTerminal(TERM *t)
|
||||
#else
|
||||
DestroyTerminal(t)
|
||||
TERM *t;
|
||||
#endif
|
||||
{
|
||||
if (t == (TERM *)0)
|
||||
return;
|
||||
if (t->attach != (char *)0)
|
||||
free(t->attach);
|
||||
if (t->attachsubst != (char *)0)
|
||||
free(t->attachsubst);
|
||||
if (t->detach != (char *)0)
|
||||
free(t->detach);
|
||||
if (t->detachsubst != (char *)0)
|
||||
free(t->detachsubst);
|
||||
free(t);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ApplyTermDefault(TERM *t)
|
||||
#else
|
||||
ApplyTermDefault(t)
|
||||
TERM *t;
|
||||
#endif
|
||||
{
|
||||
if (parserTermDefault == (TERM *)0)
|
||||
return;
|
||||
|
||||
if (parserTermDefault->attach != (char *)0) {
|
||||
if (t->attach != (char *)0)
|
||||
free(t->attach);
|
||||
if ((t->attach = StrDup(parserTermDefault->attach)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserTermDefault->attachsubst != (char *)0) {
|
||||
if (t->attachsubst != (char *)0)
|
||||
free(t->attachsubst);
|
||||
if ((t->attachsubst =
|
||||
StrDup(parserTermDefault->attachsubst)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserTermDefault->detach != (char *)0) {
|
||||
if (t->detach != (char *)0)
|
||||
free(t->detach);
|
||||
if ((t->detach = StrDup(parserTermDefault->detach)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserTermDefault->detachsubst != (char *)0) {
|
||||
if (t->detachsubst != (char *)0)
|
||||
free(t->detachsubst);
|
||||
if ((t->detachsubst =
|
||||
StrDup(parserTermDefault->detachsubst)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalBegin(char *id)
|
||||
#else
|
||||
TerminalBegin(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalBegin(%s) [%s:%d]", id, file, line));
|
||||
if (id == (char *)0 || id[0] == '\000') {
|
||||
Error("empty terminal name [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
if (parserTermTemp != (TERM *)0)
|
||||
DestroyTerminal(parserTermTemp);
|
||||
if ((parserTermTemp = (TERM *)calloc(1, sizeof(TERM)))
|
||||
== (TERM *)0)
|
||||
OutOfMem();
|
||||
ApplyTermDefault(parserTermTemp);
|
||||
parserTermTemp->name = AllocString();
|
||||
BuildString(id, parserTermTemp->name);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalEnd(void)
|
||||
#else
|
||||
TerminalEnd()
|
||||
#endif
|
||||
{
|
||||
static char *term = (char *)0;
|
||||
|
||||
CONDDEBUG((1, "TerminalEnd() [%s:%d]", file, line));
|
||||
|
||||
if (parserTermTemp == (TERM *)0)
|
||||
return;
|
||||
|
||||
if (term == (char *)0) {
|
||||
if ((term = getenv("TERM")) == (char *)0) {
|
||||
term = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (parserTermTemp->name->used > 1) {
|
||||
if ((parserTermTemp->name->string[0] == '*' &&
|
||||
parserTermTemp->name->string[1] == '\000') ||
|
||||
strcmp(parserTermTemp->name->string, term) == 0) {
|
||||
DestroyTerminal(parserTermDefault);
|
||||
parserTermDefault = parserTermTemp;
|
||||
parserTermTemp = (TERM *)0;
|
||||
}
|
||||
}
|
||||
|
||||
DestroyTerminal(parserTermTemp);
|
||||
parserTermTemp = (TERM *)0;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalAbort(void)
|
||||
#else
|
||||
TerminalAbort()
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalAbort() [%s:%d]", file, line));
|
||||
if (parserTermTemp == (TERM *)0)
|
||||
return;
|
||||
|
||||
DestroyTerminal(parserTermTemp);
|
||||
parserTermTemp = (TERM *)0;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalDestroy(void)
|
||||
#else
|
||||
TerminalDestroy()
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalDestroy() [%s:%d]", file, line));
|
||||
|
||||
if (parserTermTemp != (TERM *)0) {
|
||||
DestroyTerminal(parserTermTemp);
|
||||
parserTermTemp = (TERM *)0;
|
||||
}
|
||||
|
||||
if (parserTermDefault != (TERM *)0) {
|
||||
DestroyTerminal(pTerm);
|
||||
pTerm = parserTermDefault;
|
||||
parserTermDefault = (TERM *)0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ProcessYesNo(char *id, FLAG *flag)
|
||||
#else
|
||||
ProcessYesNo(id, flag)
|
||||
char *id;
|
||||
FLAG *flag;
|
||||
#endif
|
||||
{
|
||||
if (id == (char *)0 || id[0] == '\000')
|
||||
*flag = FLAGFALSE;
|
||||
else if (strcasecmp("yes", id) == 0 || strcasecmp("true", id) == 0 ||
|
||||
strcasecmp("on", id) == 0)
|
||||
*flag = FLAGTRUE;
|
||||
else if (strcasecmp("no", id) == 0 || strcasecmp("false", id) == 0 ||
|
||||
strcasecmp("off", id) == 0)
|
||||
*flag = FLAGFALSE;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemEscape(char *id)
|
||||
#else
|
||||
ConfigItemEscape(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemEscape(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserConfigTemp->escape != (char *)0)
|
||||
free(parserConfigTemp->escape);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->escape = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->escape = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemMaster(char *id)
|
||||
#else
|
||||
ConfigItemMaster(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemMaster(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserConfigTemp->master != (char *)0)
|
||||
free(parserConfigTemp->master);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->master = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->master = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemPort(char *id)
|
||||
#else
|
||||
ConfigItemPort(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemPort(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserConfigTemp->port != (char *)0)
|
||||
free(parserConfigTemp->port);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->port = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->port = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemSslcredentials(char *id)
|
||||
#else
|
||||
ConfigItemSslcredentials(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslcredentials(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
if (parserConfigTemp->sslcredentials != (char *)0)
|
||||
free(parserConfigTemp->sslcredentials);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->sslcredentials = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->sslcredentials = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
#else
|
||||
Error
|
||||
("sslcredentials ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemSslrequired(char *id)
|
||||
#else
|
||||
ConfigItemSslrequired(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
ProcessYesNo(id, &(parserConfigTemp->sslrequired));
|
||||
#else
|
||||
Error
|
||||
("sslrequired ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemSslenabled(char *id)
|
||||
#else
|
||||
ConfigItemSslenabled(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslenabled(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
ProcessYesNo(id, &(parserConfigTemp->sslenabled));
|
||||
#else
|
||||
Error("sslenabled ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemStriphigh(char *id)
|
||||
#else
|
||||
ConfigItemStriphigh(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemStriphigh(%s) [%s:%d]", id, file, line));
|
||||
ProcessYesNo(id, &(parserConfigTemp->striphigh));
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ConfigItemUsername(char *id)
|
||||
#else
|
||||
ConfigItemUsername(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemUsername(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserConfigTemp->username != (char *)0)
|
||||
free(parserConfigTemp->username);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->username = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->username = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
SUBST *substData = (SUBST *) 0;
|
||||
|
||||
int
|
||||
#if PROTOTYPES
|
||||
SubstCallback(char c, char **s, int *i)
|
||||
#else
|
||||
SubstCallback(c, s, i)
|
||||
char c;
|
||||
char **s;
|
||||
int *i;
|
||||
#endif
|
||||
{
|
||||
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) {
|
||||
CONFIG *pc;
|
||||
if (substData->data == (void *)0)
|
||||
return 0;
|
||||
|
||||
pc = (CONFIG *)(substData->data);
|
||||
if (c == 'u') {
|
||||
(*s) = pc->username;
|
||||
retval = 1;
|
||||
} else if (c == 'c') {
|
||||
(*s) = pc->console;
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalItemAttach(char *id)
|
||||
#else
|
||||
TerminalItemAttach(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemAttach(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserTermTemp->attach != (char *)0)
|
||||
free(parserTermTemp->attach);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserTermTemp->attach = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserTermTemp->attach = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalItemAttachsubst(char *id)
|
||||
#else
|
||||
TerminalItemAttachsubst(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemAttachsubst(%s) [%s:%d]", id, file, line));
|
||||
ProcessSubst(substData, (char **)0, &(parserTermTemp->attachsubst),
|
||||
"attachsubst", id);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalItemDetach(char *id)
|
||||
#else
|
||||
TerminalItemDetach(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemDetach(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if (parserTermTemp->detach != (char *)0)
|
||||
free(parserTermTemp->detach);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserTermTemp->detach = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserTermTemp->detach = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
TerminalItemDetachsubst(char *id)
|
||||
#else
|
||||
TerminalItemDetachsubst(id)
|
||||
char *id;
|
||||
#endif
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemDetachsubst(%s) [%s:%d]", id, file, line));
|
||||
ProcessSubst(substData, (char **)0, &(parserTermTemp->detachsubst),
|
||||
"detachsubst", id);
|
||||
}
|
||||
|
||||
ITEM keyConfig[] = {
|
||||
{"escape", ConfigItemEscape},
|
||||
{"master", ConfigItemMaster},
|
||||
{"port", ConfigItemPort},
|
||||
{"sslcredentials", ConfigItemSslcredentials},
|
||||
{"sslrequired", ConfigItemSslrequired},
|
||||
{"sslenabled", ConfigItemSslenabled},
|
||||
{"striphigh", ConfigItemStriphigh},
|
||||
{"username", ConfigItemUsername},
|
||||
{(char *)0, (void *)0}
|
||||
};
|
||||
|
||||
ITEM keyTerminal[] = {
|
||||
{"attach", TerminalItemAttach},
|
||||
{"attachsubst", TerminalItemAttachsubst},
|
||||
{"detach", TerminalItemDetach},
|
||||
{"detachsubst", TerminalItemDetachsubst},
|
||||
{(char *)0, (void *)0}
|
||||
};
|
||||
|
||||
SECTION sections[] = {
|
||||
{"config", ConfigBegin, ConfigEnd, ConfigAbort, ConfigDestroy,
|
||||
keyConfig},
|
||||
{"terminal", TerminalBegin, TerminalEnd, TerminalAbort,
|
||||
TerminalDestroy, keyTerminal},
|
||||
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
|
||||
};
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ReadConf(char *filename, FLAG verbose)
|
||||
#else
|
||||
ReadConf(filename, verbose)
|
||||
char *filename;
|
||||
FLAG verbose;
|
||||
#endif
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((FILE *)0 == (fp = fopen(filename, "r"))) {
|
||||
if (verbose == FLAGTRUE)
|
||||
Error("could not open `%s'", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize the substition bits */
|
||||
SubstCallback('\000', (char **)0, (int *)0);
|
||||
|
||||
parserConfigDefault = pConfig;
|
||||
pConfig = (CONFIG *)0;
|
||||
|
||||
parserTermDefault = pTerm;
|
||||
pTerm = (TERM *)0;
|
||||
|
||||
ParseFile(filename, fp, 0);
|
||||
|
||||
/* shouldn't really happen, but in case i screw up the stuff
|
||||
* ParseFile calls...
|
||||
*/
|
||||
if (pConfig == (CONFIG *)0) {
|
||||
if ((pConfig = (CONFIG *)calloc(1, sizeof(CONFIG)))
|
||||
== (CONFIG *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
if (pTerm == (TERM *)0) {
|
||||
if ((pTerm = (TERM *)calloc(1, sizeof(TERM)))
|
||||
== (TERM *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
|
||||
if (fDebug) {
|
||||
#define EMPTYSTR(x) x == (char *)0 ? "(null)" : x
|
||||
#define FLAGSTR(x) x == FLAGTRUE ? "true" : (x == FLAGFALSE ? "false" : "unset")
|
||||
CONDDEBUG((1, "pConfig->username = %s",
|
||||
EMPTYSTR(pConfig->username)));
|
||||
CONDDEBUG((1, "pConfig->master = %s", EMPTYSTR(pConfig->master)));
|
||||
CONDDEBUG((1, "pConfig->port = %s", EMPTYSTR(pConfig->port)));
|
||||
CONDDEBUG((1, "pConfig->escape = %s", EMPTYSTR(pConfig->escape)));
|
||||
CONDDEBUG((1, "pConfig->striphigh = %s",
|
||||
FLAGSTR(pConfig->striphigh)));
|
||||
#if HAVE_OPENSSL
|
||||
CONDDEBUG((1, "pConfig->sslcredentials = %s",
|
||||
EMPTYSTR(pConfig->sslcredentials)));
|
||||
CONDDEBUG((1, "pConfig->sslrequired = %s",
|
||||
FLAGSTR(pConfig->sslrequired)));
|
||||
CONDDEBUG((1, "pConfig->sslenabled = %s",
|
||||
FLAGSTR(pConfig->sslenabled)));
|
||||
#endif
|
||||
CONDDEBUG((1, "pTerm->attach = %s", EMPTYSTR(pTerm->attach)));
|
||||
CONDDEBUG((1, "pTerm->attachsubst = %s",
|
||||
EMPTYSTR(pTerm->attachsubst)));
|
||||
CONDDEBUG((1, "pTerm->detach = %s", EMPTYSTR(pTerm->detach)));
|
||||
CONDDEBUG((1, "pTerm->detachsubst = %s",
|
||||
EMPTYSTR(pTerm->detachsubst)));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
38
console/readconf.h
Normal file
38
console/readconf.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* $Id: readconf.h,v 5.3 2004/05/25 23:03:25 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
typedef struct config {
|
||||
STRING *name;
|
||||
char *console;
|
||||
char *username;
|
||||
char *master;
|
||||
char *port;
|
||||
char *escape;
|
||||
FLAG striphigh;
|
||||
#if HAVE_OPENSSL
|
||||
char *sslcredentials;
|
||||
FLAG sslrequired;
|
||||
FLAG sslenabled;
|
||||
#endif
|
||||
} CONFIG;
|
||||
|
||||
typedef struct term {
|
||||
STRING *name;
|
||||
char *attach;
|
||||
char *attachsubst;
|
||||
char *detach;
|
||||
char *detachsubst;
|
||||
} TERM;
|
||||
|
||||
extern CONFIG *pConfig;
|
||||
extern TERM *pTerm;
|
||||
extern SUBST *substData;
|
||||
|
||||
extern void ReadConf PARAMS((char *, FLAG));
|
||||
extern void DestroyConfig PARAMS((CONFIG *));
|
||||
extern void DestroyTerminal PARAMS((TERM *));
|
@ -24,5 +24,5 @@ will be helpful.
|
||||
Bryan Stansell
|
||||
|
||||
#
|
||||
# $Id: README,v 1.4 2003-09-29 07:29:37-07 bryan Exp $
|
||||
# $Id: README,v 1.4 2003/09/29 14:29:37 bryan Exp $
|
||||
#
|
||||
|
@ -88,15 +88,6 @@
|
||||
#define const
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef __NetBSD__
|
||||
#if 1
|
||||
static const char rcsid[] = "Id: chat.c,v 1.26 1999/12/23 01:39:54 paulus Exp ";
|
||||
#else
|
||||
__RCSID("$NetBSD: chat.c,v 1.25 2001/09/24 13:22:38 wiz Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
%define pkg conserver
|
||||
%define ver conserver-8.0.5
|
||||
%define ver 8.1.6
|
||||
|
||||
# define the name of the machine on which the main conserver
|
||||
# daemon will be running if you don't want to use the default
|
||||
@ -17,7 +17,7 @@
|
||||
Summary: Serial console server daemon/client
|
||||
Name: %{pkg}
|
||||
Version: %{ver}
|
||||
Release: 1.%{distver}x
|
||||
Release: 1.%{distver}
|
||||
Copyright: distributable
|
||||
Group: System Environment/Daemons
|
||||
URL: http://www.conserver.com/
|
||||
@ -100,4 +100,6 @@ fi
|
||||
%{prefix}/share/man/man8/conserver.8.gz
|
||||
%{prefix}/share/man/man5/conserver.cf.5.gz
|
||||
%{prefix}/share/man/man5/conserver.passwd.5.gz
|
||||
%{prefix}/share/examples/conserver/conserver.cf
|
||||
%{prefix}/share/examples/conserver/conserver.passwd
|
||||
%{prefix}/sbin/conserver
|
||||
|
@ -1,7 +1,7 @@
|
||||
PKG="conserver"
|
||||
NAME="Console server and client"
|
||||
CATEGORY="system"
|
||||
VERSION="conserver-8.0.5"
|
||||
VERSION="8.1.6"
|
||||
DESC="Console server and client"
|
||||
CLASSES=none
|
||||
ARCH=sparc
|
||||
|
15
test/dotest
15
test/dotest
@ -14,6 +14,7 @@ cleanup()
|
||||
[ "$i" != "conserver.log" ] && [ -f "$i" ] && rm -f "$i";
|
||||
done
|
||||
[ "$exitval" = 0 ] && rm -f conserver.log
|
||||
[ -d 127.0.0.1 ] && sleep 1 && rm -rf 127.0.0.1
|
||||
exit $exitval
|
||||
}
|
||||
|
||||
@ -25,7 +26,7 @@ dotest()
|
||||
eval "$2" > test.out 2>&1
|
||||
else
|
||||
echo "$1" | \
|
||||
../console/console -M 127.0.0.1 -p 7777 shell > test.out 2>&1
|
||||
../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 shell > test.out 2>&1
|
||||
fi
|
||||
if [ "$record" ]; then
|
||||
echo "recorded"
|
||||
@ -33,7 +34,7 @@ dotest()
|
||||
else
|
||||
if [ -f results/test$testnum ]; then
|
||||
if diff -i test.out results/test$testnum >test$testnum.diff 2>&1; then
|
||||
echo "succeded"
|
||||
echo "succeeded"
|
||||
rm -f test$testnum.diff
|
||||
else
|
||||
echo "failed (diffs in test$testnum.diff)"
|
||||
@ -72,7 +73,7 @@ sleep 3
|
||||
|
||||
[ ! -d results ] && mkdir results
|
||||
|
||||
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
|
||||
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
|
||||
dotest 'c?c.'
|
||||
dotest 'cl?c.'
|
||||
dotest 'cdc.'
|
||||
@ -84,14 +85,14 @@ cp test2.cf c.cf
|
||||
kill -1 $pid
|
||||
sleep 3
|
||||
|
||||
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
|
||||
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -u | sed -e 's/[0-9][0-9]*//g' -e 's/[ ][ ]*/ /g'"
|
||||
dotest 'c?c.'
|
||||
dotest 'cl?c.'
|
||||
dotest 'cdc.'
|
||||
dotest 'coc.'
|
||||
|
||||
dotest EVAL "echo 'tu.' | ../console/console -M 127.0.0.1 -p 7777 -e 'tu' shell"
|
||||
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -P | sed -e 's/:.*//'"
|
||||
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'"
|
||||
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 -x | sed -e 's/ on [^ ]* */ on /'"
|
||||
|
||||
cleanup
|
||||
|
@ -1 +1 @@
|
||||
127.0.0.1
|
||||
version `conserver.com version
|
||||
|
@ -1,17 +1,18 @@
|
||||
[Enter `^Ec?' for help]
|
||||
[help]
|
||||
. disconnect a attach read/write
|
||||
b send broadcast message c toggle flow control
|
||||
d down a console e change escape sequence
|
||||
f force attach read/write g group info
|
||||
i information dump L toggle logging on/off
|
||||
l? break sequence list l0 send break per config file
|
||||
l1-9 send specific break sequence m display the message of the day
|
||||
o (re)open the tty and log file p replay the last 60 lines
|
||||
r replay the last 20 lines s spy read only
|
||||
u show host status v show version info
|
||||
w who is on this console x show console baud info
|
||||
z suspend the connection <cr> ignore/abort command
|
||||
? print this message ^R replay the last line
|
||||
. disconnect ; move to another console
|
||||
a attach read/write b send broadcast message
|
||||
c toggle flow control d down a console
|
||||
e change escape sequence f force attach read/write
|
||||
g group info i information dump
|
||||
L toggle logging on/off l? break sequence list
|
||||
l0 send break per config file l1-9 send specific break sequence
|
||||
m display the message of the day o (re)open the tty and log file
|
||||
p replay the last 60 lines r replay the last 20 lines
|
||||
s spy read only u show host status
|
||||
v show version info w who is on this console
|
||||
x show console baud info z suspend the connection
|
||||
| attach local command ? print this message
|
||||
<cr> ignore/abort command ^R replay the last line
|
||||
\ooo send character by octal code
|
||||
[disconnect]
|
||||
|
@ -1,17 +1,18 @@
|
||||
[Enter `^Ec?' for help]
|
||||
[help]
|
||||
. disconnect a attach read/write
|
||||
b send broadcast message c toggle flow control
|
||||
d down a console e change escape sequence
|
||||
f force attach read/write g group info
|
||||
i information dump L toggle logging on/off
|
||||
l? break sequence list l0 send break per config file
|
||||
l1-9 send specific break sequence m display the message of the day
|
||||
o (re)open the tty and log file p replay the last 60 lines
|
||||
r replay the last 20 lines s spy read only
|
||||
u show host status v show version info
|
||||
w who is on this console x show console baud info
|
||||
z suspend the connection <cr> ignore/abort command
|
||||
? print this message ^R replay the last line
|
||||
. disconnect ; move to another console
|
||||
a attach read/write b send broadcast message
|
||||
c toggle flow control d down a console
|
||||
e change escape sequence f force attach read/write
|
||||
g group info i information dump
|
||||
L toggle logging on/off l? break sequence list
|
||||
l0 send break per config file l1-9 send specific break sequence
|
||||
m display the message of the day o (re)open the tty and log file
|
||||
p replay the last 60 lines r replay the last 20 lines
|
||||
s spy read only u show host status
|
||||
v show version info w who is on this console
|
||||
x show console baud info z suspend the connection
|
||||
| attach local command ? print this message
|
||||
<cr> ignore/abort command ^R replay the last line
|
||||
\ooo send character by octal code
|
||||
[disconnect]
|
||||
|
Reference in New Issue
Block a user