From 2253e03238ea96e5f14a9a409a4a27e73bea7a99 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 25 Aug 2014 10:40:42 +0200 Subject: [PATCH 4/6] added openconnect_strdup() Signed-off-by: Nikos Mavrogiannopoulos --- compat.c | 8 ++++++++ libopenconnect.map.in | 1 + openconnect.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/compat.c b/compat.c index b1d4995..cb2fc62 100644 --- a/compat.c +++ b/compat.c @@ -25,6 +25,14 @@ #include "openconnect-internal.h" +/* This function allows the caller to use the same strdup() as openconnect + * library in windows. + */ +char *openconnect_strdup(const char *s) +{ + return strdup(s); +} + #ifdef HAVE_SUNOS_BROKEN_TIME /* * On SunOS, time() goes backwards. Thankfully, gethrtime() doesn't. diff --git a/libopenconnect.map.in b/libopenconnect.map.in index 083c2ae..e0297c3 100644 --- a/libopenconnect.map.in +++ b/libopenconnect.map.in @@ -64,6 +64,7 @@ OPENCONNECT_3.3 { OPENCONNECT_3.4 { global: openconnect_set_token_callbacks; + openconnect_strdup; } OPENCONNECT_3.3; OPENCONNECT_PRIVATE { diff --git a/openconnect.h b/openconnect.h index c15d6a9..c9c3ecf 100644 --- a/openconnect.h +++ b/openconnect.h @@ -267,6 +267,8 @@ typedef enum { ownership of those strings and the library will free them later in openconnect_vpninfo_free() */ +/* This function should be used to allocate memory for openconect */ +char *openconnect_strdup(const char *s); /* The buffer 'buf' must be at least 41 bytes. It will receive a hex string with trailing NUL, representing the SHA1 fingerprint of the certificate. */ -- 1.9.3