From: Scott Cantor Date: Sun, 16 Jul 2006 22:09:54 +0000 (+0000) Subject: Handle 32-bit time size X-Git-Tag: 2.0-alpha1~221 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=444e963672e4136f5a18c9b9014e0a92e350de7f Handle 32-bit time size --- diff --git a/config_win32.h b/config_win32.h index baa4947..cfd83a1 100644 --- a/config_win32.h +++ b/config_win32.h @@ -1,100 +1,104 @@ -/* config_win32.h. Copied from a ./configure on Unix */ - -/* Define to 1 if you have the header file. -#define HAVE_DLFCN_H 1 -*/ - -/* Define to 1 if you have the `gmtime_r' function. */ -/* #undef HAVE_GMTIME_R */ - -/* Define if you have an STL implementation that supports useful string - specialization. */ -#define HAVE_GOOD_STL 1 - -/* Define to 1 if you have the header file. -#define HAVE_INTTYPES_H 1 -*/ - -/* Define if log4cpp library was found */ -#define HAVE_LIBLOG4CPP 1 - -/* Define if Xerces-C library was found */ -#define HAVE_LIBXERCESC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* define if the compiler implements namespaces */ -#define HAVE_NAMESPACES 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the header file. -#define HAVE_STRINGS_H 1 -*/ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. -#define HAVE_UNISTD_H 1 -*/ - -/* Name of package */ -#define PACKAGE "opensaml" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "mace-opensaml-users@internet2.edu" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "opensaml" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "opensaml 2.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "opensaml" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.0" - -/* Define to the necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Version number of package */ -#define VERSION "2.0" - -/* Define if you wish to disable XML-Security-dependent features. */ -/* #undef XMLTOOLING_NO_XMLSEC */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ +/* config_win32.h. Copied from a ./configure on Unix */ + +/* Define to 1 if you have the header file. +#define HAVE_DLFCN_H 1 +*/ + +/* Define to 1 if you have the `gmtime_r' function. */ +/* #undef HAVE_GMTIME_R */ + +/* Define if you have an STL implementation that supports useful string + specialization. */ +#define HAVE_GOOD_STL 1 + +/* Define to 1 if you have the header file. +#define HAVE_INTTYPES_H 1 +*/ + +/* Define if log4cpp library was found */ +#define HAVE_LIBLOG4CPP 1 + +/* Define if Xerces-C library was found */ +#define HAVE_LIBXERCESC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the header file. +#define HAVE_STRINGS_H 1 +*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. +#define HAVE_UNISTD_H 1 +*/ + +/* Name of package */ +#define PACKAGE "opensaml" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "mace-opensaml-users@internet2.edu" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "opensaml" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "opensaml 2.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "opensaml" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.0" + +/* Define to the necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Version number of package */ +#define VERSION "2.0" + +/* Define if you wish to disable XML-Security-dependent features. */ +/* #undef XMLTOOLING_NO_XMLSEC */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* The size of a `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + diff --git a/configure.ac b/configure.ac index 029d1fd..469d861 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,8 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_CHECK_FUNCS([strchr strdup strstr]) +AC_CHECK_SIZEOF(time_t) + # libcurl settings AC_PATH_PROG(CURL_CONFIG,curl-config) AC_ARG_WITH(curl, diff --git a/saml/internal.h b/saml/internal.h index 7caa141..0877395 100644 --- a/saml/internal.h +++ b/saml/internal.h @@ -70,6 +70,12 @@ #endif #endif +#if SIZEOF_TIME_T == 8 +# define SAMLTIME_MAX LLONG_MAX +#elif SIZEOF_TIME_T == 4 +# define SAMLTIME_MAX LONG_MAX +#endif + #define SAML_LOGCAT "OpenSAML" namespace opensaml { diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index 8f24e5b..eb4e798 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -164,7 +164,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(Conditions); IMPL_DATETIME_ATTRIB(NotBefore,0); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_TYPED_CHILDREN(AudienceRestrictionCondition, m_children.end()); IMPL_TYPED_CHILDREN(DoNotCacheCondition,m_children.end()); IMPL_TYPED_CHILDREN(Condition,m_children.end()); diff --git a/saml/saml2/core/impl/Assertions20Impl.cpp b/saml/saml2/core/impl/Assertions20Impl.cpp index 4a5ac94..ef1160c 100644 --- a/saml/saml2/core/impl/Assertions20Impl.cpp +++ b/saml/saml2/core/impl/Assertions20Impl.cpp @@ -401,7 +401,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(Conditions); IMPL_DATETIME_ATTRIB(NotBefore,0); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_TYPED_CHILDREN(AudienceRestriction, m_children.end()); IMPL_TYPED_CHILDREN(OneTimeUse,m_children.end()); IMPL_TYPED_CHILDREN(ProxyRestriction, m_children.end()); @@ -459,7 +459,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(SubjectConfirmationData); IMPL_DATETIME_ATTRIB(NotBefore,0); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_STRING_ATTRIB(Recipient); IMPL_STRING_ATTRIB(InResponseTo); IMPL_STRING_ATTRIB(Address); @@ -547,7 +547,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(KeyInfoConfirmationDataType); IMPL_DATETIME_ATTRIB(NotBefore,0); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_STRING_ATTRIB(Recipient); IMPL_STRING_ATTRIB(InResponseTo); IMPL_STRING_ATTRIB(Address); @@ -910,7 +910,7 @@ namespace opensaml { } IMPL_DATETIME_ATTRIB(AuthnInstant,0); IMPL_STRING_ATTRIB(SessionIndex); - IMPL_DATETIME_ATTRIB(SessionNotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(SessionNotOnOrAfter,SAMLTIME_MAX); IMPL_TYPED_CHILD(SubjectLocality); IMPL_TYPED_CHILD(AuthnContext); diff --git a/saml/saml2/core/impl/Protocols20Impl.cpp b/saml/saml2/core/impl/Protocols20Impl.cpp index c136be2..720de3e 100644 --- a/saml/saml2/core/impl/Protocols20Impl.cpp +++ b/saml/saml2/core/impl/Protocols20Impl.cpp @@ -1453,7 +1453,7 @@ namespace opensaml { IMPL_XMLOBJECT_CLONE(LogoutRequest); IMPL_STRING_ATTRIB(Reason); - IMPL_DATETIME_ATTRIB(NotOnOrAfter,LLONG_MAX); + IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); IMPL_TYPED_FOREIGN_CHILD(BaseID,saml2); IMPL_TYPED_FOREIGN_CHILD(NameID,saml2); IMPL_TYPED_FOREIGN_CHILD(EncryptedID,saml2); diff --git a/saml/saml2/metadata/impl/FilesystemMetadataProvider.cpp b/saml/saml2/metadata/impl/FilesystemMetadataProvider.cpp index 113e1a3..e9d3dbf 100644 --- a/saml/saml2/metadata/impl/FilesystemMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/FilesystemMetadataProvider.cpp @@ -66,8 +66,8 @@ namespace opensaml { private: XMLObject* load() const; void index(); - void index(EntityDescriptor* site, time_t validUntil=LLONG_MAX); - void index(EntitiesDescriptor* group, time_t validUntil=LLONG_MAX); + void index(EntityDescriptor* site, time_t validUntil=SAMLTIME_MAX); + void index(EntitiesDescriptor* group, time_t validUntil=SAMLTIME_MAX); // index of loaded metadata typedef multimap sitemap_t; diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index f3f5eff..a88ae51 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -986,7 +986,7 @@ namespace opensaml { IMPL_STRING_ATTRIB(ID); IMPL_STRING_ATTRIB(ProtocolSupportEnumeration); IMPL_STRING_ATTRIB(ErrorURL); - IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX); + IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); IMPL_DATETIME_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization); @@ -1828,7 +1828,7 @@ namespace opensaml { IMPL_STRING_ATTRIB(ID); IMPL_STRING_ATTRIB(AffiliationOwnerID); - IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX); + IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); IMPL_DATETIME_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember); @@ -2030,7 +2030,7 @@ namespace opensaml { IMPL_STRING_ATTRIB(ID); IMPL_STRING_ATTRIB(EntityID); - IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX); + IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); IMPL_DATETIME_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor); @@ -2240,7 +2240,7 @@ namespace opensaml { IMPL_STRING_ATTRIB(ID); IMPL_STRING_ATTRIB(Name); - IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX); + IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX); IMPL_DATETIME_ATTRIB(CacheDuration,0); IMPL_TYPED_CHILD(Extensions); IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end()); diff --git a/saml/saml2/metadata/impl/MetadataProvider.cpp b/saml/saml2/metadata/impl/MetadataProvider.cpp index ad9818b..b5b5684 100644 --- a/saml/saml2/metadata/impl/MetadataProvider.cpp +++ b/saml/saml2/metadata/impl/MetadataProvider.cpp @@ -43,7 +43,6 @@ MetadataProvider::MetadataProvider(const DOMElement* e) #ifdef _DEBUG NDC ndc("MetadataProvider"); #endif - Category& log=Category::getInstance(SAML_LOGCAT".Metadata"); SAMLConfig& conf=SAMLConfig::getConfig(); // Locate any default recognized filters. @@ -70,7 +69,8 @@ MetadataProvider::MetadataProvider(const DOMElement* e) child = XMLHelper::getNextSiblingElement(child); } } - catch (XMLToolingException&) { + catch (XMLToolingException& ex) { + Category::getInstance(SAML_LOGCAT".Metadata").error("caught exception while installing filters: %s", ex.what()); for_each(m_filters.begin(),m_filters.end(),xmltooling::cleanup()); throw; }