Author: jsuchome Date: Wed Feb 22 16:39:30 2012 New Revision: 67527 URL: http://svn.opensuse.org/viewcvs/yast?rev=67527&view=rev Log: - fixed handling of certificate download - 2.22.5 Modified: trunk/ldap-client/VERSION trunk/ldap-client/package/yast2-ldap-client.changes trunk/ldap-client/src/ui.ycp Modified: trunk/ldap-client/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-client/VERSION?rev=67527&r1=67526&r2=67527&view=diff ============================================================================== --- trunk/ldap-client/VERSION (original) +++ trunk/ldap-client/VERSION Wed Feb 22 16:39:30 2012 @@ -1 +1 @@ -2.22.4 +2.22.5 Modified: trunk/ldap-client/package/yast2-ldap-client.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-client/package/yast2-ldap-client.changes?rev=67527&r1=67526&r2=67527&view=diff ============================================================================== --- trunk/ldap-client/package/yast2-ldap-client.changes (original) +++ trunk/ldap-client/package/yast2-ldap-client.changes Wed Feb 22 16:39:30 2012 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Feb 22 16:38:12 CET 2012 - jsuchome@suse.cz + +- fixed handling of certificate download +- 2.22.5 + +------------------------------------------------------------------- Tue Feb 21 11:06:29 CET 2012 - jsuchome@suse.cz - removed password policies configuration from client, relevant parts Modified: trunk/ldap-client/src/ui.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-client/src/ui.ycp?rev=67527&r1=67526&r2=67527&view=diff ============================================================================== --- trunk/ldap-client/src/ui.ycp (original) +++ trunk/ldap-client/src/ui.ycp Wed Feb 22 16:39:30 2012 @@ -183,6 +183,7 @@ */ boolean SSLConfiguration () { + string certTmpFile = sformat ("%1/__LDAPcert.crt", Directory::tmpdir); string tls_cacertdir = Ldap::tls_cacertdir; string tls_cacertfile = Ldap::tls_cacertfile; UI::OpenDialog (`opt (`decorated), `HBox (`HSpacing (1), `VBox( @@ -247,6 +248,50 @@ UI::ChangeWidget (`id (`tls_cacertfile), `Value, file); } } + if (ret == `import_cert) + { + string dir = tls_cacertdir; + if (dir == "") + dir = "/etc/openldap/cacerts/"; + + boolean success = false; + string name = ""; + + string cert_url = (string) UI::QueryWidget (`id (`url), `Value); + string curlcmd = sformat("curl -f --connect-timeout 60 --max-time 120 '%1' -o %2", cert_url, certTmpFile); + + if (SCR::Execute(.target.bash, curlcmd) != 0) + { + // error message + Popup::Error (_("Could not download the certificate file from specified URL.")); + } + else if (FileUtils::CheckAndCreatePath (dir)) + { + list <string> l = splitstring (cert_url, "/"); + name = l[size(l) - 1]:"downloaded-by-yast2-ldap-client.pem"; + success = SCR::Execute (.target.bash, sformat ("/bin/cp -a '%1' '%2/%3'", certTmpFile, dir, name)) == 0; + // rehash cert directory (bnc#662937) + map out = (map)SCR::Execute (.target.bash_output, sformat ("/usr/bin/c_rehash %1", dir)); + if (out["stderr"]:"" != "") + { + y2error ("something went wrong: %1", out); + } + } + + if (success) + { + // popup message, %1 is file name, %2 directory + Popup::Message (sformat (_("The downloaded certificate file + +'%1' + +has been copied to '%2' directory. +"), name, dir)); + + tls_cacertdir = dir; + Ldap::modified = true; + } + } } while (ret != `ok && ret != `cancel); UI::CloseDialog (); @@ -323,7 +368,6 @@ boolean ldap_tls = Ldap::ldap_tls || Ldap::sssd; // force TLS to true if sssd is used string tls_checkpeer = Ldap::tls_checkpeer; boolean login_enabled = Ldap::login_enabled; - string certTmpFile = sformat ("%1/__LDAPcert.crt", Directory::tmpdir); boolean ssl_changed = false; boolean autofs = Ldap::_start_autofs; term autofs_con = `Empty (); @@ -474,82 +518,6 @@ UI::ChangeWidget (`id (`ldaps), `Value, false); } } - if (result == `import_cert) - { - string dir = Ldap::tls_cacertdir; - if (Ldap::tls_cacertdir == "") - dir = "/etc/openldap/cacerts/"; - - UI::OpenDialog ( `opt(`decorated), `HBox( - `HSpacing(1), - `VBox ( - `HSpacing (75), - // InputField label - `InputField (`id (`url), `opt (`hstretch), - _("CA Certificate URL for Download")), - `ButtonBox ( - `PushButton(`id(`ok),`opt(`default,`key_F10), Label::OKButton()), - `PushButton(`id(`cancel),`opt (`key_F9), Label::CancelButton()) - ) - ), - `HSpacing(1) - )); - UI::SetFocus (`id (`url)); - - any ret = nil; - boolean success = false; - string name = ""; - - while (true) - { - ret = UI::UserInput (); - if (ret == `cancel) - break; - if (ret == `ok) - { - string cert_url = (string) UI::QueryWidget (`id (`url), `Value); - string curlcmd = sformat("curl -f --connect-timeout 60 --max-time 120 '%1' -o %2", cert_url, certTmpFile); - - if (SCR::Execute(.target.bash, curlcmd) != 0) - { - // error message - Popup::Error (_("Could not download the certificate file from specified URL.")); - } - else if (FileUtils::CheckAndCreatePath (dir)) - { - list <string> l = splitstring (cert_url, "/"); - name = l[size(l) - 1]:"downloaded-by-yast2-ldap-client.pem"; - success = SCR::Execute (.target.bash, sformat ("/bin/cp -a '%1' '%2/%3'", certTmpFile, dir, name)) == 0; - // rehash cert directory (bnc#662937) - map out = (map)SCR::Execute (.target.bash_output, sformat ("/usr/bin/c_rehash %1", dir)); - if (out["stderr"]:"" != "") - { - y2error ("something went wrong: %1", out); - } - break; - } - } - } - UI::CloseDialog (); - - if (ret == `cancel) - { - continue; - } - if (success) - { - // popup message, %1 is file name, %2 directory - Popup::Message (sformat (_("The downloaded certificate file - -'%1' - -has been copied to '%2' directory. -"), name, dir)); - - Ldap::tls_cacertdir = dir; - Ldap::modified = true; - } - } if (result == `next || result == `advanced) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org