From: Tom Yu Date: Wed, 23 Mar 2005 04:38:46 +0000 (+0000) Subject: pullup from trunk X-Git-Tag: krb5-1.4.3-beta1~68 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5ff08d6b8ff1250637898c34bae22cbd635b76f8;p=krb5.git pullup from trunk ticket: 2953 version_fixed: 1.4.1 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17151 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 33d4ceaac..29358cafd 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,9 @@ +2005-03-04 Ken Raeburn + + * configure.in: Check return type of gmtime_r, and define + GMTIME_R_RETURNS_INT if it returns int. If the return type can't + be determined, pretend the function isn't there. + 2005-02-08 Ken Raeburn * k5-platform.h (PROGRAM_EXITING) [__GNUC__ && !_WIN32 && diff --git a/src/include/configure.in b/src/include/configure.in index 071ff55ac..450eea556 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -98,6 +98,29 @@ if test "$ac_cv_func_getpwuid_r" = yes; then fi fi +if test "$ac_cv_func_gmtime_r" = yes; then + AC_MSG_CHECKING([whether gmtime_r returns int]) + AC_CACHE_VAL(krb5_cv_gmtime_r_returns_int, + [AC_TRY_COMPILE([#include + extern int gmtime_r ();], [1;], return_int=yes, return_int=no) + AC_TRY_COMPILE([#include + extern struct tm *gmtime_r ();], [1;], return_ptr=yes, return_ptr=no) + case $return_int/$return_ptr in + yes/no) krb5_cv_gmtime_r_returns_int=yes ;; + no/yes) krb5_cv_gmtime_r_returns_int=no ;; + *) # Can't figure it out, punt the function. + ac_cv_func_gmtime_r=no ;; + esac]) + if test "$ac_cv_func_gmtime_r" = no; then + AC_MSG_RESULT(unknown -- ignoring gmtime_r) + else + AC_MSG_RESULT($krb5_cv_gmtime_r_returns_int) + if test "$krb5_cv_gmtime_r_returns_int" = yes; then + AC_DEFINE(GMTIME_R_RETURNS_INT,1,[Define if gmtime_r returns int instead of struct tm pointer, as on old HP-UX systems.]) + fi + fi +fi + AC_CHECK_FUNC(getservbyname_r,[ ac_cv_func_getservbyname_r=yes if test "$ac_cv_func_getservbyname_r" = yes; then diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 4baf064f2..9d9d2bbc2 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,3 +1,8 @@ +2005-03-04 Ken Raeburn + + * asn1_encode.c (asn1_encode_generaltime): If gmtime_r returns int + instead of pointer, do the appropriate error checking. + 2004-12-28 Ezra Peisach * asn1_decode.c (asn1_decode_generaltime): Fix memory leak when diff --git a/src/lib/krb5/asn.1/asn1_encode.c b/src/lib/krb5/asn.1/asn1_encode.c index 4f9e6949b..c5e3452b8 100644 --- a/src/lib/krb5/asn.1/asn1_encode.c +++ b/src/lib/krb5/asn.1/asn1_encode.c @@ -242,8 +242,13 @@ asn1_error_code asn1_encode_generaltime(asn1buf *buf, time_t val, * and some bogus implementations might overrun on the sprintf. */ #ifdef HAVE_GMTIME_R +# ifdef GMTIME_R_RETURNS_INT + if (gmtime_r(&gmt_time, >imebuf) != 0) + return ASN1_BAD_GMTIME; +# else if (gmtime_r(&gmt_time, >imebuf) == NULL) return ASN1_BAD_GMTIME; +# endif #else gtime = gmtime(&gmt_time); if (gtime == NULL)