Mailinglist Archive: yast-commit (939 mails)
| < Previous | Next > |
[yast-commit] r52918 - /trunk/audit-laf/src/complex.ycp
- From: gs@xxxxxxxxxxxxxxxx
- Date: Wed, 05 Nov 2008 12:37:45 -0000
- Message-id: <20081105123745.5B52AA06A7@xxxxxxxxxxxxxxxx>
Author: gs
Date: Wed Nov 5 13:37:45 2008
New Revision: 52918
URL: http://svn.opensuse.org/viewcvs/yast?rev=52918&view=rev
Log:
check script specified on option EXEC
Modified:
trunk/audit-laf/src/complex.ycp
Modified: trunk/audit-laf/src/complex.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/audit-laf/src/complex.ycp?rev=52918&r1=52917&r2=52918&view=diff
==============================================================================
--- trunk/audit-laf/src/complex.ycp (original)
+++ trunk/audit-laf/src/complex.ycp Wed Nov 5 13:37:45 2008
@@ -37,6 +37,7 @@
import "Confirm";
import "AuditLaf";
import "Report";
+import "FileUtils";
include "audit-laf/helps.ycp";
@@ -300,6 +301,35 @@
return nil;
}
+boolean CheckExec( string file )
+{
+ boolean ret = true;
+
+ if ( ! FileUtils::Exists( file ) )
+ {
+ Report::Error( sformat( "%1 doesn't exist", file ) );
+ ret = false;
+ }
+ else if ( FileUtils::GetOwnerGroupID( file ) != 0 ||
+ FileUtils::GetOwnerUserID( file ) != 0 )
+ {
+ Report::Error( sformat( "%1 not owned by root", file ) );
+ ret = false;
+ }
+ else
+ {
+ // check permissions
+ map output = (map)SCR::Execute(.target.bash_output, sformat("ls -al
%1", file ) );
+ if ( substring ( output["stdout"]:"", 0, 9 ) != "-rwxr-x---" )
+ {
+ Report::Error( sformat( "File permissiones of %1 NOT set to
-rwxr-x---", file ) );
+ ret = false;
+ }
+ }
+
+ return ret;
+}
+
/*
* Store all settings made in disk space dialog
*/
@@ -326,9 +356,11 @@
if ( option == "EXEC" )
{
exec = (string)UI::QueryWidget( `id(key+"_exec"), `Value
);
- AuditLaf::SetAuditdOption( key, option + " " + exec );
+ if ( CheckExec( exec ) )
+ {
+ AuditLaf::SetAuditdOption( key, option + " " + exec
);
+ }
}
-
else
{
AuditLaf::SetAuditdOption( key, option );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Wed Nov 5 13:37:45 2008
New Revision: 52918
URL: http://svn.opensuse.org/viewcvs/yast?rev=52918&view=rev
Log:
check script specified on option EXEC
Modified:
trunk/audit-laf/src/complex.ycp
Modified: trunk/audit-laf/src/complex.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/audit-laf/src/complex.ycp?rev=52918&r1=52917&r2=52918&view=diff
==============================================================================
--- trunk/audit-laf/src/complex.ycp (original)
+++ trunk/audit-laf/src/complex.ycp Wed Nov 5 13:37:45 2008
@@ -37,6 +37,7 @@
import "Confirm";
import "AuditLaf";
import "Report";
+import "FileUtils";
include "audit-laf/helps.ycp";
@@ -300,6 +301,35 @@
return nil;
}
+boolean CheckExec( string file )
+{
+ boolean ret = true;
+
+ if ( ! FileUtils::Exists( file ) )
+ {
+ Report::Error( sformat( "%1 doesn't exist", file ) );
+ ret = false;
+ }
+ else if ( FileUtils::GetOwnerGroupID( file ) != 0 ||
+ FileUtils::GetOwnerUserID( file ) != 0 )
+ {
+ Report::Error( sformat( "%1 not owned by root", file ) );
+ ret = false;
+ }
+ else
+ {
+ // check permissions
+ map output = (map)SCR::Execute(.target.bash_output, sformat("ls -al
%1", file ) );
+ if ( substring ( output["stdout"]:"", 0, 9 ) != "-rwxr-x---" )
+ {
+ Report::Error( sformat( "File permissiones of %1 NOT set to
-rwxr-x---", file ) );
+ ret = false;
+ }
+ }
+
+ return ret;
+}
+
/*
* Store all settings made in disk space dialog
*/
@@ -326,9 +356,11 @@
if ( option == "EXEC" )
{
exec = (string)UI::QueryWidget( `id(key+"_exec"), `Value
);
- AuditLaf::SetAuditdOption( key, option + " " + exec );
+ if ( CheckExec( exec ) )
+ {
+ AuditLaf::SetAuditdOption( key, option + " " + exec
);
+ }
}
-
else
{
AuditLaf::SetAuditdOption( key, option );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |