From ec914311f6de3d8aceb4252db0739d61bedfea1b Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Thu, 1 Mar 2012 20:59:35 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/SSPCPP-411 --- Shibboleth.sln | 2 ++ configs/Makefile.am | 2 ++ configs/shibd-redhat.in | 5 ++++- configs/shibd-suse.in | 5 ++++- shibboleth.spec.in | 4 +++- shibsp/Makefile.am | 2 ++ shibsp/base.h | 19 +++++++++++-------- shibsp/handler/impl/DiscoveryFeed.cpp | 2 +- shibsp/paths.h.in | 21 ++++++++++++--------- 9 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Shibboleth.sln b/Shibboleth.sln index 7b29ba4..afa63d0 100644 --- a/Shibboleth.sln +++ b/Shibboleth.sln @@ -59,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{2543BC configs\shibboleth2.xml = configs\shibboleth2.xml configs\shibd-debian.in = configs\shibd-debian.in configs\shibd-osx.plist.in = configs\shibd-osx.plist.in + configs\shibd-redhat.in = configs\shibd-redhat.in configs\shibd-suse.in = configs\shibd-suse.in configs\shibd.logger.in = configs\shibd.logger.in configs\sslError.html = configs\sslError.html @@ -78,6 +79,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{31B171C1-E doxygen.cfg = doxygen.cfg m4\doxygen.m4 = m4\doxygen.m4 Makefile.am = Makefile.am + shibboleth.spec.in = shibboleth.spec.in EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doc", "Doc", "{6ED5E3E7-1B0E-43FB-A8D1-77A0FCAE9AC8}" diff --git a/configs/Makefile.am b/configs/Makefile.am index 8028341..6ebd212 100644 --- a/configs/Makefile.am +++ b/configs/Makefile.am @@ -8,6 +8,7 @@ shirelogdir = ${localstatedir}/log/httpd pkgxmldir = $(datadir)/xml/@PACKAGE@ pkgwebdir = $(datadir)/@PACKAGE@ pkgrundir = $(localstatedir)/run/@PACKAGE@ +pkgcachedir = $(localstatedir)/cache/@PACKAGE@ pkgsysconfdir = $(sysconfdir)/@PACKAGE@ pkgsysconf_DATA = \ shibd-redhat \ @@ -103,6 +104,7 @@ install-data-local: all-data-local $(mkinstalldirs) $(DESTDIR)$(pkglogdir) $(mkinstalldirs) $(DESTDIR)$(shirelogdir) $(mkinstalldirs) $(DESTDIR)$(pkgrundir) + $(mkinstalldirs) $(DESTDIR)$(pkgcachedir) $(mkinstalldirs) $(DESTDIR)$(pkgxmldir) $(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir) for f in $(BUILTCONFIGFILES); do \ diff --git a/configs/shibd-redhat.in b/configs/shibd-redhat.in index 716bdbd..65295f2 100644 --- a/configs/shibd-redhat.in +++ b/configs/shibd-redhat.in @@ -32,6 +32,9 @@ start() { fi fi + # Make sure package run directory exists. + [ -d @-PKGRUNDIR-@ ] || mkdir @-PKGRUNDIR-@ + export SHIBD_PID=$pidfile touch $pidfile chown $SHIBD_USER:$SHIBD_USER $pidfile @@ -39,7 +42,7 @@ start() { /sbin/restorecon $pidfile fi # Handle transition from root to non-root packages. - chown $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@/* 2>/dev/null || : + chown -R $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@ 2>/dev/null || : daemon --user $SHIBD_USER $shibd -p $pidfile -f -w 30 RETVAL=$? diff --git a/configs/shibd-suse.in b/configs/shibd-suse.in index ed26f9e..5c8d43f 100644 --- a/configs/shibd-suse.in +++ b/configs/shibd-suse.in @@ -51,8 +51,11 @@ rc_reset case "$1" in start) + # Make sure package run directory exists. + [ -d @-PKGRUNDIR-@ ] || mkdir @-PKGRUNDIR-@ + # Handle transition from root to non-root packages. - chown $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@/* 2>/dev/null || : + chown -R $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@ 2>/dev/null || : echo -n "Starting $DESC ($NAME)" ## Start daemon with startproc(8). If this fails diff --git a/shibboleth.spec.in b/shibboleth.spec.in index 075b12b..d513892 100644 --- a/shibboleth.spec.in +++ b/shibboleth.spec.in @@ -300,6 +300,7 @@ fi %exclude %{_libdir}/%{name}/*.la %attr(0750,%{runuser},%{runuser}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{runuser},%{runuser}) %dir %{_localstatedir}/run/%{name} +%attr(0755,%{runuser},%{runuser}) %dir %{_localstatedir}/cache/%{name} %dir %{_datadir}/xml/%{name} %{_datadir}/xml/%{name}/* %dir %{_datadir}/%{name} @@ -331,7 +332,7 @@ fi %doc %{pkgdocdir}/api %changelog -* Fri Feb 10 2012 Scott Cantor - 2.5-1 +* Thu Mar 1 2012 Scott Cantor - 2.5-1 - Move logo and stylesheet to version-independent tree - Make shib.conf noreplace - Post-fixup of Alias commands in older shib.conf @@ -340,6 +341,7 @@ fi - Copy shibd restart for Red Hat to postun - Add boost-devel dependency - Build memcache plugin on RH6 +- Add cachedir to install * Sun Jun 26 2011 Scott Cantor - 2.4.3-1 - Log files shouldn't be world readable. diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am index b297c0e..579c938 100644 --- a/shibsp/Makefile.am +++ b/shibsp/Makefile.am @@ -241,6 +241,7 @@ pkgsysconfdir = $(sysconfdir)/@PACKAGE_NAME@ pkgxmldir = $(datadir)/xml/@PACKAGE_NAME@ logdir = ${localstatedir}/log rundir = $(localstatedir)/run +cachedir = $(localstatedir)/cache xmldir = $(datadir)/xml paths.h: ${srcdir}/paths.h.in Makefile ${top_builddir}/config.status @@ -251,6 +252,7 @@ paths.h: ${srcdir}/paths.h.in Makefile ${top_builddir}/config.status -e 's:@-SYSCONFDIR-@:${sysconfdir}:g' \ -e 's:@-LOGDIR-@:${logdir}:g' \ -e 's:@-RUNDIR-@:${rundir}:g' \ + -e 's:@-CACHEDIR-@:${cachedir}:g' \ -e 's:@-XMLDIR-@:${xmldir}:g' \ -e 's:@-PKGSYSCONFDIR-@:${pkgsysconfdir}:g' \ -e 's:@-PKGXMLDIR-@:${pkgxmldir}:g' \ diff --git a/shibsp/base.h b/shibsp/base.h index 1ebe1ea..702ddf2 100644 --- a/shibsp/base.h +++ b/shibsp/base.h @@ -82,31 +82,34 @@ # define SHIBSP_SCHEMAS "c:/opt/shibboleth-sp/share/xml/xmltooling/catalog.xml;c:/opt/shibboleth-sp/share/xml/opensaml/saml20-catalog.xml;c:/opt/shibboleth-sp/share/xml/opensaml/saml11-catalog.xml;c:/opt/shibboleth-sp/share/xml/shibboleth/catalog.xml" /** Default name of configuration file on Windows. */ -# define SHIBSP_CONFIG "shibboleth2.xml" +# define SHIBSP_CONFIG "shibboleth2.xml" /** * Controls default logging level of console tools and other situations * where fully-configured logging isn't used. */ -#define SHIBSP_LOGGING "console.logger" +#define SHIBSP_LOGGING "console.logger" /** Default prefix for installation (used to resolve relative paths). */ -#define SHIBSP_PREFIX "c:/opt/shibboleth-sp" +#define SHIBSP_PREFIX "c:/opt/shibboleth-sp" /** Library directory for installation (used to resolve relative paths). */ -#define SHIBSP_LIBDIR "lib" +#define SHIBSP_LIBDIR "lib" /** Log directory for installation (used to resolve relative paths). */ -#define SHIBSP_LOGDIR "var/log" +#define SHIBSP_LOGDIR "var/log" /** Configuration directory for installation (used to resolve relative paths). */ -#define SHIBSP_CFGDIR "etc" +#define SHIBSP_CFGDIR "etc" /** Runtime state directory for installation (used to resolve relative paths). */ -#define SHIBSP_RUNDIR "var/run" +#define SHIBSP_RUNDIR "var/run" + +/** Cache directory for installation (used to resolve relative paths). */ +#define SHIBSP_CACHEDIR "var/cache" /** XML directory for installation (used to resolve relative paths). */ -#define SHIBSP_XMLDIR "share/xml" +#define SHIBSP_XMLDIR "share/xml" #else # include diff --git a/shibsp/handler/impl/DiscoveryFeed.cpp b/shibsp/handler/impl/DiscoveryFeed.cpp index 72e87f2..19aecf3 100644 --- a/shibsp/handler/impl/DiscoveryFeed.cpp +++ b/shibsp/handler/impl/DiscoveryFeed.cpp @@ -127,7 +127,7 @@ DiscoveryFeed::DiscoveryFeed(const DOMElement* e, const char* appId) prop = getString("dir"); if (prop.first) m_dir = prop.second; - XMLToolingConfig::getConfig().getPathResolver()->resolve(m_dir, PathResolver::XMLTOOLING_RUN_FILE); + XMLToolingConfig::getConfig().getPathResolver()->resolve(m_dir, PathResolver::XMLTOOLING_CACHE_FILE); m_log.info("feed files will be cached in %s", m_dir.c_str()); #ifndef SHIBSP_LITE m_feedLock.reset(Mutex::create()); diff --git a/shibsp/paths.h.in b/shibsp/paths.h.in index d4ba1eb..f9070ac 100644 --- a/shibsp/paths.h.in +++ b/shibsp/paths.h.in @@ -28,30 +28,33 @@ #define __shibsp_paths_h__ /** Default schema catalogs. */ -#define SHIBSP_SCHEMAS "@-XMLTOOLINGXMLDIR-@/catalog.xml:@-OPENSAMLXMLDIR-@/saml20-catalog.xml:@-OPENSAMLXMLDIR-@/saml11-catalog.xml:@-PKGXMLDIR-@/catalog.xml" +#define SHIBSP_SCHEMAS "@-XMLTOOLINGXMLDIR-@/catalog.xml:@-OPENSAMLXMLDIR-@/saml20-catalog.xml:@-OPENSAMLXMLDIR-@/saml11-catalog.xml:@-PKGXMLDIR-@/catalog.xml" /** Default name of SP configuration file. */ -#define SHIBSP_CONFIG "shibboleth2.xml" +#define SHIBSP_CONFIG "shibboleth2.xml" /** Default name of SP console tool logging file. */ -#define SHIBSP_LOGGING "console.logger" +#define SHIBSP_LOGGING "console.logger" /** Default prefix for installation (used to resolve relative paths). */ -#define SHIBSP_PREFIX "@-PREFIX-@" +#define SHIBSP_PREFIX "@-PREFIX-@" /** Library directory for installation (used to resolve relative paths). */ -#define SHIBSP_LIBDIR "@-LIBDIR-@" +#define SHIBSP_LIBDIR "@-LIBDIR-@" /** Log directory for installation (used to resolve relative paths). */ -#define SHIBSP_LOGDIR "@-LOGDIR-@" +#define SHIBSP_LOGDIR "@-LOGDIR-@" /** Configuration directory for installation (used to resolve relative paths). */ -#define SHIBSP_CFGDIR "@-SYSCONFDIR-@" +#define SHIBSP_CFGDIR "@-SYSCONFDIR-@" /** Runtime state directory for installation (used to resolve relative paths). */ -#define SHIBSP_RUNDIR "@-RUNDIR-@" +#define SHIBSP_RUNDIR "@-RUNDIR-@" + +/** Cache directory for installation (used to resolve relative paths). */ +#define SHIBSP_CACHEDIR "@-CACHEDIR-@" /** XML directory for installation (used to resolve relative paths). */ -#define SHIBSP_XMLDIR "@-XMLDIR-@" +#define SHIBSP_XMLDIR "@-XMLDIR-@" #endif /* __shibsp_paths_h__ */ -- 2.1.4