libnm-glib: fix handling of 'nameservers' property in NMIP6Config

This commit is contained in:
Jiří Klimeš
2010-06-28 19:05:40 +02:00
parent d83872f46d
commit aa104f9950
3 changed files with 11 additions and 9 deletions

View File

@@ -132,7 +132,7 @@ libnm_glib_la_LIBADD = \
$(GUDEV_LIBS)
libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib.ver \
-version-info "6:0:4"
-version-info "6:1:4"
noinst_PROGRAMS = libnm-glib-test

View File

@@ -92,7 +92,7 @@ demarshal_ip6_nameserver_array (NMObject *object, GParamSpec *pspec, GValue *val
if (!_nm_ip6_address_array_demarshal (value, (GSList **) field))
return FALSE;
if (!strcmp (pspec->name, NM_IP6_CONFIG_NAMESERVERS))
if (pspec && !strcmp (pspec->name, NM_IP6_CONFIG_NAMESERVERS))
_nm_object_queue_notify (object, NM_IP6_CONFIG_NAMESERVERS);
return TRUE;
@@ -188,6 +188,7 @@ const GSList *
nm_ip6_config_get_nameservers (NMIP6Config *config)
{
NMIP6ConfigPrivate *priv;
GParamSpec *pspec;
GValue value = {0,};
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
@@ -203,7 +204,8 @@ nm_ip6_config_get_nameservers (NMIP6Config *config)
return NULL;
}
demarshal_ip6_nameserver_array (NM_OBJECT (config), NULL, &value, &priv->nameservers);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (config)), NM_IP6_CONFIG_NAMESERVERS);
demarshal_ip6_nameserver_array (NM_OBJECT (config), pspec, &value, &priv->nameservers);
g_value_unset (&value);
return priv->nameservers;

View File

@@ -359,7 +359,7 @@ _nm_ip6_address_array_demarshal (GValue *value, GSList **dest)
{
GPtrArray *array;
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_UINT_ARRAY))
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR))
return FALSE;
if (*dest) {
@@ -373,12 +373,12 @@ _nm_ip6_address_array_demarshal (GValue *value, GSList **dest)
int i;
for (i = 0; i < array->len; i++) {
struct in6_addr *addr = g_ptr_array_index (array, i);
struct in6_addr *dup;
GByteArray *bytearray = (GByteArray *) g_ptr_array_index (array, i);
struct in6_addr *addr;
dup = g_malloc0 (sizeof (struct in6_addr));
memcpy (dup, addr, sizeof (struct in6_addr));
*dest = g_slist_append (*dest, dup);
addr = g_malloc0 (sizeof (struct in6_addr));
memcpy (addr->s6_addr, bytearray->data, bytearray->len);
*dest = g_slist_append (*dest, addr);
}
}