[patch 2/3] array of domains
- From: groug free fr
- To: networkmanager-list gnome org
- Subject: [patch 2/3] array of domains
- Date: Mon, 29 May 2006 00:00:02 +0200
This patch affects the 9th argument of the IP4 config message (DNS domain) so
that it can either be a single STRING or an ARRAY of STRING. Implementation
is as follows:
- if the argument is a non empty STRING, it will be the only domain in the config,
as before;
- if the argument is a non empty ARRAY, every not empty STRING is added to
the IP4 config
- else, no domain is added to the IP4 config.
Index: NetworkManager-cvs/src/vpn-manager/nm-vpn-service.c
===================================================================
--- NetworkManager-cvs.orig/src/vpn-manager/nm-vpn-service.c 2006-05-27 11:47:17.000000000 +0200
+++ NetworkManager-cvs/src/vpn-manager/nm-vpn-service.c 2006-05-27 12:18:45.000000000 +0200
@@ -731,6 +731,7 @@ nm_vpn_service_stage4_ip_config_get (NMV
DBusMessageIter subiter;
NMIP4Config * config;
NMDevice * parent_dev;
+ int type;
g_return_if_fail (service != NULL);
g_return_if_fail (message != NULL);
@@ -815,11 +816,31 @@ nm_vpn_service_stage4_ip_config_get (NMV
goto out;
nm_ip4_config_set_mss (config, num);
- /* Ninth arg: DNS Domain (STRING) */
- if (!get_dbus_string_helper (&iter, &str, "DNS Domain"))
- goto out;
- if (strlen (str))
+ /* Ninth arg: DNS Domain (STRING or (ARRAY, STRING)) */
+ if (!dbus_message_iter_next (&iter))
+ goto out;
+ if ((type = dbus_message_iter_get_arg_type (&iter)) == DBUS_TYPE_STRING)
+ {
+ dbus_message_iter_get_basic (&iter, &str);
+ if (strlen (str))
nm_ip4_config_add_domain (config, str);
+ } else if (type == DBUS_TYPE_ARRAY) {
+ dbus_message_iter_recurse (&iter, &subiter);
+ while ((type = dbus_message_iter_get_arg_type (&subiter)) != DBUS_TYPE_INVALID)
+ {
+ if (type != DBUS_TYPE_STRING)
+ goto domain_error;
+ dbus_message_iter_get_basic (&subiter, &str);
+ if (strlen (str))
+ nm_ip4_config_add_domain (config, str);
+ dbus_message_iter_next (&subiter);
+ }
+ } else {
+ domain_error:
+ nm_warning ("Error: couldn't get IP4 DNS Domain"
+ " from VPN IP Config message.");
+ goto out;
+ }
/* Tenth arg: VPN Login Banner (STRING) */
if (!get_dbus_string_helper (&iter, &login_banner, "Login Banner"))
--
-gr0n6-
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]