Merge c45258c0f3ecde655ffea29330bd4812e29dc64c into 290933b4a7964d56f74d2e3c61f7045c5e0d6bfe

This commit is contained in:
Jörg Sommer 2025-01-28 15:47:16 -08:00 committed by GitHub
commit e88990ed38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 101 additions and 83 deletions

21
.gitignore vendored
View File

@ -1 +1,22 @@
*.[ch]~
Makefile
!contrib/solaris-package/Makefile
/autom4te.cache
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
*.o
/conserver.cf/conserver.cf.man
/conserver.cf/conserver.passwd.man
/conserver/conserver
/conserver/conserver.man
/conserver/conserver.rc
/conserver/convert
/console/console
/console/console.man

View File

@ -29,10 +29,10 @@ AH_TEMPLATE([REQ_SERVER_CERT], [Defined if client requires server SSL certificat
AH_TEMPLATE([TRUST_UDS_CRED], [Defined if we trust credentials from UDS client])
dnl ### Normal initialization. ######################################
AC_INIT([conserver],m4_esyscmd_s([./gen-version number]))
AC_PREREQ(2.69)
AC_INIT([conserver],[m4_esyscmd_s(./gen-version number)])
AC_PREREQ([2.72])
AC_CONFIG_SRCDIR([conserver/main.c])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS([config.h])
AC_DEFINE_UNQUOTED(CONFIGINVOCATION, "$0 $*")
@ -50,7 +50,7 @@ AC_SUBST(CONSERVER_DATE, m4_esyscmd_s([./gen-version date]))
dnl ### Custom settings. ############################################
dnl AC_MSG_CHECKING(whether to allow 64bit compilation)
dnl AC_ARG_WITH(64bit,
dnl AC_HELP_STRING([--with-64bit],[Allow 64bit compilation]),
dnl AS_HELP_STRING([--with-64bit],[Allow 64bit compilation]),
dnl [case "$withval" in
dnl yes)
dnl with_64bit=yes
@ -299,7 +299,7 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl ### Compiler characteristics. ##################################
AC_AIX
AC_USE_SYSTEM_EXTENSIONS
AC_C_CONST
dnl AC_CHECK_SIZEOF(long)
@ -312,7 +312,8 @@ dnl fi
dnl fi
dnl ### Checks for header files. ###################################
AC_HEADER_STDC
AC_CHECK_INCLUDES_DEFAULT
AC_CHECK_HEADERS(sys/ioctl.h)
AC_SYS_POSIX_TERMIOS
@ -327,10 +328,8 @@ AC_CHECK_HEADERS(sys/proc.h, [], [],
#include <sys/param.h>
#endif
])
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_TYPE_MODE_T
AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
@ -348,9 +347,9 @@ AC_CHECK_TYPE([socklen_t],[AC_DEFINE(HAVE_SOCKLEN_T,1,
#include <sys/socket.h>])
AC_MSG_CHECKING(for sa_len in struct sockaddr)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[struct sockaddr s; s.sa_len=0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[struct sockaddr s; s.sa_len=0;]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SA_LEN)],
[AC_MSG_RESULT(no)])
@ -413,45 +412,45 @@ AC_ARG_WITH(uds,
AS_HELP_STRING([--with-trust-uds-cred],[Trust UDS credentials obtained via socket]),
[case "$withval" in
yes)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[
struct sockpeercred u;
u.uid = 0;
#if !defined(SO_PEERCRED)
#error "no SO_PEERCRED defined"
#endif
],
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(UDS_CRED_STYPE, sockpeercred, [Defined to UDS credential structure name])
AC_DEFINE(UDS_CRED_UID, uid, [Defined to UDS credential structure uid field])
AC_DEFINE(UDS_CRED_SO, SO_PEERCRED, [Defined to UDS credential socket option])
AC_DEFINE(TRUST_UDS_CRED)],
[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[
struct ucred u;
u.euid = 0;
#if !defined(SO_PEERCRED)
#error "no SO_PEERCRED defined"
#endif
],
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(UDS_CRED_STYPE, ucred, [Defined to UDS credential structure name])
AC_DEFINE(UDS_CRED_UID, uid, [Defined to UDS credential structure uid field])
AC_DEFINE(UDS_CRED_SO, SO_PEERCRED, [Defined to UDS credential socket option])
AC_DEFINE(TRUST_UDS_CRED)],
[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[
struct peercred_struct u;
u.euid = 0;
#if !defined(SO_PEERID)
#error "no SO_PEERID defined"
#endif
],
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(UDS_CRED_STYPE, peercred_struct, [Defined to UDS credential structure name])
AC_DEFINE(UDS_CRED_UID, euid, [Defined to UDS credential structure uid field])
@ -495,10 +494,10 @@ AC_ARG_WITH(libwrap,
AC_CHECK_HEADER(tcpd.h,
[LIBS="$LIBS -lwrap"
AC_MSG_CHECKING(for TCP wrappers library -lwrap)
AC_TRY_LINK([#include <tcpd.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tcpd.h>
int allow_severity = 0;
int deny_severity = 0;
],[hosts_access((void *)0)],
]], [[hosts_access((void *)0)]])],
[AC_MSG_RESULT(yes)
cons_with_libwrap="YES"
AC_DEFINE(USE_LIBWRAP)
@ -508,10 +507,10 @@ AC_ARG_WITH(libwrap,
[AC_MSG_RESULT(no)
LIBS="$LIBS -lnsl"
AC_MSG_CHECKING(for TCP wrappers library -lwrap with -lnsl)
AC_TRY_LINK([#include <tcpd.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <tcpd.h>
int allow_severity = 0;
int deny_severity = 0;
],[hosts_access((void *)0)],
]],[[hosts_access((void *)0)]])],
[AC_MSG_RESULT(yes)
cons_with_libwrap="YES"
AC_DEFINE(USE_LIBWRAP)
@ -553,8 +552,8 @@ AC_ARG_WITH(openssl,
AC_CHECK_HEADER([openssl/ssl.h],
[LIBS="$LIBS -lssl -lcrypto"
AC_MSG_CHECKING(for openssl libraries -lssl and -lcrypto)
AC_TRY_LINK([#include <openssl/ssl.h>
],[SSL_CTX_new(NULL)],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>
]], [[SSL_CTX_new(NULL)]])],
[AC_MSG_RESULT(yes)
cons_with_openssl="YES"
AC_DEFINE(HAVE_OPENSSL)
@ -611,9 +610,9 @@ AC_ARG_WITH(gssapi,
AC_CHECK_HEADER([gssapi/gssapi.h],
[LIBS="$oLIBS -lgssapi"
AC_MSG_CHECKING(for gssapi library -lgssapi)
AC_TRY_LINK([#include <gssapi/gssapi.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>
#include <stdio.h>
],[gss_create_empty_oid_set(NULL, NULL)],
]], [[gss_create_empty_oid_set(NULL, NULL)]])],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
@ -621,9 +620,9 @@ AC_ARG_WITH(gssapi,
[AC_MSG_RESULT(no)
LIBS="$oLIBS -lgssglue"
AC_MSG_CHECKING(for gssapi library -lgssglue)
AC_TRY_LINK([#include <gssapi/gssapi.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>
#include <stdio.h>
],[gss_create_empty_oid_set(NULL, NULL)],
]],[[gss_create_empty_oid_set(NULL, NULL)]])],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
@ -631,9 +630,9 @@ AC_ARG_WITH(gssapi,
[AC_MSG_RESULT(no)
LIBS="$oLIBS -lgss"
AC_MSG_CHECKING(for gssapi library -lgss)
AC_TRY_LINK([#include <gssapi/gssapi.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>
#include <stdio.h>
],[gss_create_empty_oid_set(NULL, NULL)],
]],[[gss_create_empty_oid_set(NULL, NULL)]])],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
@ -641,8 +640,8 @@ AC_ARG_WITH(gssapi,
[AC_MSG_RESULT(no)
LIBS="$oLIBS -lgssapi_krb5"
AC_MSG_CHECKING(for gssapi library -lgssapi_krb5)
AC_TRY_LINK([#include <gssapi/gssapi.h>
],[gss_create_empty_oid_set(NULL, NULL)],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gssapi/gssapi.h>
]],[[gss_create_empty_oid_set(NULL, NULL)]])],
[AC_MSG_RESULT(yes)
cons_with_gssapi="YES"
AC_DEFINE(HAVE_GSSAPI)
@ -700,8 +699,8 @@ AC_ARG_WITH(freeipmi,
AC_CHECK_HEADER([ipmiconsole.h],
[LIBS="$LIBS -lipmiconsole"
AC_MSG_CHECKING(for freeipmi libraries -lipmiconsole)
AC_TRY_LINK([#include <ipmiconsole.h>
],[ipmiconsole_ctx_fd(0)],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ipmiconsole.h>
]], [[ipmiconsole_ctx_fd(0)]])],
[AC_MSG_RESULT(yes)
cons_with_freeipmi="YES"
AC_DEFINE(HAVE_FREEIPMI)
@ -745,8 +744,8 @@ AC_ARG_WITH(dmalloc,
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_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dmalloc.h>
]], [[dmalloc_debug(0)]])],
[AC_MSG_RESULT(yes)
cons_with_dmalloc="YES"
AC_DEFINE(HAVE_DMALLOC)
@ -768,10 +767,9 @@ dnl dnl The following basically stollen from the less-358 distribution, but
dnl dnl modified for my own purposes
dnl AC_MSG_CHECKING(for POSIX regex)
dnl AC_ARG_WITH(regex,
dnl AC_HELP_STRING([--with-regex],
dnl [Use regular expressions in conserver.passwd]),
dnl AS_HELP_STRING([--with-regex],[Use regular expressions in conserver.passwd]),
dnl [if test "$withval" = yes; then
dnl AC_TRY_RUN([
dnl AC_RUN_IFELSE([AC_LANG_SOURCE([[
dnl #include <sys/types.h>
dnl #include <regex.h>
dnl main() { regex_t r; regmatch_t rm; char *text = "xabcy";
@ -779,17 +777,17 @@ dnl if (regcomp(&r, "abc", 0)) exit(1);
dnl if (regexec(&r, text, 1, &rm, 0)) exit(1);
dnl if (rm.rm_so != 1) exit(1); /* check for correct offset */
dnl exit(0); }
dnl ],have_posix_regex=yes,have_posix_regex=no,have_posix_regex=unknown)
dnl ]])],[have_posix_regex=yes],[have_posix_regex=no],[have_posix_regex=unknown])
dnl if test $have_posix_regex = yes; then
dnl AC_MSG_RESULT(yes)
dnl AC_DEFINE(HAVE_POSIX_REGCOMP)
dnl elif test $have_posix_regex = unknown; then
dnl AC_TRY_LINK([
dnl AC_LINK_IFELSE([AC_LANG_PROGRAM([[
dnl #include <sys/types.h>
dnl #include <regex.h>],
dnl [regex_t *r; regfree(r);],
dnl #include <regex.h>]], [[
dnl regex_t *r; regfree(r);]])],[
dnl AC_MSG_RESULT(yes)
dnl AC_DEFINE(HAVE_POSIX_REGCOMP))
dnl AC_DEFINE(HAVE_POSIX_REGCOMP)],[])
dnl else
dnl AC_MSG_RESULT(no)
dnl fi

View File

@ -28,7 +28,7 @@ install:
$(INSTALL) -m 0644 conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5
$(INSTALL) -m 0644 conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5
$(MKDIR) $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.cf $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.passwd $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 $(srcdir)/conserver.cf $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 $(srcdir)/conserver.passwd $(DESTDIR)$(exampledir)
.PHONY: clean distclean install

View File

@ -9,8 +9,7 @@ sbindir = @sbindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
datadir = @datadir@
libdir = @libdir@
pkglibdir = $(libdir)/conserver
pkglibdir = @libexecdir@/conserver
exampledir = $(datadir)/examples/conserver
### Installation programs and flags
@ -25,9 +24,11 @@ CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) $(DEFS) @CPPFLAGS@ @CONSCPPFLAGS@
LDFLAGS = @LDFLAGS@ @CONSLDFLAGS@
LIBS = @LIBS@ @CONSLIBS@
LDLIBS = @LIBS@ @CONSLIBS@
LINK.o = $(LINK.c)
@SET_MAKE@
vpath %.c $(srcdir)
### Makefile rules - no user-servicable parts below
@ -46,13 +47,9 @@ all: $(ALL)
$(CONSERVER_OBJS): $(CONSERVER_HDRS)
conserver: $(CONSERVER_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
convert: convert.o cutil.o
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o cutil.o $(LIBS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o $(ALL) core

View File

@ -47,6 +47,7 @@
#include <access.h>
#include <readcfg.h>
#include <main.h>
#include <time.h>
BAUD baud[] = {

View File

@ -7,6 +7,7 @@
#include <compat.h>
#include <cutil.h>
#include <time.h>
#include <version.h>
#include <net/if.h>
@ -546,7 +547,7 @@ Verbose(char *fmt, ...)
}
void
SimpleSignal(int sig, RETSIGTYPE(*disp) (int))
SimpleSignal(int sig, void(*disp) (int))
{
#if HAVE_SIGACTION
struct sigaction sa;

View File

@ -156,7 +156,7 @@ extern void Debug(int, char *, ...);
extern void Error(char *, ...);
extern void Msg(char *, ...);
extern void Verbose(char *, ...);
extern void SimpleSignal(int, RETSIGTYPE(*)(int));
extern void SimpleSignal(int, void(*)(int));
extern int GetMaxFiles();
extern char *FmtCtl(int, STRING *);
extern void FmtCtlStr(char *, int, STRING *);

View File

@ -35,7 +35,7 @@ GetPseudoTTY(STRING *slave, int *slaveFD)
# if HAVE_SIGACTION
sigset_t oldmask, newmask;
# else
extern RETSIGTYPE FlagReapVirt(int);
extern void FlagReapVirt(int);
# endif
# if HAVE_SIGACTION
@ -83,7 +83,7 @@ GetPseudoTTY(STRING *slave, int *slaveFD)
# if HAVE_SIGACTION
sigset_t oldmask, newmask;
# else
extern RETSIGTYPE FlagReapVirt(int);
extern void FlagReapVirt(int);
# endif
int c;
/* clone list and idea stolen from xemacs distribution */

View File

@ -67,6 +67,7 @@
#include <main.h>
#include <version.h>
#include <stdio.h>
#include <time.h>
#if HAVE_PAM
# include <security/pam_appl.h>
@ -828,7 +829,7 @@ CheckPass(char *pcUser, char *pcWord, FLAG empty_check)
* and reread the configuration file
* lucky for us: log file fd's can change async from the group driver!
*/
static RETSIGTYPE
static void
FlagSawChldHUP(int sig)
{
fSawChldHUP = 1;
@ -840,7 +841,7 @@ FlagSawChldHUP(int sig)
/* on an USR2 close and re-open log files so lop can trim them (ksb)
* lucky for us: log file fd's can change async from the group driver!
*/
static RETSIGTYPE
static void
FlagSawChldUSR2(int sig)
{
fSawChldUSR2 = 1;
@ -890,7 +891,7 @@ ReOpen(GRPENT *pGE)
}
}
static RETSIGTYPE
static void
FlagReUp(int sig)
{
fSawReUp = 1;
@ -1250,7 +1251,7 @@ WriteLog(CONSENT *pCE, char *s, int len)
FileWrite(pCE->fdlog, FLAGFALSE, (char *)0, 0);
}
static RETSIGTYPE
static void
FlagGoAway(int sig)
{
fSawGoAway = 1;
@ -1260,7 +1261,7 @@ FlagGoAway(int sig)
}
/* yep, basically the same...ah well, maybe someday */
static RETSIGTYPE
static void
FlagGoAwayAlso(int sig)
{
fSawGoAway = 1;
@ -1269,7 +1270,7 @@ FlagGoAwayAlso(int sig)
#endif
}
static RETSIGTYPE
static void
FlagReapVirt(int sig)
{
fSawReapVirt = 1;

View File

@ -46,7 +46,7 @@ static unsigned long dmallocMarkClientConnection = 0;
#endif
static RETSIGTYPE
static void
FlagSawCHLD(int sig)
{
fSawCHLD = 1;
@ -122,7 +122,7 @@ FixKids(int msfd)
/* kill all the kids and exit.
* Called when master process receives SIGTERM
*/
static RETSIGTYPE
static void
FlagQuitIt(int arg)
{
fSawQuit = 1;
@ -134,7 +134,7 @@ FlagQuitIt(int arg)
/* yes, this is basically the same as FlagQuitIt but we *may*
* want to do something special on SIGINT at some point.
*/
static RETSIGTYPE
static void
FlagSawINT(int arg)
{
fSawQuit = 1;
@ -143,7 +143,7 @@ FlagSawINT(int arg)
#endif
}
static RETSIGTYPE
static void
FlagSawHUP(int arg)
{
fSawHUP = 1;
@ -152,7 +152,7 @@ FlagSawHUP(int arg)
#endif
}
static RETSIGTYPE
static void
FlagSawUSR2(int arg)
{
fSawUSR2 = 1;
@ -161,7 +161,7 @@ FlagSawUSR2(int arg)
#endif
}
static RETSIGTYPE
static void
FlagSawUSR1(int arg)
{
fSawUSR1 = 1;

View File

@ -33,6 +33,7 @@
#include <access.h>
#include <readcfg.h>
#include <main.h>
#include <time.h>
/***** external things *****/
NAMES *userList = (NAMES *)0;

View File

@ -21,9 +21,11 @@ CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/conserver $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
LDLIBS = @LIBS@
LINK.o = $(LINK.c)
@SET_MAKE@
vpath %.c $(srcdir)
### Makefile rules - no user-servicable parts below
@ -39,14 +41,10 @@ all: $(ALL)
$(CONSOLE_OBJS): $(CONSOLE_HDRS)
console: $(CONSOLE_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
console: $(CONSOLE_OBJS) $(LIBS)
../conserver/cutil.o:
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) cutil.o ) || exit 1;
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
$(MAKE) -C ../conserver $(MAKE_FLAGS) cutil.o
clean:
rm -f *~ *.o $(ALL) core

View File

@ -836,7 +836,7 @@ static sig_atomic_t fSawReapVirt = 0;
#if HAVE_SIGACTION
static
#endif
RETSIGTYPE
void
FlagReapVirt(int sig)
{
fSawReapVirt = 1;