Imported from conserver-8.1.4.tar.gz

This commit is contained in:
Bryan Stansell 2004-04-13 13:30:28 -07:00
parent 29b909ee59
commit 8cd506c093
24 changed files with 614 additions and 138 deletions

12
CHANGES
View File

@ -1,6 +1,16 @@
CHANGES
=======
version 8.1.4 (Apr 13, 2004):
- fixed macro use in manpages to hopefully be more compatible
- removed extra newline of --MARK-- range output
- fixed bug where server -b option wasn't working - reported by
Nathan R. Hruby <nhruby@uga.edu>
- fixed client segfault when using -R, -t, -d, and -b options
- added a --with-uds configure option to have all client/server
communication happen via unix domain sockets - suggested by
William P LePera <lepera@us.ibm.com>
version 8.1.3 (Mar 22, 2004):
- fixed small memory and file descriptor leak in client when
using '^Ec;'
@ -698,5 +708,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.162 2004/03/23 00:55:04 bryan Exp $
# $Id: CHANGES,v 1.167 2004/04/13 19:40:07 bryan Exp $
#

14
INSTALL
View File

@ -165,6 +165,9 @@ Detailed Instructions
--with-maxmemb=MAXMEMB Specify maximum consoles per process [16]
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
--with-trustrevdns Trust reverse DNS information
--with-extmsgs Produce extended messages
--with-uds[=DIR] Use Unix domain sockets for client/server
communication [/tmp/conserver]
--with-libwrap[=PATH] Compile in libwrap (tcp_wrappers) support
--with-openssl[=PATH] Compile in OpenSSL support
--with-dmalloc[=PATH] Compile in dmalloc support
@ -182,10 +185,11 @@ Detailed Instructions
A couple of notes. First, --with-libwrap will add tcp_wrappers
lookups to all socket connections in the server. --with-openssl
will add encryption between the client and server when you connect
to a console. things such as 'console -q', 'console -w', etc. are
still unencrypted, as well as connections from conserver to any
terminal servers. --with-dmalloc should only be used to do memory
allocation debugging and not used in production.
to a console. --with-uds will cause the client and server to use
unix domain sockets for their communication, eliminating the
tcp communication they normally do (which means --with-master and
--with-port are not used). --with-dmalloc should only be used to
do memory allocation debugging and not used in production.
- Run './configure'. This will detect system specific
information. The --prefix option will redirect where things are
@ -274,5 +278,5 @@ Other Information And Gotchas
#
# $Id: INSTALL,v 1.37 2004/03/23 00:55:04 bryan Exp $
# $Id: INSTALL,v 1.38 2004/04/13 18:11:58 bryan Exp $
#

View File

@ -1,4 +1,4 @@
.\" $Id: autologin.man,v 1.1 2003/11/04 02:36:24 bryan Exp $
.\" $Id: autologin.man,v 1.2 2004/03/23 18:32:06 bryan Exp $
.TH AUTOLOGIN 8L PUCC
.SH NAME
autologin \- create an automatic login session from /etc/inittab
@ -112,12 +112,21 @@ environment variable set to
ss10:2:respawn:/usr/local/etc/autologin \-e TERM=reg20 \-t/dev/tty10 \-lssinfo
.ad
.PP
Adding the following line to \fI/etc/ttytab\fP on a Sun 4.1.\fIx\fP
Adding the following line to
.I /etc/ttytab
on a Sun
.RI 4.1. x
machine establishes a root login on the console device:
.br
.na
console "/usr/local/etc/autologin \-lroot \-t" xterm on local secure
.ad
Note that \fIinit\fP provides the \fItty\fP argument on the end of the command.
.PP
Note that
.I init
provides the
.I tty
argument on the end of the command.
.SH FILES
/bin/su
.br

View File

@ -8,6 +8,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
#if USE_UNIX_DOMAIN_SOCKETS
#include <sys/un.h>
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>

View File

@ -324,12 +324,18 @@
/* Defined if we trust reverse DNS */
#undef TRUST_REVERSE_DNS
/* Directory for Unix domain sockets */
#undef UDSDIR
/* Defined if we produce extended messages */
#undef USE_EXTENDED_MESSAGES
/* use tcp_wrappers libwrap */
#undef USE_LIBWRAP
/* Defined if we use Unix domain sockets */
#undef USE_UNIX_DOMAIN_SOCKETS
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */

51
configure vendored
View File

@ -857,6 +857,9 @@ Optional Packages:
--with-timeout=TIMEOUT Specify connect() timeout in seconds [10]
--with-trustrevdns Trust reverse DNS information
--with-extmsgs Produce extended messages
--with-uds[=DIR]
Use Unix domain sockets for client/server
communication [/tmp/conserver]
--with-libwrap[=PATH]
Compile in libwrap (tcp_wrappers) support
--with-openssl[=PATH]
@ -1312,6 +1315,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
@ -1692,6 +1696,53 @@ else
echo "${ECHO_T}no" >&6
fi;
echo "$as_me:$LINENO: checking whether to use Unix domain sockets" >&5
echo $ECHO_N "checking whether to use Unix domain sockets... $ECHO_C" >&6
# Check whether --with-uds or --without-uds was given.
if test "${with_uds+set}" = set; then
withval="$with_uds"
case "$withval" in
yes)
cat >>confdefs.h <<_ACEOF
#define UDSDIR "/tmp/conserver"
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define USE_UNIX_DOMAIN_SOCKETS 1
_ACEOF
echo "$as_me:$LINENO: result: /tmp/conserver" >&5
echo "${ECHO_T}/tmp/conserver" >&6
;;
no)
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
;;
*)
cat >>confdefs.h <<_ACEOF
#define UDSDIR "$withval"
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define USE_UNIX_DOMAIN_SOCKETS 1
_ACEOF
echo "$as_me:$LINENO: result: '$withval'" >&5
echo "${ECHO_T}'$withval'" >&6
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
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi;
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'

View File

@ -17,9 +17,12 @@ AH_TEMPLATE([HAVE_DMALLOC], [have dmalloc support])
AH_TEMPLATE([HAVE_SA_LEN],[Defined if sa_len member exists in struct sockaddr])
AH_TEMPLATE([TRUST_REVERSE_DNS],[Defined if we trust reverse DNS])
AH_TEMPLATE([USE_EXTENDED_MESSAGES],[Defined if we produce extended messages])
AH_TEMPLATE([USE_UNIX_DOMAIN_SOCKETS],[Defined if we use Unix domain sockets])
AH_TEMPLATE([UDSDIR], [Directory for Unix domain sockets])
dnl ### Normal initialization. ######################################
AC_INIT
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([conserver/main.c])
AC_CONFIG_HEADER(config.h)
@ -49,7 +52,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")
@ -65,7 +68,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")
@ -81,7 +84,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")
@ -97,7 +100,7 @@ AC_ARG_WITH(master,
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"])
@ -117,7 +120,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"])
@ -137,7 +140,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")
@ -154,7 +157,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"
@ -169,7 +172,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)
@ -191,7 +194,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)
@ -205,7 +208,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)
@ -218,7 +221,7 @@ AC_ARG_WITH(trustrevdns,
AC_MSG_CHECKING(whether to display extended messages)
AC_ARG_WITH(extmsgs,
AC_HELP_STRING([--with-extmsgs],[Produce extended messages]),
AS_HELP_STRING([--with-extmsgs],[Produce extended messages]),
[case "$withval" in
yes)
AC_DEFINE(USE_EXTENDED_MESSAGES)
@ -229,6 +232,32 @@ AC_ARG_WITH(extmsgs,
;;
esac],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(whether to use Unix domain sockets)
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])
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_DEFINE_UNQUOTED(UDSDIR, "$withval")
AC_DEFINE(USE_UNIX_DOMAIN_SOCKETS)
AC_MSG_RESULT('$withval')
if expr "$withval" : '/' >/dev/null 2>&1; then
:
else
echo "*** WARNING *** you may have better success using a fully-qualified path"
echo "*** WARNING *** instead of '$withval'"
fi
;;
esac],[AC_MSG_RESULT(no)])
dnl ### Check for compiler et al. ###################################
AC_PROG_CC
AC_PROG_INSTALL
@ -315,7 +344,7 @@ AC_SUBST(CONSLIBS)
AC_SUBST(CONSCPPFLAGS)
AC_SUBST(CONSLDFLAGS)
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
@ -365,7 +394,7 @@ AC_ARG_WITH(libwrap,
)
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
@ -403,7 +432,7 @@ AC_ARG_WITH(openssl,
)
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
@ -478,7 +507,7 @@ dnl fi],[AC_MSG_RESULT(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"

View File

@ -1,5 +1,5 @@
.\" $Id: conserver.cf.man,v 1.58 2004/02/24 02:59:36 bryan Exp $
.TH CONSERVER.CF 5 "2004/02/24" "conserver-8.1.3" "conserver"
.\" $Id: conserver.cf.man,v 1.61 2004/03/26 13:03:01 bryan Exp $
.TH CONSERVER.CF 5 "2004/03/26" "conserver-8.1.4" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)
@ -123,7 +123,7 @@ fashion (top down), so order is important.
.RS
.TP 15
.B admin
.RI "[ [\fB!\fP]" username ,...
.RI "[ [\f3!\fP]" username ,...
| "" ]
.br
Define a list of users making up the admin list for the console server.
@ -264,7 +264,8 @@ all conserver hosts.
.RS
.TP 15
.B defaultaccess
.RB [ " rejected " | " trusted " | " allowed " ]
.RB [ " rejected " | " trusted "
.RB | " allowed " ]
.br
Set the default access permission for all hosts not matched by
an access list (see the
@ -272,7 +273,9 @@ an access list (see the
command-line flag).
.TP
.B daemonmode
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br
Set whether or not to become a daemon when run (see the
.B \-d
@ -300,7 +303,9 @@ Set the port used by the master conserver process (see the
command-line flag).
.TP
.B redirect
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br
Turn redirection on or off (see the
.B \-R
@ -309,7 +314,7 @@ command-line flag).
.B reinitcheck
.I number
.br
Set the number of seconds used between reinitialization checks (see the
Set the number of minutes used between reinitialization checks (see the
.B \-O
command-line flag).
.TP
@ -321,7 +326,9 @@ Set the base port number used by child processes (see the
command-line flag).
.TP
.B setproctitle
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br
Set whether or not the process title shows master/group functionality
as well as the port number the process is listening on and how many
@ -340,7 +347,9 @@ credentials file location (see the
command-line flag).
.TP
.B sslrequired
.RB [ " yes " | " true " | " on " | " no " | " false " | " off " ]
.RB [ " yes " | " true "
.RB | " on " | " no "
.RB | " false " | " off " ]
.br
Set whether or not encryption is required when talking to clients (see the
.B \-E
@ -388,8 +397,11 @@ of their definition).
.RS
.TP 15
.B baud
.RB [ " 300 " | " 600 " | " 1800 " | " 2400 " | " 4800"
.RB | " 9600 " | " 19200 " | " 38400 " | " 57600 " | " 115200 " ]
.RB [ " 300 " | " 600 "
.RB | " 1800 " | " 2400 "
.RB | " 4800 " | " 9600 "
.RB | " 19200 " | " 38400 "
.RB | " 57600 " | " 115200 " ]
.br
Assign the baud rate to the console.
Only consoles of type ``device'' will use this value.
@ -411,7 +423,7 @@ as the access to the console.
Only consoles of type ``device'' will use this value.
.TP
.B devicesubst
.RI [ c = t [ n ] f "[,...]"
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
| "" ]
.br
Perform character substitutions on the
@ -419,7 +431,7 @@ Perform character substitutions on the
value.
A series of replacements can be defined by specifying a
comma-separated list of
.IR c = t [ n ] f
\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP
sequences where
.I c
is any printable character,
@ -488,14 +500,14 @@ Assign the string
.I command
as the command to access the console.
Conserver will run the command by
invoking ``/bin/sh -ce "\fIcommand\fP"''.
invoking ``/bin/sh -ce "\f2command\fP"''.
If the null string (``""'') is used or no
.B exec
keyword is specified, conserver will use the command ``/bin/sh -i''.
Only consoles of type ``exec'' will use this value.
.TP
.B execsubst
.RI [ c = t [ n ] f "[,...]"
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
| "" ]
.br
Perform character substitutions on the
@ -543,7 +555,7 @@ use the default delay time.
The default string is ``\en''.
.TP
.B idletimeout
.BR \fInumber\fP [ s | m | h ]
\f2number\fP[\f3s\fP|\f3m\fP|\f3h\fP]
.br
Set the idle timeout of the console to
.I number
@ -577,7 +589,7 @@ If the null string (``""'') is used, the command is unset and
nothing is invoked.
.TP
.B initsubst
.RI [ c = t [ n ] f "[,...]"
[\f2c\fP=\f2t\fP[\f2n\fP]\f2f\fP[,...]
| "" ]
.br
Perform character substitutions on the
@ -602,7 +614,7 @@ If the null string (``""'') is used, the logfile name is unset and
no logging will occur.
.TP
.B logfilemax
.BR \fInumber\fP [ k | m ]
\f2number\fP[\f3k\fP|\f3m\fP]
.br
Enable automatic rotation of
.B logfile
@ -772,7 +784,9 @@ Default is
.RE
.TP
.B parity
.RB [ " even " | " mark " | " none " | " odd " | " space " ]
.RB [ " even " | " mark "
.RB | " none " | " odd "
.RB | " space " ]
.br
Set the parity option for the console.
Only consoles of type ``device'' will use this value.
@ -858,7 +872,7 @@ console option still applies when data is read by the server, and if enabled,
can impact the encapsulation process.
.TP
.B ro
.RI "[ [\fB!\fP]" username ,...
.RI "[ [\f3!\fP]" username ,...
| "" ]
.br
Define a list of users making up the read-only access list
@ -874,7 +888,7 @@ If the null string (``""'') is used, any
users previously defined for the console's read-only list are removed.
.TP
.B rw
.RI "[ [\fB!\fP]" username ,...
.RI "[ [\f3!\fP]" username ,...
| "" ]
.br
Define a list of users making up the read-write access list
@ -891,7 +905,7 @@ users previously defined for the console's read-write list are removed.
.TP
.B timestamp
[
.RB [ \fInumber\fP [ m | h | d | l ]][ a ][ b ]
[\f2number\fP[\f3m\fP|\f3h\fP|\f3d\fP|\f3l\fP]][\f3a\fP][\f3b\fP]
| "" ]
.br
Specifies the time between timestamps applied to the console
@ -922,7 +936,8 @@ A
can be specified to add logging of break sequences sent to the console.
.TP
.B type
.RB [ " device " | " exec " | " host " ]
.RB [ " device " | " exec "
.RB | " host " ]
.br
Set the type of console.
The type
@ -951,7 +966,7 @@ Define a user group identified as
.RS
.TP 15
.B users
.RI "[ [\fB!\fP]" username ,...
.RI "[ [\f3!\fP]" username ,...
| "" ]
.br
Define a list of users making up the group

View File

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

View File

@ -181,11 +181,11 @@
<H3>Downloading</H3>
<P>The current version, released on Mar 22, 2004, is <A
href="8.1.3.tar.gz">8.1.3.tar.gz</A>. You can get it via
<P>The current version, released on Apr 13, 2004, is <A
href="8.1.4.tar.gz">8.1.4.tar.gz</A>. You can get it via
<A href=
"ftp://ftp.conserver.com/conserver/8.1.3.tar.gz">FTP</A>
or <A href="8.1.3.tar.gz">HTTP</A>. See the <A href=
"ftp://ftp.conserver.com/conserver/8.1.4.tar.gz">FTP</A>
or <A href="8.1.4.tar.gz">HTTP</A>. See the <A href=
"CHANGES">CHANGES</A> file for information on the latest
updates.</P>

View File

@ -1,5 +1,5 @@
/*
* $Id: client.c,v 5.81 2004/03/20 14:40:40 bryan Exp $
* $Id: client.c,v 5.83 2004/04/13 18:12:00 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -315,8 +315,7 @@ Replay(pCE, fdOut, iBack)
if ((char *)0 != s) {
*s = '\000';
}
FileWrite(fdOut, FLAGTRUE, lines[i].line->string,
lines[i].line->used - 1);
FileWrite(fdOut, FLAGTRUE, lines[i].line->string, -1);
FileWrite(fdOut, FLAGTRUE, " .. ", 4);
/* build the end string by removing the leading "[-- MARK -- "
@ -488,10 +487,26 @@ ClientAccessOk(pCL)
#endif
{
char *peername = (char *)0;
int retval = 1;
#if USE_UNIX_DOMAIN_SOCKETS
struct in_addr addr;
# if HAVE_INET_ATON
inet_aton("127.0.0.1", &addr);
# else
addr.s_addr = inet_addr("127.0.0.1");
# endif
pCL->caccess = AccType(&addr, &peername);
if (pCL->caccess == 'r') {
FileWrite(pCL->fd, FLAGFALSE, "access from your host refused\r\n",
-1);
retval = 0;
}
#else
socklen_t so;
int cfd;
struct sockaddr_in in_port;
int retval = 1;
int getpeer = -1;
cfd = FileFDNum(pCL->fd);
@ -523,16 +538,22 @@ ClientAccessOk(pCL)
-1);
retval = 0;
}
setpeer:
#endif
if (pCL->peername != (STRING *)0) {
BuildString((char *)0, pCL->peername);
if (peername != (char *)0)
BuildString(peername, pCL->peername);
#if USE_UNIX_DOMAIN_SOCKETS
else
BuildString("127.0.0.1", pCL->peername);
#else
else if (getpeer != -1)
BuildString(inet_ntoa(in_port.sin_addr), pCL->peername);
else
BuildString("<unknown>", pCL->peername);
#endif
}
if (peername != (char *)0)
free(peername);

View File

@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.43 2004/03/23 01:02:29 bryan Exp $
.TH CONSERVER 8 "2004/03/23" "conserver-8.1.3" "conserver"
.\" $Id: conserver.man,v 1.46 2004/04/13 18:19:26 bryan Exp $
.TH CONSERVER 8 "2004/04/13" "conserver-8.1.4" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
@ -11,7 +11,7 @@ conserver \- console server daemon
.RB [ \-m
.IR max ]
.RB [ \-M
.IR addr ]
.IR master ]
.RB [ \-p
.IR port ]
.RB [ \-b
@ -50,7 +50,7 @@ knowledge of the distribution of consoles among servers.)
.B Conserver
forks a child for each group of consoles it must manage
and assigns each process a port number to listen on.
The maximum number of consoles managed by each child process is set using
The maximum number of consoles managed by each child process is set using the
.B \-m
option.
The
@ -76,14 +76,31 @@ the
.BR conserver.cf (5)
access list.
.PP
When Unix domain sockets are used between the client and
server (enabled using
.BR --with-uds ),
authentication checks are done on the hardcoded address ``127.0.0.1''.
Automatic client redirection is also disabled (as if the
.B \-R
option was used) since the client cannot communicate with remote servers.
The directory used to hold the sockets is checked to make sure it's empty
when the server starts.
The server will
.B not
remove any files in the directory itself, just in case the directory is
accidentally specified as ``/etc'' or some other critical location.
The server will do it's best to remove all the sockets when it shuts down,
but it could stop ungracefully (crash, ``kill -9'', etc)
and leave files behind.
It's would then be up to the admin (or a creative startup script) to clean
up the directory before the server will start again.
.PP
.B Conserver
completely controls any connection to a console.
All escape sequences given by the user to
.B console
are passed to the server without interpretation.
The server recognizes and processes all escape sequences,
The suspend sequence is recognized by the server and sent back to the
client as a TCP out-of-band command, which the client processes.
The server recognizes and processes all escape sequences.
.PP
The
.B conserver
@ -217,7 +234,7 @@ option.
.B \-d
Become a daemon.
Disconnects from the controlling terminal and sends
all output to the logfile (see
all output (including any debug output) to the logfile (see
.BR \-L ).
.TP
.B \-D
@ -271,11 +288,20 @@ 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
.IR master
directory, ``/tmp/conserver'',
may be changed at compile time using the
.B --with-uds
option.
.TP
.B \-n
Obsolete (now a no-op); see
@ -301,6 +327,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
@ -443,6 +472,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

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.291 2004/03/16 04:17:31 bryan Exp $
* $Id: group.c,v 5.293 2004/04/13 18:12:00 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -1265,7 +1265,14 @@ DeUtmp(pGE, sfd)
#endif
{
CONSENT *pCE;
#if USE_UNIX_DOMAIN_SOCKETS
struct sockaddr_un lstn_port;
socklen_t so;
so = sizeof(lstn_port);
if (getsockname(sfd, (struct sockaddr *)&lstn_port, &so) != -1)
unlink(lstn_port.sun_path);
#endif
/* shut down the socket */
close(sfd);
@ -4469,18 +4476,53 @@ Spawn(pGE)
{
pid_t pid;
int sfd;
#if USE_UNIX_DOMAIN_SOCKETS
struct sockaddr_un lstn_port;
static STRING *portPath = (STRING *)0;
#else
socklen_t so;
struct sockaddr_in lstn_port;
int true = 1;
unsigned short portInc = 0;
struct sockaddr_in lstn_port;
#endif
/* get a socket for listening
*/
/* get a socket for listening */
#if HAVE_MEMSET
memset((void *)&lstn_port, 0, sizeof(lstn_port));
#else
bzero((char *)&lstn_port, sizeof(lstn_port));
#endif
#if USE_UNIX_DOMAIN_SOCKETS
lstn_port.sun_family = AF_UNIX;
if (portPath == (STRING *)0)
portPath = AllocString();
BuildStringPrint(portPath, "%s/%u", interface, pGE->id);
if (portPath->used > sizeof(lstn_port.sun_path)) {
Error("Spawn(): path to socket too long: %s", portPath->string);
Bye(EX_OSERR);
}
strcpy(lstn_port.sun_path, portPath->string);
/* create a socket to listen on
* (prepared by master so he can see the port number of the kid)
*/
if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Error("Spawn(): socket(): %s", strerror(errno));
Bye(EX_OSERR);
}
if (!SetFlags(sfd, O_NONBLOCK, 0))
Bye(EX_OSERR);
if (bind(sfd, (struct sockaddr *)&lstn_port, sizeof(lstn_port)) < 0) {
Error("Spawn(): bind(%s): %s", lstn_port.sun_path,
strerror(errno));
Bye(EX_OSERR);
}
pGE->port = pGE->id;
#else
lstn_port.sin_family = AF_INET;
lstn_port.sin_addr.s_addr = bindAddr;
lstn_port.sin_port = htons(bindBasePort);
@ -4509,7 +4551,7 @@ Spawn(pGE)
# if defined(EADDRINUSE)
(errno == EADDRINUSE) ||
# endif
(errno == EACCES)) && portInc++) {
(errno == EACCES)) && ++portInc) {
lstn_port.sin_port = htons(bindBasePort + portInc);
} else {
Error("Spawn(): bind(%hu): %s", ntohs(lstn_port.sin_port),
@ -4524,6 +4566,7 @@ Spawn(pGE)
Bye(EX_OSERR);
}
pGE->port = ntohs(lstn_port.sin_port);
#endif
fflush(stderr);
fflush(stdout);
@ -4587,12 +4630,20 @@ Spawn(pGE)
}
if (listen(sfd, SOMAXCONN) < 0) {
#if USE_UNIX_DOMAIN_SOCKETS
Error("Spawn(): listen(%s): %s", lstn_port.sun_path,
strerror(errno));
#else
Error("Spawn(): listen(%hu): %s", pGE->port, strerror(errno));
#endif
Bye(EX_OSERR);
}
Kiddie(pGE, sfd);
/* should never get here...but on errors we could */
close(sfd);
#if USE_UNIX_DOMAIN_SOCKETS
unlink(lstn_port.sun_path);
#endif
Bye(EX_SOFTWARE);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.178 2004/03/11 16:23:59 bryan Exp $
* $Id: main.c,v 5.179 2004/04/13 18:12:00 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -41,6 +41,7 @@
#include <version.h>
#include <net/if.h>
#include <dirent.h>
#if HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
@ -523,7 +524,7 @@ Usage(wantfull)
#endif
{
static char u_terse[] =
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M addr] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]";
"[-7dDEFhinoRSuvV] [-a type] [-m max] [-M master] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min] [-U logfile]";
static char *full[] = {
"7 strip the high bit off all console data",
"a type set the default access type",
@ -546,11 +547,19 @@ Usage(wantfull)
"i initialize console connections on demand",
"L logfile give a new logfile path to the server process",
"m max maximum consoles managed per process",
"M addr address to listen on (all addresses by default)",
#if USE_UNIX_DOMAIN_SOCKETS
"M master directory that holds the Unix domain sockets",
#else
"M master address to listen on (all addresses by default)",
#endif
"n obsolete - see -u",
"o reopen downed console on client connect",
"O min reopen all downed consoles every <min> minutes",
#if USE_UNIX_DOMAIN_SOCKETS
"p port ignored - Unix domain sockets compiled into code",
#else
"p port port to listen on",
#endif
"P passwd give a new passwd file to the server process",
"R disable automatic client redirection",
"S syntax check of configuration file",
@ -616,9 +625,13 @@ Version()
Msg("default pidfile is `%s'", PIDFILE);
Msg("default limit is %d member%s per group", MAXMEMB,
MAXMEMB == 1 ? "" : "s");
#if USE_UNIX_DOMAIN_SOCKETS
Msg("default socket directory `%s'", UDSDIR);
#else
Msg("default primary port referenced as `%s'", defConfig.primaryport);
Msg("default secondary base port referenced as `%s'",
defConfig.secondaryport);
#endif
BuildString((char *)0, acA1);
if (optionlist[0] == (char *)0)
@ -1153,6 +1166,94 @@ ProbeInterfaces()
#endif
}
/* This makes sure a directory exists and tries to create it if it
* doesn't. returns 0 for success, -1 for error
*/
#if USE_UNIX_DOMAIN_SOCKETS
int
#if PROTOTYPES
VerifyEmptyDirectory(char *d)
#else
VerifyEmptyDirectory(d)
char *d;
#endif
{
struct stat dstat;
DIR *dir;
struct dirent *de;
STRING *path = (STRING *)0;
int retval = 0;
while (1) {
if (stat(d, &dstat) == -1) {
if (errno == ENOENT) {
if (mkdir(d, 0755) == -1) {
Error("mkdir(%s): %s", d, strerror(errno));
return -1;
}
CONDDEBUG((1, "VerifyEmptyDirectory: created `%s'", d));
continue;
} else {
Error("stat(%s): %s", d, strerror(errno));
return -1;
}
}
if (S_ISDIR(dstat.st_mode))
break;
return -1;
}
/* now make sure it's empty...erase anything you see, etc */
if ((dir = opendir(d)) == (DIR *) 0) {
Error("opendir(%s): %s", d, strerror(errno));
return -1;
}
while ((de = readdir(dir)) != (struct dirent *)0) {
if ((strcmp(de->d_name, ".") == 0) ||
(strcmp(de->d_name, "..") == 0))
continue;
/* we're going to just let the user deal with non-empty directories */
Error("non-empty directory `%s'", d);
retval = -1;
break;
/* this is probably too extreme. if someone happens to point conserver
* at /etc, for example, it could (if running as root) nuke the password
* database, config files, etc. too many important files could be
* shredded with a small typo.
*/
#if 0
if (path == (STRING *)0)
path = AllocString();
BuildStringPrint(path, "%s/%s", d, de->d_name);
if (stat(path->string, &dstat) == -1) {
Error("stat(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
if (S_ISDIR(dstat.st_mode)) {
if (rmdir(path->string) != 0) {
Error("rmdir(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
} else {
if (unlink(path->string) != 0) {
Error("unlink(%s): %s", path->string, strerror(errno));
retval = -1;
break;
}
}
#endif
}
if (path != (STRING *)0)
DestroyString(path);
return retval;
}
#endif
/* find out where/who we are (ksb)
* parse optons
* read in the config file, open the log file
@ -1180,8 +1281,10 @@ main(argc, argv)
char *curuser = (char *)0;
int curuid = 0;
GRPENT *pGE = (GRPENT *)0;
#if !USE_UNIX_DOMAIN_SOCKETS
#if HAVE_INET_ATON
struct in_addr inetaddr;
#endif
#endif
isMultiProc = 1; /* make sure stuff has the pid */
@ -1379,6 +1482,14 @@ main(argc, argv)
if (fSyntaxOnly)
Msg("performing configuration file syntax check");
#if USE_UNIX_DOMAIN_SOCKETS
/* Don't do any redirects if we're purely local
* (but it allows them to see where remote consoles are)
*/
optConf->redirect = FLAGFALSE;
if (interface == (char *)0)
interface = UDSDIR;
#else
/* set up the address to bind to */
if (interface == (char *)0 ||
(interface[0] == '*' && interface[1] == '\000'))
@ -1403,10 +1514,11 @@ main(argc, argv)
ba.s_addr = bindAddr;
CONDDEBUG((1, "main(): bind address set to `%s'", inet_ntoa(ba)));
}
#endif
/* must do all this so IsMe() works right */
if (gethostname(myHostname, MAXHOSTNAME) != 0) {
Error("gethostname(): %s", interface, strerror(errno));
Error("gethostname(): %s", strerror(errno));
Bye(EX_OSERR);
}
ProbeInterfaces();
@ -1423,6 +1535,7 @@ main(argc, argv)
ReadCfg(pcConfig, fpConfig);
fclose(fpConfig);
#if !USE_UNIX_DOMAIN_SOCKETS
/* set up the port to bind to */
if (optConf->primaryport != (char *)0)
config->primaryport = StrDup(optConf->primaryport);
@ -1482,6 +1595,7 @@ main(argc, argv)
bindBasePort = ntohs((unsigned short)pSE->s_port);
}
}
#endif
if (optConf->passwdfile != (char *)0)
config->passwdfile = StrDup(optConf->passwdfile);
@ -1580,7 +1694,13 @@ main(argc, argv)
if (pGroups == (GRPENT *)0 && pRCList == (REMOTE *)0) {
Error("no consoles found in configuration file");
} else if (!fSyntaxOnly) {
} else if (fSyntaxOnly) {
/* short-circuit */
#if USE_UNIX_DOMAIN_SOCKETS
} else if (VerifyEmptyDirectory(interface) == -1) {
Error("Master(): %s: unusable socket directory", interface);
#endif
} else {
#if HAVE_OPENSSL
/* Prep the SSL layer */
SetupSSL();
@ -1603,7 +1723,6 @@ main(argc, argv)
continue;
Spawn(pGE);
Verbose("group #%d pid %lu on port %hu", pGE->id,
(unsigned long)pGE->pid, pGE->port);
}
@ -1617,8 +1736,13 @@ main(argc, argv)
local += pGE->imembers;
for (pRC = pRCList; (REMOTE *)0 != pRC; pRC = pRC->pRCnext)
remote++;
# if USE_UNIX_DOMAIN_SOCKETS
setproctitle("master: port 0, %d local, %d remote", local,
remote);
#else
setproctitle("master: port %hu, %d local, %d remote", bindPort,
local, remote);
#endif
}
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: main.h,v 5.51 2003/11/10 15:37:24 bryan Exp $
* $Id: main.h,v 5.52 2004/04/13 18:12:00 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -49,6 +49,9 @@ 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

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.124 2003/12/25 19:22:00 bryan Exp $
* $Id: master.c,v 5.125 2004/04/13 18:12:00 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -569,6 +569,9 @@ DoNormalRead(pCLServing)
int iSep = 1;
if ((GRPENT *)0 != pGroups) {
#if USE_UNIX_DOMAIN_SOCKETS
FilePrint(pCLServing->fd, FLAGTRUE, "@0");
#else
struct sockaddr_in lcl;
socklen_t so = sizeof(lcl);
if (-1 ==
@ -583,6 +586,7 @@ DoNormalRead(pCLServing)
}
FilePrint(pCLServing->fd, FLAGTRUE, "@%s",
inet_ntoa(lcl.sin_addr));
#endif
iSep = 0;
}
if (config->redirect == FLAGTRUE) {
@ -673,8 +677,13 @@ Master()
int msfd;
socklen_t so;
fd_set rmask, wmask;
#if USE_UNIX_DOMAIN_SOCKETS
struct sockaddr_un master_port;
static STRING *portPath = (STRING *)0;
#else
struct sockaddr_in master_port;
int true = 1;
#endif
FILE *fp;
CONSCLIENT *pCLServing = (CONSCLIENT *)0;
CONSCLIENT *pCL = (CONSCLIENT *)0;
@ -715,6 +724,40 @@ Master()
#else
bzero((char *)&master_port, sizeof(master_port));
#endif
#if USE_UNIX_DOMAIN_SOCKETS
master_port.sun_family = AF_UNIX;
if (portPath == (STRING *)0)
portPath = AllocString();
BuildStringPrint(portPath, "%s/0", interface);
if (portPath->used > sizeof(master_port.sun_path)) {
Error("Master(): path to socket too long: %s", portPath->string);
return;
}
strcpy(master_port.sun_path, portPath->string);
if ((msfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Error("Master(): socket(AF_UNIX,SOCK_STREAM): %s",
strerror(errno));
return;
}
if (!SetFlags(msfd, O_NONBLOCK, 0))
return;
if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port)) <
0) {
Error("Master(): bind(%s): %s", master_port.sun_path,
strerror(errno));
return;
}
if (listen(msfd, SOMAXCONN) < 0) {
Error("Master(): listen(%s): %s", master_port.sun_path,
strerror(errno));
return;
}
#else
master_port.sin_family = AF_INET;
master_port.sin_addr.s_addr = bindAddr;
master_port.sin_port = htons(bindPort);
@ -748,6 +791,7 @@ Master()
strerror(errno));
return;
}
#endif
fp = fopen(PIDFILE, "w");
if (fp) {
@ -943,6 +987,9 @@ Master()
}
close(msfd);
#if USE_UNIX_DOMAIN_SOCKETS
unlink(master_port.sun_path);
#endif
/* clean up the free list */
while (pCLmfree != (CONSCLIENT *)0) {

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.168 2004/03/11 16:23:59 bryan Exp $
* $Id: readcfg.c,v 5.169 2004/04/13 18:12:01 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -143,7 +143,7 @@ int isStartup = 0;
GRPENT *pGroupsOld = (GRPENT *)0;
GRPENT *pGEstage = (GRPENT *)0;
GRPENT *pGE = (GRPENT *)0;
static unsigned int groupID = 0;
static unsigned int groupID = 1;
REMOTE **ppRC = (REMOTE **)0;
/* 'break' handling */

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.59 2004/03/16 04:17:31 bryan Exp $
* $Id: version.h,v 1.60 2004/04/03 15:44:49 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -14,4 +14,4 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define THIS_VERSION "conserver.com version 8.1.3"
#define THIS_VERSION "conserver.com version 8.1.4"

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.161 2004/03/20 14:40:42 bryan Exp $
* $Id: console.c,v 5.162 2004/04/13 18:12:03 bryan Exp $
*
* Copyright conserver.com, 2000
*
@ -47,8 +47,12 @@ int fReqEncryption = 1;
char *pcCredFile = (char *)0;
#endif
int chAttn = -1, chEsc = -1;
char *pcInMaster = /* which machine is current */
MASTERHOST;
char *pcInMaster =
#if USE_UNIX_DOMAIN_SOCKETS
UDSDIR;
#else
MASTERHOST; /* which machine is current */
#endif
char *pcPort = DEFPORT;
unsigned short bindPort;
CONSFILE *cfstdout;
@ -270,10 +274,14 @@ Version()
acA2 = AllocString();
Msg("%s", THIS_VERSION);
#if USE_UNIX_DOMAIN_SOCKETS
Msg("default socket directory `%s\'", UDSDIR);
#else
Msg("default initial master server `%s\'", MASTERHOST);
Msg("default port referenced as `%s'", DEFPORT);
#endif
Msg("default escape sequence `%s%s\'", FmtCtl(DEFATTN, acA1),
FmtCtl(DEFESC, acA2));
Msg("default port referenced as `%s'", DEFPORT);
BuildString((char *)0, acA1);
if (optionlist[0] == (char *)0)
@ -430,8 +438,13 @@ GetPort(pcToHost, sPort)
#endif
{
int s;
#if USE_UNIX_DOMAIN_SOCKETS
struct sockaddr_un port;
static STRING *portPath = (STRING *)0;
#else
struct hostent *hp = (struct hostent *)0;
struct sockaddr_in port;
#endif
#if HAVE_MEMSET
memset((void *)(&port), '\000', sizeof(port));
@ -439,6 +452,32 @@ GetPort(pcToHost, sPort)
bzero((char *)(&port), sizeof(port));
#endif
#if USE_UNIX_DOMAIN_SOCKETS
if (portPath == (STRING *)0)
portPath = AllocString();
BuildStringPrint(portPath, "%s/%hu", pcInMaster, sPort);
port.sun_family = AF_UNIX;
if (portPath->used > sizeof(port.sun_path)) {
Error("GetPort: path to socket too long: %s", portPath->string);
return (CONSFILE *)0;
}
strcpy(port.sun_path, portPath->string);
CONDDEBUG((1, "GetPort: socket=%s", port.sun_path));
/* set up the socket to talk to the server for all consoles
* (it will tell us who to talk to to get a real connection)
*/
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
Error("socket(AF_UNIX,SOCK_STREAM): %s", strerror(errno));
return (CONSFILE *)0;
}
if (connect(s, (struct sockaddr *)(&port), sizeof(port)) < 0) {
Error("connect(): %s: %s", port.sun_path, strerror(errno));
return (CONSFILE *)0;
}
#else
# if HAVE_INET_ATON
if (inet_aton(pcToHost, &(port.sin_addr)) == 0)
# else
@ -481,11 +520,13 @@ GetPort(pcToHost, sPort)
Error("socket(AF_INET,SOCK_STREAM): %s", strerror(errno));
return (CONSFILE *)0;
}
if (connect(s, (struct sockaddr *)(&port), sizeof(port)) < 0) {
Error("connect(): %hu@%s: %s", ntohs(port.sin_port), pcToHost,
strerror(errno));
return (CONSFILE *)0;
}
#endif
return FileOpenFD(s, simpleSocket);
}
@ -1270,6 +1311,7 @@ DoCmds(master, pports, cmdi)
int len;
char *ports;
char *pcopy;
char *serverName;
if ((pcopy = ports = StrDup(pports)) == (char *)0)
OutOfMem();
@ -1292,13 +1334,27 @@ DoCmds(master, pports, cmdi)
} else
server = master;
#if USE_UNIX_DOMAIN_SOCKETS
serverName = "localhost";
#else
serverName = server;
#endif
if (*ports == '\000') {
#if USE_UNIX_DOMAIN_SOCKETS
port = 0;
#else
port = htons(bindPort);
#endif
} else if (!isdigit((int)(ports[0]))) {
Error("invalid port spec for %s: `%s'", server, ports);
Error("invalid port spec for %s: `%s'", serverName, ports);
continue;
} else {
#if USE_UNIX_DOMAIN_SOCKETS
port = (short)atoi(ports);
#else
port = htons((short)atoi(ports));
#endif
}
attemptLogin:
@ -1310,7 +1366,7 @@ DoCmds(master, pports, cmdi)
t = ReadReply(pcf, 0);
if (strcmp(t, "ok\r\n") != 0) {
FileClose(&pcf);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, t);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", serverName, t);
continue;
}
#if HAVE_OPENSSL
@ -1321,7 +1377,8 @@ DoCmds(master, pports, cmdi)
AttemptSSL(pcf);
}
if (FileGetType(pcf) != SSLSocket) {
Error("Encryption not supported by server `%s'", server);
Error("Encryption not supported by server `%s'",
serverName);
FileClose(&pcf);
continue;
}
@ -1339,9 +1396,9 @@ DoCmds(master, pports, cmdi)
if (t[7] == ' ') {
hostname = PruneSpace(t + 7);
if (*hostname == '\000')
hostname = server;
hostname = serverName;
} else
hostname = server;
hostname = serverName;
if (tmpString == (STRING *)0)
tmpString = AllocString();
if (tmpString->used <= 1) {
@ -1351,7 +1408,7 @@ DoCmds(master, pports, cmdi)
pass = GetPassword(tmpString->string);
if (pass == (char *)0) {
Error("could not get password from tty for `%s'",
server);
serverName);
FileClose(&pcf);
continue;
}
@ -1363,12 +1420,12 @@ DoCmds(master, pports, cmdi)
tmpString->used - 1);
t = ReadReply(pcf, 0);
if (strcmp(t, "ok\r\n") != 0) {
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, t);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", serverName, t);
if (++count < 3) {
BuildString((char *)0, tmpString);
goto attemptLogin;
}
Error("too many bad passwords for `%s'", server);
Error("too many bad passwords for `%s'", serverName);
count = 0;
FileClose(&pcf);
continue;
@ -1376,7 +1433,7 @@ DoCmds(master, pports, cmdi)
count = 0;
} else if (strcmp(t, "ok\r\n") != 0) {
FileClose(&pcf);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, t);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", serverName, t);
continue;
}
@ -1412,7 +1469,8 @@ DoCmds(master, pports, cmdi)
Bye(EX_SOFTWARE);
}
} else if (result[0] != '[') { /* did we not get a connection? */
FilePrint(cfstdout, FLAGFALSE, "%s: %s", server, result);
FilePrint(cfstdout, FLAGFALSE, "%s: %s", serverName,
result);
FileClose(&pcf);
continue;
} else {
@ -1452,7 +1510,7 @@ DoCmds(master, pports, cmdi)
*/
if (cmds[0][0] == 'd') {
if (result[0] != 'o' || result[1] != 'k') {
FileWrite(cfstdout, FLAGTRUE, server, -1);
FileWrite(cfstdout, FLAGTRUE, serverName, -1);
FileWrite(cfstdout, FLAGTRUE, ": ", 2);
FileWrite(cfstdout, FLAGFALSE, result, len);
} else {
@ -1461,8 +1519,9 @@ DoCmds(master, pports, cmdi)
} else if ((cmds[0][0] != 'b' && cmds[0][0] != 't') ||
(result[0] != 'o' || result[1] != 'k')) {
/* did a 'master' before this or doing a 'disconnect' */
if (cmds[1][0] == 'm' || cmds[0][0] == 'd') {
FileWrite(cfstdout, FLAGTRUE, server, -1);
if ((cmds[1] != (char *)0 && cmds[1][0] == 'm') ||
cmds[0][0] == 'd') {
FileWrite(cfstdout, FLAGTRUE, serverName, -1);
FileWrite(cfstdout, FLAGTRUE, ": ", 2);
}
FileWrite(cfstdout, FLAGFALSE, result, len);
@ -1514,7 +1573,6 @@ main(argc, argv)
extern int optind;
extern int optopt;
extern char *optarg;
int i;
static STRING *textMsg = (STRING *)0;
int cmdi;
static STRING *consoleName = (STRING *)0;
@ -1556,7 +1614,10 @@ main(argc, argv)
/* fall through */
case 'b':
pcCmd = "broadcast";
cmdarg = optarg;
if (cmdarg != (char *)0)
free(cmdarg);
if ((cmdarg = StrDup(optarg)) == (char *)0)
OutOfMem();
break;
case 'c':
@ -1571,7 +1632,10 @@ main(argc, argv)
case 'd':
pcCmd = "disconnect";
cmdarg = optarg;
if (cmdarg != (char *)0)
free(cmdarg);
if ((cmdarg = StrDup(optarg)) == (char *)0)
OutOfMem();
break;
case 'E':
@ -1702,6 +1766,8 @@ main(argc, argv)
Error("missing console name");
Bye(EX_UNAVAILABLE);
}
if (cmdarg != (char *)0)
free(cmdarg);
if ((cmdarg = StrDup(argv[optind++])) == (char *)0)
OutOfMem();
} else if (*pcCmd == 't') {
@ -1709,24 +1775,27 @@ main(argc, argv)
Error("missing message text");
Bye(EX_UNAVAILABLE);
}
cmdarg = argv[optind++];
if (cmdarg != (char *)0)
free(cmdarg);
if ((cmdarg = StrDup(argv[optind++])) == (char *)0)
OutOfMem();
}
if (optind < argc) {
Error("extra garbage on command line? (%s...)", argv[optind]);
Bye(EX_UNAVAILABLE);
}
#if !USE_UNIX_DOMAIN_SOCKETS
/* if we somehow lost the port (or got an empty string), reset */
if (pcPort == (char *)0 || pcPort[0] == '\000')
pcPort = DEFPORT;
/* Look for non-numeric characters */
for (i = 0; pcPort[i] != '\000'; i++)
if (!isdigit((int)pcPort[i]))
for (opt = 0; pcPort[opt] != '\000'; opt++)
if (!isdigit((int)pcPort[opt]))
break;
if (pcPort[i] == '\000') {
if (pcPort[opt] == '\000') {
/* numeric only */
bindPort = atoi(pcPort);
} else {
@ -1739,6 +1808,7 @@ main(argc, argv)
bindPort = ntohs((u_short) pSE->s_port);
}
}
#endif
if (pcUser == (char *)0 || pcUser[0] == '\000') {
if (((pcUser = getenv("LOGNAME")) == (char *)0) &&
@ -1836,8 +1906,9 @@ main(argc, argv)
free(cmdarg);
if (*pcCmd == 'd')
FilePrint(cfstdout, FLAGFALSE, "Disconnected %d users\n",
disconnectCount);
FilePrint(cfstdout, FLAGFALSE, "disconnected %d %s\n",
disconnectCount,
disconnectCount == 1 ? "user" : "users");
Bye(0);
return 0; /* noop - Bye() terminates us */

View File

@ -1,5 +1,5 @@
.\" $Id: console.man,v 1.45 2004/03/20 14:40:42 bryan Exp $
.TH CONSOLE 1 "2004/03/20" "conserver-8.1.3" "conserver"
.\" $Id: console.man,v 1.46 2004/03/23 18:32:09 bryan Exp $
.TH CONSOLE 1 "2004/03/23" "conserver-8.1.4" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS
@ -26,11 +26,11 @@ console \- console server client program
.RB [ \-p
.IR port ]
.RB [ \-d
.RI [ user ][\fB@\fP console ]]
.RI [ user ][\f3@\fP console ]]
.RB [ \- [ bB ]
.IR message ]
.RB [ \-t
.RI [ user ][\fB@\fP console ]
.RI [ user ][\f3@\fP console ]
.IR message ]
.br
.B console

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver 8.1.3
%define ver 8.1.4
# define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default

View File

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

View File

@ -91,7 +91,7 @@ dotest 'cdc.'
dotest 'coc.'
dotest EVAL "echo 'tu.' | ../console/console -M 127.0.0.1 -p 7777 -e 'tu' shell"
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -P | sed -e 's/:.*//'"
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -R | sed -e 's/ [^ ]*$//'"
dotest EVAL "../console/console -M 127.0.0.1 -p 7777 -x | sed -e 's/ on [^ ]* */ on /'"
cleanup

View File

@ -1 +1 @@
127.0.0.1
version `conserver.com version