[yast-commit] r49790 - in /trunk/auditd/src: complex.ycp dialogs.ycp
Author: gs Date: Wed Aug 6 17:32:43 2008 New Revision: 49790 URL: http://svn.opensuse.org/viewcvs/yast?rev=49790&view=rev Log: add a test, restore and reset button to rules dialog Modified: trunk/auditd/src/complex.ycp trunk/auditd/src/dialogs.ycp Modified: trunk/auditd/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/complex.ycp?rev=49790&r1=49789&r2=49790&view=diff ============================================================================== --- trunk/auditd/src/complex.ycp (original) +++ trunk/auditd/src/complex.ycp Wed Aug 6 17:32:43 2008 @@ -244,6 +244,42 @@ UI::ChangeWidget(`id("rules"), `Value, mergestring( new_rules, "\n" ) ); } } + else if ( action == "restore" ) + { + UI::ChangeWidget( `id("rules"), `Value, Auditd::GetRules() ); + } + else if ( action == "reset" ) + { + UI::ChangeWidget( `id("rules"), `Value, Auditd::GetRules() ); + integer exit_code = (integer)SCR::Execute( .target.bash, "auditctl -D" ); + if ( exit_code == 0 ) + exit_code = (integer)SCR::Execute( .target.bash, "auditctl -R /etc/audit/audit.rules" ); + if ( exit_code == 0 ) + Popup::Message( _("Rules successfully restored" ) ); + else + Report::Error( _("Cannot reset rules, please test again" ) ); + } + else if ( action == "test" ) + { + boolean success = (boolean)SCR::Write(.target.string, "/tmp/tmp_rules_file", + (string)UI::QueryWidget( `id("rules"), `Value ) ); + if ( success ) + { + map output = (map)SCR::Execute(.target.bash_output, "auditctl -R /tmp/tmp_rules_file" ); + if ( output["exit"]:0 != 0 ) + { + Report::Error( sformat( output["stderr"]:"" ) ); + } + else + { + Popup::Message( "Success"); + } + } + else + { + Report::Error( _("Cannnot create tmp file for rules" ) ); + } + } return nil; } Modified: trunk/auditd/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/dialogs.ycp?rev=49790&r1=49789&r2=49790&view=diff ============================================================================== --- trunk/auditd/src/dialogs.ycp (original) +++ trunk/auditd/src/dialogs.ycp Wed Aug 6 17:32:43 2008 @@ -193,11 +193,19 @@ )), `VStretch() ) - ) ) , - `VWeight( 80, `VBox( - `Left(`Label(_("Edit rules for audit daemon here:") ) ), + ) ), + `VWeight( 70, `VBox( + `Left(`Label(_("Edit rules for audit subsystem here:") ) ), `MultiLineEdit(`id("rules"), Auditd::GetRulesFile() ) - ) + + ) ), + `VWeight( 10, + `HBox(`PushButton( `id( "test" ), _("Test") ), + `HSpacing(2.0), + `PushButton( `id( "restore" ), _("Restore 'audit.rules'") ), + `HSpacing(2.0), + `PushButton( `id( "reset" ), _("Restore and Reset") ) + ) ), `VStretch() ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn.opensuse.org