2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

First cut add installing an init.d file for HP-UX and AIX to remove

old sudo timestamp files at boot time.
This commit is contained in:
Todd C. Miller 2014-02-16 10:22:43 -07:00
parent a61935c2b9
commit 96d87d55dd
8 changed files with 146 additions and 28 deletions

View File

@ -22,6 +22,8 @@ Makefile$
^doc/.*\.mdoc\.sed$
^doc/varsub$
^init.d/*.sh$
^pathnames\.h$
^src/sudo$
^src/sesh$

View File

@ -159,6 +159,8 @@ include/sudo_event.h
include/sudo_plugin.h
include/sudo_util.h
indent.pro
init.d/aix.sh.in
init.d/hpux.sh.in
install-sh
ltmain.sh
m4/ax_check_compile_flag.m4
@ -410,7 +412,6 @@ src/locale_stub.c
src/net_ifs.c
src/openbsd.c
src/parse_args.c
src/preserve_fds.c
src/po/README
src/po/cs.mo
src/po/cs.po
@ -460,6 +461,7 @@ src/po/vi.po
src/po/zh_CN.mo
src/po/zh_CN.po
src/preload.c
src/preserve_fds.c
src/regress/ttyname/check_ttyname.c
src/selinux.c
src/sesh.c

34
configure vendored
View File

@ -719,6 +719,9 @@ timeout
vardir
rundir
iolog_dir
RC_LINK
INIT_DIR
INIT_SCRIPT
NO_VIZ
SSP_CFLAGS
SSP_LDFLAGS
@ -2966,6 +2969,9 @@ $as_echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;}
@ -3046,6 +3052,9 @@ LT_LDEXPORTS="-export-symbols \$(shlib_exp)"
LT_LDDEP="\$(shlib_exp)"
NO_VIZ="-DNO_VIZ"
OS_INIT=os_init_common
INIT_SCRIPT=
INIT_DIR=
RC_LINK=
CHECKSHADOW=true
shadow_defs=
@ -14223,6 +14232,11 @@ fi
RTLD_PRELOAD_VAR="LDR_PRELOAD"
fi
# Remove timedir on boot, AIX does not have /var/run
INIT_SCRIPT=aix.sh
INIT_DIR=/etc/rc.d/init.d
RC_LINK=/etc/rc.d/rc2.d/S90sudo
# AIX-specific functions
for ac_func in getuserattr setauthdb setrlimit64
do :
@ -14253,6 +14267,11 @@ done
: ${mansectsu='1m'}
: ${mansectform='4'}
# HP-UX does not clear /var/run so we need to do it
INIT_SCRIPT=hpux.sh
INIT_DIR=/etc/rc.d/init.d
RC_LINK=/sbin/rc2.d/S900sudo
# HP-UX shared libs must be executable
SHLIB_MODE=0755
@ -22388,7 +22407,7 @@ test "$localedir" = '${datarootdir}/locale' && localedir='$(datarootdir)/locale'
test "$localstatedir" = '${prefix}/var' && localstatedir='$(prefix)/var'
test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
ac_config_files="$ac_config_files Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/group_file/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers"
ac_config_files="$ac_config_files Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile init.d/aix.sh init.d/hpux.sh src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/group_file/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -23376,6 +23395,8 @@ do
"compat/Makefile") CONFIG_FILES="$CONFIG_FILES compat/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"init.d/aix.sh") CONFIG_FILES="$CONFIG_FILES init.d/aix.sh" ;;
"init.d/hpux.sh") CONFIG_FILES="$CONFIG_FILES init.d/hpux.sh" ;;
"src/sudo_usage.h") CONFIG_FILES="$CONFIG_FILES src/sudo_usage.h" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"plugins/sample/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/sample/Makefile" ;;
@ -24465,20 +24486,13 @@ $as_echo "$as_me: You will need to customize sample.pam and install it as /etc/p
;;
esac
fi
clear_rundir=0
case $host_os in
hpux*|aix*)
clear_rundir=1
;;
*)
case "$rundir" in
case "$rundir" in
/var/run*)
clear_rundir=0
;;
*)
clear_rundir=1
;;
esac
;;
esac
if test $clear_rundir -eq 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Warning: the $rundir/ts directory must be cleared at boot time." >&5

View File

@ -86,6 +86,9 @@ AC_SUBST([PIE_CFLAGS])
AC_SUBST([SSP_LDFLAGS])
AC_SUBST([SSP_CFLAGS])
AC_SUBST([NO_VIZ])
AC_SUBST([INIT_SCRIPT])
AC_SUBST([INIT_DIR])
AC_SUBST([RC_LINK])
dnl
dnl Variables that get substituted in docs (not overridden by environment)
dnl
@ -209,6 +212,9 @@ LT_LDEXPORTS="-export-symbols \$(shlib_exp)"
LT_LDDEP="\$(shlib_exp)"
NO_VIZ="-DNO_VIZ"
OS_INIT=os_init_common
INIT_SCRIPT=
INIT_DIR=
RC_LINK=
dnl
dnl Other vaiables
@ -1672,6 +1678,11 @@ case "$host" in
RTLD_PRELOAD_VAR="LDR_PRELOAD"
fi
# Remove timedir on boot, AIX does not have /var/run
INIT_SCRIPT=aix.sh
INIT_DIR=/etc/rc.d/init.d
RC_LINK=/etc/rc.d/rc2.d/S90sudo
# AIX-specific functions
AC_CHECK_FUNCS(getuserattr setauthdb setrlimit64)
COMMON_OBJS="${COMMON_OBJS} aix.lo"
@ -1691,6 +1702,11 @@ case "$host" in
: ${mansectsu='1m'}
: ${mansectform='4'}
# HP-UX does not clear /var/run so we need to do it
INIT_SCRIPT=hpux.sh
INIT_DIR=/etc/rc.d/init.d
RC_LINK=/sbin/rc2.d/S900sudo
# HP-UX shared libs must be executable
SHLIB_MODE=0755
@ -3778,7 +3794,7 @@ test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/
dnl
dnl Substitute into the Makefile and man pages
dnl
AC_CONFIG_FILES([Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/group_file/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers])
AC_CONFIG_FILES([Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile init.d/aix.sh init.d/hpux.sh src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/group_file/Makefile plugins/system_group/Makefile plugins/sudoers/Makefile plugins/sudoers/sudoers])
AC_OUTPUT
dnl
@ -3798,23 +3814,15 @@ if test "$with_pam" = "yes"; then
esac
fi
dnl
dnl AIX and HP-UX do not clear /var/run
dnl Also point out other non-cleared dirs
dnl Warn user if they may need to clear rundir manually.
dnl
clear_rundir=0
case $host_os in
hpux*|aix*)
clear_rundir=1
;;
*)
case "$rundir" in
case "$rundir" in
/var/run*)
clear_rundir=0
;;
*)
clear_rundir=1
;;
esac
;;
esac
if test $clear_rundir -eq 1; then
AC_MSG_NOTICE([Warning: the $rundir/ts directory must be cleared at boot time.])

25
init.d/aix.sh.in Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
#
# Simple AIX rc.d script to remove the sudo timestamp directory on boot.
# This is needed because AIX does not have /var/run.
# Install as /etc/rc.d/init.d/sudo with a link /etc/rc.d/rc2.d/S90sudo
#
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
TSDIR="@rundir@/ts"
rval=0
case "$1" in
start)
echo "Removing the $TSDIR directory"
rm -rf "$TSDIR"
;;
*)
echo "usage: $0 start"
rval=1
;;
esac
exit $rval

27
init.d/hpux.sh.in Normal file
View File

@ -0,0 +1,27 @@
#!/sbin/sh
#
# Simple HP-UX init.d script to remove the sudo timestamp directory on boot.
# This is needed because HP-UX does not clear /var/run on its own.
# Install as /sbin/init.d/sudo with a link /sbin/rc2.d/S900sudo
#
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
TSDIR="@rundir@/ts"
rval=0
case "$1" in
start_msg)
echo "Removing the $TSDIR directory"
;;
start)
rm -rf "$TSDIR"
;;
*)
echo "usage: $0 {start|start_msg}"
rval=1
;;
esac
exit $rval

View File

@ -79,6 +79,11 @@ install_gid = 0
shlib_ext = @SHLIB_EXT@
shlib_mode = @SHLIB_MODE@
# Optional init script and rc.d link
INIT_DIR=@INIT_DIR@
INIT_SCRIPT=@INIT_SCRIPT@
RC_LINK=@RC_LINK@
TEST_PROGS = check_ttyname
TEST_LIBS = @LIBS@ @LIBINTL@ $(LT_LIBS)
TEST_LDFLAGS = @LDFLAGS@
@ -135,12 +140,21 @@ check_ttyname: $(CHECK_TTYNAME_OBJS) $(top_builddir)/common/libsudo_util.la $(LI
pre-install:
install: install-binaries @INSTALL_NOEXEC@
install: install-binaries install-rc @INSTALL_NOEXEC@
install-dirs:
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) \
$(DESTDIR)$(libexecdir)/sudo $(DESTDIR)$(noexecdir)
install-rc:
@if [ -n "$(INIT_SCRIPT)" ]; then \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(INIT_DIR) \
`echo $(DESTDIR)$(RC_LINK)|sed 's,/[^/]*$$,,'`; \
$(INSTALL) -O $(install_uid) -G $(install_gid) -m 0755 $(top_srcdir)/init.d/$(INIT_SCRIPT) $(DESTDIR)$(INIT_DIR)/sudo; \
rm -f $(DESTDIR)$(RC_LINK); \
ln -s $(INIT_DIR)/sudo $(DESTDIR)$(RC_LINK); \
fi
install-binaries: install-dirs $(PROGS)
$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -m 04755 sudo $(DESTDIR)$(bindir)/sudo
rm -f $(DESTDIR)$(bindir)/sudoedit

26
sudo.pp
View File

@ -291,6 +291,12 @@ still allow people to get their work done."
/usr/bin/sudoreplay 0755 root: symlink $bindir/sudoreplay
/usr/sbin/visudo 0755 root: symlink $sbindir/visudo
%endif
%if [aix]
/etc/rc.d/init.d/sudo 0755 root:
%endif
%if [sd]
/sbin/init.d/sudo 0755 root:
%endif
%files [!aix]
$sudoedit_man 0644 symlink,ignore-others $sudoedit_man_target
@ -365,6 +371,18 @@ still allow people to get their work done."
exit 0;
'
%post [aix]
# Create /etc/rc.d/rc2.d/S90sudo link if /etc/rc.d exists
if [ -d /etc/rc.d ]; then
rm -f /etc/rc.d/rc2.d/S90sudo
ln -s /etc/rc.d/init.d/sudo /etc/rc.d/rc2.d/S90sudo
fi
%endif
%post [sd]
# Create /sbin/rc2.d/S900sudo link
rm -f /sbin/rc2.d/S900sudo
ln -s /sbin/init.d/sudo /sbin/rc2.d/S900sudo
%endif
%preun
# Remove the time stamp dir and its contents
# We currently leave the lecture status files installed
@ -379,3 +397,11 @@ still allow people to get their work done."
rm -f /etc/sudo-ldap.conf
fi
%endif
%if [aix]
# Remove /etc/rc.d/rc2.d/S90sudo link
rm -f /etc/rc.d/rc2.d/S90sudo
%endif
%if [sd]
# Remove /sbin/rc2.d/S900sudo link
rm -f /sbin/rc2.d/S900sudo
%endif