Author: gs
Date: Tue Feb 3 11:09:43 2009
New Revision: 55201
URL: http://svn.opensuse.org/viewcvs/yast?rev=55201&view=rev
Log:
save inititial settings to be able to decide whether
changes are made
Modified:
trunk/audit-laf/src/AuditLaf.ycp
trunk/audit-laf/src/complex.ycp
Modified: trunk/audit-laf/src/AuditLaf.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/audit-laf/src/AuditLaf.ycp?rev=55201&r1=55200&r2=55201&view=diff
==============================================================================
--- trunk/audit-laf/src/AuditLaf.ycp (original)
+++ trunk/audit-laf/src/AuditLaf.ycp Tue Feb 3 11:09:43 2009
@@ -44,10 +44,6 @@
import "Service";
-/**
- * Prototypes
- */
-global boolean Modified();
/**
* Data was modified?
@@ -80,9 +76,9 @@
boolean rules_locked = false;
/*
- * The rules have been checked
+ * The rules have been changed (sent to 'autitctl' to check the syntax)
*/
-boolean rules_checked = false;
+boolean rules_changed = false;
global void SetRulesLocked( boolean value ) {
@@ -94,11 +90,11 @@
}
global void SetRulesChanged( boolean value ) {
- rules_checked = value;
+ rules_changed = value;
}
global boolean RulesChanged() {
- return rules_checked;
+ return rules_changed;
}
/**
@@ -134,6 +130,8 @@
modified = value;
}
+
+
global boolean ProposalValid() {
return proposal_valid;
}
@@ -241,9 +239,15 @@
"disk_error_action" : "SUSPEND"
];
+/*
+ * Save settings initially read from /etc/audit/auditd.conf to be able
+ * to decide whether changes are made
+ */
+map INITIAL_SETTINGS = $[];
+
/**
* Rules for the subsystem audit (passed via auditctl).
- * Iinitially read from /etc/audit/audit.rules and edited in
+ * Initially read from /etc/audit/audit.rules and edited in
* the rules editor.
*/
string RULES = "";
@@ -253,6 +257,16 @@
*/
string INITIAL_RULES = "";
+/*
+ * Set data modified only if really has changed
+ */
+global void SetDataModified() {
+ if ( INITIAL_SETTINGS != SETTINGS || INITIAL_RULES != RULES )
+ modified = true;
+ else
+ modified = false;
+}
+
/**
* Get value of given option from SEETINGS
*/
@@ -311,7 +325,7 @@
if ( rules != nil && rules != "" )
{
RULES = rules;
- // additionally save initial settings
+ // additionally save initial rules
INITIAL_RULES = rules;
return true;
}
@@ -349,6 +363,9 @@
if (val != nil) SETTINGS[key] = val;
});
+ // additionally save initial settings
+ INITIAL_SETTINGS = SETTINGS;
+
y2milestone("%1 has been read: %2", config_file, SETTINGS);
return true;
}
Modified: trunk/audit-laf/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/audit-laf/src/complex.ycp?rev=55201&r1=55200&r2=55201&view=diff
==============================================================================
--- trunk/audit-laf/src/complex.ycp (original)
+++ trunk/audit-laf/src/complex.ycp Tue Feb 3 11:09:43 2009
@@ -143,8 +143,6 @@
*/
void StoreLogfileSettingsDialog (string id, map event) {
- AuditLaf::SetModified( true );
-
// Store all values in SETTINGS
AuditLaf::SetAuditdOption( "freq", tostring( (integer)UI::QueryWidget( `id("freq"), `Value ) ) );
AuditLaf::SetAuditdOption( "num_logs", tostring( (integer)UI::QueryWidget( `id("num_logs"), `Value ) ) );
@@ -174,6 +172,8 @@
}
}
+ AuditLaf::SetDataModified();
+
y2milestone( "Store log file settings" );
}
@@ -214,14 +214,14 @@
*/
void StoreDispatcherDialog (string id, map event) {
- AuditLaf::SetModified( true );
-
// Store all values in SETTINGS
foreach (string key, ["dispatcher",
"disp_qos"], {
AuditLaf::SetAuditdOption( key, (string) UI::QueryWidget(`id(key), `Value) );
});
+ AuditLaf::SetDataModified( );
+
y2milestone( "Store dispatcher dialog" );
}
@@ -303,17 +303,17 @@
if ( ! FileUtils::Exists( file ) )
{
- Report::Error( sformat( "%1 doesn't exist.\n", file ) + message );
+ Report::Error( sformat(_("%1 doesn't exist.\n"), file ) + message );
ret = false;
}
else if ( ! FileUtils::IsFile( file ) )
{
- Report::Error( sformat( "%1 is not a regular file.\n", file ) + message );
+ Report::Error( sformat(_("%1 is not a regular file.\n"), file ) + message );
ret = false;
}
else if ( FileUtils::GetOwnerUserID( file ) != 0 )
{
- Report::Error( sformat( "%1 not owned by root.\n", file ) + message );
+ Report::Error( sformat(_("%1 not owned by root.\n"), file ) + message );
ret = false;
}
else
@@ -323,7 +323,7 @@
if ( substring ( output["stdout"]:"", 0, 10 ) != "-rwxr-x---" )
{
- Report::Error( sformat( "File permissiones of %1 NOT set to -rwxr-x---.\n", file ) + message );
+ Report::Error( sformat(_("File permissiones of %1 NOT set to -rwxr-x---.\n"), file ) + message );
ret = false;
}
}
@@ -338,8 +338,6 @@
string option = "";
string exec = "";
- AuditLaf::SetModified( true );
-
foreach ( string key, ["space_left",
"action_mail_acct",
"admin_space_left"
@@ -367,6 +365,8 @@
AuditLaf::SetAuditdOption( key, option );
}
});
+
+ AuditLaf::SetDataModified( );
y2milestone( "Store disk space settings" );
}
@@ -576,12 +576,12 @@
*/
void StoreRulesDialog( string id, map event) {
- AuditLaf::SetModified( true );
-
string rules = (string)UI::QueryWidget( `id("rules"), `Value );
AuditLaf::SetRules( rules );
+ AuditLaf::SetDataModified( );
+
y2debug( "RULES: %1", rules );
y2milestone( "Store rules dialog" );
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org