~modemmanager/network-manager/ubuntu.0.7.mm

« back to all changes in this revision

Viewing changes to system-settings/plugins/keyfile/writer.c

  • Committer: Alexander Sack
  • Date: 2009-01-23 19:37:11 UTC
  • mfrom: (2957.1.31 ubuntu.0.7)
  • Revision ID: asac@jwsdot.com-20090123193711-2i2k6isrzqop2f29
merge 0.7-0ubuntu2 jaunty packaging
rev:2988 from lp:~network-manager/network-manager/ubuntu.0.7

* fix LP: #270584 add the dependency network-manager-dev in
  libnm-glib-dev
  - update debian/control
* update Standards-Version to 3.8.0
  - update debian/control
* (merge) new upstream release NetworkManager 0.7 final
  - rev 3802 lp:~vcs-imports/network-manager/main/
  + fix LP: #288963 Network Manager fails to connect to a system stored
    network with "set_network_cb(): Couldn't set network config: Did not receive
    correct message.." in intrepid
  + fix LP: #288703 Routes lost on DHCP lease renewal (breaks VPN)
* drop probe v250 modem patch; this should be done in udev-extras; until
  that happens we rely on accurate hal-info
  - delete debian/patches/add_probe_for_v250_modems.patch
  - update debian/patches/series
* drop upstreamed patches
  - delete debian/patches/50_gcc43.patch
  - delete debian/patches/lp282207_set_apn_at_syntax.patch
  - delete debian/patches/lp268667_more_ppp_default_options.patch
  - delete debian/patches/lp278631-initscript-polishing.patch
  - update debian/patches/series
* drop unused patch
  - delete debian/patches/41o_completely_deactivate_stage1.patch
* make manual regristration timeout patch out of automatic one (which
  was applied upstream)
  - rename debian/patches/lp303142_more_time_for_automatic_registration.patch
    => debian/patches/lp303142_more_time_for_manual_registration.patch
* add patch to fix ftbfs
  - add debian/patches/ftbfs_nm_netlink_monitor.patch
  - update debian/patches/series
* [libnm-util-dev] dont try to install nm-setting-ip6-config.h - which is
  supposed to be hidden in 0.7 final
  - update debian/libnm-util-dev.install
* prepatch upstream soname version bump for libnm-util
  - add debian/patches/04-ltversioning.patch
  - update debian/patches/series
  ship the libs in libnm-util1
  - update debian/control
  - rename debian/libnm-util0.install => debian/libnm-util1.install
  and bump so shlibs control file info for libnm-util1
  - update debian/rules
* add easy bzr builddeb support with proper upstream-revision (--show-ids)
  - add .bzr-builddeb/default.conf
* install plugin in ppp 2.4.4 and 2.4.5 directory
  - update debian/network-manager.install
* fix LP: #292054 - Some drivers take too long to associate (Was:
  network-manager 0.7 always asks for WPA passphrase); we workaround
  this driver/wpasupplicant bug by giving association more time
  (e.g. 60sec instead of 25sec)
  - add debian/patches/lp292054_tune_supplicant_timeout_60s.patch
  - update debian/patches/series
* fix LP: #256905 - dbus policy file (nm-avahi-autoipd.conf) not properly
  deployed in package; install nm-avahi-autoipd.conf
  - update debian/network-manager.install
* fix LP: #282207 - [Sierra] NM 0.7 does not set APN for AT&T 3G connection;
  apply fix from Jerone Young
  - add debian/patches/lp282207_set_apn_at_syntax.patch
  - update debian/patches/series
* fix LP: #268667 - not all required ppp options get set on command line
  which makes ppp use bad values from /etc/ppp/options; we backport upstream
  fix
  - add debian/patches/lp268667_more_ppp_default_options.patch
  - update debian/patches/series
* fix LP: #291564 - ifupdown network manager does not blacklist/unmanage
  mapped devices in managed=false mode; thanks to Stephan Trebels for the
  patch
  - add debian/patches/lp291564_ifupdown_unmanage_mapping_and_iface.patch
  - update debian/patches/series
