From 9f587a0414ce73c6b85e5c3a6a4f7d0892ebccc0 Mon Sep 17 00:00:00 2001 From: b Date: Tue, 5 Jan 2016 20:07:43 +0000 Subject: [PATCH] script removing access files fixed. git-svn-id: svn://botcastle1b/yplom/facebug1@15 7dec801f-c475-4e67-ba99-809552d69c55 --- rmaccess.1.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rmaccess.1.pl b/rmaccess.1.pl index f6fde5f..adbb320 100644 --- a/rmaccess.1.pl +++ b/rmaccess.1.pl @@ -36,12 +36,15 @@ my $timeout_inact = TIMEOUT_INACT*60; if (opendir ($dir, ACCESS_PATH)) { while (defined($path = readdir $dir)) { + if ($path !~ /^[0-9a-fA-F]+$/) { + next; + } if (open ($file, '<', ACCESS_PATH.$path)) { - $unlocktime=<$accessfile>; - $lasttime=<$accessfile>; + $unlocktime=<$file>; + $lasttime=<$file>; close($file); - if (($unlocktime !~ /^([0-9]+)$/) || ($lasttime !~ /^([0-9]+)$/)) { + if (($unlocktime !~ /^([0-9]+)$/) or ($lasttime !~ /^([0-9]+)$/)) { unlink (ACCESS_PATH.$path); } elsif ((abs($time-$unlocktime)>$timeout_unlock) or (abs($time-$lasttime)>$timeout_inact)){ -- 2.30.2