mirror of
https://github.com/bstansell/conserver.git
synced 2024-12-18 20:37:56 +00:00
Imported from conserver-7.2.6.tar.gz
This commit is contained in:
parent
19eedadfe0
commit
d8dfd2cb9a
28
CHANGES
28
CHANGES
@ -1,6 +1,32 @@
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
version 7.2.6 (Mar 20, 2003):
|
||||
- the -b conserver option was mostly broken (since 7.2.0)
|
||||
- changed logging format so that all messages are of a similar
|
||||
form
|
||||
- fixed bad port number in 'cached previous timeout' message -
|
||||
reported by Dave Stuit <djs@tellme.com>
|
||||
- now using pid_t type for better compatibility
|
||||
- fixed the RPM and Solaris package to include the man
|
||||
page for conserver.passwd - suggested by R P Herrold
|
||||
<herrold@owlriver.com>
|
||||
- added restart option (-HUP) to conserver startup scripts
|
||||
- added -B option to client for sending messages to a single
|
||||
server - suggested by Dave Stuit <djs@tellme.com>
|
||||
- added --with-dmalloc for memory usage debugging
|
||||
- bug with multiple interfaces and -M option not maching hostname
|
||||
in configuration file - patch by Igor Sviridov <sia@nest.org>
|
||||
- memory leak using openssl library plugged
|
||||
- automatic reinitialization of failed consoles now retries
|
||||
every minute like the manpage says it does - reported by Chris
|
||||
Fowler <cfowler@outpostsentinel.com>
|
||||
- when -R option is used, substring matches on console names
|
||||
from clients only match local console names (and if that
|
||||
fails just remote console names) but ambiguous name list
|
||||
returns both local and remote consoles - suggested by Todd
|
||||
Stansell <todd@stansell.org>
|
||||
|
||||
version 7.2.5 (Jan 27, 2003):
|
||||
- fixed many documentation bugs - reported by Dave Stuit
|
||||
<djs@tellme.com>
|
||||
@ -377,5 +403,5 @@ before version 6.05:
|
||||
and enhancements of various types were applied.
|
||||
|
||||
#
|
||||
# $Id: CHANGES,v 1.75 2003-01-27 17:47:59-08 bryan Exp $
|
||||
# $Id: CHANGES,v 1.78 2003-03-10 17:45:55-08 bryan Exp $
|
||||
#
|
||||
|
12
compat.h
12
compat.h
@ -259,3 +259,15 @@ typedef int socklen_t;
|
||||
#ifndef ONLRET
|
||||
#define ONLRET 0
|
||||
#endif
|
||||
|
||||
#ifndef PARAMS
|
||||
# if PROTOTYPES
|
||||
# define PARAMS(protos) protos
|
||||
# else /* no PROTOTYPES */
|
||||
# define PARAMS(protos) ()
|
||||
# endif /* no PROTOTYPES */
|
||||
#endif
|
||||
|
||||
#if HAVE_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif
|
||||
|
16
config.h.in
16
config.h.in
@ -21,8 +21,8 @@
|
||||
/* Define to 1 if you have the <crypt.h> header file. */
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
/* Define to 1 if you have the `flock' function. */
|
||||
#undef HAVE_FLOCK
|
||||
/* have dmalloc support */
|
||||
#undef HAVE_DMALLOC
|
||||
|
||||
/* Define if libbsm has `getaudit'. */
|
||||
#undef HAVE_GETAUDIT
|
||||
@ -261,6 +261,9 @@
|
||||
/* 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
|
||||
|
||||
@ -276,9 +279,6 @@
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* use ansi prototypes/decls */
|
||||
#undef USE_ANSI_PROTO
|
||||
|
||||
/* use tcp_wrappers libwrap */
|
||||
#undef USE_LIBWRAP
|
||||
|
||||
@ -289,11 +289,17 @@
|
||||
# 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
|
||||
|
898
configure
vendored
898
configure
vendored
@ -852,6 +852,8 @@ Optional Packages:
|
||||
Compile in libwrap (tcp_wrappers) support
|
||||
--with-openssl[=PATH]
|
||||
Compile in OpenSSL support
|
||||
--with-dmalloc[=PATH]
|
||||
Compile in dmalloc support
|
||||
--with-regex Use regular expressions in conserver.passwd
|
||||
--with-pam Enable PAM support
|
||||
|
||||
@ -2756,6 +2758,642 @@ fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}gcc; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}gcc"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
echo "$as_me:$LINENO: result: $CC" >&5
|
||||
echo "${ECHO_T}$CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_CC"; then
|
||||
ac_ct_CC=$CC
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$ac_ct_CC"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="gcc"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_CC=$ac_cv_prog_ac_ct_CC
|
||||
if test -n "$ac_ct_CC"; then
|
||||
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
|
||||
echo "${ECHO_T}$ac_ct_CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
CC=$ac_ct_CC
|
||||
else
|
||||
CC="$ac_cv_prog_CC"
|
||||
fi
|
||||
|
||||
if test -z "$CC"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}cc; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}cc"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
echo "$as_me:$LINENO: result: $CC" >&5
|
||||
echo "${ECHO_T}$CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_CC"; then
|
||||
ac_ct_CC=$CC
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$ac_ct_CC"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="cc"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_CC=$ac_cv_prog_ac_ct_CC
|
||||
if test -n "$ac_ct_CC"; then
|
||||
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
|
||||
echo "${ECHO_T}$ac_ct_CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
CC=$ac_ct_CC
|
||||
else
|
||||
CC="$ac_cv_prog_CC"
|
||||
fi
|
||||
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
ac_prog_rejected=no
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
|
||||
ac_prog_rejected=yes
|
||||
continue
|
||||
fi
|
||||
ac_cv_prog_CC="cc"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if test $ac_prog_rejected = yes; then
|
||||
# We found a bogon in the path, so make sure we never use it.
|
||||
set dummy $ac_cv_prog_CC
|
||||
shift
|
||||
if test $# != 0; then
|
||||
# We chose a different compiler from the bogus one.
|
||||
# However, it has the same basename, so the bogon will be chosen
|
||||
# first if we set CC to just the basename; use the full file name.
|
||||
shift
|
||||
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
echo "$as_me:$LINENO: result: $CC" >&5
|
||||
echo "${ECHO_T}$CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
for ac_prog in cl
|
||||
do
|
||||
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
echo "$as_me:$LINENO: result: $CC" >&5
|
||||
echo "${ECHO_T}$CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
test -n "$CC" && break
|
||||
done
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
ac_ct_CC=$CC
|
||||
for ac_prog in cl
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test -n "$ac_ct_CC"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_prog"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_CC=$ac_cv_prog_ac_ct_CC
|
||||
if test -n "$ac_ct_CC"; then
|
||||
echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
|
||||
echo "${ECHO_T}$ac_ct_CC" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
test -n "$ac_ct_CC" && break
|
||||
done
|
||||
|
||||
CC=$ac_ct_CC
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
|
||||
echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:$LINENO:" \
|
||||
"checking for C compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
(eval $ac_compiler --version </dev/null >&5) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
|
||||
(eval $ac_compiler -v </dev/null >&5) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
|
||||
(eval $ac_compiler -V </dev/null >&5) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
|
||||
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
|
||||
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
|
||||
if test "${ac_cv_c_compiler_gnu+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
choke me
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_compiler_gnu=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_compiler_gnu=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
ac_cv_c_compiler_gnu=$ac_compiler_gnu
|
||||
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
|
||||
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
|
||||
GCC=`test $ac_compiler_gnu = yes && echo yes`
|
||||
ac_test_CFLAGS=${CFLAGS+set}
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-g"
|
||||
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
||||
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_cc_g+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_prog_cc_g=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_prog_cc_g=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
|
||||
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
if test "$GCC" = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-g"
|
||||
fi
|
||||
else
|
||||
if test "$GCC" = yes; then
|
||||
CFLAGS="-O2"
|
||||
else
|
||||
CFLAGS=
|
||||
fi
|
||||
fi
|
||||
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
|
||||
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
|
||||
if test "${ac_cv_prog_cc_stdc+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_cv_prog_cc_stdc=no
|
||||
ac_save_CC=$CC
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
|
||||
struct buf { int x; };
|
||||
FILE * (*rcsopen) (struct buf *, struct stat *, int);
|
||||
static char *e (p, i)
|
||||
char **p;
|
||||
int i;
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
static char *f (char * (*g) (char **, int), char **p, ...)
|
||||
{
|
||||
char *s;
|
||||
va_list v;
|
||||
va_start (v,p);
|
||||
s = g (p, va_arg (v,int));
|
||||
va_end (v);
|
||||
return s;
|
||||
}
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};
|
||||
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX 10.20 and later -Ae
|
||||
# HP-UX older versions -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_prog_cc_stdc=$ac_arg
|
||||
break
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
fi
|
||||
rm -f conftest.$ac_objext
|
||||
done
|
||||
rm -f conftest.$ac_ext conftest.$ac_objext
|
||||
CC=$ac_save_CC
|
||||
|
||||
fi
|
||||
|
||||
case "x$ac_cv_prog_cc_stdc" in
|
||||
x|xno)
|
||||
echo "$as_me:$LINENO: result: none needed" >&5
|
||||
echo "${ECHO_T}none needed" >&6 ;;
|
||||
*)
|
||||
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
|
||||
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
|
||||
CC="$CC $ac_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
|
||||
# Some people use a C++ compiler to compile C. Since we use `exit',
|
||||
# in C++ we need to declare it. In case someone uses the same compiler
|
||||
# for both compiling C and C++ we need to have the C++ compiler decide
|
||||
# the declaration of exit, since it's the most demanding environment.
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#ifndef __cplusplus
|
||||
choke me
|
||||
#endif
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
for ac_declaration in \
|
||||
''\
|
||||
'#include <stdlib.h>' \
|
||||
'extern "C" void std::exit (int) throw (); using std::exit;' \
|
||||
'extern "C" void std::exit (int); using std::exit;' \
|
||||
'extern "C" void exit (int) throw ();' \
|
||||
'extern "C" void exit (int);' \
|
||||
'void exit (int);'
|
||||
do
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
$ac_declaration
|
||||
int
|
||||
main ()
|
||||
{
|
||||
exit (42);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
:
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
continue
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
$ac_declaration
|
||||
int
|
||||
main ()
|
||||
{
|
||||
exit (42);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
break
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
done
|
||||
rm -f conftest*
|
||||
if test -n "$ac_declaration"; then
|
||||
echo '#ifdef __cplusplus' >>confdefs.h
|
||||
echo $ac_declaration >>confdefs.h
|
||||
echo '#endif' >>confdefs.h
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
|
||||
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
|
||||
@ -2850,6 +3488,26 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for function prototypes" >&5
|
||||
echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6
|
||||
if test "$ac_cv_prog_cc_stdc" != no; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define PROTOTYPES 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define __PROTOTYPES 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
|
||||
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
|
||||
@ -3379,13 +4037,6 @@ echo "$as_me: WARNING: building a 64bit version of conserver - good luck!" >&2;}
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ac_cv_prog_cc_stdc" != "no"; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define USE_ANSI_PROTO 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
|
||||
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_stdc+set}" = set; then
|
||||
@ -4338,6 +4989,58 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for pid_t" >&5
|
||||
echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
|
||||
if test "${ac_cv_type_pid_t+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((pid_t *) 0)
|
||||
return 0;
|
||||
if (sizeof (pid_t))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_type_pid_t=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_type_pid_t=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
|
||||
echo "${ECHO_T}$ac_cv_type_pid_t" >&6
|
||||
if test $ac_cv_type_pid_t = yes; then
|
||||
:
|
||||
else
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define pid_t int
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for sig_atomic_t" >&5
|
||||
echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6
|
||||
@ -5149,6 +5852,184 @@ fi
|
||||
fi;
|
||||
|
||||
|
||||
# Check whether --with-dmalloc or --without-dmalloc was given.
|
||||
if test "${with_dmalloc+set}" = set; then
|
||||
withval="$with_dmalloc"
|
||||
if test "$withval" != "no"; then
|
||||
if test "$withval" != "yes"; then
|
||||
DMALLOCCPPFLAGS="-I$withval/include"
|
||||
DMALLOCLDFLAGS="-L$withval/lib"
|
||||
else
|
||||
DMALLOCCPPFLAGS=""
|
||||
DMALLOCLDFLAGS=""
|
||||
fi
|
||||
|
||||
oCPPFLAGS="$CPPFLAGS"
|
||||
oLDFLAGS="$LDFLAGS"
|
||||
oLIBS="$LIBS"
|
||||
have_dmalloc=no
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $DMALLOCCPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $DMALLOCLDFLAGS"
|
||||
|
||||
if test "${ac_cv_header_dmalloc_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for dmalloc.h" >&5
|
||||
echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_dmalloc_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_dmalloc_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking dmalloc.h usability" >&5
|
||||
echo $ECHO_N "checking dmalloc.h usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
$ac_includes_default
|
||||
#include <dmalloc.h>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking dmalloc.h presence" >&5
|
||||
echo $ECHO_N "checking dmalloc.h presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <dmalloc.h>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc in
|
||||
yes:no )
|
||||
{ echo "$as_me:$LINENO: WARNING: dmalloc.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: dmalloc.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&2;};;
|
||||
no:yes )
|
||||
{ echo "$as_me:$LINENO: WARNING: dmalloc.h: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: dmalloc.h: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: dmalloc.h: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: dmalloc.h: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: dmalloc.h: proceeding with the preprocessor's result" >&2;};;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for dmalloc.h" >&5
|
||||
echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_dmalloc_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_cv_header_dmalloc_h=$ac_header_preproc
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_dmalloc_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
|
||||
|
||||
fi
|
||||
if test $ac_cv_header_dmalloc_h = yes; then
|
||||
LIBS="$LIBS -ldmalloc"
|
||||
echo "$as_me:$LINENO: checking for dmalloc libraries -ldmalloc" >&5
|
||||
echo $ECHO_N "checking for dmalloc libraries -ldmalloc... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <dmalloc.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
dmalloc_debug(0)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_DMALLOC 1
|
||||
_ACEOF
|
||||
|
||||
have_dmalloc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $have_dmalloc = no; then
|
||||
LIBS="$oLIBS"
|
||||
CPPFLAGS="$oCPPFLAGS"
|
||||
LDFLAGS="$oLDFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for POSIX regex" >&5
|
||||
echo $ECHO_N "checking for POSIX regex... $ECHO_C" >&6
|
||||
@ -5497,8 +6378,7 @@ fi;
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase getlogin
|
||||
for ac_func in 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 sysconf getpassphrase getlogin
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
|
50
configure.in
50
configure.in
@ -10,10 +10,10 @@ AH_TEMPLATE([MAXMEMB], [Number of consoles per child process])
|
||||
AH_TEMPLATE([CONNECTTIMEOUT], [TCP connection timeout])
|
||||
AH_TEMPLATE([PIDFILE], [pidfile to write to])
|
||||
AH_TEMPLATE([USE_LIBWRAP], [use tcp_wrappers libwrap])
|
||||
AH_TEMPLATE([USE_ANSI_PROTO], [use ansi prototypes/decls])
|
||||
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_DMALLOC], [have dmalloc support])
|
||||
|
||||
dnl ### Normal initialization. ######################################
|
||||
AC_INIT
|
||||
@ -174,8 +174,9 @@ AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
dnl ### Compiler characteristics. ##################################
|
||||
AC_AIX
|
||||
AC_PROG_CC_STDC
|
||||
AC_PROG_CC
|
||||
AC_C_CONST
|
||||
AC_C_PROTOTYPES
|
||||
|
||||
AC_CHECK_SIZEOF(long)
|
||||
if test "$ac_cv_sizeof_long" -gt 4; then
|
||||
@ -186,10 +187,6 @@ if test "$ac_cv_sizeof_long" -gt 4; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ac_cv_prog_cc_stdc" != "no"; then
|
||||
AC_DEFINE_UNQUOTED(USE_ANSI_PROTO, 1)
|
||||
fi
|
||||
|
||||
dnl ### Checks for header files. ###################################
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(sys/ioctl.h)
|
||||
@ -213,6 +210,7 @@ AC_HEADER_TIME
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_PID_T
|
||||
|
||||
AC_CHECK_TYPE([sig_atomic_t],,
|
||||
AC_DEFINE(sig_atomic_t, volatile int,
|
||||
@ -312,6 +310,44 @@ AC_ARG_WITH(openssl,
|
||||
fi]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(dmalloc,
|
||||
AC_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"
|
||||
else
|
||||
DMALLOCCPPFLAGS=""
|
||||
DMALLOCLDFLAGS=""
|
||||
fi
|
||||
|
||||
oCPPFLAGS="$CPPFLAGS"
|
||||
oLDFLAGS="$LDFLAGS"
|
||||
oLIBS="$LIBS"
|
||||
have_dmalloc=no
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $DMALLOCCPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $DMALLOCLDFLAGS"
|
||||
|
||||
AC_CHECK_HEADER([dmalloc.h],
|
||||
[LIBS="$LIBS -ldmalloc"
|
||||
AC_MSG_CHECKING(for dmalloc libraries -ldmalloc)
|
||||
AC_TRY_LINK([#include <dmalloc.h>
|
||||
],[dmalloc_debug(0)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DMALLOC)
|
||||
have_dmalloc=yes],
|
||||
[AC_MSG_RESULT(no)])],)
|
||||
|
||||
if test $have_dmalloc = no; then
|
||||
LIBS="$oLIBS"
|
||||
CPPFLAGS="$oCPPFLAGS"
|
||||
LDFLAGS="$oLDFLAGS"
|
||||
fi
|
||||
fi]
|
||||
)
|
||||
|
||||
|
||||
dnl ### Check for needed functions. ################################
|
||||
|
||||
@ -374,7 +410,7 @@ AC_ARG_WITH(pam,
|
||||
fi],)
|
||||
|
||||
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase getlogin)
|
||||
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 sysconf getpassphrase getlogin)
|
||||
AC_FUNC_SETPGRP
|
||||
|
||||
dnl Checks for libbsm functions
|
||||
|
@ -8,8 +8,7 @@
|
||||
"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=
|
||||
"http://www.conserver.com/conserver.ico">
|
||||
<LINK rel="SHORTCUT ICON" href="conserver.ico">
|
||||
|
||||
<TITLE>Conserver</TITLE>
|
||||
|
||||
@ -25,16 +24,23 @@
|
||||
<TABLE summary="Logo" bgcolor="black" width="100%" align=
|
||||
"center">
|
||||
<TR>
|
||||
<TD align="center"><BR>
|
||||
<IMG src="conserver.gif" alt="Conserver"><BR>
|
||||
<BR>
|
||||
<TD align="center"><IMG src="conserver.jpg" alt=
|
||||
"Conserver"><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
|
||||
|
||||
<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,
|
||||
@ -84,8 +90,7 @@
|
||||
from home or wherever.</P>
|
||||
|
||||
<H3>The FAQ</H3>
|
||||
Here's the conserver <A href=
|
||||
"http://www.conserver.com/FAQ">FAQ</A>. Got any
|
||||
Here's the conserver <A href="FAQ">FAQ</A>. Got any
|
||||
additions? Let me know.
|
||||
|
||||
<H3>Mailing Lists</H3>
|
||||
@ -170,24 +175,21 @@
|
||||
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=
|
||||
"http://www.conserver.com/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>
|
||||
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 Jan 27, 2003, is <A
|
||||
href=
|
||||
"http://www.conserver.com/7.2.5.tar.gz">7.2.5.tar.gz</A>.
|
||||
You can get it via <A href=
|
||||
"ftp://ftp.conserver.com/conserver/7.2.5.tar.gz">FTP</A>
|
||||
or <A href=
|
||||
"http://www.conserver.com/7.2.5.tar.gz">HTTP</A>. See the
|
||||
<A href="http://www.conserver.com/CHANGES">CHANGES</A>
|
||||
file for information on the latest updates.</P>
|
||||
<P>The current version, released on Mar 20, 2003, is <A
|
||||
href="7.2.6.tar.gz">7.2.6.tar.gz</A>. You can get it via
|
||||
<A href=
|
||||
"ftp://ftp.conserver.com/conserver/7.2.6.tar.gz">FTP</A>
|
||||
or <A href="7.2.6.tar.gz">HTTP</A>. See the <A href=
|
||||
"CHANGES">CHANGES</A> file for information on the latest
|
||||
updates.</P>
|
||||
|
||||
<P>As of version 6.1.7, the packaging and numbering
|
||||
scheme has changed. I used to package conserver as
|
||||
@ -203,8 +205,7 @@
|
||||
|
||||
<H3>Installation</H3>
|
||||
|
||||
<P>Check the <A href=
|
||||
"http://www.conserver.com/INSTALL">INSTALL</A> file for
|
||||
<P>Check the <A href="INSTALL">INSTALL</A> file for
|
||||
instructions.</P>
|
||||
|
||||
<H3>Systems Tested</H3>
|
||||
@ -242,8 +243,7 @@
|
||||
|
||||
<P>Zonker Harris has fabulous documents regarding the
|
||||
hookup of consoles to terminal servers and other such
|
||||
devices. His <A href=
|
||||
"http://www.conserver.com/consoles/">Greater Scroll of
|
||||
devices. His <A href="consoles/">Greater Scroll of
|
||||
Console Knowledge</A> is a great place to start.</P>
|
||||
<HR noshade>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: access.c,v 5.45 2002-10-12 20:08:07-07 bryan Exp $
|
||||
* $Id: access.c,v 5.52 2003-03-08 08:37:24-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -74,7 +74,7 @@
|
||||
* Returns 0 if the addresses match, else returns 1.
|
||||
*/
|
||||
int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
AddrCmp(struct in_addr *addr, char *pattern)
|
||||
#else
|
||||
AddrCmp(addr, pattern)
|
||||
@ -84,14 +84,16 @@ AddrCmp(addr, pattern)
|
||||
{
|
||||
in_addr_t hostaddr, pattern_addr, netmask;
|
||||
char *p, *slash_posn;
|
||||
static STRING buf = { (char *)0, 0, 0 };
|
||||
static STRING *buf = (STRING *) 0;
|
||||
|
||||
if (buf == (STRING *) 0)
|
||||
buf = AllocString();
|
||||
slash_posn = strchr(pattern, '/');
|
||||
if (slash_posn != NULL) {
|
||||
buildMyString((char *)0, &buf);
|
||||
buildMyString(pattern, &buf);
|
||||
buf.string[slash_posn - pattern] = '\0'; /* isolate the address */
|
||||
p = buf.string;
|
||||
BuildString((char *)0, buf);
|
||||
BuildString(pattern, buf);
|
||||
buf->string[slash_posn - pattern] = '\0'; /* isolate the address */
|
||||
p = buf->string;
|
||||
} else
|
||||
p = pattern;
|
||||
|
||||
@ -121,17 +123,16 @@ AddrCmp(addr, pattern)
|
||||
netmask = 0xffffffff; /* compare entire addresses */
|
||||
hostaddr = addr->s_addr;
|
||||
|
||||
Debug(1, "Access check: host=%lx(%lx/%lx)", hostaddr & netmask,
|
||||
hostaddr, netmask);
|
||||
Debug(1, "Access check: acl=%lx(%lx/%lx)",
|
||||
pattern_addr & netmask, pattern_addr, netmask);
|
||||
Debug(1, "AddrCmp(): host=%lx(%lx/%lx) acl=%lx(%lx/%lx)",
|
||||
hostaddr & netmask, hostaddr, netmask, pattern_addr & netmask,
|
||||
pattern_addr, netmask);
|
||||
return (hostaddr & netmask) != (pattern_addr & netmask);
|
||||
}
|
||||
|
||||
/* return the access type for a given host entry (ksb)
|
||||
*/
|
||||
char
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
AccType(struct in_addr *addr, char *hname)
|
||||
#else
|
||||
AccType(addr, hname)
|
||||
@ -145,15 +146,15 @@ AccType(addr, hname)
|
||||
|
||||
if (fDebug) {
|
||||
if (hname)
|
||||
Debug(1, "Access check: hostname=%s, ip=%s", hname,
|
||||
Debug(1, "AccType(): hostname=%s, ip=%s", hname,
|
||||
inet_ntoa(*addr));
|
||||
else
|
||||
Debug(1, "Access check: hostname=<unresolvable>, ip=%s",
|
||||
Debug(1, "AccType(): hostname=<unresolvable>, ip=%s",
|
||||
inet_ntoa(*addr));
|
||||
}
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *) 0;
|
||||
pACtmp = pACtmp->pACnext) {
|
||||
Debug(1, "Access check: who=%s, trust=%c", pACtmp->pcwho,
|
||||
Debug(1, "AccType(): who=%s, trust=%c", pACtmp->pcwho,
|
||||
pACtmp->ctrust);
|
||||
if (pACtmp->isCIDR != 0) {
|
||||
if (0 == AddrCmp(addr, pACtmp->pcwho)) {
|
||||
@ -165,7 +166,7 @@ AccType(addr, hname)
|
||||
pcName = hname;
|
||||
len = strlen(pcName);
|
||||
while (len >= pACtmp->ilen) {
|
||||
Debug(1, "Access check: name=%s", pcName);
|
||||
Debug(1, "AccType(): name=%s", pcName);
|
||||
if (0 == strcmp(pcName, pACtmp->pcwho)) {
|
||||
return pACtmp->ctrust;
|
||||
}
|
||||
@ -182,7 +183,7 @@ AccType(addr, hname)
|
||||
}
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
SetDefAccess(struct in_addr *pAddr, char *pHost)
|
||||
#else
|
||||
SetDefAccess(pAddr, pHost)
|
||||
@ -206,7 +207,7 @@ SetDefAccess(pAddr, pHost)
|
||||
pACList->ilen = iLen;
|
||||
pACList->pcwho = strcpy(pcWho, addr);
|
||||
|
||||
Debug(1, "Access list prime: trust=%c, who=%s", pACList->ctrust,
|
||||
Debug(1, "SetDefAccess(): trust=%c, who=%s", pACList->ctrust,
|
||||
pACList->pcwho);
|
||||
|
||||
if ((char *)0 == (pcDomain = strchr(pHost, '.'))) {
|
||||
@ -226,15 +227,15 @@ SetDefAccess(pAddr, pHost)
|
||||
pACList->pACnext->ilen = iLen;
|
||||
pACList->pACnext->pcwho = strcpy(pcWho, pcDomain);
|
||||
|
||||
Debug(1, "Access list prime: trust=%c, who=%s",
|
||||
pACList->pACnext->ctrust, pACList->pACnext->pcwho);
|
||||
Debug(1, "SetDefAccess(): trust=%c, who=%s", pACList->pACnext->ctrust,
|
||||
pACList->pACnext->pcwho);
|
||||
}
|
||||
|
||||
/* thread ther list of uniq console server machines, aliases for (ksb)
|
||||
* machines will screw us up
|
||||
*/
|
||||
REMOTE *
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FindUniq(REMOTE * pRCAll)
|
||||
#else
|
||||
FindUniq(pRCAll)
|
||||
@ -262,3 +263,29 @@ FindUniq(pRCAll)
|
||||
}
|
||||
return pRCAll;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DestroyRemoteConsole(REMOTE * pRCList)
|
||||
#else
|
||||
DestroyRemoteConsole(pRCList)
|
||||
REMOTE *pRCList;
|
||||
#endif
|
||||
{
|
||||
DestroyString(&pRCList->rserver);
|
||||
DestroyString(&pRCList->rhost);
|
||||
free(pRCList);
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DestroyAccessList(ACCESS * pACList)
|
||||
#else
|
||||
DestroyAccessList(pACList)
|
||||
ACCESS *pACList;
|
||||
#endif
|
||||
{
|
||||
if (pACList->pcwho != (char *)0)
|
||||
free(pACList->pcwho);
|
||||
free(pACList);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: access.h,v 5.18 2002-09-29 19:04:32-07 bryan Exp $
|
||||
* $Id: access.h,v 5.22 2003-03-06 10:13:41-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -52,12 +52,8 @@ typedef struct remote { /* console at another host */
|
||||
STRING rhost; /* remote host to call to get it */
|
||||
} REMOTE;
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern REMOTE *FindUniq(REMOTE *);
|
||||
extern char AccType(struct in_addr *, char *);
|
||||
extern void SetDefAccess(struct in_addr *, char *);
|
||||
#else
|
||||
extern REMOTE *FindUniq();
|
||||
extern char AccType();
|
||||
extern void SetDefAccess();
|
||||
#endif
|
||||
extern REMOTE *FindUniq PARAMS((REMOTE *));
|
||||
extern char AccType PARAMS((struct in_addr *, char *));
|
||||
extern void SetDefAccess PARAMS((struct in_addr *, char *));
|
||||
extern void DestroyRemoteConsole PARAMS((REMOTE *));
|
||||
extern void DestroyAccessList PARAMS((ACCESS *));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: client.c,v 5.49 2002-10-12 20:07:43-07 bryan Exp $
|
||||
* $Id: client.c,v 5.58 2003-03-09 13:53:40-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -59,7 +59,7 @@
|
||||
/* find the next guy who wants to write on the console (ksb)
|
||||
*/
|
||||
CONSCLIENT *
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FindWrite(CONSCLIENT * pCL)
|
||||
#else
|
||||
FindWrite(pCL)
|
||||
@ -79,54 +79,16 @@ FindWrite(pCL)
|
||||
pCL->fwantwr = 0;
|
||||
pCL->fwr = 1;
|
||||
if (pCL->pCEto->nolog) {
|
||||
fileWrite(pCL->fd, "\r\n[attached (nologging)]\r\n", -1);
|
||||
FileWrite(pCL->fd, "\r\n[attached (nologging)]\r\n", -1);
|
||||
} else {
|
||||
fileWrite(pCL->fd, "\r\n[attached]\r\n", -1);
|
||||
FileWrite(pCL->fd, "\r\n[attached]\r\n", -1);
|
||||
}
|
||||
tagLogfile(pCL->pCEto, "%s attached", pCL->acid.string);
|
||||
TagLogfile(pCL->pCEto, "%s attached", pCL->acid.string);
|
||||
return pCL;
|
||||
}
|
||||
return (CONSCLIENT *) 0;
|
||||
}
|
||||
|
||||
/* show a character as a string so the user cannot mistake it for (ksb)
|
||||
* another
|
||||
*
|
||||
* must pass us at least 16 characters to put fill with text
|
||||
*/
|
||||
char *
|
||||
#if USE_ANSI_PROTO
|
||||
FmtCtl(int ci, STRING * pcIn)
|
||||
#else
|
||||
FmtCtl(ci, pcIn)
|
||||
int ci;
|
||||
STRING *pcIn;
|
||||
#endif
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
buildMyString((char *)0, pcIn);
|
||||
c = ci & 0xff;
|
||||
if (c > 127) {
|
||||
c -= 128;
|
||||
buildMyString("M-", pcIn);
|
||||
}
|
||||
|
||||
if (c < ' ' || c == '\177') {
|
||||
buildMyStringChar('^', pcIn);
|
||||
buildMyStringChar(c ^ 0100, pcIn);
|
||||
} else if (c == ' ') {
|
||||
buildMyString("<space>", pcIn);
|
||||
} else if (c == '^') {
|
||||
buildMyString("<circumflex>", pcIn);
|
||||
} else if (c == '\\') {
|
||||
buildMyString("<backslash>", pcIn);
|
||||
} else {
|
||||
buildMyStringChar(c, pcIn);
|
||||
}
|
||||
return pcIn->string;
|
||||
}
|
||||
|
||||
/* replay last iBack lines of the log file upon connect to console (ksb)
|
||||
*
|
||||
* NB: we know the console might be spewing when the replay happens,
|
||||
@ -134,7 +96,7 @@ FmtCtl(ci, pcIn)
|
||||
* so we don't drop chars...
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
Replay(CONSFILE * fdLog, CONSFILE * fdOut, int iBack)
|
||||
#else
|
||||
Replay(fdLog, fdOut, iBack)
|
||||
@ -164,17 +126,24 @@ Replay(fdLog, fdOut, iBack)
|
||||
int u;
|
||||
int is_mark;
|
||||
char dummy[4];
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
unsigned long dmallocMarkReplay = 0;
|
||||
#endif
|
||||
|
||||
if ((CONSFILE *) 0 == fdLog) {
|
||||
fileWrite(fdOut, "[no log file on this console]\r\n", -1);
|
||||
FileWrite(fdOut, "[no log file on this console]\r\n", -1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* find the size of the file
|
||||
*/
|
||||
if (0 != fileStat(fdLog, &stLog)) {
|
||||
if (0 != FileStat(fdLog, &stLog)) {
|
||||
return;
|
||||
}
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
dmallocMarkReplay = dmalloc_mark();
|
||||
#endif
|
||||
|
||||
file_pos = stLog.st_size - 1;
|
||||
buf_pos = file_pos + 1;
|
||||
|
||||
@ -208,15 +177,15 @@ Replay(fdLog, fdOut, iBack)
|
||||
#if defined(SEEK_SET)
|
||||
/* PTX and maybe other Posix systems
|
||||
*/
|
||||
if (fileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
|
||||
if (FileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#else
|
||||
if (fileSeek(fdLog, buf_pos, L_SET) < 0) {
|
||||
if (FileSeek(fdLog, buf_pos, L_SET) < 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
#endif
|
||||
if ((r = fileRead(fdLog, buf, BUFSIZ)) <= 0) {
|
||||
if ((r = FileRead(fdLog, buf, BUFSIZ)) <= 0) {
|
||||
goto common_exit;
|
||||
}
|
||||
bp = buf + r;
|
||||
@ -275,10 +244,10 @@ Replay(fdLog, fdOut, iBack)
|
||||
lines[ln].line.used = 0;
|
||||
lines[ln].line.allocated = 0;
|
||||
} else {
|
||||
buildMyString((char *)0, &lines[ln - 1].line);
|
||||
buildMyString(lines[ln].line.string,
|
||||
&lines[ln - 1].line);
|
||||
buildMyString((char *)0, &lines[ln].line);
|
||||
BuildString((char *)0, &lines[ln - 1].line);
|
||||
BuildString(lines[ln].line.string,
|
||||
&lines[ln - 1].line);
|
||||
BuildString((char *)0, &lines[ln].line);
|
||||
}
|
||||
ln--;
|
||||
}
|
||||
@ -299,7 +268,7 @@ Replay(fdLog, fdOut, iBack)
|
||||
if (ln < 0) {
|
||||
ln = 0;
|
||||
}
|
||||
(void)buildMyStringChar(ch, &lines[ln].line);
|
||||
BuildStringChar(ch, &lines[ln].line);
|
||||
|
||||
/* if we've processed "a lot" of data for a line, then bail
|
||||
* why? there must be some very long non-newline terminated
|
||||
@ -343,8 +312,8 @@ Replay(fdLog, fdOut, iBack)
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
(void)fileWrite(fdOut, lines[i].line.string, -1);
|
||||
(void)fileWrite(fdOut, " .. ", -1);
|
||||
FileWrite(fdOut, lines[i].line.string, -1);
|
||||
FileWrite(fdOut, " .. ", -1);
|
||||
|
||||
/* build the end string by removing the leading "[-- MARK -- "
|
||||
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
|
||||
@ -355,31 +324,20 @@ Replay(fdLog, fdOut, iBack)
|
||||
if ((char *)0 != s) {
|
||||
*s = '\000';
|
||||
}
|
||||
(void)fileWrite(fdOut, lines[i].mark_end.string + mark_len,
|
||||
-1);
|
||||
(void)fileWrite(fdOut, " -- MARK --]\r\n", -1);
|
||||
FileWrite(fdOut, lines[i].mark_end.string + mark_len, -1);
|
||||
FileWrite(fdOut, " -- MARK --]\r\n", -1);
|
||||
u = lines[i].mark_end.used;
|
||||
s = lines[i].mark_end.string;
|
||||
} else
|
||||
(void)fileWrite(fdOut, lines[i].line.string, -1);
|
||||
FileWrite(fdOut, lines[i].line.string, -1);
|
||||
}
|
||||
|
||||
common_exit:
|
||||
|
||||
if ((struct lines *)0 != lines) {
|
||||
for (i = 0; i < n_lines; i++) {
|
||||
if ((char *)0 != lines[i].mark_end.string) {
|
||||
free(lines[i].mark_end.string);
|
||||
lines[i].mark_end.string = (char *)0;
|
||||
lines[i].mark_end.used = 0;
|
||||
lines[i].mark_end.allocated = 0;
|
||||
}
|
||||
if ((char *)0 != lines[i].line.string) {
|
||||
free(lines[i].line.string);
|
||||
lines[i].line.string = (char *)0;
|
||||
lines[i].line.used = 0;
|
||||
lines[i].line.allocated = 0;
|
||||
}
|
||||
DestroyString(&lines[i].mark_end);
|
||||
DestroyString(&lines[i].line);
|
||||
}
|
||||
free(lines);
|
||||
lines = (struct lines *)0;
|
||||
@ -388,6 +346,10 @@ Replay(fdLog, fdOut, iBack)
|
||||
free(buf);
|
||||
buf = (char *)0;
|
||||
}
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_REPLAY
|
||||
Debug(1, "Replay(): dmalloc / MarkReplay");
|
||||
dmalloc_log_changed(dmallocMarkReplay, 1, 0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -445,7 +407,7 @@ static HELP aHLTable[] = {
|
||||
/* list the commands we know for the user (ksb)
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
HelpUser(CONSCLIENT * pCL)
|
||||
#else
|
||||
HelpUser(pCL)
|
||||
@ -456,52 +418,55 @@ HelpUser(pCL)
|
||||
static char
|
||||
acH1[] = "help]\r\n", acH2[] = "help spy mode]\r\n", acEoln[] =
|
||||
"\r\n";
|
||||
static STRING acLine = { (char *)0, 0, 0 };
|
||||
static STRING *acLine = (STRING *) 0;
|
||||
|
||||
if (acLine == (STRING *) 0)
|
||||
acLine = AllocString();
|
||||
|
||||
iCmp = WHEN_ALWAYS | WHEN_SPY;
|
||||
if (pCL->fwr) {
|
||||
(void)fileWrite(pCL->fd, acH1, sizeof(acH1) - 1);
|
||||
FileWrite(pCL->fd, acH1, sizeof(acH1) - 1);
|
||||
iCmp |= WHEN_ATTACH;
|
||||
} else {
|
||||
(void)fileWrite(pCL->fd, acH2, sizeof(acH2) - 1);
|
||||
FileWrite(pCL->fd, acH2, sizeof(acH2) - 1);
|
||||
}
|
||||
if ('\033' == pCL->ic[0] && 'O' == pCL->ic[1]) {
|
||||
iCmp |= WHEN_VT100;
|
||||
}
|
||||
|
||||
buildMyString((char *)0, &acLine);
|
||||
BuildString((char *)0, acLine);
|
||||
for (i = 0; i < sizeof(aHLTable) / sizeof(HELP); ++i) {
|
||||
if (0 == (aHLTable[i].iwhen & iCmp)) {
|
||||
continue;
|
||||
}
|
||||
if (acLine.used != 0) { /* second part of line */
|
||||
if (acLine->used != 0) { /* second part of line */
|
||||
if (strlen(aHLTable[i].actext) < HALFLINE) {
|
||||
for (j = acLine.used; j <= HALFLINE; ++j) {
|
||||
buildMyStringChar(' ', &acLine);
|
||||
for (j = acLine->used; j <= HALFLINE; ++j) {
|
||||
BuildStringChar(' ', acLine);
|
||||
}
|
||||
buildMyString(aHLTable[i].actext, &acLine);
|
||||
buildMyString(acEoln, &acLine);
|
||||
(void)fileWrite(pCL->fd, acLine.string, -1);
|
||||
buildMyString((char *)0, &acLine);
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
continue;
|
||||
} else {
|
||||
buildMyString(acEoln, &acLine);
|
||||
(void)fileWrite(pCL->fd, acLine.string, -1);
|
||||
buildMyString((char *)0, &acLine);
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
if (acLine.used == 0) { /* at new line */
|
||||
buildMyStringChar(' ', &acLine);
|
||||
buildMyString(aHLTable[i].actext, &acLine);
|
||||
if (acLine.used > HALFLINE) {
|
||||
buildMyString(acEoln, &acLine);
|
||||
(void)fileWrite(pCL->fd, acLine.string, -1);
|
||||
buildMyString((char *)0, &acLine);
|
||||
if (acLine->used == 0) { /* at new line */
|
||||
BuildStringChar(' ', acLine);
|
||||
BuildString(aHLTable[i].actext, acLine);
|
||||
if (acLine->used > HALFLINE) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
BuildString((char *)0, acLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (acLine.used != 0) {
|
||||
buildMyString(acEoln, &acLine);
|
||||
(void)fileWrite(pCL->fd, acLine.string, -1);
|
||||
if (acLine->used != 0) {
|
||||
BuildString(acEoln, acLine);
|
||||
FileWrite(pCL->fd, acLine->string, -1);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: client.h,v 5.25 2002-02-25 14:00:38-08 bryan Exp $
|
||||
* $Id: client.h,v 5.27 2003-03-06 10:13:41-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -78,14 +78,6 @@ typedef struct client { /* Connection Information: */
|
||||
cnct_port; /* where from */
|
||||
} CONSCLIENT;
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern char *FmtCtl(int, STRING *);
|
||||
extern void Replay(CONSFILE *, CONSFILE *, int);
|
||||
extern void HelpUser(CONSCLIENT *);
|
||||
extern CONSCLIENT *FindWrite(CONSCLIENT *);
|
||||
#else
|
||||
extern char *FmtCtl();
|
||||
extern void Replay();
|
||||
extern void HelpUser();
|
||||
extern CONSCLIENT *FindWrite();
|
||||
#endif
|
||||
extern void Replay PARAMS((CONSFILE *, CONSFILE *, int));
|
||||
extern void HelpUser PARAMS((CONSCLIENT *));
|
||||
extern CONSCLIENT *FindWrite PARAMS((CONSCLIENT *));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.c,v 5.92 2002-10-12 20:07:43-07 bryan Exp $
|
||||
* $Id: consent.c,v 5.101 2003-03-09 15:51:15-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -94,7 +94,7 @@ BAUD baud[] = {
|
||||
/* find a baud rate for the string "9600x" -> B9600 (ksb)
|
||||
*/
|
||||
BAUD *
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FindBaud(char *pcMode)
|
||||
#else
|
||||
FindBaud(pcMode)
|
||||
@ -151,7 +151,7 @@ PARITY parity[] = {
|
||||
/* find a parity on the end of a baud "9600even" -> EVEN (ksb)
|
||||
*/
|
||||
PARITY *
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FindParity(char *pcMode)
|
||||
#else
|
||||
FindParity(pcMode)
|
||||
@ -180,7 +180,7 @@ FindParity(pcMode)
|
||||
/* setup a tty device (ksb)
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
TtyDev(CONSENT * pCE)
|
||||
#else
|
||||
TtyDev(pCE)
|
||||
@ -193,7 +193,8 @@ TtyDev(pCE)
|
||||
/* here we should fstat for `read-only' checks
|
||||
*/
|
||||
if (-1 == fstat(pCE->fdtty, &stPerm)) {
|
||||
Error("fstat: %s: %s", pCE->dfile.string, strerror(errno));
|
||||
Error("[%s] fstat(%s(%d)): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
} else if (0 == (stPerm.st_mode & 0222)) {
|
||||
/* any device that is read-only we won't write to
|
||||
*/
|
||||
@ -204,8 +205,8 @@ TtyDev(pCE)
|
||||
* Get terminal attributes
|
||||
*/
|
||||
if (-1 == tcgetattr(pCE->fdtty, &termp)) {
|
||||
Error("tcgetattr: %s(%d): %s", pCE->dfile.string, pCE->fdtty,
|
||||
strerror(errno));
|
||||
Error("[%s] tcgetattr(%s(%d)): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -234,13 +235,13 @@ TtyDev(pCE)
|
||||
termp.c_cc[VTIME] = 1;
|
||||
|
||||
if (-1 == cfsetospeed(&termp, pCE->pbaud->irate)) {
|
||||
Error("cfsetospeed: %s(%d): %s", pCE->dfile.string, pCE->fdtty,
|
||||
strerror(errno));
|
||||
Error("[%s] cfsetospeed(%s(%d)): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (-1 == cfsetispeed(&termp, pCE->pbaud->irate)) {
|
||||
Error("cfsetispeed: %s(%d): %s", pCE->dfile.string, pCE->fdtty,
|
||||
strerror(errno));
|
||||
Error("[%s] cfsetispeed(%s(%d)): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -248,8 +249,8 @@ TtyDev(pCE)
|
||||
* Set terminal attributes
|
||||
*/
|
||||
if (-1 == tcsetattr(pCE->fdtty, TCSADRAIN, &termp)) {
|
||||
Error("tcsetattr: %s(%d): %s", pCE->dfile.string, pCE->fdtty,
|
||||
strerror(errno));
|
||||
Error("[%s] tcsetattr(%s(%d),TCSADRAIN): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# if HAVE_STROPTS_H
|
||||
@ -257,7 +258,7 @@ TtyDev(pCE)
|
||||
* eat all the streams modules upto and including ttcompat
|
||||
*/
|
||||
while (ioctl(pCE->fdtty, I_FIND, "ttcompat") == 1) {
|
||||
(void)ioctl(pCE->fdtty, I_POP, 0);
|
||||
ioctl(pCE->fdtty, I_POP, 0);
|
||||
}
|
||||
# endif
|
||||
pCE->fup = 1;
|
||||
@ -271,7 +272,7 @@ TtyDev(pCE)
|
||||
/* setup a tty device (ksb)
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
TtyDev(CONSENT * pCE)
|
||||
#else
|
||||
TtyDev(pCE)
|
||||
@ -286,7 +287,8 @@ TtyDev(pCE)
|
||||
/* here we should fstat for `read-only' checks
|
||||
*/
|
||||
if (-1 == fstat(pCE->fdtty, &stPerm)) {
|
||||
Error("fstat: %s: %s", pCE->dfile.string, strerror(errno));
|
||||
Error("[%s] fstat(%s(%d)): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
} else if (0 == (stPerm.st_mode & 0222)) {
|
||||
/* any device that is read-only we won't write to
|
||||
*/
|
||||
@ -294,7 +296,8 @@ TtyDev(pCE)
|
||||
}
|
||||
# if defined(TIOCSSOFTCAR)
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCSSOFTCAR, &fSoftcar)) {
|
||||
Error("softcar: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCSSOFTCAR): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
@ -302,8 +305,8 @@ TtyDev(pCE)
|
||||
/* stty 9600 raw cs7
|
||||
*/
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCGETP, (char *)&sty)) {
|
||||
Error("ioctl1: %s(%d): %s", pCE->dfile.string, pCE->fdtty,
|
||||
strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCGETP): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
sty.sg_flags &= ~(ECHO | CRMOD | pCE->pparity->iclr);
|
||||
@ -313,7 +316,8 @@ TtyDev(pCE)
|
||||
sty.sg_ispeed = pCE->pbaud->irate;
|
||||
sty.sg_ospeed = pCE->pbaud->irate;
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCSETP, (char *)&sty)) {
|
||||
Error("ioctl2: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCSETP): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -321,7 +325,8 @@ TtyDev(pCE)
|
||||
* (in cbreak mode we may not need to this... but we do)
|
||||
*/
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCGETC, (char *)&m_tchars)) {
|
||||
Error("ioctl3: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCGETC): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
m_tchars.t_intrc = -1;
|
||||
@ -331,11 +336,13 @@ TtyDev(pCE)
|
||||
m_tchars.t_eofc = -1;
|
||||
m_tchars.t_brkc = -1;
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCSETC, (char *)&m_tchars)) {
|
||||
Error("ioctl4: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCSETC): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCGLTC, (char *)&m_ltchars)) {
|
||||
Error("ioctl5: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCGLTC): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
m_ltchars.t_werasc = -1;
|
||||
@ -344,7 +351,8 @@ TtyDev(pCE)
|
||||
m_ltchars.t_suspc = -1;
|
||||
m_ltchars.t_dsuspc = -1;
|
||||
if (-1 == ioctl(pCE->fdtty, TIOCSLTC, (char *)&m_ltchars)) {
|
||||
Error("ioctl6: %d: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(%s(%d),TIOCSLTC): %s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->fdtty, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
# if HAVE_STROPTS_H
|
||||
@ -365,7 +373,7 @@ TtyDev(pCE)
|
||||
/* setup a virtual device (ksb)
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
VirtDev(CONSENT * pCE)
|
||||
#else
|
||||
VirtDev(pCE)
|
||||
@ -381,12 +389,13 @@ VirtDev(pCE)
|
||||
struct ltchars m_ltchars;
|
||||
# endif
|
||||
# endif
|
||||
int i, iNewGrp;
|
||||
int i;
|
||||
pid_t iNewGrp;
|
||||
extern char **environ;
|
||||
char *pcShell, **ppcArgv;
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
switch (pCE->ipid = fork()) {
|
||||
case -1:
|
||||
@ -395,35 +404,34 @@ VirtDev(pCE)
|
||||
thepid = getpid();
|
||||
break;
|
||||
default:
|
||||
if (fVerbose)
|
||||
Error("%s has pid %d on %s", pCE->server.string, pCE->ipid,
|
||||
pCE->acslave.string);
|
||||
(void)fflush(stderr);
|
||||
Verbose("[%s] pid %lu on %s", pCE->server.string, pCE->ipid,
|
||||
pCE->acslave.string);
|
||||
fflush(stderr);
|
||||
pCE->fup = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* put the signals back that we ignore (trapped auto-reset to default)
|
||||
*/
|
||||
simpleSignal(SIGQUIT, SIG_DFL);
|
||||
simpleSignal(SIGINT, SIG_DFL);
|
||||
simpleSignal(SIGPIPE, SIG_DFL);
|
||||
SimpleSignal(SIGQUIT, SIG_DFL);
|
||||
SimpleSignal(SIGINT, SIG_DFL);
|
||||
SimpleSignal(SIGPIPE, SIG_DFL);
|
||||
#if defined(SIGTTOU)
|
||||
simpleSignal(SIGTTOU, SIG_DFL);
|
||||
SimpleSignal(SIGTTOU, SIG_DFL);
|
||||
#endif
|
||||
#if defined(SIGTTIN)
|
||||
simpleSignal(SIGTTIN, SIG_DFL);
|
||||
SimpleSignal(SIGTTIN, SIG_DFL);
|
||||
#endif
|
||||
#if defined(SIGTSTP)
|
||||
simpleSignal(SIGTSTP, SIG_DFL);
|
||||
SimpleSignal(SIGTSTP, SIG_DFL);
|
||||
#endif
|
||||
#if defined(SIGPOLL)
|
||||
simpleSignal(SIGPOLL, SIG_DFL);
|
||||
SimpleSignal(SIGPOLL, SIG_DFL);
|
||||
#endif
|
||||
|
||||
/* setup new process with clean filew descriptors
|
||||
*/
|
||||
i = cmaxfiles();
|
||||
i = GetMaxFiles();
|
||||
for ( /* i above */ ; --i > 2;) {
|
||||
close(i);
|
||||
}
|
||||
@ -435,7 +443,7 @@ VirtDev(pCE)
|
||||
# if HAVE_SETSID
|
||||
iNewGrp = setsid();
|
||||
if (-1 == iNewGrp) {
|
||||
Error("%s: setsid: %s", pCE->server.string, strerror(errno));
|
||||
Error("[%s] setsid(): %s", pCE->server.string, strerror(errno));
|
||||
iNewGrp = getpid();
|
||||
}
|
||||
# else
|
||||
@ -443,7 +451,7 @@ VirtDev(pCE)
|
||||
# endif
|
||||
|
||||
if (0 != open(pCE->acslave.string, O_RDWR, 0) || 1 != dup(0)) {
|
||||
Error("%s: fd sync error", pCE->server.string);
|
||||
Error("[%s] fd sync error", pCE->server.string);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
# if HAVE_STROPTS_H && !defined(_AIX)
|
||||
@ -451,13 +459,13 @@ VirtDev(pCE)
|
||||
* under PTX (others?) we have to push the compatibility
|
||||
* streams modules `ptem', `ld', and `ttcompat'
|
||||
*/
|
||||
Debug(1, "Pushing ptemp onto pseudo-terminal");
|
||||
(void)ioctl(0, I_PUSH, "ptem");
|
||||
Debug(1, "Pushing ldterm onto pseudo-terminal");
|
||||
(void)ioctl(0, I_PUSH, "ldterm");
|
||||
Debug(1, "Pushing ttcompat onto pseudo-terminal");
|
||||
(void)ioctl(0, I_PUSH, "ttcompat");
|
||||
Debug(1, "Done pushing modules onto pseudo-terminal");
|
||||
Debug(1, "VirtDev(): pushing ptemp onto pseudo-terminal");
|
||||
ioctl(0, I_PUSH, "ptem");
|
||||
Debug(1, "VirtDev(): pushing ldterm onto pseudo-terminal");
|
||||
ioctl(0, I_PUSH, "ldterm");
|
||||
Debug(1, "VirtDev(): pushing ttcompat onto pseudo-terminal");
|
||||
ioctl(0, I_PUSH, "ttcompat");
|
||||
Debug(1, "VirtDev(): done pushing modules onto pseudo-terminal");
|
||||
# endif
|
||||
|
||||
# if HAVE_TERMIOS_H
|
||||
@ -467,7 +475,8 @@ VirtDev(pCE)
|
||||
if (0 != ioctl(0, TCGETS, &n_tio))
|
||||
# endif
|
||||
{
|
||||
Error("ioctl: getsw: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TCGETS): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
n_tio.c_iflag &= ~(IGNCR | IUCLC);
|
||||
@ -493,7 +502,8 @@ VirtDev(pCE)
|
||||
if (0 != ioctl(0, TCSETS, &n_tio))
|
||||
# endif
|
||||
{
|
||||
Error("getattr: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TCSETS): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@ -502,7 +512,8 @@ VirtDev(pCE)
|
||||
/* stty 9600 raw cs7
|
||||
*/
|
||||
if (-1 == ioctl(0, TIOCGETP, (char *)&sty)) {
|
||||
Error("ioctl1: %s: %s", pCE->fdtty, strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCGETP): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
sty.sg_flags &= ~(CBREAK | TANDEM | pCE->pparity->iclr);
|
||||
@ -512,7 +523,8 @@ VirtDev(pCE)
|
||||
sty.sg_ispeed = pCE->pbaud->irate;
|
||||
sty.sg_ospeed = pCE->pbaud->irate;
|
||||
if (-1 == ioctl(0, TIOCSETP, (char *)&sty)) {
|
||||
Error("ioctl2: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCSETP): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@ -520,7 +532,8 @@ VirtDev(pCE)
|
||||
* (in cbreak mode we may not need to this... but we do)
|
||||
*/
|
||||
if (-1 == ioctl(0, TIOCGETC, (char *)&m_tchars)) {
|
||||
Error("ioctl3: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCGETC): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
m_tchars.t_intrc = '\003';
|
||||
@ -530,11 +543,13 @@ VirtDev(pCE)
|
||||
m_tchars.t_eofc = '\004';
|
||||
m_tchars.t_brkc = '\033';
|
||||
if (-1 == ioctl(0, TIOCSETC, (char *)&m_tchars)) {
|
||||
Error("ioctl4: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCSETC): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (-1 == ioctl(0, TIOCGLTC, (char *)&m_ltchars)) {
|
||||
Error("ioctl5: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCGLTC): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
m_ltchars.t_werasc = '\027';
|
||||
@ -543,7 +558,8 @@ VirtDev(pCE)
|
||||
m_ltchars.t_suspc = '\032';
|
||||
m_ltchars.t_dsuspc = '\031';
|
||||
if (-1 == ioctl(0, TIOCSLTC, (char *)&m_ltchars)) {
|
||||
Error("ioctl6: %s", strerror(errno));
|
||||
Error("[%s] ioctl(0,TIOCSLTC): %s", pCE->server.string,
|
||||
strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@ -560,13 +576,13 @@ VirtDev(pCE)
|
||||
# endif /* HAVE_TERMIOS_H */
|
||||
|
||||
close(2);
|
||||
(void)dup(1); /* better be 2, but it is too late now */
|
||||
dup(1); /* better be 2, but it is too late now */
|
||||
|
||||
/* if the command is null we should run root's shell, directly
|
||||
* if we can't find root's shell run /bin/sh
|
||||
*/
|
||||
pcShell = "/bin/sh";
|
||||
if (pCE->pccmd.used == 0 || pCE->pccmd.string[0] == '\000') {
|
||||
if (pCE->pccmd.used <= 1) {
|
||||
static char *apcArgv[] = {
|
||||
"-shell", "-i", (char *)0
|
||||
};
|
||||
@ -586,14 +602,14 @@ VirtDev(pCE)
|
||||
ppcArgv = apcArgv;
|
||||
}
|
||||
execve(pcShell, ppcArgv, environ);
|
||||
Error("execve: %s", strerror(errno));
|
||||
Error("[%s] execve(): %s", pCE->server.string, strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
/* down a console, virtual or real (ksb)
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
ConsDown(CONSENT * pCE, fd_set * pfdSet)
|
||||
#else
|
||||
ConsDown(pCE, pfdSet)
|
||||
@ -602,25 +618,26 @@ ConsDown(pCE, pfdSet)
|
||||
#endif
|
||||
{
|
||||
if (-1 != pCE->ipid) {
|
||||
Debug(1, "Sending pid %d signal %d", pCE->ipid, SIGHUP);
|
||||
Debug(1, "ConsDown(): sending pid %lu signal %d",
|
||||
(unsigned long)pCE->ipid, SIGHUP);
|
||||
kill(pCE->ipid, SIGHUP);
|
||||
pCE->ipid = -1;
|
||||
}
|
||||
if (-1 != pCE->fdtty) {
|
||||
if ((fd_set *) 0 != pfdSet)
|
||||
FD_CLR(pCE->fdtty, pfdSet);
|
||||
(void)close(pCE->fdtty);
|
||||
close(pCE->fdtty);
|
||||
pCE->fdtty = -1;
|
||||
}
|
||||
if ((CONSFILE *) 0 != pCE->fdlog) {
|
||||
if (pCE->nolog) {
|
||||
filePrint(pCE->fdlog,
|
||||
FilePrint(pCE->fdlog,
|
||||
"[-- Console logging restored -- %s]\r\n",
|
||||
strtime(NULL));
|
||||
StrTime(NULL));
|
||||
}
|
||||
filePrint(pCE->fdlog, "[-- Console down -- %s]\r\n",
|
||||
strtime(NULL));
|
||||
fileClose(&pCE->fdlog);
|
||||
FilePrint(pCE->fdlog, "[-- Console down -- %s]\r\n",
|
||||
StrTime(NULL));
|
||||
FileClose(&pCE->fdlog);
|
||||
pCE->fdlog = (CONSFILE *) 0;
|
||||
}
|
||||
pCE->fup = 0;
|
||||
@ -629,7 +646,7 @@ ConsDown(pCE, pfdSet)
|
||||
}
|
||||
|
||||
int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
CheckHostCache(const char *hostname)
|
||||
#else
|
||||
CheckHostCache(hostname)
|
||||
@ -648,7 +665,7 @@ CheckHostCache(hostname)
|
||||
}
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
AddHostCache(const char *hostname)
|
||||
#else
|
||||
AddHostCache(hostname)
|
||||
@ -658,16 +675,16 @@ AddHostCache(hostname)
|
||||
struct hostcache *n;
|
||||
if ((struct hostcache *)0 ==
|
||||
(n = (struct hostcache *)calloc(1, sizeof(struct hostcache)))) {
|
||||
Error("calloc failure: %s", strerror(errno));
|
||||
Error("AddHostCache(): calloc(): %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
buildMyString(hostname, &n->hostname);
|
||||
BuildString(hostname, &n->hostname);
|
||||
n->next = hostcachelist;
|
||||
hostcachelist = n;
|
||||
}
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
ClearHostCache(void)
|
||||
#else
|
||||
ClearHostCache()
|
||||
@ -690,7 +707,7 @@ ClearHostCache()
|
||||
* We also maintian the select set for the caller.
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
ConsInit(CONSENT * pCE, fd_set * pfdSet, int useHostCache)
|
||||
#else
|
||||
ConsInit(pCE, pfdSet, useHostCache)
|
||||
@ -700,7 +717,7 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
#endif
|
||||
{
|
||||
time_t tyme;
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
extern int FallBack(STRING *, STRING *);
|
||||
#else
|
||||
extern int FallBack();
|
||||
@ -714,7 +731,7 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
if (pCE->fup) {
|
||||
ConsDown(pCE, pfdSet);
|
||||
usleep(500000); /* pause 0.50 sec to let things settle a bit */
|
||||
resetMark();
|
||||
ResetMark();
|
||||
}
|
||||
|
||||
pCE->autoReUp = 0;
|
||||
@ -727,15 +744,17 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
*/
|
||||
if ((CONSFILE *) 0 ==
|
||||
(pCE->fdlog =
|
||||
fileOpen(pCE->lfile.string, O_RDWR | O_CREAT | O_APPEND, 0644))) {
|
||||
Error("open: %s: %s", pCE->lfile.string, strerror(errno));
|
||||
FileOpen(pCE->lfile.string, O_RDWR | O_CREAT | O_APPEND, 0644))) {
|
||||
Error("[%s] FileOpen(%s): %s", pCE->server.string,
|
||||
pCE->lfile.string, strerror(errno));
|
||||
return;
|
||||
}
|
||||
filePrint(pCE->fdlog, "[-- Console up -- %s]\r\n", strtime(NULL));
|
||||
FilePrint(pCE->fdlog, "[-- Console up -- %s]\r\n", StrTime(NULL));
|
||||
|
||||
if (0 != pCE->fvirtual) {
|
||||
if (-1 == (pCE->fdtty = FallBack(&pCE->acslave, &pCE->dfile))) {
|
||||
Error("Failed to allocate pseudo-tty: %s", strerror(errno));
|
||||
Error("[%s] failed to allocate pseudo-tty: %s",
|
||||
pCE->server.string, strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
@ -748,60 +767,63 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
struct timeval tv;
|
||||
|
||||
if (CheckHostCache(pCE->networkConsoleHost.string)) {
|
||||
Error("cached previous timeout: %s (%u@%s): forcing down",
|
||||
pCE->server.string, ntohs(port.sin_port),
|
||||
pCE->networkConsoleHost.string);
|
||||
Error("[%s] cached previous timeout: %s: forcing down",
|
||||
pCE->server.string, pCE->networkConsoleHost.string);
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
usleep(100000); /* Not all terminal servers can keep up */
|
||||
resetMark();
|
||||
ResetMark();
|
||||
|
||||
#if HAVE_MEMSET
|
||||
(void)memset((void *)&port, 0, sizeof(port));
|
||||
memset((void *)&port, 0, sizeof(port));
|
||||
#else
|
||||
(void)bzero((char *)&port, sizeof(port));
|
||||
bzero((char *)&port, sizeof(port));
|
||||
#endif
|
||||
|
||||
if ((hp = gethostbyname(pCE->networkConsoleHost.string)) == NULL) {
|
||||
Error("gethostbyname(%s): %s: forcing down",
|
||||
pCE->networkConsoleHost.string, hstrerror(h_errno));
|
||||
Error("[%s] gethostbyname(%s): %s: forcing down",
|
||||
pCE->server.string, pCE->networkConsoleHost.string,
|
||||
hstrerror(h_errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
#if HAVE_MEMCPY
|
||||
(void)memcpy(&port.sin_addr.s_addr, hp->h_addr, hp->h_length);
|
||||
memcpy(&port.sin_addr.s_addr, hp->h_addr, hp->h_length);
|
||||
#else
|
||||
(void)bcopy(hp->h_addr, &port.sin_addr.s_addr, hp->h_length);
|
||||
bcopy(hp->h_addr, &port.sin_addr.s_addr, hp->h_length);
|
||||
#endif
|
||||
port.sin_family = hp->h_addrtype;
|
||||
port.sin_port = htons(pCE->networkConsolePort);
|
||||
|
||||
if ((pCE->fdtty = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
Error("socket: %s", strerror(errno));
|
||||
Error("[%s] socket(AF_INET,SOCK_STREAM): %s",
|
||||
pCE->server.string, strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (setsockopt
|
||||
(pCE->fdtty, SOL_SOCKET, SO_KEEPALIVE, (char *)&one,
|
||||
sizeof(one)) < 0) {
|
||||
Error("setsockopt SO_KEEPALIVE: %s", strerror(errno));
|
||||
Error("[%s] setsockopt(%u,SO_KEEPALIVE): %s",
|
||||
pCE->server.string, pCE->fdtty, strerror(errno));
|
||||
}
|
||||
|
||||
if ((flags = fcntl(pCE->fdtty, F_GETFL)) >= 0) {
|
||||
flags |= O_NONBLOCK;
|
||||
if (fcntl(pCE->fdtty, F_SETFL, flags) < 0) {
|
||||
Error("fcntl O_NONBLOCK: %s", strerror(errno));
|
||||
Error("[%s] fcntl(%u,F_SETFL): %s", pCE->server.string,
|
||||
pCE->fdtty, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
Error("fcntl: %s", strerror(errno));
|
||||
Error("[%s] fcntl(%u,F_GETFL): %s", pCE->server.string,
|
||||
pCE->fdtty, strerror(errno));
|
||||
}
|
||||
|
||||
if (connect(pCE->fdtty, (struct sockaddr *)&port, sizeof(port)) <
|
||||
0) {
|
||||
if (errno != EINPROGRESS) {
|
||||
Error("connect: %s (%u@%s): %s: forcing down",
|
||||
pCE->server.string, ntohs(port.sin_port),
|
||||
pCE->networkConsoleHost.string, strerror(errno));
|
||||
Error("[%s] connect(%u): %s: forcing down",
|
||||
pCE->server.string, pCE->fdtty, strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
@ -813,17 +835,16 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
FD_SET(pCE->fdtty, &fds);
|
||||
|
||||
if ((one = select(pCE->fdtty + 1, NULL, &fds, NULL, &tv)) < 0) {
|
||||
Error("select: %s (%u@%s): %s: forcing down",
|
||||
pCE->server.string, ntohs(port.sin_port),
|
||||
pCE->networkConsoleHost.string, strerror(errno));
|
||||
Error("[%s] select(%u): %s: forcing down", pCE->server.string,
|
||||
pCE->fdtty, strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
|
||||
if (one == 0) { /* Timeout */
|
||||
AddHostCache(pCE->networkConsoleHost.string);
|
||||
Error("timeout: %s (%u@%s): forcing down", pCE->server.string,
|
||||
ntohs(port.sin_port), pCE->networkConsoleHost.string);
|
||||
Error("[%s] connect timeout: forcing down", pCE->server.string,
|
||||
strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
} else { /* Response */
|
||||
@ -836,16 +857,14 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
if (getsockopt
|
||||
(pCE->fdtty, SOL_SOCKET, SO_ERROR, (char *)&flags,
|
||||
&slen) < 0) {
|
||||
Error("getsockopt SO_ERROR: %s (%u@%s): %s: forcing down",
|
||||
pCE->server.string, ntohs(port.sin_port),
|
||||
pCE->networkConsoleHost.string, strerror(errno));
|
||||
Error("[%s] getsockopt(%u,SO_ERROR): %s: forcing down",
|
||||
pCE->server.string, pCE->fdtty, strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
if (flags != 0) {
|
||||
Error("connect: %s (%u@%s): %s: forcing down",
|
||||
pCE->server.string, ntohs(port.sin_port),
|
||||
pCE->networkConsoleHost.string, strerror(flags));
|
||||
Error("[%s] connect(%u): %s: forcing down",
|
||||
pCE->server.string, pCE->fdtty, strerror(flags));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
@ -861,7 +880,8 @@ ConsInit(pCE, pfdSet, useHostCache)
|
||||
} else if (-1 ==
|
||||
(pCE->fdtty =
|
||||
open(pCE->dfile.string, O_RDWR | O_NDELAY, 0600))) {
|
||||
Error("open: %s: %s", pCE->dfile.string, strerror(errno));
|
||||
Error("[%s] open(%s): %s", pCE->server.string, pCE->dfile.string,
|
||||
strerror(errno));
|
||||
ConsDown(pCE, pfdSet);
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: consent.h,v 5.31 2002-09-29 19:04:43-07 bryan Exp $
|
||||
* $Id: consent.h,v 5.35 2003-03-09 15:21:49-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -51,8 +51,6 @@ typedef struct parity { /* a parity bits table */
|
||||
int iclr;
|
||||
} PARITY;
|
||||
|
||||
#define ALARMTIME 60 /* time between chimes */
|
||||
|
||||
typedef struct consent { /* console information */
|
||||
STRING server; /* server name */
|
||||
STRING dfile; /* device file */
|
||||
@ -61,20 +59,20 @@ typedef struct consent { /* console information */
|
||||
PARITY *pparity; /* the parity on this line */
|
||||
int mark; /* Mark (chime) interval */
|
||||
long nextMark; /* Next mark (chime) time */
|
||||
short int breakType; /* break type [1-9] */
|
||||
short breakType; /* break type [1-9] */
|
||||
int autoReUp;
|
||||
|
||||
/* Used if network console */
|
||||
int isNetworkConsole;
|
||||
STRING networkConsoleHost;
|
||||
int networkConsolePort;
|
||||
unsigned short networkConsolePort;
|
||||
int telnetState;
|
||||
|
||||
/* used if virtual console */
|
||||
STRING acslave; /* pseudo-device slave side */
|
||||
int fvirtual; /* is a pty device we use as a console */
|
||||
STRING pccmd; /* virtual console command */
|
||||
int ipid; /* pid of virtual command */
|
||||
pid_t ipid; /* pid of virtual command */
|
||||
|
||||
/* only used in child */
|
||||
int nolog; /* don't log output */
|
||||
@ -82,12 +80,12 @@ typedef struct consent { /* console information */
|
||||
int fdtty; /* the port to talk to machine on */
|
||||
int activitylog; /* log attach/detach/bump */
|
||||
int breaklog; /* log breaks sent */
|
||||
short int fup; /* we setup this line? */
|
||||
short int fronly; /* we can only read this console */
|
||||
short fup; /* we setup this line? */
|
||||
short fronly; /* we can only read this console */
|
||||
struct client *pCLon; /* clients on this console */
|
||||
struct client *pCLwr; /* client that is writting on console */
|
||||
char acline[132 * 2 + 2]; /* max chars we will call a line */
|
||||
short int iend; /* length of data stored in acline */
|
||||
short iend; /* length of data stored in acline */
|
||||
struct consent *pCEnext; /* next console entry */
|
||||
} CONSENT;
|
||||
|
||||
@ -96,20 +94,10 @@ struct hostcache {
|
||||
struct hostcache *next;
|
||||
};
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern PARITY *FindParity(char *);
|
||||
extern BAUD *FindBaud(char *);
|
||||
extern void ConsInit(CONSENT *, fd_set *, int);
|
||||
extern void ConsDown(CONSENT *, fd_set *);
|
||||
extern int CheckHostCache(const char *);
|
||||
extern void AddHostCache(const char *);
|
||||
extern void ClearHostCache(void);
|
||||
#else
|
||||
extern PARITY *FindParity();
|
||||
extern BAUD *FindBaud();
|
||||
extern void ConsInit();
|
||||
extern void ConsDown();
|
||||
extern int CheckHostCache();
|
||||
extern void AddHostCache();
|
||||
extern void ClearHostCache();
|
||||
#endif
|
||||
extern PARITY *FindParity PARAMS((char *));
|
||||
extern BAUD *FindBaud PARAMS((char *));
|
||||
extern void ConsInit PARAMS((CONSENT *, fd_set *, int));
|
||||
extern void ConsDown PARAMS((CONSENT *, fd_set *));
|
||||
extern int CheckHostCache PARAMS((const char *));
|
||||
extern void AddHostCache PARAMS((const char *));
|
||||
extern void ClearHostCache PARAMS((void));
|
||||
|
@ -16,8 +16,13 @@ case "$1" in
|
||||
[ "$master" ] && kill -TERM $master
|
||||
;;
|
||||
|
||||
'restart')
|
||||
master=`ps -ef | grep conserver | awk '$3 == "1"{print $2}'`
|
||||
[ "$master" ] && kill -HUP $master
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 { start | stop }"
|
||||
echo "Usage: $0 { start | stop | restart }"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fallback.c,v 5.46 2002-10-12 20:07:43-07 bryan Exp $
|
||||
* $Id: fallback.c,v 5.52 2003-03-08 08:38:14-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -37,10 +37,10 @@
|
||||
* get a pty for the user (emulate the neato sequent call) (mm)
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
getpseudotty(STRING * slave, STRING * master)
|
||||
#if PROTOTYPES
|
||||
GetPseudoTTY(STRING * slave, STRING * master)
|
||||
#else
|
||||
getpseudotty(slave, master)
|
||||
GetPseudoTTY(slave, master)
|
||||
STRING *slave;
|
||||
STRING *master;
|
||||
#endif
|
||||
@ -54,11 +54,11 @@ getpseudotty(slave, master)
|
||||
if ((char *)0 == (pcName = ttyname(fd))) {
|
||||
return -1;
|
||||
}
|
||||
buildMyString((char *)0, slave);
|
||||
buildMyString(pcName, slave);
|
||||
BuildString((char *)0, slave);
|
||||
BuildString(pcName, slave);
|
||||
|
||||
buildMyString((char *)0, master);
|
||||
buildMyString(pcName, master);
|
||||
BuildString((char *)0, master);
|
||||
BuildString(pcName, master);
|
||||
master->string[7] = 'c';
|
||||
|
||||
return fd;
|
||||
@ -77,10 +77,10 @@ extern int unlockpt();
|
||||
* DYNIX/ptx v4.0
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
getpseudotty(STRING * slave, STRING * master)
|
||||
#if PROTOTYPES
|
||||
GetPseudoTTY(STRING * slave, STRING * master)
|
||||
#else
|
||||
getpseudotty(slave, master)
|
||||
GetPseudoTTY(slave, master)
|
||||
STRING *slave;
|
||||
STRING *master;
|
||||
#endif
|
||||
@ -100,34 +100,36 @@ getpseudotty(slave, master)
|
||||
sigemptyset(&newmask);
|
||||
sigaddset(&newmask, SIGCHLD);
|
||||
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
|
||||
Error("sigprocmask(SIG_BLOCK): %s", strerror(errno));
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_BLOCK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
simpleSignal(SIGCHLD, SIG_DFL);
|
||||
SimpleSignal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
|
||||
grantpt(fd); /* change permission of slave */
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
|
||||
Error("sigprocmask(SIG_SETMASK): %s", strerror(errno));
|
||||
Error("GetPseudoTTY(): sigprocmask(SIG_SETMASK): %s",
|
||||
strerror(errno));
|
||||
#else
|
||||
simpleSignal(SIGCHLD, FlagReapVirt);
|
||||
SimpleSignal(SIGCHLD, FlagReapVirt);
|
||||
#endif
|
||||
|
||||
unlockpt(fd); /* unlock slave */
|
||||
buildMyString((char *)0, master);
|
||||
BuildString((char *)0, master);
|
||||
if ((char *)0 == (pcName = ttyname(fd))) {
|
||||
buildMyString("/dev/ptmx", master);
|
||||
BuildString("/dev/ptmx", master);
|
||||
} else {
|
||||
buildMyString(pcName, master);
|
||||
BuildString(pcName, master);
|
||||
}
|
||||
|
||||
if ((char *)0 == (pcName = ptsname(fd))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
buildMyString((char *)0, slave);
|
||||
buildMyString(pcName, slave);
|
||||
BuildString((char *)0, slave);
|
||||
BuildString(pcName, slave);
|
||||
|
||||
return fd;
|
||||
}
|
||||
@ -148,10 +150,10 @@ static char chartwo[] =
|
||||
* get a pty for the user (emulate the neato sequent call) (ksb)
|
||||
*/
|
||||
static int
|
||||
#if USE_ANSI_PROTO
|
||||
getpseudotty(STRING * slave, STRING * master)
|
||||
#if PROTOTYPES
|
||||
GetPseudoTTY(STRING * slave, STRING * master)
|
||||
#else
|
||||
getpseudotty(slave, master)
|
||||
GetPseudoTTY(slave, master)
|
||||
STRING *slave;
|
||||
STRING *master;
|
||||
#endif
|
||||
@ -195,16 +197,16 @@ getpseudotty(slave, master)
|
||||
acSlave[iIndex] = *pcOne;
|
||||
acSlave[iIndex + 1] = *pcTwo;
|
||||
if (-1 == access(acSlave, F_OK)) {
|
||||
(void)close(fd);
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
buildMyString((char *)0, master);
|
||||
buildMyString(acMaster, master);
|
||||
buildMyString((char *)0, slave);
|
||||
buildMyString(acSlave, slave);
|
||||
BuildString((char *)0, master);
|
||||
BuildString(acMaster, master);
|
||||
BuildString((char *)0, slave);
|
||||
BuildString(acSlave, slave);
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
@ -214,7 +216,7 @@ getpseudotty(slave, master)
|
||||
* get a Joe pty bacause the daemon is not with us, sadly. (ksb)
|
||||
*/
|
||||
int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FallBack(STRING * pcSlave, STRING * pcMaster)
|
||||
#else
|
||||
FallBack(pcSlave, pcMaster)
|
||||
@ -222,15 +224,20 @@ FallBack(pcSlave, pcMaster)
|
||||
#endif
|
||||
{
|
||||
int fd;
|
||||
static STRING pcTSlave = { (char *)0, 0, 0 };
|
||||
static STRING pcTMaster = { (char *)0, 0, 0 };
|
||||
static STRING *pcTSlave = (STRING *) 0;
|
||||
static STRING *pcTMaster = (STRING *) 0;
|
||||
|
||||
if (-1 == (fd = getpseudotty(&pcTSlave, &pcTMaster))) {
|
||||
if (pcTSlave == (STRING *) 0)
|
||||
pcTSlave = AllocString();
|
||||
if (pcTMaster == (STRING *) 0)
|
||||
pcTMaster = AllocString();
|
||||
|
||||
if (-1 == (fd = GetPseudoTTY(pcTSlave, pcTMaster))) {
|
||||
return -1;
|
||||
}
|
||||
buildMyString((char *)0, pcSlave);
|
||||
buildMyString(pcTSlave.string, pcSlave);
|
||||
buildMyString((char *)0, pcMaster);
|
||||
buildMyString(pcTMaster.string, pcMaster);
|
||||
BuildString((char *)0, pcSlave);
|
||||
BuildString(pcTSlave->string, pcSlave);
|
||||
BuildString((char *)0, pcMaster);
|
||||
BuildString(pcTMaster->string, pcMaster);
|
||||
return fd;
|
||||
}
|
||||
|
1315
conserver/group.c
1315
conserver/group.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: group.h,v 5.25 2002-09-20 23:04:45-07 bryan Exp $
|
||||
* $Id: group.h,v 5.30 2003-03-09 15:21:49-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -43,7 +43,7 @@
|
||||
typedef struct grpent { /* group info */
|
||||
unsigned int id; /* uniqueue group id */
|
||||
unsigned short port; /* port group listens on */
|
||||
int pid; /* pid of server for group */
|
||||
pid_t pid; /* pid of server for group */
|
||||
int imembers; /* number of consoles in this group */
|
||||
fd_set rinit; /* descriptor list */
|
||||
CONSENT *pCElist; /* list of consoles in this group */
|
||||
@ -53,24 +53,11 @@ typedef struct grpent { /* group info */
|
||||
struct grpent *pGEnext; /* next group entry */
|
||||
} GRPENT;
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern void Spawn(GRPENT *);
|
||||
extern int CheckPass(char *, char *);
|
||||
extern const char *strtime(time_t *);
|
||||
extern void tagLogfile(const CONSENT *, const char *, ...);
|
||||
extern void cleanupBreak(short int);
|
||||
extern void destroyGroup(GRPENT *);
|
||||
extern void destroyConsent(GRPENT *, CONSENT *);
|
||||
extern void SendClientsMsg(CONSENT *, char *);
|
||||
extern void resetMark(void);
|
||||
#else
|
||||
extern void Spawn();
|
||||
extern int CheckPass();
|
||||
extern const char *strtime();
|
||||
extern void tagLogfile();
|
||||
extern void cleanupBreak();
|
||||
extern void destroyGroup();
|
||||
extern void destroyConsent();
|
||||
extern void SendClientsMsg();
|
||||
extern void resetMark();
|
||||
#endif
|
||||
extern void Spawn PARAMS((GRPENT *));
|
||||
extern int CheckPass PARAMS((char *, char *));
|
||||
extern void TagLogfile PARAMS((const CONSENT *, const 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));
|
||||
|
509
conserver/main.c
509
conserver/main.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.c,v 5.106 2003-01-08 17:18:59-08 bryan Exp $
|
||||
* $Id: main.c,v 5.120 2003-03-09 15:20:43-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -53,8 +53,8 @@
|
||||
#include <readcfg.h>
|
||||
#include <version.h>
|
||||
|
||||
int fAll = 0, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fVersion =
|
||||
0, fStrip = 0, fDaemon = 0, fUseLogfile = 0, fReopen = 0, fReopenall =
|
||||
int fAll = 0, fSoftcar = 0, fNoinit = 0, fVersion = 0, fStrip =
|
||||
0, fDaemon = 0, fUseLogfile = 0, fReopen = 0, fReopenall =
|
||||
0, fNoautoreup = 0, fNoredir = 0;
|
||||
|
||||
char chDefAcc = 'r';
|
||||
@ -64,13 +64,14 @@ char *pcConfig = CONFIGFILE;
|
||||
char *pcPasswd = PASSWDFILE;
|
||||
char *pcPort = DEFPORT;
|
||||
char *pcBasePort = DEFBASEPORT;
|
||||
STRING *defaultShell = (STRING *) 0;
|
||||
int domainHack = 0;
|
||||
int isMaster = 1;
|
||||
int cMaxMemb = MAXMEMB;
|
||||
char *pcAddress = NULL;
|
||||
in_addr_t bindAddr;
|
||||
unsigned int bindPort;
|
||||
unsigned int bindBasePort;
|
||||
unsigned short bindPort;
|
||||
unsigned short bindBasePort;
|
||||
|
||||
struct sockaddr_in in_port;
|
||||
struct in_addr acMyAddr;
|
||||
@ -80,12 +81,17 @@ char acMyHost[1024]; /* staff.cc.purdue.edu */
|
||||
SSL_CTX *ctx = (SSL_CTX *) 0;
|
||||
int fReqEncryption = 1;
|
||||
char *pcCredFile = (char *)0;
|
||||
DH *dh512 = (DH *) 0;
|
||||
DH *dh1024 = (DH *) 0;
|
||||
DH *dh2048 = (DH *) 0;
|
||||
DH *dh4096 = (DH *) 0;
|
||||
|
||||
|
||||
DH *
|
||||
#if USE_ANSI_PROTO
|
||||
get_dh512(void)
|
||||
#if PROTOTYPES
|
||||
GetDH512(void)
|
||||
#else
|
||||
get_dh512()
|
||||
GetDH512()
|
||||
#endif
|
||||
{
|
||||
static unsigned char dh512_p[] = {
|
||||
@ -114,10 +120,10 @@ get_dh512()
|
||||
}
|
||||
|
||||
DH *
|
||||
#if USE_ANSI_PROTO
|
||||
get_dh1024(void)
|
||||
#if PROTOTYPES
|
||||
GetDH1024(void)
|
||||
#else
|
||||
get_dh1024()
|
||||
GetDH1024()
|
||||
#endif
|
||||
{
|
||||
static unsigned char dh1024_p[] = {
|
||||
@ -152,10 +158,10 @@ get_dh1024()
|
||||
}
|
||||
|
||||
DH *
|
||||
#if USE_ANSI_PROTO
|
||||
get_dh2048(void)
|
||||
#if PROTOTYPES
|
||||
GetDH2048(void)
|
||||
#else
|
||||
get_dh2048()
|
||||
GetDH2048()
|
||||
#endif
|
||||
{
|
||||
static unsigned char dh2048_p[] = {
|
||||
@ -203,10 +209,10 @@ get_dh2048()
|
||||
}
|
||||
|
||||
DH *
|
||||
#if USE_ANSI_PROTO
|
||||
get_dh4096()
|
||||
#if PROTOTYPES
|
||||
GetDH4096(void)
|
||||
#else
|
||||
get_dh4096(void)
|
||||
GetDH4096()
|
||||
#endif
|
||||
{
|
||||
static unsigned char dh4096_p[] = {
|
||||
@ -280,61 +286,73 @@ get_dh4096(void)
|
||||
}
|
||||
|
||||
DH *
|
||||
#if USE_ANSI_PROTO
|
||||
tmp_dh_callback(SSL * ssl, int is_export, int keylength)
|
||||
#if PROTOTYPES
|
||||
TmpDHCallback(SSL * ssl, int is_export, int keylength)
|
||||
#else
|
||||
tmp_dh_callback(ssl, is_export, keylength)
|
||||
TmpDHCallback(ssl, is_export, keylength)
|
||||
SSL *ssl;
|
||||
int is_export;
|
||||
int keylength;
|
||||
#endif
|
||||
{
|
||||
Debug(1, "TmpDHCallback(): asked for a DH key length %u", keylength);
|
||||
switch (keylength) {
|
||||
case 512:
|
||||
return get_dh512();
|
||||
if (dh512 == (DH *) 0)
|
||||
dh512 = GetDH512();
|
||||
return dh512;
|
||||
case 1024:
|
||||
return get_dh1024();
|
||||
if (dh1024 == (DH *) 0)
|
||||
dh1024 = GetDH1024();
|
||||
return dh1024;
|
||||
case 2048:
|
||||
return get_dh2048();
|
||||
if (dh2048 == (DH *) 0)
|
||||
dh2048 = GetDH2048();
|
||||
return dh2048;
|
||||
default:
|
||||
return get_dh4096();
|
||||
if (dh4096 == (DH *) 0)
|
||||
dh4096 = GetDH4096();
|
||||
return dh4096;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
setupSSL(void)
|
||||
#if PROTOTYPES
|
||||
SetupSSL(void)
|
||||
#else
|
||||
setupSSL()
|
||||
SetupSSL()
|
||||
#endif
|
||||
{
|
||||
if (ctx == (SSL_CTX *) 0) {
|
||||
SSL_load_error_strings();
|
||||
if (!SSL_library_init()) {
|
||||
Error("SSL library initialization failed");
|
||||
Error("SetupSSL(): SSL_library_init() failed");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if ((ctx = SSL_CTX_new(SSLv23_method())) == (SSL_CTX *) 0) {
|
||||
Error("Creating SSL context failed");
|
||||
Error("SetupSSL(): SSL_CTX_new() failed");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (SSL_CTX_set_default_verify_paths(ctx) != 1) {
|
||||
Error("Could not load SSL default CA file and/or directory");
|
||||
Error
|
||||
("SetupSSL(): could not load SSL default CA file and/or directory");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (pcCredFile != (char *)0) {
|
||||
if (SSL_CTX_use_certificate_chain_file(ctx, pcCredFile) != 1) {
|
||||
Error("Could not load SSL certificate from '%s'",
|
||||
pcCredFile);
|
||||
Error
|
||||
("SetupSSL(): could not load SSL certificate from `%s'",
|
||||
pcCredFile);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (SSL_CTX_use_PrivateKey_file
|
||||
(ctx, pcCredFile, SSL_FILETYPE_PEM) != 1) {
|
||||
Error("Could not SSL private key from '%s'", pcCredFile);
|
||||
Error("SetupSSL(): could not SSL private key from `%s'",
|
||||
pcCredFile);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, ssl_verify_callback);
|
||||
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, SSLVerifyCallback);
|
||||
SSL_CTX_set_options(ctx,
|
||||
SSL_OP_ALL | SSL_OP_NO_SSLv2 |
|
||||
SSL_OP_SINGLE_DH_USE);
|
||||
@ -342,21 +360,25 @@ setupSSL()
|
||||
SSL_MODE_ENABLE_PARTIAL_WRITE |
|
||||
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
|
||||
SSL_MODE_AUTO_RETRY);
|
||||
SSL_CTX_set_tmp_dh_callback(ctx, tmp_dh_callback);
|
||||
SSL_CTX_set_tmp_dh_callback(ctx, TmpDHCallback);
|
||||
if (SSL_CTX_set_cipher_list(ctx, "ALL:!LOW:!EXP:!MD5:@STRENGTH") !=
|
||||
1) {
|
||||
Error("Setting SSL cipher list failed");
|
||||
Error("SetupSSL(): setting SSL cipher list failed");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
/* might want to turn this back on at some point, but i can't
|
||||
* see why right now.
|
||||
*/
|
||||
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
reopenLogfile(void)
|
||||
#if PROTOTYPES
|
||||
ReopenLogfile(void)
|
||||
#else
|
||||
reopenLogfile()
|
||||
ReopenLogfile()
|
||||
#endif
|
||||
{
|
||||
/* redirect stdout and stderr to the logfile.
|
||||
@ -370,7 +392,7 @@ reopenLogfile()
|
||||
|
||||
close(1);
|
||||
if (1 != open(pcLogfile, O_WRONLY | O_CREAT | O_APPEND, 0644)) {
|
||||
Error("open: %s: %s", pcLogfile, strerror(errno));
|
||||
Error("ReopenLogfile(): open(%s): %s", pcLogfile, strerror(errno));
|
||||
exit(EX_TEMPFAIL);
|
||||
}
|
||||
close(2);
|
||||
@ -380,10 +402,10 @@ reopenLogfile()
|
||||
/* become a daemon (ksb)
|
||||
*/
|
||||
static void
|
||||
#if USE_ANSI_PROTO
|
||||
daemonize()
|
||||
#if PROTOTYPES
|
||||
Daemonize()
|
||||
#else
|
||||
daemonize()
|
||||
Daemonize()
|
||||
#endif
|
||||
{
|
||||
int res;
|
||||
@ -391,117 +413,123 @@ daemonize()
|
||||
int td;
|
||||
#endif
|
||||
|
||||
simpleSignal(SIGQUIT, SIG_IGN);
|
||||
simpleSignal(SIGINT, SIG_IGN);
|
||||
SimpleSignal(SIGQUIT, SIG_IGN);
|
||||
SimpleSignal(SIGINT, SIG_IGN);
|
||||
#if defined(SIGTTOU)
|
||||
simpleSignal(SIGTTOU, SIG_IGN);
|
||||
SimpleSignal(SIGTTOU, SIG_IGN);
|
||||
#endif
|
||||
#if defined(SIGTTIN)
|
||||
simpleSignal(SIGTTIN, SIG_IGN);
|
||||
SimpleSignal(SIGTTIN, SIG_IGN);
|
||||
#endif
|
||||
#if defined(SIGTSTP)
|
||||
simpleSignal(SIGTSTP, SIG_IGN);
|
||||
SimpleSignal(SIGTSTP, SIG_IGN);
|
||||
#endif
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
switch (res = fork()) {
|
||||
case -1:
|
||||
Error("fork: %s", strerror(errno));
|
||||
Error("Daemonize(): fork(): %s", strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
case 0:
|
||||
thepid = getpid();
|
||||
break;
|
||||
default:
|
||||
exit(EX_OK);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
reopenLogfile();
|
||||
ReopenLogfile();
|
||||
|
||||
/* Further disassociate this process from the terminal
|
||||
* Maybe this will allow you to start a daemon from rsh,
|
||||
* i.e. with no controlling terminal.
|
||||
*/
|
||||
#if HAVE_SETSID
|
||||
(void)setsid();
|
||||
setsid();
|
||||
#else
|
||||
(void)setpgrp(0, getpid());
|
||||
setpgrp(0, getpid());
|
||||
|
||||
/* lose our controlling terminal
|
||||
*/
|
||||
if (-1 != (td = open("/dev/tty", O_RDWR, 0600))) {
|
||||
(void)ioctl(td, TIOCNOTTY, (char *)0);
|
||||
ioctl(td, TIOCNOTTY, (char *)0);
|
||||
close(td);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static char u_terse[] =
|
||||
" [-7dDEFhinRouvV] [-a type] [-m max] [-M addr] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min]";
|
||||
static char *apcLong[] = {
|
||||
"7 strip the high bit of all console data",
|
||||
"a type set the default access type",
|
||||
"b port base port for secondary channel (any by default)",
|
||||
#if HAVE_OPENSSL
|
||||
"c cred load an SSL certificate and key from the PEM encoded file",
|
||||
#else
|
||||
"c cred ignored - encryption not compiled into code",
|
||||
#endif
|
||||
"C config give a new config file to the server process",
|
||||
"d become a daemon, redirecting stdout/stderr to logfile",
|
||||
"D enable debug output, sent to stderr",
|
||||
#if HAVE_OPENSSL
|
||||
"E don't require encrypted client connections",
|
||||
#else
|
||||
"E ignored - encryption not compiled into code",
|
||||
#endif
|
||||
"F do not automatically reinitialize failed consoles",
|
||||
"h output this message",
|
||||
"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)",
|
||||
"n obsolete - see -u",
|
||||
"o reopen downed console on client connect",
|
||||
"O min reopen all downed consoles every <min> minutes",
|
||||
"p port port to listen on",
|
||||
"P passwd give a new passwd file to the server process",
|
||||
"R disable automatic client redirection",
|
||||
"u copy \"unloved\" console data to stdout",
|
||||
"v be verbose on startup",
|
||||
"V output version info",
|
||||
(char *)0
|
||||
};
|
||||
|
||||
/* output a long message to the user (ksb)
|
||||
*/
|
||||
static void
|
||||
#if USE_ANSI_PROTO
|
||||
Usage(char **ppc)
|
||||
#if PROTOTYPES
|
||||
Usage(int wantfull)
|
||||
#else
|
||||
Usage(ppc)
|
||||
char **ppc;
|
||||
Usage(wantfull)
|
||||
int wantfull;
|
||||
#endif
|
||||
{
|
||||
for ( /* passed */ ; (char *)0 != *ppc; ++ppc)
|
||||
fprintf(stderr, "\t%s\n", *ppc);
|
||||
static char u_terse[] =
|
||||
"[-7dDEFhinRouvV] [-a type] [-m max] [-M addr] [-p port] [-b port] [-c cred] [-C config] [-P passwd] [-L logfile] [-O min]";
|
||||
static char *full[] = {
|
||||
"7 strip the high bit of all console data",
|
||||
"a type set the default access type",
|
||||
"b port base port for secondary channel (any by default)",
|
||||
#if HAVE_OPENSSL
|
||||
"c cred load an SSL certificate and key from the PEM encoded file",
|
||||
#else
|
||||
"c cred ignored - encryption not compiled into code",
|
||||
#endif
|
||||
"C config give a new config file to the server process",
|
||||
"d become a daemon, redirecting stdout/stderr to logfile",
|
||||
"D enable debug output, sent to stderr",
|
||||
#if HAVE_OPENSSL
|
||||
"E don't require encrypted client connections",
|
||||
#else
|
||||
"E ignored - encryption not compiled into code",
|
||||
#endif
|
||||
"F do not automatically reinitialize failed consoles",
|
||||
"h output this message",
|
||||
"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)",
|
||||
"n obsolete - see -u",
|
||||
"o reopen downed console on client connect",
|
||||
"O min reopen all downed consoles every <min> minutes",
|
||||
"p port port to listen on",
|
||||
"P passwd give a new passwd file to the server process",
|
||||
"R disable automatic client redirection",
|
||||
"u copy \"unloved\" console data to stdout",
|
||||
"v be verbose on startup",
|
||||
"V output version info",
|
||||
(char *)0
|
||||
};
|
||||
fprintf(stderr, "%s: usage %s\n", progname, u_terse);
|
||||
if (wantfull) {
|
||||
int i;
|
||||
for (i = 0; full[i] != (char *)0; i++)
|
||||
fprintf(stderr, "\t%s\n", full[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* show the user our version info (ksb)
|
||||
*/
|
||||
static void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
Version()
|
||||
#else
|
||||
Version()
|
||||
#endif
|
||||
{
|
||||
static STRING acA1 = { (char *)0, 0, 0 };
|
||||
static STRING acA2 = { (char *)0, 0, 0 };
|
||||
static STRING *acA1 = (STRING *) 0;
|
||||
static STRING *acA2 = (STRING *) 0;
|
||||
int i;
|
||||
char *optionlist[] = {
|
||||
#if HAVE_DMALLOC
|
||||
"dmalloc",
|
||||
#endif
|
||||
#if USE_LIBWRAP
|
||||
"libwrap",
|
||||
#endif
|
||||
@ -517,18 +545,23 @@ Version()
|
||||
(char *)0
|
||||
};
|
||||
|
||||
outputPid = 0;
|
||||
if (acA1 == (STRING *) 0)
|
||||
acA1 = AllocString();
|
||||
if (acA2 == (STRING *) 0)
|
||||
acA2 = AllocString();
|
||||
|
||||
Info("%s", THIS_VERSION);
|
||||
Info("default access type `%c\'", chDefAcc);
|
||||
Info("default escape sequence `%s%s\'", FmtCtl(DEFATTN, &acA1),
|
||||
FmtCtl(DEFESC, &acA2));
|
||||
Info("configuration in `%s\'", pcConfig);
|
||||
Info("password in `%s\'", pcPasswd);
|
||||
Info("logfile is `%s\'", pcLogfile);
|
||||
Info("pidfile is `%s\'", PIDFILE);
|
||||
Info("limited to %d member%s per group", cMaxMemb,
|
||||
cMaxMemb == 1 ? "" : "s");
|
||||
isMultiProc = 0;
|
||||
|
||||
Msg("%s", THIS_VERSION);
|
||||
Msg("default access type `%c'", chDefAcc);
|
||||
Msg("default escape sequence `%s%s'", FmtCtl(DEFATTN, acA1),
|
||||
FmtCtl(DEFESC, acA2));
|
||||
Msg("configuration in `%s'", pcConfig);
|
||||
Msg("password in `%s'", pcPasswd);
|
||||
Msg("logfile is `%s'", pcLogfile);
|
||||
Msg("pidfile is `%s'", PIDFILE);
|
||||
Msg("limited to %d member%s per group", cMaxMemb,
|
||||
cMaxMemb == 1 ? "" : "s");
|
||||
|
||||
/* Look for non-numeric characters */
|
||||
for (i = 0; pcPort[i] != '\000'; i++)
|
||||
@ -538,15 +571,16 @@ Version()
|
||||
if (pcPort[i] == '\000') {
|
||||
/* numeric only */
|
||||
bindPort = atoi(pcPort);
|
||||
Info("on port %u (referenced as `%s')", bindPort, pcPort);
|
||||
Msg("on port %hu (referenced as `%s')", bindPort, pcPort);
|
||||
} else {
|
||||
/* non-numeric only */
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) {
|
||||
Error("getservbyname: %s: %s", pcPort, strerror(errno));
|
||||
Error("Version(): getservbyname(%s): %s", pcPort,
|
||||
strerror(errno));
|
||||
} else {
|
||||
bindPort = ntohs((u_short) pSE->s_port);
|
||||
Info("on port %u (referenced as `%s')", bindPort, pcPort);
|
||||
bindPort = ntohs((unsigned short)pSE->s_port);
|
||||
Msg("on port %hu (referenced as `%s')", bindPort, pcPort);
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,44 +592,91 @@ Version()
|
||||
if (pcBasePort[i] == '\000') {
|
||||
/* numeric only */
|
||||
bindBasePort = atoi(pcBasePort);
|
||||
Info("secondary channel base port %u (referenced as `%s')",
|
||||
bindBasePort, pcBasePort);
|
||||
Msg("secondary channel base port %hu (referenced as `%s')",
|
||||
bindBasePort, pcBasePort);
|
||||
} else {
|
||||
/* non-numeric only */
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 ==
|
||||
(pSE = getservbyname(pcBasePort, "tcp"))) {
|
||||
Error("getservbyname: %s: %s", pcBasePort, strerror(errno));
|
||||
Error("Version(): getservbyname(%s): %s", pcBasePort,
|
||||
strerror(errno));
|
||||
} else {
|
||||
bindBasePort = ntohs((u_short) pSE->s_port);
|
||||
Info("secondary channel base port %u (referenced as `%s')",
|
||||
bindBasePort, pcBasePort);
|
||||
bindBasePort = ntohs((unsigned short)pSE->s_port);
|
||||
Msg("secondary channel base port %hu (referenced as `%s')",
|
||||
bindBasePort, pcBasePort);
|
||||
}
|
||||
}
|
||||
buildMyString((char *)0, &acA1);
|
||||
BuildString((char *)0, acA1);
|
||||
if (optionlist[0] == (char *)0)
|
||||
buildMyString("none", &acA1);
|
||||
BuildString("none", acA1);
|
||||
for (i = 0; optionlist[i] != (char *)0; i++) {
|
||||
if (i == 0)
|
||||
buildMyString(optionlist[i], &acA1);
|
||||
BuildString(optionlist[i], acA1);
|
||||
else {
|
||||
buildMyString(", ", &acA1);
|
||||
buildMyString(optionlist[i], &acA1);
|
||||
BuildString(", ", acA1);
|
||||
BuildString(optionlist[i], acA1);
|
||||
}
|
||||
}
|
||||
Info("options: %s", acA1.string);
|
||||
Info("built with `%s'", CONFIGINVOCATION);
|
||||
Msg("options: %s", acA1->string);
|
||||
Msg("built with `%s'", CONFIGINVOCATION);
|
||||
|
||||
if (fVerbose)
|
||||
printf(COPYRIGHT);
|
||||
exit(EX_OK);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
dumpDataStructures(void)
|
||||
#if PROTOTYPES
|
||||
DestroyDataStructures(void)
|
||||
#else
|
||||
dumpDataStructures()
|
||||
DestroyDataStructures()
|
||||
#endif
|
||||
{
|
||||
GRPENT *pGE;
|
||||
REMOTE *pRC;
|
||||
ACCESS *pAC;
|
||||
|
||||
while (pGroups != (GRPENT *) 0) {
|
||||
pGE = pGroups->pGEnext;
|
||||
DestroyGroup(pGroups);
|
||||
pGroups = pGE;
|
||||
}
|
||||
|
||||
while (pRCList != (REMOTE *) 0) {
|
||||
pRC = pRCList->pRCnext;
|
||||
DestroyRemoteConsole(pRCList);
|
||||
pRCList = pRC;
|
||||
}
|
||||
|
||||
while (pACList != (ACCESS *) 0) {
|
||||
pAC = pACList->pACnext;
|
||||
DestroyAccessList(pACList);
|
||||
pACList = pAC;
|
||||
}
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
if (ctx != (SSL_CTX *) 0)
|
||||
SSL_CTX_free(ctx);
|
||||
if (dh512 != (DH *) 0)
|
||||
DH_free(dh512);
|
||||
if (dh1024 != (DH *) 0)
|
||||
DH_free(dh1024);
|
||||
if (dh2048 != (DH *) 0)
|
||||
DH_free(dh2048);
|
||||
if (dh4096 != (DH *) 0)
|
||||
DH_free(dh4096);
|
||||
#endif
|
||||
|
||||
DestroyBreakList();
|
||||
DestroyStrings();
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DumpDataStructures(void)
|
||||
#else
|
||||
DumpDataStructures()
|
||||
#endif
|
||||
{
|
||||
GRPENT *pGE;
|
||||
@ -607,8 +688,9 @@ dumpDataStructures()
|
||||
return;
|
||||
|
||||
for (pGE = pGroups; pGE != (GRPENT *) 0; pGE = pGE->pGEnext) {
|
||||
Debug(1, "Group: id=%u pid=%d, port=%d, imembers=%d", pGE->id,
|
||||
pGE->port, pGE->pid, pGE->imembers);
|
||||
Debug(1,
|
||||
"DumpDataStructures(): group: id=%u pid=%lu, port=%hu, imembers=%d",
|
||||
pGE->id, pGE->port, (unsigned long)pGE->pid, pGE->imembers);
|
||||
|
||||
for (pCE = pGE->pCElist; pCE != (CONSENT *) 0; pCE = pCE->pCEnext) {
|
||||
if (pCE->pccmd.string == (char *)0)
|
||||
@ -624,29 +706,36 @@ dumpDataStructures()
|
||||
if (pCE->acslave.string == (char *)0)
|
||||
pCE->acslave.string = empty;
|
||||
|
||||
Debug(1, " server=%s, dfile=%s, lfile=%s", pCE->server.string,
|
||||
pCE->dfile.string, pCE->lfile.string);
|
||||
Debug(1, " mark=%d, nextMark=%ld, breakType=%d", pCE->mark,
|
||||
pCE->nextMark, pCE->breakType);
|
||||
Debug(1,
|
||||
"DumpDataStructures(): server=%s, dfile=%s, lfile=%s",
|
||||
pCE->server.string, pCE->dfile.string,
|
||||
pCE->lfile.string);
|
||||
Debug(1,
|
||||
"DumpDataStructures(): mark=%d, nextMark=%ld, breakType=%d",
|
||||
pCE->mark, pCE->nextMark, pCE->breakType);
|
||||
|
||||
Debug(1, " isNetworkConsole=%d, networkConsoleHost=%s",
|
||||
Debug(1,
|
||||
"DumpDataStructures(): isNetworkConsole=%d, networkConsoleHost=%s",
|
||||
pCE->isNetworkConsole, pCE->networkConsoleHost.string);
|
||||
Debug(1,
|
||||
" networkConsolePort=%d, telnetState=%d, autoReup=%d",
|
||||
"DumpDataStructures(): networkConsolePort=%hu, telnetState=%d, autoReup=%d",
|
||||
pCE->networkConsolePort, pCE->telnetState,
|
||||
pCE->autoReUp);
|
||||
|
||||
Debug(1, " baud=%s, parity=%c", pCE->pbaud->acrate,
|
||||
pCE->pparity->ckey);
|
||||
Debug(1, "DumpDataStructures(): baud=%s, parity=%c",
|
||||
pCE->pbaud->acrate, pCE->pparity->ckey);
|
||||
|
||||
Debug(1, " fvirtual=%d, acslave=%s, pccmd=%s, ipid=%d",
|
||||
Debug(1,
|
||||
"DumpDataStructures(): fvirtual=%d, acslave=%s, pccmd=%s, ipid=%lu",
|
||||
pCE->fvirtual, pCE->acslave.string, pCE->pccmd.string,
|
||||
pCE->ipid);
|
||||
(unsigned long)pCE->ipid);
|
||||
|
||||
Debug(1, " nolog=%d, fdtty=%d, activitylog=%d, breaklog=%d",
|
||||
Debug(1,
|
||||
"DumpDataStructures(): nolog=%d, fdtty=%d, activitylog=%d, breaklog=%d",
|
||||
pCE->nolog, pCE->fdtty, pCE->activitylog, pCE->breaklog);
|
||||
Debug(1, " fup=%d, fronly=%d", pCE->fup, pCE->fronly);
|
||||
Debug(1, " ------");
|
||||
Debug(1, "DumpDataStructures(): fup=%d, fronly=%d", pCE->fup,
|
||||
pCE->fronly);
|
||||
Debug(1, "DumpDataStructures(): ------");
|
||||
}
|
||||
}
|
||||
for (pRC = pRCList; (REMOTE *) 0 != pRC; pRC = pRC->pRCnext) {
|
||||
@ -654,8 +743,8 @@ dumpDataStructures()
|
||||
pRC->rserver.string = empty;
|
||||
if (pRC->rhost.string == (char *)0)
|
||||
pRC->rhost.string = empty;
|
||||
Debug(1, "Remote: rserver=%s, rhost =%s", pRC->rserver.string,
|
||||
pRC->rhost.string);
|
||||
Debug(1, "DumpDataStructures(): remote: rserver=%s, rhost =%s",
|
||||
pRC->rserver.string, pRC->rhost.string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,7 +757,7 @@ dumpDataStructures()
|
||||
* exit happy
|
||||
*/
|
||||
int
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
main(int argc, char **argv)
|
||||
#else
|
||||
main(argc, argv)
|
||||
@ -689,7 +778,7 @@ main(argc, argv)
|
||||
GRPENT *pGE;
|
||||
CONSENT *pCE;
|
||||
|
||||
outputPid = 1; /* make sure stuff has the pid */
|
||||
isMultiProc = 1; /* make sure stuff has the pid */
|
||||
|
||||
thepid = getpid();
|
||||
if ((char *)0 == (progname = strrchr(argv[0], '/'))) {
|
||||
@ -698,7 +787,7 @@ main(argc, argv)
|
||||
++progname;
|
||||
}
|
||||
|
||||
(void)setpwent();
|
||||
setpwent();
|
||||
|
||||
#if HAVE_SETLINEBUF
|
||||
setlinebuf(stdout);
|
||||
@ -710,7 +799,7 @@ main(argc, argv)
|
||||
#endif
|
||||
|
||||
|
||||
(void)gethostname(acMyHost, sizeof(acMyHost));
|
||||
gethostname(acMyHost, sizeof(acMyHost));
|
||||
if ((struct hostent *)0 == (hpMe = gethostbyname(acMyHost))) {
|
||||
Error("gethostbyname(%s): %s", acMyHost, hstrerror(h_errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
@ -721,9 +810,9 @@ main(argc, argv)
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
#if HAVE_MEMCPY
|
||||
(void)memcpy(&acMyAddr, hpMe->h_addr, hpMe->h_length);
|
||||
memcpy(&acMyAddr, hpMe->h_addr, hpMe->h_length);
|
||||
#else
|
||||
(void)bcopy(hpMe->h_addr, &acMyAddr, hpMe->h_length);
|
||||
bcopy(hpMe->h_addr, &acMyAddr, hpMe->h_length);
|
||||
#endif
|
||||
|
||||
while (EOF != (i = getopt(argc, argv, acOpts))) {
|
||||
@ -742,7 +831,7 @@ main(argc, argv)
|
||||
case 't':
|
||||
break;
|
||||
default:
|
||||
Error("unknown access type `%s\'", optarg);
|
||||
Error("unknown access type `%s'", optarg);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
@ -773,9 +862,8 @@ main(argc, argv)
|
||||
fNoautoreup = 1;
|
||||
break;
|
||||
case 'h':
|
||||
fprintf(stderr, "%s: usage%s\n", progname, u_terse);
|
||||
Usage(apcLong);
|
||||
exit(EX_OK);
|
||||
Usage(1);
|
||||
Bye(EX_OK);
|
||||
case 'i':
|
||||
fNoinit = 1;
|
||||
break;
|
||||
@ -821,7 +909,7 @@ main(argc, argv)
|
||||
fVerbose = 1;
|
||||
break;
|
||||
case '\?':
|
||||
fprintf(stderr, "%s: usage%s\n", progname, u_terse);
|
||||
Usage(0);
|
||||
exit(EX_UNAVAILABLE);
|
||||
default:
|
||||
Error("option %c needs a parameter", optopt);
|
||||
@ -839,25 +927,35 @@ main(argc, argv)
|
||||
*/
|
||||
close(0);
|
||||
if (0 != open("/dev/null", O_RDWR, 0644)) {
|
||||
Error("open: /dev/null: %s", strerror(errno));
|
||||
Error("open(/dev/null): %s", strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
if (fVersion) {
|
||||
Version();
|
||||
exit(EX_OK);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
if (fDaemon) {
|
||||
daemonize();
|
||||
Daemonize();
|
||||
}
|
||||
|
||||
Info("%s", THIS_VERSION);
|
||||
Msg("%s", THIS_VERSION);
|
||||
|
||||
#if HAVE_GETLOGIN
|
||||
origuser = getlogin();
|
||||
#endif
|
||||
curuid = getuid();
|
||||
|
||||
if (defaultShell == (STRING *) 0)
|
||||
defaultShell = AllocString();
|
||||
if ((pwd = getpwuid(0)) != (struct passwd *)0 &&
|
||||
pwd->pw_shell[0] != '\000') {
|
||||
BuildString(pwd->pw_shell, defaultShell);
|
||||
} else {
|
||||
BuildString("/bin/sh", defaultShell);
|
||||
}
|
||||
|
||||
if ((struct passwd *)0 != (pwd = getpwuid(curuid)))
|
||||
curuser = pwd->pw_name;
|
||||
|
||||
@ -867,20 +965,17 @@ main(argc, argv)
|
||||
|
||||
if (curuser == (char *)0)
|
||||
if (origuser == (char *)0)
|
||||
Info("Started as uid %d by uid %d at %s", curuid, curuid,
|
||||
strtime(NULL));
|
||||
Msg("started as uid %d by uid %d", curuid, curuid);
|
||||
else
|
||||
Info("Started as uid %d by `%s' at %s", curuid, origuser,
|
||||
strtime(NULL));
|
||||
Msg("started as uid %d by `%s'", curuid, origuser);
|
||||
else
|
||||
Info("Started as `%s' by `%s' at %s", curuser,
|
||||
(origuser == (char *)0) ? curuser : origuser, strtime(NULL));
|
||||
(void)endpwent();
|
||||
Msg("started as `%s' by `%s'", curuser,
|
||||
(origuser == (char *)0) ? curuser : origuser);
|
||||
endpwent();
|
||||
|
||||
#if HAVE_GETSPNAM && !HAVE_PAM
|
||||
if (0 != geteuid()) {
|
||||
Error
|
||||
("Warning: Running as a non-root user - any shadow password usage will most likely fail!");
|
||||
Msg("Warning: running as a non-root user - any shadow password usage will most likely fail!");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -889,18 +984,20 @@ main(argc, argv)
|
||||
} else {
|
||||
bindAddr = inet_addr(pcAddress);
|
||||
if (bindAddr == (in_addr_t) (-1)) {
|
||||
Error("inet_addr: %s: %s", pcAddress, "invalid IP address");
|
||||
Error("inet_addr(%s): %s", pcAddress, "invalid IP address");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
acMyAddr.s_addr = bindAddr;
|
||||
}
|
||||
if (fDebug) {
|
||||
struct in_addr ba;
|
||||
ba.s_addr = bindAddr;
|
||||
Debug(1, "Bind address set to `%s'", inet_ntoa(ba));
|
||||
Debug(1, "main(): bind address set to `%s'", inet_ntoa(ba));
|
||||
}
|
||||
|
||||
if (pcPort == NULL) {
|
||||
Error("Severe error: pcPort is NULL???? How can that be?");
|
||||
Error
|
||||
("main(): severe error - pcPort is NULL???? how can that be?");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@ -916,10 +1013,10 @@ main(argc, argv)
|
||||
/* non-numeric only */
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 == (pSE = getservbyname(pcPort, "tcp"))) {
|
||||
Error("getservbyname: %s: %s", pcPort, strerror(errno));
|
||||
Error("getservbyname(%s): %s", pcPort, strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
} else {
|
||||
bindPort = ntohs((u_short) pSE->s_port);
|
||||
bindPort = ntohs((unsigned short)pSE->s_port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -936,39 +1033,28 @@ main(argc, argv)
|
||||
struct servent *pSE;
|
||||
if ((struct servent *)0 ==
|
||||
(pSE = getservbyname(pcBasePort, "tcp"))) {
|
||||
Error("getservbyname: %s: %s", pcBasePort, strerror(errno));
|
||||
Error("getservbyname(%s): %s", pcBasePort, strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
} else {
|
||||
bindBasePort = ntohs((u_short) pSE->s_port);
|
||||
bindBasePort = ntohs((unsigned short)pSE->s_port);
|
||||
}
|
||||
}
|
||||
|
||||
/* read the config file
|
||||
*/
|
||||
if ((FILE *) 0 == (fpConfig = fopen(pcConfig, "r"))) {
|
||||
Error("fopen: %s: %s", pcConfig, strerror(errno));
|
||||
Error("fopen(%s): %s", pcConfig, strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
#if HAVE_FLOCK
|
||||
/* we lock the configuration file so that two identical
|
||||
* conservers will not be running together (but two with
|
||||
* different configurations can run on the same host).
|
||||
*/
|
||||
if (-1 == flock(fileno(fpConfig), LOCK_NB | LOCK_EX)) {
|
||||
Error("%s is locked, won\'t run more than one conserver?",
|
||||
pcConfig);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
ReadCfg(pcConfig, fpConfig);
|
||||
|
||||
if (pGroups == (GRPENT *) 0 && pRCList == (REMOTE *) 0) {
|
||||
Error("No consoles found in configuration file");
|
||||
Error("no consoles found in configuration file");
|
||||
} else {
|
||||
#if HAVE_OPENSSL
|
||||
/* Prep the SSL layer */
|
||||
setupSSL();
|
||||
SetupSSL();
|
||||
#endif
|
||||
|
||||
/* if no one can use us we need to come up with a default
|
||||
@ -985,14 +1071,12 @@ main(argc, argv)
|
||||
|
||||
Spawn(pGE);
|
||||
|
||||
if (fVerbose) {
|
||||
Info("group #%d pid %d on port %u", pGE->id, pGE->pid,
|
||||
ntohs(pGE->port));
|
||||
}
|
||||
Verbose("group #%d pid %lu on port %hu", pGE->id,
|
||||
(unsigned long)pGE->pid, ntohs(pGE->port));
|
||||
for (pCE = pGE->pCElist; pCE != (CONSENT *) 0;
|
||||
pCE = pCE->pCEnext) {
|
||||
if (-1 != pCE->fdtty)
|
||||
(void)close(pCE->fdtty);
|
||||
close(pCE->fdtty);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1000,8 +1084,8 @@ main(argc, argv)
|
||||
ACCESS *pACtmp;
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *) 0;
|
||||
pACtmp = pACtmp->pACnext) {
|
||||
Info("access type '%c' for \"%s\"", pACtmp->ctrust,
|
||||
pACtmp->pcwho);
|
||||
Verbose("access type `%c' for `%s'", pACtmp->ctrust,
|
||||
pACtmp->pcwho);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1011,24 +1095,25 @@ main(argc, argv)
|
||||
if (fVerbose) {
|
||||
REMOTE *pRC;
|
||||
for (pRC = pRCUniq; (REMOTE *) 0 != pRC; pRC = pRC->pRCuniq) {
|
||||
Info("peer server on `%s'", pRC->rhost.string);
|
||||
Verbose("peer server on `%s'", pRC->rhost.string);
|
||||
}
|
||||
}
|
||||
|
||||
(void)fflush(stdout);
|
||||
(void)fflush(stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
Master();
|
||||
|
||||
/* stop putting kids back, and shoot them
|
||||
*/
|
||||
simpleSignal(SIGCHLD, SIG_DFL);
|
||||
SimpleSignal(SIGCHLD, SIG_DFL);
|
||||
SignalKids(SIGTERM);
|
||||
}
|
||||
|
||||
dumpDataStructures();
|
||||
DumpDataStructures();
|
||||
|
||||
Info("Stopped at %s", strtime(NULL));
|
||||
(void)endpwent();
|
||||
(void)fclose(fpConfig);
|
||||
exit(EX_OK);
|
||||
Msg("terminated");
|
||||
endpwent();
|
||||
fclose(fpConfig);
|
||||
Bye(EX_OK);
|
||||
return EX_OK; /* never gets here clears the compiler warning */
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.h,v 5.39 2003-01-08 17:12:38-08 bryan Exp $
|
||||
* $Id: main.h,v 5.45 2003-03-09 15:20:43-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -37,14 +37,15 @@
|
||||
/* program options and stuff
|
||||
*/
|
||||
extern char rcsid[];
|
||||
extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive, fStrip,
|
||||
fDaemon, fReopen, fReopenall, fNoautoreup, fNoredir;
|
||||
extern int fAll, fSoftcar, fNoinit, fInteractive, fStrip, fDaemon, fReopen,
|
||||
fReopenall, fNoautoreup, fNoredir;
|
||||
extern char chDefAcc;
|
||||
extern in_addr_t bindAddr;
|
||||
extern unsigned int bindPort, bindBasePort;
|
||||
extern unsigned short bindPort, bindBasePort;
|
||||
extern char *pcLogfile;
|
||||
extern char *pcConfig;
|
||||
extern char *pcPasswd;
|
||||
extern STRING *defaultShell;
|
||||
extern int cMaxMemb;
|
||||
extern struct sockaddr_in in_port;
|
||||
extern char acMyHost[];
|
||||
@ -55,10 +56,5 @@ extern int isMaster;
|
||||
extern SSL_CTX *ctx;
|
||||
extern int fReqEncryption;
|
||||
#endif
|
||||
#if USE_ANSI_PROTO
|
||||
extern void reopenLogfile(void);
|
||||
extern void dumpDataStructures(void);
|
||||
#else
|
||||
extern void reopenLogfile();
|
||||
extern void dumpDataStructures();
|
||||
#endif
|
||||
extern void ReopenLogfile PARAMS((void));
|
||||
extern void DumpDataStructures PARAMS((void));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.c,v 5.82 2003-01-08 17:18:44-08 bryan Exp $
|
||||
* $Id: master.c,v 5.91 2003-03-10 17:37:04-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -66,7 +66,7 @@ static sig_atomic_t fSawQuit = 0, fSawHUP = 0, fSawUSR2 = 0, fSawUSR1 =
|
||||
|
||||
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagSawCHLD(int sig)
|
||||
#else
|
||||
FlagSawCHLD(sig)
|
||||
@ -75,7 +75,7 @@ FlagSawCHLD(sig)
|
||||
{
|
||||
fSawCHLD = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGCHLD, FlagSawCHLD);
|
||||
SimpleSignal(SIGCHLD, FlagSawCHLD);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -83,13 +83,13 @@ FlagSawCHLD(sig)
|
||||
* Called when master process receives SIGCHLD
|
||||
*/
|
||||
static void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FixKids()
|
||||
#else
|
||||
FixKids()
|
||||
#endif
|
||||
{
|
||||
int pid;
|
||||
pid_t pid;
|
||||
int UWbuf;
|
||||
GRPENT *pGE;
|
||||
|
||||
@ -114,36 +114,30 @@ FixKids()
|
||||
fSawQuit = 1;
|
||||
/* So we don't kill something that's dead */
|
||||
pGE->pid = -1;
|
||||
Info("%s: exit(%d), shutdown [%s]",
|
||||
pGE->pCElist->server.string, WEXITSTATUS(UWbuf),
|
||||
strtime(NULL));
|
||||
Msg("[%s] exit(%d), shutdown", pGE->pCElist->server.string,
|
||||
WEXITSTATUS(UWbuf));
|
||||
break;
|
||||
}
|
||||
if (WIFSIGNALED(UWbuf) && (WTERMSIG(UWbuf) == SIGTERM)) {
|
||||
fSawQuit = 1;
|
||||
/* So we don't kill something that's dead */
|
||||
pGE->pid = -1;
|
||||
Info("%s: signal(%d), shutdown [%s]",
|
||||
pGE->pCElist->server.string, WTERMSIG(UWbuf),
|
||||
strtime(NULL));
|
||||
Msg("[%s] signal(%d), shutdown",
|
||||
pGE->pCElist->server.string, WTERMSIG(UWbuf));
|
||||
break;
|
||||
}
|
||||
|
||||
/* If not, then just a simple restart of the child */
|
||||
if (WIFEXITED(UWbuf))
|
||||
Info("%s(%d): exit(%d), restarted [%s]", progname, pid,
|
||||
WEXITSTATUS(UWbuf), strtime(NULL));
|
||||
Msg("[%s] exit(%d), restarted", WEXITSTATUS(UWbuf));
|
||||
if (WIFSIGNALED(UWbuf))
|
||||
Info("%s(%d): signal(%d), restarted [%s]", progname, pid,
|
||||
WTERMSIG(UWbuf), strtime(NULL));
|
||||
Msg("[%s] signal(%d), restarted", WTERMSIG(UWbuf));
|
||||
|
||||
/* this kid kid is dead, start another
|
||||
*/
|
||||
Spawn(pGE);
|
||||
if (fVerbose) {
|
||||
Info("group #%d pid %d on port %u", pGE->id, pGE->pid,
|
||||
ntohs(pGE->port));
|
||||
}
|
||||
Verbose("group #%d pid %lu on port %hu", pGE->id,
|
||||
(unsigned long)pGE->pid, ntohs(pGE->port));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,7 +146,7 @@ FixKids()
|
||||
* Called when master process receives SIGTERM
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagQuitIt(int arg)
|
||||
#else
|
||||
FlagQuitIt(arg)
|
||||
@ -161,7 +155,7 @@ FlagQuitIt(arg)
|
||||
{
|
||||
fSawQuit = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGTERM, FlagQuitIt);
|
||||
SimpleSignal(SIGTERM, FlagQuitIt);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -169,7 +163,7 @@ FlagQuitIt(arg)
|
||||
* want to do something special on SIGINT at some point.
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagSawINT(int arg)
|
||||
#else
|
||||
FlagSawINT(arg)
|
||||
@ -178,12 +172,12 @@ FlagSawINT(arg)
|
||||
{
|
||||
fSawQuit = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGINT, FlagSawINT);
|
||||
SimpleSignal(SIGINT, FlagSawINT);
|
||||
#endif
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagSawHUP(int arg)
|
||||
#else
|
||||
FlagSawHUP(arg)
|
||||
@ -192,12 +186,12 @@ FlagSawHUP(arg)
|
||||
{
|
||||
fSawHUP = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGHUP, FlagSawHUP);
|
||||
SimpleSignal(SIGHUP, FlagSawHUP);
|
||||
#endif
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagSawUSR2(int arg)
|
||||
#else
|
||||
FlagSawUSR2(arg)
|
||||
@ -206,12 +200,12 @@ FlagSawUSR2(arg)
|
||||
{
|
||||
fSawUSR2 = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGUSR2, FlagSawUSR2);
|
||||
SimpleSignal(SIGUSR2, FlagSawUSR2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
FlagSawUSR1(int arg)
|
||||
#else
|
||||
FlagSawUSR1(arg)
|
||||
@ -220,14 +214,14 @@ FlagSawUSR1(arg)
|
||||
{
|
||||
fSawUSR1 = 1;
|
||||
#if !HAVE_SIGACTION
|
||||
simpleSignal(SIGUSR1, FlagSawUSR1);
|
||||
SimpleSignal(SIGUSR1, FlagSawUSR1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Signal all the kids...
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
SignalKids(int arg)
|
||||
#else
|
||||
SignalKids(arg)
|
||||
@ -239,9 +233,11 @@ SignalKids(arg)
|
||||
for (pGE = pGroups; pGE != (GRPENT *) 0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers || -1 == pGE->pid)
|
||||
continue;
|
||||
Debug(1, "Sending pid %d signal %d", pGE->pid, arg);
|
||||
Debug(1, "SignalKids(): sending pid %lu signal %d",
|
||||
(unsigned long)pGE->pid, arg);
|
||||
if (-1 == kill(pGE->pid, arg)) {
|
||||
Error("kill: %s", strerror(errno));
|
||||
Error("SignalKids(): kill(%lu): %s", (unsigned long)pGE->pid,
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,7 +246,7 @@ SignalKids(arg)
|
||||
/* this routine is used by the master console server process (ksb)
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
Master(void)
|
||||
#else
|
||||
Master()
|
||||
@ -269,7 +265,7 @@ Master()
|
||||
unsigned char acIn[1024]; /* a command to the master is limited to this */
|
||||
struct sockaddr_in master_port, response_port;
|
||||
int true = 1;
|
||||
int pid, parentpid;
|
||||
pid_t pid, parentpid;
|
||||
char *ambiguous = (char *)0;
|
||||
GRPENT *pGE;
|
||||
CONSENT *pCE;
|
||||
@ -277,63 +273,65 @@ Master()
|
||||
|
||||
|
||||
/* set up signal handler */
|
||||
simpleSignal(SIGPIPE, SIG_IGN);
|
||||
simpleSignal(SIGQUIT, SIG_IGN);
|
||||
SimpleSignal(SIGPIPE, SIG_IGN);
|
||||
SimpleSignal(SIGQUIT, SIG_IGN);
|
||||
#if defined(SIGTTOU)
|
||||
simpleSignal(SIGTTOU, SIG_IGN);
|
||||
SimpleSignal(SIGTTOU, SIG_IGN);
|
||||
#endif
|
||||
#if defined(SIGTTIN)
|
||||
simpleSignal(SIGTTIN, SIG_IGN);
|
||||
SimpleSignal(SIGTTIN, SIG_IGN);
|
||||
#endif
|
||||
#if defined(SIGPOLL)
|
||||
simpleSignal(SIGPOLL, SIG_IGN);
|
||||
SimpleSignal(SIGPOLL, SIG_IGN);
|
||||
#endif
|
||||
simpleSignal(SIGCHLD, FlagSawCHLD);
|
||||
simpleSignal(SIGTERM, FlagQuitIt);
|
||||
simpleSignal(SIGUSR1, FlagSawUSR1);
|
||||
simpleSignal(SIGHUP, FlagSawHUP);
|
||||
simpleSignal(SIGUSR2, FlagSawUSR2);
|
||||
simpleSignal(SIGINT, FlagSawINT);
|
||||
SimpleSignal(SIGCHLD, FlagSawCHLD);
|
||||
SimpleSignal(SIGTERM, FlagQuitIt);
|
||||
SimpleSignal(SIGUSR1, FlagSawUSR1);
|
||||
SimpleSignal(SIGHUP, FlagSawHUP);
|
||||
SimpleSignal(SIGUSR2, FlagSawUSR2);
|
||||
SimpleSignal(SIGINT, FlagSawINT);
|
||||
|
||||
/* set up port for master to listen on
|
||||
*/
|
||||
#if HAVE_MEMSET
|
||||
(void)memset((void *)&master_port, 0, sizeof(master_port));
|
||||
memset((void *)&master_port, 0, sizeof(master_port));
|
||||
#else
|
||||
(void)bzero((char *)&master_port, sizeof(master_port));
|
||||
bzero((char *)&master_port, sizeof(master_port));
|
||||
#endif
|
||||
master_port.sin_family = AF_INET;
|
||||
master_port.sin_addr.s_addr = bindAddr;
|
||||
master_port.sin_port = htons(bindPort);
|
||||
|
||||
if ((msfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
Error("socket: %s", strerror(errno));
|
||||
Error("Master(): socket(AF_INET,SOCK_STREAM): %s",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#if HAVE_SETSOCKOPT
|
||||
if (setsockopt
|
||||
(msfd, SOL_SOCKET, SO_REUSEADDR, (char *)&true,
|
||||
sizeof(true)) < 0) {
|
||||
Error("setsockopt: %s", strerror(errno));
|
||||
Error("Master(): setsockopt(%u,SO_REUSEADDR): %s", msfd,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (bind(msfd, (struct sockaddr *)&master_port, sizeof(master_port)) <
|
||||
0) {
|
||||
Error("bind: %s", strerror(errno));
|
||||
Error("Master(): bind(%u): %s", msfd, strerror(errno));
|
||||
return;
|
||||
}
|
||||
if (listen(msfd, SOMAXCONN) < 0) {
|
||||
Error("listen: %s", strerror(errno));
|
||||
Error("Master(): listen(%u): %s", msfd, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
fp = fopen(PIDFILE, "w");
|
||||
if (fp) {
|
||||
fprintf(fp, "%d\n", (int)getpid());
|
||||
fprintf(fp, "%lu\n", (unsigned long)getpid());
|
||||
fclose(fp);
|
||||
} else {
|
||||
Error("can't write pid to %s", PIDFILE);
|
||||
Error("Master(): can't write pid to %s", PIDFILE);
|
||||
}
|
||||
|
||||
FD_ZERO(&rmaster);
|
||||
@ -346,20 +344,20 @@ Master()
|
||||
}
|
||||
if (fSawHUP) {
|
||||
fSawHUP = 0;
|
||||
Info("Processing SIGHUP at %s", strtime(NULL));
|
||||
reopenLogfile();
|
||||
Msg("processing SIGHUP");
|
||||
ReopenLogfile();
|
||||
SignalKids(SIGHUP);
|
||||
ReReadCfg();
|
||||
}
|
||||
if (fSawUSR1) {
|
||||
fSawUSR1 = 0;
|
||||
Info("Processing SIGUSR1 at %s", strtime(NULL));
|
||||
Msg("processing SIGUSR1");
|
||||
SignalKids(SIGUSR1);
|
||||
}
|
||||
if (fSawUSR2) {
|
||||
fSawUSR2 = 0;
|
||||
Info("Processing SIGUSR2 at %s", strtime(NULL));
|
||||
reopenLogfile();
|
||||
Msg("processing SIGUSR2");
|
||||
ReopenLogfile();
|
||||
SignalKids(SIGUSR2);
|
||||
}
|
||||
if (fSawQuit) { /* Something above set the quit flag */
|
||||
@ -372,7 +370,7 @@ Master()
|
||||
select(msfd + 1, &rmask, (fd_set *) 0, (fd_set *) 0,
|
||||
(struct timeval *)0)) {
|
||||
if (errno != EINTR) {
|
||||
Error("select: %s", strerror(errno));
|
||||
Error("Master(): select(): %s", strerror(errno));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -382,12 +380,12 @@ Master()
|
||||
so = sizeof(response_port);
|
||||
cfd = accept(msfd, (struct sockaddr *)&response_port, &so);
|
||||
if (cfd < 0) {
|
||||
Error("accept: %s", strerror(errno));
|
||||
Error("Master(): accept(%u): %s", msfd, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((CONSFILE *) 0 == (csocket = fileOpenFD(cfd, simpleSocket))) {
|
||||
Error("fileOpenFD: %s", strerror(errno));
|
||||
if ((CONSFILE *) 0 == (csocket = FileOpenFD(cfd, simpleSocket))) {
|
||||
Error("Master(): FileOpenFD(%u): %s", cfd, strerror(errno));
|
||||
close(cfd);
|
||||
continue;
|
||||
}
|
||||
@ -397,9 +395,9 @@ Master()
|
||||
request_init(&request, RQ_DAEMON, progname, RQ_FILE, cfd, 0);
|
||||
fromhost(&request);
|
||||
if (!hosts_access(&request)) {
|
||||
fileWrite(csocket, "access from your host refused\r\n",
|
||||
FileWrite(csocket, "access from your host refused\r\n",
|
||||
-1);
|
||||
fileClose(&csocket);
|
||||
FileClose(&csocket);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -407,10 +405,10 @@ Master()
|
||||
|
||||
so = sizeof(in_port);
|
||||
if (-1 ==
|
||||
getpeername(fileFDNum(csocket), (struct sockaddr *)&in_port,
|
||||
getpeername(FileFDNum(csocket), (struct sockaddr *)&in_port,
|
||||
&so)) {
|
||||
fileWrite(csocket, "getpeername failed\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
FileWrite(csocket, "getpeername failed\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
continue;
|
||||
}
|
||||
so = sizeof(in_port.sin_addr);
|
||||
@ -422,33 +420,33 @@ Master()
|
||||
cType = AccType(&in_port.sin_addr, hpPeer->h_name);
|
||||
}
|
||||
if ('r' == cType) {
|
||||
fileWrite(csocket, "access from your host refused\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
FileWrite(csocket, "access from your host refused\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
continue;
|
||||
}
|
||||
|
||||
(void)fflush(stdin);
|
||||
(void)fflush(stderr);
|
||||
fflush(stdin);
|
||||
fflush(stderr);
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
fileWrite(csocket, "fork failed, try again later\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
Error("fork: %s", strerror(errno));
|
||||
FileWrite(csocket, "fork failed, try again later\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
Error("Master(): fork(): %s", strerror(errno));
|
||||
continue;
|
||||
default:
|
||||
#if defined(__CYGWIN__)
|
||||
/* Since we've got all that "special" stuff in the fileClose
|
||||
/* Since we've got all that "special" stuff in the FileClose
|
||||
* routine for getting around a winsock bug, we have to
|
||||
* shut things down differently here. Instead of calling
|
||||
* fileClose (which half-closes the socket as well as just
|
||||
* FileClose (which half-closes the socket as well as just
|
||||
* closing the descriptor), we "unopen" the structure (to
|
||||
* free memory) and then do a regular close. The child (which
|
||||
* writes to the client) will do a fileClose and all the
|
||||
* writes to the client) will do a FileClose and all the
|
||||
* flushing magic will happen. UGH! -bryan
|
||||
*/
|
||||
close(fileUnopen(csocket));
|
||||
close(FileUnopen(csocket));
|
||||
#else
|
||||
fileClose(&csocket);
|
||||
FileClose(&csocket);
|
||||
#endif
|
||||
continue;
|
||||
case 0:
|
||||
@ -460,10 +458,10 @@ Master()
|
||||
/* handle the connection
|
||||
* (port lookup, who, users, or quit)
|
||||
*/
|
||||
fileWrite(csocket, "ok\r\n", -1);
|
||||
FileWrite(csocket, "ok\r\n", -1);
|
||||
for (i = 0; i < sizeof(acIn) - 1; /* i+=nr */ ) {
|
||||
if ((nr =
|
||||
fileRead(csocket, &acIn[i], sizeof(acIn) - 1 - i)) <= 0) {
|
||||
FileRead(csocket, &acIn[i], sizeof(acIn) - 1 - i)) <= 0) {
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < nr; j++, i++) {
|
||||
@ -479,9 +477,9 @@ Master()
|
||||
acIn[i] = '\000';
|
||||
}
|
||||
if (0 == i) {
|
||||
Error("lost connection");
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
Error("Master(): lost connection (%u)", FileFDNum(csocket));
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if ((char *)0 != (pcArgs = strchr((char *)acIn, ':'))) {
|
||||
*pcArgs++ = '\000';
|
||||
@ -501,30 +499,30 @@ Master()
|
||||
};
|
||||
char **ppc;
|
||||
for (ppc = apcHelp; (char *)0 != *ppc; ++ppc) {
|
||||
(void)fileWrite(csocket, *ppc, -1);
|
||||
FileWrite(csocket, *ppc, -1);
|
||||
}
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 == strcmp((char *)acIn, "quit")) {
|
||||
if ('t' == cType) {
|
||||
fileWrite(csocket, "trusted -- terminated\r\n", -1);
|
||||
FileWrite(csocket, "trusted -- terminated\r\n", -1);
|
||||
kill(parentpid, SIGTERM);
|
||||
} else if ((char *)0 == pcArgs) {
|
||||
fileWrite(csocket, "must be trusted to terminate\r\n", -1);
|
||||
FileWrite(csocket, "must be trusted to terminate\r\n", -1);
|
||||
} else if (CheckPass("root", pcArgs) != AUTH_SUCCESS) {
|
||||
fileWrite(csocket, "Sorry.\r\n", -1);
|
||||
FileWrite(csocket, "Sorry.\r\n", -1);
|
||||
} else {
|
||||
fileWrite(csocket, "ok -- terminated\r\n", -1);
|
||||
FileWrite(csocket, "ok -- terminated\r\n", -1);
|
||||
kill(parentpid, SIGTERM);
|
||||
}
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 == strcmp((char *)acIn, "pid")) {
|
||||
filePrint(csocket, "%d\r\n", parentpid);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FilePrint(csocket, "%lu\r\n", (unsigned long)parentpid);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 == strcmp((char *)acIn, "groups")) {
|
||||
int iSep = 1;
|
||||
@ -532,12 +530,12 @@ Master()
|
||||
for (pGE = pGroups; pGE != (GRPENT *) 0; pGE = pGE->pGEnext) {
|
||||
if (0 == pGE->imembers)
|
||||
continue;
|
||||
filePrint(csocket, ":%u" + iSep, ntohs(pGE->port));
|
||||
FilePrint(csocket, ":%hu" + iSep, ntohs(pGE->port));
|
||||
iSep = 0;
|
||||
}
|
||||
fileWrite(csocket, "\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileWrite(csocket, "\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 == strcmp((char *)acIn, "master")) {
|
||||
int iSep = 1;
|
||||
@ -546,43 +544,44 @@ Master()
|
||||
struct sockaddr_in lcl;
|
||||
so = sizeof(lcl);
|
||||
if (-1 ==
|
||||
getsockname(fileFDNum(csocket),
|
||||
getsockname(FileFDNum(csocket),
|
||||
(struct sockaddr *)&lcl, &so)) {
|
||||
fileWrite(csocket,
|
||||
FileWrite(csocket,
|
||||
"getsockname failed, try again later\r\n",
|
||||
-1);
|
||||
Error("getsockname: %s", strerror(errno));
|
||||
Error("Master(): getsockname(%u): %s",
|
||||
FileFDNum(csocket), strerror(errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
filePrint(csocket, "@%s", inet_ntoa(lcl.sin_addr));
|
||||
FilePrint(csocket, "@%s", inet_ntoa(lcl.sin_addr));
|
||||
iSep = 0;
|
||||
}
|
||||
if (!fNoredir) {
|
||||
for (pRC = pRCUniq; (REMOTE *) 0 != pRC;
|
||||
pRC = pRC->pRCuniq) {
|
||||
filePrint(csocket, ":@%s" + iSep, pRC->rhost.string);
|
||||
FilePrint(csocket, ":@%s" + iSep, pRC->rhost.string);
|
||||
iSep = 0;
|
||||
}
|
||||
}
|
||||
fileWrite(csocket, "\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileWrite(csocket, "\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 == strcmp((char *)acIn, "version")) {
|
||||
filePrint(csocket, "version `%s\'\r\n", THIS_VERSION);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FilePrint(csocket, "version `%s'\r\n", THIS_VERSION);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
if (0 != strcmp((char *)acIn, "call")) {
|
||||
fileWrite(csocket, "unknown command\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileWrite(csocket, "unknown command\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
if ((char *)0 == pcArgs) {
|
||||
fileWrite(csocket, "call requires argument\r\n", -1);
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileWrite(csocket, "call requires argument\r\n", -1);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
/* look up the machine to call
|
||||
@ -599,8 +598,8 @@ Master()
|
||||
continue;
|
||||
}
|
||||
prnum = ntohs(pGE->port);
|
||||
ambiguous = buildString(pCE->server.string);
|
||||
ambiguous = buildString(", ");
|
||||
ambiguous = BuildTmpString(pCE->server.string);
|
||||
ambiguous = BuildTmpString(", ");
|
||||
++found;
|
||||
}
|
||||
}
|
||||
@ -608,14 +607,16 @@ Master()
|
||||
* duplicates - a bad state to be in.
|
||||
* Does the readcfg.c code even check for dups?
|
||||
*/
|
||||
for (pRC = pRCList; (REMOTE *) 0 != pRC; pRC = pRC->pRCnext) {
|
||||
if (0 != strcmp(pcArgs, pRC->rserver.string)) {
|
||||
continue;
|
||||
if (!fNoredir || (fNoredir && found == 0)) {
|
||||
for (pRC = pRCList; (REMOTE *) 0 != pRC; pRC = pRC->pRCnext) {
|
||||
if (0 != strcmp(pcArgs, pRC->rserver.string)) {
|
||||
continue;
|
||||
}
|
||||
ambiguous = BuildTmpString(pRC->rserver.string);
|
||||
ambiguous = BuildTmpString(", ");
|
||||
++found;
|
||||
pRCFound = pRC;
|
||||
}
|
||||
ambiguous = buildString(pRC->rserver.string);
|
||||
ambiguous = buildString(", ");
|
||||
++found;
|
||||
pRCFound = pRC;
|
||||
}
|
||||
if (found == 0) { /* Then look for substring matches */
|
||||
for (pGE = pGroups; pGE != (GRPENT *) 0; pGE = pGE->pGEnext) {
|
||||
@ -629,55 +630,59 @@ Master()
|
||||
continue;
|
||||
}
|
||||
prnum = ntohs(pGE->port);
|
||||
ambiguous = buildString(pCE->server.string);
|
||||
ambiguous = buildString(", ");
|
||||
ambiguous = BuildTmpString(pCE->server.string);
|
||||
ambiguous = BuildTmpString(", ");
|
||||
++found;
|
||||
}
|
||||
}
|
||||
/* look for a remote server */
|
||||
/* again, looks for dups with local consoles */
|
||||
for (pRC = pRCList; (REMOTE *) 0 != pRC; pRC = pRC->pRCnext) {
|
||||
if (0 !=
|
||||
strncmp(pcArgs, pRC->rserver.string, strlen(pcArgs))) {
|
||||
continue;
|
||||
if (!fNoredir || (fNoredir && found != 1)) {
|
||||
for (pRC = pRCList; (REMOTE *) 0 != pRC;
|
||||
pRC = pRC->pRCnext) {
|
||||
if (0 !=
|
||||
strncmp(pcArgs, pRC->rserver.string,
|
||||
strlen(pcArgs))) {
|
||||
continue;
|
||||
}
|
||||
ambiguous = BuildTmpString(pRC->rserver.string);
|
||||
ambiguous = BuildTmpString(", ");
|
||||
++found;
|
||||
pRCFound = pRC;
|
||||
}
|
||||
ambiguous = buildString(pRC->rserver.string);
|
||||
ambiguous = buildString(", ");
|
||||
++found;
|
||||
pRCFound = pRC;
|
||||
}
|
||||
}
|
||||
switch (found) {
|
||||
case 0:
|
||||
filePrint(csocket, "console `%s' not found\r\n", pcArgs);
|
||||
FilePrint(csocket, "console `%s' not found\r\n", pcArgs);
|
||||
break;
|
||||
case 1:
|
||||
if ((REMOTE *) 0 != pRCFound) {
|
||||
if (fNoredir) {
|
||||
filePrint(csocket,
|
||||
FilePrint(csocket,
|
||||
"automatic redirection disabled - console on master `%s'\r\n",
|
||||
pRCFound->rhost.string);
|
||||
} else {
|
||||
filePrint(csocket, "@%s\r\n",
|
||||
FilePrint(csocket, "@%s\r\n",
|
||||
pRCFound->rhost.string);
|
||||
}
|
||||
} else {
|
||||
filePrint(csocket, "%u\r\n", prnum);
|
||||
FilePrint(csocket, "%hu\r\n", prnum);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
found = strlen(ambiguous);
|
||||
ambiguous[found - 2] = '\000';
|
||||
filePrint(csocket,
|
||||
FilePrint(csocket,
|
||||
"ambiguous console abbreviation, `%s'\r\n\tchoices are %s\r\n",
|
||||
pcArgs, ambiguous);
|
||||
break;
|
||||
}
|
||||
buildString((char *)0); /* we're done - clean up */
|
||||
BuildTmpString((char *)0); /* we're done - clean up */
|
||||
ambiguous = (char *)0;
|
||||
fileClose(&csocket);
|
||||
exit(EX_OK);
|
||||
FileClose(&csocket);
|
||||
Bye(EX_OK);
|
||||
}
|
||||
|
||||
(void)unlink(PIDFILE);
|
||||
unlink(PIDFILE);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: master.h,v 5.15 2002-09-29 19:05:25-07 bryan Exp $
|
||||
* $Id: master.h,v 5.16 2003-03-06 10:13:41-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -37,10 +37,5 @@
|
||||
/*
|
||||
* stuff the master process needs
|
||||
*/
|
||||
#if USE_ANSI_PROTO
|
||||
extern void Master(void);
|
||||
extern void SignalKids(int);
|
||||
#else
|
||||
extern void Master();
|
||||
extern void SignalKids();
|
||||
#endif
|
||||
extern void Master PARAMS((void));
|
||||
extern void SignalKids PARAMS((int));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: readcfg.c,v 5.90 2003-01-08 17:12:21-08 bryan Exp $
|
||||
* $Id: readcfg.c,v 5.99 2003-03-09 15:20:15-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -67,11 +67,11 @@ static unsigned int groupID = 0;
|
||||
* return 0 on invalid spec, non-zero on valid spec
|
||||
*/
|
||||
int
|
||||
#if USE_ANSI_PROTO
|
||||
parseMark(const char *pcFile, const int iLine, const char *pcMark,
|
||||
#if PROTOTYPES
|
||||
ParseMark(const char *pcFile, const int iLine, const char *pcMark,
|
||||
time_t tyme, CONSENT * pCE)
|
||||
#else
|
||||
parseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
ParseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
const char *pcFile;
|
||||
const int iLine;
|
||||
const char *pcMark;
|
||||
@ -79,7 +79,7 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
CONSENT *pCE;
|
||||
#endif
|
||||
{
|
||||
static STRING mark = { (char *)0, 0, 0 };
|
||||
static STRING *mark = (STRING *) 0;
|
||||
char *p, *n = (char *)0;
|
||||
int activity = 0, bactivity = 0;
|
||||
int factor = 0, pfactor = 0;
|
||||
@ -87,10 +87,14 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
|
||||
if ((pcMark == (char *)0) || (*pcMark == '\000'))
|
||||
return 0;
|
||||
buildMyString((char *)0, &mark);
|
||||
buildMyString(pcMark, &mark);
|
||||
|
||||
for (p = mark.string; *p != '\000'; p++) {
|
||||
if (mark == (STRING *) 0)
|
||||
mark = AllocString();
|
||||
|
||||
BuildString((char *)0, mark);
|
||||
BuildString(pcMark, mark);
|
||||
|
||||
for (p = mark->string; *p != '\000'; p++) {
|
||||
if (*p == 'a' || *p == 'A') {
|
||||
if (n != (char *)0) {
|
||||
Error
|
||||
@ -160,7 +164,7 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
}
|
||||
|
||||
Debug(1,
|
||||
"Mark spec of `%s' parsed: factor=%d, value=%d, activity=%d, bactivity=%d",
|
||||
"ParseMark(): mark spec of `%s' parsed: factor=%d, value=%d, activity=%d, bactivity=%d",
|
||||
pcMark, factor, value, activity, bactivity);
|
||||
|
||||
if (pCE != (CONSENT *) 0) {
|
||||
@ -202,10 +206,10 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
|
||||
* a pointer to the start of the non-space part
|
||||
*/
|
||||
char *
|
||||
#if USE_ANSI_PROTO
|
||||
pruneSpace(char *string)
|
||||
#if PROTOTYPES
|
||||
PruneSpace(char *string)
|
||||
#else
|
||||
pruneSpace(string)
|
||||
PruneSpace(string)
|
||||
char *string;
|
||||
#endif
|
||||
{
|
||||
@ -238,11 +242,30 @@ pruneSpace(string)
|
||||
return string;
|
||||
}
|
||||
|
||||
void
|
||||
#if PROTOTYPES
|
||||
DestroyBreakList(void)
|
||||
#else
|
||||
DestroyBreakList()
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
|
||||
if (breakList == (STRING *) 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
DestroyString(&breakList[i]);
|
||||
}
|
||||
free(breakList);
|
||||
breakList = (STRING *) 0;
|
||||
}
|
||||
|
||||
/* read in the configuration file, fill in all the structs we use (ksb)
|
||||
* to manage the consoles
|
||||
*/
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
ReadCfg(char *pcFile, FILE * fp)
|
||||
#else
|
||||
ReadCfg(pcFile, fp, master)
|
||||
@ -259,20 +282,23 @@ ReadCfg(pcFile, fp, master)
|
||||
GRPENT *pGEstage = (GRPENT *) 0;
|
||||
int iLine;
|
||||
unsigned char *acIn;
|
||||
static STRING acInSave = { (char *)0, 0, 0 };
|
||||
static STRING *acInSave = (STRING *) 0;
|
||||
char *acStart;
|
||||
CONSENT *pCE = (CONSENT *) 0;
|
||||
CONSENT *pCEtmp = (CONSENT *) 0;
|
||||
CONSENT *pCEmatch = (CONSENT *) 0;
|
||||
REMOTE **ppRC;
|
||||
REMOTE *pRCtmp;
|
||||
static STRING LogDirectory = { (char *)0, 0, 0 };
|
||||
static STRING *logDirectory = (STRING *) 0;
|
||||
time_t tyme;
|
||||
static STRING defMark = { (char *)0, 0, 0 };
|
||||
static STRING *defMark = (STRING *) 0;
|
||||
int isStartup = (pGroups == (GRPENT *) 0 && pRCList == (REMOTE *) 0);
|
||||
REMOTE *pRCListOld = (REMOTE *) 0;
|
||||
GRPENT *pGroupsOld = (GRPENT *) 0;
|
||||
CONSCLIENT *pCLtmp = (CONSCLIENT *) 0;
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_READCFG
|
||||
unsigned long dmallocMarkReadCfg = 0;
|
||||
#endif
|
||||
|
||||
/* if we're the master process, this will either be the first time
|
||||
* reading the config file (in which case we'll just build the two
|
||||
@ -292,6 +318,16 @@ ReadCfg(pcFile, fp, master)
|
||||
*
|
||||
* yep, slippery little slope we're walking here. hope we survive!
|
||||
*/
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_READCFG
|
||||
dmallocMarkReadCfg = dmalloc_mark();
|
||||
#endif
|
||||
if (acInSave == (STRING *) 0)
|
||||
acInSave = AllocString();
|
||||
if (logDirectory == (STRING *) 0)
|
||||
logDirectory = AllocString();
|
||||
if (defMark == (STRING *) 0)
|
||||
defMark = AllocString();
|
||||
|
||||
if (!isStartup) {
|
||||
pGroupsOld = pGroups;
|
||||
pRCListOld = pRCList;
|
||||
@ -300,9 +336,9 @@ ReadCfg(pcFile, fp, master)
|
||||
}
|
||||
|
||||
tyme = time((time_t *) 0);
|
||||
buildMyString((char *)0, &defMark);
|
||||
buildMyString((char *)0, &LogDirectory);
|
||||
buildMyString((char *)0, &acInSave);
|
||||
BuildString((char *)0, defMark);
|
||||
BuildString((char *)0, logDirectory);
|
||||
BuildString((char *)0, acInSave);
|
||||
ppRC = &pRCList;
|
||||
|
||||
/* initialize the break lists */
|
||||
@ -313,37 +349,35 @@ ReadCfg(pcFile, fp, master)
|
||||
}
|
||||
} else {
|
||||
for (iLine = 0; iLine < 9; iLine++) {
|
||||
buildMyString((char *)0, &breakList[iLine]);
|
||||
BuildString((char *)0, &breakList[iLine]);
|
||||
}
|
||||
}
|
||||
buildMyString("\\z", &breakList[0]);
|
||||
buildMyString("\\r~^b", &breakList[1]);
|
||||
buildMyString("#.reset -x\\r", &breakList[2]);
|
||||
BuildString("\\z", &breakList[0]);
|
||||
BuildString("\\r~^b", &breakList[1]);
|
||||
BuildString("#.reset -x\\r", &breakList[2]);
|
||||
|
||||
/* nuke the groups lists (should be a noop, but...) */
|
||||
while (pGroups != (GRPENT *) 0) {
|
||||
pGEtmp = pGroups->pGEnext;
|
||||
destroyGroup(pGroups);
|
||||
DestroyGroup(pGroups);
|
||||
pGroups = pGEtmp;
|
||||
}
|
||||
|
||||
/* nuke the remote consoles */
|
||||
while (pRCList != (REMOTE *) 0) {
|
||||
pRCtmp = pRCList->pRCnext;
|
||||
destroyString(&pRCList->rserver);
|
||||
destroyString(&pRCList->rhost);
|
||||
free(pRCList);
|
||||
DestroyRemoteConsole(pRCList);
|
||||
pRCList = pRCtmp;
|
||||
}
|
||||
|
||||
iLine = 0;
|
||||
while ((acIn =
|
||||
(unsigned char *)readLine(fp, &acInSave,
|
||||
(unsigned char *)ReadLine(fp, acInSave,
|
||||
&iLine)) != (unsigned char *)0) {
|
||||
char *pcLine, *pcMode, *pcLog, *pcRem, *pcStart, *pcMark, *pcBreak;
|
||||
char *pcColon;
|
||||
|
||||
acStart = pruneSpace((char *)acIn);
|
||||
acStart = PruneSpace((char *)acIn);
|
||||
|
||||
if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) {
|
||||
break;
|
||||
@ -352,28 +386,29 @@ ReadCfg(pcFile, fp, master)
|
||||
((char *)0 == (pcColon = strchr(acStart, ':')) ||
|
||||
pcColon > pcLine)) {
|
||||
*pcLine++ = '\000';
|
||||
acStart = pruneSpace(acStart);
|
||||
pcLine = pruneSpace(pcLine);
|
||||
acStart = PruneSpace(acStart);
|
||||
pcLine = PruneSpace(pcLine);
|
||||
if (0 == strcmp(acStart, "LOGDIR")) {
|
||||
buildMyString((char *)0, &LogDirectory);
|
||||
buildMyString(pcLine, &LogDirectory);
|
||||
BuildString((char *)0, logDirectory);
|
||||
BuildString(pcLine, logDirectory);
|
||||
} else if (0 == strcmp(acStart, "TIMESTAMP")) {
|
||||
buildMyString((char *)0, &defMark);
|
||||
if (parseMark(pcFile, iLine, pcLine, tyme, NULL)) {
|
||||
buildMyString(pcLine, &defMark);
|
||||
BuildString((char *)0, defMark);
|
||||
if (ParseMark(pcFile, iLine, pcLine, tyme, NULL)) {
|
||||
BuildString(pcLine, defMark);
|
||||
}
|
||||
} else if (0 == strcmp(acStart, "DOMAINHACK")) {
|
||||
domainHack = 1;
|
||||
} else if (0 == strncmp(acStart, "BREAK", 5) &&
|
||||
acStart[5] >= '1' && acStart[5] <= '9' &&
|
||||
acStart[6] == '\000') {
|
||||
Debug(1, "BREAK%c found with `%s'", acStart[5], pcLine);
|
||||
Debug(1, "ReadCfg(): BREAK%c found with `%s'", acStart[5],
|
||||
pcLine);
|
||||
if (pcLine[0] == '\000') {
|
||||
buildMyString((char *)0, &breakList[acStart[5] - '1']);
|
||||
BuildString((char *)0, &breakList[acStart[5] - '1']);
|
||||
} else {
|
||||
buildMyString((char *)0, &breakList[acStart[5] - '1']);
|
||||
buildMyString(pcLine, &breakList[acStart[5] - '1']);
|
||||
cleanupBreak(acStart[5] - '0');
|
||||
BuildString((char *)0, &breakList[acStart[5] - '1']);
|
||||
BuildString(pcLine, &breakList[acStart[5] - '1']);
|
||||
CleanupBreak(acStart[5] - '0');
|
||||
}
|
||||
} else {
|
||||
Error("%s(%d) unknown variable `%s'", pcFile, iLine,
|
||||
@ -391,7 +426,7 @@ ReadCfg(pcFile, fp, master)
|
||||
*pcMode++ = '\000';
|
||||
*pcLog++ = '\000';
|
||||
|
||||
acStart = pruneSpace(acStart);
|
||||
acStart = PruneSpace(acStart);
|
||||
|
||||
/* before going any further, we might was well check for
|
||||
* duplicates. gotta do it somewhere, and we only need
|
||||
@ -455,14 +490,14 @@ ReadCfg(pcFile, fp, master)
|
||||
if (pCEtmp != (CONSENT *) 0)
|
||||
continue;
|
||||
|
||||
pcLine = pruneSpace(pcLine);
|
||||
pcMode = pruneSpace(pcMode);
|
||||
pcLog = pruneSpace(pcLog);
|
||||
pcLine = PruneSpace(pcLine);
|
||||
pcMode = PruneSpace(pcMode);
|
||||
pcLog = PruneSpace(pcLog);
|
||||
|
||||
if ((char *)0 != (pcMark = strchr(pcLog, ':'))) {
|
||||
*pcMark++ = '\000';
|
||||
pcLog = pruneSpace(pcLog);
|
||||
pcMark = pruneSpace(pcMark);
|
||||
pcLog = PruneSpace(pcLog);
|
||||
pcMark = PruneSpace(pcMark);
|
||||
/* Skip null intervals */
|
||||
if (pcMark[0] == '\000')
|
||||
pcMark = (char *)0;
|
||||
@ -473,8 +508,8 @@ ReadCfg(pcFile, fp, master)
|
||||
} else {
|
||||
if ((char *)0 != (pcBreak = strchr(pcMark, ':'))) {
|
||||
*pcBreak++ = '\000';
|
||||
pcMark = pruneSpace(pcMark);
|
||||
pcBreak = pruneSpace(pcBreak);
|
||||
pcMark = PruneSpace(pcMark);
|
||||
pcBreak = PruneSpace(pcBreak);
|
||||
/* Ignore null specs */
|
||||
if (pcMark[0] == '\000')
|
||||
pcMark = (char *)0;
|
||||
@ -492,16 +527,17 @@ ReadCfg(pcFile, fp, master)
|
||||
struct hostent *hpMe;
|
||||
|
||||
*pcRem++ = '\000';
|
||||
pcLine = pruneSpace(pcLine);
|
||||
pcRem = pruneSpace(pcRem);
|
||||
pcLine = PruneSpace(pcLine);
|
||||
pcRem = PruneSpace(pcRem);
|
||||
|
||||
if ((struct hostent *)0 == (hpMe = gethostbyname(pcRem))) {
|
||||
Error("gethostbyname(%s): %s", pcRem, hstrerror(h_errno));
|
||||
Error("ReadCfg(): gethostbyname(%s): %s", pcRem,
|
||||
hstrerror(h_errno));
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
if (4 != hpMe->h_length || AF_INET != hpMe->h_addrtype) {
|
||||
Error
|
||||
("wrong address size (4 != %d) or address family (%d != %d)",
|
||||
("ReadCfg(): wrong address size (4 != %d) or address family (%d != %d)",
|
||||
hpMe->h_length, AF_INET, hpMe->h_addrtype);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
@ -523,15 +559,13 @@ ReadCfg(pcFile, fp, master)
|
||||
if ((REMOTE *) 0 == pRCTemp) {
|
||||
OutOfMem();
|
||||
}
|
||||
buildMyString((char *)0, &pRCTemp->rhost);
|
||||
buildMyString(pcRem, &pRCTemp->rhost);
|
||||
buildMyString((char *)0, &pRCTemp->rserver);
|
||||
buildMyString(acStart, &pRCTemp->rserver);
|
||||
BuildString((char *)0, &pRCTemp->rhost);
|
||||
BuildString(pcRem, &pRCTemp->rhost);
|
||||
BuildString((char *)0, &pRCTemp->rserver);
|
||||
BuildString(acStart, &pRCTemp->rserver);
|
||||
*ppRC = pRCTemp;
|
||||
ppRC = &pRCTemp->pRCnext;
|
||||
if (fVerbose) {
|
||||
Info("%s remote on %s", acStart, pcRem);
|
||||
}
|
||||
Verbose("[%s] remote on %s", acStart, pcRem);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -613,7 +647,7 @@ ReadCfg(pcFile, fp, master)
|
||||
* everything is calloc()ed, so STRING types are ready to rock
|
||||
*/
|
||||
|
||||
buildMyString(acStart, &pCE->server);
|
||||
BuildString(acStart, &pCE->server);
|
||||
|
||||
/*
|
||||
* Here we substitute the console name for any '&' character in the
|
||||
@ -623,27 +657,27 @@ ReadCfg(pcFile, fp, master)
|
||||
pcStart = pcLog;
|
||||
while ((char *)0 != (pcRem = strchr(pcStart, '&'))) {
|
||||
*pcRem = '\000';
|
||||
buildMyString(pcStart, &pCE->lfile);
|
||||
buildMyString(acStart, &pCE->lfile);
|
||||
BuildString(pcStart, &pCE->lfile);
|
||||
BuildString(acStart, &pCE->lfile);
|
||||
pcStart = pcRem + 1;
|
||||
}
|
||||
buildMyString(pcStart, &pCE->lfile);
|
||||
if (LogDirectory.used > 1 && pCE->lfile.used > 1 &&
|
||||
BuildString(pcStart, &pCE->lfile);
|
||||
if (logDirectory->used > 1 && pCE->lfile.used > 1 &&
|
||||
*pCE->lfile.string != '/') {
|
||||
char *p;
|
||||
buildString((char *)0);
|
||||
p = buildString(pCE->lfile.string);
|
||||
buildMyString((char *)0, &pCE->lfile);
|
||||
buildMyString(LogDirectory.string, &pCE->lfile);
|
||||
buildMyStringChar('/', &pCE->lfile);
|
||||
buildMyString(p, &pCE->lfile);
|
||||
buildString((char *)0);
|
||||
BuildTmpString((char *)0);
|
||||
p = BuildTmpString(pCE->lfile.string);
|
||||
BuildString((char *)0, &pCE->lfile);
|
||||
BuildString(logDirectory->string, &pCE->lfile);
|
||||
BuildStringChar('/', &pCE->lfile);
|
||||
BuildString(p, &pCE->lfile);
|
||||
BuildTmpString((char *)0);
|
||||
}
|
||||
|
||||
if (pcMark) {
|
||||
(void)parseMark(pcFile, iLine, pcMark, tyme, pCE);
|
||||
ParseMark(pcFile, iLine, pcMark, tyme, pCE);
|
||||
} else {
|
||||
(void)parseMark(pcFile, iLine, defMark.string, tyme, pCE);
|
||||
ParseMark(pcFile, iLine, defMark->string, tyme, pCE);
|
||||
}
|
||||
|
||||
pCE->breakType = 1;
|
||||
@ -653,8 +687,8 @@ ReadCfg(pcFile, fp, master)
|
||||
if (bt > 9 || bt < 0) {
|
||||
Error("%s(%d) bad break spec `%d'", pcFile, iLine, bt);
|
||||
} else {
|
||||
pCE->breakType = (short int)bt;
|
||||
Debug(1, "breakType set to %d", pCE->breakType);
|
||||
pCE->breakType = (short)bt;
|
||||
Debug(1, "ReadCfg(): breakType set to %d", pCE->breakType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,64 +699,64 @@ ReadCfg(pcFile, fp, master)
|
||||
|
||||
if (pcLine[0] == '!') {
|
||||
char acOut[100];
|
||||
pcLine = pruneSpace(pcLine + 1);
|
||||
pcLine = PruneSpace(pcLine + 1);
|
||||
pCE->isNetworkConsole = 1;
|
||||
pCE->telnetState = 0;
|
||||
buildMyString((char *)0, &pCE->networkConsoleHost);
|
||||
buildMyString(pcLine, &pCE->networkConsoleHost);
|
||||
BuildString((char *)0, &pCE->networkConsoleHost);
|
||||
BuildString(pcLine, &pCE->networkConsoleHost);
|
||||
pCE->networkConsolePort = atoi(pcMode);
|
||||
pCE->fvirtual = 0;
|
||||
buildMyString((char *)0, &pCE->dfile);
|
||||
buildMyString(pCE->networkConsoleHost.string, &pCE->dfile);
|
||||
sprintf(acOut, "/%d", pCE->networkConsolePort);
|
||||
buildMyString(acOut, &pCE->dfile);
|
||||
BuildString((char *)0, &pCE->dfile);
|
||||
BuildString(pCE->networkConsoleHost.string, &pCE->dfile);
|
||||
sprintf(acOut, "/%hu", pCE->networkConsolePort);
|
||||
BuildString(acOut, &pCE->dfile);
|
||||
pCE->pbaud = FindBaud("Netwk");
|
||||
pCE->pparity = FindParity(" ");
|
||||
if (isStartup && fVerbose) {
|
||||
Info("%s is network on %s logged to %s", acStart,
|
||||
pCE->dfile.string, pCE->lfile.string);
|
||||
if (isStartup) {
|
||||
Verbose("[%s] socket on %s logged to %s", acStart,
|
||||
pCE->dfile.string, pCE->lfile.string);
|
||||
}
|
||||
} else if ('|' == pcLine[0]) {
|
||||
pcLine = pruneSpace(pcLine + 1);
|
||||
pcLine = PruneSpace(pcLine + 1);
|
||||
pCE->isNetworkConsole = 0;
|
||||
pCE->telnetState = 0;
|
||||
pCE->fvirtual = 1;
|
||||
buildMyString((char *)0, &pCE->pccmd);
|
||||
buildMyString(pcLine, &pCE->pccmd);
|
||||
buildMyString((char *)0, &pCE->dfile);
|
||||
buildMyString("/dev/null", &pCE->dfile);
|
||||
buildMyString((char *)0, &pCE->acslave);
|
||||
buildMyString("/dev/null", &pCE->acslave);
|
||||
BuildString((char *)0, &pCE->pccmd);
|
||||
BuildString(pcLine, &pCE->pccmd);
|
||||
BuildString((char *)0, &pCE->dfile);
|
||||
BuildString("/dev/null", &pCE->dfile);
|
||||
BuildString((char *)0, &pCE->acslave);
|
||||
BuildString("/dev/null", &pCE->acslave);
|
||||
pCE->pbaud = FindBaud("Local");
|
||||
pCE->pparity = FindParity(" ");
|
||||
if (isStartup && fVerbose) {
|
||||
Info("%s with command `%s' logged to %s", acStart,
|
||||
pCE->pccmd.string, pCE->lfile.string);
|
||||
if (isStartup) {
|
||||
Verbose("[%s] command `%s' logged to %s", acStart,
|
||||
pCE->pccmd.string, pCE->lfile.string);
|
||||
}
|
||||
} else {
|
||||
pCE->isNetworkConsole = 0;
|
||||
pCE->telnetState = 0;
|
||||
pCE->fvirtual = 0;
|
||||
buildMyString((char *)0, &pCE->dfile);
|
||||
buildMyString(pcLine, &pCE->dfile);
|
||||
BuildString((char *)0, &pCE->dfile);
|
||||
BuildString(pcLine, &pCE->dfile);
|
||||
pCE->pbaud = FindBaud(pcMode);
|
||||
if (pCE->pbaud->irate == 0) {
|
||||
Error("%s(%d) invalid baud rate `%s'", pcFile, iLine,
|
||||
pcMode);
|
||||
destroyConsent(pGE, pCE);
|
||||
DestroyConsent(pGE, pCE);
|
||||
continue;
|
||||
}
|
||||
pCE->pparity = FindParity(pcMode);
|
||||
if (isStartup && fVerbose) {
|
||||
Info("%s is on %s (%s%c) logged to %s", acStart,
|
||||
pCE->dfile.string, pCE->pbaud->acrate,
|
||||
pCE->pparity->ckey, pCE->lfile.string);
|
||||
if (isStartup) {
|
||||
Verbose("[%s] %s (%s%c) logged to %s", acStart,
|
||||
pCE->dfile.string, pCE->pbaud->acrate,
|
||||
pCE->pparity->ckey, pCE->lfile.string);
|
||||
}
|
||||
}
|
||||
|
||||
/* ok, now for the hard part of the reread */
|
||||
if (pCEmatch != (CONSENT *) 0) {
|
||||
short int closeMatch = 1;
|
||||
short closeMatch = 1;
|
||||
/* see if the group is already staged */
|
||||
for (pGEtmp = pGEstage; pGEtmp != (GRPENT *) 0;
|
||||
pGEtmp = pGEtmp->pGEnext) {
|
||||
@ -778,7 +812,7 @@ ReadCfg(pcFile, fp, master)
|
||||
}
|
||||
pGEtmp->pCLall = pCLtmp;
|
||||
/* set file descriptors */
|
||||
FD_SET(fileFDNum(pCLtmp->fd), &pGEtmp->rinit);
|
||||
FD_SET(FileFDNum(pCLtmp->fd), &pGEtmp->rinit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -800,7 +834,7 @@ ReadCfg(pcFile, fp, master)
|
||||
}
|
||||
pGEtmp->pCLall = pCLtmp;
|
||||
/* set file descriptors */
|
||||
FD_SET(fileFDNum(pCLtmp->fd), &pGEtmp->rinit);
|
||||
FD_SET(FileFDNum(pCLtmp->fd), &pGEtmp->rinit);
|
||||
}
|
||||
|
||||
/* add the original console to the new group */
|
||||
@ -818,28 +852,28 @@ ReadCfg(pcFile, fp, master)
|
||||
closeMatch = 0;
|
||||
if (pCEmatch->dfile.used && pCE->dfile.used) {
|
||||
if (strcmp(pCEmatch->dfile.string, pCE->dfile.string) != 0) {
|
||||
buildMyString((char *)0, &pCEmatch->dfile);
|
||||
buildMyString(pCE->dfile.string, &pCEmatch->dfile);
|
||||
BuildString((char *)0, &pCEmatch->dfile);
|
||||
BuildString(pCE->dfile.string, &pCEmatch->dfile);
|
||||
if (!pCE->fvirtual)
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->dfile.used || pCE->dfile.used) {
|
||||
buildMyString((char *)0, &pCEmatch->dfile);
|
||||
buildMyString(pCE->dfile.string, &pCEmatch->dfile);
|
||||
BuildString((char *)0, &pCEmatch->dfile);
|
||||
BuildString(pCE->dfile.string, &pCEmatch->dfile);
|
||||
if (!pCE->fvirtual)
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->lfile.used && pCE->lfile.used) {
|
||||
if (strcmp(pCEmatch->lfile.string, pCE->lfile.string) != 0) {
|
||||
buildMyString((char *)0, &pCEmatch->lfile);
|
||||
buildMyString(pCE->lfile.string, &pCEmatch->lfile);
|
||||
fileClose(&pCEmatch->fdlog);
|
||||
BuildString((char *)0, &pCEmatch->lfile);
|
||||
BuildString(pCE->lfile.string, &pCEmatch->lfile);
|
||||
FileClose(&pCEmatch->fdlog);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->lfile.used || pCE->lfile.used) {
|
||||
buildMyString((char *)0, &pCEmatch->lfile);
|
||||
buildMyString(pCE->lfile.string, &pCEmatch->lfile);
|
||||
fileClose(&pCEmatch->fdlog);
|
||||
BuildString((char *)0, &pCEmatch->lfile);
|
||||
BuildString(pCE->lfile.string, &pCEmatch->lfile);
|
||||
FileClose(&pCEmatch->fdlog);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->pbaud != pCE->pbaud) {
|
||||
@ -864,18 +898,17 @@ ReadCfg(pcFile, fp, master)
|
||||
if (strcmp
|
||||
(pCEmatch->networkConsoleHost.string,
|
||||
pCE->networkConsoleHost.string) != 0) {
|
||||
buildMyString((char *)0,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
buildMyString(pCE->networkConsoleHost.string,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
BuildString((char *)0,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
BuildString(pCE->networkConsoleHost.string,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->networkConsoleHost.used ||
|
||||
pCE->networkConsoleHost.used) {
|
||||
buildMyString((char *)0,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
buildMyString(pCE->networkConsoleHost.string,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
BuildString((char *)0, &pCEmatch->networkConsoleHost);
|
||||
BuildString(pCE->networkConsoleHost.string,
|
||||
&pCEmatch->networkConsoleHost);
|
||||
closeMatch = 0;
|
||||
}
|
||||
if (pCEmatch->networkConsolePort !=
|
||||
@ -892,13 +925,13 @@ ReadCfg(pcFile, fp, master)
|
||||
if (pCEmatch->pccmd.used && pCE->pccmd.used) {
|
||||
if (strcmp(pCEmatch->pccmd.string, pCE->pccmd.string)
|
||||
!= 0) {
|
||||
buildMyString((char *)0, &pCEmatch->pccmd);
|
||||
buildMyString(pCE->pccmd.string, &pCEmatch->pccmd);
|
||||
BuildString((char *)0, &pCEmatch->pccmd);
|
||||
BuildString(pCE->pccmd.string, &pCEmatch->pccmd);
|
||||
closeMatch = 0;
|
||||
}
|
||||
} else if (pCEmatch->pccmd.used || pCE->pccmd.used) {
|
||||
buildMyString((char *)0, &pCEmatch->pccmd);
|
||||
buildMyString(pCE->pccmd.string, &pCEmatch->pccmd);
|
||||
BuildString((char *)0, &pCEmatch->pccmd);
|
||||
BuildString(pCE->pccmd.string, &pCEmatch->pccmd);
|
||||
closeMatch = 0;
|
||||
}
|
||||
}
|
||||
@ -916,7 +949,7 @@ ReadCfg(pcFile, fp, master)
|
||||
}
|
||||
|
||||
/* nuke the temp data structure */
|
||||
destroyConsent(pGE, pCE);
|
||||
DestroyConsent(pGE, pCE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -925,7 +958,7 @@ ReadCfg(pcFile, fp, master)
|
||||
if (!isMaster || (*ppGE)->imembers == 0) {
|
||||
pGEtmp = *ppGE;
|
||||
*ppGE = (*ppGE)->pGEnext;
|
||||
destroyGroup(pGEtmp);
|
||||
DestroyGroup(pGEtmp);
|
||||
} else {
|
||||
ppGE = &((*ppGE)->pGEnext);
|
||||
}
|
||||
@ -936,16 +969,14 @@ ReadCfg(pcFile, fp, master)
|
||||
/* nuke the old groups lists */
|
||||
while (pGroupsOld != (GRPENT *) 0) {
|
||||
pGEtmp = pGroupsOld->pGEnext;
|
||||
destroyGroup(pGroupsOld);
|
||||
DestroyGroup(pGroupsOld);
|
||||
pGroupsOld = pGEtmp;
|
||||
}
|
||||
|
||||
/* nuke the old remote consoles */
|
||||
while (pRCListOld != (REMOTE *) 0) {
|
||||
pRCtmp = pRCListOld->pRCnext;
|
||||
destroyString(&pRCListOld->rserver);
|
||||
destroyString(&pRCListOld->rhost);
|
||||
free(pRCListOld);
|
||||
DestroyRemoteConsole(pRCListOld);
|
||||
pRCListOld = pRCtmp;
|
||||
}
|
||||
|
||||
@ -954,23 +985,21 @@ ReadCfg(pcFile, fp, master)
|
||||
/* clean out the access restrictions
|
||||
*/
|
||||
while (pACList != (ACCESS *) 0) {
|
||||
if (pACList->pcwho != (char *)0)
|
||||
free(pACList->pcwho);
|
||||
pACtmp = pACList->pACnext;
|
||||
free(pACList);
|
||||
DestroyAccessList(pACList);
|
||||
pACList = pACtmp;
|
||||
}
|
||||
pACList = (ACCESS *) 0;
|
||||
ppAC = &pACList;
|
||||
|
||||
while ((acIn =
|
||||
(unsigned char *)readLine(fp, &acInSave,
|
||||
(unsigned char *)ReadLine(fp, acInSave,
|
||||
&iLine)) != (unsigned char *)0) {
|
||||
char *pcMach, *pcNext, *pcMem;
|
||||
char cType;
|
||||
int iLen;
|
||||
|
||||
acStart = pruneSpace((char *)acIn);
|
||||
acStart = PruneSpace((char *)acIn);
|
||||
|
||||
if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) {
|
||||
break;
|
||||
@ -998,7 +1027,7 @@ ReadCfg(pcFile, fp, master)
|
||||
cType = 't';
|
||||
break;
|
||||
default:
|
||||
Error("%s(%d) unknown access key `%s\'", pcFile, iLine,
|
||||
Error("%s(%d) unknown access key `%s'", pcFile, iLine,
|
||||
acStart);
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
@ -1027,7 +1056,7 @@ ReadCfg(pcFile, fp, master)
|
||||
char *sPtr = (char *)0, *nPtr = (char *)0;
|
||||
char cidr[BUFSIZ];
|
||||
|
||||
(void)strcpy(cidr, pcMach);
|
||||
strcpy(cidr, pcMach);
|
||||
/* Scan for [0-9./], and stop if you find something else */
|
||||
for (j = 0; cidr[j] != '\000'; j++) {
|
||||
if (isdigit((int)(cidr[j]))) {
|
||||
@ -1101,14 +1130,15 @@ ReadCfg(pcFile, fp, master)
|
||||
ppAC = &pACtmp->pACnext;
|
||||
}
|
||||
}
|
||||
|
||||
destroyString(&LogDirectory);
|
||||
destroyString(&defMark);
|
||||
#if HAVE_DMALLOC && DMALLOC_MARK_READCFG
|
||||
Debug(1, "ReadCfg(): dmalloc / MarkReadCfg");
|
||||
dmalloc_log_changed(dmallocMarkReadCfg, 1, 0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Unless otherwise stated, returns the same values as send(2) */
|
||||
void
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
ReReadCfg(void)
|
||||
#else
|
||||
ReReadCfg()
|
||||
@ -1117,7 +1147,7 @@ ReReadCfg()
|
||||
FILE *fpConfig;
|
||||
|
||||
if ((FILE *) 0 == (fpConfig = fopen(pcConfig, "r"))) {
|
||||
Error("fopen: %s: %s", pcConfig, strerror(errno));
|
||||
Error("ReReadCfg(): fopen(%s): %s", pcConfig, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1127,12 +1157,12 @@ ReReadCfg()
|
||||
|
||||
if (pGroups == (GRPENT *) 0 && pRCList == (REMOTE *) 0) {
|
||||
if (isMaster) {
|
||||
Error("No consoles found in configuration file");
|
||||
Error("no consoles found in configuration file");
|
||||
kill(thepid, SIGTERM); /* shoot myself in the head */
|
||||
return;
|
||||
} else {
|
||||
Error("No consoles to manage after reconfiguration - exiting");
|
||||
exit(EX_OK);
|
||||
Error("no consoles to manage after reconfiguration - exiting");
|
||||
Bye(EX_OK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,14 +1183,12 @@ ReReadCfg()
|
||||
|
||||
Spawn(pGE);
|
||||
|
||||
if (fVerbose) {
|
||||
Info("group #%d pid %d on port %u", pGE->id, pGE->pid,
|
||||
ntohs(pGE->port));
|
||||
}
|
||||
Verbose("group #%d pid %lu on port %hu", pGE->id,
|
||||
(unsigned long)pGE->pid, ntohs(pGE->port));
|
||||
for (pCE = pGE->pCElist; pCE != (CONSENT *) 0;
|
||||
pCE = pCE->pCEnext) {
|
||||
if (-1 != pCE->fdtty)
|
||||
(void)close(pCE->fdtty);
|
||||
close(pCE->fdtty);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1168,8 +1196,8 @@ ReReadCfg()
|
||||
ACCESS *pACtmp;
|
||||
for (pACtmp = pACList; pACtmp != (ACCESS *) 0;
|
||||
pACtmp = pACtmp->pACnext) {
|
||||
Info("access type '%c' for \"%s\"", pACtmp->ctrust,
|
||||
pACtmp->pcwho);
|
||||
Verbose("access type `%c' for `%s'", pACtmp->ctrust,
|
||||
pACtmp->pcwho);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1180,7 +1208,7 @@ ReReadCfg()
|
||||
if (fVerbose) {
|
||||
REMOTE *pRC;
|
||||
for (pRC = pRCUniq; (REMOTE *) 0 != pRC; pRC = pRC->pRCuniq) {
|
||||
Info("peer server on `%s'", pRC->rhost.string);
|
||||
Verbose("peer server on `%s'", pRC->rhost.string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: readcfg.h,v 5.20 2002-09-29 19:05:12-07 bryan Exp $
|
||||
* $Id: readcfg.h,v 5.23 2003-03-06 10:13:41-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
@ -44,12 +44,7 @@ extern REMOTE *pRCUniq; /* list of uniq console servers */
|
||||
extern ACCESS *pACList; /* `who do you love' (or trust) */
|
||||
extern STRING *breakList; /* list of break sequences */
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern void ReadCfg(char *, FILE *);
|
||||
extern char *pruneSpace(char *);
|
||||
extern void ReReadCfg(void);
|
||||
#else
|
||||
extern void ReadCfg();
|
||||
extern char *pruneSpace();
|
||||
extern void ReReadCfg();
|
||||
#endif
|
||||
extern void ReadCfg PARAMS((char *, FILE *));
|
||||
extern char *PruneSpace PARAMS((char *));
|
||||
extern void ReReadCfg PARAMS((void));
|
||||
extern void DestroyBreakList PARAMS((void));
|
||||
|
598
conserver/util.c
598
conserver/util.c
File diff suppressed because it is too large
Load Diff
113
conserver/util.h
113
conserver/util.h
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* $Id: util.h,v 1.32 2002-10-01 20:52:02-07 bryan Exp $
|
||||
* $Id: util.h,v 1.41 2003-03-08 08:39:57-08 bryan Exp $
|
||||
*
|
||||
* Copyright conserver.com, 2000
|
||||
*
|
||||
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
|
||||
*/
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
#if PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
@ -38,6 +38,8 @@ typedef struct dynamicString {
|
||||
char *string;
|
||||
int used;
|
||||
int allocated;
|
||||
struct dynamicString *next;
|
||||
struct dynamicString *prev;
|
||||
} STRING;
|
||||
|
||||
typedef struct consFile {
|
||||
@ -53,74 +55,47 @@ typedef struct consFile {
|
||||
/* Add crypto stuff to suit */
|
||||
} CONSFILE;
|
||||
|
||||
extern int outputPid, fDebug;
|
||||
extern int isMultiProc, fDebug, fVerbose;
|
||||
extern char *progname;
|
||||
extern int thepid;
|
||||
extern pid_t thepid;
|
||||
|
||||
#if USE_ANSI_PROTO
|
||||
extern void Debug(int, char *, ...);
|
||||
extern void Error(char *, ...);
|
||||
extern void Info(char *, ...);
|
||||
extern void simpleSignal(int, RETSIGTYPE(*)(int));
|
||||
extern int cmaxfiles();
|
||||
extern void FmtCtlStr(char *, int, STRING *);
|
||||
extern CONSFILE *fileOpenFD(int, enum consFileType);
|
||||
extern CONSFILE *fileOpen(const char *, int, int);
|
||||
extern int fileClose(CONSFILE **);
|
||||
extern int fileRead(CONSFILE *, void *, int);
|
||||
extern int fileWrite(CONSFILE *, const char *, int);
|
||||
extern void fileVwrite(CONSFILE *, const char *, va_list);
|
||||
extern void filePrint(CONSFILE *, const 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 void OutOfMem();
|
||||
extern char *buildString(const char *);
|
||||
extern char *buildStringChar(const char);
|
||||
extern char *buildMyString(const char *, STRING *);
|
||||
extern char *buildMyStringChar(const char, STRING *);
|
||||
extern void initString(STRING *);
|
||||
extern void destroyString(STRING *);
|
||||
extern char *readLine(FILE *, STRING *, int *);
|
||||
extern enum consFileType fileGetType(CONSFILE *);
|
||||
extern void fileSetType(CONSFILE *, enum consFileType);
|
||||
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 *FileOpen PARAMS((const char *, int, int));
|
||||
extern int FileClose PARAMS((CONSFILE **));
|
||||
extern int FileRead PARAMS((CONSFILE *, void *, int));
|
||||
extern int FileWrite PARAMS((CONSFILE *, const char *, int));
|
||||
extern void FileVWrite PARAMS((CONSFILE *, const char *, va_list));
|
||||
extern void FilePrint PARAMS((CONSFILE *, const 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 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 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));
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *fileGetSSL(CONSFILE *);
|
||||
extern void fileSetSSL(CONSFILE *, SSL *);
|
||||
extern int ssl_verify_callback(int, X509_STORE_CTX *);
|
||||
#endif
|
||||
#else
|
||||
extern void Debug();
|
||||
extern void Error();
|
||||
extern void Info();
|
||||
extern void simpleSignal();
|
||||
extern int cmaxfiles();
|
||||
extern void FmtCtlStr();
|
||||
extern CONSFILE *fileOpenFD();
|
||||
extern CONSFILE *fileOpen();
|
||||
extern int fileClose();
|
||||
extern int fileRead();
|
||||
extern int fileWrite();
|
||||
extern void fileVWrite();
|
||||
extern void filePrint();
|
||||
extern int fileStat();
|
||||
extern int fileSeek();
|
||||
extern int fileSend();
|
||||
extern int fileFDNum();
|
||||
extern void OutOfMem();
|
||||
extern char *buildString();
|
||||
extern char *buildStringChar();
|
||||
extern char *buildMyString();
|
||||
extern char *buildMyStringChar();
|
||||
extern void initString();
|
||||
extern void destroyString();
|
||||
extern char *readLine();
|
||||
extern enum consFileType fileGetType();
|
||||
extern void fileSetType();
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *fileGetSSL();
|
||||
extern void fileSetSSL();
|
||||
extern int ssl_verify_callback();
|
||||
#endif
|
||||
extern SSL *FileGetSSL PARAMS((CONSFILE *));
|
||||
extern void FileSetSSL PARAMS((CONSFILE *, SSL *));
|
||||
extern int SSLVerifyCallback PARAMS((int, X509_STORE_CTX *));
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: version.h,v 1.40 2003-01-27 17:47:53-08 bryan Exp $
|
||||
* $Id: version.h,v 1.41 2003-03-10 17:37:27-08 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 7.2.5"
|
||||
#define THIS_VERSION "conserver.com version 7.2.6"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
.\" $Id: console.man,v 1.24 2003-01-08 17:07:51-08 bryan Exp $
|
||||
.\" $Id: console.man,v 1.25 2003-03-04 07:53:03-08 bryan Exp $
|
||||
.TH CONSOLE 1 "Local"
|
||||
.SH NAME
|
||||
console \- console server client program
|
||||
@ -9,7 +9,7 @@ console \- console server client program
|
||||
\fIconsole\fP
|
||||
.br
|
||||
\fBconsole\fP [\fB\-hiIPrRuVwWx\fP] [\fB\-7Dv\fP] [\fB\-M\fP \fImach\fP]
|
||||
[\fB\-p\fP \fIport\fP] [\fB\-b\fP \fImessage\fP]
|
||||
[\fB\-p\fP \fIport\fP] [\fB\-\fP[\fBbB\fP] \fImessage\fP]
|
||||
.br
|
||||
\fBconsole\fP [\fB\-qQ\fP] [\fB\-7Dv\fP] [\fB\-M\fP \fImach\fP]
|
||||
[\fB\-p\fP \fIport\fP]
|
||||
@ -73,7 +73,10 @@ 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 \fImessage\fP to all users connected to the console server.
|
||||
Broadcast a \fImessage\fP to all users connected to each server.
|
||||
.TP
|
||||
.BI \-B message
|
||||
Same as \fB\-b\fP but just send a \fImessage\fP to users on the primary server.
|
||||
.TP
|
||||
.BI \-c cred
|
||||
Load an SSL certificate and key from the PEM encoded file \fIcred\fP.
|
||||
|
@ -38,8 +38,9 @@ case "$1" in
|
||||
status conserver
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
echo -n "Restarting conserver: "
|
||||
killproc conserver -HUP
|
||||
echo
|
||||
;;
|
||||
*)
|
||||
echo "Usage: conserver {start|stop|restart|status}"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
%define pkg conserver
|
||||
%define ver 7.2.5
|
||||
%define ver 7.2.6
|
||||
|
||||
# define the name of the machine on which the main conserver
|
||||
# daemon will be running if you don't want to use the default
|
||||
@ -99,4 +99,5 @@ fi
|
||||
%{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
|
||||
|
@ -39,4 +39,5 @@ fakeinstall:
|
||||
$(FIXMANCMD) man_tbl_header $(BUILDDIR)/conserver/conserver.man > $(MAN1MDIR)/conserver.$(MAN1MEXT)
|
||||
$(FIXMANCMD) man_tbl_header $(BUILDDIR)/console/console.man > $(MAN1MDIR)/console.$(MAN1MEXT)
|
||||
$(FIXMANCMD) $(BUILDDIR)/conserver.cf/conserver.cf.man > $(MAN4DIR)/conserver.cf.$(MAN4EXT)
|
||||
$(FIXMANCMD) $(BUILDDIR)/conserver.cf/conserver.passwd.man > $(MAN4DIR)/conserver.passwd.$(MAN4EXT)
|
||||
$(FIXSCRIPTCMD) $(BUILDDIR)/conserver/conserver.rc > $(LIBDIR)/conserver.rc
|
||||
|
@ -1,7 +1,7 @@
|
||||
PKG="conserver"
|
||||
NAME="Console server and client"
|
||||
CATEGORY="system"
|
||||
VERSION="7.2.5"
|
||||
VERSION="7.2.6"
|
||||
DESC="Console server and client"
|
||||
CLASSES=none
|
||||
ARCH=sparc
|
||||
|
@ -12,3 +12,4 @@ f none share/man/man1m/conserver.1m 0644 bin bin
|
||||
f none share/man/man1m/console.1m 0644 bin bin
|
||||
d none share/man/man5 0755 bin bin
|
||||
f none share/man/man5/conserver.cf.5 0644 bin bin
|
||||
f none share/man/man5/conserver.passwd.5 0644 bin bin
|
||||
|
Loading…
Reference in New Issue
Block a user