* fix LP: #291902 - ifupdown plugin should not export any parsed connection
  configuration when running in managed=false mode; we fix this by exporting
  empty connection list in unmanaged mode
  - add debian/patches/lp291902_IFUPDOWN_dont_export_connection_in_unmanaged_mode.patch
  - update debian/patches/series
* belt-and-braces fix LP: #290468 VPN fails, "/usr/bin/nm-ppp-starter
  missing"; we remove obsolete conffiles in -pptp .preinst; in case user
  modified them they will be renamed to .dpkg-bak; this patch takes care that
  NM doesn't consider files in /etc/NetworkManager/VPN that don't have a
  .name filename suffix.
  - add debian/patches/lp290468_only_consider_name_suffix_VPN_service_files.patch
  - update debian/patches/series
* fix LP: #303142 - 3G [Option] some modems take a while time to register on
  network (CREG); we use g_timeout_add instead of _idle_add to give the
  modem some rest during registration phase.
  - add debian/patches/lp303142_more_time_for_automatic_registration.patch
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
 
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
2
/* NetworkManager system settings service - keyfile plugin
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
17
 *
 
18
 * Copyright (C) 2008 Novell, Inc.
 
19
 * Copyright (C) 2008 Red Hat, Inc.
 
20
 */
2
21
 
3
22
#include <sys/stat.h>
4
23
#include <unistd.h>
48
67
                        }
49
68
                }
50
69
 
51
 
                g_key_file_set_string_list (file, setting->name, key, (const char **) list, array->len);
 
70
                g_key_file_set_string_list (file, nm_setting_get_name (setting), key, (const char **) list, array->len);
52
71
                g_strfreev (list);
53
72
        } else {
54
73
                int *tmp_array;
57
76
                for (i = 0; i < array->len; i++)
58
77
                        tmp_array[i] = g_array_index (array, int, i);
59
78
 
60
 
                g_key_file_set_integer_list (file, setting->name, key, tmp_array, array->len);
 
79
                g_key_file_set_integer_list (file, nm_setting_get_name (setting), key, tmp_array, array->len);
61
80
                g_free (tmp_array);
62
81
        }
63
82
 
136
155
                return TRUE;
137
156
 
138
157
        if (!strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES))
139
 
                write_ip4_values (file, setting->name, key, array, 3, 0, 2);
 
158
                write_ip4_values (file, nm_setting_get_name (setting), key, array, 3, 0, 2);
140
159
        else if (!strcmp (key, NM_SETTING_IP4_CONFIG_ROUTES))
141
 
                write_ip4_values (file, setting->name, key, array, 4, 0, 2);
 
160
                write_ip4_values (file, nm_setting_get_name (setting), key, array, 4, 0, 2);
142
161
 
143
162
        return TRUE;
144
163
}
177
196
            && !strcmp (key, NM_SETTING_VPN_SECRETS)) {
178
197
                info.setting_name = VPN_SECRETS_GROUP;
179
198
        } else
180
 
                info.setting_name = setting->name;
 
199
                info.setting_name = nm_setting_get_name (setting);
181
200
 
182
201
        g_hash_table_foreach (hash, write_hash_of_string_helper, &info);
183
202
}
184
203
 
185
204
static void
186
205
write_setting_value (NMSetting *setting,
187
 
                                 const char *key,
188
 
                                 const GValue *value,
189
 
                                 gboolean secret,
190
 
                                 gpointer user_data)
 
206
                     const char *key,
 
207
                     const GValue *value,
 
208
                     GParamFlags flag,
 
209
                     gpointer user_data)
