add initial files for Tinjac
This commit is contained in:
commit
7839475334
3845 changed files with 744630 additions and 0 deletions
3845
.gitattributes
vendored
Normal file
3845
.gitattributes
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
cronie-1.4.6/AUTHORS
Normal file
2
cronie-1.4.6/AUTHORS
Normal file
|
@ -0,0 +1,2 @@
|
|||
Original vixie-cron was written by Paul Vixie.
|
||||
|
78
cronie-1.4.6/COPYING
Normal file
78
cronie-1.4.6/COPYING
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software written by Ken Arnold and
|
||||
* published in UNIX Review, Vol. 6, No. 8.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Paul Vixie.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)bitstring.h 8.1 (Berkeley) 7/19/93
|
||||
*/
|
1344
cronie-1.4.6/ChangeLog
Normal file
1344
cronie-1.4.6/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
22
cronie-1.4.6/INSTALL
Normal file
22
cronie-1.4.6/INSTALL
Normal file
|
@ -0,0 +1,22 @@
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
In the vixie-cron directory run:
|
||||
autoreconf
|
||||
These commands create from configure.ac executable ./configure
|
||||
|
||||
Then you can start installation:
|
||||
make
|
||||
make install
|
||||
|
||||
The executable files will be installed in /usr/local/*
|
||||
|
||||
Options
|
||||
=======
|
||||
In the default package are used configure options:
|
||||
--with-pam
|
||||
--with-selinux
|
||||
--with-audit
|
||||
|
||||
|
||||
|
13
cronie-1.4.6/Makefile.am
Normal file
13
cronie-1.4.6/Makefile.am
Normal file
|
@ -0,0 +1,13 @@
|
|||
SUBDIRS = src man
|
||||
if ANACRON
|
||||
SUBDIRS += anacron
|
||||
endif
|
||||
|
||||
if PAM
|
||||
pamdir = $(sysconfdir)/pam.d
|
||||
dist_pam_DATA = pam/crond
|
||||
endif
|
||||
|
||||
EXTRA_DIST = cronie.init crond.sysconfig contrib/anacrontab \
|
||||
contrib/0anacron contrib/0hourly \
|
||||
contrib/dailyjobs
|
753
cronie-1.4.6/Makefile.in
Normal file
753
cronie-1.4.6/Makefile.in
Normal file
|
@ -0,0 +1,753 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@ANACRON_TRUE@am__append_1 = anacron
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(am__dist_pam_DATA_DIST) \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS config.guess config.sub depcomp \
|
||||
install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
am__dist_pam_DATA_DIST = pam/crond
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(pamdir)"
|
||||
DATA = $(dist_pam_DATA)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = src man anacron
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
ANACRONTAB = @ANACRONTAB@
|
||||
ANACRON_SPOOL_DIR = @ANACRON_SPOOL_DIR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DAEMON_GROUPNAME = @DAEMON_GROUPNAME@
|
||||
DAEMON_USERNAME = @DAEMON_USERNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPAM = @LIBPAM@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPOOL_DIR = @SPOOL_DIR@
|
||||
STRIP = @STRIP@
|
||||
SYSCRONTAB = @SYSCRONTAB@
|
||||
SYS_CROND_DIR = @SYS_CROND_DIR@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src man $(am__append_1)
|
||||
@PAM_TRUE@pamdir = $(sysconfdir)/pam.d
|
||||
@PAM_TRUE@dist_pam_DATA = pam/crond
|
||||
EXTRA_DIST = cronie.init crond.sysconfig contrib/anacrontab \
|
||||
contrib/0anacron contrib/0hourly \
|
||||
contrib/dailyjobs
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
install-dist_pamDATA: $(dist_pam_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pamdir)" || $(MKDIR_P) "$(DESTDIR)$(pamdir)"
|
||||
@list='$(dist_pam_DATA)'; test -n "$(pamdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pamdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pamdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-dist_pamDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(dist_pam_DATA)'; test -n "$(pamdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pamdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pamdir)" && rm -f $$files
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(DATA) config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(pamdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-dist_pamDATA
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-dist_pamDATA
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||
distclean distclean-generic distclean-hdr distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dist_pamDATA install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
tags-recursive uninstall uninstall-am uninstall-dist_pamDATA
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
0
cronie-1.4.6/NEWS
Normal file
0
cronie-1.4.6/NEWS
Normal file
11
cronie-1.4.6/README
Normal file
11
cronie-1.4.6/README
Normal file
|
@ -0,0 +1,11 @@
|
|||
17. January 2008 mmaslano (at) redhat (dot) com
|
||||
Rename the fork on cronie. The source code could be found here:
|
||||
http://mmaslano.fedorapeople.org/cronie/ or git archive here:
|
||||
git://git.fedorahosted.org/git/cronie.git
|
||||
|
||||
3. October 2007 mmaslano (at) redhat (dot) com
|
||||
This is a clone of 'original' vixie-cron. It was used in Red Hat|Fedora
|
||||
system and patched for a long time. Now was made clone tagged with
|
||||
version 4.2.
|
||||
Changes are mainly in git commit messages, some older changes could be
|
||||
found in spec changelog (contrib/vixie-cron.spec).
|
951
cronie-1.4.6/aclocal.m4
vendored
Normal file
951
cronie-1.4.6/aclocal.m4
vendored
Normal file
|
@ -0,0 +1,951 @@
|
|||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
|
||||
[m4_warning([this file was generated for autoconf 2.65.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
# _AM_AUTOCONF_VERSION(VERSION)
|
||||
# -----------------------------
|
||||
# aclocal traces this macro to find the Autoconf version.
|
||||
# This is a private macro too. Using m4_define simplifies
|
||||
# the logic in aclocal, which can simply ignore this definition.
|
||||
m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
|
||||
m4_define([_AM_COND_VALUE_$1], [$2])dnl
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 10
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], UPC, [depcc="$UPC" am_compiler_list=],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
am__universal=false
|
||||
m4_case([$1], [CC],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac],
|
||||
[CXX],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac])
|
||||
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this. Also, some Intel
|
||||
# versions had trouble with output in subdirs
|
||||
am__obj=sub/conftest.${OBJEXT-o}
|
||||
am__minus_obj="-o $am__obj"
|
||||
case $depmode in
|
||||
gcc)
|
||||
# This depmode causes a compiler race in universal mode.
|
||||
test "$am__universal" = false || continue
|
||||
;;
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
msvisualcpp | msvcmsys)
|
||||
# This compiler won't grok `-c -o', but also, the minuso test has
|
||||
# not run yet. These depmodes are late enough in the game, and
|
||||
# so weak that their functioning should not be impacted.
|
||||
am__obj=conftest.${OBJEXT-o}
|
||||
am__minus_obj=
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=$am__obj \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 5
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
shift
|
||||
for mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
}
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 16
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.62])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then
|
||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
|
||||
# is not polluted with repeated "-I."
|
||||
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
])
|
||||
|
||||
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
|
||||
dnl mangled by Autoconf and run in a shell conditional statement.
|
||||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_arg=$1
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$_am_arg | $_am_arg:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
*)
|
||||
install_sh="\${SHELL} $am_aux_dir/install-sh"
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from `make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
AC_MSG_ERROR([unsafe absolute working directory name]);;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
|
||||
esac
|
||||
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
# This macro is traced by Automake.
|
||||
AC_DEFUN([_AM_SUBST_NOTMAKE])
|
||||
|
||||
# AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Public sister of _AM_SUBST_NOTMAKE.
|
||||
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
28
cronie-1.4.6/anacron/Makefile.am
Normal file
28
cronie-1.4.6/anacron/Makefile.am
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Makefile.am - two binaries crond and crontab
|
||||
sbin_PROGRAMS = anacron
|
||||
|
||||
anacron_SOURCES = \
|
||||
gregor.c lock.c log.c main.c matchrx.c readtab.c runjob.c \
|
||||
$(common_src)
|
||||
common_src = global.h gregor.h matchrx.h
|
||||
common_nodist = anacron-paths.h
|
||||
nodist_anacron_SOURCES = $(common_nodist)
|
||||
BUILT_SOURCES = $(common_nodist)
|
||||
|
||||
|
||||
LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
|
||||
|
||||
# This header contains all the paths.
|
||||
# If they are configurable, they are declared in configure script.
|
||||
# Depends on this Makefile, because it uses make variables.
|
||||
anacron-paths.h: Makefile
|
||||
@echo 'creating $@'
|
||||
@sed >$@ 's/ *\\$$//' <<\END #\
|
||||
/* This file has been automatically generated. Do not edit. */ \
|
||||
\
|
||||
#ifndef _ANACRON_PATHS_H_ \
|
||||
#define _ANACRON_PATHS_H_ \
|
||||
#define ANACRON_SPOOL_DIR "$(ANACRON_SPOOL_DIR)" \
|
||||
#define ANACRONTAB "$(ANACRONTAB)" \
|
||||
#endif /* _ANACRON_PATHS_H_ */ \
|
||||
END
|
510
cronie-1.4.6/anacron/Makefile.in
Normal file
510
cronie-1.4.6/anacron/Makefile.in
Normal file
|
@ -0,0 +1,510 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
sbin_PROGRAMS = anacron$(EXEEXT)
|
||||
subdir = anacron
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(sbin_PROGRAMS)
|
||||
am__objects_1 =
|
||||
am_anacron_OBJECTS = gregor.$(OBJEXT) lock.$(OBJEXT) log.$(OBJEXT) \
|
||||
main.$(OBJEXT) matchrx.$(OBJEXT) readtab.$(OBJEXT) \
|
||||
runjob.$(OBJEXT) $(am__objects_1)
|
||||
nodist_anacron_OBJECTS = $(am__objects_1)
|
||||
anacron_OBJECTS = $(am_anacron_OBJECTS) $(nodist_anacron_OBJECTS)
|
||||
anacron_LDADD = $(LDADD)
|
||||
am__DEPENDENCIES_1 =
|
||||
anacron_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(anacron_SOURCES) $(nodist_anacron_SOURCES)
|
||||
DIST_SOURCES = $(anacron_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
ANACRONTAB = @ANACRONTAB@
|
||||
ANACRON_SPOOL_DIR = @ANACRON_SPOOL_DIR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DAEMON_GROUPNAME = @DAEMON_GROUPNAME@
|
||||
DAEMON_USERNAME = @DAEMON_USERNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPAM = @LIBPAM@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPOOL_DIR = @SPOOL_DIR@
|
||||
STRIP = @STRIP@
|
||||
SYSCRONTAB = @SYSCRONTAB@
|
||||
SYS_CROND_DIR = @SYS_CROND_DIR@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
anacron_SOURCES = \
|
||||
gregor.c lock.c log.c main.c matchrx.c readtab.c runjob.c \
|
||||
$(common_src)
|
||||
|
||||
common_src = global.h gregor.h matchrx.h
|
||||
common_nodist = anacron-paths.h
|
||||
nodist_anacron_SOURCES = $(common_nodist)
|
||||
BUILT_SOURCES = $(common_nodist)
|
||||
LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu anacron/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu anacron/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-sbinPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
|
||||
|
||||
clean-sbinPROGRAMS:
|
||||
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
|
||||
anacron$(EXEEXT): $(anacron_OBJECTS) $(anacron_DEPENDENCIES)
|
||||
@rm -f anacron$(EXEEXT)
|
||||
$(LINK) $(anacron_OBJECTS) $(anacron_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gregor.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matchrx.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readtab.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runjob.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(sbindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-sbinPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-sbinPROGRAMS
|
||||
|
||||
.MAKE: all check install install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-sbinPROGRAMS ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-sbinPROGRAMS install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-sbinPROGRAMS
|
||||
|
||||
|
||||
# This header contains all the paths.
|
||||
# If they are configurable, they are declared in configure script.
|
||||
# Depends on this Makefile, because it uses make variables.
|
||||
anacron-paths.h: Makefile
|
||||
@echo 'creating $@'
|
||||
@sed >$@ 's/ *\\$$//' <<\END #\
|
||||
/* This file has been automatically generated. Do not edit. */ \
|
||||
\
|
||||
#ifndef _ANACRON_PATHS_H_ \
|
||||
#define _ANACRON_PATHS_H_ \
|
||||
#define ANACRON_SPOOL_DIR "$(ANACRON_SPOOL_DIR)" \
|
||||
#define ANACRONTAB "$(ANACRONTAB)" \
|
||||
#endif /* _ANACRON_PATHS_H_ */ \
|
||||
END
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
156
cronie-1.4.6/anacron/global.h
Normal file
156
cronie-1.4.6/anacron/global.h
Normal file
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _ANACRON_GLOBAL_H
|
||||
#define _ANACRON_GLOBAL_H
|
||||
|
||||
/* Syslog facility and priorities messages will be logged to (see syslog(3)).
|
||||
* If you change these, please update the man page. */
|
||||
#define SYSLOG_FACILITY LOG_CRON
|
||||
#define EXPLAIN_LEVEL LOG_NOTICE /* informational messages */
|
||||
#define COMPLAIN_LEVEL LOG_ERR /* error messages */
|
||||
#define DEBUG_LEVEL LOG_DEBUG /* only used when DEBUG is defined */
|
||||
|
||||
/* Mail interface. (All MTAs should supply this command) */
|
||||
#define SENDMAIL "/usr/sbin/sendmail"
|
||||
|
||||
/* End of user-configurable section */
|
||||
|
||||
|
||||
#define FAILURE_EXIT 1
|
||||
#define MAX_MSG 150
|
||||
|
||||
#include <signal.h>
|
||||
#include "anacron-paths.h"
|
||||
|
||||
/* Some declarations */
|
||||
|
||||
struct env_rec1 {
|
||||
char *assign;
|
||||
|
||||
struct env_rec1 *next;
|
||||
};
|
||||
typedef struct env_rec1 env_rec;
|
||||
|
||||
struct job_rec1 {
|
||||
int period;
|
||||
int named_period;
|
||||
int delay;
|
||||
char *ident;
|
||||
char *command;
|
||||
char *mailto;
|
||||
|
||||
int tab_line;
|
||||
int arg_num;
|
||||
int timestamp_fd;
|
||||
int input_fd;
|
||||
int output_fd;
|
||||
int mail_header_size;
|
||||
pid_t job_pid;
|
||||
pid_t mailer_pid;
|
||||
int drop_job;
|
||||
|
||||
struct job_rec1 *next;
|
||||
env_rec *prev_env_rec;
|
||||
};
|
||||
typedef struct job_rec1 job_rec;
|
||||
|
||||
/* Global variables */
|
||||
|
||||
extern pid_t primary_pid;
|
||||
extern char *program_name;
|
||||
extern char *anacrontab;
|
||||
extern char *spooldir;
|
||||
extern int old_umask;
|
||||
extern sigset_t old_sigmask;
|
||||
extern int serialize,force,update_only,now,no_daemon,quiet,testing_only;
|
||||
extern int day_now;
|
||||
extern int year,month,day_of_month;
|
||||
extern int in_background;
|
||||
|
||||
extern job_rec *first_job_rec;
|
||||
extern env_rec *first_env_rec;
|
||||
|
||||
extern char **args;
|
||||
extern int nargs;
|
||||
|
||||
extern int njobs;
|
||||
extern job_rec **job_array;
|
||||
|
||||
extern int running_jobs,running_mailers;
|
||||
|
||||
extern int complaints;
|
||||
|
||||
/* time ranges for START_HOURS_RANGE */
|
||||
extern int range_start;
|
||||
extern int range_stop;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* main.c */
|
||||
int xopen(int fd, const char *file_name, int flags);
|
||||
void xclose(int fd);
|
||||
pid_t xfork(void);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PRINTF_FORMAT(n, m) \
|
||||
__attribute__ ((format (printf, n, m)))
|
||||
#else
|
||||
#define PRINTF_FORMAT(n, m)
|
||||
#endif
|
||||
|
||||
/* log.c */
|
||||
void explain(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void explain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void complain(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void complain_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void die(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void die_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void xdebug(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void xdebug_e(const char *fmt, ...)PRINTF_FORMAT(1,2);
|
||||
void xcloselog(void);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define Debug(args) xdebug args
|
||||
#define Debug_e(args) xdebug_e args
|
||||
#else /* not DEBUG */
|
||||
#define Debug(args) (void)(0)
|
||||
#define Debug_e(args) (void)(0)
|
||||
#endif /* not DEBUG */
|
||||
|
||||
/* readtab.c */
|
||||
void read_tab(int cwd);
|
||||
void arrange_jobs(void);
|
||||
|
||||
/* lock.c */
|
||||
int consider_job(job_rec *jr);
|
||||
void unlock(job_rec *jr);
|
||||
void update_timestamp(job_rec *jr);
|
||||
void fake_job(job_rec *jr);
|
||||
|
||||
/* runjob.c */
|
||||
void tend_children();
|
||||
void launch_job(job_rec *jr);
|
||||
|
||||
#endif
|
181
cronie-1.4.6/anacron/gregor.c
Normal file
181
cronie-1.4.6/anacron/gregor.c
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include "gregor.h"
|
||||
|
||||
static const int
|
||||
days_in_month[] = {
|
||||
31, /* Jan */
|
||||
28, /* Feb (non-leap) */
|
||||
31, /* Mar */
|
||||
30, /* Apr */
|
||||
31, /* May */
|
||||
30, /* Jun */
|
||||
31, /* Jul */
|
||||
31, /* Aug */
|
||||
30, /* Sep */
|
||||
31, /* Oct */
|
||||
30, /* Nov */
|
||||
31 /* Dec */
|
||||
};
|
||||
|
||||
static int leap(int year);
|
||||
|
||||
int
|
||||
day_num(int year, int month, int day)
|
||||
/* Return the "day number" of the date year-month-day according to the
|
||||
* "proleptic Gregorian calendar".
|
||||
* If the given date is invalid, return -1.
|
||||
*
|
||||
* Here, "day number" is defined as the number of days since December 31,
|
||||
* 1 B.C. (Gregorian). (January 1, 1 A.D. is day number 1 etc...)
|
||||
*
|
||||
* The Gregorian calendar was instituted by Pope Gregory XIII in 1582,
|
||||
* and has gradually spread to become the international standard calendar.
|
||||
* The proleptic Gregorian calendar is formed by projecting the date system
|
||||
* of the Gregorian calendar to dates before its adoption.
|
||||
*
|
||||
* For more details, see:
|
||||
* http://astro.nmsu.edu/~lhuber/leaphist.html
|
||||
* http://www.magnet.ch/serendipity/hermetic/cal_stud/cal_art.htm
|
||||
* and your local library.
|
||||
*/
|
||||
{
|
||||
int dn;
|
||||
int i;
|
||||
int isleap; /* save three calls to leap() */
|
||||
|
||||
/* Some validity checks */
|
||||
|
||||
/* we don't deal with B.C. years here */
|
||||
if (year < 1) return - 1;
|
||||
/* conservative overflow estimate */
|
||||
if (year > (INT_MAX / 366)) return - 1;
|
||||
if (month > 12 || month < 1) return - 1;
|
||||
if (day < 1) return - 1;
|
||||
|
||||
isleap = leap(year);
|
||||
|
||||
if (month != 2) {
|
||||
if(day > days_in_month[month - 1]) return - 1;
|
||||
}
|
||||
else if ((isleap && day > 29) || (!isleap && day > 28))
|
||||
return - 1;
|
||||
|
||||
/* First calculate the day number of December 31 last year */
|
||||
|
||||
/* save us from doing (year - 1) over and over */
|
||||
i = year - 1;
|
||||
/* 365 days in a "regular" year + number of leap days */
|
||||
dn = (i * 365) + ((i / 4) - (i / 100) + (i / 400));
|
||||
|
||||
/* Now, day number of the last day of the previous month */
|
||||
|
||||
for (i = month - 1; i > 0; --i)
|
||||
dn += days_in_month[i - 1];
|
||||
/* Add 29 February ? */
|
||||
if (month > 2 && isleap) ++dn;
|
||||
|
||||
/* How many days into month are we */
|
||||
|
||||
dn += day;
|
||||
|
||||
return dn;
|
||||
}
|
||||
|
||||
static int
|
||||
leap(int year)
|
||||
/* Is this a leap year ? */
|
||||
{
|
||||
/* every year exactly divisible by 4 is "leap" */
|
||||
/* unless it is exactly divisible by 100 */
|
||||
/* but not by 400 */
|
||||
return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
|
||||
}
|
||||
|
||||
int
|
||||
days_last_month (void)
|
||||
/* How many days did last month have? */
|
||||
{
|
||||
struct tm time_record;
|
||||
time_t current_time;
|
||||
time (¤t_time);
|
||||
localtime_r (¤t_time, &time_record);
|
||||
|
||||
switch (time_record.tm_mon) {
|
||||
case 0: return days_in_month[11];
|
||||
case 2: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0);
|
||||
default: return days_in_month[time_record.tm_mon - 1];
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
days_this_month (void)
|
||||
/* How many days does this month have? */
|
||||
{
|
||||
struct tm time_record;
|
||||
time_t current_time;
|
||||
time (¤t_time);
|
||||
localtime_r (¤t_time, &time_record);
|
||||
|
||||
switch (time_record.tm_mon) {
|
||||
case 1: return days_in_month[1] + (leap (time_record.tm_year + 1900) ? 1 : 0);
|
||||
default: return days_in_month[time_record.tm_mon];
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
days_last_year (void)
|
||||
/* How many days this last year have? */
|
||||
{
|
||||
struct tm time_record;
|
||||
time_t current_time;
|
||||
time (¤t_time);
|
||||
localtime_r (¤t_time, &time_record);
|
||||
|
||||
if (leap(time_record.tm_year - 1 + 1900)) {
|
||||
return 366;
|
||||
}
|
||||
|
||||
return 365;
|
||||
}
|
||||
|
||||
int
|
||||
days_this_year (void)
|
||||
/* How many days does this year have */
|
||||
{
|
||||
struct tm time_record;
|
||||
time_t current_time;
|
||||
time (¤t_time);
|
||||
localtime_r (¤t_time, &time_record);
|
||||
|
||||
if (leap(time_record.tm_year + 1900)) {
|
||||
return 366;
|
||||
}
|
||||
|
||||
return 365;
|
||||
}
|
30
cronie-1.4.6/anacron/gregor.h
Normal file
30
cronie-1.4.6/anacron/gregor.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
int day_num(int year, int month, int day);
|
||||
int days_last_month (void);
|
||||
int days_this_month (void);
|
||||
int days_last_year (void);
|
||||
int days_this_year (void);
|
196
cronie-1.4.6/anacron/lock.c
Normal file
196
cronie-1.4.6/anacron/lock.c
Normal file
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyirght (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
/* Lock and timestamp management
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include "global.h"
|
||||
#include "gregor.h"
|
||||
|
||||
static void
|
||||
open_tsfile(job_rec *jr)
|
||||
/* Open the timestamp file for job jr */
|
||||
{
|
||||
jr->timestamp_fd = open(jr->ident, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
if (jr->timestamp_fd == -1)
|
||||
die_e("Can't open timestamp file for job %s", jr->ident);
|
||||
fcntl(jr->timestamp_fd, F_SETFD, 1); /* set close-on-exec flag */
|
||||
/* We want to own this file, and set its mode to 0600. This is necessary
|
||||
* in order to prevent other users from putting locks on it. */
|
||||
if (fchown(jr->timestamp_fd, getuid(), getgid()))
|
||||
die_e("Can't chown timestamp file %s", jr->ident);
|
||||
if (fchmod(jr->timestamp_fd, S_IRUSR | S_IWUSR))
|
||||
die_e("Can't chmod timestamp file %s", jr->ident);
|
||||
}
|
||||
|
||||
static int
|
||||
lock_file(int fd)
|
||||
/* Attempt to put an exclusive fcntl() lock on file "fd"
|
||||
* Return 1 on success, 0 on failure.
|
||||
*/
|
||||
{
|
||||
int r;
|
||||
struct flock sfl;
|
||||
|
||||
sfl.l_type = F_WRLCK;
|
||||
sfl.l_start = 0;
|
||||
sfl.l_whence = SEEK_SET;
|
||||
sfl.l_len = 0; /* we lock all the file */
|
||||
errno = 0;
|
||||
r = fcntl(fd, F_SETLK, &sfl);
|
||||
if (r != -1) return 1;
|
||||
if (errno != EACCES && errno != EAGAIN)
|
||||
die_e("fcntl() error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
consider_job(job_rec *jr)
|
||||
/* Check the timestamp of the job. If "its time has come", lock the job
|
||||
* and return 1, if it's too early, or we can't get the lock, return 0.
|
||||
*/
|
||||
{
|
||||
char timestamp[9];
|
||||
int ts_year, ts_month, ts_day, dn;
|
||||
ssize_t b;
|
||||
|
||||
open_tsfile(jr);
|
||||
|
||||
/* read timestamp */
|
||||
b = read(jr->timestamp_fd, timestamp, 8);
|
||||
if (b == -1) die_e("Error reading timestamp file %s", jr->ident);
|
||||
timestamp[8] = 0;
|
||||
|
||||
/* is it too early? */
|
||||
if (!force && b == 8)
|
||||
{
|
||||
int day_delta;
|
||||
if (sscanf(timestamp, "%4d%2d%2d", &ts_year, &ts_month, &ts_day) == 3)
|
||||
dn = day_num(ts_year, ts_month, ts_day);
|
||||
else
|
||||
dn = 0;
|
||||
|
||||
day_delta = day_now - dn;
|
||||
|
||||
/*
|
||||
* if day_delta is negative, we assume there was a clock skew
|
||||
* and re-run any affected jobs
|
||||
* otherwise we check if the job's time has come
|
||||
*/
|
||||
if (day_delta >= 0 && day_delta < jr->period)
|
||||
{
|
||||
/* yes, skip job */
|
||||
xclose(jr->timestamp_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if it's a named period, in which case we need
|
||||
* to figure it out.
|
||||
*/
|
||||
if (jr->named_period)
|
||||
{
|
||||
int period = 0, bypass = 0;
|
||||
switch (jr->named_period)
|
||||
{
|
||||
case 1: /* monthly */
|
||||
period = days_last_month ();
|
||||
bypass = days_this_month ();
|
||||
break;
|
||||
case 2: /* yearly, annualy */
|
||||
period = days_last_year ();
|
||||
bypass = days_this_year ();
|
||||
break;
|
||||
case 3: /* daily */
|
||||
period = 1;
|
||||
bypass = 1;
|
||||
break;
|
||||
case 4: /* weekly */
|
||||
period = 7;
|
||||
bypass = 7;
|
||||
break;
|
||||
default:
|
||||
die ("Unknown named period for %s (%d)", jr->ident, jr->named_period);
|
||||
}
|
||||
printf ("Checking against %d with %d\n", day_delta, period);
|
||||
if (day_delta < period && day_delta != bypass)
|
||||
{
|
||||
/* Job is still too young */
|
||||
xclose (jr->timestamp_fd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no! try to grab the lock */
|
||||
if (lock_file(jr->timestamp_fd)) return 1; /* success */
|
||||
|
||||
/* didn't get lock */
|
||||
xclose(jr->timestamp_fd);
|
||||
explain("Job `%s' locked by another anacron - skipping", jr->ident);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
unlock(job_rec *jr)
|
||||
{
|
||||
xclose(jr->timestamp_fd);
|
||||
}
|
||||
|
||||
void
|
||||
update_timestamp(job_rec *jr)
|
||||
/* We write the date "now". "Now" can be either the time when anacron
|
||||
* started, or the time when the job finished.
|
||||
* I'm not quite sure which is more "right", but I've decided on the first
|
||||
* option.
|
||||
* Note that this is not the way it was with anacron 1.0.3 to 1.0.7.
|
||||
*/
|
||||
{
|
||||
char stamp[10];
|
||||
|
||||
snprintf(stamp, 10, "%04d%02d%02d\n", year, month, day_of_month);
|
||||
if (lseek(jr->timestamp_fd, 0, SEEK_SET))
|
||||
die_e("Can't lseek timestamp file for job %s", jr->ident);
|
||||
if (write(jr->timestamp_fd, stamp, 9) != 9)
|
||||
die_e("Can't write timestamp file for job %s", jr->ident);
|
||||
if (ftruncate(jr->timestamp_fd, 9))
|
||||
die_e("ftruncate error");
|
||||
}
|
||||
|
||||
void
|
||||
fake_job(job_rec *jr)
|
||||
/* We don't bother with any locking here. There's no point. */
|
||||
{
|
||||
open_tsfile(jr);
|
||||
update_timestamp(jr);
|
||||
xclose(jr->timestamp_fd);
|
||||
}
|
225
cronie-1.4.6/anacron/log.c
Normal file
225
cronie-1.4.6/anacron/log.c
Normal file
|
@ -0,0 +1,225 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
/* Error logging
|
||||
*
|
||||
* We have two levels of logging (plus debugging if DEBUG is defined):
|
||||
* "explain" level for informational messages, and "complain" level for errors.
|
||||
*
|
||||
* We log everything to syslog, see the top of global.h for relevant
|
||||
* definitions.
|
||||
*
|
||||
* Stderr gets "complain" messages when we're in the foreground,
|
||||
* and "explain" messages when we're in the foreground, and not "quiet".
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "global.h"
|
||||
|
||||
static char truncated[] = " (truncated)";
|
||||
static char msg[MAX_MSG + 1];
|
||||
static int log_open = 0;
|
||||
|
||||
/* Number of complaints that we've seen */
|
||||
int complaints = 0;
|
||||
|
||||
static void
|
||||
xopenlog()
|
||||
{
|
||||
if (!log_open)
|
||||
{
|
||||
openlog(program_name, LOG_PID, SYSLOG_FACILITY);
|
||||
log_open = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xcloselog()
|
||||
{
|
||||
if (log_open) closelog();
|
||||
log_open = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
make_msg(const char *fmt, va_list args)
|
||||
/* Construct the message string from its parts */
|
||||
{
|
||||
int len;
|
||||
|
||||
/* There's some confusion in the documentation about what vsnprintf
|
||||
* returns when the buffer overflows. Hmmm... */
|
||||
len = vsnprintf(msg, sizeof(msg), fmt, args);
|
||||
if (len >= sizeof(msg) - 1)
|
||||
strcpy(msg + sizeof(msg) - sizeof(truncated), truncated);
|
||||
}
|
||||
|
||||
static void
|
||||
slog(int priority, const char *fmt, va_list args)
|
||||
/* Log a message, described by "fmt" and "args", with the specified
|
||||
* "priority". */
|
||||
{
|
||||
make_msg(fmt, args);
|
||||
xopenlog();
|
||||
syslog(priority, "%s", msg);
|
||||
if (!in_background)
|
||||
{
|
||||
if (priority == EXPLAIN_LEVEL && !quiet)
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
else if (priority == COMPLAIN_LEVEL)
|
||||
fprintf(stderr, "%s: %s\n", program_name, msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
log_e(int priority, const char *fmt, va_list args)
|
||||
/* Same as slog(), but also appends an error description corresponding
|
||||
* to "errno". */
|
||||
{
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
make_msg(fmt, args);
|
||||
xopenlog();
|
||||
syslog(priority, "%s: %s", msg, strerror(saved_errno));
|
||||
if (!in_background)
|
||||
{
|
||||
if (priority == EXPLAIN_LEVEL && !quiet)
|
||||
fprintf(stderr, "%s: %s\n", msg, strerror(saved_errno));
|
||||
else if (priority == COMPLAIN_LEVEL)
|
||||
fprintf(stderr, "%s: %s: %s\n",
|
||||
program_name, msg, strerror(saved_errno));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
explain(const char *fmt, ...)
|
||||
/* Log an "explain" level message */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
slog(EXPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
explain_e(const char *fmt, ...)
|
||||
/* Log an "explain" level message, with an error description */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log_e(EXPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
complain(const char *fmt, ...)
|
||||
/* Log a "complain" level message */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
slog(COMPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
complaints += 1;
|
||||
}
|
||||
|
||||
void
|
||||
complain_e(const char *fmt, ...)
|
||||
/* Log a "complain" level message, with an error description */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log_e(COMPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
complaints += 1;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...)
|
||||
/* Log a "complain" level message, and exit */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
slog(COMPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
if (getpid() == primary_pid) complain("Aborted");
|
||||
|
||||
exit(FAILURE_EXIT);
|
||||
}
|
||||
|
||||
void
|
||||
die_e(const char *fmt, ...)
|
||||
/* Log a "complain" level message, with an error description, and exit */
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log_e(COMPLAIN_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
if (getpid() == primary_pid) complain("Aborted");
|
||||
|
||||
exit(FAILURE_EXIT);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/* These are called through the Debug() and Debug_e() macros, defined
|
||||
* in global.h */
|
||||
|
||||
void
|
||||
xdebug(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
slog(DEBUG_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
xdebug_e(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log_e(DEBUG_LEVEL, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#endif /* DEBUG */
|
529
cronie-1.4.6/anacron/main.c
Normal file
529
cronie-1.4.6/anacron/main.c
Normal file
|
@ -0,0 +1,529 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "global.h"
|
||||
#include "gregor.h"
|
||||
|
||||
pid_t primary_pid;
|
||||
int day_now;
|
||||
int year, month, day_of_month; /* date anacron started */
|
||||
|
||||
char *program_name;
|
||||
char *anacrontab;
|
||||
char *spooldir;
|
||||
int serialize, force, update_only, now,
|
||||
no_daemon, quiet, testing_only; /* command-line options */
|
||||
char **args; /* vector of "job" command-line arguments */
|
||||
int nargs; /* number of these */
|
||||
char *defarg = "*";
|
||||
int in_background; /* are we in the background? */
|
||||
int old_umask; /* umask when started */
|
||||
sigset_t old_sigmask; /* signal mask when started */
|
||||
|
||||
job_rec *first_job_rec;
|
||||
env_rec *first_env_rec;
|
||||
|
||||
static time_t start_sec; /* time anacron started */
|
||||
static volatile int got_sigalrm, got_sigchld, got_sigusr1;
|
||||
int running_jobs, running_mailers; /* , number of */
|
||||
int range_start = -1;
|
||||
int range_stop = -1;
|
||||
|
||||
static void
|
||||
print_version()
|
||||
{
|
||||
printf("Anacron \n"
|
||||
"Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>\n"
|
||||
"Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>\n"
|
||||
"Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>\n"
|
||||
"\n"
|
||||
"Mail comments, suggestions and bug reports to <pasc@redellipse.net>."
|
||||
"\n\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_usage()
|
||||
{
|
||||
printf("Usage: anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [-S spooldir] [job] ...\n"
|
||||
" anacron [-S spooldir] -u [job] ...\n"
|
||||
" anacron [-V|-h]\n"
|
||||
" anacron -T [-t anacrontab]\n"
|
||||
"\n"
|
||||
" -s Serialize execution of jobs\n"
|
||||
" -f Force execution of jobs, even before their time\n"
|
||||
" -n Run jobs with no delay, implies -s\n"
|
||||
" -d Don't fork to the background\n"
|
||||
" -q Suppress stderr messages, only applicable with -d\n"
|
||||
" -u Update the timestamps without actually running anything\n"
|
||||
" -t Use this anacrontab\n"
|
||||
" -V Print version information\n"
|
||||
" -h Print this message\n"
|
||||
" -T Test an anacrontab\n"
|
||||
" -S Select a different spool directory\n"
|
||||
"\n"
|
||||
"See the manpage for more details.\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
static void
|
||||
parse_opts(int argc, char *argv[])
|
||||
/* Parse command-line options */
|
||||
{
|
||||
int opt;
|
||||
|
||||
quiet = no_daemon = serialize = force = update_only = now = 0;
|
||||
opterr = 0;
|
||||
while ((opt = getopt(argc, argv, "sfundqt:TS:Vh")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 's':
|
||||
serialize = 1;
|
||||
break;
|
||||
case 'f':
|
||||
force = 1;
|
||||
break;
|
||||
case 'u':
|
||||
update_only = 1;
|
||||
break;
|
||||
case 'n':
|
||||
now = serialize = 1;
|
||||
break;
|
||||
case 'd':
|
||||
no_daemon = 1;
|
||||
break;
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
case 't':
|
||||
anacrontab = strdup(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
testing_only = 1;
|
||||
break;
|
||||
case 'S':
|
||||
spooldir = strdup(optarg);
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
case 'h':
|
||||
print_usage();
|
||||
exit(0);
|
||||
case '?':
|
||||
fprintf(stderr, "%s: invalid option: %c\n",
|
||||
program_name, optopt);
|
||||
fprintf(stderr, "type: `%s -h' for more information\n",
|
||||
program_name);
|
||||
exit(FAILURE_EXIT);
|
||||
}
|
||||
}
|
||||
if (optind == argc)
|
||||
{
|
||||
/* no arguments. Equivalent to: `*' */
|
||||
nargs = 1;
|
||||
args = &defarg;
|
||||
}
|
||||
else
|
||||
{
|
||||
nargs = argc - optind;
|
||||
args = argv + optind;
|
||||
}
|
||||
}
|
||||
|
||||
pid_t
|
||||
xfork()
|
||||
/* Like fork(), only never returns on failure */
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
pid = fork();
|
||||
if (pid == -1) die_e("Can't fork");
|
||||
return pid;
|
||||
}
|
||||
|
||||
int
|
||||
xopen(int fd, const char *file_name, int flags)
|
||||
/* Like open, only it:
|
||||
* a) never returns on failure, and
|
||||
* b) if "fd" is non-negative, expect the file to open
|
||||
* on file-descriptor "fd".
|
||||
*/
|
||||
{
|
||||
int rfd;
|
||||
|
||||
rfd = open(file_name, flags);
|
||||
if (fd >= 0 && rfd != fd)
|
||||
die_e("Can't open %s on file-descriptor %d", file_name, fd);
|
||||
else if (rfd < 0)
|
||||
die_e("Can't open %s", file_name);
|
||||
return rfd;
|
||||
}
|
||||
|
||||
void
|
||||
xclose(int fd)
|
||||
/* Like close(), only doesn't return on failure */
|
||||
{
|
||||
if (close(fd)) die_e("Can't close file descriptor %d", fd);
|
||||
}
|
||||
|
||||
static void
|
||||
go_background()
|
||||
/* Become a daemon. The foreground process exits successfully. */
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
/* stdin is already closed */
|
||||
|
||||
if (fclose(stdout)) die_e("Can't close stdout");
|
||||
xopen(1, "/dev/null", O_WRONLY);
|
||||
|
||||
if (fclose(stderr)) die_e("Can't close stderr");
|
||||
xopen(2, "/dev/null", O_WRONLY);
|
||||
|
||||
pid = xfork();
|
||||
if (pid != 0)
|
||||
{
|
||||
/* parent */
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* child */
|
||||
primary_pid = getpid();
|
||||
if (setsid() == -1) die_e("setsid() error");
|
||||
in_background = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
handle_sigalrm()
|
||||
{
|
||||
got_sigalrm = 1;
|
||||
}
|
||||
|
||||
void
|
||||
handle_sigchld()
|
||||
{
|
||||
got_sigchld = 1;
|
||||
}
|
||||
|
||||
void
|
||||
handle_sigusr1()
|
||||
{
|
||||
got_sigusr1 = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
set_signal_handling()
|
||||
/* We only use SIGALRM, SIGCHLD and SIGUSR1, and we unblock them only
|
||||
* in wait_signal().
|
||||
*/
|
||||
{
|
||||
sigset_t ss;
|
||||
struct sigaction sa;
|
||||
|
||||
got_sigalrm = got_sigchld = got_sigusr1 = 0;
|
||||
|
||||
/* block SIGALRM, SIGCHLD and SIGUSR1 */
|
||||
if (sigemptyset(&ss) ||
|
||||
sigaddset(&ss, SIGALRM) ||
|
||||
sigaddset(&ss, SIGCHLD) ||
|
||||
sigaddset(&ss, SIGUSR1)) die_e("sigset error");
|
||||
if (sigprocmask(SIG_BLOCK, &ss, NULL)) die_e ("sigprocmask error");
|
||||
|
||||
/* setup SIGALRM handler */
|
||||
sa.sa_handler = handle_sigalrm;
|
||||
sa.sa_mask = ss;
|
||||
sa.sa_flags = 0;
|
||||
if (sigaction(SIGALRM, &sa, NULL)) die_e("sigaction error");
|
||||
|
||||
/* setup SIGCHLD handler */
|
||||
sa.sa_handler = handle_sigchld;
|
||||
sa.sa_mask = ss;
|
||||
sa.sa_flags = SA_NOCLDSTOP;
|
||||
if (sigaction(SIGCHLD, &sa, NULL)) die_e("sigaction error");
|
||||
|
||||
/* setup SIGUSR1 handler */
|
||||
sa.sa_handler = handle_sigusr1;
|
||||
sa.sa_mask = ss;
|
||||
sa.sa_flags = 0;
|
||||
if (sigaction(SIGUSR1, &sa, NULL)) die_e("sigaction error");
|
||||
}
|
||||
|
||||
static void
|
||||
wait_signal()
|
||||
/* Return after a signal is caught */
|
||||
{
|
||||
sigset_t ss;
|
||||
|
||||
if (sigprocmask(0, NULL, &ss)) die_e("sigprocmask error");
|
||||
if (sigdelset(&ss, SIGALRM) ||
|
||||
sigdelset(&ss, SIGCHLD) ||
|
||||
sigdelset(&ss, SIGUSR1)) die_e("sigset error");
|
||||
sigsuspend(&ss);
|
||||
}
|
||||
|
||||
static void
|
||||
wait_children()
|
||||
/* Wait until we have no more children (of any kind) */
|
||||
{
|
||||
while (running_jobs > 0 || running_mailers > 0)
|
||||
{
|
||||
wait_signal();
|
||||
if (got_sigchld) tend_children();
|
||||
got_sigchld = 0;
|
||||
if (got_sigusr1) explain("Received SIGUSR1");
|
||||
got_sigusr1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
orderly_termination()
|
||||
/* Execution is diverted here, when we get SIGUSR1 */
|
||||
{
|
||||
explain("Received SIGUSR1");
|
||||
got_sigusr1 = 0;
|
||||
wait_children();
|
||||
explain("Exited");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
xsleep(unsigned int n)
|
||||
/* Sleep for n seconds, servicing SIGCHLDs and SIGUSR1s in the meantime.
|
||||
* If n=0, return immediately.
|
||||
*/
|
||||
{
|
||||
if (n == 0) return;
|
||||
alarm(n);
|
||||
do
|
||||
{
|
||||
wait_signal();
|
||||
if (got_sigchld) tend_children();
|
||||
got_sigchld = 0;
|
||||
if (got_sigusr1) orderly_termination();
|
||||
}
|
||||
while (!got_sigalrm);
|
||||
got_sigalrm = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
wait_jobs()
|
||||
/* Wait until there are no running jobs,
|
||||
* servicing SIGCHLDs and SIGUSR1s in the meantime.
|
||||
*/
|
||||
{
|
||||
while (running_jobs > 0)
|
||||
{
|
||||
wait_signal();
|
||||
if (got_sigchld) tend_children();
|
||||
got_sigchld = 0;
|
||||
if (got_sigusr1) orderly_termination();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
record_start_time()
|
||||
{
|
||||
struct tm *tm_now;
|
||||
|
||||
start_sec = time(NULL);
|
||||
tm_now = localtime(&start_sec);
|
||||
year = tm_now->tm_year + 1900;
|
||||
month = tm_now->tm_mon + 1;
|
||||
day_of_month = tm_now->tm_mday;
|
||||
day_now = day_num(year, month, day_of_month);
|
||||
if (day_now == -1) die("Invalid date (this is really embarrassing)");
|
||||
if (!update_only && !testing_only)
|
||||
explain("Anacron started on %04d-%02d-%02d",
|
||||
year, month, day_of_month);
|
||||
}
|
||||
|
||||
static int
|
||||
time_till(job_rec *jr)
|
||||
/* Return the number of seconds that we have to wait until it's time
|
||||
* to start job jr.
|
||||
*/
|
||||
{
|
||||
unsigned int tj, tn;
|
||||
|
||||
if (now) return 0;
|
||||
tn = time(NULL);
|
||||
tj = start_sec + jr->delay * 60;
|
||||
if (tj < tn) return 0;
|
||||
return tj - tn;
|
||||
}
|
||||
|
||||
static void
|
||||
fake_jobs()
|
||||
{
|
||||
int j;
|
||||
|
||||
j = 0;
|
||||
while (j < njobs)
|
||||
{
|
||||
fake_job(job_array[j]);
|
||||
explain("Updated timestamp for job `%s' to %04d-%02d-%02d",
|
||||
job_array[j]->ident, year, month, day_of_month);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
explain_intentions()
|
||||
{
|
||||
int j;
|
||||
struct tm *t;
|
||||
|
||||
j = 0;
|
||||
while (j < njobs)
|
||||
{
|
||||
if (now)
|
||||
{
|
||||
explain("Will run job `%s'", job_array[j]->ident);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t jobtime = start_sec + job_array[j]->delay * 60;
|
||||
|
||||
t = localtime(&jobtime);
|
||||
if (range_start != -1 && range_stop != -1 &&
|
||||
(t->tm_hour < range_start || t->tm_hour >= range_stop))
|
||||
{
|
||||
Debug(("The job `%s' falls out of the %02d:00-%02d:00 hours range, skipping.",
|
||||
job_array[j]->ident, range_start, range_stop));
|
||||
job_array[j]->drop_job = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
explain("Will run job `%s' in %d min.",
|
||||
job_array[j]->ident, job_array[j]->delay);
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if (serialize && njobs > 0)
|
||||
explain("Jobs will be executed sequentially");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int j;
|
||||
|
||||
int cwd;
|
||||
|
||||
int dropped_jobs = 0;
|
||||
|
||||
anacrontab = NULL;
|
||||
spooldir = NULL;
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
|
||||
if (gettimeofday(&tv, &tz) != 0)
|
||||
explain("Can't get exact time, failure.");
|
||||
|
||||
srandom(getpid()+tv.tv_usec);
|
||||
|
||||
if((program_name = strrchr(argv[0], '/')) == NULL)
|
||||
program_name = argv[0];
|
||||
else
|
||||
++program_name; /* move pointer to char after '/' */
|
||||
|
||||
parse_opts(argc, argv);
|
||||
|
||||
if (anacrontab == NULL)
|
||||
anacrontab = strdup(ANACRONTAB);
|
||||
|
||||
if (spooldir == NULL)
|
||||
spooldir = strdup(ANACRON_SPOOL_DIR);
|
||||
|
||||
if ((cwd = open ("./", O_RDONLY)) == -1) {
|
||||
die_e ("Can't save current directory");
|
||||
}
|
||||
|
||||
in_background = 0;
|
||||
|
||||
if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir );
|
||||
|
||||
old_umask = umask(0);
|
||||
|
||||
if (sigprocmask(0, NULL, &old_sigmask)) die_e("sigset error");
|
||||
|
||||
if (fclose(stdin)) die_e("Can't close stdin");
|
||||
xopen(0, "/dev/null", O_RDONLY);
|
||||
|
||||
if (!no_daemon && !testing_only)
|
||||
go_background();
|
||||
else
|
||||
primary_pid = getpid();
|
||||
|
||||
record_start_time();
|
||||
read_tab(cwd);
|
||||
close(cwd);
|
||||
arrange_jobs();
|
||||
|
||||
if (testing_only)
|
||||
{
|
||||
if (complaints) exit (1);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
if (update_only)
|
||||
{
|
||||
fake_jobs();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
explain_intentions();
|
||||
set_signal_handling();
|
||||
running_jobs = running_mailers = 0;
|
||||
for(j = 0; j < njobs; ++j)
|
||||
{
|
||||
if (job_array[j]->drop_job == 1)
|
||||
{
|
||||
++dropped_jobs;
|
||||
continue;
|
||||
}
|
||||
xsleep(time_till(job_array[j]));
|
||||
if (serialize) wait_jobs();
|
||||
launch_job(job_array[j]);
|
||||
}
|
||||
wait_children();
|
||||
explain("Normal exit (%d job%s run)", njobs-dropped_jobs, (njobs-dropped_jobs == 1 ? "" : "s"));
|
||||
exit(0);
|
||||
}
|
87
cronie-1.4.6/anacron/matchrx.c
Normal file
87
cronie-1.4.6/anacron/matchrx.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <regex.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "matchrx.h"
|
||||
|
||||
int
|
||||
match_rx(const char *rx, char *string, int n_sub, /* char **substrings */...)
|
||||
/* Return 1 if the regular expression "*rx" matches the string "*string",
|
||||
* 0 if not, -1 on error.
|
||||
* "Extended" regular expressions are used.
|
||||
* Additionally, there should be "n_sub" "substrings" arguments. These,
|
||||
* if not NULL, and if the match succeeds are set to point to the
|
||||
* corresponding substrings of the regexp.
|
||||
* The original string is changed, and the substrings must not overlap,
|
||||
* or even be directly adjacent.
|
||||
* This is not the most efficient, or elegant way of doing this.
|
||||
*/
|
||||
{
|
||||
int r, n;
|
||||
regex_t crx;
|
||||
va_list va;
|
||||
char **substring;
|
||||
regmatch_t *sub_offsets;
|
||||
sub_offsets = malloc(sizeof(regmatch_t) * (n_sub + 1));
|
||||
memset(sub_offsets, 0, sizeof(regmatch_t) * (n_sub + 1));
|
||||
|
||||
if (regcomp(&crx, rx, REG_EXTENDED)) {
|
||||
free(sub_offsets);
|
||||
return - 1;
|
||||
}
|
||||
r = regexec(&crx, string, n_sub + 1, sub_offsets, 0);
|
||||
if (r != 0 && r != REG_NOMATCH) {
|
||||
free(sub_offsets);
|
||||
return - 1;
|
||||
}
|
||||
regfree(&crx);
|
||||
if (r == REG_NOMATCH) {
|
||||
free(sub_offsets);
|
||||
return 0;
|
||||
}
|
||||
|
||||
va_start(va, n_sub);
|
||||
n = 1;
|
||||
while (n <= n_sub)
|
||||
{
|
||||
substring = va_arg(va, char**);
|
||||
if (substring != NULL)
|
||||
{
|
||||
if (sub_offsets[n].rm_so == -1) {
|
||||
free(sub_offsets);
|
||||
return - 1;
|
||||
}
|
||||
*substring = string + sub_offsets[n].rm_so;
|
||||
*(string + sub_offsets[n].rm_eo) = 0;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
va_end(va);
|
||||
free(sub_offsets);
|
||||
return 1;
|
||||
}
|
26
cronie-1.4.6/anacron/matchrx.h
Normal file
26
cronie-1.4.6/anacron/matchrx.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
int match_rx(const char *rx, char *string,
|
||||
int n_sub, /* char **substrings */...);
|
393
cronie-1.4.6/anacron/readtab.c
Normal file
393
cronie-1.4.6/anacron/readtab.c
Normal file
|
@ -0,0 +1,393 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
Copyright (C) 2004 Pascal Hakim <pasc@redellipse.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
/* /etc/anacrontab parsing, and job sorting
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <obstack.h>
|
||||
#include <limits.h>
|
||||
#include <fnmatch.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include "global.h"
|
||||
#include "matchrx.h"
|
||||
|
||||
static struct obstack input_o; /* holds input line */
|
||||
static struct obstack tab_o; /* holds processed data read from anacrontab */
|
||||
static FILE *tab;
|
||||
job_rec **job_array;
|
||||
int njobs; /* number of jobs to run */
|
||||
static int jobs_read; /* number of jobs read */
|
||||
static int line_num; /* current line in anacrontab */
|
||||
static job_rec *last_job_rec; /* last job stored in memory, at the moment */
|
||||
static env_rec *last_env_rec; /* last environment assignment stored */
|
||||
|
||||
static int random_number = 0;
|
||||
|
||||
/* some definitions for the obstack macros */
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
static void *
|
||||
xmalloc (size_t size)
|
||||
/* Just like standard malloc(), only never returns NULL. */
|
||||
{
|
||||
void * ptr;
|
||||
|
||||
ptr = malloc(size);
|
||||
if (ptr == NULL)
|
||||
die("Memory exhausted");
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static int
|
||||
conv2int(const char *s)
|
||||
/* Return the int or -1 on over/under-flow
|
||||
*/
|
||||
{
|
||||
long l;
|
||||
|
||||
errno = 0;
|
||||
l = strtol(s, NULL, 10);
|
||||
/* we use negative as error, so I am really returning unsigned int */
|
||||
if (errno == ERANGE || l < 0 || l > INT_MAX) return - 1;
|
||||
return l;
|
||||
}
|
||||
|
||||
static char *
|
||||
read_tab_line ()
|
||||
/* Read one line and return a pointer to it.
|
||||
Return NULL if no more lines.
|
||||
*/
|
||||
{
|
||||
int c, prev=0;
|
||||
|
||||
if (feof(tab)) return NULL;
|
||||
while (1)
|
||||
{
|
||||
c = getc(tab);
|
||||
if ((c == '\n' && prev != '\\') || c == EOF)
|
||||
{
|
||||
if (0 != prev) obstack_1grow(&input_o, prev);
|
||||
break;
|
||||
}
|
||||
|
||||
if ('\\' != prev && 0 != prev && '\n' != prev) obstack_1grow(&input_o, prev);
|
||||
else if ('\n' == prev) obstack_1grow(&input_o, ' ');
|
||||
|
||||
prev = c;
|
||||
}
|
||||
if (ferror(tab)) die_e("Error reading %s", anacrontab);
|
||||
obstack_1grow(&input_o, '\0');
|
||||
return obstack_finish(&input_o);
|
||||
}
|
||||
|
||||
static int
|
||||
job_arg_num(const char *ident)
|
||||
/* Return the command-line-argument number refering to this job-identifier.
|
||||
* If it isn't specified, return -1.
|
||||
*/
|
||||
{
|
||||
int i, r;
|
||||
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
r = fnmatch(args[i], ident, 0);
|
||||
if (r == 0) return i;
|
||||
if (r != FNM_NOMATCH) die("fnmatch() error");
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
static void
|
||||
register_env(const char *env_var, const char *value)
|
||||
/* Store the environment assignment "env_var"="value" */
|
||||
{
|
||||
env_rec *er;
|
||||
int var_len, val_len;
|
||||
|
||||
var_len = strlen(env_var);
|
||||
val_len = strlen(value);
|
||||
er = obstack_alloc(&tab_o, sizeof(env_rec));
|
||||
er->assign = obstack_alloc(&tab_o, var_len + 1 + val_len + 1);
|
||||
strcpy(er->assign, env_var);
|
||||
er->assign[var_len] = '=';
|
||||
strcpy(er->assign + var_len + 1, value);
|
||||
er->assign[var_len + 1 + val_len] = 0;
|
||||
if (last_env_rec != NULL) last_env_rec->next = er;
|
||||
else first_env_rec = er;
|
||||
last_env_rec = er;
|
||||
Debug(("on line %d: %s", line_num, er->assign));
|
||||
}
|
||||
|
||||
static void
|
||||
register_job(const char *periods, const char *delays,
|
||||
const char *ident, char *command)
|
||||
/* Store a job definition */
|
||||
{
|
||||
int period, delay;
|
||||
job_rec *jr;
|
||||
int ident_len, command_len;
|
||||
|
||||
ident_len = strlen(ident);
|
||||
command_len = strlen(command);
|
||||
jobs_read++;
|
||||
period = conv2int(periods);
|
||||
delay = conv2int(delays);
|
||||
if (period < 0 || delay < 0)
|
||||
{
|
||||
complain("%s: number out of range on line %d, skipping",
|
||||
anacrontab, line_num);
|
||||
return;
|
||||
}
|
||||
jr = obstack_alloc(&tab_o, sizeof(job_rec));
|
||||
jr->period = period;
|
||||
jr->named_period = 0;
|
||||
delay += random_number;
|
||||
jr->delay = delay;
|
||||
jr->tab_line = line_num;
|
||||
jr->ident = obstack_alloc(&tab_o, ident_len + 1);
|
||||
strcpy(jr->ident, ident);
|
||||
jr->arg_num = job_arg_num(ident);
|
||||
jr->command = obstack_alloc(&tab_o, command_len + 1);
|
||||
strcpy(jr->command, command);
|
||||
jr->job_pid = jr->mailer_pid = 0;
|
||||
if (last_job_rec != NULL) last_job_rec->next = jr;
|
||||
else first_job_rec = jr;
|
||||
last_job_rec = jr;
|
||||
jr->prev_env_rec = last_env_rec;
|
||||
jr->next = NULL;
|
||||
Debug(("Read job - period=%d, delay=%d, ident=%s, command=%s",
|
||||
jr->period, jr->delay, jr->ident, jr->command));
|
||||
}
|
||||
|
||||
static void
|
||||
register_period_job(const char *periods, const char *delays,
|
||||
const char *ident, char *command)
|
||||
/* Store a job definition with a named period */
|
||||
{
|
||||
int delay;
|
||||
job_rec *jr;
|
||||
int period_len, ident_len, command_len;
|
||||
|
||||
period_len = strlen(periods);
|
||||
ident_len = strlen(ident);
|
||||
command_len = strlen(command);
|
||||
jobs_read++;
|
||||
delay = conv2int(delays);
|
||||
if (delay < 0)
|
||||
{
|
||||
complain("%s: number out of range on line %d, skipping",
|
||||
anacrontab, line_num);
|
||||
return;
|
||||
}
|
||||
|
||||
jr = obstack_alloc(&tab_o, sizeof(job_rec));
|
||||
if (!strncmp ("@monthly", periods, 7)) {
|
||||
jr->named_period = 1;
|
||||
} else if (!strncmp("@yearly", periods, 7) || !strncmp("@annualy", periods, 8)) {
|
||||
jr->named_period = 2;
|
||||
} else if (!strncmp ("@daily", periods, 7)) {
|
||||
jr->named_period = 3;
|
||||
} else if (!strncmp ("@weekly", periods, 7)) {
|
||||
jr->named_period = 4;
|
||||
} else {
|
||||
complain("%s: Unknown named period on line %d, skipping",
|
||||
anacrontab, line_num);
|
||||
}
|
||||
jr->period = 0;
|
||||
delay += random_number;
|
||||
jr->delay = delay;
|
||||
jr->tab_line = line_num;
|
||||
jr->ident = obstack_alloc(&tab_o, ident_len + 1);
|
||||
strcpy(jr->ident, ident);
|
||||
jr->arg_num = job_arg_num(ident);
|
||||
jr->command = obstack_alloc(&tab_o, command_len + 1);
|
||||
strcpy(jr->command, command);
|
||||
jr->job_pid = jr->mailer_pid = 0;
|
||||
if (last_job_rec != NULL) last_job_rec->next = jr;
|
||||
else first_job_rec = jr;
|
||||
last_job_rec = jr;
|
||||
jr->prev_env_rec = last_env_rec;
|
||||
jr->next = NULL;
|
||||
Debug(("Read job - period %d, delay=%d, ident%s, command=%s",
|
||||
jr->named_period, jr->delay, jr->ident, jr->command));
|
||||
}
|
||||
|
||||
static void
|
||||
parse_tab_line(char *line)
|
||||
{
|
||||
int r;
|
||||
char *env_var;
|
||||
char *value;
|
||||
char *periods;
|
||||
char *delays;
|
||||
char *ident;
|
||||
char *command;
|
||||
char *from;
|
||||
char *to;
|
||||
|
||||
/* an empty line? */
|
||||
r = match_rx("^[ \t]*($|#)", line, 0);
|
||||
if (r == -1) goto reg_err;
|
||||
if (r)
|
||||
{
|
||||
Debug(("line %d empty", line_num));
|
||||
return;
|
||||
}
|
||||
|
||||
/* an environment assignment? */
|
||||
r = match_rx("^[ \t]*([^ \t=]+)[ \t]*=(.*)$", line, 2,
|
||||
&env_var, &value);
|
||||
if (r == -1) goto reg_err;
|
||||
if (r)
|
||||
{
|
||||
if (strncmp(env_var, "START_HOURS_RANGE", 17) == 0)
|
||||
{
|
||||
r = match_rx("^([[:digit:]]+)-([[:digit:]]+)$", value, 2, &from, &to);
|
||||
if ((r == -1) || (from == NULL) || (to == NULL)) goto reg_invalid;
|
||||
range_start = atoi(from);
|
||||
range_stop = atoi(to);
|
||||
Debug(("Jobs will start in the %02d:00-%02d:00 range.", range_start, range_stop));
|
||||
}
|
||||
if (strncmp(env_var, "RANDOM_DELAY", 12) == 0) {
|
||||
r = match_rx("^([[:digit:]]+)$", value, 0);
|
||||
if (r != -1) {
|
||||
int i = random();
|
||||
double x = 0;
|
||||
x = (double) i / (double) RAND_MAX * (double) (atoi(value));
|
||||
random_number = (int)x;
|
||||
Debug(("Randomized delay set: %d", random_number));
|
||||
}
|
||||
else goto reg_invalid;
|
||||
}
|
||||
register_env(env_var, value);
|
||||
return;
|
||||
}
|
||||
|
||||
/* a job? */
|
||||
r = match_rx("^[ \t]*([[:digit:]]+)[ \t]+([[:digit:]]+)[ \t]+"
|
||||
"([^ \t/]+)[ \t]+([^ \t].*)$",
|
||||
line, 4, &periods, &delays, &ident, &command);
|
||||
if (r == -1) goto reg_err;
|
||||
if (r)
|
||||
{
|
||||
register_job(periods, delays, ident, command);
|
||||
return;
|
||||
}
|
||||
|
||||
/* A period job? */
|
||||
r = match_rx("^[ \t]*(@[^ \t]+)[ \t]+([[:digit:]]+)[ \t]+"
|
||||
"([^ \t/]+)[ \t]+([^ \t].*)$",
|
||||
line, 4, &periods, &delays, &ident, &command);
|
||||
if (r == -1) goto reg_err;
|
||||
if (r)
|
||||
{
|
||||
register_period_job(periods, delays, ident, command);
|
||||
return;
|
||||
}
|
||||
|
||||
reg_invalid:
|
||||
complain("Invalid syntax in %s on line %d - skipping this line",
|
||||
anacrontab, line_num);
|
||||
return;
|
||||
|
||||
reg_err:
|
||||
die("Regex error reading %s", anacrontab);
|
||||
}
|
||||
|
||||
void
|
||||
read_tab(int cwd)
|
||||
/* Read the anacrontab file into memory */
|
||||
{
|
||||
char *tab_line;
|
||||
|
||||
first_job_rec = last_job_rec = NULL;
|
||||
first_env_rec = last_env_rec = NULL;
|
||||
jobs_read = 0;
|
||||
line_num = 0;
|
||||
/* Open the anacrontab file */
|
||||
fchdir (cwd);
|
||||
tab = fopen(anacrontab, "r");
|
||||
if (chdir(spooldir)) die_e("Can't chdir to %s", spooldir);
|
||||
|
||||
if (tab == NULL) die_e("Error opening %s", anacrontab);
|
||||
/* Initialize the obstacks */
|
||||
obstack_init(&input_o);
|
||||
obstack_init(&tab_o);
|
||||
while ((tab_line = read_tab_line()) != NULL)
|
||||
{
|
||||
line_num++;
|
||||
parse_tab_line(tab_line);
|
||||
obstack_free(&input_o, tab_line);
|
||||
}
|
||||
if (fclose(tab)) die_e("Error closing %s", anacrontab);
|
||||
}
|
||||
|
||||
static int
|
||||
execution_order(const job_rec **job1, const job_rec **job2)
|
||||
/* Comparison function for sorting the jobs.
|
||||
*/
|
||||
{
|
||||
int d;
|
||||
|
||||
d = (*job1)->arg_num - (*job2)->arg_num;
|
||||
if (d != 0 && now) return d;
|
||||
d = (*job1)->delay - (*job2)->delay;
|
||||
if (d != 0) return d;
|
||||
d = (*job1)->tab_line - (*job2)->tab_line;
|
||||
return d;
|
||||
}
|
||||
|
||||
void
|
||||
arrange_jobs()
|
||||
/* Make an array of pointers to jobs that are going to be executed,
|
||||
* and arrange them in the order of execution.
|
||||
* Also lock these jobs.
|
||||
*/
|
||||
{
|
||||
job_rec *j;
|
||||
|
||||
j = first_job_rec;
|
||||
njobs = 0;
|
||||
while (j != NULL)
|
||||
{
|
||||
if (j->arg_num != -1 && (update_only || testing_only || consider_job(j)))
|
||||
{
|
||||
njobs++;
|
||||
obstack_grow(&tab_o, &j, sizeof(j));
|
||||
}
|
||||
j = j->next;
|
||||
}
|
||||
job_array = obstack_finish(&tab_o);
|
||||
|
||||
/* sort the jobs */
|
||||
qsort(job_array, njobs, sizeof(*job_array),
|
||||
(int (*)(const void *, const void *))execution_order);
|
||||
}
|
345
cronie-1.4.6/anacron/runjob.c
Normal file
345
cronie-1.4.6/anacron/runjob.c
Normal file
|
@ -0,0 +1,345 @@
|
|||
/*
|
||||
Anacron - run commands periodically
|
||||
Copyright (C) 1998 Itai Tzur <itzur@actcom.co.il>
|
||||
Copyright (C) 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
The GNU General Public License can also be found in the file
|
||||
`COPYING' that comes with the Anacron source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "global.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
static int
|
||||
temp_file(job_rec *jr)
|
||||
/* Open a temporary file and return its file descriptor */
|
||||
{
|
||||
const int max_retries = 50;
|
||||
char *name;
|
||||
int fdin, fdout, i;
|
||||
|
||||
i = 0;
|
||||
name = NULL;
|
||||
do
|
||||
{
|
||||
i++;
|
||||
free(name);
|
||||
name = tempnam(NULL, NULL);
|
||||
if (name == NULL) die("Can't find a unique temporary filename");
|
||||
fdout = open(name, O_WRONLY | O_CREAT | O_EXCL | O_APPEND,
|
||||
S_IRUSR | S_IWUSR);
|
||||
if ( fdout != -1 )
|
||||
fdin = open(name, O_RDONLY, S_IRUSR | S_IWUSR);
|
||||
/* I'm not sure we actually need to be so persistent here */
|
||||
} while (fdout == -1 && errno == EEXIST && i < max_retries);
|
||||
|
||||
if (fdout == -1) die_e("Can't open temporary file for writing");
|
||||
if (fdin == -1) die_e("Can't open temporary file for reading");
|
||||
if (unlink(name)) die_e("Can't unlink temporary file");
|
||||
free(name);
|
||||
fcntl(fdout, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */
|
||||
fcntl(fdin, F_SETFD, FD_CLOEXEC); /* set close-on-exec flag */
|
||||
|
||||
jr->input_fd = fdin;
|
||||
jr->output_fd = fdout;
|
||||
|
||||
return fdout;
|
||||
}
|
||||
|
||||
static off_t
|
||||
file_size(int fd)
|
||||
/* Return the size of temporary file fd */
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (fstat(fd, &st)) die_e("Can't fstat temporary file");
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
static char *
|
||||
username()
|
||||
{
|
||||
struct passwd *ps;
|
||||
|
||||
ps = getpwuid(geteuid());
|
||||
if (ps == NULL) die_e("getpwuid() error");
|
||||
return ps->pw_name;
|
||||
}
|
||||
|
||||
static void
|
||||
xputenv(const char *s)
|
||||
{
|
||||
if (putenv(s)) die_e("Can't set the environment");
|
||||
}
|
||||
|
||||
static void
|
||||
setup_env(const job_rec *jr)
|
||||
/* Setup the environment for the job according to /etc/anacrontab */
|
||||
{
|
||||
env_rec *er;
|
||||
|
||||
er = first_env_rec;
|
||||
if (er == NULL || jr->prev_env_rec == NULL) return;
|
||||
xputenv(er->assign);
|
||||
while (er != jr->prev_env_rec)
|
||||
{
|
||||
er = er->next;
|
||||
xputenv(er->assign);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
run_job(const job_rec *jr)
|
||||
/* This is called to start the job, after the fork */
|
||||
{
|
||||
/* setup stdout and stderr */
|
||||
xclose(1);
|
||||
xclose(2);
|
||||
if (dup2(jr->output_fd, 1) != 1 || dup2(jr->output_fd, 2) != 2)
|
||||
die_e("dup2() error"); /* dup2 also clears close-on-exec flag */
|
||||
in_background = 0; /* now, errors will be mailed to the user */
|
||||
if (chdir("/")) die_e("Can't chdir to '/'");
|
||||
|
||||
umask(old_umask);
|
||||
if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL))
|
||||
die_e("sigprocmask error");
|
||||
xcloselog();
|
||||
execl("/bin/sh", "/bin/sh", "-c", jr->command, (char *)NULL);
|
||||
die_e("execl() error");
|
||||
}
|
||||
|
||||
static void
|
||||
xwrite(int fd, const char *string)
|
||||
/* Write (using write()) the string "string" to temporary file "fd".
|
||||
* Don't return on failure */
|
||||
{
|
||||
if (write(fd, string, strlen(string)) == -1)
|
||||
die_e("Can't write to temporary file");
|
||||
}
|
||||
|
||||
static int
|
||||
xwait(pid_t pid , int *status)
|
||||
/* Check if child process "pid" has finished. If it has, return 1 and its
|
||||
* exit status in "*status". If not, return 0.
|
||||
*/
|
||||
{
|
||||
pid_t r;
|
||||
|
||||
r = waitpid(pid, status, WNOHANG);
|
||||
if (r == -1) die_e("waitpid() error");
|
||||
if (r == 0) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
launch_mailer(job_rec *jr)
|
||||
{
|
||||
pid_t pid;
|
||||
struct stat buf;
|
||||
int r;
|
||||
|
||||
/* Check that we have a way of sending mail. */
|
||||
if(stat(SENDMAIL, &buf))
|
||||
{
|
||||
complain("Can't find sendmail at %s, not mailing output", SENDMAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
pid = xfork();
|
||||
if (pid == 0)
|
||||
{
|
||||
/* child */
|
||||
in_background = 1;
|
||||
/* set stdin to the job's output */
|
||||
xclose(0);
|
||||
if (dup2(jr->input_fd, 0) != 0) die_e("Can't dup2()");
|
||||
if (lseek(0, 0, SEEK_SET) != 0) die_e("Can't lseek()");
|
||||
umask(old_umask);
|
||||
if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL))
|
||||
die_e("sigprocmask error");
|
||||
xcloselog();
|
||||
|
||||
/* Ensure stdout/stderr are sane before exec-ing sendmail */
|
||||
xclose(1); xopen(1, "/dev/null", O_WRONLY);
|
||||
xclose(2); xopen(2, "/dev/null", O_WRONLY);
|
||||
xclose(jr->output_fd);
|
||||
|
||||
/* Ensure stdin is not appendable ... ? */
|
||||
/* fdflags = fcntl(0, F_GETFL); fdflags &= ~O_APPEND; */
|
||||
/* fcntl(0, F_SETFL, fdflags ); */
|
||||
|
||||
/* Here, I basically mirrored the way /usr/sbin/sendmail is called
|
||||
* by cron on a Debian system, except for the "-oem" and "-or0s"
|
||||
* options, which don't seem to be appropriate here.
|
||||
* Hopefully, this will keep all the MTAs happy. */
|
||||
execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi",
|
||||
jr->mailto, (char *)NULL);
|
||||
die_e("Can't exec " SENDMAIL);
|
||||
}
|
||||
/* parent */
|
||||
/* record mailer pid */
|
||||
jr->mailer_pid = pid;
|
||||
running_mailers++;
|
||||
}
|
||||
|
||||
static void
|
||||
tend_mailer(job_rec *jr, int status)
|
||||
{
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
|
||||
complain("Tried to mail output of job `%s', "
|
||||
"but mailer process (" SENDMAIL ") exited with status %d",
|
||||
jr->ident, WEXITSTATUS(status));
|
||||
else if (!WIFEXITED(status) && WIFSIGNALED(status))
|
||||
complain("Tried to mail output of job `%s', "
|
||||
"but mailer process (" SENDMAIL ") got signal %d",
|
||||
jr->ident, WTERMSIG(status));
|
||||
else if (!WIFEXITED(status) && !WIFSIGNALED(status))
|
||||
complain("Tried to mail output of job `%s', "
|
||||
"but mailer process (" SENDMAIL ") terminated abnormally"
|
||||
, jr->ident);
|
||||
|
||||
jr->mailer_pid = 0;
|
||||
running_mailers--;
|
||||
}
|
||||
|
||||
void
|
||||
launch_job(job_rec *jr)
|
||||
{
|
||||
pid_t pid;
|
||||
int fd;
|
||||
char hostname[512];
|
||||
char *mailto;
|
||||
|
||||
/* get hostname */
|
||||
if (gethostname(hostname, 512)) {
|
||||
strcpy (hostname,"unknown machine");
|
||||
}
|
||||
|
||||
setup_env(jr);
|
||||
|
||||
/* Get the destination email address if set, or current user otherwise */
|
||||
mailto = getenv("MAILTO");
|
||||
|
||||
if (mailto)
|
||||
jr->mailto = mailto;
|
||||
else
|
||||
jr->mailto = username ();
|
||||
|
||||
/* create temporary file for stdout and stderr of the job */
|
||||
temp_file(jr); fd = jr->output_fd;
|
||||
/* write mail header */
|
||||
xwrite(fd, "From: ");
|
||||
xwrite(fd, "Anacron <");
|
||||
xwrite(fd, username());
|
||||
xwrite(fd, ">\n");
|
||||
xwrite(fd, "To: ");
|
||||
if (mailto) {
|
||||
xwrite(fd, mailto);
|
||||
} else {
|
||||
xwrite(fd, username());
|
||||
}
|
||||
xwrite(fd, "\n");
|
||||
xwrite(fd, "Content-Type: text/plain; charset=\"");
|
||||
xwrite(fd, nl_langinfo(CODESET));
|
||||
xwrite(fd, "\"\n");
|
||||
xwrite(fd, "Subject: Anacron job '");
|
||||
xwrite(fd, jr->ident);
|
||||
xwrite(fd, "' on ");
|
||||
xwrite(fd, hostname);
|
||||
xwrite(fd, "\n\n");
|
||||
|
||||
jr->mail_header_size = file_size(fd);
|
||||
|
||||
pid = xfork();
|
||||
if (pid == 0)
|
||||
{
|
||||
/* child */
|
||||
in_background = 1;
|
||||
run_job(jr);
|
||||
/* execution never gets here */
|
||||
}
|
||||
/* parent */
|
||||
explain("Job `%s' started", jr->ident);
|
||||
jr->job_pid = pid;
|
||||
running_jobs++;
|
||||
}
|
||||
|
||||
static void
|
||||
tend_job(job_rec *jr, int status)
|
||||
/* Take care of a finished job */
|
||||
{
|
||||
int mail_output;
|
||||
char *m;
|
||||
|
||||
update_timestamp(jr);
|
||||
unlock(jr);
|
||||
if (file_size(jr->output_fd) > jr->mail_header_size) mail_output = 1;
|
||||
else mail_output = 0;
|
||||
|
||||
m = mail_output ? " (mailing output)" : "";
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
|
||||
explain("Job `%s' terminated%s", jr->ident, m);
|
||||
else if (WIFEXITED(status))
|
||||
explain("Job `%s' terminated (exit status: %d)%s",
|
||||
jr->ident, WEXITSTATUS(status), m);
|
||||
else if (WIFSIGNALED(status))
|
||||
complain("Job `%s' terminated due to signal %d%s",
|
||||
jr->ident, WTERMSIG(status), m);
|
||||
else /* is this possible? */
|
||||
complain("Job `%s' terminated abnormally%s", jr->ident, m);
|
||||
|
||||
jr->job_pid = 0;
|
||||
running_jobs--;
|
||||
if (mail_output) launch_mailer(jr);
|
||||
xclose(jr->output_fd);
|
||||
xclose(jr->input_fd);
|
||||
}
|
||||
|
||||
void
|
||||
tend_children()
|
||||
/* This is called whenever we get a SIGCHLD.
|
||||
* Takes care of zombie children.
|
||||
*/
|
||||
{
|
||||
int j;
|
||||
int status;
|
||||
|
||||
j = 0;
|
||||
while (j < njobs)
|
||||
{
|
||||
if (job_array[j]->mailer_pid != 0 &&
|
||||
xwait(job_array[j]->mailer_pid, &status))
|
||||
tend_mailer(job_array[j], status);
|
||||
if (job_array[j]->job_pid != 0 &&
|
||||
xwait(job_array[j]->job_pid, &status))
|
||||
tend_job(job_array[j], status);
|
||||
j++;
|
||||
}
|
||||
}
|
1501
cronie-1.4.6/config.guess
vendored
Executable file
1501
cronie-1.4.6/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
249
cronie-1.4.6/config.h.in
Normal file
249
cronie-1.4.6/config.h.in
Normal file
|
@ -0,0 +1,249 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* if you have a tm_gmtoff member in struct tm */
|
||||
#undef CAPITALIZE_FOR_PS
|
||||
|
||||
/* Code will be built with debug info. */
|
||||
#undef DEBUGGING
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the `fchgrp' function. */
|
||||
#undef HAVE_FCHGRP
|
||||
|
||||
/* Define to 1 if you have the `fchown' function. */
|
||||
#undef HAVE_FCHOWN
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `flock' function. */
|
||||
#undef HAVE_FLOCK
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the `getseuserbyname' function. */
|
||||
#undef HAVE_GETSEUSERBYNAME
|
||||
|
||||
/* Define to 1 if you have the `get_default_context_with_level' function. */
|
||||
#undef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL
|
||||
|
||||
/* Define to 1 if you have the <glob.h> header file. */
|
||||
#undef HAVE_GLOB_H
|
||||
|
||||
/* Define to 1 if you have the `inotify_add_watch' function. */
|
||||
#undef HAVE_INOTIFY_ADD_WATCH
|
||||
|
||||
/* Define to 1 if you have the `inotify_init' function. */
|
||||
#undef HAVE_INOTIFY_INIT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `pam' library (-lpam). */
|
||||
#undef HAVE_LIBPAM
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the `lockf' function. */
|
||||
#undef HAVE_LOCKF
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `pam_getenvlist' function. */
|
||||
#undef HAVE_PAM_GETENVLIST
|
||||
|
||||
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
|
||||
#undef HAVE_PAM_PAM_APPL_H
|
||||
|
||||
/* Define to 1 if you have the `pam_putenv' function. */
|
||||
#undef HAVE_PAM_PUTENV
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define to 1 if you have the <pty.h> header file. */
|
||||
#undef HAVE_PTY_H
|
||||
|
||||
/* Define to 1 if you have the <security/pam_appl.h> header file. */
|
||||
#undef HAVE_SECURITY_PAM_APPL_H
|
||||
|
||||
/* Define to 1 if you have the <selinux/selinux.h> header file. */
|
||||
#undef HAVE_SELINUX_SELINUX_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
|
||||
/* Define to 1 if you have the <sys/audit.h> header file. */
|
||||
#undef HAVE_SYS_AUDIT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/fcntl.h> header file. */
|
||||
#undef HAVE_SYS_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/inotify.h> header file. */
|
||||
#undef HAVE_SYS_INOTIFY_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stream.h> header file. */
|
||||
#undef HAVE_SYS_STREAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stropts.h> header file. */
|
||||
#undef HAVE_SYS_STROPTS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/timers.h> header file. */
|
||||
#undef HAVE_SYS_TIMERS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <util.h> header file. */
|
||||
#undef HAVE_UTIL_H
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
/* There will be path to sendmail. */
|
||||
#undef MAILARG
|
||||
|
||||
/* -i = don't terminate on "." by itself -Fx = Set full-name of sender -odi =
|
||||
Option Deliverymode Interactive -oem = Option Errors Mailedtosender -oi =
|
||||
Ignore "." alone on a line -t = Get recipient from headers -f %s = Envelope
|
||||
sender address -d = undocumented but common flag. */
|
||||
#undef MAILFMT
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Using syslog for log messages. */
|
||||
#undef SYSLOG
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you want Audit trails. */
|
||||
#undef WITH_AUDIT
|
||||
|
||||
/* Define if you want inotify support. */
|
||||
#undef WITH_INOTIFY
|
||||
|
||||
/* Define if you want to enable PAM support */
|
||||
#undef WITH_PAM
|
||||
|
||||
/* Define if you want SELinux support. */
|
||||
#undef WITH_SELINUX
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define to `long int' if <sys/types.h> does not define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
1705
cronie-1.4.6/config.sub
vendored
Executable file
1705
cronie-1.4.6/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
6567
cronie-1.4.6/configure
vendored
Executable file
6567
cronie-1.4.6/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
248
cronie-1.4.6/configure.ac
Normal file
248
cronie-1.4.6/configure.ac
Normal file
|
@ -0,0 +1,248 @@
|
|||
AC_INIT([cronie],[1.4.6],[mmaslano@redhat.com])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
dnl Check for _GNU_SOURCE
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
AC_CHECK_HEADERS( \
|
||||
dirent.h \
|
||||
fcntl.h \
|
||||
getopt.h \
|
||||
glob.h \
|
||||
limits.h \
|
||||
paths.h \
|
||||
pty.h \
|
||||
selinux/selinux.h \
|
||||
stddef.h \
|
||||
stdint.h \
|
||||
sys/audit.h \
|
||||
sys/inotify.h \
|
||||
sys/stat.h \
|
||||
sys/stream.h \
|
||||
sys/stropts.h \
|
||||
sys/time.h \
|
||||
sys/timers.h \
|
||||
sys/types.h \
|
||||
sys/cdefs.h \
|
||||
sys/fcntl.h \
|
||||
time.h \
|
||||
unistd.h \
|
||||
util.h \
|
||||
utime.h \
|
||||
)
|
||||
|
||||
AC_CHECK_FUNCS( \
|
||||
fcntl \
|
||||
lockf \
|
||||
flock \
|
||||
fchown \
|
||||
fchgrp \
|
||||
)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_UID_T
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_STRUCT_TM
|
||||
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
||||
|
||||
dnl Checking for programs
|
||||
|
||||
AC_MSG_CHECKING(username to run under)
|
||||
AC_ARG_WITH(daemon_username,
|
||||
[AS_HELP_STRING([--with-daemon_username=DAEMON_USERNAME], [Username to run under (default daemon) ])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
AC_MSG_ERROR(Need DAEMON_USERNAME.)
|
||||
;;
|
||||
yes)
|
||||
DAEMON_USERNAME=daemon
|
||||
AC_MSG_RESULT(daemon)
|
||||
;;
|
||||
*)
|
||||
DAEMON_USERNAME="$withval";
|
||||
AC_MSG_RESULT($withval)
|
||||
;;
|
||||
esac ],
|
||||
DAEMON_USERNAME=daemon
|
||||
AC_MSG_RESULT(daemon)
|
||||
)
|
||||
AC_SUBST(DAEMON_USERNAME)
|
||||
|
||||
AC_MSG_CHECKING(groupname to run under)
|
||||
AC_ARG_WITH(daemon_groupname,
|
||||
[AS_HELP_STRING([--with-daemon_groupname=DAEMON_GROUPNAME], [Groupname to run under (default daemon) ])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
AC_MSG_ERROR(Need DAEMON_GROUPNAME.)
|
||||
;;
|
||||
yes)
|
||||
DAEMON_GROUPNAME=daemon
|
||||
AC_MSG_RESULT(daemon)
|
||||
;;
|
||||
*)
|
||||
DAEMON_GROUPNAME="$withval";
|
||||
AC_MSG_RESULT($withval)
|
||||
;;
|
||||
esac ],
|
||||
DAEMON_GROUPNAME=daemon
|
||||
AC_MSG_RESULT(daemon)
|
||||
)
|
||||
AC_SUBST(DAEMON_GROUPNAME)
|
||||
|
||||
# Check whether inotify is accepted
|
||||
AC_ARG_WITH(inotify,
|
||||
[AS_HELP_STRING([--with-inotify], [ Enable inotify support])],
|
||||
[ if test "x$withval" != "xno" ; then
|
||||
AC_DEFINE(WITH_INOTIFY,1,[Define if you want inotify support.])
|
||||
AC_CHECK_HEADER([sys/inotify.h], , AC_MSG_ERROR(Inotify support requires sys/inotify.h header))
|
||||
AC_CHECK_FUNCS(inotify_init inotify_add_watch)
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(pie,CRONIE_HELP_STRING(--enable-pie,Build cronie as a Position Independent Executable))
|
||||
if test "x$enable_pie" = xyes; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS -fpie"
|
||||
LDFLAGS="$LDFLAGS -pie -fpie"
|
||||
AC_CACHE_CHECK([whether compiler accepts -pie -fpie], ac_cv_pie_fpie,
|
||||
[AC_TRY_LINK([], [],
|
||||
ac_cv_pie_fpie=yes, ac_cv_pie_fpie=no)])
|
||||
if test $ac_cv_pie_fpie = no; then
|
||||
CFLAGS="$save_CFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether user wants SELinux support
|
||||
SELINUX_MSG="no"
|
||||
LIBSELINUX=""
|
||||
AC_ARG_WITH(selinux,
|
||||
[AS_HELP_STRING([--with-selinux], [Enable SELinux support])],
|
||||
[ if test "x$withval" != "xno" ; then
|
||||
saved_LIBS="$LIBS"
|
||||
AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
|
||||
SELINUX_MSG="yes"
|
||||
AC_CHECK_HEADER([selinux/selinux.h], ,AC_MSG_ERROR(SELinux support requires selinux.h header))
|
||||
AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
|
||||
AC_MSG_ERROR(SELinux support requires libselinux library))
|
||||
AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
|
||||
LIBS="$saved_LIBS $LIBSELINUX"
|
||||
AC_SUBST(LIBSELINUX)
|
||||
fi ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [Build with PAM support])])
|
||||
AC_ARG_ENABLE(pam, [AS_HELP_STRING([--enable-pam], [Alias for --with-pam])])
|
||||
|
||||
# Check that with_pam and enable_pam are consistent.
|
||||
# If neither one is set, the default is "no."
|
||||
if test -z "$with_pam"; then
|
||||
with_pam=${enable_pam:-no}
|
||||
elif test -n "$enable_pam" && test "$with_pam" != "$enable_pam"; then
|
||||
AC_MSG_ERROR(
|
||||
[Contradicting --with/without-pam and --enable/disable-pam options.])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([PAM], [test "$with_pam" != no])
|
||||
|
||||
if test "$with_pam" != no; then
|
||||
AC_DEFINE(WITH_PAM, 1, [Define if you want to enable PAM support])
|
||||
pam_appl_h_found=no
|
||||
AC_CHECK_HEADERS([pam/pam_appl.h security/pam_appl.h],
|
||||
[pam_appl_h_found=yes])
|
||||
test "$pam_appl_h_found" = yes ||
|
||||
AC_MSG_ERROR([PAM headers not found])
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
AC_CHECK_LIB([dl], [dlopen], [libdl_found=yes], [libdl_found=no])
|
||||
AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
|
||||
AC_CHECK_FUNCS([pam_getenvlist pam_putenv])
|
||||
LIBS="$saved_LIBS"
|
||||
|
||||
case $libdl_found:" $LIBS " in #(
|
||||
*" -ldl "*) LIBPAM= ;; #(
|
||||
yes:*) LIBPAM=-ldl ;; # libdl found, but is not in $LIBS
|
||||
esac
|
||||
AC_SUBST([LIBPAM], ["-lpam $LIBPAM"])
|
||||
fi
|
||||
|
||||
AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
|
||||
|
||||
AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
|
||||
|
||||
AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s",
|
||||
[-i = don't terminate on "." by itself
|
||||
-Fx = Set full-name of sender
|
||||
-odi = Option Deliverymode Interactive
|
||||
-oem = Option Errors Mailedtosender
|
||||
-oi = Ignore "." alone on a line
|
||||
-t = Get recipient from headers
|
||||
-f %s = Envelope sender address
|
||||
-d = undocumented but common flag.])
|
||||
|
||||
AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
|
||||
|
||||
AC_DEFINE(CAPITALIZE_FOR_PS, 1, [if you have a tm_gmtoff member in struct tm])
|
||||
|
||||
# Check whether user wants Linux audit support
|
||||
AC_ARG_WITH(audit,
|
||||
[AS_HELP_STRING([--with-audit], [Enable audit trails])],
|
||||
[ if test "x$withval" != "xno" ; then
|
||||
saved_LIBS="$LIBS"
|
||||
AC_DEFINE(WITH_AUDIT,1,[Define if you want Audit trails.])
|
||||
AC_CHECK_HEADER([libaudit.h], ,AC_MSG_ERROR(Audit trails requires libaudit.h header))
|
||||
AC_CHECK_LIB(audit, audit_open, [ LIBAUDIT="-laudit" ],
|
||||
AC_MSG_ERROR(Audit support needs audit libraries.))
|
||||
LIBS="$saved_LIBS $LIBAUDIT"
|
||||
AC_SUBST(LIBAUDIT)
|
||||
fi ]
|
||||
)
|
||||
|
||||
dnl CRONIE_VAR_DEFAULT (VAR, DESCRIPTION, DEFAULT)
|
||||
dnl --------------------------------------------
|
||||
AC_DEFUN([CRONIE_CONF_VAR],
|
||||
[AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
|
||||
if test "$$1" = ""; then
|
||||
$1='$3'
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([ANACRON_CONF_VAR],
|
||||
[AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
|
||||
if test "$$1" = ""; then
|
||||
$1='$3'
|
||||
fi
|
||||
])
|
||||
|
||||
CRONIE_CONF_VAR([SYSCRONTAB], [the current working directory of the running daemon], [${sysconfdir}/crontab])
|
||||
CRONIE_CONF_VAR([SYS_CROND_DIR], [the current working directory of the running daemon], [${sysconfdir}/cron.d])
|
||||
CRONIE_CONF_VAR([SPOOL_DIR], [the directory where all the user cron tabs reside], [${localstatedir}/spool/cron])
|
||||
|
||||
AC_ARG_ENABLE([anacron], [AS_HELP_STRING([--enable-anacron], [Build also anacron.])])
|
||||
AM_CONDITIONAL([ANACRON], [test "$enable_anacron" = yes])
|
||||
if test "$enable_anacron" != no; then
|
||||
ANACRON_CONF_VAR([ANACRON_SPOOL_DIR],[The path for anacron locks.],[${localstatedir}/spool/anacron])
|
||||
ANACRON_CONF_VAR([ANACRONTAB],[The anacron table for regular jobs.],[${sysconfdir}/anacrontab])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile anacron/Makefile])
|
||||
AC_OUTPUT
|
||||
|
18
cronie-1.4.6/contrib/0anacron
Normal file
18
cronie-1.4.6/contrib/0anacron
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
#in case file doesn't exist
|
||||
if test -r /var/spool/anacron/cron.daily; then
|
||||
day=`cat /var/spool/anacron/cron.daily`
|
||||
fi
|
||||
if [ `date +%Y%m%d` = "$day" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# in case anacron is already running,
|
||||
# there will be log (daemon won't be running twice).
|
||||
if test -x /usr/bin/on_ac_power; then
|
||||
/usr/bin/on_ac_power &> /dev/null
|
||||
if test $? -eq 1; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
/usr/sbin/anacron -s
|
4
cronie-1.4.6/contrib/0hourly
Normal file
4
cronie-1.4.6/contrib/0hourly
Normal file
|
@ -0,0 +1,4 @@
|
|||
SHELL=/bin/bash
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root
|
||||
01 * * * * root run-parts /etc/cron.hourly
|
16
cronie-1.4.6/contrib/anacrontab
Normal file
16
cronie-1.4.6/contrib/anacrontab
Normal file
|
@ -0,0 +1,16 @@
|
|||
# /etc/anacrontab: configuration file for anacron
|
||||
|
||||
# See anacron(8) and anacrontab(5) for details.
|
||||
|
||||
SHELL=/bin/sh
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root
|
||||
# the maximal random delay added to the base delay of the jobs
|
||||
RANDOM_DELAY=45
|
||||
# the jobs will be started during the following hours only
|
||||
START_HOURS_RANGE=3-22
|
||||
|
||||
#period in days delay in minutes job-identifier command
|
||||
1 5 cron.daily nice run-parts /etc/cron.daily
|
||||
7 25 cron.weekly nice run-parts /etc/cron.weekly
|
||||
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
|
8
cronie-1.4.6/contrib/dailyjobs
Normal file
8
cronie-1.4.6/contrib/dailyjobs
Normal file
|
@ -0,0 +1,8 @@
|
|||
SHELL=/bin/bash
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root
|
||||
|
||||
# run-parts
|
||||
02 4 * * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.daily
|
||||
22 4 * * 0 root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.weekly
|
||||
42 4 1 * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.monthly
|
3
cronie-1.4.6/crond.sysconfig
Normal file
3
cronie-1.4.6/crond.sysconfig
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Settings for the CRON daemon.
|
||||
# CRONDARGS= : any extra command-line startup arguments for crond
|
||||
CRONDARGS=
|
132
cronie-1.4.6/cronie.init
Executable file
132
cronie-1.4.6/cronie.init
Executable file
|
@ -0,0 +1,132 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# crond Start/Stop the cron clock daemon.
|
||||
#
|
||||
# chkconfig: 2345 90 60
|
||||
# description: cron is a standard UNIX program that runs user-specified \
|
||||
# programs at periodic scheduled times. vixie cron adds a \
|
||||
# number of features to the basic UNIX cron, including better \
|
||||
# security and more powerful configuration options.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: crond crontab
|
||||
# Required-Start: $local_fs $syslog
|
||||
# Required-Stop: $local_fs $syslog
|
||||
# Default-Start: 2345
|
||||
# Default-Stop: 90
|
||||
# Short-Description: run cron daemon
|
||||
# Description: cron is a standard UNIX program that runs user-specified
|
||||
# programs at periodic scheduled times. vixie cron adds a
|
||||
# number of features to the basic UNIX cron, including better
|
||||
# security and more powerful configuration options.
|
||||
### END INIT INFO
|
||||
|
||||
[ -f /etc/sysconfig/crond ] || {
|
||||
[ "$1" = "status" ] && exit 4 || exit 6
|
||||
}
|
||||
|
||||
RETVAL=0
|
||||
prog="crond"
|
||||
exec=/usr/sbin/crond
|
||||
lockfile=/var/lock/subsys/crond
|
||||
config=/etc/sysconfig/crond
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
start() {
|
||||
if [ $UID -ne 0 ] ; then
|
||||
echo "User has insufficient privilege."
|
||||
exit 4
|
||||
fi
|
||||
[ -x $exec ] || exit 5
|
||||
[ -f $config ] || exit 6
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $prog $CRONDARGS
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ $UID -ne 0 ] ; then
|
||||
echo "User has insufficient privilege."
|
||||
exit 4
|
||||
fi
|
||||
echo -n $"Stopping $prog: "
|
||||
if [ -n "`pidfileofproc $exec`" ]; then
|
||||
killproc $exec
|
||||
RETVAL=3
|
||||
else
|
||||
failure $"Stopping $prog"
|
||||
fi
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
echo -n $"Reloading $prog: "
|
||||
if [ -n "`pidfileofproc $exec`" ]; then
|
||||
killproc $exec -HUP
|
||||
else
|
||||
failure $"Reloading $prog"
|
||||
fi
|
||||
retval=$?
|
||||
echo
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
# new configuration takes effect after restart
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status -p /var/run/crond.pid $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
|
630
cronie-1.4.6/depcomp
Executable file
630
cronie-1.4.6/depcomp
Executable file
|
@ -0,0 +1,630 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
520
cronie-1.4.6/install-sh
Executable file
520
cronie-1.4.6/install-sh
Executable file
|
@ -0,0 +1,520 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
6
cronie-1.4.6/man/Makefile.am
Normal file
6
cronie-1.4.6/man/Makefile.am
Normal file
|
@ -0,0 +1,6 @@
|
|||
dist_man_MANS = crontab.1 crontab.5 cron.8 crond.8
|
||||
if ANACRON
|
||||
dist_man_MANS += anacrontab.5 anacron.8
|
||||
endif
|
||||
noinst_MANS = bitstring.3
|
||||
|
500
cronie-1.4.6/man/Makefile.in
Normal file
500
cronie-1.4.6/man/Makefile.in
Normal file
|
@ -0,0 +1,500 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@ANACRON_TRUE@am__append_1 = anacrontab.5 anacron.8
|
||||
subdir = man
|
||||
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \
|
||||
"$(DESTDIR)$(man8dir)"
|
||||
man5dir = $(mandir)/man5
|
||||
man8dir = $(mandir)/man8
|
||||
NROFF = nroff
|
||||
MANS = $(dist_man_MANS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
ANACRONTAB = @ANACRONTAB@
|
||||
ANACRON_SPOOL_DIR = @ANACRON_SPOOL_DIR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DAEMON_GROUPNAME = @DAEMON_GROUPNAME@
|
||||
DAEMON_USERNAME = @DAEMON_USERNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPAM = @LIBPAM@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPOOL_DIR = @SPOOL_DIR@
|
||||
STRIP = @STRIP@
|
||||
SYSCRONTAB = @SYSCRONTAB@
|
||||
SYS_CROND_DIR = @SYS_CROND_DIR@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
dist_man_MANS = crontab.1 crontab.5 cron.8 crond.8 $(am__append_1)
|
||||
noinst_MANS = bitstring.3
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu man/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-man1: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
|
||||
install-man5: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
|
||||
@list=''; test -n "$(man5dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.5[a-z]*$$/p'; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man5:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man5dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.5[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
|
||||
install-man8: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
|
||||
@list=''; test -n "$(man8dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.8[a-z]*$$/p'; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man8:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man8dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.8[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(MANS)'; if test -n "$$list"; then \
|
||||
list=`for p in $$list; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
|
||||
if test -n "$$list" && \
|
||||
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
|
||||
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
|
||||
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
|
||||
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
|
||||
echo " typically \`make maintainer-clean' will remove them" >&2; \
|
||||
exit 1; \
|
||||
else :; fi; \
|
||||
else :; fi
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man1 install-man5 install-man8
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man1 install-man5 install-man8 install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-man \
|
||||
uninstall-man1 uninstall-man5 uninstall-man8
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
167
cronie-1.4.6/man/anacron.8
Normal file
167
cronie-1.4.6/man/anacron.8
Normal file
|
@ -0,0 +1,167 @@
|
|||
.TH ANACRON 8 2009-07-17 "Marcela Mašláňová" "Anacron Users' Manual"
|
||||
.SH NAME
|
||||
anacron \- runs commands periodically
|
||||
.SH SYNOPSIS
|
||||
.B anacron \fR[\fB-s\fR] [\fB-f\fR] [\fB-n\fR] [\fB-d\fR] [\fB-q\fR]
|
||||
[\fB-t anacrontab\fR] [\fB-S spooldir\fR] [\fIjob\fR]
|
||||
.br
|
||||
.B anacron \fR[\fB-S spooldir\fR] -u [\fB-t anacrontab\fR] \fR[\fIjob\fR]
|
||||
.br
|
||||
.B anacron \fR[\fB-V\fR|\fB-h\fR]
|
||||
.br
|
||||
.B anacron -T \fR[\fB-t anacrontab\fR]
|
||||
.SH DESCRIPTION
|
||||
Anacron
|
||||
is used to execute commands periodically, with a
|
||||
frequency specified in days. Unlike \fBcron(8)\fR,
|
||||
it does not assume that the machine is running continuously. Hence,
|
||||
it can be used on machines that are not running 24 hours a day
|
||||
to control regular jobs as daily, weekly, and monthly jobs.
|
||||
.PP
|
||||
Anacron reads a list of jobs from the
|
||||
.I /etc/anacrontab
|
||||
configuration file (see \fBanacrontab(5)\fR). This file
|
||||
contains the list of jobs that Anacron controls. Each
|
||||
job entry specifies a period in days,
|
||||
a delay in minutes, a unique
|
||||
job identifier, and a shell command.
|
||||
.PP
|
||||
For each job, Anacron checks whether
|
||||
this job has been executed in the last \fBn\fR days, where \fBn\fR is the time period specified
|
||||
for that job. If a job has not been executed in \fBn\fR days or more, Anacron runs the job's shell command, after waiting
|
||||
for the number of minutes specified as the delay parameter.
|
||||
.PP
|
||||
After the command exits, Anacron records the date (excludes the hour) in a special
|
||||
timestamp file for that job, so it knows when to execute that job again.
|
||||
.PP
|
||||
When there are no more jobs to be run, Anacron exits.
|
||||
.PP
|
||||
Anacron only considers jobs whose identifier, as
|
||||
specified in \fBanacrontab(5)\fR, matches any of
|
||||
the
|
||||
.I job
|
||||
command-line arguments. The
|
||||
.I job
|
||||
command-line arguments can be represented by shell wildcard patterns (be sure to protect them from
|
||||
your shell with adequate quoting). Specifying no
|
||||
.I job
|
||||
command-line arguments is equivalent to specifying "*" (that is, all jobs are
|
||||
considered by Anacron).
|
||||
.PP
|
||||
Unless Anacron is run with the \fB-d\fR option (specified below), it forks to the
|
||||
background when it starts, and any parent processes exit immediately.
|
||||
.PP
|
||||
Unless Anacron is run with the \fB-s\fR or \fB-n\fR options, it starts jobs
|
||||
immediately when their delay is over. The execution of different jobs is
|
||||
completely independent.
|
||||
.PP
|
||||
If an executed job generates any output to standard output or to standard error,
|
||||
the output is mailed to the user under whom Anacron is running (usually root), or to
|
||||
the address specified in the \fBMAILTO\fR environment variable in the
|
||||
.I /etc/anacrontab
|
||||
file, if such exists. If the \fBLOGNAME\fR environment variable is set, it is used in the From: field of the mail.
|
||||
.PP
|
||||
Any informative messages generated by Anacron are sent to \fBsyslogd(8)\fR
|
||||
or \fBrsyslogd(8)\fR under with facility set to \fBcron\fR and priority set to \fBnotice\fR. Any error
|
||||
messages are sent with the priority \fBerror\fR.
|
||||
.PP
|
||||
"Active" jobs (i.e. jobs that Anacron already decided
|
||||
to run and are now waiting for their delay to pass, and jobs that are currently
|
||||
being executed by
|
||||
Anacron), are "locked", so that other copies of Anacron cannot run them
|
||||
at the same time.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B -f
|
||||
Forces execution of all jobs, ignoring any timestamps.
|
||||
.TP
|
||||
.B -u
|
||||
Updates the timestamps of all jobs to the current date, but
|
||||
does not run any.
|
||||
.TP
|
||||
.B -s
|
||||
Serializes execution of jobs. Anacron does not start a new job before the
|
||||
previous one finished.
|
||||
.TP
|
||||
.B -n
|
||||
Runs jobs immediately and ignores the specified delays in the
|
||||
.I /etc/anacrontab
|
||||
file. This options implies \fB-s\fR.
|
||||
.TP
|
||||
.B -d
|
||||
Does not fork Anacron to the background. In this mode, Anacron will output informational
|
||||
messages to standard error, as well as to syslog. The output of any job
|
||||
is mailed by Anacron.
|
||||
.TP
|
||||
.B -q
|
||||
Suppresses any messages to standard error. Only applicable with \fB-d\fR.
|
||||
.TP
|
||||
.B -t some_anacrontab
|
||||
Uses the specified anacrontab, rather than the
|
||||
.I /etc/anacrontab
|
||||
default one.
|
||||
.TP
|
||||
.B -T
|
||||
Anacrontab testing. Tests the
|
||||
.I /etc/anacrontab
|
||||
configuration file for validity. If
|
||||
there is an error in the file, it is shown on the standard output and Anacron
|
||||
returns the value of 1. Valid anacrontabs return the value of 0.
|
||||
.TP
|
||||
.B -S spooldir
|
||||
Uses the specified spooldir to store timestamps in. This option is required for
|
||||
users who wish to run anacron themselves.
|
||||
.TP
|
||||
.B -V
|
||||
Prints version information, and exits.
|
||||
.TP
|
||||
.B -h
|
||||
Prints short usage message, and exits.
|
||||
.SH SIGNALS
|
||||
After receiving a \fBSIGUSR1\fR signal, Anacron waits for any running
|
||||
jobs to finish and then exits. This can be used to stop
|
||||
Anacron cleanly.
|
||||
.SH NOTES
|
||||
Make sure your time-zone is set correctly before Anacron is
|
||||
started since the time-zone affects the date. This is usually accomplished
|
||||
by setting the TZ environment variable, or by installing a
|
||||
.I /usr/lib/zoneinfo/localtime
|
||||
file. See
|
||||
.B tzset(3)
|
||||
for more information.
|
||||
|
||||
Timestamp files are created in the spool directory for each job specified in an anacrontab. These files are never removed automatically by Anacron, and should be removed by hand if a job is no longer being scheduled.
|
||||
.SH FILES
|
||||
.TP
|
||||
.I /etc/anacrontab
|
||||
Contains specifications of jobs. See \fBanacrontab(5)\fR for a complete
|
||||
description.
|
||||
.TP
|
||||
.I /var/spool/anacron
|
||||
This directory is used by Anacron for storing timestamp files.
|
||||
.SH "SEE ALSO"
|
||||
.BR anacrontab (5), cron (8), tzset (3)
|
||||
.PP
|
||||
The Anacron
|
||||
.I README
|
||||
file.
|
||||
.SH BUGS
|
||||
Anacron never removes timestamp files. Remove unused files manually.
|
||||
.PP
|
||||
Anacron
|
||||
uses up to two file descriptors for each active job. It may run out of
|
||||
descriptors if there are more than about 125 active jobs (on normal kernels).
|
||||
.PP
|
||||
Mail comments, suggestions and bug reports to Sean 'Shaleh' Perry <shaleh@(debian.org|valinux.com)>.
|
||||
.SH AUTHOR
|
||||
Anacron was originally conceived and implemented by Christian Schwarz
|
||||
<schwarz@monet.m.isar.de>.
|
||||
.PP
|
||||
The current implementation is a complete rewrite by Itai Tzur
|
||||
<itzur@actcom.co.il>.
|
||||
.PP
|
||||
The code base was maintained by Sean 'Shaleh' Perry <shaleh@(debian.org|valinux.com)>.
|
||||
.PP
|
||||
Since 2004, it is maintained by Pascal Hakim <pasc@(debian.org|redellipse.net)>.
|
||||
.PP
|
||||
For Fedora, Anacron is maintained by Marcela Mašláňová <mmaslano@redhat.com>.
|
98
cronie-1.4.6/man/anacrontab.5
Normal file
98
cronie-1.4.6/man/anacrontab.5
Normal file
|
@ -0,0 +1,98 @@
|
|||
.TH ANACRONTAB 5 2009-08-17 "Marcela Mašláňová" "Anacron Users' Manual"
|
||||
.SH NAME
|
||||
/etc/anacrontab \- configuration file for Anacron
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I /etc/anacrontab
|
||||
configuration file describes the jobs controlled by \fBanacron(8)\fR. It can contain three types of lines:
|
||||
job-description lines, environment assignments, or empty lines.
|
||||
.PP
|
||||
Job-description lines can have the following format:
|
||||
.PP
|
||||
period in days delay in minutes job-identifier command
|
||||
.PP
|
||||
The
|
||||
.I period in days
|
||||
variable specifies the frequency of execution of a job in days. This variable can be represented by an integer or a macro (@daily, @weekly, @monthly), where @daily denotes the same value as the integer 1, @weekly the same as 7, and @monthly specifies that the job is run once a month, independent on the length of the month.
|
||||
.PP
|
||||
The
|
||||
.I delay in minutes
|
||||
variable specifies the number of minutes anacron waits, if necessary, before executing a job. This variable is represented by an integer where 0 means no delay.
|
||||
.PP
|
||||
The
|
||||
.I job-identifier
|
||||
variable specifies a unique name of a job which is used in the log files.
|
||||
.PP
|
||||
The
|
||||
.I command
|
||||
variable specifies the command to execute. The command can either be a command such as \fBls /proc >> /tmp/proc\fR or a command to execute a custom script.
|
||||
.PP
|
||||
Environment assignment lines can have the following format:
|
||||
.PP
|
||||
VAR=VALUE
|
||||
.PP
|
||||
Any spaces around
|
||||
.I VAR
|
||||
are removed. No spaces around
|
||||
.I VALUE
|
||||
are allowed (unless you want them to be part of the value). The specified assignment
|
||||
takes effect from the next line until the end of the file, or to the next
|
||||
assignment of the same variable.
|
||||
.PP
|
||||
The
|
||||
.I START_HOURS_RANGE
|
||||
variable defines an interval (in hours) when scheduled jobs can be run. In case this time interval is missed, for example, due to a power down, then scheduled jobs are not executed that day.
|
||||
.PP
|
||||
The
|
||||
.I RANDOM_DELAY
|
||||
variable denotes the maximum number of minutes that will be added to the delay in minutes variable which is specified for each job. A
|
||||
.I RANDOM_DELAY
|
||||
set to 12 would therefore add, randomly, between 0 and 12 minutes to the delay in minutes for each job in that particular anacrontab. When set to 0, no random delay is added.
|
||||
.PP
|
||||
Empty lines are either blank lines, line containing white spaces only, or
|
||||
lines with white spaces followed by a '#' followed by an arbitrary comment.
|
||||
.PP
|
||||
You can continue a line onto the next line by adding a '\\' at the end of it.
|
||||
.PP
|
||||
In case you want to disable Anacron, add the
|
||||
.I 0anacron
|
||||
cron job (which is a part of
|
||||
.IR crontabs(4) )
|
||||
into the
|
||||
.I /etc/cron.hourly/jobs.deny
|
||||
directory.
|
||||
.SH EXAMPLE
|
||||
This example shows how to set up an Anacron job similar in functionality to
|
||||
.I /etc/crontab
|
||||
which starts all regular jobs
|
||||
between 6:00 and 8:00
|
||||
.I only.
|
||||
A
|
||||
.I RANDOM_DELAY
|
||||
which can be 30 minutes at the most is specified. Jobs will run serialized in a queue where each job is started only after the previous one is finished.
|
||||
.nf
|
||||
# environment variables
|
||||
SHELL=/bin/sh
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
MAILTO=root
|
||||
RANDOM_DELAY=30
|
||||
# Anacron jobs will start between 6am and 8am.
|
||||
START_HOURS_RANGE=6-8
|
||||
# delay will be 5 minutes + RANDOM_DELAY for cron.daily
|
||||
1 5 cron.daily nice run-parts /etc/cron.daily
|
||||
7 0 cron.weekly nice run-parts /etc/cron.weekly
|
||||
@monthly 0 cron.monthly nice run-parts /etc/cron.monthly
|
||||
.fi
|
||||
.SH "SEE ALSO"
|
||||
.BR anacron (8),
|
||||
.BR crontabs (4)
|
||||
.PP
|
||||
The Anacron
|
||||
.I README
|
||||
file.
|
||||
.SH AUTHOR
|
||||
Itai Tzur <itzur@actcom.co.il>
|
||||
.PP
|
||||
Currently maintained by Pascal Hakim <pasc@(debian.org|redellipse.net)>.
|
||||
.PP
|
||||
For Fedora, maintained by Marcela Mašláňová <mmaslano@redhat.com>.
|
225
cronie-1.4.6/man/cron.8
Normal file
225
cronie-1.4.6/man/cron.8
Normal file
|
@ -0,0 +1,225 @@
|
|||
.\"/* Copyright 1988,1990,1993,1996 by Paul Vixie
|
||||
.\" * All rights reserved
|
||||
.\" */
|
||||
.\"
|
||||
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" Modified 2010/09/12 by Colin Dean, Durham University IT Service,
|
||||
.\" to add clustering support.
|
||||
.\"
|
||||
.\" $Id: cron.8,v 1.8 2004/01/23 19:03:32 vixie Exp $
|
||||
.\"
|
||||
.TH CRON "8" "July 2010" "Marcela Mašláňová" "Cronie Users' Manual"
|
||||
.SH NAME
|
||||
crond \- daemon to execute scheduled commands
|
||||
.SH SYNOPSIS
|
||||
.B crond
|
||||
.RB [ -n " | " -p " | " -s " | " -m \fP\fI<mail command>\fP ]
|
||||
|
||||
.B crond
|
||||
.B -x
|
||||
.RB [ext,sch,proc,pars,load,misc,test,bit]
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
.I Cron
|
||||
is started from
|
||||
.I /etc/rc.d/init.d
|
||||
or
|
||||
.I /etc/init.d
|
||||
It returns immediately, thus, there is no need to need to start it with the '&' parameter.
|
||||
.PP
|
||||
.I Cron
|
||||
searches
|
||||
.I /var/spool/cron
|
||||
for crontab files which are named after accounts in
|
||||
.I /etc/passwd;
|
||||
The found crontabs are loaded into the memory.
|
||||
.I Cron
|
||||
also searches for
|
||||
.I /etc/anacrontab
|
||||
and any files in the
|
||||
.I /etc/cron.d
|
||||
directory, which have a different format (see
|
||||
.BR crontab (5)).
|
||||
.I Cron
|
||||
examines all stored crontabs and checks each job to see if it needs to be
|
||||
run in the current minute. When executing
|
||||
commands, any output is mailed to the owner of the crontab (or to the user
|
||||
specified in the
|
||||
.I MAILTO
|
||||
environment variable in the crontab, if such exists).
|
||||
Any job output can also be sent to syslog by using the
|
||||
.B "\-s"
|
||||
option.
|
||||
.PP
|
||||
There are two ways how changes in crontables are checked. The first
|
||||
method is checking the modtime of a file. The second method is using the inotify support.
|
||||
Using of inotify is logged in the
|
||||
.I /var/log/cron
|
||||
log after the daemon is started. The inotify support checks for changes in all crontables and accesses the
|
||||
hard disk only when a change is detected.
|
||||
.PP
|
||||
When using the modtime option,
|
||||
.I Cron
|
||||
checks its crontables' modtimes every minute to check for any changes and reloads
|
||||
the crontables which have changed. There is no need to restart
|
||||
.I Cron
|
||||
after some of the
|
||||
crontables were modified. The modtime option is also used when inotify can not be initialized.
|
||||
.PP
|
||||
.I Cron
|
||||
checks these files and directories:
|
||||
.IR /etc/anacrontab
|
||||
system crontab, usually used to run daily, weekly, monthly jobs. See
|
||||
.BR anacrontab (5)
|
||||
for more details.
|
||||
.IR /etc/cron.d/
|
||||
directory that contains system cronjobs stored for different users.
|
||||
.IR /var/spool/cron
|
||||
directory that contains user crontables created by the
|
||||
.IR crontab
|
||||
command.
|
||||
|
||||
Note that the
|
||||
.BR crontab (1)
|
||||
command updates the modtime of the spool directory whenever it changes a
|
||||
crontab.
|
||||
.PP
|
||||
.SS Daylight Saving Time and other time changes
|
||||
Local time changes of less than three hours, such as those caused
|
||||
by the Daylight Saving Time changes, are handled in a special way.
|
||||
This only applies to jobs that run at a specific time and jobs that
|
||||
run with a granularity greater than one hour. Jobs that run
|
||||
more frequently are scheduled normally.
|
||||
.PP
|
||||
If time was adjusted one hour forward, those jobs that would have run in the
|
||||
interval that has been skipped will be run immediately.
|
||||
Conversely, if time was adjusted backward, running the same job twice is avoided.
|
||||
.PP
|
||||
Time changes of more than 3 hours are considered to be corrections to
|
||||
the clock or the timezone, and the new time is used immediately.
|
||||
.PP
|
||||
It is possible to use different time zones for crontables. See
|
||||
.IR crontab (5)
|
||||
for more information.
|
||||
.SS PAM Access Control
|
||||
.IR Cron
|
||||
supports access control with PAM if the system has PAM installed. For more information, see
|
||||
.IR pam (8).
|
||||
A PAM configuration file for
|
||||
.IR crond
|
||||
is installed in
|
||||
.IR /etc/pam.d/crond .
|
||||
The daemon loads the PAM environment from the pam_env module. This
|
||||
can be overridden by defining specific settings in the appropriate crontab file.
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B "\-m"
|
||||
This option allows you to specify a shell command to use for sending
|
||||
.I Cron
|
||||
mail output instead of using
|
||||
.BR sendmail (8)
|
||||
This command must accept a fully formatted mail message (with headers) on standard input and send it
|
||||
as a mail message to the recipients specified in the mail headers. Specifying
|
||||
the string
|
||||
.I "off"
|
||||
(i.e. crond -m off)
|
||||
will disable the sending of mail.
|
||||
.TP
|
||||
.B "\-n"
|
||||
Tells the daemon to run in the foreground. This can be useful when starting it out of init.
|
||||
.TP
|
||||
.B "\-p"
|
||||
Allows
|
||||
.I Cron
|
||||
to accept any user set crontables.
|
||||
.TP
|
||||
.B "\-s"
|
||||
This option will direct
|
||||
.I Cron
|
||||
to send the job output to the system log using
|
||||
.IR syslog (3).
|
||||
This is useful if your system does not have
|
||||
.BR sendmail (8),
|
||||
installed or if mail is disabled.
|
||||
.TP
|
||||
.B "\-x"
|
||||
This option allows you to set debug flags.
|
||||
.SH SIGNALS
|
||||
When the \s-2SIGHUP\s+2 is received, the
|
||||
.I Cron
|
||||
daemon will close and reopen its
|
||||
log file. This proves to be useful in scripts which rotate and age log files.
|
||||
Naturally, this is not relevant if
|
||||
.I Cron
|
||||
was built to use
|
||||
.IR syslog (3).
|
||||
.SH CLUSTERING SUPPORT
|
||||
In this version of
|
||||
.IR Cron
|
||||
it is possible to use a network-mounted shared
|
||||
.I /var/spool/cron
|
||||
across a cluster of hosts and specify that only one of the hosts should
|
||||
run the crontab jobs in this directory at any one time. This is done by starting
|
||||
.I Cron
|
||||
with the \fB-c\fP option, and have the
|
||||
.I /var/spool/cron/.cron.hostname
|
||||
file contain just one line, which represents the hostname of whichever host in the
|
||||
cluster should run the jobs. If this file does not exist, or the hostname
|
||||
in it does not match that returned by
|
||||
.BR gethostname (2) ,
|
||||
then all crontab files in this directory are ignored. This has no effect on
|
||||
cron jobs specified in the
|
||||
.I /etc/crontab
|
||||
file or on files in the
|
||||
.I /etc/cron.d
|
||||
directory. These files are always run and considered host-specific.
|
||||
.PP
|
||||
Rather than editing
|
||||
.I /var/spool/cron/.cron.hostname
|
||||
directly, use the \fB-n\fP option of
|
||||
.BR crontab (1)
|
||||
to specify the host.
|
||||
.PP
|
||||
You should ensure that all hosts in a cluster, and the file server from which
|
||||
they mount the shared crontab directory, have closely synchronised clocks,
|
||||
e.g. using
|
||||
.BR ntpd (8)
|
||||
, otherwise the results will be very unpredictable.
|
||||
.PP
|
||||
Using cluster sharing automatically disables inotify support, because inotify cannot be
|
||||
relied on with network-mounted shared file systems.
|
||||
.SH CAVEATS
|
||||
All
|
||||
.BR crontab
|
||||
files have to be regular files or symlinks to regular files, they must not be executable
|
||||
or writable for anyone else but the owner.
|
||||
This requirement can be overridden by using the \fB-p\fP option on the crond command line.
|
||||
If inotify support is in use, changes in the symlinked crontabs are not automatically
|
||||
noticed by the cron daemon. The cron daemon must receive a SIGHUP signal to reload the crontabs.
|
||||
This is a limitation of the inotify API.
|
||||
.PP
|
||||
The syslog output will be used instead of mail, when sendmail is not installed.
|
||||
.SH "SEE ALSO"
|
||||
.BR crontab (1),
|
||||
.BR crontab (5),
|
||||
.BR inotify (7),
|
||||
.BR pam (8)
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
Paul Vixie <vixie@isc.org>
|
||||
Marcela Mašláňová <mmaslano@redhat.com>
|
||||
Colin Dean <c.c.dean@durham.ac.uk>
|
1
cronie-1.4.6/man/crond.8
Normal file
1
cronie-1.4.6/man/crond.8
Normal file
|
@ -0,0 +1 @@
|
|||
.so man8/cron.8
|
186
cronie-1.4.6/man/crontab.1
Normal file
186
cronie-1.4.6/man/crontab.1
Normal file
|
@ -0,0 +1,186 @@
|
|||
.\"/* Copyright 1988,1990,1993 by Paul Vixie
|
||||
.\" * All rights reserved
|
||||
.\" */
|
||||
.\"
|
||||
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" Modified 2010/09/12 by Colin Dean, Durham University IT Service,
|
||||
.\" to add clustering support.
|
||||
.\"
|
||||
.\" $Id: crontab.1,v 1.7 2004/01/23 19:03:32 vixie Exp $
|
||||
.\"
|
||||
.TH CRONTAB 1 "22 September 2010"
|
||||
.SH NAME
|
||||
crontab \- maintains crontab files for individual users
|
||||
.SH SYNOPSIS
|
||||
.B crontab
|
||||
.RB [ -u
|
||||
.IR user ] " file"
|
||||
.br
|
||||
.B crontab
|
||||
.RB [ -u
|
||||
.IR user ]
|
||||
.RB [ -l " | " -r " | " -e ]\ [ -i ]
|
||||
.RB [ -s ]
|
||||
.br
|
||||
.B crontab
|
||||
.BR -n\ [
|
||||
.IR "hostname " ]
|
||||
.br
|
||||
.B crontab
|
||||
.BR -c
|
||||
.SH DESCRIPTION
|
||||
.I Crontab
|
||||
is the program used to install, remove or list the tables
|
||||
used to serve the
|
||||
.BR cron (8)
|
||||
daemon. Each user can have their own crontab, and though these are files in
|
||||
.IR /var/spool/ ,
|
||||
they are not intended to be edited directly. For SELinux in MLS mode, you can define
|
||||
more crontabs for each range. For more information, see
|
||||
.BR selinux (8).
|
||||
.PP
|
||||
In this version of
|
||||
.IR Cron
|
||||
it is possible to use a network-mounted shared
|
||||
.I /var/spool/cron
|
||||
across a cluster of hosts and specify that only one of the hosts should
|
||||
run the crontab jobs in the particular directory at any one time. You may also use
|
||||
.BR crontab (1)
|
||||
from any of these hosts to edit the same shared set of crontab files, and to
|
||||
set and query which host should run the crontab jobs.
|
||||
.PP
|
||||
Running cron jobs can be allowed or disallowed for different users. For this purpose, use the
|
||||
.I cron.allow
|
||||
and
|
||||
.I cron.deny
|
||||
files.
|
||||
If the
|
||||
.I cron.allow
|
||||
file exists, a user must be listed in it to be allowed to use cron
|
||||
If the
|
||||
.I cron.allow
|
||||
file does not exist but the
|
||||
.I cron.deny
|
||||
file does exist, then a user must \fInot\fR be listed in the
|
||||
.I cron.deny
|
||||
file in order to use cron. If neither of these files exists,
|
||||
only the super user is allowed to use cron.
|
||||
Another way to restrict access to cron is to use PAM authentication to set up users,
|
||||
which are allowed or disallowed to use
|
||||
.I crontab
|
||||
or modify system cron jobs in the
|
||||
.IR /etc/cron.d/
|
||||
directory.
|
||||
.PP
|
||||
The temporary directory can be set in an environment variable. If it is not set
|
||||
by the user, the
|
||||
.I /tmp
|
||||
directory is used.
|
||||
.PP
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B "\-u"
|
||||
Appends the name of the user whose crontab is to be modified. If this option
|
||||
is not used,
|
||||
.I crontab
|
||||
examines "your" crontab, i.e., the crontab of the person executing the
|
||||
command. Note that
|
||||
.BR su (8)
|
||||
may confuse
|
||||
.IR crontab ,
|
||||
thus, when executing commands under
|
||||
.BR su (8)
|
||||
you should always use the
|
||||
.B -u
|
||||
option. If no crontab exists for a particular user, it is created for him the first time the
|
||||
.B crontab -u
|
||||
command is used under his username.
|
||||
.TP
|
||||
.B "\-l"
|
||||
Displays the current crontab on standard output.
|
||||
.TP
|
||||
.B "\-r"
|
||||
Removes the current crontab.
|
||||
.TP
|
||||
.B "\-e"
|
||||
Edits the current crontab using the editor specified by
|
||||
the \s-1VISUAL\s+1 or \s-1EDITOR\s+1 environment variables. After you exit
|
||||
from the editor, the modified crontab will be installed automatically.
|
||||
.TP
|
||||
.B "\-i"
|
||||
This option modifies the
|
||||
.B "\-r"
|
||||
option to prompt the user for a 'y/Y' response
|
||||
before actually removing the crontab.
|
||||
.TP
|
||||
.B "\-s"
|
||||
Appends the current SELinux security context string as an
|
||||
MLS_LEVEL setting to the crontab file before editing / replacement
|
||||
occurs - see the documentation of MLS_LEVEL in
|
||||
.BR crontab(5)\.
|
||||
.TP
|
||||
.B "\-n"
|
||||
This option is relevant only if
|
||||
.BR cron (8)
|
||||
was started with the \fB-c\fP option, to enable clustering support. It is
|
||||
used to set the host in the cluster which should run the jobs specified in the
|
||||
crontab files in the
|
||||
.I /var/spool/cron\
|
||||
directory.
|
||||
If a hostname is supplied, the host whose hostname returned by
|
||||
.BR gethostname(2)
|
||||
matches the supplied hostname, will be selected to run the selected cron jobs subsequently. If there
|
||||
is no host in the cluster matching the supplied hostname, or you explicitly specify
|
||||
an empty hostname, then the selected jobs will not be run at all. If the hostname
|
||||
is omitted, the name of the local host returned by
|
||||
.BR gethostname(2)
|
||||
is used. Using this option has no effect on the
|
||||
.I /etc/crontab
|
||||
file and the files in the
|
||||
.I /etc/cron.d
|
||||
directory, which are always run, and considered host-specific. For more
|
||||
information on clustering support, see
|
||||
.BR cron (8)\.
|
||||
.TP
|
||||
.B "\-c"
|
||||
This option is only relevant if
|
||||
.BR cron (8)
|
||||
was started with the \fB-c\fP option, to enable clustering support. It is
|
||||
used to query which host in the cluster is currently set to run the jobs
|
||||
specified in the crontab files in the directory
|
||||
.I /var/spool/cron
|
||||
, as set using the \fB-n\fP option.
|
||||
.SH "SEE ALSO"
|
||||
.BR crontab (5), cron (8)
|
||||
.SH FILES
|
||||
.nf
|
||||
/etc/cron.allow
|
||||
/etc/cron.deny
|
||||
.fi
|
||||
.SH STANDARDS
|
||||
The
|
||||
.I crontab
|
||||
command conforms to IEEE Std1003.2-1992 (``POSIX''). This new command syntax
|
||||
differs from previous versions of Vixie Cron, as well as from the classic
|
||||
SVR3 syntax.
|
||||
.SH DIAGNOSTICS
|
||||
An informative usage message appears if you run a crontab with a faulty command
|
||||
defined in it.
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
Paul Vixie <vixie@isc.org>
|
||||
Colin Dean <c.c.dean@durham.ac.uk>
|
309
cronie-1.4.6/man/crontab.5
Normal file
309
cronie-1.4.6/man/crontab.5
Normal file
|
@ -0,0 +1,309 @@
|
|||
.\"/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
.\" * All rights reserved
|
||||
.\" */
|
||||
.\"
|
||||
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" $Id: crontab.5,v 1.6 2004/01/23 19:03:33 vixie Exp $
|
||||
.\"
|
||||
.TH ANACRONTAB 5 "July 2010" "Marcela Mašláňová" "Cronie Users' Manual"
|
||||
.SH NAME
|
||||
crontab \- files used to schedule the execution of programs
|
||||
.SH DESCRIPTION
|
||||
A
|
||||
.I crontab
|
||||
file contains instructions for the
|
||||
.BR cron (8)
|
||||
daemon in the following simplified manner: "run this command at this time on this date".
|
||||
Each user can define their own crontab. Commands defined in any given crontab are
|
||||
executed under the user who owns that particular crontab. Uucp and News usually have
|
||||
their own crontabs, eliminating the need for explicitly running
|
||||
.BR su (1)
|
||||
as part of a cron command.
|
||||
.PP
|
||||
Blank lines, leading spaces, and tabs are ignored. Lines whose first
|
||||
non-white space character is a pound-sign (#) are comments, and are note processed.
|
||||
Note that comments are not allowed on the same line as cron commands, since
|
||||
they are considered a part of the command. Similarly, comments are not
|
||||
allowed on the same line as environment variable settings.
|
||||
.PP
|
||||
An active line in a crontab is either an environment setting or a cron
|
||||
command. An environment setting is of the form:
|
||||
.PP
|
||||
name = value
|
||||
.PP
|
||||
where the white spaces around the equal-sign (=) are optional, and any subsequent
|
||||
non-leading white spaces in
|
||||
.I value
|
||||
is a part of the value assigned to
|
||||
.IR name .
|
||||
The
|
||||
.I value
|
||||
string may be placed in quotes (single or double, but matching) to preserve
|
||||
leading or trailing white spaces.
|
||||
.PP
|
||||
Several environment variables are set up
|
||||
automatically by the
|
||||
.BR cron (8)
|
||||
daemon.
|
||||
.I SHELL
|
||||
is set to /bin/sh, and
|
||||
.I LOGNAME
|
||||
and
|
||||
.I HOME
|
||||
are set from the /etc/passwd line of the crontab\'s owner.
|
||||
.I HOME
|
||||
and
|
||||
.I SHELL
|
||||
can be overridden by settings in the crontab; LOGNAME can not.
|
||||
.PP
|
||||
(Note: the
|
||||
.I LOGNAME
|
||||
variable is sometimes called
|
||||
.I USER
|
||||
on BSD systems and is also automatically set).
|
||||
.PP
|
||||
In addition to
|
||||
.IR LOGNAME ,
|
||||
.IR HOME ,
|
||||
and
|
||||
.IR SHELL ,
|
||||
.BR cron (8)
|
||||
looks at the
|
||||
.I MAILTO
|
||||
variable if a mail needs to be send as a result of running
|
||||
any commands in that particular crontab. If
|
||||
.I MAILTO
|
||||
is defined (and non-empty), mail is
|
||||
sent to the specified address. If
|
||||
.I MAILTO
|
||||
is defined but empty (\fIMAILTO=""\fR), no
|
||||
mail is sent. Otherwise, mail is sent to the owner of the crontab. This
|
||||
option is useful if you decide to use /bin/mail instead of /usr/lib/sendmail as
|
||||
your mailer. Note that /bin/mail does not provide aliasing and UUCP
|
||||
usually does not read its mail. If
|
||||
.I MAILFROM
|
||||
is defined (and non-empty), it
|
||||
is used as the envelope sender address, otherwise, ``root'' is used.
|
||||
.PP
|
||||
By default, cron sends a mail using the 'Content-Type:' header of 'text/plain'
|
||||
with the 'charset=' parameter set to the 'charmap/codeset' of the locale in which
|
||||
.BR crond (8)
|
||||
is started up - i.e. either the default system locale, if no LC_* environment
|
||||
variables are set, or the locale specified by the LC_* environment variables
|
||||
(see
|
||||
.BR locale (7)).
|
||||
Different character encodings can be used for mailing cron job outputs by
|
||||
setting the
|
||||
.I CONTENT_TYPE
|
||||
and
|
||||
.I CONTENT_TRANSFER_ENCODING
|
||||
variables in a crontab to the correct values of the mail headers of those names.
|
||||
.PP
|
||||
The
|
||||
.I CRON_TZ
|
||||
variable specifies the time zone specific for the cron table.
|
||||
The user should enter a time according to the specified time zone into the table.
|
||||
The time used for writing into a log file is taken from the local time zone, where the
|
||||
daemon is running.
|
||||
.PP
|
||||
The
|
||||
.I MLS_LEVEL
|
||||
environment variable provides support for multiple per-job
|
||||
SELinux security contexts in the same crontab.
|
||||
By default, cron jobs execute with the default SELinux security context of the
|
||||
user that created the crontab file.
|
||||
When using multiple security levels and roles, this may not be sufficient, because
|
||||
the same user may be running in different roles or in different security levels.
|
||||
For more information about roles and SELinux MLS/MCS, see
|
||||
.BR selinux (8)
|
||||
and the crontab example mentioned later on in this text.
|
||||
You can set the
|
||||
.I MLS_LEVEL
|
||||
variable to the SELinux security context string specifying
|
||||
the particular SELinux security context in which you want jobs to be run.
|
||||
.B crond
|
||||
will then set the execution context of those jobs that meet the specifications of the particular security context.
|
||||
For more information, see
|
||||
.BR crontab (1)\ -s\ option.
|
||||
.PP
|
||||
The format of a cron command is similar to the V7 standard, with a number of
|
||||
upward-compatible extensions. Each line has five time-and-date fields
|
||||
followed by a
|
||||
.BR user name
|
||||
(if this is the
|
||||
.BR system
|
||||
crontab file), and followed by a command. Commands are executed by
|
||||
.BR cron (8)
|
||||
when the 'minute', 'hour', and 'month of the year' fields match the current time,
|
||||
.I and
|
||||
at least one of the two 'day' fields ('day of month', or 'day of week')
|
||||
match the current time (see "Note" below).
|
||||
.PP
|
||||
Note that this means that non-existent times, such as the "missing hours"
|
||||
during the daylight savings time conversion, will never match, causing jobs
|
||||
scheduled during the "missing times" not to be run. Similarly, times
|
||||
that occur more than once (again, during the daylight savings time conversion)
|
||||
will cause matching jobs to be run twice.
|
||||
.PP
|
||||
.BR cron (8)
|
||||
examines cron entries every minute.
|
||||
.PP
|
||||
The time and date fields are:
|
||||
.IP
|
||||
.ta 1.5i
|
||||
field allowed values
|
||||
.br
|
||||
----- --------------
|
||||
.br
|
||||
minute 0-59
|
||||
.br
|
||||
hour 0-23
|
||||
.br
|
||||
day of month 1-31
|
||||
.br
|
||||
month 1-12 (or names, see below)
|
||||
.br
|
||||
day of week 0-7 (0 or 7 is Sunday, or use names)
|
||||
.br
|
||||
.PP
|
||||
A field may contain an asterisk (*), which always stands for "first\-last".
|
||||
.PP
|
||||
Ranges of numbers are allowed. Ranges are two numbers separated
|
||||
with a hyphen. The specified range is inclusive. For example,
|
||||
8-11 for an 'hours' entry specifies execution at hours 8, 9, 10,
|
||||
and 11.
|
||||
.PP
|
||||
Lists are allowed. A list is a set of numbers (or ranges)
|
||||
separated by commas. Examples: "1,2,5,9", "0-4,8-12".
|
||||
.PP
|
||||
Step values can be used in conjunction with ranges. Following
|
||||
a range with "/<number>" specifies skips of the number's value
|
||||
through the range. For example, "0-23/2" can be used in the 'hours'
|
||||
field to specify command execution for every other hour (the alternative
|
||||
in the V7 standard is "0,2,4,6,8,10,12,14,16,18,20,22"). Step values are
|
||||
also permitted after an asterisk, so if specifying a job to be run every two
|
||||
hours, you can use "*/2".
|
||||
.PP
|
||||
Names can also be used for the 'month' and 'day of week'
|
||||
fields. Use the first three letters of the particular
|
||||
day or month (case does not matter). Ranges or
|
||||
lists of names are not allowed.
|
||||
.PP
|
||||
The "sixth" field (the rest of the line) specifies the command to be
|
||||
run.
|
||||
The entire command portion of the line, up to a newline or a "%"
|
||||
character, will be executed by /bin/sh or by the shell
|
||||
specified in the SHELL variable of the cronfile.
|
||||
A "%" character in the command, unless escaped with a backslash
|
||||
(\\), will be changed into newline characters, and all data
|
||||
after the first % will be sent to the command as standard
|
||||
input.
|
||||
.PP
|
||||
Note: The day of a command's execution can be specified in the following two
|
||||
fields \(em 'day of month', and 'day of week'. If both fields are
|
||||
restricted (i.e., do not contain the "*" character), the command will be run when
|
||||
.I either
|
||||
field matches the current time. For example,
|
||||
.br
|
||||
"30 4 1,15 * 5"
|
||||
would cause a command to be run at 4:30 am on the 1st and 15th of each
|
||||
month, plus every Friday.
|
||||
.SH EXAMPLE CRON FILE
|
||||
.nf
|
||||
# use /bin/sh to run commands, no matter what /etc/passwd says
|
||||
SHELL=/bin/sh
|
||||
# mail any output to `paul', no matter whose crontab this is
|
||||
MAILTO=paul
|
||||
#
|
||||
CRON_TZ=Japan
|
||||
# run five minutes after midnight, every day
|
||||
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
|
||||
# run at 2:15pm on the first of every month -- output mailed to paul
|
||||
15 14 1 * * $HOME/bin/monthly
|
||||
# run at 10 pm on weekdays, annoy Joe
|
||||
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%
|
||||
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
|
||||
5 4 * * sun echo "run at 5 after 4 every sunday"
|
||||
.fi
|
||||
.SH Jobs in /etc/cron.d/
|
||||
The jobs in
|
||||
.I cron.d
|
||||
and
|
||||
.I /etc/crontab
|
||||
are system jobs, which are used usually for more than
|
||||
one user, thus, the username is needed. MAILTO on the first line
|
||||
is optional.
|
||||
.SH EXAMPLE OF A JOB IN /etc/cron.d/job
|
||||
.nf
|
||||
#login as root
|
||||
#create job with preferred editor (e.g. vim)
|
||||
MAILTO=root
|
||||
* * * * * root touch /tmp/file
|
||||
.fi
|
||||
.SH SELinux with multi level security (MLS)
|
||||
In a crontab, it is important to specify a security level by \fIcrontab\ -s\fR or specifying
|
||||
the required level on the first line of the crontab. Each level is specified
|
||||
in \fI/etc/selinux/targeted/seusers\fR. When using crontab in the MLS mode, it is especially important to:
|
||||
.br
|
||||
- check/change the actual role,
|
||||
.br
|
||||
- set correct \fIrole for directory\fR, which is used for input/output.
|
||||
.SH EXAMPLE FOR SELINUX MLS
|
||||
.nf
|
||||
# login as root
|
||||
newrole -r sysadm_r
|
||||
mkdir /tmp/SystemHigh
|
||||
chcon -l SystemHigh /tmp/SystemHigh
|
||||
crontab -e
|
||||
# write in crontab file
|
||||
MLS_LEVEL=SystemHigh
|
||||
0-59 * * * * id -Z > /tmp/SystemHigh/crontest
|
||||
.fi
|
||||
.SH FILES
|
||||
.I /etc/anacrontab
|
||||
system crontab file for jobs like cron.daily, weekly, monthly.
|
||||
.I /var/spool/cron/
|
||||
a directory for storing crontabs defined by users.
|
||||
.I /etc/cron.d/
|
||||
a directory for storing system crontables.
|
||||
.SH "SEE ALSO"
|
||||
.BR cron (8),
|
||||
.BR crontab (1)
|
||||
.SH EXTENSIONS
|
||||
These special time specification "nicknames" which replace
|
||||
the 5 initial time and date fields, and are prefixed with the '@' character, are supported:
|
||||
.nf
|
||||
@reboot : Run once after reboot.
|
||||
@yearly : Run once a year, ie. "0 0 1 1 *".
|
||||
@annually : Run once a year, ie. "0 0 1 1 *".
|
||||
@monthly : Run once a month, ie. "0 0 1 * *".
|
||||
@weekly : Run once a week, ie. "0 0 * * 0".
|
||||
@daily : Run once a day, ie. "0 0 * * *".
|
||||
@hourly : Run once an hour, ie. "0 * * * *".
|
||||
.fi
|
||||
.SH CAVEATS
|
||||
.BR crontab
|
||||
files have to be regular files or symlinks to regular files, they must not be executable
|
||||
or writable for anyone else but the owner.
|
||||
This requirement can be overridden by using the \fB-p\fP option on the crond command line.
|
||||
If inotify support is in use, changes in the symlinked crontabs are not automatically
|
||||
noticed by the cron daemon. The cron daemon must receive a SIGHUP signal to reload the crontabs.
|
||||
This is a limitation of the inotify API.
|
||||
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
Paul Vixie <vixie@isc.org>
|
376
cronie-1.4.6/missing
Executable file
376
cronie-1.4.6/missing
Executable file
|
@ -0,0 +1,376 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar*)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar*)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
10
cronie-1.4.6/pam/crond
Normal file
10
cronie-1.4.6/pam/crond
Normal file
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# The PAM configuration file for the cron daemon
|
||||
#
|
||||
#
|
||||
# No PAM authentication called, auth modules not needed
|
||||
account required pam_access.so
|
||||
account include password-auth
|
||||
session required pam_loginuid.so
|
||||
session include password-auth
|
||||
auth include password-auth
|
73
cronie-1.4.6/src/Makefile.am
Normal file
73
cronie-1.4.6/src/Makefile.am
Normal file
|
@ -0,0 +1,73 @@
|
|||
# Makefile.am - two binaries crond and crontab
|
||||
|
||||
sbin_PROGRAMS = crond
|
||||
bin_PROGRAMS = crontab
|
||||
|
||||
crond_SOURCES = \
|
||||
cron.c database.c user.c job.c do_command.c popen.c \
|
||||
$(common_src)
|
||||
crontab_SOURCES = crontab.c $(common_src)
|
||||
common_src = entry.c env.c misc.c pw_dup.c security.c cron.h \
|
||||
externs.h funcs.h globals.h macros.h pathnames.h structs.h \
|
||||
bitstring.h
|
||||
common_nodist = cron-paths.h
|
||||
nodist_crond_SOURCES = $(common_nodist)
|
||||
nodist_crontab_SOURCES = $(common_nodist)
|
||||
BUILT_SOURCES = $(common_nodist)
|
||||
|
||||
|
||||
LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
|
||||
|
||||
## if DEBUG
|
||||
## noinst_PROGRAMS = debug
|
||||
## endif
|
||||
|
||||
# This header contains all the paths.
|
||||
# If they are configurable, they are declared in configure script.
|
||||
# Depends on this Makefile, because it uses make variables.
|
||||
# CCD 2010/09/10 added CRON_HOSTNAME for clustered-cron.
|
||||
cron-paths.h: Makefile
|
||||
@echo 'creating $@'
|
||||
@sed >$@ 's/ *\\$$//' <<\END #\
|
||||
/* This file has been automatically generated. Do not edit. */ \
|
||||
\
|
||||
#ifndef _CRON_PATHS_H_ \
|
||||
#define _CRON_PATHS_H_ \
|
||||
\
|
||||
/* SPOOLDIR is where the crontabs live. \
|
||||
* This directory will have its modtime updated \
|
||||
* whenever crontab(1) changes a crontab; this is \
|
||||
* the signal for cron(8) to look at each individual \
|
||||
* crontab file and reload those whose modtimes are \
|
||||
* newer than they were last time around (or which \
|
||||
* didn't exist last time around...) \
|
||||
* or it will be checked by inotify \
|
||||
*/ \
|
||||
#define SPOOL_DIR "$(SPOOL_DIR)" \
|
||||
\
|
||||
/* CRON_HOSTNAME is file in SPOOL_DIR which, if it \
|
||||
* exists, and does not just contain a line matching \
|
||||
* the name returned by gethostname(), causes all \
|
||||
* crontabs in SPOOL_DIR to be ignored. This is \
|
||||
* intended to be used when clustering hosts sharing \
|
||||
* one NFS-mounted SPOOL_DIR, and where only one host \
|
||||
* should use the crontab files here at any one time. \
|
||||
*/ \
|
||||
#define CRON_HOSTNAME ".cron.hostname" \
|
||||
\
|
||||
/* cron allow/deny file. At least cron.deny must \
|
||||
* exist for ordinary users to run crontab. \
|
||||
*/ \
|
||||
#define CRON_ALLOW "$(sysconfdir)/cron.allow" \
|
||||
#define CRON_DENY "$(sysconfdir)/cron.deny" \
|
||||
\
|
||||
/* 4.3BSD-style crontab f.e. /etc/crontab */ \
|
||||
#define SYSCRONTAB "$(SYSCRONTAB)" \
|
||||
\
|
||||
/* system crontab dir f.e. /etc/cron.d/ */ \
|
||||
#define SYS_CROND_DIR "$(SYS_CROND_DIR)" \
|
||||
\
|
||||
#define SYSCONFDIR "$(sysconfdir)" \
|
||||
\
|
||||
#endif /* _CRON_PATHS_H_ */ \
|
||||
END
|
609
cronie-1.4.6/src/Makefile.in
Normal file
609
cronie-1.4.6/src/Makefile.in
Normal file
|
@ -0,0 +1,609 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# Makefile.am - two binaries crond and crontab
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
sbin_PROGRAMS = crond$(EXEEXT)
|
||||
bin_PROGRAMS = crontab$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
|
||||
am__objects_1 = entry.$(OBJEXT) env.$(OBJEXT) misc.$(OBJEXT) \
|
||||
pw_dup.$(OBJEXT) security.$(OBJEXT)
|
||||
am_crond_OBJECTS = cron.$(OBJEXT) database.$(OBJEXT) user.$(OBJEXT) \
|
||||
job.$(OBJEXT) do_command.$(OBJEXT) popen.$(OBJEXT) \
|
||||
$(am__objects_1)
|
||||
am__objects_2 =
|
||||
nodist_crond_OBJECTS = $(am__objects_2)
|
||||
crond_OBJECTS = $(am_crond_OBJECTS) $(nodist_crond_OBJECTS)
|
||||
crond_LDADD = $(LDADD)
|
||||
am__DEPENDENCIES_1 =
|
||||
crond_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
am_crontab_OBJECTS = crontab.$(OBJEXT) $(am__objects_1)
|
||||
nodist_crontab_OBJECTS = $(am__objects_2)
|
||||
crontab_OBJECTS = $(am_crontab_OBJECTS) $(nodist_crontab_OBJECTS)
|
||||
crontab_LDADD = $(LDADD)
|
||||
crontab_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(crond_SOURCES) $(nodist_crond_SOURCES) $(crontab_SOURCES) \
|
||||
$(nodist_crontab_SOURCES)
|
||||
DIST_SOURCES = $(crond_SOURCES) $(crontab_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
ANACRONTAB = @ANACRONTAB@
|
||||
ANACRON_SPOOL_DIR = @ANACRON_SPOOL_DIR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DAEMON_GROUPNAME = @DAEMON_GROUPNAME@
|
||||
DAEMON_USERNAME = @DAEMON_USERNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBAUDIT = @LIBAUDIT@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPAM = @LIBPAM@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPOOL_DIR = @SPOOL_DIR@
|
||||
STRIP = @STRIP@
|
||||
SYSCRONTAB = @SYSCRONTAB@
|
||||
SYS_CROND_DIR = @SYS_CROND_DIR@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
crond_SOURCES = \
|
||||
cron.c database.c user.c job.c do_command.c popen.c \
|
||||
$(common_src)
|
||||
|
||||
crontab_SOURCES = crontab.c $(common_src)
|
||||
common_src = entry.c env.c misc.c pw_dup.c security.c cron.h \
|
||||
externs.h funcs.h globals.h macros.h pathnames.h structs.h \
|
||||
bitstring.h
|
||||
|
||||
common_nodist = cron-paths.h
|
||||
nodist_crond_SOURCES = $(common_nodist)
|
||||
nodist_crontab_SOURCES = $(common_nodist)
|
||||
BUILT_SOURCES = $(common_nodist)
|
||||
LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-sbinPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
|
||||
|
||||
clean-sbinPROGRAMS:
|
||||
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
|
||||
crond$(EXEEXT): $(crond_OBJECTS) $(crond_DEPENDENCIES)
|
||||
@rm -f crond$(EXEEXT)
|
||||
$(LINK) $(crond_OBJECTS) $(crond_LDADD) $(LIBS)
|
||||
crontab$(EXEEXT): $(crontab_OBJECTS) $(crontab_DEPENDENCIES)
|
||||
@rm -f crontab$(EXEEXT)
|
||||
$(LINK) $(crontab_OBJECTS) $(crontab_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cron.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crontab.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/do_command.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entry.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popen.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pw_dup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-sbinPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-sbinPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
.MAKE: all check install install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-sbinPROGRAMS ctags distclean \
|
||||
distclean-compile distclean-generic distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-binPROGRAMS install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-sbinPROGRAMS install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
|
||||
# This header contains all the paths.
|
||||
# If they are configurable, they are declared in configure script.
|
||||
# Depends on this Makefile, because it uses make variables.
|
||||
# CCD 2010/09/10 added CRON_HOSTNAME for clustered-cron.
|
||||
cron-paths.h: Makefile
|
||||
@echo 'creating $@'
|
||||
@sed >$@ 's/ *\\$$//' <<\END #\
|
||||
/* This file has been automatically generated. Do not edit. */ \
|
||||
\
|
||||
#ifndef _CRON_PATHS_H_ \
|
||||
#define _CRON_PATHS_H_ \
|
||||
\
|
||||
/* SPOOLDIR is where the crontabs live. \
|
||||
* This directory will have its modtime updated \
|
||||
* whenever crontab(1) changes a crontab; this is \
|
||||
* the signal for cron(8) to look at each individual \
|
||||
* crontab file and reload those whose modtimes are \
|
||||
* newer than they were last time around (or which \
|
||||
* didn't exist last time around...) \
|
||||
* or it will be checked by inotify \
|
||||
*/ \
|
||||
#define SPOOL_DIR "$(SPOOL_DIR)" \
|
||||
\
|
||||
/* CRON_HOSTNAME is file in SPOOL_DIR which, if it \
|
||||
* exists, and does not just contain a line matching \
|
||||
* the name returned by gethostname(), causes all \
|
||||
* crontabs in SPOOL_DIR to be ignored. This is \
|
||||
* intended to be used when clustering hosts sharing \
|
||||
* one NFS-mounted SPOOL_DIR, and where only one host \
|
||||
* should use the crontab files here at any one time. \
|
||||
*/ \
|
||||
#define CRON_HOSTNAME ".cron.hostname" \
|
||||
\
|
||||
/* cron allow/deny file. At least cron.deny must \
|
||||
* exist for ordinary users to run crontab. \
|
||||
*/ \
|
||||
#define CRON_ALLOW "$(sysconfdir)/cron.allow" \
|
||||
#define CRON_DENY "$(sysconfdir)/cron.deny" \
|
||||
\
|
||||
/* 4.3BSD-style crontab f.e. /etc/crontab */ \
|
||||
#define SYSCRONTAB "$(SYSCRONTAB)" \
|
||||
\
|
||||
/* system crontab dir f.e. /etc/cron.d/ */ \
|
||||
#define SYS_CROND_DIR "$(SYS_CROND_DIR)" \
|
||||
\
|
||||
#define SYSCONFDIR "$(sysconfdir)" \
|
||||
\
|
||||
#endif /* _CRON_PATHS_H_ */ \
|
||||
END
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
141
cronie-1.4.6/src/bitstring.h
Normal file
141
cronie-1.4.6/src/bitstring.h
Normal file
|
@ -0,0 +1,141 @@
|
|||
/* $NetBSD: bitstring.h,v 1.3 2003/08/07 11:17:08 agc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Paul Vixie.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)bitstring.h 8.1 (Berkeley) 7/19/93
|
||||
*/
|
||||
|
||||
#ifndef _BITSTRING_H_
|
||||
#define _BITSTRING_H_
|
||||
|
||||
typedef unsigned char bitstr_t;
|
||||
|
||||
/* internal macros */
|
||||
/* byte of the bitstring bit is in */
|
||||
#define _bit_byte(bit) \
|
||||
((bit) >> 3)
|
||||
|
||||
/* mask for the bit within its byte */
|
||||
#define _bit_mask(bit) \
|
||||
(1 << ((bit)&0x7))
|
||||
|
||||
/* external macros */
|
||||
/* bytes in a bitstring of nbits bits */
|
||||
#define bitstr_size(nbits) \
|
||||
((((nbits) - 1) >> 3) + 1)
|
||||
|
||||
/* allocate a bitstring */
|
||||
#define bit_alloc(nbits) \
|
||||
(bitstr_t *)calloc(1, \
|
||||
(unsigned int)bitstr_size(nbits) * sizeof(bitstr_t))
|
||||
|
||||
/* allocate a bitstring on the stack */
|
||||
#define bit_decl(name, nbits) \
|
||||
(name)[bitstr_size(nbits)]
|
||||
|
||||
/* is bit N of bitstring name set? */
|
||||
#define bit_test(name, bit) \
|
||||
((name)[_bit_byte(bit)] & _bit_mask(bit))
|
||||
|
||||
/* set bit N of bitstring name */
|
||||
#define bit_set(name, bit) \
|
||||
(name)[_bit_byte(bit)] |= _bit_mask(bit)
|
||||
|
||||
/* clear bit N of bitstring name */
|
||||
#define bit_clear(name, bit) \
|
||||
(name)[_bit_byte(bit)] &= ~_bit_mask(bit)
|
||||
|
||||
/* clear bits start ... stop in bitstring */
|
||||
#define bit_nclear(name, start, stop) { \
|
||||
register bitstr_t *_name = name; \
|
||||
register int _start = start, _stop = stop; \
|
||||
register int _startbyte = _bit_byte(_start); \
|
||||
register int _stopbyte = _bit_byte(_stop); \
|
||||
if (_startbyte == _stopbyte) { \
|
||||
_name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \
|
||||
(0xff << ((_stop&0x7) + 1))); \
|
||||
} else { \
|
||||
_name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \
|
||||
while (++_startbyte < _stopbyte) \
|
||||
_name[_startbyte] = 0; \
|
||||
_name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* set bits start ... stop in bitstring */
|
||||
#define bit_nset(name, start, stop) { \
|
||||
register bitstr_t *_name = name; \
|
||||
register int _start = start, _stop = stop; \
|
||||
register int _startbyte = _bit_byte(_start); \
|
||||
register int _stopbyte = _bit_byte(_stop); \
|
||||
if (_startbyte == _stopbyte) { \
|
||||
_name[_startbyte] |= ((0xff << (_start&0x7)) & \
|
||||
(0xff >> (7 - (_stop&0x7)))); \
|
||||
} else { \
|
||||
_name[_startbyte] |= 0xff << ((_start)&0x7); \
|
||||
while (++_startbyte < _stopbyte) \
|
||||
_name[_startbyte] = 0xff; \
|
||||
_name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* find first bit clear in name */
|
||||
#define bit_ffc(name, nbits, value) { \
|
||||
register bitstr_t *_name = name; \
|
||||
register int _byte, _nbits = nbits; \
|
||||
register int _stopbyte = _bit_byte(_nbits), _value = -1; \
|
||||
for (_byte = 0; _byte <= _stopbyte; ++_byte) \
|
||||
if (_name[_byte] != 0xff) { \
|
||||
_value = _byte << 3; \
|
||||
for (_stopbyte = _name[_byte]; (_stopbyte&0x1); \
|
||||
++_value, _stopbyte >>= 1); \
|
||||
break; \
|
||||
} \
|
||||
*(value) = _value; \
|
||||
}
|
||||
|
||||
/* find first bit set in name */
|
||||
#define bit_ffs(name, nbits, value) { \
|
||||
register bitstr_t *_name = name; \
|
||||
register int _byte, _nbits = nbits; \
|
||||
register int _stopbyte = _bit_byte(_nbits), _value = -1; \
|
||||
for (_byte = 0; _byte <= _stopbyte; ++_byte) \
|
||||
if (_name[_byte]) { \
|
||||
_value = _byte << 3; \
|
||||
for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \
|
||||
++_value, _stopbyte >>= 1); \
|
||||
break; \
|
||||
} \
|
||||
*(value) = _value; \
|
||||
}
|
||||
|
||||
#endif /* !_BITSTRING_H_ */
|
639
cronie-1.4.6/src/cron.c
Normal file
639
cronie-1.4.6/src/cron.c
Normal file
|
@ -0,0 +1,639 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 2010/09/12 by Colin Dean, Durham University IT Service,
|
||||
* to add clustering support.
|
||||
*/
|
||||
|
||||
#define MAIN_PROGRAM
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
#if defined WITH_INOTIFY
|
||||
int inotify_enabled;
|
||||
#else
|
||||
# define inotify_enabled 0
|
||||
#endif
|
||||
|
||||
enum timejump { negative, small, medium, large };
|
||||
|
||||
static void usage(void),
|
||||
run_reboot_jobs(cron_db *),
|
||||
find_jobs(int, cron_db *, int, int),
|
||||
set_time(int),
|
||||
cron_sleep(int, cron_db *),
|
||||
sigchld_handler(int),
|
||||
sighup_handler(int),
|
||||
sigchld_reaper(void), quit(int), parse_args(int c, char *v[]);
|
||||
|
||||
static volatile sig_atomic_t got_sighup, got_sigchld;
|
||||
static int timeRunning, virtualTime, clockTime;
|
||||
static long GMToff;
|
||||
static int DisableInotify;
|
||||
|
||||
#if defined WITH_INOTIFY
|
||||
|
||||
/*
|
||||
* Note that inotify isn't safe to use with clustering, as changes made
|
||||
* to a shared filesystem on one system cannot be relied on to be notified
|
||||
* on another system, so use of inotify is disabled at runtime if run with
|
||||
* clustering enabled.
|
||||
*/
|
||||
|
||||
# define NUM_WATCHES 3
|
||||
|
||||
int wd[NUM_WATCHES];
|
||||
const char *watchpaths[NUM_WATCHES] = {SPOOL_DIR, SYS_CROND_DIR, SYSCRONTAB};
|
||||
|
||||
void set_cron_unwatched(int fd) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
|
||||
if (wd[i] < 0) {
|
||||
inotify_rm_watch(fd, wd[i]);
|
||||
wd[i] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void set_cron_watched(int fd) {
|
||||
pid_t pid = getpid();
|
||||
int i;
|
||||
|
||||
if (fd < 0) {
|
||||
inotify_enabled = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
|
||||
int w;
|
||||
|
||||
w = inotify_add_watch(fd, watchpaths[i],
|
||||
IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO |
|
||||
IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF);
|
||||
if (w < 0) {
|
||||
if (wd[i] != -1) {
|
||||
log_it("CRON", pid, "This directory or file can't be watched",
|
||||
watchpaths[i], errno);
|
||||
log_it("CRON", pid, "INFO", "running without inotify support",
|
||||
0);
|
||||
}
|
||||
inotify_enabled = 0;
|
||||
set_cron_unwatched(fd);
|
||||
return;
|
||||
}
|
||||
wd[i] = w;
|
||||
}
|
||||
|
||||
if (!inotify_enabled) {
|
||||
log_it("CRON", pid, "INFO", "running with inotify support", 0);
|
||||
}
|
||||
|
||||
inotify_enabled = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void handle_signals(cron_db * database) {
|
||||
if (got_sighup) {
|
||||
got_sighup = 0;
|
||||
#if defined WITH_INOTIFY
|
||||
/* watches must be reinstated on reload */
|
||||
if (inotify_enabled && (EnableClustering != 1)) {
|
||||
set_cron_unwatched(database->ifd);
|
||||
inotify_enabled = 0;
|
||||
}
|
||||
#endif
|
||||
database->mtime = (time_t) 0;
|
||||
log_close();
|
||||
}
|
||||
|
||||
if (got_sigchld) {
|
||||
got_sigchld = 0;
|
||||
sigchld_reaper();
|
||||
}
|
||||
}
|
||||
|
||||
static void usage(void) {
|
||||
const char **dflags;
|
||||
|
||||
fprintf(stderr, "usage: %s [-h] print this message \n \
|
||||
[-i] deamon runs without inotify support \n \
|
||||
[-m <mail command>] off or specify prefered client for sending mails \n \
|
||||
[-n] run in foreground \n \
|
||||
[-p] permit any crontab \n \
|
||||
[-c] enable clustering support \n \
|
||||
[-s] log into syslog instead of sending mails \n \
|
||||
[-x [",
|
||||
ProgramName);
|
||||
for (dflags = DebugFlagNames; *dflags; dflags++)
|
||||
fprintf(stderr, "%s%s", *dflags, dflags[1] ? "," : "]");
|
||||
fprintf(stderr, "] print debug information\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct sigaction sact;
|
||||
cron_db database;
|
||||
int fd;
|
||||
char *cs;
|
||||
pid_t pid = getpid();
|
||||
#if defined WITH_INOTIFY
|
||||
int i;
|
||||
#endif
|
||||
|
||||
ProgramName = argv[0];
|
||||
MailCmd[0] = '\0';
|
||||
cron_default_mail_charset[0] = '\0';
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
#if defined(BSD)
|
||||
setlinebuf(stdout);
|
||||
setlinebuf(stderr);
|
||||
#endif
|
||||
|
||||
SyslogOutput = 0;
|
||||
NoFork = 0;
|
||||
parse_args(argc, argv);
|
||||
|
||||
bzero((char *) &sact, sizeof sact);
|
||||
sigemptyset(&sact.sa_mask);
|
||||
sact.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
sact.sa_flags |= SA_RESTART;
|
||||
#endif
|
||||
sact.sa_handler = sigchld_handler;
|
||||
(void) sigaction(SIGCHLD, &sact, NULL);
|
||||
sact.sa_handler = sighup_handler;
|
||||
(void) sigaction(SIGHUP, &sact, NULL);
|
||||
sact.sa_handler = quit;
|
||||
(void) sigaction(SIGINT, &sact, NULL);
|
||||
(void) sigaction(SIGTERM, &sact, NULL);
|
||||
|
||||
acquire_daemonlock(0);
|
||||
set_cron_uid();
|
||||
set_cron_cwd();
|
||||
|
||||
if (putenv("PATH=" _PATH_DEFPATH) < 0) {
|
||||
log_it("CRON", pid, "DEATH", "can't putenv PATH", errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Get the default locale character set for the mail
|
||||
* "Content-Type: ...; charset=" header
|
||||
*/
|
||||
setlocale(LC_ALL, ""); /* set locale to system defaults or to
|
||||
* that specified by any LC_* env vars */
|
||||
if ((cs = nl_langinfo(CODESET)) != 0L)
|
||||
strncpy(cron_default_mail_charset, cs, MAX_ENVSTR);
|
||||
else
|
||||
strcpy(cron_default_mail_charset, "US-ASCII");
|
||||
|
||||
/* if there are no debug flags turned on, fork as a daemon should.
|
||||
*/
|
||||
if (DebugFlags) {
|
||||
#if DEBUGGING
|
||||
(void) fprintf(stderr, "[%ld] cron started\n", (long) getpid());
|
||||
#endif
|
||||
}
|
||||
else if (NoFork == 0) {
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
log_it("CRON", pid, "DEATH", "can't fork", errno);
|
||||
exit(0);
|
||||
break;
|
||||
case 0:
|
||||
/* child process */
|
||||
(void) setsid();
|
||||
if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) >= 0) {
|
||||
(void) dup2(fd, STDIN);
|
||||
(void) dup2(fd, STDOUT);
|
||||
(void) dup2(fd, STDERR);
|
||||
if (fd != STDERR)
|
||||
(void) close(fd);
|
||||
}
|
||||
log_it("CRON", getpid(), "STARTUP", PACKAGE_VERSION, 0);
|
||||
break;
|
||||
default:
|
||||
/* parent process should just die */
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (access("/usr/sbin/sendmail", X_OK) != 0) {
|
||||
SyslogOutput=1;
|
||||
log_it("CRON", pid, "INFO","Syslog will be used instead of sendmail.", errno);
|
||||
}
|
||||
|
||||
pid = getpid();
|
||||
acquire_daemonlock(0);
|
||||
database.head = NULL;
|
||||
database.tail = NULL;
|
||||
database.mtime = (time_t) 0;
|
||||
|
||||
load_database(&database);
|
||||
|
||||
fd = -1;
|
||||
#if defined WITH_INOTIFY
|
||||
if (DisableInotify || EnableClustering) {
|
||||
log_it("CRON", getpid(), "No inotify - daemon runs with -i or -c option",
|
||||
"", 0);
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
|
||||
/* initialize to negative number other than -1
|
||||
* so an eventual error is reported for the first time
|
||||
*/
|
||||
wd[i] = -2;
|
||||
}
|
||||
|
||||
database.ifd = fd = inotify_init();
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
if (fd < 0)
|
||||
log_it("CRON", pid, "INFO", "Inotify init failed", errno);
|
||||
set_cron_watched(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
set_time(TRUE);
|
||||
run_reboot_jobs(&database);
|
||||
timeRunning = virtualTime = clockTime;
|
||||
|
||||
/*
|
||||
* Too many clocks, not enough time (Al. Einstein)
|
||||
* These clocks are in minutes since the epoch, adjusted for timezone.
|
||||
* virtualTime: is the time it *would* be if we woke up
|
||||
* promptly and nobody ever changed the clock. It is
|
||||
* monotonically increasing... unless a timejump happens.
|
||||
* At the top of the loop, all jobs for 'virtualTime' have run.
|
||||
* timeRunning: is the time we last awakened.
|
||||
* clockTime: is the time when set_time was last called.
|
||||
*/
|
||||
while (TRUE) {
|
||||
int timeDiff;
|
||||
enum timejump wakeupKind;
|
||||
|
||||
/* ... wait for the time (in minutes) to change ... */
|
||||
do {
|
||||
cron_sleep(timeRunning + 1, &database);
|
||||
set_time(FALSE);
|
||||
} while (clockTime == timeRunning);
|
||||
timeRunning = clockTime;
|
||||
|
||||
/*
|
||||
* Calculate how the current time differs from our virtual
|
||||
* clock. Classify the change into one of 4 cases.
|
||||
*/
|
||||
timeDiff = timeRunning - virtualTime;
|
||||
#if defined WITH_INOTIFY
|
||||
if (inotify_enabled) {
|
||||
check_inotify_database(&database);
|
||||
}
|
||||
else {
|
||||
if (load_database(&database) && (EnableClustering != 1))
|
||||
/* try reinstating the watches */
|
||||
set_cron_watched(fd);
|
||||
}
|
||||
#else
|
||||
load_database(&database);
|
||||
#endif
|
||||
|
||||
/* shortcut for the most common case */
|
||||
if (timeDiff == 1) {
|
||||
virtualTime = timeRunning;
|
||||
find_jobs(virtualTime, &database, TRUE, TRUE);
|
||||
}
|
||||
else {
|
||||
if (timeDiff > (3 * MINUTE_COUNT) || timeDiff < -(3 * MINUTE_COUNT))
|
||||
wakeupKind = large;
|
||||
else if (timeDiff > 5)
|
||||
wakeupKind = medium;
|
||||
else if (timeDiff > 0)
|
||||
wakeupKind = small;
|
||||
else
|
||||
wakeupKind = negative;
|
||||
|
||||
switch (wakeupKind) {
|
||||
case small:
|
||||
/*
|
||||
* case 1: timeDiff is a small positive number
|
||||
* (wokeup late) run jobs for each virtual
|
||||
* minute until caught up.
|
||||
*/
|
||||
Debug(DSCH, ("[%ld], normal case %d minutes to go\n",
|
||||
(long) pid, timeDiff))
|
||||
do {
|
||||
if (job_runqueue())
|
||||
sleep(10);
|
||||
virtualTime++;
|
||||
find_jobs(virtualTime, &database, TRUE, TRUE);
|
||||
} while (virtualTime < timeRunning);
|
||||
break;
|
||||
|
||||
case medium:
|
||||
/*
|
||||
* case 2: timeDiff is a medium-sized positive
|
||||
* number, for example because we went to DST
|
||||
* run wildcard jobs once, then run any
|
||||
* fixed-time jobs that would otherwise be
|
||||
* skipped if we use up our minute (possible,
|
||||
* if there are a lot of jobs to run) go
|
||||
* around the loop again so that wildcard jobs
|
||||
* have a chance to run, and we do our
|
||||
* housekeeping.
|
||||
*/
|
||||
Debug(DSCH, ("[%ld], DST begins %d minutes to go\n",
|
||||
(long) pid, timeDiff))
|
||||
/* run wildcard jobs for current minute */
|
||||
find_jobs(timeRunning, &database, TRUE, FALSE);
|
||||
|
||||
/* run fixed-time jobs for each minute missed */
|
||||
do {
|
||||
if (job_runqueue())
|
||||
sleep(10);
|
||||
virtualTime++;
|
||||
find_jobs(virtualTime, &database, FALSE, TRUE);
|
||||
set_time(FALSE);
|
||||
} while (virtualTime < timeRunning && clockTime == timeRunning);
|
||||
break;
|
||||
|
||||
case negative:
|
||||
/*
|
||||
* case 3: timeDiff is a small or medium-sized
|
||||
* negative num, eg. because of DST ending.
|
||||
* Just run the wildcard jobs. The fixed-time
|
||||
* jobs probably have already run, and should
|
||||
* not be repeated. Virtual time does not
|
||||
* change until we are caught up.
|
||||
*/
|
||||
Debug(DSCH, ("[%ld], DST ends %d minutes to go\n",
|
||||
(long) pid, timeDiff))
|
||||
find_jobs(timeRunning, &database, TRUE, FALSE);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* other: time has changed a *lot*,
|
||||
* jump virtual time, and run everything
|
||||
*/
|
||||
Debug(DSCH, ("[%ld], clock jumped\n", (long) pid))
|
||||
virtualTime = timeRunning;
|
||||
find_jobs(timeRunning, &database, TRUE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Jobs to be run (if any) are loaded; clear the queue. */
|
||||
job_runqueue();
|
||||
|
||||
handle_signals(&database);
|
||||
}
|
||||
|
||||
#if defined WITH_INOTIFY
|
||||
if (inotify_enabled && (EnableClustering != 1))
|
||||
set_cron_unwatched(fd);
|
||||
|
||||
if (fd >= 0 && close(fd) < 0)
|
||||
log_it("CRON", pid, "INFO", "Inotify close failed", errno);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void run_reboot_jobs(cron_db * db) {
|
||||
user *u;
|
||||
entry *e;
|
||||
int reboot;
|
||||
pid_t pid = getpid();
|
||||
|
||||
/* lock exist - skip reboot jobs */
|
||||
if (access(REBOOT_LOCK, F_OK) == 0) {
|
||||
log_it("CRON", pid, "INFO",
|
||||
"@reboot jobs will be run at computer's startup.", 0);
|
||||
return;
|
||||
}
|
||||
/* lock doesn't exist - create lock, run reboot jobs */
|
||||
if ((reboot = creat(REBOOT_LOCK, S_IRUSR & S_IWUSR)) < 0)
|
||||
log_it("CRON", pid, "INFO", "Can't create lock for reboot jobs.",
|
||||
errno);
|
||||
else
|
||||
close(reboot);
|
||||
|
||||
for (u = db->head; u != NULL; u = u->next) {
|
||||
for (e = u->crontab; e != NULL; e = e->next) {
|
||||
if (e->flags & WHEN_REBOOT)
|
||||
job_add(e, u);
|
||||
}
|
||||
}
|
||||
(void) job_runqueue();
|
||||
}
|
||||
|
||||
static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild) {
|
||||
char *orig_tz, *job_tz;
|
||||
time_t virtualSecond = vtime * SECONDS_PER_MINUTE;
|
||||
struct tm *tm = gmtime(&virtualSecond);
|
||||
int minute, hour, dom, month, dow;
|
||||
user *u;
|
||||
entry *e;
|
||||
const char *uname;
|
||||
struct passwd *pw = NULL;
|
||||
|
||||
/* make 0-based values out of these so we can use them as indicies
|
||||
*/
|
||||
#define maketime(tz1, tz2) do { \
|
||||
char *t = tz1; \
|
||||
if (t != NULL && *t != '\0') \
|
||||
setenv("TZ", t, 1); \
|
||||
else if ((tz2) != NULL) \
|
||||
setenv("TZ", (tz2), 1); \
|
||||
else \
|
||||
unsetenv("TZ"); \
|
||||
tm = localtime(&StartTime); \
|
||||
minute = tm->tm_min -FIRST_MINUTE; \
|
||||
hour = tm->tm_hour -FIRST_HOUR; \
|
||||
dom = tm->tm_mday -FIRST_DOM; \
|
||||
month = tm->tm_mon +1 /* 0..11 -> 1..12 */ -FIRST_MONTH; \
|
||||
dow = tm->tm_wday -FIRST_DOW; \
|
||||
} while (0)
|
||||
|
||||
orig_tz = getenv("TZ");
|
||||
maketime(NULL, orig_tz);
|
||||
|
||||
Debug(DSCH, ("[%ld] tick(%d,%d,%d,%d,%d) %s %s\n",
|
||||
(long) getpid(), minute, hour, dom, month, dow,
|
||||
doWild ? " " : "No wildcard", doNonWild ? " " : "Wildcard only"))
|
||||
/* the dom/dow situation is odd. '* * 1,15 * Sun' will run on the
|
||||
* first and fifteenth AND every Sunday; '* * * * Sun' will run *only*
|
||||
* on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this
|
||||
* is why we keep 'e->dow_star' and 'e->dom_star'. yes, it's bizarre.
|
||||
* like many bizarre things, it's the standard.
|
||||
*/
|
||||
for (u = db->head; u != NULL; u = u->next) {
|
||||
for (e = u->crontab; e != NULL; e = e->next) {
|
||||
Debug(DSCH | DEXT, ("user [%s:%ld:%ld:...] cmd=\"%s\"\n",
|
||||
e->pwd->pw_name, (long) e->pwd->pw_uid,
|
||||
(long) e->pwd->pw_gid, e->cmd))
|
||||
uname = e->pwd->pw_name;
|
||||
/* check if user exists in time of job is being run f.e. ldap */
|
||||
if ((pw = getpwnam(uname)) != NULL) {
|
||||
job_tz = env_get("CRON_TZ", e->envp);
|
||||
maketime(job_tz, orig_tz);
|
||||
/* here we test whether time is NOW */
|
||||
if (bit_test(e->minute, minute) &&
|
||||
bit_test(e->hour, hour) &&
|
||||
bit_test(e->month, month) &&
|
||||
(((e->flags & DOM_STAR) || (e->flags & DOW_STAR))
|
||||
? (bit_test(e->dow, dow) && bit_test(e->dom, dom))
|
||||
: (bit_test(e->dow, dow) || bit_test(e->dom, dom))
|
||||
)
|
||||
) {
|
||||
if ((doNonWild &&
|
||||
!(e->flags & (MIN_STAR | HR_STAR))) ||
|
||||
(doWild && (e->flags & (MIN_STAR | HR_STAR))))
|
||||
job_add(e, u); /*will add job, if it isn't in queue already for NOW. */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (orig_tz != NULL)
|
||||
setenv("TZ", orig_tz, 1);
|
||||
else
|
||||
unsetenv("TZ");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set StartTime and clockTime to the current time.
|
||||
* These are used for computing what time it really is right now.
|
||||
* Note that clockTime is a unix wallclock time converted to minutes.
|
||||
*/
|
||||
static void set_time(int initialize) {
|
||||
struct tm tm;
|
||||
static int isdst;
|
||||
|
||||
StartTime = time(NULL);
|
||||
|
||||
/* We adjust the time to GMT so we can catch DST changes. */
|
||||
tm = *localtime(&StartTime);
|
||||
if (initialize || tm.tm_isdst != isdst) {
|
||||
isdst = tm.tm_isdst;
|
||||
GMToff = get_gmtoff(&StartTime, &tm);
|
||||
Debug(DSCH, ("[%ld] GMToff=%ld\n", (long) getpid(), (long) GMToff))
|
||||
}
|
||||
clockTime = (StartTime + GMToff) / (time_t) SECONDS_PER_MINUTE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to just hit the next minute.
|
||||
*/
|
||||
static void cron_sleep(int target, cron_db * db) {
|
||||
time_t t1, t2;
|
||||
int seconds_to_wait;
|
||||
|
||||
t1 = time(NULL) + GMToff;
|
||||
seconds_to_wait = (int) (target * SECONDS_PER_MINUTE - t1) + 1;
|
||||
Debug(DSCH, ("[%ld] Target time=%ld, sec-to-wait=%d\n",
|
||||
(long) getpid(), (long) target * SECONDS_PER_MINUTE,
|
||||
seconds_to_wait))
|
||||
|
||||
while (seconds_to_wait > 0 && seconds_to_wait < 65) {
|
||||
sleep((unsigned int) seconds_to_wait);
|
||||
|
||||
/*
|
||||
* Check to see if we were interrupted by a signal.
|
||||
* If so, service the signal(s) then continue sleeping
|
||||
* where we left off.
|
||||
*/
|
||||
handle_signals(db);
|
||||
|
||||
t2 = time(NULL) + GMToff;
|
||||
seconds_to_wait -= (int) (t2 - t1);
|
||||
t1 = t2;
|
||||
}
|
||||
}
|
||||
|
||||
static void sighup_handler(int x) {
|
||||
got_sighup = 1;
|
||||
}
|
||||
|
||||
static void sigchld_handler(int x) {
|
||||
got_sigchld = 1;
|
||||
}
|
||||
|
||||
static void quit(int x) {
|
||||
(void) unlink(_PATH_CRON_PID);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
static void sigchld_reaper(void) {
|
||||
WAIT_T waiter;
|
||||
PID_T pid;
|
||||
|
||||
do {
|
||||
pid = waitpid(-1, &waiter, WNOHANG);
|
||||
switch (pid) {
|
||||
case -1:
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
Debug(DPROC, ("[%ld] sigchld...no children\n", (long) getpid()))
|
||||
break;
|
||||
case 0:
|
||||
Debug(DPROC, ("[%ld] sigchld...no dead kids\n", (long) getpid()))
|
||||
break;
|
||||
default:
|
||||
Debug(DPROC,
|
||||
("[%ld] sigchld...pid #%ld died, stat=%d\n",
|
||||
(long) getpid(), (long) pid, WEXITSTATUS(waiter)))
|
||||
break;
|
||||
}
|
||||
} while (pid > 0);
|
||||
}
|
||||
|
||||
static void parse_args(int argc, char *argv[]) {
|
||||
int argch;
|
||||
|
||||
while (-1 != (argch = getopt(argc, argv, "hnpsix:m:c"))) {
|
||||
switch (argch) {
|
||||
case 'x':
|
||||
if (!set_debug_flags(optarg))
|
||||
usage();
|
||||
break;
|
||||
case 'n':
|
||||
NoFork = 1;
|
||||
break;
|
||||
case 'p':
|
||||
PermitAnyCrontab = 1;
|
||||
break;
|
||||
case 's':
|
||||
SyslogOutput = 1;
|
||||
break;
|
||||
case 'i':
|
||||
DisableInotify = 1;
|
||||
break;
|
||||
case 'm':
|
||||
strncpy(MailCmd, optarg, MAX_COMMAND);
|
||||
break;
|
||||
case 'c':
|
||||
EnableClustering = 1;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
51
cronie-1.4.6/src/cron.h
Normal file
51
cronie-1.4.6/src/cron.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* cron.h - header for vixie's cron
|
||||
*
|
||||
* $Id: cron.h,v 1.6 2004/01/23 18:56:42 vixie Exp $
|
||||
*
|
||||
* vix 14nov88 [rest of log is in RCS]
|
||||
* vix 14jan87 [0 or 7 can be sunday; thanks, mwm@berkeley]
|
||||
* vix 30dec86 [written]
|
||||
*/
|
||||
|
||||
#include "../config.h"
|
||||
#include "externs.h"
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_INOTIFY
|
||||
#include <sys/inotify.h>
|
||||
#endif
|
||||
|
||||
#include "pathnames.h"
|
||||
#include "macros.h"
|
||||
#include "structs.h"
|
||||
#include "funcs.h"
|
||||
#include "globals.h"
|
||||
|
969
cronie-1.4.6/src/crontab.c
Normal file
969
cronie-1.4.6/src/crontab.c
Normal file
|
@ -0,0 +1,969 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* crontab - install and manage per-user crontab files
|
||||
* vix 02may87 [RCS has the rest of the log]
|
||||
* vix 26jan87 [original]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 2010/09/10 by Colin Dean, Durham University IT Service,
|
||||
* to add clustering support.
|
||||
*/
|
||||
|
||||
#define MAIN_PROGRAM
|
||||
|
||||
#include <cron.h>
|
||||
#ifdef WITH_SELINUX
|
||||
# include <selinux/selinux.h>
|
||||
# include <selinux/context.h>
|
||||
# include <selinux/av_permissions.h>
|
||||
#endif
|
||||
|
||||
#define NHEADER_LINES 0
|
||||
|
||||
enum opt_t {opt_unknown, opt_list, opt_delete, opt_edit, opt_replace, opt_hostset, opt_hostget};
|
||||
|
||||
#if DEBUGGING
|
||||
static char *Options[] = {"???", "list", "delete", "edit", "replace", "hostset", "hostget"};
|
||||
|
||||
# ifdef WITH_SELINUX
|
||||
static char *getoptargs = "u:lerisncx:";
|
||||
# else
|
||||
static char *getoptargs = "u:lerincx:";
|
||||
# endif
|
||||
#else
|
||||
# ifdef WITH_SELINUX
|
||||
static char *getoptargs = "u:lerisnc";
|
||||
# else
|
||||
static char *getoptargs = "u:lerinc";
|
||||
# endif
|
||||
#endif
|
||||
static char *selinux_context = 0;
|
||||
|
||||
static PID_T Pid;
|
||||
static char User[MAX_UNAME], RealUser[MAX_UNAME];
|
||||
static char Filename[MAX_FNAME], TempFilename[MAX_FNAME];
|
||||
static char Host[MAXHOSTNAMELEN];
|
||||
static FILE *NewCrontab;
|
||||
static int CheckErrorCount;
|
||||
static int PromptOnDelete;
|
||||
static int HostSpecified;
|
||||
static enum opt_t Option;
|
||||
static struct passwd *pw;
|
||||
static void list_cmd(void),
|
||||
delete_cmd(void),
|
||||
edit_cmd(void),
|
||||
poke_daemon(void),
|
||||
check_error(const char *), parse_args(int c, char *v[]), die(int);
|
||||
static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void);
|
||||
static char *host_specific_filename(char *filename, int prefix);
|
||||
static char *tmp_path(void);
|
||||
|
||||
static void usage(const char *msg) {
|
||||
fprintf(stderr, "%s: usage error: %s\n", ProgramName, msg);
|
||||
fprintf(stderr, "usage:\t%s [-u user] file\n", ProgramName);
|
||||
fprintf(stderr, "\t%s [-u user] [ -e | -l | -r ]\n", ProgramName);
|
||||
fprintf(stderr, "\t%s -n [ hostname ]\n", ProgramName);
|
||||
fprintf(stderr, "\t%s -c\n", ProgramName);
|
||||
fprintf(stderr, "\t\t(default operation is replace, per 1003.2)\n");
|
||||
fprintf(stderr, "\t-e\t(edit user's crontab)\n");
|
||||
fprintf(stderr, "\t-l\t(list user's crontab)\n");
|
||||
fprintf(stderr, "\t-r\t(delete user's crontab)\n");
|
||||
fprintf(stderr, "\t-i\t(prompt before deleting user's crontab)\n");
|
||||
fprintf(stderr, "\t-n\t(set host in cluster to run users' crontabs)\n");
|
||||
fprintf(stderr, "\t-c\t(get host in cluster to run users' crontabs)\n");
|
||||
#ifdef WITH_SELINUX
|
||||
fprintf(stderr, "\t-s\t(selinux context)\n");
|
||||
#endif
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int exitstatus;
|
||||
|
||||
Pid = getpid();
|
||||
ProgramName = argv[0];
|
||||
MailCmd[0] = '\0';
|
||||
cron_default_mail_charset[0] = '\0';
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
#if defined(BSD)
|
||||
setlinebuf(stderr);
|
||||
#endif
|
||||
char *n = "-"; /*set the n string to - so we have a valid string to use */
|
||||
/*should we desire to make changes to behavior later. */
|
||||
if (argv[1] == NULL) { /* change behavior to allow crontab to take stdin with no '-' */
|
||||
argv[1] = n;
|
||||
}
|
||||
parse_args(argc, argv); /* sets many globals, opens a file */
|
||||
set_cron_cwd();
|
||||
if (!allowed(RealUser, CRON_ALLOW, CRON_DENY)) {
|
||||
fprintf(stderr,
|
||||
"You (%s) are not allowed to use this program (%s)\n",
|
||||
User, ProgramName);
|
||||
fprintf(stderr, "See crontab(1) for more information\n");
|
||||
log_it(RealUser, Pid, "AUTH", "crontab command not allowed", 0);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
#if defined(WITH_PAM)
|
||||
if (cron_start_pam(pw) != PAM_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"You (%s) are not allowed to access to (%s) because of pam configuration.\n",
|
||||
User, ProgramName);
|
||||
exit(ERROR_EXIT);
|
||||
};
|
||||
#endif
|
||||
|
||||
exitstatus = OK_EXIT;
|
||||
switch (Option) {
|
||||
case opt_unknown:
|
||||
exitstatus = ERROR_EXIT;
|
||||
break;
|
||||
case opt_list:
|
||||
list_cmd();
|
||||
break;
|
||||
case opt_delete:
|
||||
delete_cmd();
|
||||
break;
|
||||
case opt_edit:
|
||||
edit_cmd();
|
||||
break;
|
||||
case opt_replace:
|
||||
if (replace_cmd() < 0)
|
||||
exitstatus = ERROR_EXIT;
|
||||
break;
|
||||
case opt_hostset:
|
||||
if (hostset_cmd() < 0)
|
||||
exitstatus = ERROR_EXIT;
|
||||
break;
|
||||
case opt_hostget:
|
||||
if (hostget_cmd() < 0)
|
||||
exitstatus = ERROR_EXIT;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
cron_close_pam();
|
||||
exit(exitstatus);
|
||||
/*NOTREACHED*/}
|
||||
|
||||
static void parse_args(int argc, char *argv[]) {
|
||||
int argch;
|
||||
|
||||
if (!(pw = getpwuid(getuid()))) {
|
||||
fprintf(stderr, "%s: your UID isn't in the passwd file.\n",
|
||||
ProgramName);
|
||||
fprintf(stderr, "bailing out.\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (strlen(pw->pw_name) >= sizeof User) {
|
||||
fprintf(stderr, "username too long\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
strcpy(User, pw->pw_name);
|
||||
strcpy(RealUser, User);
|
||||
Filename[0] = '\0';
|
||||
Option = opt_unknown;
|
||||
PromptOnDelete = 0;
|
||||
HostSpecified = 0;
|
||||
while (-1 != (argch = getopt(argc, argv, getoptargs))) {
|
||||
switch (argch) {
|
||||
#if DEBUGGING
|
||||
case 'x':
|
||||
if (!set_debug_flags(optarg))
|
||||
usage("bad debug option");
|
||||
break;
|
||||
#endif
|
||||
case 'u':
|
||||
if (MY_UID(pw) != ROOT_UID) {
|
||||
fprintf(stderr, "must be privileged to use -u\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
if (crontab_security_access() != 0) {
|
||||
fprintf(stderr,
|
||||
"Access denied by SELinux, must be privileged to use -u\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
if (Option == opt_hostset || Option == opt_hostget) {
|
||||
fprintf(stderr,
|
||||
"cannot use -u with -n or -c\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
if (!(pw = getpwnam(optarg))) {
|
||||
fprintf(stderr, "%s: user `%s' unknown\n",
|
||||
ProgramName, optarg);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (strlen(optarg) >= sizeof User)
|
||||
usage("username too long");
|
||||
(void) strcpy(User, optarg);
|
||||
break;
|
||||
case 'l':
|
||||
if (Option != opt_unknown)
|
||||
usage("only one operation permitted");
|
||||
Option = opt_list;
|
||||
break;
|
||||
case 'r':
|
||||
if (Option != opt_unknown)
|
||||
usage("only one operation permitted");
|
||||
Option = opt_delete;
|
||||
break;
|
||||
case 'e':
|
||||
if (Option != opt_unknown)
|
||||
usage("only one operation permitted");
|
||||
Option = opt_edit;
|
||||
break;
|
||||
case 'i':
|
||||
PromptOnDelete = 1;
|
||||
break;
|
||||
#ifdef WITH_SELINUX
|
||||
case 's':
|
||||
if (getprevcon((security_context_t *) & (selinux_context))) {
|
||||
fprintf(stderr, "Cannot obtain SELinux process context\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 'n':
|
||||
if (MY_UID(pw) != ROOT_UID) {
|
||||
fprintf(stderr,
|
||||
"must be privileged to set host with -n\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (Option != opt_unknown)
|
||||
usage("only one operation permitted");
|
||||
if (strcmp(User, RealUser) != 0) {
|
||||
fprintf(stderr,
|
||||
"cannot use -u with -n or -c\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
Option = opt_hostset;
|
||||
break;
|
||||
case 'c':
|
||||
if (Option != opt_unknown)
|
||||
usage("only one operation permitted");
|
||||
if (strcmp(User, RealUser) != 0) {
|
||||
fprintf(stderr,
|
||||
"cannot use -u with -n or -c\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
Option = opt_hostget;
|
||||
break;
|
||||
default:
|
||||
usage("unrecognized option");
|
||||
}
|
||||
}
|
||||
|
||||
endpwent();
|
||||
|
||||
if (Option == opt_hostset && argv[optind] != NULL) {
|
||||
HostSpecified = 1;
|
||||
if (strlen(argv[optind]) >= sizeof Host)
|
||||
usage("hostname too long");
|
||||
(void) strcpy(Host, argv[optind]);
|
||||
optind++;
|
||||
}
|
||||
|
||||
if (Option != opt_unknown) {
|
||||
if (argv[optind] != NULL)
|
||||
usage("no arguments permitted after this option");
|
||||
}
|
||||
else {
|
||||
if (argv[optind] != NULL) {
|
||||
Option = opt_replace;
|
||||
if (strlen(argv[optind]) >= sizeof Filename)
|
||||
usage("filename too long");
|
||||
(void) strcpy(Filename, argv[optind]);
|
||||
}
|
||||
else
|
||||
usage("file name must be specified for replace");
|
||||
}
|
||||
|
||||
if (Option == opt_replace) {
|
||||
/* we have to open the file here because we're going to
|
||||
* chdir(2) into /var/cron before we get around to
|
||||
* reading the file.
|
||||
*/
|
||||
if (!strcmp(Filename, "-"))
|
||||
NewCrontab = stdin;
|
||||
else {
|
||||
/* relinquish the setuid status of the binary during
|
||||
* the open, lest nonroot users read files they should
|
||||
* not be able to read. we can't use access() here
|
||||
* since there's a race condition. thanks go out to
|
||||
* Arnt Gulbrandsen <agulbra@pvv.unit.no> for spotting
|
||||
* the race.
|
||||
*/
|
||||
|
||||
if (swap_uids() < OK) {
|
||||
perror("swapping uids");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (!(NewCrontab = fopen(Filename, "r"))) {
|
||||
perror(Filename);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (swap_uids_back() < OK) {
|
||||
perror("swapping uids back");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug(DMISC, ("user=%s, file=%s, option=%s\n",
|
||||
User, Filename, Options[(int) Option]))
|
||||
}
|
||||
|
||||
static void list_cmd(void) {
|
||||
char n[MAX_FNAME];
|
||||
FILE *f;
|
||||
int ch;
|
||||
|
||||
log_it(RealUser, Pid, "LIST", User, 0);
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (!(f = fopen(n, "r"))) {
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr, "no crontab for %s\n", User);
|
||||
else
|
||||
perror(n);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
/* file is open. copy to stdout, close.
|
||||
*/
|
||||
Set_LineNum(1)
|
||||
while (EOF != (ch = get_char(f)))
|
||||
putchar(ch);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void delete_cmd(void) {
|
||||
char n[MAX_FNAME] = "";
|
||||
if (PromptOnDelete == 1) {
|
||||
printf("crontab: really delete %s's crontab? ", User);
|
||||
fflush(stdout);
|
||||
if ((fgets(n, MAX_FNAME - 1, stdin) == 0L)
|
||||
|| ((n[0] != 'Y') && (n[0] != 'y'))
|
||||
)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
log_it(RealUser, Pid, "DELETE", User, 0);
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (unlink(n) != 0) {
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr, "no crontab for %s\n", User);
|
||||
else
|
||||
perror(n);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
poke_daemon();
|
||||
}
|
||||
|
||||
static void check_error(const char *msg) {
|
||||
CheckErrorCount++;
|
||||
fprintf(stderr, "\"%s\":%d: %s\n", Filename, LineNumber - 1, msg);
|
||||
}
|
||||
|
||||
static char *tmp_path() {
|
||||
char *tmpdir = NULL;
|
||||
|
||||
if ((getuid() == geteuid()) && (getgid() == getegid())) {
|
||||
tmpdir = getenv("TMPDIR");
|
||||
}
|
||||
return tmpdir ? tmpdir : "/tmp";
|
||||
}
|
||||
|
||||
static char *host_specific_filename(char *filename, int prefix)
|
||||
{
|
||||
/*
|
||||
* For cluster-wide use, where there is otherwise risk of the same
|
||||
* name being generated on more than one host at once, prefix with
|
||||
* "hostname." or suffix with ".hostname" as requested, and return
|
||||
* static buffer or NULL on failure.
|
||||
*/
|
||||
|
||||
static char safename[MAX_FNAME];
|
||||
char hostname[MAXHOSTNAMELEN];
|
||||
|
||||
if (gethostname(hostname, sizeof hostname) != 0)
|
||||
return NULL;
|
||||
|
||||
if (prefix) {
|
||||
if (!glue_strings(safename, sizeof safename, hostname, filename, '.'))
|
||||
return NULL;
|
||||
} else {
|
||||
if (!glue_strings(safename, sizeof safename, filename, hostname, '.'))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return safename;
|
||||
}
|
||||
|
||||
static void edit_cmd(void) {
|
||||
char n[MAX_FNAME], q[MAX_TEMPSTR], *editor;
|
||||
FILE *f;
|
||||
int ch = '\0', t;
|
||||
struct stat statbuf;
|
||||
struct utimbuf utimebuf;
|
||||
WAIT_T waiter;
|
||||
PID_T pid, xpid;
|
||||
|
||||
log_it(RealUser, Pid, "BEGIN EDIT", User, 0);
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (!(f = fopen(n, "r"))) {
|
||||
if (errno != ENOENT) {
|
||||
perror(n);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
fprintf(stderr, "no crontab for %s - using an empty one\n", User);
|
||||
if (!(f = fopen(_PATH_DEVNULL, "r"))) {
|
||||
perror(_PATH_DEVNULL);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn off signals. */
|
||||
(void) signal(SIGHUP, SIG_IGN);
|
||||
(void) signal(SIGINT, SIG_IGN);
|
||||
(void) signal(SIGQUIT, SIG_IGN);
|
||||
|
||||
if (!glue_strings(Filename, sizeof Filename, tmp_path(),
|
||||
"crontab.XXXXXXXXXX", '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (swap_uids() == -1) {
|
||||
perror("swapping uids");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (-1 == (t = mkstemp(Filename))) {
|
||||
perror(Filename);
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
if (swap_uids_back() == -1) {
|
||||
perror("swapping uids back");
|
||||
goto fatal;
|
||||
}
|
||||
if (!(NewCrontab = fdopen(t, "r+"))) {
|
||||
perror("fdopen");
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
Set_LineNum(1)
|
||||
/*
|
||||
* NHEADER_LINES processing removed for clarity
|
||||
* (NHEADER_LINES == 0 in all Red Hat crontabs)
|
||||
*/
|
||||
/* copy the rest of the crontab (if any) to the temp file.
|
||||
*/
|
||||
if (EOF != ch)
|
||||
while (EOF != (ch = get_char(f)))
|
||||
putc(ch, NewCrontab);
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
if (selinux_context) {
|
||||
context_t ccon = NULL;
|
||||
const char *level = NULL;
|
||||
|
||||
if (!(ccon = context_new(selinux_context))) {
|
||||
fprintf(stderr, "context_new failed\n");
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
if (!(level = context_range_get(ccon))) {
|
||||
fprintf(stderr, "context_range failed\n");
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
fprintf(NewCrontab, "MLS_LEVEL=%s\n", level);
|
||||
context_free(ccon);
|
||||
freecon(selinux_context);
|
||||
selinux_context = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
fclose(f);
|
||||
if (fflush(NewCrontab) < OK) {
|
||||
perror(Filename);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (swap_uids() == -1) {
|
||||
perror("swapping uids");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
/* Set it to 1970 */
|
||||
utimebuf.actime = 0;
|
||||
utimebuf.modtime = 0;
|
||||
utime(Filename, &utimebuf);
|
||||
if (swap_uids_back() == -1) {
|
||||
perror("swapping uids");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
again:
|
||||
rewind(NewCrontab);
|
||||
if (ferror(NewCrontab)) {
|
||||
fprintf(stderr, "%s: error while writing new crontab to %s\n",
|
||||
ProgramName, Filename);
|
||||
fatal:
|
||||
unlink(Filename);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
if (((editor = getenv("VISUAL")) == NULL || *editor == '\0') &&
|
||||
((editor = getenv("EDITOR")) == NULL || *editor == '\0')) {
|
||||
editor = EDITOR;
|
||||
}
|
||||
|
||||
/* we still have the file open. editors will generally rewrite the
|
||||
* original file rather than renaming/unlinking it and starting a
|
||||
* new one; even backup files are supposed to be made by copying
|
||||
* rather than by renaming. if some editor does not support this,
|
||||
* then don't use it. the security problems are more severe if we
|
||||
* close and reopen the file around the edit.
|
||||
*/
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
perror("fork");
|
||||
goto fatal;
|
||||
case 0:
|
||||
/* child */
|
||||
if (setgid(MY_GID(pw)) < 0) {
|
||||
perror("setgid(getgid())");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (setuid(MY_UID(pw)) < 0) {
|
||||
perror("setuid(getuid())");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (!glue_strings(q, sizeof q, editor, Filename, ' ')) {
|
||||
fprintf(stderr, "%s: editor command line too long\n", ProgramName);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", q, (char *) 0);
|
||||
perror(editor);
|
||||
exit(ERROR_EXIT);
|
||||
/*NOTREACHED*/ default:
|
||||
/* parent */
|
||||
break;
|
||||
}
|
||||
|
||||
/* parent */
|
||||
for (;;) {
|
||||
xpid = waitpid(pid, &waiter, 0);
|
||||
if (xpid == -1) {
|
||||
if (errno != EINTR)
|
||||
fprintf(stderr,
|
||||
"%s: waitpid() failed waiting for PID %ld from \"%s\": %s\n",
|
||||
ProgramName, (long) pid, editor, strerror(errno));
|
||||
}
|
||||
else if (xpid != pid) {
|
||||
fprintf(stderr, "%s: wrong PID (%ld != %ld) from \"%s\"\n",
|
||||
ProgramName, (long) xpid, (long) pid, editor);
|
||||
goto fatal;
|
||||
}
|
||||
else if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) {
|
||||
fprintf(stderr, "%s: \"%s\" exited with status %d\n",
|
||||
ProgramName, editor, WEXITSTATUS(waiter));
|
||||
goto fatal;
|
||||
}
|
||||
else if (WIFSIGNALED(waiter)) {
|
||||
fprintf(stderr,
|
||||
"%s: \"%s\" killed; signal %d (%score dumped)\n",
|
||||
ProgramName, editor, WTERMSIG(waiter),
|
||||
WCOREDUMP(waiter) ? "" : "no ");
|
||||
goto fatal;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
(void) signal(SIGHUP, SIG_DFL);
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
(void) signal(SIGQUIT, SIG_DFL);
|
||||
|
||||
/* lstat doesn't make any harm, because
|
||||
* the file is stat'ed only when crontab is touched
|
||||
*/
|
||||
if (lstat(Filename, &statbuf) < 0) {
|
||||
perror("lstat");
|
||||
goto fatal;
|
||||
}
|
||||
|
||||
if (!S_ISREG(statbuf.st_mode)) {
|
||||
fprintf(stderr, "%s: illegal crontab\n", ProgramName);
|
||||
goto remove;
|
||||
}
|
||||
|
||||
if (statbuf.st_mtime == 0) {
|
||||
fprintf(stderr, "%s: no changes made to crontab\n", ProgramName);
|
||||
goto remove;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: installing new crontab\n", ProgramName);
|
||||
fclose(NewCrontab);
|
||||
if (swap_uids() < OK) {
|
||||
perror("swapping uids");
|
||||
goto remove;
|
||||
}
|
||||
if (!(NewCrontab = fopen(Filename, "r+"))) {
|
||||
perror("cannot read new crontab");
|
||||
goto remove;
|
||||
}
|
||||
if (swap_uids_back() < OK) {
|
||||
perror("swapping uids back");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (NewCrontab == 0L) {
|
||||
perror("fopen");
|
||||
goto fatal;
|
||||
}
|
||||
switch (replace_cmd()) {
|
||||
case 0:
|
||||
break;
|
||||
case -1:
|
||||
for (;;) {
|
||||
printf("Do you want to retry the same edit? ");
|
||||
fflush(stdout);
|
||||
q[0] = '\0';
|
||||
if (fgets(q, sizeof q, stdin) == 0L)
|
||||
continue;
|
||||
switch (q[0]) {
|
||||
case 'y':
|
||||
case 'Y':
|
||||
goto again;
|
||||
case 'n':
|
||||
case 'N':
|
||||
goto abandon;
|
||||
default:
|
||||
fprintf(stderr, "Enter Y or N\n");
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/ case -2:
|
||||
abandon:
|
||||
fprintf(stderr, "%s: edits left in %s\n", ProgramName, Filename);
|
||||
goto done;
|
||||
default:
|
||||
fprintf(stderr, "%s: panic: bad switch() in replace_cmd()\n",
|
||||
ProgramName);
|
||||
goto fatal;
|
||||
}
|
||||
remove:
|
||||
unlink(Filename);
|
||||
done:
|
||||
log_it(RealUser, Pid, "END EDIT", User, 0);
|
||||
}
|
||||
|
||||
/* returns 0 on success
|
||||
* -1 on syntax error
|
||||
* -2 on install error
|
||||
*/
|
||||
static int replace_cmd(void) {
|
||||
char n[MAX_FNAME], envstr[MAX_ENVSTR];
|
||||
FILE *tmp;
|
||||
int ch, eof, fd;
|
||||
int error = 0;
|
||||
entry *e;
|
||||
uid_t file_owner;
|
||||
char **envp = env_init();
|
||||
char *safename;
|
||||
|
||||
if (envp == NULL) {
|
||||
fprintf(stderr, "%s: Cannot allocate memory.\n", ProgramName);
|
||||
return (-2);
|
||||
}
|
||||
|
||||
safename = host_specific_filename("tmp.XXXXXXXXXX", 1);
|
||||
if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
|
||||
safename, '/')) {
|
||||
TempFilename[0] = '\0';
|
||||
fprintf(stderr, "path too long\n");
|
||||
return (-2);
|
||||
}
|
||||
if ((fd = mkstemp(TempFilename)) == -1 || !(tmp = fdopen(fd, "w+"))) {
|
||||
perror(TempFilename);
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
unlink(TempFilename);
|
||||
}
|
||||
TempFilename[0] = '\0';
|
||||
return (-2);
|
||||
}
|
||||
|
||||
(void) signal(SIGHUP, die);
|
||||
(void) signal(SIGINT, die);
|
||||
(void) signal(SIGQUIT, die);
|
||||
|
||||
/* write a signature at the top of the file.
|
||||
*
|
||||
* VERY IMPORTANT: make sure NHEADER_LINES agrees with this code.
|
||||
*/
|
||||
/*fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
|
||||
*fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now));
|
||||
*fprintf(tmp, "# (Cron version %s)\n", CRON_VERSION);
|
||||
*/
|
||||
#ifdef WITH_SELINUX
|
||||
if (selinux_context)
|
||||
fprintf(tmp, "SELINUX_ROLE_TYPE=%s\n", selinux_context);
|
||||
#endif
|
||||
|
||||
/* copy the crontab to the tmp
|
||||
*/
|
||||
rewind(NewCrontab);
|
||||
Set_LineNum(1)
|
||||
while (EOF != (ch = get_char(NewCrontab)))
|
||||
putc(ch, tmp);
|
||||
if (ftruncate(fileno(tmp), ftell(tmp)) == -1) {
|
||||
fprintf(stderr, "%s: error while writing new crontab to %s\n",
|
||||
ProgramName, TempFilename);
|
||||
fclose(tmp);
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
fflush(tmp);
|
||||
rewind(tmp);
|
||||
if (ferror(tmp)) {
|
||||
fprintf(stderr, "%s: error while writing new crontab to %s\n",
|
||||
ProgramName, TempFilename);
|
||||
fclose(tmp);
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* check the syntax of the file being installed.
|
||||
*/
|
||||
|
||||
/* BUG: was reporting errors after the EOF if there were any errors
|
||||
* in the file proper -- kludged it by stopping after first error.
|
||||
* vix 31mar87
|
||||
*/
|
||||
Set_LineNum(1 - NHEADER_LINES)
|
||||
CheckErrorCount = 0;
|
||||
eof = FALSE;
|
||||
while (!CheckErrorCount && !eof) {
|
||||
switch (load_env(envstr, tmp)) {
|
||||
case ERR:
|
||||
/* check for data before the EOF */
|
||||
if (envstr[0] != '\0') {
|
||||
Set_LineNum(LineNumber + 1);
|
||||
check_error("premature EOF");
|
||||
}
|
||||
eof = TRUE;
|
||||
break;
|
||||
case FALSE:
|
||||
e = load_entry(tmp, check_error, pw, envp);
|
||||
if (e)
|
||||
free(e);
|
||||
break;
|
||||
case TRUE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckErrorCount != 0) {
|
||||
fprintf(stderr, "errors in crontab file, can't install.\n");
|
||||
fclose(tmp);
|
||||
error = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
file_owner = (getgid() == getegid())? ROOT_UID : pw->pw_uid;
|
||||
|
||||
#ifdef HAVE_FCHOWN
|
||||
if (fchown(fileno(tmp), file_owner, -1) < OK) {
|
||||
perror("fchown");
|
||||
fclose(tmp);
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
if (chown(TempFilename, file_owner, -1) < OK) {
|
||||
perror("chown");
|
||||
fclose(tmp);
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fclose(tmp) == EOF) {
|
||||
perror("fclose");
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, User, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
if (rename(TempFilename, n)) {
|
||||
fprintf(stderr, "%s: error renaming %s to %s\n",
|
||||
ProgramName, TempFilename, n);
|
||||
perror("rename");
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
TempFilename[0] = '\0';
|
||||
log_it(RealUser, Pid, "REPLACE", User, 0);
|
||||
|
||||
poke_daemon();
|
||||
|
||||
done:
|
||||
(void) signal(SIGHUP, SIG_DFL);
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
(void) signal(SIGQUIT, SIG_DFL);
|
||||
if (TempFilename[0]) {
|
||||
(void) unlink(TempFilename);
|
||||
TempFilename[0] = '\0';
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int hostset_cmd(void) {
|
||||
char n[MAX_FNAME];
|
||||
FILE *tmp;
|
||||
int fd;
|
||||
int error = 0;
|
||||
char *safename;
|
||||
|
||||
if (!HostSpecified)
|
||||
gethostname(Host, sizeof Host);
|
||||
|
||||
safename = host_specific_filename("tmp.XXXXXXXXXX", 1);
|
||||
if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
|
||||
safename, '/')) {
|
||||
TempFilename[0] = '\0';
|
||||
fprintf(stderr, "path too long\n");
|
||||
return (-2);
|
||||
}
|
||||
if ((fd = mkstemp(TempFilename)) == -1 || !(tmp = fdopen(fd, "w"))) {
|
||||
perror(TempFilename);
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
unlink(TempFilename);
|
||||
}
|
||||
TempFilename[0] = '\0';
|
||||
return (-2);
|
||||
}
|
||||
|
||||
(void) signal(SIGHUP, die);
|
||||
(void) signal(SIGINT, die);
|
||||
(void) signal(SIGQUIT, die);
|
||||
|
||||
(void) fchmod(fd, 0600); /* not all mkstemp() implementations do this */
|
||||
|
||||
if (fprintf(tmp, "%s\n", Host) < 0 || fclose(tmp) == EOF) {
|
||||
fprintf(stderr, "%s: error while writing to %s\n",
|
||||
ProgramName, TempFilename);
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, CRON_HOSTNAME, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (rename(TempFilename, n)) {
|
||||
fprintf(stderr, "%s: error renaming %s to %s\n",
|
||||
ProgramName, TempFilename, n);
|
||||
perror("rename");
|
||||
error = -2;
|
||||
goto done;
|
||||
}
|
||||
TempFilename[0] = '\0';
|
||||
log_it(RealUser, Pid, "SET HOST", Host, 0);
|
||||
|
||||
poke_daemon();
|
||||
|
||||
done:
|
||||
(void) signal(SIGHUP, SIG_DFL);
|
||||
(void) signal(SIGINT, SIG_DFL);
|
||||
(void) signal(SIGQUIT, SIG_DFL);
|
||||
if (TempFilename[0]) {
|
||||
(void) unlink(TempFilename);
|
||||
TempFilename[0] = '\0';
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int hostget_cmd(void) {
|
||||
char n[MAX_FNAME];
|
||||
FILE *f;
|
||||
|
||||
if (!glue_strings(n, sizeof n, SPOOL_DIR, CRON_HOSTNAME, '/')) {
|
||||
fprintf(stderr, "path too long\n");
|
||||
return (-2);
|
||||
}
|
||||
|
||||
if (!(f = fopen(n, "r"))) {
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr, "File %s not found\n", n);
|
||||
else
|
||||
perror(n);
|
||||
return (-2);
|
||||
}
|
||||
|
||||
if (get_string(Host, sizeof Host, f, "\n") == EOF) {
|
||||
fprintf(stderr, "Error reading from %s\n", n);
|
||||
fclose(f);
|
||||
return (-2);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
printf("%s\n", Host);
|
||||
fflush(stdout);
|
||||
|
||||
log_it(RealUser, Pid, "GET HOST", Host, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void poke_daemon(void) {
|
||||
if (utime(SPOOL_DIR, NULL) < OK) {
|
||||
fprintf(stderr, "crontab: can't update mtime on spooldir\n");
|
||||
perror(SPOOL_DIR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void die(int x) {
|
||||
if (TempFilename[0])
|
||||
(void) unlink(TempFilename);
|
||||
_exit(ERROR_EXIT);
|
||||
}
|
550
cronie-1.4.6/src/database.c
Normal file
550
cronie-1.4.6/src/database.c
Normal file
|
@ -0,0 +1,550 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* vix 26jan87 [RCS has the log]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 2010/09/12 by Colin Dean, Durham University IT Service,
|
||||
* to add clustering support.
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
#define TMAX(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
/* size of the event structure, not counting name */
|
||||
#define EVENT_SIZE (sizeof (struct inotify_event))
|
||||
|
||||
/* reasonable guess as to size of 1024 events */
|
||||
#define BUF_LEN (1024 * (EVENT_SIZE + 16))
|
||||
|
||||
static void overwrite_database(cron_db *, cron_db *);
|
||||
|
||||
static void process_crontab(const char *, const char *,
|
||||
const char *, cron_db *, cron_db *);
|
||||
|
||||
static int not_a_crontab(DIR_T * dp);
|
||||
/* return 1 if we should skip this file */
|
||||
|
||||
static void max_mtime(char *dir_name, struct stat *max_st);
|
||||
/* record max mtime of any file under dir_name in max_st */
|
||||
|
||||
static int
|
||||
check_open(const char *tabname, const char *fname, const char *uname,
|
||||
struct passwd *pw, time_t * mtime) {
|
||||
struct stat statbuf;
|
||||
int crontab_fd;
|
||||
pid_t pid = getpid();
|
||||
|
||||
if ((crontab_fd =
|
||||
open(tabname, O_RDONLY | O_NONBLOCK, 0)) == -1) {
|
||||
log_it(uname, pid, "CAN'T OPEN", tabname, errno);
|
||||
return (-1);
|
||||
}
|
||||
if (fstat(crontab_fd, &statbuf) < OK) {
|
||||
log_it(uname, pid, "STAT FAILED", tabname, errno);
|
||||
close(crontab_fd);
|
||||
return (-1);
|
||||
}
|
||||
*mtime = statbuf.st_mtime;
|
||||
if (PermitAnyCrontab == 0) {
|
||||
if (!S_ISREG(statbuf.st_mode)) {
|
||||
log_it(uname, pid, "NOT REGULAR", tabname, 0);
|
||||
close(crontab_fd);
|
||||
return (-1);
|
||||
}
|
||||
if ((statbuf.st_mode & 07533) != 0400) {
|
||||
log_it(uname, pid, "BAD FILE MODE", tabname, 0);
|
||||
close(crontab_fd);
|
||||
return (-1);
|
||||
}
|
||||
if (statbuf.st_uid != ROOT_UID && (pw == NULL ||
|
||||
statbuf.st_uid != pw->pw_uid ||
|
||||
strcmp(uname, pw->pw_name) != 0)) {
|
||||
log_it(uname, pid, "WRONG FILE OWNER", tabname, 0);
|
||||
close(crontab_fd);
|
||||
return (-1);
|
||||
}
|
||||
if (pw && statbuf.st_nlink != 1) {
|
||||
log_it(uname, pid, "BAD LINK COUNT", tabname, 0);
|
||||
close(crontab_fd);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
return (crontab_fd);
|
||||
}
|
||||
|
||||
static void
|
||||
process_crontab(const char *uname, const char *fname, const char *tabname,
|
||||
cron_db * new_db, cron_db * old_db) {
|
||||
struct passwd *pw = NULL;
|
||||
int crontab_fd = -1;
|
||||
user *u;
|
||||
time_t mtime;
|
||||
int crond_crontab = (fname == NULL) && (strcmp(tabname, SYSCRONTAB) != 0);
|
||||
|
||||
if (fname == NULL) {
|
||||
/* must be set to something for logging purposes.
|
||||
*/
|
||||
fname = "*system*";
|
||||
}
|
||||
else if ((pw = getpwnam(uname)) == NULL) {
|
||||
/* file doesn't have a user in passwd file.
|
||||
*/
|
||||
log_it(uname, getpid(), "ORPHAN", "no passwd entry", 0);
|
||||
goto next_crontab;
|
||||
}
|
||||
|
||||
if ((crontab_fd = check_open(tabname, fname, uname, pw, &mtime)) == -1)
|
||||
goto next_crontab;
|
||||
|
||||
Debug(DLOAD, ("\t%s:", fname))
|
||||
|
||||
u = find_user(old_db, fname, crond_crontab ? tabname : NULL); /* find user in old_db */
|
||||
|
||||
if (u != NULL) {
|
||||
/* if crontab has not changed since we last read it
|
||||
* in, then we can just use our existing entry.
|
||||
*/
|
||||
if (u->mtime == mtime) {
|
||||
Debug(DLOAD, (" [no change, using old data]"))
|
||||
unlink_user(old_db, u);
|
||||
link_user(new_db, u);
|
||||
goto next_crontab;
|
||||
}
|
||||
|
||||
/* before we fall through to the code that will reload
|
||||
* the user, let's deallocate and unlink the user in
|
||||
* the old database. This is more a point of memory
|
||||
* efficiency than anything else, since all leftover
|
||||
* users will be deleted from the old database when
|
||||
* we finish with the crontab...
|
||||
*/
|
||||
Debug(DLOAD, (" [delete old data]"))
|
||||
unlink_user(old_db, u);
|
||||
free_user(u);
|
||||
log_it(fname, getpid(), "RELOAD", tabname, 0);
|
||||
}
|
||||
|
||||
u = load_user(crontab_fd, pw, uname, fname, tabname); /* read the file */
|
||||
if (u != NULL) {
|
||||
u->mtime = mtime;
|
||||
link_user(new_db, u);
|
||||
}
|
||||
|
||||
next_crontab:
|
||||
if (crontab_fd != -1) {
|
||||
Debug(DLOAD, (" [done]\n"))
|
||||
close(crontab_fd);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
cluster_host_is_local(void)
|
||||
{
|
||||
char filename[MAXNAMLEN+1];
|
||||
int is_local;
|
||||
FILE *f;
|
||||
char hostname[MAXHOSTNAMELEN], myhostname[MAXHOSTNAMELEN];
|
||||
|
||||
if (!EnableClustering)
|
||||
return (1);
|
||||
|
||||
/* to allow option of NFS-mounting SPOOL_DIR on a cluster of
|
||||
* hosts and to only use crontabs here on any one host at a
|
||||
* time, allow for existence of a CRON_HOSTNAME file, and if
|
||||
* it doesn't exist, or exists but does not contain this
|
||||
* host's hostname, then skip the crontabs.
|
||||
*
|
||||
* Note: for safety's sake, no CRON_HOSTNAME file means skip,
|
||||
* otherwise its accidental deletion could result in multiple
|
||||
* cluster hosts running the same cron jobs, which is
|
||||
* potentially worse.
|
||||
*/
|
||||
|
||||
is_local = 0;
|
||||
if (glue_strings(filename, sizeof filename, SPOOL_DIR, CRON_HOSTNAME, '/')) {
|
||||
if ((f = fopen(filename, "r"))) {
|
||||
|
||||
if (EOF != get_string(hostname, MAXHOSTNAMELEN, f, "\n") &&
|
||||
gethostname(myhostname, MAXHOSTNAMELEN) == 0) {
|
||||
is_local = (strcmp(myhostname, hostname) == 0);
|
||||
} else {
|
||||
Debug(DLOAD, ("cluster: hostname comparison error\n"));
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
} else {
|
||||
Debug(DLOAD, ("cluster: file %s not found\n", filename));
|
||||
}
|
||||
}
|
||||
|
||||
return (is_local);
|
||||
}
|
||||
|
||||
#if defined WITH_INOTIFY
|
||||
void check_inotify_database(cron_db * old_db) {
|
||||
cron_db new_db;
|
||||
DIR_T *dp;
|
||||
DIR *dir;
|
||||
struct timeval time;
|
||||
fd_set rfds;
|
||||
int retval = 0;
|
||||
char buf[BUF_LEN];
|
||||
pid_t pid = getpid();
|
||||
time.tv_sec = 0;
|
||||
time.tv_usec = 0;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(old_db->ifd, &rfds);
|
||||
|
||||
retval = select(old_db->ifd + 1, &rfds, NULL, NULL, &time);
|
||||
if (retval == -1) {
|
||||
if (errno != EINTR)
|
||||
log_it("CRON", pid, "INOTIFY", "select failed", errno);
|
||||
return;
|
||||
}
|
||||
else if (FD_ISSET(old_db->ifd, &rfds)) {
|
||||
new_db.head = new_db.tail = NULL;
|
||||
new_db.ifd = old_db->ifd;
|
||||
while ((retval = read(old_db->ifd, buf, sizeof (buf))) == -1 &&
|
||||
errno == EINTR) ;
|
||||
|
||||
if (retval == 0) {
|
||||
/* this should not happen as the buffer is large enough */
|
||||
errno = ENOMEM;
|
||||
}
|
||||
|
||||
if (retval <= 0) {
|
||||
log_it("CRON", pid, "INOTIFY", "read failed", errno);
|
||||
/* something fatal must have occured we have no other reasonable
|
||||
* way how to handle this failure than exit.
|
||||
*/
|
||||
(void) exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
/* we must reinstate the watches here - TODO reinstate only watches
|
||||
* which get IN_IGNORED event
|
||||
*/
|
||||
set_cron_watched(old_db->ifd);
|
||||
|
||||
/* TODO: parse the events and read only affected files */
|
||||
|
||||
process_crontab("root", NULL, SYSCRONTAB, &new_db, old_db);
|
||||
|
||||
if (!(dir = opendir(SYS_CROND_DIR))) {
|
||||
log_it("CRON", pid, "OPENDIR FAILED", SYS_CROND_DIR, errno);
|
||||
}
|
||||
else {
|
||||
while (NULL != (dp = readdir(dir))) {
|
||||
char tabname[MAXNAMLEN + 1];
|
||||
|
||||
if (not_a_crontab(dp))
|
||||
continue;
|
||||
|
||||
if (!glue_strings(tabname, sizeof tabname, SYS_CROND_DIR,
|
||||
dp->d_name, '/'))
|
||||
continue;
|
||||
process_crontab("root", NULL, tabname, &new_db, old_db);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
if (!(dir = opendir(SPOOL_DIR))) {
|
||||
log_it("CRON", pid, "OPENDIR FAILED", SPOOL_DIR, errno);
|
||||
}
|
||||
else {
|
||||
while (NULL != (dp = readdir(dir))) {
|
||||
char fname[MAXNAMLEN + 1], tabname[MAXNAMLEN + 1];
|
||||
|
||||
if (not_a_crontab(dp))
|
||||
continue;
|
||||
|
||||
strncpy(fname, dp->d_name, MAXNAMLEN);
|
||||
|
||||
if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR,
|
||||
dp->d_name, '/'))
|
||||
continue;
|
||||
process_crontab(fname, fname, tabname, &new_db, old_db);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
/* if we don't do this, then when our children eventually call
|
||||
* getpwnam() in do_command.c's child_process to verify MAILTO=,
|
||||
* they will screw us up (and v-v).
|
||||
*/
|
||||
endpwent();
|
||||
}
|
||||
else {
|
||||
/* just return as no db reload is needed */
|
||||
return;
|
||||
}
|
||||
|
||||
overwrite_database(old_db, &new_db);
|
||||
Debug(DLOAD, ("check_inotify_database is done\n"))
|
||||
}
|
||||
#endif
|
||||
|
||||
static void overwrite_database(cron_db * old_db, cron_db * new_db) {
|
||||
user *u, *nu;
|
||||
/* whatever's left in the old database is now junk.
|
||||
*/
|
||||
Debug(DLOAD, ("unlinking old database:\n"))
|
||||
for (u = old_db->head; u != NULL; u = nu) {
|
||||
Debug(DLOAD, ("\t%s\n", u->name))
|
||||
nu = u->next;
|
||||
unlink_user(old_db, u);
|
||||
free_user(u);
|
||||
}
|
||||
|
||||
/* overwrite the database control block with the new one.
|
||||
*/
|
||||
*old_db = *new_db;
|
||||
}
|
||||
|
||||
int load_database(cron_db * old_db) {
|
||||
struct stat statbuf, syscron_stat, crond_stat;
|
||||
cron_db new_db;
|
||||
DIR_T *dp;
|
||||
DIR *dir;
|
||||
pid_t pid = getpid();
|
||||
int is_local = 0;
|
||||
|
||||
Debug(DLOAD, ("[%ld] load_database()\n", (long) pid))
|
||||
|
||||
/* before we start loading any data, do a stat on SPOOL_DIR
|
||||
* so that if anything changes as of this moment (i.e., before we've
|
||||
* cached any of the database), we'll see the changes next time.
|
||||
*/
|
||||
if (stat(SPOOL_DIR, &statbuf) < OK) {
|
||||
log_it("CRON", pid, "STAT FAILED", SPOOL_DIR, errno);
|
||||
statbuf.st_mtime = 0;
|
||||
}
|
||||
else {
|
||||
/* As pointed out in Red Hat bugzilla 198019, with modern Linux it
|
||||
* is possible to modify a file without modifying the mtime of the
|
||||
* containing directory. Hence, we must check the mtime of each file:
|
||||
*/
|
||||
max_mtime(SPOOL_DIR, &statbuf);
|
||||
}
|
||||
|
||||
if (stat(SYS_CROND_DIR, &crond_stat) < OK) {
|
||||
log_it("CRON", pid, "STAT FAILED", SYS_CROND_DIR, errno);
|
||||
crond_stat.st_mtime = 0;
|
||||
}
|
||||
else {
|
||||
max_mtime(SYS_CROND_DIR, &crond_stat);
|
||||
}
|
||||
|
||||
/* track system crontab file
|
||||
*/
|
||||
if (stat(SYSCRONTAB, &syscron_stat) < OK)
|
||||
syscron_stat.st_mtime = 0;
|
||||
|
||||
/* if spooldir's mtime has not changed, we don't need to fiddle with
|
||||
* the database.
|
||||
*
|
||||
* Note that old_db->mtime is initialized to 0 in main(), and
|
||||
* so is guaranteed to be different than the stat() mtime the first
|
||||
* time this function is called.
|
||||
*/
|
||||
if (old_db->mtime == TMAX(crond_stat.st_mtime,
|
||||
TMAX(statbuf.st_mtime, syscron_stat.st_mtime))
|
||||
) {
|
||||
Debug(DLOAD, ("[%ld] spool dir mtime unch, no load needed.\n",
|
||||
(long) pid))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* something's different. make a new database, moving unchanged
|
||||
* elements from the old database, reloading elements that have
|
||||
* actually changed. Whatever is left in the old database when
|
||||
* we're done is chaff -- crontabs that disappeared.
|
||||
*/
|
||||
new_db.mtime = TMAX(crond_stat.st_mtime,
|
||||
TMAX(statbuf.st_mtime, syscron_stat.st_mtime));
|
||||
new_db.head = new_db.tail = NULL;
|
||||
#if defined WITH_INOTIFY
|
||||
new_db.ifd = old_db->ifd;
|
||||
#endif
|
||||
|
||||
if (syscron_stat.st_mtime)
|
||||
process_crontab("root", NULL, SYSCRONTAB, &new_db, old_db);
|
||||
|
||||
if (!(dir = opendir(SYS_CROND_DIR))) {
|
||||
log_it("CRON", pid, "OPENDIR FAILED", SYS_CROND_DIR, errno);
|
||||
}
|
||||
else {
|
||||
while (NULL != (dp = readdir(dir))) {
|
||||
char tabname[MAXNAMLEN + 1];
|
||||
|
||||
if (not_a_crontab(dp))
|
||||
continue;
|
||||
|
||||
if (!glue_strings(tabname, sizeof tabname, SYS_CROND_DIR,
|
||||
dp->d_name, '/'))
|
||||
continue; /* XXX log? */
|
||||
|
||||
process_crontab("root", NULL, tabname, &new_db, old_db);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
/* we used to keep this dir open all the time, for the sake of
|
||||
* efficiency. however, we need to close it in every fork, and
|
||||
* we fork a lot more often than the mtime of the dir changes.
|
||||
*/
|
||||
|
||||
if (!(dir = opendir(SPOOL_DIR))) {
|
||||
log_it("CRON", pid, "OPENDIR FAILED", SPOOL_DIR, errno);
|
||||
}
|
||||
else {
|
||||
|
||||
is_local = cluster_host_is_local();
|
||||
|
||||
while (is_local && NULL != (dp = readdir(dir))) {
|
||||
char fname[MAXNAMLEN + 1], tabname[MAXNAMLEN + 1];
|
||||
|
||||
if (not_a_crontab(dp))
|
||||
continue;
|
||||
|
||||
strncpy(fname, dp->d_name, MAXNAMLEN);
|
||||
|
||||
if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, fname, '/'))
|
||||
continue; /* XXX log? */
|
||||
|
||||
process_crontab(fname, fname, tabname, &new_db, old_db);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
/* if we don't do this, then when our children eventually call
|
||||
* getpwnam() in do_command.c's child_process to verify MAILTO=,
|
||||
* they will screw us up (and v-v).
|
||||
*/
|
||||
endpwent();
|
||||
|
||||
overwrite_database(old_db, &new_db);
|
||||
Debug(DLOAD, ("load_database is done\n"))
|
||||
return 1;
|
||||
}
|
||||
|
||||
void link_user(cron_db * db, user * u) {
|
||||
if (db->head == NULL)
|
||||
db->head = u;
|
||||
if (db->tail)
|
||||
db->tail->next = u;
|
||||
u->prev = db->tail;
|
||||
u->next = NULL;
|
||||
db->tail = u;
|
||||
}
|
||||
|
||||
void unlink_user(cron_db * db, user * u) {
|
||||
if (u->prev == NULL)
|
||||
db->head = u->next;
|
||||
else
|
||||
u->prev->next = u->next;
|
||||
|
||||
if (u->next == NULL)
|
||||
db->tail = u->prev;
|
||||
else
|
||||
u->next->prev = u->prev;
|
||||
}
|
||||
|
||||
user *find_user(cron_db * db, const char *name, const char *tabname) {
|
||||
user *u;
|
||||
|
||||
for (u = db->head; u != NULL; u = u->next)
|
||||
if ((strcmp(u->name, name) == 0)
|
||||
&& ((tabname == NULL)
|
||||
|| (strcmp(tabname, u->tabname) == 0)
|
||||
)
|
||||
)
|
||||
break;
|
||||
return (u);
|
||||
}
|
||||
|
||||
static int not_a_crontab(DIR_T * dp) {
|
||||
int len;
|
||||
|
||||
/* avoid file names beginning with ".". this is good
|
||||
* because we would otherwise waste two guaranteed calls
|
||||
* to getpwnam() for . and .., and there shouldn't be
|
||||
* hidden files in here anyway
|
||||
*/
|
||||
if (dp->d_name[0] == '.')
|
||||
return (1);
|
||||
|
||||
/* ignore files starting with # and ending with ~ */
|
||||
if (dp->d_name[0] == '#')
|
||||
return (1);
|
||||
|
||||
/* ignore CRON_HOSTNAME file (in case doesn't start with ".") */
|
||||
if (0 == strcmp(dp->d_name, CRON_HOSTNAME))
|
||||
return(1);
|
||||
|
||||
len = strlen(dp->d_name);
|
||||
|
||||
if (len >= MAXNAMLEN)
|
||||
return (1); /* XXX log? */
|
||||
|
||||
if ((len > 0) && (dp->d_name[len - 1] == '~'))
|
||||
return (1);
|
||||
|
||||
if ((len > 8) && (strncmp(dp->d_name + len - 8, ".rpmsave", 8) == 0))
|
||||
return (1);
|
||||
if ((len > 8) && (strncmp(dp->d_name + len - 8, ".rpmorig", 8) == 0))
|
||||
return (1);
|
||||
if ((len > 7) && (strncmp(dp->d_name + len - 7, ".rpmnew", 7) == 0))
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void max_mtime(char *dir_name, struct stat *max_st) {
|
||||
DIR *dir;
|
||||
DIR_T *dp;
|
||||
struct stat st;
|
||||
|
||||
if (!(dir = opendir(dir_name))) {
|
||||
max_st->st_mtime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
while (NULL != (dp = readdir(dir))) {
|
||||
char tabname[MAXNAMLEN + 1];
|
||||
|
||||
if ( not_a_crontab ( dp ) && strcmp(dp->d_name, CRON_HOSTNAME) != 0)
|
||||
continue;
|
||||
|
||||
if (!glue_strings(tabname, sizeof tabname, dir_name, dp->d_name, '/'))
|
||||
continue; /* XXX log? */
|
||||
|
||||
if (stat(tabname, &st) < OK)
|
||||
continue; /* XXX log? */
|
||||
|
||||
if (st.st_mtime > max_st->st_mtime)
|
||||
max_st->st_mtime = st.st_mtime;
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
571
cronie-1.4.6/src/do_command.c
Normal file
571
cronie-1.4.6/src/do_command.c
Normal file
|
@ -0,0 +1,571 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
static void child_process(entry *, user *);
|
||||
static int safe_p(const char *, const char *);
|
||||
|
||||
void do_command(entry * e, user * u) {
|
||||
pid_t pid = getpid();
|
||||
|
||||
Debug(DPROC, ("[%ld] do_command(%s, (%s,%ld,%ld))\n",
|
||||
(long) pid, e->cmd, u->name,
|
||||
(long) e->pwd->pw_uid, (long) e->pwd->pw_gid))
|
||||
|
||||
/* fork to become asynchronous -- parent process is done immediately,
|
||||
* and continues to run the normal cron code, which means return to
|
||||
* tick(). the child and grandchild don't leave this function, alive.
|
||||
*
|
||||
* vfork() is unsuitable, since we have much to do, and the parent
|
||||
* needs to be able to run off and fork other processes.
|
||||
*/
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
log_it("CRON", pid, "CAN'T FORK", "do_command", errno);
|
||||
break;
|
||||
case 0:
|
||||
/* child process */
|
||||
acquire_daemonlock(1);
|
||||
child_process(e, u);
|
||||
Debug(DPROC, ("[%ld] child process done, exiting\n", (long) getpid()))
|
||||
_exit(OK_EXIT);
|
||||
break;
|
||||
default:
|
||||
/* parent process */
|
||||
break;
|
||||
}
|
||||
Debug(DPROC, ("[%ld] main process returning to work\n", (long) pid))
|
||||
}
|
||||
|
||||
static void child_process(entry * e, user * u) {
|
||||
int stdin_pipe[2], stdout_pipe[2];
|
||||
char *input_data, *usernm, *mailto, *mailfrom;
|
||||
int children = 0;
|
||||
char **jobenv = 0L;
|
||||
pid_t pid = getpid();
|
||||
pid_t jobpid;
|
||||
|
||||
/* Set up the Red Hat security context for both mail/minder and job processes:
|
||||
*/
|
||||
if (cron_set_job_security_context(e, u, &jobenv) != 0) {
|
||||
//syslog(LOG_INFO, "CRON (%s) ERROR: cannot set security context", e->pwd->pw_name);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
Debug(DPROC, ("[%ld] child_process('%s')\n", (long) getpid(), e->cmd))
|
||||
#ifdef CAPITALIZE_FOR_PS
|
||||
/* mark ourselves as different to PS command watchers by upshifting
|
||||
* our program name. This has no effect on some kernels.
|
||||
*/
|
||||
/*local */ {
|
||||
char *pch;
|
||||
|
||||
for (pch = ProgramName; *pch; pch++)
|
||||
*pch = MkUpper(*pch);
|
||||
}
|
||||
#endif /* CAPITALIZE_FOR_PS */
|
||||
|
||||
/* discover some useful and important environment settings
|
||||
*/
|
||||
usernm = e->pwd->pw_name;
|
||||
mailto = env_get("MAILTO", jobenv);
|
||||
mailfrom = env_get("MAILFROM", e->envp);
|
||||
|
||||
/* our parent is watching for our death by catching SIGCHLD. we
|
||||
* do not care to watch for our children's deaths this way -- we
|
||||
* use wait() explicitly. so we have to reset the signal (which
|
||||
* was inherited from the parent).
|
||||
*/
|
||||
(void) signal(SIGCHLD, SIG_DFL);
|
||||
|
||||
/* create some pipes to talk to our future child
|
||||
*/
|
||||
if (pipe(stdin_pipe) == -1) { /* child's stdin */
|
||||
log_it("CRON", pid, "PIPE() FAILED", "stdin_pipe", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pipe(stdout_pipe) == -1) { /* child's stdout */
|
||||
log_it("CRON", pid, "PIPE() FAILED", "stdout_pipe", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
/* since we are a forked process, we can diddle the command string
|
||||
* we were passed -- nobody else is going to use it again, right?
|
||||
*
|
||||
* if a % is present in the command, previous characters are the
|
||||
* command, and subsequent characters are the additional input to
|
||||
* the command. An escaped % will have the escape character stripped
|
||||
* from it. Subsequent %'s will be transformed into newlines,
|
||||
* but that happens later.
|
||||
*/
|
||||
/*local */ {
|
||||
int escaped = FALSE;
|
||||
int ch;
|
||||
char *p;
|
||||
|
||||
for (input_data = p = e->cmd;
|
||||
(ch = *input_data) != '\0'; input_data++, p++) {
|
||||
if (p != input_data)
|
||||
*p = ch;
|
||||
if (escaped) {
|
||||
if (ch == '%')
|
||||
*--p = ch;
|
||||
escaped = FALSE;
|
||||
continue;
|
||||
}
|
||||
if (ch == '\\') {
|
||||
escaped = TRUE;
|
||||
continue;
|
||||
}
|
||||
if (ch == '%') {
|
||||
*input_data++ = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
|
||||
/* fork again, this time so we can exec the user's command.
|
||||
*/
|
||||
switch ((jobpid = fork())) {
|
||||
case -1:
|
||||
log_it("CRON", pid, "CAN'T FORK", "child_process", errno);
|
||||
cron_close_pam();
|
||||
exit(ERROR_EXIT);
|
||||
/*NOTREACHED*/ case 0:
|
||||
Debug(DPROC, ("[%ld] grandchild process fork()'ed\n", (long) getpid()))
|
||||
|
||||
if (cron_change_user_permanently(e->pwd, env_get("HOME", jobenv)) < 0)
|
||||
_exit(ERROR_EXIT);
|
||||
|
||||
/* write a log message. we've waited this long to do it
|
||||
* because it was not until now that we knew the PID that
|
||||
* the actual user command shell was going to get and the
|
||||
* PID is part of the log message.
|
||||
*/
|
||||
if ((e->flags & DONT_LOG) == 0) {
|
||||
char *x = mkprints((u_char *) e->cmd, strlen(e->cmd));
|
||||
|
||||
log_it(usernm, getpid(), "CMD", x, 0);
|
||||
free(x);
|
||||
}
|
||||
|
||||
/* that's the last thing we'll log. close the log files.
|
||||
*/
|
||||
log_close();
|
||||
|
||||
/* get new pgrp, void tty, etc.
|
||||
*/
|
||||
(void) setsid();
|
||||
|
||||
/* close the pipe ends that we won't use. this doesn't affect
|
||||
* the parent, who has to read and write them; it keeps the
|
||||
* kernel from recording us as a potential client TWICE --
|
||||
* which would keep it from sending SIGPIPE in otherwise
|
||||
* appropriate circumstances.
|
||||
*/
|
||||
close(stdin_pipe[WRITE_PIPE]);
|
||||
close(stdout_pipe[READ_PIPE]);
|
||||
|
||||
/* grandchild process. make std{in,out} be the ends of
|
||||
* pipes opened by our daddy; make stderr go to stdout.
|
||||
*/
|
||||
if (stdin_pipe[READ_PIPE] != STDIN) {
|
||||
dup2(stdin_pipe[READ_PIPE], STDIN);
|
||||
close(stdin_pipe[READ_PIPE]);
|
||||
}
|
||||
if (stdout_pipe[WRITE_PIPE] != STDOUT) {
|
||||
dup2(stdout_pipe[WRITE_PIPE], STDOUT);
|
||||
close(stdout_pipe[WRITE_PIPE]);
|
||||
}
|
||||
dup2(STDOUT, STDERR);
|
||||
|
||||
/* Our grandparent is watching for our parent's death by
|
||||
* catching SIGCHLD. Meanwhile, our parent will use wait
|
||||
* explicitly and so has disabled SIGCHLD. So now it's
|
||||
* time to reset SIGCHLD handling.
|
||||
*/
|
||||
(void) signal(SIGCHLD, SIG_DFL);
|
||||
|
||||
|
||||
/*
|
||||
* Exec the command.
|
||||
*/
|
||||
{
|
||||
char *shell = env_get("SHELL", jobenv);
|
||||
|
||||
#if DEBUGGING
|
||||
if (DebugFlags & DTEST) {
|
||||
fprintf(stderr, "debug DTEST is on, not exec'ing command.\n");
|
||||
fprintf(stderr, "\tcmd='%s' shell='%s'\n", e->cmd, shell);
|
||||
_exit(OK_EXIT);
|
||||
}
|
||||
#endif /*DEBUGGING*/
|
||||
execle(shell, shell, "-c", e->cmd, (char *) 0, jobenv);
|
||||
fprintf(stderr, "execl: couldn't exec `%s'\n", shell);
|
||||
perror("execl");
|
||||
_exit(ERROR_EXIT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cron_restore_default_security_context();
|
||||
/* parent process */
|
||||
break;
|
||||
}
|
||||
|
||||
children++;
|
||||
|
||||
/* middle process, child of original cron, parent of process running
|
||||
* the user's command.
|
||||
*/
|
||||
|
||||
Debug(DPROC, ("[%ld] child continues, closing pipes\n", (long) getpid()))
|
||||
|
||||
/* close the ends of the pipe that will only be referenced in the
|
||||
* grandchild process...
|
||||
*/
|
||||
close(stdin_pipe[READ_PIPE]);
|
||||
close(stdout_pipe[WRITE_PIPE]);
|
||||
|
||||
/*
|
||||
* write, to the pipe connected to child's stdin, any input specified
|
||||
* after a % in the crontab entry. while we copy, convert any
|
||||
* additional %'s to newlines. when done, if some characters were
|
||||
* written and the last one wasn't a newline, write a newline.
|
||||
*
|
||||
* Note that if the input data won't fit into one pipe buffer (2K
|
||||
* or 4K on most BSD systems), and the child doesn't read its stdin,
|
||||
* we would block here. thus we must fork again.
|
||||
*/
|
||||
|
||||
if (*input_data && fork() == 0) {
|
||||
FILE *out = fdopen(stdin_pipe[WRITE_PIPE], "w");
|
||||
int need_newline = FALSE;
|
||||
int escaped = FALSE;
|
||||
int ch;
|
||||
|
||||
Debug(DPROC, ("[%ld] child2 sending data to grandchild\n",
|
||||
(long) getpid()))
|
||||
|
||||
/* close the pipe we don't use, since we inherited it and
|
||||
* are part of its reference count now.
|
||||
*/
|
||||
close(stdout_pipe[READ_PIPE]);
|
||||
if (cron_change_user_permanently(e->pwd, env_get("HOME", jobenv)) < 0)
|
||||
_exit(ERROR_EXIT);
|
||||
/* translation:
|
||||
* \% -> %
|
||||
* % -> \n
|
||||
* \x -> \x for all x != %
|
||||
*/
|
||||
while ((ch = *input_data++) != '\0') {
|
||||
if (escaped) {
|
||||
if (ch != '%')
|
||||
putc('\\', out);
|
||||
}
|
||||
else {
|
||||
if (ch == '%')
|
||||
ch = '\n';
|
||||
}
|
||||
|
||||
if (!(escaped = (ch == '\\'))) {
|
||||
putc(ch, out);
|
||||
need_newline = (ch != '\n');
|
||||
}
|
||||
}
|
||||
if (escaped)
|
||||
putc('\\', out);
|
||||
if (need_newline)
|
||||
putc('\n', out);
|
||||
|
||||
/* close the pipe, causing an EOF condition. fclose causes
|
||||
* stdin_pipe[WRITE_PIPE] to be closed, too.
|
||||
*/
|
||||
fclose(out);
|
||||
|
||||
Debug(DPROC, ("[%ld] child2 done sending to grandchild\n",
|
||||
(long) getpid()))
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* close the pipe to the grandkiddie's stdin, since its wicked uncle
|
||||
* ernie back there has it open and will close it when he's done.
|
||||
*/
|
||||
close(stdin_pipe[WRITE_PIPE]);
|
||||
|
||||
children++;
|
||||
|
||||
/*
|
||||
* read output from the grandchild. it's stderr has been redirected to
|
||||
* it's stdout, which has been redirected to our pipe. if there is any
|
||||
* output, we'll be mailing it to the user whose crontab this is...
|
||||
* when the grandchild exits, we'll get EOF.
|
||||
*/
|
||||
|
||||
Debug(DPROC, ("[%ld] child reading output from grandchild\n",
|
||||
(long) getpid()))
|
||||
|
||||
/*local */ {
|
||||
FILE *in = fdopen(stdout_pipe[READ_PIPE], "r");
|
||||
int ch = getc(in);
|
||||
|
||||
if (ch != EOF) {
|
||||
FILE *mail = NULL;
|
||||
int bytes = 1;
|
||||
int status = 0;
|
||||
#if defined(SYSLOG)
|
||||
char jobtag[64], logbuf[1024];
|
||||
int bufidx = 0;
|
||||
/* according to the NOTES section of openlog(3), jobtag will be
|
||||
* used (implicitly) by future calls to syslog(). That's why it
|
||||
* was defined outside of the if block here. */
|
||||
if (SyslogOutput) {
|
||||
snprintf(jobtag, sizeof(jobtag), "CROND[%d]", jobpid);
|
||||
openlog(jobtag, 0, LOG_CRON);
|
||||
if (ch != '\n')
|
||||
logbuf[bufidx++] = ch;
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug(DPROC | DEXT,
|
||||
("[%ld] got data (%x:%c) from grandchild\n",
|
||||
(long) getpid(), ch, ch))
|
||||
|
||||
/* get name of recipient. this is MAILTO if set to a
|
||||
* valid local username; USER otherwise.
|
||||
*/
|
||||
if (mailto) {
|
||||
/* MAILTO was present in the environment
|
||||
*/
|
||||
if (!*mailto) {
|
||||
/* ... but it's empty. set to NULL
|
||||
*/
|
||||
mailto = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* MAILTO not present, set to USER.
|
||||
*/
|
||||
mailto = usernm;
|
||||
}
|
||||
|
||||
/* get sender address. this is MAILFROM if set (and safe),
|
||||
* root otherwise.
|
||||
*/
|
||||
if (!mailfrom || !*mailfrom || !safe_p(usernm, mailfrom)) {
|
||||
mailfrom = calloc(5, sizeof (char));
|
||||
strcpy(mailfrom, "root");
|
||||
}
|
||||
|
||||
/* if we are supposed to be mailing, MAILTO will
|
||||
* be non-NULL. only in this case should we set
|
||||
* up the mail command and subjects and stuff...
|
||||
*/
|
||||
|
||||
/* Also skip it if MailCmd is set to "off" */
|
||||
if (mailto && safe_p(usernm, mailto)
|
||||
&& strncmp(MailCmd,"off",4)) {
|
||||
char **env;
|
||||
char mailcmd[MAX_COMMAND];
|
||||
char hostname[MAXHOSTNAMELEN];
|
||||
char *content_type = env_get("CONTENT_TYPE", jobenv),
|
||||
*content_transfer_encoding =
|
||||
env_get("CONTENT_TRANSFER_ENCODING", jobenv);
|
||||
|
||||
gethostname(hostname, MAXHOSTNAMELEN);
|
||||
|
||||
if (MailCmd[0] == '\0') {
|
||||
if (strlens(MAILFMT, MAILARG, mailfrom, NULL) + 1
|
||||
>= sizeof mailcmd) {
|
||||
fprintf(stderr, "mailcmd too long\n");
|
||||
(void) _exit(ERROR_EXIT);
|
||||
}
|
||||
(void) sprintf(mailcmd, MAILFMT, MAILARG, mailfrom);
|
||||
}
|
||||
else {
|
||||
strncpy(mailcmd, MailCmd, MAX_COMMAND);
|
||||
}
|
||||
if (!(mail = cron_popen(mailcmd, "w", e->pwd))) {
|
||||
perror(mailcmd);
|
||||
(void) _exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
fprintf(mail, "From: %s (Cron Daemon)\n", mailfrom);
|
||||
fprintf(mail, "To: %s\n", mailto);
|
||||
fprintf(mail, "Subject: Cron <%s@%s> %s\n",
|
||||
usernm, first_word(hostname, "."), e->cmd);
|
||||
|
||||
#ifdef MAIL_DATE
|
||||
fprintf(mail, "Date: %s\n", arpadate(&StartTime));
|
||||
#endif /*MAIL_DATE */
|
||||
if (content_type == 0L) {
|
||||
fprintf(mail, "Content-Type: text/plain; charset=%s\n",
|
||||
cron_default_mail_charset);
|
||||
}
|
||||
else { /* user specified Content-Type header.
|
||||
* disallow new-lines for security reasons
|
||||
* (else users could specify arbitrary mail headers!)
|
||||
*/
|
||||
char *nl = content_type;
|
||||
size_t ctlen = strlen(content_type);
|
||||
while ((*nl != '\0')
|
||||
&& ((nl = strchr(nl, '\n')) != 0L)
|
||||
&& (nl < (content_type + ctlen))
|
||||
)
|
||||
*nl = ' ';
|
||||
fprintf(mail, "Content-Type: %s\n", content_type);
|
||||
}
|
||||
if (content_transfer_encoding != 0L) {
|
||||
char *nl = content_transfer_encoding;
|
||||
size_t ctlen = strlen(content_transfer_encoding);
|
||||
while ((*nl != '\0')
|
||||
&& ((nl = strchr(nl, '\n')) != 0L)
|
||||
&& (nl < (content_transfer_encoding + ctlen))
|
||||
)
|
||||
*nl = ' ';
|
||||
fprintf(mail, "Content-Transfer-Encoding: %s\n",
|
||||
content_transfer_encoding);
|
||||
}
|
||||
|
||||
/* The Auto-Submitted header is
|
||||
* defined (and suggested by) RFC3834.
|
||||
*/
|
||||
fprintf(mail, "Auto-Submitted: auto-generated\n");
|
||||
|
||||
for (env = jobenv; *env; env++)
|
||||
fprintf(mail, "X-Cron-Env: <%s>\n", *env);
|
||||
fprintf(mail, "\n");
|
||||
|
||||
/* this was the first char from the pipe
|
||||
*/
|
||||
putc(ch, mail);
|
||||
}
|
||||
|
||||
/* we have to read the input pipe no matter whether
|
||||
* we mail or not, but obviously we only write to
|
||||
* mail pipe if we ARE mailing.
|
||||
*/
|
||||
|
||||
while (EOF != (ch = getc(in))) {
|
||||
bytes++;
|
||||
if (mail)
|
||||
putc(ch, mail);
|
||||
}
|
||||
#if defined(SYSLOG)
|
||||
if (SyslogOutput) {
|
||||
logbuf[bufidx++] = ch;
|
||||
if ((ch == '\n') || (bufidx == sizeof(logbuf)-1)) {
|
||||
if (ch == '\n')
|
||||
logbuf[bufidx-1] = '\0';
|
||||
else
|
||||
logbuf[bufidx] = '\0';
|
||||
syslog(LOG_INFO, "%s", logbuf);
|
||||
bufidx = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* only close pipe if we opened it -- i.e., we're
|
||||
* mailing...
|
||||
*/
|
||||
|
||||
if (mail) {
|
||||
Debug(DPROC, ("[%ld] closing pipe to mail\n", (long) getpid()))
|
||||
/* Note: the pclose will probably see
|
||||
* the termination of the grandchild
|
||||
* in addition to the mail process, since
|
||||
* it (the grandchild) is likely to exit
|
||||
* after closing its stdout.
|
||||
*/
|
||||
status = cron_pclose(mail);
|
||||
}
|
||||
#if defined(SYSLOG)
|
||||
if (SyslogOutput) {
|
||||
if (bufidx) {
|
||||
logbuf[bufidx] = '\0';
|
||||
syslog(LOG_INFO, "%s", logbuf);
|
||||
}
|
||||
closelog();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* if there was output and we could not mail it,
|
||||
* log the facts so the poor user can figure out
|
||||
* what's going on.
|
||||
*/
|
||||
if (mail && status) {
|
||||
char buf[MAX_TEMPSTR];
|
||||
|
||||
sprintf(buf,
|
||||
"mailed %d byte%s of output but got status 0x%04x\n",
|
||||
bytes, (bytes == 1) ? "" : "s", status);
|
||||
log_it(usernm, getpid(), "MAIL", buf, 0);
|
||||
}
|
||||
|
||||
} /*if data from grandchild */
|
||||
|
||||
Debug(DPROC, ("[%ld] got EOF from grandchild\n", (long) getpid()))
|
||||
|
||||
fclose(in); /* also closes stdout_pipe[READ_PIPE] */
|
||||
}
|
||||
|
||||
/* wait for children to die.
|
||||
*/
|
||||
for (; children > 0; children--) {
|
||||
WAIT_T waiter;
|
||||
PID_T pid;
|
||||
|
||||
Debug(DPROC, ("[%ld] waiting for grandchild #%d to finish\n",
|
||||
(long) getpid(), children))
|
||||
while ((pid = wait(&waiter)) < OK && errno == EINTR) ;
|
||||
if (pid < OK) {
|
||||
Debug(DPROC,
|
||||
("[%ld] no more grandchildren--mail written?\n",
|
||||
(long) getpid()))
|
||||
break;
|
||||
}
|
||||
Debug(DPROC, ("[%ld] grandchild #%ld finished, status=%04x",
|
||||
(long) getpid(), (long) pid, WEXITSTATUS(waiter)))
|
||||
if (WIFSIGNALED(waiter) && WCOREDUMP(waiter))
|
||||
Debug(DPROC, (", dumped core"))
|
||||
Debug(DPROC, ("\n"))
|
||||
}
|
||||
cron_close_pam();
|
||||
env_free(jobenv);
|
||||
}
|
||||
|
||||
static int safe_p(const char *usernm, const char *s) {
|
||||
static const char safe_delim[] = "@!:%-.,_+"; /* conservative! */
|
||||
const char *t;
|
||||
int ch, first;
|
||||
|
||||
for (t = s, first = 1; (ch = *t++) != '\0'; first = 0) {
|
||||
if (isascii(ch) && isprint(ch) &&
|
||||
(isalnum(ch) || (!first && strchr(safe_delim, ch))))
|
||||
continue;
|
||||
log_it(usernm, getpid(), "UNSAFE", s, 0);
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
580
cronie-1.4.6/src/entry.c
Normal file
580
cronie-1.4.6/src/entry.c
Normal file
|
@ -0,0 +1,580 @@
|
|||
/*
|
||||
* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* vix 26jan87 [RCS'd; rest of log is in RCS file]
|
||||
* vix 01jan87 [added line-level error recovery]
|
||||
* vix 31dec86 [added /step to the from-to range, per bob@acornrc]
|
||||
* vix 30dec86 [written]
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
typedef enum ecode {
|
||||
e_none, e_minute, e_hour, e_dom, e_month, e_dow,
|
||||
e_cmd, e_timespec, e_username, e_option, e_memory
|
||||
} ecode_e;
|
||||
|
||||
static const char *ecodes[] = {
|
||||
"no error",
|
||||
"bad minute",
|
||||
"bad hour",
|
||||
"bad day-of-month",
|
||||
"bad month",
|
||||
"bad day-of-week",
|
||||
"bad command",
|
||||
"bad time specifier",
|
||||
"bad username",
|
||||
"bad option",
|
||||
"out of memory"
|
||||
};
|
||||
|
||||
static int get_list(bitstr_t *, int, int, const char *[], int, FILE *),
|
||||
get_range(bitstr_t *, int, int, const char *[], int, FILE *),
|
||||
get_number(int *, int, const char *[], int, FILE *, const char *),
|
||||
set_element(bitstr_t *, int, int, int);
|
||||
|
||||
void free_entry(entry * e) {
|
||||
free(e->cmd);
|
||||
free(e->pwd);
|
||||
env_free(e->envp);
|
||||
free(e);
|
||||
}
|
||||
|
||||
/* return NULL if eof or syntax error occurs;
|
||||
* otherwise return a pointer to a new entry.
|
||||
*/
|
||||
entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
|
||||
char **envp) {
|
||||
/* this function reads one crontab entry -- the next -- from a file.
|
||||
* it skips any leading blank lines, ignores comments, and returns
|
||||
* NULL if for any reason the entry can't be read and parsed.
|
||||
*
|
||||
* the entry is also parsed here.
|
||||
*
|
||||
* syntax:
|
||||
* user crontab:
|
||||
* minutes hours doms months dows cmd\n
|
||||
* system crontab (/etc/crontab):
|
||||
* minutes hours doms months dows USERNAME cmd\n
|
||||
*/
|
||||
|
||||
ecode_e ecode = e_none;
|
||||
entry *e;
|
||||
int ch;
|
||||
char cmd[MAX_COMMAND];
|
||||
char envstr[MAX_ENVSTR];
|
||||
char **tenvp;
|
||||
|
||||
Debug(DPARS, ("load_entry()...about to eat comments\n"))
|
||||
|
||||
skip_comments(file);
|
||||
|
||||
ch = get_char(file);
|
||||
if (ch == EOF)
|
||||
return (NULL);
|
||||
|
||||
/* ch is now the first useful character of a useful line.
|
||||
* it may be an @special or it may be the first character
|
||||
* of a list of minutes.
|
||||
*/
|
||||
|
||||
e = (entry *) calloc(sizeof (entry), sizeof (char));
|
||||
|
||||
/* check for '-' as a first character, this option will disable
|
||||
* writing a syslog message about command getting executed
|
||||
*/
|
||||
if (ch == '-') {
|
||||
/* if we are editing system crontab or user uid is 0 (root)
|
||||
* we are allowed to disable logging
|
||||
*/
|
||||
if (pw == NULL || pw->pw_uid == 0)
|
||||
e->flags |= DONT_LOG;
|
||||
else {
|
||||
log_it("CRON", getpid(), "ERROR", "Only privileged user can disable logging", 0);
|
||||
ecode = e_option;
|
||||
goto eof;
|
||||
}
|
||||
ch = get_char(file);
|
||||
if (ch == EOF)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ch == '@') {
|
||||
/* all of these should be flagged and load-limited; i.e.,
|
||||
* instead of @hourly meaning "0 * * * *" it should mean
|
||||
* "close to the front of every hour but not 'til the
|
||||
* system load is low". Problems are: how do you know
|
||||
* what "low" means? (save me from /etc/cron.conf!) and:
|
||||
* how to guarantee low variance (how low is low?), which
|
||||
* means how to we run roughly every hour -- seems like
|
||||
* we need to keep a history or let the first hour set
|
||||
* the schedule, which means we aren't load-limited
|
||||
* anymore. too much for my overloaded brain. (vix, jan90)
|
||||
* HINT
|
||||
*/
|
||||
ch = get_string(cmd, MAX_COMMAND, file, " \t\n");
|
||||
if (!strcmp("reboot", cmd)) {
|
||||
e->flags |= WHEN_REBOOT;
|
||||
}
|
||||
else if (!strcmp("yearly", cmd) || !strcmp("annually", cmd)) {
|
||||
bit_set(e->minute, 0);
|
||||
bit_set(e->hour, 0);
|
||||
bit_set(e->dom, 0);
|
||||
bit_set(e->month, 0);
|
||||
bit_nset(e->dow, 0, (LAST_DOW - FIRST_DOW + 1));
|
||||
e->flags |= DOW_STAR;
|
||||
}
|
||||
else if (!strcmp("monthly", cmd)) {
|
||||
bit_set(e->minute, 0);
|
||||
bit_set(e->hour, 0);
|
||||
bit_set(e->dom, 0);
|
||||
bit_nset(e->month, 0, (LAST_MONTH - FIRST_MONTH + 1));
|
||||
bit_nset(e->dow, 0, (LAST_DOW - FIRST_DOW + 1));
|
||||
e->flags |= DOW_STAR;
|
||||
}
|
||||
else if (!strcmp("weekly", cmd)) {
|
||||
bit_set(e->minute, 0);
|
||||
bit_set(e->hour, 0);
|
||||
bit_nset(e->dom, 0, (LAST_DOM - FIRST_DOM + 1));
|
||||
bit_nset(e->month, 0, (LAST_MONTH - FIRST_MONTH + 1));
|
||||
bit_set(e->dow, 0);
|
||||
e->flags |= DOW_STAR;
|
||||
}
|
||||
else if (!strcmp("daily", cmd) || !strcmp("midnight", cmd)) {
|
||||
bit_set(e->minute, 0);
|
||||
bit_set(e->hour, 0);
|
||||
bit_nset(e->dom, 0, (LAST_DOM - FIRST_DOM + 1));
|
||||
bit_nset(e->month, 0, (LAST_MONTH - FIRST_MONTH + 1));
|
||||
bit_nset(e->dow, 0, (LAST_DOW - FIRST_DOW + 1));
|
||||
}
|
||||
else if (!strcmp("hourly", cmd)) {
|
||||
bit_set(e->minute, 0);
|
||||
bit_nset(e->hour, 0, (LAST_HOUR - FIRST_HOUR + 1));
|
||||
bit_nset(e->dom, 0, (LAST_DOM - FIRST_DOM + 1));
|
||||
bit_nset(e->month, 0, (LAST_MONTH - FIRST_MONTH + 1));
|
||||
bit_nset(e->dow, 0, (LAST_DOW - FIRST_DOW + 1));
|
||||
e->flags |= HR_STAR;
|
||||
}
|
||||
else {
|
||||
ecode = e_timespec;
|
||||
goto eof;
|
||||
}
|
||||
/* Advance past whitespace between shortcut and
|
||||
* username/command.
|
||||
*/
|
||||
Skip_Blanks(ch, file);
|
||||
if (ch == EOF || ch == '\n') {
|
||||
ecode = e_cmd;
|
||||
goto eof;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug(DPARS, ("load_entry()...about to parse numerics\n"))
|
||||
|
||||
if (ch == '*')
|
||||
e->flags |= MIN_STAR;
|
||||
ch = get_list(e->minute, FIRST_MINUTE, LAST_MINUTE, PPC_NULL, ch, file);
|
||||
if (ch == EOF) {
|
||||
ecode = e_minute;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* hours
|
||||
*/
|
||||
|
||||
if (ch == '*')
|
||||
e->flags |= HR_STAR;
|
||||
ch = get_list(e->hour, FIRST_HOUR, LAST_HOUR, PPC_NULL, ch, file);
|
||||
if (ch == EOF) {
|
||||
ecode = e_hour;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* DOM (days of month)
|
||||
*/
|
||||
|
||||
if (ch == '*')
|
||||
e->flags |= DOM_STAR;
|
||||
ch = get_list(e->dom, FIRST_DOM, LAST_DOM, PPC_NULL, ch, file);
|
||||
if (ch == EOF) {
|
||||
ecode = e_dom;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* month
|
||||
*/
|
||||
|
||||
ch = get_list(e->month, FIRST_MONTH, LAST_MONTH, MonthNames, ch, file);
|
||||
if (ch == EOF) {
|
||||
ecode = e_month;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* DOW (days of week)
|
||||
*/
|
||||
|
||||
if (ch == '*')
|
||||
e->flags |= DOW_STAR;
|
||||
ch = get_list(e->dow, FIRST_DOW, LAST_DOW, DowNames, ch, file);
|
||||
if (ch == EOF) {
|
||||
ecode = e_dow;
|
||||
goto eof;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sundays equivalent */
|
||||
if (bit_test(e->dow, 0) || bit_test(e->dow, 7)) {
|
||||
bit_set(e->dow, 0);
|
||||
bit_set(e->dow, 7);
|
||||
}
|
||||
|
||||
/* check for permature EOL and catch a common typo */
|
||||
if (ch == '\n' || ch == '*') {
|
||||
ecode = e_cmd;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* ch is the first character of a command, or a username */
|
||||
unget_char(ch, file);
|
||||
|
||||
if (!pw) {
|
||||
char *username = cmd; /* temp buffer */
|
||||
|
||||
Debug(DPARS, ("load_entry()...about to parse username\n"))
|
||||
ch = get_string(username, MAX_COMMAND, file, " \t\n");
|
||||
|
||||
Debug(DPARS, ("load_entry()...got %s\n", username))
|
||||
if (ch == EOF || ch == '\n' || ch == '*') {
|
||||
ecode = e_cmd;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
pw = getpwnam(username);
|
||||
if (pw == NULL) {
|
||||
ecode = e_username;
|
||||
goto eof;
|
||||
}
|
||||
Debug(DPARS, ("load_entry()...uid %ld, gid %ld\n",
|
||||
(long) pw->pw_uid, (long) pw->pw_gid))
|
||||
}
|
||||
|
||||
if ((e->pwd = pw_dup(pw)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
bzero(e->pwd->pw_passwd, strlen(e->pwd->pw_passwd));
|
||||
|
||||
/* copy and fix up environment. some variables are just defaults and
|
||||
* others are overrides.
|
||||
*/
|
||||
if ((e->envp = env_copy(envp)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
if (!env_get("SHELL", e->envp)) {
|
||||
if (glue_strings(envstr, sizeof envstr, "SHELL", _PATH_BSHELL, '=')) {
|
||||
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
e->envp = tenvp;
|
||||
}
|
||||
else
|
||||
log_it("CRON", getpid(), "ERROR", "can't set SHELL", 0);
|
||||
}
|
||||
if (!env_get("HOME", e->envp)) {
|
||||
if (glue_strings(envstr, sizeof envstr, "HOME", pw->pw_dir, '=')) {
|
||||
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
e->envp = tenvp;
|
||||
}
|
||||
else
|
||||
log_it("CRON", getpid(), "ERROR", "can't set HOME", 0);
|
||||
}
|
||||
#ifndef LOGIN_CAP
|
||||
/* If login.conf is in used we will get the default PATH later. */
|
||||
if (!env_get("PATH", e->envp)) {
|
||||
if (glue_strings(envstr, sizeof envstr, "PATH", _PATH_DEFPATH, '=')) {
|
||||
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
e->envp = tenvp;
|
||||
}
|
||||
else
|
||||
log_it("CRON", getpid(), "ERROR", "can't set PATH", 0);
|
||||
}
|
||||
#endif /* LOGIN_CAP */
|
||||
if (glue_strings(envstr, sizeof envstr, "LOGNAME", pw->pw_name, '=')) {
|
||||
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
e->envp = tenvp;
|
||||
}
|
||||
else
|
||||
log_it("CRON", getpid(), "ERROR", "can't set LOGNAME", 0);
|
||||
#if defined(BSD) || defined(__linux)
|
||||
if (glue_strings(envstr, sizeof envstr, "USER", pw->pw_name, '=')) {
|
||||
if ((tenvp = env_set(e->envp, envstr)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
e->envp = tenvp;
|
||||
}
|
||||
else
|
||||
log_it("CRON", getpid(), "ERROR", "can't set USER", 0);
|
||||
#endif
|
||||
|
||||
Debug(DPARS, ("load_entry()...about to parse command\n"))
|
||||
|
||||
/* Everything up to the next \n or EOF is part of the command...
|
||||
* too bad we don't know in advance how long it will be, since we
|
||||
* need to malloc a string for it... so, we limit it to MAX_COMMAND.
|
||||
*/
|
||||
ch = get_string(cmd, MAX_COMMAND, file, "\n");
|
||||
|
||||
/* a file without a \n before the EOF is rude, so we'll complain...
|
||||
*/
|
||||
if (ch == EOF) {
|
||||
ecode = e_cmd;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
/* got the command in the 'cmd' string; save it in *e.
|
||||
*/
|
||||
if ((e->cmd = strdup(cmd)) == NULL) {
|
||||
ecode = e_memory;
|
||||
goto eof;
|
||||
}
|
||||
|
||||
Debug(DPARS, ("load_entry()...returning successfully\n"))
|
||||
|
||||
/* success, fini, return pointer to the entry we just created...
|
||||
*/
|
||||
return (e);
|
||||
|
||||
eof:
|
||||
if (e->envp)
|
||||
env_free(e->envp);
|
||||
if (e->pwd)
|
||||
free(e->pwd);
|
||||
if (e->cmd)
|
||||
free(e->cmd);
|
||||
free(e);
|
||||
while (ch != '\n' && !feof(file))
|
||||
ch = get_char(file);
|
||||
if (ecode != e_none && error_func)
|
||||
(*error_func) (ecodes[(int) ecode]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
get_list(bitstr_t * bits, int low, int high, const char *names[],
|
||||
int ch, FILE * file) {
|
||||
int done;
|
||||
|
||||
/* we know that we point to a non-blank character here;
|
||||
* must do a Skip_Blanks before we exit, so that the
|
||||
* next call (or the code that picks up the cmd) can
|
||||
* assume the same thing.
|
||||
*/
|
||||
|
||||
Debug(DPARS | DEXT, ("get_list()...entered\n"))
|
||||
|
||||
/* list = range {"," range}
|
||||
*/
|
||||
/* clear the bit string, since the default is 'off'.
|
||||
*/
|
||||
bit_nclear(bits, 0, (high - low + 1));
|
||||
|
||||
/* process all ranges
|
||||
*/
|
||||
done = FALSE;
|
||||
while (!done) {
|
||||
if (EOF == (ch = get_range(bits, low, high, names, ch, file)))
|
||||
return (EOF);
|
||||
if (ch == ',')
|
||||
ch = get_char(file);
|
||||
else
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
/* exiting. skip to some blanks, then skip over the blanks.
|
||||
*/
|
||||
Skip_Nonblanks(ch, file)
|
||||
Skip_Blanks(ch, file)
|
||||
|
||||
Debug(DPARS | DEXT, ("get_list()...exiting w/ %02x\n", ch))
|
||||
|
||||
return (ch);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_range(bitstr_t * bits, int low, int high, const char *names[],
|
||||
int ch, FILE * file) {
|
||||
/* range = number | number "-" number [ "/" number ]
|
||||
*/
|
||||
|
||||
int i, num1, num2, num3;
|
||||
|
||||
Debug(DPARS | DEXT, ("get_range()...entering, exit won't show\n"))
|
||||
|
||||
if (ch == '*') {
|
||||
/* '*' means "first-last" but can still be modified by /step
|
||||
*/
|
||||
num1 = low;
|
||||
num2 = high;
|
||||
ch = get_char(file);
|
||||
if (ch == EOF)
|
||||
return (EOF);
|
||||
}
|
||||
else {
|
||||
ch = get_number(&num1, low, names, ch, file, ",- \t\n");
|
||||
if (ch == EOF)
|
||||
return (EOF);
|
||||
|
||||
if (ch != '-') {
|
||||
/* not a range, it's a single number.
|
||||
*/
|
||||
if (EOF == set_element(bits, low, high, num1)) {
|
||||
unget_char(ch, file);
|
||||
return (EOF);
|
||||
}
|
||||
return (ch);
|
||||
}
|
||||
else {
|
||||
/* eat the dash
|
||||
*/
|
||||
ch = get_char(file);
|
||||
if (ch == EOF)
|
||||
return (EOF);
|
||||
|
||||
/* get the number following the dash
|
||||
*/
|
||||
ch = get_number(&num2, low, names, ch, file, "/, \t\n");
|
||||
if (ch == EOF || num1 > num2)
|
||||
return (EOF);
|
||||
}
|
||||
}
|
||||
|
||||
/* check for step size
|
||||
*/
|
||||
if (ch == '/') {
|
||||
/* eat the slash
|
||||
*/
|
||||
ch = get_char(file);
|
||||
if (ch == EOF)
|
||||
return (EOF);
|
||||
|
||||
/* get the step size -- note: we don't pass the
|
||||
* names here, because the number is not an
|
||||
* element id, it's a step size. 'low' is
|
||||
* sent as a 0 since there is no offset either.
|
||||
*/
|
||||
ch = get_number(&num3, 0, PPC_NULL, ch, file, ", \t\n");
|
||||
if (ch == EOF || num3 == 0)
|
||||
return (EOF);
|
||||
}
|
||||
else {
|
||||
/* no step. default==1.
|
||||
*/
|
||||
num3 = 1;
|
||||
}
|
||||
|
||||
/* range. set all elements from num1 to num2, stepping
|
||||
* by num3. (the step is a downward-compatible extension
|
||||
* proposed conceptually by bob@acornrc, syntactically
|
||||
* designed then implemented by paul vixie).
|
||||
*/
|
||||
for (i = num1; i <= num2; i += num3)
|
||||
if (EOF == set_element(bits, low, high, i)) {
|
||||
unget_char(ch, file);
|
||||
return (EOF);
|
||||
}
|
||||
|
||||
return (ch);
|
||||
}
|
||||
|
||||
static int
|
||||
get_number(int *numptr, int low, const char *names[], int ch, FILE * file,
|
||||
const char *terms) {
|
||||
char temp[MAX_TEMPSTR], *pc;
|
||||
int len, i;
|
||||
|
||||
pc = temp;
|
||||
len = 0;
|
||||
|
||||
/* first look for a number */
|
||||
while (isdigit((unsigned char) ch)) {
|
||||
if (++len >= MAX_TEMPSTR)
|
||||
goto bad;
|
||||
*pc++ = ch;
|
||||
ch = get_char(file);
|
||||
}
|
||||
*pc = '\0';
|
||||
if (len != 0) {
|
||||
/* got a number, check for valid terminator */
|
||||
if (!strchr(terms, ch))
|
||||
goto bad;
|
||||
*numptr = atoi(temp);
|
||||
return (ch);
|
||||
}
|
||||
|
||||
/* no numbers, look for a string if we have any */
|
||||
if (names) {
|
||||
while (isalpha((unsigned char) ch)) {
|
||||
if (++len >= MAX_TEMPSTR)
|
||||
goto bad;
|
||||
*pc++ = ch;
|
||||
ch = get_char(file);
|
||||
}
|
||||
*pc = '\0';
|
||||
if (len != 0 && strchr(terms, ch)) {
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
Debug(DPARS | DEXT,
|
||||
("get_num, compare(%s,%s)\n", names[i], temp))
|
||||
if (!strcasecmp(names[i], temp)) {
|
||||
*numptr = i + low;
|
||||
return (ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bad:
|
||||
unget_char(ch, file);
|
||||
return (EOF);
|
||||
}
|
||||
|
||||
static int set_element(bitstr_t * bits, int low, int high, int number) {
|
||||
Debug(DPARS | DEXT, ("set_element(?,%d,%d,%d)\n", low, high, number))
|
||||
|
||||
if (number < low || number > high)
|
||||
return (EOF);
|
||||
|
||||
bit_set(bits, (number - low));
|
||||
return (OK);
|
||||
}
|
242
cronie-1.4.6/src/env.c
Normal file
242
cronie-1.4.6/src/env.c
Normal file
|
@ -0,0 +1,242 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
char **env_init(void) {
|
||||
char **p = (char **) malloc(sizeof (char **));
|
||||
|
||||
if (p != NULL)
|
||||
p[0] = NULL;
|
||||
return (p);
|
||||
}
|
||||
|
||||
void env_free(char **envp) {
|
||||
char **p;
|
||||
|
||||
for (p = envp; *p != NULL; p++)
|
||||
free(*p);
|
||||
free(envp);
|
||||
}
|
||||
|
||||
char **env_copy(char **envp) {
|
||||
int count, i, save_errno;
|
||||
char **p;
|
||||
|
||||
for (count = 0; envp[count] != NULL; count++) ;
|
||||
|
||||
p = (char **) malloc((count + 1) * sizeof (char *)); /* 1 for the NULL */
|
||||
if (p != NULL) {
|
||||
for (i = 0; i < count; i++)
|
||||
if ((p[i] = strdup(envp[i])) == NULL) {
|
||||
save_errno = errno;
|
||||
while (--i >= 0)
|
||||
free(p[i]);
|
||||
free(p);
|
||||
errno = save_errno;
|
||||
return (NULL);
|
||||
}
|
||||
p[count] = NULL;
|
||||
}
|
||||
return (p);
|
||||
}
|
||||
|
||||
char **env_set(char **envp, char *envstr) {
|
||||
int count, found;
|
||||
char **p, *envtmp;
|
||||
|
||||
/*
|
||||
* count the number of elements, including the null pointer;
|
||||
* also set 'found' to -1 or index of entry if already in here.
|
||||
*/
|
||||
found = -1;
|
||||
for (count = 0; envp[count] != NULL; count++) {
|
||||
if (!strcmp_until(envp[count], envstr, '='))
|
||||
found = count;
|
||||
}
|
||||
count++; /* for the NULL */
|
||||
|
||||
if (found != -1) {
|
||||
/*
|
||||
* it exists already, so just free the existing setting,
|
||||
* save our new one there, and return the existing array.
|
||||
*/
|
||||
if ((envtmp = strdup(envstr)) == NULL)
|
||||
return (NULL);
|
||||
free(envp[found]);
|
||||
envp[found] = envtmp;
|
||||
return (envp);
|
||||
}
|
||||
|
||||
/*
|
||||
* it doesn't exist yet, so resize the array, move null pointer over
|
||||
* one, save our string over the old null pointer, and return resized
|
||||
* array.
|
||||
*/
|
||||
if ((envtmp = strdup(envstr)) == NULL)
|
||||
return (NULL);
|
||||
p = (char **) realloc((void *) envp,
|
||||
(size_t) ((count + 1) * sizeof (char **)));
|
||||
if (p == NULL) {
|
||||
free(envtmp);
|
||||
return (NULL);
|
||||
}
|
||||
p[count] = p[count - 1];
|
||||
p[count - 1] = envtmp;
|
||||
return (p);
|
||||
}
|
||||
|
||||
/* The following states are used by load_env(), traversed in order: */
|
||||
enum env_state {
|
||||
NAMEI, /* First char of NAME, may be quote */
|
||||
NAME, /* Subsequent chars of NAME */
|
||||
EQ1, /* After end of name, looking for '=' sign */
|
||||
EQ2, /* After '=', skipping whitespace */
|
||||
VALUEI, /* First char of VALUE, may be quote */
|
||||
VALUE, /* Subsequent chars of VALUE */
|
||||
FINI, /* All done, skipping trailing whitespace */
|
||||
ERROR, /* Error */
|
||||
};
|
||||
|
||||
/* return ERR = end of file
|
||||
* FALSE = not an env setting (file was repositioned)
|
||||
* TRUE = was an env setting
|
||||
*/
|
||||
int load_env(char *envstr, FILE * f) {
|
||||
long filepos;
|
||||
int fileline;
|
||||
enum env_state state;
|
||||
char name[MAX_ENVSTR], val[MAX_ENVSTR];
|
||||
char quotechar, *c, *str;
|
||||
|
||||
filepos = ftell(f);
|
||||
fileline = LineNumber;
|
||||
skip_comments(f);
|
||||
if (EOF == get_string(envstr, MAX_ENVSTR, f, "\n"))
|
||||
return (ERR);
|
||||
|
||||
Debug(DPARS, ("load_env, read <%s>\n", envstr))
|
||||
|
||||
bzero(name, sizeof name);
|
||||
bzero(val, sizeof val);
|
||||
str = name;
|
||||
state = NAMEI;
|
||||
quotechar = '\0';
|
||||
c = envstr;
|
||||
while (state != ERROR && *c) {
|
||||
switch (state) {
|
||||
case NAMEI:
|
||||
case VALUEI:
|
||||
if (*c == '\'' || *c == '"')
|
||||
quotechar = *c++;
|
||||
state++;
|
||||
/* FALLTHROUGH */
|
||||
case NAME:
|
||||
case VALUE:
|
||||
if (quotechar) {
|
||||
if (*c == quotechar) {
|
||||
state++;
|
||||
c++;
|
||||
break;
|
||||
}
|
||||
if (state == NAME && *c == '=') {
|
||||
state = ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (state == NAME) {
|
||||
if (isspace((unsigned char) *c)) {
|
||||
c++;
|
||||
state++;
|
||||
break;
|
||||
}
|
||||
if (*c == '=') {
|
||||
state++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*str++ = *c++;
|
||||
break;
|
||||
|
||||
case EQ1:
|
||||
if (*c == '=') {
|
||||
state++;
|
||||
str = val;
|
||||
quotechar = '\0';
|
||||
}
|
||||
else {
|
||||
if (!isspace((unsigned char) *c))
|
||||
state = ERROR;
|
||||
}
|
||||
c++;
|
||||
break;
|
||||
|
||||
case EQ2:
|
||||
case FINI:
|
||||
if (isspace((unsigned char) *c))
|
||||
c++;
|
||||
else
|
||||
state++;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
if (state != FINI && !(state == VALUE && !quotechar)) {
|
||||
Debug(DPARS, ("load_env, not an env var, state = %d\n", state))
|
||||
fseek(f, filepos, 0);
|
||||
Set_LineNum(fileline);
|
||||
return (FALSE);
|
||||
}
|
||||
if (state == VALUE) {
|
||||
/* End of unquoted value: trim trailing whitespace */
|
||||
c = val + strlen(val);
|
||||
while (c > val && isspace((unsigned char) c[-1]))
|
||||
*(--c) = '\0';
|
||||
}
|
||||
|
||||
/* 2 fields from parser; looks like an env setting */
|
||||
|
||||
/*
|
||||
* This can't overflow because get_string() limited the size of the
|
||||
* name and val fields. Still, it doesn't hurt to be careful...
|
||||
*/
|
||||
if (!glue_strings(envstr, MAX_ENVSTR, name, val, '='))
|
||||
return (FALSE);
|
||||
Debug(DPARS, ("load_env, <%s> <%s> -> <%s>\n", name, val, envstr))
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
char *env_get(char *name, char **envp) {
|
||||
int len = strlen(name);
|
||||
char *p, *q;
|
||||
|
||||
while ((p = *envp++) != NULL) {
|
||||
if (!(q = strchr(p, '=')))
|
||||
continue;
|
||||
if ((q - p) == len && !strncmp(p, name, len))
|
||||
return (q + 1);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
127
cronie-1.4.6/src/externs.h
Normal file
127
cronie-1.4.6/src/externs.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/* Copyright 1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* reorder these #include's at your peril */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#ifdef HAVE_SYS_FCNTL_H
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#include <sys/file.h>
|
||||
/* stat is used even, when --with-inotify */
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <bitstring.h>
|
||||
#include <ctype.h>
|
||||
#ifndef isascii
|
||||
#define isascii(c) ((unsigned)(c)<=0177)
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <locale.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
#if defined(SYSLOG)
|
||||
# include <syslog.h>
|
||||
#endif
|
||||
|
||||
#if defined(LOGIN_CAP)
|
||||
# include <login_cap.h>
|
||||
#endif /*LOGIN_CAP*/
|
||||
|
||||
#if defined(BSD_AUTH)
|
||||
# include <bsd_auth.h>
|
||||
#endif /*BSD_AUTH*/
|
||||
|
||||
/* include locale stuff for mailer "Content-Type":
|
||||
*/
|
||||
#include <locale.h>
|
||||
#include <nl_types.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#define DIR_T struct dirent
|
||||
#define WAIT_T int
|
||||
#define SIG_T sig_t
|
||||
#define TIME_T time_t
|
||||
#define PID_T pid_t
|
||||
|
||||
#ifndef TZNAME_ALREADY_DEFINED
|
||||
extern char *tzname[2];
|
||||
#endif
|
||||
#define TZONE(tm) tzname[(tm).tm_isdst]
|
||||
|
||||
#if (defined(BSD)) && (BSD >= 199103) || defined(__linux) || defined(__sun) || defined(_AIX)
|
||||
# define HAVE_SAVED_UIDS
|
||||
#endif
|
||||
|
||||
#define MY_UID(pw) getuid()
|
||||
#define MY_GID(pw) getgid()
|
||||
|
||||
/* getopt() isn't part of POSIX. some systems define it in <stdlib.h> anyway.
|
||||
* of those that do, some complain that our definition is different and some
|
||||
* do not. to add to the misery and confusion, some systems define getopt()
|
||||
* in ways that we cannot predict or comprehend, yet do not define the adjunct
|
||||
* external variables needed for the interface.
|
||||
*/
|
||||
#if (!defined(BSD) || (BSD < 198911))
|
||||
int getopt(int, char * const *, const char *);
|
||||
#endif
|
||||
|
||||
#if (!defined(BSD) || (BSD < 199103))
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
#endif
|
||||
|
||||
/* digital unix needs this but does not give us a way to identify it.
|
||||
*/
|
||||
extern int flock(int, int);
|
||||
|
||||
/* not all systems who provide flock() provide these definitions.
|
||||
*/
|
||||
#ifndef LOCK_SH
|
||||
# define LOCK_SH 1
|
||||
#endif
|
||||
#ifndef LOCK_EX
|
||||
# define LOCK_EX 2
|
||||
#endif
|
||||
#ifndef LOCK_NB
|
||||
# define LOCK_NB 4
|
||||
#endif
|
||||
#ifndef LOCK_UN
|
||||
# define LOCK_UN 8
|
||||
#endif
|
||||
|
||||
#ifndef WCOREDUMP
|
||||
# define WCOREDUMP(st) (((st) & 0200) != 0)
|
||||
#endif
|
112
cronie-1.4.6/src/funcs.h
Normal file
112
cronie-1.4.6/src/funcs.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* $Id: funcs.h,v 1.9 2004/01/23 18:56:42 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Notes:
|
||||
* This file has to be included by cron.h after data structure defs.
|
||||
* We should reorg this into sections by module.
|
||||
*/
|
||||
|
||||
void set_cron_uid(void),
|
||||
set_cron_cwd(void),
|
||||
open_logfile(void),
|
||||
sigpipe_func(void),
|
||||
job_add(entry *, user *),
|
||||
do_command(entry *, user *),
|
||||
link_user(cron_db *, user *),
|
||||
unlink_user(cron_db *, user *),
|
||||
free_user(user *),
|
||||
env_free(char **),
|
||||
unget_char(int, FILE *),
|
||||
free_entry(entry *),
|
||||
acquire_daemonlock(int),
|
||||
skip_comments(FILE *),
|
||||
log_it(const char *, PID_T, const char *, const char *, int),
|
||||
log_close(void);
|
||||
#if defined WITH_INOTIFY
|
||||
void set_cron_watched(int ),
|
||||
set_cron_unwatched(int ),
|
||||
check_inotify_database(cron_db *);
|
||||
#endif
|
||||
|
||||
int load_database(cron_db *),
|
||||
job_runqueue(void),
|
||||
set_debug_flags(const char *),
|
||||
get_char(FILE *),
|
||||
get_string(char *, int, FILE *, char *),
|
||||
swap_uids(void),
|
||||
swap_uids_back(void),
|
||||
load_env(char *, FILE *),
|
||||
cron_pclose(FILE *),
|
||||
glue_strings(char *, size_t, const char *, const char *, char),
|
||||
strcmp_until(const char *, const char *, char),
|
||||
allowed(const char * ,const char * ,const char *),
|
||||
strdtb(char *);
|
||||
|
||||
size_t strlens(const char *, ...);
|
||||
|
||||
char *env_get(char *, char **),
|
||||
*arpadate(time_t *),
|
||||
*mkprints(unsigned char *, unsigned int),
|
||||
*first_word(char *, char *),
|
||||
**env_init(void),
|
||||
**env_copy(char **),
|
||||
**env_set(char **, char *);
|
||||
|
||||
user *load_user(int, struct passwd *, const char *, const char *, const char *),
|
||||
*find_user(cron_db *, const char *, const char *);
|
||||
|
||||
entry *load_entry(FILE *, void (*)(), struct passwd *, char **);
|
||||
|
||||
FILE *cron_popen(char *, const char *, struct passwd *);
|
||||
|
||||
struct passwd *pw_dup(const struct passwd *);
|
||||
|
||||
#ifndef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
long get_gmtoff(time_t *, struct tm *);
|
||||
#endif
|
||||
|
||||
/* Red Hat security stuff (security.c):
|
||||
*/
|
||||
void cron_restore_default_security_context( void );
|
||||
|
||||
int cron_set_job_security_context( entry *e, user *u, char ***jobenvp );
|
||||
|
||||
int cron_open_security_session( struct passwd *pw );
|
||||
|
||||
void cron_close_security_session( void );
|
||||
|
||||
int cron_change_user( struct passwd *pw );
|
||||
|
||||
int cron_change_user_permanently( struct passwd *pw, char *homedir );
|
||||
|
||||
int get_security_context(const char *name,
|
||||
int crontab_fd,
|
||||
security_context_t *rcontext,
|
||||
const char *tabname
|
||||
);
|
||||
|
||||
void free_security_context( security_context_t *scontext );
|
||||
|
||||
int crontab_security_access(void);
|
||||
|
||||
/* PAM */
|
||||
int cron_start_pam(struct passwd *pw);
|
||||
void cron_close_pam(void);
|
89
cronie-1.4.6/src/globals.h
Normal file
89
cronie-1.4.6/src/globals.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* $Id: globals.h,v 1.10 2004/01/23 19:03:33 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 2010/09/12 by Colin Dean, Durham University IT Service,
|
||||
* to add clustering support.
|
||||
*/
|
||||
|
||||
#ifdef MAIN_PROGRAM
|
||||
# define XTRN
|
||||
# define INIT(x) = x
|
||||
#else
|
||||
# define XTRN extern
|
||||
# define INIT(x)
|
||||
#endif
|
||||
|
||||
XTRN const char *copyright[]
|
||||
#ifdef MAIN_PROGRAM
|
||||
= {
|
||||
"@(#) ISC Cron V4.1",
|
||||
"@(#) Copyright 1988,1989,1990,1993,1994 by Paul Vixie",
|
||||
"@(#) Copyright 1997,2000 by Internet Software Consortium, Inc.",
|
||||
"@(#) Copyright 2004 by Internet Systems Consortium, Inc.",
|
||||
"@(#) All rights reserved",
|
||||
NULL
|
||||
}
|
||||
#endif
|
||||
;
|
||||
|
||||
XTRN const char *MonthNames[]
|
||||
#ifdef MAIN_PROGRAM
|
||||
= {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
||||
NULL
|
||||
}
|
||||
#endif
|
||||
;
|
||||
|
||||
XTRN const char *DowNames[]
|
||||
#ifdef MAIN_PROGRAM
|
||||
= {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
|
||||
NULL
|
||||
}
|
||||
#endif
|
||||
;
|
||||
|
||||
XTRN char *ProgramName;
|
||||
XTRN int LineNumber;
|
||||
XTRN int SyslogOutput;
|
||||
XTRN time_t StartTime;
|
||||
XTRN int NoFork;
|
||||
XTRN int PermitAnyCrontab;
|
||||
XTRN char MailCmd[MAX_COMMAND];
|
||||
XTRN char cron_default_mail_charset[MAX_ENVSTR];
|
||||
XTRN int EnableClustering;
|
||||
|
||||
#if DEBUGGING
|
||||
XTRN int DebugFlags INIT(0);
|
||||
XTRN const char *DebugFlagNames[]
|
||||
#ifdef MAIN_PROGRAM
|
||||
= {
|
||||
"ext", "sch", "proc", "pars", "load", "misc", "test", "bit",
|
||||
NULL
|
||||
}
|
||||
#endif
|
||||
;
|
||||
#else
|
||||
#define DebugFlags 0
|
||||
#endif /* DEBUGGING */
|
67
cronie-1.4.6/src/job.c
Normal file
67
cronie-1.4.6/src/job.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
typedef struct _job {
|
||||
struct _job *next;
|
||||
entry *e;
|
||||
user *u;
|
||||
} job;
|
||||
|
||||
static job *jhead = NULL, *jtail = NULL;
|
||||
|
||||
void job_add(entry * e, user * u) {
|
||||
job *j;
|
||||
|
||||
/* if already on queue, keep going */
|
||||
for (j = jhead; j != NULL; j = j->next)
|
||||
if (j->e == e && j->u == u)
|
||||
return;
|
||||
|
||||
/* build a job queue element */
|
||||
if ((j = (job *) malloc(sizeof (job))) == NULL)
|
||||
return;
|
||||
j->next = NULL;
|
||||
j->e = e;
|
||||
j->u = u;
|
||||
|
||||
/* add it to the tail */
|
||||
if (jhead == NULL)
|
||||
jhead = j;
|
||||
else
|
||||
jtail->next = j;
|
||||
jtail = j;
|
||||
}
|
||||
|
||||
int job_runqueue(void) {
|
||||
job *j, *jn;
|
||||
int run = 0;
|
||||
|
||||
for (j = jhead; j; j = jn) {
|
||||
do_command(j->e, j->u);
|
||||
jn = j->next;
|
||||
free(j);
|
||||
run++;
|
||||
}
|
||||
jhead = jtail = NULL;
|
||||
return (run);
|
||||
}
|
132
cronie-1.4.6/src/macros.h
Normal file
132
cronie-1.4.6/src/macros.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* $Id: macros.h,v 1.9 2004/01/23 18:56:43 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
/* these are really immutable, and are
|
||||
* defined for symbolic convenience only
|
||||
* TRUE, FALSE, and ERR must be distinct
|
||||
* ERR must be < OK.
|
||||
*/
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/* system calls return this on success */
|
||||
#define OK 0
|
||||
/* or this on error */
|
||||
#define ERR (-1)
|
||||
|
||||
/* turn this on to get '-x' code */
|
||||
#ifndef DEBUGGING
|
||||
#define DEBUGGING FALSE
|
||||
#endif
|
||||
|
||||
#define INIT_PID 1 /* parent of orphans */
|
||||
#define READ_PIPE 0 /* which end of a pipe pair do you read? */
|
||||
#define WRITE_PIPE 1 /* or write to? */
|
||||
#define STDIN 0 /* what is stdin's file descriptor? */
|
||||
#define STDOUT 1 /* stdout's? */
|
||||
#define STDERR 2 /* stderr's? */
|
||||
#define ERROR_EXIT 1 /* exit() with this will scare the shell */
|
||||
#define OK_EXIT 0 /* exit() with this is considered 'normal' */
|
||||
#define MAX_FNAME PATH_MAX/* max length of internally generated fn */
|
||||
#define MAX_COMMAND 131072 /* max length of internally generated cmd (max sh cmd line length) */
|
||||
#define MAX_ENVSTR 131072 /* max length of envvar=value\0 strings */
|
||||
#define MAX_TEMPSTR 131072 /* obvious */
|
||||
#define MAX_UNAME 256 /* max length of username */
|
||||
#define ROOT_UID 0 /* don't change this, it really must be root */
|
||||
#define ROOT_USER "root" /* ditto */
|
||||
|
||||
/* NOTE: these correspond to DebugFlagNames,
|
||||
* defined below.
|
||||
*/
|
||||
#define DEXT 0x0001 /* extend flag for other debug masks */
|
||||
#define DSCH 0x0002 /* scheduling debug mask */
|
||||
#define DPROC 0x0004 /* process control debug mask */
|
||||
#define DPARS 0x0008 /* parsing debug mask */
|
||||
#define DLOAD 0x0010 /* database loading debug mask */
|
||||
#define DMISC 0x0020 /* misc debug mask */
|
||||
#define DTEST 0x0040 /* test mode: don't execute any commands */
|
||||
|
||||
#define PPC_NULL ((const char **)NULL)
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
#define Skip_Blanks(c, f) \
|
||||
while (c == '\t' || c == ' ') \
|
||||
c = get_char(f);
|
||||
|
||||
#define Skip_Nonblanks(c, f) \
|
||||
while (c!='\t' && c!=' ' && c!='\n' && c != EOF) \
|
||||
c = get_char(f);
|
||||
|
||||
#if DEBUGGING
|
||||
# define Debug(mask, message) \
|
||||
if ((DebugFlags & (mask)) != 0) \
|
||||
printf message;
|
||||
#else /* !DEBUGGING */
|
||||
# define Debug(mask, message) \
|
||||
;
|
||||
#endif /* DEBUGGING */
|
||||
|
||||
#define MkUpper(ch) (islower(ch) ? toupper(ch) : ch)
|
||||
#define Set_LineNum(ln) {Debug(DPARS|DEXT,("linenum=%d\n",ln)); \
|
||||
LineNumber = ln; \
|
||||
}
|
||||
|
||||
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
#define get_gmtoff(c, t) ((t)->tm_gmtoff)
|
||||
#endif
|
||||
|
||||
#define SECONDS_PER_MINUTE 60
|
||||
#define SECONDS_PER_HOUR 3600
|
||||
|
||||
#define FIRST_MINUTE 0
|
||||
#define LAST_MINUTE 59
|
||||
#define MINUTE_COUNT (LAST_MINUTE - FIRST_MINUTE + 1)
|
||||
|
||||
#define FIRST_HOUR 0
|
||||
#define LAST_HOUR 23
|
||||
#define HOUR_COUNT (LAST_HOUR - FIRST_HOUR + 1)
|
||||
|
||||
#define FIRST_DOM 1
|
||||
#define LAST_DOM 31
|
||||
#define DOM_COUNT (LAST_DOM - FIRST_DOM + 1)
|
||||
|
||||
#define FIRST_MONTH 1
|
||||
#define LAST_MONTH 12
|
||||
#define MONTH_COUNT (LAST_MONTH - FIRST_MONTH + 1)
|
||||
|
||||
/* note on DOW: 0 and 7 are both Sunday, for compatibility reasons. */
|
||||
#define FIRST_DOW 0
|
||||
#define LAST_DOW 7
|
||||
#define DOW_COUNT (LAST_DOW - FIRST_DOW + 1)
|
||||
|
||||
/*
|
||||
* Because crontab/at files may be owned by their respective users we
|
||||
* take extreme care in opening them. If the OS lacks the O_NOFOLLOW
|
||||
* we will just have to live without it. In order for this to be an
|
||||
* issue an attacker would have to subvert group CRON_GROUP.
|
||||
*/
|
||||
#ifndef O_NOFOLLOW
|
||||
#define O_NOFOLLOW 0
|
||||
#endif
|
749
cronie-1.4.6/src/misc.c
Normal file
749
cronie-1.4.6/src/misc.c
Normal file
|
@ -0,0 +1,749 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* vix 26jan87 [RCS has the rest of the log]
|
||||
* vix 30dec86 [written]
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
#ifdef WITH_AUDIT
|
||||
# include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H /* fcntl(2) */
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H /* lockf(3) */
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_FLOCK /* flock(2) */
|
||||
# include <sys/file.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(SYSLOG) && defined(LOG_FILE)
|
||||
# undef LOG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(LOG_DAEMON) && !defined(LOG_CRON)
|
||||
# define LOG_CRON LOG_DAEMON
|
||||
#endif
|
||||
|
||||
#ifndef FACILITY
|
||||
# define FACILITY LOG_CRON
|
||||
#endif
|
||||
|
||||
static int LogFD = ERR;
|
||||
|
||||
#if defined(SYSLOG)
|
||||
static int syslog_open = FALSE;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FCNTL) && defined(F_SETLK)
|
||||
static int trylock_file(int fd) {
|
||||
struct flock fl;
|
||||
|
||||
memset(&fl, '\0', sizeof (fl));
|
||||
fl.l_type = F_WRLCK;
|
||||
fl.l_whence = SEEK_SET;
|
||||
fl.l_start = 0;
|
||||
fl.l_len = 0;
|
||||
|
||||
return fcntl(fd, F_SETLK, &fl);
|
||||
}
|
||||
#elif defined(HAVE_LOCKF)
|
||||
# define trylock_file(fd) lockf((fd), F_TLOCK, 0)
|
||||
#elif defined(HAVE_FLOCK)
|
||||
# define trylock_file(fd) flock((fd), LOCK_EX|LOCK_NB)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* glue_strings is the overflow-safe equivalent of
|
||||
* sprintf(buffer, "%s%c%s", a, separator, b);
|
||||
*
|
||||
* returns 1 on success, 0 on failure. 'buffer' MUST NOT be used if
|
||||
* glue_strings fails.
|
||||
*/
|
||||
int
|
||||
glue_strings(char *buffer, size_t buffer_size, const char *a, const char *b,
|
||||
char separator) {
|
||||
char *buf;
|
||||
char *buf_end;
|
||||
|
||||
if (buffer_size <= 0)
|
||||
return (0);
|
||||
buf_end = buffer + buffer_size;
|
||||
buf = buffer;
|
||||
|
||||
for ( /* nothing */ ; buf < buf_end && *a != '\0'; buf++, a++)
|
||||
*buf = *a;
|
||||
if (buf == buf_end)
|
||||
return (0);
|
||||
if (separator != '/' || buf == buffer || buf[-1] != '/')
|
||||
*buf++ = separator;
|
||||
if (buf == buf_end)
|
||||
return (0);
|
||||
for ( /* nothing */ ; buf < buf_end && *b != '\0'; buf++, b++)
|
||||
*buf = *b;
|
||||
if (buf == buf_end)
|
||||
return (0);
|
||||
*buf = '\0';
|
||||
return (1);
|
||||
}
|
||||
|
||||
int strcmp_until(const char *left, const char *right, char until) {
|
||||
while (*left && *left != until && *left == *right) {
|
||||
left++;
|
||||
right++;
|
||||
}
|
||||
|
||||
if ((*left == '\0' || *left == until) && (*right == '\0' ||
|
||||
*right == until)) {
|
||||
return (0);
|
||||
}
|
||||
return (*left - *right);
|
||||
}
|
||||
|
||||
/* strdtb(s) - delete trailing blanks in string 's' and return new length
|
||||
*/
|
||||
int strdtb(char *s) {
|
||||
char *x = s;
|
||||
|
||||
/* scan forward to the null
|
||||
*/
|
||||
while (*x)
|
||||
x++;
|
||||
|
||||
/* scan backward to either the first character before the string,
|
||||
* or the last non-blank in the string, whichever comes first.
|
||||
*/
|
||||
do {
|
||||
x--;
|
||||
} while (x >= s && isspace((unsigned char) *x));
|
||||
|
||||
/* one character beyond where we stopped above is where the null
|
||||
* goes.
|
||||
*/
|
||||
*++x = '\0';
|
||||
|
||||
/* the difference between the position of the null character and
|
||||
* the position of the first character of the string is the length.
|
||||
*/
|
||||
return (x - s);
|
||||
}
|
||||
|
||||
int set_debug_flags(const char *flags) {
|
||||
/* debug flags are of the form flag[,flag ...]
|
||||
*
|
||||
* if an error occurs, print a message to stdout and return FALSE.
|
||||
* otherwise return TRUE after setting ERROR_FLAGS.
|
||||
*/
|
||||
|
||||
#if !DEBUGGING
|
||||
|
||||
printf("this program was compiled without debugging enabled\n");
|
||||
return (FALSE);
|
||||
|
||||
#else /* DEBUGGING */
|
||||
|
||||
const char *pc = flags;
|
||||
|
||||
DebugFlags = 0;
|
||||
|
||||
while (*pc) {
|
||||
const char **test;
|
||||
int mask;
|
||||
|
||||
/* try to find debug flag name in our list.
|
||||
*/
|
||||
for (test = DebugFlagNames, mask = 1;
|
||||
*test != NULL && strcmp_until(*test, pc, ','); test++, mask <<= 1) ;
|
||||
|
||||
if (!*test) {
|
||||
fprintf(stderr, "unrecognized debug flag <%s> <%s>\n", flags, pc);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
DebugFlags |= mask;
|
||||
|
||||
/* skip to the next flag
|
||||
*/
|
||||
while (*pc && *pc != ',')
|
||||
pc++;
|
||||
if (*pc == ',')
|
||||
pc++;
|
||||
}
|
||||
|
||||
if (DebugFlags) {
|
||||
int flag;
|
||||
|
||||
fprintf(stderr, "debug flags enabled:");
|
||||
|
||||
for (flag = 0; DebugFlagNames[flag]; flag++)
|
||||
if (DebugFlags & (1 << flag))
|
||||
fprintf(stderr, " %s", DebugFlagNames[flag]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
|
||||
#endif /* DEBUGGING */
|
||||
}
|
||||
|
||||
void set_cron_uid(void) {
|
||||
#if defined(BSD) || defined(POSIX)
|
||||
if (seteuid(ROOT_UID) < OK) {
|
||||
perror("seteuid");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
#else
|
||||
if (setuid(ROOT_UID) < OK) {
|
||||
perror("setuid");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_cron_cwd(void) {
|
||||
struct stat sb;
|
||||
struct group *grp = NULL;
|
||||
|
||||
#ifdef CRON_GROUP
|
||||
grp = getgrnam(CRON_GROUP);
|
||||
#endif
|
||||
/* check SPOOL_DIR existence
|
||||
*/
|
||||
if (stat(SPOOL_DIR, &sb) < OK && errno == ENOENT) {
|
||||
perror(SPOOL_DIR);
|
||||
if (OK == mkdir(SPOOL_DIR, 0700)) {
|
||||
fprintf(stderr, "%s: created\n", SPOOL_DIR);
|
||||
stat(SPOOL_DIR, &sb);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "%s: ", SPOOL_DIR);
|
||||
perror("mkdir");
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
}
|
||||
if (!S_ISDIR(sb.st_mode)) {
|
||||
fprintf(stderr, "'%s' is not a directory, bailing out.\n", SPOOL_DIR);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (grp != NULL) {
|
||||
if (sb.st_gid != grp->gr_gid)
|
||||
if (chown(SPOOL_DIR, -1, grp->gr_gid) == -1) {
|
||||
fprintf(stderr, "chdir %s failed: %s\n", SPOOL_DIR,
|
||||
strerror(errno));
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
if (sb.st_mode != 01730)
|
||||
if (chmod(SPOOL_DIR, 01730) == -1) {
|
||||
fprintf(stderr, "chmod 01730 %s failed: %s\n", SPOOL_DIR,
|
||||
strerror(errno));
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* acquire_daemonlock() - write our PID into /etc/cron.pid, unless
|
||||
* another daemon is already running, which we detect here.
|
||||
*
|
||||
* note: main() calls us twice; once before forking, once after.
|
||||
* we maintain static storage of the file pointer so that we
|
||||
* can rewrite our PID into _PATH_CRON_PID after the fork.
|
||||
*/
|
||||
void acquire_daemonlock(int closeflag) {
|
||||
static int fd = -1;
|
||||
char buf[3 * MAX_FNAME];
|
||||
const char *pidfile;
|
||||
char *ep;
|
||||
long otherpid = -1;
|
||||
ssize_t num, len;
|
||||
pid_t pid = getpid();
|
||||
|
||||
if (closeflag) {
|
||||
/* close stashed fd for child so we don't leak it. */
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fd == -1) {
|
||||
pidfile = _PATH_CRON_PID;
|
||||
/* Initial mode is 0600 to prevent flock() race/DoS. */
|
||||
if ((fd = open(pidfile, O_RDWR | O_CREAT, 0600)) == -1) {
|
||||
int save_errno = errno;
|
||||
sprintf(buf, "can't open or create %s", pidfile);
|
||||
fprintf(stderr, "%s: %s: %s\n", ProgramName, buf,
|
||||
strerror(save_errno));
|
||||
log_it("CRON", pid, "DEATH", buf, save_errno);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
|
||||
if (trylock_file(fd) < OK) {
|
||||
int save_errno = errno;
|
||||
|
||||
bzero(buf, sizeof (buf));
|
||||
if ((num = read(fd, buf, sizeof (buf) - 1)) > 0 &&
|
||||
(otherpid = strtol(buf, &ep, 10)) > 0 &&
|
||||
ep != buf && *ep == '\n' && otherpid != LONG_MAX) {
|
||||
snprintf(buf, sizeof (buf),
|
||||
"can't lock %s, otherpid may be %ld", pidfile, otherpid);
|
||||
}
|
||||
else {
|
||||
snprintf(buf, sizeof (buf),
|
||||
"can't lock %s, otherpid unknown", pidfile);
|
||||
}
|
||||
fprintf(stderr, "%s: %s: %s\n", ProgramName, buf,
|
||||
strerror(save_errno));
|
||||
log_it("CRON", pid, "DEATH", buf, save_errno);
|
||||
exit(ERROR_EXIT);
|
||||
}
|
||||
(void) fchmod(fd, 0644);
|
||||
(void) fcntl(fd, F_SETFD, 1);
|
||||
}
|
||||
|
||||
sprintf(buf, "%ld\n", (long) pid);
|
||||
(void) lseek(fd, (off_t) 0, SEEK_SET);
|
||||
len = strlen(buf);
|
||||
if ((num = write(fd, buf, len)) != len)
|
||||
log_it("CRON", pid, "ERROR", "write() failed", errno);
|
||||
else {
|
||||
if (ftruncate(fd, num) == -1)
|
||||
log_it("CRON", pid, "ERROR", "ftruncate() failed", errno);
|
||||
}
|
||||
|
||||
/* abandon fd even though the file is open. we need to keep
|
||||
* it open and locked, but we don't need the handles elsewhere.
|
||||
*/
|
||||
}
|
||||
|
||||
/* get_char(file) : like getc() but increment LineNumber on newlines
|
||||
*/
|
||||
int get_char(FILE * file) {
|
||||
int ch;
|
||||
|
||||
ch = getc(file);
|
||||
if (ch == '\n')
|
||||
Set_LineNum(LineNumber + 1)
|
||||
return (ch);
|
||||
}
|
||||
|
||||
/* unget_char(ch, file) : like ungetc but do LineNumber processing
|
||||
*/
|
||||
void unget_char(int ch, FILE * file) {
|
||||
ungetc(ch, file);
|
||||
if (ch == '\n')
|
||||
Set_LineNum(LineNumber - 1)
|
||||
}
|
||||
|
||||
/* get_string(str, max, file, termstr) : like fgets() but
|
||||
* (1) has terminator string which should include \n
|
||||
* (2) will always leave room for the null
|
||||
* (3) uses get_char() so LineNumber will be accurate
|
||||
* (4) returns EOF or terminating character, whichever
|
||||
*/
|
||||
int get_string(char *string, int size, FILE * file, char *terms) {
|
||||
int ch;
|
||||
|
||||
while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) {
|
||||
if (size > 1) {
|
||||
*string++ = (char) ch;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
if (size > 0)
|
||||
*string = '\0';
|
||||
|
||||
return (ch);
|
||||
}
|
||||
|
||||
/* skip_comments(file) : read past comment (if any)
|
||||
*/
|
||||
void skip_comments(FILE * file) {
|
||||
int ch;
|
||||
|
||||
while (EOF != (ch = get_char(file))) {
|
||||
/* ch is now the first character of a line.
|
||||
*/
|
||||
while (ch == ' ' || ch == '\t')
|
||||
ch = get_char(file);
|
||||
|
||||
if (ch == EOF)
|
||||
break;
|
||||
|
||||
/* ch is now the first non-blank character of a line.
|
||||
*/
|
||||
|
||||
if (ch != '\n' && ch != '#')
|
||||
break;
|
||||
|
||||
/* ch must be a newline or comment as first non-blank
|
||||
* character on a line.
|
||||
*/
|
||||
|
||||
while (ch != '\n' && ch != EOF)
|
||||
ch = get_char(file);
|
||||
|
||||
/* ch is now the newline of a line which we're going to
|
||||
* ignore.
|
||||
*/
|
||||
}
|
||||
if (ch != EOF)
|
||||
unget_char(ch, file);
|
||||
}
|
||||
|
||||
/* int in_file(const char *string, FILE *file, int error)
|
||||
* return TRUE if one of the lines in file matches string exactly,
|
||||
* FALSE if no lines match, and error on error.
|
||||
*/
|
||||
static int in_file(const char *string, FILE * file, int error) {
|
||||
char line[MAX_TEMPSTR];
|
||||
char *endp;
|
||||
|
||||
if (fseek(file, 0L, SEEK_SET))
|
||||
return (error);
|
||||
while (fgets(line, MAX_TEMPSTR, file)) {
|
||||
if (line[0] != '\0') {
|
||||
endp = &line[strlen(line) - 1];
|
||||
if (*endp != '\n')
|
||||
return (error);
|
||||
*endp = '\0';
|
||||
if (0 == strcmp(line, string))
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
if (ferror(file))
|
||||
return (error);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* int allowed(const char *username, const char *allow_file, const char *deny_file)
|
||||
* returns TRUE if (allow_file exists and user is listed)
|
||||
* or (deny_file exists and user is NOT listed).
|
||||
* root is always allowed.
|
||||
*/
|
||||
int allowed(const char *username, const char *allow_file,
|
||||
const char *deny_file) {
|
||||
FILE *fp;
|
||||
int isallowed;
|
||||
char buf[128];
|
||||
|
||||
if (getuid() == 0)
|
||||
return TRUE;
|
||||
isallowed = FALSE;
|
||||
if ((fp = fopen(allow_file, "r")) != NULL) {
|
||||
isallowed = in_file(username, fp, FALSE);
|
||||
fclose(fp);
|
||||
if ((getuid() == 0) && (!isallowed)) {
|
||||
snprintf(buf, sizeof (buf),
|
||||
"root used -u for user %s not in cron.allow", username);
|
||||
log_it("crontab", getpid(), "warning", buf, 0);
|
||||
isallowed = TRUE;
|
||||
}
|
||||
}
|
||||
else if ((fp = fopen(deny_file, "r")) != NULL) {
|
||||
isallowed = !in_file(username, fp, FALSE);
|
||||
fclose(fp);
|
||||
if ((getuid() == 0) && (!isallowed)) {
|
||||
snprintf(buf, sizeof (buf),
|
||||
"root used -u for user %s in cron.deny", username);
|
||||
log_it("crontab", getpid(), "warning", buf, 0);
|
||||
isallowed = TRUE;
|
||||
}
|
||||
}
|
||||
#ifdef WITH_AUDIT
|
||||
if (isallowed == FALSE) {
|
||||
int audit_fd = audit_open();
|
||||
audit_log_user_message(audit_fd, AUDIT_USER_START, "cron deny",
|
||||
NULL, NULL, NULL, 0);
|
||||
close(audit_fd);
|
||||
}
|
||||
#endif
|
||||
return (isallowed);
|
||||
}
|
||||
|
||||
void log_it(const char *username, PID_T xpid, const char *event,
|
||||
const char *detail, int err) {
|
||||
#if defined(LOG_FILE) || DEBUGGING
|
||||
PID_T pid = xpid;
|
||||
#endif
|
||||
#if defined(LOG_FILE)
|
||||
char *msg;
|
||||
TIME_T now = time((TIME_T) 0);
|
||||
struct tm *t = localtime(&now);
|
||||
int msg_size;
|
||||
#endif
|
||||
|
||||
#if defined(LOG_FILE)
|
||||
/* we assume that MAX_TEMPSTR will hold the date, time, &punctuation.
|
||||
*/
|
||||
msg = malloc(msg_size = (strlen(username)
|
||||
+ strlen(event)
|
||||
+ strlen(detail)
|
||||
+ MAX_TEMPSTR)
|
||||
);
|
||||
if (msg == NULL) { /* damn, out of mem and we did not test that before... */
|
||||
fprintf(stderr, "%s: Run OUT OF MEMORY while %s\n",
|
||||
ProgramName, __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
if (LogFD < OK) {
|
||||
LogFD = open(LOG_FILE, O_WRONLY | O_APPEND | O_CREAT, 0600);
|
||||
if (LogFD < OK) {
|
||||
fprintf(stderr, "%s: can't open log file\n", ProgramName);
|
||||
perror(LOG_FILE);
|
||||
}
|
||||
else {
|
||||
(void) fcntl(LogFD, F_SETFD, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* we have to snprintf() it because fprintf() doesn't always write
|
||||
* everything out in one chunk and this has to be atomically appended
|
||||
* to the log file.
|
||||
*/
|
||||
snprintf(msg, msg_size,
|
||||
"%s (%02d/%02d-%02d:%02d:%02d-%d) %s (%s)%s%s\n", username,
|
||||
t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, pid,
|
||||
event, detail, err != 0 ? ": " : "", err != 0 ? strerror(err) : "");
|
||||
|
||||
/* we have to run strlen() because sprintf() returns (char*) on old BSD
|
||||
*/
|
||||
if (LogFD < OK || write(LogFD, msg, strlen(msg)) < OK) {
|
||||
if (LogFD >= OK)
|
||||
perror(LOG_FILE);
|
||||
fprintf(stderr, "%s: can't write to log file\n", ProgramName);
|
||||
write(STDERR, msg, strlen(msg));
|
||||
}
|
||||
|
||||
free(msg);
|
||||
#endif /*LOG_FILE */
|
||||
|
||||
#if defined(SYSLOG)
|
||||
if (!syslog_open) {
|
||||
# ifdef LOG_DAEMON
|
||||
openlog(ProgramName, LOG_PID, FACILITY);
|
||||
# else
|
||||
openlog(ProgramName, LOG_PID);
|
||||
# endif
|
||||
syslog_open = TRUE; /* assume openlog success */
|
||||
}
|
||||
|
||||
syslog(err != 0 ? LOG_ERR : LOG_INFO,
|
||||
"(%s) %s (%s)%s%s", username, event, detail,
|
||||
err != 0 ? ": " : "", err != 0 ? strerror(err) : "");
|
||||
|
||||
|
||||
#endif /*SYSLOG*/
|
||||
#if DEBUGGING
|
||||
if (DebugFlags) {
|
||||
fprintf(stderr, "log_it: (%s %ld) %s (%s)%s%s\n",
|
||||
username, (long) pid, event, detail,
|
||||
err != 0 ? ": " : "", err != 0 ? strerror(err) : "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void log_close(void) {
|
||||
if (LogFD != ERR) {
|
||||
close(LogFD);
|
||||
LogFD = ERR;
|
||||
}
|
||||
#if defined(SYSLOG)
|
||||
closelog();
|
||||
syslog_open = FALSE;
|
||||
#endif /*SYSLOG*/
|
||||
}
|
||||
|
||||
/* char *first_word(char *s, char *t)
|
||||
* return pointer to first word
|
||||
* parameters:
|
||||
* s - string we want the first word of
|
||||
* t - terminators, implicitly including \0
|
||||
* warnings:
|
||||
* (1) this routine is fairly slow
|
||||
* (2) it returns a pointer to static storage
|
||||
*/
|
||||
char *first_word(char *s, char *t) {
|
||||
static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */
|
||||
static int retsel = 0;
|
||||
char *rb, *rp;
|
||||
|
||||
/* select a return buffer */
|
||||
retsel = 1 - retsel;
|
||||
rb = &retbuf[retsel][0];
|
||||
rp = rb;
|
||||
|
||||
/* skip any leading terminators */
|
||||
while (*s && (NULL != strchr(t, *s))) {
|
||||
s++;
|
||||
}
|
||||
|
||||
/* copy until next terminator or full buffer */
|
||||
while (*s && (NULL == strchr(t, *s)) && (rp < &rb[MAX_TEMPSTR])) {
|
||||
*rp++ = *s++;
|
||||
}
|
||||
|
||||
/* finish the return-string and return it */
|
||||
*rp = '\0';
|
||||
return (rb);
|
||||
}
|
||||
|
||||
/* warning:
|
||||
* heavily ascii-dependent.
|
||||
*/
|
||||
void mkprint(char *dst, unsigned char *src, int len) {
|
||||
/*
|
||||
* XXX
|
||||
* We know this routine can't overflow the dst buffer because mkprints()
|
||||
* allocated enough space for the worst case.
|
||||
*/
|
||||
while (len-- > 0) {
|
||||
unsigned char ch = *src++;
|
||||
|
||||
if (ch < ' ') { /* control character */
|
||||
*dst++ = '^';
|
||||
*dst++ = ch + '@';
|
||||
}
|
||||
else if (ch < 0177) { /* printable */
|
||||
*dst++ = ch;
|
||||
}
|
||||
else if (ch == 0177) { /* delete/rubout */
|
||||
*dst++ = '^';
|
||||
*dst++ = '?';
|
||||
}
|
||||
else { /* parity character */
|
||||
sprintf(dst, "\\%03o", ch);
|
||||
dst += 4;
|
||||
}
|
||||
}
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
/* warning:
|
||||
* returns a pointer to malloc'd storage, you must call free yourself.
|
||||
*/
|
||||
char *mkprints(unsigned char *src, unsigned int len) {
|
||||
char *dst = malloc(len * 4 + 1);
|
||||
|
||||
if (dst)
|
||||
mkprint(dst, src, len);
|
||||
|
||||
return (dst);
|
||||
}
|
||||
|
||||
#ifdef MAIL_DATE
|
||||
/* Sat, 27 Feb 1993 11:44:51 -0800 (CST)
|
||||
* 1234567890123456789012345678901234567
|
||||
*/
|
||||
char *arpadate(time_t *clock) {
|
||||
time_t t = clock ? *clock : time((TIME_T) 0);
|
||||
struct tm tm = *localtime(&t);
|
||||
long gmtoff = get_gmtoff(&t, &tm);
|
||||
int hours = gmtoff / SECONDS_PER_HOUR;
|
||||
int minutes =
|
||||
(gmtoff - (hours * SECONDS_PER_HOUR)) / SECONDS_PER_MINUTE;
|
||||
static char ret[64]; /* zone name might be >3 chars */
|
||||
|
||||
(void) sprintf(ret, "%s, %2d %s %2d %02d:%02d:%02d %.2d%.2d (%s)",
|
||||
DowNames[tm.tm_wday],
|
||||
tm.tm_mday,
|
||||
MonthNames[tm.tm_mon],
|
||||
tm.tm_year + 1900,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, hours, minutes, TZONE(tm));
|
||||
return (ret);
|
||||
}
|
||||
#endif /*MAIL_DATE */
|
||||
|
||||
#ifdef HAVE_SAVED_UIDS
|
||||
static uid_t save_euid;
|
||||
static gid_t save_egid;
|
||||
|
||||
int swap_uids(void) {
|
||||
save_egid = getegid();
|
||||
save_euid = geteuid();
|
||||
return ((setegid(getgid()) || seteuid(getuid()))? -1 : 0);
|
||||
}
|
||||
|
||||
int swap_uids_back(void) {
|
||||
return ((setegid(save_egid) || seteuid(save_euid)) ? -1 : 0);
|
||||
}
|
||||
|
||||
#else /*HAVE_SAVED_UIDS */
|
||||
|
||||
int swap_uids(void) {
|
||||
return ((setregid(getegid(), getgid())
|
||||
|| setreuid(geteuid(), getuid())) ? -1 : 0);
|
||||
}
|
||||
|
||||
int swap_uids_back(void) {
|
||||
return (swap_uids());
|
||||
}
|
||||
#endif /*HAVE_SAVED_UIDS */
|
||||
|
||||
size_t strlens(const char *last, ...) {
|
||||
va_list ap;
|
||||
size_t ret = 0;
|
||||
const char *str;
|
||||
|
||||
va_start(ap, last);
|
||||
for (str = last; str != NULL; str = va_arg(ap, const char *))
|
||||
ret += strlen(str);
|
||||
va_end(ap);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Return the offset from GMT in seconds (algorithm taken from sendmail).
|
||||
*
|
||||
* warning:
|
||||
* clobbers the static storage space used by localtime() and gmtime().
|
||||
* If the local pointer is non-NULL it *must* point to a local copy.
|
||||
*/
|
||||
#ifndef HAVE_STRUCT_TM_TM_GMTOFF
|
||||
long get_gmtoff(time_t * clock, struct tm *local) {
|
||||
struct tm gmt;
|
||||
long offset;
|
||||
|
||||
gmt = *gmtime(clock);
|
||||
if (local == NULL)
|
||||
local = localtime(clock);
|
||||
|
||||
offset = (local->tm_sec - gmt.tm_sec) +
|
||||
((local->tm_min - gmt.tm_min) * 60) +
|
||||
((local->tm_hour - gmt.tm_hour) * 3600);
|
||||
|
||||
/* Timezone may cause year rollover to happen on a different day. */
|
||||
if (local->tm_year < gmt.tm_year)
|
||||
offset -= 24 * 3600;
|
||||
else if (local->tm_year > gmt.tm_year)
|
||||
offset += 24 * 3600;
|
||||
else if (local->tm_yday < gmt.tm_yday)
|
||||
offset -= 24 * 3600;
|
||||
else if (local->tm_yday > gmt.tm_yday)
|
||||
offset += 24 * 3600;
|
||||
|
||||
return (offset);
|
||||
}
|
||||
#endif /* HAVE_STRUCT_TM_TM_GMTOFF */
|
73
cronie-1.4.6/src/pathnames.h
Normal file
73
cronie-1.4.6/src/pathnames.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* Copyright 1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: pathnames.h,v 1.9 2004/01/23 18:56:43 vixie Exp $
|
||||
*/
|
||||
|
||||
#ifndef _PATHNAMES_H_
|
||||
#define _PATHNAMES_H_
|
||||
|
||||
#if (defined(BSD)) && (BSD >= 199103) || defined(__linux) || defined(AIX)
|
||||
# include <paths.h>
|
||||
#endif /*BSD*/
|
||||
|
||||
#include "cron-paths.h"
|
||||
|
||||
/* where should the daemon stick its PID?
|
||||
* PIDDIR must end in '/'.
|
||||
* (Don't ask why the default is "/etc/".)
|
||||
*/
|
||||
#ifdef _PATH_VARRUN
|
||||
# define PIDDIR _PATH_VARRUN
|
||||
#else
|
||||
# define PIDDIR SYSCONFDIR "/"
|
||||
#endif
|
||||
#define PIDFILE "crond.pid"
|
||||
#define _PATH_CRON_PID PIDDIR PIDFILE
|
||||
#define REBOOT_LOCK PIDDIR "cron.reboot"
|
||||
|
||||
/* what editor to use if no EDITOR or VISUAL
|
||||
* environment variable specified.
|
||||
*/
|
||||
#if defined(_PATH_VI)
|
||||
# define EDITOR _PATH_VI
|
||||
#else
|
||||
# define EDITOR "/usr/ucb/vi"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_BSHELL
|
||||
# define _PATH_BSHELL "/bin/sh"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_DEFPATH
|
||||
# define _PATH_DEFPATH "/usr/bin:/bin"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_TMP
|
||||
# define _PATH_TMP "/tmp"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_DEVNULL
|
||||
# define _PATH_DEVNULL "/dev/null"
|
||||
#endif
|
||||
|
||||
#endif /* _PATHNAMES_H_ */
|
156
cronie-1.4.6/src/popen.c
Normal file
156
cronie-1.4.6/src/popen.c
Normal file
|
@ -0,0 +1,156 @@
|
|||
/* $NetBSD: popen.c,v 1.9 2005/03/16 02:53:55 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software written by Ken Arnold and
|
||||
* published in UNIX Review, Vol. 6, No. 8.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SYS_CDEFS_H
|
||||
# include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#include <cron.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
* Special version of popen which avoids call to shell. This insures noone
|
||||
* may create a pipe to a hidden program as a side effect of a list or dir
|
||||
* command.
|
||||
*/
|
||||
static PID_T *pids;
|
||||
static int fds;
|
||||
|
||||
#define MAX_ARGS 1024
|
||||
|
||||
FILE *cron_popen(char *program, const char *type, struct passwd *pw) {
|
||||
char *cp;
|
||||
FILE *iop;
|
||||
int argc, pdes[2];
|
||||
PID_T pid;
|
||||
char *argv[MAX_ARGS];
|
||||
ssize_t out;
|
||||
char buf[PIPE_BUF];
|
||||
|
||||
#ifdef __GNUC__
|
||||
(void) &iop; /* Avoid fork clobbering */
|
||||
#endif
|
||||
|
||||
if ((*type != 'r' && *type != 'w') || type[1])
|
||||
return (NULL);
|
||||
|
||||
if (!pids) {
|
||||
if ((fds = getdtablesize()) <= 0)
|
||||
return (NULL);
|
||||
if (!(pids = (PID_T *) malloc((u_int) (fds * sizeof (PID_T)))))
|
||||
return (NULL);
|
||||
bzero((char *) pids, fds * sizeof (PID_T));
|
||||
}
|
||||
if (pipe(pdes) < 0)
|
||||
return (NULL);
|
||||
|
||||
/* break up string into pieces */
|
||||
for (argc = 0, cp = program; argc < MAX_ARGS; cp = NULL)
|
||||
if (!(argv[argc++] = strtok(cp, " \t\n")))
|
||||
break;
|
||||
|
||||
iop = NULL;
|
||||
switch (pid = fork()) {
|
||||
case -1: /* error */
|
||||
(void) close(pdes[0]);
|
||||
(void) close(pdes[1]);
|
||||
goto pfree;
|
||||
/* NOTREACHED */
|
||||
case 0: /* child */
|
||||
if (*type == 'r') {
|
||||
if (pdes[1] != STDOUT) {
|
||||
dup2(pdes[1], STDOUT);
|
||||
dup2(pdes[1], STDERR); /* stderr, too! */
|
||||
(void) close(pdes[1]);
|
||||
}
|
||||
(void) close(pdes[0]);
|
||||
}
|
||||
else {
|
||||
if (pdes[0] != STDIN) {
|
||||
dup2(pdes[0], STDIN);
|
||||
(void) close(pdes[0]);
|
||||
}
|
||||
(void) close(pdes[1]);
|
||||
}
|
||||
|
||||
if (execvp(argv[0], argv) < 0) {
|
||||
int save_errno = errno;
|
||||
|
||||
log_it("CRON", getpid(), "EXEC FAILED", program, save_errno);
|
||||
if (*type != 'r') {
|
||||
while (0 != (out = read(STDIN, buf, PIPE_BUF))) {
|
||||
if ((out == -1) && (errno != EINTR))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_exit(1);
|
||||
}
|
||||
/* parent; assume fdopen can't fail... */
|
||||
if (*type == 'r') {
|
||||
iop = fdopen(pdes[0], type);
|
||||
(void) close(pdes[1]);
|
||||
}
|
||||
else {
|
||||
iop = fdopen(pdes[1], type);
|
||||
(void) close(pdes[0]);
|
||||
}
|
||||
pids[fileno(iop)] = pid;
|
||||
|
||||
pfree:
|
||||
return (iop);
|
||||
}
|
||||
|
||||
int cron_pclose(FILE * iop) {
|
||||
int fdes;
|
||||
sigset_t oset, nset;
|
||||
WAIT_T stat_loc;
|
||||
PID_T pid;
|
||||
|
||||
/*
|
||||
* pclose returns -1 if stream is not associated with a
|
||||
* `popened' command, or, if already `pclosed'.
|
||||
*/
|
||||
if (pids == 0 || pids[fdes = fileno(iop)] == 0)
|
||||
return (-1);
|
||||
(void) fclose(iop);
|
||||
|
||||
sigemptyset(&nset);
|
||||
sigaddset(&nset, SIGINT);
|
||||
sigaddset(&nset, SIGQUIT);
|
||||
sigaddset(&nset, SIGHUP);
|
||||
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
|
||||
while ((pid = wait(&stat_loc)) != pids[fdes] && pid != -1) ;
|
||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
pids[fdes] = 0;
|
||||
return (pid == -1 ? -1 : WEXITSTATUS(stat_loc));
|
||||
}
|
123
cronie-1.4.6/src/pw_dup.c
Normal file
123
cronie-1.4.6/src/pw_dup.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (c) 2000,2002 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
|
||||
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#if !defined(OpenBSD) || OpenBSD < 200105
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
struct passwd *
|
||||
pw_dup(const struct passwd *pw) {
|
||||
char *cp;
|
||||
size_t nsize=0, psize=0, gsize=0, dsize=0, ssize=0, total=0;
|
||||
struct passwd *newpw;
|
||||
|
||||
/* Allocate in one big chunk for easy freeing */
|
||||
total = sizeof(struct passwd);
|
||||
if (pw->pw_name) {
|
||||
nsize = strlen(pw->pw_name) + 1;
|
||||
total += nsize;
|
||||
}
|
||||
if (pw->pw_passwd) {
|
||||
psize = strlen(pw->pw_passwd) + 1;
|
||||
total += psize;
|
||||
}
|
||||
#ifdef LOGIN_CAP
|
||||
if (pw->pw_class) {
|
||||
csize = strlen(pw->pw_class) + 1;
|
||||
total += csize;
|
||||
}
|
||||
#endif /* LOGIN_CAP */
|
||||
if (pw->pw_gecos) {
|
||||
gsize = strlen(pw->pw_gecos) + 1;
|
||||
total += gsize;
|
||||
}
|
||||
if (pw->pw_dir) {
|
||||
dsize = strlen(pw->pw_dir) + 1;
|
||||
total += dsize;
|
||||
}
|
||||
if (pw->pw_shell) {
|
||||
ssize = strlen(pw->pw_shell) + 1;
|
||||
total += ssize;
|
||||
}
|
||||
if ((cp = malloc(total)) == NULL)
|
||||
return (NULL);
|
||||
newpw = (struct passwd *)cp;
|
||||
|
||||
/*
|
||||
* Copy in passwd contents and make strings relative to space
|
||||
* at the end of the buffer.
|
||||
*/
|
||||
(void)memcpy(newpw, pw, sizeof(struct passwd));
|
||||
cp += sizeof(struct passwd);
|
||||
if (pw->pw_name) {
|
||||
(void)memcpy(cp, pw->pw_name, nsize);
|
||||
newpw->pw_name = cp;
|
||||
cp += nsize;
|
||||
}
|
||||
if (pw->pw_passwd) {
|
||||
(void)memcpy(cp, pw->pw_passwd, psize);
|
||||
newpw->pw_passwd = cp;
|
||||
cp += psize;
|
||||
}
|
||||
#ifdef LOGIN_CAP
|
||||
if (pw->pw_class) {
|
||||
(void)memcpy(cp, pw->pw_class, csize);
|
||||
newpw->pw_class = cp;
|
||||
cp += csize;
|
||||
}
|
||||
#endif /* LOGIN_CAP */
|
||||
if (pw->pw_gecos) {
|
||||
(void)memcpy(cp, pw->pw_gecos, gsize);
|
||||
newpw->pw_gecos = cp;
|
||||
cp += gsize;
|
||||
}
|
||||
if (pw->pw_dir) {
|
||||
(void)memcpy(cp, pw->pw_dir, dsize);
|
||||
newpw->pw_dir = cp;
|
||||
cp += dsize;
|
||||
}
|
||||
if (pw->pw_shell) {
|
||||
(void)memcpy(cp, pw->pw_shell, ssize);
|
||||
newpw->pw_shell = cp;
|
||||
cp += ssize;
|
||||
}
|
||||
|
||||
return (newpw);
|
||||
}
|
||||
|
||||
#endif /* !OpenBSD || OpenBSD < 200105 */
|
574
cronie-1.4.6/src/security.c
Normal file
574
cronie-1.4.6/src/security.c
Normal file
|
@ -0,0 +1,574 @@
|
|||
/* security.c
|
||||
*
|
||||
* Implement Red Hat crond security context transitions
|
||||
*
|
||||
* Jason Vas Dias <jvdias@redhat.com> January 2006
|
||||
*
|
||||
* Copyright(C) Red Hat Inc., 2006
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
# include <selinux/selinux.h>
|
||||
# include <selinux/context.h>
|
||||
# include <selinux/flask.h>
|
||||
# include <selinux/av_permissions.h>
|
||||
# include <selinux/get_context_list.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_AUDIT
|
||||
# include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PAM
|
||||
static pam_handle_t *pamh = NULL;
|
||||
static int pam_session_opened = 0; //global for open session
|
||||
|
||||
static int
|
||||
cron_conv(int num_msg, const struct pam_message **msgm,
|
||||
struct pam_response **response, void *appdata_ptr)
|
||||
{
|
||||
struct pam_message**m = msgm;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_msg; i++) {
|
||||
switch (m[i]->msg_style) {
|
||||
case PAM_ERROR_MSG:
|
||||
case PAM_TEXT_INFO:
|
||||
if (m[i]->msg != NULL) {
|
||||
log_it("CRON", getpid(), "pam_message", m[i]->msg, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static const struct pam_conv conv = {
|
||||
cron_conv, NULL
|
||||
};
|
||||
|
||||
static int cron_open_pam_session(struct passwd *pw);
|
||||
|
||||
# define PAM_FAIL_CHECK if (retcode != PAM_SUCCESS) { \
|
||||
fprintf(stderr,"\n%s\n",pam_strerror(pamh, retcode)); \
|
||||
if (pamh != NULL) { \
|
||||
if (pam_session_opened != 0) \
|
||||
pam_close_session(pamh, PAM_SILENT); \
|
||||
pam_end(pamh, retcode); \
|
||||
} \
|
||||
return(retcode); }
|
||||
#endif
|
||||
|
||||
static char **build_env(char **cronenv);
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
static int cron_change_selinux_range(user * u, security_context_t ucontext);
|
||||
static int cron_get_job_range(user * u, security_context_t * ucontextp,
|
||||
char **jobenv);
|
||||
#endif
|
||||
|
||||
void cron_restore_default_security_context() {
|
||||
#ifdef WITH_SELINUX
|
||||
setexeccon(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cron_set_job_security_context(entry * e, user * u, char ***jobenv) {
|
||||
time_t minutely_time = 0;
|
||||
#ifdef WITH_PAM
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
if ((e->flags & MIN_STAR) == MIN_STAR) {
|
||||
/* "minute-ly" job: Every minute for given hour/dow/month/dom.
|
||||
* Ensure that these jobs never run in the same minute:
|
||||
*/
|
||||
minutely_time = time(0);
|
||||
Debug(DSCH, ("Minute-ly job. Recording time %lu\n", minutely_time))
|
||||
}
|
||||
|
||||
#ifdef WITH_PAM
|
||||
if ((ret = cron_start_pam(e->pwd)) != 0) {
|
||||
log_it(e->pwd->pw_name, getpid(), "FAILED to authorize user with PAM",
|
||||
pam_strerror(pamh, ret), 0);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
*jobenv = build_env(e->envp);
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
/* we must get the crontab context BEFORE changing user, else
|
||||
* we'll not be permitted to read the cron spool directory :-)
|
||||
*/
|
||||
security_context_t ucontext = 0;
|
||||
|
||||
if (cron_get_job_range(u, &ucontext, *jobenv) < OK) {
|
||||
log_it(e->pwd->pw_name, getpid(), "ERROR",
|
||||
"failed to get SELinux context", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cron_change_selinux_range(u, ucontext) != 0) {
|
||||
log_it(e->pwd->pw_name, getpid(), "ERROR",
|
||||
"failed to change SELinux context", 0);
|
||||
if (ucontext)
|
||||
freecon(ucontext);
|
||||
return -1;
|
||||
}
|
||||
if (ucontext)
|
||||
freecon(ucontext);
|
||||
#endif
|
||||
#ifdef WITH_PAM
|
||||
if ((ret = cron_open_pam_session(e->pwd)) != 0) {
|
||||
log_it(e->pwd->pw_name, getpid(),
|
||||
"FAILED to open PAM security session", pam_strerror(pamh, ret), 0);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cron_change_user(e->pwd) != 0) {
|
||||
log_it(e->pwd->pw_name, getpid(), "ERROR", "failed to change user", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_close();
|
||||
|
||||
time_t job_run_time = time(0L);
|
||||
|
||||
if ((minutely_time > 0) && ((job_run_time / 60) != (minutely_time / 60))) {
|
||||
/* if a per-minute job is delayed into the next minute
|
||||
* (eg. by network authentication method timeouts), skip it.
|
||||
*/
|
||||
struct tm tmS, tmN;
|
||||
char buf[256];
|
||||
|
||||
localtime_r(&job_run_time, &tmN);
|
||||
localtime_r(&minutely_time, &tmS);
|
||||
|
||||
snprintf(buf, sizeof (buf),
|
||||
"Job execution of per-minute job scheduled for "
|
||||
"%.2u:%.2u delayed into subsequent minute %.2u:%.2u. Skipping job run.",
|
||||
tmS.tm_hour, tmS.tm_min, tmN.tm_hour, tmN.tm_min);
|
||||
log_it(e->pwd->pw_name, getpid(), "INFO", buf, 0);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cron_start_pam(struct passwd *pw) {
|
||||
int retcode = 0;
|
||||
|
||||
#if defined(WITH_PAM)
|
||||
retcode = pam_start("crond", pw->pw_name, &conv, &pamh);
|
||||
PAM_FAIL_CHECK;
|
||||
retcode = pam_set_item(pamh, PAM_TTY, "cron");
|
||||
PAM_FAIL_CHECK;
|
||||
retcode = pam_acct_mgmt(pamh, PAM_SILENT);
|
||||
PAM_FAIL_CHECK;
|
||||
retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
|
||||
PAM_FAIL_CHECK;
|
||||
#endif
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
static int cron_open_pam_session(struct passwd *pw) {
|
||||
int retcode = 0;
|
||||
|
||||
#if defined(WITH_PAM)
|
||||
retcode = pam_open_session(pamh, PAM_SILENT);
|
||||
PAM_FAIL_CHECK;
|
||||
if (retcode == PAM_SUCCESS)
|
||||
pam_session_opened = 1;
|
||||
#endif
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
void cron_close_pam(void) {
|
||||
#if defined(WITH_PAM)
|
||||
if (pam_session_opened != 0) {
|
||||
pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
|
||||
pam_close_session(pamh, PAM_SILENT);
|
||||
}
|
||||
pam_end(pamh, PAM_SUCCESS);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cron_change_user(struct passwd *pw) {
|
||||
pid_t pid = getpid();
|
||||
/* set our directory, uid and gid. Set gid first, since once
|
||||
* we set uid, we've lost root privledges.
|
||||
*/
|
||||
if (setgid(pw->pw_gid) != 0) {
|
||||
log_it("CRON", pid, "ERROR", "setgid failed", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (initgroups(pw->pw_name, pw->pw_gid) != 0) {
|
||||
log_it("CRON", pid, "ERROR", "initgroups failed", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setreuid(pw->pw_uid, -1) != 0) {
|
||||
log_it("CRON", pid, "ERROR", "setreuid failed", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cron_change_user_permanently(struct passwd *pw, char *homedir) {
|
||||
if (setreuid(pw->pw_uid, pw->pw_uid) != 0) {
|
||||
log_it("CRON", getpid(), "ERROR", "setreuid failed", errno);
|
||||
return -1;
|
||||
}
|
||||
if (chdir(homedir) == -1) {
|
||||
log_it("CRON", getpid(), "ERROR chdir failed", homedir, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int cron_authorize_context(security_context_t scontext,
|
||||
security_context_t file_context) {
|
||||
#ifdef WITH_SELINUX
|
||||
struct av_decision avd;
|
||||
int retval;
|
||||
unsigned int bit = FILE__ENTRYPOINT;
|
||||
/*
|
||||
* Since crontab files are not directly executed,
|
||||
* crond must ensure that the crontab file has
|
||||
* a context that is appropriate for the context of
|
||||
* the user cron job. It performs an entrypoint
|
||||
* permission check for this purpose.
|
||||
*/
|
||||
retval = security_compute_av(scontext, file_context,
|
||||
SECCLASS_FILE, bit, &avd);
|
||||
if (retval || ((bit & avd.allowed) != bit))
|
||||
return 0;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cron_authorize_range(security_context_t scontext,
|
||||
security_context_t ucontext) {
|
||||
#ifdef WITH_SELINUX
|
||||
struct av_decision avd;
|
||||
int retval;
|
||||
unsigned int bit = CONTEXT__CONTAINS;
|
||||
/*
|
||||
* Since crontab files are not directly executed,
|
||||
* so crond must ensure that any user specified range
|
||||
* falls within the seusers-specified range for that Linux user.
|
||||
*/
|
||||
retval = security_compute_av(scontext, ucontext,
|
||||
SECCLASS_CONTEXT, bit, &avd);
|
||||
|
||||
if (retval || ((bit & avd.allowed) != bit))
|
||||
return 0;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if WITH_SELINUX
|
||||
/* always uses u->scontext as the default process context, then changes the
|
||||
level, and retuns it in ucontextp (or NULL otherwise) */
|
||||
static int
|
||||
cron_get_job_range(user * u, security_context_t * ucontextp, char **jobenv) {
|
||||
char *range;
|
||||
|
||||
if (is_selinux_enabled() <= 0)
|
||||
return 0;
|
||||
if (ucontextp == 0L)
|
||||
return -1;
|
||||
|
||||
*ucontextp = 0L;
|
||||
|
||||
if ((range = env_get("MLS_LEVEL", jobenv)) != 0L) {
|
||||
context_t ccon;
|
||||
if (!(ccon = context_new(u->scontext))) {
|
||||
log_it(u->name, getpid(), "context_new FAILED for MLS_LEVEL",
|
||||
range, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (context_range_set(ccon, range)) {
|
||||
log_it(u->name, getpid(),
|
||||
"context_range_set FAILED for MLS_LEVEL", range, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(*ucontextp = context_str(ccon))) {
|
||||
log_it(u->name, getpid(), "context_str FAILED for MLS_LEVEL",
|
||||
range, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(*ucontextp = strdup(*ucontextp))) {
|
||||
log_it(u->name, getpid(), "strdup FAILED for MLS_LEVEL", range, 0);
|
||||
return -1;
|
||||
}
|
||||
context_free(ccon);
|
||||
}
|
||||
else if (!u->scontext) {
|
||||
/* cron_change_selinux_range() deals with this */
|
||||
return 0;
|
||||
}
|
||||
else if (!(*ucontextp = strdup(u->scontext))) {
|
||||
log_it(u->name, getpid(), "strdup FAILED for MLS_LEVEL", range, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
static int cron_change_selinux_range(user * u, security_context_t ucontext) {
|
||||
char *msg = NULL;
|
||||
|
||||
if (is_selinux_enabled() <= 0)
|
||||
return 0;
|
||||
|
||||
if (u->scontext == 0L) {
|
||||
if (security_getenforce() > 0) {
|
||||
log_it(u->name, getpid(), "NULL security context for user", "", 0);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
log_it(u->name, getpid(),
|
||||
"NULL security context for user, "
|
||||
"but SELinux in permissive mode, continuing", "", 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(u->scontext, ucontext)) {
|
||||
if (!cron_authorize_range(u->scontext, ucontext)) {
|
||||
if (security_getenforce() > 0) {
|
||||
# ifdef WITH_AUDIT
|
||||
if (asprintf(&msg,
|
||||
"cron: Unauthorized MLS range acct=%s new_scontext=%s old_scontext=%s",
|
||||
u->name, (char *) ucontext, u->scontext) >= 0) {
|
||||
int audit_fd = audit_open();
|
||||
audit_log_user_message(audit_fd, AUDIT_USER_ROLE_CHANGE,
|
||||
msg, NULL, NULL, NULL, 0);
|
||||
close(audit_fd);
|
||||
free(msg);
|
||||
}
|
||||
# endif
|
||||
if (asprintf
|
||||
(&msg, "Unauthorized range in %s for user range in %s",
|
||||
(char *) ucontext, u->scontext) >= 0) {
|
||||
log_it(u->name, getpid(), "ERROR", msg, 0);
|
||||
free(msg);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if (asprintf
|
||||
(&msg,
|
||||
"Unauthorized range in %s for user range in %s,"
|
||||
" but SELinux in permissive mod, continuing",
|
||||
(char *) ucontext, u->scontext) >= 0) {
|
||||
log_it(u->name, getpid(), "WARNING", msg, 0);
|
||||
free(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (setexeccon(ucontext) < 0 || setkeycreatecon(ucontext) < 0) {
|
||||
if (security_getenforce() > 0) {
|
||||
if (asprintf
|
||||
(&msg, "Could not set exec or keycreate context to %s for user",
|
||||
(char *) ucontext) >= 0) {
|
||||
log_it(u->name, getpid(), "ERROR", msg, 0);
|
||||
free(msg);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if (asprintf
|
||||
(&msg,
|
||||
"Could not set exec or keycreate context to %s for user,"
|
||||
" but SELinux in permissive mode, continuing",
|
||||
(char *) ucontext) >= 0) {
|
||||
log_it(u->name, getpid(), "WARNING", msg, 0);
|
||||
free(msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
get_security_context(const char *name, int crontab_fd,
|
||||
security_context_t * rcontext, const char *tabname) {
|
||||
#ifdef WITH_SELINUX
|
||||
security_context_t scontext = NULL;
|
||||
security_context_t file_context = NULL;
|
||||
int retval = 0;
|
||||
char *seuser = NULL;
|
||||
char *level = NULL;
|
||||
|
||||
*rcontext = NULL;
|
||||
|
||||
if (is_selinux_enabled() <= 0)
|
||||
return 0;
|
||||
|
||||
if (name != NULL) {
|
||||
if (getseuserbyname(name, &seuser, &level) < 0) {
|
||||
log_it(name, getpid(), "getseuserbyname FAILED", name, 0);
|
||||
return (security_getenforce() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
retval = get_default_context_with_level(name == NULL ? "system_u" : seuser,
|
||||
level, NULL, &scontext);
|
||||
free(seuser);
|
||||
free(level);
|
||||
if (retval) {
|
||||
if (security_getenforce() > 0) {
|
||||
log_it(name, getpid(), "No SELinux security context", tabname, 0);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
log_it(name, getpid(),
|
||||
"No security context but SELinux in permissive mode, continuing",
|
||||
tabname, 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (fgetfilecon(crontab_fd, &file_context) < OK) {
|
||||
if (security_getenforce() > 0) {
|
||||
log_it(name, getpid(), "getfilecon FAILED", tabname, 0);
|
||||
freecon(scontext);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
log_it(name, getpid(),
|
||||
"getfilecon FAILED but SELinux in permissive mode, continuing",
|
||||
tabname, 0);
|
||||
*rcontext = scontext;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cron_authorize_context(scontext, file_context)) {
|
||||
freecon(scontext);
|
||||
freecon(file_context);
|
||||
if (security_getenforce() > 0) {
|
||||
log_it(name, getpid(), "Unauthorized SELinux context", tabname, 0);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
log_it(name, getpid(),
|
||||
"Unauthorized SELinux context, but SELinux in permissive mode, continuing",
|
||||
tabname, 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
freecon(file_context);
|
||||
|
||||
*rcontext = scontext;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free_security_context(security_context_t * scontext) {
|
||||
#ifdef WITH_SELINUX
|
||||
if (*scontext != NULL) {
|
||||
freecon(*scontext);
|
||||
*scontext = 0L;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int crontab_security_access(void) {
|
||||
#ifdef WITH_SELINUX
|
||||
int selinux_check_passwd_access = -1;
|
||||
if (is_selinux_enabled() > 0) {
|
||||
security_context_t user_context;
|
||||
if (getprevcon_raw(&user_context) == 0) {
|
||||
security_class_t passwd_class;
|
||||
struct av_decision avd;
|
||||
int retval;
|
||||
|
||||
passwd_class = string_to_security_class("passwd");
|
||||
if (passwd_class == 0) {
|
||||
selinux_check_passwd_access = -1;
|
||||
fprintf(stderr, "Security class \"passwd\" is not defined in the SELinux policy.\n");
|
||||
}
|
||||
|
||||
retval = security_compute_av_raw(user_context,
|
||||
user_context,
|
||||
passwd_class,
|
||||
PASSWD__CRONTAB,
|
||||
&avd);
|
||||
|
||||
if ((retval == 0) && ((PASSWD__CRONTAB & avd.allowed) == PASSWD__CRONTAB)) {
|
||||
selinux_check_passwd_access = 0;
|
||||
}
|
||||
freecon(user_context);
|
||||
}
|
||||
|
||||
if (selinux_check_passwd_access != 0 && security_getenforce() == 0)
|
||||
selinux_check_passwd_access = 0;
|
||||
|
||||
return selinux_check_passwd_access;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Build up the job environment from the PAM environment plus the
|
||||
* crontab environment
|
||||
*/
|
||||
static char **build_env(char **cronenv) {
|
||||
#ifdef WITH_PAM
|
||||
char **jobenv = cronenv;
|
||||
char **pamenv = pam_getenvlist(pamh);
|
||||
char *cronvar;
|
||||
int count = 0;
|
||||
jobenv = env_copy(pamenv);
|
||||
|
||||
/* Now add the cron environment variables. Since env_set()
|
||||
* overwrites existing variables, this will let cron's
|
||||
* environment settings override pam's */
|
||||
|
||||
while ((cronvar = cronenv[count++])) {
|
||||
if (!(jobenv = env_set(jobenv, cronvar))) {
|
||||
log_it("CRON", getpid(),
|
||||
"Setting Cron environment variable failed", cronvar, 0);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return jobenv;
|
||||
#else
|
||||
return env_copy(cronenv);
|
||||
#endif
|
||||
}
|
70
cronie-1.4.6/src/structs.h
Normal file
70
cronie-1.4.6/src/structs.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* $Id: structs.h,v 1.7 2004/01/23 18:56:43 vixie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
typedef struct _entry {
|
||||
struct _entry *next;
|
||||
struct passwd *pwd;
|
||||
char **envp;
|
||||
char *cmd;
|
||||
bitstr_t bit_decl(minute, MINUTE_COUNT);
|
||||
bitstr_t bit_decl(hour, HOUR_COUNT);
|
||||
bitstr_t bit_decl(dom, DOM_COUNT);
|
||||
bitstr_t bit_decl(month, MONTH_COUNT);
|
||||
bitstr_t bit_decl(dow, DOW_COUNT);
|
||||
int flags;
|
||||
#define MIN_STAR 0x01
|
||||
#define HR_STAR 0x02
|
||||
#define DOM_STAR 0x04
|
||||
#define DOW_STAR 0x08
|
||||
#define WHEN_REBOOT 0x10
|
||||
#define DONT_LOG 0x20
|
||||
} entry;
|
||||
|
||||
/* the crontab database will be a list of the
|
||||
* following structure, one element per user
|
||||
* plus one for the system.
|
||||
*
|
||||
* These are the crontabs.
|
||||
*/
|
||||
#ifndef WITH_SELINUX
|
||||
#define security_context_t unsigned
|
||||
#endif
|
||||
|
||||
typedef struct _user {
|
||||
struct _user *next, *prev; /* links */
|
||||
char *name;
|
||||
char *tabname; /* /etc/cron.d/ file name or NULL */
|
||||
time_t mtime; /* last modtime of crontab */
|
||||
entry *crontab; /* this person's crontab */
|
||||
security_context_t scontext; /* SELinux security context */
|
||||
} user;
|
||||
|
||||
typedef struct _cron_db {
|
||||
user *head, *tail; /* links */
|
||||
time_t mtime; /* last modtime on spooldir */
|
||||
#ifdef WITH_INOTIFY
|
||||
int ifd;
|
||||
#endif
|
||||
} cron_db;
|
||||
/* in the C tradition, we only create
|
||||
* variables for the main program, just
|
||||
* extern them elsewhere.
|
||||
*/
|
132
cronie-1.4.6/src/user.c
Normal file
132
cronie-1.4.6/src/user.c
Normal file
|
@ -0,0 +1,132 @@
|
|||
/* Copyright 1988,1990,1993,1994 by Paul Vixie
|
||||
* All rights reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* vix 26jan87 [log is in RCS file]
|
||||
*/
|
||||
|
||||
#include <cron.h>
|
||||
|
||||
static const char *FileName;
|
||||
|
||||
static void
|
||||
log_error (const char *msg)
|
||||
{
|
||||
log_it ("CRON", getpid (), msg, FileName, 0);
|
||||
}
|
||||
|
||||
void
|
||||
free_user (user * u) {
|
||||
entry *e, *ne;
|
||||
|
||||
free(u->name);
|
||||
free(u->tabname);
|
||||
for (e = u->crontab; e != NULL; e = ne) {
|
||||
ne = e->next;
|
||||
free_entry(e);
|
||||
}
|
||||
free_security_context(&(u->scontext));
|
||||
free(u);
|
||||
}
|
||||
|
||||
user *
|
||||
load_user (int crontab_fd, struct passwd *pw, const char *uname,
|
||||
const char *fname, const char *tabname) {
|
||||
char envstr[MAX_ENVSTR];
|
||||
FILE *file;
|
||||
user *u;
|
||||
entry *e;
|
||||
int status, save_errno;
|
||||
char **envp, **tenvp;
|
||||
|
||||
if (!(file = fdopen(crontab_fd, "r"))) {
|
||||
int save_errno = errno;
|
||||
log_it(uname, getpid (), "FAILED", "fdopen on crontab_fd in load_user",
|
||||
save_errno);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Debug(DPARS, ("load_user()\n"))
|
||||
/* file is open. build user entry, then read the crontab file.
|
||||
*/
|
||||
if ((u = (user *) malloc (sizeof (user))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (((u->name = strdup(fname)) == NULL)
|
||||
|| ((u->tabname = strdup(tabname)) == NULL)) {
|
||||
save_errno = errno;
|
||||
free(u);
|
||||
errno = save_errno;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
u->crontab = NULL;
|
||||
|
||||
/* init environment. this will be copied/augmented for each entry.
|
||||
*/
|
||||
if ((envp = env_init()) == NULL) {
|
||||
save_errno = errno;
|
||||
free(u->name);
|
||||
free(u);
|
||||
errno = save_errno;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (get_security_context(pw == NULL ? NULL : uname,
|
||||
crontab_fd, &u->scontext, tabname) != 0) {
|
||||
free_user (u);
|
||||
u = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load the crontab
|
||||
*/
|
||||
while ((status = load_env (envstr, file)) >= OK) {
|
||||
switch (status) {
|
||||
case ERR:
|
||||
free_user(u);
|
||||
u = NULL;
|
||||
goto done;
|
||||
case FALSE:
|
||||
FileName = tabname;
|
||||
e = load_entry(file, log_error, pw, envp);
|
||||
if (e) {
|
||||
e->next = u->crontab;
|
||||
u->crontab = e;
|
||||
}
|
||||
break;
|
||||
case TRUE:
|
||||
if ((tenvp = env_set (envp, envstr)) == NULL) {
|
||||
save_errno = errno;
|
||||
free_user(u);
|
||||
u = NULL;
|
||||
errno = save_errno;
|
||||
goto done;
|
||||
}
|
||||
envp = tenvp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
env_free(envp);
|
||||
fclose(file);
|
||||
Debug(DPARS, ("...load_user() done\n")) return (u);
|
||||
}
|
16
wt-3.1.7a/AUTHORS
Normal file
16
wt-3.1.7a/AUTHORS
Normal file
|
@ -0,0 +1,16 @@
|
|||
Wt is being developed jointly by the following authors:
|
||||
|
||||
* Koen Deforche (koen@emweb.be)
|
||||
Main developer
|
||||
|
||||
* Wim Dumon (wim@emweb.be)
|
||||
Windows port, hangman example, and tutorial.
|
||||
|
||||
The following people contributed code in the past, but this code is no longer
|
||||
part of Wt:
|
||||
|
||||
* Abdiel Janulgue (xynopsis@yahoo.com)
|
||||
Contributed XLObject (template based signal/slot system), which has
|
||||
been replaced by a Boost.Signals-based signal/slot system
|
||||
|
||||
Many people have contributed patches and bug fixes, see the Changelog
|
399
wt-3.1.7a/CMakeLists.txt
Normal file
399
wt-3.1.7a/CMakeLists.txt
Normal file
|
@ -0,0 +1,399 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE true)
|
||||
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0002 OLD)
|
||||
CMAKE_POLICY(SET CMP0003 OLD)
|
||||
CMAKE_POLICY(SET CMP0005 OLD)
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
|
||||
PROJECT(WT)
|
||||
SET(CMAKE_MODULE_PATH ${WT_SOURCE_DIR} ${WT_SOURCE_DIR}/cmake)
|
||||
|
||||
SET(VERSION_SERIES 3)
|
||||
SET(VERSION_MAJOR 1)
|
||||
SET(VERSION_MINOR 7a)
|
||||
|
||||
SET(WT_SOVERSION 26)
|
||||
SET(WTEXT_SOVERSION 26)
|
||||
SET(WTHTTP_SOVERSION 26)
|
||||
SET(WTFCGI_SOVERSION 26)
|
||||
SET(WTISAPI_SOVERSION 4)
|
||||
SET(WTDBO_SOVERSION 26)
|
||||
SET(WTDBOSQLITE3_SOVERSION 26)
|
||||
SET(WTDBOPOSTGRES_SOVERSION 26)
|
||||
|
||||
#
|
||||
# Ubuntu patched this compiler to hell
|
||||
# gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
|
||||
#
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
ARGS --version
|
||||
OUTPUT_VARIABLE GCC_COMPILER_VERSION
|
||||
)
|
||||
|
||||
IF(GCC_COMPILER_VERSION MATCHES ".*4\\.4\\.4\\-14ubuntu5.*")
|
||||
MESSAGE(" ")
|
||||
MESSAGE(" !!!!! WARNING Your compiler is BUGGY. !!!!! ")
|
||||
MESSAGE(" ")
|
||||
MESSAGE(" If possible, upgrade your compiler to e.g. g++ 4.5:")
|
||||
MESSAGE(" ")
|
||||
MESSAGE(" $ sudo apt-get install g++-4.5")
|
||||
MESSAGE(" ")
|
||||
MESSAGE(" And build using that compiler cmake -DCMAKE_CXX_COMPILER=g++-4.5")
|
||||
MESSAGE(" ")
|
||||
MESSAGE(" We will now disable all assertions as a work around, by")
|
||||
MESSAGE(" building using -DNDEBUG. You will need to define this")
|
||||
MESSAGE(" also for programs built using Wt")
|
||||
MESSAGE(" ")
|
||||
ADD_DEFINITIONS(-DNDEBUG)
|
||||
ENDIF(GCC_COMPILER_VERSION MATCHES ".*4\\.4\\.4\\-14ubuntu5.*")
|
||||
|
||||
#
|
||||
# Various things that must be configured by the user or packager ...
|
||||
#
|
||||
OPTION(BUILD_EXAMPLES "Build examples" ON)
|
||||
OPTION(INSTALL_RESOURCES "Install resources directory" ON)
|
||||
OPTION(ENABLE_GM "Enable GraphicsMagick, for supporting painting to raster images (PNG, GIF, ...) (WRasterImage)" ON)
|
||||
OPTION(ENABLE_HARU "Enable Haru Free PDF Library, which is used to provide support for painting to PDF (WPdfImage)" ON)
|
||||
OPTION(ENABLE_EXT "Build Wt Ext library with JavaScript-only widgets (http://extjs.com/)" ON)
|
||||
OPTION(ENABLE_SQLITE "Build SQLite3 backend for Wt::Dbo" ON)
|
||||
OPTION(ENABLE_POSTGRES "Build PostgreSQL backend for Wt::Dbo" ON)
|
||||
OPTION(WT_NO_STD_LOCALE "Build Wt ro run on a system without std::locale support" OFF)
|
||||
OPTION(WT_NO_STD_WSTRING "Build Wt ro run on a system without std::wstring support" OFF)
|
||||
|
||||
IF(NOT SHARED_LIBS)
|
||||
IF(WIN32)
|
||||
OPTION(SHARED_LIBS "Compile shared libraries" OFF)
|
||||
ELSE(WIN32)
|
||||
OPTION(SHARED_LIBS "Compile shared libraries" ON)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT SHARED_LIBS)
|
||||
|
||||
IF(WIN32)
|
||||
IF(SHARED_LIBS)
|
||||
# See http://svn.boost.org/trac/boost/ticket/3465
|
||||
SET(WT_NO_BOOST_INTRUSIVE true)
|
||||
ENDIF(SHARED_LIBS)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Fixup Windows declspec stuff
|
||||
IF(NOT SHARED_LIBS)
|
||||
SET(WT_STATIC true)
|
||||
SET(WTHTTP_STATIC true)
|
||||
SET(WT_EXT_STATIC true)
|
||||
SET(WTDBO_STATIC true)
|
||||
SET(WTDBOSQLITE3_STATIC true)
|
||||
SET(WTDBOPOSTGRES_STATIC true)
|
||||
ENDIF(NOT SHARED_LIBS)
|
||||
|
||||
IF(NOT MULTI_THREADED)
|
||||
OPTION(MULTI_THREADED "Build multi-threaded httpd deamon (if possible)" ON)
|
||||
ENDIF(NOT MULTI_THREADED)
|
||||
|
||||
SET(BUILD_SHARED_LIBS ${SHARED_LIBS})
|
||||
|
||||
# Default is to use cmake's boost discovery. The default will use wt's own
|
||||
# boost detection mechanism if one of the following is true:
|
||||
# - cmake version is too old (prior to 2.6 series)
|
||||
# - BOOST_COMPILER or BOOST_VERSION was defined (compatibility with existing
|
||||
# build scripts)
|
||||
IF(DEFINED BOOST_COMPILER OR DEFINED BOOST_VERSION)
|
||||
SET(DEFAULT_WT_BOOST_DISCOVERY TRUE)
|
||||
ELSE(DEFINED BOOST_COMPILER OR DEFINED BOOST_VERSION)
|
||||
SET(DEFAULT_WT_BOOST_DISCOVERY FALSE)
|
||||
ENDIF(DEFINED BOOST_COMPILER OR DEFINED BOOST_VERSION)
|
||||
# There's no decent boost discovery prior to cmake 2.6
|
||||
IF(CMAKE_MAJOR_VERSION LESS 2)
|
||||
SET(DEFAULT_WT_BOOST_DISCOVERY TRUE)
|
||||
ELSEIF(CMAKE_MAJOR_VERSION EQUAL 2)
|
||||
IF(CMAKE_MINOR_VERSION LESS 6)
|
||||
SET(DEFAULT_WT_BOOST_DISCOVERY TRUE)
|
||||
ELSEIF(CMAKE_MINOR_VERSION EQUAL 6)
|
||||
IF(CMAKE_TINY_VERSION LESS 2)
|
||||
# Pau says: 2.6.0 and 2.6.1 are not very good
|
||||
SET(DEFAULT_WT_BOOST_DISCOVERY TRUE)
|
||||
ENDIF(CMAKE_TINY_VERSION LESS 2)
|
||||
ENDIF(CMAKE_MINOR_VERSION LESS 6)
|
||||
ENDIF(CMAKE_MAJOR_VERSION LESS 2)
|
||||
|
||||
SET(WT_BOOST_DISCOVERY ${DEFAULT_WT_BOOST_DISCOVERY} CACHE BOOL "Use Wt's boost discovery method rather than the cmake 2.6+ method")
|
||||
|
||||
|
||||
SET(LIB_INSTALL_DIR "lib" CACHE STRING
|
||||
"Name for library directory within ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
IF(WIN32)
|
||||
|
||||
SET(RUNDIR "c:/witty") # Does not apply to win32
|
||||
|
||||
IF(NOT DEFINED CONFIGDIR)
|
||||
SET(CONFIGDIR ${RUNDIR} CACHE STRING "Path for the configuration files")
|
||||
ENDIF(NOT DEFINED CONFIGDIR)
|
||||
|
||||
SET(USERLIB_PREFIX_DEFAULT "c:/libraries")
|
||||
IF(MSVC)
|
||||
SET(BUILD_PARALLEL "/MP" CACHE STRING "MSVC option for parallel builds (/MP or /MPx)")
|
||||
ENDIF(MSVC)
|
||||
|
||||
ELSE(WIN32)
|
||||
|
||||
SET(RUNDIR "/var/run/wt" CACHE PATH
|
||||
"Default path for wt session management (only used by FCGI connector; not relative to CMAKE_INSTALL_PREFIX)")
|
||||
|
||||
IF( NOT DEFINED CONFIGDIR )
|
||||
SET(CONFIGDIR "/etc/wt" CACHE STRING "Path for the configuration files")
|
||||
ENDIF( NOT DEFINED CONFIGDIR )
|
||||
|
||||
SET(USERLIB_PREFIX_DEFAULT "/usr")
|
||||
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(DEFINED USERLIB_ROOT) # Deprecated <= 3.1.3
|
||||
SET(USERLIB_PREFIX ${USERLIB_ROOT} CACHE PATH
|
||||
"Installation prefix of dependency libraries (by USERLIB_ROOT)")
|
||||
ELSE(DEFINED USERLIB_ROOT)
|
||||
SET(USERLIB_PREFIX ${USERLIB_PREFIX_DEFAULT} CACHE PATH
|
||||
"Installation prefix of dependency libraries")
|
||||
ENDIF(DEFINED USERLIB_ROOT)
|
||||
|
||||
IF(WIN32)
|
||||
SET(BOOST_PREFIX_DEFAULT "c:/Program Files/Boost")
|
||||
OPTION(BOOST_DYNAMIC "Link to boost DLLs (OFF means static link)" OFF)
|
||||
ELSE(WIN32)
|
||||
SET(BOOST_PREFIX_DEFAULT ${USERLIB_PREFIX})
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(DEFINED BOOST_DIR) # Deprecated <= 3.1.3
|
||||
SET(BOOST_PREFIX ${BOOST_DIR} CACHE PATH
|
||||
"Installation prefix of boost libraries (by BOOST_DIR)")
|
||||
ELSE(DEFINED BOOST_DIR)
|
||||
SET(BOOST_PREFIX ${BOOST_PREFIX_DEFAULT} CACHE PATH
|
||||
"Installation prefix of boost libraries")
|
||||
ENDIF(DEFINED BOOST_DIR)
|
||||
|
||||
SET(FCGI_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of fcgi library (overrides USERLIB_PREFIX)")
|
||||
SET(POSTGRES_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of postgresql library (overrides USERLIB_PREFIX)")
|
||||
SET(MYSQL_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of mysql and mysql++ libraries "
|
||||
"(overrides USERLIB_PREFIX)")
|
||||
SET(SQLITE3_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of sqlite3 library (overrides USERLIB_PREFIX)")
|
||||
SET(HARU_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of libharu library (overrides USERLIB_PREFIX)")
|
||||
SET(SSL_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of SSL library (overrides USERLIB_PREFIX)")
|
||||
SET(ZLIB_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of zlib library (overrides USERLIB_PREFIX)")
|
||||
SET(GM_PREFIX ${USERLIB_PREFIX} CACHE PATH
|
||||
"Installation prefix of GraphicsMgick library (overrides GM_PREFIX)")
|
||||
|
||||
OPTION(DEBUG "Support for debugging, must be enabled also in wt_config.xml" OFF)
|
||||
IF(CYGWIN)
|
||||
OPTION(BUILD_TESTS "Build Wt tests" OFF)
|
||||
ELSE(CYGWIN)
|
||||
OPTION(BUILD_TESTS "Build Wt tests" ON)
|
||||
ENDIF(CYGWIN)
|
||||
|
||||
ADD_DEFINITIONS(-DWT_WITH_OLD_INTERNALPATH_API)
|
||||
IF(CYGWIN)
|
||||
ADD_DEFINITIONS(-D__USE_W32_SOCKETS)
|
||||
ENDIF(CYGWIN)
|
||||
|
||||
MARK_AS_ADVANCED( CONFIGDIR )
|
||||
SET(CONFIGURATION "${CONFIGDIR}/wt_config.xml" CACHE PATH "Path to the wt configuration file")
|
||||
SET(WTHTTP_CONFIGURATION ${CONFIGDIR}/wthttpd CACHE PATH "Path for the wthttpd configuration file")
|
||||
|
||||
SET(WEBUSER apache CACHE STRING "Webserver username (e.g. apache or www)")
|
||||
SET(WEBGROUP apache CACHE STRING "Webserver groupname (e.g. apache or www or users)")
|
||||
IF(WIN32)
|
||||
SET(CONNECTOR_FCGI FALSE)
|
||||
IF(NOT MINGW)
|
||||
OPTION(CONNECTOR_ISAPI "Compile in ISAPI connector (libwtisapi) ?" ON)
|
||||
ENDIF(NOT MINGW)
|
||||
ELSE(WIN32)
|
||||
OPTION(CONNECTOR_FCGI "Compile in FCGI connector (libwtfcgi) ?" ON)
|
||||
SET(CONNECTOR_ISAPI OFF)
|
||||
ENDIF(WIN32)
|
||||
OPTION(CONNECTOR_HTTP "Compile in stand-alone httpd connector (libwthttp) ?" ON)
|
||||
SET(EXAMPLES_CONNECTOR wthttp CACHE STRING "Connector used for examples")
|
||||
|
||||
INCLUDE(cmake/WtFindBoost.txt)
|
||||
INCLUDE(cmake/WtFindFcgi.txt)
|
||||
INCLUDE(cmake/WtFindZlib.txt)
|
||||
INCLUDE(cmake/WtFindSsl.txt)
|
||||
INCLUDE(cmake/WtFindMysqlpp.txt)
|
||||
INCLUDE(cmake/WtFindPostgresql.txt)
|
||||
INCLUDE(cmake/WtFindAsciidoc.txt)
|
||||
INCLUDE(cmake/WtFindHaru.txt)
|
||||
INCLUDE(cmake/WtFindGm.txt)
|
||||
|
||||
FIND_PACKAGE(Qt4)
|
||||
IF(QT_FOUND)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ENDIF(QT_FOUND)
|
||||
|
||||
INCLUDE(FindThreads)
|
||||
|
||||
IF(NOT BOOST_WT_FOUND)
|
||||
SET(ERR
|
||||
"Could not find a boost installation in " ${BOOST_PREFIX} ".\n\n"
|
||||
"There are two methods in Wt to find boost:\n\n"
|
||||
"1. Find boost through cmake (recommended)\n"
|
||||
"This requires cmake 2.6, and is in "
|
||||
"that case the default (unless BOOST_COMPILER or BOOST_VERSION is "
|
||||
"defined). This method requires a multi-threaded boost installation.\n"
|
||||
"You may need to add your boost version number to "
|
||||
"Boost_ADDITIONAL_VERSIONS, and/or set BOOST_PREFIX to the location "
|
||||
"where boost is installed.\n\n"
|
||||
"2. Use the Wt-proprietary method to find boost.\n"
|
||||
"This requires you to define three variables:\n"
|
||||
"BOOST_PREFIX: set to the directory where you installed boost\n"
|
||||
"BOOST_COMPILER: set to the compiler signature as you find them in "
|
||||
"library names (e.g.: gcc42)\n"
|
||||
"BOOST_VERSION: set to the boost version, again as you find them in "
|
||||
"the library names (e.g.: 1_38)\n\n"
|
||||
"Note 1: WT_BOOST_DISCOVERY is the variable that selects the boost "
|
||||
"discovery method. When set to false, method 1 is used (default if "
|
||||
"cmake version is recent enough and BOOST_COMPILER and BOOST_VERSION "
|
||||
"are not defined). When set to true, method 2 is used.\n"
|
||||
"Note 2: the code to discover boost is located in cmake/WtFindBoost.txt\n"
|
||||
"Note 3: on windows, set BOOST_PREFIX to the full path, eg "
|
||||
"c:/Program Files/boost/boost_1_38\n\n"
|
||||
"Wt requires the following C++ boost libraries: date_time, regex, program_options, signals, and optionally thread")
|
||||
MESSAGE(FATAL_ERROR ${ERR})
|
||||
ENDIF(NOT BOOST_WT_FOUND)
|
||||
|
||||
IF(BOOST_WT_MT_FOUND)
|
||||
IF(MULTI_THREADED)
|
||||
MESSAGE("** Enabling multi threading.")
|
||||
SET(MULTI_THREADED_BUILD true)
|
||||
|
||||
ADD_DEFINITIONS(-DWT_THREADED -D_REENTRANT -DBOOST_SPIRIT_THREADSAFE)
|
||||
ELSE(MULTI_THREADED)
|
||||
MESSAGE("** Disabling multi threading.")
|
||||
SET(MULTI_THREADED_BUILD false)
|
||||
|
||||
ADD_DEFINITIONS(-DBOOST_DISABLE_THREADS -DSQLITE_THREADSAFE=0)
|
||||
ENDIF(MULTI_THREADED)
|
||||
ELSE(BOOST_WT_MT_FOUND)
|
||||
SET(MULTI_THREADED_BUILD false)
|
||||
MESSAGE("** Disabling multi threading: could not find multi-threaded boost libraries")
|
||||
ADD_DEFINITIONS(-DBOOST_DISABLE_THREADS -DSQLITE_THREADSAFE=0)
|
||||
ENDIF(BOOST_WT_MT_FOUND)
|
||||
|
||||
FIND_PACKAGE(Doxygen)
|
||||
|
||||
# Boost is used nearly everywhere, so we can put these here
|
||||
INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${BOOST_LIB_DIRS})
|
||||
IF(WIN32)
|
||||
IF(BOOST_DYNAMIC)
|
||||
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
|
||||
ELSE(BOOST_DYNAMIC)
|
||||
# You could expect that this is the default when BOOST_ALL_DYN_LINK
|
||||
# is not set, but this is problematic for cygwin
|
||||
ADD_DEFINITIONS(-DBOOST_THREAD_USE_LIB)
|
||||
ENDIF(BOOST_DYNAMIC)
|
||||
ADD_DEFINITIONS(
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-Dinline=__inline
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
IF(DEBUG)
|
||||
SET(WT_DEBUG_ENABLED 1)
|
||||
ELSE(DEBUG)
|
||||
SET(WT_DEBUG_ENABLED 0)
|
||||
ENDIF(DEBUG)
|
||||
|
||||
ADD_CUSTOM_TARGET(doc)
|
||||
|
||||
IF (ASCIIDOC_FOUND)
|
||||
MACRO (ASCIIDOC_FILE target infile outfile)
|
||||
ADD_CUSTOM_TARGET(${target}
|
||||
${ASCIIDOC_EXECUTABLE} -a toc -a numbered -o ${outfile} ${infile}
|
||||
COMMENT "Asciidoc ${infile}")
|
||||
ADD_DEPENDENCIES(doc ${target})
|
||||
ENDMACRO (ASCIIDOC_FILE)
|
||||
ENDIF (ASCIIDOC_FOUND)
|
||||
|
||||
IF (DOXYGEN_FOUND)
|
||||
ADD_CUSTOM_TARGET(doxygen
|
||||
${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Doxygen ...")
|
||||
ADD_DEPENDENCIES(doc doxygen)
|
||||
ADD_CUSTOM_TARGET(doxygen-examples
|
||||
${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/examples
|
||||
COMMENT "Doxygen for examples ...")
|
||||
ADD_DEPENDENCIES(doc doxygen-examples)
|
||||
ENDIF (DOXYGEN_FOUND)
|
||||
|
||||
SUBDIRS(src)
|
||||
|
||||
IF(BUILD_EXAMPLES)
|
||||
IF(WIN32)
|
||||
SUBDIRS(examples)
|
||||
ELSE(WIN32)
|
||||
SUBDIRS(EXCLUDE_FROM_ALL examples)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(BUILD_EXAMPLES)
|
||||
|
||||
IF(BUILD_TESTS)
|
||||
SUBDIRS(test)
|
||||
ENDIF(BUILD_TESTS)
|
||||
|
||||
IF( NOT DEFINED WT_CMAKE_FINDER_INSTALL_DIR )
|
||||
SET( WT_CMAKE_FINDER_INSTALL_DIR "share/cmake-2.4/Modules" )
|
||||
ENDIF( NOT DEFINED WT_CMAKE_FINDER_INSTALL_DIR)
|
||||
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/cmake/FindWt.cmake DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}/${WT_CMAKE_FINDER_INSTALL_DIR} )
|
||||
|
||||
IF(INSTALL_RESOURCES)
|
||||
INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/resources DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}/share/Wt/)
|
||||
ENDIF(INSTALL_RESOURCES)
|
||||
|
||||
IF(NOT EXISTS ${DESTDIR}${CONFIGDIR}/wt_config.xml)
|
||||
INSTALL(FILES ${WT_BINARY_DIR}/wt_config.xml DESTINATION ${CONFIGDIR})
|
||||
ENDIF (NOT EXISTS ${DESTDIR}${CONFIGDIR}/wt_config.xml)
|
||||
|
||||
IF(ENABLE_HARU AND HARU_FOUND)
|
||||
SET(HAVE_HARU ON)
|
||||
SET(WT_HAS_WPDFIMAGE true)
|
||||
ENDIF(ENABLE_HARU AND HARU_FOUND)
|
||||
|
||||
IF(ENABLE_GM AND GM_FOUND)
|
||||
SET(HAVE_GM ON)
|
||||
SET(WT_HAS_WRASTERIMAGE true)
|
||||
ENDIF(ENABLE_GM AND GM_FOUND)
|
||||
|
||||
# Compile time constants & make sure our build finds it
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Wt)
|
||||
SET(WCONFIG_H_PATH ${CMAKE_CURRENT_BINARY_DIR}/Wt/WConfig.h)
|
||||
CONFIGURE_FILE(
|
||||
${WT_SOURCE_DIR}/WConfig.h.in
|
||||
${WCONFIG_H_PATH}
|
||||
)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
INSTALL_FILES(/include/Wt FILES ${WCONFIG_H_PATH})
|
||||
|
||||
# Generate wt_config.xml from wt_config.xml.in
|
||||
CONFIGURE_FILE(
|
||||
${WT_SOURCE_DIR}/wt_config.xml.in
|
||||
${WT_BINARY_DIR}/wt_config.xml
|
||||
)
|
||||
|
3066
wt-3.1.7a/Changelog
Normal file
3066
wt-3.1.7a/Changelog
Normal file
File diff suppressed because it is too large
Load diff
1371
wt-3.1.7a/Doxyfile
Normal file
1371
wt-3.1.7a/Doxyfile
Normal file
File diff suppressed because it is too large
Load diff
336
wt-3.1.7a/INSTALL
Normal file
336
wt-3.1.7a/INSTALL
Normal file
|
@ -0,0 +1,336 @@
|
|||
Wt Installation instructions on Unix-like systems
|
||||
|
||||
This page lists the instructions for building and installing Wt 3.0.0.
|
||||
It is organized in 3 sections:
|
||||
* Requirements
|
||||
* Building and installing the library
|
||||
* Trying the examples (or your own Wt application)
|
||||
|
||||
Requirements
|
||||
|
||||
The library provides two ways for deploying applications: either using
|
||||
the FastCGI protocol, in conjunction with a webserver (like apache), or
|
||||
using a built-in web server (wthttpd). You only need one of these, but
|
||||
you can have both of them.
|
||||
|
||||
The built-in web server is more convenient during development and is
|
||||
easier to setup.
|
||||
|
||||
The FastCGI based solution provides more flexibility for deployment of
|
||||
the application. The built-in web server runs all sessions in a single
|
||||
process, while the FastCGI based solution allows different deployment
|
||||
schemes including dedicated processes per sessions.
|
||||
|
||||
Each of these two choices correspond to a library, a so-called
|
||||
connector library. Below it is outlined how to configure the build
|
||||
process of Wt to build either or both libraries (libwthttp and
|
||||
libfcgi).
|
||||
|
||||
Thus, to build a Wt library with built-in web server you need to link
|
||||
against libwt and libwthttp. To build a Wt library which acts as a
|
||||
FastCGI process, you need to link against libwt and libfcgi.
|
||||
|
||||
1 Wt requirements
|
||||
|
||||
* Compiler: gcc-3.3.4 or higher, or gcc-4.1.x or higher, or other
|
||||
Ansi C++ compiler that can deal with boost-like C++ code.
|
||||
* [1]CMake cross-platform build system:
|
||||
Preferably CMake 2.6, which comes with a usable script for finding
|
||||
boost libraries, but CMake 2.4 is still supported using Wt's own
|
||||
boost find script.
|
||||
* [2]C++ boost library (version 1.36 or higher), preferably with
|
||||
thread support enabled. You can verify you have a thread-enabled
|
||||
boost installation by locating the libboost_thread library. Thread
|
||||
support is not essential: Wt functionality is not affected except
|
||||
for exotic things like server push and reentrant event loops. Most
|
||||
importantly, even without thread support Wt can handle multiple
|
||||
concurrent sessions.
|
||||
* Optionally, [3]Haru Free PDF Library, which is used to provide
|
||||
support for painting to PDF (WPdfImage).
|
||||
* Optionally, [4]GraphicsMagick, for supporting painting to raster
|
||||
images (PNG, GIF, ...) (WRasterImage).
|
||||
|
||||
1a Using FastCGI
|
||||
|
||||
When using FastCGI, Wt requires a webserver (like apache, lighttpd or
|
||||
nginx) which supports the FastCGI protocol.
|
||||
|
||||
Given that Apache is still the most popular webserver, below are the
|
||||
requirements for apache, for other web servers the list is similar:
|
||||
* FCGI library, including C++ bindings (libfcgi++)
|
||||
* Fastcgi or mod_fcgi plugin for Apache.
|
||||
|
||||
1b Using wthttpd
|
||||
|
||||
When using the built-in webserver, two more libraries may be installed
|
||||
to enable optional features (you can also build without them), but
|
||||
otherwise no extra dependencies are required.
|
||||
* Optionally, libz, for compression over HTTP.
|
||||
* Optionally, openssl, for supporting HTTPS.
|
||||
|
||||
2 Additional and optional requirements for some of the examples
|
||||
|
||||
* libmysql++-2.x (hangman)
|
||||
__________________________________________________________________
|
||||
|
||||
Building and installing the Wt library
|
||||
|
||||
1. Create a build directory
|
||||
|
||||
The recommended way to build the library is in a seperate build
|
||||
directory, for example within the top-level of the Wt package:
|
||||
$ cd wt-x.xx
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
|
||||
2. Configure the library
|
||||
|
||||
$ cmake ../
|
||||
|
||||
The latter command will try to locate the necessary libraries. If
|
||||
everything is OK, then this should end with something like:
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/kdforc0/project/wt/build
|
||||
|
||||
To build a multi-threaded version of Wt, which uses multiple threads
|
||||
for handling concurrent requests, you need a thread-enabled boost
|
||||
library. By default, CMake 2.6 will only search for a thread-enabled
|
||||
boost installation, while CMake 2.4 will fall-back to a
|
||||
non-multithreaded boost library, reporting:
|
||||
...
|
||||
-- Looking for pthread_create in pthread - found
|
||||
** Disabling multi threading.
|
||||
...
|
||||
|
||||
Most linux distributions provide multi-threaded boost libraries by
|
||||
default now.
|
||||
|
||||
If CMake fails, because it cannot resolve all dependencies, then you
|
||||
may help CMake by setting some variables to help CMake locate the
|
||||
libraries. This may be done on the command-line using -Dvar=value or
|
||||
using the interactive program:
|
||||
$ ccmake .
|
||||
|
||||
Variables that you may set to configure Wt's built-in boost finding
|
||||
method:
|
||||
|
||||
BOOST_COMPILER
|
||||
The boost compiler signature. For a library
|
||||
libboost_regex-gcc41-mt-1_37.so, this is 'gcc41'
|
||||
|
||||
BOOST_VERSION
|
||||
The boost compiler signature. For a library
|
||||
libboost_regex-gcc41-mt-1_37.so, this is '1_37'
|
||||
|
||||
BOOST_DIR
|
||||
The boost installation directory. This is the directory where
|
||||
lib/ and include/ are located for your boost installation.
|
||||
|
||||
Other variables specify several build and configuration aspects of Wt,
|
||||
of which the most relevant ones are:
|
||||
|
||||
CMAKE_INSTALL_PREFIX
|
||||
Installation prefix for the library and include files)
|
||||
|
||||
CONFIGDIR
|
||||
Path for configuration files (default is /etc/wt/)
|
||||
|
||||
CONNECTOR_FCGI
|
||||
Build the FastCGI connector (libwtfcgi) ?
|
||||
|
||||
CONNECTOR_HTTP
|
||||
Build the stand-alone httpd connector (libwthttp) ?
|
||||
|
||||
EXAMPLES_CONNECTOR
|
||||
Which connector library to use for the examples? (wthttp or
|
||||
wtfcgi)
|
||||
|
||||
MULTI_THREADED
|
||||
Build a multi-threaded wthttpd? While on by default, and
|
||||
recommended, you may want to disable this for example if you
|
||||
suspect threading problems. Note that recursive event loops
|
||||
(most notably when using Dialog::exec()) are not possible
|
||||
without thread support.
|
||||
|
||||
The following variables apply to the FastCGI connector:
|
||||
|
||||
RUNDIR
|
||||
Default location for Wt runtime session management (can be
|
||||
overridden in the Configuration file)
|
||||
|
||||
WEBUSER
|
||||
Webserver username: used to assign permissions to RUNDIR
|
||||
|
||||
WEBGROUP
|
||||
Webserver groupname: used to assign permissions to RUNDIR
|
||||
|
||||
The following variables apply to the wthttpd connector:
|
||||
|
||||
WTHTTP_CONFIGURATION
|
||||
Location of the wthttpd configuration file (default is
|
||||
/etc/wt/wthttpd)
|
||||
|
||||
HTTP_WITH_SSL
|
||||
Compile with support for SSL, for secure HTTP (HTTPS). This
|
||||
requires an OpenSSL library.
|
||||
|
||||
HTTP_WITH_ZLIB
|
||||
Compile with support for compression over HTTP. This requires
|
||||
the libz library.
|
||||
|
||||
To change any entry, use [Enter]. To save and quit, do [c] followed by
|
||||
[g].
|
||||
|
||||
3. Build the library
|
||||
|
||||
$ make
|
||||
|
||||
4. Install the library (as user with sufficient permissions):
|
||||
|
||||
$ make install
|
||||
|
||||
5. Get your LD_LIBRARY_PATH ok, if needed (mostly for FastCGI).
|
||||
|
||||
If you did not install Wt in a directory (CMAKE_INSTALL_PREFIX)
|
||||
included in the default linker dynamic library search path, then the
|
||||
web server will not be able to start Wt programs (such as the
|
||||
examples).
|
||||
|
||||
Fix it by (as user with sufficient permissions):
|
||||
$ ln -s /your/path/to/lib/libwt.so /usr/lib
|
||||
$ ln -s /your/path/to/lib/libwtfcgi.so /usr/lib
|
||||
__________________________________________________________________
|
||||
|
||||
Trying the examples (or your own Wt application)
|
||||
|
||||
Deploying an application is different when using FastCGI or the
|
||||
built-in web server (wthttpd).
|
||||
|
||||
The examples that come with the library use the connector specified by
|
||||
the build option EXAMPLES_CONNECTOR (see supra).
|
||||
|
||||
Some examples need third-party JavaScript libraries (ExtJS or TinyMCE).
|
||||
* Download ExtJS from [5]http://yogurtearl.com/ext-2.0.2.zip, and
|
||||
install it according to these instructions:
|
||||
[6]http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html
|
||||
* Download TinyMCE from [7]http://tinymce.moxiecode.com/ and install
|
||||
its tiny_mce folder into the resources/ folder.
|
||||
|
||||
You will notice 404 File not Found errors for ext/ or
|
||||
resources/tiny_mce/ if you are missing these JavaScript libraries.
|
||||
|
||||
A. Using FastCGI and apache
|
||||
|
||||
1. Build the examples
|
||||
|
||||
$ make -C examples
|
||||
|
||||
2. Deploy the example foobar
|
||||
|
||||
The easiest way to deploy the examples is by copying the binary (from
|
||||
your build directory) and the source directory (which contains the
|
||||
images) and the resources/ into the same destination directory
|
||||
somewhere in your Apache server (we no longer generate a ./deploy.sh
|
||||
script that took care of some of this).
|
||||
$ export DESTINATION=/var/www/localhost/htdocs/wt-examples
|
||||
$ mkdir -p $DESTINATION/foobar
|
||||
$ cp -r examples/foobar/* resources/* build/examples/foobar/*.wt $DESTINATIO
|
||||
N/foobar/
|
||||
|
||||
This does however make public also files (such as message resources
|
||||
bundles, data files, etc...) that do not need to be served by your web
|
||||
server. The clean way to deploy your own applications is to use the
|
||||
"approot" property to deploy those files to a directory outside the
|
||||
webserver's doc root.
|
||||
|
||||
3. Configure Apache
|
||||
|
||||
Treat the example as a mod_fastcgi application, by adding a line to
|
||||
20_mod_fastcgi.conf in your Apache configuration modules.d/ directory,
|
||||
e.g.:
|
||||
FastCgiServer /var/www/localhost/htdocs/wt-examples/composer/composer.wt
|
||||
|
||||
4. Restart apache
|
||||
|
||||
B. Using wthttpd
|
||||
|
||||
1. Build the examples
|
||||
|
||||
$ make -C examples
|
||||
|
||||
2. Running an example
|
||||
|
||||
Most examples use additional files, such as message resource bundles,
|
||||
which are not indicated with absolute path names. Therefore the working
|
||||
directory should be the source directory for the example. A similar
|
||||
argument goes for icons and the setting of the --docroot variable.
|
||||
Since Wt 3.1.4, you can use the "approot" property to move the
|
||||
additional files that should not be available to browsers outside of
|
||||
the docroot.
|
||||
$ cd ../examples/foobar # source directory for example foobar
|
||||
$ ln -s ../../resources . # include standard Wt resource files
|
||||
$ ../../build/examples/foobar/foobar.wt --docroot . --http-address 0.0.0.0 -
|
||||
-http-port 8080
|
||||
|
||||
This will start a httpd server listening on all local interfaces, on
|
||||
port 8080, and you may browse the example at [8]http://127.0.0.1:8080/
|
||||
|
||||
You will notice 404 File not Found errors for resources/ files if you
|
||||
are missing the resources files.
|
||||
|
||||
These are all the command-line options that are available:
|
||||
General options:
|
||||
-h [ --help ] produce help message
|
||||
-t [ --threads ] arg (=10) number of threads
|
||||
--servername arg (=vierwerf) servername (IP address or DNS name)
|
||||
--docroot arg document root for static files
|
||||
--errroot arg root for error pages
|
||||
--accesslog arg access log file (defaults to stdout)
|
||||
--no-compression do not compress dynamic text/html and text/plai
|
||||
n responses
|
||||
--deploy-path arg (=/) location for deployment
|
||||
--session-id-prefix arg prefix for session-id's (overrides wt_config.xm
|
||||
l setting)
|
||||
-p [ --pid-file ] arg path to pid file (optional)
|
||||
-c [ --config ] arg location of wt_config.xml. If unspecified,
|
||||
WT_CONFIG_XML is searched in the environment,
|
||||
if it does not exist then the compiled-in
|
||||
default (/etc/wt/wt_config.xml) is tried. If
|
||||
the default does not exist, we revert to
|
||||
default values for all parameters.
|
||||
--max-request-size arg Maximum size of a HTTP request. This also
|
||||
limits POST requests, so this is an upper limit
|
||||
for file uploads. Default is 40MB.
|
||||
--max-memory-request-size arg Requests are usually read in memory before
|
||||
being processed. To avoid DOS attacks where
|
||||
large requests take up all RAM, use this
|
||||
parameter to force requests that are larger
|
||||
than the specified size to be spooled to disk.
|
||||
This will also spool file uploads to disk.
|
||||
--gdb do not shutdown when receiving Ctrl-C (and let
|
||||
gdb break instead)
|
||||
|
||||
HTTP server options:
|
||||
--http-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--http-port arg (=80) HTTP port (e.g. 80)
|
||||
|
||||
HTTPS server options:
|
||||
--https-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--https-port arg (=443) HTTPS port (e.g. 443)
|
||||
--ssl-certificate arg SSL server certificate chain file
|
||||
e.g. "/etc/ssl/certs/vsign1.pem"
|
||||
--ssl-private-key arg SSL server private key file
|
||||
e.g. "/etc/ssl/private/company.pem"
|
||||
--ssl-tmp-dh arg File for temporary Diffie-Hellman parameters
|
||||
e.g. "/etc/ssl/dh512.pem"
|
||||
|
||||
References
|
||||
|
||||
1. http://www.cmake.org/
|
||||
2. http://www.boost.org/
|
||||
3. http://libharu.org/
|
||||
4. http://www.graphicsmagick.org/
|
||||
5. http://yogurtearl.com/ext-2.0.2.zip
|
||||
6. http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html
|
||||
7. http://tinymce.moxiecode.com/
|
||||
8. http://127.0.0.1:8080/
|
405
wt-3.1.7a/INSTALL.html
Normal file
405
wt-3.1.7a/INSTALL.html
Normal file
|
@ -0,0 +1,405 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
</head>
|
||||
<title>Wt Installation</title>
|
||||
<body>
|
||||
<h1>Wt Installation instructions on Unix-like systems</h1>
|
||||
|
||||
This page lists the instructions for building and installing Wt 3.0.0.
|
||||
It is organized in 3 sections:
|
||||
<ul>
|
||||
<li>Requirements</li>
|
||||
<li>Building and installing the library</li>
|
||||
<li>Trying the examples (or your own Wt application)</li>
|
||||
</ul>
|
||||
|
||||
<a name="requirements"></a><h2>Requirements</h2>
|
||||
|
||||
<p>
|
||||
The library provides two ways for deploying applications: either using
|
||||
the FastCGI protocol, in conjunction with a webserver (like apache),
|
||||
or using a built-in web server (wthttpd). You only need one of these,
|
||||
but you can have both of them.</p>
|
||||
|
||||
<p>
|
||||
The built-in web server is more convenient during development and is
|
||||
easier to setup.</p>
|
||||
|
||||
<p>
|
||||
The FastCGI based solution provides more flexibility for deployment of
|
||||
the application. The built-in web server runs all sessions in a single
|
||||
process, while the FastCGI based solution allows different deployment
|
||||
schemes including dedicated processes per sessions.</p>
|
||||
|
||||
<p>
|
||||
Each of these two choices correspond to a library, a
|
||||
so-called <i>connector</i> library. Below it is outlined how to
|
||||
configure the build process of Wt to build either or both libraries
|
||||
(libwthttp and libfcgi).</p>
|
||||
|
||||
<p>
|
||||
Thus, to build a Wt library with built-in web server you need to
|
||||
link against libwt and libwthttp. To build a Wt library which acts as
|
||||
a FastCGI process, you need to link against libwt and libfcgi.
|
||||
</p>
|
||||
|
||||
<h3>1 Wt requirements</h3>
|
||||
|
||||
<ul>
|
||||
<li>Compiler: gcc-3.3.4 or higher, or gcc-4.1.x or higher, or other
|
||||
Ansi C++ compiler that can deal with boost-like C++ code.</li>
|
||||
<li><a href="http://www.cmake.org/">CMake cross-platform build
|
||||
system</a>:
|
||||
<div>Preferably CMake 2.6, which comes with a usable script for
|
||||
finding boost libraries, but CMake 2.4 is still supported using
|
||||
Wt's own boost find script.
|
||||
</div>
|
||||
</li>
|
||||
<li><a href="http://www.boost.org/">C++ boost library</a> (version
|
||||
1.36 or higher), preferably with thread support enabled. You can
|
||||
verify you have a thread-enabled boost installation by locating the
|
||||
libboost_thread library. Thread support is not essential: Wt
|
||||
functionality is not affected except for exotic things like server
|
||||
push and reentrant event loops. Most importantly, even without
|
||||
thread support Wt can handle multiple concurrent sessions.</li>
|
||||
<li>Optionally, <a href="http://libharu.org/">Haru Free PDF Library</a>, which is used to provide support for painting to PDF (WPdfImage).</li>
|
||||
<li>Optionally, <a href="http://www.graphicsmagick.org/">GraphicsMagick</a>, for supporting painting to raster images (PNG, GIF, ...) (WRasterImage).</li>
|
||||
</ul>
|
||||
|
||||
<h4>1a Using FastCGI</h4>
|
||||
|
||||
<p>When using FastCGI, Wt requires a webserver (like apache, lighttpd or
|
||||
nginx) which supports the FastCGI protocol.</p>
|
||||
|
||||
<p>Given that Apache is still the most popular webserver, below are
|
||||
the requirements for apache, for other web servers the list is
|
||||
similar:</p>
|
||||
|
||||
<ul>
|
||||
<li>FCGI library, including C++ bindings (libfcgi++)</li>
|
||||
<li>Fastcgi or mod_fcgi plugin for Apache.</li>
|
||||
</ul>
|
||||
|
||||
<h4>1b Using wthttpd</h4>
|
||||
|
||||
When using the built-in webserver, two more libraries may be installed
|
||||
to enable optional features (you can also build without them), but
|
||||
otherwise no extra dependencies are required.
|
||||
|
||||
<ul>
|
||||
<li>Optionally, libz, for compression over HTTP.</li>
|
||||
<li>Optionally, openssl, for supporting HTTPS.</li>
|
||||
</ul>
|
||||
|
||||
<h3>2 Additional and optional requirements for some of the examples</h3>
|
||||
<ul>
|
||||
<li>libmysql++-2.x (hangman)</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="build"></a><h2>Building and installing the Wt library</h2>
|
||||
|
||||
<h4>1. Create a build directory</h4>
|
||||
|
||||
<p>The recommended way to build the library is in a seperate build
|
||||
directory, for example within the top-level of the Wt package:</p>
|
||||
|
||||
<pre>
|
||||
$ cd wt-x.xx
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
</pre>
|
||||
|
||||
<h4>2. Configure the library</h4>
|
||||
|
||||
<pre>
|
||||
$ cmake ../
|
||||
</pre>
|
||||
|
||||
<p>The latter command will try to locate the necessary libraries. If everything
|
||||
is OK, then this should end with something like:
|
||||
|
||||
<pre>
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/kdforc0/project/wt/build
|
||||
</pre></p>
|
||||
|
||||
<p>To build a multi-threaded version of Wt, which uses multiple
|
||||
threads for handling concurrent requests, you need a thread-enabled
|
||||
boost library. By default, CMake 2.6 will only search for a
|
||||
thread-enabled boost installation, while CMake 2.4 will fall-back to a
|
||||
non-multithreaded boost library, reporting:
|
||||
|
||||
<pre>
|
||||
...
|
||||
-- Looking for pthread_create in pthread - found
|
||||
** Disabling multi threading.
|
||||
...
|
||||
</pre></p>
|
||||
|
||||
<p>Most linux distributions provide multi-threaded boost libraries by
|
||||
default now.</p>
|
||||
|
||||
<p>If CMake fails, because it cannot resolve all dependencies, then you
|
||||
may help CMake by setting some variables to help CMake locate the libraries.
|
||||
This may be done on the command-line using -D<i>var</i>=<i>value</i> or
|
||||
using the interactive program:
|
||||
|
||||
<pre>
|
||||
$ ccmake .
|
||||
</pre>
|
||||
|
||||
<p>Variables that you may set to configure Wt's built-in boost finding
|
||||
method:</p>
|
||||
|
||||
<dl>
|
||||
<dt><strong>BOOST_COMPILER</strong></dt>
|
||||
<dd>The boost compiler signature. For a library
|
||||
libboost_regex-gcc41-mt-1_37.so, this is 'gcc41'</dd>
|
||||
<dt><strong>BOOST_VERSION</strong></dt>
|
||||
<dd>The boost compiler signature. For a library
|
||||
libboost_regex-gcc41-mt-1_37.so, this is '1_37'</dd>
|
||||
<dt><strong>BOOST_DIR</strong></dt>
|
||||
<dd>The boost installation directory. This is the directory where lib/
|
||||
and include/ are located for your boost installation.</dd>
|
||||
</dl>
|
||||
|
||||
Other variables specify several build and configuration aspects of Wt, of which
|
||||
the most relevant ones are:
|
||||
|
||||
<dl>
|
||||
<dt><strong>CMAKE_INSTALL_PREFIX</strong></dt>
|
||||
<dd>Installation prefix for the library and include files)</dd>
|
||||
<dt><strong>CONFIGDIR</strong></dt>
|
||||
<dd>Path for configuration files (default is /etc/wt/)</dd>
|
||||
<dt><strong>CONNECTOR_FCGI</strong></dt>
|
||||
<dd>Build the FastCGI connector (libwtfcgi) ?</dd>
|
||||
<dt><strong>CONNECTOR_HTTP</strong></dt>
|
||||
<dd>Build the stand-alone httpd connector (libwthttp) ?</dd>
|
||||
<dt><strong>EXAMPLES_CONNECTOR</strong></dt>
|
||||
<dd>Which connector library to use for the examples? (wthttp or wtfcgi)</dd>
|
||||
<dt><strong>MULTI_THREADED</strong></dt>
|
||||
<dd>Build a multi-threaded wthttpd? While on by default, and
|
||||
recommended, you may want to disable this for example if you suspect
|
||||
threading problems. Note that recursive event loops (most notably when
|
||||
using Dialog::exec()) are not possible without thread support.</dd>
|
||||
</dl>
|
||||
|
||||
The following variables apply to the FastCGI connector:
|
||||
|
||||
<dl>
|
||||
<dt><strong>RUNDIR</strong></dt>
|
||||
<dd>Default location for Wt runtime session management (can be overridden in the Configuration file)</dd>
|
||||
<dt><strong>WEBUSER</strong></dt>
|
||||
<dd>Webserver username: used to assign permissions to RUNDIR</dd>
|
||||
<dt><strong>WEBGROUP</strong></dt>
|
||||
<dd>Webserver groupname: used to assign permissions to RUNDIR</dd>
|
||||
</dl>
|
||||
|
||||
The following variables apply to the wthttpd connector:
|
||||
|
||||
<dl>
|
||||
<dt><strong>WTHTTP_CONFIGURATION</strong></dt>
|
||||
<dd>Location of the wthttpd configuration file (default is /etc/wt/wthttpd)</dd>
|
||||
<dt><strong>HTTP_WITH_SSL</strong></dt>
|
||||
<dd>Compile with support for SSL, for secure HTTP (HTTPS). This requires an OpenSSL library.</dd>
|
||||
<dt><strong>HTTP_WITH_ZLIB</strong></dt>
|
||||
<dd>Compile with support for compression over HTTP. This requires the
|
||||
libz library.</dd>
|
||||
</dl>
|
||||
|
||||
To change any entry, use [Enter]. To save and quit, do [c] followed by [g].
|
||||
</p>
|
||||
|
||||
<h4>3. Build the library</h4>
|
||||
|
||||
<pre>
|
||||
$ make
|
||||
</pre>
|
||||
|
||||
<h4>4. Install the library (as user with sufficient permissions):</h4>
|
||||
|
||||
<pre>
|
||||
$ make install
|
||||
</pre>
|
||||
|
||||
<h4>5. Get your LD_LIBRARY_PATH ok, if needed (mostly for FastCGI).</h4>
|
||||
|
||||
<p>
|
||||
If you did not install Wt in a directory (CMAKE_INSTALL_PREFIX) included
|
||||
in the default linker dynamic library search path, then the web server will
|
||||
not be able to start Wt programs (such as the examples).</p>
|
||||
|
||||
<p>
|
||||
Fix it by (as user with sufficient permissions):
|
||||
|
||||
<pre>
|
||||
$ ln -s /your/path/to/lib/libwt.so /usr/lib
|
||||
$ ln -s /your/path/to/lib/libwtfcgi.so /usr/lib
|
||||
</pre>
|
||||
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="examples"></a><h2>Trying the examples (or your own Wt application)</h2>
|
||||
|
||||
<p>Deploying an application is different when using FastCGI or the
|
||||
built-in web server (wthttpd).</p>
|
||||
|
||||
<p>The examples that come with the library use the connector specified
|
||||
by the build option EXAMPLES_CONNECTOR (see supra).</p>
|
||||
|
||||
<p>Some examples need third-party JavaScript libraries (ExtJS or TinyMCE).
|
||||
<ul>
|
||||
<li>Download ExtJS
|
||||
from <a href="http://yogurtearl.com/ext-2.0.2.zip">http://yogurtearl.com/ext-2.0.2.zip</a>,
|
||||
and install it according to these instructions:
|
||||
<a href="http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html">http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html</a>
|
||||
</li>
|
||||
<li>Download TinyMCE
|
||||
from <a href="http://tinymce.moxiecode.com/">http://tinymce.moxiecode.com/</a>
|
||||
and install its <tt>tiny_mce</tt> folder into the resources/ folder.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
You will notice 404 File not Found errors for <tt>ext/</tt> or
|
||||
<tt>resources/tiny_mce/</tt> if you are missing these JavaScript
|
||||
libraries.
|
||||
</p>
|
||||
|
||||
<a name="examples-fastcgi"></a></a><h3>A. Using FastCGI and apache</h3>
|
||||
|
||||
<h4>1. Build the examples</h4>
|
||||
|
||||
<pre>
|
||||
$ make -C examples
|
||||
</pre>
|
||||
|
||||
<h4>2. Deploy the example <i>foobar</i></h4>
|
||||
|
||||
<p>
|
||||
The easiest way to deploy the examples is by copying the binary (from
|
||||
your build directory) and the source directory (which contains the
|
||||
images) and the resources/ into the same destination directory
|
||||
somewhere in your Apache server (we no longer generate a ./deploy.sh
|
||||
script that took care of some of this).
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ export DESTINATION=/var/www/localhost/htdocs/wt-examples
|
||||
$ mkdir -p $DESTINATION/<i>foobar</i>
|
||||
$ cp -r examples/<i>foobar</i>/* resources/* build/examples/<i>foobar</i>/*.wt $DESTINATION/<i>foobar</i>/
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This does however make public also files (such as message resources
|
||||
bundles, data files, etc...) that do not need to be served by your web
|
||||
server. The clean way to deploy your own applications is to use the
|
||||
"approot" property to deploy those files to a directory outside the
|
||||
webserver's doc root.
|
||||
</p>
|
||||
|
||||
<h4>3. Configure Apache</h4>
|
||||
|
||||
<p>
|
||||
Treat the example as a mod_fastcgi application, by adding a line to
|
||||
20_mod_fastcgi.conf in your Apache configuration modules.d/ directory, e.g.:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
FastCgiServer /var/www/localhost/htdocs/wt-examples/composer/composer.wt
|
||||
</pre>
|
||||
|
||||
<h4>4. Restart apache</h4>
|
||||
|
||||
<a name="examples-wthttpd"></a><h3>B. Using wthttpd</h3>
|
||||
|
||||
<h4>1. Build the examples</h4>
|
||||
|
||||
<pre>
|
||||
$ make -C examples
|
||||
</pre>
|
||||
|
||||
<h4>2. Running an example</h4>
|
||||
|
||||
<p>
|
||||
Most examples use additional files, such as message resource bundles,
|
||||
which are not indicated with absolute path names. Therefore the
|
||||
working directory should be the source directory for the example. A
|
||||
similar argument goes for icons and the setting of the --docroot
|
||||
variable. Since Wt 3.1.4, you can use the "approot" property to move
|
||||
the additional files that should not be available to browsers outside
|
||||
of the docroot.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ cd ../examples/<i>foobar</i> # source directory for example <i>foobar</i>
|
||||
$ ln -s ../../resources . # include standard Wt resource files
|
||||
$ ../../build/examples/<i>foobar</i>/<i>foobar</i>.wt --docroot . --http-address 0.0.0.0 --http-port 8080
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This will start a httpd server listening on all local interfaces, on
|
||||
port 8080, and you may browse the example at <a
|
||||
href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a></p>
|
||||
|
||||
<p>
|
||||
You will notice 404 File not Found errors for resources/ files if you are
|
||||
missing the resources files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
These are all the command-line options that are available:
|
||||
<pre>
|
||||
General options:
|
||||
-h [ --help ] produce help message
|
||||
-t [ --threads ] arg (=10) number of threads
|
||||
--servername arg (=vierwerf) servername (IP address or DNS name)
|
||||
--docroot arg document root for static files
|
||||
--errroot arg root for error pages
|
||||
--accesslog arg access log file (defaults to stdout)
|
||||
--no-compression do not compress dynamic text/html and text/plai
|
||||
n responses
|
||||
--deploy-path arg (=/) location for deployment
|
||||
--session-id-prefix arg prefix for session-id's (overrides wt_config.xm
|
||||
l setting)
|
||||
-p [ --pid-file ] arg path to pid file (optional)
|
||||
-c [ --config ] arg location of wt_config.xml. If unspecified,
|
||||
WT_CONFIG_XML is searched in the environment,
|
||||
if it does not exist then the compiled-in
|
||||
default (/etc/wt/wt_config.xml) is tried. If
|
||||
the default does not exist, we revert to
|
||||
default values for all parameters.
|
||||
--max-request-size arg Maximum size of a HTTP request. This also
|
||||
limits POST requests, so this is an upper limit
|
||||
for file uploads. Default is 40MB.
|
||||
--max-memory-request-size arg Requests are usually read in memory before
|
||||
being processed. To avoid DOS attacks where
|
||||
large requests take up all RAM, use this
|
||||
parameter to force requests that are larger
|
||||
than the specified size to be spooled to disk.
|
||||
This will also spool file uploads to disk.
|
||||
--gdb do not shutdown when receiving Ctrl-C (and let
|
||||
gdb break instead)
|
||||
|
||||
HTTP server options:
|
||||
--http-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--http-port arg (=80) HTTP port (e.g. 80)
|
||||
|
||||
HTTPS server options:
|
||||
--https-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--https-port arg (=443) HTTPS port (e.g. 443)
|
||||
--ssl-certificate arg SSL server certificate chain file
|
||||
e.g. "/etc/ssl/certs/vsign1.pem"
|
||||
--ssl-private-key arg SSL server private key file
|
||||
e.g. "/etc/ssl/private/company.pem"
|
||||
--ssl-tmp-dh arg File for temporary Diffie-Hellman parameters
|
||||
e.g. "/etc/ssl/dh512.pem"
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
122
wt-3.1.7a/INSTALL.win32.html
Normal file
122
wt-3.1.7a/INSTALL.win32.html
Normal file
|
@ -0,0 +1,122 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
</head>
|
||||
<title>Wt Installation</title>
|
||||
<body>
|
||||
<h1>Wt Installation instructions for Windows</h1>
|
||||
|
||||
This page lists the instructions for building and installing Wt on Windows.
|
||||
It is organized in 3 sections:
|
||||
<ul>
|
||||
<li>Requirements</li>
|
||||
<li>Building and installing the library</li>
|
||||
<li>Trying the examples (or your own Wt application)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Requirements</h2>
|
||||
|
||||
<p>
|
||||
Wt for Windows uses the built-in web server connector or the ISAPI connector.
|
||||
The fastcgi connector is not supported. The built-in web server is more
|
||||
convenient during development and is easier to setup than the ISAPI connector.
|
||||
To use the built-in server, you have to link your projects against libwt
|
||||
and libwthttp. To use the ISAPI connector, you have to link to libwtisapi
|
||||
instead of libwthttp.</p>
|
||||
|
||||
<p>Requirements:
|
||||
<ul>
|
||||
<li>Microsoft Visual Studio C++ 2005 or newer. Wt and its dependencies also
|
||||
build on the Express Edition, which is free (as in beer) to use.
|
||||
<li>CMake cross-platform build system (www.cmake.org): cmake-2.6.x,
|
||||
Windows version (2.8 or newer recommended).</li>
|
||||
<li>Boost 1.36 (or later).</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>Additional and optional requirements for some of the examples
|
||||
<ul>
|
||||
<li>For https support: OpenSSL, version 0.9.8d or newer.</li>
|
||||
<li>To compress traffic: zlib 1.2.3</li>
|
||||
<li>libmysql and libmysql++-2.x (hangman)</li>
|
||||
<li><a href="http://libharu.org/">Haru Free PDF Library</a>, which is used to provide support for painting to PDF (WPdfImage).</li>
|
||||
<li><a href="http://www.graphicsmagick.org/">GraphicsMagick</a>, for supporting painting to raster images (PNG, GIF, ...) (WRasterImage).</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We stronly recommend to use libraries which are all built using the same
|
||||
compiler and the same runtime configuration (/MT, /MD, /MTd
|
||||
or /MDd) to avoid incompatibilities with the C runtime libraries. Mixing
|
||||
CRTs is NOT recommended, the <a href="http://www.zlib.net/DLL_FAQ.txt">zlib
|
||||
DLL FAQ</a> clearly explains why and what you should do about it (in
|
||||
short: use prebuilt libraries for the exact same compiler as you use, and
|
||||
if those are not available, rebuild the dependency libraries from the sources).
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2>Step by step instructions to build and install the Wt library</h2>
|
||||
|
||||
Up to date instructions are located on the Wt wiki page:
|
||||
<a href="http://redmine.emweb.be/projects/wt/wiki/Installing_Wt_on_MS_Windows">Installing Wt on MS Windows</a>
|
||||
|
||||
Instructions on how to use the ISAPI connector for deployment under IIS are
|
||||
also available on the wiki page:
|
||||
<a href="http://redmine.emweb.be/projects/wt/wiki/ISAPI_on_Microsoft_IIS">ISAPI on Microsoft IIS</a>
|
||||
|
||||
<h2>Trying the examples (or your own Wt application) using wthttpd</h3>
|
||||
|
||||
<h4>1. Run the example in the MSVC IDE </h4>
|
||||
|
||||
Right-click on the example project you want to run, and select 'Properties'.
|
||||
In Configuration Properties->Debugging, set the Command Arguments to
|
||||
<pre>
|
||||
--http-address=0.0.0.0 --http-port=8080 --deploy-path=/hello --docroot=.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This will start a httpd server listening on all local interfaces, on
|
||||
port 8080, and you may browse the example at <a
|
||||
href="http://127.0.0.1:8080/hello">http://127.0.0.1:8080/hello</a></p>
|
||||
|
||||
<p>
|
||||
Examples that need extra files to run, should be executed from their source
|
||||
directory in order to find their dependency files (icons, css files, etc.
|
||||
Watch for 404 errors in Wt's output). To do so, set the 'Working directory'
|
||||
for the example to wt-x.y.z/examples/ExampleName. Some examples (e.g. the
|
||||
wt home page) need the 'resources' directory to work correctly. Copy
|
||||
the wt-2.x.x/resources to the example's source directory to solve this
|
||||
problem. Other examples (such as the Charts example) may require the
|
||||
installation of ExtJs. See the Wt reference manual for more information
|
||||
on how to obtain and install ExtJs.
|
||||
|
||||
<p>
|
||||
These are all the command-line options that are available:
|
||||
<pre>
|
||||
General options:
|
||||
-h [ --help ] produce help message
|
||||
-t [ --threads ] arg (=10) number of threads
|
||||
--docroot arg document root for static files
|
||||
--no-compression do not compress dynamic text/html and text/plain
|
||||
responses
|
||||
--deploy-path arg (=/) location for deployment
|
||||
|
||||
HTTP server options:
|
||||
--http-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--http-port arg (=80) HTTP port (e.g. 80)
|
||||
|
||||
HTTPS server options:
|
||||
--https-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
|
||||
--https-port arg (=443) HTTPS port (e.g. 443)
|
||||
--ssl-certificate arg SSL server certificate chain file
|
||||
e.g. "/etc/ssl/certs/vsign1.pem"
|
||||
--ssl-private-key arg SSL server private key file
|
||||
e.g. "/etc/ssl/private/company.pem"
|
||||
--ssl-tmp-dh arg File for temporary Diffie-Hellman parameters
|
||||
e.g. "/etc/ssl/dh512.pem"
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
355
wt-3.1.7a/LICENSE
Normal file
355
wt-3.1.7a/LICENSE
Normal file
|
@ -0,0 +1,355 @@
|
|||
In addition to the license terms of the GNU General Public License,
|
||||
Version 2, as copied below, Emweb bvba gives permission to link the
|
||||
code of its release of Wt with the OpenSSL project's "OpenSSL" library
|
||||
(or with modified versions of it that use the same license as the
|
||||
"OpenSSL" library), and distribute the linked executables. You must
|
||||
obey the GNU General Public License in all respects for all of the
|
||||
code used other than "OpenSSL". If you modify this file, you may
|
||||
extend this exception to your version of the file, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this exception
|
||||
statement from your version.
|
||||
|
||||
Wt is licensed under the GNU GPL Version 2. Other versions of the GPL do
|
||||
not apply.
|
||||
|
||||
======================================================================
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
1887
wt-3.1.7a/ReleaseNotes.html
Normal file
1887
wt-3.1.7a/ReleaseNotes.html
Normal file
File diff suppressed because it is too large
Load diff
47
wt-3.1.7a/WConfig.h.in
Normal file
47
wt-3.1.7a/WConfig.h.in
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef WCONFIG_H
|
||||
#define WCONFIG_H
|
||||
|
||||
// Version defines
|
||||
#define WT_SERIES 0x${VERSION_SERIES}
|
||||
#define WT_MAJOR 0x${VERSION_MAJOR}
|
||||
#define WT_MINOR 0x${VERSION_MINOR}
|
||||
|
||||
/*! \brief A constant that encodes the library version of %Wt
|
||||
*
|
||||
* You may use this constant to check for the version of %Wt at build-time.
|
||||
*/
|
||||
#define WT_VERSION (((WT_SERIES & 0xff) << 24) | ((WT_MAJOR & 0xff) << 16) | ((WT_MINOR & 0xff) << 8))
|
||||
#define WT_VERSION_STR "${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}"
|
||||
#define WT_CLASS "Wt${VERSION_SERIES}_${VERSION_MAJOR}_${VERSION_MINOR}"
|
||||
|
||||
#define RUNDIR "${RUNDIR}"
|
||||
#define WT_CONFIG_XML "${CONFIGURATION}"
|
||||
#define WTHTTP_CONFIGURATION "${WTHTTP_CONFIGURATION}"
|
||||
|
||||
#cmakedefine WT_STATIC
|
||||
#cmakedefine WTDBO_STATIC
|
||||
#cmakedefine WTDBOPOSTGRES_STATIC
|
||||
#cmakedefine WTDBOSQLITE3_STATIC
|
||||
#cmakedefine WTHTTP_STATIC
|
||||
#cmakedefine WT_EXT_STATIC
|
||||
#cmakedefine WT_EXT_STATIC
|
||||
|
||||
#cmakedefine WT_HAS_WRASTERIMAGE
|
||||
#cmakedefine WT_HAS_WPDFIMAGE
|
||||
|
||||
#cmakedefine WT_NO_BOOST_INTRUSIVE
|
||||
#cmakedefine WT_NO_STD_LOCALE
|
||||
#cmakedefine WT_NO_STD_WSTRING
|
||||
|
||||
#if ${WT_DEBUG_ENABLED}
|
||||
#ifndef WT_TARGET_JAVA
|
||||
#define WT_DEBUG(statement) do { if (Wt::WApplication::instance()->debug()) statement; } while(0)
|
||||
#else
|
||||
#define WT_DEBUG(statement)
|
||||
#endif
|
||||
#else
|
||||
#define WT_DEBUG(statement)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
2
wt-3.1.7a/WtInstall.cmake
Normal file
2
wt-3.1.7a/WtInstall.cmake
Normal file
|
@ -0,0 +1,2 @@
|
|||
EXEC_PROGRAM(mkdir ARGS -p ${DESTDIR}${RUNDIR})
|
||||
EXEC_PROGRAM(chown ARGS ${WEBUSER}:${WEBGROUP} ${DESTDIR}${RUNDIR})
|
74
wt-3.1.7a/cmake/FindSqlite3.cmake
Normal file
74
wt-3.1.7a/cmake/FindSqlite3.cmake
Normal file
|
@ -0,0 +1,74 @@
|
|||
# We define:
|
||||
# - SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
|
||||
# - SQLITE3_LIBRARIES - Sqlite 3 libraries
|
||||
# - SQLITE3_LIBRARY_RELEASE - Where the release library is
|
||||
# - SQLITE3_LIBRARY_DEBUG - Where the debug library is
|
||||
# - SQLITE3_FOUND - Set to TRUE if we found everything
|
||||
# (library, includes and executable)
|
||||
# Taking into account:
|
||||
# - SQLITE3_PREFIX
|
||||
|
||||
# Copyright (c) 2010 Pau Garcia i Quiles, <pgquiles@elpauer.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
|
||||
|
||||
IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
|
||||
SET(SQLITE3_FIND_QUIETLY TRUE)
|
||||
ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
|
||||
|
||||
FIND_PATH(SQLITE3_INCLUDE_DIR
|
||||
sqlite3.h
|
||||
PATHS
|
||||
${SQLITE3_PREFIX}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE
|
||||
NAMES
|
||||
sqlite3
|
||||
PATHS
|
||||
${SQLITE3_PREFIX}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG
|
||||
NAMES
|
||||
sqlite3
|
||||
HINTS
|
||||
${SQLITE3_PREFIX}/lib/debug/usr/lib )
|
||||
|
||||
IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
|
||||
SET( SQLITE3_FOUND TRUE )
|
||||
ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
|
||||
|
||||
IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
|
||||
# if the generator supports configuration types then set
|
||||
# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
|
||||
IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
|
||||
ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
|
||||
# then just use the release libraries
|
||||
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
|
||||
ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
ELSEIF( SQLITE3_LIBRARY_RELEASE )
|
||||
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
|
||||
ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
|
||||
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
|
||||
ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
|
||||
|
||||
IF( SQLITE3_FOUND )
|
||||
IF( NOT SQLITE3_FIND_QUIETLY )
|
||||
MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
|
||||
MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
|
||||
ENDIF( NOT SQLITE3_FIND_QUIETLY )
|
||||
ELSE(SQLITE3_FOUND)
|
||||
IF( SQLITE3_FIND_REQUIRED)
|
||||
MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
|
||||
ELSE( SQLITE3_FIND_REQUIRED)
|
||||
MESSAGE( STATUS "Optional package Sqlite3 was not found" )
|
||||
ENDIF( SQLITE3_FIND_REQUIRED)
|
||||
ENDIF(SQLITE3_FOUND)
|
127
wt-3.1.7a/cmake/FindWt.cmake
Executable file
127
wt-3.1.7a/cmake/FindWt.cmake
Executable file
|
@ -0,0 +1,127 @@
|
|||
# Find Wt includes and libraries
|
||||
#
|
||||
# This script sets the following variables:
|
||||
#
|
||||
# Wt_INCLUDE_DIR
|
||||
# Wt_LIBRARIES - Release libraries
|
||||
# Wt_FOUND - True if release libraries found
|
||||
# Wt_DEBUG_LIBRARIES - Debug libraries
|
||||
# Wt_DEBUG_FOUND - True if debug libraries found
|
||||
#
|
||||
# To direct the script to a particular Wt installation, use the
|
||||
# standard cmake variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH
|
||||
#
|
||||
# To use this script to find Wt, when using the new style for include files:
|
||||
# #include <Wt/WLineEdit>
|
||||
# #include <Wt/Ext/LineEdit>
|
||||
# #include <Wt/Chart/WPieChart>
|
||||
#
|
||||
# include the following CMake snippet in your project:
|
||||
#
|
||||
# FIND_PACKAGE( Wt REQUIRED )
|
||||
# INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} )
|
||||
# TARGET_LINK_LIBRARIES( yourexe
|
||||
# ${Wt_DEBUG_LIBRARY} # or {Wt_LIBRARY}
|
||||
# ${Wt_HTTP_DEBUG_LIBRARY} # or {Wt_HTTP_LIBRARY}
|
||||
# ${Wt_EXT_DEBUG_LIBRARY} # or {Wt_EXT_LIBRARY}
|
||||
# )
|
||||
#
|
||||
# To use this script to find Wt, when using the old include style:
|
||||
# #include <WLineEdit>
|
||||
# #include <Ext/LineEdit>
|
||||
# #include <Chart/WPieChart>
|
||||
# style of include files, change the INCLUDE_DIRECTORIES statement to:
|
||||
# INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} ${Wt_INCLUDE_DIR}/Wt )
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
FIND_PATH( Wt_INCLUDE_DIR NAMES Wt/WObject PATHS ENV PATH PATH_SUFFIXES include wt )
|
||||
|
||||
SET( Wt_FIND_COMPONENTS Release Debug )
|
||||
|
||||
IF( Wt_INCLUDE_DIR )
|
||||
FIND_LIBRARY( Wt_LIBRARY NAMES wt PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_EXT_LIBRARY NAMES wtext PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_HTTP_LIBRARY NAMES wthttp PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_FCGI_LIBRARY NAMES wtfcgi PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_DBO_LIBRARY NAMES wtdbo PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_DBOSQLITE3_LIBRARY NAMES wtdbosqlite3 PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
FIND_LIBRARY( Wt_DBOPOSTGRES_LIBRARY NAMES wtdbopostgres PATHS PATH PATH_SUFFIXES lib lib-release lib_release )
|
||||
|
||||
FIND_LIBRARY( Wt_DEBUG_LIBRARY NAMES wtd wt PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_EXT_DEBUG_LIBRARY NAMES wtextd wtext PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_HTTP_DEBUG_LIBRARY NAMES wthttpd wthttp PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_FCGI_DEBUG_LIBRARY NAMES wtfcgid wtfcgi PATHS PATH PATH_SUFFIXES lib libd lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_DBO_DEBUG_LIBRARY NAMES wtdbod wtdbo PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_DBOSQLITE3_DEBUG_LIBRARY NAMES wtdbosqlite3d wtdbosqlite3 PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
FIND_LIBRARY( Wt_DBOPOSTGRES_DEBUG_LIBRARY NAMES wtdbopostgresd wtdbopostgres PATHS PATH PATH_SUFFIXES lib lib-debug lib_debug HINTS /usr/lib/debug/usr/lib)
|
||||
|
||||
IF( Wt_LIBRARY AND Wt_EXT_LIBRARY AND Wt_HTTP_LIBRARY)
|
||||
SET( Wt_FOUND TRUE )
|
||||
SET( Wt_FIND_REQUIRED_Release TRUE )
|
||||
SET( Wt_LIBRARIES ${Wt_LIBRARY} ${Wt_EXT_LIBRARY} ${Wt_HTTP_LIBRARY} )
|
||||
ENDIF( Wt_LIBRARY AND Wt_EXT_LIBRARY AND Wt_HTTP_LIBRARY)
|
||||
|
||||
IF( Wt_DBO_LIBRARY )
|
||||
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBO_LIBRARY} )
|
||||
IF( Wt_DBOSQLITE3_LIBRARY )
|
||||
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBOSQLITE3_LIBRARY} )
|
||||
ENDIF( Wt_DBOSQLITE3_LIBRARY )
|
||||
IF( Wt_DBOPOSTGRES_LIBRARY )
|
||||
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_DBOPOSTGRES_LIBRARY} )
|
||||
ENDIF( Wt_DBOPOSTGRES_LIBRARY )
|
||||
ENDIF( Wt_DBO_LIBRARY )
|
||||
|
||||
IF( Wt_FCGI_LIBRARY )
|
||||
SET( Wt_LIBRARIES ${Wt_LIBRARIES} ${Wt_FCGI_LIBRARY} )
|
||||
ENDIF( Wt_FCGI_LIBRARY )
|
||||
|
||||
IF( Wt_DEBUG_LIBRARY AND Wt_EXT_DEBUG_LIBRARY AND Wt_HTTP_DEBUG_LIBRARY)
|
||||
SET( Wt_DEBUG_FOUND TRUE )
|
||||
SET( Wt_FIND_REQUIRED_Debug TRUE )
|
||||
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARY} ${Wt_EXT_DEBUG_LIBRARY} ${Wt_HTTP_DEBUG_LIBRARY})
|
||||
ENDIF( Wt_DEBUG_LIBRARY AND Wt_EXT_DEBUG_LIBRARY AND Wt_HTTP_DEBUG_LIBRARY)
|
||||
|
||||
IF( Wt_DBO_DEBUG_LIBRARY )
|
||||
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBO_DEBUG_LIBRARY} )
|
||||
IF( Wt_DBOSQLITE3_DEBUG_LIBRARY )
|
||||
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBOSQLITE3_DEBUG_LIBRARY} )
|
||||
ENDIF( Wt_DBOSQLITE3_DEBUG_LIBRARY )
|
||||
IF( Wt_DBOPOSTGRES_DEBUG_LIBRARY )
|
||||
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_DBOPOSTGRES_DEBUG_LIBRARY} )
|
||||
ENDIF( Wt_DBOPOSTGRES_DEBUG_LIBRARY )
|
||||
ENDIF( Wt_DBO_DEBUG_LIBRARY )
|
||||
|
||||
IF( Wt_FCGI_DEBUG_LIBRARY )
|
||||
SET( Wt_DEBUG_LIBRARIES ${Wt_DEBUG_LIBRARIES} ${Wt_FCGI_DEBUG_LIBRARY} )
|
||||
ENDIF( Wt_FCGI_DEBUG_LIBRARY )
|
||||
|
||||
IF(Wt_FOUND)
|
||||
IF (NOT Wt_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found the Wt libraries at ${Wt_LIBRARIES}")
|
||||
MESSAGE(STATUS "Found the Wt headers at ${Wt_INCLUDE_DIR}")
|
||||
ENDIF (NOT Wt_FIND_QUIETLY)
|
||||
ELSE(Wt_FOUND)
|
||||
IF(Wt_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could NOT find Wt")
|
||||
ENDIF(Wt_FIND_REQUIRED)
|
||||
ENDIF(Wt_FOUND)
|
||||
|
||||
IF(Wt_DEBUG_FOUND)
|
||||
IF (NOT Wt_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found the Wt debug libraries at ${Wt_DEBUG_LIBRARIES}")
|
||||
MESSAGE(STATUS "Found the Wt debug headers at ${Wt_INCLUDE_DIR}")
|
||||
ENDIF (NOT Wt_FIND_QUIETLY)
|
||||
ELSE(Wt_DEBUG_FOUND)
|
||||
IF(Wt_FIND_REQUIRED_Debug)
|
||||
MESSAGE(FATAL_ERROR "Could NOT find Wt debug libraries")
|
||||
ENDIF(Wt_FIND_REQUIRED_Debug)
|
||||
ENDIF(Wt_DEBUG_FOUND)
|
||||
|
||||
ENDIF( Wt_INCLUDE_DIR )
|
43
wt-3.1.7a/cmake/WtFindAsciidoc.txt
Normal file
43
wt-3.1.7a/cmake/WtFindAsciidoc.txt
Normal file
|
@ -0,0 +1,43 @@
|
|||
# - Find Asciidoc
|
||||
# this module looks for asciidoc
|
||||
#
|
||||
# ASCIIDOC_EXECUTABLE - the full path to asciidoc
|
||||
# ASCIIDOC_FOUND - If false, don't attempt to use asciidoc.
|
||||
|
||||
IF(NOT WIN32)
|
||||
FIND_PROGRAM(ASCIIDOC_EXECUTABLE
|
||||
asciidoc
|
||||
)
|
||||
ELSE(NOT WIN32)
|
||||
FIND_PROGRAM(ASCIIDOC_PYTHON python)
|
||||
FIND_FILE(ASCIIDOC_PYFILE asciidoc.py
|
||||
PATHS
|
||||
c:/asciidoc
|
||||
${ASCIIDOC_DIR}
|
||||
)
|
||||
IF(ASCIIDOC_PYTHON AND ASCIIDOC_PYFILE)
|
||||
SET(ASCIIDOC_EXECUTABLE ${ASCIIDOC_PYTHON} ${ASCIIDOC_PYFILE})
|
||||
ENDIF(ASCIIDOC_PYTHON AND ASCIIDOC_PYFILE)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
#MESSAGE(FATAL_ERROR "asciidoc exec: ${ASCIIDOC_EXECUTABLE}")
|
||||
|
||||
IF (NOT ASCIIDOC_EXECUTABLE)
|
||||
SET(ASCIIDOC_FOUND "NO" CACHE BOOL "ASCIIDOC found")
|
||||
ELSE (NOT ASCIIDOC_EXECUTABLE)
|
||||
SET(ASCIIDOC_FOUND "YES" CACHE BOOL "ASCIIDOC found")
|
||||
ENDIF (NOT ASCIIDOC_EXECUTABLE)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ASCIIDOC_EXECUTABLE
|
||||
ASCIIDOC_PYTHON
|
||||
ASCIIDOC_PYFILE
|
||||
ASCIIDOC_FOUND
|
||||
)
|
||||
|
||||
|
||||
IF (NOT ASCIIDOC_FOUND AND Asciidoc_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find asciidoc")
|
||||
ENDIF (NOT ASCIIDOC_FOUND AND Asciidoc_FIND_REQUIRED)
|
||||
|
||||
|
53
wt-3.1.7a/cmake/WtFindAsio.txt
Normal file
53
wt-3.1.7a/cmake/WtFindAsio.txt
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Attention: must have done WtFindBoost.txt before this one!
|
||||
#
|
||||
# This defines:
|
||||
# - ASIO_INCLUDE_DIRS
|
||||
# - ASIO_LIBRARIES
|
||||
# - ASIO_DEFINITIONS
|
||||
# - ASIO_FOUND
|
||||
#
|
||||
# This file will search for both plain and boost kinds of asio, and
|
||||
# set up the correct includes and libraries
|
||||
# ASIO_LIBRARIES is set to the boost system library, if the boost
|
||||
# version of asio was detected. Otherwise, it remains empty.
|
||||
|
||||
|
||||
#FIND_PATH(PLAIN_ASIO_INCLUDE
|
||||
# NAMES
|
||||
# asio.hpp
|
||||
# PATHS
|
||||
# ${BOOST_INCLUDE_DIRS}
|
||||
# /usr/include
|
||||
# /usr/local/include
|
||||
#)
|
||||
|
||||
IF(BOOST_WTHTTP_FOUND)
|
||||
FIND_PATH(BOOST_ASIO_INCLUDE
|
||||
NAMES
|
||||
boost/asio.hpp
|
||||
PATHS
|
||||
${BOOST_INCLUDE_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
ENDIF(BOOST_WTHTTP_FOUND)
|
||||
|
||||
SET(ASIO_FOUND FALSE)
|
||||
SET(ASIO_DEFINITIONS "")
|
||||
SET(ASIO_LIBRARIES "")
|
||||
SET(ASIO_INCLUDE_DIRS "")
|
||||
|
||||
IF(PLAIN_ASIO_INCLUDE)
|
||||
SET (ASIO_INCLUDE_DIRS ${PLAIN_ASIO_INCLUDE})
|
||||
SET (ASIO_LIBRARIES "")
|
||||
SET(ASIO_FOUND TRUE)
|
||||
ELSE(PLAIN_ASIO_INCLUDE)
|
||||
IF(BOOST_ASIO_INCLUDE
|
||||
AND DEFINED BOOST_WT_SYSTEM_LIBRARY)
|
||||
SET (ASIO_INCLUDE ${BOOST_ASIO_INCLUDE})
|
||||
SET(ASIO_DEFINITIONS -DBOOST_ASIO)
|
||||
SET(ASIO_LIBRARIES ${BOOST_WT_SYSTEM_LIBRARY})
|
||||
SET(ASIO_FOUND TRUE)
|
||||
ENDIF(BOOST_ASIO_INCLUDE
|
||||
AND DEFINED BOOST_WT_SYSTEM_LIBRARY)
|
||||
ENDIF(PLAIN_ASIO_INCLUDE)
|
||||
|
99
wt-3.1.7a/cmake/WtFindBoost-cmake.txt
Normal file
99
wt-3.1.7a/cmake/WtFindBoost-cmake.txt
Normal file
|
@ -0,0 +1,99 @@
|
|||
# This file sets:
|
||||
# - BOOST_INCLUDE_DIRS
|
||||
# - BOOST_LIB_DIRS
|
||||
# - BOOST_WT_FOUND // All dependencies for wt found
|
||||
# - BOOST_WT_MT_FOUND
|
||||
# - BOOST_WTHTTP_FOUND // All dependencies for wthttp found
|
||||
# - BOOST_WTHTTP_MT_FOUND
|
||||
# - BOOST_SUPPORT_LIBRARIES (should always be added to the boost libs)
|
||||
# - BOOST_WT_LIBRARIES
|
||||
#
|
||||
# Separate compiled boost libraries are also discovered:
|
||||
# - BOOST_DT_LIB
|
||||
# - BOOST_FS_LIB
|
||||
# - BOOST_REGEX_LIB
|
||||
# - BOOST_PO_LIB
|
||||
# - BOOST_SIGNALS_LIB
|
||||
# - BOOST_SYSTEM_LIB
|
||||
# - BOOST_THREAD_LIB (only if BOOST_MT_FOUND)
|
||||
# Boost will try to find the same kind (mt or not) of library for all three
|
||||
# of these libraries. Boost is considered to be found successfully only
|
||||
# when the libraries are all of the same kind (mt or not). If the mt
|
||||
# libraries exits, the mt versions will be used unless MULTI_THREADED is
|
||||
# set to OFF. Otherwise, the non-mt versions will be used.
|
||||
#
|
||||
|
||||
# For starters, see if the cmake-provided scripts are able to find boost
|
||||
SET(BOOST_WT_FOUND FALSE)
|
||||
SET(BOOST_WT_MT_FOUND FALSE)
|
||||
SET(BOOST_WTHTTP_FOUND FALSE)
|
||||
SET(BOOST_WTHTTP_MT_FOUND FALSE)
|
||||
SET(BOOST_SUPPORT_LIBRARIES "")
|
||||
|
||||
IF(NOT DEFINED Boost_ADDITIONAL_VERSIONS)
|
||||
SET(Boost_ADDITIONAL_VERSIONS
|
||||
"1.35" "1.36" "1.37" "1.38" "1.39"
|
||||
"1.40" "1.41" "1.42" "1.43" "1.44" "1.45" "1.46" "1.47" "1.48" "1.49")
|
||||
ENDIF(NOT DEFINED Boost_ADDITIONAL_VERSIONS)
|
||||
|
||||
SET(Boost_USE_MULTITHREADED ON)
|
||||
|
||||
IF(DEFINED BOOST_PREFIX AND NOT DEFINED BOOST_ROOT)
|
||||
SET(BOOST_ROOT ${BOOST_PREFIX})
|
||||
ENDIF(DEFINED BOOST_PREFIX AND NOT DEFINED BOOST_ROOT)
|
||||
|
||||
IF(WIN32)
|
||||
IF(BOOST_DYNAMIC)
|
||||
SET(Boost_USE_STATIC_LIBS OFF)
|
||||
ELSE(BOOST_DYNAMIC)
|
||||
SET(Boost_USE_STATIC_LIBS ON)
|
||||
ENDIF(BOOST_DYNAMIC)
|
||||
ENDIF(WIN32)
|
||||
|
||||
SET(Boost_DEBUG ON)
|
||||
|
||||
FIND_PACKAGE(Boost 1.35
|
||||
COMPONENTS
|
||||
date_time
|
||||
regex
|
||||
program_options
|
||||
signals
|
||||
system
|
||||
filesystem
|
||||
thread
|
||||
REQUIRED)
|
||||
IF (Boost_FOUND)
|
||||
# Translate variables from official cmake names to internally used names
|
||||
SET(BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
|
||||
SET(BOOST_LIB_DIRS ${Boost_LIBRARY_DIRS})
|
||||
SET(BOOST_DT_LIB ${Boost_DATE_TIME_LIBRARY})
|
||||
SET(BOOST_FS_LIB ${Boost_FILESYSTEM_LIBRARY})
|
||||
SET(BOOST_REGEX_LIB ${Boost_REGEX_LIBRARY})
|
||||
SET(BOOST_PO_LIB ${Boost_PROGRAM_OPTIONS_LIBRARY})
|
||||
SET(BOOST_SIGNALS_LIB ${Boost_SIGNALS_LIBRARY})
|
||||
SET(BOOST_SYSTEM_LIB ${Boost_SYSTEM_LIBRARY})
|
||||
SET(BOOST_THREAD_LIB ${Boost_THREAD_LIBRARY})
|
||||
|
||||
SET(BOOST_WT_MT_FOUND TRUE)
|
||||
SET(BOOST_WT_FOUND TRUE)
|
||||
SET(BOOST_WTHTTP_MT_FOUND TRUE)
|
||||
SET(BOOST_WTHTTP_FOUND TRUE)
|
||||
|
||||
IF(MSVC)
|
||||
# use autolink
|
||||
SET(BOOST_WT_LIBRARIES "")
|
||||
SET(BOOST_WTHTTP_LIBRARIES "")
|
||||
ELSE(MSVC)
|
||||
SET(BOOST_WT_LIBRARIES
|
||||
${Boost_THREAD_LIBRARY}
|
||||
${Boost_REGEX_LIBRARY}
|
||||
${Boost_SIGNALS_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
${Boost_DATE_TIME_LIBRARY})
|
||||
SET(BOOST_WTHTTP_LIBRARIES
|
||||
${Boost_THREAD_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_DATE_TIME_LIBRARY})
|
||||
ENDIF(MSVC)
|
||||
ENDIF (Boost_FOUND)
|
294
wt-3.1.7a/cmake/WtFindBoost-vintage.txt
Normal file
294
wt-3.1.7a/cmake/WtFindBoost-vintage.txt
Normal file
|
@ -0,0 +1,294 @@
|
|||
# This file sets:
|
||||
# - BOOST_INCLUDE_DIRS
|
||||
# - BOOST_LIB_DIRS
|
||||
# - BOOST_WT_FOUND // All dependencies for wt found
|
||||
# - BOOST_WT_MT_FOUND
|
||||
# - BOOST_WTHTTP_FOUND // All dependencies for wthttp found
|
||||
# - BOOST_WTHTTP_MT_FOUND
|
||||
# - BOOST_SUPPORT_LIBRARIES (should always be added to the boost libs)
|
||||
#
|
||||
# Separate compiled boost libraries are also discovered:
|
||||
# - BOOST_DT_LIB
|
||||
# - BOOST_FS_LIB
|
||||
# - BOOST_REGEX_LIB
|
||||
# - BOOST_PO_LIB
|
||||
# - BOOST_SIGNALS_LIB
|
||||
# - BOOST_SYSTEM_LIB
|
||||
# - BOOST_THREAD_LIB (only if BOOST_MT_FOUND)
|
||||
# Boost will try to find the same kind (mt or not) of library for all three
|
||||
# of these libraries. Boost is considered to be found successfully only
|
||||
# when the libraries are all of the same kind (mt or not). If the mt
|
||||
# libraries exits, the mt versions will be used unless MULTI_THREADED is
|
||||
# set to OFF. Otherwise, the non-mt versions will be used.
|
||||
|
||||
FIND_PATH(BOOST_INCLUDE_DIRS
|
||||
boost/lexical_cast.hpp
|
||||
PATHS
|
||||
${BOOST_PREFIX}/include
|
||||
${BOOST_PREFIX}/include/${BOOST_VERSION}
|
||||
${BOOST_PREFIX}/include/boost-${BOOST_VERSION}
|
||||
${BOOST_PREFIX}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
#SET (BOOST_LIB_DIRS "${BOOST_PREFIX}/lib ${BOOST_PREFIX}/lib64")
|
||||
SET (BOOST_LIB_DIRS ${BOOST_PREFIX}/lib)
|
||||
|
||||
IF(MSVC)
|
||||
# FIXME: write some TRY_COMPILEs here to verify that these libs exist
|
||||
SET(BOOST_SUPPORT_LIBRARIES "")
|
||||
ELSE(MSVC)
|
||||
FIND_LIBRARY(BOOST_THREAD_LIB
|
||||
NAMES
|
||||
boost_thread-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_thread-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_thread-${BOOST_COMPILER}-mt
|
||||
boost_thread-mt-${BOOST_VERSION}
|
||||
boost_thread-mt
|
||||
boost_thread-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_thread-${BOOST_COMPILER}
|
||||
boost_thread-${BOOST_VERSION}
|
||||
boost_thread
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_REGEX_LIB
|
||||
NAMES
|
||||
boost_regex-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_regex-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_regex-${BOOST_COMPILER}-mt
|
||||
boost_regex-mt-${BOOST_VERSION}
|
||||
boost_regex-mt
|
||||
boost_regex-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_regex-${BOOST_COMPILER}
|
||||
boost_regex-${BOOST_VERSION}
|
||||
boost_regex
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_PO_LIB
|
||||
NAMES
|
||||
boost_program_options-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_program_options-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_program_options-${BOOST_COMPILER}-mt
|
||||
boost_program_options-mt-${BOOST_VERSION}
|
||||
boost_program_options-mt
|
||||
boost_program_options-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_program_options-${BOOST_COMPILER}
|
||||
boost_program_options-${BOOST_VERSION}
|
||||
boost_program_options
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_DT_LIB
|
||||
NAMES
|
||||
boost_date_time-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_date_time-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_date_time-${BOOST_COMPILER}-mt
|
||||
boost_date_time-mt-${BOOST_VERSION}
|
||||
boost_date_time-mt
|
||||
boost_date_time-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_date_time-${BOOST_COMPILER}
|
||||
boost_date_time-${BOOST_VERSION}
|
||||
boost_date_time
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_SIGNALS_LIB
|
||||
NAMES
|
||||
boost_signals-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_signals-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_signals-${BOOST_COMPILER}-mt
|
||||
boost_signals-mt-${BOOST_VERSION}
|
||||
boost_signals-mt
|
||||
boost_signals-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_signals-${BOOST_COMPILER}
|
||||
boost_signals-${BOOST_VERSION}
|
||||
boost_signals
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_SYSTEM_LIB
|
||||
NAMES
|
||||
boost_system-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_system-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_system-${BOOST_COMPILER}-mt
|
||||
boost_system-mt-${BOOST_VERSION}
|
||||
boost_system-mt
|
||||
boost_system-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_system-${BOOST_COMPILER}
|
||||
boost_system-${BOOST_VERSION}
|
||||
boost_system
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(BOOST_FS_LIB
|
||||
NAMES
|
||||
boost_filesystem-${BOOST_COMPILER}-mt-${BOOST_FLAGS}-${BOOST_VERSION}
|
||||
boost_filesystem-${BOOST_COMPILER}-mt-${BOOST_VERSION}
|
||||
boost_filesystem-${BOOST_COMPILER}-mt
|
||||
boost_filesystem-mt-${BOOST_VERSION}
|
||||
boost_filesystem-mt
|
||||
boost_filesystem-${BOOST_COMPILER}-${BOOST_VERSION}
|
||||
boost_filesystem-${BOOST_COMPILER}
|
||||
boost_filesystem-${BOOST_VERSION}
|
||||
boost_filesystem
|
||||
PATHS
|
||||
${BOOST_LIB_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# FIXME: todo for Linux
|
||||
SET(RT_LIB "rt")
|
||||
SET(OTHER_LIBS "-lpthread")
|
||||
SET(BOOST_SUPPORT_LIBRARIES "")
|
||||
ENDIF(MSVC)
|
||||
|
||||
SET(BOOST_WT_FOUND FALSE)
|
||||
SET(BOOST_WT_MT_FOUND FALSE)
|
||||
SET(BOOST_WTHTTP_FOUND FALSE)
|
||||
SET(BOOST_WTHTTP_MT_FOUND FALSE)
|
||||
|
||||
IF(BOOST_INCLUDE_DIRS)
|
||||
IF(MSVC)
|
||||
# This is not really tested by this script yet - assume availability
|
||||
SET(BOOST_WT_MT_FOUND TRUE)
|
||||
SET(BOOST_WT_FOUND TRUE)
|
||||
SET(BOOST_WTHTTP_MT_FOUND TRUE)
|
||||
SET(BOOST_WTHTTP_FOUND TRUE)
|
||||
SET(BOOST_WT_LIBRARIES "")
|
||||
|
||||
SET(BOOST_WT_THREAD_LIBRARY "")
|
||||
SET(BOOST_WT_REGEX_LIBRARY "")
|
||||
SET(BOOST_WT_SIGNALS_LIBRARY "")
|
||||
SET(BOOST_WT_DT_LIBRARY "")
|
||||
SET(BOOST_WT_SYSTEM_LIBRARY "")
|
||||
|
||||
SET(BOOST_WTHTTP_THREAD_LIBRARY "")
|
||||
SET(BOOST_WTHTTP_FS_LIBRARY "")
|
||||
SET(BOOST_WTHTTP_PO_LIBRARY "")
|
||||
SET(BOOST_WTHTTP_DT_LIBRARY "")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(NOT BOOST_WT_FOUND
|
||||
AND MULTI_THREADED
|
||||
AND BOOST_THREAD_LIB
|
||||
AND BOOST_REGEX_LIB
|
||||
AND BOOST_SIGNALS_LIB
|
||||
AND BOOST_SYSTEM_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
SET(BOOST_WT_MT_FOUND TRUE)
|
||||
SET(BOOST_WT_FOUND TRUE)
|
||||
|
||||
SET(BOOST_WT_LIBRARIES
|
||||
${BOOST_THREAD_LIB}
|
||||
${BOOST_REGEX_LIB}
|
||||
${BOOST_SIGNALS_LIB}
|
||||
${BOOST_SYSTEM_LIB}
|
||||
${BOOST_DT_LIB})
|
||||
|
||||
SET(BOOST_WT_THREAD_LIBRARY ${BOOST_THREAD_LIB})
|
||||
SET(BOOST_WT_REGEX_LIBRARY ${BOOST_REGEX_LIB})
|
||||
SET(BOOST_WT_SIGNALS_LIBRARY ${BOOST_SIGNALS_LIB})
|
||||
SET(BOOST_WT_SYSTEM_LIBRARY ${BOOST_SYSTEM_LIB})
|
||||
SET(BOOST_WT_DT_LIBRARY ${BOOST_DT_LIB})
|
||||
|
||||
ENDIF(NOT BOOST_WT_FOUND
|
||||
AND MULTI_THREADED
|
||||
AND BOOST_THREAD_LIB
|
||||
AND BOOST_REGEX_LIB
|
||||
AND BOOST_SIGNALS_LIB
|
||||
AND BOOST_SYSTEM_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
IF(NOT BOOST_WT_FOUND
|
||||
AND BOOST_REGEX_LIB
|
||||
AND BOOST_SIGNALS_LIB
|
||||
AND BOOST_SYSTEM_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
SET(BOOST_WT_MT_FOUND FALSE)
|
||||
SET(BOOST_WT_FOUND TRUE)
|
||||
|
||||
SET(BOOST_WT_LIBRARIES
|
||||
${BOOST_REGEX_LIB}
|
||||
${BOOST_SIGNALS_LIB}
|
||||
${BOOST_SYSTEM_LIB}
|
||||
${BOOST_DT_LIB})
|
||||
|
||||
SET(BOOST_WT_REGEX_LIBRARY ${BOOST_REGEX_LIB})
|
||||
SET(BOOST_WT_SIGNALS_LIBRARY ${BOOST_SIGNALS_LIB})
|
||||
SET(BOOST_WT_SYSTEM_LIBRARY ${BOOST_SYSTEM_LIB})
|
||||
SET(BOOST_WT_DT_LIBRARY ${BOOST_DT_LIB})
|
||||
|
||||
ENDIF(NOT BOOST_WT_FOUND
|
||||
AND BOOST_REGEX_LIB
|
||||
AND BOOST_SIGNALS_LIB
|
||||
AND BOOST_SYSTEM_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
IF(NOT BOOST_WTHTTP_FOUND
|
||||
AND MULTI_THREADED
|
||||
AND BOOST_THREAD_LIB
|
||||
AND BOOST_FS_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
SET(BOOST_WTHTTP_MT_FOUND TRUE)
|
||||
SET(BOOST_WTHTTP_FOUND TRUE)
|
||||
|
||||
SET(BOOST_WTHTTP_LIBRARIES
|
||||
${BOOST_THREAD_LIB}
|
||||
${BOOST_FS_LIB}
|
||||
${BOOST_PO_LIB}
|
||||
${BOOST_DT_LIB})
|
||||
|
||||
SET(BOOST_WTHTTP_THREAD_LIBRARY ${BOOST_THREAD_LIB})
|
||||
SET(BOOST_WTHTTP_FS_LIBRARY ${BOOST_FS_LIB})
|
||||
SET(BOOST_WTHTTP_PO_LIBRARY ${BOOST_PO_LIB})
|
||||
SET(BOOST_WTHTTP_DT_LIBRARY ${BOOST_DT_LIB})
|
||||
|
||||
ENDIF(NOT BOOST_WTHTTP_FOUND
|
||||
AND MULTI_THREADED
|
||||
AND BOOST_THREAD_LIB
|
||||
AND BOOST_FS_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
IF(NOT BOOST_WTHTTP_FOUND
|
||||
AND BOOST_FS_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
SET(BOOST_WTHTTP_MT_FOUND FALSE)
|
||||
SET(BOOST_WTHTTP_FOUND TRUE)
|
||||
|
||||
SET(BOOST_WTHTTP_LIBRARIES
|
||||
${BOOST_FS_LIB}
|
||||
${BOOST_PO_LIB}
|
||||
${BOOST_DT_LIB})
|
||||
|
||||
SET(BOOST_WTHTTP_FS_LIBRARY ${BOOST_FS_LIB})
|
||||
SET(BOOST_WTHTTP_PO_LIBRARY ${BOOST_PO_LIB})
|
||||
SET(BOOST_WTHTTP_DT_LIBRARY ${BOOST_DT_LIB})
|
||||
|
||||
ENDIF(NOT BOOST_WTHTTP_FOUND
|
||||
AND BOOST_FS_LIB
|
||||
AND BOOST_PO_LIB
|
||||
AND BOOST_DT_LIB)
|
||||
|
||||
ENDIF(BOOST_INCLUDE_DIRS)
|
6
wt-3.1.7a/cmake/WtFindBoost.txt
Normal file
6
wt-3.1.7a/cmake/WtFindBoost.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Includes the appropriate boost finder
|
||||
IF(WT_BOOST_DISCOVERY)
|
||||
INCLUDE(${WT_SOURCE_DIR}/cmake/WtFindBoost-vintage.txt)
|
||||
ELSE(WT_BOOST_DISCOVERY)
|
||||
INCLUDE(${WT_SOURCE_DIR}/cmake/WtFindBoost-cmake.txt)
|
||||
ENDIF(WT_BOOST_DISCOVERY)
|
39
wt-3.1.7a/cmake/WtFindFcgi.txt
Normal file
39
wt-3.1.7a/cmake/WtFindFcgi.txt
Normal file
|
@ -0,0 +1,39 @@
|
|||
# This file sets:
|
||||
# - FCGI_INCLUDE_DIRS
|
||||
# - FCGI_LIBRARIES
|
||||
# - FCGI_FOUND
|
||||
#
|
||||
# Taking into account:
|
||||
# - FCGI_PREFIX
|
||||
|
||||
FIND_PATH(FCGI_INCLUDE_DIR
|
||||
fcgio.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/include/fastcgi
|
||||
)
|
||||
|
||||
FIND_LIBRARY(FCGI_LIB fcgi
|
||||
${FCGI_PREFIX}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(FCGIPP_LIB fcgi++
|
||||
${FCGI_PREFIX}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
SET(FCGI_FOUND FALSE)
|
||||
|
||||
IF(FCGI_INCLUDE_DIR
|
||||
AND FCGI_LIB
|
||||
AND FCGIPP_LIB)
|
||||
SET(FCGI_FOUND TRUE)
|
||||
SET(FCGI_LIBRARIES ${FCGI_LIB} ${FCGIPP_LIB})
|
||||
SET(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
|
||||
ENDIF(FCGI_INCLUDE_DIR
|
||||
AND FCGI_LIB
|
||||
AND FCGIPP_LIB)
|
81
wt-3.1.7a/cmake/WtFindGm.txt
Normal file
81
wt-3.1.7a/cmake/WtFindGm.txt
Normal file
|
@ -0,0 +1,81 @@
|
|||
# We set:
|
||||
# - GM_INCLUDE_DIRS
|
||||
# - GM_LIBRARIES
|
||||
# - GM_FOUND
|
||||
# Taking into account:
|
||||
# - GM_PREFIX
|
||||
|
||||
FIND_PATH(GM_INCLUDE_DIR
|
||||
magick/api.h
|
||||
PATHS
|
||||
${GM_PREFIX}/include/GraphicsMagick/
|
||||
${GM_PREFIX}/include/
|
||||
${GM_PREFIX}/
|
||||
/usr/include/GraphicsMagick/
|
||||
/usr/include/
|
||||
/usr/local/include/GraphicsMagick/
|
||||
/usr/local/include/
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(GM_LIB
|
||||
NAMES
|
||||
CORE_DB_Magick_
|
||||
PATHS
|
||||
${GM_PREFIX}/VisualMagick/lib/Release
|
||||
${GM_PREFIX}/VisualMagick/lib
|
||||
)
|
||||
FIND_LIBRARY(GMPP_LIB
|
||||
NAMES
|
||||
CORE_DB_Magick++_
|
||||
PATHS
|
||||
${GM_PREFIX}/VisualMagick/lib/Release
|
||||
${GM_PREFIX}/VisualMagick/lib
|
||||
)
|
||||
FIND_LIBRARY(GM_LIB_DEBUG
|
||||
NAMES
|
||||
CORE_DB_Magick_
|
||||
PATHS
|
||||
${GM_PREFIX}/VisualMagick/lib/Debug
|
||||
${GM_PREFIX}/VisualMagick/lib
|
||||
)
|
||||
FIND_LIBRARY(GMPP_LIB_DEBUG
|
||||
NAMES
|
||||
CORE_DB_Magick++_
|
||||
PATHS
|
||||
${GM_PREFIX}/VisualMagick/lib/Debug
|
||||
${GM_PREFIX}/VisualMagick/lib
|
||||
)
|
||||
|
||||
IF(GM_LIB AND GMPP_LIB AND GM_LIB_DEBUG AND GMPP_LIB_DEBUG AND GM_INCLUDE_DIR)
|
||||
SET(GM_FOUND TRUE)
|
||||
SET(GM_INCLUDE_DIRS ${GM_INCLUDE_DIR})
|
||||
SET(GM_LIBRARIES
|
||||
optimized ${GM_LIB}
|
||||
optimized ${GMPP_LIB}
|
||||
debug ${GM_LIB_DEBUG}
|
||||
debug ${GMPP_LIB_DEBUG}
|
||||
${GM_SUPPORT_LIBS}
|
||||
)
|
||||
ELSE(GM_LIB AND GMPP_LIB AND GM_LIB_DEBUG AND GMPP_LIB_DEBUG AND GM_INCLUDE_DIR)
|
||||
SET(GM_FOUND FALSE)
|
||||
ENDIF(GM_LIB AND GMPP_LIB AND GM_LIB_DEBUG AND GMPP_LIB_DEBUG AND GM_INCLUDE_DIR)
|
||||
ELSE(WIN32)
|
||||
FIND_LIBRARY(GM_LIB
|
||||
NAMES
|
||||
GraphicsMagick
|
||||
PATHS
|
||||
${GM_PREFIX}/lib
|
||||
)
|
||||
|
||||
IF(GM_LIB AND GM_INCLUDE_DIR)
|
||||
SET(GM_FOUND TRUE)
|
||||
SET(GM_INCLUDE_DIRS ${GM_INCLUDE_DIR})
|
||||
SET(GM_LIBRARIES ${GM_LIB} ${GM_SUPPORT_LIBS})
|
||||
ELSE(GM_LIB AND GM_INCLUDE_DIR)
|
||||
SET(GM_FOUND FALSE)
|
||||
ENDIF(GM_LIB AND GM_INCLUDE_DIR)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
|
97
wt-3.1.7a/cmake/WtFindHaru.txt
Normal file
97
wt-3.1.7a/cmake/WtFindHaru.txt
Normal file
|
@ -0,0 +1,97 @@
|
|||
# We set:
|
||||
# - HARU_INCLUDE_DIRS
|
||||
# - HARU_LIBRARIES
|
||||
# - HARU_FOUND
|
||||
# Taking into account:
|
||||
# - HARU_PREFIX
|
||||
|
||||
FIND_PATH(HARU_INCLUDE_DIR
|
||||
hpdf.h
|
||||
PATHS
|
||||
${HARU_PREFIX}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/local/include/hpdf
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(HARU_LIB_RELEASE
|
||||
NAMES
|
||||
libhpdf
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
)
|
||||
FIND_LIBRARY(HARU_LIB_DEBUG
|
||||
NAMES
|
||||
libhpdfd
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
)
|
||||
FIND_LIBRARY(PNG_LIB_RELEASE
|
||||
NAMES
|
||||
libpng
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
)
|
||||
FIND_LIBRARY(PNG_LIB_DEBUG
|
||||
NAMES
|
||||
libpngd
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
)
|
||||
IF(HARU_LIB_RELEASE AND HARU_LIB_DEBUG AND PNG_LIB_RELEASE AND PNG_LIB_DEBUG)
|
||||
SET(HARU_LIB optimized ${HARU_LIB_RELEASE} optimized ${PNG_LIB_RELEASE} debug ${HARU_LIB_DEBUG} debug ${PNG_LIB_RELEASE})
|
||||
SET(HARU_SUPPORT_LIBS "")
|
||||
ENDIF(HARU_LIB_RELEASE AND HARU_LIB_DEBUG AND PNG_LIB_RELEASE
|
||||
AND PNG_LIB_DEBUG)
|
||||
SET(HARU_SUPPORT_LIBS_FOUND TRUE)
|
||||
ELSE(WIN32)
|
||||
FIND_LIBRARY(HARU_LIB
|
||||
NAMES
|
||||
hpdf
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(PNG_LIB
|
||||
NAMES
|
||||
png png12 png14
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
${USERLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(M_LIB
|
||||
NAMES
|
||||
m
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
${USERLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(Z_LIB
|
||||
NAMES
|
||||
z
|
||||
PATHS
|
||||
${HARU_PREFIX}/lib
|
||||
${USERLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
SET(HARU_SUPPORT_LIBS_FOUND FALSE)
|
||||
|
||||
IF (PNG_LIB AND M_LIB AND Z_LIB)
|
||||
SET(HARU_SUPPORT_LIBS_FOUND TRUE)
|
||||
SET(HARU_SUPPORT_LIBS ${PNG_LIB} ${M_LIB} ${Z_LIB})
|
||||
ENDIF (PNG_LIB AND M_LIB AND Z_LIB)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(HARU_LIB AND HARU_INCLUDE_DIR AND HARU_SUPPORT_LIBS_FOUND)
|
||||
SET(HARU_FOUND TRUE)
|
||||
SET(HARU_INCLUDE_DIRS ${HARU_INCLUDE_DIR})
|
||||
SET(HARU_LIBRARIES ${HARU_LIB} ${HARU_SUPPORT_LIBS})
|
||||
ELSE(HARU_LIB AND HARU_INCLUDE_DIR AND HARU_SUPPORT_LIBS_FOUND)
|
||||
SET(HARU_FOUND FALSE)
|
||||
ENDIF(HARU_LIB AND HARU_INCLUDE_DIR AND HARU_SUPPORT_LIBS_FOUND)
|
||||
|
||||
|
||||
|
49
wt-3.1.7a/cmake/WtFindMysqlpp.txt
Normal file
49
wt-3.1.7a/cmake/WtFindMysqlpp.txt
Normal file
|
@ -0,0 +1,49 @@
|
|||
# This file defines:
|
||||
# - MYSQLPP_LIBRARIES
|
||||
# - MYSQLPP_INCLUDE_DIRS
|
||||
# - MYSQLPP_FOUND
|
||||
# - MSQLPP_DEFINITIONS
|
||||
# Taking into account:
|
||||
# - MYSQL_PREFIX
|
||||
|
||||
FIND_LIBRARY(MYSQLPP_LIBRARIES mysqlpp
|
||||
${MYSQL_PREFIX}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
)
|
||||
|
||||
FIND_PATH(MYSQLPP_INCLUDE mysql++/mysql++.h
|
||||
${MYSQL_PREFIX}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
)
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE mysql.h
|
||||
${MYSQL_PREFIX}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/include/mysql
|
||||
/opt/local/include/mysql5/mysql
|
||||
/usr/local/include/mysql
|
||||
)
|
||||
|
||||
SET(MYSQLPP_FOUND FALSE)
|
||||
|
||||
IF(MYSQLPP_LIBRARIES
|
||||
AND MYSQLPP_INCLUDE
|
||||
AND MYSQL_INCLUDE)
|
||||
SET(MYSQLPP_FOUND TRUE)
|
||||
SET(MYSQLPP_INCLUDE_DIRS ${MYSQLPP_INCLUDE} ${MYSQL_INCLUDE})
|
||||
IF(WIN32)
|
||||
# Static linkage of mysqlpp, hence we don't want __declspecs
|
||||
SET(MSQLPP_DEFINITIONS -DMYSQLPP_NO_DLL)
|
||||
ELSE(WIN32)
|
||||
SET(MSQLPP_DEFINITIONS "")
|
||||
ENDIF(WIN32)
|
||||
|
||||
ENDIF(MYSQLPP_LIBRARIES
|
||||
AND MYSQLPP_INCLUDE
|
||||
AND MYSQL_INCLUDE)
|
||||
|
35
wt-3.1.7a/cmake/WtFindPostgresql.txt
Normal file
35
wt-3.1.7a/cmake/WtFindPostgresql.txt
Normal file
|
@ -0,0 +1,35 @@
|
|||
# This file defines:
|
||||
# - POSTGRES_LIBRARIES
|
||||
# - POSTGRES_INCLUDE_DIRS
|
||||
# - POSTGRES_FOUND
|
||||
# Taking into account:
|
||||
# - POSTGRES_PREFIX
|
||||
|
||||
FIND_LIBRARY(POSTGRES_LIBRARIES
|
||||
NAMES
|
||||
pq libpq
|
||||
PATHS
|
||||
${POSTGRES_PREFIX}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
)
|
||||
|
||||
FIND_PATH(POSTGRES_INCLUDE libpq-fe.h
|
||||
${POSTGRES_PREFIX}/include
|
||||
${POSTGRES_PREFIX}/postgresql/include
|
||||
/usr/include
|
||||
/usr/include/postgresql
|
||||
/usr/local/include
|
||||
/usr/local/include/postgresql
|
||||
/opt/local/include
|
||||
/opt/local/include/postgresql
|
||||
)
|
||||
|
||||
SET(POSTGRES_FOUND FALSE)
|
||||
|
||||
IF(POSTGRES_LIBRARIES AND POSTGRES_INCLUDE)
|
||||
SET(POSTGRES_FOUND TRUE)
|
||||
SET(POSTGRES_INCLUDE_DIRS ${POSTGRES_INCLUDE})
|
||||
ENDIF(POSTGRES_LIBRARIES AND POSTGRES_INCLUDE)
|
||||
|
106
wt-3.1.7a/cmake/WtFindSsl.txt
Normal file
106
wt-3.1.7a/cmake/WtFindSsl.txt
Normal file
|
@ -0,0 +1,106 @@
|
|||
# We define:
|
||||
# - SSL_INCLUDE_DIRS
|
||||
# - SSL_LIBRARIES
|
||||
# - SSL_FOUND
|
||||
# Taking into account:
|
||||
# - SSL_PREFIX
|
||||
#
|
||||
# Remark for Win32 users: This file searches for both debug and release
|
||||
# versions of the OpenSSL library. We assume that debug libs are compiled
|
||||
# with /MDd, and release with /MD. Apparently that is what CMake uses for
|
||||
# these modes; it is currently unclear to me if cmake ever uses /MT variants.
|
||||
|
||||
FIND_PATH(SSL_INCLUDE_DIRS openssl/ssl.h
|
||||
${SSL_PREFIX}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
c:/openssl/include
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(SSL_LIB_RELEASE
|
||||
NAMES
|
||||
ssl
|
||||
ssleay32MD
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${SSL_PREFIX}/lib
|
||||
c:/openssl/lib/VC
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SSL_LIB_DEBUG
|
||||
NAMES
|
||||
ssleay32MDd
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${SSL_PREFIX}/lib
|
||||
c:/openssl/lib/VC
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SSL_TOO_LIB_RELEASE
|
||||
NAMES
|
||||
libeay32MD
|
||||
PATHS
|
||||
${SSL_PREFIX}/lib
|
||||
c:/openssl/lib/VC
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SSL_TOO_LIB_DEBUG
|
||||
NAMES
|
||||
libeay32MDd
|
||||
PATHS
|
||||
${SSL_PREFIX}/lib
|
||||
c:/openssl/lib/VC
|
||||
)
|
||||
|
||||
# We require both release and debug versions of the SSL libs. People who
|
||||
# really know what they are doing, may edit this file to relax this requirement.
|
||||
IF(SSL_INCLUDE_DIRS
|
||||
AND SSL_LIB_RELEASE
|
||||
AND SSL_LIB_DEBUG
|
||||
AND SSL_TOO_LIB_RELEASE
|
||||
AND SSL_TOO_LIB_DEBUG)
|
||||
SET(SSL_FOUND true)
|
||||
SET(SSL_LIBRARIES
|
||||
optimized ${SSL_LIB_RELEASE} debug ${SSL_LIB_DEBUG}
|
||||
optimized ${SSL_TOO_LIB_RELEASE} debug ${SSL_TOO_LIB_DEBUG})
|
||||
ELSE(SSL_INCLUDE_DIRS
|
||||
AND SSL_LIB_RELEASE
|
||||
AND SSL_LIB_DEBUG
|
||||
AND SSL_TOO_LIB_RELEASE
|
||||
AND SSL_TOO_LIB_DEBUG)
|
||||
SET(SSL_FOUND false)
|
||||
ENDIF(SSL_INCLUDE_DIRS
|
||||
AND SSL_LIB_RELEASE
|
||||
AND SSL_LIB_DEBUG
|
||||
AND SSL_TOO_LIB_RELEASE
|
||||
AND SSL_TOO_LIB_DEBUG)
|
||||
ELSE (WIN32)
|
||||
FIND_LIBRARY(SSL_LIB
|
||||
NAMES
|
||||
ssl
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${SSL_PREFIX}/lib
|
||||
)
|
||||
ENDIF (WIN32)
|
||||
|
||||
IF(SSL_LIB
|
||||
AND SSL_INCLUDE_DIRS)
|
||||
IF(WIN32)
|
||||
IF(SSL_TOO_LIB)
|
||||
SET(SSL_FOUND true)
|
||||
SET(SSL_LIBRARIES ${SSL_LIB} ${SSL_TOO_LIB})
|
||||
ELSE(SSL_TOO_LIB)
|
||||
SET(SSL_FOUND false)
|
||||
ENDIF(SSL_TOO_LIB)
|
||||
ELSE(WIN32)
|
||||
SET(SSL_FOUND true)
|
||||
SET(SSL_LIBRARIES ${SSL_LIB} -lcrypto)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(SSL_LIB
|
||||
AND SSL_INCLUDE_DIRS)
|
||||
|
55
wt-3.1.7a/cmake/WtFindZlib.txt
Normal file
55
wt-3.1.7a/cmake/WtFindZlib.txt
Normal file
|
@ -0,0 +1,55 @@
|
|||
# This file defines:
|
||||
# - ZLIB_INCLUDE_DIRS
|
||||
# - ZLIB_LIBRARIES
|
||||
# - ZLIB_FOUND
|
||||
# - ZLIB_DEFINITIONS
|
||||
# Taking into account:
|
||||
# - ZLIB_PREFIX
|
||||
|
||||
FIND_PATH(ZLIB_INCLUDE zlib.h
|
||||
${ZLIB_PREFIX}/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(ZLIB_LIB_RELEASE
|
||||
NAMES
|
||||
zlibstat
|
||||
PATHS
|
||||
/usr/lib
|
||||
${ZLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(ZLIB_LIB_DEBUG
|
||||
NAMES
|
||||
zlibstatd
|
||||
PATHS
|
||||
${ZLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
IF(ZLIB_INCLUDE AND ZLIB_LIB_RELEASE AND ZLIB_LIB_DEBUG)
|
||||
SET(ZLIB_FOUND TRUE)
|
||||
SET(ZLIB_DEFINITIONS -DZLIB_WINAPI)
|
||||
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE})
|
||||
SET(ZLIB_LIBRARIES optimized ${ZLIB_LIB_RELEASE} debug ${ZLIB_LIB_DEBUG})
|
||||
ELSE(ZLIB_INCLUDE AND ZLIB_LIB_RELEASE AND ZLIB_LIB_DEBUG)
|
||||
SET(ZLIB_FOUND FALSE)
|
||||
ENDIF(ZLIB_INCLUDE AND ZLIB_LIB_RELEASE AND ZLIB_LIB_DEBUG)
|
||||
ELSE(WIN32)
|
||||
FIND_LIBRARY(ZLIB_LIB
|
||||
NAMES
|
||||
z
|
||||
PATHS
|
||||
/usr/lib
|
||||
${ZLIB_PREFIX}/lib
|
||||
)
|
||||
|
||||
IF(ZLIB_INCLUDE AND ZLIB_LIB)
|
||||
SET(ZLIB_FOUND TRUE)
|
||||
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE})
|
||||
SET(ZLIB_LIBRARIES ${ZLIB_LIB})
|
||||
ELSE(ZLIB_INCLUDE AND ZLIB_LIB)
|
||||
SET(ZLIB_FOUND FALSE)
|
||||
ENDIF(ZLIB_INCLUDE AND ZLIB_LIB)
|
||||
ENDIF(WIN32)
|
||||
|
50
wt-3.1.7a/doc/examples/html/AddresseeEdit_8C.html
Normal file
50
wt-3.1.7a/doc/examples/html/AddresseeEdit_8C.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.C File Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.C File Reference</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<code>#include <boost/tokenizer.hpp></code><br/>
|
||||
<code>#include <boost/algorithm/string.hpp></code><br/>
|
||||
<code>#include <Wt/WContainerWidget></code><br/>
|
||||
<code>#include "<a class="el" href="AddresseeEdit_8h_source.html">AddresseeEdit.h</a>"</code><br/>
|
||||
<code>#include "<a class="el" href="Label_8h_source.html">Label.h</a>"</code><br/>
|
||||
|
||||
<p><a href="AddresseeEdit_8C_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
</table>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
127
wt-3.1.7a/doc/examples/html/AddresseeEdit_8C_source.html
Normal file
127
wt-3.1.7a/doc/examples/html/AddresseeEdit_8C_source.html
Normal file
|
@ -0,0 +1,127 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.C Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.C</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<a href="AddresseeEdit_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
|
||||
<a name="l00003"></a>00003 <span class="comment"> *</span>
|
||||
<a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span>
|
||||
<a name="l00005"></a>00005 <span class="comment"> */</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <boost/tokenizer.hpp></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include <boost/algorithm/string.hpp></span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include <Wt/WContainerWidget></span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="AddresseeEdit_8h.html">AddresseeEdit.h</a>"</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="Label_8h.html">Label.h</a>"</span>
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a><a class="code" href="classAddresseeEdit.html#aac9972a5a209f9e2b5aeb05a8e4f9f8d">00015</a> <a class="code" href="classAddresseeEdit.html#aac9972a5a209f9e2b5aeb05a8e4f9f8d" title="Create a new addressee edit with the given label.">AddresseeEdit::AddresseeEdit</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>& label, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent,
|
||||
<a name="l00016"></a>00016 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *labelParent)
|
||||
<a name="l00017"></a>00017 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html">WTextArea</a>(parent)
|
||||
<a name="l00018"></a>00018 {
|
||||
<a name="l00019"></a>00019 <a class="code" href="classAddresseeEdit.html#a593dba58d431415e256615718c32cbfc" title="The label associated with this edit.">label_</a> = <span class="keyword">new</span> <a class="code" href="classLabel.html" title="A label.">Label</a>(label, labelParent);
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a>00021 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html#ade46b47350f427f45c9b53ac7e41c5b2">setRows</a>(3); <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html#af429ed3a2b6011c97b4f9ea7f910e079">setColumns</a>(55);
|
||||
<a name="l00022"></a>00022 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ae1b84e31581405358b6d57ec14505234">resize</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html">WLength</a>(99, WLength::Percentage), WLength::Auto);
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a>00024 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a73c0244d363cd2f8bd4814fe1ebee2b1">setInline</a>(<span class="keyword">false</span>); <span class="comment">// for IE to position the suggestions well</span>
|
||||
<a name="l00025"></a>00025 }
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classAddresseeEdit.html#adbf088c1a833e6bdc8d3f3f551d42a98">00027</a> <span class="keywordtype">void</span> <a class="code" href="classAddresseeEdit.html#adbf088c1a833e6bdc8d3f3f551d42a98" title="Set a list of addressees.">AddresseeEdit::setAddressees</a>(<span class="keyword">const</span> std::vector<Contact>& contacts)
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 std::wstring <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html#ad8b89ce30df2b02894c53b6ed71fe4a6">text</a>;
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a>00031 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < contacts.size(); ++i) {
|
||||
<a name="l00032"></a>00032 <span class="keywordflow">if</span> (i != 0)
|
||||
<a name="l00033"></a>00033 text += L<span class="stringliteral">", "</span>;
|
||||
<a name="l00034"></a>00034 text += contacts[i].formatted();
|
||||
<a name="l00035"></a>00035 }
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a>00037 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html#a1f05060c037d13c2c6c26f51f1fb9640">setText</a>(text);
|
||||
<a name="l00038"></a>00038 }
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a><a class="code" href="classAddresseeEdit.html#a6315749900d4e9aea13e5447f8bca027">00040</a> <span class="keywordtype">bool</span> <a class="code" href="classAddresseeEdit.html#a6315749900d4e9aea13e5447f8bca027" title="Parse the addressees into a list of contacts.">AddresseeEdit::parse</a>(std::vector<Contact>& contacts)<span class="keyword"> const</span>
|
||||
<a name="l00041"></a>00041 <span class="keyword"></span>{
|
||||
<a name="l00042"></a>00042 <span class="keyword">typedef</span> boost::tokenizer<boost::escaped_list_separator<wchar_t>,
|
||||
<a name="l00043"></a>00043 std::wstring::const_iterator, std::wstring>
|
||||
<a name="l00044"></a>00044 CsvTokenizer;
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00046"></a>00046 std::wstring t = <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html#ad8b89ce30df2b02894c53b6ed71fe4a6">text</a>();
|
||||
<a name="l00047"></a>00047 CsvTokenizer tok(t);
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a>00049 <span class="keywordflow">for</span> (CsvTokenizer::iterator i = tok.begin(); i != tok.end(); ++i) {
|
||||
<a name="l00050"></a>00050 std::wstring addressee = *i;
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00052"></a>00052 boost::trim(addressee);
|
||||
<a name="l00053"></a>00053 std::wstring::size_type pos = addressee.find_last_of(<span class="charliteral">' '</span>);
|
||||
<a name="l00054"></a>00054 <span class="keywordflow">if</span> (pos != std::string::npos) {
|
||||
<a name="l00055"></a>00055 std::wstring email = addressee.substr(pos + 1);
|
||||
<a name="l00056"></a>00056 std::wstring name = addressee.substr(0, pos);
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00058"></a>00058 boost::trim(email);
|
||||
<a name="l00059"></a>00059 boost::trim(name);
|
||||
<a name="l00060"></a>00060 <span class="keywordflow">if</span> (email[0] == <span class="charliteral">'<'</span>)
|
||||
<a name="l00061"></a>00061 email = email.substr(1);
|
||||
<a name="l00062"></a>00062 <span class="keywordflow">if</span> (email[email.length() - 1] == <span class="charliteral">'>'</span>)
|
||||
<a name="l00063"></a>00063 email = email.substr(0, email.length() - 1);
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keywordflow">if</span> (!email.empty())
|
||||
<a name="l00066"></a>00066 contacts.push_back(<a class="code" href="structContact.html" title="An email contact.">Contact</a>(name, email));
|
||||
<a name="l00067"></a>00067 } <span class="keywordflow">else</span>
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> (!addressee.empty())
|
||||
<a name="l00069"></a>00069 contacts.push_back(<a class="code" href="structContact.html" title="An email contact.">Contact</a>(L<span class="stringliteral">""</span>, addressee));
|
||||
<a name="l00070"></a>00070 }
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00072"></a>00072 }
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a><a class="code" href="classAddresseeEdit.html#ab7dbde2bff2fef234d20617b7ae42e26">00074</a> std::vector<Contact> <a class="code" href="classAddresseeEdit.html#ab7dbde2bff2fef234d20617b7ae42e26" title="Get a list of addressees.">AddresseeEdit::addressees</a>()<span class="keyword"> const</span>
|
||||
<a name="l00075"></a>00075 <span class="keyword"></span>{
|
||||
<a name="l00076"></a>00076 std::vector<Contact> result;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classAddresseeEdit.html#a6315749900d4e9aea13e5447f8bca027" title="Parse the addressees into a list of contacts.">parse</a>(result);
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">return</span> result;
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classAddresseeEdit.html#a7ee58f243d0171e1341059322d92501d">00082</a> <span class="keywordtype">void</span> <a class="code" href="classAddresseeEdit.html#a7ee58f243d0171e1341059322d92501d" title="Reimplement hide() and show() to also hide() and show() the label.">AddresseeEdit::setHidden</a>(<span class="keywordtype">bool</span> how)
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <a class="code" href="classAddresseeEdit.html#a7ee58f243d0171e1341059322d92501d" title="Reimplement hide() and show() to also hide() and show() the label.">WTextArea::setHidden</a>(how);
|
||||
<a name="l00085"></a>00085 <a class="code" href="classAddresseeEdit.html#a593dba58d431415e256615718c32cbfc" title="The label associated with this edit.">label_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#abf00d84015803f7553c9e6650dc10bd4">setHidden</a>(how);
|
||||
<a name="l00086"></a>00086 }
|
||||
</pre></div></div>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
57
wt-3.1.7a/doc/examples/html/AddresseeEdit_8h.html
Normal file
57
wt-3.1.7a/doc/examples/html/AddresseeEdit_8h.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.h File Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#namespaces">Namespaces</a> </div>
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.h File Reference</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<code>#include <Wt/WTextArea></code><br/>
|
||||
<code>#include "<a class="el" href="Contact_8h_source.html">Contact.h</a>"</code><br/>
|
||||
|
||||
<p><a href="AddresseeEdit_8h_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr><td colspan="2"><h2><a name="nested-classes"></a>
|
||||
Classes</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classAddresseeEdit.html">AddresseeEdit</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">An edit field for an email addressee. <a href="classAddresseeEdit.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td colspan="2"><h2><a name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html">Wt</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
82
wt-3.1.7a/doc/examples/html/AddresseeEdit_8h_source.html
Normal file
82
wt-3.1.7a/doc/examples/html/AddresseeEdit_8h_source.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.h Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AddresseeEdit.h</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<a href="AddresseeEdit_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This may look like C code, but it's really -*- C++ -*-</span>
|
||||
<a name="l00002"></a>00002 <span class="comment">/*</span>
|
||||
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
|
||||
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||
<a name="l00005"></a>00005 <span class="comment"> * See the LICENSE file for terms of use.</span>
|
||||
<a name="l00006"></a>00006 <span class="comment"> */</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#ifndef ADDRESSEE_EDIT_H_</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define ADDRESSEE_EDIT_H_</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include <Wt/WTextArea></span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="Contact_8h.html">Contact.h</a>"</span>
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="keyword">using namespace </span>Wt;
|
||||
<a name="l00015"></a>00015
|
||||
<a name="l00016"></a>00016 <span class="keyword">namespace </span>Wt {
|
||||
<a name="l00017"></a>00017 <span class="keyword">class </span><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTableCell.html">WTableCell</a>;
|
||||
<a name="l00018"></a>00018 }
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a>00020 <span class="keyword">class </span><a class="code" href="classLabel.html" title="A label.">Label</a>;
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00031"></a><a class="code" href="classAddresseeEdit.html">00031</a> <span class="keyword">class </span><a class="code" href="classAddresseeEdit.html" title="An edit field for an email addressee.">AddresseeEdit</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTextArea.html">WTextArea</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00039"></a>00039 <a class="code" href="classAddresseeEdit.html" title="An edit field for an email addressee.">AddresseeEdit</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WString.html">WString</a>& label, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent,
|
||||
<a name="l00040"></a>00040 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *labelParent);
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> setAddressees(<span class="keyword">const</span> std::vector<Contact>& contacts);
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00048"></a>00048 std::vector<Contact> addressees() <span class="keyword">const</span>;
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setHidden(<span class="keywordtype">bool</span>);
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00053"></a>00053 <span class="keyword">private</span>:
|
||||
<a name="l00055"></a><a class="code" href="classAddresseeEdit.html#a593dba58d431415e256615718c32cbfc">00055</a> <a class="code" href="classLabel.html" title="A label.">Label</a> *<a class="code" href="classAddresseeEdit.html#a593dba58d431415e256615718c32cbfc" title="The label associated with this edit.">label_</a>;
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">bool</span> parse(std::vector<Contact>& contacts) <span class="keyword">const</span>;
|
||||
<a name="l00059"></a>00059 };
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00064"></a>00064 <span class="preprocessor">#endif // ADDRESSEE_EDIT_H_</span>
|
||||
</pre></div></div>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
60
wt-3.1.7a/doc/examples/html/AttachmentEdit_8C.html
Normal file
60
wt-3.1.7a/doc/examples/html/AttachmentEdit_8C.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.C File Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.C File Reference</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<code>#include <fstream></code><br/>
|
||||
<code>#include <unistd.h></code><br/>
|
||||
<code>#include <boost/lexical_cast.hpp></code><br/>
|
||||
<code>#include <iostream></code><br/>
|
||||
<code>#include <Wt/WAnchor></code><br/>
|
||||
<code>#include <Wt/WCheckBox></code><br/>
|
||||
<code>#include <Wt/WCssDecorationStyle></code><br/>
|
||||
<code>#include <Wt/WFileResource></code><br/>
|
||||
<code>#include <Wt/WFileUpload></code><br/>
|
||||
<code>#include <Wt/WProgressBar></code><br/>
|
||||
<code>#include <Wt/WText></code><br/>
|
||||
<code>#include "<a class="el" href="Attachment_8h_source.html">Attachment.h</a>"</code><br/>
|
||||
<code>#include "<a class="el" href="AttachmentEdit_8h_source.html">AttachmentEdit.h</a>"</code><br/>
|
||||
<code>#include "<a class="el" href="Composer_8h_source.html">Composer.h</a>"</code><br/>
|
||||
<code>#include "<a class="el" href="Option_8h_source.html">Option.h</a>"</code><br/>
|
||||
|
||||
<p><a href="AttachmentEdit_8C_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
</table>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
245
wt-3.1.7a/doc/examples/html/AttachmentEdit_8C_source.html
Normal file
245
wt-3.1.7a/doc/examples/html/AttachmentEdit_8C_source.html
Normal file
|
@ -0,0 +1,245 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.C Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.C</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<a href="AttachmentEdit_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||||
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
|
||||
<a name="l00003"></a>00003 <span class="comment"> *</span>
|
||||
<a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span>
|
||||
<a name="l00005"></a>00005 <span class="comment"> */</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <fstream></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef WIN32</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#include <unistd.h></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#endif</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#include <boost/lexical_cast.hpp></span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="preprocessor">#include <iostream></span>
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="preprocessor">#include <Wt/WAnchor></span>
|
||||
<a name="l00016"></a>00016 <span class="preprocessor">#include <Wt/WCheckBox></span>
|
||||
<a name="l00017"></a>00017 <span class="preprocessor">#include <Wt/WCssDecorationStyle></span>
|
||||
<a name="l00018"></a>00018 <span class="preprocessor">#include <Wt/WFileResource></span>
|
||||
<a name="l00019"></a>00019 <span class="preprocessor">#include <Wt/WFileUpload></span>
|
||||
<a name="l00020"></a>00020 <span class="preprocessor">#include <Wt/WProgressBar></span>
|
||||
<a name="l00021"></a>00021 <span class="preprocessor">#include <Wt/WText></span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="Attachment_8h.html">Attachment.h</a>"</span>
|
||||
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="AttachmentEdit_8h.html">AttachmentEdit.h</a>"</span>
|
||||
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="Composer_8h.html">Composer.h</a>"</span>
|
||||
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="Option_8h.html">Option.h</a>"</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ae6266b6977a64a366fddd9fc94a277ff">00028</a> <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ae6266b6977a64a366fddd9fc94a277ff">AttachmentEdit::UploadInfo::UploadInfo</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html">Http::UploadedFile</a>& f,
|
||||
<a name="l00029"></a>00029 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent)
|
||||
<a name="l00030"></a>00030 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>(parent),
|
||||
<a name="l00031"></a>00031 info_(f)
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="comment">/*</span>
|
||||
<a name="l00034"></a>00034 <span class="comment"> * Include the file ?</span>
|
||||
<a name="l00035"></a>00035 <span class="comment"> */</span>
|
||||
<a name="l00036"></a>00036 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#a2bdc455790096d63d594a0dd7fe47a6f" title="The check box to keep or discard the uploaded file.">keep_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCheckBox.html">WCheckBox</a>(<span class="keyword">this</span>);
|
||||
<a name="l00037"></a>00037 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#a2bdc455790096d63d594a0dd7fe47a6f" title="The check box to keep or discard the uploaded file.">keep_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractToggleButton.html#a6838c9a37f3e9e3c466e9f48bde55e62">setChecked</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a>00039 <span class="comment">/*</span>
|
||||
<a name="l00040"></a>00040 <span class="comment"> * Give information on the file uploaded.</span>
|
||||
<a name="l00041"></a>00041 <span class="comment"> */</span>
|
||||
<a name="l00042"></a>00042 std::streamsize fsize = 0;
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 std::ifstream theFile(<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a80453ce8dc7a06e12b5c1f622c027320">spoolFileName</a>().c_str());
|
||||
<a name="l00045"></a>00045 theFile.seekg(0, std::ios_base::end);
|
||||
<a name="l00046"></a>00046 fsize = theFile.tellg();
|
||||
<a name="l00047"></a>00047 theFile.seekg(0);
|
||||
<a name="l00048"></a>00048 }
|
||||
<a name="l00049"></a>00049 std::wstring size;
|
||||
<a name="l00050"></a>00050 <span class="keywordflow">if</span> (fsize < 1024)
|
||||
<a name="l00051"></a>00051 size = boost::lexical_cast<std::wstring>(fsize) + L<span class="stringliteral">" bytes"</span>;
|
||||
<a name="l00052"></a>00052 <span class="keywordflow">else</span>
|
||||
<a name="l00053"></a>00053 size = boost::lexical_cast<std::wstring>((int)(fsize / 1024))
|
||||
<a name="l00054"></a>00054 + L<span class="stringliteral">"kb"</span>;
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a>00056 std::wstring fn = <span class="keyword">static_cast<</span>std::wstring<span class="keyword">></span>
|
||||
<a name="l00057"></a>00057 (<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a94abba3bda8fc934ae86db54c577b428">escapeText</a>(WString::fromUTF8(<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a6548081a259f55d572bf049d576bb2a3">clientFileName</a>())));
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ab7eba6ca0f514142e96fe3a4845f0361" title="Anchor referencing the file.">downloadLink_</a>
|
||||
<a name="l00060"></a>00060 = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAnchor.html">WAnchor</a>(<span class="stringliteral">""</span>, fn + L<span class="stringliteral">" (<i>"</span> + WString::fromUTF8(<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a165bc88288a19a1134ecdf3922f86f25">contentType</a>())
|
||||
<a name="l00061"></a>00061 + L<span class="stringliteral">"</i>) "</span> + size, <span class="keyword">this</span>);
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileResource.html">WFileResource</a> *res = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileResource.html">WFileResource</a>(<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a165bc88288a19a1134ecdf3922f86f25">contentType</a>(),
|
||||
<a name="l00064"></a>00064 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a80453ce8dc7a06e12b5c1f622c027320">spoolFileName</a>(),
|
||||
<a name="l00065"></a>00065 <span class="keyword">this</span>);
|
||||
<a name="l00066"></a>00066 res-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WResource.html#a8f2c3c2aa013cebecd73398dadc3d6d0">suggestFileName</a>(<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a6548081a259f55d572bf049d576bb2a3">clientFileName</a>());
|
||||
<a name="l00067"></a>00067 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ab7eba6ca0f514142e96fe3a4845f0361" title="Anchor referencing the file.">downloadLink_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAnchor.html#af4b130e223525c4b6084eb2fb8797738">setResource</a>(res);
|
||||
<a name="l00068"></a>00068 }
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a><a class="code" href="classAttachmentEdit.html#aedd19941ecf64ef030eaa164eb34b85a">00070</a> <a class="code" href="classAttachmentEdit.html#aedd19941ecf64ef030eaa164eb34b85a" title="Creates an attachment edit field.">AttachmentEdit::AttachmentEdit</a>(<a class="code" href="classComposer.html" title="An E-mail composer widget.">Composer</a> *composer, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>)
|
||||
<a name="l00071"></a>00071 : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>(parent),
|
||||
<a name="l00072"></a>00072 <a class="code" href="classAttachmentEdit.html#a403927978e9c841e64b62421458790e8">composer_</a>(composer),
|
||||
<a name="l00073"></a>00073 <a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">uploadDone_</a>(this),
|
||||
<a name="l00074"></a>00074 <a class="code" href="classAttachmentEdit.html#a6a19f364e7a82797bc5c18adb6a01530" title="The state of the last upload process.">uploadFailed_</a>(false)
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="comment">/*</span>
|
||||
<a name="l00077"></a>00077 <span class="comment"> * The file upload itself.</span>
|
||||
<a name="l00078"></a>00078 <span class="comment"> */</span>
|
||||
<a name="l00079"></a>00079 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html">WFileUpload</a>(<span class="keyword">this</span>);
|
||||
<a name="l00080"></a>00080 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#a17f8e368c2ffc9836c65e470b311de9d">setMultiple</a>(<span class="keyword">true</span>);
|
||||
<a name="l00081"></a>00081 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#ac7ad1324c86d378da9da9740a631a662">setFileTextSize</a>(40);
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <span class="comment">/*</span>
|
||||
<a name="l00084"></a>00084 <span class="comment"> * A progress bar</span>
|
||||
<a name="l00085"></a>00085 <span class="comment"> */</span>
|
||||
<a name="l00086"></a>00086 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WProgressBar.html">WProgressBar</a> *progress = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WProgressBar.html">WProgressBar</a>();
|
||||
<a name="l00087"></a>00087 progress-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WProgressBar.html#a6fb308103fbdad5d58c90450c657678a">setFormat</a>(WString::Empty);
|
||||
<a name="l00088"></a>00088 progress-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a4b69458117dbeed309fc3109e4789125">setVerticalAlignment</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa2ed90f01dbf74049f428d33769d48e3f">AlignMiddle</a>);
|
||||
<a name="l00089"></a>00089 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#a6600c5a1232057418b3fe63d5db1c004">setProgressBar</a>(progress);
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">/*</span>
|
||||
<a name="l00092"></a>00092 <span class="comment"> * The 'remove' option.</span>
|
||||
<a name="l00093"></a>00093 <span class="comment"> */</span>
|
||||
<a name="l00094"></a>00094 <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a> = <span class="keyword">new</span> <a class="code" href="classOption.html" title="A clickable option.">Option</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#aa651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">"msg.remove"</span>), <span class="keyword">this</span>);
|
||||
<a name="l00095"></a>00095 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#aee0157eb927635094425c6f91cc7bd16">decorationStyle</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCssDecorationStyle.html#a5e552350f0955212ea237994a98638dc">font</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFont.html#ad449c8c5c3b78e66d51fe6db0c0b9d58">setSize</a>(WFont::Smaller);
|
||||
<a name="l00096"></a>00096 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a4b69458117dbeed309fc3109e4789125">setVerticalAlignment</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa2ed90f01dbf74049f428d33769d48e3f">AlignMiddle</a>);
|
||||
<a name="l00097"></a>00097 <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a07719d06da0dd17af2381c663e8fb0b7">setMargin</a>(5, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a5a6f4636bcc6ab3c075165d249b3a5a3a6568fecac7c7d7223afaed240bcfdd9e">Left</a>);
|
||||
<a name="l00098"></a>00098 <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a>-><a class="code" href="classOption.html#a31cd766f28605ceba53642d7d4e68c9e" title="Returns the clickable part.">item</a>()-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<span class="keyword">this</span>, &WWidget::hide);
|
||||
<a name="l00099"></a>00099 <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a>-><a class="code" href="classOption.html#a31cd766f28605ceba53642d7d4e68c9e" title="Returns the clickable part.">item</a>()-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<span class="keyword">this</span>, &<a class="code" href="classAttachmentEdit.html#a27277be62832ebbda987707b7a2d814e" title="Slot triggered when the users wishes to remove this attachment edit.">AttachmentEdit::remove</a>);
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// The error message.</span>
|
||||
<a name="l00102"></a>00102 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<span class="stringliteral">""</span>, <span class="keyword">this</span>);
|
||||
<a name="l00103"></a>00103 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a6fd43dced1a62f7e79bc3522eeb16216">setStyleClass</a>(<span class="stringliteral">"error"</span>);
|
||||
<a name="l00104"></a>00104 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a07719d06da0dd17af2381c663e8fb0b7">setMargin</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html">WLength</a>(5), <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a5a6f4636bcc6ab3c075165d249b3a5a3a6568fecac7c7d7223afaed240bcfdd9e">Left</a>);
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="comment">/*</span>
|
||||
<a name="l00107"></a>00107 <span class="comment"> * React to events.</span>
|
||||
<a name="l00108"></a>00108 <span class="comment"> */</span>
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="comment">// Try to catch the fileupload change signal to trigger an upload.</span>
|
||||
<a name="l00111"></a>00111 <span class="comment">// We could do like google and at a delay with a WTimer as well...</span>
|
||||
<a name="l00112"></a>00112 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#a3abaf94bdba04e7833aa18bc7e8d0f40">changed</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1EventSignal.html#a6efcb92576b5aa846a3354dd26918a9f">connect</a>(<a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>, &WFileUpload::upload);
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// React to a succesfull upload.</span>
|
||||
<a name="l00115"></a>00115 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#aacb4622c8cd83d1635a8c0db13c8c0fe">uploaded</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1EventSignal.html#a6efcb92576b5aa846a3354dd26918a9f">connect</a>(<span class="keyword">this</span>, &<a class="code" href="classAttachmentEdit.html#a85d6892fe9c38394d17dc350ce678acd" title="Slot triggered when the WFileUpload completed an upload.">AttachmentEdit::uploaded</a>);
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// React to a fileupload problem.</span>
|
||||
<a name="l00118"></a>00118 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#a29dc78a0162c676f7b72904d595440d8">fileTooLarge</a>().connect(<span class="keyword">this</span>, &<a class="code" href="classAttachmentEdit.html#a9f7b53df9b2342f38984832f1d2430eb" title="Slot triggered when the WFileUpload received an oversized file.">AttachmentEdit::fileTooLarge</a>);
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="comment">/*</span>
|
||||
<a name="l00121"></a>00121 <span class="comment"> * Connect the uploadDone signal to the Composer's attachmentDone,</span>
|
||||
<a name="l00122"></a>00122 <span class="comment"> * so that the Composer can keep track of attachment upload progress,</span>
|
||||
<a name="l00123"></a>00123 <span class="comment"> * if it wishes.</span>
|
||||
<a name="l00124"></a>00124 <span class="comment"> */</span>
|
||||
<a name="l00125"></a>00125 <a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">uploadDone_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a15d1150af031537b492674ee651bf4a3">connect</a>(composer, &<a class="code" href="classComposer.html#aaa2db4aef750f6533c53af1189c92144" title="Slotcalled when an attachment has been uploaded.">Composer::attachmentDone</a>);
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classAttachmentEdit.html#a172fff67913dc3e3adf8c1e4198d6ea6">00128</a> <span class="keywordtype">bool</span> <a class="code" href="classAttachmentEdit.html#a172fff67913dc3e3adf8c1e4198d6ea6" title="Updates the file now.">AttachmentEdit::uploadNow</a>()
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="comment">/*</span>
|
||||
<a name="l00131"></a>00131 <span class="comment"> * See if this attachment still needs to be uploaded,</span>
|
||||
<a name="l00132"></a>00132 <span class="comment"> * and return if a new asynchronous upload is started.</span>
|
||||
<a name="l00133"></a>00133 <span class="comment"> */</span>
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">if</span> (<a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>) {
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> (<a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#a66376fb4668a037760a91abad9f83f8a">canUpload</a>()) {
|
||||
<a name="l00136"></a>00136 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#ac17094f2fd6ae8cac1035161f7d80b9c">upload</a>();
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00138"></a>00138 } <span class="keywordflow">else</span>
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00140"></a>00140 } <span class="keywordflow">else</span>
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a><a class="code" href="classAttachmentEdit.html#a85d6892fe9c38394d17dc350ce678acd">00144</a> <span class="keywordtype">void</span> <a class="code" href="classAttachmentEdit.html#a85d6892fe9c38394d17dc350ce678acd" title="Slot triggered when the WFileUpload completed an upload.">AttachmentEdit::uploaded</a>()
|
||||
<a name="l00145"></a>00145 {
|
||||
<a name="l00146"></a>00146 std::vector<Http::UploadedFile> files = <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html#ab1ffd4c3c203e6772f4a1b2e235888e3">uploadedFiles</a>();
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> (!files.empty()) {
|
||||
<a name="l00149"></a>00149 <span class="comment">/*</span>
|
||||
<a name="l00150"></a>00150 <span class="comment"> * Delete this widgets since we have a succesfull upload.</span>
|
||||
<a name="l00151"></a>00151 <span class="comment"> */</span>
|
||||
<a name="l00152"></a>00152 <span class="keyword">delete</span> <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>;
|
||||
<a name="l00153"></a>00153 <a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a> = 0;
|
||||
<a name="l00154"></a>00154 <span class="keyword">delete</span> <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a>;
|
||||
<a name="l00155"></a>00155 <a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a> = 0;
|
||||
<a name="l00156"></a>00156 <span class="keyword">delete</span> <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>;
|
||||
<a name="l00157"></a>00157 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a> = 0;
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < files.size(); ++i)
|
||||
<a name="l00160"></a>00160 <a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">uploadInfo_</a>.push_back(<span class="keyword">new</span> <a class="code" href="classAttachmentEdit_1_1UploadInfo.html">UploadInfo</a>(files[i], <span class="keyword">this</span>));
|
||||
<a name="l00161"></a>00161 } <span class="keywordflow">else</span> {
|
||||
<a name="l00162"></a>00162 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a2f788aa524d51b3962642c9f565e66e6">setText</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#aa651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">"msg.file-empty"</span>));
|
||||
<a name="l00163"></a>00163 <a class="code" href="classAttachmentEdit.html#a6a19f364e7a82797bc5c18adb6a01530" title="The state of the last upload process.">uploadFailed_</a> = <span class="keyword">true</span>;
|
||||
<a name="l00164"></a>00164 }
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <span class="comment">/*</span>
|
||||
<a name="l00167"></a>00167 <span class="comment"> * Signal to the Composer that a new asynchronous file upload was processed.</span>
|
||||
<a name="l00168"></a>00168 <span class="comment"> */</span>
|
||||
<a name="l00169"></a>00169 <a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">uploadDone_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a8d9cf8a1e83634462fe2b492b3beb1c5">emit</a>();
|
||||
<a name="l00170"></a>00170 }
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a><a class="code" href="classAttachmentEdit.html#a27277be62832ebbda987707b7a2d814e">00172</a> <span class="keywordtype">void</span> <a class="code" href="classAttachmentEdit.html#a27277be62832ebbda987707b7a2d814e" title="Slot triggered when the users wishes to remove this attachment edit.">AttachmentEdit::remove</a>()
|
||||
<a name="l00173"></a>00173 {
|
||||
<a name="l00174"></a>00174 <a class="code" href="classAttachmentEdit.html#a403927978e9c841e64b62421458790e8">composer_</a>-><a class="code" href="classComposer.html#ab142f49c8de59da0f84185165eb6c1c1" title="Remove the given attachment edit.">removeAttachment</a>(<span class="keyword">this</span>);
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a><a class="code" href="classAttachmentEdit.html#a9f7b53df9b2342f38984832f1d2430eb">00177</a> <span class="keywordtype">void</span> <a class="code" href="classAttachmentEdit.html#a9f7b53df9b2342f38984832f1d2430eb" title="Slot triggered when the WFileUpload received an oversized file.">AttachmentEdit::fileTooLarge</a>(<span class="keywordtype">int</span> size)
|
||||
<a name="l00178"></a>00178 {
|
||||
<a name="l00179"></a>00179 <a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a2f788aa524d51b3962642c9f565e66e6">setText</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#aa651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">"msg.file-too-large"</span>));
|
||||
<a name="l00180"></a>00180 <a class="code" href="classAttachmentEdit.html#a6a19f364e7a82797bc5c18adb6a01530" title="The state of the last upload process.">uploadFailed_</a> = <span class="keyword">true</span>;
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="comment">/*</span>
|
||||
<a name="l00183"></a>00183 <span class="comment"> * Signal to the Composer that a new asyncrhonous file upload was processed.</span>
|
||||
<a name="l00184"></a>00184 <span class="comment"> */</span>
|
||||
<a name="l00185"></a>00185 <a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">uploadDone_</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a8d9cf8a1e83634462fe2b492b3beb1c5">emit</a>();
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a><a class="code" href="classAttachmentEdit.html#aa6037eafc345a6a3358da421fc04045a">00188</a> std::vector<Attachment> <a class="code" href="classAttachmentEdit.html#aa6037eafc345a6a3358da421fc04045a" title="Returns the attachment.">AttachmentEdit::attachments</a>()
|
||||
<a name="l00189"></a>00189 {
|
||||
<a name="l00190"></a>00190 std::vector<Attachment> result;
|
||||
<a name="l00191"></a>00191
|
||||
<a name="l00192"></a>00192 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < <a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">uploadInfo_</a>.size(); ++i) {
|
||||
<a name="l00193"></a>00193 <span class="keywordflow">if</span> (<a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">uploadInfo_</a>[i]->keep_->isChecked()) {
|
||||
<a name="l00194"></a>00194 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html">Http::UploadedFile</a>& f = <a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">uploadInfo_</a>[i]->info_;
|
||||
<a name="l00195"></a>00195 f.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#ab8cdd14724b871e71d3ec7d9530f9e29">stealSpoolFile</a>();
|
||||
<a name="l00196"></a>00196 result.push_back(<a class="code" href="classAttachment.html" title="An email attachment.">Attachment</a>
|
||||
<a name="l00197"></a>00197 (WString::fromUTF8(f.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a6548081a259f55d572bf049d576bb2a3">clientFileName</a>()),
|
||||
<a name="l00198"></a>00198 WString::fromUTF8(f.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a165bc88288a19a1134ecdf3922f86f25">contentType</a>()),
|
||||
<a name="l00199"></a>00199 f.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html#a80453ce8dc7a06e12b5c1f622c027320">spoolFileName</a>()));
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201 }
|
||||
<a name="l00202"></a>00202
|
||||
<a name="l00203"></a>00203 <span class="keywordflow">return</span> result;
|
||||
<a name="l00204"></a>00204 }
|
||||
</pre></div></div>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
57
wt-3.1.7a/doc/examples/html/AttachmentEdit_8h.html
Normal file
57
wt-3.1.7a/doc/examples/html/AttachmentEdit_8h.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.h File Reference</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#namespaces">Namespaces</a> </div>
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.h File Reference</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<code>#include <Wt/WContainerWidget></code><br/>
|
||||
|
||||
<p><a href="AttachmentEdit_8h_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr><td colspan="2"><h2><a name="nested-classes"></a>
|
||||
Classes</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classAttachmentEdit.html">AttachmentEdit</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">An edit field for an email attachment. <a href="classAttachmentEdit.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classAttachmentEdit_1_1UploadInfo.html">AttachmentEdit::UploadInfo</a></td></tr>
|
||||
<tr><td colspan="2"><h2><a name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html">Wt</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
113
wt-3.1.7a/doc/examples/html/AttachmentEdit_8h_source.html
Normal file
113
wt-3.1.7a/doc/examples/html/AttachmentEdit_8h_source.html
Normal file
|
@ -0,0 +1,113 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.h Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Generated by Doxygen 1.7.2 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||||
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||||
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs2">
|
||||
<ul class="tablist">
|
||||
<li><a href="files.html"><span>File List</span></a></li>
|
||||
<li><a href="globals.html"><span>File Members</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<h1>/home/koen/project/wt/public-git/wt/examples/composer/AttachmentEdit.h</h1> </div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<a href="AttachmentEdit_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This may look like C code, but it's really -*- C++ -*-</span>
|
||||
<a name="l00002"></a>00002 <span class="comment">/*</span>
|
||||
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
|
||||
<a name="l00004"></a>00004 <span class="comment"> *</span>
|
||||
<a name="l00005"></a>00005 <span class="comment"> * See the LICENSE file for terms of use.</span>
|
||||
<a name="l00006"></a>00006 <span class="comment"> */</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#ifndef ATTACHMENT_EDIT_H_</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define ATTACHMENT_EDIT_H_</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include <Wt/WContainerWidget></span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>Wt {
|
||||
<a name="l00013"></a>00013 <span class="keyword">class </span><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html">WFileUpload</a>;
|
||||
<a name="l00014"></a>00014 <span class="keyword">class </span><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>;
|
||||
<a name="l00015"></a>00015 <span class="keyword">class </span><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCheckBox.html">WCheckBox</a>;
|
||||
<a name="l00016"></a>00016 }
|
||||
<a name="l00017"></a>00017
|
||||
<a name="l00018"></a>00018 <span class="keyword">class </span><a class="code" href="classAttachment.html" title="An email attachment.">Attachment</a>;
|
||||
<a name="l00019"></a>00019 <span class="keyword">class </span><a class="code" href="classComposer.html" title="An E-mail composer widget.">Composer</a>;
|
||||
<a name="l00020"></a>00020 <span class="keyword">class </span><a class="code" href="classOption.html" title="A clickable option.">Option</a>;
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a>00022 <span class="keyword">using namespace </span>Wt;
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00037"></a><a class="code" href="classAttachmentEdit.html">00037</a> <span class="keyword">class </span><a class="code" href="classAttachmentEdit.html" title="An edit field for an email attachment.">AttachmentEdit</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classAttachmentEdit.html" title="An edit field for an email attachment.">AttachmentEdit</a>(<a class="code" href="classComposer.html" title="An E-mail composer widget.">Composer</a> *composer, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent = 0);
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">bool</span> uploadNow();
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00054"></a><a class="code" href="classAttachmentEdit.html#adc4314df22d6fa1598acebe62726a464">00054</a> <span class="keywordtype">bool</span> <a class="code" href="classAttachmentEdit.html#adc4314df22d6fa1598acebe62726a464" title="Returns whether the upload failed.">uploadFailed</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> uploadFailed_; }
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 std::vector<Attachment> attachments();
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00063"></a><a class="code" href="classAttachmentEdit.html#a8e8ec2b62906eb6137b1a505a6ba0306">00063</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html">Signal<void></a>& <a class="code" href="classAttachmentEdit.html#a8e8ec2b62906eb6137b1a505a6ba0306" title="Signal emitted when new attachment(s) have been uploaded (or failed to upload.">uploadDone</a>() { <span class="keywordflow">return</span> uploadDone_; }
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">private</span>:
|
||||
<a name="l00066"></a><a class="code" href="classAttachmentEdit.html#a403927978e9c841e64b62421458790e8">00066</a> <a class="code" href="classComposer.html" title="An E-mail composer widget.">Composer</a> *<a class="code" href="classAttachmentEdit.html#a403927978e9c841e64b62421458790e8">composer_</a>;
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a><a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">00068</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html">Signal<void></a> <a class="code" href="classAttachmentEdit.html#a24ee0aca670036a7491a1c0114188cc7">uploadDone_</a>;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430">00071</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFileUpload.html">WFileUpload</a> *<a class="code" href="classAttachmentEdit.html#aa9a3945293cf0a30d35e8bc56312d430" title="The WFileUpload control.">upload_</a>;
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classAttachmentEdit_1_1UploadInfo.html">00073</a> <span class="keyword">class </span><a class="code" href="classAttachmentEdit_1_1UploadInfo.html">UploadInfo</a> : <span class="keyword">public</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="keyword">public</span>:
|
||||
<a name="l00076"></a>00076 <a class="code" href="classAttachmentEdit_1_1UploadInfo.html">UploadInfo</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html">Http::UploadedFile</a>& f, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent = 0);
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">00078</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Http_1_1UploadedFile.html">Http::UploadedFile</a> <a class="code" href="classAttachmentEdit_1_1UploadInfo.html#acc43ca5ce401f8320154638602f3b536">info_</a>;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a><a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ab7eba6ca0f514142e96fe3a4845f0361">00081</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAnchor.html">WAnchor</a> *<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#ab7eba6ca0f514142e96fe3a4845f0361" title="Anchor referencing the file.">downloadLink_</a>;
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a><a class="code" href="classAttachmentEdit_1_1UploadInfo.html#a2bdc455790096d63d594a0dd7fe47a6f">00084</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCheckBox.html">WCheckBox</a> *<a class="code" href="classAttachmentEdit_1_1UploadInfo.html#a2bdc455790096d63d594a0dd7fe47a6f" title="The check box to keep or discard the uploaded file.">keep_</a>;
|
||||
<a name="l00085"></a>00085 };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a><a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">00087</a> std::vector<UploadInfo *> <a class="code" href="classAttachmentEdit.html#ad3f98e98d3e5502fc275446dc5c6b762">uploadInfo_</a>;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a><a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d">00090</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *<a class="code" href="classAttachmentEdit.html#a2c3fa5d63ec5feedc63f95295989cd4d" title="The text box to display an error (empty or too big file)">error_</a>;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a><a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae">00093</a> <a class="code" href="classOption.html" title="A clickable option.">Option</a> *<a class="code" href="classAttachmentEdit.html#a55484424d37b196d07035e245399ffae" title="The option to cancel the file upload.">remove_</a>;
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a><a class="code" href="classAttachmentEdit.html#a6a19f364e7a82797bc5c18adb6a01530">00096</a> <span class="keywordtype">bool</span> <a class="code" href="classAttachmentEdit.html#a6a19f364e7a82797bc5c18adb6a01530" title="The state of the last upload process.">uploadFailed_</a>;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">void</span> uploaded();
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> fileTooLarge(<span class="keywordtype">int</span> size);
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">void</span> <span class="keyword">remove</span>();
|
||||
<a name="l00106"></a>00106 };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00110"></a>00110 <span class="preprocessor">#endif // ATTACHMENT_EDIT_H_</span>
|
||||
</pre></div></div>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right; margin: 3px"><small>
|
||||
Generated on Tue Nov 30 2010 for <a href="http://www.webtoolkit.eu/wt">the
|
||||
C++ Web Toolkit (Wt)</a> by <a
|
||||
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
|
||||
alt="doxygen" border="0" style="vertical-align: middle; display:
|
||||
inline-block; height: 2em"></a> 1.7.2</small></address>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue