mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-15 12:48:33 +02:00
2006-10-30 Tambet Ingo <tambet@ximian.com>
vpnc/: * properties/Makefile.am: Include new files pcf-file.[ch] in build. Add NetworkManager to CFLAGS and LDADD. * properties/pcf-file.c: Implement. * properties/pcf-file.h: Ditto. * properties/nm-vpnc.c (import_from_file): Rewrite using new Cisco PCF file parser instead of using GKeyFile (which has slightly different semantics). * src/Makefile.am: Add NetworkManager to CFLAGS and LDADD. * src/nm-vpnc-service.c: Remove the leading NetworkManager directory from NM includes since the NM pkg-config file already adds that. * src/nm-vpnc-service-vpnc-helper.c: Ditto. openvpn/: * properties/Makefile.am: Add NetworkManager to CFLAGS and LDADD. * src/Makefile.am: Ditto. * properties/nm-openvpn.c: Remove the leading NetworkManager directory from NM includes since the NM pkg-config file already adds that. * src/nm-openvpn-service-openvpn-helper.c: Ditto. * src/nm-openvpn-service.c: Ditto. pptp/: * src/nm-pppd-plugin.c: Remove the leading NetworkManager directory from NM includes since the NM pkg-config file already adds that. * properties/vpnui_impl.c: Ditto. * properties/vpnui_impl.h: Ditto. * src/nm-ppp-starter.c: Ditto. * src/Makefile.am: Add NetworkManager to CFLAGS and LDADD. * properties/Makefile.am: Add NetworkManager to CFLAGS and LDADD. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2093 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
2091dd21d5
commit
d5d84393ab
21 changed files with 336 additions and 101 deletions
|
|
@ -1,3 +1,16 @@
|
|||
2006-10-30 Tambet Ingo <tambet@ximian.com>
|
||||
|
||||
* properties/Makefile.am: Add NetworkManager to CFLAGS and LDADD.
|
||||
|
||||
* src/Makefile.am: Ditto.
|
||||
|
||||
* properties/nm-openvpn.c: Remove the leading NetworkManager directory
|
||||
from NM includes since the NM pkg-config file already adds that.
|
||||
|
||||
* src/nm-openvpn-service-openvpn-helper.c: Ditto.
|
||||
|
||||
* src/nm-openvpn-service.c: Ditto.
|
||||
|
||||
2006-10-04 Tambet Ingo <tambet@ximian.com>
|
||||
|
||||
* properties/nm-openvpn.c (impl_get_widget, impl_get_properties)
|
||||
|
|
|
|||
|
|
@ -8,24 +8,26 @@ libnm_openvpn_properties_la_SOURCES = \
|
|||
gladedir = $(datadir)/gnome-vpn-properties/openvpn
|
||||
glade_DATA = nm-openvpn-dialog.glade
|
||||
|
||||
libnm_openvpn_properties_la_CFLAGS = \
|
||||
libnm_openvpn_properties_la_CFLAGS = \
|
||||
$(GLADE_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GCONF_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
|
||||
libnm_openvpn_properties_la_LIBADD = \
|
||||
libnm_openvpn_properties_la_LIBADD = \
|
||||
$(GLADE_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GCONF_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS)
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
CLEANFILES = *.bak *.gladep *~
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
|
||||
#include <NetworkManager/nm-vpn-ui-interface.h>
|
||||
#include <nm-vpn-ui-interface.h>
|
||||
|
||||
#include "../src/nm-openvpn-service.h"
|
||||
#include "../src/nm-utils.h"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/vpn-daemons/op
|
|||
AM_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
-Wall \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
|
|
@ -26,14 +27,16 @@ nm_openvpn_service_SOURCES = \
|
|||
|
||||
nm_openvpn_service_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
$(GTHREAD_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
|
||||
nm_openvpn_service_openvpn_helper_SOURCES = \
|
||||
nm-openvpn-service-openvpn-helper.c
|
||||
|
||||
nm_openvpn_service_openvpn_helper_LDADD = \
|
||||
nm_openvpn_service_openvpn_helper_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
$(GTHREAD_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "nm-openvpn-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager/NetworkManagerVPN.h>
|
||||
#include <NetworkManager.h>
|
||||
#include <NetworkManagerVPN.h>
|
||||
|
||||
#include "nm-openvpn-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
2006-10-30 Tambet Ingo <tambet@ximian.com>
|
||||
|
||||
* src/nm-pppd-plugin.c: Remove the leading NetworkManager directory
|
||||
from NM includes since the NM pkg-config file already adds that.
|
||||
|
||||
* properties/vpnui_impl.c: Ditto.
|
||||
|
||||
* properties/vpnui_impl.h: Ditto.
|
||||
|
||||
* src/nm-ppp-starter.c: Ditto.
|
||||
|
||||
* src/Makefile.am: Add NetworkManager to CFLAGS and LDADD.
|
||||
|
||||
* properties/Makefile.am: Add NetworkManager to CFLAGS and LDADD.
|
||||
|
||||
2006-06-20 Satoru SATOH <ss@gnome.gr.jp>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Added ja (Japanese).
|
||||
|
|
|
|||
|
|
@ -21,24 +21,26 @@ libnm_ppp_properties_la_SOURCES = \
|
|||
gladedir = $(datadir)/gnome-vpn-properties/ppp
|
||||
glade_DATA = nm-ppp-dialog.glade
|
||||
|
||||
libnm_ppp_properties_la_CFLAGS = \
|
||||
libnm_ppp_properties_la_CFLAGS = \
|
||||
$(GLADE_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GCONF_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
|
||||
libnm_ppp_properties_la_LIBADD = \
|
||||
libnm_ppp_properties_la_LIBADD = \
|
||||
$(GLADE_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GCONF_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS)
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
CLEANFILES = *.bak *.gladep *~
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <glade/glade.h>
|
||||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
#include <NetworkManager/nm-vpn-ui-interface.h>
|
||||
#include <nm-vpn-ui-interface.h>
|
||||
|
||||
#define NMVPNUI_IMPL_C
|
||||
#include "vpnui_impl.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <glade/glade.h>
|
||||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
#include <NetworkManager/nm-vpn-ui-interface.h>
|
||||
#include <nm-vpn-ui-interface.h>
|
||||
|
||||
|
||||
struct impl_config
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ INCLUDES = -I${top_srcdir} \
|
|||
AM_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
$(PPPD_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
$(PPPD_CFLAGS) \
|
||||
$(NM_VPN_CFLAGS) \
|
||||
-Wall \
|
||||
$(NM_VPN_CFLAGS) \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
|
|
@ -17,8 +18,8 @@ AM_CPPFLAGS = \
|
|||
-DLIBDIR=\""$(libdir)"\" \
|
||||
-DLIBEXECDIR=\""$(libexecdir)"\" \
|
||||
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
|
||||
-DDATADIR=\"$(datadir)\" \
|
||||
-fPIC
|
||||
-DDATADIR=\"$(datadir)\" \
|
||||
-fPIC
|
||||
|
||||
bin_PROGRAMS = nm-ppp-starter
|
||||
|
||||
|
|
@ -38,7 +39,8 @@ nm_ppp_starter_SOURCES = \
|
|||
|
||||
nm_ppp_starter_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
$(GTHREAD_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
nm_pppd_plugin_so_SOURCES = \
|
||||
nm-pppd-plugin.c \
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager/NetworkManagerVPN.h>
|
||||
#include <NetworkManager.h>
|
||||
#include <NetworkManagerVPN.h>
|
||||
|
||||
#include "nm-ppp-starter.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "nm-ppp-starter.h"
|
||||
#include "nm-pppd-plugin.h"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
2006-10-30 Tambet Ingo <tambet@ximian.com>
|
||||
|
||||
* properties/Makefile.am: Include new files pcf-file.[ch] in build.
|
||||
Add NetworkManager to CFLAGS and LDADD.
|
||||
|
||||
* properties/pcf-file.c: Implement.
|
||||
|
||||
* properties/pcf-file.h: Ditto.
|
||||
|
||||
* properties/nm-vpnc.c (import_from_file): Rewrite using new Cisco PCF
|
||||
file parser instead of using GKeyFile (which has slightly different
|
||||
semantics).
|
||||
|
||||
* src/Makefile.am: Add NetworkManager to CFLAGS and LDADD.
|
||||
|
||||
* src/nm-vpnc-service.c: Remove the leading NetworkManager directory
|
||||
from NM includes since the NM pkg-config file already adds that.
|
||||
|
||||
* src/nm-vpnc-service-vpnc-helper.c: Ditto.
|
||||
|
||||
2006-06-19 Satoru SATOH <ss@gnome.gr.jp>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Added ja (Japanese).
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
lib_LTLIBRARIES = libnm-vpnc-properties.la
|
||||
|
||||
libnm_vpnc_properties_la_SOURCES = \
|
||||
pcf-file.c \
|
||||
pcf-file.h \
|
||||
nm-vpnc.c
|
||||
|
||||
gladedir = $(datadir)/gnome-vpn-properties/vpnc
|
||||
|
|
@ -13,6 +15,7 @@ libnm_vpnc_properties_la_CFLAGS = \
|
|||
$(GTK_CFLAGS) \
|
||||
$(GCONF_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@
|
|||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
|
||||
#include <NetworkManager/nm-vpn-ui-interface.h>
|
||||
#include <nm-vpn-ui-interface.h>
|
||||
#include "pcf-file.h"
|
||||
|
||||
typedef struct _NetworkManagerVpnUIImpl NetworkManagerVpnUIImpl;
|
||||
|
||||
|
|
@ -478,95 +479,85 @@ impl_get_confirmation_details (NetworkManagerVpnUI *self, gchar **retval)
|
|||
static gboolean
|
||||
import_from_file (NetworkManagerVpnUIImpl *impl, const char *path)
|
||||
{
|
||||
char *basename;
|
||||
GKeyFile *keyfile;
|
||||
gboolean file_is_good;
|
||||
GHashTable *pcf;
|
||||
const char *buf;
|
||||
gboolean have_value;
|
||||
char *basename = NULL;
|
||||
gboolean expand = FALSE;
|
||||
gboolean success = FALSE;
|
||||
|
||||
/*printf ("path='%s'\n", path);*/
|
||||
pcf = pcf_file_load (path);
|
||||
if (pcf == NULL)
|
||||
return FALSE;
|
||||
|
||||
file_is_good = FALSE;
|
||||
basename = g_path_get_basename (path);
|
||||
/* Connection name */
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "Description")) == NULL || strlen (buf) < 1)
|
||||
goto error;
|
||||
gtk_entry_set_text (impl->w_connection_name, buf);
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
if (g_key_file_load_from_file (keyfile, path, 0, NULL)) {
|
||||
char *connectionname = NULL;
|
||||
char *gateway = NULL;
|
||||
char *groupname = NULL;
|
||||
char *username = NULL;
|
||||
char *domain = NULL;
|
||||
char *tunneling_mode = NULL;
|
||||
char *routes = NULL;
|
||||
gboolean should_expand;
|
||||
/* Gateway */
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "Host")) == NULL || strlen (buf) < 1)
|
||||
goto error;
|
||||
gtk_entry_set_text (impl->w_gateway, buf);
|
||||
|
||||
if ((connectionname = g_key_file_get_string (keyfile, "main", "Description", NULL)) == NULL)
|
||||
goto error;
|
||||
if ((gateway = g_key_file_get_string (keyfile, "main", "Host", NULL)) == NULL)
|
||||
goto error;
|
||||
if ((groupname = g_key_file_get_string (keyfile, "main", "GroupName", NULL)) == NULL)
|
||||
goto error;
|
||||
if ((username = g_key_file_get_string (keyfile, "main", "Username", NULL)) == NULL)
|
||||
goto error;
|
||||
if ((domain = g_key_file_get_string (keyfile, "main", "NTDomain", NULL)) == NULL)
|
||||
goto error;
|
||||
if ((tunneling_mode = g_key_file_get_string (keyfile, "main", "TunnelingMode", NULL)) == NULL)
|
||||
goto error;
|
||||
/* Group name */
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "GroupName")) == NULL || strlen (buf) < 1)
|
||||
goto error;
|
||||
gtk_entry_set_text (impl->w_group_name, buf);
|
||||
|
||||
/* may not exist */
|
||||
if ((routes = g_key_file_get_string (keyfile, "main", "X-NM-Routes", NULL)) == NULL)
|
||||
routes = g_strdup ("");
|
||||
/* Optional settings */
|
||||
|
||||
/* sanity check data */
|
||||
if (! (strlen (gateway) > 0 &&
|
||||
strlen (groupname) > 0))
|
||||
goto error;
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "UserName")))
|
||||
gtk_entry_set_text (impl->w_username, buf);
|
||||
have_value = buf == NULL ? FALSE : strlen (buf) > 0;
|
||||
expand |= have_value;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_alternate_username), have_value);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_username), have_value);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_domain), have_value);
|
||||
|
||||
gtk_entry_set_text (impl->w_connection_name, connectionname);
|
||||
gtk_entry_set_text (impl->w_gateway, gateway);
|
||||
gtk_entry_set_text (impl->w_group_name, groupname);
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "NTDomain")))
|
||||
gtk_entry_set_text (impl->w_domain, buf);
|
||||
have_value = buf == NULL ? FALSE : strlen (buf) > 0;
|
||||
expand |= have_value;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_domain), have_value);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_alternate_username), strlen (username) > 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), strlen (routes) > 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_domain), strlen (domain) > 0);
|
||||
gtk_entry_set_text (impl->w_username, username);
|
||||
gtk_entry_set_text (impl->w_routes, routes);
|
||||
gtk_entry_set_text (impl->w_domain, domain);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_username), strlen (username) > 0);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), strlen (routes) > 0);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_domain), strlen (username) > 0);
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "X-NM-Routes")))
|
||||
gtk_entry_set_text (impl->w_routes, buf);
|
||||
have_value = buf == NULL ? FALSE : strlen (buf) > 0;
|
||||
expand |= have_value;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), have_value);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), have_value);
|
||||
|
||||
should_expand = (strlen (username) > 0) || (strlen (domain) > 0) || (strlen (routes) > 0);
|
||||
gtk_expander_set_expanded (impl->w_opt_info_expander, should_expand);
|
||||
gtk_expander_set_expanded (impl->w_opt_info_expander, expand);
|
||||
|
||||
if ((buf = pcf_file_lookup_value (pcf, "main", "TunnelingMode"))) {
|
||||
/* If applicable, put up warning that TCP tunneling will be disabled */
|
||||
if (strcmp (tunneling_mode, "1") == 0) {
|
||||
|
||||
if (strncmp (buf, "1", 1) == 0) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("TCP tunneling not supported"));
|
||||
basename = g_path_get_basename (path);
|
||||
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
|
||||
_("TCP tunneling not supported"));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("The VPN settings file '%s' specifies that VPN traffic should be tunneled through TCP which is currently not supported in the vpnc software.\n\nThe connection can still be created, with TCP tunneling disabled, however it may not work as expected."), basename);
|
||||
_("The VPN settings file '%s' specifies that VPN traffic should be tunneled through TCP which is currently not supported in the vpnc software.\n\nThe connection can still be created, with TCP tunneling disabled, however it may not work as expected."), basename);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
file_is_good = TRUE;
|
||||
|
||||
error:
|
||||
g_free (connectionname);
|
||||
g_free (gateway);
|
||||
g_free (groupname);
|
||||
g_free (username);
|
||||
g_free (domain);
|
||||
g_free (tunneling_mode);
|
||||
}
|
||||
g_key_file_free (keyfile);
|
||||
|
||||
if (!file_is_good) {
|
||||
success = TRUE;
|
||||
|
||||
error:
|
||||
g_hash_table_destroy (pcf);
|
||||
|
||||
if (!success) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
if (!basename)
|
||||
basename = g_path_get_basename (path);
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
|
|
@ -580,7 +571,7 @@ import_from_file (NetworkManagerVpnUIImpl *impl, const char *path)
|
|||
|
||||
g_free (basename);
|
||||
|
||||
return file_is_good;
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
158
vpn-daemons/vpnc/properties/pcf-file.c
Normal file
158
vpn-daemons/vpnc/properties/pcf-file.c
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "pcf-file.h"
|
||||
|
||||
static void
|
||||
pcf_entry_free (PcfEntry *entry)
|
||||
{
|
||||
if (entry) {
|
||||
g_free (entry->key);
|
||||
g_free (entry->value);
|
||||
g_free (entry);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
The main reader loop here is based on the simple .ini file
|
||||
parser from avahi/avahi-daemon/ini-file-parser.c
|
||||
*/
|
||||
|
||||
GHashTable *
|
||||
pcf_file_load (const char *fname)
|
||||
{
|
||||
FILE *fo;
|
||||
unsigned line;
|
||||
GHashTable *pcf;
|
||||
GHashTable *group = NULL;
|
||||
|
||||
g_return_val_if_fail (fname != NULL, NULL);
|
||||
|
||||
if (!(fo = fopen (fname, "r"))) {
|
||||
g_warning ("Failed to open file '%s': %s", fname, strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pcf = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free,
|
||||
(GDestroyNotify) g_hash_table_destroy);
|
||||
|
||||
line = 0;
|
||||
while (!feof (fo)) {
|
||||
char ln[256], *s, *e;
|
||||
|
||||
if (!(fgets (ln, sizeof (ln), fo)))
|
||||
break;
|
||||
|
||||
line++;
|
||||
|
||||
s = ln + strspn (ln, " \t");
|
||||
s[strcspn (s, "\r\n")] = 0;
|
||||
|
||||
/* Skip comments and empty lines */
|
||||
if (*s == ';' || *s == 0)
|
||||
continue;
|
||||
|
||||
if (*s == '[') {
|
||||
/* new group */
|
||||
|
||||
if (!(e = strchr (s, ']'))) {
|
||||
g_warning ("Unclosed group header in %s:%u: <%s>", fname, line, s);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*e = 0;
|
||||
|
||||
group = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
|
||||
(GDestroyNotify) pcf_entry_free);
|
||||
|
||||
g_hash_table_insert (pcf, g_utf8_strdown (s+1, -1), group);
|
||||
} else {
|
||||
PcfEntry *entry;
|
||||
|
||||
/* Normal assignment */
|
||||
if (!(e = strchr (s, '='))) {
|
||||
g_warning ("Missing assignment in %s:%u: <%s>", fname, line, s);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!group) {
|
||||
g_warning ("Assignment outside group in %s:%u <%s>", fname, line, s);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Split the key and the value */
|
||||
*(e++) = 0;
|
||||
|
||||
entry = g_new (PcfEntry, 1);
|
||||
entry->value = g_strdup (e);
|
||||
|
||||
if (*s == '!') {
|
||||
entry->key = g_utf8_strdown (s+1, -1);
|
||||
entry->read_only = TRUE;
|
||||
} else {
|
||||
entry->key = g_utf8_strdown (s, -1);
|
||||
entry->read_only = FALSE;
|
||||
}
|
||||
|
||||
g_hash_table_insert (group, entry->key, entry);
|
||||
}
|
||||
}
|
||||
|
||||
fclose (fo);
|
||||
|
||||
return pcf;
|
||||
|
||||
fail:
|
||||
|
||||
if (fo)
|
||||
fclose (fo);
|
||||
|
||||
if (pcf)
|
||||
g_hash_table_destroy (pcf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PcfEntry *
|
||||
pcf_file_lookup (GHashTable *pcf_file,
|
||||
const char *group,
|
||||
const char *key)
|
||||
{
|
||||
gpointer section;
|
||||
PcfEntry *entry = NULL;
|
||||
char *group_lower = NULL;
|
||||
char *key_lower = NULL;
|
||||
|
||||
g_return_val_if_fail (pcf_file != NULL, NULL);
|
||||
g_return_val_if_fail (group != NULL, NULL);
|
||||
g_return_val_if_fail (key != NULL, NULL);
|
||||
|
||||
group_lower = g_utf8_strdown (group, -1);
|
||||
section = g_hash_table_lookup (pcf_file, group_lower);
|
||||
if (section) {
|
||||
key_lower = g_utf8_strdown (key, -1);
|
||||
entry = (PcfEntry *) g_hash_table_lookup ((GHashTable *) section, key_lower);
|
||||
}
|
||||
|
||||
g_free (group_lower);
|
||||
g_free (key_lower);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
const char *
|
||||
pcf_file_lookup_value (GHashTable *pcf_file,
|
||||
const char *group,
|
||||
const char *key)
|
||||
{
|
||||
PcfEntry *entry;
|
||||
|
||||
entry = pcf_file_lookup (pcf_file, group, key);
|
||||
if (entry)
|
||||
return entry->value;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
23
vpn-daemons/vpnc/properties/pcf-file.h
Normal file
23
vpn-daemons/vpnc/properties/pcf-file.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef PCF_FILE_H
|
||||
#define PCF_FILE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct PcfEntry PcfEntry;
|
||||
|
||||
struct PcfEntry {
|
||||
char *key;
|
||||
char *value;
|
||||
gboolean read_only;
|
||||
};
|
||||
|
||||
GHashTable *pcf_file_load (const char *fname);
|
||||
PcfEntry *pcf_file_lookup (GHashTable *pcf_file,
|
||||
const char *group,
|
||||
const char *key);
|
||||
|
||||
const char *pcf_file_lookup_value (GHashTable *pcf_file,
|
||||
const char *group,
|
||||
const char *key);
|
||||
|
||||
#endif /* PCF_FILE_H */
|
||||
|
|
@ -3,6 +3,7 @@ INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/vpn-daemons/vpn
|
|||
AM_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
$(NETWORK_MANAGER_CFLAGS) \
|
||||
-Wall \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
|
|
@ -26,7 +27,8 @@ nm_vpnc_service_SOURCES = \
|
|||
|
||||
nm_vpnc_service_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
$(GTHREAD_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
|
||||
nm_vpnc_service_vpnc_helper_SOURCES = \
|
||||
|
|
@ -34,6 +36,7 @@ nm_vpnc_service_vpnc_helper_SOURCES = \
|
|||
|
||||
nm_vpnc_service_vpnc_helper_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
$(GTHREAD_LIBS) \
|
||||
$(NETWORK_MANAGER_LIBS)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#include "nm-vpnc-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
#include <NetworkManager/NetworkManagerVPN.h>
|
||||
#include <NetworkManager.h>
|
||||
#include <NetworkManagerVPN.h>
|
||||
|
||||
#include "nm-vpnc-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue