summaryrefslogtreecommitdiff
path: root/callouts
diff options
context:
space:
mode:
authorTomas Hozza <thozza@redhat.com>2013-06-21 16:19:01 +0200
committerDan Williams <dcbw@redhat.com>2013-06-21 16:27:23 -0500
commitac536c212473dadbf49b9e0129f745f497728c7d (patch)
tree4c99fa18cbd8bb70ffb843b9aa616d2af284fd58 /callouts
parent8ce4250d8e68a9465506d239c478856ceac4caa7 (diff)
dispatcher: expose domains in IP4/6 config
Previously the function add_domains() expected the "domains" value to be of type DBUS_TYPE_G_ARRAY_OF_STRING but the value is in fact of type G_TYPE_STRV. Also added check to log critical message in case of "val" not holding G_TYPE_STRV type. This caused dispatcher not to export IPx_DOMAINS environment variable. Signed-off-by: Tomas Hozza <thozza@redhat.com>
Diffstat (limited to 'callouts')
-rw-r--r--callouts/nm-dispatcher-utils.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index 887e80dda0..8824295d23 100644
--- a/callouts/nm-dispatcher-utils.c
+++ b/callouts/nm-dispatcher-utils.c
@@ -60,25 +60,27 @@ add_domains (GSList *items,
const char four_or_six)
{
GValue *val;
- GPtrArray *domains = NULL;
+ char **domains = NULL;
GString *tmp;
guint i;
/* Search domains */
val = g_hash_table_lookup (hash, "domains");
- if (!val || !G_VALUE_HOLDS (val, DBUS_TYPE_G_ARRAY_OF_STRING))
+ if (!val)
return items;
- domains = (GPtrArray *) g_value_get_boxed (val);
- if (!domains || (domains->len == 0))
+ g_return_val_if_fail (G_VALUE_HOLDS (val, G_TYPE_STRV), items);
+
+ domains = (char **) g_value_get_boxed (val);
+ if (!domains || !domains[0])
return items;
tmp = g_string_new (NULL);
g_string_append_printf (tmp, "%sIP%c_DOMAINS=", prefix, four_or_six);
- for (i = 0; i < domains->len; i++) {
+ for (i = 0; domains[i]; i++) {
if (i > 0)
g_string_append_c (tmp, ' ');
- g_string_append (tmp, (char *) g_ptr_array_index (domains, i));
+ g_string_append (tmp, domains[i]);
}
items = g_slist_prepend (items, tmp->str);
g_string_free (tmp, FALSE);