diff options
Diffstat (limited to 'ldap-scripts')
-rwxr-xr-x | ldap-scripts/applySystemQuotas.pl | 11 | ||||
-rwxr-xr-x | ldap-scripts/edquota_editor | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ldap-scripts/applySystemQuotas.pl b/ldap-scripts/applySystemQuotas.pl index 762eb82..41c74d9 100755 --- a/ldap-scripts/applySystemQuotas.pl +++ b/ldap-scripts/applySystemQuotas.pl @@ -49,8 +49,8 @@ my $i = 0; my $max = $search->count; for ( $i=0; $i<$max; $i++ ) { my $entry = $search->entry($i); - my $editor = $ENV{'EDITOR'} if $ENV{'EDITOR'}; - $ENV{'EDITOR'} = $edquota_editor; + my $editor = $ENV{'VISUAL'} if $ENV{'VISUAL'}; + $ENV{'VISUAL'} = $edquota_editor; $ENV{'QUOTA_USER'} = $entry->get_value('uid'); # Delete all existing quotas for QUOTA_USER $ENV{'QUOTA_FILESYS'} = '*'; @@ -73,7 +73,12 @@ for ( $i=0; $i<$max; $i++ ) { qx($edquota -u $ENV{'QUOTA_USER'}); } } - $ENV{'EDITOR'} = $editor if $editor; + if ($editor) { + $ENV{'VISUAL'} = $editor; + } + else { + delete $ENV{'VISUAL'}; + } } $search = $ldap->unbind; diff --git a/ldap-scripts/edquota_editor b/ldap-scripts/edquota_editor index 95a03ee..fdebd09 100755 --- a/ldap-scripts/edquota_editor +++ b/ldap-scripts/edquota_editor @@ -10,7 +10,7 @@ die "QUOTA_SFILES environment variable not set\n" unless defined $ENV{'QUOTA_SFI die "QUOTA_HFILES environment variable not set\n" unless defined $ENV{'QUOTA_HFILES'}; open FILE, $ARGV[0]; -$qdata = join '', (@_=<FILE>); +my $qdata = join '', (@_=<FILE>); close FILE; open FILE, ">$ARGV[0]"; print FILE &edit_quota_file($qdata, $ENV{'QUOTA_FILESYS'}, $ENV{'QUOTA_SBLOCKS'}, $ENV{'QUOTA_HBLOCKS'}, $ENV{'QUOTA_SFILES'}, $ENV{'QUOTA_HFILES'}); @@ -18,7 +18,7 @@ close FILE; # edit_quota_file(data, filesys, sblocks, hblocks, sfiles, hfiles) sub edit_quota_file { - local($rv, $line, @line, $i); + my($rv, $line, @line, $i); @line = split /\n/, $_[0]; for ( $i=0; $i<@line; $i++ ) { if ($line[$i] =~ /^\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/ && ($1 eq $_[1] || $_[1] eq '*')) { |