diff --git a/lib/openconnect_helper.c b/lib/openconnect_helper.c index 57faa33..a0623fa 100644 --- a/lib/openconnect_helper.c +++ b/lib/openconnect_helper.c @@ -30,6 +30,7 @@ #include #include "openconnect_helper.h" +#include "../src/main.h" #include "../src/util.h" #include "../src/dialog.h" @@ -43,6 +44,7 @@ typedef void (*show_progress_fn) (void *privdata, int level, typedef void (*vpninfo_free_fn)(struct openconnect_info *vpninfo); typedef int (*obtain_cookie_fn)(struct openconnect_info *vpninfo); +typedef int (*passphrase_from_fsid_fn)(struct openconnect_info *vpninfo); #if OPENCONNECT_CHECK_VER(5, 0) typedef int (*validate_cert_fn) (void *privdata, const char *reason); @@ -75,7 +77,6 @@ typedef const char *(*get_hostname_fn)(struct openconnect_info *); typedef int (*set_client_cert_fn)(struct openconnect_info *, const char *cert, const char *sslkey); -typedef int (*passphrase_from_fsid_fn)(struct openconnect_info *vpninfo); typedef int (*set_cafile_fn)(struct openconnect_info *, const char *); typedef int (*parse_url_fn)(struct openconnect_info *vpninfo, const char *url); typedef int (*set_option_value_fn)(struct oc_form_opt *opt, const char *value); @@ -93,7 +94,6 @@ typedef char *(*get_hostname_fn)(struct openconnect_info *); typedef void (*set_client_cert_fn)(struct openconnect_info *, char *cert, char *sslkey); -typedef int (*passphrase_from_fsid_fn)(struct openconnect_info *vpninfo); typedef void (*set_cafile_fn)(struct openconnect_info *, char *); typedef int (*parse_url_fn)(struct openconnect_info *vpninfo, char *url); #endif /* !OPENCONNECT_CHECK_VERSION(4, 0) */ @@ -101,12 +101,12 @@ typedef int (*parse_url_fn)(struct openconnect_info *vpninfo, char *url); static init_ssl_fn init_ssl; static vpninfo_free_fn vpninfo_free; static obtain_cookie_fn obtain_cookie; +static passphrase_from_fsid_fn passphrase_from_fsid; static vpninfo_new_fn _vpninfo_new; static get_cookie_fn _get_cookie; static get_hostname_fn _get_hostname; static set_client_cert_fn _set_client_cert; -static passphrase_from_fsid_fn _passphrase_from_fsid; static set_cafile_fn _set_cafile; static parse_url_fn _parse_url; @@ -136,7 +136,7 @@ static gboolean init_lib(void) { _get_cookie = openconnect_get_cookie; _get_hostname = openconnect_get_hostname; _set_client_cert = openconnect_set_client_cert; - _passphrase_from_fsid = openconnect_passphrase_from_fsid; + passphrase_from_fsid = openconnect_passphrase_from_fsid; _set_cafile = openconnect_set_cafile; _parse_url = openconnect_parse_url; #if OPENCONNECT_CHECK_VER(5, 0) @@ -164,7 +164,7 @@ static gboolean init_lib(void) { _get_cookie = dlsym(lib, "openconnect_get_cookie"); _get_hostname = dlsym(lib, "openconnect_get_hostname"); _set_client_cert = dlsym(lib, "openconnect_set_client_cert"); - _passphrase_from_fsid = dlsym(lib, "openconnect_passphrase_from_fsid"); + passphrase_from_fsid = dlsym(lib, "openconnect_passphrase_from_fsid"); _set_cafile = dlsym(lib, "openconnect_set_cafile"); _parse_url = dlsym(lib, "openconnect_parse_url"); #if OPENCONNECT_CHECK_VER(5, 0) @@ -434,6 +434,9 @@ static GVariantDict *get_tokens(GHashTable *info) if(cert) set_cafile(vpninfo, cert); + if(use_fsid) + passphrase_from_fsid(vpninfo); + parse_url(vpninfo, host); status = obtain_cookie(vpninfo); diff --git a/src/main.c b/src/main.c index 5493cff..eb7b69f 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,9 @@ GHashTable *technology_types, *services; GDBusProxy *manager_proxy, *vpn_manager_proxy; struct technology *technologies[CONNECTION_TYPE_COUNT]; gboolean shutting_down = FALSE; + const gchar *default_page; +gboolean use_fsid; /* sort smallest enum value first */ gint technology_list_sort_cb(GtkListBoxRow *row1, GtkListBoxRow *row2, @@ -590,6 +592,8 @@ static void activate(GtkApplication *app, gpointer user_data) static const GOptionEntry options[] = { { "page", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &default_page, NULL, NULL }, + { "use-fsid", 0, 0, G_OPTION_ARG_NONE, &use_fsid, + "Use FSID with openconnect", NULL }, { NULL } }; diff --git a/src/main.h b/src/main.h index ed3f4af..9e383dc 100644 --- a/src/main.h +++ b/src/main.h @@ -30,5 +30,6 @@ void remove_service(const gchar *path); extern gboolean shutting_down; extern GtkWidget *main_window; +extern gboolean use_fsid; #endif /* _CONNMAN_GTK_MAIN_H */