From ad7ac48d030b5ba7b8449bf3621b817affe3190f Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 14 Feb 2015 20:03:39 -0600 Subject: add strsep fallback for libtls --- configure.ac | 3 ++- include/string.h | 4 ++++ tls/Makefile.am | 5 +++++ update.sh | 6 +++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2f86fbd..46e9a40 100644 --- a/configure.ac +++ b/configure.ac @@ -196,7 +196,7 @@ LDFLAGS="$LDFLAGS $CLANG_FLAGS" AC_CHECK_FUNCS([arc4random_buf asprintf explicit_bzero funopen getauxval]) AC_CHECK_FUNCS([getentropy issetugid memmem poll reallocarray]) -AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strtonum]) +AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) AC_CHECK_FUNCS([symlink openat]) AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp]) @@ -213,6 +213,7 @@ AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes]) +AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes]) AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp" = xyes]) diff --git a/include/string.h b/include/string.h index c558a90..05d1ffc 100644 --- a/include/string.h +++ b/include/string.h @@ -33,6 +33,10 @@ size_t strnlen(const char *str, size_t maxlen); #endif #endif +#ifndef HAVE_STRSEP +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_EXPLICIT_BZERO void explicit_bzero(void *, size_t); #endif diff --git a/tls/Makefile.am b/tls/Makefile.am index 8a88632..f0919a5 100644 --- a/tls/Makefile.am +++ b/tls/Makefile.am @@ -16,4 +16,9 @@ libtls_la_SOURCES += tls_server.c libtls_la_SOURCES += tls_util.c libtls_la_SOURCES += tls_verify.c noinst_HEADERS = tls_internal.h + +if !HAVE_STRSEP +libtls_la_SOURCES += strsep.c +endif + endif diff --git a/update.sh b/update.sh index 35b49d1..29012ad 100755 --- a/update.sh +++ b/update.sh @@ -168,7 +168,11 @@ done echo copying libtls source rm -f tls/*.c tls/*.h for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do - $CP $libtls_src/$i tls + if [ -e $libtls_src/$i ]; then + $CP $libtls_src/$i tls + else + $CP $libc_src/string/$i tls + fi done # copy openssl(1) source -- cgit v1.2.3-55-g6feb