network-manager-applet r618 - in trunk: . src src/connection-editor src/wireless-security
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r618 - in trunk: . src src/connection-editor src/wireless-security
- Date: Sat, 29 Mar 2008 20:55:03 +0000 (GMT)
Author: dcbw
Date: Sat Mar 29 20:55:02 2008
New Revision: 618
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=618&view=rev
Log:
2008-03-29 Dan Williams <dcbw redhat com>
* src/applet.glade
- remove the wep_passphrase_widget
* src/wireless-security/ws-wep-passphrase.c
src/wireless-security/ws-wep-passphrase.h
src/wireless-security/Makefile.am
- remove WEP passphrase widget
* src/wireless-security/ws-wep-key.c
src/wireless-security/ws-wep-key.h
- Fold WEP passphrase widget into WEP key widget
* src/wireless-dialog.c
src/connection-editor/page-wireless-security.c
- WEP passphrase widget is now part of WirelessSecurityWEPKey
Removed:
trunk/src/wireless-security/ws-wep-passphrase.c
trunk/src/wireless-security/ws-wep-passphrase.h
Modified:
trunk/ChangeLog
trunk/src/applet.glade
trunk/src/connection-editor/page-wireless-security.c
trunk/src/wireless-dialog.c
trunk/src/wireless-security/Makefile.am
trunk/src/wireless-security/wireless-security.h
trunk/src/wireless-security/ws-wep-key.c
trunk/src/wireless-security/ws-wep-key.h
Modified: trunk/src/applet.glade
==============================================================================
--- trunk/src/applet.glade (original)
+++ trunk/src/applet.glade Sat Mar 29 20:55:02 2008
@@ -1937,215 +1937,6 @@
</child>
</widget>
-<widget class="GtkWindow" id="wep_passphrase_widget">
- <property name="visible">True</property>
- <property name="title">wep_passphrase_widget</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkNotebook" id="wep_passphrase_notebook">
- <property name="visible">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkTable" id="table7">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="wep_passphrase_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Passphrase:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="wep_passphrase_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">False</property>
- <property name="max_length">64</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="activates_default">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="auth_method_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Authentication:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="show_checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show passphrase</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label30">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="auth_method_combo">
- <property name="visible">True</property>
- <property name="items" translatable="yes">Open System
-Shared Key</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
<widget class="GtkWindow" id="eap_tls_widget">
<property name="visible">True</property>
<property name="title">eap_tls_widget</property>
Modified: trunk/src/connection-editor/page-wireless-security.c
==============================================================================
--- trunk/src/connection-editor/page-wireless-security.c (original)
+++ trunk/src/connection-editor/page-wireless-security.c Sat Mar 29 20:55:02 2008
@@ -253,31 +253,29 @@
}
if (nm_utils_security_valid (NMU_SEC_STATIC_WEP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
- WirelessSecurityWEPKey *ws_wep_hex;
- WirelessSecurityWEPKey *ws_wep_ascii;
- WirelessSecurityWEPPassphrase *ws_wep_passphrase;
-
- ws_wep_passphrase = ws_wep_passphrase_new (glade_file, connection);
- if (ws_wep_passphrase) {
- add_security_item (self, WIRELESS_SECURITY (ws_wep_passphrase), sec_model,
+ WirelessSecurityWEPKey *ws_wep;
+
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_PASSPHRASE);
+ if (ws_wep) {
+ add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 128-bit Passphrase"));
item++;
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
active = item;
}
- ws_wep_hex = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
- if (ws_wep_hex) {
- add_security_item (self, WIRELESS_SECURITY (ws_wep_hex), sec_model,
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
+ if (ws_wep) {
+ add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Hexadecimal"));
item++;
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
active = item;
}
- ws_wep_ascii = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
- if (ws_wep_ascii) {
- add_security_item (self, WIRELESS_SECURITY (ws_wep_ascii), sec_model,
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
+ if (ws_wep) {
+ add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit ASCII"));
item++;
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
Modified: trunk/src/wireless-dialog.c
==============================================================================
--- trunk/src/wireless-dialog.c (original)
+++ trunk/src/wireless-dialog.c Sat Mar 29 20:55:02 2008
@@ -477,29 +477,27 @@
*/
if ( nm_utils_security_valid (NMU_SEC_STATIC_WEP, dev_caps, !!cur_ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)
&& ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_802_11_DEVICE_CAP_WPA | NM_802_11_DEVICE_CAP_RSN)))) {
- WirelessSecurityWEPKey *ws_wep_hex;
- WirelessSecurityWEPKey *ws_wep_ascii;
- WirelessSecurityWEPPassphrase *ws_wep_passphrase;
-
- ws_wep_passphrase = ws_wep_passphrase_new (glade_file, connection);
- if (ws_wep_passphrase) {
- add_security_item (dialog, WIRELESS_SECURITY (ws_wep_passphrase), sec_model,
+ WirelessSecurityWEPKey *ws_wep;
+
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_PASSPHRASE);
+ if (ws_wep) {
+ add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 128-bit Passphrase"));
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
active = item++;
}
- ws_wep_hex = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
- if (ws_wep_hex) {
- add_security_item (dialog, WIRELESS_SECURITY (ws_wep_hex), sec_model,
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_HEX);
+ if (ws_wep) {
+ add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Hexadecimal"));
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
active = item++;
}
- ws_wep_ascii = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
- if (ws_wep_ascii) {
- add_security_item (dialog, WIRELESS_SECURITY (ws_wep_ascii), sec_model,
+ ws_wep = ws_wep_key_new (glade_file, connection, WEP_KEY_TYPE_ASCII);
+ if (ws_wep) {
+ add_security_item (dialog, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit ASCII"));
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP))
active = item++;
Modified: trunk/src/wireless-security/Makefile.am
==============================================================================
--- trunk/src/wireless-security/Makefile.am (original)
+++ trunk/src/wireless-security/Makefile.am Sat Mar 29 20:55:02 2008
@@ -5,8 +5,6 @@
wireless-security.c \
ws-wep-key.h \
ws-wep-key.c \
- ws-wep-passphrase.h \
- ws-wep-passphrase.c \
ws-wpa-psk.h \
ws-wpa-psk.c \
sha1.c \
Modified: trunk/src/wireless-security/wireless-security.h
==============================================================================
--- trunk/src/wireless-security/wireless-security.h (original)
+++ trunk/src/wireless-security/wireless-security.h Sat Mar 29 20:55:02 2008
@@ -82,7 +82,6 @@
/* Below for internal use only */
#include "ws-wep-key.h"
-#include "ws-wep-passphrase.h"
#include "ws-wpa-psk.h"
#include "ws-leap.h"
#include "ws-wpa-eap.h"
Modified: trunk/src/wireless-security/ws-wep-key.c
==============================================================================
--- trunk/src/wireless-security/ws-wep-key.c (original)
+++ trunk/src/wireless-security/ws-wep-key.c Sat Mar 29 20:55:02 2008
@@ -25,6 +25,7 @@
#include "wireless-security.h"
#include "utils.h"
+#include "gnome-keyring-md5.h"
static void
@@ -76,6 +77,9 @@
if (!isascii (key[i]))
return FALSE;
}
+ } else if (sec->type == WEP_KEY_TYPE_PASSPHRASE) {
+ if (!key || !strlen (key) || (strlen (key) > 64))
+ return FALSE;
}
return TRUE;
@@ -93,6 +97,30 @@
gtk_size_group_add_widget (group, widget);
}
+static char *
+wep128_passphrase_hash (const char *input)
+{
+ char md5_data[65];
+ unsigned char digest[16];
+ int input_len;
+ int i;
+
+ g_return_val_if_fail (input != NULL, NULL);
+
+ input_len = strlen (input);
+ if (input_len < 1)
+ return NULL;
+
+ /* Get at least 64 bytes */
+ for (i = 0; i < 64; i++)
+ md5_data [i] = input [i % input_len];
+
+ /* Null terminate md5 seed data and hash it */
+ md5_data[64] = 0;
+ gnome_keyring_md5_string (md5_data, digest);
+ return (utils_bin2hexstr ((const char *) &digest, 16, 26));
+}
+
static void
fill_connection (WirelessSecurity *parent, NMConnection *connection)
{
@@ -100,6 +128,7 @@
GtkWidget *widget;
gint auth_alg;
const char *key;
+ char *hashed;
widget = glade_xml_get_widget (parent->xml, "auth_method_combo");
auth_alg = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
@@ -109,12 +138,14 @@
if (sec->type == WEP_KEY_TYPE_HEX) {
ws_wep_fill_connection (connection, key, auth_alg);
- } else {
- char *hashed;
-
+ } else if (sec->type == WEP_KEY_TYPE_ASCII) {
hashed = utils_bin2hexstr (key, strlen (key), strlen (key) * 2);
ws_wep_fill_connection (connection, hashed, auth_alg);
g_free (hashed);
+ } else if (sec->type == WEP_KEY_TYPE_PASSPHRASE) {
+ hashed = wep128_passphrase_hash (key);
+ ws_wep_fill_connection (connection, hashed, auth_alg);
+ g_free (hashed);
}
}
@@ -140,6 +171,9 @@
if (isascii(text[i]))
result[count++] = text[i];
}
+ } else if (sec->type == WEP_KEY_TYPE_PASSPHRASE) {
+ for (i = 0; i < length; i++)
+ result[count++] = text[i];
}
if (count == 0)
@@ -203,6 +237,12 @@
g_signal_connect (G_OBJECT (widget), "insert-text",
(GCallback) wep_entry_filter_cb,
sec);
+ if (sec->type == WEP_KEY_TYPE_HEX)
+ gtk_entry_set_max_length (GTK_ENTRY (widget), 26);
+ else if (sec->type == WEP_KEY_TYPE_ASCII)
+ gtk_entry_set_max_length (GTK_ENTRY (widget), 13);
+ else if (sec->type == WEP_KEY_TYPE_PASSPHRASE)
+ gtk_entry_set_max_length (GTK_ENTRY (widget), 64);
widget = glade_xml_get_widget (xml, "show_checkbutton");
g_assert (widget);
Modified: trunk/src/wireless-security/ws-wep-key.h
==============================================================================
--- trunk/src/wireless-security/ws-wep-key.h (original)
+++ trunk/src/wireless-security/ws-wep-key.h Sat Mar 29 20:55:02 2008
@@ -24,7 +24,8 @@
typedef enum {
WEP_KEY_TYPE_HEX = 0,
- WEP_KEY_TYPE_ASCII = 1
+ WEP_KEY_TYPE_ASCII = 1,
+ WEP_KEY_TYPE_PASSPHRASE = 2,
} WEPKeyType;
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]