nm: Replace libgnomeui with libnma for password dialog
libgnomeui is long deprecated. There's one functional difference: the choice to save the passwords is gone. The password flags and saved password should be set in the preferences dialog, but this commit does not fix that.
This commit is contained in:
committed by
Tobias Brunner
parent
456044189c
commit
47bd094e53
@@ -2,9 +2,9 @@ nm_libexec_PROGRAMS = nm-strongswan-auth-dialog
|
||||
|
||||
nm_strongswan_auth_dialog_CPPFLAGS = \
|
||||
$(GTK_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(LIBSECRET_CFLAGS) \
|
||||
$(LIBNM_CFLAGS) \
|
||||
$(LIBNMA_CFLAGS) \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
@@ -15,6 +15,6 @@ nm_strongswan_auth_dialog_SOURCES = \
|
||||
|
||||
nm_strongswan_auth_dialog_LDADD = \
|
||||
$(GTK_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(LIBSECRET_LIBS) \
|
||||
$(LIBNM_LIBS)
|
||||
$(LIBNM_LIBS) \
|
||||
$(LIBNMA_LIBS)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Lubomir Rintel
|
||||
*
|
||||
* Copyright (C) 2008-2011 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* Copyright (C) 2004 Dan Williams
|
||||
* Red Hat, Inc.
|
||||
*
|
||||
@@ -19,14 +22,16 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libsecret/secret.h>
|
||||
#include <libgnomeui/libgnomeui.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
#include <nm-vpn-service-plugin.h>
|
||||
#include <nma-vpn-password-dialog.h>
|
||||
|
||||
#define NM_DBUS_SERVICE_STRONGSWAN "org.freedesktop.NetworkManager.strongswan"
|
||||
|
||||
@@ -85,7 +90,7 @@ static char* get_connection_type(char *uuid)
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
gboolean retry = FALSE, allow_interaction = FALSE;
|
||||
gchar *name = NULL, *uuid = NULL, *service = NULL, *keyring = NULL, *pass;
|
||||
gchar *name = NULL, *uuid = NULL, *service = NULL, *pass;
|
||||
GOptionContext *context;
|
||||
char *agent, *type;
|
||||
guint32 minlen = 0;
|
||||
@@ -142,69 +147,47 @@ int main (int argc, char *argv[])
|
||||
{
|
||||
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);
|
||||
dialog = nma_vpn_password_dialog_new(_("VPN password required"),
|
||||
_("EAP password required to establish VPN connection:"),
|
||||
NULL);
|
||||
}
|
||||
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);
|
||||
dialog = nma_vpn_password_dialog_new(_("VPN password required"),
|
||||
_("Private key decryption password required to establish VPN connection:"),
|
||||
NULL);
|
||||
}
|
||||
else if (!strcmp(type, "psk"))
|
||||
{
|
||||
dialog = gnome_password_dialog_new(_("VPN password required"),
|
||||
_("Pre-shared key required to establish VPN connection (min. 20 characters):"),
|
||||
NULL, NULL, TRUE);
|
||||
gnome_password_dialog_set_show_remember(GNOME_PASSWORD_DIALOG(dialog), TRUE);
|
||||
dialog = nma_vpn_password_dialog_new(_("VPN password required"),
|
||||
_("Pre-shared key required to establish VPN connection (min. 20 characters):"),
|
||||
NULL);
|
||||
minlen = 20;
|
||||
}
|
||||
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);
|
||||
dialog = nma_vpn_password_dialog_new(_("VPN password required"),
|
||||
_("Smartcard PIN required to establish VPN connection:"),
|
||||
NULL);
|
||||
}
|
||||
gnome_password_dialog_set_show_username(GNOME_PASSWORD_DIALOG(dialog), FALSE);
|
||||
if (pass)
|
||||
{
|
||||
gnome_password_dialog_set_password(GNOME_PASSWORD_DIALOG(dialog), pass);
|
||||
nma_vpn_password_dialog_set_password(NMA_VPN_PASSWORD_DIALOG(dialog), pass);
|
||||
}
|
||||
|
||||
nma_vpn_password_dialog_set_show_password_secondary(NMA_VPN_PASSWORD_DIALOG(dialog), FALSE);
|
||||
gtk_widget_show(dialog);
|
||||
too_short_retry:
|
||||
if (!gnome_password_dialog_run_and_block(GNOME_PASSWORD_DIALOG(dialog)))
|
||||
if (!nma_vpn_password_dialog_run_and_block(NMA_VPN_PASSWORD_DIALOG(dialog)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
pass = gnome_password_dialog_get_password(GNOME_PASSWORD_DIALOG(dialog));
|
||||
pass = g_strdup(nma_vpn_password_dialog_get_password(NMA_VPN_PASSWORD_DIALOG(dialog)));
|
||||
if (minlen && strlen(pass) < minlen)
|
||||
{
|
||||
goto too_short_retry;
|
||||
}
|
||||
switch (gnome_password_dialog_get_remember(GNOME_PASSWORD_DIALOG(dialog)))
|
||||
{
|
||||
case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING:
|
||||
break;
|
||||
case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION:
|
||||
keyring = SECRET_COLLECTION_SESSION;
|
||||
/* FALL */
|
||||
case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER:
|
||||
if (!secret_password_store_sync(SECRET_SCHEMA_COMPAT_NETWORK,
|
||||
keyring, "", pass, NULL, NULL,
|
||||
"user", g_get_user_name(),
|
||||
"server", name,
|
||||
"protocol", service,
|
||||
NULL))
|
||||
{
|
||||
g_warning ("storing password in keyring failed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pass)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,6 @@ IT_PROG_INTLTOOL([0.35])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6)
|
||||
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
|
||||
PKG_CHECK_MODULES(LIBSECRET, libsecret-1)
|
||||
|
||||
PKG_CHECK_MODULES(LIBNM_GLIB, NetworkManager >= 1.1.0 libnm-util libnm-glib libnm-glib-vpn)
|
||||
|
||||
@@ -5,19 +5,18 @@ Maintainer: Martin Willi <[email protected]>
|
||||
Build-Depends: cdbs,
|
||||
debhelper (>= 7),
|
||||
libnm (>= 1.1.0),
|
||||
libnma-dev (>= 1.1.0),
|
||||
network-manager-dev (>= 1.1.0),
|
||||
libnm-util-dev (>= 1.1.0),
|
||||
libnm-glib-dev (>= 1.1.0),
|
||||
libnm-glib-vpn-dev (>= 1.1.0),
|
||||
libgnomeui-dev,
|
||||
libsecret-1-dev,
|
||||
automake,
|
||||
gnome-common,
|
||||
Standards-Version: 3.8.3
|
||||
|
||||
Package: network-manager-strongswan
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan-nm, network-manager (>= 1.1.0)
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, strongswan-nm, network-manager (>= 1.1.0), libnma (>= 1.11.0)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user