From 2766bbe292c2a1d9473c256cbfece198ea4ba5fc Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 10 Oct 2007 20:24:34 +0000 Subject: [PATCH] 2007-10-10 Dan Williams * libnm-util/nm-setting.c libnm-util/nm-setting.h - Add a default 'user_name' field to the VPN setting, which VPN plugins can use if they choose. Should be filled in by the settings service on-the-fly with the currently logged in user's username git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2967 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 8 ++++++++ libnm-util/nm-setting.c | 6 ++++++ libnm-util/nm-setting.h | 1 + 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6938ddeda2..be1aa14634 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-10-10 Dan Williams + + * libnm-util/nm-setting.c + libnm-util/nm-setting.h + - Add a default 'user_name' field to the VPN setting, which VPN plugins + can use if they choose. Should be filled in by the settings service + on-the-fly with the currently logged in user's username + 2007-10-10 Dan Williams * src/nm-device-802-11-wireless.c diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index d927387c60..039fd3bc43 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -1260,6 +1260,10 @@ setting_vpn_verify (NMSetting *setting, GHashTable *all_settings) if (!self->service_type || !strlen (self->service_type)) return FALSE; + /* default username can be NULL, but can't be zero-length */ + if (self->user_name && !strlen (self->user_name)) + return FALSE; + return TRUE; } @@ -1269,6 +1273,7 @@ setting_vpn_destroy (NMSetting *setting) NMSettingVPN *self = (NMSettingVPN *) setting; g_free (self->service_type); + g_free (self->user_name); if (self->routes) { g_slist_foreach (self->routes, (GFunc) g_free, NULL); @@ -1280,6 +1285,7 @@ setting_vpn_destroy (NMSetting *setting) static SettingMember vpn_table[] = { { "service_type", NM_S_TYPE_STRING, G_STRUCT_OFFSET (NMSettingVPN, service_type), TRUE, FALSE }, + { "user_name", NM_S_TYPE_STRING, G_STRUCT_OFFSET (NMSettingVPN, user_name), FALSE, FALSE }, { "routes", NM_S_TYPE_STRING_ARRAY, G_STRUCT_OFFSET (NMSettingVPN, routes), FALSE, FALSE }, { NULL, 0, 0 }, }; diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h index 3964157ce1..b9f6ba6d3d 100644 --- a/libnm-util/nm-setting.h +++ b/libnm-util/nm-setting.h @@ -227,6 +227,7 @@ typedef struct { NMSetting parent; char *service_type; + char *user_name; GSList *routes; } NMSettingVPN;