Author: openvasfelix Date: Tue Feb 9 12:54:07 2010 New Revision: 60755 URL: http://svn.opensuse.org/viewcvs/yast?rev=60755&view=rev Log: * src/complex.ycp: Check if at least one user exists and return appropriate value * src/helps.ycp: Added (unpolished) help text for add user page. * src/dialogs.ycp: Added missing shortcut to inputfield, new function to create add user dialog. * src/wizards.ycp: Added add user page to sequencer. Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/complex.ycp branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/wizards.ycp Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/complex.ycp?rev=60755&r1=60754&r2=60755&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/complex.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/complex.ycp Tue Feb 9 12:54:07 2010 @@ -50,7 +50,16 @@ //OpenvasSecurityScanner::SetAbortFunction(PollAbort); if (!Confirm::MustBeRoot()) return `abort; boolean ret = OpenvasSecurityScanner::Read(); - return ret ? `next : `abort; + /* Check if at least one user exist, if not, forward to user creation page */ + if (ret) + { + if (OpenvasSecurityScanner::CheckUserExists() == true) + return `next; + else + return `addUser; + } + else + return `abort; } /** Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp?rev=60755&r1=60754&r2=60755&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp Tue Feb 9 12:54:07 2010 @@ -34,6 +34,7 @@ import "Label"; import "Wizard"; import "OpenvasSecurityScanner"; +import "Popup"; include "openvas-security-scanner/helps.ycp"; @@ -87,7 +88,7 @@ integer w = 38; term contents = `VBox (`Frame ("Security Scanner Service", `MinSize (w, 0, radio_box)), `VSpacing (1), `Frame ("Professional Feed Subscriptions", `MinSize (w, 0, gsf_box)), `VSpacing (1), - `Frame ("Manual Feed Management", `MinSize (w, 0, `VBox (sync_now_button)))); + `Frame ("Manual Feed Management", `MinSize (w, 0, `VBox (sync_now_button))), `VSpacing (1) ); Wizard::SetContentsButtons (caption, contents, HELPS["configuration"]:"", @@ -172,7 +173,7 @@ string caption = _("Greenbone Security Feed installation"); - term contents = `VBox (`InputField(`id(`gsf_location), _("Path to directory containing the Greenbone Security Feed Files"), "")); + term contents = `VBox (`InputField(`id(`gsf_location), _("&Path to directory containing the Greenbone Security Feed Files"), "")); Wizard::SetContentsButtons (caption, contents, HELPS["activategsf"]:"", @@ -227,6 +228,70 @@ } +/** + * Dialog to create an (openvas) user. + * + * @return Yet unused next or abort. + * @todo Implement behaviour based on choice (return). + */ +any AddUserDialog () { + string caption = _("Add User to OpenVAS Security Scanner"); + string message = _("In order for the OpenVAS Security Scanner to work, a user has to be installed."); + + term contents = `VBox (`Label(message), + `InputField(`id(`user_login), _("&Login of the user"), "")); + contents = add (contents, `Password(`id(`user_pass), _("&Password for user"), "")); + contents = add (contents, `Password(`id(`user_pass_again), _("P&assword for user (again)"), "")); + + Wizard::SetContentsButtons (caption, contents, + HELPS["adduser"]:"", // @todo Create and reference help text + Label::BackButton(), Label::NextButton()); + Wizard::DisableBackButton (); + + any ret = nil; + + /** @todo Nicer wording when displaying text what happens (no user ... has to be created ... ). */ + while (true) { + ret = UI::UserInput (); + if (ret == `abort) + { + break; + } + else if (ret == `next) + { + /* Assuming location is correct */ + any login = UI::QueryWidget(`id(`user_login), `Value); + any pw1 = UI::QueryWidget(`id(`user_pass), `Value); + any pw2 = UI::QueryWidget(`id(`user_pass_again), `Value); + if (pw1 == pw2) + { + string addUserCmd = "printf \"" + (string) login + "\n\n" + (string) pw1 + "\n" + (string) pw2 + "\n\n\" | openvas-adduser"; + + integer ret = (integer) SCR::Execute (.target.bash, addUserCmd); + if (ret != 0) Popup::Message ("Error creating user, try to create it yourself with openvas-adduser and inspect messages."); + + Wizard::RestoreBackButton (); + return `next; + } + else + { + Popup::Message("Must enter equal passwords"); + continue; + } + break; + } + else + { + y2error ("unexpected return code: %1", ret); + continue; + } + } + + Wizard::RestoreBackButton (); + return ret; +} + + /* EOF */ } Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp?rev=60755&r1=60754&r2=60755&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp Tue Feb 9 12:54:07 2010 @@ -124,7 +124,19 @@ + _("previous NVT datastores will be deleted, which might take some time. ") + _("Note that in order to synchronize with a feed, the scanner service has to be stopped. It will be restarted once the synchronization is finished. ") + _("Click <b>abort</b> to abort this action.") - + "</p></p>" + + "</p></p>", + + "adduser" : _("<p><b><big>Add User to OpenVAS Security Scanner</big></b></br> +<p>A working installation of the OpenVAS Security Scanner has at least one user installed. +Note that this user is specific to OpenVAS.</p> +<p><b>Login of the user</b>: Type the user login name here.</p> +<p><b>Password for user</b>: Type the password for the user here.</p> +<p><b>Password for user (again)</b>: Type the password for the user here, again.</p> +</p>") +/*_("Login of the user"), "")); + contents = add (contents, `Password(`id(`user_pass), _("Password for user"), "")); + contents = add (contents, `Password(`id(`user_pass_again), _("Password for user (again)"), ""));*/ + ]; /* EOF */ Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/wizards.ycp?rev=60755&r1=60754&r2=60755&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/wizards.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/wizards.ycp Tue Feb 9 12:54:07 2010 @@ -94,6 +94,7 @@ any OpenvasSecurityScannerSequence () { map aliases = $[ "read" : [ ``( ReadDialog () ), true ], + "adduser" : ``( AddUserDialog () ), "main" : ``( MainSequence () ), "feed_fetch" : ``( FetchFeedDialog () ), "enter_gsf" : ``( EnterGSFLocationDialog () ), @@ -106,8 +107,13 @@ "ws_start" : "read", "read" : $[ `abort : `abort, + `addUser : "adduser", `next : "main" ], + "adduser" : $[ + `abort : `abort, + `next : "main" + ], "main" : $[ `abort : `abort, `feedsync_now : "feed_fetch", -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org