Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
main: Add switch for using fsid with openconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaakko Hannikainen committed Aug 27, 2015
1 parent 95b570b commit ab3a6d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/openconnect_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <string.h>

#include "openconnect_helper.h"
#include "../src/main.h"
#include "../src/util.h"
#include "../src/dialog.h"

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -93,20 +94,19 @@ 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) */

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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 }
};

Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit ab3a6d1

Please sign in to comment.