191
210
{
192
211
        GKeyFile *file = (GKeyFile *) user_data;
 
212
        const char *setting_name;
193
213
        GType type;
194
214
 
195
215
        type = G_VALUE_TYPE (value);
198
218
        if (!strcmp (key, NM_SETTING_NAME))
199
219
                return;
200
220
 
 
221
        /* Don't write the NMSettingConnection object's 'read-only' property */
 
222
        if (   NM_IS_SETTING_CONNECTION (setting)
 
223
            && !strcmp (key, NM_SETTING_CONNECTION_READ_ONLY))
 
224
                return;
 
225
 
 
226
        setting_name = nm_setting_get_name (setting);
 
227
 
201
228
        if (type == G_TYPE_STRING) {
202
229
                const char *str;
203
230
 
204
231
                str = g_value_get_string (value);
205
232
                if (str)
206
 
                        g_key_file_set_string (file, setting->name, key, str);
 
233
                        g_key_file_set_string (file, setting_name, key, str);
207
234
        } else if (type == G_TYPE_UINT)
208
 
                g_key_file_set_integer (file, setting->name, key, (int) g_value_get_uint (value));
 
235
                g_key_file_set_integer (file, setting_name, key, (int) g_value_get_uint (value));
209
236
        else if (type == G_TYPE_INT)
210
 
                g_key_file_set_integer (file, setting->name, key, g_value_get_int (value));
 
237
                g_key_file_set_integer (file, setting_name, key, g_value_get_int (value));
211
238
        else if (type == G_TYPE_UINT64) {
212
239
                char *numstr;
213
240
 
214
241
                numstr = g_strdup_printf ("%" G_GUINT64_FORMAT, g_value_get_uint64 (value));
215
 
                g_key_file_set_value (file, setting->name, key, numstr);
 
242
                g_key_file_set_value (file, setting_name, key, numstr);
216
243
                g_free (numstr);
217
244
        } else if (type == G_TYPE_BOOLEAN) {
218
 
                g_key_file_set_boolean (file, setting->name, key, g_value_get_boolean (value));
 
245
                g_key_file_set_boolean (file, setting_name, key, g_value_get_boolean (value));
219
246
        } else if (type == G_TYPE_CHAR) {
220
 
                g_key_file_set_integer (file, setting->name, key, (int) g_value_get_char (value));
 
247
                g_key_file_set_integer (file, setting_name, key, (int) g_value_get_char (value));
221
248
        } else if (type == DBUS_TYPE_G_UCHAR_ARRAY) {
222
249
                GByteArray *array;
223
250
 
230
257
                        for (i = 0; i < array->len; i++)
231
258
                                tmp_array[i] = (int) array->data[i];
232
259
 
233
 
                        g_key_file_set_integer_list (file, setting->name, key, tmp_array, array->len);
 
260
                        g_key_file_set_integer_list (file, setting_name, key, tmp_array, array->len);
234
261
                        g_free (tmp_array);
235
262
                }
236
263
        } else if (type == dbus_g_type_get_collection ("GSList", G_TYPE_STRING)) {
246
273
                        for (iter = list; iter; iter = iter->next)
247
274
                                array[i++] = iter->data;
248
275
 
249
 
                        g_key_file_set_string_list (file, setting->name, key, (const gchar **const) array, i);
 
276
                        g_key_file_set_string_list (file, setting_name, key, (const gchar **const) array, i);
250
277
                        g_free (array);
251
278
                }
252
279
        } else if (type == dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)) {
254
281
        } else if (type == DBUS_TYPE_G_UINT_ARRAY) {
255
282
                if (!write_array_of_uint (file, setting, key, value)) {
256
283
                        g_warning ("Unhandled setting property type (write) '%s/%s' : '%s'", 
257
 
                                         setting->name, key, g_type_name (type));
 
284
                                         setting_name, key, g_type_name (type));
258
285
                }
259
286
        } else if (type == DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT) {
260
287
                if (!write_array_of_array_of_uint (file, setting, key, value)) {
261
288
                        g_warning ("Unhandled setting property type (write) '%s/%s' : '%s'", 
262
 
                                         setting->name, key, g_type_name (type));
 
289
                                         setting_name, key, g_type_name (type));
263
290
                }
264
291
        } else {
265
292
                g_warning ("Unhandled setting property type (write) '%s/%s' : '%s'", 
266
 
                                 setting->name, key, g_type_name (type));
 
293
                                 setting_name, key, g_type_name (type));
267
294
        }
268
295
}
269
296
 
310
337
        if (!data)
311
338
                goto out;
312
339
 
313
 
        filename = writer_id_to_filename (s_con->id);
 
340
        filename = writer_id_to_filename (nm_setting_connection_get_id (s_con));
314
341
        path = g_build_filename (KEYFILE_DIR, filename, NULL);
315
342
        g_free (filename);
316
343