~dylanmccall/ubuntu/oneiric/network-manager-applet/lp852961-disable-autostart-for-gnome-shell

« back to all changes in this revision

Viewing changes to src/wireless-security/eap-method-tls.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-05-30 13:25:18 UTC
  • mfrom: (1.2.20 upstream)
  • Revision ID: james.westby@ubuntu.com-20110530132518-ef2bkiy1s7v0na6r
Tags: 0.8.9997+git.20110529t170033.9ec4c5d-0ubuntu1
* upstream snapshot 2011-05-29 17:00:33 (GMT)
  + 9ec4c5de855de5d9ee6c17752c3b0de6c68e9384
  - applet: fix leak in import/upgrade code (LP: #784756)
* debian/rules: switch back to git "master" branch.
* debian/patches/0001-applet-fix-possibly-uninitialized-variable.patch: drop,
  this is fixed upstream.
* debian/patches/04-autostart.patch: refreshed.
* debian/patches/20_use_full_vpn_dialog_service_name_path.patch: refreshed.
* debian/patches/lp328572-dxteam-connect-text.patch: refreshed.
* debian/patches/lp337960_dxteam_notification_icon_names.diff: refreshed.
* debian/patches/lp341684_device_sensitive_disconnect_notify.patch: refresh.
* debian/patches/lp460144_correctly_update_notification.patch: refreshed.
* debian/patches/lp341684_device_sensitive_disconnect_notify.patch: refresh.
* debian/patches/lp358526_generic_disconnected_notification_icon.patch:
  refreshed.
* debian/patches/nm-applet-use-indicator.patch: refreshed and modified to
  build with GTK3 appindicator.
  - properly free icon_name for indicators (LP: #724554), thanks JKL.
  - fix leak in applet_menu_item_add_complex_separator_helper due to new'ing
    a GtkSeparatorMenuItem on top of a GtkImageMenuItem (LP: #784711).
* debian/control:
  - Bump Build-Depends to libappindicator3-dev.
  - Update Build-Depends for GTK to libgtk-3-dev.
  - Bump network-manager and libnm Depends and Build-Depends to 0.8.998.
* debian/rules, debian/patches/series: pass --libexecdir to configure, which
  now renders the patch 20_use_full_vpn_dialog_service_name_path.patch
  unnecessary, so we're dropping it.
* debian/patches/20_use_full_vpn_dialog_service_name_path.patch: dropped,
  see above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * (C) Copyright 2007 - 2010 Red Hat, Inc.
21
21
 */
22
22
 
 
23
#include "config.h"
 
24
 
23
25
#include <glib/gi18n.h>
24
26
#include <ctype.h>
25
27
#include <string.h>
27
29
#include <nm-setting-connection.h>
28
30
#include <nm-setting-8021x.h>
29
31
 
30
 
#include "gconf-helpers.h"
31
32
#include "eap-method.h"
32
33
#include "wireless-security.h"
33
 
#include "utils.h"
34
34
#include "helpers.h"
35
35
 
36
36
struct _EAPMethodTLS {
37
37
        EAPMethod parent;
38
 
 
39
 
        gboolean phase2;
40
38
};
41
39
 
42
40
 
119
117
static void
120
118
fill_connection (EAPMethod *parent, NMConnection *connection)
121
119
{
122
 
        EAPMethodTLS *method = (EAPMethodTLS *) parent;
123
120
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
124
121
        NMSetting8021x *s_8021x;
125
 
        NMSettingConnection *s_con;
126
122
        GtkWidget *widget;
127
123
        char *ca_filename, *pk_filename, *cc_filename;
128
124
        const char *password = NULL;
129
125
        GError *error = NULL;
130
126
 
131
 
        s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
132
 
        g_assert (s_con);
133
 
 
134
127
        s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
135
128
        g_assert (s_8021x);
136
129
 
137
 
        if (method->phase2)
 
130
        if (parent->phase2)
138
131
                g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "tls", NULL);
139
132
        else
140
133
                nm_setting_802_1x_add_eap_method (s_8021x, "tls");
154
147
        pk_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
155
148
        g_assert (pk_filename);
156
149
 
157
 
        if (method->phase2) {
 
150
        if (parent->phase2) {
158
151
                if (!nm_setting_802_1x_set_phase2_private_key (s_8021x, pk_filename, password, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) {
159
152
                        g_warning ("Couldn't read phase2 private key '%s': %s", pk_filename, error ? error->message : "(unknown)");
160
153
                        g_clear_error (&error);
178
171
                g_assert (cc_filename);
179
172
 
180
173
                format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
181
 
                if (method->phase2) {
 
174
                if (parent->phase2) {
182
175
                        if (!nm_setting_802_1x_set_phase2_client_cert (s_8021x, cc_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) {
183
176
                                g_warning ("Couldn't read phase2 client certificate '%s': %s", cc_filename, error ? error->message : "(unknown)");
184
177
                                g_clear_error (&error);
198
191
        ca_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
199
192
 
200
193
        format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
201
 
        if (method->phase2) {
 
194
        if (parent->phase2) {
202
195
                if (!nm_setting_802_1x_set_phase2_ca_cert (s_8021x, ca_filename, NM_SETTING_802_1X_CK_SCHEME_PATH, &format, &error)) {
203
196
                        g_warning ("Couldn't read phase2 CA certificate '%s': %s", ca_filename, error ? error->message : "(unknown)");
204
197
                        g_clear_error (&error);
209
202
                        g_clear_error (&error);
210
203
                }
211
204
        }
212
 
 
213
 
        nm_gconf_set_ignore_ca_cert (nm_setting_connection_get_uuid (s_con),
214
 
                                     method->phase2,
215
 
                                     eap_method_get_ignore_ca_cert (parent));
216
205
}
217
206
 
218
207
static void
246
235
                GtkWindow *parent_window = NULL;
247
236
 
248
237
                toplevel = gtk_widget_get_toplevel (parent->ui_widget);
249
 
#if GTK_CHECK_VERSION(2,18,0)
250
238
                if (gtk_widget_is_toplevel (toplevel))
251
 
#else
252
 
                if (GTK_WIDGET_TOPLEVEL (toplevel))
253
 
#endif
254
239
                        parent_window = GTK_WINDOW (toplevel);
255
240
 
256
241
                dialog = gtk_message_dialog_new (parent_window,
296
281
                  const char *name,
297
282
                  const char *title,
298
283
                  WirelessSecurity *ws_parent,
299
 
                  EAPMethodTLS *method,
 
284
                  EAPMethod *parent,
300
285
                  NMSetting8021x *s_8021x,
301
286
                  SchemeFunc scheme_func,
302
287
                  PathFunc path_func,
326
311
        if (privkey) {
327
312
                g_signal_connect (G_OBJECT (widget), "selection-changed",
328
313
                                  (GCallback) private_key_picker_file_set_cb,
329
 
                                  method);
 
314
                                  parent);
330
315
                if (filename)
331
 
                        private_key_picker_helper ((EAPMethod *) method, filename, FALSE);
 
316
                        private_key_picker_helper (parent, filename, FALSE);
332
317
        }
333
318
 
334
319
        g_signal_connect (G_OBJECT (widget), "selection-changed",
350
335
static void
351
336
update_secrets (EAPMethod *parent, NMConnection *connection)
352
337
{
353
 
        EAPMethodTLS *method = (EAPMethodTLS *) parent;
354
338
        NMSetting8021x *s_8021x;
355
339
        HelperSecretFunc password_func;
356
340
        SchemeFunc scheme_func;
358
342
        const char *filename;
359
343
        GtkWidget *widget;
360
344
 
361
 
        if (method->phase2) {
 
345
        if (parent->phase2) {
362
346
                password_func = (HelperSecretFunc) nm_setting_802_1x_get_phase2_private_key_password;
363
347
                scheme_func = nm_setting_802_1x_get_phase2_private_key_scheme;
364
348
                path_func = nm_setting_802_1x_get_phase2_private_key_path;
392
376
                    gboolean phase2)
393
377
{
394
378
        EAPMethod *parent;
395
 
        EAPMethodTLS *method;
396
379
        GtkWidget *widget;
397
380
        NMSetting8021x *s_8021x = NULL;
398
381
 
404
387
                                  NULL,
405
388
                                  UIDIR "/eap-method-tls.ui",
406
389
                                  "eap_tls_notebook",
407
 
                                  "eap_tls_identity_entry");
 
390
                                  "eap_tls_identity_entry",
 
391
                                  phase2);
408
392
        if (!parent)
409
393
                return NULL;
410
394
 
411
 
        eap_method_nag_init (parent,
412
 
                             "eap_tls_ca_cert_button",
413
 
                             connection,
414
 
                             phase2);
415
 
 
416
 
        method = (EAPMethodTLS *) parent;
417
 
        method->phase2 = phase2;
 
395
        eap_method_nag_init (parent, "eap_tls_ca_cert_button", connection);
418
396
 
419
397
        if (connection)
420
398
                s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
429
407
 
430
408
        setup_filepicker (parent->builder, "eap_tls_user_cert_button",
431
409
                          _("Choose your personal certificate..."),
432
 
                          ws_parent, method, s_8021x,
 
410
                          ws_parent, parent, s_8021x,
433
411
                          phase2 ? nm_setting_802_1x_get_phase2_client_cert_scheme : nm_setting_802_1x_get_client_cert_scheme,
434
412
                          phase2 ? nm_setting_802_1x_get_phase2_client_cert_path : nm_setting_802_1x_get_client_cert_path,
435
413
                          FALSE, TRUE);
436
414
        setup_filepicker (parent->builder, "eap_tls_ca_cert_button",
437
415
                          _("Choose a Certificate Authority certificate..."),
438
 
                          ws_parent, method, s_8021x,
 
416
                          ws_parent, parent, s_8021x,
439
417
                          phase2 ? nm_setting_802_1x_get_phase2_ca_cert_scheme : nm_setting_802_1x_get_ca_cert_scheme,
440
418
                          phase2 ? nm_setting_802_1x_get_phase2_ca_cert_path : nm_setting_802_1x_get_ca_cert_path,
441
419
                          FALSE, FALSE);
442
420
        setup_filepicker (parent->builder, "eap_tls_private_key_button",
443
421
                          _("Choose your private key..."),
444
 
                          ws_parent, method, s_8021x,
 
422
                          ws_parent, parent, s_8021x,
445
423
                          phase2 ? nm_setting_802_1x_get_phase2_private_key_scheme : nm_setting_802_1x_get_private_key_scheme,
446
424
                          phase2 ? nm_setting_802_1x_get_phase2_private_key_path : nm_setting_802_1x_get_private_key_path,
447
425
                          TRUE, FALSE);
448
426
 
449
427
        /* Fill secrets, if any */
450
428
        if (connection)
451
 
                update_secrets (EAP_METHOD (method), connection);
 
429
                update_secrets (parent, connection);
452
430
 
453
431
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_private_key_password_entry"));
454
432
        g_assert (widget);
460
438
        g_assert (widget);
461
439
        g_signal_connect (G_OBJECT (widget), "toggled",
462
440
                          (GCallback) show_toggled_cb,
463
 
                          method);
 
441
                          parent);
464
442
 
465
 
        return method;
 
443
        return (EAPMethodTLS *) parent;
466
444
}
467
445