From bca0820b89b4db69a53953fecad48f786ae69170 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 27 Feb 2009 21:44:44 +0000 Subject: [PATCH] Conver at module to new library --- at/at-lib.pl | 17 ++++++++--------- at/config.info | 1 - web-lib-funcs.pl | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/at/at-lib.pl b/at/at-lib.pl index 2a69d0726..0ba1aa711 100644 --- a/at/at-lib.pl +++ b/at/at-lib.pl @@ -1,9 +1,9 @@ # at-lib.pl # Functions for listing and creating at jobs -do '../web-lib.pl'; +BEGIN { push(@INC, ".."); }; +use WebminCore; &init_config(); -do '../ui-lib.pl'; %access = &get_module_acl(); do "$config{'at_style'}-lib.pl"; @@ -84,8 +84,8 @@ sub save_allowed if (@_) { local($_); &open_tempfile(ALLOW, ">$config{allow_file}"); - foreach (@_) { - &print_tempfile(ALLOW, $_,"\n"); + foreach my $u (@_) { + &print_tempfile(ALLOW, $u,"\n"); } &close_tempfile(ALLOW); chmod(0444, $config{allow_file}); @@ -102,11 +102,10 @@ else { sub save_denied { &lock_file($config{deny_file}); -if (@_) { - local($_); - &open_tempfile(DENY, "> $config{deny_file}"); - foreach (@_) { - &print_tempfile(DENY, $_,"\n"); +if (@_ || !-r $config{'allow_file'}) { + &open_tempfile(DENY, ">$config{deny_file}"); + foreach my $u (@_) { + &print_tempfile(DENY, $u,"\n"); } &close_tempfile(DENY); chmod(0444, $config{deny_file}); diff --git a/at/config.info b/at/config.info index 4f8c3ab68..2b5edbcc1 100644 --- a/at/config.info +++ b/at/config.info @@ -1,4 +1,3 @@ -line2=System configuration,11 at_style=At system type,1,linux-Linux,solaris-Solaris,freebsd-FreeBSD,irix-Irix,macos-MacOS X,openserver-OpenServer at_dir=At jobs directory,0 allow_file=Allow At users file,3,None diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index ea97186fe..5363f9b9b 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -7259,7 +7259,7 @@ successful. The handle must have been one passed to open_tempfile. sub close_tempfile { my $file; -my $fh = &callers_package($fh); +my $fh = &callers_package($_[0]); if (defined($file = $main::open_temphandles{$fh})) { # Closing a handle