~ubuntu-branches/debian/lenny/network-manager/lenny

« back to all changes in this revision

Viewing changes to src/nm-ap-security.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2008-07-05 15:11:33 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080705151133-rnwi7uuhda2iulug
Tags: 0.6.6-2
* debian/control
  - Add Build-Depends on pkg-config.
  - Drop obsolete Depends on iputils-arping. (Closes: #487794)
* debian/patches/09-nm_dbus_get_ap_from_object_path-mem_leak_fix.patch 
  - Fix memory leak in src/nm-dbus-net.c. (Closes: #488604)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "nm-ap-security-wep.h"
30
30
#include "nm-ap-security-wpa-psk.h"
31
31
#include "nm-ap-security-wpa-eap.h"
 
32
#include "nm-ap-security-leap.h"
32
33
#include "nm-device-802-11-wireless.h"
33
34
#include "wpa_ctrl.h"
34
35
#include "nm-utils.h"
96
97
                                security = NM_AP_SECURITY (nm_ap_security_wpa_eap_new_deserialize (iter));
97
98
                                break;
98
99
 
 
100
                        case NM_AUTH_TYPE_LEAP:
 
101
                                security = NM_AP_SECURITY (nm_ap_security_leap_new_deserialize (iter));
 
102
                                break;
 
103
 
99
104
                        default:
100
105
                                nm_warning ("Unmatched cipher %d", we_cipher);
101
106
                                break;
115
120
#define WPA_EAP         (NM_802_11_CAP_PROTO_WPA | NM_802_11_CAP_KEY_MGMT_802_1X)
116
121
#define WEP_WEP104              (NM_802_11_CAP_PROTO_WEP | NM_802_11_CAP_CIPHER_WEP104)
117
122
#define WEP_WEP40               (NM_802_11_CAP_PROTO_WEP | NM_802_11_CAP_CIPHER_WEP40)
 
123
#define LEAP                    (NM_802_11_CAP_KEY_MGMT_802_1X)
118
124
NMAPSecurity *
119
125
nm_ap_security_new_from_ap (NMAccessPoint *ap)
120
126
{
135
141
                security = NM_AP_SECURITY (nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP104));
136
142
        else if ((caps & WEP_WEP40) == WEP_WEP40)
137
143
                security = NM_AP_SECURITY (nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP40));
 
144
        else if ((caps & LEAP) == LEAP)
 
145
                security = NM_AP_SECURITY (nm_ap_security_leap_new_from_ap (ap));
138
146
        else if (!nm_ap_get_encrypted (ap))
139
147
                security = nm_ap_security_new (IW_AUTH_CIPHER_NONE);
140
148
 
150
158
        return NM_AP_SECURITY_GET_CLASS (self)->get_default_capabilities_func (self);
151
159
}
152
160
 
 
161
gboolean
 
162
nm_ap_security_get_authentication_required (NMAPSecurity *self)
 
163
{
 
164
        g_return_val_if_fail (self != NULL, FALSE);
 
165
        
 
166
        return NM_AP_SECURITY_GET_CLASS (self)->get_authentication_required_func (self);
 
167
}
 
168
 
153
169
 
154
170
gboolean
155
171
nm_ap_security_write_supplicant_config (NMAPSecurity *self,
156
172
                                        struct wpa_ctrl *ctrl,
157
173
                                        int nwid,
158
 
                                        gboolean adhoc)
 
174
                                        NMAPSecurityWriteFlags flag)
159
175
{
160
176
        g_return_val_if_fail (self != NULL, FALSE);
161
177
        g_return_val_if_fail (ctrl != NULL, FALSE);
165
181
                return FALSE;
166
182
 
167
183
        return NM_AP_SECURITY_GET_CLASS (self)->write_supplicant_config_func (self,
168
 
                        ctrl, nwid, adhoc);
 
184
                        ctrl, nwid, flag);
169
185
}
170
186
 
171
187
void
181
197
                || (we_cipher == IW_AUTH_CIPHER_WEP104)
182
198
                || (we_cipher == IW_AUTH_CIPHER_TKIP)
183
199
                || (we_cipher == IW_AUTH_CIPHER_CCMP)
184
 
                || (we_cipher == NM_AUTH_TYPE_WPA_EAP));
 
200
                || (we_cipher == NM_AUTH_TYPE_WPA_EAP)
 
201
                || (we_cipher == NM_AUTH_TYPE_LEAP));
185
202
 
186
203
        self->priv->we_cipher = we_cipher;
187
204
}
223
240
real_write_supplicant_config (NMAPSecurity *self,
224
241
                              struct wpa_ctrl *ctrl,
225
242
                              int nwid,
226
 
                              gboolean adhoc)
 
243
                              NMAPSecurityWriteFlags flag)
227
244
{
228
245
        /* Unencrypted network setup */
229
246
        if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,