summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2010-04-07 20:00:29 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2010-04-07 20:00:29 +0000
commitaf49c4a01c342806bf4cb3d5229ef08da64da5e9 (patch)
tree0dc7201e85f9d1e19cc900b6779aa37b5540af23 /bin
parent039f61cf2431986680c3ca1a75f19f188974882e (diff)
downloaddrakguard-af49c4a01c342806bf4cb3d5229ef08da64da5e9.tar
drakguard-af49c4a01c342806bf4cb3d5229ef08da64da5e9.tar.gz
drakguard-af49c4a01c342806bf4cb3d5229ef08da64da5e9.tar.bz2
drakguard-af49c4a01c342806bf4cb3d5229ef08da64da5e9.tar.xz
drakguard-af49c4a01c342806bf4cb3d5229ef08da64da5e9.zip
Properly define variables.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/drakguard27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/drakguard b/bin/drakguard
index f86dd37..013492f 100755
--- a/bin/drakguard
+++ b/bin/drakguard
@@ -239,7 +239,7 @@ gtkadd($w->{window},
$locale = lc($locale->{country});
my @system_name = grep { $_ && m/^GenericName(\[$locale\])?=(.*)\s*/g} chomp_(cat_($text));
foreach (@exec_line){
- ($exec, $text, $args) = /(^Exec=)(\w+)\s*(.*)/;
+ my ($exec, $text, $args) = /(^Exec=)(\w+)\s*(.*)/;
if ($text eq ""){
($exec, $text, $args) = /(^Exec=)(.*+)\s*(.*)/;}
}
@@ -308,7 +308,7 @@ sub list_add_entry_program {
foreach my $a (@addr) {
$b = $a;
$a =~ s/\s(.*)//g;
- @abc = map {$_->[0]} @{$list->{data}};
+ my @abc = map {$_->[0]} @{$list->{data}};
push @{$list->{data}}, $b
unless (any { $_->[0] eq $b } @{$list->{data}}) || (grep {$_ && m/$a(.*)/g} @abc);
}
@@ -506,13 +506,13 @@ sub set_permissions {
sub restore_permissions {
my ($line) = @_;
foreach ($line){
- ($fich, $usrname, $grpname, $mode) = /^(.*)\t(\w+)\.(\w+)\t(\d+)\s*/ or next;
+ my ($fich, $usrname, $grpname, $mode) = /^(.*)\t(\w+)\.(\w+)\t(\d+)\s*/ or next;
+ $mode = sprintf "%04d", $mode;#make number with 4 digits
+ my $guid = getgrnam($grpname);
+ my $uid = getpwnam($usrname);
+ chown $uid, $guid, $fich;
+ chmod oct($mode), $fich;
}
- $mode = sprintf "%04d", $mode;#make number with 4 digits
- $guid = getgrnam($grpname);
- $uid = getpwnam($usrname);
- chown $uid, $guid, $fich;
- chmod oct($mode), $fich;
}
sub subst_config_line {
@@ -651,8 +651,10 @@ sub apply_block_program {
s/\s(.*)//;
}
#code to make diff bettween vectors
+ my (@union, @intersection, @difference);
+ my $element;
@union = @intersection = @difference = ();
- %count = ();
+ my %count = ();
foreach $element (@original_list, @actual_list) { $count{$element}++ }
foreach $element (keys %count) {
# push @union, $element;
@@ -660,6 +662,7 @@ sub apply_block_program {
}
if (scalar(@difference)) {
#keep the permissons save, make the way to do that
+ my $diff;
foreach $diff (@difference) {
my @orig_file = cat_($perms_orig);
my @progs_orig_file = grep { $_ && m/$diff/g } chomp_(cat_($perms_orig));
@@ -714,7 +717,7 @@ sub apply_block_program {
#this is just the case to reactivate the parental control
#`unprotect $_ --remove` foreach @intersection;
remove_acl($dansguardian_protected_program_list, $_) foreach @intersection;
- foreach $intersec (@intersection){
+ foreach my $intersec (@intersection){
set_permissions($intersec, grep {$_ && m/$intersec/g} @orig_list);
}
}
@@ -725,12 +728,12 @@ sub apply_block_program {
}
#restore the original file permissions
`setfacl -b $_` foreach @original_list;
- foreach $list (@original_list) {
+ foreach my $list (@original_list) {
my @progs_orig_file = grep { $_ && m/$list/g } chomp_(cat_($perms_orig));
#test if program is in msec
if (scalar(@progs_orig_file)) {
#clean config file of the removed programs
- foreach $element (@progs_orig_file){
+ foreach my $element (@progs_orig_file){
my $val = $element;
$val =~ s/\t(.*)\s*//;
$element =~ s/^(\d+)\t//;