Fix Solaris build
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 29 Sep 2014 10:50:06 +0000 (11:50 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 29 Sep 2014 10:50:06 +0000 (11:50 +0100)
src/src/os.c
src/src/tlscert-openssl.c

index 6e02b8fe298099e96323d39d435ab63107f3c189..2b6f79c3fab66a24e121bb734e4194b0a5047d81 100644 (file)
@@ -836,6 +836,39 @@ os_get_dns_resolver_res(void)
 
 /* ----------------------------------------------------------------------- */
 
 
 /* ----------------------------------------------------------------------- */
 
+/***********************************************************
+*                 Time-related functions                   *
+***********************************************************/
+
+/* At least Solaris, and probably others, don't have this */
+
+#ifndef _BSD_SOURCE
+
+# include <time.h>
+# include <stdlib.h>
+
+time_t
+timegm(struct tm * tm)
+{
+time_t ret;
+char *tz;
+
+tz = getenv("TZ");
+setenv("TZ", "", 1);
+tzset();
+ret = mktime(tm);
+if (tz)
+  setenv("TZ", tz, 1);
+else
+  unsetenv("TZ");
+tzset();
+return ret;
+}
+
+#endif
+
+/* ----------------------------------------------------------------------- */
+
 
 
 
 
 
 
index a57980df040f26d72534b2837ca2070689ff1b16..9444b6d7ca07652544c10cb6b47369503fc680da 100644 (file)
@@ -344,7 +344,7 @@ while (sk_GENERAL_NAME_num(san) > 0)
   if (ele[len])        /* not nul-terminated */
     ele = string_copyn(ele, len);
 
   if (ele[len])        /* not nul-terminated */
     ele = string_copyn(ele, len);
 
-  if (strnlen(CS ele, len) == len)     /* ignore any with embedded nul */
+  if (Ustrlen(ele) == len)     /* ignore any with embedded nul */
     list = string_append_listele(list, sep,
          match == -1 ? string_sprintf("%s=%s", tag, ele) : ele);
   }
     list = string_append_listele(list, sep,
          match == -1 ? string_sprintf("%s=%s", tag, ele) : ele);
   }