On Fri, 2014-06-27 at 11:06 -0500, Dan Williams wrote: > On Fri, 2014-06-27 at 10:59 -0500, Dan Williams wrote: > > On Fri, 2014-06-27 at 10:27 +0000, John Frankish wrote: > > > > > The configure script for NetworkManager-openvpn-0.9.8.4 looks for > > > > > gnome-keyring-1.pc, which is not present in gnome-keyring-3.10.1 > > > > > > > > > > Is this mean to be compiled with ''--without-gnome" for gnome-3? > > > > > > > > Which Linux distro do you have? The development headers are often > > > > shipped in sub-packages, like "gnome-keyring-devel" or "gnome-keyring- > > > > dev". It may also be named "gnome-keyring-libs-devel" or > > > > "gnome-keyring- > > > > libs-dev". Does your distro have any packages like that? > > > > > > > I compiled Gnome-keyring-3.10.1 from source - it looks like the source > > > package no longer installs gnome-keyring-1.pc since about > > > gnome-keyring-3.4.x? > > > > > > The only libs installed are: > > > > > > /usr/local/lib/gnome-keyring/devel/gkm-gnome2-store-standalone.so > > > /usr/local/lib/gnome-keyring/devel/gkm-secret-store-standalone.so > > > /usr/local/lib/gnome-keyring/devel/gkm-ssh-store-standalone.so > > > /usr/local/lib/gnome-keyring/devel/gkm-xdg-store-standalone.so > > > /usr/local/lib/pkcs11/gnome-keyring-pkcs11.so > > > /usr/local/lib/security/pam_gnome_keyring.so > > > > > > ..so perhaps this makes sense? > > > > I think I know the issue. Upstream GNOME switched to "libsecret", which > > network-manager-openvpn was not ported to use. We'll have to fix that > > in the NM-openvpn 0.9.8.x branch, it was already fixed in git master. > > > > So the short answer is it's not going to work right now, but should > > soon. > > John, can you test the attached patch? Let me know if this fixes the > issue for you. Thanks!
The one where I forget to attach the patch. Fixed. Dan
>From c5bd5fc1e06f3f205af2a90ad187aa4256a38899 Mon Sep 17 00:00:00 2001 From: Dan Winship <[email protected]> Date: Wed, 27 Feb 2013 14:24:30 +0100 Subject: [PATCH] auth-dialog: port to libsecret https://bugzilla.gnome.org/show_bug.cgi?id=694307 Chery-picked from commit 038bdaa095056fe2940e5f15c97768496f91c98d --- auth-dialog/Makefile.am | 4 +-- auth-dialog/main.c | 74 +++++++++++++++++++++++---------------- auth-dialog/vpn-password-dialog.c | 1 - configure.ac | 6 ++-- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am index c1ad8f3..b66baf9 100644 --- a/auth-dialog/Makefile.am +++ b/auth-dialog/Makefile.am @@ -1,14 +1,14 @@ libexec_PROGRAMS = nm-openvpn-auth-dialog nm_openvpn_auth_dialog_CPPFLAGS = \ $(GTHREAD_CFLAGS) \ $(GTK_CFLAGS) \ $(NM_CFLAGS) \ - $(GNOMEKEYRING_CFLAGS) \ + $(LIBSECRET_CFLAGS) \ -I$(top_srcdir)/ -DICONDIR=\""$(datadir)/pixmaps"\" \ -DUIDIR=\""$(uidir)"\" \ -DBINDIR=\""$(bindir)"\" \ -DG_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \ -DGNOME_DISABLE_DEPRECATED \ @@ -19,11 +19,11 @@ nm_openvpn_auth_dialog_SOURCES = \ main.c \ vpn-password-dialog.c \ vpn-password-dialog.h nm_openvpn_auth_dialog_LDADD = \ $(GTK_LIBS) \ $(NM_LIBS) \ - $(GNOMEKEYRING_LIBS) \ + $(LIBSECRET_LIBS) \ $(top_builddir)/common/libnm-openvpn-common.la CLEANFILES = *~ diff --git a/auth-dialog/main.c b/auth-dialog/main.c index 5e06cee..1ccb246 100644 --- a/auth-dialog/main.c +++ b/auth-dialog/main.c @@ -27,56 +27,70 @@ #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <gnome-keyring.h> -#include <gnome-keyring-memory.h> + +#define SECRET_API_SUBJECT_TO_CHANGE +#include <libsecret/secret.h> #include <nm-setting-vpn.h> #include <nm-setting-connection.h> #include <nm-vpn-plugin-utils.h> #include "common/utils.h" #include "src/nm-openvpn-service.h" #include "vpn-password-dialog.h" #define KEYRING_UUID_TAG "connection-uuid" #define KEYRING_SN_TAG "setting-name" #define KEYRING_SK_TAG "setting-key" +static const SecretSchema network_manager_secret_schema = { + "org.freedesktop.NetworkManager.Connection", + SECRET_SCHEMA_DONT_MATCH_NAME, + { + { KEYRING_UUID_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SN_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { KEYRING_SK_TAG, SECRET_SCHEMA_ATTRIBUTE_STRING }, + { NULL, 0 }, + } +}; + #define UI_KEYFILE_GROUP "VPN Plugin UI" static char * keyring_lookup_secret (const char *uuid, const char *secret_name) { - GList *found_list = NULL; - GnomeKeyringResult ret; - GnomeKeyringFound *found; + GHashTable *attrs; + GList *list; char *secret = NULL; - ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET, - &found_list, - KEYRING_UUID_TAG, - GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - uuid, - KEYRING_SN_TAG, - GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - NM_SETTING_VPN_SETTING_NAME, - KEYRING_SK_TAG, - GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - secret_name, - NULL); - if (ret == GNOME_KEYRING_RESULT_OK && found_list) { - found = g_list_nth_data (found_list, 0); - secret = gnome_keyring_memory_strdup (found->secret); + attrs = secret_attributes_build (&network_manager_secret_schema, + KEYRING_UUID_TAG, uuid, + KEYRING_SN_TAG, NM_SETTING_VPN_SETTING_NAME, + KEYRING_SK_TAG, secret_name, + NULL); + + list = secret_service_search_sync (NULL, &network_manager_secret_schema, attrs, + SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS, + NULL, NULL); + if (list && list->data) { + SecretItem *item = list->data; + SecretValue *value = secret_item_get_secret (item); + + if (value) { + secret = g_strdup (secret_value_get (value, NULL)); + secret_value_unref (value); + } } - gnome_keyring_found_list_free (found_list); + g_list_free_full (list, g_object_unref); + g_hash_table_unref (attrs); return secret; } static void keyfile_add_entry_info (GKeyFile *keyfile, const gchar *key, const gchar *value, @@ -130,26 +144,26 @@ get_secrets (const char *vpn_name, g_return_val_if_fail (vpn_uuid != NULL, FALSE); g_return_val_if_fail (out_password != NULL, FALSE); g_return_val_if_fail (out_certpass != NULL, FALSE); if (need_password) { if (!(pw_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)) { if (in_pass) - password = gnome_keyring_memory_strdup (in_pass); + password = g_strdup (in_pass); else password = keyring_lookup_secret (vpn_uuid, NM_OPENVPN_KEY_PASSWORD); } if (!password && !(pw_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) need_secret = TRUE; } if (need_certpass) { if (!(cp_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)) { if (in_certpass) - certpass = gnome_keyring_memory_strdup (in_certpass); + certpass = g_strdup (in_certpass); else certpass = keyring_lookup_secret (vpn_uuid, NM_OPENVPN_KEY_CERTPASS); } if (!certpass && !(cp_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) need_secret = TRUE; } @@ -214,30 +228,30 @@ get_secrets (const char *vpn_name, } } gtk_widget_show (GTK_WIDGET (dialog)); if (vpn_password_dialog_run_and_block (dialog)) { if (need_password) - *out_password = gnome_keyring_memory_strdup (vpn_password_dialog_get_password (dialog)); + *out_password = g_strdup (vpn_password_dialog_get_password (dialog)); if (need_certpass) { if (need_password) - *out_certpass = gnome_keyring_memory_strdup (vpn_password_dialog_get_password_secondary (dialog)); + *out_certpass = g_strdup (vpn_password_dialog_get_password_secondary (dialog)); else - *out_certpass = gnome_keyring_memory_strdup (vpn_password_dialog_get_password (dialog)); + *out_certpass = g_strdup (vpn_password_dialog_get_password (dialog)); } success = TRUE; } gtk_widget_destroy (GTK_WIDGET (dialog)); out: - gnome_keyring_memory_free (password); - gnome_keyring_memory_free (certpass); + g_free (password); + g_free (certpass); g_free (prompt); return success; } static void @@ -386,17 +400,17 @@ main (int argc, char *argv[]) if (need_password && new_password) printf ("%s\n%s\n", NM_OPENVPN_KEY_PASSWORD, new_password); if (need_certpass && new_certpass) printf ("%s\n%s\n", NM_OPENVPN_KEY_CERTPASS, new_certpass); printf ("\n\n"); if (new_password) - gnome_keyring_memory_free (new_password); + g_free (new_password); if (new_certpass) - gnome_keyring_memory_free (new_certpass); + g_free (new_certpass); /* for good measure, flush stdout since Kansas is going Bye-Bye */ fflush (stdout); /* Wait for quit signal */ wait_for_quit (); } diff --git a/auth-dialog/vpn-password-dialog.c b/auth-dialog/vpn-password-dialog.c index 6c976a3..da22659 100644 --- a/auth-dialog/vpn-password-dialog.c +++ b/auth-dialog/vpn-password-dialog.c @@ -19,15 +19,14 @@ * Copyright (C) 2011 Red Hat, Inc. * * Authors: Ramiro Estrugo <[email protected]> * Dan Williams <[email protected]> */ #include <config.h> -#include <gnome-keyring-memory.h> #include <glib/gi18n.h> #include <gtk/gtk.h> #include "vpn-password-dialog.h" G_DEFINE_TYPE (VpnPasswordDialog, vpn_password_dialog, GTK_TYPE_DIALOG) diff --git a/configure.ac b/configure.ac index 405bb3a..c4a87d2 100644 --- a/configure.ac +++ b/configure.ac @@ -91,17 +91,17 @@ if test x"$with_gnome" != xno; then ;; esac AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_0" - PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1) - AC_SUBST(GNOMEKEYRING_CFLAGS) - AC_SUBST(GNOMEKEYRING_LIBS) + PKG_CHECK_MODULES(LIBSECRET, libsecret-unstable) + AC_SUBST(LIBSECRET_CFLAGS) + AC_SUBST(LIBSECRET_LIBS) dnl maintainer mode stuff if test $USE_MAINTAINER_MODE = yes; then DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED -DGCONF_DISABLE_DEPRECATED" else DISABLE_DEPRECATED="" fi -- 1.9.3
_______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
