~ubuntu-branches/debian/sid/wicd/sid

« back to all changes in this revision

Viewing changes to debian/patches/40-checkbox_passwords.patch

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2011-10-17 22:18:06 UTC
  • Revision ID: package-import@ubuntu.com-20111017221806-99dnvqej5w7lm0qw
Tags: 1.7.0+ds1-7
* Standards-Version bump to 3.9.2, no changes needed
* Updated debian/copyright to match latest DEP-5
* Implement a -t/--tray switch to only run the wicd tray icon
  (36-implement_tray-only.patch) (Closes: #583684)
* Replace "cli" with "console" (to avoid the usage of "CLI", which is used
  by Mono applications) in wicd-cli's short description
  (Closes: #617328)
* Add Danish debconf translation, thanks to Joe Dalton
  (Closes: #621364)
* Add Serbian debconf translation, thanks to Zlatan Todoric
  (Closes: #635079, #635080)
* 34-dont_save_useless_config.patch: drop useless has_profile=False
  sections and more (Closes: #629364)
* Work-around adding non-existing users to debconf (Closes: #634051)
* Fix suspend scripts, they had old paths (37-fix_suspend_scripts.patch)
  (Closes: #635444)
* Fix search for libc in wicd/misc.py (38-fix_libc_ctype_linking.patch)
  (Closes: #636941)
* 39-fix_channel_digit_parsing.patch: support channels with more than
  2 digits (Closes: #640075)
* 40-checkbox_passwords.patch: add a checkbox to show/hide passwords
  (Closes: #573096) (LP: #476982)
* 41-add_new_templates.patch: new encryption templates (Closes: #641531)
* 42-support_new_urwid.patch: support urwid 1.0.0 (Closes: #645681)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
6
Forwarded: no
 
7
 
 
8
---
 
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(-)
 
24
 
 
25
--- wicd.orig/encryption/templates/eap
 
26
+++ wicd/encryption/templates/eap
 
27
@@ -3,6 +3,7 @@ author = Adam Blackburn
 
28
 version = 2
 
29
 require username *Username password *Password 
 
30
 optional pac_file *Path_To_PAC_File
 
31
+protected password *Password
 
32
 -----
 
33
 ctrl_interface=/var/run/wpa_supplicant
 
34
 network={
 
35
--- wicd.orig/encryption/templates/eap-tls
 
36
+++ wicd/encryption/templates/eap-tls
 
37
@@ -3,7 +3,7 @@ author = Dan O'Reilly
 
38
 version = 1
 
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
 
41
-
 
42
+protected identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
 
43
 -----
 
44
 ctrl_interface=/var/run/wpa_supplicant
 
45
 network={
 
46
--- wicd.orig/encryption/templates/leap
 
47
+++ wicd/encryption/templates/leap
 
48
@@ -2,6 +2,7 @@ name = LEAP with WEP
 
49
 author = Adam Blackburn
 
50
 version = 1
 
51
 require username *Username password *Password
 
52
+protected password *Password
 
53
 -----
 
54
 ctrl_interface=/var/run/wpa_supplicant
 
55
 network={
 
56
--- wicd.orig/encryption/templates/peap
 
57
+++ wicd/encryption/templates/peap
 
58
@@ -2,6 +2,7 @@ name = PEAP with GTC
 
59
 author = Adam Blackburn
 
60
 version = 2
 
61
 require identity *Identity password *Password
 
62
+protected password *Password
 
63
 -----
 
64
 ctrl_interface=/var/run/wpa_supplicant
 
65
 network={
 
66
--- wicd.orig/encryption/templates/peap-tkip
 
67
+++ wicd/encryption/templates/peap-tkip
 
68
@@ -3,6 +3,7 @@ author = Fralaltro
 
69
 version = 1
 
70
 require identity *Identity password *Password 
 
71
 optional ca_cert *Path_to_CA_Cert
 
72
+protected password *Password
 
73
 -----
 
74
 ctrl_interface=/var/run/wpa_supplicant
 
75
 network={
 
76
--- wicd.orig/encryption/templates/ttls
 
77
+++ wicd/encryption/templates/ttls
 
78
@@ -2,6 +2,7 @@ name = TTLS with WEP
 
79
 author = Adam Blackburn
 
80
 version = 1
 
81
 require identity *Identity password *Password auth *Authentication
 
82
+protected password *Password
 
83
 -----
 
84
 ctrl_interface=/var/run/wpa_supplicant
 
85
 network={
 
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
 
90
 version = 1
 
91
 require key *Key
 
92
+protected key *Key
 
93
 -----
 
94
 ctrl_interface=/var/run/wpa_supplicant
 
95
 network={
 
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
 
100
 version = 1
 
101
 require passphrase *Passphrase
 
102
+protected passphrase *Passphrase
 
103
 -----
 
104
 ctrl_interface=/var/run/wpa_supplicant
 
105
 network={
 
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
 
110
 version = 1
 
111
 require key *Key
 
112
+protected key *Key
 
113
 -----
 
114
 ctrl_interface=/var/run/wpa_supplicant
 
115
 network={
 
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
 
120
 version = 1
 
121
 require key *Key
 
122
+protected key *Key
 
123
 -----
 
124
 ctrl_interface=/var/run/wpa_supplicant
 
125
 network={
 
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
 
130
 version = 1
 
131
 require apsk *Preshared_Key
 
132
+protected apsk *Preshared_Key
 
133
 -----
 
134
 ctrl_interface=/var/run/wpa_supplicant
 
135
 network={
 
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)
 
142
+
 
143
+
 
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)
 
161
+        self.label.show()
 
162
+        self.check.show()
 
163
+        self.entry.show()
 
164
+        self.check.connect('clicked', self.click_handler)
 
165
+        self.show()
 
166
+
 
167
+    def set_entry_text(self, text):
 
168
+        # For compatibility...
 
169
+        self.entry.set_text(text)
 
170
+
 
171
+    def get_entry_text(self):
 
172
+        return self.entry.get_text()
 
173
+
 
174
+    def set_sensitive(self, value):
 
175
+        self.entry.set_sensitive(value)
 
176
+        self.label.set_sensitive(value)
 
177
+        self.check.set_sensitive(value)
 
178
+
 
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
 
190
 
 
191
 from wicd.translations import language
 
192
 
 
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()
 
197
-        
 
198
+
 
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_]
 
204
             for field in fields:
 
205
                 if language.has_key(field[1]):
 
206
-                    box = LabelEntry(language[field[1].lower().replace(' ','_')])
 
207
+                    field_text = language[field[1].lower().replace(' ','_')]
 
208
                 else:
 
209
-                    box = LabelEntry(field[1].replace('_',' '))
 
210
-                box.set_auto_hidden(True)
 
211
+                    field_text = field[1].replace('_',' ')
 
212
+
 
213
+                if field in methods[ID]['protected']:
 
214
+                    box = ProtectedLabelEntry(field_text)
 
215
+                else:
 
216
+                    box = LabelEntry(field_text)
 
217
+
 
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
 
234
                 continue
 
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
 
241
+                continue
 
242
         elif line.startswith("----"):
 
243
             # We're done.
 
244
             break