diff --git a/encryption/templates/eap b/encryption/templates/eap index e771285..8cefc42 100644 --- a/encryption/templates/eap +++ b/encryption/templates/eap @@ -3,6 +3,7 @@ author = Adam Blackburn version = 2 require username *Username password *Password optional pac_file *Path_To_PAC_File +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/eap-tls b/encryption/templates/eap-tls index ea6e9fe..15960d5 100644 --- a/encryption/templates/eap-tls +++ b/encryption/templates/eap-tls @@ -3,7 +3,7 @@ author = Dan O'Reilly version = 1 require identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password optional ca_cert *Path_to_CA_Cert client_cert *Path_to_Client_Cert - +protected identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/leap b/encryption/templates/leap index 1685c2a..072772d 100644 --- a/encryption/templates/leap +++ b/encryption/templates/leap @@ -2,6 +2,7 @@ name = LEAP with WEP author = Adam Blackburn version = 1 require username *Username password *Password +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/peap b/encryption/templates/peap index 9010a2c..1f6ae17 100644 --- a/encryption/templates/peap +++ b/encryption/templates/peap @@ -2,6 +2,7 @@ name = PEAP with GTC author = Adam Blackburn version = 2 require identity *Identity password *Password +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/peap-tkip b/encryption/templates/peap-tkip index 94a9812..c6d0f91 100644 --- a/encryption/templates/peap-tkip +++ b/encryption/templates/peap-tkip @@ -3,6 +3,7 @@ author = Fralaltro version = 1 require identity *Identity password *Password optional ca_cert *Path_to_CA_Cert +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/ttls b/encryption/templates/ttls index 002a92b..6f11e66 100644 --- a/encryption/templates/ttls +++ b/encryption/templates/ttls @@ -2,6 +2,7 @@ name = TTLS with WEP author = Adam Blackburn version = 1 require identity *Identity password *Password auth *Authentication +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wep-hex b/encryption/templates/wep-hex index 6d331bc..d0cb285 100644 --- a/encryption/templates/wep-hex +++ b/encryption/templates/wep-hex @@ -2,6 +2,7 @@ name = WEP (Hex [0-9/A-F]) author = Adam Blackburn version = 1 require key *Key +protected key *Key ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wep-passphrase b/encryption/templates/wep-passphrase index 792eece..838369b 100644 --- a/encryption/templates/wep-passphrase +++ b/encryption/templates/wep-passphrase @@ -2,6 +2,7 @@ name = WEP (Passphrase) author = Adam Blackburn version = 1 require passphrase *Passphrase +protected passphrase *Passphrase ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wep-shared b/encryption/templates/wep-shared index 713e68c..ba3da27 100644 --- a/encryption/templates/wep-shared +++ b/encryption/templates/wep-shared @@ -2,6 +2,7 @@ name = WEP Shared/Restricted author = Dan O'Reilly version = 1 require key *Key +protected key *Key ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wpa b/encryption/templates/wpa index 20b36a7..e56d254 100644 --- a/encryption/templates/wpa +++ b/encryption/templates/wpa @@ -2,6 +2,7 @@ name = WPA 1/2 (Passphrase) author = Adam Blackburn version = 1 require key *Key +protected key *Key ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wpa-peap b/encryption/templates/wpa-peap index 4851a4f..1ae85b3 100644 --- a/encryption/templates/wpa-peap +++ b/encryption/templates/wpa-peap @@ -2,6 +2,7 @@ name = WPA-PEAP author = atiketemola version = 1 require identity *Username domain *Domain password *Password +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wpa-psk b/encryption/templates/wpa-psk index 3685610..130b46e 100644 --- a/encryption/templates/wpa-psk +++ b/encryption/templates/wpa-psk @@ -2,6 +2,7 @@ name = WPA 1/2 (Preshared Key) author = Adam Blackburn version = 1 require apsk *Preshared_Key +protected apsk *Preshared_Key ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wpa2-leap b/encryption/templates/wpa2-leap index 88f203f..6e84521 100644 --- a/encryption/templates/wpa2-leap +++ b/encryption/templates/wpa2-leap @@ -2,6 +2,7 @@ name = WPA2-LEAP author = atiketemola version = 1 require username *Username password *Password +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/encryption/templates/wpa2-peap b/encryption/templates/wpa2-peap index 403d575..6021c64 100644 --- a/encryption/templates/wpa2-peap +++ b/encryption/templates/wpa2-peap @@ -2,6 +2,7 @@ name = WPA2-PEAP author = atiketemola version = 1 require identity *Username domain *Domain password *Password +protected password *Password ----- ctrl_interface=/var/run/wpa_supplicant network={ diff --git a/gtk/guiutil.py b/gtk/guiutil.py index 2837edd..484eab5 100644 --- a/gtk/guiutil.py +++ b/gtk/guiutil.py @@ -176,3 +176,43 @@ class GreyLabel(gtk.Label): def set_label(self, text): self.set_markup(text) self.set_alignment(0, 0) + + +class ProtectedLabelEntry(gtk.HBox): + """ A LabelEntry with a CheckButton that protects the entry text. """ + def __init__(self, label_text): + gtk.HBox.__init__(self) + self.entry = gtk.Entry() + self.entry.set_size_request(200, -1) + self.entry.set_visibility(False) + self.label = LeftAlignedLabel() + self.label.set_text(label_text) + self.label.set_size_request(165, -1) + self.check = gtk.CheckButton() + self.check.set_size_request(5, -1) + self.check.set_active(False) + self.check.set_focus_on_click(False) + self.pack_start(self.label, fill=True, expand=True) + self.pack_start(self.check, fill=True, expand=True) + self.pack_start(self.entry, fill=False, expand=False) + self.label.show() + self.check.show() + self.entry.show() + self.check.connect('clicked', self.click_handler) + self.show() + + def set_entry_text(self, text): + # For compatibility... + self.entry.set_text(text) + + def get_entry_text(self): + return self.entry.get_text() + + def set_sensitive(self, value): + self.entry.set_sensitive(value) + self.label.set_sensitive(value) + self.check.set_sensitive(value) + + def click_handler(self, widget=None, event=None): + active = self.check.get_active() + self.entry.set_visibility(active) diff --git a/gtk/netentry.py b/gtk/netentry.py index e9075ed..5ed5895 100644 --- a/gtk/netentry.py +++ b/gtk/netentry.py @@ -30,7 +30,7 @@ import wicd.misc as misc import wicd.wpath as wpath import wicd.dbusmanager as dbusmanager from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool -from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input +from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry from wicd.translations import language @@ -358,7 +358,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog): self.chkbox_encryption.set_active(False) self.combo_encryption.set_sensitive(False) self.encrypt_types = misc.LoadEncryptionMethods() - + information_button = gtk.Button(stock=gtk.STOCK_INFO) self.button_hbox.pack_start(information_button, False, False) information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID, self)) @@ -532,10 +532,15 @@ class WirelessSettingsDialog(AdvancedSettingsDialog): fields = methods[ID][type_] for field in fields: if language.has_key(field[1]): - box = LabelEntry(language[field[1].lower().replace(' ','_')]) + field_text = language[field[1].lower().replace(' ','_')] else: - box = LabelEntry(field[1].replace('_',' ')) - box.set_auto_hidden(True) + field_text = field[1].replace('_',' ') + + if field in methods[ID]['protected']: + box = ProtectedLabelEntry(field_text) + else: + box = LabelEntry(field_text) + self.vbox_encrypt_info.pack_start(box) # Add the data to a dict, so that the information # can be easily accessed by giving the name of the wanted diff --git a/wicd/misc.py b/wicd/misc.py index 5721fd5..cf75105 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -335,6 +335,7 @@ def _parse_enc_template(enctype): cur_type["fields"] = [] cur_type['optional'] = [] cur_type['required'] = [] + cur_type['protected'] = [] cur_type['name'] = "" for index, line in enumerate(f): if line.startswith("name") and not cur_type["name"]: @@ -353,6 +354,13 @@ def _parse_enc_template(enctype): # An error occured parsing the optional line. print "Invalid 'optional' line found in template %s" % enctype continue + elif line.startswith("protected"): + cur_type["protected"] = __parse_field_ent(parse_ent(line, "protected"), + field_type="protected") + if not cur_type["protected"]: + # An error occured parsing the protected line. + print "Invalid 'protected' line found in template %s" % enctype + continue elif line.startswith("----"): # We're done. break