Author: rhafer Date: Fri Jun 27 15:57:55 2008 New Revision: 48609 URL: http://svn.opensuse.org/viewcvs/yast?rev=48609&view=rev Log: Reworked TLS Dialog Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/tree_structure.ycp trunk/ldap-server/src/widgets.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev... ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 15:57:55 2008 @@ -551,5 +551,30 @@ } +BEGIN { $TYPEINFO {HaveCommonServerCertificate} = ["function", "boolean" ]; } +sub HaveCommonServerCertificate +{ + my $self = shift; + y2milestone("HaveCommonServerCertificate"); + + if (SCR->Read(".target.size", '/etc/ssl/certs/YaST-CA.pem') <= 0) + { + y2milestone("YaST-CA.pem does not exists"); + return YaST::YCP::Boolean(0); + } + + if (SCR->Read(".target.size", '/etc/ssl/servercerts/servercert.pem') <= 0 ) + { + y2milestone("Common server certificate file does not exist"); + return YaST::YCP::Boolean(0); + } + if ( SCR->Read(".target.size", '/etc/ssl/servercerts/serverkey.pem') <= 0 ) + { + y2milestone("Common server certificate key file does not exist"); + return YaST::YCP::Boolean(0); + } + return YaST::YCP::Boolean(1); +} + 1; # EOF Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.yc... ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:57:55 2008 @@ -382,18 +382,49 @@ ``{ y2milestone( "calling tls input handler" ); -// boolean common_ca_available = LdapServer::ReadCommonServerCertificateAvailable(); -// -// if( handler_cmd == `rb_yes ) -// { -// UI::ChangeWidget( `rt_tls_info, `Enabled, true ); -// UI::ChangeWidget( `pb_edit, `Enabled, true ); -// } else if( handler_cmd == `rb_no ) -// { -// UI::ChangeWidget( `rt_tls_info, `Enabled, false ); -// UI::ChangeWidget( `pb_edit, `Enabled, false ); -// } else if( handler_cmd == `pb_edit ) -// { + boolean common_cert_available = LdapServer::HaveCommonServerCertificate(); + + if( handler_cmd == `cb_tls_enabled ) + { + boolean tls_enabled_cb = (boolean)UI::QueryWidget( `cb_tls_enabled, `Value ); + if ( tls_enabled_cb ) + { + UI::ChangeWidget( `cb_ssl_listener_enabled, `Enabled, true ); + if ( common_cert_available ) + { + UI::ChangeWidget( `cb_use_common_cert, `Enabled, true ); + } else { + UI::ChangeWidget( `fr_import_cert, `Enabled, true ); + } + + } else { + UI::ChangeWidget( `cb_ssl_listener_enabled, `Enabled, false ); + UI::ChangeWidget( `cb_use_common_cert, `Enabled, false ); + UI::ChangeWidget( `fr_import_cert, `Enabled, false ); + } + } + else if( handler_cmd == `cb_use_common_cert ) + { + boolean use_common_cert = (boolean)UI::QueryWidget( `cb_use_common_cert, `Value ); + if ( use_common_cert ) + { + if ( common_cert_available ) + { + UI::ChangeWidget( `te_ca_file, `Value, "/etc/ssl/certs/YaST-CA.pem"); + UI::ChangeWidget( `te_cert_file, `Value, "/etc/ssl/servercerts/servercert.pem"); + UI::ChangeWidget( `te_key_file, `Value, "/etc/ssl/servercerts/servercert.pem"); + UI::ChangeWidget( `fr_import_cert, `Enabled, false ); + } else { + Popup::Error( _("A common server certificate is not available") ); + UI::ChangeWidget( `cb_use_common_cert, `Value, false ); + UI::ChangeWidget( `cb_use_common_cert, `Enabled, false ); + } + } else { + UI::ChangeWidget( `fr_import_cert, `Enabled, true ); + } + } + else if( handler_cmd == `pb_edit ) + { // //show edit popup // any ret = nil; // string dlg_name = common_ca_available ? "type" : "import"; @@ -513,7 +544,7 @@ // // UI::CloseDialog(); // eval( cb_read_tls() ); -// } + } //reread tls page return true; } @@ -1030,10 +1061,6 @@ /* Tree item */ "name" : _("TLS Settings"), "widget" : tlsWidget, - "dialogs" : $[ - "type" : tlsTypeWidget, - "import": tlsImportWidget, - ], "cb_check" : ``( cb_check_tls() ), "cb_read" : ``( cb_read_tls() ), "cb_write" : ``( cb_write_tls() ), Modified: trunk/ldap-server/src/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/widgets.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/widgets.ycp (original) +++ trunk/ldap-server/src/widgets.ycp Fri Jun 27 15:57:55 2008 @@ -140,79 +140,65 @@ term tlsWidget = `VBox( `Heading( _("TLS Settings") ), - `Frame( - _("TLS Active"), - `RadioButtonGroup( - `id( `rbg_tls ), - `HBox( - `RadioButton( `id( `rb_yes ), `opt( `notify ), Label::YesButton() ), - `RadioButton( `id( `rb_no ), `opt( `notify ), Label::NoButton() ) - ) - ) - ), - `RichText( `id( `rt_tls_info ), "" ), - `PushButton( `id( `pb_edit ), _("&Select Certificate...") ) - ); - - term tlsTypeWidget = - `VBox( - `Heading( _("Select Type") ), - `VSpacing( 1 ), - `RadioButtonGroup( - `id( `rbg_type ), - `VBox ( - `Left( - `RadioButton( `id( `rb_import ), _("&Import Certificates") ) - ), - `Left( - `RadioButton( `id( `rb_common ), _("Use C&ommon Server Certificate"), true ) - ) - ) - ), - `VSpacing( 1 ), - `HBox( - `PushButton( `id( `ok ), Label::OKButton() ), - `PushButton( `id( `cancel ), Label::CancelButton()) - ) - ); - - term tlsImportWidget = - `VBox( - `Heading( _("Import Certificate") ), - `VSpacing( 1 ), - `VSquash( - `HBox( - `TextEntry( `id( `te_cert_file ), _("Certificate &File (PEM Format)") ), - `HSpacing( 0.5 ), - `Bottom( - `PushButton( `id( `pb_cert_file ), _("&Browse...") ) - ) - ) - ), - `VSpacing( 0.5 ), - `VSquash( - `HBox( - `TextEntry( `id( `te_key_file ), _("Certificate &Key File (PEM Format -- Unencrypted)")+" " ), - `HSpacing( 0.5 ), - `Bottom( - `PushButton( `id( `pb_key_file ), _("B&rowse...") ) + `VBox( + `Frame( + _("Basic Settings"), + `VBox( + `Left( + `CheckBox( `id( `cb_tls_enabled ), `opt( `notify ) , + _("Enable TLS"), false ) + ), + `Left( + `CheckBox( `id( `cb_ssl_listener_enabled ), + _("Enable LDAP over SSL (ldaps) interface"), false ) + ), + `Left( + `CheckBox( `id( `cb_use_common_cert ), `opt( `notify ), + _("Use common Server Certificate"), false ) + ), + `HStretch() ) ) ), `VSpacing( 0.5 ), - `VSquash( - `HBox( - `TextEntry( `id( `te_ca_file ), _("C&A Certificate File (PEM Format)") ), - `HSpacing( 0.5 ), - `Bottom( - `PushButton( `id( `pb_ca_file ), _("Bro&wse...") ) + `VBox( + `Frame( `id( `fr_import_cert ), + _("Import Certificate"), + `VBox( + `VSquash( + `HBox( + `InputField( `id( `te_ca_file ), `opt( `hstretch ), + _("C&A Certificate File (PEM Format)") ), + `HSpacing( 0.5 ), + `Bottom( + `PushButton( `id( `pb_ca_file ), _("Bro&wse...") ) + ) + ) + ), + `VSpacing( 0.5 ), + `VSquash( + `HBox( + `InputField( `id( `te_cert_file ), `opt( `hstretch ), + _("Certificate &File (PEM Format)") ), + `HSpacing( 0.5 ), + `Bottom( + `PushButton( `id( `pb_cert_file ), _("&Browse...") ) + ) + ) + ), + `VSpacing( 0.5 ), + `VSquash( + `HBox( + `InputField( `id( `te_key_file ), `opt( `hstretch ), + _("Certificate &Key File (PEM Format -- Unencrypted)") ), + `HSpacing( 0.5 ), + `Bottom( + `PushButton( `id( `pb_key_file ), _("B&rowse...") ) + ) + ) + ) ) ) - ), - `VSpacing( 1 ), - `HBox( - `PushButton( `id( `ok ), Label::OKButton() ), - `PushButton( `id( `cancel ), Label::CancelButton() ) ) ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org