From cf1bf2656e9dd185eed210eb74db40fda37a8f11 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 14 Oct 2010 17:45:19 +0200 Subject: Moved sources of the NetworkManager plugin to src/frontends. --- packages/network-manager-strongswan/Makefile | 2 +- src/frontends/gnome/.gitignore | 11 + src/frontends/gnome/Makefile.am | 26 + src/frontends/gnome/NEWS | 29 ++ src/frontends/gnome/auth-dialog/.gitignore | 1 + src/frontends/gnome/auth-dialog/Makefile.am | 26 + src/frontends/gnome/auth-dialog/main.c | 247 ++++++++++ src/frontends/gnome/autogen.sh | 15 + src/frontends/gnome/configure.ac | 101 ++++ src/frontends/gnome/debian/.gitignore | 6 + src/frontends/gnome/debian/changelog | 33 ++ src/frontends/gnome/debian/compat | 1 + src/frontends/gnome/debian/control | 29 ++ src/frontends/gnome/debian/copyright | 10 + src/frontends/gnome/debian/docs | 0 .../debian/network-manager-strongswan.postinst | 19 + src/frontends/gnome/debian/rules | 15 + src/frontends/gnome/m4/.gitignore | 7 + src/frontends/gnome/m4/compiler_warnings.m4 | 31 ++ src/frontends/gnome/nm-strongswan-service.conf | 16 + src/frontends/gnome/nm-strongswan-service.name.in | 8 + src/frontends/gnome/po/.gitignore | 4 + src/frontends/gnome/po/ChangeLog | 0 src/frontends/gnome/po/LINGUAS | 2 + src/frontends/gnome/po/POTFILES.in | 5 + src/frontends/gnome/po/de.po | 173 +++++++ src/frontends/gnome/properties/Makefile.am | 37 ++ .../gnome/properties/nm-strongswan-dialog.glade | 346 +++++++++++++ src/frontends/gnome/properties/nm-strongswan.c | 541 +++++++++++++++++++++ src/frontends/gnome/properties/nm-strongswan.h | 76 +++ src/libcharon/plugins/nm/gnome/.gitignore | 11 - src/libcharon/plugins/nm/gnome/Makefile.am | 26 - src/libcharon/plugins/nm/gnome/NEWS | 29 -- .../plugins/nm/gnome/auth-dialog/.gitignore | 1 - .../plugins/nm/gnome/auth-dialog/Makefile.am | 26 - src/libcharon/plugins/nm/gnome/auth-dialog/main.c | 247 ---------- src/libcharon/plugins/nm/gnome/autogen.sh | 15 - src/libcharon/plugins/nm/gnome/configure.ac | 101 ---- src/libcharon/plugins/nm/gnome/debian/.gitignore | 6 - src/libcharon/plugins/nm/gnome/debian/changelog | 33 -- src/libcharon/plugins/nm/gnome/debian/compat | 1 - src/libcharon/plugins/nm/gnome/debian/control | 29 -- src/libcharon/plugins/nm/gnome/debian/copyright | 10 - src/libcharon/plugins/nm/gnome/debian/docs | 0 .../debian/network-manager-strongswan.postinst | 19 - src/libcharon/plugins/nm/gnome/debian/rules | 15 - src/libcharon/plugins/nm/gnome/m4/.gitignore | 7 - .../plugins/nm/gnome/m4/compiler_warnings.m4 | 31 -- .../plugins/nm/gnome/nm-strongswan-service.conf | 16 - .../plugins/nm/gnome/nm-strongswan-service.name.in | 8 - src/libcharon/plugins/nm/gnome/po/.gitignore | 4 - src/libcharon/plugins/nm/gnome/po/ChangeLog | 0 src/libcharon/plugins/nm/gnome/po/LINGUAS | 2 - src/libcharon/plugins/nm/gnome/po/POTFILES.in | 5 - src/libcharon/plugins/nm/gnome/po/de.po | 173 ------- .../plugins/nm/gnome/properties/Makefile.am | 37 -- .../nm/gnome/properties/nm-strongswan-dialog.glade | 346 ------------- .../plugins/nm/gnome/properties/nm-strongswan.c | 541 --------------------- .../plugins/nm/gnome/properties/nm-strongswan.h | 76 --- 59 files changed, 1816 insertions(+), 1816 deletions(-) create mode 100644 src/frontends/gnome/.gitignore create mode 100644 src/frontends/gnome/Makefile.am create mode 100644 src/frontends/gnome/NEWS create mode 100644 src/frontends/gnome/auth-dialog/.gitignore create mode 100644 src/frontends/gnome/auth-dialog/Makefile.am create mode 100644 src/frontends/gnome/auth-dialog/main.c create mode 100755 src/frontends/gnome/autogen.sh create mode 100644 src/frontends/gnome/configure.ac create mode 100644 src/frontends/gnome/debian/.gitignore create mode 100644 src/frontends/gnome/debian/changelog create mode 100644 src/frontends/gnome/debian/compat create mode 100644 src/frontends/gnome/debian/control create mode 100644 src/frontends/gnome/debian/copyright create mode 100644 src/frontends/gnome/debian/docs create mode 100644 src/frontends/gnome/debian/network-manager-strongswan.postinst create mode 100755 src/frontends/gnome/debian/rules create mode 100644 src/frontends/gnome/m4/.gitignore create mode 100644 src/frontends/gnome/m4/compiler_warnings.m4 create mode 100644 src/frontends/gnome/nm-strongswan-service.conf create mode 100644 src/frontends/gnome/nm-strongswan-service.name.in create mode 100644 src/frontends/gnome/po/.gitignore create mode 100644 src/frontends/gnome/po/ChangeLog create mode 100644 src/frontends/gnome/po/LINGUAS create mode 100644 src/frontends/gnome/po/POTFILES.in create mode 100644 src/frontends/gnome/po/de.po create mode 100644 src/frontends/gnome/properties/Makefile.am create mode 100644 src/frontends/gnome/properties/nm-strongswan-dialog.glade create mode 100644 src/frontends/gnome/properties/nm-strongswan.c create mode 100644 src/frontends/gnome/properties/nm-strongswan.h delete mode 100644 src/libcharon/plugins/nm/gnome/.gitignore delete mode 100644 src/libcharon/plugins/nm/gnome/Makefile.am delete mode 100644 src/libcharon/plugins/nm/gnome/NEWS delete mode 100644 src/libcharon/plugins/nm/gnome/auth-dialog/.gitignore delete mode 100644 src/libcharon/plugins/nm/gnome/auth-dialog/Makefile.am delete mode 100644 src/libcharon/plugins/nm/gnome/auth-dialog/main.c delete mode 100755 src/libcharon/plugins/nm/gnome/autogen.sh delete mode 100644 src/libcharon/plugins/nm/gnome/configure.ac delete mode 100644 src/libcharon/plugins/nm/gnome/debian/.gitignore delete mode 100644 src/libcharon/plugins/nm/gnome/debian/changelog delete mode 100644 src/libcharon/plugins/nm/gnome/debian/compat delete mode 100644 src/libcharon/plugins/nm/gnome/debian/control delete mode 100644 src/libcharon/plugins/nm/gnome/debian/copyright delete mode 100644 src/libcharon/plugins/nm/gnome/debian/docs delete mode 100644 src/libcharon/plugins/nm/gnome/debian/network-manager-strongswan.postinst delete mode 100755 src/libcharon/plugins/nm/gnome/debian/rules delete mode 100644 src/libcharon/plugins/nm/gnome/m4/.gitignore delete mode 100644 src/libcharon/plugins/nm/gnome/m4/compiler_warnings.m4 delete mode 100644 src/libcharon/plugins/nm/gnome/nm-strongswan-service.conf delete mode 100644 src/libcharon/plugins/nm/gnome/nm-strongswan-service.name.in delete mode 100644 src/libcharon/plugins/nm/gnome/po/.gitignore delete mode 100644 src/libcharon/plugins/nm/gnome/po/ChangeLog delete mode 100644 src/libcharon/plugins/nm/gnome/po/LINGUAS delete mode 100644 src/libcharon/plugins/nm/gnome/po/POTFILES.in delete mode 100644 src/libcharon/plugins/nm/gnome/po/de.po delete mode 100644 src/libcharon/plugins/nm/gnome/properties/Makefile.am delete mode 100644 src/libcharon/plugins/nm/gnome/properties/nm-strongswan-dialog.glade delete mode 100644 src/libcharon/plugins/nm/gnome/properties/nm-strongswan.c delete mode 100644 src/libcharon/plugins/nm/gnome/properties/nm-strongswan.h diff --git a/packages/network-manager-strongswan/Makefile b/packages/network-manager-strongswan/Makefile index c4a3b9f1e..0a30dad58 100644 --- a/packages/network-manager-strongswan/Makefile +++ b/packages/network-manager-strongswan/Makefile @@ -1,5 +1,5 @@ -SOURCE:=../../src/charon/plugins/nm/gnome +SOURCE:=../../src/frontends/gnome VERSION:=1.1.0rc1 source: prepare diff --git a/src/frontends/gnome/.gitignore b/src/frontends/gnome/.gitignore new file mode 100644 index 000000000..64bb14511 --- /dev/null +++ b/src/frontends/gnome/.gitignore @@ -0,0 +1,11 @@ +compile +config.h +config.h.in +intltool-extract.in +intltool-merge.in +intltool-update.in +mkinstalldirs +nm-strongswan-service.name +stamp-h1 +config.guess.cdbs-orig +config.sub.cdbs-orig diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am new file mode 100644 index 000000000..fb29085a6 --- /dev/null +++ b/src/frontends/gnome/Makefile.am @@ -0,0 +1,26 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = properties auth-dialog po + +dbusservicedir = $(sysconfdir)/dbus-1/system.d +dbusservice_DATA = nm-strongswan-service.conf + +nmvpnservicedir = $(sysconfdir)/NetworkManager/VPN +nmvpnservice_DATA = nm-strongswan-service.name + +@INTLTOOL_DESKTOP_RULE@ + +nm-strongswan-service.name: $(srcdir)/nm-strongswan-service.name.in + sed -e 's|[@]LIBEXECDIR[@]|$(libexecdir)|' \ + -e 's|[@]CHARON[@]|$(charon)|' $< >$@ + +EXTRA_DIST = nm-strongswan-service.name.in \ + $(dbusservice_DATA) \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in + +CLEANFILES = $(nmvpnservice_DATA) *~ +DISTCLEANFILES = intltool-extract intltool-merge intltool-update + +ACLOCAL_AMFLAGS = -I m4 diff --git a/src/frontends/gnome/NEWS b/src/frontends/gnome/NEWS new file mode 100644 index 000000000..f84ccc836 --- /dev/null +++ b/src/frontends/gnome/NEWS @@ -0,0 +1,29 @@ +NetworkManager-strongswan-1.2.0 +------------------------------- + +- Added Smartcard support + +NetworkManager-strongswan-1.1.2 +------------------------------- + +- Additionally look for libnm-glib[-vpn] pkgconfig packages during configure +- Tooltips are translatable +- Update german translations + +NetworkManager-strongswan-1.1.1 +------------------------------- + +- Implemented save_secrets(), fixes crash when saving connections + +NetworkManager-strongswan-1.1.0 +------------------------------- + +- updated to NetworkManager 7.1 API + +- requires >= strongswan-4.1.13 + + +NetworkManager-strongswan-1.0.0 +------------------------------- + +- First release diff --git a/src/frontends/gnome/auth-dialog/.gitignore b/src/frontends/gnome/auth-dialog/.gitignore new file mode 100644 index 000000000..bceb305e1 --- /dev/null +++ b/src/frontends/gnome/auth-dialog/.gitignore @@ -0,0 +1 @@ +nm-strongswan-auth-dialog diff --git a/src/frontends/gnome/auth-dialog/Makefile.am b/src/frontends/gnome/auth-dialog/Makefile.am new file mode 100644 index 000000000..672287123 --- /dev/null +++ b/src/frontends/gnome/auth-dialog/Makefile.am @@ -0,0 +1,26 @@ +libexec_PROGRAMS = nm-strongswan-auth-dialog + +nm_strongswan_auth_dialog_CPPFLAGS = \ + $(GTHREAD_CFLAGS) \ + $(GTK_CFLAGS) \ + $(LIBGNOMEUI_CFLAGS) \ + $(GNOMEKEYRING_CFLAGS) \ + $(NETWORK_MANAGER_CFLAGS) \ + $(NM_UTILS_CFLAGS) \ + -DICONDIR=\""$(datadir)/pixmaps"\" \ + -DGLADEDIR=\""$(gladedir)"\" \ + -DBINDIR=\""$(bindir)"\" \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + -DVERSION=\"$(VERSION)\" + +nm_strongswan_auth_dialog_SOURCES = \ + main.c + +nm_strongswan_auth_dialog_LDADD = \ + $(GTK_LIBS) \ + $(LIBGNOMEUI_LIBS) \ + $(GNOMEKEYRING_LIBS) + diff --git a/src/frontends/gnome/auth-dialog/main.c b/src/frontends/gnome/auth-dialog/main.c new file mode 100644 index 000000000..686ff290f --- /dev/null +++ b/src/frontends/gnome/auth-dialog/main.c @@ -0,0 +1,247 @@ +/* + * Copyright (C) 2008 Martin Willi + * Hochschule fuer Technik Rapperswil + * Copyright (C) 2004 Dan Williams + * Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan" + +/** + * lookup a password in the keyring + */ +static char *lookup_password(char *name, char *service) +{ + GList *list; + GList *iter; + char *pass = NULL; + + if (gnome_keyring_find_network_password_sync(g_get_user_name(), NULL, name, + NULL, service, NULL, 0, &list) != GNOME_KEYRING_RESULT_OK) + { + return NULL; + } + + for (iter = list; iter; iter = iter->next) + { + GnomeKeyringNetworkPasswordData *data = iter->data; + + if (strcmp(data->object, "password") == 0 && data->password) + { + pass = g_strdup(data->password); + break; + } + } + gnome_keyring_network_password_list_free(list); + return pass; +} + +/** + * get the connection type + */ +static char* get_connection_type(char *uuid) +{ + GConfClient *client = NULL; + GSList *list; + GSList *iter; + char *key, *str, *path, *found = NULL, *method = NULL; + + client = gconf_client_get_default(); + + list = gconf_client_all_dirs(client, "/system/networking/connections", NULL); + g_return_val_if_fail(list, NULL); + + for (iter = list; iter; iter = iter->next) + { + path = (char *) iter->data; + + key = g_strdup_printf("%s/%s/%s", path, + NM_SETTING_CONNECTION_SETTING_NAME, + NM_SETTING_CONNECTION_UUID); + str = gconf_client_get_string(client, key, NULL); + g_free (key); + + if (str && !strcmp(str, uuid)) + { + found = g_strdup(path); + } + g_free (str); + if (found) + { + break; + } + } + g_slist_foreach(list, (GFunc)g_free, NULL); + g_slist_free(list); + + if (found) + { + key = g_strdup_printf ("%s/%s/%s", found, + NM_SETTING_VPN_SETTING_NAME, "method"); + method = gconf_client_get_string(client, key, NULL); + g_free(found); + g_free(key); + } + g_object_unref(client); + return method; +} + +int main (int argc, char *argv[]) +{ + gboolean retry = FALSE; + gchar *name = NULL, *uuid = NULL, *service = NULL, *keyring = NULL, *pass; + GOptionContext *context; + GnomeProgram *program = NULL; + char buf, *agent, *type; + guint32 itemid; + GtkWidget *dialog; + GOptionEntry entries[] = { + { "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL}, + { "uuid", 'u', 0, G_OPTION_ARG_STRING, &uuid, "UUID of VPN connection", NULL}, + { "name", 'n', 0, G_OPTION_ARG_STRING, &name, "Name of VPN connection", NULL}, + { "service", 's', 0, G_OPTION_ARG_STRING, &service, "VPN service type", NULL}, + { NULL } + }; + + bindtextdomain(GETTEXT_PACKAGE, NULL); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + + context = g_option_context_new ("- strongswan auth dialog"); + g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); + + program = gnome_program_init ("nm-strongswan-auth-dialog", VERSION, + LIBGNOMEUI_MODULE, + argc, argv, + GNOME_PARAM_GOPTION_CONTEXT, context, + GNOME_PARAM_NONE); + + if (uuid == NULL || name == NULL || service == NULL) + { + fprintf (stderr, "Have to supply UUID, name, and service\n"); + g_object_unref (program); + return 1; + } + + if (strcmp(service, NM_DBUS_SERVICE_STRONGSWAN) != 0) + { + fprintf(stderr, "This dialog only works with the '%s' service\n", + NM_DBUS_SERVICE_STRONGSWAN); + g_object_unref (program); + return 1; + } + + type = get_connection_type(uuid); + if (!type) + { + fprintf(stderr, "Connection lookup failed\n"); + g_object_unref (program); + return 1; + } + if (!strcmp(type, "eap") || !strcmp(type, "key") || !strcmp(type, "smartcard")) + { + pass = lookup_password(name, service); + if (!pass || retry) + { + if (!strcmp(type, "eap")) + { + dialog = gnome_password_dialog_new(_("VPN password required"), + _("EAP password required to establish VPN connection:"), + NULL, NULL, TRUE); + gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); + } + else if (!strcmp(type, "key")) + { + dialog = gnome_password_dialog_new(_("VPN password required"), + _("Private key decryption password required to establish VPN connection:"), + NULL, NULL, TRUE); + gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); + } + else /* smartcard */ + { + dialog = gnome_password_dialog_new(_("VPN password required"), + _("Smartcard PIN required to establish VPN connection:"), + NULL, NULL, TRUE); + gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), FALSE); + } + gnome_password_dialog_set_show_username(GNOME_PASSWORD_DIALOG(dialog), FALSE); + if (pass) + { + gnome_password_dialog_set_password(GNOME_PASSWORD_DIALOG(dialog), pass); + } + if (!gnome_password_dialog_run_and_block(GNOME_PASSWORD_DIALOG(dialog))) + { + g_object_unref (program); + return 1; + } + + pass = gnome_password_dialog_get_password(GNOME_PASSWORD_DIALOG(dialog)); + switch (gnome_password_dialog_get_remember(GNOME_PASSWORD_DIALOG(dialog))) + { + case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING: + break; + case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION: + keyring = "session"; + /* FALL */ + case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER: + if (gnome_keyring_set_network_password_sync(keyring, + g_get_user_name(), NULL, name, "password", service, NULL, 0, + pass, &itemid) != GNOME_KEYRING_RESULT_OK) + { + g_warning ("storing password in keyring failed"); + } + break; + } + } + printf("password\n%s\n", pass); + } + else + { + agent = getenv("SSH_AUTH_SOCK"); + if (agent) + { + printf("agent\n%s\n", agent); + } + else + { + dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Configuration uses ssh-agent for authentication, " + "but ssh-agent is not running!")); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return 1; + } + } + printf("\n\n"); + /* flush output, wait for input */ + fflush(stdout); + if (fread(&buf, 1, sizeof(buf), stdin)); + g_object_unref(program); + return 0; +} + diff --git a/src/frontends/gnome/autogen.sh b/src/frontends/gnome/autogen.sh new file mode 100755 index 000000000..25847e7c3 --- /dev/null +++ b/src/frontends/gnome/autogen.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. +REQUIRED_AUTOMAKE_VERSION=1.7 +PKG_NAME=NetworkManager-strongswan + +which gnome-autogen.sh || { + echo "You need to install gnome-common from the GNOME CVS" + exit 1 +} +USE_GNOME2_MACROS=1 . gnome-autogen.sh + + diff --git a/src/frontends/gnome/configure.ac b/src/frontends/gnome/configure.ac new file mode 100644 index 000000000..148db3e28 --- /dev/null +++ b/src/frontends/gnome/configure.ac @@ -0,0 +1,101 @@ +AC_PREREQ(2.52) + +AC_INIT(NetworkManager-strongswan, 1.2.0, martin@strongswan.org, NetworkManager-strongswan) +AM_INIT_AUTOMAKE([subdir-objects]) +AM_MAINTAINER_MODE + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_HEADERS([config.h]) + +dnl +dnl Require programs +dnl +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LIBTOOL + +dnl +dnl Required headers +dnl +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h) + +dnl +dnl Checks for typedefs, structures, and compiler characteristics. +dnl +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_HEADER_TIME + +dnl +dnl Checks for library functions. +dnl +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MEMCMP +AC_CHECK_FUNCS(select socket uname) + +GETTEXT_PACKAGE=NetworkManager-strongswan +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) + +IT_PROG_INTLTOOL([0.35]) +AM_GLIB_GNU_GETTEXT + +PKG_CHECK_MODULES(GTHREAD, gthread-2.0) +AC_SUBST(GTHREAD_CFLAGS) +AC_SUBST(GTHREAD_LIBS) + +PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.30) +AC_SUBST(DBUS_CFLAGS) +AC_SUBST(DBUS_LIBS) + +if test x"$with_gnome" != xno; then + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6) + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + + PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0) + AC_SUBST(GDK_PIXBUF_CFLAGS) + AC_SUBST(GDK_PIXBUF_LIBS) + + PKG_CHECK_MODULES(GLADE, libglade-2.0) + AC_SUBST(GLADE_CFLAGS) + AC_SUBST(GLADE_LIBS) + + PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0) + AC_SUBST(LIBGNOMEUI_CFLAGS) + AC_SUBST(LIBGNOMEUI_LIBS) + + PKG_CHECK_MODULES(GCONF, gconf-2.0) + AC_SUBST(GCONF_CFLAGS) + AC_SUBST(GCONF_LIBS) + + PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1) + AC_SUBST(GNOMEKEYRING_CFLAGS) + AC_SUBST(GNOMEKEYRING_LIBS) +fi + +PKG_CHECK_EXISTS([libnm-glib], + [PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm-glib libnm-glib-vpn)], + [PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm_glib libnm_glib_vpn)] +) +AC_SUBST(NM_UTILS_CFLAGS) +AC_SUBST(NM_UTILS_LIBS) + +AC_ARG_WITH( + [charon], + AS_HELP_STRING([--with-charon=file],[path to the strongSwan IKEv2 daemon charon"]), + [AC_SUBST(charon, "$withval")], + [AC_SUBST(charon, "${libexecdir}/ipsec/charon")] +) + +NM_COMPILER_WARNINGS + +AC_CONFIG_FILES([ +Makefile +properties/Makefile +auth-dialog/Makefile +po/Makefile.in +]) +AC_OUTPUT diff --git a/src/frontends/gnome/debian/.gitignore b/src/frontends/gnome/debian/.gitignore new file mode 100644 index 000000000..69c984b17 --- /dev/null +++ b/src/frontends/gnome/debian/.gitignore @@ -0,0 +1,6 @@ +files +network-manager-strongswan.debhelper.log +network-manager-strongswan.substvars +network-manager-strongswan/ +stamp-autotools-files +stamp-makefile-build diff --git a/src/frontends/gnome/debian/changelog b/src/frontends/gnome/debian/changelog new file mode 100644 index 000000000..27add5160 --- /dev/null +++ b/src/frontends/gnome/debian/changelog @@ -0,0 +1,33 @@ +network-manager-strongswan (1.1.2-1) unstable; urgency=low + + * New upstream release, fixes pkgconfig for new libnm-glib packages + (Closes: #569302) + + -- Martin Willi Thu, 18 Feb 2010 09:41:39 +0100 + +network-manager-strongswan (1.1.1-2) unstable; urgency=low + + * Added ${shlibs:Depends} dependency + * Reload network-manager after installation, reloading dbus is insufficient. + * Fixed debhelper-but-no-misc-depends, out-of-date-standards-version and + copyright-without-copyright-notice lintian warnings + + -- Martin Willi Mon, 12 Oct 2009 10:19:40 +0200 + +network-manager-strongswan (1.1.1-1) unstable; urgency=low + + * New upstream release fixing a crasher when saving connections + * Fix "Wrong path to network-manager initscript in postinst" + Reload dbus instead of network-manager, as other VPN plugins do. + (Closes: #529189) + * Fix "FTBFS: No package 'libnm-util' found" + added dependencies to libnm-util-dev and libnm-glib-vpn-dev + (Closes: #528977) + + -- Martin Willi Tue, 19 May 2009 13:16:51 +0200 + +network-manager-strongswan (1.1.0-1) unstable; urgency=low + + * Initial Debian packaging of NetworkManager plugin for strongSwan + + -- Martin Willi Wed, 25 Mar 2009 09:07:05 +0100 diff --git a/src/frontends/gnome/debian/compat b/src/frontends/gnome/debian/compat new file mode 100644 index 000000000..7f8f011eb --- /dev/null +++ b/src/frontends/gnome/debian/compat @@ -0,0 +1 @@ +7 diff --git a/src/frontends/gnome/debian/control b/src/frontends/gnome/debian/control new file mode 100644 index 000000000..71d8bc922 --- /dev/null +++ b/src/frontends/gnome/debian/control @@ -0,0 +1,29 @@ +Source: network-manager-strongswan +Section: net +Priority: extra +Maintainer: Martin Willi +Build-Depends: cdbs, + debhelper (>= 7), + network-manager-dev (>= 0.7), + libnm-util-dev (>= 0.7), + libnm-glib-dev (>= 0.7), + libnm-glib-vpn-dev (>= 0.7), + libdbus-glib-1-dev, + libglade2-dev, + libgnomeui-dev, + automake1.9, + gnome-common, +Standards-Version: 3.8.3 + +Package: network-manager-strongswan +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan-nm, network-manager +Description: network management framework (strongSwan plugin) + NetworkManager attempts to keep an active network connection available at + all times. It is intended primarily for laptops where it allows easy + switching between local wireless networks, it's also useful on desktops + with a selection of different interfaces to use. It is not intended for + usage on servers. + . + This package provides a VPN plugin for strongSwan, providing easy access to + IKEv2 IPSec VPN's. diff --git a/src/frontends/gnome/debian/copyright b/src/frontends/gnome/debian/copyright new file mode 100644 index 000000000..8542aeaae --- /dev/null +++ b/src/frontends/gnome/debian/copyright @@ -0,0 +1,10 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59 +Name: NetworkManager-strongswan +Source: http://download.strongswan.org/NetworkManager + +Copyright: 2008-2009, Martin Willi + 2005-2008, Dan Williams + 2005, David Zeuthen +License: GPL-2 + On Debian systems the full text of the GNU General Public License can be found + in the `/usr/share/common-licenses/GPL-2' file. diff --git a/src/frontends/gnome/debian/docs b/src/frontends/gnome/debian/docs new file mode 100644 index 000000000..e69de29bb diff --git a/src/frontends/gnome/debian/network-manager-strongswan.postinst b/src/frontends/gnome/debian/network-manager-strongswan.postinst new file mode 100644 index 000000000..f855e713c --- /dev/null +++ b/src/frontends/gnome/debian/network-manager-strongswan.postinst @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +case "$1" in + configure) + if [ -x "/etc/init.d/network-manager" ]; then + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d network-manager force-reload || true + else + /etc/init.d/network-manager force-reload || true + fi + fi + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/src/frontends/gnome/debian/rules b/src/frontends/gnome/debian/rules new file mode 100755 index 000000000..0f723246e --- /dev/null +++ b/src/frontends/gnome/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk + +DEB_CONFIGURE_EXTRA_FLAGS := --with-charon=/usr/lib/ipsec/charon + +DEB_CONFIGURE_LIBEXECDIR := "\$$(prefix)/lib/NetworkManager" + +DEB_DH_MAKESHLIBS_ARGS_ALL := -X/usr/lib/NetworkManager/ + +DEB_DH_INSTALL_SOURCEDIR := debian/tmp + + + diff --git a/src/frontends/gnome/m4/.gitignore b/src/frontends/gnome/m4/.gitignore new file mode 100644 index 000000000..3d067d03a --- /dev/null +++ b/src/frontends/gnome/m4/.gitignore @@ -0,0 +1,7 @@ +intltool.m4 +libtool.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +lt~obsolete.m4 + diff --git a/src/frontends/gnome/m4/compiler_warnings.m4 b/src/frontends/gnome/m4/compiler_warnings.m4 new file mode 100644 index 000000000..6cea2f74e --- /dev/null +++ b/src/frontends/gnome/m4/compiler_warnings.m4 @@ -0,0 +1,31 @@ +AC_DEFUN([NM_COMPILER_WARNINGS], +[AC_ARG_ENABLE(more-warnings, + AS_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), + set_more_warnings="$enableval",set_more_warnings=yes) +AC_MSG_CHECKING(for more warnings, including -Werror) +if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then + AC_MSG_RESULT(yes) + CFLAGS="-Wall -Werror -std=gnu89 $CFLAGS" + + for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \ + -Wdeclaration-after-statement -Wstrict-prototypes \ + -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \ + -fno-strict-aliasing; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + if test $has_option = no; then + CFLAGS="$SAVE_CFLAGS" + fi + AC_MSG_RESULT($has_option) + unset has_option + unset SAVE_CFLAGS + done + unset option +else + AC_MSG_RESULT(no) +fi +]) diff --git a/src/frontends/gnome/nm-strongswan-service.conf b/src/frontends/gnome/nm-strongswan-service.conf new file mode 100644 index 000000000..dccc19af9 --- /dev/null +++ b/src/frontends/gnome/nm-strongswan-service.conf @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/src/frontends/gnome/nm-strongswan-service.name.in b/src/frontends/gnome/nm-strongswan-service.name.in new file mode 100644 index 000000000..4120e55ae --- /dev/null +++ b/src/frontends/gnome/nm-strongswan-service.name.in @@ -0,0 +1,8 @@ +[VPN Connection] +name=strongswan +service=org.freedesktop.NetworkManager.strongswan +program=@CHARON@ + +[GNOME] +auth-dialog=@LIBEXECDIR@/nm-strongswan-auth-dialog +properties=libnm-strongswan-properties diff --git a/src/frontends/gnome/po/.gitignore b/src/frontends/gnome/po/.gitignore new file mode 100644 index 000000000..b02b6e4ac --- /dev/null +++ b/src/frontends/gnome/po/.gitignore @@ -0,0 +1,4 @@ +Makefile.in.in +POTFILES +de.gmo +stamp-it diff --git a/src/frontends/gnome/po/ChangeLog b/src/frontends/gnome/po/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/src/frontends/gnome/po/LINGUAS b/src/frontends/gnome/po/LINGUAS new file mode 100644 index 000000000..adc376a70 --- /dev/null +++ b/src/frontends/gnome/po/LINGUAS @@ -0,0 +1,2 @@ +# please keep this list sorted alphabetically +de diff --git a/src/frontends/gnome/po/POTFILES.in b/src/frontends/gnome/po/POTFILES.in new file mode 100644 index 000000000..3732874e9 --- /dev/null +++ b/src/frontends/gnome/po/POTFILES.in @@ -0,0 +1,5 @@ +# List of source files containing translatable strings. +# Please keep this file sorted alphabetically. +properties/nm-strongswan.c +properties/nm-strongswan-dialog.glade +auth-dialog/main.c diff --git a/src/frontends/gnome/po/de.po b/src/frontends/gnome/po/de.po new file mode 100644 index 000000000..e6649e581 --- /dev/null +++ b/src/frontends/gnome/po/de.po @@ -0,0 +1,173 @@ +# Translations for NetworkManager-strongswan. +# Copyright (C) 2010 Martin Willi +# This file is distributed under the same license as the +# NetworkManager-strongswan package. +msgid "" +msgstr "" +"Project-Id-Version: NetworkManager-strongswan\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-08-11 16:12+0200\n" +"PO-Revision-Date: 2010-02-18 09:20+0100\n" +"Last-Translator: Martin Willi \n" +"Language-Team: de \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../properties/nm-strongswan.c:38 +msgid "IPsec/IKEv2 (strongswan)" +msgstr "IPsec/IKEv2 (strongswan)" + +#: ../properties/nm-strongswan.c:39 +msgid "IPsec with the IKEv2 key exchange protocol." +msgstr "IPsec mit dem IKEv2 Protokoll." + +#: ../properties/nm-strongswan.c:208 +msgid "Certificate/private key" +msgstr "Zertifikat/Privater Schlüssel" + +#: ../properties/nm-strongswan.c:209 +msgid "Certificate/ssh-agent" +msgstr "Zertifikat/ssh-agent" + +#: ../properties/nm-strongswan.c:210 +msgid "Smartcard" +msgstr "Smartcard" + +#: ../properties/nm-strongswan.c:211 +msgid "EAP" +msgstr "EAP" + +#: ../properties/nm-strongswan-dialog.glade.h:1 +msgid "Client" +msgstr "Client" + +#: ../properties/nm-strongswan-dialog.glade.h:2 +msgid "Gateway" +msgstr "Gateway" + +#: ../properties/nm-strongswan-dialog.glade.h:3 +msgid "Options" +msgstr "Optionen" + +#: ../properties/nm-strongswan-dialog.glade.h:4 +msgid "An IP address or hostname the Gateway can be contacted." +msgstr "Ein IP-Adresse oder einen Rechnernamen des Gateways." + +#: ../properties/nm-strongswan-dialog.glade.h:5 +msgid "Au_thentication:" +msgstr "Au_thentisierung:" + +#: ../properties/nm-strongswan-dialog.glade.h:6 +msgid "Authentication Method to use for authentication against the Gateway. " +msgstr "Methode zur Authentisierung gegenüber dem Gateway." + +#: ../properties/nm-strongswan-dialog.glade.h:7 +msgid "C_ertificate:" +msgstr "Z_ertifikat:" + +#: ../properties/nm-strongswan-dialog.glade.h:8 +msgid "Ce_rtificate:" +msgstr "Ze_rtifikat:" + +#: ../properties/nm-strongswan-dialog.glade.h:9 +msgid "Client certificate to use for client authentication." +msgstr "Zertifikat des Clients für dessen Authentisierung." + +#: ../properties/nm-strongswan-dialog.glade.h:10 +msgid "En_force UDP encapsulation" +msgstr "Erzwingen einer zusätzlichen Einbettung der Datenpakete in _UDP" + +#: ../properties/nm-strongswan-dialog.glade.h:11 +msgid "" +"Gateway or CA certificate to use for gateway authentication. If none is " +"specified, pre-installed CA certificates are used." +msgstr "" +"Gateway- oder CA-Zertifikat für die Authentisierung des Gateways. Ohne " +"Angabe eines Zertifikates werden die CA-Zertifikate des Systems verwendet." + +#: ../properties/nm-strongswan-dialog.glade.h:12 +msgid "" +"IPComp compresses raw IP packets before they get encrypted. This saves some " +"bandwith, but uses more processing power." +msgstr "" +"IPComp komprimiert IP-Pakete, bevor sie verschlüsselt werden. Diese Option " +"kann Bandbreite sparen, benötigt jedoch zusätzliche Rechenleistung." + +#: ../properties/nm-strongswan-dialog.glade.h:13 +msgid "Private _key:" +msgstr "Privater _Schlüssel:" + +#: ../properties/nm-strongswan-dialog.glade.h:14 +msgid "" +"Private key to use for client authentication. This key has to match the " +"certificates public key and may be encrypted." +msgstr "" +"Privater Schlüssel für die Authentisierung des Clients. Dieser Schlüssel " +"muss zum konfigurierten Zertifikat passen und kann verschlüsselt sein." + +#: ../properties/nm-strongswan-dialog.glade.h:15 +msgid "Request an _inner IP address" +msgstr "_Innere IP-Adresse beziehen" + +#: ../properties/nm-strongswan-dialog.glade.h:16 +msgid "" +"Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT " +"situation is detected might help in such cases." +msgstr "" +"Manche Firewalls blockieren Datenverkehr mit dem ESP-Protokoll. Das " +"erzwingen einer zustzlichen Einbettung in UDP, auch wenn kein NAT-Router " +"detektiert wurde, kann in solchen Situationen hilfreich sein." + +#: ../properties/nm-strongswan-dialog.glade.h:17 +msgid "" +"The Gateway may provide addresses from a pool to use for communication in " +"the Gateways network. Check to request such an address." +msgstr "" +"Der Gateway kann IP-Adressen bereitstellen, welche der Client für die " +"Kommunikation im dahinterliegenden Netz verwenden kann. Aktivieren, um eine " +"solche Adresse zu beziehen." + +#: ../properties/nm-strongswan-dialog.glade.h:18 +msgid "The username (identity) to use for authentication against the gateway." +msgstr "Benutzername/Identität für die Authentisierung gegenüber dem Gateway." + +#: ../properties/nm-strongswan-dialog.glade.h:19 +msgid "Use IP c_ompression" +msgstr "IP-Pakete k_omprimieren" + +#: ../properties/nm-strongswan-dialog.glade.h:20 +msgid "_Address:" +msgstr "_Adresse:" + +#: ../properties/nm-strongswan-dialog.glade.h:21 +msgid "_Username:" +msgstr "_Benutzername:" + +#: ../auth-dialog/main.c:172 ../auth-dialog/main.c:179 +#: ../auth-dialog/main.c:186 +msgid "VPN password required" +msgstr "VPN Passwort notwendig" + +#: ../auth-dialog/main.c:173 +msgid "EAP password required to establish VPN connection:" +msgstr "Für die Erstellung des VPN-Tunnels ist ein EAP-Passwort erforderlich:" + +#: ../auth-dialog/main.c:180 +msgid "Private key decryption password required to establish VPN connection:" +msgstr "" +"Der Private Schlüssel für die Erstellung des VPN-Tunnels ist durch ein " +"Passwort geschützt:" + +#: ../auth-dialog/main.c:187 +#, fuzzy +msgid "Smartcard PIN required to establish VPN connection:" +msgstr "Für die Smartcard ist eine PIN erforderlich:" + +#: ../auth-dialog/main.c:233 +msgid "" +"Configuration uses ssh-agent for authentication, but ssh-agent is not " +"running!" +msgstr "" +"Die Konfiguration verwendet ssh-agent fr die Authentisierung, aber ssh-agent " +"ist nicht gestartet!" diff --git a/src/frontends/gnome/properties/Makefile.am b/src/frontends/gnome/properties/Makefile.am new file mode 100644 index 000000000..3db7c226e --- /dev/null +++ b/src/frontends/gnome/properties/Makefile.am @@ -0,0 +1,37 @@ +plugindir = $(libdir)/NetworkManager +plugin_LTLIBRARIES = libnm-strongswan-properties.la + +libnm_strongswan_properties_la_SOURCES = \ + nm-strongswan.c \ + nm-strongswan.h + +gladedir = $(datadir)/gnome-vpn-properties/strongswan +glade_DATA = nm-strongswan-dialog.glade + +libnm_strongswan_properties_la_CFLAGS = \ + $(GLADE_CFLAGS) \ + $(GTK_CFLAGS) \ + $(GCONF_CFLAGS) \ + $(LIBGNOMEUI_CFLAGS) \ + $(NM_UTILS_CFLAGS) \ + -DICONDIR=\""$(datadir)/pixmaps"\" \ + -DGLADEDIR=\""$(gladedir)"\" \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED \ + -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ + -DVERSION=\"$(VERSION)\" + +libnm_strongswan_properties_la_LIBADD = \ + $(GLADE_LIBS) \ + $(GTK_LIBS) \ + $(GCONF_LIBS) \ + $(LIBGNOMEUI_LIBS) \ + $(NM_UTILS_LIBS) + +libnm_strongswan_properties_la_LDFLAGS = \ + -avoid-version + +CLEANFILES = *.bak *.gladep *~ + +EXTRA_DIST = $(glade_DATA) diff --git a/src/frontends/gnome/properties/nm-strongswan-dialog.glade b/src/frontends/gnome/properties/nm-strongswan-dialog.glade new file mode 100644 index 000000000..02c68888d --- /dev/null +++ b/src/frontends/gnome/properties/nm-strongswan-dialog.glade @@ -0,0 +1,346 @@ + + + + + + window1 + + + True + 12 + vertical + 16 + + + True + vertical + 6 + + + True + 0 + <b>Gateway</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + 2 + 2 + 6 + 6 + + + True + 0 + _Address: + True + address-entry + + + GTK_FILL + + + + + + True + True + True + An IP address or hostname the Gateway can be contacted. + + + 1 + 2 + + + + + + True + 0 + C_ertificate: + True + certificate-button + + + 1 + 2 + GTK_FILL + + + + + + True + Gateway or CA certificate to use for gateway authentication. If none is specified, pre-installed CA certificates are used. + + + 1 + 2 + 1 + 2 + + + + + + + 1 + + + + + False + 0 + + + + + True + vertical + 6 + + + True + 0 + <b>Client</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + 4 + 2 + 6 + 6 + + + True + Private key to use for client authentication. This key has to match the certificates public key and may be encrypted. + + + 1 + 2 + 3 + 4 + + + + + True + 0 + Private _key: + True + userkey-button + + + 3 + 4 + GTK_FILL + + + + + + True + True + Authentication Method to use for authentication against the Gateway. + + + + 1 + 2 + + + + + True + 0 + Au_thentication: + True + method-combo + + + GTK_FILL + + + + + + True + 0 + _Username: + True + user-entry + + + 1 + 2 + GTK_FILL + + + + + + True + True + True + The username (identity) to use for authentication against the gateway. + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + Ce_rtificate: + True + usercert-button + + + 2 + 3 + GTK_FILL + + + + + + True + Client certificate to use for client authentication. + + + 1 + 2 + 2 + 3 + + + + + + + 1 + + + + + False + 1 + + + + + True + vertical + 6 + + + True + 0 + <b>Options</b> + True + + + False + False + 0 + + + + + True + 12 + + + True + vertical + + + Request an _inner IP address + True + True + False + True + The Gateway may provide addresses from a pool to use for communication in the Gateways network. Check to request such an address. + True + True + + + 0 + + + + + En_force UDP encapsulation + True + True + False + True + Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases. + True + True + + + 1 + + + + + Use IP c_ompression + True + True + False + True + IPComp compresses raw IP packets before they get encrypted. This saves some bandwith, but uses more processing power. + True + True + + + 2 + + + + + + + 1 + + + + + False + 2 + + + + + + diff --git a/src/frontends/gnome/properties/nm-strongswan.c b/src/frontends/gnome/properties/nm-strongswan.c new file mode 100644 index 000000000..45c0df32d --- /dev/null +++ b/src/frontends/gnome/properties/nm-strongswan.c @@ -0,0 +1,541 @@ +/* + * Copyright (C) 2008 Martin Willi + * Hochschule fuer Technik Rapperswil + * Copyright (C) 2005 David Zeuthen + * Copyright (C) 2005-2008 Dan Williams + * + * Based on NetworkManager's vpnc plugin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#define NM_VPN_API_SUBJECT_TO_CHANGE + +#include +#include +#include +#include + +#include "nm-strongswan.h" + +#define STRONGSWAN_PLUGIN_NAME _("IPsec/IKEv2 (strongswan)") +#define STRONGSWAN_PLUGIN_DESC _("IPsec with the IKEv2 key exchange protocol.") +#define STRONGSWAN_PLUGIN_SERVICE "org.freedesktop.NetworkManager.strongswan" +#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan" + +/************** plugin class **************/ + +static void strongswan_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class); + +G_DEFINE_TYPE_EXTENDED (StrongswanPluginUi, strongswan_plugin_ui, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_INTERFACE, + strongswan_plugin_ui_interface_init)) + +/************** UI widget class **************/ + +static void strongswan_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class); + +G_DEFINE_TYPE_EXTENDED (StrongswanPluginUiWidget, strongswan_plugin_ui_widget, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE, + strongswan_plugin_ui_widget_interface_init)) + +#define STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetPrivate)) + +typedef struct { + GladeXML *xml; + GtkWidget *widget; +} StrongswanPluginUiWidgetPrivate; + + +#define STRONGSWAN_PLUGIN_UI_ERROR strongswan_plugin_ui_error_quark () + +static GQuark +strongswan_plugin_ui_error_quark (void) +{ + static GQuark error_quark = 0; + + if (G_UNLIKELY (error_quark == 0)) + error_quark = g_quark_from_static_string ("strongswan-plugin-ui-error-quark"); + + return error_quark; +} + +#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } + +GType +strongswan_plugin_ui_error_get_type (void) +{ + static GType etype = 0; + + if (etype == 0) { + static const GEnumValue values[] = { + /* Unknown error. */ + ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_UNKNOWN, "UnknownError"), + /* The specified property was invalid. */ + ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, "InvalidProperty"), + /* The specified property was missing and is required. */ + ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY, "MissingProperty"), + { 0, 0, 0 } + }; + etype = g_enum_register_static ("StrongswanPluginUiError", values); + } + return etype; +} + +static gboolean +check_validity (StrongswanPluginUiWidget *self, GError **error) +{ + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); + GtkWidget *widget; + char *str; + + widget = glade_xml_get_widget (priv->xml, "address-entry"); + str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); + if (!str || !strlen (str)) { + g_set_error (error, + STRONGSWAN_PLUGIN_UI_ERROR, + STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, + "address"); + return FALSE; + } + return TRUE; +} + +static void update_layout (GtkWidget *widget, StrongswanPluginUiWidgetPrivate *priv) +{ + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) + { + default: + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); + /* FALL */ + case 0: + gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label")); + gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button")); + gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-label")); + gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-button")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); + break; + case 1: + gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label")); + gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); + break; + case 2: + gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); + break; + case 3: + gtk_widget_show (glade_xml_get_widget (priv->xml, "user-label")); + gtk_widget_show (glade_xml_get_widget (priv->xml, "user-entry")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); + gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); + break; + } + +} + +static void +settings_changed_cb (GtkWidget *widget, gpointer user_data) +{ + StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (user_data); + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); + + if (widget == glade_xml_get_widget (priv->xml, "method-combo")) + { + update_layout(glade_xml_get_widget (priv->xml, "method-combo"), priv); + } + g_signal_emit_by_name (STRONGSWAN_PLUGIN_UI_WIDGET (user_data), "changed"); +} + +static gboolean +init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError **error) +{ + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); + NMSettingVPN *settings; + GtkWidget *widget; + const char *value; + + settings = NM_SETTING_VPN(nm_connection_get_setting(connection, NM_TYPE_SETTING_VPN)); + widget = glade_xml_get_widget (priv->xml, "address-entry"); + value = nm_setting_vpn_get_data_item (settings, "address"); + if (value) + gtk_entry_set_text (GTK_ENTRY (widget), value); + g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "certificate-button"); + value = nm_setting_vpn_get_data_item (settings, "certificate"); + if (value) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); + g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "user-label"); + gtk_widget_set_no_show_all (widget, TRUE); + widget = glade_xml_get_widget (priv->xml, "user-entry"); + gtk_widget_set_no_show_all (widget, TRUE); + value = nm_setting_vpn_get_data_item (settings, "user"); + if (value) + gtk_entry_set_text (GTK_ENTRY (widget), value); + g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "method-combo"); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/private key")); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/ssh-agent")); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Smartcard")); + gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("EAP")); + value = nm_setting_vpn_get_data_item (settings, "method"); + if (value) { + if (g_strcmp0 (value, "key") == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); + } + if (g_strcmp0 (value, "agent") == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1); + } + if (g_strcmp0 (value, "smartcard") == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 2); + } + if (g_strcmp0 (value, "eap") == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 3); + } + } + if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1) + { + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); + } + update_layout (widget, priv); + g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "usercert-label"); + gtk_widget_set_no_show_all (widget, TRUE); + widget = glade_xml_get_widget (priv->xml, "usercert-button"); + gtk_widget_set_no_show_all (widget, TRUE); + value = nm_setting_vpn_get_data_item (settings, "usercert"); + if (value) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); + g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "userkey-label"); + gtk_widget_set_no_show_all (widget, TRUE); + widget = glade_xml_get_widget (priv->xml, "userkey-button"); + gtk_widget_set_no_show_all (widget, TRUE); + value = nm_setting_vpn_get_data_item (settings, "userkey"); + if (value) + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); + g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "virtual-check"); + value = nm_setting_vpn_get_data_item (settings, "virtual"); + if (value && strcmp(value, "yes") == 0) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); + } + g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "encap-check"); + value = nm_setting_vpn_get_data_item (settings, "encap"); + if (value && strcmp(value, "yes") == 0) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); + } + g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); + + widget = glade_xml_get_widget (priv->xml, "ipcomp-check"); + value = nm_setting_vpn_get_data_item (settings, "ipcomp"); + if (value && strcmp(value, "yes") == 0) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); + } + g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); + + return TRUE; +} + +static GObject * +get_widget (NMVpnPluginUiWidgetInterface *iface) +{ + StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (iface); + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); + + return G_OBJECT (priv->widget); +} + +static gboolean +update_connection (NMVpnPluginUiWidgetInterface *iface, + NMConnection *connection, + GError **error) +{ + StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (iface); + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); + NMSettingVPN *settings; + GtkWidget *widget; + gboolean active; + char *str; + + if (!check_validity (self, error)) + return FALSE; + settings = NM_SETTING_VPN (nm_setting_vpn_new ()); + + g_object_set (settings, NM_SETTING_VPN_SERVICE_TYPE, + NM_DBUS_SERVICE_STRONGSWAN, NULL); + + widget = glade_xml_get_widget (priv->xml, "address-entry"); + str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) { + nm_setting_vpn_add_data_item (settings, "address", str); + } + + widget = glade_xml_get_widget (priv->xml, "certificate-button"); + str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + if (str) { + nm_setting_vpn_add_data_item (settings, "certificate", str); + } + + widget = glade_xml_get_widget (priv->xml, "method-combo"); + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) + { + default: + case 0: + widget = glade_xml_get_widget (priv->xml, "userkey-button"); + str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + if (str) { + nm_setting_vpn_add_data_item (settings, "userkey", str); + } + widget = glade_xml_get_widget (priv->xml, "usercert-button"); + str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + if (str) { + nm_setting_vpn_add_data_item (settings, "usercert", str); + } + str = "key"; + break; + case 1: + widget = glade_xml_get_widget (priv->xml, "usercert-button"); + str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + if (str) { + nm_setting_vpn_add_data_item (settings, "usercert", str); + } + str = "agent"; + break; + case 2: + str = "smartcard"; + break; + case 3: + widget = glade_xml_get_widget (priv->xml, "user-entry"); + str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); + if (str && strlen (str)) { + nm_setting_vpn_add_data_item (settings, "user", str); + } + str = "eap"; + break; + } + nm_setting_vpn_add_data_item (settings, "method", str); + + widget = glade_xml_get_widget (priv->xml, "virtual-check"); + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + nm_setting_vpn_add_data_item (settings, "virtual", active ? "yes" : "no"); + + widget = glade_xml_get_widget (priv->xml, "encap-check"); + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + nm_setting_vpn_add_data_item (settings, "encap", active ? "yes" : "no"); + + widget = glade_xml_get_widget (priv->xml, "ipcomp-check"); + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + nm_setting_vpn_add_data_item (settings, "ipcomp", active ? "yes" : "no"); + + nm_connection_add_setting (connection, NM_SETTING (settings)); + return TRUE; +} + +static gboolean +save_secrets (NMVpnPluginUiWidgetInterface *iface, + NMConnection *connection, GError **error) +{ + /* no secrets to save */ + return TRUE; +} + +static NMVpnPluginUiWidgetInterface * +nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error) +{ + NMVpnPluginUiWidgetInterface *object; + StrongswanPluginUiWidgetPrivate *priv; + char *glade_file; + + if (error) + g_return_val_if_fail (*error == NULL, NULL); + + object = NM_VPN_PLUGIN_UI_WIDGET_INTERFACE (g_object_new (STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, NULL)); + if (!object) { + g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not create strongswan object"); + return NULL; + } + + priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (object); + + glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-strongswan-dialog.glade"); + priv->xml = glade_xml_new (glade_file, "strongswan-vbox", GETTEXT_PACKAGE); + if (priv->xml == NULL) { + g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, + "could not load required resources at %s", glade_file); + g_free (glade_file); + g_object_unref (object); + return NULL; + } + g_free (glade_file); + + priv->widget = glade_xml_get_widget (priv->xml, "strongswan-vbox"); + if (!priv->widget) { + g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not load UI widget"); + g_object_unref (object); + return NULL; + } + g_object_ref_sink (priv->widget); + + if (!init_plugin_ui (STRONGSWAN_PLUGIN_UI_WIDGET (object), connection, error)) { + g_object_unref (object); + return NULL; + } + + return object; +} + +static void +dispose (GObject *object) +{ + StrongswanPluginUiWidget *plugin = STRONGSWAN_PLUGIN_UI_WIDGET (object); + StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (plugin); + + if (priv->widget) + g_object_unref (priv->widget); + + if (priv->xml) + g_object_unref (priv->xml); + + G_OBJECT_CLASS (strongswan_plugin_ui_widget_parent_class)->dispose (object); +} + +static void +strongswan_plugin_ui_widget_class_init (StrongswanPluginUiWidgetClass *req_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (req_class); + + g_type_class_add_private (req_class, sizeof (StrongswanPluginUiWidgetPrivate)); + + object_class->dispose = dispose; +} + +static void +strongswan_plugin_ui_widget_init (StrongswanPluginUiWidget *plugin) +{ +} + +static void +strongswan_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class) +{ + /* interface implementation */ + iface_class->get_widget = get_widget; + iface_class->update_connection = update_connection; + iface_class->save_secrets = save_secrets; +} + +static guint32 +get_capabilities (NMVpnPluginUiInterface *iface) +{ + return 0; +} + +static NMVpnPluginUiWidgetInterface * +ui_factory (NMVpnPluginUiInterface *iface, NMConnection *connection, GError **error) +{ + return nm_vpn_plugin_ui_widget_interface_new (connection, error); +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + switch (prop_id) { + case NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME: + g_value_set_string (value, STRONGSWAN_PLUGIN_NAME); + break; + case NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC: + g_value_set_string (value, STRONGSWAN_PLUGIN_DESC); + break; + case NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE: + g_value_set_string (value, STRONGSWAN_PLUGIN_SERVICE); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +strongswan_plugin_ui_class_init (StrongswanPluginUiClass *req_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (req_class); + + object_class->get_property = get_property; + + g_object_class_override_property (object_class, + NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME, + NM_VPN_PLUGIN_UI_INTERFACE_NAME); + + g_object_class_override_property (object_class, + NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC, + NM_VPN_PLUGIN_UI_INTERFACE_DESC); + + g_object_class_override_property (object_class, + NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE, + NM_VPN_PLUGIN_UI_INTERFACE_SERVICE); +} + +static void +strongswan_plugin_ui_init (StrongswanPluginUi *plugin) +{ +} + +static void +strongswan_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class) +{ + /* interface implementation */ + iface_class->ui_factory = ui_factory; + iface_class->get_capabilities = get_capabilities; + /* TODO: implement delete_connection to purge associated secrets */ +} + + +G_MODULE_EXPORT NMVpnPluginUiInterface * +nm_vpn_plugin_ui_factory (GError **error) +{ + if (error) + g_return_val_if_fail (*error == NULL, NULL); + + return NM_VPN_PLUGIN_UI_INTERFACE (g_object_new (STRONGSWAN_TYPE_PLUGIN_UI, NULL)); +} + diff --git a/src/frontends/gnome/properties/nm-strongswan.h b/src/frontends/gnome/properties/nm-strongswan.h new file mode 100644 index 000000000..e2b66bb15 --- /dev/null +++ b/src/frontends/gnome/properties/nm-strongswan.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2008 Martin Willi + * Hochschule fuer Technik Rapperswil + * Copyright (C) 2008 Dan Williams + * + * Based on NetworkManager's vpnc plugin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef _NM_STRONGSWAN_H_ +#define _NM_STRONGSWAN_H_ + +#include + +typedef enum +{ + STRONGSWAN_PLUGIN_UI_ERROR_UNKNOWN = 0, + STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, + STRONGSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY +} StrongswanPluginUiError; + +#define STRONGSWAN_TYPE_PLUGIN_UI_ERROR (strongswan_plugin_ui_error_get_type ()) +GType strongswan_plugin_ui_error_get_type (void); + +#define STRONGSWAN_TYPE_PLUGIN_UI (strongswan_plugin_ui_get_type ()) +#define STRONGSWAN_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUi)) +#define STRONGSWAN_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass)) +#define STRONGSWAN_IS_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI)) +#define STRONGSWAN_IS_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI)) +#define STRONGSWAN_PLUGIN_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass)) + +typedef struct _StrongswanPluginUi StrongswanPluginUi; +typedef struct _StrongswanPluginUiClass StrongswanPluginUiClass; + +struct _StrongswanPluginUi { + GObject parent; +}; + +struct _StrongswanPluginUiClass { + GObjectClass parent; +}; + +GType strongswan_plugin_ui_get_type (void); + + +#define STRONGSWAN_TYPE_PLUGIN_UI_WIDGET (strongswan_plugin_ui_widget_get_type ()) +#define STRONGSWAN_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidget)) +#define STRONGSWAN_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetClass)) +#define STRONGSWAN_IS_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET)) +#define STRONGSWAN_IS_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET)) +#define STRONGSWAN_PLUGIN_UI_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetClass)) + +typedef struct _StrongswanPluginUiWidget StrongswanPluginUiWidget; +typedef struct _StrongswanPluginUiWidgetClass StrongswanPluginUiWidgetClass; + +struct _StrongswanPluginUiWidget { + GObject parent; +}; + +struct _StrongswanPluginUiWidgetClass { + GObjectClass parent; +}; + +GType strongswan_plugin_ui_widget_get_type (void); + +#endif /* _NM_STRONGSWAN_H_ */ + diff --git a/src/libcharon/plugins/nm/gnome/.gitignore b/src/libcharon/plugins/nm/gnome/.gitignore deleted file mode 100644 index 64bb14511..000000000 --- a/src/libcharon/plugins/nm/gnome/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -compile -config.h -config.h.in -intltool-extract.in -intltool-merge.in -intltool-update.in -mkinstalldirs -nm-strongswan-service.name -stamp-h1 -config.guess.cdbs-orig -config.sub.cdbs-orig diff --git a/src/libcharon/plugins/nm/gnome/Makefile.am b/src/libcharon/plugins/nm/gnome/Makefile.am deleted file mode 100644 index fb29085a6..000000000 --- a/src/libcharon/plugins/nm/gnome/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -SUBDIRS = properties auth-dialog po - -dbusservicedir = $(sysconfdir)/dbus-1/system.d -dbusservice_DATA = nm-strongswan-service.conf - -nmvpnservicedir = $(sysconfdir)/NetworkManager/VPN -nmvpnservice_DATA = nm-strongswan-service.name - -@INTLTOOL_DESKTOP_RULE@ - -nm-strongswan-service.name: $(srcdir)/nm-strongswan-service.name.in - sed -e 's|[@]LIBEXECDIR[@]|$(libexecdir)|' \ - -e 's|[@]CHARON[@]|$(charon)|' $< >$@ - -EXTRA_DIST = nm-strongswan-service.name.in \ - $(dbusservice_DATA) \ - intltool-extract.in \ - intltool-merge.in \ - intltool-update.in - -CLEANFILES = $(nmvpnservice_DATA) *~ -DISTCLEANFILES = intltool-extract intltool-merge intltool-update - -ACLOCAL_AMFLAGS = -I m4 diff --git a/src/libcharon/plugins/nm/gnome/NEWS b/src/libcharon/plugins/nm/gnome/NEWS deleted file mode 100644 index f84ccc836..000000000 --- a/src/libcharon/plugins/nm/gnome/NEWS +++ /dev/null @@ -1,29 +0,0 @@ -NetworkManager-strongswan-1.2.0 -------------------------------- - -- Added Smartcard support - -NetworkManager-strongswan-1.1.2 -------------------------------- - -- Additionally look for libnm-glib[-vpn] pkgconfig packages during configure -- Tooltips are translatable -- Update german translations - -NetworkManager-strongswan-1.1.1 -------------------------------- - -- Implemented save_secrets(), fixes crash when saving connections - -NetworkManager-strongswan-1.1.0 -------------------------------- - -- updated to NetworkManager 7.1 API - -- requires >= strongswan-4.1.13 - - -NetworkManager-strongswan-1.0.0 -------------------------------- - -- First release diff --git a/src/libcharon/plugins/nm/gnome/auth-dialog/.gitignore b/src/libcharon/plugins/nm/gnome/auth-dialog/.gitignore deleted file mode 100644 index bceb305e1..000000000 --- a/src/libcharon/plugins/nm/gnome/auth-dialog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -nm-strongswan-auth-dialog diff --git a/src/libcharon/plugins/nm/gnome/auth-dialog/Makefile.am b/src/libcharon/plugins/nm/gnome/auth-dialog/Makefile.am deleted file mode 100644 index 672287123..000000000 --- a/src/libcharon/plugins/nm/gnome/auth-dialog/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -libexec_PROGRAMS = nm-strongswan-auth-dialog - -nm_strongswan_auth_dialog_CPPFLAGS = \ - $(GTHREAD_CFLAGS) \ - $(GTK_CFLAGS) \ - $(LIBGNOMEUI_CFLAGS) \ - $(GNOMEKEYRING_CFLAGS) \ - $(NETWORK_MANAGER_CFLAGS) \ - $(NM_UTILS_CFLAGS) \ - -DICONDIR=\""$(datadir)/pixmaps"\" \ - -DGLADEDIR=\""$(gladedir)"\" \ - -DBINDIR=\""$(bindir)"\" \ - -DG_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DGNOME_DISABLE_DEPRECATED \ - -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ - -DVERSION=\"$(VERSION)\" - -nm_strongswan_auth_dialog_SOURCES = \ - main.c - -nm_strongswan_auth_dialog_LDADD = \ - $(GTK_LIBS) \ - $(LIBGNOMEUI_LIBS) \ - $(GNOMEKEYRING_LIBS) - diff --git a/src/libcharon/plugins/nm/gnome/auth-dialog/main.c b/src/libcharon/plugins/nm/gnome/auth-dialog/main.c deleted file mode 100644 index 686ff290f..000000000 --- a/src/libcharon/plugins/nm/gnome/auth-dialog/main.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2008 Martin Willi - * Hochschule fuer Technik Rapperswil - * Copyright (C) 2004 Dan Williams - * Red Hat, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan" - -/** - * lookup a password in the keyring - */ -static char *lookup_password(char *name, char *service) -{ - GList *list; - GList *iter; - char *pass = NULL; - - if (gnome_keyring_find_network_password_sync(g_get_user_name(), NULL, name, - NULL, service, NULL, 0, &list) != GNOME_KEYRING_RESULT_OK) - { - return NULL; - } - - for (iter = list; iter; iter = iter->next) - { - GnomeKeyringNetworkPasswordData *data = iter->data; - - if (strcmp(data->object, "password") == 0 && data->password) - { - pass = g_strdup(data->password); - break; - } - } - gnome_keyring_network_password_list_free(list); - return pass; -} - -/** - * get the connection type - */ -static char* get_connection_type(char *uuid) -{ - GConfClient *client = NULL; - GSList *list; - GSList *iter; - char *key, *str, *path, *found = NULL, *method = NULL; - - client = gconf_client_get_default(); - - list = gconf_client_all_dirs(client, "/system/networking/connections", NULL); - g_return_val_if_fail(list, NULL); - - for (iter = list; iter; iter = iter->next) - { - path = (char *) iter->data; - - key = g_strdup_printf("%s/%s/%s", path, - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_UUID); - str = gconf_client_get_string(client, key, NULL); - g_free (key); - - if (str && !strcmp(str, uuid)) - { - found = g_strdup(path); - } - g_free (str); - if (found) - { - break; - } - } - g_slist_foreach(list, (GFunc)g_free, NULL); - g_slist_free(list); - - if (found) - { - key = g_strdup_printf ("%s/%s/%s", found, - NM_SETTING_VPN_SETTING_NAME, "method"); - method = gconf_client_get_string(client, key, NULL); - g_free(found); - g_free(key); - } - g_object_unref(client); - return method; -} - -int main (int argc, char *argv[]) -{ - gboolean retry = FALSE; - gchar *name = NULL, *uuid = NULL, *service = NULL, *keyring = NULL, *pass; - GOptionContext *context; - GnomeProgram *program = NULL; - char buf, *agent, *type; - guint32 itemid; - GtkWidget *dialog; - GOptionEntry entries[] = { - { "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL}, - { "uuid", 'u', 0, G_OPTION_ARG_STRING, &uuid, "UUID of VPN connection", NULL}, - { "name", 'n', 0, G_OPTION_ARG_STRING, &name, "Name of VPN connection", NULL}, - { "service", 's', 0, G_OPTION_ARG_STRING, &service, "VPN service type", NULL}, - { NULL } - }; - - bindtextdomain(GETTEXT_PACKAGE, NULL); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - textdomain(GETTEXT_PACKAGE); - - context = g_option_context_new ("- strongswan auth dialog"); - g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); - - program = gnome_program_init ("nm-strongswan-auth-dialog", VERSION, - LIBGNOMEUI_MODULE, - argc, argv, - GNOME_PARAM_GOPTION_CONTEXT, context, - GNOME_PARAM_NONE); - - if (uuid == NULL || name == NULL || service == NULL) - { - fprintf (stderr, "Have to supply UUID, name, and service\n"); - g_object_unref (program); - return 1; - } - - if (strcmp(service, NM_DBUS_SERVICE_STRONGSWAN) != 0) - { - fprintf(stderr, "This dialog only works with the '%s' service\n", - NM_DBUS_SERVICE_STRONGSWAN); - g_object_unref (program); - return 1; - } - - type = get_connection_type(uuid); - if (!type) - { - fprintf(stderr, "Connection lookup failed\n"); - g_object_unref (program); - return 1; - } - if (!strcmp(type, "eap") || !strcmp(type, "key") || !strcmp(type, "smartcard")) - { - pass = lookup_password(name, service); - if (!pass || retry) - { - if (!strcmp(type, "eap")) - { - dialog = gnome_password_dialog_new(_("VPN password required"), - _("EAP password required to establish VPN connection:"), - NULL, NULL, TRUE); - gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); - } - else if (!strcmp(type, "key")) - { - dialog = gnome_password_dialog_new(_("VPN password required"), - _("Private key decryption password required to establish VPN connection:"), - NULL, NULL, TRUE); - gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE); - } - else /* smartcard */ - { - dialog = gnome_password_dialog_new(_("VPN password required"), - _("Smartcard PIN required to establish VPN connection:"), - NULL, NULL, TRUE); - gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), FALSE); - } - gnome_password_dialog_set_show_username(GNOME_PASSWORD_DIALOG(dialog), FALSE); - if (pass) - { - gnome_password_dialog_set_password(GNOME_PASSWORD_DIALOG(dialog), pass); - } - if (!gnome_password_dialog_run_and_block(GNOME_PASSWORD_DIALOG(dialog))) - { - g_object_unref (program); - return 1; - } - - pass = gnome_password_dialog_get_password(GNOME_PASSWORD_DIALOG(dialog)); - switch (gnome_password_dialog_get_remember(GNOME_PASSWORD_DIALOG(dialog))) - { - case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING: - break; - case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION: - keyring = "session"; - /* FALL */ - case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER: - if (gnome_keyring_set_network_password_sync(keyring, - g_get_user_name(), NULL, name, "password", service, NULL, 0, - pass, &itemid) != GNOME_KEYRING_RESULT_OK) - { - g_warning ("storing password in keyring failed"); - } - break; - } - } - printf("password\n%s\n", pass); - } - else - { - agent = getenv("SSH_AUTH_SOCK"); - if (agent) - { - printf("agent\n%s\n", agent); - } - else - { - dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Configuration uses ssh-agent for authentication, " - "but ssh-agent is not running!")); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - return 1; - } - } - printf("\n\n"); - /* flush output, wait for input */ - fflush(stdout); - if (fread(&buf, 1, sizeof(buf), stdin)); - g_object_unref(program); - return 0; -} - diff --git a/src/libcharon/plugins/nm/gnome/autogen.sh b/src/libcharon/plugins/nm/gnome/autogen.sh deleted file mode 100755 index 25847e7c3..000000000 --- a/src/libcharon/plugins/nm/gnome/autogen.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. -REQUIRED_AUTOMAKE_VERSION=1.7 -PKG_NAME=NetworkManager-strongswan - -which gnome-autogen.sh || { - echo "You need to install gnome-common from the GNOME CVS" - exit 1 -} -USE_GNOME2_MACROS=1 . gnome-autogen.sh - - diff --git a/src/libcharon/plugins/nm/gnome/configure.ac b/src/libcharon/plugins/nm/gnome/configure.ac deleted file mode 100644 index 148db3e28..000000000 --- a/src/libcharon/plugins/nm/gnome/configure.ac +++ /dev/null @@ -1,101 +0,0 @@ -AC_PREREQ(2.52) - -AC_INIT(NetworkManager-strongswan, 1.2.0, martin@strongswan.org, NetworkManager-strongswan) -AM_INIT_AUTOMAKE([subdir-objects]) -AM_MAINTAINER_MODE - -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADERS([config.h]) - -dnl -dnl Require programs -dnl -AC_PROG_CC -AM_PROG_CC_C_O -AC_PROG_INSTALL -AC_PROG_LIBTOOL - -dnl -dnl Required headers -dnl -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h) - -dnl -dnl Checks for typedefs, structures, and compiler characteristics. -dnl -AC_TYPE_MODE_T -AC_TYPE_PID_T -AC_HEADER_TIME - -dnl -dnl Checks for library functions. -dnl -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MEMCMP -AC_CHECK_FUNCS(select socket uname) - -GETTEXT_PACKAGE=NetworkManager-strongswan -AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) - -IT_PROG_INTLTOOL([0.35]) -AM_GLIB_GNU_GETTEXT - -PKG_CHECK_MODULES(GTHREAD, gthread-2.0) -AC_SUBST(GTHREAD_CFLAGS) -AC_SUBST(GTHREAD_LIBS) - -PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.30) -AC_SUBST(DBUS_CFLAGS) -AC_SUBST(DBUS_LIBS) - -if test x"$with_gnome" != xno; then - PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6) - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - - PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0) - AC_SUBST(GDK_PIXBUF_CFLAGS) - AC_SUBST(GDK_PIXBUF_LIBS) - - PKG_CHECK_MODULES(GLADE, libglade-2.0) - AC_SUBST(GLADE_CFLAGS) - AC_SUBST(GLADE_LIBS) - - PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0) - AC_SUBST(LIBGNOMEUI_CFLAGS) - AC_SUBST(LIBGNOMEUI_LIBS) - - PKG_CHECK_MODULES(GCONF, gconf-2.0) - AC_SUBST(GCONF_CFLAGS) - AC_SUBST(GCONF_LIBS) - - PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1) - AC_SUBST(GNOMEKEYRING_CFLAGS) - AC_SUBST(GNOMEKEYRING_LIBS) -fi - -PKG_CHECK_EXISTS([libnm-glib], - [PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm-glib libnm-glib-vpn)], - [PKG_CHECK_MODULES(NM_UTILS, NetworkManager >= 0.7.0 libnm-util libnm_glib libnm_glib_vpn)] -) -AC_SUBST(NM_UTILS_CFLAGS) -AC_SUBST(NM_UTILS_LIBS) - -AC_ARG_WITH( - [charon], - AS_HELP_STRING([--with-charon=file],[path to the strongSwan IKEv2 daemon charon"]), - [AC_SUBST(charon, "$withval")], - [AC_SUBST(charon, "${libexecdir}/ipsec/charon")] -) - -NM_COMPILER_WARNINGS - -AC_CONFIG_FILES([ -Makefile -properties/Makefile -auth-dialog/Makefile -po/Makefile.in -]) -AC_OUTPUT diff --git a/src/libcharon/plugins/nm/gnome/debian/.gitignore b/src/libcharon/plugins/nm/gnome/debian/.gitignore deleted file mode 100644 index 69c984b17..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -files -network-manager-strongswan.debhelper.log -network-manager-strongswan.substvars -network-manager-strongswan/ -stamp-autotools-files -stamp-makefile-build diff --git a/src/libcharon/plugins/nm/gnome/debian/changelog b/src/libcharon/plugins/nm/gnome/debian/changelog deleted file mode 100644 index 27add5160..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/changelog +++ /dev/null @@ -1,33 +0,0 @@ -network-manager-strongswan (1.1.2-1) unstable; urgency=low - - * New upstream release, fixes pkgconfig for new libnm-glib packages - (Closes: #569302) - - -- Martin Willi Thu, 18 Feb 2010 09:41:39 +0100 - -network-manager-strongswan (1.1.1-2) unstable; urgency=low - - * Added ${shlibs:Depends} dependency - * Reload network-manager after installation, reloading dbus is insufficient. - * Fixed debhelper-but-no-misc-depends, out-of-date-standards-version and - copyright-without-copyright-notice lintian warnings - - -- Martin Willi Mon, 12 Oct 2009 10:19:40 +0200 - -network-manager-strongswan (1.1.1-1) unstable; urgency=low - - * New upstream release fixing a crasher when saving connections - * Fix "Wrong path to network-manager initscript in postinst" - Reload dbus instead of network-manager, as other VPN plugins do. - (Closes: #529189) - * Fix "FTBFS: No package 'libnm-util' found" - added dependencies to libnm-util-dev and libnm-glib-vpn-dev - (Closes: #528977) - - -- Martin Willi Tue, 19 May 2009 13:16:51 +0200 - -network-manager-strongswan (1.1.0-1) unstable; urgency=low - - * Initial Debian packaging of NetworkManager plugin for strongSwan - - -- Martin Willi Wed, 25 Mar 2009 09:07:05 +0100 diff --git a/src/libcharon/plugins/nm/gnome/debian/compat b/src/libcharon/plugins/nm/gnome/debian/compat deleted file mode 100644 index 7f8f011eb..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/src/libcharon/plugins/nm/gnome/debian/control b/src/libcharon/plugins/nm/gnome/debian/control deleted file mode 100644 index 71d8bc922..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/control +++ /dev/null @@ -1,29 +0,0 @@ -Source: network-manager-strongswan -Section: net -Priority: extra -Maintainer: Martin Willi -Build-Depends: cdbs, - debhelper (>= 7), - network-manager-dev (>= 0.7), - libnm-util-dev (>= 0.7), - libnm-glib-dev (>= 0.7), - libnm-glib-vpn-dev (>= 0.7), - libdbus-glib-1-dev, - libglade2-dev, - libgnomeui-dev, - automake1.9, - gnome-common, -Standards-Version: 3.8.3 - -Package: network-manager-strongswan -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan-nm, network-manager -Description: network management framework (strongSwan plugin) - NetworkManager attempts to keep an active network connection available at - all times. It is intended primarily for laptops where it allows easy - switching between local wireless networks, it's also useful on desktops - with a selection of different interfaces to use. It is not intended for - usage on servers. - . - This package provides a VPN plugin for strongSwan, providing easy access to - IKEv2 IPSec VPN's. diff --git a/src/libcharon/plugins/nm/gnome/debian/copyright b/src/libcharon/plugins/nm/gnome/debian/copyright deleted file mode 100644 index 8542aeaae..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/copyright +++ /dev/null @@ -1,10 +0,0 @@ -Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59 -Name: NetworkManager-strongswan -Source: http://download.strongswan.org/NetworkManager - -Copyright: 2008-2009, Martin Willi - 2005-2008, Dan Williams - 2005, David Zeuthen -License: GPL-2 - On Debian systems the full text of the GNU General Public License can be found - in the `/usr/share/common-licenses/GPL-2' file. diff --git a/src/libcharon/plugins/nm/gnome/debian/docs b/src/libcharon/plugins/nm/gnome/debian/docs deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/libcharon/plugins/nm/gnome/debian/network-manager-strongswan.postinst b/src/libcharon/plugins/nm/gnome/debian/network-manager-strongswan.postinst deleted file mode 100644 index f855e713c..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/network-manager-strongswan.postinst +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -set -e - -case "$1" in - configure) - if [ -x "/etc/init.d/network-manager" ]; then - if [ -x /usr/sbin/invoke-rc.d ]; then - invoke-rc.d network-manager force-reload || true - else - /etc/init.d/network-manager force-reload || true - fi - fi - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/src/libcharon/plugins/nm/gnome/debian/rules b/src/libcharon/plugins/nm/gnome/debian/rules deleted file mode 100755 index 0f723246e..000000000 --- a/src/libcharon/plugins/nm/gnome/debian/rules +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/autotools.mk - -DEB_CONFIGURE_EXTRA_FLAGS := --with-charon=/usr/lib/ipsec/charon - -DEB_CONFIGURE_LIBEXECDIR := "\$$(prefix)/lib/NetworkManager" - -DEB_DH_MAKESHLIBS_ARGS_ALL := -X/usr/lib/NetworkManager/ - -DEB_DH_INSTALL_SOURCEDIR := debian/tmp - - - diff --git a/src/libcharon/plugins/nm/gnome/m4/.gitignore b/src/libcharon/plugins/nm/gnome/m4/.gitignore deleted file mode 100644 index 3d067d03a..000000000 --- a/src/libcharon/plugins/nm/gnome/m4/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -intltool.m4 -libtool.m4 -ltoptions.m4 -ltsugar.m4 -ltversion.m4 -lt~obsolete.m4 - diff --git a/src/libcharon/plugins/nm/gnome/m4/compiler_warnings.m4 b/src/libcharon/plugins/nm/gnome/m4/compiler_warnings.m4 deleted file mode 100644 index 6cea2f74e..000000000 --- a/src/libcharon/plugins/nm/gnome/m4/compiler_warnings.m4 +++ /dev/null @@ -1,31 +0,0 @@ -AC_DEFUN([NM_COMPILER_WARNINGS], -[AC_ARG_ENABLE(more-warnings, - AS_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), - set_more_warnings="$enableval",set_more_warnings=yes) -AC_MSG_CHECKING(for more warnings, including -Werror) -if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then - AC_MSG_RESULT(yes) - CFLAGS="-Wall -Werror -std=gnu89 $CFLAGS" - - for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \ - -Wdeclaration-after-statement -Wstrict-prototypes \ - -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \ - -fno-strict-aliasing; do - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" - AC_MSG_CHECKING([whether gcc understands $option]) - AC_TRY_COMPILE([], [], - has_option=yes, - has_option=no,) - if test $has_option = no; then - CFLAGS="$SAVE_CFLAGS" - fi - AC_MSG_RESULT($has_option) - unset has_option - unset SAVE_CFLAGS - done - unset option -else - AC_MSG_RESULT(no) -fi -]) diff --git a/src/libcharon/plugins/nm/gnome/nm-strongswan-service.conf b/src/libcharon/plugins/nm/gnome/nm-strongswan-service.conf deleted file mode 100644 index dccc19af9..000000000 --- a/src/libcharon/plugins/nm/gnome/nm-strongswan-service.conf +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/libcharon/plugins/nm/gnome/nm-strongswan-service.name.in b/src/libcharon/plugins/nm/gnome/nm-strongswan-service.name.in deleted file mode 100644 index 4120e55ae..000000000 --- a/src/libcharon/plugins/nm/gnome/nm-strongswan-service.name.in +++ /dev/null @@ -1,8 +0,0 @@ -[VPN Connection] -name=strongswan -service=org.freedesktop.NetworkManager.strongswan -program=@CHARON@ - -[GNOME] -auth-dialog=@LIBEXECDIR@/nm-strongswan-auth-dialog -properties=libnm-strongswan-properties diff --git a/src/libcharon/plugins/nm/gnome/po/.gitignore b/src/libcharon/plugins/nm/gnome/po/.gitignore deleted file mode 100644 index b02b6e4ac..000000000 --- a/src/libcharon/plugins/nm/gnome/po/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile.in.in -POTFILES -de.gmo -stamp-it diff --git a/src/libcharon/plugins/nm/gnome/po/ChangeLog b/src/libcharon/plugins/nm/gnome/po/ChangeLog deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/libcharon/plugins/nm/gnome/po/LINGUAS b/src/libcharon/plugins/nm/gnome/po/LINGUAS deleted file mode 100644 index adc376a70..000000000 --- a/src/libcharon/plugins/nm/gnome/po/LINGUAS +++ /dev/null @@ -1,2 +0,0 @@ -# please keep this list sorted alphabetically -de diff --git a/src/libcharon/plugins/nm/gnome/po/POTFILES.in b/src/libcharon/plugins/nm/gnome/po/POTFILES.in deleted file mode 100644 index 3732874e9..000000000 --- a/src/libcharon/plugins/nm/gnome/po/POTFILES.in +++ /dev/null @@ -1,5 +0,0 @@ -# List of source files containing translatable strings. -# Please keep this file sorted alphabetically. -properties/nm-strongswan.c -properties/nm-strongswan-dialog.glade -auth-dialog/main.c diff --git a/src/libcharon/plugins/nm/gnome/po/de.po b/src/libcharon/plugins/nm/gnome/po/de.po deleted file mode 100644 index e6649e581..000000000 --- a/src/libcharon/plugins/nm/gnome/po/de.po +++ /dev/null @@ -1,173 +0,0 @@ -# Translations for NetworkManager-strongswan. -# Copyright (C) 2010 Martin Willi -# This file is distributed under the same license as the -# NetworkManager-strongswan package. -msgid "" -msgstr "" -"Project-Id-Version: NetworkManager-strongswan\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-11 16:12+0200\n" -"PO-Revision-Date: 2010-02-18 09:20+0100\n" -"Last-Translator: Martin Willi \n" -"Language-Team: de \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../properties/nm-strongswan.c:38 -msgid "IPsec/IKEv2 (strongswan)" -msgstr "IPsec/IKEv2 (strongswan)" - -#: ../properties/nm-strongswan.c:39 -msgid "IPsec with the IKEv2 key exchange protocol." -msgstr "IPsec mit dem IKEv2 Protokoll." - -#: ../properties/nm-strongswan.c:208 -msgid "Certificate/private key" -msgstr "Zertifikat/Privater Schlüssel" - -#: ../properties/nm-strongswan.c:209 -msgid "Certificate/ssh-agent" -msgstr "Zertifikat/ssh-agent" - -#: ../properties/nm-strongswan.c:210 -msgid "Smartcard" -msgstr "Smartcard" - -#: ../properties/nm-strongswan.c:211 -msgid "EAP" -msgstr "EAP" - -#: ../properties/nm-strongswan-dialog.glade.h:1 -msgid "Client" -msgstr "Client" - -#: ../properties/nm-strongswan-dialog.glade.h:2 -msgid "Gateway" -msgstr "Gateway" - -#: ../properties/nm-strongswan-dialog.glade.h:3 -msgid "Options" -msgstr "Optionen" - -#: ../properties/nm-strongswan-dialog.glade.h:4 -msgid "An IP address or hostname the Gateway can be contacted." -msgstr "Ein IP-Adresse oder einen Rechnernamen des Gateways." - -#: ../properties/nm-strongswan-dialog.glade.h:5 -msgid "Au_thentication:" -msgstr "Au_thentisierung:" - -#: ../properties/nm-strongswan-dialog.glade.h:6 -msgid "Authentication Method to use for authentication against the Gateway. " -msgstr "Methode zur Authentisierung gegenüber dem Gateway." - -#: ../properties/nm-strongswan-dialog.glade.h:7 -msgid "C_ertificate:" -msgstr "Z_ertifikat:" - -#: ../properties/nm-strongswan-dialog.glade.h:8 -msgid "Ce_rtificate:" -msgstr "Ze_rtifikat:" - -#: ../properties/nm-strongswan-dialog.glade.h:9 -msgid "Client certificate to use for client authentication." -msgstr "Zertifikat des Clients für dessen Authentisierung." - -#: ../properties/nm-strongswan-dialog.glade.h:10 -msgid "En_force UDP encapsulation" -msgstr "Erzwingen einer zusätzlichen Einbettung der Datenpakete in _UDP" - -#: ../properties/nm-strongswan-dialog.glade.h:11 -msgid "" -"Gateway or CA certificate to use for gateway authentication. If none is " -"specified, pre-installed CA certificates are used." -msgstr "" -"Gateway- oder CA-Zertifikat für die Authentisierung des Gateways. Ohne " -"Angabe eines Zertifikates werden die CA-Zertifikate des Systems verwendet." - -#: ../properties/nm-strongswan-dialog.glade.h:12 -msgid "" -"IPComp compresses raw IP packets before they get encrypted. This saves some " -"bandwith, but uses more processing power." -msgstr "" -"IPComp komprimiert IP-Pakete, bevor sie verschlüsselt werden. Diese Option " -"kann Bandbreite sparen, benötigt jedoch zusätzliche Rechenleistung." - -#: ../properties/nm-strongswan-dialog.glade.h:13 -msgid "Private _key:" -msgstr "Privater _Schlüssel:" - -#: ../properties/nm-strongswan-dialog.glade.h:14 -msgid "" -"Private key to use for client authentication. This key has to match the " -"certificates public key and may be encrypted." -msgstr "" -"Privater Schlüssel für die Authentisierung des Clients. Dieser Schlüssel " -"muss zum konfigurierten Zertifikat passen und kann verschlüsselt sein." - -#: ../properties/nm-strongswan-dialog.glade.h:15 -msgid "Request an _inner IP address" -msgstr "_Innere IP-Adresse beziehen" - -#: ../properties/nm-strongswan-dialog.glade.h:16 -msgid "" -"Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT " -"situation is detected might help in such cases." -msgstr "" -"Manche Firewalls blockieren Datenverkehr mit dem ESP-Protokoll. Das " -"erzwingen einer zustzlichen Einbettung in UDP, auch wenn kein NAT-Router " -"detektiert wurde, kann in solchen Situationen hilfreich sein." - -#: ../properties/nm-strongswan-dialog.glade.h:17 -msgid "" -"The Gateway may provide addresses from a pool to use for communication in " -"the Gateways network. Check to request such an address." -msgstr "" -"Der Gateway kann IP-Adressen bereitstellen, welche der Client für die " -"Kommunikation im dahinterliegenden Netz verwenden kann. Aktivieren, um eine " -"solche Adresse zu beziehen." - -#: ../properties/nm-strongswan-dialog.glade.h:18 -msgid "The username (identity) to use for authentication against the gateway." -msgstr "Benutzername/Identität für die Authentisierung gegenüber dem Gateway." - -#: ../properties/nm-strongswan-dialog.glade.h:19 -msgid "Use IP c_ompression" -msgstr "IP-Pakete k_omprimieren" - -#: ../properties/nm-strongswan-dialog.glade.h:20 -msgid "_Address:" -msgstr "_Adresse:" - -#: ../properties/nm-strongswan-dialog.glade.h:21 -msgid "_Username:" -msgstr "_Benutzername:" - -#: ../auth-dialog/main.c:172 ../auth-dialog/main.c:179 -#: ../auth-dialog/main.c:186 -msgid "VPN password required" -msgstr "VPN Passwort notwendig" - -#: ../auth-dialog/main.c:173 -msgid "EAP password required to establish VPN connection:" -msgstr "Für die Erstellung des VPN-Tunnels ist ein EAP-Passwort erforderlich:" - -#: ../auth-dialog/main.c:180 -msgid "Private key decryption password required to establish VPN connection:" -msgstr "" -"Der Private Schlüssel für die Erstellung des VPN-Tunnels ist durch ein " -"Passwort geschützt:" - -#: ../auth-dialog/main.c:187 -#, fuzzy -msgid "Smartcard PIN required to establish VPN connection:" -msgstr "Für die Smartcard ist eine PIN erforderlich:" - -#: ../auth-dialog/main.c:233 -msgid "" -"Configuration uses ssh-agent for authentication, but ssh-agent is not " -"running!" -msgstr "" -"Die Konfiguration verwendet ssh-agent fr die Authentisierung, aber ssh-agent " -"ist nicht gestartet!" diff --git a/src/libcharon/plugins/nm/gnome/properties/Makefile.am b/src/libcharon/plugins/nm/gnome/properties/Makefile.am deleted file mode 100644 index 3db7c226e..000000000 --- a/src/libcharon/plugins/nm/gnome/properties/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -plugindir = $(libdir)/NetworkManager -plugin_LTLIBRARIES = libnm-strongswan-properties.la - -libnm_strongswan_properties_la_SOURCES = \ - nm-strongswan.c \ - nm-strongswan.h - -gladedir = $(datadir)/gnome-vpn-properties/strongswan -glade_DATA = nm-strongswan-dialog.glade - -libnm_strongswan_properties_la_CFLAGS = \ - $(GLADE_CFLAGS) \ - $(GTK_CFLAGS) \ - $(GCONF_CFLAGS) \ - $(LIBGNOMEUI_CFLAGS) \ - $(NM_UTILS_CFLAGS) \ - -DICONDIR=\""$(datadir)/pixmaps"\" \ - -DGLADEDIR=\""$(gladedir)"\" \ - -DG_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DGNOME_DISABLE_DEPRECATED \ - -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ - -DVERSION=\"$(VERSION)\" - -libnm_strongswan_properties_la_LIBADD = \ - $(GLADE_LIBS) \ - $(GTK_LIBS) \ - $(GCONF_LIBS) \ - $(LIBGNOMEUI_LIBS) \ - $(NM_UTILS_LIBS) - -libnm_strongswan_properties_la_LDFLAGS = \ - -avoid-version - -CLEANFILES = *.bak *.gladep *~ - -EXTRA_DIST = $(glade_DATA) diff --git a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan-dialog.glade b/src/libcharon/plugins/nm/gnome/properties/nm-strongswan-dialog.glade deleted file mode 100644 index 02c68888d..000000000 --- a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan-dialog.glade +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - window1 - - - True - 12 - vertical - 16 - - - True - vertical - 6 - - - True - 0 - <b>Gateway</b> - True - - - False - False - 0 - - - - - True - 12 - - - True - 2 - 2 - 6 - 6 - - - True - 0 - _Address: - True - address-entry - - - GTK_FILL - - - - - - True - True - True - An IP address or hostname the Gateway can be contacted. - - - 1 - 2 - - - - - - True - 0 - C_ertificate: - True - certificate-button - - - 1 - 2 - GTK_FILL - - - - - - True - Gateway or CA certificate to use for gateway authentication. If none is specified, pre-installed CA certificates are used. - - - 1 - 2 - 1 - 2 - - - - - - - 1 - - - - - False - 0 - - - - - True - vertical - 6 - - - True - 0 - <b>Client</b> - True - - - False - False - 0 - - - - - True - 12 - - - True - 4 - 2 - 6 - 6 - - - True - Private key to use for client authentication. This key has to match the certificates public key and may be encrypted. - - - 1 - 2 - 3 - 4 - - - - - True - 0 - Private _key: - True - userkey-button - - - 3 - 4 - GTK_FILL - - - - - - True - True - Authentication Method to use for authentication against the Gateway. - - - - 1 - 2 - - - - - True - 0 - Au_thentication: - True - method-combo - - - GTK_FILL - - - - - - True - 0 - _Username: - True - user-entry - - - 1 - 2 - GTK_FILL - - - - - - True - True - True - The username (identity) to use for authentication against the gateway. - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - Ce_rtificate: - True - usercert-button - - - 2 - 3 - GTK_FILL - - - - - - True - Client certificate to use for client authentication. - - - 1 - 2 - 2 - 3 - - - - - - - 1 - - - - - False - 1 - - - - - True - vertical - 6 - - - True - 0 - <b>Options</b> - True - - - False - False - 0 - - - - - True - 12 - - - True - vertical - - - Request an _inner IP address - True - True - False - True - The Gateway may provide addresses from a pool to use for communication in the Gateways network. Check to request such an address. - True - True - - - 0 - - - - - En_force UDP encapsulation - True - True - False - True - Some firewalls block ESP traffic. Enforcing UDP capsulation even if no NAT situation is detected might help in such cases. - True - True - - - 1 - - - - - Use IP c_ompression - True - True - False - True - IPComp compresses raw IP packets before they get encrypted. This saves some bandwith, but uses more processing power. - True - True - - - 2 - - - - - - - 1 - - - - - False - 2 - - - - - - diff --git a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.c b/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.c deleted file mode 100644 index 45c0df32d..000000000 --- a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.c +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (C) 2008 Martin Willi - * Hochschule fuer Technik Rapperswil - * Copyright (C) 2005 David Zeuthen - * Copyright (C) 2005-2008 Dan Williams - * - * Based on NetworkManager's vpnc plugin - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#define NM_VPN_API_SUBJECT_TO_CHANGE - -#include -#include -#include -#include - -#include "nm-strongswan.h" - -#define STRONGSWAN_PLUGIN_NAME _("IPsec/IKEv2 (strongswan)") -#define STRONGSWAN_PLUGIN_DESC _("IPsec with the IKEv2 key exchange protocol.") -#define STRONGSWAN_PLUGIN_SERVICE "org.freedesktop.NetworkManager.strongswan" -#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan" - -/************** plugin class **************/ - -static void strongswan_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class); - -G_DEFINE_TYPE_EXTENDED (StrongswanPluginUi, strongswan_plugin_ui, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_INTERFACE, - strongswan_plugin_ui_interface_init)) - -/************** UI widget class **************/ - -static void strongswan_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class); - -G_DEFINE_TYPE_EXTENDED (StrongswanPluginUiWidget, strongswan_plugin_ui_widget, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE, - strongswan_plugin_ui_widget_interface_init)) - -#define STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetPrivate)) - -typedef struct { - GladeXML *xml; - GtkWidget *widget; -} StrongswanPluginUiWidgetPrivate; - - -#define STRONGSWAN_PLUGIN_UI_ERROR strongswan_plugin_ui_error_quark () - -static GQuark -strongswan_plugin_ui_error_quark (void) -{ - static GQuark error_quark = 0; - - if (G_UNLIKELY (error_quark == 0)) - error_quark = g_quark_from_static_string ("strongswan-plugin-ui-error-quark"); - - return error_quark; -} - -#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } - -GType -strongswan_plugin_ui_error_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = { - /* Unknown error. */ - ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_UNKNOWN, "UnknownError"), - /* The specified property was invalid. */ - ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, "InvalidProperty"), - /* The specified property was missing and is required. */ - ENUM_ENTRY (STRONGSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY, "MissingProperty"), - { 0, 0, 0 } - }; - etype = g_enum_register_static ("StrongswanPluginUiError", values); - } - return etype; -} - -static gboolean -check_validity (StrongswanPluginUiWidget *self, GError **error) -{ - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - GtkWidget *widget; - char *str; - - widget = glade_xml_get_widget (priv->xml, "address-entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (!str || !strlen (str)) { - g_set_error (error, - STRONGSWAN_PLUGIN_UI_ERROR, - STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, - "address"); - return FALSE; - } - return TRUE; -} - -static void update_layout (GtkWidget *widget, StrongswanPluginUiWidgetPrivate *priv) -{ - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) - { - default: - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - /* FALL */ - case 0: - gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label")); - gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button")); - gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-label")); - gtk_widget_show (glade_xml_get_widget (priv->xml, "userkey-button")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); - break; - case 1: - gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-label")); - gtk_widget_show (glade_xml_get_widget (priv->xml, "usercert-button")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); - break; - case 2: - gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "user-entry")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); - break; - case 3: - gtk_widget_show (glade_xml_get_widget (priv->xml, "user-label")); - gtk_widget_show (glade_xml_get_widget (priv->xml, "user-entry")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "usercert-button")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-label")); - gtk_widget_hide (glade_xml_get_widget (priv->xml, "userkey-button")); - break; - } - -} - -static void -settings_changed_cb (GtkWidget *widget, gpointer user_data) -{ - StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (user_data); - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - - if (widget == glade_xml_get_widget (priv->xml, "method-combo")) - { - update_layout(glade_xml_get_widget (priv->xml, "method-combo"), priv); - } - g_signal_emit_by_name (STRONGSWAN_PLUGIN_UI_WIDGET (user_data), "changed"); -} - -static gboolean -init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError **error) -{ - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - NMSettingVPN *settings; - GtkWidget *widget; - const char *value; - - settings = NM_SETTING_VPN(nm_connection_get_setting(connection, NM_TYPE_SETTING_VPN)); - widget = glade_xml_get_widget (priv->xml, "address-entry"); - value = nm_setting_vpn_get_data_item (settings, "address"); - if (value) - gtk_entry_set_text (GTK_ENTRY (widget), value); - g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "certificate-button"); - value = nm_setting_vpn_get_data_item (settings, "certificate"); - if (value) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); - g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "user-label"); - gtk_widget_set_no_show_all (widget, TRUE); - widget = glade_xml_get_widget (priv->xml, "user-entry"); - gtk_widget_set_no_show_all (widget, TRUE); - value = nm_setting_vpn_get_data_item (settings, "user"); - if (value) - gtk_entry_set_text (GTK_ENTRY (widget), value); - g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "method-combo"); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/private key")); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Certificate/ssh-agent")); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("Smartcard")); - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), _("EAP")); - value = nm_setting_vpn_get_data_item (settings, "method"); - if (value) { - if (g_strcmp0 (value, "key") == 0) { - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - } - if (g_strcmp0 (value, "agent") == 0) { - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1); - } - if (g_strcmp0 (value, "smartcard") == 0) { - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 2); - } - if (g_strcmp0 (value, "eap") == 0) { - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 3); - } - } - if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1) - { - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - } - update_layout (widget, priv); - g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "usercert-label"); - gtk_widget_set_no_show_all (widget, TRUE); - widget = glade_xml_get_widget (priv->xml, "usercert-button"); - gtk_widget_set_no_show_all (widget, TRUE); - value = nm_setting_vpn_get_data_item (settings, "usercert"); - if (value) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); - g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "userkey-label"); - gtk_widget_set_no_show_all (widget, TRUE); - widget = glade_xml_get_widget (priv->xml, "userkey-button"); - gtk_widget_set_no_show_all (widget, TRUE); - value = nm_setting_vpn_get_data_item (settings, "userkey"); - if (value) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value); - g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "virtual-check"); - value = nm_setting_vpn_get_data_item (settings, "virtual"); - if (value && strcmp(value, "yes") == 0) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); - } - g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "encap-check"); - value = nm_setting_vpn_get_data_item (settings, "encap"); - if (value && strcmp(value, "yes") == 0) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); - } - g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); - - widget = glade_xml_get_widget (priv->xml, "ipcomp-check"); - value = nm_setting_vpn_get_data_item (settings, "ipcomp"); - if (value && strcmp(value, "yes") == 0) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); - } - g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self); - - return TRUE; -} - -static GObject * -get_widget (NMVpnPluginUiWidgetInterface *iface) -{ - StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (iface); - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - - return G_OBJECT (priv->widget); -} - -static gboolean -update_connection (NMVpnPluginUiWidgetInterface *iface, - NMConnection *connection, - GError **error) -{ - StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (iface); - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self); - NMSettingVPN *settings; - GtkWidget *widget; - gboolean active; - char *str; - - if (!check_validity (self, error)) - return FALSE; - settings = NM_SETTING_VPN (nm_setting_vpn_new ()); - - g_object_set (settings, NM_SETTING_VPN_SERVICE_TYPE, - NM_DBUS_SERVICE_STRONGSWAN, NULL); - - widget = glade_xml_get_widget (priv->xml, "address-entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (str && strlen (str)) { - nm_setting_vpn_add_data_item (settings, "address", str); - } - - widget = glade_xml_get_widget (priv->xml, "certificate-button"); - str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - if (str) { - nm_setting_vpn_add_data_item (settings, "certificate", str); - } - - widget = glade_xml_get_widget (priv->xml, "method-combo"); - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) - { - default: - case 0: - widget = glade_xml_get_widget (priv->xml, "userkey-button"); - str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - if (str) { - nm_setting_vpn_add_data_item (settings, "userkey", str); - } - widget = glade_xml_get_widget (priv->xml, "usercert-button"); - str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - if (str) { - nm_setting_vpn_add_data_item (settings, "usercert", str); - } - str = "key"; - break; - case 1: - widget = glade_xml_get_widget (priv->xml, "usercert-button"); - str = (char *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); - if (str) { - nm_setting_vpn_add_data_item (settings, "usercert", str); - } - str = "agent"; - break; - case 2: - str = "smartcard"; - break; - case 3: - widget = glade_xml_get_widget (priv->xml, "user-entry"); - str = (char *) gtk_entry_get_text (GTK_ENTRY (widget)); - if (str && strlen (str)) { - nm_setting_vpn_add_data_item (settings, "user", str); - } - str = "eap"; - break; - } - nm_setting_vpn_add_data_item (settings, "method", str); - - widget = glade_xml_get_widget (priv->xml, "virtual-check"); - active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - nm_setting_vpn_add_data_item (settings, "virtual", active ? "yes" : "no"); - - widget = glade_xml_get_widget (priv->xml, "encap-check"); - active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - nm_setting_vpn_add_data_item (settings, "encap", active ? "yes" : "no"); - - widget = glade_xml_get_widget (priv->xml, "ipcomp-check"); - active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - nm_setting_vpn_add_data_item (settings, "ipcomp", active ? "yes" : "no"); - - nm_connection_add_setting (connection, NM_SETTING (settings)); - return TRUE; -} - -static gboolean -save_secrets (NMVpnPluginUiWidgetInterface *iface, - NMConnection *connection, GError **error) -{ - /* no secrets to save */ - return TRUE; -} - -static NMVpnPluginUiWidgetInterface * -nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error) -{ - NMVpnPluginUiWidgetInterface *object; - StrongswanPluginUiWidgetPrivate *priv; - char *glade_file; - - if (error) - g_return_val_if_fail (*error == NULL, NULL); - - object = NM_VPN_PLUGIN_UI_WIDGET_INTERFACE (g_object_new (STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, NULL)); - if (!object) { - g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not create strongswan object"); - return NULL; - } - - priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (object); - - glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-strongswan-dialog.glade"); - priv->xml = glade_xml_new (glade_file, "strongswan-vbox", GETTEXT_PACKAGE); - if (priv->xml == NULL) { - g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, - "could not load required resources at %s", glade_file); - g_free (glade_file); - g_object_unref (object); - return NULL; - } - g_free (glade_file); - - priv->widget = glade_xml_get_widget (priv->xml, "strongswan-vbox"); - if (!priv->widget) { - g_set_error (error, STRONGSWAN_PLUGIN_UI_ERROR, 0, "could not load UI widget"); - g_object_unref (object); - return NULL; - } - g_object_ref_sink (priv->widget); - - if (!init_plugin_ui (STRONGSWAN_PLUGIN_UI_WIDGET (object), connection, error)) { - g_object_unref (object); - return NULL; - } - - return object; -} - -static void -dispose (GObject *object) -{ - StrongswanPluginUiWidget *plugin = STRONGSWAN_PLUGIN_UI_WIDGET (object); - StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (plugin); - - if (priv->widget) - g_object_unref (priv->widget); - - if (priv->xml) - g_object_unref (priv->xml); - - G_OBJECT_CLASS (strongswan_plugin_ui_widget_parent_class)->dispose (object); -} - -static void -strongswan_plugin_ui_widget_class_init (StrongswanPluginUiWidgetClass *req_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (req_class); - - g_type_class_add_private (req_class, sizeof (StrongswanPluginUiWidgetPrivate)); - - object_class->dispose = dispose; -} - -static void -strongswan_plugin_ui_widget_init (StrongswanPluginUiWidget *plugin) -{ -} - -static void -strongswan_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class) -{ - /* interface implementation */ - iface_class->get_widget = get_widget; - iface_class->update_connection = update_connection; - iface_class->save_secrets = save_secrets; -} - -static guint32 -get_capabilities (NMVpnPluginUiInterface *iface) -{ - return 0; -} - -static NMVpnPluginUiWidgetInterface * -ui_factory (NMVpnPluginUiInterface *iface, NMConnection *connection, GError **error) -{ - return nm_vpn_plugin_ui_widget_interface_new (connection, error); -} - -static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - switch (prop_id) { - case NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME: - g_value_set_string (value, STRONGSWAN_PLUGIN_NAME); - break; - case NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC: - g_value_set_string (value, STRONGSWAN_PLUGIN_DESC); - break; - case NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE: - g_value_set_string (value, STRONGSWAN_PLUGIN_SERVICE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -strongswan_plugin_ui_class_init (StrongswanPluginUiClass *req_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (req_class); - - object_class->get_property = get_property; - - g_object_class_override_property (object_class, - NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME, - NM_VPN_PLUGIN_UI_INTERFACE_NAME); - - g_object_class_override_property (object_class, - NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC, - NM_VPN_PLUGIN_UI_INTERFACE_DESC); - - g_object_class_override_property (object_class, - NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE, - NM_VPN_PLUGIN_UI_INTERFACE_SERVICE); -} - -static void -strongswan_plugin_ui_init (StrongswanPluginUi *plugin) -{ -} - -static void -strongswan_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class) -{ - /* interface implementation */ - iface_class->ui_factory = ui_factory; - iface_class->get_capabilities = get_capabilities; - /* TODO: implement delete_connection to purge associated secrets */ -} - - -G_MODULE_EXPORT NMVpnPluginUiInterface * -nm_vpn_plugin_ui_factory (GError **error) -{ - if (error) - g_return_val_if_fail (*error == NULL, NULL); - - return NM_VPN_PLUGIN_UI_INTERFACE (g_object_new (STRONGSWAN_TYPE_PLUGIN_UI, NULL)); -} - diff --git a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.h b/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.h deleted file mode 100644 index e2b66bb15..000000000 --- a/src/libcharon/plugins/nm/gnome/properties/nm-strongswan.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2008 Martin Willi - * Hochschule fuer Technik Rapperswil - * Copyright (C) 2008 Dan Williams - * - * Based on NetworkManager's vpnc plugin - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#ifndef _NM_STRONGSWAN_H_ -#define _NM_STRONGSWAN_H_ - -#include - -typedef enum -{ - STRONGSWAN_PLUGIN_UI_ERROR_UNKNOWN = 0, - STRONGSWAN_PLUGIN_UI_ERROR_INVALID_PROPERTY, - STRONGSWAN_PLUGIN_UI_ERROR_MISSING_PROPERTY -} StrongswanPluginUiError; - -#define STRONGSWAN_TYPE_PLUGIN_UI_ERROR (strongswan_plugin_ui_error_get_type ()) -GType strongswan_plugin_ui_error_get_type (void); - -#define STRONGSWAN_TYPE_PLUGIN_UI (strongswan_plugin_ui_get_type ()) -#define STRONGSWAN_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUi)) -#define STRONGSWAN_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass)) -#define STRONGSWAN_IS_PLUGIN_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI)) -#define STRONGSWAN_IS_PLUGIN_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI)) -#define STRONGSWAN_PLUGIN_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI, StrongswanPluginUiClass)) - -typedef struct _StrongswanPluginUi StrongswanPluginUi; -typedef struct _StrongswanPluginUiClass StrongswanPluginUiClass; - -struct _StrongswanPluginUi { - GObject parent; -}; - -struct _StrongswanPluginUiClass { - GObjectClass parent; -}; - -GType strongswan_plugin_ui_get_type (void); - - -#define STRONGSWAN_TYPE_PLUGIN_UI_WIDGET (strongswan_plugin_ui_widget_get_type ()) -#define STRONGSWAN_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidget)) -#define STRONGSWAN_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetClass)) -#define STRONGSWAN_IS_PLUGIN_UI_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET)) -#define STRONGSWAN_IS_PLUGIN_UI_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET)) -#define STRONGSWAN_PLUGIN_UI_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STRONGSWAN_TYPE_PLUGIN_UI_WIDGET, StrongswanPluginUiWidgetClass)) - -typedef struct _StrongswanPluginUiWidget StrongswanPluginUiWidget; -typedef struct _StrongswanPluginUiWidgetClass StrongswanPluginUiWidgetClass; - -struct _StrongswanPluginUiWidget { - GObject parent; -}; - -struct _StrongswanPluginUiWidgetClass { - GObjectClass parent; -}; - -GType strongswan_plugin_ui_widget_get_type (void); - -#endif /* _NM_STRONGSWAN_H_ */ - -- cgit v1.2.3