mirror of
https://github.com/bstansell/conserver.git
synced 2025-06-24 17:55:08 +00:00
Compare commits
150 Commits
Author | SHA1 | Date | |
---|---|---|---|
785f2dae9a | |||
11963af83e | |||
2a089dff46 | |||
2d8a816b62 | |||
55738e4e97 | |||
02d0c15a77 | |||
51ac2ace52 | |||
e862920a82 | |||
933f3271ad | |||
af79b97fdf | |||
3da2e0db15 | |||
958da9f13c | |||
31a4e9493d | |||
ca0bde5039 | |||
e77500eb11 | |||
b626f3fea9 | |||
dbe104674d | |||
54f35f135e | |||
17a2e50d5f | |||
3b1dbb3474 | |||
975304f033 | |||
d565e30d36 | |||
0aa733db99 | |||
abd8edec1d | |||
68422e949d | |||
2a9f3d981f | |||
08e8f7667d | |||
209b3a889a | |||
8455d4a8ce | |||
61473af523 | |||
a33f8cf63a | |||
89e400246b | |||
686f718e0d | |||
d3ffe500c9 | |||
b24257e79a | |||
f84e82a8d7 | |||
009bd45dad | |||
2561311abb | |||
956a618114 | |||
d679fa21b4 | |||
636dc4946b | |||
cdf979c5ad | |||
e289ba408f | |||
6c543f8137 | |||
1687e20148 | |||
62f5083f23 | |||
a8cff43007 | |||
b8e0d85185 | |||
3b12232c1c | |||
126e7cf04f | |||
4f29d9aa75 | |||
feb72a9a8f | |||
b0c99fe46d | |||
a18c8bc6c4 | |||
a75e3fc17c | |||
969731ea4f | |||
bd837bf4ce | |||
da781c9187 | |||
e6193995fe | |||
c3db82a572 | |||
8060b14efe | |||
649f5099d5 | |||
ddc8eec8c6 | |||
95c958d6b3 | |||
742da69935 | |||
8cfbe1aeb1 | |||
6c5814c9c8 | |||
5decb6e739 | |||
b68bc50e61 | |||
7e1d967251 | |||
ba1adaa351 | |||
b1cbf1580a | |||
16f1639262 | |||
efb908117f | |||
043a43225b | |||
fc94056635 | |||
f43f978691 | |||
5c9ffec7cd | |||
51cfe7eb30 | |||
6cee71850e | |||
922be28008 | |||
d330a25f97 | |||
1f8e299fe4 | |||
5ab4cad967 | |||
6526fcd002 | |||
9228512c67 | |||
2297db8291 | |||
8c44a3dec9 | |||
b352435f5c | |||
16bbf649dd | |||
225cddc056 | |||
b5a569345d | |||
de081974fc | |||
4c35d42135 | |||
3946ca2958 | |||
d4fe34041f | |||
d529026f11 | |||
09178676ce | |||
0032b330ec | |||
0a4d65a504 | |||
d97fd1a57f | |||
b285f0a948 | |||
12671246ae | |||
123cecc122 | |||
b1a0fa3c50 | |||
7315957bba | |||
06f5c67298 | |||
4330a8b5c0 | |||
139e08e73b | |||
4a32f41eca | |||
46a63441bb | |||
9b2d757e5f | |||
ff83413d6a | |||
864f9e7b9a | |||
26b165d251 | |||
d6af8728d7 | |||
16598183c6 | |||
4e3c2e134e | |||
166633395d | |||
05d8632431 | |||
28079e19a8 | |||
eb2ad65fba | |||
b2ea81a201 | |||
4039e65b31 | |||
8534a21cef | |||
484806e667 | |||
b94c8967bf | |||
64a2a77266 | |||
0c74cb3ece | |||
019277a041 | |||
a30e7d2289 | |||
ed79341c2c | |||
c418af32c7 | |||
3cec1dde71 | |||
892f52dbd4 | |||
4ce124e121 | |||
faad858599 | |||
27475bdd30 | |||
c0f8de9c24 | |||
cf461c7ce8 | |||
5c430d220b | |||
8cd506c093 | |||
29b909ee59 | |||
aea0e2a547 | |||
9eed9f2d8f | |||
25a4dcb0fd | |||
75cfd02f7a | |||
ad7a90dd69 | |||
691c3102c9 | |||
eafae7c27d |
48
.cirrus.yml
Normal file
48
.cirrus.yml
Normal file
@ -0,0 +1,48 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 1
|
||||
|
||||
freebsd_12_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-1
|
||||
install_script:
|
||||
- pkg install -y autoconf automake
|
||||
- ./package/setup-configure
|
||||
basic_script: &basic
|
||||
- "[ -f Makefile ] && make distclean"
|
||||
- ./configure || { cat config.log; exit 1; }
|
||||
- make
|
||||
- make test
|
||||
uds_script: &uds
|
||||
- "[ -f Makefile ] && make distclean"
|
||||
- ./configure --with-trust-uds-cred --with-uds || { cat config.log; exit 1; }
|
||||
- make
|
||||
- make test
|
||||
pam_ssl_script: &pamssl
|
||||
- "[ -f Makefile ] && make distclean"
|
||||
- ./configure --with-pam --with-openssl || { cat config.log; exit 1; }
|
||||
- make
|
||||
- make test
|
||||
gssapi_script: &gssapi
|
||||
- "[ -f Makefile ] && make distclean"
|
||||
- ./configure --with-gssapi || { cat config.log; exit 1; }
|
||||
- make
|
||||
- make test
|
||||
|
||||
linux_gcc_task:
|
||||
container:
|
||||
image: gcc:latest
|
||||
install_script:
|
||||
- ./package/setup-configure
|
||||
basic_script: *basic
|
||||
uds_script: *uds
|
||||
pam_ssl_script: *pamssl
|
||||
|
||||
#macos_task:
|
||||
# osx_instance:
|
||||
# image: mojave-xcode-10.1
|
||||
# install_script:
|
||||
# - brew install autoconf automake
|
||||
# - ./package/setup-configure
|
||||
# basic_script: *basic
|
||||
# uds_script: *uds
|
||||
# pam_ssl_script: *pamssl
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.[ch]~
|
4
FAQ
4
FAQ
@ -184,7 +184,3 @@ directed to faq@conserver.com. The FAQ answers the following questions:
|
||||
- Have you tried a search on the conserver site (it searches
|
||||
mailing list traffic as well) to see if someone else has gone
|
||||
through the same problem?
|
||||
|
||||
#
|
||||
# $Id: FAQ,v 1.9 2003-08-23 12:27:10-07 bryan Exp $
|
||||
#
|
||||
|
59
INSTALL
59
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
|
||||
@ -137,8 +156,9 @@ Detailed Instructions
|
||||
--with-port=PORT Specify port number [conserver]
|
||||
--with-base=PORT Base port for secondary channel [0]
|
||||
--with-master=MASTER Specify master server hostname [console]
|
||||
--with-cffile=CFFILE Specify config filename
|
||||
[SYSCONFDIR/conserver.cf]
|
||||
--with-ccffile=CFFILE Specify client config filename
|
||||
[SYSCONFDIR/console.cf]
|
||||
--with-cffile=CFFILE Specify config filename [SYSCONFDIR/conserver.cf]
|
||||
--with-pwdfile=PWDFILE Specify password filename
|
||||
[SYSCONFDIR/conserver.passwd]
|
||||
--with-logfile=LOGFILE Specify log filename [/var/log/conserver]
|
||||
@ -146,10 +166,23 @@ 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-rpath Use -R as well as -L for libraries
|
||||
--with-cycladests (deprecated - noop) Build for a Cyclades TS
|
||||
--with-uds[=DIR] Use Unix domain sockets for client/server
|
||||
communication [/tmp/conserver]
|
||||
--with-trust-uds-cred Trust UDS credentials obtained via socket
|
||||
--with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support
|
||||
--with-openssl[=PATH] Compile in OpenSSL support
|
||||
--with-req-server-cert Require server SSL certificate by client
|
||||
--with-gssapi[=PATH] Compile in GSS-API support
|
||||
--with-striprealm retry username without @REALM with gss-api
|
||||
authentication
|
||||
--with-freeipmi[=PATH] Compile in FreeIPMI support
|
||||
--with-dmalloc[=PATH] Compile in dmalloc support
|
||||
--with-pam Enable PAM support
|
||||
--with-ipv6 (experimental) Use IPv6 for client/server
|
||||
communication
|
||||
|
||||
Not surprisingly, some match the old conserver/cons.h items...here
|
||||
they are for reference:
|
||||
@ -163,10 +196,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
|
||||
@ -205,10 +239,10 @@ Detailed Instructions
|
||||
step.
|
||||
|
||||
+ Next, make sure conserver runs during boot. The init script we
|
||||
use under Solaris is installed in <PREFIX>/etc/conserver.rc.
|
||||
Use that or some form of it for your own /etc/init.d script or
|
||||
an entry in startup files (/etc/rc, /etc/rc.local, or
|
||||
whatever).
|
||||
use under Solaris is installed in
|
||||
<DATADIR>/examples/conserver/conserver.rc. Use that or some
|
||||
form of it for your own /etc/init.d script or an entry in
|
||||
startup files (/etc/rc, /etc/rc.local, or whatever).
|
||||
|
||||
+ Now for the fun stuff. You need to create a conserver.cf and
|
||||
conserver.passwd file. Those are defined with the
|
||||
@ -252,8 +286,3 @@ Other Information And Gotchas
|
||||
connecting to servers, you might be tickling this bug and you
|
||||
can upgrade the compiler, turn off the optimization, or apply
|
||||
this code change.
|
||||
|
||||
|
||||
#
|
||||
# $Id: INSTALL,v 1.34 2003-10-03 10:52:31-07 bryan Exp $
|
||||
#
|
||||
|
126
LICENSE
126
LICENSE
@ -1,115 +1,29 @@
|
||||
Since this piece of software has had many contiributors, there is a
|
||||
"chain" of licensing information embedded in the files. I've copied
|
||||
what I could find here so that it's easy to reference. The entire
|
||||
bundle of software is guided by these licensing statements.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2000, conserver.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of conserver.com nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998, GNAC, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Neither the name of GNAC, Inc. nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 1992 Purdue Research Foundation, West Lafayette, Indiana
|
||||
47907. All rights reserved.
|
||||
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it freely, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. Neither the authors nor Purdue University are responsible for any
|
||||
consequences of the use of this software.
|
||||
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Credit to the authors and Purdue
|
||||
University must appear in documentation and sources.
|
||||
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
4. This notice may not be removed or altered.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1990 The Ohio State University.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms are permitted
|
||||
provided that: (1) source distributions retain this entire copyright
|
||||
notice and comment, and (2) distributions including binaries display
|
||||
the following acknowledgement: ``This product includes software
|
||||
developed by The Ohio State University and its contributors''
|
||||
in the documentation or other materials provided with the distribution
|
||||
and in all advertising materials mentioning features or use of this
|
||||
software. Neither the name of the University nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
115
LICENSES
Normal file
115
LICENSES
Normal file
@ -0,0 +1,115 @@
|
||||
Since this piece of software has had many contiributors, there is a
|
||||
"chain" of licensing information embedded in the files. I've copied
|
||||
what I could find here so that it's easy to reference. The entire
|
||||
bundle of software is guided by these licensing statements.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2000, conserver.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Neither the name of conserver.com nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998, GNAC, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
- Neither the name of GNAC, Inc. nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright 1992 Purdue Research Foundation, West Lafayette, Indiana
|
||||
47907. All rights reserved.
|
||||
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it freely, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. Neither the authors nor Purdue University are responsible for any
|
||||
consequences of the use of this software.
|
||||
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Credit to the authors and Purdue
|
||||
University must appear in documentation and sources.
|
||||
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
4. This notice may not be removed or altered.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1990 The Ohio State University.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms are permitted
|
||||
provided that: (1) source distributions retain this entire copyright
|
||||
notice and comment, and (2) distributions including binaries display
|
||||
the following acknowledgement: ``This product includes software
|
||||
developed by The Ohio State University and its contributors''
|
||||
in the documentation or other materials provided with the distribution
|
||||
and in all advertising materials mentioning features or use of this
|
||||
software. Neither the name of the University nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
----------------------------------------------------------------------------
|
@ -1,4 +1,5 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
|
302
PROTOCOL
Normal file
302
PROTOCOL
Normal file
@ -0,0 +1,302 @@
|
||||
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 its 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
|
||||
newlogs* close and open all logfiles (SIGUSR2)
|
||||
pid provide pid of master process
|
||||
quit* terminate conserver (SIGTERM)
|
||||
restart* restart conserver (SIGHUP) - deprecated
|
||||
reconfig* reread config file (SIGHUP)
|
||||
version provide version info for server
|
||||
up* bring up all downed consoles (SIGUSR1)
|
||||
* = 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 "newlogs" command reopens all logfiles used by conserver, assuming
|
||||
the user has administrative access. It responds with a message starting
|
||||
with "ok" if successful and an error message otherwise (like
|
||||
"unauthorized command"). The client is disconnected if it's successful.
|
||||
|
||||
The "pid" command responds with the pid of the master process (in this
|
||||
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 has been deprecated. You should use "reconfig".
|
||||
|
||||
The "reconfig" command will cause conserver to reread the configuration
|
||||
file and apply any changes, assuming the user has administrative access.
|
||||
It responds with a message starting with "ok" if successful and an error
|
||||
message otherwise (like "unauthorized command"). The client is not
|
||||
disconnected.
|
||||
|
||||
The "version" command responds with the version string. The client is
|
||||
not disconnected.
|
||||
|
||||
The "up" command tries to "bring up" all disconnected consoles, assuming
|
||||
the user has administrative access. It responds with a message starting
|
||||
with "ok" if successful and an error message otherwise (like
|
||||
"unauthorized command"). The client is disconnected if it's successful.
|
||||
|
||||
|
||||
"group" Mode
|
||||
------------
|
||||
|
||||
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]"
|
59
README
59
README
@ -1,59 +0,0 @@
|
||||
README
|
||||
======
|
||||
|
||||
|
||||
Maintainer/Enhancer
|
||||
|
||||
Bryan Stansell (bryan@conserver.com)
|
||||
|
||||
|
||||
Documentation
|
||||
|
||||
See the INSTALL file for installation, the conserver.html file for
|
||||
an overview, and the man pages for specifics.
|
||||
|
||||
|
||||
Downloading
|
||||
|
||||
The latest version can be found at http://www.conserver.com/
|
||||
|
||||
|
||||
Systems Tested
|
||||
|
||||
Here's a list of systems that I've been told can successfully
|
||||
compile conserver. If anyone has more to add to this list (or
|
||||
something on the list doesn't work any more), please let me know.
|
||||
|
||||
AIX 4.3.3/5.1/5.2, native cc
|
||||
BSDI BSD/OS 3.X, gcc
|
||||
Cygwin (w2k),gcc 2.95.3
|
||||
DEC Tru64 4.0, gcc
|
||||
DEC Tru64 4.0/5.1, native cc
|
||||
FreeBSD 4.2/4.8/5.1 (x86), gcc
|
||||
HP-UX 10.20, gcc
|
||||
HP-UX 11.10 parisc and ia64, native cc
|
||||
Irix 6.15, native cc
|
||||
Linux 2.2.18 (x86), gcc
|
||||
Linux 2.4.2 (x86), gcc
|
||||
Linux ia64, native gcc
|
||||
Linux RedHat 6.2 and 7.2 (x86), native gcc
|
||||
MacOS X, native gcc
|
||||
Solaris 2.5.1 thru 9 (sparc/x86), gcc
|
||||
Solaris 7/8, native cc
|
||||
|
||||
|
||||
Contributions
|
||||
|
||||
Contributions distributed with the code can be found in the contrib
|
||||
subdirectory. Other tools that complement conserver are listed
|
||||
below.
|
||||
|
||||
Zinc
|
||||
----
|
||||
According to the website, Zinc is a console log output management
|
||||
program. For more information, visit the website at:
|
||||
http://www.columbia.edu/acis/sy/unixdev/zinc
|
||||
|
||||
#
|
||||
# $Id: README,v 1.22 2003-08-23 12:34:24-07 bryan Exp $
|
||||
#
|
35
README.md
Normal file
35
README.md
Normal file
@ -0,0 +1,35 @@
|
||||
Conserver
|
||||
=========
|
||||
|
||||
[](https://cirrus-ci.com/github/conserver/conserver)
|
||||
|
||||
Conserver is an application that allows multiple users to watch a
|
||||
serial console at the same time. It can log the data, allows users to
|
||||
take write-access of a console (one at a time), and has a variety of
|
||||
bells and whistles to accentuate that basic functionality. The idea is
|
||||
that conserver will log all your serial traffic so you can go back and
|
||||
review why something crashed, look at changes (if done on the console),
|
||||
or tie the console logs into a monitoring system (just watch the
|
||||
logfiles it creates). With multi-user capabilities you can work on
|
||||
equipment with others, mentor, train, etc. It also does all that
|
||||
client-server stuff so that, assuming you have a network connection,
|
||||
you can interact with any of the equipment from home or wherever.
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
See the `INSTALL` file for installation and the man pages for specifics.
|
||||
|
||||
|
||||
Downloading
|
||||
-----------
|
||||
|
||||
The latest version can be found on [GitHub](https://github.com/conserver/conserver/releases).
|
||||
|
||||
|
||||
Contributions
|
||||
-------------
|
||||
|
||||
Contributions distributed with the code can be found in the `contrib`
|
||||
subdirectory.
|
50
TODO
50
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,19 +50,17 @@ 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>
|
||||
|
||||
- config file for client (list of masters, for example)
|
||||
|
||||
- strftime() idea for logfile names : Lars Kellogg-Stedman <lars@larsshack.org>
|
||||
|
||||
- 9600baud log replay?
|
||||
|
||||
- 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 +71,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 +81,28 @@ 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!
|
||||
|
||||
#
|
||||
# $Id: TODO,v 1.38 2003-10-31 09:53:46-08 bryan Exp $
|
||||
#
|
||||
- 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>
|
||||
|
||||
- netgroup support? : Nikolaos Papavassiliou
|
||||
<Nikolaos.Papavassiliou@reuters.com> and Phil Dibowitz <phil@usc.edu>
|
||||
|
||||
- send sequences to console on client connect? (to repaint screen,
|
||||
for example) : John Cagle <jcagle@gmail.com>
|
||||
|
||||
- uucp locks : Sebastian Zagrodzki <sebek@heron.net.icm.edu.pl>
|
||||
|
||||
- support more than 9 break sequences : Danish Mirza <Danish@lehman.com>
|
||||
thought it was easy, but adding more than could break things with
|
||||
current encoding. doable, will have to think harder about it.
|
||||
|
||||
- reintroduce console grouping : Martin Turba
|
||||
<martin.turba@igd.fraunhofer.de>
|
||||
|
||||
- quick-recheck of down consoles (for uds) and possibly only log state
|
||||
changes (instead of each try) : DJ Gregor <dj@gregor.com>
|
||||
|
1
_config.yml
Normal file
1
_config.yml
Normal file
@ -0,0 +1 @@
|
||||
theme: jekyll-theme-cayman
|
@ -1,5 +1,3 @@
|
||||
# $Id: INSTALL,v 1.3 94/07/11 12:38:19 ksb 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
|
||||
world).
|
||||
|
@ -1,4 +1,5 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
@ -31,6 +32,8 @@ ALL = autologin
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
$(AUTOLOGIN_OBJS): $(AUTOLOGIN_HDRS)
|
||||
|
||||
autologin: $(AUTOLOGIN_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o autologin $(AUTOLOGIN_OBJS) $(LIBS)
|
||||
|
||||
@ -43,7 +46,7 @@ clean:
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
||||
install:
|
||||
install: autologin
|
||||
$(MKDIR) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) autologin $(DESTDIR)$(bindir)
|
||||
|
||||
|
@ -15,7 +15,3 @@ No one I've ever talked to found a need for something like autologin.
|
||||
Good luck.
|
||||
|
||||
Bryan Stansell
|
||||
|
||||
#
|
||||
# $Id: README,v 1.2 2002-09-23 14:08:42-07 bryan Exp $
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
# $Id: README,v 1.3 93/04/21 16:13:37 ksb Exp $
|
||||
|
||||
This program can be used to put a root shell on the console at boot time.
|
||||
See the manual page.
|
||||
|
||||
|
@ -34,13 +34,13 @@
|
||||
* to change the /etc/security/audit_event line.
|
||||
*/
|
||||
|
||||
#define AUE_autologin 32900
|
||||
# define AUE_autologin 32900
|
||||
|
||||
#include <sys/unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <bsm/audit.h>
|
||||
#include <bsm/libbsm.h>
|
||||
#include <libintl.h>
|
||||
# include <sys/unistd.h>
|
||||
# include <netdb.h>
|
||||
# include <bsm/audit.h>
|
||||
# include <bsm/libbsm.h>
|
||||
# include <libintl.h>
|
||||
#endif
|
||||
|
||||
#include <compat.h>
|
||||
@ -68,12 +68,9 @@
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char *rcsid = "$Id: autologin.c,v 1.23 2002-09-20 23:29:39-07 bryan Exp $";
|
||||
#endif /* not lint */
|
||||
extern char *progname;
|
||||
gid_t awGrps[NGROUPS_MAX];
|
||||
int iGrps = 0;
|
||||
extern char *progname;
|
||||
gid_t awGrps[NGROUPS_MAX];
|
||||
int iGrps = 0;
|
||||
|
||||
/*
|
||||
* External variables
|
||||
@ -82,512 +79,439 @@ int iGrps = 0;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
void make_utmp();
|
||||
void usage();
|
||||
void make_utmp();
|
||||
void usage();
|
||||
|
||||
int
|
||||
Process()
|
||||
Process(void)
|
||||
{
|
||||
register int c;
|
||||
int iErrs = 0;
|
||||
int i, iNewGrp;
|
||||
gid_t wGid;
|
||||
uid_t wUid;
|
||||
char *pcCmd = (char *)0,
|
||||
*pcDevTty = (char *)0;
|
||||
char *pcTmp;
|
||||
int iErrs = 0;
|
||||
int i, iNewGrp;
|
||||
gid_t wGid;
|
||||
uid_t wUid;
|
||||
char *pcCmd = (char *)0, *pcDevTty = (char *)0;
|
||||
#ifdef HAVE_GETUSERATTR
|
||||
char *pcGrps;
|
||||
#endif
|
||||
struct passwd *pwd;
|
||||
struct stat st;
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
struct termios n_tio;
|
||||
#else
|
||||
# ifdef TIOCNOTTY
|
||||
# ifdef O_CBREAK
|
||||
auto struct tc n_tchars;
|
||||
# else
|
||||
auto struct tchars n_tchars;
|
||||
# endif
|
||||
# ifdef TIOCGLTC
|
||||
auto struct ltchars n_ltchars;
|
||||
# endif
|
||||
# else
|
||||
# ifdef TIOCGETP
|
||||
auto struct sgttyb n_sty;
|
||||
# endif
|
||||
# endif
|
||||
char *pcGrps;
|
||||
#endif
|
||||
struct passwd *pwd;
|
||||
struct stat st;
|
||||
struct termios n_tio;
|
||||
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
|
||||
char my_hostname[MAXHOSTNAMELEN];
|
||||
char my_hostname[MAXHOSTNAMELEN];
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
|
||||
if (0 != gethostname(my_hostname, sizeof(my_hostname))) {
|
||||
(void) fprintf(stderr, "%s: gethostname: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != gethostname(my_hostname, sizeof(my_hostname))) {
|
||||
(void)fprintf(stderr, "%s: gethostname: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif
|
||||
if ((char *)0 != pcCommand) {
|
||||
if ((char *)0 == (pcCmd = (char *)malloc(strlen(pcCommand) + 4))) {
|
||||
(void) fprintf(stderr, "%s: malloc: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
(void)strcpy(pcCmd, "-c ");
|
||||
(void)strcat(pcCmd, pcCommand);
|
||||
if ((char *)0 != pcCommand) {
|
||||
if ((char *)0 == (pcCmd = (char *)malloc(strlen(pcCommand) + 4))) {
|
||||
(void)fprintf(stderr, "%s: malloc: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
(void)strcpy(pcCmd, "-c ");
|
||||
(void)strcat(pcCmd, pcCommand);
|
||||
}
|
||||
|
||||
if ( (char *)0 != pcGroup ) {
|
||||
iErrs += addgroup(pcGroup);
|
||||
}
|
||||
if ((char *)0 != pcGroup) {
|
||||
iErrs += addgroup(pcGroup);
|
||||
}
|
||||
|
||||
if ( (char *)0 == pcLogin ) {
|
||||
static char acLogin[17];
|
||||
if ((struct passwd *)0 == (pwd = getpwuid(geteuid()))) {
|
||||
(void) fprintf(stderr, "%s: %d: uid unknown\n", progname, geteuid());
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
pcLogin = strcpy(acLogin, pwd->pw_name);
|
||||
} else if ((struct passwd *)0 == (pwd = getpwnam(pcLogin))) {
|
||||
(void) fprintf(stderr, "%s: %s: login name unknown\n", progname, pcLogin);
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
if ((char *)0 == pcLogin) {
|
||||
static char acLogin[17];
|
||||
if ((struct passwd *)0 == (pwd = getpwuid(geteuid()))) {
|
||||
(void)fprintf(stderr, "%s: %d: uid unknown\n", progname,
|
||||
geteuid());
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
wUid = pwd->pw_uid;
|
||||
wGid = pwd->pw_gid;
|
||||
(void)endpwent();
|
||||
pcLogin = strcpy(acLogin, pwd->pw_name);
|
||||
} else if ((struct passwd *)0 == (pwd = getpwnam(pcLogin))) {
|
||||
(void)fprintf(stderr, "%s: %s: login name unknown\n", progname,
|
||||
pcLogin);
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
wUid = pwd->pw_uid;
|
||||
wGid = pwd->pw_gid;
|
||||
(void)endpwent();
|
||||
#ifdef HAVE_GETUSERATTR
|
||||
/* getuserattr() returns a funny list of groups:
|
||||
* "grp1\0grp2\0grp3\0\0"
|
||||
*/
|
||||
if (0 == getuserattr(pcLogin, S_SUGROUPS, &pcGrps, SEC_LIST)) {
|
||||
while ('\000' != *pcGrps) {
|
||||
/* ignore "ALL" and any group beginning with '!' */
|
||||
if ('!' == *pcGrps || 0 != strcmp(pcGrps, "ALL")) {
|
||||
iErrs += addgroup(pcGrps);
|
||||
}
|
||||
pcGrps = pcGrps + strlen(pcGrps) + 1;
|
||||
}
|
||||
/* getuserattr() returns a funny list of groups:
|
||||
* "grp1\0grp2\0grp3\0\0"
|
||||
*/
|
||||
if (0 == getuserattr(pcLogin, S_SUGROUPS, &pcGrps, SEC_LIST)) {
|
||||
while ('\000' != *pcGrps) {
|
||||
/* ignore "ALL" and any group beginning with '!' */
|
||||
if ('!' == *pcGrps || 0 != strcmp(pcGrps, "ALL")) {
|
||||
iErrs += addgroup(pcGrps);
|
||||
}
|
||||
pcGrps = pcGrps + strlen(pcGrps) + 1;
|
||||
}
|
||||
#endif /* HAVE_GETUSERATTR */
|
||||
(void)endgrent();
|
||||
}
|
||||
#endif /* HAVE_GETUSERATTR */
|
||||
(void)endgrent();
|
||||
|
||||
if ((char *)0 != pcTty) {
|
||||
if ( '/' == *pcTty ) {
|
||||
pcDevTty = pcTty;
|
||||
} else {
|
||||
if ( (char *)0 == (pcDevTty = (char *)malloc(strlen(pcTty)+5+1) ) ) {
|
||||
(void) fprintf(stderr, "%s: malloc: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
sprintf(pcDevTty, "/dev/%s", pcTty);
|
||||
}
|
||||
if ((char *)0 != pcTty) {
|
||||
if ('/' == *pcTty) {
|
||||
pcDevTty = pcTty;
|
||||
} else {
|
||||
if ((char *)0 ==
|
||||
(pcDevTty = (char *)malloc(strlen(pcTty) + 5 + 1))) {
|
||||
(void)fprintf(stderr, "%s: malloc: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
sprintf(pcDevTty, "/dev/%s", pcTty);
|
||||
}
|
||||
|
||||
|
||||
if (0 != stat(pcDevTty, &st)) {
|
||||
(void) fprintf(stderr, "%s: Can't stat %s: %s\n", progname, pcDevTty, strerror(errno));
|
||||
++iErrs;
|
||||
if (0 != stat(pcDevTty, &st)) {
|
||||
(void)fprintf(stderr, "%s: Can't stat %s: %s\n", progname,
|
||||
pcDevTty, strerror(errno));
|
||||
++iErrs;
|
||||
#if defined(VCHR) && defined(VMPC)
|
||||
} else if (VCHR != st.st_type && VMPC != st.st_type) {
|
||||
(void) fprintf(stderr, "%s: %s is not a character device\n", progname, pcDevTty);
|
||||
++iErrs;
|
||||
} else if (VCHR != st.st_type && VMPC != st.st_type) {
|
||||
(void)fprintf(stderr, "%s: %s is not a character device\n",
|
||||
progname, pcDevTty);
|
||||
++iErrs;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
pcDevTty = (char *)0;
|
||||
}
|
||||
} else {
|
||||
pcDevTty = (char *)0;
|
||||
}
|
||||
|
||||
if (iErrs) {
|
||||
usage();
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != geteuid()) {
|
||||
(void) fprintf(stderr, "%s: Must be root!!!\n", progname);
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (iGrps && 0 < setgroups(iGrps, awGrps)) {
|
||||
(void) fprintf(stderr, "%s: Can't setgroups(): %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (iErrs) {
|
||||
usage();
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != geteuid()) {
|
||||
(void)fprintf(stderr, "%s: Must be root!!!\n", progname);
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (iGrps && 0 < setgroups(iGrps, awGrps)) {
|
||||
(void)fprintf(stderr, "%s: Can't setgroups(): %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* Close open files
|
||||
*/
|
||||
for (i = (char *)0 == pcTty ? 3 : 0; i < getdtablesize(); ++i) {
|
||||
(void) close(i);
|
||||
}
|
||||
/* Close open files
|
||||
*/
|
||||
#if HAVE_CLOSEFROM
|
||||
closefrom((char *)0 == pcTty ? 3 : 0);
|
||||
#else
|
||||
for (i = (char *)0 == pcTty ? 3 : 0; i < getdtablesize(); ++i) {
|
||||
(void)close(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make us a session leader so that when we open /dev/tty
|
||||
* it will become our controlling terminal.
|
||||
*/
|
||||
if (-1 == (iNewGrp = getsid(getpid()))) {
|
||||
if (-1 == (iNewGrp = setsid())) {
|
||||
(void) fprintf(stderr, "%s: setsid: %d: %s\n", progname, iNewGrp, strerror(errno));
|
||||
iNewGrp = getpid();
|
||||
}
|
||||
/* Make us a session leader so that when we open /dev/tty
|
||||
* it will become our controlling terminal.
|
||||
*/
|
||||
if (-1 == (iNewGrp = getsid(getpid()))) {
|
||||
if (-1 == (iNewGrp = setsid())) {
|
||||
(void)fprintf(stderr, "%s: setsid: %d: %s\n", progname,
|
||||
iNewGrp, strerror(errno));
|
||||
iNewGrp = getpid();
|
||||
}
|
||||
|
||||
}
|
||||
#if defined(HAVE_BSM_AUDIT_H) && defined(HAVE_LIBBSM)
|
||||
if (!cannot_audit(0)) {
|
||||
if (!cannot_audit(0)) {
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
struct auditinfo_addr audit_info;
|
||||
struct auditinfo_addr audit_info;
|
||||
# else
|
||||
struct auditinfo audit_info;
|
||||
struct auditinfo audit_info;
|
||||
# endif
|
||||
au_mask_t audit_mask;
|
||||
au_mask_t audit_mask;
|
||||
# if !defined(HAVE_GETAUDIT_ADDR)
|
||||
struct hostent *hp;
|
||||
struct hostent *hp;
|
||||
# endif
|
||||
int iAuditFile;
|
||||
int fShowEvent = 1;
|
||||
token_t *ptAuditToken;
|
||||
int iAuditFile;
|
||||
int fShowEvent = 1;
|
||||
token_t *ptAuditToken;
|
||||
|
||||
(void)memset(&audit_info, 0, sizeof(audit_info));
|
||||
audit_info.ai_auid = wUid;
|
||||
audit_info.ai_asid = getpid();
|
||||
audit_mask.am_success = audit_mask.am_failure = 0;
|
||||
(void) au_user_mask(pcLogin, &audit_mask);
|
||||
audit_info.ai_mask.am_success = audit_mask.am_success;
|
||||
audit_info.ai_mask.am_failure = audit_mask.am_failure;
|
||||
(void)memset(&audit_info, 0, sizeof(audit_info));
|
||||
audit_info.ai_auid = wUid;
|
||||
audit_info.ai_asid = getpid();
|
||||
audit_mask.am_success = audit_mask.am_failure = 0;
|
||||
(void)au_user_mask(pcLogin, &audit_mask);
|
||||
audit_info.ai_mask.am_success = audit_mask.am_success;
|
||||
audit_info.ai_mask.am_failure = audit_mask.am_failure;
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
(void)aug_get_machine(my_hostname,
|
||||
&audit_info.ai_termid.at_addr[0],
|
||||
&audit_info.ai_termid.at_type);
|
||||
(void)aug_get_machine(my_hostname,
|
||||
&audit_info.ai_termid.at_addr[0],
|
||||
&audit_info.ai_termid.at_type);
|
||||
# else
|
||||
if ((char *)0 != (hp = gethostbyname(my_hostname))
|
||||
&& AF_INET == hp->h_addrtype) {
|
||||
(void)memcpy(&audit_info.ai_termid.machine,
|
||||
hp->h_addr,
|
||||
sizeof(audit_info.ai_termid.machine));
|
||||
}
|
||||
# endif
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
if (0 > setaudit_addr(&audit_info, sizeof(audit_info)))
|
||||
# else
|
||||
if (0 > setaudit(&audit_info))
|
||||
# endif
|
||||
{
|
||||
fprintf(stderr, "%s: setaudit failed: %s\n",
|
||||
progname,
|
||||
strerror(errno));
|
||||
fShowEvent = 0;
|
||||
}
|
||||
if (fShowEvent) {
|
||||
fShowEvent = au_preselect(AUE_autologin,
|
||||
&audit_mask,
|
||||
AU_PRS_SUCCESS,
|
||||
AU_PRS_REREAD);
|
||||
}
|
||||
if (fShowEvent) {
|
||||
iAuditFile = au_open();
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
ptAuditToken = au_to_subject_ex(wUid,
|
||||
wUid,
|
||||
wGid,
|
||||
wUid,
|
||||
wGid,
|
||||
audit_info.ai_asid,
|
||||
audit_info.ai_asid,
|
||||
&audit_info.ai_termid),
|
||||
# else
|
||||
ptAuditToken = au_to_subject(wUid,
|
||||
wUid,
|
||||
wGid,
|
||||
wUid,
|
||||
wGid,
|
||||
audit_info.ai_asid,
|
||||
audit_info.ai_asid,
|
||||
&audit_info.ai_termid),
|
||||
# endif
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
ptAuditToken = au_to_text(gettext("successful login"));
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
if ((char *)0 != pcCmd) {
|
||||
ptAuditToken = au_to_text(pcCmd);
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
}
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
ptAuditToken = au_to_return32(0, 0);
|
||||
# else
|
||||
ptAuditToken = au_to_return(0, 0);
|
||||
# endif
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
if(0 > au_close(iAuditFile, AU_TO_WRITE, AUE_autologin)) {
|
||||
fprintf(stderr, "%s: audit write failed",
|
||||
progname,
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
if ((char *)0 != (hp = gethostbyname(my_hostname))
|
||||
&& AF_INET == hp->h_addrtype) {
|
||||
(void)memcpy(&audit_info.ai_termid.machine, hp->h_addr,
|
||||
sizeof(audit_info.ai_termid.machine));
|
||||
}
|
||||
# endif
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
if (0 > setaudit_addr(&audit_info, sizeof(audit_info)))
|
||||
# else
|
||||
if (0 > setaudit(&audit_info))
|
||||
# endif
|
||||
{
|
||||
fprintf(stderr, "%s: setaudit failed: %s\n", progname,
|
||||
strerror(errno));
|
||||
fShowEvent = 0;
|
||||
}
|
||||
if (fShowEvent) {
|
||||
fShowEvent =
|
||||
au_preselect(AUE_autologin, &audit_mask, AU_PRS_SUCCESS,
|
||||
AU_PRS_REREAD);
|
||||
}
|
||||
if (fShowEvent) {
|
||||
iAuditFile = au_open();
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
ptAuditToken =
|
||||
au_to_subject_ex(wUid, wUid, wGid, wUid, wGid,
|
||||
audit_info.ai_asid, audit_info.ai_asid,
|
||||
&audit_info.ai_termid),
|
||||
# else
|
||||
ptAuditToken =
|
||||
au_to_subject(wUid, wUid, wGid, wUid, wGid,
|
||||
audit_info.ai_asid, audit_info.ai_asid,
|
||||
&audit_info.ai_termid),
|
||||
# endif
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
ptAuditToken = au_to_text(gettext("successful login"));
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
if ((char *)0 != pcCmd) {
|
||||
ptAuditToken = au_to_text(pcCmd);
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
}
|
||||
# if defined(HAVE_GETAUDIT_ADDR)
|
||||
ptAuditToken = au_to_return32(0, 0);
|
||||
# else
|
||||
ptAuditToken = au_to_return(0, 0);
|
||||
# endif
|
||||
(void)au_write(iAuditFile, ptAuditToken);
|
||||
if (0 > au_close(iAuditFile, AU_TO_WRITE, AUE_autologin)) {
|
||||
fprintf(stderr, "%s: audit write failed: %s", progname,
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Open the TTY for stdin, stdout and stderr
|
||||
*/
|
||||
if ((char *)0 != pcDevTty) {
|
||||
/* Open the TTY for stdin, stdout and stderr
|
||||
*/
|
||||
if ((char *)0 != pcDevTty) {
|
||||
#ifdef TIOCNOTTY
|
||||
if (-1 != (i = open("/dev/tty", 2, 0))) {
|
||||
if ( ioctl(i, TIOCNOTTY, (char *)0) )
|
||||
(void) fprintf(stderr, "%s: ioctl(%d, TIOCNOTTY, (char *)0): %s\n", progname, i, strerror(errno));
|
||||
(void) close(i);
|
||||
}
|
||||
#endif
|
||||
if (0 != open(pcDevTty, O_RDWR, 0666)) {
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
dup(0);
|
||||
dup(0);
|
||||
if (-1 != (i = open("/dev/tty", 2, 0))) {
|
||||
if (ioctl(i, TIOCNOTTY, (char *)0))
|
||||
(void)fprintf(stderr,
|
||||
"%s: ioctl(%d, TIOCNOTTY, (char *)0): %s\n",
|
||||
progname, i, strerror(errno));
|
||||
(void)close(i);
|
||||
}
|
||||
#endif
|
||||
if (0 != open(pcDevTty, O_RDWR, 0666)) {
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
dup(0);
|
||||
dup(0);
|
||||
}
|
||||
|
||||
/* put the tty in out process group
|
||||
*/
|
||||
/* put the tty in out process group
|
||||
*/
|
||||
#ifdef HAVE_TCGETPGRP
|
||||
if (-1 >= (i = tcgetpgrp(0))){
|
||||
(void) fprintf(stderr, "%s: tcgetpgrp: %s\n", progname, strerror(errno));
|
||||
}
|
||||
if (-1 >= (i = tcgetpgrp(0))) {
|
||||
(void)fprintf(stderr, "%s: tcgetpgrp: %s\n", progname,
|
||||
strerror(errno));
|
||||
}
|
||||
#endif
|
||||
#ifndef SETPGRP_VOID
|
||||
if (-1 != i && setpgrp(0, i) ){
|
||||
(void) fprintf(stderr, "%s: setpgrp: %s, i = %d\n", progname, strerror(errno), i);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (-1 != i && setpgrp(0, i)) {
|
||||
(void)fprintf(stderr, "%s: setpgrp: %s, i = %d\n", progname,
|
||||
strerror(errno), i);
|
||||
}
|
||||
#ifdef HAVE_TCSETPGRP
|
||||
if (tcsetpgrp(0, iNewGrp)){
|
||||
(void) fprintf(stderr, "%s: tcsetpgrp: %s\n", progname, strerror(errno));
|
||||
}
|
||||
#endif
|
||||
#ifndef SETPGRP_VOID
|
||||
if (-1 != iNewGrp && setpgrp(0, iNewGrp)){
|
||||
(void) fprintf(stderr, "%s: setpgrp: %s, iNewGrp = %d\n", progname, strerror(errno), iNewGrp);
|
||||
}
|
||||
if (tcsetpgrp(0, iNewGrp)) {
|
||||
(void)fprintf(stderr, "%s: tcsetpgrp: %s\n", progname,
|
||||
strerror(errno));
|
||||
}
|
||||
#endif
|
||||
if (-1 != iNewGrp && setpgrp(0, iNewGrp)) {
|
||||
(void)fprintf(stderr, "%s: setpgrp: %s, iNewGrp = %d\n", progname,
|
||||
strerror(errno), iNewGrp);
|
||||
}
|
||||
|
||||
/* put the tty in the correct mode
|
||||
*/
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
if (0 != ioctl(0, TIOCGETP, (char *)&n_sty)) {
|
||||
fprintf(stderr, "%s: iotcl: getp: %s\n", progname, strerror(errno));
|
||||
exit(10);
|
||||
}
|
||||
#ifdef O_CBREAK
|
||||
n_sty.sg_flags &= ~(O_CBREAK);
|
||||
n_sty.sg_flags |= (O_CRMOD|O_ECHO);
|
||||
#else
|
||||
n_sty.sg_flags &= ~(CBREAK);
|
||||
n_sty.sg_flags |= (CRMOD|ECHO);
|
||||
#endif
|
||||
n_sty.sg_kill = '\025'; /* ^U */
|
||||
n_sty.sg_erase = '\010'; /* ^H */
|
||||
if (0 != ioctl(0, TIOCSETP, (char *)&n_sty)) {
|
||||
fprintf(stderr, "%s: iotcl: setp: %s\n", progname, strerror(errno));
|
||||
exit(10);
|
||||
}
|
||||
|
||||
/* stty undef all tty chars
|
||||
*/
|
||||
#if 0
|
||||
if (-1 == ioctl(0, TIOCGETC, (char *)&n_tchars)) {
|
||||
fprintf(stderr, "%s: ioctl: getc: %s\n", progname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
n_tchars.t_intrc = -1;
|
||||
n_tchars.t_quitc = -1;
|
||||
if (-1 == ioctl(0, TIOCSETC, (char *)&n_tchars)) {
|
||||
fprintf(stderr, "%s: ioctl: setc: %s\n", progname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef TIOCGLTC
|
||||
if (-1 == ioctl(0, TIOCGLTC, (char *)&n_ltchars)) {
|
||||
fprintf(stderr, "%s: ioctl: gltc: %s\n", progname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
n_ltchars.t_suspc = -1;
|
||||
n_ltchars.t_dsuspc = -1;
|
||||
n_ltchars.t_flushc = -1;
|
||||
n_ltchars.t_lnextc = -1;
|
||||
if (-1 == ioctl(0, TIOCSLTC, (char *)&n_ltchars)) {
|
||||
fprintf(stderr, "%s: ioctl: sltc: %s\n", progname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#else /* not using ioctl, using POSIX or sun stuff */
|
||||
/* put the tty in the correct mode
|
||||
*/
|
||||
#ifdef HAVE_TCGETATTR
|
||||
if (0 != tcgetattr(0, &n_tio)) {
|
||||
(void) fprintf(stderr, "%s: tcgetattr: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != tcgetattr(0, &n_tio)) {
|
||||
(void)fprintf(stderr, "%s: tcgetattr: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#else
|
||||
if (0 != ioctl(0, TCGETS, &n_tio)) {
|
||||
(void) fprintf(stderr, "%s: iotcl: TCGETS: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != ioctl(0, TCGETS, &n_tio)) {
|
||||
(void)fprintf(stderr, "%s: iotcl: TCGETS: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif
|
||||
n_tio.c_iflag &= ~(IGNCR|IUCLC);
|
||||
n_tio.c_iflag |= ICRNL|IXON|IXANY;
|
||||
n_tio.c_oflag &= ~(OLCUC|ONOCR|ONLRET|OFILL|NLDLY|CRDLY|TABDLY|BSDLY);
|
||||
n_tio.c_oflag |= OPOST|ONLCR|TAB3;
|
||||
n_tio.c_lflag &= ~(XCASE|NOFLSH|ECHOK|ECHONL);
|
||||
n_tio.c_lflag |= ISIG|ICANON|ECHO;
|
||||
n_tio.c_cc[VEOF] = '\004'; /* ^D */
|
||||
n_tio.c_cc[VEOL] = '\000'; /* EOL */
|
||||
n_tio.c_cc[VERASE] = '\010'; /* ^H */
|
||||
n_tio.c_cc[VINTR] = '\003'; /* ^C */
|
||||
n_tio.c_cc[VKILL] = '\025'; /* ^U */
|
||||
/* MIN */
|
||||
n_tio.c_cc[VQUIT] = '\034'; /* ^\ */
|
||||
n_tio.c_cc[VSTART] = '\021'; /* ^Q */
|
||||
n_tio.c_cc[VSTOP] = '\023'; /* ^S */
|
||||
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */
|
||||
n_tio.c_iflag &= ~(IGNCR | IUCLC);
|
||||
n_tio.c_iflag |= ICRNL | IXON | IXANY;
|
||||
n_tio.c_oflag &=
|
||||
~(OLCUC | ONOCR | ONLRET | OFILL | NLDLY | CRDLY | TABDLY | BSDLY);
|
||||
n_tio.c_oflag |= OPOST | ONLCR | TAB3;
|
||||
n_tio.c_lflag &= ~(XCASE | NOFLSH | ECHOK | ECHONL);
|
||||
n_tio.c_lflag |= ISIG | ICANON | ECHO;
|
||||
n_tio.c_cc[VEOF] = '\004'; /* ^D */
|
||||
n_tio.c_cc[VEOL] = '\000'; /* EOL */
|
||||
n_tio.c_cc[VERASE] = '\010'; /* ^H */
|
||||
n_tio.c_cc[VINTR] = '\003'; /* ^C */
|
||||
n_tio.c_cc[VKILL] = '\025'; /* ^U */
|
||||
/* MIN */
|
||||
n_tio.c_cc[VQUIT] = '\034'; /* ^\ */
|
||||
n_tio.c_cc[VSTART] = '\021'; /* ^Q */
|
||||
n_tio.c_cc[VSTOP] = '\023'; /* ^S */
|
||||
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */
|
||||
#ifdef HAVE_TCSETATTR
|
||||
if (0 != tcsetattr(0, TCSANOW, &n_tio)) {
|
||||
(void) fprintf(stderr, "%s: tcsetattr: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#else
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
if (0 != ioctl(0, TCSETS, &n_tio)) {
|
||||
(void) fprintf(stderr, "%s: ioctl: TCSETS: %s\n", progname, strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
if (0 != tcsetattr(0, TCSANOW, &n_tio)) {
|
||||
(void)fprintf(stderr, "%s: tcsetattr: %s\n", progname,
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* setup tty */
|
||||
|
||||
if (fMakeUtmp) {
|
||||
extern char *ttyname();
|
||||
make_utmp(pcLogin, (char *)0 != pcTty ? pcTty : ttyname(0));
|
||||
}
|
||||
/* Change ownership and modes on the tty.
|
||||
*/
|
||||
if ((char *)0 != pcDevTty) {
|
||||
(void) chown(pcDevTty, wUid, wGid);
|
||||
(void) chmod(pcDevTty, (mode_t) TTYMODE);
|
||||
}
|
||||
if (fMakeUtmp) {
|
||||
extern char *ttyname();
|
||||
make_utmp(pcLogin, (char *)0 != pcTty ? pcTty : ttyname(0));
|
||||
}
|
||||
/* Change ownership and modes on the tty.
|
||||
*/
|
||||
if ((char *)0 != pcDevTty) {
|
||||
(void)chown(pcDevTty, wUid, wGid);
|
||||
(void)chmod(pcDevTty, (mode_t) TTYMODE);
|
||||
}
|
||||
|
||||
if ((char *)0 != pcCmd) {
|
||||
execl(PATH_SU, "su", "-", pcLogin, pcCmd, (char *)0);
|
||||
} else {
|
||||
execl(PATH_SU, "su", "-", pcLogin, (char *)0);
|
||||
}
|
||||
if ((char *)0 != pcCmd) {
|
||||
execl(PATH_SU, "su", "-", pcLogin, pcCmd, (char *)0);
|
||||
} else {
|
||||
execl(PATH_SU, "su", "-", pcLogin, (char *)0);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_PUTENV
|
||||
int
|
||||
putenv(pcAssign)
|
||||
char *pcAssign;
|
||||
putenv(char *pcAssign)
|
||||
{
|
||||
register char *pcEq;
|
||||
register char *pcEq;
|
||||
|
||||
if ((char *)0 != (pcEq = strchr(pcAssign, '='))) {
|
||||
*pcEq++ = '\000';
|
||||
(void)setenv(pcAssign, pcEq, 1);
|
||||
*--pcEq = '=';
|
||||
} else {
|
||||
unsetenv(pcAssign);
|
||||
}
|
||||
if ((char *)0 != (pcEq = strchr(pcAssign, '='))) {
|
||||
*pcEq++ = '\000';
|
||||
(void)setenv(pcAssign, pcEq, 1);
|
||||
*--pcEq = '=';
|
||||
} else {
|
||||
unsetenv(pcAssign);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
addgroup(pcGrp)
|
||||
char *pcGrp;
|
||||
addgroup(char *pcGrp)
|
||||
{
|
||||
struct group *grp;
|
||||
struct group *grp;
|
||||
|
||||
grp = getgrnam(pcGrp);
|
||||
if ((struct group *)0 == grp) {
|
||||
(void) fprintf(stderr, "%s: Unknown group: %s\n", progname, pcGrp);
|
||||
return(1);
|
||||
}
|
||||
if (iGrps >= NGROUPS_MAX) {
|
||||
(void) fprintf(stderr, "%s: Too many groups specified with \"%s\".\n", progname, pcGrp);
|
||||
return(1);
|
||||
}
|
||||
awGrps[iGrps++] = grp->gr_gid;
|
||||
return(0);
|
||||
grp = getgrnam(pcGrp);
|
||||
if ((struct group *)0 == grp) {
|
||||
(void)fprintf(stderr, "%s: Unknown group: %s\n", progname, pcGrp);
|
||||
return (1);
|
||||
}
|
||||
if (iGrps >= NGROUPS_MAX) {
|
||||
(void)fprintf(stderr,
|
||||
"%s: Too many groups specified with \"%s\".\n",
|
||||
progname, pcGrp);
|
||||
return (1);
|
||||
}
|
||||
awGrps[iGrps++] = grp->gr_gid;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* install a utmp entry to show the use we know is here is here (ksb)
|
||||
*/
|
||||
void
|
||||
make_utmp(pclogin, pctty)
|
||||
char *pclogin;
|
||||
char *pctty;
|
||||
make_utmp(char *pclogin, char *pctty)
|
||||
{
|
||||
register int iFound, iPos;
|
||||
register int fdUtmp;
|
||||
register char *pcDev;
|
||||
register struct utmp *up;
|
||||
auto struct utmp outmp, utmp;
|
||||
register int iFound, iPos;
|
||||
register int fdUtmp;
|
||||
register char *pcDev;
|
||||
register struct utmp *up;
|
||||
auto struct utmp utmp;
|
||||
|
||||
|
||||
if ((char *)0 == pctty) {
|
||||
return;
|
||||
if ((char *)0 == pctty) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fdUtmp = open(UTMP_FILE, O_RDWR, 0664)) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* create empty utmp entry
|
||||
*/
|
||||
(void)memset(&utmp, 0, sizeof(struct utmp));
|
||||
|
||||
/* Only the last portion of the tty is saved, unless it's
|
||||
* all digits. Then back up and include the previous part
|
||||
* /dev/pty/02 -> pty/02 (not just 02)
|
||||
*/
|
||||
if ((char *)0 != (pcDev = strrchr(pctty, '/'))) {
|
||||
if (!*(pcDev + strspn(pcDev, "/0123456789"))) {
|
||||
while (pcDev != pctty && *--pcDev != '/') {
|
||||
}
|
||||
}
|
||||
|
||||
if ((fdUtmp = open(UTMP_FILE, O_RDWR, 0664)) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* create empty utmp entry
|
||||
*/
|
||||
(void)memset(&utmp, 0, sizeof(struct utmp));
|
||||
|
||||
/* Only the last portion of the tty is saved, unless it's
|
||||
* all digits. Then back up and include the previous part
|
||||
* /dev/pty/02 -> pty/02 (not just 02)
|
||||
*/
|
||||
if ((char *)0 != (pcDev = strrchr(pctty, '/'))) {
|
||||
if (! *(pcDev + strspn(pcDev, "/0123456789"))) {
|
||||
while (pcDev != pctty && *--pcDev != '/') {
|
||||
}
|
||||
}
|
||||
if (*pcDev == '/') {
|
||||
++pcDev;
|
||||
}
|
||||
} else {
|
||||
pcDev = pctty;
|
||||
if (*pcDev == '/') {
|
||||
++pcDev;
|
||||
}
|
||||
} else {
|
||||
pcDev = pctty;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETUTENT
|
||||
/* look through getutent's by pid
|
||||
*/
|
||||
(void)setutent();
|
||||
utmp.ut_pid = getpid();
|
||||
iFound = iPos = 0;
|
||||
while ((up = getutent()) != NULL) {
|
||||
if (up->ut_pid == utmp.ut_pid) {
|
||||
utmp = *up;
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
(void)endutent();
|
||||
/* we were an initprocess, now we are a login shell
|
||||
*/
|
||||
utmp.ut_type = USER_PROCESS;
|
||||
(void)strncpy(utmp.ut_user, pclogin, sizeof(utmp.ut_user));
|
||||
if ('\000' == utmp.ut_line[0]) {
|
||||
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
|
||||
/* look through getutent's by pid
|
||||
*/
|
||||
(void)setutent();
|
||||
utmp.ut_pid = getpid();
|
||||
iFound = iPos = 0;
|
||||
while ((up = getutent()) != NULL) {
|
||||
if (up->ut_pid == utmp.ut_pid) {
|
||||
utmp = *up;
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
(void)endutent();
|
||||
/* we were an initprocess, now we are a login shell
|
||||
*/
|
||||
utmp.ut_type = USER_PROCESS;
|
||||
(void)strncpy(utmp.ut_user, pclogin, sizeof(utmp.ut_user));
|
||||
if ('\000' == utmp.ut_line[0]) {
|
||||
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE_SETTTYENT
|
||||
{
|
||||
# ifdef HAVE_SETTTYENT
|
||||
{
|
||||
register struct ttyent *ty;
|
||||
|
||||
/* look through ttyslots by line?
|
||||
@ -595,56 +519,56 @@ char *pctty;
|
||||
(void)setttyent();
|
||||
iFound = iPos = 0;
|
||||
while ((ty = getttyent()) != NULL) {
|
||||
if (strcmp(ty->ty_name, pcDev) == 0) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
iPos++;
|
||||
if (strcmp(ty->ty_name, pcDev) == 0) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
/* fill in utmp from ty ZZZ */
|
||||
(void)endttyent();
|
||||
}
|
||||
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
|
||||
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
|
||||
(void)strncpy(utmp.ut_host, "(autologin)", sizeof(utmp.ut_host));
|
||||
# else
|
||||
/* look through /etc/utmp by hand (sigh)
|
||||
*/
|
||||
iFound = iPos = 0;
|
||||
while (sizeof(utmp) == read(fdUtmp, &utmp, sizeof(utmp))) {
|
||||
if (0 == strncmp(utmp.ut_line, pcDev, sizeof(utmp.ut_line))) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
(void)strncpy(utmp.ut_line, pcDev, sizeof(utmp.ut_line));
|
||||
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
|
||||
(void)strncpy(utmp.ut_host, "(autologin)", sizeof(utmp.ut_host));
|
||||
#else
|
||||
/* look through /etc/utmp by hand (sigh)
|
||||
*/
|
||||
iFound = iPos = 0;
|
||||
while (sizeof(utmp) == read(fdUtmp, & utmp, sizeof(utmp))) {
|
||||
if (0 == strncmp(utmp.ut_line, pcDev, sizeof(utmp.ut_line))) {
|
||||
++iFound;
|
||||
break;
|
||||
}
|
||||
iPos++;
|
||||
}
|
||||
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
|
||||
iPos++;
|
||||
}
|
||||
(void)strncpy(utmp.ut_name, pclogin, sizeof(utmp.ut_name));
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
utmp.ut_time = time((time_t *) 0);
|
||||
utmp.ut_time = time((time_t *)0);
|
||||
|
||||
if (0 == iFound) {
|
||||
fprintf(stderr, "%s: %s: no ttyslot\n", progname, pctty);
|
||||
} else if (-1 == lseek(fdUtmp, (off_t)(iPos*sizeof(utmp)), 0)) {
|
||||
fprintf(stderr, "%s: lseek: %s\n", progname, strerror(errno));
|
||||
} else {
|
||||
(void)write(fdUtmp, (char *)&utmp, sizeof(utmp));
|
||||
}
|
||||
(void)close(fdUtmp);
|
||||
if (0 == iFound) {
|
||||
fprintf(stderr, "%s: %s: no ttyslot\n", progname, pctty);
|
||||
} else if (-1 == lseek(fdUtmp, (off_t) (iPos * sizeof(utmp)), 0)) {
|
||||
fprintf(stderr, "%s: lseek: %s\n", progname, strerror(errno));
|
||||
} else {
|
||||
(void)write(fdUtmp, (char *)&utmp, sizeof(utmp));
|
||||
}
|
||||
(void)close(fdUtmp);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
char *u_pch;
|
||||
int u_loop;
|
||||
char *u_pch;
|
||||
int u_loop;
|
||||
|
||||
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) {
|
||||
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
|
||||
}
|
||||
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) {
|
||||
fprintf(stdout, "%s\n", u_pch);
|
||||
}
|
||||
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) {
|
||||
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
|
||||
}
|
||||
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) {
|
||||
fprintf(stdout, "%s\n", u_pch);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
# mkcmd parser for autologin program
|
||||
%%
|
||||
static char *rcsid =
|
||||
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
|
||||
%%
|
||||
|
||||
integer variable "iErrs" {
|
||||
|
@ -1,4 +1,3 @@
|
||||
.\" $Id: autologin.man,v 1.3 93/03/16 16:41:45 ksb Exp $
|
||||
.TH AUTOLOGIN 8L PUCC
|
||||
.SH NAME
|
||||
autologin \- create an automatic login session from /etc/inittab
|
||||
@ -112,12 +111,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
|
||||
|
280
autologin/main.c
280
autologin/main.c
@ -13,174 +13,170 @@
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
static int
|
||||
optopt; /* character checked for validity */
|
||||
optopt; /* character checked for validity */
|
||||
|
||||
/* get option letter from argument vector, also does -number correctly
|
||||
* for nice, xargs, and stuff (these extras by ksb)
|
||||
* does +arg if you give a last argument of "+", else give (char *)0
|
||||
*/
|
||||
static int
|
||||
getopt(nargc, nargv, ostr)
|
||||
int nargc;
|
||||
char **nargv, *ostr;
|
||||
getopt(int nargc, char **nargv, char *ostr)
|
||||
{
|
||||
register char *oli; /* option letter list index */
|
||||
static char EMSG[] = ""; /* just a null place */
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
register char *oli; /* option letter list index */
|
||||
static char EMSG[] = ""; /* just a null place */
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
|
||||
if ('\000' == *place) { /* update scanning pointer */
|
||||
if (optind >= nargc)
|
||||
return EOF;
|
||||
if (nargv[optind][0] != '-') {
|
||||
register int iLen;
|
||||
return EOF;
|
||||
}
|
||||
place = nargv[optind];
|
||||
if ('\000' == *++place) /* "-" (stdin) */
|
||||
return EOF;
|
||||
if (*place == '-' && '\000' == place[1]) {
|
||||
/* found "--" */
|
||||
++optind;
|
||||
return EOF;
|
||||
}
|
||||
} /* option letter okay? */
|
||||
/* if we find the letter, (not a `:')
|
||||
* or a digit to match a # in the list
|
||||
*/
|
||||
if ((optopt = *place++) == ':' ||
|
||||
((char *)0 == (oli = strchr(ostr,optopt)) &&
|
||||
(!(isdigit(optopt)||'-'==optopt) || (char *)0 == (oli = strchr(ostr, '#'))))) {
|
||||
if(!*place) ++optind;
|
||||
return('?');
|
||||
if ('\000' == *place) { /* update scanning pointer */
|
||||
if (optind >= nargc)
|
||||
return EOF;
|
||||
if (nargv[optind][0] != '-') {
|
||||
register int iLen;
|
||||
return EOF;
|
||||
}
|
||||
if ('#' == *oli) { /* accept as -digits */
|
||||
optarg = place -1;
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return '#';
|
||||
place = nargv[optind];
|
||||
if ('\000' == *++place) /* "-" (stdin) */
|
||||
return EOF;
|
||||
if (*place == '-' && '\000' == place[1]) {
|
||||
/* found "--" */
|
||||
++optind;
|
||||
return EOF;
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if ('\000' == *place)
|
||||
++optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) { /* no white space */
|
||||
optarg = place;
|
||||
} else if (nargc <= ++optind) { /* no arg!! */
|
||||
place = EMSG;
|
||||
return '*';
|
||||
} else {
|
||||
optarg = nargv[optind]; /* white space */
|
||||
}
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
/* option letter okay? */
|
||||
/* if we find the letter, (not a `:')
|
||||
* or a digit to match a # in the list
|
||||
*/
|
||||
if ((optopt = *place++) == ':' ||
|
||||
((char *)0 == (oli = strchr(ostr, optopt)) &&
|
||||
(!(isdigit(optopt) || '-' == optopt) ||
|
||||
(char *)0 == (oli = strchr(ostr, '#'))))) {
|
||||
if (!*place)
|
||||
++optind;
|
||||
return ('?');
|
||||
}
|
||||
if ('#' == *oli) { /* accept as -digits */
|
||||
optarg = place - 1;
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return '#';
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if ('\000' == *place)
|
||||
++optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) { /* no white space */
|
||||
optarg = place;
|
||||
} else if (nargc <= ++optind) { /* no arg!! */
|
||||
place = EMSG;
|
||||
return '*';
|
||||
} else {
|
||||
optarg = nargv[optind]; /* white space */
|
||||
}
|
||||
return optopt; /* dump back option letter */
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return optopt; /* dump back option letter */
|
||||
}
|
||||
#endif /* ! HAVE_GETOPT */
|
||||
|
||||
char
|
||||
*progname = "$Id$",
|
||||
*au_terse[] = {
|
||||
" [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]",
|
||||
" -h",
|
||||
" -V",
|
||||
(char *)0
|
||||
},
|
||||
*u_help[] = {
|
||||
"c cmd command to run",
|
||||
"e env=value environment variable to set",
|
||||
"g group initial group",
|
||||
"h print this help message",
|
||||
"l login login name",
|
||||
"t tty attach to this terminal",
|
||||
"u do no make utmp entry",
|
||||
"V show version information",
|
||||
(char *)0
|
||||
},
|
||||
*pcCommand = (char *)0,
|
||||
*pcGroup = (char *)0,
|
||||
*pcLogin = (char *)0,
|
||||
*pcTty = (char *)0;
|
||||
*progname = "", *au_terse[] = {
|
||||
" [-u] [-c cmd] [-e env=value] [-g group] [-l login] [-t tty]",
|
||||
" -h",
|
||||
" -V",
|
||||
(char *)0
|
||||
}, *u_help[] = {
|
||||
|
||||
"c cmd command to run",
|
||||
"e env=value environment variable to set",
|
||||
"g group initial group",
|
||||
"h print this help message",
|
||||
"l login login name",
|
||||
"t tty attach to this terminal",
|
||||
"u do no make utmp entry",
|
||||
"V show version information", (char *)0
|
||||
}, *pcCommand = (char *)0, *pcGroup = (char *)0, *pcLogin =
|
||||
(char *)0, *pcTty = (char *)0;
|
||||
int
|
||||
fMakeUtmp = 1,
|
||||
iErrs = 0;
|
||||
fMakeUtmp = 1, iErrs = 0;
|
||||
|
||||
#ifndef u_terse
|
||||
#define u_terse (au_terse[0])
|
||||
# define u_terse (au_terse[0])
|
||||
#endif
|
||||
|
||||
static char *rcsid =
|
||||
"$Id: autologin.m,v 1.2 92/07/28 13:18:34 ksb Exp $";
|
||||
|
||||
/*
|
||||
* parser
|
||||
*/
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
static char
|
||||
sbOpt[] = "c:e:g:hl:t:uV",
|
||||
*u_pch = (char *)0;
|
||||
static int
|
||||
u_loop = 0;
|
||||
register int u_curopt;
|
||||
extern int atoi();
|
||||
static char
|
||||
sbOpt[] = "c:e:g:hl:t:uV", *u_pch = (char *)0;
|
||||
static int
|
||||
u_loop = 0;
|
||||
register int u_curopt;
|
||||
extern int atoi();
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
if ((char *)0 == progname)
|
||||
progname = argv[0];
|
||||
else
|
||||
++progname;
|
||||
while (EOF != (u_curopt = getopt(argc, argv, sbOpt))) {
|
||||
switch (u_curopt) {
|
||||
case '*':
|
||||
fprintf(stderr, "%s: option `-%c\' needs a parameter\n", progname, optopt);
|
||||
exit(1);
|
||||
case '?':
|
||||
fprintf(stderr, "%s: unknown option `-%c\', use `-h\' for help\n", progname, optopt);
|
||||
exit(1);
|
||||
case 'c':
|
||||
pcCommand = optarg;
|
||||
continue;
|
||||
case 'e':
|
||||
if (putenv(optarg) != 0) {
|
||||
(void) fprintf(stderr, "%s: putenv(\"%s\"): failed\n", progname, optarg);
|
||||
exit(1);
|
||||
}
|
||||
continue;
|
||||
case 'g':
|
||||
pcGroup = optarg;
|
||||
continue;
|
||||
case 'h':
|
||||
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]); ++u_loop) {
|
||||
if ('\000' == *u_pch) {
|
||||
fprintf(stdout, "%s: with no parameters\n", progname);
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
|
||||
}
|
||||
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]); ++u_loop) {
|
||||
fprintf(stdout, "%s\n", u_pch);
|
||||
}
|
||||
exit(0);
|
||||
case 'l':
|
||||
pcLogin = optarg;
|
||||
continue;
|
||||
case 't':
|
||||
pcTty = optarg;
|
||||
continue;
|
||||
case 'u':
|
||||
fMakeUtmp = 0;
|
||||
continue;
|
||||
case 'V':
|
||||
printf("%s: %s\n", progname, rcsid);
|
||||
exit(0);
|
||||
progname = strrchr(argv[0], '/');
|
||||
if ((char *)0 == progname)
|
||||
progname = argv[0];
|
||||
else
|
||||
++progname;
|
||||
while (EOF != (u_curopt = getopt(argc, argv, sbOpt))) {
|
||||
switch (u_curopt) {
|
||||
case '*':
|
||||
fprintf(stderr, "%s: option `-%c\' needs a parameter\n",
|
||||
progname, optopt);
|
||||
exit(1);
|
||||
case '?':
|
||||
fprintf(stderr,
|
||||
"%s: unknown option `-%c\', use `-h\' for help\n",
|
||||
progname, optopt);
|
||||
exit(1);
|
||||
case 'c':
|
||||
pcCommand = optarg;
|
||||
continue;
|
||||
case 'e':
|
||||
if (putenv(optarg) != 0) {
|
||||
(void)fprintf(stderr, "%s: putenv(\"%s\"): failed\n",
|
||||
progname, optarg);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
continue;
|
||||
case 'g':
|
||||
pcGroup = optarg;
|
||||
continue;
|
||||
case 'h':
|
||||
for (u_loop = 0; (char *)0 != (u_pch = au_terse[u_loop]);
|
||||
++u_loop) {
|
||||
if ('\000' == *u_pch) {
|
||||
fprintf(stdout, "%s: with no parameters\n",
|
||||
progname);
|
||||
continue;
|
||||
}
|
||||
fprintf(stdout, "%s: usage%s\n", progname, u_pch);
|
||||
}
|
||||
for (u_loop = 0; (char *)0 != (u_pch = u_help[u_loop]);
|
||||
++u_loop) {
|
||||
fprintf(stdout, "%s\n", u_pch);
|
||||
}
|
||||
exit(0);
|
||||
case 'l':
|
||||
pcLogin = optarg;
|
||||
continue;
|
||||
case 't':
|
||||
pcTty = optarg;
|
||||
continue;
|
||||
case 'u':
|
||||
fMakeUtmp = 0;
|
||||
continue;
|
||||
case 'V':
|
||||
printf("%s\n", progname);
|
||||
exit(0);
|
||||
}
|
||||
Process();
|
||||
exit(iErrs);
|
||||
break;
|
||||
}
|
||||
Process();
|
||||
exit(iErrs);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
extern char *progname, *au_terse[4], *u_help[9];
|
||||
#ifndef u_terse
|
||||
#define u_terse (au_terse[0])
|
||||
# define u_terse (au_terse[0])
|
||||
#endif
|
||||
extern int main();
|
||||
extern int fMakeUtmp, iErrs;
|
||||
@ -12,4 +12,3 @@ extern char *pcCommand, *pcGroup, *pcLogin, *pcTty;
|
||||
/* from std_help.m */
|
||||
/* from std_version.m */
|
||||
/* from autologin.m */
|
||||
|
||||
|
122
compat.h
122
compat.h
@ -7,8 +7,9 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/un.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
@ -34,18 +35,29 @@
|
||||
# define DEFESC 'c'
|
||||
#endif
|
||||
|
||||
/* set the default length of the replay functions
|
||||
* DEFREPLAY for 'r'
|
||||
* DEFPLAYBACK for 'p'
|
||||
*/
|
||||
#if !defined(DEFREPLAY)
|
||||
# define DEFREPLAY 20
|
||||
#endif
|
||||
#if !defined(PLAYBACK)
|
||||
# define DEFPLAYBACK 60
|
||||
#endif
|
||||
|
||||
/* For legacy compile-time setting of the port...
|
||||
*/
|
||||
#if ! defined(DEFPORT)
|
||||
# if defined(SERVICENAME)
|
||||
# define DEFPORT SERVICENAME
|
||||
# if defined(SERVICENAME)
|
||||
# define DEFPORT SERVICENAME
|
||||
# else
|
||||
# if defined(PORTNUMBER)
|
||||
# define DEFPORT PORTNUMBER
|
||||
# else
|
||||
# if defined(PORTNUMBER)
|
||||
# define DEFPORT PORTNUMBER
|
||||
# else
|
||||
# define DEFPORT "conserver"
|
||||
# endif
|
||||
# define DEFPORT "conserver"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
@ -91,6 +103,18 @@ typedef long fd_set;
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#ifndef TAB3
|
||||
# ifdef OXTABS
|
||||
# define TAB3 OXTABS
|
||||
# else
|
||||
# ifdef XTABS
|
||||
# define TAB3 XTABS
|
||||
# else
|
||||
# define TAB3 0
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STROPTS_H
|
||||
# include <stropts.h>
|
||||
#endif
|
||||
@ -105,7 +129,7 @@ typedef long fd_set;
|
||||
#endif
|
||||
|
||||
#if HAVE_TYPES_H
|
||||
#include <sys/types.h>
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
@ -114,30 +138,30 @@ typedef long fd_set;
|
||||
#define LO(s) ((unsigned)((s) & 0377))
|
||||
#define HI(s) ((unsigned)(((s) >> 8) & 0377))
|
||||
#if !defined(WIFEXITED)
|
||||
#define WIFEXITED(s) (LO(s)==0)
|
||||
# define WIFEXITED(s) (LO(s)==0)
|
||||
#endif
|
||||
#if !defined(WEXITSTATUS)
|
||||
#define WEXITSTATUS(s) HI(s)
|
||||
# define WEXITSTATUS(s) HI(s)
|
||||
#endif
|
||||
#if !defined(WIFSIGNALED)
|
||||
#define WIFSIGNALED(s) ((LO(s)>0)&&(HI(s)==0))
|
||||
# define WIFSIGNALED(s) ((LO(s)>0)&&(HI(s)==0))
|
||||
#endif
|
||||
#if !defined(WTERMSIG)
|
||||
#define WTERMSIG(s) (LO(s)&0177)
|
||||
# define WTERMSIG(s) (LO(s)&0177)
|
||||
#endif
|
||||
#if !defined(WIFSTOPPED)
|
||||
#define WIFSTOPPED(s) ((LO(s)==0177)&&(HI(s)!=0))
|
||||
# define WIFSTOPPED(s) ((LO(s)==0177)&&(HI(s)!=0))
|
||||
#endif
|
||||
#if !defined(WSTOPSIG)
|
||||
#define WSTOPSIG(s) HI(s)
|
||||
# define WSTOPSIG(s) HI(s)
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSEXITS_H
|
||||
#include <sysexits.h>
|
||||
# include <sysexits.h>
|
||||
#else
|
||||
#define EX_OK 0
|
||||
#define EX_UNAVAILABLE 69
|
||||
#define EX_TEMPFAIL 75
|
||||
# define EX_OK 0
|
||||
# define EX_UNAVAILABLE 69
|
||||
# define EX_TEMPFAIL 75
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
@ -211,19 +235,19 @@ extern char *h_errlist[];
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_USERSEC_H
|
||||
#include <usersec.h>
|
||||
# include <usersec.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTY_H
|
||||
#include <pty.h>
|
||||
# include <pty.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUTIL_H
|
||||
#include <libutil.h>
|
||||
# include <libutil.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UTIL_H
|
||||
#include <util.h>
|
||||
# include <util.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -256,50 +280,66 @@ typedef int socklen_t;
|
||||
* as legacy definitions.
|
||||
*/
|
||||
#ifndef IUCLC
|
||||
#define IUCLC 0
|
||||
# define IUCLC 0
|
||||
#endif
|
||||
#ifndef OLCUC
|
||||
#define OLCUC 0
|
||||
# define OLCUC 0
|
||||
#endif
|
||||
#ifndef XCASE
|
||||
#define XCASE 0
|
||||
# define XCASE 0
|
||||
#endif
|
||||
/* Some systems don't have OFILL or *DLY. */
|
||||
#ifndef OFILL
|
||||
#define OFILL 0
|
||||
# define OFILL 0
|
||||
#endif
|
||||
#ifndef NLDLY
|
||||
#define NLDLY 0
|
||||
# define NLDLY 0
|
||||
#endif
|
||||
#ifndef CRDLY
|
||||
#define CRDLY 0
|
||||
# define CRDLY 0
|
||||
#endif
|
||||
#ifndef TABDLY
|
||||
#define TABDLY 0
|
||||
# define TABDLY 0
|
||||
#endif
|
||||
#ifndef BSDLY
|
||||
#define BSDLY 0
|
||||
# define BSDLY 0
|
||||
#endif
|
||||
#ifndef ONOCR
|
||||
#define ONOCR 0
|
||||
# define ONOCR 0
|
||||
#endif
|
||||
#ifndef ONLRET
|
||||
#define ONLRET 0
|
||||
# define ONLRET 0
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if PROTOTYPES
|
||||
# define PARAMS(protos) protos
|
||||
# else /* no PROTOTYPES */
|
||||
# define PARAMS(protos) ()
|
||||
# endif /* no PROTOTYPES */
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET L_SET
|
||||
#endif
|
||||
|
||||
/* setup a conditional debugging line */
|
||||
#ifndef CONDDEBUG
|
||||
#define CONDDEBUG(line) if (fDebug) {debugFileName=__FILE__; debugLineNo=__LINE__; Debug line;}
|
||||
# define CONDDEBUG(line) if (fDebug) {debugFileName=__FILE__; debugLineNo=__LINE__; Debug line;}
|
||||
#endif
|
||||
|
||||
#if HAVE_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
# include <dmalloc.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FREEIPMI
|
||||
# include <ipmiconsole.h>
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_STYPE
|
||||
# if USE_IPV6
|
||||
# define INADDR_STYPE struct sockaddr_storage
|
||||
# else
|
||||
# define INADDR_STYPE struct in_addr
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SOCKADDR_STYPE
|
||||
# if USE_IPV6
|
||||
# define SOCKADDR_STYPE struct sockaddr_storage
|
||||
# else
|
||||
# define SOCKADDR_STYPE struct sockaddr_in
|
||||
# endif
|
||||
#endif
|
||||
|
1410
config.guess
vendored
1410
config.guess
vendored
File diff suppressed because it is too large
Load Diff
347
config.h.in
347
config.h.in
@ -1,347 +0,0 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Config file path */
|
||||
#undef CONFIGFILE
|
||||
|
||||
/* ./configure invocation */
|
||||
#undef CONFIGINVOCATION
|
||||
|
||||
/* TCP connection timeout */
|
||||
#undef CONNECTTIMEOUT
|
||||
|
||||
/* Base socket used for secondary channel */
|
||||
#undef DEFBASEPORT
|
||||
|
||||
/* Socket used to communicate */
|
||||
#undef DEFPORT
|
||||
|
||||
/* Define to 1 if you have the `bigcrypt' function. */
|
||||
#undef HAVE_BIGCRYPT
|
||||
|
||||
/* Define to 1 if you have the <bsm/audit.h> header file. */
|
||||
#undef HAVE_BSM_AUDIT_H
|
||||
|
||||
/* Define to 1 if you have the <crypt.h> header file. */
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
/* have dmalloc support */
|
||||
#undef HAVE_DMALLOC
|
||||
|
||||
/* Define to 1 if you have the `getaudit' function. */
|
||||
#undef HAVE_GETAUDIT
|
||||
|
||||
/* Define to 1 if you have the `getaudit_addr' function. */
|
||||
#undef HAVE_GETAUDIT_ADDR
|
||||
|
||||
/* Define to 1 if you have the `getdtablesize' function. */
|
||||
#undef HAVE_GETDTABLESIZE
|
||||
|
||||
/* Define to 1 if you have the `getlogin' function. */
|
||||
#undef HAVE_GETLOGIN
|
||||
|
||||
/* Define to 1 if you have the `getopt' function. */
|
||||
#undef HAVE_GETOPT
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the `getprpwnam' function. */
|
||||
#undef HAVE_GETPRPWNAM
|
||||
|
||||
/* Define to 1 if you have the `getrlimit' function. */
|
||||
#undef HAVE_GETRLIMIT
|
||||
|
||||
/* Define to 1 if you have the `getsid' function. */
|
||||
#undef HAVE_GETSID
|
||||
|
||||
/* Define to 1 if you have the `getspnam' function. */
|
||||
#undef HAVE_GETSPNAM
|
||||
|
||||
/* Define to 1 if you have the `getuserattr' function. */
|
||||
#undef HAVE_GETUSERATTR
|
||||
|
||||
/* Define to 1 if you have the `getutent' function. */
|
||||
#undef HAVE_GETUTENT
|
||||
|
||||
/* Define to 1 if you have the `grantpt' function. */
|
||||
#undef HAVE_GRANTPT
|
||||
|
||||
/* Define to 1 if you have the <hpsecurity.h> header file. */
|
||||
#undef HAVE_HPSECURITY_H
|
||||
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Defined if in_addr_t exists */
|
||||
#undef HAVE_IN_ADDR_T
|
||||
|
||||
/* Define to 1 if you have the `iscomsec' function. */
|
||||
#undef HAVE_ISCOMSEC
|
||||
|
||||
/* Define to 1 if you have the `bsm' library (-lbsm). */
|
||||
#undef HAVE_LIBBSM
|
||||
|
||||
/* Define to 1 if you have the `sec' library (-lsec). */
|
||||
#undef HAVE_LIBSEC
|
||||
|
||||
/* Define to 1 if you have the `util' library (-lutil). */
|
||||
#undef HAVE_LIBUTIL
|
||||
|
||||
/* Define to 1 if you have the <libutil.h> header file. */
|
||||
#undef HAVE_LIBUTIL_H
|
||||
|
||||
/* Define to 1 if you have the `xnet' library (-lxnet). */
|
||||
#undef HAVE_LIBXNET
|
||||
|
||||
/* Define to 1 if you have the `memcmp' function. */
|
||||
#undef HAVE_MEMCMP
|
||||
|
||||
/* Define to 1 if you have the `memcpy' function. */
|
||||
#undef HAVE_MEMCPY
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `openpty' function. */
|
||||
#undef HAVE_OPENPTY
|
||||
|
||||
/* have openssl support */
|
||||
#undef HAVE_OPENSSL
|
||||
|
||||
/* have PAM support */
|
||||
#undef HAVE_PAM
|
||||
|
||||
/* Define to 1 if you have the <prot.h> header file. */
|
||||
#undef HAVE_PROT_H
|
||||
|
||||
/* Define to 1 if you have the `ptsname' function. */
|
||||
#undef HAVE_PTSNAME
|
||||
|
||||
/* Define to 1 if you have the <pty.h> header file. */
|
||||
#undef HAVE_PTY_H
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Defined if sa_len member exists in struct sockaddr */
|
||||
#undef HAVE_SA_LEN
|
||||
|
||||
/* Define to 1 if you have the `setgroups' function. */
|
||||
#undef HAVE_SETGROUPS
|
||||
|
||||
/* Define to 1 if you have the `setlinebuf' function. */
|
||||
#undef HAVE_SETLINEBUF
|
||||
|
||||
/* Define to 1 if you have the `setpgrp' function. */
|
||||
#undef HAVE_SETPGRP
|
||||
|
||||
/* Define to 1 if you have the `setproctitle' function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define to 1 if you have the `setsid' function. */
|
||||
#undef HAVE_SETSID
|
||||
|
||||
/* Define to 1 if you have the `setsockopt' function. */
|
||||
#undef HAVE_SETSOCKOPT
|
||||
|
||||
/* Define to 1 if you have the `setttyent' function. */
|
||||
#undef HAVE_SETTTYENT
|
||||
|
||||
/* Define to 1 if you have the `setvbuf' function. */
|
||||
#undef HAVE_SETVBUF
|
||||
|
||||
/* Define to 1 if you have the <shadow.h> header file. */
|
||||
#undef HAVE_SHADOW_H
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Defined if socklen_t exists */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if strcasecmp is available */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if stricmp is available */
|
||||
#undef HAVE_STRICMP
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <stropts.h> header file. */
|
||||
#undef HAVE_STROPTS_H
|
||||
|
||||
/* Define to 1 if you have the `sysconf' function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define to 1 if you have the <sysexits.h> header file. */
|
||||
#undef HAVE_SYSEXITS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/audit.h> header file. */
|
||||
#undef HAVE_SYS_AUDIT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl_compat.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_COMPAT_H
|
||||
|
||||
/* 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/proc.h> header file. */
|
||||
#undef HAVE_SYS_PROC_H
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#undef HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/sockio.h> header file. */
|
||||
#undef HAVE_SYS_SOCKIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ttold.h> header file. */
|
||||
#undef HAVE_SYS_TTOLD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
#undef HAVE_SYS_UIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/vlimit.h> header file. */
|
||||
#undef HAVE_SYS_VLIMIT_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the `tcgetattr' function. */
|
||||
#undef HAVE_TCGETATTR
|
||||
|
||||
/* Define to 1 if you have the `tcgetpgrp' function. */
|
||||
#undef HAVE_TCGETPGRP
|
||||
|
||||
/* Define to 1 if you have the `tcsendbreak' function. */
|
||||
#undef HAVE_TCSENDBREAK
|
||||
|
||||
/* Define to 1 if you have the `tcsetattr' function. */
|
||||
#undef HAVE_TCSETATTR
|
||||
|
||||
/* Define to 1 if you have the `tcsetpgrp' function. */
|
||||
#undef HAVE_TCSETPGRP
|
||||
|
||||
/* Define to 1 if you have the <ttyent.h> header file. */
|
||||
#undef HAVE_TTYENT_H
|
||||
|
||||
/* Define to 1 if you have the <types.h> header file. */
|
||||
#undef HAVE_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `unlockpt' function. */
|
||||
#undef HAVE_UNLOCKPT
|
||||
|
||||
/* Define to 1 if you have the <usersec.h> header file. */
|
||||
#undef HAVE_USERSEC_H
|
||||
|
||||
/* Define to 1 if you have the <util.h> header file. */
|
||||
#undef HAVE_UTIL_H
|
||||
|
||||
/* Logfile path */
|
||||
#undef LOGFILEPATH
|
||||
|
||||
/* Hostname of console server */
|
||||
#undef MASTERHOST
|
||||
|
||||
/* Number of consoles per child process */
|
||||
#undef MAXMEMB
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Password file path */
|
||||
#undef PASSWDFILE
|
||||
|
||||
/* pidfile to write to */
|
||||
#undef PIDFILE
|
||||
|
||||
/* Define to 1 if the C compiler supports function prototypes. */
|
||||
#undef PROTOTYPES
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to 1 if the `setpgrp' function takes no argument. */
|
||||
#undef SETPGRP_VOID
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Defined if we trust reverse DNS */
|
||||
#undef TRUST_REVERSE_DNS
|
||||
|
||||
/* use tcp_wrappers libwrap */
|
||||
#undef USE_LIBWRAP
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define like PROTOTYPES; this can be used by system headers. */
|
||||
#undef __PROTOTYPES
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define if <signal.h> does not define sig_atomic_t */
|
||||
#undef sig_atomic_t
|
1508
config.sub
vendored
1508
config.sub
vendored
File diff suppressed because it is too large
Load Diff
@ -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])
|
||||
@ -13,12 +14,23 @@ AH_TEMPLATE([USE_LIBWRAP], [use tcp_wrappers libwrap])
|
||||
dnl AH_TEMPLATE([HAVE_POSIX_REGCOMP], [have POSIX regcomp])
|
||||
AH_TEMPLATE([HAVE_PAM], [have PAM support])
|
||||
AH_TEMPLATE([HAVE_OPENSSL], [have openssl support])
|
||||
AH_TEMPLATE([HAVE_GSSAPI], [have gss-api support])
|
||||
AH_TEMPLATE([HAVE_FREEIPMI], [have freeipmi support])
|
||||
AH_TEMPLATE([STRIP_REALM], [retry username without @REALM with gss-api authentication])
|
||||
AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
|
||||
AH_TEMPLATE([HAVE_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([USE_IPV6], [Defined if building with IPv6 support])
|
||||
AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets])
|
||||
AH_TEMPLATE([FOR_CYCLADES_TS], [Defined if building for a Cyclades TS])
|
||||
AH_TEMPLATE([REQ_SERVER_CERT], [Defined if client requires server SSL certificate])
|
||||
AH_TEMPLATE([TRUST_UDS_CRED], [Defined if we trust credentials from UDS client])
|
||||
|
||||
dnl ### Normal initialization. ######################################
|
||||
AC_INIT
|
||||
AC_INIT([conserver],m4_esyscmd_s([./gen-version number]))
|
||||
AC_PREREQ(2.59)
|
||||
AC_CONFIG_SRCDIR([conserver/main.c])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
@ -31,6 +43,9 @@ fi
|
||||
MKDIR="mkdir -p -m 755"
|
||||
AC_SUBST(MKDIR)
|
||||
|
||||
AC_SUBST(CONSERVER_VERSION, m4_esyscmd_s([./gen-version number]))
|
||||
AC_SUBST(CONSERVER_DATE, m4_esyscmd_s([./gen-version date]))
|
||||
|
||||
|
||||
dnl ### Custom settings. ############################################
|
||||
dnl AC_MSG_CHECKING(whether to allow 64bit compilation)
|
||||
@ -48,7 +63,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 +79,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 +95,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 +109,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 +151,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 +171,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 +188,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 +203,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 +225,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 +239,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 +250,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)])
|
||||
|
||||
use_dash_r=no
|
||||
AC_MSG_CHECKING(whether to use -R paths as well as -L)
|
||||
AC_ARG_WITH(rpath,
|
||||
AS_HELP_STRING([--with-rpath],[Use -R as well as -L for libraries]),
|
||||
[case "$withval" in
|
||||
yes|no)
|
||||
AC_MSG_RESULT($withval)
|
||||
use_dash_r=$withval
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(whether we are building for a Cyclades TS)
|
||||
AC_ARG_WITH(cycladests,
|
||||
AS_HELP_STRING([--with-cycladests],[(deprecated - noop) Build for a Cyclades TS]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(FOR_CYCLADES_TS)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
dnl ### Check for compiler et al. ###################################
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
@ -224,7 +301,6 @@ AC_PROG_MAKE_SET
|
||||
dnl ### Compiler characteristics. ##################################
|
||||
AC_AIX
|
||||
AC_C_CONST
|
||||
AC_C_PROTOTYPES
|
||||
|
||||
dnl AC_CHECK_SIZEOF(long)
|
||||
dnl if test "$ac_cv_sizeof_long" -gt 4; then
|
||||
@ -244,12 +320,20 @@ 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 sys/un.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_TYPE_UID_T
|
||||
|
||||
AC_CHECK_TYPE([sig_atomic_t],,
|
||||
AC_DEFINE(sig_atomic_t, volatile int,
|
||||
@ -293,13 +377,109 @@ AC_SEARCH_LIBS(crypt,crypt)
|
||||
AC_SUBST(CONSLIBS)
|
||||
AC_SUBST(CONSCPPFLAGS)
|
||||
AC_SUBST(CONSLDFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(whether to use Unix domain sockets)
|
||||
cons_with_uds="NO"
|
||||
AC_ARG_WITH(uds,
|
||||
AS_HELP_STRING([--with-uds@<:@=DIR@:>@ ],
|
||||
[Use Unix domain sockets for client/server communication @<:@/tmp/conserver@:>@]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(UDSDIR, "/tmp/conserver")
|
||||
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
|
||||
AC_MSG_RESULT([/tmp/conserver])
|
||||
cons_with_uds="YES"
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE_UNQUOTED(UDSDIR, "$withval")
|
||||
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
|
||||
AC_MSG_RESULT('$withval')
|
||||
cons_with_uds="YES"
|
||||
if expr "$withval" : '/' >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
echo "*** WARNING *** you may have better success using a fully-qualified path"
|
||||
echo "*** WARNING *** instead of '$withval'"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $cons_with_uds = YES; then
|
||||
AC_MSG_CHECKING(whether to trust UDS credentials)
|
||||
AC_ARG_WITH(trust-uds-cred,
|
||||
AS_HELP_STRING([--with-trust-uds-cred],[Trust UDS credentials obtained via socket]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[
|
||||
struct sockpeercred u;
|
||||
u.uid = 0;
|
||||
#if !defined(SO_PEERCRED)
|
||||
#error "no SO_PEERCRED defined"
|
||||
#endif
|
||||
],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(UDS_CRED_STYPE, sockpeercred, [Defined to UDS credential structure name])
|
||||
AC_DEFINE(UDS_CRED_UID, uid, [Defined to UDS credential structure uid field])
|
||||
AC_DEFINE(UDS_CRED_SO, SO_PEERCRED, [Defined to UDS credential socket option])
|
||||
AC_DEFINE(TRUST_UDS_CRED)],
|
||||
[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[
|
||||
struct ucred u;
|
||||
u.euid = 0;
|
||||
#if !defined(SO_PEERCRED)
|
||||
#error "no SO_PEERCRED defined"
|
||||
#endif
|
||||
],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(UDS_CRED_STYPE, ucred, [Defined to UDS credential structure name])
|
||||
AC_DEFINE(UDS_CRED_UID, uid, [Defined to UDS credential structure uid field])
|
||||
AC_DEFINE(UDS_CRED_SO, SO_PEERCRED, [Defined to UDS credential socket option])
|
||||
AC_DEFINE(TRUST_UDS_CRED)],
|
||||
[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[
|
||||
struct peercred_struct u;
|
||||
u.euid = 0;
|
||||
#if !defined(SO_PEERID)
|
||||
#error "no SO_PEERID defined"
|
||||
#endif
|
||||
],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(UDS_CRED_STYPE, peercred_struct, [Defined to UDS credential structure name])
|
||||
AC_DEFINE(UDS_CRED_UID, euid, [Defined to UDS credential structure uid field])
|
||||
AC_DEFINE(UDS_CRED_SO, SO_PEERID, [Defined to UDS credential socket option])
|
||||
AC_DEFINE(TRUST_UDS_CRED)],
|
||||
[AC_MSG_RESULT(no)]),
|
||||
])
|
||||
])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
fi
|
||||
],[AC_MSG_RESULT(no)])
|
||||
|
||||
cons_with_libwrap="NO"
|
||||
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
|
||||
WRAPCPPFLAGS="-I$withval/include"
|
||||
WRAPLDFLAGS="-L$withval/lib"
|
||||
if test "$use_dash_r" != "yes"; then
|
||||
WRAPLDFLAGS="-L$withval/lib"
|
||||
else
|
||||
WRAPLDFLAGS="-L$withval/lib -R$withval/lib"
|
||||
fi
|
||||
else
|
||||
WRAPCPPFLAGS=""
|
||||
WRAPLDFLAGS=""
|
||||
@ -320,6 +500,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 +513,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,13 +525,18 @@ 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
|
||||
OPENSSLCPPFLAGS="-I$withval/include"
|
||||
OPENSSLLDFLAGS="-L$withval/lib"
|
||||
if test "$use_dash_r" != "yes"; then
|
||||
OPENSSLLDFLAGS="-L$withval/lib"
|
||||
else
|
||||
OPENSSLLDFLAGS="-L$withval/lib -R$withval/lib"
|
||||
fi
|
||||
else
|
||||
OPENSSLCPPFLAGS=""
|
||||
OPENSSLLDFLAGS=""
|
||||
@ -367,8 +554,9 @@ AC_ARG_WITH(openssl,
|
||||
[LIBS="$LIBS -lssl -lcrypto"
|
||||
AC_MSG_CHECKING(for openssl libraries -lssl and -lcrypto)
|
||||
AC_TRY_LINK([#include <openssl/ssl.h>
|
||||
],[SSL_library_init()],
|
||||
],[SSL_CTX_new(NULL)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_openssl="YES"
|
||||
AC_DEFINE(HAVE_OPENSSL)
|
||||
have_openssl=yes],
|
||||
[AC_MSG_RESULT(no)])],)
|
||||
@ -378,16 +566,159 @@ AC_ARG_WITH(openssl,
|
||||
CPPFLAGS="$oCPPFLAGS"
|
||||
LDFLAGS="$oLDFLAGS"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to require server cert)
|
||||
AC_ARG_WITH(req-server-cert,
|
||||
AS_HELP_STRING([--with-req-server-cert],[Require server SSL certificate by client]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(REQ_SERVER_CERT)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
fi]
|
||||
)
|
||||
|
||||
cons_with_gssapi="NO"
|
||||
cons_strip_realm="NO"
|
||||
AC_ARG_WITH(gssapi,
|
||||
AS_HELP_STRING([--with-gssapi@<:@=PATH@:>@],
|
||||
[Compile in GSS-API support]),
|
||||
[if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
GSSAPICPPFLAGS="-I$withval/include"
|
||||
if test "$use_dash_r" != "yes"; then
|
||||
GSSAPILDFLAGS="-L$withval/lib"
|
||||
else
|
||||
GSSAPILDFLAGS="-L$withval/lib -R$withval/lib"
|
||||
fi
|
||||
else
|
||||
GSSAPICPPFLAGS=""
|
||||
GSSAPILDFLAGS=""
|
||||
fi
|
||||
|
||||
oCPPFLAGS="$CPPFLAGS"
|
||||
oLDFLAGS="$LDFLAGS"
|
||||
oLIBS="$LIBS"
|
||||
have_gssapi=no
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $GSSAPICPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $GSSAPILDFLAGS"
|
||||
|
||||
AC_CHECK_HEADER([gssapi/gssapi.h],
|
||||
[LIBS="$oLIBS -lgssapi"
|
||||
AC_MSG_CHECKING(for gssapi library -lgssapi)
|
||||
AC_TRY_LINK([#include <gssapi/gssapi.h>
|
||||
#include <stdio.h>
|
||||
],[gss_create_empty_oid_set(NULL, NULL)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_gssapi="YES"
|
||||
AC_DEFINE(HAVE_GSSAPI)
|
||||
have_gssapi=yes],
|
||||
[AC_MSG_RESULT(no)
|
||||
LIBS="$oLIBS -lgssglue"
|
||||
AC_MSG_CHECKING(for gssapi library -lgssglue)
|
||||
AC_TRY_LINK([#include <gssapi/gssapi.h>
|
||||
#include <stdio.h>
|
||||
],[gss_create_empty_oid_set(NULL, NULL)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_gssapi="YES"
|
||||
AC_DEFINE(HAVE_GSSAPI)
|
||||
have_gssapi=yes],
|
||||
[AC_MSG_RESULT(no)
|
||||
LIBS="$oLIBS -lgss"
|
||||
AC_MSG_CHECKING(for gssapi library -lgss)
|
||||
AC_TRY_LINK([#include <gssapi/gssapi.h>
|
||||
#include <stdio.h>
|
||||
],[gss_create_empty_oid_set(NULL, NULL)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_gssapi="YES"
|
||||
AC_DEFINE(HAVE_GSSAPI)
|
||||
have_gssapi=yes],
|
||||
[AC_MSG_RESULT(no)])])])],)
|
||||
|
||||
if test $have_gssapi = no; then
|
||||
LIBS="$oLIBS"
|
||||
CPPFLAGS="$oCPPFLAGS"
|
||||
LDFLAGS="$oLDFLAGS"
|
||||
else
|
||||
AC_MSG_CHECKING(whether to fallback to username without @REALM)
|
||||
AC_ARG_WITH(striprealm,
|
||||
AS_HELP_STRING([--with-striprealm],[retry username without @REALM with gss-api authentication]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(STRIP_REALM)
|
||||
AC_MSG_RESULT(yes)
|
||||
cons_strip_realm="YES"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
fi
|
||||
fi]
|
||||
)
|
||||
|
||||
cons_with_freeipmi="NO"
|
||||
AC_ARG_WITH(freeipmi,
|
||||
AS_HELP_STRING([--with-freeipmi@<:@=PATH@:>@],
|
||||
[Compile in FreeIPMI support]),
|
||||
[if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
FREEIPMICPPFLAGS="-I$withval/include"
|
||||
if test "$use_dash_r" != "yes"; then
|
||||
FREEIPMILDFLAGS="-L$withval/lib"
|
||||
else
|
||||
FREEIPMILDFLAGS="-L$withval/lib -R$withval/lib"
|
||||
fi
|
||||
else
|
||||
FREEIPMICPPFLAGS=""
|
||||
FREEIPMILDFLAGS=""
|
||||
fi
|
||||
|
||||
oCPPFLAGS="$CPPFLAGS"
|
||||
oLDFLAGS="$LDFLAGS"
|
||||
oLIBS="$LIBS"
|
||||
have_freeipmi=no
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $FREEIPMICPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $FREEIPMILDFLAGS"
|
||||
|
||||
AC_CHECK_HEADER([ipmiconsole.h],
|
||||
[LIBS="$LIBS -lipmiconsole"
|
||||
AC_MSG_CHECKING(for freeipmi libraries -lipmiconsole)
|
||||
AC_TRY_LINK([#include <ipmiconsole.h>
|
||||
],[ipmiconsole_ctx_fd(0)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
cons_with_freeipmi="YES"
|
||||
AC_DEFINE(HAVE_FREEIPMI)
|
||||
CONSLIBS="$CONSLIBS -lipmiconsole"
|
||||
have_freeipmi=yes],
|
||||
[AC_MSG_RESULT(no)])],)
|
||||
|
||||
LIBS="$oLIBS"
|
||||
if test $have_freeipmi = no; then
|
||||
CPPFLAGS="$oCPPFLAGS"
|
||||
LDFLAGS="$oLDFLAGS"
|
||||
fi
|
||||
fi]
|
||||
)
|
||||
|
||||
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
|
||||
DMALLOCCPPFLAGS="-I$withval/include"
|
||||
DMALLOCLDFLAGS="-L$withval/lib"
|
||||
if test "$use_dash_r" != "yes"; then
|
||||
DMALLOCLDFLAGS="-L$withval/lib"
|
||||
else
|
||||
DMALLOCLDFLAGS="-L$withval/lib -R$withval/lib"
|
||||
fi
|
||||
else
|
||||
DMALLOCCPPFLAGS=""
|
||||
DMALLOCLDFLAGS=""
|
||||
@ -407,6 +738,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 +787,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 +800,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 +808,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)])])],)
|
||||
@ -483,6 +818,23 @@ AC_ARG_WITH(pam,
|
||||
AC_MSG_RESULT(no)
|
||||
fi],[AC_MSG_RESULT(no)])
|
||||
|
||||
cons_with_ipv6="NO"
|
||||
AC_MSG_CHECKING(whether to support IPv6)
|
||||
AC_ARG_WITH(ipv6,
|
||||
AS_HELP_STRING([--with-ipv6],
|
||||
[(experimental) Use IPv6 for client/server communication]),
|
||||
[case "$withval" in
|
||||
yes)
|
||||
AC_DEFINE(USE_IPV6)
|
||||
AC_MSG_RESULT(yes)
|
||||
cons_with_ipv6="YES"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac],[AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
dnl Checks for pty allocation...
|
||||
dnl According to the xemacs distribution:
|
||||
dnl getpt() is the preferred pty allocation method on glibc systems.
|
||||
@ -498,8 +850,7 @@ AC_CHECK_HEADERS(pty.h libutil.h util.h)
|
||||
AC_CHECK_LIB(util, openpty)
|
||||
AC_CHECK_FUNCS(openpty)
|
||||
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle)
|
||||
AC_FUNC_SETPGRP
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle gettimeofday strlcpy closefrom)
|
||||
AC_CHECK_FUNC(strcasecmp,
|
||||
[AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])],
|
||||
[AC_CHECK_FUNC(stricmp,
|
||||
@ -515,4 +866,24 @@ AC_CHECK_FUNCS(getaudit getaudit_addr)
|
||||
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_CONFIG_FILES([conserver.cf/conserver.cf.man conserver.cf/conserver.passwd.man conserver/conserver.man console/console.man])
|
||||
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 " GSS-API (--with-gssapi) : $cons_with_gssapi"
|
||||
echo " FreeIPMI (--with-freeipmi) : $cons_with_freeipmi"
|
||||
if [ $cons_with_gssapi = "YES" ]; then
|
||||
echo " strip @REALM (--with-striprealm): $cons_strip_realm"
|
||||
fi
|
||||
echo " dmalloc (--with-dmalloc) : $cons_with_dmalloc"
|
||||
echo " PAM support (--with-pam) : $cons_with_pam"
|
||||
echo " IPv6 support (--with-ipv6) : $cons_with_ipv6"
|
||||
echo ""
|
||||
echo "=============================================================="
|
||||
]
|
@ -1,11 +1,7 @@
|
||||
The two files you need to set up are the conserver.cf and conserver.passwd
|
||||
files. See the sample conserver.cf and conserver.passwd files
|
||||
for examples. You can start with those and then modify extensively.
|
||||
The man page for conserver.cf and conserver.passwd should explain the
|
||||
files with enough detail to get you going.
|
||||
files. See the sample conserver.cf and conserver.passwd files for examples
|
||||
(installed in <DATADIR>/examples/conserver). You can start with those and
|
||||
then modify extensively. The man page for conserver.cf and conserver.passwd
|
||||
should explain the 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 $
|
||||
#
|
||||
|
@ -1,9 +1,11 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
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@
|
||||
@ -23,8 +25,8 @@ distclean: clean
|
||||
|
||||
install:
|
||||
$(MKDIR) $(DESTDIR)$(mandir)/man5
|
||||
$(INSTALL) conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5
|
||||
$(INSTALL) conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5
|
||||
$(INSTALL) -m 0644 conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5
|
||||
$(INSTALL) -m 0644 conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5
|
||||
$(MKDIR) $(DESTDIR)$(exampledir)
|
||||
$(INSTALL) -m 0644 conserver.cf $(DESTDIR)$(exampledir)
|
||||
$(INSTALL) -m 0644 conserver.passwd $(DESTDIR)$(exampledir)
|
||||
|
@ -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,722 +0,0 @@
|
||||
.\" $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"
|
||||
.SH NAME
|
||||
conserver.cf \- console configuration file for
|
||||
.BR conserver (8)
|
||||
.SH DESCRIPTION
|
||||
The format of the conserver.cf file is made up of named blocks of
|
||||
keyword/value pairs, comments, and optional whitespace for formatting
|
||||
flexibility.
|
||||
The block types as well as the keywords are pre-defined and
|
||||
explained in the
|
||||
.B \s-1BLOCKS\s0
|
||||
section.
|
||||
A comment is an unquoted pound-sign
|
||||
to a newline.
|
||||
See the
|
||||
.B \s-1PARSER\s0
|
||||
section for full details on whitespace and quoting.
|
||||
.PP
|
||||
Let me first show you a sample block with a couple of keyword/value
|
||||
pairs to make the description a bit simpler to understand.
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
console simple { master localhost; type exec; rw *; }
|
||||
.fi
|
||||
.ft
|
||||
.PP
|
||||
This is actually a fully functional conserver.cf file (if certain
|
||||
conditions are met...and if you can list those conditions, you can
|
||||
probably can skip to the
|
||||
.B \s-1BLOCKS\s0
|
||||
section).
|
||||
.PP
|
||||
Our example is made of up of a console-block named ``simple'' with three
|
||||
keyword/value pairs.
|
||||
What this does is define a console named ``simple'',
|
||||
makes the master of that console the host ``localhost'', makes the type
|
||||
an exec-style console, and gives every user read/write permission.
|
||||
This is the generic format of the file:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
block-type block-name { keyword value; ... }
|
||||
.fi
|
||||
.ft
|
||||
.PP
|
||||
To show the addition of comments and whitespace, here is the example
|
||||
reformatted (but functionally equivalent):
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
# define a console named "simple"
|
||||
console simple {
|
||||
# setting all required values...
|
||||
master localhost;
|
||||
type exec; # exec-style console
|
||||
rw *; # allow any username
|
||||
}
|
||||
.fi
|
||||
.ft
|
||||
.SH PARSER
|
||||
.PP
|
||||
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
|
||||
quoting characters.
|
||||
.PP
|
||||
Word seperation 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
|
||||
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
|
||||
or value without having to quote it.
|
||||
Here is an example:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
default my defs { rw *; include other defs ; }
|
||||
.fi
|
||||
.ft
|
||||
.PP
|
||||
The block-type is ``default'', the block-name is ``my defs'', and the value
|
||||
for the keyword ``include'' is ``other defs''.
|
||||
Whitespace around tokens are ignored so you get ``other defs''
|
||||
instead of ``other defs '' as the value.
|
||||
.PP
|
||||
The only way to use one of the special characters as part of a block-name
|
||||
or value is to quote it.
|
||||
.PP
|
||||
Quoting is a simple matter of prefixing a character with a backslash or
|
||||
surrounding a group of characters with double-quotes.
|
||||
If a character is prefixed by a backslash, the next character is a
|
||||
literal (so ``\e\e'' produces a ``\e'', ``\e"'' produces ``"'', ``\e{''
|
||||
produces a ``{'', etc.).
|
||||
For double-quoted strings, all characters are literal except for ``\e"'',
|
||||
which embeds a double-quote.
|
||||
.PP
|
||||
Adding a variety of quotes to our example without changing the meaning
|
||||
of things, we have:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
"defa"ult my\e defs { rw *; in\eclude "other defs" ; }
|
||||
.fi
|
||||
.ft
|
||||
.SH BLOCKS
|
||||
.TP 8
|
||||
.B access
|
||||
.RI [ " hostname " | " ipaddr " ]
|
||||
.br
|
||||
Define an access block for the host named
|
||||
.I hostname
|
||||
or using the address
|
||||
.IR ipaddr .
|
||||
If the value of ``*'' is used, the access block will be applied to
|
||||
all conserver hosts.
|
||||
Access lists are used in a first match
|
||||
fashion (top down), so order is important.
|
||||
.RS
|
||||
.TP 15
|
||||
.B admin
|
||||
.RI [ " 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.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for the console servers's admin list are removed.
|
||||
.TP
|
||||
.B allowed
|
||||
.IR hostname ", ..."
|
||||
.br
|
||||
The list of hostnames are added to the ``allowed'' list, which grants
|
||||
connections from the hosts but requires username authentication.
|
||||
.TP
|
||||
.B include
|
||||
.I accessgroup
|
||||
.br
|
||||
The access lists defined using the name
|
||||
.I accessgroup
|
||||
are applied to the current access block.
|
||||
The included access block must be previously defined.
|
||||
.TP
|
||||
.B rejected
|
||||
.IR hostname ", ..."
|
||||
.br
|
||||
The list of hostnames are added to the ``rejected'' list, which rejects
|
||||
connections from the hosts.
|
||||
.TP
|
||||
.B trusted
|
||||
.IR hostname ", ..."
|
||||
.br
|
||||
The list of hostnames are added to the ``trusted'' list, which grants
|
||||
connections from the hosts without username authentication.
|
||||
.RE
|
||||
.TP 8
|
||||
.B break
|
||||
.I n
|
||||
.br
|
||||
Define a break sequence where 0 <
|
||||
.I n
|
||||
< 10.
|
||||
Break sequences are accessed via the
|
||||
.RI ``^El n ''
|
||||
client escape sequence.
|
||||
.RS
|
||||
.TP 15
|
||||
.B delay
|
||||
.I n
|
||||
.br
|
||||
Set the time delay for the
|
||||
.B \ed
|
||||
sequence to
|
||||
.I n
|
||||
milliseconds.
|
||||
The default time delay is 250ms.
|
||||
.TP
|
||||
.B string
|
||||
.I breakseq
|
||||
.br
|
||||
Assign the string
|
||||
.IR breakseq
|
||||
to the specified slot
|
||||
.IR n .
|
||||
A break sequence is a simple character string with the exception of `\e'
|
||||
and `^':
|
||||
.RS
|
||||
.sp
|
||||
.PD 0
|
||||
.TP 6
|
||||
.B \ea
|
||||
alert
|
||||
.TP
|
||||
.B \eb
|
||||
backspace
|
||||
.TP
|
||||
.B \ed
|
||||
0.33 second delay
|
||||
.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 \ez
|
||||
serial break
|
||||
.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
|
||||
.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 conserver hosts.
|
||||
.RS
|
||||
.TP 15
|
||||
.B defaultaccess
|
||||
.RB [ " rejected " | " trusted " | " allowed " ]
|
||||
.br
|
||||
Set the default access permission for all hosts not matched by
|
||||
an access list (see the
|
||||
.B \-a
|
||||
command-line flag).
|
||||
.TP
|
||||
.B daemonmode
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not to become a daemon when run (see the
|
||||
.B \-d
|
||||
command-line flag).
|
||||
.TP
|
||||
.B logfile
|
||||
.I filename
|
||||
.br
|
||||
Set the logfile to write to when in daemon mode (see the
|
||||
.B \-L
|
||||
command-line flag).
|
||||
.TP
|
||||
.B passwdfile
|
||||
.I filename
|
||||
.br
|
||||
Set the password file location used for authentication (see the
|
||||
.B \-P
|
||||
command-line flag).
|
||||
.TP
|
||||
.B primaryport
|
||||
.RI [ " number " | " name " ]
|
||||
.br
|
||||
Set the port used by the master conserver process (see the
|
||||
.B \-p
|
||||
command-line flag).
|
||||
.TP
|
||||
.B redirect
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.br
|
||||
Turn redirection on or off (see the
|
||||
.B \-R
|
||||
command-line flag).
|
||||
.TP
|
||||
.B reinitcheck
|
||||
.I number
|
||||
.br
|
||||
Set the number of seconds used between reinitialization checks (see the
|
||||
.B \-O
|
||||
command-line flag).
|
||||
.TP
|
||||
.B secondaryport
|
||||
.RI [ " number " | " name " ]
|
||||
.br
|
||||
Set the base port number used by child processes (see the
|
||||
.B \-b
|
||||
command-line flag).
|
||||
.TP
|
||||
.B setproctitle
|
||||
.RB [ " yes " | " true " | " on " | " no " | " 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
|
||||
consoles it is managing.
|
||||
The operating system must support the
|
||||
.BR setproctitle ()
|
||||
call.
|
||||
.TP
|
||||
.B sslcredentials
|
||||
.I filename
|
||||
.br
|
||||
Set the
|
||||
.SM SSL
|
||||
credentials file location (see the
|
||||
.B \-c
|
||||
command-line flag).
|
||||
.TP
|
||||
.B sslrequired
|
||||
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
|
||||
.br
|
||||
Set whether or not encryption is required when talking to clients (see the
|
||||
.B \-E
|
||||
command-line flag).
|
||||
.RE
|
||||
.TP 8
|
||||
.B console
|
||||
.I name
|
||||
.br
|
||||
Define a console identified as
|
||||
.IR name .
|
||||
The keywords are the same as the
|
||||
.B default
|
||||
block with the following addition.
|
||||
.RS
|
||||
.TP 15
|
||||
.B aliases
|
||||
.RI [ " name" ", ..."
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of console aliases.
|
||||
If the null string (``""'') is used, any
|
||||
aliases previously defined for the console are removed.
|
||||
.RE
|
||||
.TP 8
|
||||
.B default
|
||||
.I name
|
||||
.br
|
||||
Define a block of defaults identified as
|
||||
.IR name .
|
||||
If
|
||||
.I name
|
||||
is ``*'', the automatically applied default block is defined (basically
|
||||
all consoles have an implicit ``include "*";'' at the begining
|
||||
of their definition).
|
||||
.RS
|
||||
.TP 15
|
||||
.B baud
|
||||
.RB [ " 300 " | " 600 " | " 1800 " | " 2400 " | " 4800"
|
||||
.RB | " 9600 " | " 19200 " | " 38400 " | " 57600 " | " 115200 " ]
|
||||
.br
|
||||
Assign the baud rate to the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
.TP
|
||||
.B break
|
||||
.I n
|
||||
.br
|
||||
Assign the break sequence
|
||||
.I n
|
||||
as the default for the console, which is used by
|
||||
the ``^Ecl0'' client escape sequence.
|
||||
.TP
|
||||
.B device
|
||||
.I filename
|
||||
.br
|
||||
Assign the serial device
|
||||
.I filename
|
||||
as the access to the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
.TP
|
||||
.B exec
|
||||
.RI [ " command "
|
||||
| "" ]
|
||||
.br
|
||||
Assign the string
|
||||
.I command
|
||||
as the command to access the console.
|
||||
Conserver will run the command by
|
||||
invoking ``/bin/sh -ce "\fIcommand\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.
|
||||
.TP
|
||||
.B host
|
||||
.I hostname
|
||||
.br
|
||||
Assign
|
||||
.I hostname
|
||||
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.
|
||||
.TP
|
||||
.B include
|
||||
.I default
|
||||
.br
|
||||
The default block defined using the name
|
||||
.I default
|
||||
is applied to the current console or default block.
|
||||
The included default block must be previously defined.
|
||||
.TP
|
||||
.B initcmd
|
||||
.RI [ " command "
|
||||
| "" ]
|
||||
.br
|
||||
Invoke
|
||||
.I command
|
||||
as soon as the console is brought up, redirecting the console
|
||||
to stdin, stdout, and stderr of
|
||||
.IR command .
|
||||
The
|
||||
.I command
|
||||
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 logfile
|
||||
.RI [ " filename "
|
||||
| "" ]
|
||||
.br
|
||||
Assign the logfile specified by
|
||||
.I filename
|
||||
to the console. Any occurance 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 master
|
||||
.RI [ " hostname " | " ipaddr " ]
|
||||
.br
|
||||
Define which conserver host manages the console.
|
||||
The host may be specified by
|
||||
.I hostname
|
||||
or using the address
|
||||
.IR ipaddr .
|
||||
.TP
|
||||
.B motd
|
||||
.RI [ " message "
|
||||
| "" ]
|
||||
.br
|
||||
Set the "message of the day" for the console to
|
||||
.IR message ,
|
||||
which gets displayed when a client attaches to the console.
|
||||
If the null string (``""'') is used, the MOTD is unset and
|
||||
no message will occur.
|
||||
.TP
|
||||
.B options
|
||||
.RI [ " option" ,...
|
||||
| "" ]
|
||||
.br
|
||||
You can negate the option by prefixing it with a
|
||||
.RB `` ! ''
|
||||
character.
|
||||
So, to turn off the
|
||||
.B hupcl
|
||||
flag, you would use
|
||||
.BR !hupcl .
|
||||
The following are valid
|
||||
.IR option s:
|
||||
.RS
|
||||
.sp
|
||||
.PD 0
|
||||
.TP 12
|
||||
.B ixon
|
||||
Enable
|
||||
.SM XON/XOFF
|
||||
flow control on output.
|
||||
Only consoles of type ``device'' or ``exec'' will use this value.
|
||||
Default is
|
||||
.BR ixon .
|
||||
.TP
|
||||
.B ixany
|
||||
Enable any character to restart output.
|
||||
Only consoles of type ``device'' or ``exec'' will use this value.
|
||||
Default is
|
||||
.BR !ixany .
|
||||
.TP
|
||||
.B ixoff
|
||||
Enable
|
||||
.SM XON/XOFF
|
||||
flow control on input.
|
||||
Only consoles of type ``device'' or ``exec'' will use this value.
|
||||
Default is
|
||||
.B ixoff
|
||||
for consoles of type ``device'' and
|
||||
.B !ixoff
|
||||
for consoles of type ``exec''.
|
||||
.TP
|
||||
.B crtscts
|
||||
Enable
|
||||
.SM RTS/CTS
|
||||
(hardware) flow control.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
Default is
|
||||
.BR !crtscts .
|
||||
.TP
|
||||
.B cstopb
|
||||
Set two stop bits, rather than one.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
Default is
|
||||
.BR !cstopb .
|
||||
.TP
|
||||
.B hupcl
|
||||
Lower modem control lines after last process closes the device (hang up).
|
||||
Only consoles of type ``device'' will use this value.
|
||||
Default is
|
||||
.BR !hupcl .
|
||||
.TP
|
||||
.B ondemand
|
||||
Initialize the console when a client requests a connection to the console.
|
||||
When no clients are connected, bring the console down.
|
||||
The conserver option
|
||||
.B \-i
|
||||
will set this flag for all consoles.
|
||||
Default is
|
||||
.BR !ondemand .
|
||||
.TP
|
||||
.B striphigh
|
||||
Strip the high bit off all data coming from this console and all clients
|
||||
connected to this console before processing occurs.
|
||||
The conserver option
|
||||
.B \-7
|
||||
will set this flag for all consoles.
|
||||
Default is
|
||||
.BR !stiphigh .
|
||||
.TP
|
||||
.B reinitoncc
|
||||
Automatically reinitialize (``bring up'') a downed console when a client
|
||||
connects.
|
||||
Without this option, a client will be attached to the downed console
|
||||
and will need to manually reinitialize the console with an escape sequence.
|
||||
The conserver option
|
||||
.B \-o
|
||||
will set this flag for all consoles.
|
||||
Default is
|
||||
.BR !reinitoncc .
|
||||
.TP
|
||||
.B autoreinit
|
||||
Allow this console to be automatically reinitialized if it unexpectedly
|
||||
goes down.
|
||||
If the console doesn't come back up, it is retried every minute.
|
||||
A console of type ``exec'' that exits with a zero exit status is
|
||||
automatically reinitialized regardless of this setting.
|
||||
The conserver option
|
||||
.B \-F
|
||||
will
|
||||
.B unset
|
||||
this flag for all consoles.
|
||||
Default is
|
||||
.BR autoreinit .
|
||||
.TP
|
||||
.B unloved
|
||||
Enable the sending of this console's output (prefixed with it's
|
||||
name) to the daemon's stdout (or the logfile if in daemon mode) when no
|
||||
clients are connected to the console.
|
||||
The conserver option
|
||||
.B \-u
|
||||
will set this flag for all consoles.
|
||||
Default is
|
||||
.BR !unloved .
|
||||
.PD
|
||||
.RE
|
||||
.TP
|
||||
.B parity
|
||||
.RB [ " even " | " mark " | " none " | " odd " | " space " ]
|
||||
.br
|
||||
Set the parity option for the console.
|
||||
Only consoles of type ``device'' will use this value.
|
||||
.TP
|
||||
.B port
|
||||
.RI [ " number " | " name " ]
|
||||
.br
|
||||
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
|
||||
.BR getservbyname (3)
|
||||
to look up a port number.
|
||||
You must also set the
|
||||
.B host
|
||||
option as well.
|
||||
Only consoles of type ``host'' will use this value.
|
||||
.TP
|
||||
.B ro
|
||||
.RI [ " username" ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the read-only access list
|
||||
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.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for the console's read-only list are removed.
|
||||
.TP
|
||||
.B rw
|
||||
.RI [ " username" ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the read-write access list
|
||||
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.
|
||||
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 ]
|
||||
| "" ]
|
||||
.br
|
||||
Specifies the time between timestamps applied to the console
|
||||
log file and whether to log read/write connection actions.
|
||||
The timestamps look like ``[-- MARK -- Mon Jan 25 14:46:56 1999]''.
|
||||
The
|
||||
.RB ` m ',
|
||||
.RB ` h ',
|
||||
and
|
||||
.RB ` d '
|
||||
tags specify ``minutes'' (the default), ``hours'', and ``days''.
|
||||
The
|
||||
.RB ` l '
|
||||
tag specifies ``lines'' and will cause timestamps of the
|
||||
form ``[Mon Jan 25 14:46:56 PST 1999]'' to
|
||||
be placed every
|
||||
.I number
|
||||
lines (a newline character signifies a new line).
|
||||
So, ``5h'' specifies every five hours and ``2l'' specifies every
|
||||
two lines.
|
||||
An
|
||||
.RB ` a '
|
||||
can be specified to add logs of ``attached'', ``detached'',
|
||||
and ``bumped'' actions, including the user's name and the host from which the
|
||||
client connection was made.
|
||||
A
|
||||
.RB ` b '
|
||||
can be specified to add logging of break sequences sent to the console.
|
||||
.TP
|
||||
.B type
|
||||
.RB [ " device " | " exec " | " host " ]
|
||||
.br
|
||||
Set the type of console. The type
|
||||
.RB `` device ''
|
||||
should be used for local serial ports (also set the
|
||||
.B device
|
||||
option), the type
|
||||
.RB `` exec ''
|
||||
should be used for command invocations (perhaps also set the
|
||||
.B exec
|
||||
option), and the type
|
||||
.RB `` host ''
|
||||
should be used for terminal servers and other socket-based
|
||||
interaction (also set the
|
||||
.B host
|
||||
and
|
||||
.B port
|
||||
options).
|
||||
.RE
|
||||
.TP 8
|
||||
.B group
|
||||
.I name
|
||||
.br
|
||||
Define a user group identified as
|
||||
.I name
|
||||
.RS
|
||||
.TP 15
|
||||
.B users
|
||||
.RI [ " username" ,...
|
||||
| "" ]
|
||||
.br
|
||||
Define a list of users making up the group
|
||||
.IR name .
|
||||
If
|
||||
.I username
|
||||
matches a previously defined group name, all members of the previous
|
||||
group are added to the current group.
|
||||
If the null string (``""'') is used, any
|
||||
users previously defined for this group are removed.
|
||||
.RE
|
||||
.SH AUTHORS
|
||||
Bryan Stansell, conserver.com
|
||||
.SH "SEE ALSO"
|
||||
.BR console (1),
|
||||
.BR conserver.passwd (5),
|
||||
.BR conserver (8)
|
1391
conserver.cf/conserver.cf.man.in
Normal file
1391
conserver.cf/conserver.cf.man.in
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,4 @@
|
||||
.\" $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"
|
||||
.TH CONSERVER.PASSWD 5 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
|
||||
.SH NAME
|
||||
conserver.passwd \- user access information for
|
||||
.BR conserver (8)
|
||||
@ -59,7 +58,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,4 @@
|
||||
%!PS-Adobe-2.0 EPSF-1.2
|
||||
%%$Id: label.ps,v 1.8 94/01/21 09:37:42 ksb 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,7 +1,5 @@
|
||||
# dummy conserver config file
|
||||
#
|
||||
# $Id: test.cf,v 1.2 2003-07-04 11:04:05-07 bryan Exp $
|
||||
#
|
||||
default full {
|
||||
rw *;
|
||||
}
|
||||
|
270
conserver.html
270
conserver.html
@ -1,270 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META name="generator" content=
|
||||
"HTML Tidy for Solaris (vers 1st May 2002), see www.w3.org">
|
||||
<META name="keywords" content=
|
||||
"conserver,serial,console,serial console,unix,tty,ttya,ttyb, rs-232,rs232,bryan stansell,stansell,console server,terminal server,headless">
|
||||
<META name="author" content=
|
||||
"Bryan Stansell <bryan@conserver.com>">
|
||||
<LINK rel="SHORTCUT ICON" href="conserver.ico">
|
||||
|
||||
<TITLE>Conserver</TITLE>
|
||||
|
||||
<STYLE type="text/css">
|
||||
body {
|
||||
background-color: #EEEEEE;
|
||||
color: black;
|
||||
}
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<TABLE summary="Logo" bgcolor="black" width="100%" align=
|
||||
"center">
|
||||
<TR>
|
||||
<TD align="center"><IMG src="conserver.jpg" alt=
|
||||
"Conserver"><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<TABLE summary="Conserver Page" width="80%" align="center">
|
||||
<TR>
|
||||
<TD colspan="2" align="center">Please pick your closest
|
||||
mirror: <A href=
|
||||
"http://planetmirror.com/pub/conserver/">Australia</A>
|
||||
<A href="http://www.conserver.com/">US
|
||||
(Primary)</A><BR>
|
||||
<BR>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD>
|
||||
<!-- empty cell here, then search box on right spans two rows,
|
||||
then we have the text that appears on the left, so things
|
||||
appear in the right order so they look right in lynx
|
||||
-->
|
||||
</TD>
|
||||
|
||||
<TD rowspan="2" align="right">
|
||||
<FORM method="post" action=
|
||||
"http://www.conserver.com/cgi-bin/htsearch">
|
||||
<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">
|
||||
</FORM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD>
|
||||
<H3>What is conserver?</H3>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD colspan="2">
|
||||
<P>From an email I once sent...</P>
|
||||
|
||||
<P>Conserver is an application that allows multiple users
|
||||
to watch a serial console at the same time. It can log
|
||||
the data, allows users to take write-access of a console
|
||||
(one at a time), and has a variety of bells and whistles
|
||||
to accentuate that basic functionality. The idea is that
|
||||
conserver will log all your serial traffic so you can go
|
||||
back and review why something crashed, look at changes
|
||||
(if done on the console), or tie the console logs into a
|
||||
monitoring system (just watch the logfiles it creates).
|
||||
With multi-user capabilities you can work on equipment
|
||||
with others, mentor, train, etc. It also does all that
|
||||
client-server stuff so that, assuming you have a network
|
||||
connection, you can interact with any of the equipment
|
||||
from home or wherever.</P>
|
||||
|
||||
<H3>The FAQ</H3>
|
||||
Here's the conserver <A href="FAQ">FAQ</A>. Got any
|
||||
additions? Let me know.
|
||||
|
||||
<H3>Mailing Lists</H3>
|
||||
|
||||
<P>There are currently two mailing lists available. <A
|
||||
href=
|
||||
"mailto:announce@conserver.com">announce@conserver.com</A>
|
||||
is an announcement-only mailing list for informing of new
|
||||
versions, major developments, etc. <A href=
|
||||
"mailto:users@conserver.com">users@conserver.com</A> is
|
||||
for general Q&A, discussions, ideas, etc. for
|
||||
conserver users. You can sign up by sending a message to
|
||||
<A href=
|
||||
"mailto:announce-request@conserver.com">announce-request@conserver.com</A>
|
||||
or <A href=
|
||||
"mailto:users-request@conserver.com">users-request@conserver.com</A>
|
||||
with a subject of "subscribe" or head over to the online
|
||||
<A href="https://www.conserver.com/mailman/listinfo">web
|
||||
pages</A>.</P>
|
||||
|
||||
<H3>Origin</H3>
|
||||
|
||||
<P>The console server software found here is a heavily
|
||||
modified version originally written by <A href=
|
||||
"http://hea-www.harvard.edu/~fine/">Tom Fine</A> (<A
|
||||
href=
|
||||
"mailto:fine@head-cfa.harvard.edu">fine@head-cfa.harvard.edu</A>)
|
||||
at <A href="http://www.ohio-state.edu/">Ohio State</A>
|
||||
and then Kevin S Braunsdorf (<A href=
|
||||
"mailto:ksb+conserver@sa.fedex.com">ksb+conserver@sa.fedex.com</A>)
|
||||
at <A href="http://www.purdue.edu/">Purdue
|
||||
University</A>. Patches from Robert Olson (<A href=
|
||||
"mailto:olson@mcs.anl.gov">olson@mcs.anl.gov</A>) at <A
|
||||
href="http://www.anl.gov/">Argonne National
|
||||
Laboratory</A> were then applied to get network console
|
||||
support.</P>
|
||||
|
||||
<P>Arnold de Leon (<A href=
|
||||
"mailto:arnold@corp.webtv.net">arnold@corp.webtv.net</A>)
|
||||
then fixed various bugs and added enhancements while at
|
||||
<A href="http://www.synopsys.com/">Synopsys</A>. I then
|
||||
took the result, continued fixing things, and added
|
||||
features we found useful.</P>
|
||||
|
||||
<P><A href="http://www.gnac.com/">GNAC</A> (Global
|
||||
Networking and Computing - currently <A href=
|
||||
"http://www.certaintysolutions.com/">Certainty
|
||||
Solutions</A>) has been supporting my coding efforts (in
|
||||
too many ways to list) since 1996.</P>
|
||||
|
||||
<H3>The conserver.com Distribution</H3>
|
||||
|
||||
<P>The result is a combination of many people's work.
|
||||
This version is being released in hopes that it will help
|
||||
others. There is no warranty or support implied by the
|
||||
distribution of the software.</P>
|
||||
|
||||
<P>So, what the heck is up with all the different
|
||||
conserver versions? Well, the original authors are
|
||||
continuing to distribute their own threads of the
|
||||
software so you have three main threads (as far as I
|
||||
know). First, there's Tom Fine's thread at <A href=
|
||||
"http://hea-www.harvard.edu/~fine/Tech/console-server.html">
|
||||
http://hea-www.harvard.edu/~fine/Tech/console-server.html</A>.
|
||||
He isn't actively developing it, however, according to
|
||||
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
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
<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
|
||||
<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=
|
||||
"CHANGES">CHANGES</A> file for information on the latest
|
||||
updates.</P>
|
||||
|
||||
<P>As of version 6.1.7, the packaging and numbering
|
||||
scheme has changed. I used to package conserver as
|
||||
conserver-GNAC-v.vv. Since <A href=
|
||||
"http://www.gnac.com/">GNAC</A> (now <A href=
|
||||
"http://www.certaintysolutions.com/">Certainty
|
||||
Solutions</A>) has changed its name I've decided to drop
|
||||
the GNAC portion and use a three-digit version number
|
||||
(conserver-v.v.v). Why change the version numbering? I
|
||||
need to differentiate this thread of the code from the
|
||||
original authors' and I couldn't come up with a good
|
||||
replacement for the GNAC name - sad, but true.</P>
|
||||
|
||||
<H3>Installation</H3>
|
||||
|
||||
<P>Check the <A href="INSTALL">INSTALL</A> file for
|
||||
instructions.</P>
|
||||
|
||||
<H3>Systems Tested</H3>
|
||||
|
||||
<P>Here's a list of systems that I've been told can
|
||||
successfully compile conserver. If anyone has more to add
|
||||
to this list (or something on the list doesn't work any
|
||||
more), please let me know.</P>
|
||||
|
||||
<UL>
|
||||
<LI>AIX 4.3.3/5.1/5.2, native cc</LI>
|
||||
|
||||
<LI>BSDI BSD/OS 3.X, gcc</LI>
|
||||
|
||||
<LI>Cygwin (w2k),gcc 2.95.3</LI>
|
||||
|
||||
<LI>DEC Tru64 4.0, gcc</LI>
|
||||
|
||||
<LI>DEC Tru64 4.0/5.1, native cc</LI>
|
||||
|
||||
<LI>FreeBSD 4.2/4.8/5.1 (x86), gcc</LI>
|
||||
|
||||
<LI>HP-UX 10.20, gcc</LI>
|
||||
|
||||
<LI>HP-UX 11.10 parisc and ia64, native cc</LI>
|
||||
|
||||
<LI>Irix 6.15, native cc</LI>
|
||||
|
||||
<LI>Linux 2.2.18 (x86), gcc</LI>
|
||||
|
||||
<LI>Linux 2.4.2 (x86), gcc</LI>
|
||||
|
||||
<LI>Linux ia64, native gcc</LI>
|
||||
|
||||
<LI>Linux RedHat 6.2 and 7.2 (x86), native gcc</LI>
|
||||
|
||||
<LI>MacOS X, native gcc</LI>
|
||||
|
||||
<LI>Solaris 2.5.1 thru 9 (sparc/x86), gcc</LI>
|
||||
|
||||
<LI>Solaris 7/8, native cc</LI>
|
||||
</UL>
|
||||
|
||||
<H3>Other Good Information</H3>
|
||||
|
||||
<P>Zonker Harris has fabulous documents regarding the
|
||||
hookup of consoles to terminal servers and other such
|
||||
devices. His <A href="consoles/">Greater Scroll of
|
||||
Console Knowledge</A> is a great place to start.</P>
|
||||
<HR noshade>
|
||||
|
||||
<ADDRESS>
|
||||
Bryan Stansell (<A href=
|
||||
"mailto:bryan@conserver.com">bryan@conserver.com</A>)<BR>
|
||||
|
||||
</ADDRESS>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
@ -1,4 +1,5 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
@ -6,7 +7,10 @@ exec_prefix = @exec_prefix@
|
||||
sbindir = @sbindir@
|
||||
sysconfdir = @sysconfdir@
|
||||
mandir = @mandir@
|
||||
exampledir = $(prefix)/share/examples/conserver
|
||||
datadir = @datadir@
|
||||
libdir = @libdir@
|
||||
pkglibdir = $(libdir)/conserver
|
||||
exampledir = $(datadir)/examples/conserver
|
||||
|
||||
### Installation programs and flags
|
||||
INSTALL = @INSTALL@
|
||||
@ -27,21 +31,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 $@ $<
|
||||
@ -56,8 +63,10 @@ install: conserver
|
||||
$(MKDIR) $(DESTDIR)$(sbindir)
|
||||
$(INSTALL_PROGRAM) conserver $(DESTDIR)$(sbindir)
|
||||
$(MKDIR) $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) conserver.man $(DESTDIR)$(mandir)/man8/conserver.8
|
||||
$(INSTALL) -m 0644 conserver.man $(DESTDIR)$(mandir)/man8/conserver.8
|
||||
$(MKDIR) $(DESTDIR)$(exampledir)
|
||||
$(INSTALL) conserver.rc $(DESTDIR)$(exampledir)
|
||||
$(MKDIR) $(DESTDIR)$(pkglibdir)
|
||||
$(INSTALL) convert $(DESTDIR)$(pkglibdir)/convert
|
||||
|
||||
.PHONY: clean distclean install
|
||||
|
@ -1,5 +1,3 @@
|
||||
# $Id: Sun-serial,v 2.1 93/02/09 11:45:12 ldv 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.
|
||||
It will also halt when the the console server is powered off and on. To
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: access.c,v 5.68 2003-10-19 22:52:21-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -36,7 +34,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <access.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
@ -44,7 +42,14 @@
|
||||
#include <readcfg.h>
|
||||
#include <main.h>
|
||||
|
||||
#if USE_IPV6
|
||||
# include <net/if.h>
|
||||
# include <ifaddrs.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#if !USE_IPV6
|
||||
/* Compare an Internet address (IPv4 expected), with an address pattern
|
||||
* passed as a character string representing an address in the Internet
|
||||
* standard `.' notation, optionally followed by a slash and an integer
|
||||
@ -58,20 +63,14 @@
|
||||
* Returns 0 if the addresses match, else returns 1.
|
||||
*/
|
||||
int
|
||||
#if PROTOTYPES
|
||||
AddrCmp(struct in_addr *addr, char *pattern)
|
||||
#else
|
||||
AddrCmp(addr, pattern)
|
||||
struct in_addr *addr;
|
||||
char *pattern;
|
||||
#endif
|
||||
{
|
||||
in_addr_t hostaddr, pattern_addr, netmask;
|
||||
char *p, *slash_posn;
|
||||
static STRING *buf = (STRING *)0;
|
||||
#if HAVE_INET_ATON
|
||||
# if HAVE_INET_ATON
|
||||
struct in_addr inetaddr;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (buf == (STRING *)0)
|
||||
buf = AllocString();
|
||||
@ -84,15 +83,15 @@ AddrCmp(addr, pattern)
|
||||
} else
|
||||
p = pattern;
|
||||
|
||||
#if HAVE_INET_ATON
|
||||
# if HAVE_INET_ATON
|
||||
if (inet_aton(p, &inetaddr) == 0)
|
||||
return 1;
|
||||
pattern_addr = inetaddr.s_addr;
|
||||
#else
|
||||
# else
|
||||
pattern_addr = inet_addr(p);
|
||||
if (pattern_addr == (in_addr_t) (-1))
|
||||
return 1; /* malformed address */
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (slash_posn) {
|
||||
/* convert explicit netmask */
|
||||
@ -121,44 +120,108 @@ AddrCmp(addr, pattern)
|
||||
pattern_addr & netmask, pattern_addr, netmask));
|
||||
return (hostaddr & netmask) != (pattern_addr & netmask);
|
||||
}
|
||||
#endif /* USE_IPV6 */
|
||||
|
||||
/* return the access type for a given host entry (ksb)
|
||||
*/
|
||||
char
|
||||
#if PROTOTYPES
|
||||
AccType(struct in_addr *addr, char **peername)
|
||||
#else
|
||||
AccType(addr, peername)
|
||||
struct in_addr *addr;
|
||||
char **peername;
|
||||
#endif
|
||||
AccType(INADDR_STYPE *addr, char **peername)
|
||||
{
|
||||
ACCESS *pACtmp;
|
||||
socklen_t so;
|
||||
char ret;
|
||||
#if USE_IPV6
|
||||
int error;
|
||||
char host[NI_MAXHOST];
|
||||
char ipaddr[NI_MAXHOST];
|
||||
#else
|
||||
struct hostent *he = (struct hostent *)0;
|
||||
int a;
|
||||
#if TRUST_REVERSE_DNS
|
||||
char *pcName;
|
||||
int wlen;
|
||||
char *hname;
|
||||
int len;
|
||||
#endif
|
||||
# if TRUST_REVERSE_DNS
|
||||
char **revNames = (char **)0;
|
||||
# endif
|
||||
|
||||
CONDDEBUG((1, "AccType(): ip=%s", inet_ntoa(*addr)));
|
||||
#endif /* USE_IPV6 */
|
||||
|
||||
ret = config->defaultaccess;
|
||||
so = sizeof(*addr);
|
||||
|
||||
#if USE_IPV6
|
||||
error =
|
||||
getnameinfo((struct sockaddr *)addr, so, ipaddr, sizeof(ipaddr),
|
||||
NULL, 0, NI_NUMERICHOST);
|
||||
if (error) {
|
||||
Error("AccType(): getnameinfo failed: %s", gai_strerror(error));
|
||||
goto common_ret;
|
||||
}
|
||||
CONDDEBUG((1, "AccType(): ip=%s", ipaddr));
|
||||
|
||||
error =
|
||||
getnameinfo((struct sockaddr *)addr, so, host, sizeof(host), NULL,
|
||||
0, 0);
|
||||
if (!error)
|
||||
CONDDEBUG((1, "AccType(): host=%s", host));
|
||||
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *)0; pACtmp = pACtmp->pACnext) {
|
||||
CONDDEBUG((1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
|
||||
pACtmp->ctrust));
|
||||
|
||||
if (strstr(ipaddr, pACtmp->pcwho) != NULL) {
|
||||
CONDDEBUG((1, "AccType(): match for ip=%s", ipaddr));
|
||||
ret = pACtmp->ctrust;
|
||||
goto common_ret;
|
||||
}
|
||||
|
||||
if (!error && strstr(host, pACtmp->pcwho) != NULL) {
|
||||
CONDDEBUG((1, "AccType(): match for host=%s", host));
|
||||
ret = pACtmp->ctrust;
|
||||
goto common_ret;
|
||||
}
|
||||
}
|
||||
common_ret:
|
||||
if (config->loghostnames == FLAGTRUE && !error)
|
||||
*peername = StrDup(host);
|
||||
#else
|
||||
# if TRUST_REVERSE_DNS
|
||||
/* if we trust reverse dns, we get the names associated with
|
||||
* 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,104 +229,158 @@ 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 (
|
||||
#if HAVE_MEMCMP
|
||||
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)
|
||||
#endif
|
||||
== 0) {
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
} 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)
|
||||
# else
|
||||
bcmp(&(addr->s_addr), he->h_addr_list[a],
|
||||
he->h_length)
|
||||
# endif
|
||||
== 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
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
common_ret:
|
||||
if (config->loghostnames == FLAGTRUE && peername != (char **)0) {
|
||||
# if TRUST_REVERSE_DNS
|
||||
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
|
||||
}
|
||||
#endif
|
||||
if (config->loghostnames == FLAGTRUE &&
|
||||
(he =
|
||||
gethostbyaddr((char *)addr, so,
|
||||
AF_INET)) != (struct hostent *)0) {
|
||||
*peername = he->h_name;
|
||||
# if TRUST_REVERSE_DNS
|
||||
common_ret2:
|
||||
if (revNames != (char **)0) {
|
||||
for (a = 0; revNames[a] != (char *)0; a++)
|
||||
free(revNames[a]);
|
||||
free(revNames);
|
||||
}
|
||||
return config->defaultaccess;
|
||||
# endif
|
||||
#endif /* USE_IPV6 */
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
SetDefAccess(struct in_addr *pAddr, char *pHost)
|
||||
SetDefAccess(
|
||||
#if USE_IPV6
|
||||
void
|
||||
#else
|
||||
SetDefAccess(pAddr, pHost)
|
||||
struct in_addr *pAddr;
|
||||
char *pHost;
|
||||
struct in_addr *pAddr, char *pHost
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char *pcDomain;
|
||||
char *addr;
|
||||
ACCESS *a;
|
||||
#if USE_IPV6
|
||||
int error;
|
||||
char addr[NI_MAXHOST];
|
||||
struct ifaddrs *myAddrs, *ifa;
|
||||
#endif /* USE_IPV6 */
|
||||
|
||||
while (pACList != (ACCESS *)0) {
|
||||
a = pACList->pACnext;
|
||||
DestroyAccessList(pACList);
|
||||
pACList = a;
|
||||
}
|
||||
|
||||
#if USE_IPV6
|
||||
/* get list of all addresses on system */
|
||||
error = getifaddrs(&myAddrs);
|
||||
if (error) {
|
||||
Error("SetDefAccess(): getifaddrs: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
for (ifa = myAddrs; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
/* skip interfaces without address or in down state */
|
||||
if (ifa->ifa_addr == NULL || !(ifa->ifa_flags & IFF_UP))
|
||||
continue;
|
||||
|
||||
error =
|
||||
getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_storage),
|
||||
addr, sizeof(addr), NULL, 0, NI_NUMERICHOST);
|
||||
if (error)
|
||||
continue;
|
||||
|
||||
if ((a = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((a->pcwho = StrDup(addr)) == (char *)0)
|
||||
OutOfMem();
|
||||
|
||||
a->ctrust = config->defaultaccess;
|
||||
a->pACnext = pACList;
|
||||
pACList = a;
|
||||
|
||||
CONDDEBUG((1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
|
||||
pACList->pcwho));
|
||||
}
|
||||
freeifaddrs(myAddrs);
|
||||
#elif USE_UNIX_DOMAIN_SOCKETS
|
||||
if ((pACList = (ACCESS *)calloc(1, sizeof(ACCESS))) == (ACCESS *)0)
|
||||
OutOfMem();
|
||||
if ((pACList->pcwho = StrDup("127.0.0.1")) == (char *)0)
|
||||
OutOfMem();
|
||||
pACList->ctrust = config->defaultaccess;
|
||||
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();
|
||||
if ((a->pcwho = StrDup(addr)) == (char *)0)
|
||||
OutOfMem();
|
||||
a->ctrust = 'a';
|
||||
a->ctrust = config->defaultaccess;
|
||||
a->pACnext = pACList;
|
||||
pACList = a;
|
||||
|
||||
@ -271,30 +388,11 @@ 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
|
||||
#if PROTOTYPES
|
||||
DestroyAccessList(ACCESS *pACList)
|
||||
#else
|
||||
DestroyAccessList(pACList)
|
||||
ACCESS *pACList;
|
||||
#endif
|
||||
{
|
||||
if (pACList == (ACCESS *)0)
|
||||
return;
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: access.h,v 5.26 2003-08-10 11:11:20-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -44,6 +42,12 @@ typedef struct access {
|
||||
struct access *pACnext; /* next access list */
|
||||
} ACCESS;
|
||||
|
||||
extern char AccType PARAMS((struct in_addr *, char **));
|
||||
extern void SetDefAccess PARAMS((struct in_addr *, char *));
|
||||
extern void DestroyAccessList PARAMS((ACCESS *));
|
||||
extern char AccType(INADDR_STYPE *, char **);
|
||||
extern void SetDefAccess(
|
||||
#if USE_IPV6
|
||||
void
|
||||
#else
|
||||
struct in_addr *, char *
|
||||
#endif
|
||||
);
|
||||
extern void DestroyAccessList(ACCESS *);
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: client.c,v 5.72 2003-10-02 18:49:13-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -36,15 +34,21 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <access.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
#include <readcfg.h>
|
||||
|
||||
#if USE_IPV6
|
||||
# include <sys/socket.h>
|
||||
# include <netdb.h>
|
||||
#endif /* USE_IPV6 */
|
||||
|
||||
#if defined(USE_LIBWRAP)
|
||||
#include <syslog.h>
|
||||
#include <tcpd.h>
|
||||
# include <syslog.h>
|
||||
# include <tcpd.h>
|
||||
int allow_severity = LOG_INFO;
|
||||
int deny_severity = LOG_WARNING;
|
||||
#endif
|
||||
@ -53,212 +57,171 @@ int deny_severity = LOG_WARNING;
|
||||
/* find the next guy who wants to write on the console (ksb)
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
FindWrite(CONSENT *pCE)
|
||||
#else
|
||||
FindWrite(pCE)
|
||||
CONSENT *pCE;
|
||||
#endif
|
||||
{
|
||||
CONSCLIENT *pCLfound = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCL;
|
||||
|
||||
/* make the first guy to have the `want write' bit set the writer
|
||||
* (tell him of the promotion, too) we could look for the
|
||||
* most recent or some such... I guess it doesn't matter that
|
||||
* much.
|
||||
/* make the first guy (last on the list) to have the `want write' bit set
|
||||
* the writer (tell him of the promotion, too) we could look for the most
|
||||
* recent or some such... I guess it doesn't matter that much.
|
||||
*/
|
||||
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly ||
|
||||
!(pCE->fup && pCE->ioState == ISNORMAL &&
|
||||
pCE->initfile == (CONSFILE *)0))
|
||||
if (pCE->pCLwr != (CONSCLIENT *)0 || pCE->fronly)
|
||||
return;
|
||||
|
||||
for (pCL = pCE->pCLon; (CONSCLIENT *)0 != pCL; pCL = pCL->pCLnext) {
|
||||
if (!pCL->fwantwr || pCL->fro)
|
||||
continue;
|
||||
pCL->fwantwr = 0;
|
||||
pCL->fwr = 1;
|
||||
if (pCL->fwantwr && !pCL->fro)
|
||||
pCLfound = pCL;
|
||||
}
|
||||
|
||||
if (pCLfound != (CONSCLIENT *)0) {
|
||||
pCLfound->fwantwr = 0;
|
||||
pCLfound->fwr = 1;
|
||||
if (pCE->nolog) {
|
||||
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached (nologging)]\r\n",
|
||||
-1);
|
||||
FileWrite(pCLfound->fd, FLAGFALSE,
|
||||
"\r\n[attached (nologging)]\r\n", -1);
|
||||
} else {
|
||||
FileWrite(pCL->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
|
||||
FileWrite(pCLfound->fd, FLAGFALSE, "\r\n[attached]\r\n", -1);
|
||||
}
|
||||
TagLogfileAct(pCE, "%s attached", pCL->acid->string);
|
||||
pCE->pCLwr = pCL;
|
||||
return;
|
||||
TagLogfileAct(pCE, "%s attached", pCLfound->acid->string);
|
||||
pCE->pCLwr = pCLfound;
|
||||
}
|
||||
}
|
||||
|
||||
/* replay last iBack lines of the log file upon connect to console (ksb)
|
||||
void
|
||||
BumpClient(CONSENT *pCE, char *message)
|
||||
{
|
||||
if ((CONSCLIENT *)0 == pCE->pCLwr)
|
||||
return;
|
||||
|
||||
if ((char *)0 != message)
|
||||
FileWrite(pCE->pCLwr->fd, FLAGFALSE, message, -1);
|
||||
pCE->pCLwr->fwantwr = 0;
|
||||
pCE->pCLwr->fwr = 0;
|
||||
pCE->pCLwr = (CONSCLIENT *)0;
|
||||
}
|
||||
|
||||
/* replay last 'back' lines of the log file upon connect to console (ksb)
|
||||
*
|
||||
* NB: we know the console might be spewing when the replay happens,
|
||||
* we want to just output what is in the log file and get out,
|
||||
* so we don't drop chars...
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
Replay(CONSFILE *fdLog, CONSFILE *fdOut, int iBack)
|
||||
#else
|
||||
Replay(fdLog, fdOut, iBack)
|
||||
CONSFILE *fdLog;
|
||||
CONSFILE *fdOut;
|
||||
int iBack;
|
||||
#endif
|
||||
{
|
||||
#define REPLAYBUFFER 4096
|
||||
|
||||
void
|
||||
Replay(CONSENT *pCE, CONSFILE *fdOut, unsigned short back)
|
||||
{
|
||||
CONSFILE *fdLog = (CONSFILE *)0;
|
||||
STRING *line = (STRING *)0;
|
||||
off_t file_pos;
|
||||
off_t buf_pos;
|
||||
char *buf;
|
||||
char *buf = (char *)0;
|
||||
char *bp = (char *)0;
|
||||
char *s;
|
||||
int r;
|
||||
int ch;
|
||||
struct stat stLog;
|
||||
struct lines {
|
||||
int is_mark;
|
||||
STRING *line;
|
||||
STRING *mark_end;
|
||||
} *lines;
|
||||
int n_lines;
|
||||
int ln;
|
||||
int i;
|
||||
int j;
|
||||
int u;
|
||||
int is_mark;
|
||||
char dummy[4];
|
||||
int was_mark = 0;
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
unsigned long dmallocMarkReplay = 0;
|
||||
#endif
|
||||
|
||||
if ((CONSFILE *)0 == fdLog) {
|
||||
if (pCE != (CONSENT *)0 && 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;
|
||||
}
|
||||
|
||||
/* find the size of the file
|
||||
*/
|
||||
if (0 != FileStat(fdLog, &stLog)) {
|
||||
return;
|
||||
}
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
dmallocMarkReplay = dmalloc_mark();
|
||||
#endif
|
||||
|
||||
file_pos = stLog.st_size - 1;
|
||||
/* find the size of the file
|
||||
*/
|
||||
if (0 != FileStat(fdLog, &stLog))
|
||||
goto common_exit;
|
||||
|
||||
file_pos = stLog.st_size - 1; /* point at last byte */
|
||||
buf_pos = file_pos + 1;
|
||||
|
||||
/* get space for the line information and initialize it
|
||||
*
|
||||
* we allocate room for one more line than requested to be able to
|
||||
* do the mark ranges
|
||||
*/
|
||||
if ((char *)0 == (buf = malloc(BUFSIZ))) {
|
||||
if ((char *)0 == (buf = malloc(REPLAYBUFFER)))
|
||||
OutOfMem();
|
||||
}
|
||||
n_lines = iBack + 1;
|
||||
lines = (struct lines *)calloc(n_lines, sizeof(*lines));
|
||||
if ((struct lines *)0 == lines) {
|
||||
OutOfMem();
|
||||
}
|
||||
for (i = 0; i < n_lines; i++) {
|
||||
lines[i].mark_end = AllocString();
|
||||
lines[i].line = AllocString();
|
||||
}
|
||||
ln = -1;
|
||||
bp = buf + 1; /* just give it something - it resets below */
|
||||
|
||||
line = AllocString();
|
||||
|
||||
/* loop as long as there is data in the file or we have not found
|
||||
* the requested number of lines
|
||||
*/
|
||||
while (file_pos >= 0) {
|
||||
ln = -1;
|
||||
for (; file_pos >= 0; file_pos--, bp--) {
|
||||
if (file_pos < buf_pos) {
|
||||
int r;
|
||||
|
||||
/* read one buffer worth of data a buffer boundary
|
||||
*
|
||||
* the first read will probably not get a full buffer but
|
||||
* 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
|
||||
*/
|
||||
buf_pos = (file_pos / REPLAYBUFFER) * REPLAYBUFFER;
|
||||
if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#else
|
||||
if (FileSeek(fdLog, buf_pos, L_SET) < 0) {
|
||||
if ((r = FileRead(fdLog, buf, REPLAYBUFFER)) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#endif
|
||||
if ((r = FileRead(fdLog, buf, BUFSIZ)) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
bp = buf + r;
|
||||
bp = buf + r - 1;
|
||||
}
|
||||
|
||||
/* process the next character
|
||||
*/
|
||||
--file_pos;
|
||||
if ((ch = *--bp) == '\n') {
|
||||
if ((ch = *bp) == '\n') {
|
||||
if (ln >= 0) {
|
||||
int i;
|
||||
int u;
|
||||
int is_mark = 0;
|
||||
|
||||
/* reverse the text to put it in forward order
|
||||
*/
|
||||
u = lines[ln].line->used - 1;
|
||||
u = line->used - 1;
|
||||
for (i = 0; i < u / 2; i++) {
|
||||
int temp;
|
||||
|
||||
temp = lines[ln].line->string[i];
|
||||
lines[ln].line->string[i]
|
||||
= lines[ln].line->string[u - i - 1];
|
||||
lines[ln].line->string[u - i - 1] = temp;
|
||||
temp = line->string[i];
|
||||
line->string[i] = line->string[u - i - 1];
|
||||
line->string[u - i - 1] = temp;
|
||||
}
|
||||
|
||||
/* see if this line is a MARK
|
||||
*/
|
||||
if (lines[ln].line->used > 0 &&
|
||||
lines[ln].line->string[0] == '[') {
|
||||
i = sscanf(lines[ln].line->string + 1,
|
||||
if (line->used > 0 && line->string[0] == '[') {
|
||||
char dummy[4];
|
||||
int j;
|
||||
i = sscanf(line->string + 1,
|
||||
"-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n",
|
||||
dummy, dummy, &j, &j, &j, &j, &j);
|
||||
is_mark = (i == 7);
|
||||
} else {
|
||||
is_mark = 0;
|
||||
}
|
||||
|
||||
/* process this line
|
||||
*/
|
||||
if (is_mark && ln > 0 && lines[ln - 1].is_mark) {
|
||||
if (is_mark && was_mark) {
|
||||
/* this is a mark and the previous line is also
|
||||
* a mark, so make (or continue) that range
|
||||
* a mark, so reduce the line count 'cause it'll
|
||||
* go up by one and we're joining them on output.
|
||||
*/
|
||||
if (0 == lines[ln - 1].mark_end->allocated) {
|
||||
/* this is a new range - shuffle pointers
|
||||
*
|
||||
* remember that we are moving backward
|
||||
*/
|
||||
*(lines[ln - 1].mark_end) = *(lines[ln - 1].line);
|
||||
InitString(lines[ln - 1].line);
|
||||
}
|
||||
/* if unallocated, cheat and shuffle pointers */
|
||||
if (0 == lines[ln - 1].line->allocated) {
|
||||
*(lines[ln - 1].line) = *(lines[ln].line);
|
||||
InitString(lines[ln].line);
|
||||
} else {
|
||||
BuildString((char *)0, lines[ln - 1].line);
|
||||
BuildString(lines[ln].line->string,
|
||||
lines[ln - 1].line);
|
||||
BuildString((char *)0, lines[ln].line);
|
||||
}
|
||||
ln--;
|
||||
}
|
||||
lines[ln].is_mark = is_mark;
|
||||
was_mark = is_mark;
|
||||
}
|
||||
|
||||
/* advance to the next line and break if we have enough
|
||||
*/
|
||||
ln++;
|
||||
if (ln >= n_lines - 1) {
|
||||
BuildString((char *)0, line);
|
||||
if (ln >= back) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -269,85 +232,122 @@ Replay(fdLog, fdOut, iBack)
|
||||
if (ln < 0) {
|
||||
ln = 0;
|
||||
}
|
||||
BuildStringChar(ch, lines[ln].line);
|
||||
BuildStringChar(ch, line);
|
||||
|
||||
/* if we've processed "a lot" of data for a line, then bail
|
||||
* why? there must be some very long non-newline terminated
|
||||
* strings and if we just keep going back, we could spew lots
|
||||
* of data and chew up lots of memory
|
||||
*/
|
||||
if (lines[ln].line->used > MAXREPLAYLINELEN) {
|
||||
if (line->used > MAXREPLAYLINELEN) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
buf = (char *)0;
|
||||
|
||||
/* if we got back to beginning of file but saw some data, include it
|
||||
/* move forward. either we hit the beginning of the file and we
|
||||
* move to the first byte, or we hit a \n and we move past it
|
||||
*/
|
||||
if (ln >= 0 && lines[ln].line->used > 0) {
|
||||
file_pos++;
|
||||
|
||||
/* reverse the text to put it in forward order
|
||||
*/
|
||||
u = lines[ln].line->used - 1;
|
||||
for (i = 0; i < u / 2; i++) {
|
||||
int temp;
|
||||
/* Now output the lines, starting from where we stopped */
|
||||
if (FileSeek(fdLog, file_pos, SEEK_SET) >= 0) {
|
||||
int eof = 0;
|
||||
int i = 0;
|
||||
int r = 0;
|
||||
STRING *mark_beg = (STRING *)0;
|
||||
STRING *mark_end = (STRING *)0;
|
||||
|
||||
temp = lines[ln].line->string[i];
|
||||
lines[ln].line->string[i]
|
||||
= lines[ln].line->string[u - i - 1];
|
||||
lines[ln].line->string[u - i - 1] = temp;
|
||||
mark_beg = AllocString();
|
||||
mark_end = AllocString();
|
||||
|
||||
ln = 0; /* number of lines output */
|
||||
BuildString((char *)0, line);
|
||||
|
||||
while (ln < back && !eof) {
|
||||
if (r <= 0) {
|
||||
if ((r = FileRead(fdLog, buf, REPLAYBUFFER)) < 0)
|
||||
eof = 1;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (!eof)
|
||||
BuildStringChar(buf[i], line);
|
||||
|
||||
if (buf[i] == '\n' || eof) {
|
||||
int is_mark = 0;
|
||||
if (line->used > 0 && line->string[0] == '[') {
|
||||
char dummy[4];
|
||||
int j;
|
||||
int i;
|
||||
i = sscanf(line->string + 1,
|
||||
"-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n",
|
||||
dummy, dummy, &j, &j, &j, &j, &j);
|
||||
is_mark = (i == 7);
|
||||
}
|
||||
if (is_mark) {
|
||||
if (mark_beg->used > 1) {
|
||||
BuildString((char *)0, mark_end);
|
||||
BuildString(line->string, mark_end);
|
||||
} else
|
||||
BuildString(line->string, mark_beg);
|
||||
} else {
|
||||
if (mark_beg->used > 1) {
|
||||
if (mark_end->used > 1) {
|
||||
char *s;
|
||||
|
||||
/* output the start of the range, stopping at the ']' */
|
||||
s = strrchr(mark_beg->string, ']');
|
||||
if ((char *)0 != s)
|
||||
*s = '\000';
|
||||
FileWrite(fdOut, FLAGTRUE, mark_beg->string,
|
||||
-1);
|
||||
FileWrite(fdOut, FLAGTRUE, " .. ", 4);
|
||||
|
||||
/* build the end string by removing the leading "[-- MARK -- "
|
||||
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
|
||||
*/
|
||||
s = strrchr(mark_end->string, ']');
|
||||
if ((char *)0 != s)
|
||||
*s = '\000';
|
||||
FileWrite(fdOut, FLAGTRUE,
|
||||
mark_end->string +
|
||||
sizeof("[-- MARK -- ") - 1, -1);
|
||||
FileWrite(fdOut, FLAGFALSE, " -- MARK --]\r\n",
|
||||
-1);
|
||||
} else {
|
||||
FileWrite(fdOut, FLAGFALSE, mark_beg->string,
|
||||
mark_beg->used - 1);
|
||||
}
|
||||
BuildString((char *)0, mark_beg);
|
||||
BuildString((char *)0, mark_end);
|
||||
ln++;
|
||||
if (ln >= back)
|
||||
break;
|
||||
}
|
||||
FileWrite(fdOut, FLAGFALSE, line->string,
|
||||
line->used - 1);
|
||||
ln++;
|
||||
}
|
||||
BuildString((char *)0, line);
|
||||
}
|
||||
|
||||
/* move the counters */
|
||||
i++;
|
||||
r--;
|
||||
}
|
||||
ln++;
|
||||
}
|
||||
|
||||
/* copy the lines into the buffer and put them in order
|
||||
*/
|
||||
for (i = ln - 1; i >= 0; i--) {
|
||||
if (lines[i].is_mark && 0 != lines[i].mark_end->used) {
|
||||
int mark_len;
|
||||
|
||||
/* output the start of the range, stopping at the ']'
|
||||
*/
|
||||
s = strrchr(lines[i].line->string, ']');
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
|
||||
FileWrite(fdOut, FLAGTRUE, " .. ", -1);
|
||||
|
||||
/* build the end string by removing the leading "[-- MARK -- "
|
||||
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
|
||||
*/
|
||||
mark_len = sizeof("[-- MARK -- ") - 1;
|
||||
|
||||
s = strrchr(lines[i].mark_end->string + mark_len, ']');
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
FileWrite(fdOut, FLAGTRUE,
|
||||
lines[i].mark_end->string + mark_len, -1);
|
||||
FileWrite(fdOut, FLAGFALSE, " -- MARK --]\r\n", -1);
|
||||
u = lines[i].mark_end->used;
|
||||
s = lines[i].mark_end->string;
|
||||
} else
|
||||
FileWrite(fdOut, FLAGFALSE, lines[i].line->string, -1);
|
||||
DestroyString(mark_end);
|
||||
DestroyString(mark_beg);
|
||||
}
|
||||
|
||||
common_exit:
|
||||
|
||||
if ((struct lines *)0 != lines) {
|
||||
for (i = 0; i < n_lines; i++) {
|
||||
DestroyString(lines[i].mark_end);
|
||||
DestroyString(lines[i].line);
|
||||
}
|
||||
free(lines);
|
||||
lines = (struct lines *)0;
|
||||
}
|
||||
if ((char *)0 != buf) {
|
||||
if (line != (STRING *)0)
|
||||
DestroyString(line);
|
||||
if (buf != (char *)0)
|
||||
free(buf);
|
||||
buf = (char *)0;
|
||||
}
|
||||
if (fdLog != (CONSFILE *)0)
|
||||
FileClose(&fdLog);
|
||||
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
CONDDEBUG((1, "Replay(): dmalloc / MarkReplay"));
|
||||
dmalloc_log_changed(dmallocMarkReplay, 1, 0, 1);
|
||||
@ -359,9 +359,9 @@ 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 IS_LIMITED 0x100
|
||||
|
||||
#define HALFLINE 40
|
||||
|
||||
@ -371,51 +371,45 @@ typedef struct HLnode {
|
||||
} HELP;
|
||||
|
||||
static HELP aHLTable[] = {
|
||||
{WHEN_ALWAYS, ". disconnect"},
|
||||
{WHEN_ALWAYS, "a attach read/write"},
|
||||
{WHEN_ALWAYS, "b send broadcast message"},
|
||||
{WHEN_ATTACH, "c toggle flow control"},
|
||||
{WHEN_ATTACH, "d down a console"},
|
||||
{WHEN_ALWAYS, "e change escape sequence"},
|
||||
{WHEN_ALWAYS, "f force attach read/write"},
|
||||
{WHEN_ALWAYS, "g group info"},
|
||||
{WHEN_ALWAYS, "i information dump"},
|
||||
{WHEN_ATTACH, "L toggle logging on/off"},
|
||||
{WHEN_ATTACH, "l? break sequence list"},
|
||||
{WHEN_ATTACH, "l0 send break per config file"},
|
||||
{WHEN_ATTACH, "l1-9 send specific break sequence"},
|
||||
{WHEN_ALWAYS, "m display the message of the day"},
|
||||
{WHEN_ALWAYS, "o (re)open the tty and log file"},
|
||||
{WHEN_ALWAYS, "p replay the last 60 lines"},
|
||||
{WHEN_ALWAYS, "r replay the last 20 lines"},
|
||||
{WHEN_ATTACH, "s spy read only"},
|
||||
{WHEN_ALWAYS, "u show host status"},
|
||||
{WHEN_ALWAYS, "v show version info"},
|
||||
{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_ALWAYS, "? print this message"},
|
||||
{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"}
|
||||
{WHEN_ALWAYS, ". disconnect"},
|
||||
{WHEN_ALWAYS | IS_LIMITED, "; move to another console"},
|
||||
{WHEN_ALWAYS, "a attach read/write"},
|
||||
{WHEN_ALWAYS, "b send broadcast message"},
|
||||
{WHEN_ATTACH, "c toggle flow control"},
|
||||
{WHEN_ATTACH, "d down a console"},
|
||||
{WHEN_ALWAYS, "e change escape sequence"},
|
||||
{WHEN_ALWAYS, "f force attach read/write"},
|
||||
{WHEN_ALWAYS, "g group info"},
|
||||
{WHEN_ALWAYS, "i information dump"},
|
||||
{WHEN_ATTACH, "L toggle logging on/off"},
|
||||
{WHEN_ATTACH, "l? break sequence list"},
|
||||
{WHEN_ATTACH, "l0 send break per config file"},
|
||||
{WHEN_ATTACH, "l1-9a-z send specific break sequence"},
|
||||
{WHEN_ALWAYS, "m display message of the day"},
|
||||
{WHEN_ALWAYS, "n write a note to the logfile"},
|
||||
{WHEN_ALWAYS, "o (re)open the tty and log file"},
|
||||
{WHEN_ALWAYS, "p playback the last %hu lines"},
|
||||
{WHEN_ALWAYS, "P set number of playback lines"},
|
||||
{WHEN_ALWAYS, "r replay the last %hu lines"},
|
||||
{WHEN_ALWAYS, "R set number of replay lines"},
|
||||
{WHEN_ATTACH, "s spy mode (read only)"},
|
||||
{WHEN_ALWAYS, "u show host status"},
|
||||
{WHEN_ALWAYS, "v show version info"},
|
||||
{WHEN_ALWAYS, "w who is on this console"},
|
||||
{WHEN_ALWAYS, "x show console baud info"},
|
||||
{WHEN_ALWAYS | IS_LIMITED, "z suspend the connection"},
|
||||
{WHEN_ATTACH, "! invoke task"},
|
||||
{WHEN_ATTACH | IS_LIMITED, "| 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"},
|
||||
};
|
||||
|
||||
/* list the commands we know for the user (ksb)
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
HelpUser(CONSCLIENT *pCL)
|
||||
#else
|
||||
HelpUser(pCL)
|
||||
CONSCLIENT *pCL;
|
||||
#endif
|
||||
{
|
||||
int i, j, iCmp;
|
||||
static char
|
||||
@ -433,68 +427,85 @@ 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) {
|
||||
if (0 == (aHLTable[i].iwhen & iCmp)) {
|
||||
char *text;
|
||||
|
||||
if (aHLTable[i].iwhen & IS_LIMITED &&
|
||||
ConsentUserOk(pLUList, pCL->username->string) == 1)
|
||||
continue;
|
||||
|
||||
if (0 == (aHLTable[i].iwhen & iCmp))
|
||||
continue;
|
||||
|
||||
text = aHLTable[i].actext;
|
||||
if (text[0] == 'p') {
|
||||
BuildTmpString((char *)0);
|
||||
text = BuildTmpStringPrint(text, pCL->playback);
|
||||
} else if (text[0] == 'r') {
|
||||
BuildTmpString((char *)0);
|
||||
text = BuildTmpStringPrint(text, pCL->replay);
|
||||
}
|
||||
|
||||
if (acLine->used != 0) { /* second part of line */
|
||||
if (strlen(aHLTable[i].actext) < HALFLINE) {
|
||||
if (strlen(text) < HALFLINE) {
|
||||
for (j = acLine->used; j <= HALFLINE; ++j) {
|
||||
BuildStringChar(' ', acLine);
|
||||
}
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
BuildString(text, 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);
|
||||
}
|
||||
}
|
||||
if (acLine->used == 0) { /* at new line */
|
||||
BuildStringChar(' ', acLine);
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
BuildString(text, 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);
|
||||
}
|
||||
|
||||
int
|
||||
#if PROTOTYPES
|
||||
ClientAccessOk(CONSCLIENT *pCL)
|
||||
#else
|
||||
ClientAccessOk(pCL)
|
||||
CONSCLIENT *pCL;
|
||||
#endif
|
||||
{
|
||||
char *peername = (char *)0;
|
||||
int retval = 1;
|
||||
|
||||
#if USE_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
|
||||
socklen_t so;
|
||||
int cfd;
|
||||
struct sockaddr_in in_port;
|
||||
int retval = 1;
|
||||
# if USE_IPV6
|
||||
int error;
|
||||
char addr[NI_MAXHOST];
|
||||
# endif
|
||||
SOCKADDR_STYPE in_port;
|
||||
int getpeer = -1;
|
||||
|
||||
cfd = FileFDNum(pCL->fd);
|
||||
pCL->caccess = 'r';
|
||||
#if defined(USE_LIBWRAP)
|
||||
# if defined(USE_LIBWRAP)
|
||||
{
|
||||
struct request_info request;
|
||||
CONDDEBUG((1, "ClientAccessOk(): doing tcpwrappers check"));
|
||||
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
|
||||
fromhost(&request);
|
||||
if (!hosts_access(&request)) {
|
||||
@ -504,7 +515,7 @@ ClientAccessOk(pCL)
|
||||
goto setpeer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
so = sizeof(in_port);
|
||||
if (-1 ==
|
||||
@ -513,22 +524,66 @@ ClientAccessOk(pCL)
|
||||
retval = 0;
|
||||
goto setpeer;
|
||||
}
|
||||
pCL->caccess = AccType(&in_port.sin_addr, &peername);
|
||||
pCL->caccess = AccType(
|
||||
# if USE_IPV6
|
||||
&in_port,
|
||||
# else
|
||||
&in_port.sin_addr,
|
||||
# endif
|
||||
&peername);
|
||||
if (pCL->caccess == 'r') {
|
||||
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
|
||||
-1);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
setpeer:
|
||||
#else
|
||||
struct in_addr addr;
|
||||
|
||||
# if HAVE_INET_ATON
|
||||
inet_aton("127.0.0.1", &addr);
|
||||
# else
|
||||
addr.s_addr = inet_addr("127.0.0.1");
|
||||
# endif
|
||||
pCL->caccess = AccType(&addr, &peername);
|
||||
if (pCL->caccess == 'r') {
|
||||
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
|
||||
-1);
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pCL->peername != (STRING *)0) {
|
||||
BuildString((char *)0, pCL->peername);
|
||||
if (peername != (char *)0)
|
||||
BuildString(peername, pCL->peername);
|
||||
#if USE_IPV6
|
||||
else if (getpeer != -1) {
|
||||
error =
|
||||
getnameinfo((struct sockaddr *)&in_port, so, addr,
|
||||
sizeof(addr), NULL, 0, NI_NUMERICHOST);
|
||||
if (error) {
|
||||
FileWrite(pCL->fd, FLAGFALSE, "getnameinfo failed\r\n",
|
||||
-1);
|
||||
Error("ClientAccessOk(): gatenameinfo: %s",
|
||||
gai_strerror(error));
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
BuildString(addr, pCL->peername);
|
||||
} else
|
||||
BuildString("<unknown>", pCL->peername);
|
||||
#elif USE_UNIX_DOMAIN_SOCKETS
|
||||
else
|
||||
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,6 +1,4 @@
|
||||
/*
|
||||
* $Id: client.h,v 5.33 2003-10-10 03:28:49-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -46,7 +44,14 @@ 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 */
|
||||
S_REPLAY, /* set replay length for 'r' */
|
||||
S_PLAYBACK, /* set replay length for 'p' */
|
||||
S_NOTE, /* send a note to the logfile */
|
||||
S_TASK, /* invoke a task on the server side */
|
||||
S_CONFIRM /* confirm input */
|
||||
} CLIENTSTATE;
|
||||
|
||||
typedef struct client { /* Connection Information: */
|
||||
@ -56,6 +61,7 @@ typedef struct client { /* Connection Information: */
|
||||
short fwantwr; /* (client) wants to write */
|
||||
short fro; /* read-only permission */
|
||||
short fecho; /* echo commands (not set by machines) */
|
||||
short fiwait; /* client wanting for console init */
|
||||
STRING *acid; /* login and location of client */
|
||||
STRING *peername; /* location of client */
|
||||
STRING *username; /* login of client */
|
||||
@ -72,17 +78,21 @@ typedef struct client { /* Connection Information: */
|
||||
*pCLnext; /* next person on this list */
|
||||
/* next lists link clients on a console */
|
||||
char ic[2]; /* two character escape sequence */
|
||||
unsigned short replay; /* lines to replay for 'r' */
|
||||
unsigned short playback; /* lines to replay for 'p' */
|
||||
CLIENTSTATE iState; /* state for fsm in server */
|
||||
char caccess; /* did we trust the remote machine */
|
||||
IOSTATE ioState; /* state of the socket */
|
||||
time_t stateTimer; /* timer for various ioState states */
|
||||
STRING *accmd; /* the command the user issued */
|
||||
STRING *msg; /* the broadcast message */
|
||||
struct sockaddr_in
|
||||
cnct_port; /* where from */
|
||||
INADDR_STYPE cnct_port; /* where from */
|
||||
FLAG confirmed; /* confirm state */
|
||||
CLIENTSTATE cState; /* state needing confirmation */
|
||||
char cOption; /* option initiating the confirmation */
|
||||
} CONSCLIENT;
|
||||
|
||||
extern void Replay PARAMS((CONSFILE *, CONSFILE *, int));
|
||||
extern void HelpUser PARAMS((CONSCLIENT *));
|
||||
extern void FindWrite PARAMS((CONSENT *));
|
||||
extern int ClientAccessOk PARAMS((CONSCLIENT *));
|
||||
extern void Replay(CONSENT *, CONSFILE *, unsigned short);
|
||||
extern void HelpUser(CONSCLIENT *);
|
||||
extern void FindWrite(CONSENT *);
|
||||
extern int ClientAccessOk(CONSCLIENT *);
|
||||
extern void BumpClient(CONSENT *, char *);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: consent.h,v 5.48 2003-10-02 18:49:03-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -52,12 +50,24 @@ typedef struct parity { /* a parity bits table */
|
||||
} PARITY;
|
||||
|
||||
typedef enum consType {
|
||||
UNKNOWN = 0,
|
||||
UNKNOWNTYPE = 0,
|
||||
DEVICE,
|
||||
EXEC,
|
||||
HOST
|
||||
HOST,
|
||||
NOOP,
|
||||
UDS,
|
||||
#if HAVE_FREEIPMI
|
||||
IPMI,
|
||||
#endif
|
||||
} CONSTYPE;
|
||||
|
||||
#if HAVE_FREEIPMI
|
||||
# define IPMIL_UNKNOWN (0)
|
||||
# define IPMIL_USER (IPMICONSOLE_PRIVILEGE_USER+1)
|
||||
# define IPMIL_OPERATOR (IPMICONSOLE_PRIVILEGE_OPERATOR+1)
|
||||
# define IPMIL_ADMIN (IPMICONSOLE_PRIVILEGE_ADMIN+1)
|
||||
#endif
|
||||
|
||||
typedef struct names {
|
||||
char *name;
|
||||
struct names *next;
|
||||
@ -65,6 +75,7 @@ typedef struct names {
|
||||
|
||||
typedef struct consentUsers {
|
||||
NAMES *user;
|
||||
short not;
|
||||
struct consentUsers *next;
|
||||
} CONSENTUSERS;
|
||||
|
||||
@ -78,6 +89,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 */
|
||||
@ -87,29 +99,63 @@ typedef struct consent { /* console information */
|
||||
FLAG ixoff; /* XON/XOFF flow control on input */
|
||||
#if defined(CRTSCTS)
|
||||
FLAG crtscts; /* use hardware flow control */
|
||||
#endif
|
||||
#if HAVE_FREEIPMI
|
||||
/* type == IPMI */
|
||||
int ipmiprivlevel; /* IPMI authentication level */
|
||||
ipmiconsole_ctx_t ipmictx; /* IPMI ctx */
|
||||
unsigned int ipmiworkaround; /* IPMI workaround flags */
|
||||
short ipmiwrkset; /* workaround flags set in config */
|
||||
int ipmiciphersuite; /* IPMI cipher suite */
|
||||
char *username; /* Username to log as */
|
||||
char *password; /* Login Password */
|
||||
STRING *ipmikg; /* IPMI k_g auth key */
|
||||
#endif
|
||||
/* 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 */
|
||||
uid_t execuid; /* user to run exec as */
|
||||
gid_t execgid; /* group to run exec as */
|
||||
/* type == UDS */
|
||||
char *uds; /* socket file */
|
||||
char *udssubst; /* socket file substitution pattern */
|
||||
/* global stuff */
|
||||
char *master; /* master hostname */
|
||||
unsigned short breakNum; /* break type [1-9] */
|
||||
unsigned short breakNum; /* break type [1-35] */
|
||||
char *logfile; /* logfile */
|
||||
off_t logfilemax; /* size limit for rolling logfile */
|
||||
char *initcmd; /* initcmd command */
|
||||
char *initsubst; /* initcmd substitution pattern */
|
||||
uid_t inituid; /* user to run initcmd as */
|
||||
gid_t initgid; /* group to run initcmd as */
|
||||
char *motd; /* motd */
|
||||
time_t idletimeout; /* idle timeout */
|
||||
char *idlestring; /* string to print when idle */
|
||||
unsigned short spinmax; /* initialization spin maximum */
|
||||
unsigned short spintimer; /* initialization spin timer */
|
||||
char *replstring; /* generic string for replacements */
|
||||
char *tasklist; /* list of valid tasks */
|
||||
char *breaklist; /* list of valid break sequences */
|
||||
/* timestamp stuff */
|
||||
int mark; /* Mark (chime) interval */
|
||||
long nextMark; /* Next mark (chime) time */
|
||||
FLAG activitylog; /* log attach/detach/bump */
|
||||
FLAG breaklog; /* log breaks sent */
|
||||
FLAG tasklog; /* log tasks invoked */
|
||||
/* options */
|
||||
FLAG ondemand; /* bring up on-demand */
|
||||
FLAG reinitoncc; /* open if down on client connect */
|
||||
FLAG striphigh; /* strip high-bit of console data */
|
||||
FLAG autoreinit; /* auto-reinitialize if failed */
|
||||
FLAG unloved; /* copy "unloved" data to stdout */
|
||||
FLAG login; /* allow logins to the console */
|
||||
|
||||
/*** runtime settings ***/
|
||||
CONSFILE *fdlog; /* the local log file */
|
||||
@ -119,15 +165,26 @@ typedef struct consent { /* console information */
|
||||
pid_t ipid; /* pid of virtual command */
|
||||
pid_t initpid; /* pid of initcmd command */
|
||||
CONSFILE *initfile; /* the command run on init */
|
||||
pid_t taskpid; /* pid of task running */
|
||||
CONSFILE *taskfile; /* the output from the task (read-only) */
|
||||
STRING *wbuf; /* write() buffer */
|
||||
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 */
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
struct timeval lastInit; /* time of last initialization */
|
||||
#else
|
||||
time_t lastInit; /* time of last initialization */
|
||||
#endif
|
||||
unsigned short spincount; /* initialization spin counter */
|
||||
|
||||
/*** state information ***/
|
||||
char acline[132 * 2 + 2]; /* max chars we will call a line */
|
||||
int iend; /* length of data stored in acline */
|
||||
int telnetState; /* state for telnet negotiations */
|
||||
FLAG sentDoEcho; /* have we sent telnet DO ECHO cmd? */
|
||||
FLAG sentDoSGA; /* have we sent telnet DO SGA cmd? */
|
||||
unsigned short autoReUp; /* is it coming back up automatically? */
|
||||
FLAG downHard; /* did it go down unexpectedly? */
|
||||
unsigned short nolog; /* don't log output */
|
||||
@ -150,11 +207,13 @@ typedef struct remote { /* console at another host */
|
||||
NAMES *aliases; /* aliases for remote server name */
|
||||
} REMOTE;
|
||||
|
||||
extern PARITY *FindParity PARAMS((char *));
|
||||
extern BAUD *FindBaud PARAMS((char *));
|
||||
extern void ConsInit PARAMS((CONSENT *));
|
||||
extern void ConsDown PARAMS((CONSENT *, FLAG, FLAG));
|
||||
extern REMOTE *FindUniq PARAMS((REMOTE *));
|
||||
extern void DestroyRemoteConsole PARAMS((REMOTE *));
|
||||
extern void StartInit PARAMS((CONSENT *));
|
||||
extern void StopInit PARAMS((CONSENT *));
|
||||
extern PARITY *FindParity(char *);
|
||||
extern BAUD *FindBaud(char *);
|
||||
extern void ConsInit(CONSENT *);
|
||||
extern void ConsDown(CONSENT *, FLAG, FLAG);
|
||||
extern REMOTE *FindUniq(REMOTE *);
|
||||
extern void DestroyRemoteConsole(REMOTE *);
|
||||
extern void StartInit(CONSENT *);
|
||||
extern void StopInit(CONSENT *);
|
||||
extern char *ConsState(CONSENT *);
|
||||
extern void SetupTty(CONSENT *, int);
|
||||
|
@ -1,6 +1,4 @@
|
||||
.\" @(#)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"
|
||||
.TH CONSERVER 8 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
|
||||
.SH NAME
|
||||
conserver \- console server daemon
|
||||
.SH SYNOPSIS
|
||||
@ -11,7 +9,7 @@ conserver \- console server daemon
|
||||
.RB [ \-m
|
||||
.IR max ]
|
||||
.RB [ \-M
|
||||
.IR addr ]
|
||||
.IR master ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.RB [ \-b
|
||||
@ -26,29 +24,43 @@ conserver \- console server daemon
|
||||
.IR logfile ]
|
||||
.RB [ \-O
|
||||
.IR min ]
|
||||
.RB [ \-U
|
||||
.IR logfile ]
|
||||
.SH DESCRIPTION
|
||||
.B Conserver
|
||||
is the daemon that manages
|
||||
remote access to system consoles by multiple users via the
|
||||
.BR console (1)
|
||||
client program and logs all console output.
|
||||
It can connect to consoles via local serial ports, terminal
|
||||
servers that allow network access, or to any external program.
|
||||
client program and (optionally) log the console output.
|
||||
It can connect to consoles via local serial ports, Unix domain sockets, TCP
|
||||
sockets (for terminal servers and the like), or any external program.
|
||||
.PP
|
||||
When started,
|
||||
.B conserver
|
||||
reads its
|
||||
reads the
|
||||
.BR conserver.cf (5)
|
||||
file for details of each console it should manage,
|
||||
including serial port or network parameters and logging options.
|
||||
(Also, in environments where multiple servers share a cf file,
|
||||
any server is able to refer clients to the particular server
|
||||
managing a requested console, so that the client need not have
|
||||
knowledge of the distribution of consoles among servers.)
|
||||
file for details of each console.
|
||||
The console type, logging options, serial or network parameters, and user access
|
||||
levels are just a few of the things that can be specified.
|
||||
Command-line options are then applied, possibly overriding
|
||||
.BR conserver.cf (5)
|
||||
settings.
|
||||
.B Conserver
|
||||
categorizes consoles into two types: those it should actively manage, and
|
||||
those it should just know about, so it can refer clients to other
|
||||
.B conserver
|
||||
instances.
|
||||
If the
|
||||
.B master
|
||||
value of a console matches the hostname or ip address of the local machine,
|
||||
.B conserver
|
||||
will actively manage the console.
|
||||
Otherwise, it's considered a ``remote'' console and managed by a different
|
||||
server.
|
||||
.B Conserver
|
||||
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 +86,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 its best to remove all the sockets when it shuts down,
|
||||
but it could stop ungracefully (crash, ``kill -9'', etc)
|
||||
and leave files behind.
|
||||
It 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 +122,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 +176,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 +244,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 +298,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
|
||||
@ -289,6 +328,9 @@ Enable periodic attempts (every
|
||||
.I min
|
||||
minutes) to open (``bring up'') all downed
|
||||
consoles (similar to sending a SIGUSR1).
|
||||
Without this option, or if
|
||||
.I min
|
||||
is zero, no periodic attempts occur.
|
||||
.TP
|
||||
.BI \-p port
|
||||
Set the TCP port for the master process to listen on.
|
||||
@ -299,6 +341,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 +367,40 @@ 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, `!' for a remote port, `%' for a Unix domain socket,
|
||||
and `#' for a noop console.
|
||||
.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.
|
||||
Unix domain sockets will have the path to the socket.
|
||||
Noop consoles will have nothing.
|
||||
.RE
|
||||
.TP
|
||||
.B \-u
|
||||
Send unloved console output to
|
||||
@ -332,6 +411,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 utilities to ignore potential user-introduced alarms.
|
||||
.TP
|
||||
.B \-v
|
||||
Echo the configuration as it is being read (be verbose).
|
||||
.TP
|
||||
@ -350,7 +440,7 @@ The second style is the character-based, escape-sequence mode, while
|
||||
connected to a console.
|
||||
.PP
|
||||
The initial line-based mode begins the same for both the master process
|
||||
and it's children.
|
||||
and its children.
|
||||
Upon a successful (non-rejected) client connection, an ``ok'' is sent.
|
||||
The client then issues a command and the server responds to it with a
|
||||
result string (``ok'' being the sign of success for most commands).
|
||||
@ -358,7 +448,7 @@ The commands available are ``help'', ``ssl'' (if
|
||||
SSL was built into the code), ``login'', and ``exit''.
|
||||
Using the ``login'' command, the client authenticates and gains access to
|
||||
the extended command set.
|
||||
This is where the master process and it's children differ.
|
||||
This is where the master process and its children differ.
|
||||
The master process gives the client access to global commands, and the
|
||||
child provides commands for interacting with the consoles it manages.
|
||||
The ``help'' command, in both cases, will provide a complete
|
||||
@ -374,14 +464,16 @@ any interaction with the server is done with the default escape sequence.
|
||||
This is, by no means, a complete description of the entire client/server
|
||||
interaction.
|
||||
It is, however, a brief explanation in order to give a idea of
|
||||
what the program does.
|
||||
what the program does. See the
|
||||
.B \s-1PROTOCOL\s0
|
||||
file in the distribution for further details.
|
||||
.SH FILES
|
||||
.PP
|
||||
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 +491,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,6 +1,4 @@
|
||||
/*
|
||||
* $Id: convert.c,v 1.7 2003-08-15 14:24:39-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -32,7 +30,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
@ -41,6 +39,16 @@
|
||||
#include <master.h>
|
||||
#include <main.h>
|
||||
|
||||
#if defined(USE_LIBWRAP)
|
||||
/* we don't use it...but we link to it */
|
||||
int allow_severity;
|
||||
int deny_severity;
|
||||
#endif
|
||||
|
||||
|
||||
SECTION sections[] = {
|
||||
{(char *)0, (void *)0, (void *)0, (void *)0, (void *)0}
|
||||
};
|
||||
|
||||
void
|
||||
DestroyDataStructures()
|
||||
@ -48,19 +56,12 @@ DestroyDataStructures()
|
||||
}
|
||||
|
||||
char *
|
||||
#if PROTOTYPES
|
||||
ReadLine2(FILE *fp, STRING *save, int *iLine)
|
||||
#else
|
||||
ReadLine2(fp, save, iLine)
|
||||
FILE *fp;
|
||||
STRING *save;
|
||||
int *iLine;
|
||||
#endif
|
||||
{
|
||||
static char buf[1024];
|
||||
char *wholeline = (char *)0;
|
||||
char *ret = (char *)0;
|
||||
int i, buflen, peek, commentCheck = 1, comment = 0;
|
||||
int i, buflen, peek, commentCheck = 1;
|
||||
static STRING *bufstr = (STRING *)0;
|
||||
static STRING *wholestr = (STRING *)0;
|
||||
|
||||
@ -76,7 +77,7 @@ ReadLine2(fp, save, iLine)
|
||||
|| peek) {
|
||||
/* If we have a previously saved line, use it instead */
|
||||
if (save->used) {
|
||||
strcpy(buf, save->string);
|
||||
StrCpy(buf, save->string, sizeof(buf));
|
||||
BuildString((char *)0, save);
|
||||
}
|
||||
|
||||
@ -102,7 +103,6 @@ ReadLine2(fp, save, iLine)
|
||||
if (!isspace((int)buf[i]))
|
||||
break;
|
||||
if (buf[i] == '#') {
|
||||
comment = 1;
|
||||
commentCheck = 0;
|
||||
} else if (buf[i] != '\000') {
|
||||
commentCheck = 0;
|
||||
@ -113,14 +113,11 @@ ReadLine2(fp, save, iLine)
|
||||
buflen = strlen(buf);
|
||||
if ((buflen >= 1) && (buf[buflen - 1] == '\n')) {
|
||||
(*iLine)++; /* Finally have a whole line */
|
||||
/* if (comment == 0 && commentCheck == 0) { */
|
||||
/* Finish off the chunk without the \n */
|
||||
buf[buflen - 1] = '\000';
|
||||
BuildString(buf, bufstr);
|
||||
wholeline = BuildString(bufstr->string, wholestr);
|
||||
/* }*/
|
||||
peek = 1;
|
||||
comment = 0;
|
||||
commentCheck = 1;
|
||||
BuildString((char *)0, bufstr);
|
||||
} else {
|
||||
@ -132,14 +129,10 @@ ReadLine2(fp, save, iLine)
|
||||
/* If we hit the EOF and weren't peeking ahead
|
||||
* and it's not a comment
|
||||
*/
|
||||
/*
|
||||
if (!peek && (ret == (char *)0) && (comment == 0) &&
|
||||
(commentCheck == 0)) {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -152,13 +145,7 @@ ReadLine2(fp, save, iLine)
|
||||
* to manage the consoles
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ReadCfg(char *pcFile, FILE *fp)
|
||||
#else
|
||||
ReadCfg(pcFile, fp)
|
||||
char *pcFile;
|
||||
FILE *fp;
|
||||
#endif
|
||||
{
|
||||
int iLine;
|
||||
unsigned char *acIn;
|
||||
@ -422,7 +409,6 @@ ReadCfg(pcFile, fp)
|
||||
(unsigned char *)ReadLine2(fp, acInSave,
|
||||
&iLine)) != (unsigned char *)0) {
|
||||
char *pcNext;
|
||||
char cType;
|
||||
|
||||
acStart = PruneSpace((char *)acIn);
|
||||
if (acStart[0] == '#') {
|
||||
@ -468,7 +454,6 @@ ReadCfg(pcFile, fp)
|
||||
printf("\ttrusted %s;\n", pcNext);
|
||||
break;
|
||||
default:
|
||||
cType = ' ';
|
||||
Error("%s(%d) unknown access key `%s'", pcFile, iLine,
|
||||
acStart);
|
||||
break;
|
||||
@ -480,13 +465,7 @@ ReadCfg(pcFile, fp)
|
||||
}
|
||||
|
||||
int
|
||||
#if PROTOTYPES
|
||||
main(int argc, char **argv)
|
||||
#else
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
#endif
|
||||
{
|
||||
char *pcFile;
|
||||
FILE *fp;
|
||||
|
3093
conserver/cutil.c
Normal file
3093
conserver/cutil.c
Normal file
File diff suppressed because it is too large
Load Diff
224
conserver/cutil.h
Normal file
224
conserver/cutil.h
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#if HAVE_OPENSSL
|
||||
# include <openssl/ssl.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/dh.h>
|
||||
# include <openssl/err.h>
|
||||
# if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
# define TLS_method SSLv23_method
|
||||
# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L */
|
||||
# if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
# define CIPHER_SEC0
|
||||
# else
|
||||
# define CIPHER_SEC0 ":@SECLEVEL=0"
|
||||
# endif/* OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) */
|
||||
#endif
|
||||
#if HAVE_GSSAPI
|
||||
# include <gssapi/gssapi.h>
|
||||
#endif
|
||||
|
||||
/* 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_ABRT '.' /* abort */
|
||||
|
||||
/* Struct to wrap information about a "file"...
|
||||
* This can be a socket, local file, whatever. We do this so
|
||||
* we can add encryption to sockets (and generalize I/O).
|
||||
*/
|
||||
enum consFileType {
|
||||
simpleFile,
|
||||
simpleSocket,
|
||||
simplePipe,
|
||||
#if HAVE_OPENSSL
|
||||
SSLSocket,
|
||||
#endif
|
||||
nothing
|
||||
};
|
||||
|
||||
typedef enum IOState {
|
||||
ISDISCONNECTED = 0,
|
||||
INCONNECT,
|
||||
ISNORMAL,
|
||||
#if HAVE_OPENSSL
|
||||
INSSLACCEPT,
|
||||
INSSLSHUTDOWN,
|
||||
#endif
|
||||
#if HAVE_GSSAPI
|
||||
INGSSACCEPT,
|
||||
#endif
|
||||
ISFLUSHING
|
||||
} IOSTATE;
|
||||
|
||||
typedef enum flag {
|
||||
FLAGUNKNOWN = 0,
|
||||
FLAGTRUE,
|
||||
FLAGFALSE
|
||||
} FLAG;
|
||||
|
||||
|
||||
typedef struct dynamicString {
|
||||
char *string;
|
||||
int used;
|
||||
int allocated;
|
||||
struct dynamicString *next;
|
||||
struct dynamicString *prev;
|
||||
} STRING;
|
||||
|
||||
typedef struct consFile {
|
||||
/* Standard socket type stuff */
|
||||
enum consFileType ftype;
|
||||
int fd;
|
||||
int fdout; /* only used when a simplePipe */
|
||||
STRING *wbuf;
|
||||
FLAG errored;
|
||||
FLAG quoteiac;
|
||||
FLAG sawiac;
|
||||
FLAG sawiacsusp;
|
||||
FLAG sawiacexec;
|
||||
FLAG sawiacabrt;
|
||||
FLAG sawiacgoto;
|
||||
#if HAVE_OPENSSL
|
||||
/* SSL stuff */
|
||||
SSL *ssl;
|
||||
FLAG waitForWrite;
|
||||
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)(char *);
|
||||
} ITEM;
|
||||
|
||||
typedef struct section {
|
||||
char *id;
|
||||
void (*begin)(char *);
|
||||
void (*end)(void);
|
||||
void (*abort)(void);
|
||||
void (*destroy)(void);
|
||||
ITEM *items;
|
||||
} SECTION;
|
||||
|
||||
typedef enum substToken {
|
||||
ISNOTHING = 0,
|
||||
ISNUMBER,
|
||||
ISSTRING
|
||||
} SUBSTTOKEN;
|
||||
|
||||
typedef struct subst {
|
||||
/* function to retrieve a token type based on a character
|
||||
*/
|
||||
SUBSTTOKEN (*token)(char);
|
||||
/* data for callback function
|
||||
*/
|
||||
void *data;
|
||||
/* function to retrieve a value (as a char* or int or both) for
|
||||
* a substitution
|
||||
*/
|
||||
int (*value)(char, char **, int *);
|
||||
} SUBST;
|
||||
|
||||
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;
|
||||
extern char *progname;
|
||||
extern pid_t thepid;
|
||||
#define MAXHOSTNAME 1024
|
||||
extern char myHostname[];
|
||||
#if !USE_IPV6
|
||||
extern struct in_addr *myAddrs;
|
||||
#endif
|
||||
extern fd_set rinit;
|
||||
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(time_t *);
|
||||
extern void Debug(int, char *, ...);
|
||||
extern void Error(char *, ...);
|
||||
extern void Msg(char *, ...);
|
||||
extern void Verbose(char *, ...);
|
||||
extern void SimpleSignal(int, RETSIGTYPE(*)(int));
|
||||
extern int GetMaxFiles();
|
||||
extern char *FmtCtl(int, STRING *);
|
||||
extern void FmtCtlStr(char *, int, STRING *);
|
||||
extern CONSFILE *FileOpenFD(int, enum consFileType);
|
||||
extern CONSFILE *FileOpenPipe(int, int);
|
||||
extern CONSFILE *FileOpen(const char *, int, int);
|
||||
extern int FileClose(CONSFILE **);
|
||||
extern int FileRead(CONSFILE *, void *, int);
|
||||
extern int FileWrite(CONSFILE *, FLAG, char *, int);
|
||||
extern void FileVWrite(CONSFILE *, FLAG, char *, va_list);
|
||||
extern void FilePrint(CONSFILE *, FLAG, char *, ...);
|
||||
extern int FileStat(CONSFILE *, struct stat *);
|
||||
extern int FileSeek(CONSFILE *, off_t, int);
|
||||
extern int FileSend(CONSFILE *, const void *, size_t, int);
|
||||
extern int FileFDNum(CONSFILE *);
|
||||
extern int FileFDOutNum(CONSFILE *);
|
||||
extern int FileUnopen(CONSFILE *);
|
||||
extern void OutOfMem();
|
||||
extern char *BuildTmpString(const char *);
|
||||
extern char *BuildTmpStringChar(const char);
|
||||
extern char *BuildTmpStringPrint(char *, ...);
|
||||
extern char *BuildString(const char *, STRING *);
|
||||
extern char *BuildStringChar(const char, STRING *);
|
||||
extern char *BuildStringPrint(STRING *, char *, ...);
|
||||
extern char *BuildStringN(const char *, int, STRING *);
|
||||
extern char *ShiftString(STRING *, int);
|
||||
extern void InitString(STRING *);
|
||||
extern void DestroyString(STRING *);
|
||||
extern void DestroyStrings(void);
|
||||
extern STRING *AllocString(void);
|
||||
extern char *ReadLine(FILE *, STRING *, int *);
|
||||
extern enum consFileType FileGetType(CONSFILE *);
|
||||
extern void FileSetType(CONSFILE *, enum consFileType);
|
||||
extern void FileSetQuoteIAC(CONSFILE *, FLAG);
|
||||
extern FLAG FileSawQuoteSusp(CONSFILE *);
|
||||
extern FLAG FileSawQuoteExec(CONSFILE *);
|
||||
extern FLAG FileSawQuoteAbrt(CONSFILE *);
|
||||
extern FLAG FileSawQuoteGoto(CONSFILE *);
|
||||
extern void Bye(int);
|
||||
extern void DestroyDataStructures(void);
|
||||
extern int IsMe(char *);
|
||||
extern char *PruneSpace(char *);
|
||||
extern int FileCanRead(CONSFILE *, fd_set *, fd_set *);
|
||||
extern int FileCanWrite(CONSFILE *, fd_set *, fd_set *);
|
||||
extern int FileBufEmpty(CONSFILE *);
|
||||
extern int SetFlags(int, int, int);
|
||||
extern char *StrDup(const char *);
|
||||
extern int ParseIACBuf(CONSFILE *, void *, int *);
|
||||
extern void *MemMove(void *, void *, size_t);
|
||||
extern char *StringChar(STRING *, int, char);
|
||||
extern void ParseFile(char *, FILE *, int);
|
||||
#if !USE_IPV6
|
||||
extern void ProbeInterfaces(in_addr_t);
|
||||
#endif
|
||||
extern void ProcessSubst(SUBST *, char **, char **, char *, char *);
|
||||
extern char *MyVersion(void);
|
||||
extern unsigned int AtoU(char *);
|
||||
extern void StrCpy(char *, const char *, unsigned int);
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *FileGetSSL(CONSFILE *);
|
||||
extern void FileSetSSL(CONSFILE *, SSL *);
|
||||
extern int SSLVerifyCallback(int, X509_STORE_CTX *);
|
||||
extern int FileSSLAccept(CONSFILE *);
|
||||
extern int FileCanSSLAccept(CONSFILE *, fd_set *, fd_set *);
|
||||
#endif
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: fallback.c,v 5.59 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -16,7 +14,7 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
|
||||
/*
|
||||
* get a pty for the user
|
||||
@ -27,44 +25,38 @@
|
||||
* packages, i think things are ok...hopefully it's true!
|
||||
*/
|
||||
static int
|
||||
#if PROTOTYPES
|
||||
GetPseudoTTY(STRING *slave, int *slaveFD)
|
||||
#else
|
||||
GetPseudoTTY(slave, slaveFD)
|
||||
STRING *slave;
|
||||
int *slaveFD;
|
||||
#endif
|
||||
{
|
||||
#if HAVE_OPENPTY
|
||||
int fd = -1;
|
||||
int sfd = -1;
|
||||
int opty = 0;
|
||||
char *pcName;
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
sigset_t oldmask, newmask;
|
||||
#else
|
||||
extern RETSIGTYPE FlagReapVirt PARAMS((int));
|
||||
#endif
|
||||
# else
|
||||
extern RETSIGTYPE FlagReapVirt(int);
|
||||
# endif
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
sigemptyset(&newmask);
|
||||
sigaddset(&newmask, SIGCHLD);
|
||||
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
# else
|
||||
SimpleSignal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
opty = openpty(&fd, &sfd, NULL, NULL, NULL);
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
# else
|
||||
SimpleSignal(SIGCHLD, FlagReapVirt);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (opty != 0) {
|
||||
if (fd >= 0)
|
||||
@ -84,15 +76,15 @@ GetPseudoTTY(slave, slaveFD)
|
||||
*slaveFD = sfd;
|
||||
return fd;
|
||||
#else
|
||||
#if (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX)
|
||||
# if (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX)
|
||||
int fd = -1;
|
||||
int sfd = -1;
|
||||
char *pcName;
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
sigset_t oldmask, newmask;
|
||||
#else
|
||||
extern RETSIGTYPE FlagReapVirt PARAMS((int));
|
||||
#endif
|
||||
# else
|
||||
extern RETSIGTYPE FlagReapVirt(int);
|
||||
# endif
|
||||
int c;
|
||||
/* clone list and idea stolen from xemacs distribution */
|
||||
static char *clones[] = {
|
||||
@ -111,48 +103,48 @@ GetPseudoTTY(slave, slaveFD)
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
sigemptyset(&newmask);
|
||||
sigaddset(&newmask, SIGCHLD);
|
||||
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
# else
|
||||
SimpleSignal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if HAVE_GRANTPT
|
||||
# if HAVE_GRANTPT
|
||||
grantpt(fd); /* change permission of slave */
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
# if HAVE_SIGACTION
|
||||
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
# else
|
||||
SimpleSignal(SIGCHLD, FlagReapVirt);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if HAVE_UNLOCKPT
|
||||
# if HAVE_UNLOCKPT
|
||||
unlockpt(fd); /* unlock slave */
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if defined(_AIX)
|
||||
# if defined(_AIX)
|
||||
if ((pcName = ttyname(fd)) == (char *)0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
# if HAVE_PTSNAME
|
||||
# else
|
||||
# if HAVE_PTSNAME
|
||||
if ((pcName = ptsname(fd)) == (char *)0) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
# else
|
||||
# else
|
||||
close(fd);
|
||||
return -1;
|
||||
# endif
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* go ahead and open the slave */
|
||||
if ((sfd = open(pcName, O_RDWR, 0)) < 0) {
|
||||
@ -166,7 +158,7 @@ GetPseudoTTY(slave, slaveFD)
|
||||
|
||||
*slaveFD = sfd;
|
||||
return fd;
|
||||
#else
|
||||
# else
|
||||
/*
|
||||
* Below is the string for finding /dev/ptyXX. For each architecture we
|
||||
* leave some pty's world writable because we don't have source for
|
||||
@ -210,7 +202,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;
|
||||
@ -234,7 +226,7 @@ GetPseudoTTY(slave, slaveFD)
|
||||
|
||||
*slaveFD = sfd;
|
||||
return fd;
|
||||
#endif /* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */
|
||||
# endif/* (HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT) || defined(_AIX) */
|
||||
#endif /* HAVE_OPENPTY */
|
||||
}
|
||||
|
||||
@ -242,13 +234,7 @@ GetPseudoTTY(slave, slaveFD)
|
||||
* get a pty using the GetPseudoTTY code above
|
||||
*/
|
||||
int
|
||||
#if PROTOTYPES
|
||||
FallBack(char **slave, int *sfd)
|
||||
#else
|
||||
FallBack(slave, sfd)
|
||||
char **slave;
|
||||
int *sfd;
|
||||
#endif
|
||||
{
|
||||
int fd;
|
||||
static STRING *pcTSlave = (STRING *)0;
|
||||
|
5110
conserver/group.c
5110
conserver/group.c
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: group.h,v 5.38 2003-09-19 08:58:18-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -34,6 +32,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 +60,29 @@ typedef struct grpent { /* group info */
|
||||
struct grpent *pGEnext; /* next group entry */
|
||||
} GRPENT;
|
||||
|
||||
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 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 time_t timers[];
|
||||
|
||||
extern void Spawn(GRPENT *, int);
|
||||
extern int CheckPass(char *, char *, FLAG);
|
||||
extern void TagLogfile(const CONSENT *, char *, ...);
|
||||
extern void TagLogfileAct(const CONSENT *, char *, ...);
|
||||
extern void DestroyGroup(GRPENT *);
|
||||
extern void DestroyConsent(GRPENT *, CONSENT *);
|
||||
extern void SendClientsMsg(CONSENT *, char *);
|
||||
extern void ResetMark(void);
|
||||
extern void DestroyConsentUsers(CONSENTUSERS **);
|
||||
extern CONSENTUSERS *ConsentFindUser(CONSENTUSERS *, char *);
|
||||
extern int ConsentUserOk(CONSENTUSERS *, char *);
|
||||
extern void DisconnectClient(GRPENT *, CONSCLIENT *, char *, FLAG);
|
||||
extern int ClientAccess(CONSENT *, char *);
|
||||
extern void DestroyClient(CONSCLIENT *);
|
||||
extern int CheckPasswd(CONSCLIENT *, char *, FLAG);
|
||||
extern void DeUtmp(GRPENT *, int);
|
||||
extern void ClientWantsWrite(CONSCLIENT *);
|
||||
extern void SendIWaitClientsMsg(CONSENT *, char *);
|
||||
#if HAVE_OPENSSL
|
||||
extern int AttemptSSL PARAMS((CONSCLIENT *));
|
||||
extern int AttemptSSL(CONSCLIENT *);
|
||||
#endif
|
||||
#if HAVE_GSSAPI
|
||||
extern int AttemptGSSAPI(CONSCLIENT *);
|
||||
#endif
|
||||
|
969
conserver/main.c
969
conserver/main.c
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: main.h,v 5.50 2003-10-19 22:52:37-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -36,20 +34,32 @@
|
||||
|
||||
/* program options and stuff
|
||||
*/
|
||||
extern char rcsid[];
|
||||
extern int fAll, fNoinit, fInteractive, fStrip, fDaemon, fReopen,
|
||||
fNoautoreup, fSyntaxOnly;
|
||||
#if USE_IPV6
|
||||
extern struct addrinfo *bindAddr;
|
||||
extern struct addrinfo *bindBaseAddr;
|
||||
#else
|
||||
extern in_addr_t bindAddr;
|
||||
extern struct sockaddr_in in_port;
|
||||
#endif
|
||||
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 DumpDataStructures PARAMS((void));
|
||||
#if HAVE_GSSAPI
|
||||
extern gss_name_t gss_myname;
|
||||
extern gss_cred_id_t gss_mycreds;
|
||||
#endif
|
||||
extern void ReopenLogfile(void);
|
||||
extern void ReopenUnifiedlog(void);
|
||||
extern void DumpDataStructures(void);
|
||||
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: master.c,v 5.118 2003-10-10 03:29:21-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -29,14 +27,13 @@
|
||||
|
||||
#include <compat.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <consent.h>
|
||||
#include <client.h>
|
||||
#include <group.h>
|
||||
#include <access.h>
|
||||
#include <master.h>
|
||||
#include <readcfg.h>
|
||||
#include <version.h>
|
||||
#include <main.h>
|
||||
|
||||
|
||||
@ -50,12 +47,7 @@ static unsigned long dmallocMarkClientConnection = 0;
|
||||
|
||||
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagSawCHLD(int sig)
|
||||
#else
|
||||
FlagSawCHLD(sig)
|
||||
int sig;
|
||||
#endif
|
||||
{
|
||||
fSawCHLD = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -67,11 +59,7 @@ FlagSawCHLD(sig)
|
||||
* Called when master process receives SIGCHLD
|
||||
*/
|
||||
static void
|
||||
#if PROTOTYPES
|
||||
FixKids()
|
||||
#else
|
||||
FixKids()
|
||||
#endif
|
||||
FixKids(int msfd)
|
||||
{
|
||||
pid_t pid;
|
||||
int UWbuf;
|
||||
@ -124,7 +112,7 @@ FixKids()
|
||||
|
||||
/* this kid kid is dead, start another
|
||||
*/
|
||||
Spawn(pGE);
|
||||
Spawn(pGE, msfd);
|
||||
Verbose("group #%d pid %lu on port %hu", pGE->id,
|
||||
(unsigned long)pGE->pid, pGE->port);
|
||||
}
|
||||
@ -135,12 +123,7 @@ FixKids()
|
||||
* Called when master process receives SIGTERM
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagQuitIt(int arg)
|
||||
#else
|
||||
FlagQuitIt(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
fSawQuit = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -152,12 +135,7 @@ FlagQuitIt(arg)
|
||||
* want to do something special on SIGINT at some point.
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagSawINT(int arg)
|
||||
#else
|
||||
FlagSawINT(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
fSawQuit = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -166,12 +144,7 @@ FlagSawINT(arg)
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagSawHUP(int arg)
|
||||
#else
|
||||
FlagSawHUP(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
fSawHUP = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -180,12 +153,7 @@ FlagSawHUP(arg)
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagSawUSR2(int arg)
|
||||
#else
|
||||
FlagSawUSR2(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
fSawUSR2 = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -194,12 +162,7 @@ FlagSawUSR2(arg)
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if PROTOTYPES
|
||||
FlagSawUSR1(int arg)
|
||||
#else
|
||||
FlagSawUSR1(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
fSawUSR1 = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
@ -210,12 +173,7 @@ FlagSawUSR1(arg)
|
||||
/* Signal all the kids...
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
SignalKids(int arg)
|
||||
#else
|
||||
SignalKids(arg)
|
||||
int arg;
|
||||
#endif
|
||||
{
|
||||
GRPENT *pGE;
|
||||
|
||||
@ -232,12 +190,7 @@ SignalKids(arg)
|
||||
}
|
||||
|
||||
REMOTE *
|
||||
#if PROTOTYPES
|
||||
FindRemoteConsole(char *args)
|
||||
#else
|
||||
FindRemoteConsole(args)
|
||||
char *args;
|
||||
#endif
|
||||
{
|
||||
REMOTE *pRC;
|
||||
NAMES *name;
|
||||
@ -254,13 +207,7 @@ FindRemoteConsole(args)
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
CommandCall(CONSCLIENT *pCL, char *args)
|
||||
#else
|
||||
CommandCall(pCL, args)
|
||||
CONSCLIENT *pCL;
|
||||
char *args;
|
||||
#endif
|
||||
{
|
||||
int found;
|
||||
REMOTE *pRC, *pRCFound;
|
||||
@ -292,7 +239,8 @@ CommandCall(pCL, args)
|
||||
pRCFound = pRC;
|
||||
}
|
||||
}
|
||||
if (found == 0) { /* Then look for substring matches */
|
||||
if (found == 0 && config->autocomplete == FLAGTRUE) {
|
||||
/* Then look for substring matches */
|
||||
NAMES *name = (NAMES *)0;
|
||||
int foundOne = 0;
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
@ -382,13 +330,7 @@ CommandCall(pCL, args)
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DropMasterClient(CONSCLIENT *pCLServing, FLAG force)
|
||||
#else
|
||||
DropMasterClient(pCLServing, force)
|
||||
CONSCLIENT *pCLServing;
|
||||
FLAG force;
|
||||
#endif
|
||||
{
|
||||
/* if we have data buffered and aren't forced to close,
|
||||
* we can't close quite yet
|
||||
@ -424,16 +366,11 @@ DropMasterClient(pCLServing, force)
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DoNormalRead(CONSCLIENT *pCLServing)
|
||||
#else
|
||||
DoNormalRead(pCLServing)
|
||||
CONSCLIENT *pCLServing;
|
||||
#endif
|
||||
{
|
||||
char *pcCmd;
|
||||
char *pcArgs;
|
||||
int nr, i;
|
||||
int nr, i, l;
|
||||
unsigned char acIn[BUFSIZ];
|
||||
|
||||
/* read connection */
|
||||
@ -442,230 +379,323 @@ 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, FLAGFALSE)
|
||||
!= 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
|
||||
#if HAVE_GSSAPI
|
||||
"gssapi log in with gssapi\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",
|
||||
"newlogs* close and open all logfiles (SIGUSR2)\r\n",
|
||||
"pid provide pid of master process\r\n",
|
||||
"quit* terminate conserver (SIGTERM)\r\n",
|
||||
"restart* restart conserver (SIGHUP) - deprecated\r\n",
|
||||
"reconfig* reread config file (SIGHUP)\r\n",
|
||||
"version provide version info for server\r\n",
|
||||
"up* bring up all downed consoles (SIGUSR1)\r\n",
|
||||
"* = requires admin privileges\r\n",
|
||||
(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) {
|
||||
#if HAVE_GSSAPI
|
||||
} else if (pCLServing->iState == S_IDENT &&
|
||||
strcmp(pcCmd, "gssapi") == 0) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE, "ok\r\n", -1);
|
||||
/* Change the I/O mode right away, we'll do the read
|
||||
* and accept when the select gets back to us */
|
||||
pCLServing->ioState = INGSSACCEPT;
|
||||
#endif
|
||||
} 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, "",
|
||||
FLAGTRUE) == 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_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
|
||||
SOCKADDR_STYPE 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 {
|
||||
# if USE_IPV6
|
||||
int error;
|
||||
char addr[NI_MAXHOST];
|
||||
error =
|
||||
getnameinfo((struct sockaddr *)&lcl, so, addr,
|
||||
sizeof(addr), NULL, 0,
|
||||
NI_NUMERICHOST);
|
||||
if (!error)
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
|
||||
addr);
|
||||
# else
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
|
||||
inet_ntoa(lcl.sin_addr));
|
||||
# endif
|
||||
iSep = 0;
|
||||
}
|
||||
#else
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, "@0");
|
||||
iSep = 0;
|
||||
#endif
|
||||
}
|
||||
if (iSep >= 0) {
|
||||
if (config->redirect == FLAGTRUE) {
|
||||
REMOTE *pRC;
|
||||
char *s;
|
||||
for (pRC = pRCUniq; (REMOTE *)0 != pRC;
|
||||
pRC = pRC->pRCuniq) {
|
||||
s = ":@%s";
|
||||
s += iSep;
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, s,
|
||||
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",
|
||||
MyVersion());
|
||||
} 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, "reconfig") == 0) {
|
||||
if (ConsentUserOk(pADList, pCLServing->username->string) ==
|
||||
1) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- reconfiguring\r\n", -1);
|
||||
Verbose("reconfig command by %s",
|
||||
pCLServing->acid->string);
|
||||
kill(thepid, SIGHUP);
|
||||
} else
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "up") == 0) {
|
||||
if (ConsentUserOk(pADList, pCLServing->username->string) ==
|
||||
1) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- bringing up consoles\r\n", -1);
|
||||
Verbose("up command by %s", pCLServing->acid->string);
|
||||
kill(thepid, SIGUSR1);
|
||||
} else
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "newlogs") == 0) {
|
||||
if (ConsentUserOk(pADList, pCLServing->username->string) ==
|
||||
1) {
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"ok -- opening new logfiles\r\n", -1);
|
||||
Verbose("newlogs command by %s",
|
||||
pCLServing->acid->string);
|
||||
kill(thepid, SIGUSR2);
|
||||
} else
|
||||
FileWrite(pCLServing->fd, FLAGFALSE,
|
||||
"unauthorized command\r\n", -1);
|
||||
} else if (pCLServing->iState == S_NORMAL &&
|
||||
strcmp(pcCmd, "groups") == 0) {
|
||||
int iSep = 1;
|
||||
GRPENT *pGE;
|
||||
char *s;
|
||||
|
||||
for (pGE = pGroups; pGE != (GRPENT *)0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers)
|
||||
continue;
|
||||
s = ":%hu";
|
||||
s += iSep;
|
||||
FilePrint(pCLServing->fd, FLAGTRUE, s, 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);
|
||||
}
|
||||
}
|
||||
|
||||
/* this routine is used by the master console server process (ksb)
|
||||
*/
|
||||
void
|
||||
#if PROTOTYPES
|
||||
Master(void)
|
||||
#else
|
||||
Master()
|
||||
#endif
|
||||
{
|
||||
int cfd;
|
||||
int msfd;
|
||||
socklen_t so;
|
||||
fd_set rmask, wmask;
|
||||
#if USE_IPV6 || !USE_UNIX_DOMAIN_SOCKETS
|
||||
# if USE_IPV6
|
||||
struct addrinfo *rp;
|
||||
# else
|
||||
struct sockaddr_in master_port;
|
||||
# endif
|
||||
# if HAVE_SETSOCKOPT
|
||||
int true = 1;
|
||||
# endif
|
||||
#else
|
||||
struct sockaddr_un master_port;
|
||||
static STRING *portPath = (STRING *)0;
|
||||
#endif
|
||||
FILE *fp;
|
||||
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
|
||||
CONSCLIENT *pCL = (CONSCLIENT *)0;
|
||||
@ -682,6 +712,9 @@ Master()
|
||||
#endif
|
||||
#if defined(SIGPOLL)
|
||||
SimpleSignal(SIGPOLL, SIG_IGN);
|
||||
#endif
|
||||
#if defined(SIGXFSZ)
|
||||
SimpleSignal(SIGXFSZ, SIG_IGN);
|
||||
#endif
|
||||
SimpleSignal(SIGCHLD, FlagSawCHLD);
|
||||
SimpleSignal(SIGTERM, FlagQuitIt);
|
||||
@ -701,11 +734,82 @@ Master()
|
||||
|
||||
/* set up port for master to listen on
|
||||
*/
|
||||
#if HAVE_MEMSET
|
||||
#if !USE_IPV6
|
||||
# if HAVE_MEMSET
|
||||
memset((void *)&master_port, 0, sizeof(master_port));
|
||||
#else
|
||||
# else
|
||||
bzero((char *)&master_port, sizeof(master_port));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if USE_IPV6
|
||||
for (rp = bindAddr; rp != NULL; rp = rp->ai_next) {
|
||||
if ((msfd =
|
||||
socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) < 0)
|
||||
continue;
|
||||
|
||||
# if HAVE_SETSOCKOPT
|
||||
if (setsockopt
|
||||
(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true,
|
||||
sizeof(true)) < 0)
|
||||
goto fail;
|
||||
# endif
|
||||
if (!SetFlags(msfd, O_NONBLOCK, 0))
|
||||
goto fail;
|
||||
|
||||
if (bind(msfd, rp->ai_addr, rp->ai_addrlen) == 0)
|
||||
break;
|
||||
|
||||
fail:
|
||||
close(msfd);
|
||||
}
|
||||
|
||||
if (listen(msfd, SOMAXCONN) < 0) {
|
||||
Error("Master(): listen(): %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* save addrlen for accept */
|
||||
so = rp->ai_addrlen;
|
||||
#elif USE_UNIX_DOMAIN_SOCKETS
|
||||
master_port.sun_family = AF_UNIX;
|
||||
|
||||
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,
|
||||
sizeof(master_port.sun_path));
|
||||
|
||||
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;
|
||||
}
|
||||
# ifdef TRUST_UDS_CRED
|
||||
/* Allow everyone to connect, but we later auth them via SO_PEERCRED */
|
||||
chmod(master_port.sun_path, 0666);
|
||||
# endif
|
||||
|
||||
#else
|
||||
master_port.sin_family = AF_INET;
|
||||
master_port.sin_addr.s_addr = bindAddr;
|
||||
master_port.sin_port = htons(bindPort);
|
||||
@ -715,7 +819,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 +827,7 @@ Master()
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (!SetFlags(msfd, O_NONBLOCK, 0))
|
||||
return;
|
||||
@ -739,6 +843,7 @@ Master()
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
fp = fopen(PIDFILE, "w");
|
||||
if (fp) {
|
||||
@ -756,14 +861,15 @@ Master()
|
||||
for (fSawQuit = 0; !fSawQuit; /* can't close here :-( */ ) {
|
||||
if (fSawCHLD) {
|
||||
fSawCHLD = 0;
|
||||
FixKids();
|
||||
FixKids(msfd);
|
||||
}
|
||||
if (fSawHUP) {
|
||||
fSawHUP = 0;
|
||||
Msg("processing SIGHUP");
|
||||
ReopenLogfile();
|
||||
ReopenUnifiedlog();
|
||||
SignalKids(SIGHUP);
|
||||
ReReadCfg(msfd);
|
||||
ReReadCfg(msfd, msfd);
|
||||
/* fix up the client descriptors since ReReadCfg() doesn't
|
||||
* see them like it can in the child processes */
|
||||
for (pCL = pCLmall; pCL != (CONSCLIENT *)0; pCL = pCL->pCLscan) {
|
||||
@ -783,6 +889,7 @@ Master()
|
||||
fSawUSR2 = 0;
|
||||
Msg("processing SIGUSR2");
|
||||
ReopenLogfile();
|
||||
ReopenUnifiedlog();
|
||||
SignalKids(SIGUSR2);
|
||||
}
|
||||
if (fSawQuit) { /* Something above set the quit flag */
|
||||
@ -816,6 +923,17 @@ Master()
|
||||
pCLServing->ioState = ISNORMAL;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if HAVE_GSSAPI
|
||||
case INGSSACCEPT:
|
||||
{
|
||||
int r;
|
||||
if ((r = AttemptGSSAPI(pCLServing)) < 0)
|
||||
DropMasterClient(pCLServing, FLAGFALSE);
|
||||
else if (r == 1)
|
||||
pCLServing->ioState = ISNORMAL;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case ISNORMAL:
|
||||
if (FileCanRead(pCLServing->fd, &rmask, &wmask))
|
||||
@ -827,8 +945,8 @@ Master()
|
||||
CONDDEBUG((1, "Master(): flushing fd %d",
|
||||
FileFDNum(pCLServing->fd)));
|
||||
if (FileWrite
|
||||
(pCLServing->fd, FLAGFALSE, (char *)0,
|
||||
0) < 0) {
|
||||
(pCLServing->fd, FLAGFALSE, (char *)0, 0)
|
||||
< 0) {
|
||||
DropMasterClient(pCLServing, FLAGTRUE);
|
||||
break;
|
||||
}
|
||||
@ -857,7 +975,9 @@ Master()
|
||||
dmallocMarkClientConnection = dmalloc_mark();
|
||||
#endif
|
||||
|
||||
#if !USE_IPV6
|
||||
so = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
for (cfd = 0; cfd == 0;) {
|
||||
cfd =
|
||||
accept(msfd, (struct sockaddr *)&pCLmfree->cnct_port, &so);
|
||||
@ -874,9 +994,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 +1046,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,6 +1,4 @@
|
||||
/*
|
||||
* $Id: master.h,v 5.17 2003-10-03 07:23:37-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -39,5 +37,5 @@
|
||||
*/
|
||||
extern CONSCLIENT *pCLmall;
|
||||
extern CONSCLIENT *pCLmfree;
|
||||
extern void Master PARAMS((void));
|
||||
extern void SignalKids PARAMS((int));
|
||||
extern void Master(void);
|
||||
extern void SignalKids(int);
|
||||
|
3572
conserver/readcfg.c
3572
conserver/readcfg.c
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,16 @@
|
||||
/*
|
||||
* $Id: readcfg.h,v 5.36 2003-10-31 09:54:44-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#define BREAKDELAYDEFAULT 250
|
||||
#define BREAKLISTSIZE 35 /* ('z'-('a'-1))+('9'-('1'-1)) */
|
||||
#define BREAKALPHAOFFSET 39 /* ('a'-('9'+1)) */
|
||||
|
||||
typedef struct config {
|
||||
STRING *name;
|
||||
FLAG autocomplete;
|
||||
char defaultaccess;
|
||||
FLAG daemonmode;
|
||||
char *logfile;
|
||||
@ -17,34 +20,56 @@ typedef struct config {
|
||||
FLAG loghostnames;
|
||||
int reinitcheck;
|
||||
char *secondaryport;
|
||||
char *unifiedlog;
|
||||
int initdelay;
|
||||
#if HAVE_SETPROCTITLE
|
||||
FLAG setproctitle;
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
char *sslcredentials;
|
||||
FLAG sslrequired;
|
||||
FLAG sslreqclientcert;
|
||||
char *sslcacertificatefile;
|
||||
#endif
|
||||
} CONFIG;
|
||||
|
||||
typedef struct breaks {
|
||||
STRING *seq;
|
||||
int delay;
|
||||
FLAG confirm;
|
||||
} BREAKS;
|
||||
|
||||
typedef struct tasks {
|
||||
char id;
|
||||
STRING *cmd;
|
||||
STRING *descr;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
char *subst;
|
||||
FLAG confirm;
|
||||
struct tasks *next;
|
||||
} TASKS;
|
||||
|
||||
extern NAMES *userList; /* user list */
|
||||
extern GRPENT *pGroups; /* group info */
|
||||
extern REMOTE *pRCList; /* list of remote consoles we know about */
|
||||
extern REMOTE *pRCUniq; /* list of uniq console servers */
|
||||
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 CONSENTUSERS *pLUList; /* list of limited users */
|
||||
extern BREAKS breakList[BREAKLISTSIZE]; /* list of break sequences */
|
||||
extern TASKS *taskList; /* list of tasks */
|
||||
extern SUBST *taskSubst; /* substitution function data for tasks */
|
||||
extern CONFIG *pConfig; /* settings seen by config parser */
|
||||
extern SUBST *substData; /* substitution function data */
|
||||
|
||||
extern void ReadCfg PARAMS((char *, FILE *));
|
||||
extern void ReReadCfg PARAMS((int));
|
||||
extern void DestroyBreakList PARAMS((void));
|
||||
extern void DestroyUserList PARAMS((void));
|
||||
extern void DestroyConfig PARAMS((CONFIG *));
|
||||
extern NAMES *FindUserList PARAMS((char *));
|
||||
extern NAMES *AddUserList PARAMS((char *));
|
||||
extern CONSENT *FindConsoleName PARAMS((CONSENT *, char *));
|
||||
extern void ReadCfg(char *, FILE *);
|
||||
extern void ReReadCfg(int, int);
|
||||
extern void DestroyBreakList(void);
|
||||
extern void InitBreakList(void);
|
||||
extern void DestroyTaskList(void);
|
||||
extern void DestroyUserList(void);
|
||||
extern void DestroyConfig(CONFIG *);
|
||||
extern NAMES *FindUserList(char *);
|
||||
extern NAMES *AddUserList(char *);
|
||||
extern CONSENT *FindConsoleName(CONSENT *, char *);
|
||||
|
1941
conserver/util.c
1941
conserver/util.c
File diff suppressed because it is too large
Load Diff
144
conserver/util.h
144
conserver/util.h
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* $Id: util.h,v 1.55 2003-10-03 06:32:34-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#if PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#if HAVE_OPENSSL
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
/* communication constants
|
||||
*/
|
||||
#define OB_SUSP 'Z' /* suspended by server */
|
||||
#define OB_DROP '.' /* dropped by server */
|
||||
|
||||
/* Struct to wrap information about a "file"...
|
||||
* This can be a socket, local file, whatever. We do this so
|
||||
* we can add encryption to sockets (and generalize I/O).
|
||||
*/
|
||||
enum consFileType {
|
||||
simpleFile,
|
||||
simpleSocket,
|
||||
simplePipe,
|
||||
#if HAVE_OPENSSL
|
||||
SSLSocket,
|
||||
#endif
|
||||
nothing
|
||||
};
|
||||
|
||||
typedef enum IOState {
|
||||
ISDISCONNECTED = 0,
|
||||
INCONNECT,
|
||||
ISNORMAL,
|
||||
#if HAVE_OPENSSL
|
||||
INSSLACCEPT,
|
||||
INSSLSHUTDOWN,
|
||||
#endif
|
||||
ISFLUSHING
|
||||
} IOSTATE;
|
||||
|
||||
typedef enum flag {
|
||||
FLAGUNKNOWN = 0,
|
||||
FLAGTRUE,
|
||||
FLAGFALSE
|
||||
} FLAG;
|
||||
|
||||
|
||||
typedef struct dynamicString {
|
||||
char *string;
|
||||
int used;
|
||||
int allocated;
|
||||
struct dynamicString *next;
|
||||
struct dynamicString *prev;
|
||||
} STRING;
|
||||
|
||||
typedef struct consFile {
|
||||
/* Standard socket type stuff */
|
||||
enum consFileType ftype;
|
||||
int fd;
|
||||
int fdout; /* only used when a simplePipe */
|
||||
STRING *wbuf;
|
||||
#if HAVE_OPENSSL
|
||||
/* SSL stuff */
|
||||
SSL *ssl;
|
||||
FLAG waitForWrite;
|
||||
FLAG waitForRead;
|
||||
#endif
|
||||
/* Add crypto stuff to suit */
|
||||
} CONSFILE;
|
||||
|
||||
extern int isMultiProc, fDebug, fVerbose, fErrorPrinted;
|
||||
extern char *progname;
|
||||
extern pid_t thepid;
|
||||
#define MAXHOSTNAME 1024
|
||||
extern char myHostname[];
|
||||
extern struct in_addr *myAddrs;
|
||||
extern fd_set rinit;
|
||||
extern fd_set winit;
|
||||
extern int maxfd;
|
||||
extern int debugLineNo;
|
||||
extern char *debugFileName;
|
||||
|
||||
extern const char *StrTime PARAMS((time_t *));
|
||||
extern void Debug PARAMS((int, char *, ...));
|
||||
extern void Error PARAMS((char *, ...));
|
||||
extern void Msg PARAMS((char *, ...));
|
||||
extern void Verbose PARAMS((char *, ...));
|
||||
extern void SimpleSignal PARAMS((int, RETSIGTYPE(*)(int)));
|
||||
extern int GetMaxFiles PARAMS(());
|
||||
extern char *FmtCtl PARAMS((int, STRING *));
|
||||
extern void FmtCtlStr PARAMS((char *, int, STRING *));
|
||||
extern CONSFILE *FileOpenFD PARAMS((int, enum consFileType));
|
||||
extern CONSFILE *FileOpenPipe PARAMS((int, int));
|
||||
extern CONSFILE *FileOpen PARAMS((const char *, int, int));
|
||||
extern int FileClose PARAMS((CONSFILE **));
|
||||
extern int FileRead PARAMS((CONSFILE *, void *, int));
|
||||
extern int FileWrite PARAMS((CONSFILE *, FLAG, char *, int));
|
||||
extern void FileVWrite PARAMS((CONSFILE *, FLAG, char *, va_list));
|
||||
extern void FilePrint PARAMS((CONSFILE *, FLAG, char *, ...));
|
||||
extern int FileStat PARAMS((CONSFILE *, struct stat *));
|
||||
extern int FileSeek PARAMS((CONSFILE *, off_t, int));
|
||||
extern int FileSend PARAMS((CONSFILE *, const void *, size_t, int));
|
||||
extern int FileFDNum PARAMS((CONSFILE *));
|
||||
extern int FileFDOutNum PARAMS((CONSFILE *));
|
||||
extern int FileUnopen PARAMS((CONSFILE *));
|
||||
extern void OutOfMem PARAMS(());
|
||||
extern char *BuildTmpString PARAMS((const char *));
|
||||
extern char *BuildTmpStringChar PARAMS((const char));
|
||||
extern char *BuildString PARAMS((const char *, STRING *));
|
||||
extern char *BuildStringChar PARAMS((const char, STRING *));
|
||||
extern char *BuildStringPrint PARAMS((STRING *, char *, ...));
|
||||
extern char *BuildStringN PARAMS((const char *, int, STRING *));
|
||||
extern char *ShiftString PARAMS((STRING *, int));
|
||||
extern void InitString PARAMS((STRING *));
|
||||
extern void DestroyString PARAMS((STRING *));
|
||||
extern void DestroyStrings PARAMS((void));
|
||||
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 Bye PARAMS((int));
|
||||
extern void DestroyDataStructures PARAMS((void));
|
||||
extern int IsMe PARAMS((char *));
|
||||
extern char *PruneSpace PARAMS((char *));
|
||||
extern int FileCanRead PARAMS((CONSFILE *, fd_set *, fd_set *));
|
||||
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 *));
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *FileGetSSL PARAMS((CONSFILE *));
|
||||
extern void FileSetSSL PARAMS((CONSFILE *, SSL *));
|
||||
extern int SSLVerifyCallback PARAMS((int, X509_STORE_CTX *));
|
||||
extern int FileSSLAccept PARAMS((CONSFILE *));
|
||||
extern int FileCanSSLAccept PARAMS((CONSFILE *, fd_set *, fd_set *));
|
||||
#endif
|
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: version.h,v 1.51 2003-10-31 10:04:19-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -14,4 +12,9 @@
|
||||
@(#) Copyright 2000 conserver.com.\n\
|
||||
All rights reserved.\n"
|
||||
|
||||
#define THIS_VERSION "conserver.com version 8.0.5"
|
||||
#define VERSION_DATE "2020/05/01"
|
||||
#define VERSION_MAJOR 8
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_REV 5
|
||||
#define VERSION_TEXT "conserver.com version"
|
||||
#define VERSION_UINT (VERSION_MAJOR * 1000000 + VERSION_MINOR * 1000 + VERSION_REV)
|
||||
|
@ -1,4 +1,5 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
@ -15,7 +16,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 +26,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 $@ $<
|
||||
@ -51,6 +57,6 @@ install: console
|
||||
$(MKDIR) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) console $(DESTDIR)$(bindir)
|
||||
$(MKDIR) $(DESTDIR)$(mandir)/man1
|
||||
$(INSTALL) console.man $(DESTDIR)$(mandir)/man1/console.1
|
||||
$(INSTALL) -m 0644 console.man $(DESTDIR)$(mandir)/man1/console.1
|
||||
|
||||
.PHONY: clean distclean install
|
||||
|
1889
console/console.c
1889
console/console.c
File diff suppressed because it is too large
Load Diff
@ -1,558 +0,0 @@
|
||||
.\" $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"
|
||||
.SH NAME
|
||||
console \- console server client program
|
||||
.SH SYNOPSIS
|
||||
.B console
|
||||
.RB [ \-aAEfFsS ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-c
|
||||
.IR cred ]
|
||||
.BR [ \-M
|
||||
.IR mach ]
|
||||
.BR [ \-p
|
||||
.IR port ]
|
||||
.BR [ \-e
|
||||
.IR esc ]
|
||||
.BR [ \-l
|
||||
.IR user ]
|
||||
.I console
|
||||
.br
|
||||
.B console
|
||||
.RB [ \-hiIPrRuVwWx ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-M
|
||||
.IR mach ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.RB [ \-d
|
||||
.RI [ user ][\fB@\fP console ]]
|
||||
.RB [ \- [ bB ]
|
||||
.IR message ]
|
||||
.RB [ \-t
|
||||
.RI [ user ][\fB@\fP console ]
|
||||
.IR message ]
|
||||
.br
|
||||
.B console
|
||||
.RB [ \-qQ ]
|
||||
.RB [ \-7Dv ]
|
||||
.RB [ \-M
|
||||
.IR mach ]
|
||||
.RB [ \-p
|
||||
.IR port ]
|
||||
.SH DESCRIPTION
|
||||
.B Console
|
||||
is used to manipulate console terminals remotely or to poll running
|
||||
.BR conserver (8)
|
||||
daemons for status information.
|
||||
.PP
|
||||
In the first form above,
|
||||
.B console
|
||||
asks the user's password before
|
||||
granting interactive access to a console (on a non-trusted system),
|
||||
since such a session may provide single-user access.
|
||||
Only as much of the console name as is required to
|
||||
identify it uniquely to the server is required.
|
||||
.PP
|
||||
For non-interactive options,
|
||||
.B console
|
||||
outputs only the requested information and exits.
|
||||
.PP
|
||||
.B Console
|
||||
knows only of a primary
|
||||
.B conserver
|
||||
host (see the
|
||||
.B \-M
|
||||
option below), to which it initially connects.
|
||||
In a multi-server environment, the primary server may refer
|
||||
the client to a different server handling the requested console,
|
||||
or it will provide a list of all servers if required (as when
|
||||
.B console
|
||||
is invoked with the
|
||||
.B \-r
|
||||
option).
|
||||
.B Console
|
||||
then opens connections to the appropriate server(s).
|
||||
It is not necessary for the user of
|
||||
.B console
|
||||
to know which server manages which consoles, as long as
|
||||
.B console
|
||||
knows a valid primary server
|
||||
and all available consoles are listed in the primary server's
|
||||
configuration file.
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
Options may be given as separate arguments (e.g.,
|
||||
.B \-v
|
||||
.BR \-w )
|
||||
or clustered (e.g.,
|
||||
.BR \-vw ).
|
||||
Options and their arguments may be separated by optional white space.
|
||||
Option arguments containing spaces or other characters special to the shell
|
||||
must be quoted.
|
||||
.TP 11
|
||||
.B \-7
|
||||
Strip the high bit off of all data received, whether from user
|
||||
input or from the server, before any processing occurs.
|
||||
Disallows escape sequence characters with the high bit set.
|
||||
.TP
|
||||
.B \-a
|
||||
Access a console with a two-way (read-write) connection (this is the default).
|
||||
The connection is dropped to spy mode if someone else is attached read-write.
|
||||
.TP
|
||||
.BI \-b message
|
||||
Broadcast a
|
||||
.I message
|
||||
to all users connected to each server.
|
||||
.TP
|
||||
.BI \-B message
|
||||
Same as
|
||||
.B \-b
|
||||
but just send a
|
||||
.I message
|
||||
to users on the primary server.
|
||||
.TP
|
||||
.BI \-c cred
|
||||
Load an SSL certificate and key from the PEM encoded file
|
||||
.IR cred .
|
||||
.TP
|
||||
.B \-d
|
||||
Disconnect the users specified by
|
||||
.IR user @ console .
|
||||
You may specify the target as
|
||||
.I user
|
||||
(disconnect the
|
||||
.IR user,
|
||||
regardless of what console they are attached to),
|
||||
.RI @ console
|
||||
(disconnect all users attached to
|
||||
.IR console ),
|
||||
or
|
||||
.IR user @ console
|
||||
(disconnect the
|
||||
.I user
|
||||
attached to
|
||||
.IR console ).
|
||||
.TP
|
||||
.B \-D
|
||||
Enable debugging output.
|
||||
.TP
|
||||
.BI \-e esc
|
||||
Set the initial two-character escape sequence to those represented by
|
||||
.IR esc .
|
||||
Any of the forms output by
|
||||
.BR cat (1)'s
|
||||
.B \-v
|
||||
option are accepted.
|
||||
The default value is
|
||||
.RB `` ^Ec ''.
|
||||
.TP
|
||||
.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.
|
||||
.TP
|
||||
.B \-f
|
||||
Same as
|
||||
.B \-a
|
||||
except it will force any existing connection into spy mode.
|
||||
.TP
|
||||
.B \-h
|
||||
Display a brief help message.
|
||||
.TP
|
||||
.B \-i
|
||||
Display information in a machine-parseable format (see below for the details).
|
||||
.TP
|
||||
.B \-I
|
||||
Same as
|
||||
.B \-i
|
||||
but just acts on the primary server.
|
||||
.TP
|
||||
.BI \-l user
|
||||
Set the login name used for authentication to
|
||||
.IR user .
|
||||
By default,
|
||||
.B console
|
||||
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
|
||||
The
|
||||
.B console
|
||||
client program polls
|
||||
.I mach
|
||||
as the primary server,
|
||||
rather than the default set at compile time (typically
|
||||
.RB `` console '').
|
||||
The default
|
||||
.I mach
|
||||
may be changed at compile time using the
|
||||
.B --with-master
|
||||
option.
|
||||
.TP
|
||||
.BI \-p port
|
||||
Set the port to connect to.
|
||||
This may be either a port number
|
||||
or a service name.
|
||||
The default
|
||||
.I port
|
||||
may be changed at compile time
|
||||
using the
|
||||
.B --with-port
|
||||
option.
|
||||
.TP
|
||||
.B \-P
|
||||
Display the pid of the master daemon process on each server.
|
||||
.TP
|
||||
.B \-q
|
||||
The
|
||||
.B console
|
||||
client connects to each server to request that the
|
||||
server daemon quit (shut down).
|
||||
The root password of the host(s) running conserver is required
|
||||
unless the local host is listed as ``trusted'' in the
|
||||
conserver.cf file; in that case, just press <return>.
|
||||
.TP
|
||||
.B \-Q
|
||||
Same as
|
||||
.B \-q
|
||||
but just acts on the primary server.
|
||||
.TP
|
||||
.B \-r
|
||||
Display daemon versions.
|
||||
The
|
||||
.B console
|
||||
client connects to each
|
||||
server to request its version information.
|
||||
.TP
|
||||
.B \-R
|
||||
Same as
|
||||
.B \-r
|
||||
but just acts on the primary server.
|
||||
.TP
|
||||
.B \-s
|
||||
Request a read-only (spy mode) connection.
|
||||
In this mode all the escape sequences (below) work, or report errors,
|
||||
but all other keyboard input is discarded.
|
||||
.TP
|
||||
.B \-t
|
||||
Send a text
|
||||
.I message
|
||||
to
|
||||
.IR user @ console .
|
||||
You may specify the target as
|
||||
.I user
|
||||
(send to
|
||||
.IR user,
|
||||
regardless of what console they are attached to),
|
||||
.RI @ console
|
||||
(send to all users attached to
|
||||
.IR console ),
|
||||
or
|
||||
.IR user @ console
|
||||
(send to
|
||||
.I user
|
||||
attached to
|
||||
.IR console ).
|
||||
.TP
|
||||
.B \-u
|
||||
Show a list of all consoles with status (`up', `down', or `init')
|
||||
and attached users
|
||||
.RI ( user @ host
|
||||
if attached read-write, `<spies>' if only users in spy mode, or `<none>').
|
||||
.TP
|
||||
.B \-v
|
||||
Be more verbose when building the connection(s).
|
||||
Use this option in combination with any of `show' options (below)
|
||||
for added benefit.
|
||||
.TP
|
||||
.B \-V
|
||||
Output the version and settings of the console client program
|
||||
and then exit.
|
||||
.TP
|
||||
.B \-w
|
||||
Show a list of all who are currently connected to consoles,
|
||||
including the hostnames where the
|
||||
.B console
|
||||
connections originate and the idle times.
|
||||
This is useful to see if anybody is actively
|
||||
using the console system if it becomes necessary to shut down
|
||||
.BR conserver .
|
||||
.TP
|
||||
.B \-W
|
||||
Same as
|
||||
.B \-w
|
||||
but just acts on the primary server.
|
||||
.TP
|
||||
.B \-x
|
||||
Show a list of consoles and devices.
|
||||
.PP
|
||||
The
|
||||
.BR \-A ,
|
||||
.BR \-F ", or"
|
||||
.B \-S
|
||||
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 '
|
||||
were typed).
|
||||
.PP
|
||||
The
|
||||
.B \-i
|
||||
option outputs information regarding each console in 13 colon-separated fields.
|
||||
.TP
|
||||
.I name
|
||||
The name of the console.
|
||||
.TP
|
||||
.I hostname,pid,socket
|
||||
The hostname, pid, and socket number of the child process managing
|
||||
the console.
|
||||
.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 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
|
||||
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.
|
||||
.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,
|
||||
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.
|
||||
.TP
|
||||
.I state
|
||||
The state of the console.
|
||||
Values with either be ``up'', ``down'', or ``init''.
|
||||
.TP
|
||||
.I perm
|
||||
This value will either be ``rw'' or ``ro''.
|
||||
It will only be ``ro'' if
|
||||
the console is a local device (`/' type) and the permissions are such
|
||||
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
|
||||
values will be the logfile, ``log'' or ``nolog'' (if logging is on
|
||||
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
|
||||
.I break
|
||||
The default break sequence used for the console.
|
||||
.TP
|
||||
.I reup
|
||||
If the console is currently down and the automatic reconnection code
|
||||
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.
|
||||
.TP
|
||||
.I options
|
||||
The active options for the console are presented in a comma seperated list.
|
||||
.TP
|
||||
.I initcmd
|
||||
The initcmd configuration option for the console.
|
||||
.SH "ESCAPE SEQUENCES"
|
||||
The connection can be controlled by a two-character escape sequence, followed
|
||||
by a command.
|
||||
The default escape sequence is ``control-E c''
|
||||
(octal 005 143).
|
||||
(The escape sequences are actually processed by the server; see the
|
||||
.BR conserver (8)
|
||||
man page for more information.)
|
||||
Commands are:
|
||||
.sp
|
||||
.PD 0
|
||||
.TP 13
|
||||
.B a
|
||||
attach read-write if nobody already is
|
||||
.TP
|
||||
.B b
|
||||
send broadcast message to all users on this console
|
||||
.TP
|
||||
.B c
|
||||
toggle flow control (don't do this)
|
||||
.TP
|
||||
.B d
|
||||
down the current console
|
||||
.TP
|
||||
.BI e cc
|
||||
change the escape sequence to the next two characters
|
||||
.TP
|
||||
.B f
|
||||
forcibly attach read-write
|
||||
.TP
|
||||
.B g
|
||||
group info
|
||||
.TP
|
||||
.B L
|
||||
toggle logging on/off
|
||||
.TP
|
||||
.B l?
|
||||
list the break sequences available
|
||||
.TP
|
||||
.B l0
|
||||
send the break sequence associated with this console
|
||||
.TP
|
||||
.B l1-9
|
||||
send the specific break sequence
|
||||
.TP
|
||||
.B m
|
||||
display the "message of the day"
|
||||
.TP
|
||||
.B o
|
||||
close (if open) and reopen the line (to clear errors (silo overflows))
|
||||
and the log file
|
||||
.TP
|
||||
.B p
|
||||
replay the last 60 lines of output
|
||||
.TP
|
||||
.B r
|
||||
replay the last 20 lines of output
|
||||
.TP
|
||||
.B s
|
||||
switch to spy mode (read-only)
|
||||
.TP
|
||||
.B u
|
||||
show status of hosts/users in this group
|
||||
.TP
|
||||
.B v
|
||||
show the version of the group server
|
||||
.TP
|
||||
.B w
|
||||
who is using this console
|
||||
.TP
|
||||
.B x
|
||||
examine this group's devices and modes
|
||||
.TP
|
||||
.B z
|
||||
suspend this connection
|
||||
.TP
|
||||
.B ?
|
||||
display list of commands
|
||||
.TP
|
||||
.BR ^M " (return)"
|
||||
continue, ignore the escape sequence
|
||||
.TP
|
||||
.BR ^R " (ctrl-R)"
|
||||
replay the last line only
|
||||
.TP
|
||||
.BI \e ooo
|
||||
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
|
||||
will be discarded.
|
||||
Note that a line break or a down command
|
||||
can only be sent from a full two-way attachment.
|
||||
To send the escape sequence through the connection one must redefine
|
||||
the outer escape sequence, or use
|
||||
.BI ^Ec\e ooo
|
||||
to send the
|
||||
first escape character before typing the second character directly.
|
||||
.PP
|
||||
In the
|
||||
.B \-u
|
||||
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.
|
||||
.SH EXAMPLES
|
||||
.TP 15
|
||||
console \-u
|
||||
Outputs something like:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
dumb up <none>
|
||||
expert up ksb@mentor
|
||||
tyro up <spies>
|
||||
mentor up <none>
|
||||
sage up fine@cis
|
||||
.fi
|
||||
.ft
|
||||
.IP
|
||||
The
|
||||
.B <none>
|
||||
indicates no one is viewing
|
||||
.IR dumb
|
||||
or
|
||||
.IR mentor ,
|
||||
the
|
||||
.B <spies>
|
||||
indicates only read-only connections exist for
|
||||
.IR tyro ,
|
||||
and other
|
||||
.IR login @ host
|
||||
entries indicate users attached read-write to
|
||||
.I sage
|
||||
and
|
||||
.IR expert .
|
||||
.TP
|
||||
console \-w
|
||||
Outputs something like:
|
||||
.IP
|
||||
.ft CR
|
||||
.nf
|
||||
ksb@extra attach 2days expert
|
||||
file@cis attach 21:46 sage
|
||||
dmr@alice spy \00:04 tyro
|
||||
.fi
|
||||
.ft
|
||||
.IP
|
||||
The third column is the idle time of the user.
|
||||
Either
|
||||
.IR hours : minutes
|
||||
or number of days is displayed.
|
||||
.TP
|
||||
console \-e "^[1" lv426
|
||||
Requests a connection to the host ``lv426'' with the escape characters
|
||||
set to ``escape one''.
|
||||
.SH BUGS
|
||||
It is possible to create a loop of console connections, with ugly results.
|
||||
Never run
|
||||
.B console
|
||||
from within a console connection (unless you set each
|
||||
escape sequence differently).
|
||||
.PP
|
||||
The \-i output can produce more than the stated number of fields of
|
||||
information if the user-provided information has embedded colons.
|
||||
.PP
|
||||
I'm sure there are more, I just don't know where they are.
|
||||
Please let me know if you find any.
|
||||
.SH AUTHORS
|
||||
Thomas A. Fine, Ohio State Computer Science
|
||||
.br
|
||||
Kevin Braunsdorf, Purdue University Computing Center
|
||||
.br
|
||||
Bryan Stansell, conserver.com
|
||||
.SH "SEE ALSO"
|
||||
.BR conserver.cf (5),
|
||||
.BR conserver.passwd (5),
|
||||
.BR conserver (8)
|
1033
console/console.man.in
Normal file
1033
console/console.man.in
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id: getpassword.c,v 1.7 2003-09-28 12:29:17-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
@ -12,7 +10,7 @@
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <cutil.h>
|
||||
#include <version.h>
|
||||
|
||||
|
||||
@ -31,12 +29,7 @@ static STRING *pass = (STRING *)0;
|
||||
* we really use cbreak at PUCC because we need even parity...
|
||||
*/
|
||||
static void
|
||||
#if PROTOTYPES
|
||||
C2Raw(int fd)
|
||||
#else
|
||||
C2Raw(fd)
|
||||
int fd;
|
||||
#endif
|
||||
{
|
||||
struct termios n_tios;
|
||||
|
||||
@ -64,12 +57,7 @@ C2Raw(fd)
|
||||
* put the tty back as it was, however that was
|
||||
*/
|
||||
static void
|
||||
#if PROTOTYPES
|
||||
C2Normal(int fd)
|
||||
#else
|
||||
C2Normal(fd)
|
||||
int fd;
|
||||
#endif
|
||||
{
|
||||
if (!screwy)
|
||||
return;
|
||||
@ -78,12 +66,7 @@ C2Normal(fd)
|
||||
}
|
||||
|
||||
char *
|
||||
#if PROTOTYPES
|
||||
GetPassword(char *prompt)
|
||||
#else
|
||||
GetPassword(prompt)
|
||||
char *prompt;
|
||||
#endif
|
||||
{
|
||||
int fd;
|
||||
int nc;
|
||||
@ -140,11 +123,7 @@ GetPassword(prompt)
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
ClearPassword(void)
|
||||
#else
|
||||
ClearPassword()
|
||||
#endif
|
||||
{
|
||||
if (pass == (STRING *)0 || pass->allocated == 0)
|
||||
return;
|
||||
|
@ -1,10 +1,8 @@
|
||||
/*
|
||||
* $Id: getpassword.h,v 1.3 2003-09-11 02:10:58-07 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
extern char *GetPassword PARAMS((char *));
|
||||
extern void *ClearPassword PARAMS((void));
|
||||
extern char *GetPassword(char *);
|
||||
extern void *ClearPassword(void);
|
||||
|
726
console/readconf.c
Normal file
726
console/readconf.c
Normal file
@ -0,0 +1,726 @@
|
||||
/*
|
||||
* 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
|
||||
DestroyConfig(CONFIG *c)
|
||||
{
|
||||
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);
|
||||
if (c->sslcacertificatefile != (char *)0)
|
||||
free(c->sslcacertificatefile);
|
||||
if (c->sslcacertificatepath != (char *)0)
|
||||
free(c->sslcacertificatepath);
|
||||
#endif
|
||||
free(c);
|
||||
}
|
||||
|
||||
void
|
||||
ApplyConfigDefault(CONFIG *c)
|
||||
{
|
||||
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 (parserConfigDefault->replay != FLAGUNKNOWN)
|
||||
c->replay = parserConfigDefault->replay;
|
||||
if (parserConfigDefault->playback != FLAGUNKNOWN)
|
||||
c->playback = parserConfigDefault->playback;
|
||||
#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->sslcacertificatefile != (char *)0) {
|
||||
if (c->sslcacertificatefile != (char *)0)
|
||||
free(c->sslcacertificatefile);
|
||||
if ((c->sslcacertificatefile =
|
||||
StrDup(parserConfigDefault->sslcacertificatefile)) ==
|
||||
(char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->sslcacertificatepath != (char *)0) {
|
||||
if (c->sslcacertificatepath != (char *)0)
|
||||
free(c->sslcacertificatepath);
|
||||
if ((c->sslcacertificatepath =
|
||||
StrDup(parserConfigDefault->sslcacertificatepath)) ==
|
||||
(char *)0)
|
||||
OutOfMem();
|
||||
}
|
||||
if (parserConfigDefault->sslrequired != FLAGUNKNOWN)
|
||||
c->sslrequired = parserConfigDefault->sslrequired;
|
||||
if (parserConfigDefault->sslenabled != FLAGUNKNOWN)
|
||||
c->sslenabled = parserConfigDefault->sslenabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ConfigBegin(char *id)
|
||||
{
|
||||
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
|
||||
ConfigEnd(void)
|
||||
{
|
||||
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
|
||||
ConfigAbort(void)
|
||||
{
|
||||
CONDDEBUG((1, "ConfigAbort() [%s:%d]", file, line));
|
||||
if (parserConfigTemp == (CONFIG *)0)
|
||||
return;
|
||||
|
||||
DestroyConfig(parserConfigTemp);
|
||||
parserConfigTemp = (CONFIG *)0;
|
||||
}
|
||||
|
||||
void
|
||||
ConfigDestroy(void)
|
||||
{
|
||||
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
|
||||
DestroyTerminal(TERM *t)
|
||||
{
|
||||
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
|
||||
ApplyTermDefault(TERM *t)
|
||||
{
|
||||
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
|
||||
TerminalBegin(char *id)
|
||||
{
|
||||
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
|
||||
TerminalEnd(void)
|
||||
{
|
||||
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
|
||||
TerminalAbort(void)
|
||||
{
|
||||
CONDDEBUG((1, "TerminalAbort() [%s:%d]", file, line));
|
||||
if (parserTermTemp == (TERM *)0)
|
||||
return;
|
||||
|
||||
DestroyTerminal(parserTermTemp);
|
||||
parserTermTemp = (TERM *)0;
|
||||
}
|
||||
|
||||
void
|
||||
TerminalDestroy(void)
|
||||
{
|
||||
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
|
||||
ProcessYesNo(char *id, FLAG *flag)
|
||||
{
|
||||
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
|
||||
ConfigItemEscape(char *id)
|
||||
{
|
||||
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
|
||||
ConfigItemMaster(char *id)
|
||||
{
|
||||
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
|
||||
ConfigItemPlayback(char *id)
|
||||
{
|
||||
int i;
|
||||
|
||||
CONDDEBUG((1, "ConfigItemPlayback(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->playback = 0;
|
||||
return;
|
||||
}
|
||||
for (i = 0; id[i] != '\000'; i++) {
|
||||
if (!isdigit((int)id[i])) {
|
||||
Error("invalid playback value [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i > 4) {
|
||||
Error("playback value too large [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
parserConfigTemp->playback = (unsigned short)atoi(id) + 1;
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemPort(char *id)
|
||||
{
|
||||
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
|
||||
ConfigItemReplay(char *id)
|
||||
{
|
||||
int i;
|
||||
|
||||
CONDDEBUG((1, "ConfigItemReplay(%s) [%s:%d]", id, file, line));
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->replay = 0;
|
||||
return;
|
||||
}
|
||||
for (i = 0; id[i] != '\000'; i++) {
|
||||
if (!isdigit((int)id[i])) {
|
||||
Error("invalid replay value [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i > 4) {
|
||||
Error("replay value too large [%s:%d]", file, line);
|
||||
return;
|
||||
}
|
||||
parserConfigTemp->replay = (unsigned short)atoi(id) + 1;
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemSslcredentials(char *id)
|
||||
{
|
||||
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
|
||||
ConfigItemSslcacertificatefile(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslcacertificatefile(%s) [%s:%d]", id, file,
|
||||
line));
|
||||
#if HAVE_OPENSSL
|
||||
if (parserConfigTemp->sslcacertificatefile != (char *)0)
|
||||
free(parserConfigTemp->sslcacertificatefile);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->sslcacertificatefile = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->sslcacertificatefile = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
#else
|
||||
Error
|
||||
("sslcacertificatefile ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemSslcacertificatepath(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslcacertificatepath(%s) [%s:%d]", id, file,
|
||||
line));
|
||||
#if HAVE_OPENSSL
|
||||
if (parserConfigTemp->sslcacertificatepath != (char *)0)
|
||||
free(parserConfigTemp->sslcacertificatepath);
|
||||
|
||||
if ((id == (char *)0) || (*id == '\000')) {
|
||||
parserConfigTemp->sslcacertificatepath = (char *)0;
|
||||
return;
|
||||
}
|
||||
if ((parserConfigTemp->sslcacertificatepath = StrDup(id)) == (char *)0)
|
||||
OutOfMem();
|
||||
#else
|
||||
Error
|
||||
("sslcacertificatepath ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemSslrequired(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemSslrequired(%s) [%s:%d]", id, file, line));
|
||||
#if HAVE_OPENSSL
|
||||
ProcessYesNo(id, &(parserConfigTemp->sslrequired));
|
||||
#else
|
||||
Error
|
||||
("sslrequired ignored - encryption not compiled into code [%s:%d]",
|
||||
file, line);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemSslenabled(char *id)
|
||||
{
|
||||
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
|
||||
ConfigItemStriphigh(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "ConfigItemStriphigh(%s) [%s:%d]", id, file, line));
|
||||
ProcessYesNo(id, &(parserConfigTemp->striphigh));
|
||||
}
|
||||
|
||||
void
|
||||
ConfigItemUsername(char *id)
|
||||
{
|
||||
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;
|
||||
|
||||
SUBSTTOKEN
|
||||
SubstToken(char c)
|
||||
{
|
||||
switch (c) {
|
||||
case 'u':
|
||||
case 'c':
|
||||
return ISSTRING;
|
||||
default:
|
||||
return ISNOTHING;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SubstValue(char c, char **s, int *i)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
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
|
||||
InitSubstCallback(void)
|
||||
{
|
||||
if (substData == (SUBST *)0) {
|
||||
if ((substData = (SUBST *)calloc(1, sizeof(SUBST))) == (SUBST *)0)
|
||||
OutOfMem();
|
||||
substData->value = &SubstValue;
|
||||
substData->token = &SubstToken;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TerminalItemAttach(char *id)
|
||||
{
|
||||
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
|
||||
TerminalItemAttachsubst(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemAttachsubst(%s) [%s:%d]", id, file, line));
|
||||
ProcessSubst(substData, (char **)0, &(parserTermTemp->attachsubst),
|
||||
"attachsubst", id);
|
||||
}
|
||||
|
||||
void
|
||||
TerminalItemDetach(char *id)
|
||||
{
|
||||
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
|
||||
TerminalItemDetachsubst(char *id)
|
||||
{
|
||||
CONDDEBUG((1, "TerminalItemDetachsubst(%s) [%s:%d]", id, file, line));
|
||||
ProcessSubst(substData, (char **)0, &(parserTermTemp->detachsubst),
|
||||
"detachsubst", id);
|
||||
}
|
||||
|
||||
ITEM keyConfig[] = {
|
||||
{"escape", ConfigItemEscape},
|
||||
{"master", ConfigItemMaster},
|
||||
{"playback", ConfigItemPlayback},
|
||||
{"port", ConfigItemPort},
|
||||
{"replay", ConfigItemReplay},
|
||||
{"sslcredentials", ConfigItemSslcredentials},
|
||||
{"sslcacertificatefile", ConfigItemSslcacertificatefile},
|
||||
{"sslcacertificatepath", ConfigItemSslcacertificatepath},
|
||||
{"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
|
||||
ReadConf(char *filename, FLAG verbose)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((FILE *)0 == (fp = fopen(filename, "r"))) {
|
||||
if (verbose == FLAGTRUE)
|
||||
Error("could not open `%s'", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize the substition bits */
|
||||
InitSubstCallback();
|
||||
|
||||
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)));
|
||||
CONDDEBUG((1, "pConfig->replay = %hu", pConfig->replay));
|
||||
CONDDEBUG((1, "pConfig->playback = %hu", pConfig->playback));
|
||||
#if HAVE_OPENSSL
|
||||
CONDDEBUG((1, "pConfig->sslcredentials = %s",
|
||||
EMPTYSTR(pConfig->sslcredentials)));
|
||||
CONDDEBUG((1, "pConfig->sslcacertificatefile = %s",
|
||||
EMPTYSTR(pConfig->sslcacertificatefile)));
|
||||
CONDDEBUG((1, "pConfig->sslcacertificatepath = %s",
|
||||
EMPTYSTR(pConfig->sslcacertificatepath)));
|
||||
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);
|
||||
}
|
40
console/readconf.h
Normal file
40
console/readconf.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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;
|
||||
unsigned short replay;
|
||||
unsigned short playback;
|
||||
#if HAVE_OPENSSL
|
||||
char *sslcredentials;
|
||||
char *sslcacertificatefile;
|
||||
char *sslcacertificatepath;
|
||||
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(char *, FLAG);
|
||||
extern void DestroyConfig(CONFIG *);
|
||||
extern void DestroyTerminal(TERM *);
|
@ -22,7 +22,3 @@ I can't verify that these scripts will work for everyone. Hopefully they
|
||||
will be helpful.
|
||||
|
||||
Bryan Stansell
|
||||
|
||||
#
|
||||
# $Id: README,v 1.4 2003-09-29 07:29:37-07 bryan Exp $
|
||||
#
|
||||
|
@ -1,4 +1,5 @@
|
||||
### Path settings
|
||||
datarootdir = @datarootdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
prefix = @prefix@
|
||||
|
@ -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>
|
||||
|
@ -6,12 +6,13 @@
|
||||
# outside of my own purposes. If this helps, cool. In the end I put the
|
||||
# rootcert.pem file in my global certs directory (OPENSSL_ROOT/ssl/certs),
|
||||
# point the server to server.pem and point the client at client.pem. I
|
||||
# then run the c_rehash command (I supposed it helps or is important).
|
||||
# When it asks for a passphrase, use 'pass', otherwise this script won't
|
||||
# work. Ugly, yeah, but it's an ok test.
|
||||
# then run the c_rehash command.
|
||||
#
|
||||
# You can also use the sslcacertificatefile options to point the client/server
|
||||
# at rootcert.pem instead of populating the global repository
|
||||
#
|
||||
|
||||
[ -f rootreq.pem -a -f rootkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem -passin pass:pass -passout pass:pass
|
||||
[ -f rootreq.pem -a -f rootkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem -nodes
|
||||
US
|
||||
California
|
||||
Folsom
|
||||
@ -25,7 +26,7 @@ EOD
|
||||
[ -f rootcert.pem ] || openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem
|
||||
[ -f root.pem ] || cat rootcert.pem rootkey.pem > root.pem
|
||||
|
||||
[ -f serverreq.pem -a -f serverkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout serverkey.pem -out serverreq.pem -passin pass:pass -passout pass:pass
|
||||
[ -f serverreq.pem -a -f serverkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout serverkey.pem -out serverreq.pem -nodes
|
||||
US
|
||||
California
|
||||
Folsom
|
||||
@ -39,7 +40,7 @@ EOD
|
||||
[ -f servercert.pem ] || openssl x509 -req -in serverreq.pem -sha1 -extensions usr_cert -CA root.pem -CAkey root.pem -CAcreateserial -out servercert.pem
|
||||
[ -f server.pem ] || cat servercert.pem serverkey.pem rootcert.pem > server.pem
|
||||
|
||||
[ -f clientreq.pem -a -f clientkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout clientkey.pem -out clientreq.pem -passin pass:pass -passout pass:pass
|
||||
[ -f clientreq.pem -a -f clientkey.pem ] || cat <<EOD | openssl req -newkey rsa:1024 -sha1 -keyout clientkey.pem -out clientreq.pem -nodes
|
||||
US
|
||||
California
|
||||
Folsom
|
||||
|
5
contrib/redhat-rpm/conserver.defaults
Normal file
5
contrib/redhat-rpm/conserver.defaults
Normal file
@ -0,0 +1,5 @@
|
||||
# server options
|
||||
#OPTIONS="-p 33000 -d"
|
||||
# run as different user that root
|
||||
#RUNAS=conservr
|
||||
|
@ -7,44 +7,66 @@
|
||||
# config: /etc/conserver.cf
|
||||
#
|
||||
|
||||
DAEMON=/usr/sbin/conserver
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# Source defaults
|
||||
. /etc/default/conserver
|
||||
|
||||
# Check that networking is up.
|
||||
[ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
# make sure conserver is installed and executable
|
||||
[ -x /usr/sbin/conserver ] || exit 1
|
||||
[ -x $DAEMON ] || exit 1
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
echo -n "Starting conserver: "
|
||||
daemon --user "${RUNAS-}" $DAEMON ${OPTIONS--d}
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/conserver
|
||||
echo
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
echo -n "Shutting down conserver: "
|
||||
killproc conserver
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/conserver
|
||||
echo
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting conserver: "
|
||||
daemon conserver -d
|
||||
echo
|
||||
touch /var/lock/subsys/conserver
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down conserver: "
|
||||
killproc conserver
|
||||
echo
|
||||
rm -f /var/lock/subsys/conserver
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status conserver
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting conserver: "
|
||||
stop
|
||||
start
|
||||
;;
|
||||
reload)
|
||||
echo -n "Reloading conserver: "
|
||||
killproc conserver -HUP
|
||||
RETVAL=$?
|
||||
echo
|
||||
;;
|
||||
*)
|
||||
echo "Usage: conserver {start|stop|restart|status}"
|
||||
exit 1
|
||||
echo "Usage: conserver {start|stop|restart|reload|status}"
|
||||
RETVAL=1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
exit $RETVAL
|
||||
|
@ -3,8 +3,8 @@
|
||||
# platform that doesn't have red hat rpm >= 4.0.2 installed.
|
||||
#
|
||||
|
||||
%define pkg conserver
|
||||
%define ver conserver-8.0.5
|
||||
%define pkg conserver
|
||||
%define ver
|
||||
|
||||
# define the name of the machine on which the main conserver
|
||||
# daemon will be running if you don't want to use the default
|
||||
@ -12,26 +12,71 @@
|
||||
%define master console
|
||||
|
||||
# what red hat (or other distibution) version are you running?
|
||||
%define distver 6
|
||||
%define distver 1
|
||||
|
||||
# compile arguments. defaults to 0
|
||||
# example: rpmbuild -bb conserver.spec --with openssl
|
||||
%define with_openssl %{?_with_openssl: 1} %{?!_with_openssl: 0}
|
||||
%define with_libwrap %{?_with_libwrap: 1} %{?!_with_libwrap: 0}
|
||||
%define with_pam %{?_with_pam: 1} %{?!_with_pam: 0}
|
||||
%define with_dmalloc %{?_with_dmalloc: 1} %{?!_with_dmalloc: 0}
|
||||
%define with_freeipmi %{?_with_freeipmi: 1} %{?!_with_freeipmi: 0}
|
||||
|
||||
# additionally you can use macros logfile pidfile
|
||||
# example: rpmbuild -bb conserver.spec --define "pidfile /var/run/conserver/pid"
|
||||
|
||||
Summary: Serial console server daemon/client
|
||||
Name: %{pkg}
|
||||
Version: %{ver}
|
||||
Release: 1.%{distver}x
|
||||
Copyright: distributable
|
||||
Release: %{distver}
|
||||
License: BSD
|
||||
Summary: Serial console server daemon/client
|
||||
Group: System Environment/Daemons
|
||||
URL: http://www.conserver.com/
|
||||
Source: http://www.conserver.com/%{pkg}-%{ver}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{pkg}-buildroot
|
||||
%if %{with_openssl}
|
||||
Requires: openssl
|
||||
BuildRequires: openssl-devel
|
||||
%endif
|
||||
%if %{with_pam}
|
||||
BuildRequires: pam-devel
|
||||
%endif
|
||||
%if %{with_libwrap}
|
||||
Requires: tcp_wrappers
|
||||
%endif
|
||||
%if %{with_dmalloc}
|
||||
Requires: dmalloc
|
||||
BuildRequires: dmalloc
|
||||
%endif
|
||||
%if %{with_freeipmi}
|
||||
Requires: freeipmi
|
||||
BuildRequires: freeipmi-devel
|
||||
%endif
|
||||
Prefix: %{_prefix}
|
||||
|
||||
%package server
|
||||
Summary: Serial console server daemon
|
||||
Group: System Environment/Daemons
|
||||
|
||||
%package client
|
||||
Summary: Serial console server client
|
||||
Group: Applications/Internet
|
||||
|
||||
%description
|
||||
Conserver is an application that allows multiple users to watch a
|
||||
Conserver is a daemon that allows multiple users to watch a
|
||||
serial console at the same time. It can log the data, allows users to
|
||||
take write-access of a console (one at a time), and has a variety of
|
||||
bells and whistles to accentuate that basic functionality.
|
||||
|
||||
%description server
|
||||
conserver-server is a daemon that allows multiple users to watch a
|
||||
serial console at the same time. It can log the data, allows users to
|
||||
take write-access of a console (one at a time), and has a variety of
|
||||
bells and whistles to accentuate that basic functionality.
|
||||
|
||||
%description client
|
||||
conserver-client to connect to conserver-server using a tcp port.
|
||||
Allows multiple users to watch a serial console at the same time.
|
||||
|
||||
%prep
|
||||
%{__rm} -rf %{buildroot}
|
||||
@ -44,7 +89,8 @@ f="conserver/Makefile.in"
|
||||
%{__mv} $f $f.orig
|
||||
%{__sed} -e 's/^.*conserver\.rc.*$//' < $f.orig > $f
|
||||
|
||||
%configure --with-master=%{master}
|
||||
%configure %{?_with_openssl} %{?_with_libwrap} %{?_with_dmalloc} %{?_with_freeipmi} %{?_with_pam} %{?logfile: --with-logfile=%{logfile}} %{?pidfile: --with-pidfile=%{pidfile}} %{?master: --with-master=%{master}}
|
||||
|
||||
make
|
||||
|
||||
|
||||
@ -65,12 +111,15 @@ make
|
||||
%{__mkdir_p} %{buildroot}/%{_initrddir}
|
||||
%{__cp} contrib/redhat-rpm/conserver.init %{buildroot}/%{_initrddir}/conserver
|
||||
|
||||
# install copy of init script defaults
|
||||
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/default
|
||||
%{__cp} contrib/redhat-rpm/conserver.defaults %{buildroot}/%{_sysconfdir}/default/conserver
|
||||
|
||||
%clean
|
||||
%{__rm} -rf %{buildroot}
|
||||
|
||||
|
||||
%post
|
||||
%post server
|
||||
if [ -x %{_initrddir}/conserver ]; then
|
||||
/sbin/chkconfig --add conserver
|
||||
fi
|
||||
@ -80,7 +129,7 @@ if ! egrep '\<conserver\>' /etc/services > /dev/null 2>&1 ; then
|
||||
fi
|
||||
|
||||
|
||||
%preun
|
||||
%preun server
|
||||
if [ "$1" = 0 ]; then
|
||||
if [ -x %{_initrddir}/conserver ]; then
|
||||
%{_initrddir}/conserver stop
|
||||
@ -88,16 +137,37 @@ if [ "$1" = 0 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# we need this even if empty
|
||||
#%files
|
||||
|
||||
%files
|
||||
%files server
|
||||
%defattr(-,root,root)
|
||||
%doc CHANGES FAQ INSTALL README conserver.cf
|
||||
%config(noreplace) %{_sysconfdir}/conserver.cf
|
||||
%config(noreplace) %{_sysconfdir}/conserver.passwd
|
||||
%config(noreplace) %{_sysconfdir}/default/conserver
|
||||
%attr(555,root,root) %{_initrddir}/conserver
|
||||
%{prefix}/bin/console
|
||||
%{prefix}/share/man/man1/console.1.gz
|
||||
%{prefix}/share/man/man8/conserver.8.gz
|
||||
%{prefix}/share/man/man5/conserver.cf.5.gz
|
||||
%{prefix}/share/man/man5/conserver.passwd.5.gz
|
||||
%{prefix}/sbin/conserver
|
||||
%{_libdir}/conserver/convert
|
||||
%{_mandir}/man8/conserver.8.gz
|
||||
%{_mandir}/man5/conserver.cf.5.gz
|
||||
%{_mandir}/man5/conserver.passwd.5.gz
|
||||
%{_datadir}/examples/conserver/conserver.cf
|
||||
%{_datadir}/examples/conserver/conserver.passwd
|
||||
%{_sbindir}/conserver
|
||||
|
||||
%files client
|
||||
%defattr(-,root,root)
|
||||
%doc CHANGES FAQ INSTALL README
|
||||
%{_bindir}/console
|
||||
%{_mandir}/man1/console.1.gz
|
||||
|
||||
%changelog
|
||||
* Wed Oct 14 2009 Jodok Ole Muellers <muellejo@aschendorff.de>
|
||||
- Changed the conserver.spec file to create separate subpackages
|
||||
for client and server by using the %package directive.
|
||||
* Wed Sep 25 2009 Fabien Wernli
|
||||
- added configure prerequisites
|
||||
* Thu Sep 24 2009 Fabien Wernli
|
||||
- added prefix to configure
|
||||
- changed some hardcoded values to proper macros:
|
||||
didn't work on x64 lib -> lib64
|
||||
|
@ -1,7 +1,7 @@
|
||||
PKG="conserver"
|
||||
NAME="Console server and client"
|
||||
CATEGORY="system"
|
||||
VERSION="conserver-8.0.5"
|
||||
VERSION=
|
||||
DESC="Console server and client"
|
||||
CLASSES=none
|
||||
ARCH=sparc
|
||||
|
22
gen-version
Executable file
22
gen-version
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# awk gets stdin from /dev/null 'cause when autoconf runs this via m4_esyscmd_s,
|
||||
# stdin is closed and awk assumes there will always be an open stdin and you end
|
||||
# up with a bogus message:
|
||||
#
|
||||
# awk: i/o error occurred while closing /dev/stdin
|
||||
# input record number 20, file conserver/version.h
|
||||
# source line number 1
|
||||
#
|
||||
#
|
||||
case "$1" in
|
||||
number)
|
||||
awk '$2=="VERSION_MAJOR"{maj=$NF} $2=="VERSION_MINOR"{min=$NF} $2=="VERSION_REV"{rev=$NF} END{print maj "." min "." rev}' conserver/version.h < /dev/null
|
||||
;;
|
||||
|
||||
date)
|
||||
awk '$2=="VERSION_DATE"{print $NF}' conserver/version.h < /dev/null | tr -d '"'
|
||||
;;
|
||||
esac
|
26
package/README.md
Normal file
26
package/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
Testing Locally
|
||||
---------------
|
||||
|
||||
You can run `./package/make-and-stage-release local` and the current code will be
|
||||
packaged into `./build` so anyone can configure and build code in a confined space.
|
||||
|
||||
Creating a new release
|
||||
----------------------
|
||||
|
||||
- Create a new release branch `git checkout -b release-vx.y.z`
|
||||
- Edit `conserver/version.h`
|
||||
- Update `CHANGES` with output of `./package/create-changes vx.y.z..`
|
||||
- Double-check and merge release branch
|
||||
- Run `GITHUB_TOKEN=xxxx ./package/make-and-stage-release` to tag release, create distribution, pgp sign, and push to github
|
||||
|
||||
Requirements:
|
||||
|
||||
- autoconf
|
||||
- githubrelease (pypi)
|
||||
- gpg
|
||||
|
||||
Publishing a release
|
||||
--------------------
|
||||
|
||||
- Use github to promote from draft or use the command output from `make-and-stage-release`
|
||||
- Send announcement on mailing lists
|
1645
package/config.guess
vendored
Normal file
1645
package/config.guess
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1795
package/config.sub
vendored
Normal file
1795
package/config.sub
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
package/create-changes
Executable file
10
package/create-changes
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
[ -z "$1" ] && echo "Usage: $0 tag" && exit 1
|
||||
range="$1"
|
||||
date=`./gen-version date`
|
||||
changedate=`date -j -f '%Y/%m/%d' "$date" '+%B %-d, %Y'`
|
||||
echo "version `./gen-version number` ($changedate):"
|
||||
git log --no-merges --pretty=tformat:' - %s (%an <%ae>)' "$range" | tail -r | awk '{if (! l[$0]) {l[$0]++; print}}' | sed -e 's/ *(Bryan Stansell <bryan@conserver.com>)$//'
|
65
package/make-and-stage-release
Executable file
65
package/make-and-stage-release
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
case $(sed --help 2>&1) in
|
||||
*GNU*) sed_i () { sed -i "$@"; };;
|
||||
*) sed_i () { sed -i '' "$@"; };;
|
||||
esac
|
||||
|
||||
local=false && [ "$1" = "local" ] && local=true
|
||||
|
||||
[ -f conserver/version.h ] || { echo "you are in the wrong place" ; exit 1; }
|
||||
|
||||
ver=`./gen-version number`
|
||||
|
||||
if ! $local; then
|
||||
echo "Ready to tag release v$ver (y/N)?"
|
||||
read i
|
||||
if [ "$i" = "y" ]; then
|
||||
echo "Adding git tag v$ver"
|
||||
git tag -a -m "Release $ver" v$ver
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ../conserver-$ver.tar.gz ] || $local; then
|
||||
(
|
||||
[ -d build ] && rm -rf build
|
||||
mkdir build
|
||||
archtag=v$ver
|
||||
$local && archtag=HEAD
|
||||
git archive --format=tar.gz --prefix=conserver-$ver/ $archtag | (cd build; tar zxf -)
|
||||
cd build/conserver-$ver
|
||||
../../package/setup-configure
|
||||
rm -rf package
|
||||
sed_i -e "/^%define ver/s| ver.*| ver $ver|" contrib/redhat-rpm/conserver.spec
|
||||
sed_i -e "/^VERSION=/s|.*|VERSION=\"$ver\"|" contrib/solaris-package/pkginfo
|
||||
)
|
||||
$local && exit
|
||||
echo "Creating ../conserver-$ver.tar.gz"
|
||||
tar zcf ../conserver-$ver.tar.gz -C build conserver-$ver
|
||||
rm -rf build
|
||||
|
||||
[ -f ../conserver-$ver.tar.gz.asc ] && rm ../conserver-$ver.tar.gz.asc
|
||||
fi
|
||||
if [ ! -f ../conserver-$ver.tar.gz.asc ]; then
|
||||
echo "Signing ../conserver-$ver.tar.gz"
|
||||
gpg -ab --local-user bryan@conserver.com ../conserver-$ver.tar.gz
|
||||
fi
|
||||
body="\`\`\`
|
||||
`sed -ne '/^ver/,/^$/p' CHANGES | sed -e '/^$/,$d'`
|
||||
\`\`\`"
|
||||
|
||||
ls -l ../conserver-$ver.tar.gz*
|
||||
echo "Ready to push (y/N)?"
|
||||
read i
|
||||
if [ "$i" = "y" ]; then
|
||||
git push --tags
|
||||
githubrelease release conserver/conserver create --name conserver-$ver --body "$body" v$ver ../conserver-$ver.tar.gz*
|
||||
echo You can publish this release on the website or with:
|
||||
echo " "githubrelease release conserver/conserver publish v$ver
|
||||
else
|
||||
echo Ok, here is the command I would have used:
|
||||
echo " "git push --tags
|
||||
echo " "githubrelease release conserver/conserver create --name conserver-$ver --body \""$body"\" v$ver ../conserver-$ver.tar.gz*
|
||||
fi
|
15
package/run-gindent
Executable file
15
package/run-gindent
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
gindent -npro -i4 -ip4 -cli4 -br -brs -cdw -ce -npcs -ncs -nhnl -l75 -lc75 -nbbo -ppi1 `
|
||||
echo -T SOCKADDR_STYPE
|
||||
echo -T INADDR_STYPE
|
||||
echo -T time_t
|
||||
echo -T X509_STORE_CTX
|
||||
echo -T FILE
|
||||
echo -T SSL
|
||||
echo -T fd_set
|
||||
echo -T pam_handle_t
|
||||
echo -T SSL_CTX
|
||||
echo -T DH
|
||||
sed -ne '/typedef/,/}/p' */*.[ch] | grep '^[ ]*}' | sed -e 's/[ ]*}/-T/' -e 's/;//' | sort -u
|
||||
` */*.[ch]
|
21
package/setup-configure
Executable file
21
package/setup-configure
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
curl -s -o config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess'
|
||||
curl -s -o config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub'
|
||||
|
||||
grep ^timestamp config.guess >/dev/null 2>&1 || cp package/config.guess .
|
||||
grep ^timestamp config.sub >/dev/null 2>&1 || cp package/config.sub .
|
||||
|
||||
# We set lang to avoid this with the gcc docker image on cirrus:
|
||||
#
|
||||
# ./package/setup-configure
|
||||
# perl: warning: Setting locale failed.
|
||||
# perl: warning: Please check that your locale settings:
|
||||
# LANGUAGE = (unset),
|
||||
# LC_ALL = (unset),
|
||||
# LANG = "en_US.UTF-8"
|
||||
# are supported and installed on your system.
|
||||
|
||||
LANG=C autoreconf
|
21
test/dotest
21
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,15 +26,15 @@ 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"
|
||||
mv test.out results/test$testnum
|
||||
else
|
||||
if [ -f results/test$testnum ]; then
|
||||
if diff -i test.out results/test$testnum >test$testnum.diff 2>&1; then
|
||||
echo "succeded"
|
||||
if diff -i results/test$testnum >test$testnum.diff test.out 2>&1; then
|
||||
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,16 @@ 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 'cocacoc.'
|
||||
|
||||
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 /'"
|
||||
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x sh | sed -e '1s/^[^:]*//'"
|
||||
dotest EVAL "../console/console -n -C /dev/null -M 127.0.0.1 -p 7777 -x shell | sed -e 's/ on [^ ]* */ on /'"
|
||||
|
||||
cleanup
|
||||
|
@ -1,4 +1,6 @@
|
||||
console: shell is down
|
||||
[`shell' -- console is down]
|
||||
[Enter `^Ec?' for help]
|
||||
[up -- attached]
|
||||
[up]
|
||||
[ok]
|
||||
[up]
|
||||
[disconnect]
|
||||
|
@ -1 +1 @@
|
||||
127.0.0.1
|
||||
version `conserver.com version
|
||||
|
2
test/results/test14
Normal file
2
test/results/test14
Normal file
@ -0,0 +1,2 @@
|
||||
: ambiguous console abbreviation, `sh'
|
||||
choices are shellb, shella, shell
|
1
test/results/test15
Normal file
1
test/results/test15
Normal file
@ -0,0 +1 @@
|
||||
shell on at Local
|
@ -1,17 +1,20 @@
|
||||
[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
|
||||
\ooo send character by octal code
|
||||
. 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-9a-z send specific break sequence
|
||||
m display message of the day n write a note to the logfile
|
||||
o (re)open the tty and log file p playback the last 60 lines
|
||||
P set number of playback lines r replay the last 20 lines
|
||||
R set number of replay lines s spy mode (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 ! invoke task
|
||||
| attach local command ? print this message
|
||||
<cr> ignore/abort command ^R replay the last line
|
||||
\ooo send character by octal code
|
||||
[disconnect]
|
||||
|
@ -1,4 +1,4 @@
|
||||
console: shell is down
|
||||
[`shell' -- console is down]
|
||||
[Enter `^Ec?' for help]
|
||||
[up -- attached]
|
||||
[up]
|
||||
[disconnect]
|
||||
|
@ -1,17 +1,20 @@
|
||||
[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
|
||||
\ooo send character by octal code
|
||||
. 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-9a-z send specific break sequence
|
||||
m display message of the day n write a note to the logfile
|
||||
o (re)open the tty and log file p playback the last 60 lines
|
||||
P set number of playback lines r replay the last 20 lines
|
||||
R set number of replay lines s spy mode (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 ! invoke task
|
||||
| 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