1
From: Yanick Fratantonio <yans86@gmail.com>
2
Subject: add a password field to the templates
3
Origin: vendor, http://bazaar.launchpad.net/~reyammer/wicd/bug-476982/revision/20
4
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573096
5
Bug-Ubuntu: https://launchpad.net/bugs/476982
9
encryption/templates/eap | 1
10
encryption/templates/eap-tls | 2 -
11
encryption/templates/leap | 1
12
encryption/templates/peap | 1
13
encryption/templates/peap-tkip | 1
14
encryption/templates/ttls | 1
15
encryption/templates/wep-hex | 1
16
encryption/templates/wep-passphrase | 1
17
encryption/templates/wep-shared | 1
18
encryption/templates/wpa | 1
19
encryption/templates/wpa-psk | 1
20
gtk/guiutil.py | 40 ++++++++++++++++++++++++++++++++++++
21
gtk/netentry.py | 15 +++++++++----
22
wicd/misc.py | 8 +++++++
23
14 files changed, 69 insertions(+), 6 deletions(-)
25
--- wicd.orig/encryption/templates/eap
26
+++ wicd/encryption/templates/eap
27
@@ -3,6 +3,7 @@ author = Adam Blackburn
29
require username *Username password *Password
30
optional pac_file *Path_To_PAC_File
31
+protected password *Password
33
ctrl_interface=/var/run/wpa_supplicant
35
--- wicd.orig/encryption/templates/eap-tls
36
+++ wicd/encryption/templates/eap-tls
37
@@ -3,7 +3,7 @@ author = Dan O'Reilly
39
require identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
40
optional ca_cert *Path_to_CA_Cert client_cert *Path_to_Client_Cert
42
+protected identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
44
ctrl_interface=/var/run/wpa_supplicant
46
--- wicd.orig/encryption/templates/leap
47
+++ wicd/encryption/templates/leap
48
@@ -2,6 +2,7 @@ name = LEAP with WEP
49
author = Adam Blackburn
51
require username *Username password *Password
52
+protected password *Password
54
ctrl_interface=/var/run/wpa_supplicant
56
--- wicd.orig/encryption/templates/peap
57
+++ wicd/encryption/templates/peap
58
@@ -2,6 +2,7 @@ name = PEAP with GTC
59
author = Adam Blackburn
61
require identity *Identity password *Password
62
+protected password *Password
64
ctrl_interface=/var/run/wpa_supplicant
66
--- wicd.orig/encryption/templates/peap-tkip
67
+++ wicd/encryption/templates/peap-tkip
68
@@ -3,6 +3,7 @@ author = Fralaltro
70
require identity *Identity password *Password
71
optional ca_cert *Path_to_CA_Cert
72
+protected password *Password
74
ctrl_interface=/var/run/wpa_supplicant
76
--- wicd.orig/encryption/templates/ttls
77
+++ wicd/encryption/templates/ttls
78
@@ -2,6 +2,7 @@ name = TTLS with WEP
79
author = Adam Blackburn
81
require identity *Identity password *Password auth *Authentication
82
+protected password *Password
84
ctrl_interface=/var/run/wpa_supplicant
86
--- wicd.orig/encryption/templates/wep-hex
87
+++ wicd/encryption/templates/wep-hex
88
@@ -2,6 +2,7 @@ name = WEP (Hex [0-9/A-F])
89
author = Adam Blackburn
94
ctrl_interface=/var/run/wpa_supplicant
96
--- wicd.orig/encryption/templates/wep-passphrase
97
+++ wicd/encryption/templates/wep-passphrase
98
@@ -2,6 +2,7 @@ name = WEP (Passphrase)
99
author = Adam Blackburn
101
require passphrase *Passphrase
102
+protected passphrase *Passphrase
104
ctrl_interface=/var/run/wpa_supplicant
106
--- wicd.orig/encryption/templates/wep-shared
107
+++ wicd/encryption/templates/wep-shared
108
@@ -2,6 +2,7 @@ name = WEP Shared/Restricted
109
author = Dan O'Reilly
114
ctrl_interface=/var/run/wpa_supplicant
116
--- wicd.orig/encryption/templates/wpa
117
+++ wicd/encryption/templates/wpa
118
@@ -2,6 +2,7 @@ name = WPA 1/2 (Passphrase)
119
author = Adam Blackburn
124
ctrl_interface=/var/run/wpa_supplicant
126
--- wicd.orig/encryption/templates/wpa-psk
127
+++ wicd/encryption/templates/wpa-psk
128
@@ -2,6 +2,7 @@ name = WPA 1/2 (Preshared Key)
129
author = Adam Blackburn
131
require apsk *Preshared_Key
132
+protected apsk *Preshared_Key
134
ctrl_interface=/var/run/wpa_supplicant
136
--- wicd.orig/gtk/guiutil.py
137
+++ wicd/gtk/guiutil.py
138
@@ -176,3 +176,43 @@ class GreyLabel(gtk.Label):
139
def set_label(self, text):
140
self.set_markup(text)
141
self.set_alignment(0, 0)
144
+class ProtectedLabelEntry(gtk.HBox):
145
+ """ A LabelEntry with a CheckButton that protects the entry text. """
146
+ def __init__(self, label_text):
147
+ gtk.HBox.__init__(self)
148
+ self.entry = gtk.Entry()
149
+ self.entry.set_size_request(200, -1)
150
+ self.entry.set_visibility(False)
151
+ self.label = LeftAlignedLabel()
152
+ self.label.set_text(label_text)
153
+ self.label.set_size_request(165, -1)
154
+ self.check = gtk.CheckButton()
155
+ self.check.set_size_request(5, -1)
156
+ self.check.set_active(False)
157
+ self.check.set_focus_on_click(False)
158
+ self.pack_start(self.label, fill=True, expand=True)
159
+ self.pack_start(self.check, fill=True, expand=True)
160
+ self.pack_start(self.entry, fill=False, expand=False)
164
+ self.check.connect('clicked', self.click_handler)
167
+ def set_entry_text(self, text):
168
+ # For compatibility...
169
+ self.entry.set_text(text)
171
+ def get_entry_text(self):
172
+ return self.entry.get_text()
174
+ def set_sensitive(self, value):
175
+ self.entry.set_sensitive(value)
176
+ self.label.set_sensitive(value)
177
+ self.check.set_sensitive(value)
179
+ def click_handler(self, widget=None, event=None):
180
+ active = self.check.get_active()
181
+ self.entry.set_visibility(active)
182
--- wicd.orig/gtk/netentry.py
183
+++ wicd/gtk/netentry.py
184
@@ -30,7 +30,7 @@ import wicd.misc as misc
185
import wicd.wpath as wpath
186
import wicd.dbusmanager as dbusmanager
187
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
188
-from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input
189
+from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry
191
from wicd.translations import language
193
@@ -358,7 +358,7 @@ class WirelessSettingsDialog(AdvancedSet
194
self.chkbox_encryption.set_active(False)
195
self.combo_encryption.set_sensitive(False)
196
self.encrypt_types = misc.LoadEncryptionMethods()
199
information_button = gtk.Button(stock=gtk.STOCK_INFO)
200
self.button_hbox.pack_start(information_button, False, False)
201
information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID, self))
202
@@ -532,10 +532,15 @@ class WirelessSettingsDialog(AdvancedSet
203
fields = methods[ID][type_]
205
if language.has_key(field[1]):
206
- box = LabelEntry(language[field[1].lower().replace(' ','_')])
207
+ field_text = language[field[1].lower().replace(' ','_')]
209
- box = LabelEntry(field[1].replace('_',' '))
210
- box.set_auto_hidden(True)
211
+ field_text = field[1].replace('_',' ')
213
+ if field in methods[ID]['protected']:
214
+ box = ProtectedLabelEntry(field_text)
216
+ box = LabelEntry(field_text)
218
self.vbox_encrypt_info.pack_start(box)
219
# Add the data to a dict, so that the information
220
# can be easily accessed by giving the name of the wanted
221
--- wicd.orig/wicd/misc.py
222
+++ wicd/wicd/misc.py
223
@@ -335,6 +335,7 @@ def _parse_enc_template(enctype):
224
cur_type["fields"] = []
225
cur_type['optional'] = []
226
cur_type['required'] = []
227
+ cur_type['protected'] = []
228
cur_type['name'] = ""
229
for index, line in enumerate(f):
230
if line.startswith("name") and not cur_type["name"]:
231
@@ -353,6 +354,13 @@ def _parse_enc_template(enctype):
232
# An error occured parsing the optional line.
233
print "Invalid 'optional' line found in template %s" % enctype
235
+ elif line.startswith("protected"):
236
+ cur_type["protected"] = __parse_field_ent(parse_ent(line, "protected"),
237
+ field_type="protected")
238
+ if not cur_type["protected"]:
239
+ # An error occured parsing the protected line.
240
+ print "Invalid 'protected' line found in template %s" % enctype
242
elif line.startswith("----"):