Author: gs Date: Thu Nov 6 12:54:59 2008 New Revision: 52976 URL: http://svn.opensuse.org/viewcvs/yast?rev=52976&view=rev Log: improve CheckExec 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=52976&r1=52975&r2=52976&view=diff ============================================================================== --- trunk/audit-laf/src/complex.ycp (original) +++ trunk/audit-laf/src/complex.ycp Thu Nov 6 12:54:59 2008 @@ -301,19 +301,26 @@ return nil; } -boolean CheckExec( string file ) +boolean CheckExec( string file, string key ) { + // Check the executable like done in audit package (see audit-1.7.7/src/auditd-config.c) boolean ret = true; + // Second part of an error message: the value won't be changed because of previous error + string message = sformat(_("Value of '%1' remains unchanged."), key ); if ( ! FileUtils::Exists( file ) ) { - Report::Error( sformat( "%1 doesn't exist", file ) ); + Report::Error( sformat( "%1 doesn't exist.\n", file ) + message ); ret = false; } - else if ( FileUtils::GetOwnerGroupID( file ) != 0 || - FileUtils::GetOwnerUserID( file ) != 0 ) + else if ( ! FileUtils::IsFile( file ) ) { - Report::Error( sformat( "%1 not owned by root", file ) ); + 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 ); ret = false; } else @@ -323,7 +330,7 @@ if ( substring ( output["stdout"]:"", 0, 10 ) != "-rwxr-x---" ) { - Report::Error( sformat( "File permissiones of %1 NOT set to -rwxr-x---", file ) ); + Report::Error( sformat( "File permissiones of %1 NOT set to -rwxr-x---.\n", file ) + message ); ret = false; } } @@ -357,7 +364,7 @@ if ( option == "EXEC" ) { exec = (string)UI::QueryWidget( `id(key+"_exec"), `Value ); - if ( CheckExec( exec ) ) + if ( CheckExec( exec, key ) ) { AuditLaf::SetAuditdOption( key, option + " " + exec ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org