From a7bbb30a15ee1b359b46ca8c5e41a6e61e8edb92 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 18 Mar 2020 12:36:25 -0400 Subject: [PATCH] libopenconnect: add public interface stubs for SAML support The SAML support is still work in progress and not merged yet. Start adding the new public API to libopenconnect, so that distributions can choose to ship with out-of-tree support to let their users have the feature without breaking ABI compatibility. Signed-off-by: Luca Boccassi Co-authored-by: Steven Walter --- libopenconnect.map.in | 2 ++ library.c | 12 ++++++++++++ openconnect.h | 23 +++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/libopenconnect.map.in b/libopenconnect.map.in index 9e47bdf4..c8bd45c2 100644 --- a/libopenconnect.map.in +++ b/libopenconnect.map.in @@ -115,6 +115,8 @@ OPENCONNECT_5_7 { openconnect_get_auth_expiration; openconnect_disable_dtls; openconnect_get_connect_url; + openconnect_set_webview_callback; + openconnect_webview_load_changed; } OPENCONNECT_5_6; OPENCONNECT_PRIVATE { diff --git a/library.c b/library.c index a06ba6af..943b2982 100644 --- a/library.c +++ b/library.c @@ -1606,3 +1606,15 @@ retry: return ret; } + +void openconnect_set_webview_callback(struct openconnect_info *vpninfo, + openconnect_open_webview_vfn webview_fn) +{ + return; +} + +int openconnect_webview_load_changed(struct openconnect_info *vpninfo, + const struct oc_webview_result *result) +{ + return -EOPNOTSUPP; +} diff --git a/openconnect.h b/openconnect.h index 4f2297a1..e735f33e 100644 --- a/openconnect.h +++ b/openconnect.h @@ -43,6 +43,8 @@ extern "C" { * - Add openconnect_get_auth_expiration() * - Add openconnect_disable_dtls() * - Make openconnect_disable_ipv6() return int + * - Add openconnect_set_webview_callback() + * - Add openconnect_webview_load_changed() * * API version 5.6 (v8.06; 2020-03-31): * - Add openconnect_set_trojan_interval() @@ -324,6 +326,17 @@ struct oc_cert { void *reserved; }; +/* Used by openconnect_webview_load_changed() to return data to OC. + * The arrays must contain an even number of const strings, with names and + * values, and a NULL to terminate. E.g.: + * name0, val0, name1, val1, NULL + */ +struct oc_webview_result { + const char *uri; + const char **cookies; + const char **headers; +}; + /****************************************************************************/ #define PRG_ERR 0 @@ -732,6 +745,16 @@ struct openconnect_info *openconnect_vpninfo_new(const char *useragent, void *privdata); void openconnect_vpninfo_free(struct openconnect_info *vpninfo); +typedef int (*openconnect_open_webview_vfn) (struct openconnect_info *, + const char *uri, + void *privdata); + +void openconnect_set_webview_callback(struct openconnect_info *vpninfo, + openconnect_open_webview_vfn); + +int openconnect_webview_load_changed(struct openconnect_info *vpninfo, + const struct oc_webview_result *result); + /* Callback to allow binding a newly created socket's file descriptor to a specific interface, e.g. with SO_BINDTODEVICE. This tells the kernel not to route the traffic in question over the VPN tunnel. */ -- 2.50.1