Author: locilka Date: Wed Dec 10 18:13:12 2008 New Revision: 54039 URL: http://svn.opensuse.org/viewcvs/yast?rev=54039&view=rev Log: - Added missing functionality to add and remove supported ciphers (bnc #455969). - 2.17.1 Modified: trunk/sshd/VERSION trunk/sshd/package/yast2-sshd.changes trunk/sshd/src/Sshd.ycp trunk/sshd/src/complex.ycp trunk/sshd/src/dialogs.ycp Modified: trunk/sshd/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/sshd/VERSION?rev=54039&r1=54038&r2=54039&view=diff ============================================================================== --- trunk/sshd/VERSION (original) +++ trunk/sshd/VERSION Wed Dec 10 18:13:12 2008 @@ -1 +1 @@ -2.17.0 +2.17.1 Modified: trunk/sshd/package/yast2-sshd.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/sshd/package/yast2-sshd.changes?rev=54039&r1=54038&r2=54039&view=diff ============================================================================== --- trunk/sshd/package/yast2-sshd.changes (original) +++ trunk/sshd/package/yast2-sshd.changes Wed Dec 10 18:13:12 2008 @@ -2,6 +2,9 @@ Wed Dec 10 16:43:46 CET 2008 - locilka@suse.cz - Forgotten text marked for translation (bnc #450474). +- Added missing functionality to add and remove supported ciphers + (bnc #455969). +- 2.17.1 ------------------------------------------------------------------- Wed Dec 3 15:39:06 CET 2008 - locilka@suse.cz Modified: trunk/sshd/src/Sshd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sshd/src/Sshd.ycp?rev=54039&r1=54038&r2=54039&view=diff ============================================================================== --- trunk/sshd/src/Sshd.ycp (original) +++ trunk/sshd/src/Sshd.ycp Wed Dec 10 18:13:12 2008 @@ -63,7 +63,7 @@ "PasswordAuthentication" : ["yes"], "RSAAuthentication" : ["no"], "PubkeyAuthentication" : ["yes"], - "Cipher" : ["aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr"], + "Ciphers" : ["aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr"], ]; /** Modified: trunk/sshd/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sshd/src/complex.ycp?rev=54039&r1=54038&r2=54039&view=diff ============================================================================== --- trunk/sshd/src/complex.ycp (original) +++ trunk/sshd/src/complex.ycp Wed Dec 10 18:13:12 2008 @@ -74,33 +74,43 @@ */ void InitCipherTable () { - list <string> wrk = Sshd::GetDefaultSSHDOption("Cipher"); - list <string> defaults = splitstring(wrk[0]:"",","); - list <string> ciphers = []; - list <term> default_items = []; - list <term> items = []; - - if (defaults != nil && defaults != []) { - foreach (string cipher, defaults,{ - items = add (items, `item(`id(cipher), cipher)); - }); - //For combo box - list all supported c's - UI::ChangeWidget(`id("supported_ciphers"), `Items, default_items); - - - foreach (string cipher, ciphers,{ - items = add (items, `item(`id(cipher), cipher)); - }); - - UI::ChangeWidget(`id("Ciphers"),`Items, items); - UI::ChangeWidget(`id("add_cipher"), `Enabled, true); - UI::ChangeWidget(`id("remove_cipher"), `Enabled, true); - } - else { - UI::ChangeWidget(`id("Ciphers"),`Items,defaults); - UI::ChangeWidget(`id("Ciphers"),`Items, []); - UI::ChangeWidget(`id("remove_cipher"), `Enabled, false); - } + list <string> tmp_list = Sshd::GetDefaultSSHDOption ("Ciphers"); + list <string> defaults = sort (splitstring (tmp_list[0]:"", ", ")); + + tmp_list = Sshd::GetSSHDOption ("Ciphers"); + list <string> current_ciphers = sort (splitstring (tmp_list[0]:"", ", ")); + + // nil must have been set before + // it says the item should be removed from config and use the 'default' settings + if (tmp_list == nil) + current_ciphers = defaults; + + // ciphers to enable + list <term> combobox_items = []; + // all enabled ciphers + list <term> table_items = []; + + // all default (known) ciphers + foreach (string cipher, defaults, { + // cipher is enabled + if (contains (current_ciphers, cipher)) { + table_items = add (table_items, `item (`id (cipher), cipher)); + // cipher is disabled + } else { + combobox_items = add (combobox_items, `item (`id (cipher), cipher)); + } + }); + + UI::ChangeWidget (`id ("supported_ciphers"), `Items, combobox_items); + UI::ChangeWidget (`id ("Ciphers"), `Items, table_items); + + // some cipher(s) are allowed -> allow removing them + UI::ChangeWidget (`id ("remove_cipher"), `Enabled, (table_items != nil && size (table_items) > 0)); + UI::ChangeWidget (`id ("Ciphers"), `Enabled, (table_items != nil && size (table_items) > 0)); + + // some cipher(s) are not allowed -> allow adding them + UI::ChangeWidget (`id ("add_cipher"), `Enabled, (table_items != nil && size (combobox_items) > 0)); + UI::ChangeWidget (`id ("supported_ciphers"), `Enabled, (table_items != nil && size (combobox_items) > 0)); } /* @@ -277,14 +287,56 @@ symbol HandleProtocolConfigurationDialog (string id, map event) { any action = event["ID"]:nil; + list <string> tmp_list = Sshd::GetSSHDOption ("Ciphers"); + + // nil must have been set before + // it says the item should be removed from config and use the 'default' settings + if (tmp_list == nil) + tmp_list = Sshd::GetDefaultSSHDOption ("Ciphers"); + + list <string> ciphers = sort (splitstring (tmp_list[0]:"", ", ")); + list <string> backup = ciphers; + if (action == "remove_cipher") { - // FIXME - y2error ("Removing ciphers not yet supported"); + string cipher_to_remove = (string) UI::QueryWidget (`id ("Ciphers"), `CurrentItem); + if (Confirm::Delete (cipher_to_remove)) { + y2milestone ("Removing: %1", cipher_to_remove); + + ciphers = filter (string one_cipher, ciphers, { + return (one_cipher != cipher_to_remove); + }); + } } else if (action == "add_cipher") { string cipher_to_add = (string) UI::QueryWidget (`id ("supported_ciphers"), `Value); - // FIXME - y2error ("Adding ciphers not yet supported"); + y2milestone ("Adding: %1", cipher_to_add); + + if (cipher_to_add != nil) { + ciphers = toset (add (ciphers, cipher_to_add)); + } + } + + // Nothing has changed + if (ciphers == backup) { + return nil; + } + + if (ciphers != nil) { + list <string> tmp_list = Sshd::GetDefaultSSHDOption ("Ciphers"); + list <string> defaults = sort (splitstring (tmp_list[0]:"", ", ")); + + // the default ciphers -> remove the entry completely + if (ciphers == defaults) { + Sshd::SetSSHDOption ("Ciphers", nil); + } else { + Sshd::SetSSHDOption ("Ciphers", [mergestring (ciphers, ",")]); + } + } else { + y2error ("Ciphers: %1", ciphers); } + + InitCipherTable(); + + return nil; } /** Modified: trunk/sshd/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sshd/src/dialogs.ycp?rev=54039&r1=54038&r2=54039&view=diff ============================================================================== --- trunk/sshd/src/dialogs.ycp (original) +++ trunk/sshd/src/dialogs.ycp Wed Dec 10 18:13:12 2008 @@ -114,7 +114,7 @@ `VBox ( `VSpacing( 1.1 ), `PushButton ( `id ( "add_cipher" ), `opt ( `hstretch ), " " + Label::AddButton() + " "), - `PushButton ( `id ( "remove_cipher" ), `opt ( `hstretch ), " " + Label::RemoveButton() + " "), + `PushButton ( `id ( "remove_cipher" ), `opt ( `hstretch ), " " + Label::DeleteButton() + " "), `Empty(`opt(`vstretch)) ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org