-Fri Jul 1 13:03:39 1994 Mark Eichin (eichin@tweedledumber.cygnus.com)
+Fri Jul 1 13:03:39 1994 Mark Eichin (eichin@cygnus.com)
+
+ * asn1_encode_k.c (asn1_encode_msgtype): comment out krb5_msgtype
+ decl of val arg, use int (to match prototype in header.) Throw out
+ OLDDECLARG, DECLARG, and use old-style definition to match style
+ of the rest of the code.
+ (asn1_encode_ui_4): comment out krb5_ui_4 decl of val arg, use int
+ (to match prototype in header.) Also rewrote definition header.
+
+ * asn1_decode.c (asn1_decode_generaltime): tm_gmtoff is *not* in
+ System V either. The only portable way to find the delta is to
+ subtract gmtime from localtime at a fixed point (epoch+24hours is
+ an easy way to simplify the arithmetic.)
+ HAVE_GMTOFF: might someday be defined, but for now merely labels
+ what the code original did/was intended to do.
* configure.in: redo "autoconf frobbage" since the old way didn't
work with srcdir. Now, AC_OUTPUT generates all three Makefiles,
#include "asn1_decode.h"
#include "asn1_get.h"
#include <time.h>
+#ifdef USE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#define setup()\
asn1_error_code retval;\
ts.tm_isdst = -1;
t = mktime(&ts);
if(t == -1) return ASN1_BAD_TIMEFORMAT;
+
+#ifdef HAVE_GMTOFF
t += ts.tm_gmtoff; /* Convert back to UTC timezone */
- /* !!!WARNING!!! tm_gmtoff is non-ANSI,
- although it should exist in both
- BSD and SYSV. */
+#else
+ {
+ struct tm zg, zl;
+ time_t zero = 24*60*60; /* miss the year boundary */
+ long delta;
+
+ zl = *localtime(&zero);
+ zg = *gmtime(&zero);
+
+ delta = (zl.tm_sec + 60*(zl.tm_min+60*(zl.tm_hour + 24*zl.tm_yday)))
+ - (zg.tm_sec + 60*(zg.tm_min+60*(zg.tm_hour + 24*zg.tm_yday)));
+
+ t += delta;
+ }
+#endif
+
*val = t;
cleanup();
}
*retlen = sum;\
return 0
-asn1_error_code asn1_encode_ui_4(DECLARG(asn1buf *, buf),
- DECLARG(const krb5_ui_4, val),
- DECLARG(int *, retlen))
- OLDDECLARG(asn1buf *, buf)
- OLDDECLARG(const krb5_ui_4, val)
- OLDDECLARG(int *, retlen)
+asn1_error_code asn1_encode_ui_4(buf, val, retlen)
+ asn1buf * buf;
+ const /*krb5_ui_4*/int val;
+ int *retlen;
{
return asn1_encode_unsigned_integer(buf,val,retlen);
}
-asn1_error_code asn1_encode_msgtype(DECLARG(asn1buf *, buf),
- DECLARG(const krb5_msgtype, val),
- DECLARG(int *, retlen))
- OLDDECLARG(asn1buf *, buf)
- OLDDECLARG(const krb5_msgtype, val)
- OLDDECLARG(int *, retlen)
+asn1_error_code asn1_encode_msgtype(buf, val, retlen)
+ asn1buf * buf;
+ const /*krb5_msgtype*/int val;
+ int * retlen;
{
switch(val){
case KRB5_AS_REQ: