remove unused "common-gnome" + some code ported from nm-pptp

parent a61b7d4f
#AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
SUBDIRS = src SUBDIRS = src
if WITH_GNOME if WITH_GNOME
SUBDIRS += common-gnome auth-dialog properties po SUBDIRS += auth-dialog properties po
endif endif
dbusservicedir = $(sysconfdir)/dbus-1/system.d dbusservicedir = $(sysconfdir)/dbus-1/system.d
......
...@@ -3,18 +3,16 @@ INCLUDES = -I${top_srcdir} ...@@ -3,18 +3,16 @@ INCLUDES = -I${top_srcdir}
libexec_PROGRAMS = nm-l2tp-auth-dialog libexec_PROGRAMS = nm-l2tp-auth-dialog
nm_l2tp_auth_dialog_CPPFLAGS = \ nm_l2tp_auth_dialog_CPPFLAGS = \
$(NM_UTILS_CFLAGS) \ $(NM_CFLAGS) \
$(GTHREAD_CFLAGS) \ $(GTHREAD_CFLAGS) \
$(GTK_CFLAGS) \ $(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \ $(GNOMEKEYRING_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \ -DICONDIR=\""$(datadir)/pixmaps"\" \
-DUIDIR=\""$(uidir)"\" \ -DUIDIR=\""$(uidir)"\" \
-DBINDIR=\""$(bindir)"\" \ -DBINDIR=\""$(bindir)"\" \
-DG_DISABLE_DEPRECATED \ -DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \
-DGNOME_DISABLE_DEPRECATED \ -DGTK_DISABLE_DEPRECATED \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
nm_l2tp_auth_dialog_SOURCES = \ nm_l2tp_auth_dialog_SOURCES = \
...@@ -23,8 +21,8 @@ nm_l2tp_auth_dialog_SOURCES = \ ...@@ -23,8 +21,8 @@ nm_l2tp_auth_dialog_SOURCES = \
vpn-password-dialog.h vpn-password-dialog.h
nm_l2tp_auth_dialog_LDADD = \ nm_l2tp_auth_dialog_LDADD = \
$(GTK_LIBS) \ $(NM_LIBS) \
$(GCONF_LIBS) \ $(GTK_LIBS) \
$(top_builddir)/common-gnome/libnm-l2tp-common-gnome.la $(GNOMEKEYRING_LIBS)
CLEANFILES = *~ CLEANFILES = *~
noinst_LTLIBRARIES=libnm-l2tp-common-gnome.la
libnm_l2tp_common_gnome_la_CPPFLAGS = \
$(NM_UTILS_CFLAGS) \
$(GLIB_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
-DG_DISABLE_DEPRECATED
libnm_l2tp_common_gnome_la_SOURCES= \
keyring-helpers.c \
keyring-helpers.h
libnm_l2tp_common_gnome_la_LIBADD = \
$(NM_UTILS_LIBS) \
$(GLIB_LIBS) \
$(GNOMEKEYRING_LIBS)
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2004 - 2008 Red Hat, Inc.
*/
#include <string.h>
#include <gnome-keyring-memory.h>
#include <nm-setting-vpn.h>
#include "keyring-helpers.h"
#include "../src/nm-l2tp-service.h"
#define KEYRING_UUID_TAG "connection-uuid"
#define KEYRING_SN_TAG "setting-name"
#define KEYRING_SK_TAG "setting-key"
char *
keyring_helpers_lookup_secret (const char *vpn_uuid,
const char *secret_name,
gboolean *is_session)
{
GList *found_list = NULL;
GnomeKeyringResult ret;
GnomeKeyringFound *found;
char *secret;
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found_list,
KEYRING_UUID_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
vpn_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) || (g_list_length (found_list) == 0))
return NULL;
found = (GnomeKeyringFound *) found_list->data;
if (is_session) {
if (strcmp (found->keyring, "session") == 0)
*is_session = TRUE;
else
*is_session = FALSE;
}
secret = found->secret ? gnome_keyring_memory_strdup (found->secret) : NULL;
gnome_keyring_found_list_free (found_list);
return secret;
}
GnomeKeyringResult
keyring_helpers_save_secret (const char *vpn_uuid,
const char *vpn_name,
const char *keyring,
const char *secret_name,
const char *secret)
{
char *display_name;
GnomeKeyringResult ret;
GnomeKeyringAttributeList *attrs = NULL;
guint32 id = 0;
display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_SETTING_NAME,
secret_name,
vpn_name,
NM_DBUS_SERVICE_L2TP);
attrs = gnome_keyring_attribute_list_new ();
gnome_keyring_attribute_list_append_string (attrs,
KEYRING_UUID_TAG,
vpn_uuid);
gnome_keyring_attribute_list_append_string (attrs,
KEYRING_SN_TAG,
NM_SETTING_VPN_SETTING_NAME);
gnome_keyring_attribute_list_append_string (attrs,
KEYRING_SK_TAG,
secret_name);
ret = gnome_keyring_item_create_sync (keyring,
GNOME_KEYRING_ITEM_GENERIC_SECRET,
display_name,
attrs,
secret,
TRUE,
&id);
gnome_keyring_attribute_list_free (attrs);
g_free (display_name);
return ret;
}
static void
ignore_callback (GnomeKeyringResult result, gpointer data)
{
}
gboolean
keyring_helpers_delete_secret (const char *vpn_uuid,
const char *secret_name)
{
GList *found = NULL, *iter;
GnomeKeyringResult ret;
g_return_val_if_fail (vpn_uuid != NULL, FALSE);
g_return_val_if_fail (secret_name != NULL, FALSE);
ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
&found,
KEYRING_UUID_TAG,
GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
vpn_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 && ret != GNOME_KEYRING_RESULT_NO_MATCH)
return FALSE;
if (g_list_length (found) == 0)
return TRUE;
/* delete them all */
for (iter = found; iter; iter = g_list_next (iter)) {
GnomeKeyringFound *item = (GnomeKeyringFound *) iter->data;
gnome_keyring_item_delete (item->keyring, item->item_id,
ignore_callback, NULL, NULL);
}
gnome_keyring_found_list_free (found);
return TRUE;
}
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2004 - 2008 Red Hat, Inc.
*/
#ifndef KEYRING_HELPERS_H
#define KEYRING_HELPERS_H
#include <glib.h>
#include <gnome-keyring.h>
#include <gnome-keyring-memory.h>
char *keyring_helpers_lookup_secret (
const char *vpn_uuid,
const char *secret_name,
gboolean *is_session);
GnomeKeyringResult keyring_helpers_save_secret (
const char *vpn_uuid,
const char *vpn_name,
const char *keyring,
const char *secret_name,
const char *secret);
gboolean keyring_helpers_delete_secret (
const char *vpn_uuid,
const char *secret_name);
#endif /* KEYRING_HELPERS_H */
...@@ -62,12 +62,20 @@ IT_PROG_INTLTOOL([0.35]) ...@@ -62,12 +62,20 @@ IT_PROG_INTLTOOL([0.35])
AM_GLIB_GNU_GETTEXT AM_GLIB_GNU_GETTEXT
PKG_CHECK_MODULES(GTHREAD, gthread-2.0) PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.74) PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.74)
PKG_CHECK_MODULES(NM_UTILS, AC_SUBST(DBUS_GLIB_CFLAGS)
AC_SUBST(DBUS_GLIB_LIBS)
PKG_CHECK_MODULES(NM,
NetworkManager >= 0.8.1 NetworkManager >= 0.8.1
libnm-util libnm-util
libnm-glib libnm-glib
libnm-glib-vpn) libnm-glib-vpn)
AC_SUBST(NM_CFLAGS)
AC_SUBST(NM_LIBS)
if test x"$with_gnome" != xno; then if test x"$with_gnome" != xno; then
AC_ARG_WITH([gtkver], AS_HELP_STRING([--with-gtkver], [The major version of GTK+ to build with]), AC_ARG_WITH([gtkver], AS_HELP_STRING([--with-gtkver], [The major version of GTK+ to build with]),
...@@ -105,7 +113,6 @@ fi ...@@ -105,7 +113,6 @@ fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
src/Makefile src/Makefile
common-gnome/Makefile
auth-dialog/Makefile auth-dialog/Makefile
properties/Makefile properties/Makefile
po/Makefile.in po/Makefile.in
......
...@@ -19,7 +19,7 @@ libnm_l2tp_properties_la_CFLAGS = \ ...@@ -19,7 +19,7 @@ libnm_l2tp_properties_la_CFLAGS = \
$(GCONF_CFLAGS) \ $(GCONF_CFLAGS) \
$(LIBGNOMEUI_CFLAGS) \ $(LIBGNOMEUI_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \ $(GNOMEKEYRING_CFLAGS) \
$(NM_UTILS_CFLAGS) \ $(NM_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \ -DICONDIR=\""$(datadir)/pixmaps"\" \
-DUIDIR=\""$(uidir)"\" \ -DUIDIR=\""$(uidir)"\" \
-DG_DISABLE_DEPRECATED \ -DG_DISABLE_DEPRECATED \
...@@ -32,8 +32,7 @@ libnm_l2tp_properties_la_LIBADD = \ ...@@ -32,8 +32,7 @@ libnm_l2tp_properties_la_LIBADD = \
$(GTK_LIBS) \ $(GTK_LIBS) \
$(GCONF_LIBS) \ $(GCONF_LIBS) \
$(LIBGNOMEUI_LIBS) \ $(LIBGNOMEUI_LIBS) \
$(top_builddir)/common-gnome/libnm-l2tp-common-gnome.la \ $(NM_LIBS)
$(NM_UTILS_LIBS)
libnm_l2tp_properties_la_LDFLAGS = \ libnm_l2tp_properties_la_LDFLAGS = \
-avoid-version -avoid-version
......
...@@ -3,7 +3,7 @@ INCLUDES = -I${top_srcdir} ...@@ -3,7 +3,7 @@ INCLUDES = -I${top_srcdir}
AM_CPPFLAGS = \ AM_CPPFLAGS = \
$(DBUS_GLIB_CFLAGS) \ $(DBUS_GLIB_CFLAGS) \
$(GTHREAD_CFLAGS) \ $(GTHREAD_CFLAGS) \
$(NM_UTILS_CFLAGS) \ $(NM_CFLAGS) \
-DG_DISABLE_DEPRECATED \ -DG_DISABLE_DEPRECATED \
-DBINDIR=\"$(bindir)\" \ -DBINDIR=\"$(bindir)\" \
-DPREFIX=\""$(prefix)"\" \ -DPREFIX=\""$(prefix)"\" \
...@@ -27,7 +27,7 @@ nm-l2tp-pppd-service-glue.h: $(top_srcdir)/src/nm-l2tp-pppd-service.xml ...@@ -27,7 +27,7 @@ nm-l2tp-pppd-service-glue.h: $(top_srcdir)/src/nm-l2tp-pppd-service.xml
nm_l2tp_service_LDADD = \ nm_l2tp_service_LDADD = \
$(DBUS_GLIB_LIBS) \ $(DBUS_GLIB_LIBS) \
$(GTHREAD_LIBS) \ $(GTHREAD_LIBS) \
$(NM_UTILS_LIBS) $(NM_LIBS)
pppd_plugindir = $(PPPD_PLUGIN_DIR) pppd_plugindir = $(PPPD_PLUGIN_DIR)
pppd_plugin_LTLIBRARIES = nm-l2tp-pppd-plugin.la pppd_plugin_LTLIBRARIES = nm-l2tp-pppd-plugin.la
...@@ -39,14 +39,14 @@ nm_l2tp_pppd_plugin_la_SOURCES = \ ...@@ -39,14 +39,14 @@ nm_l2tp_pppd_plugin_la_SOURCES = \
nm_l2tp_pppd_plugin_la_CPPFLAGS = \ nm_l2tp_pppd_plugin_la_CPPFLAGS = \
$(DBUS_GLIB_CFLAGS) \ $(DBUS_GLIB_CFLAGS) \
$(GLIB_CFLAGS) \ $(GLIB_CFLAGS) \
$(NM_UTILS_CFLAGS) $(NM_CFLAGS)
nm_l2tp_pppd_plugin_la_LDFLAGS = -module -avoid-version nm_l2tp_pppd_plugin_la_LDFLAGS = -module -avoid-version
nm_l2tp_pppd_plugin_la_LIBADD = \ nm_l2tp_pppd_plugin_la_LIBADD = \
$(DBUS_GLIB_LIBS) \ $(DBUS_GLIB_LIBS) \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(NM_UTILS_LIBS) $(NM_LIBS)
BUILT_SOURCES = nm-l2tp-pppd-service-glue.h BUILT_SOURCES = nm-l2tp-pppd-service-glue.h
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment