Commit ce5037a7 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Minor cleanup, reset a couple of global variables back to default state

when invoked (as for long running fcgid daemon).
parent 9ccc7333
...@@ -57,6 +57,7 @@ my $USERNAME = "Unknown"; ...@@ -57,6 +57,7 @@ my $USERNAME = "Unknown";
my $GCOS = "Unknown"; my $GCOS = "Unknown";
my @SAVEARGV = @ARGV; my @SAVEARGV = @ARGV;
my $SAVEPID = $PID; my $SAVEPID = $PID;
my $PREFORKFILE = "/var/tmp/auditfork_$PID";
my $SAVE_STDOUT = 0; my $SAVE_STDOUT = 0;
my $SAVE_STDERR = 0; my $SAVE_STDERR = 0;
...@@ -148,6 +149,15 @@ sub AuditStart($;$$) ...@@ -148,6 +149,15 @@ sub AuditStart($;$$)
return; return;
} }
# Reset to default for rentry in log running script.
$logfile = undef;
$prefork = undef;
$logonly = 0;
$logtblogs = 0;
$savelog = 0;
$fancy = 0;
$forked = 0;
# Logging instead of "auditing" ... # Logging instead of "auditing" ...
if (defined($options)) { if (defined($options)) {
if ($options & LIBAUDIT_NODELETE()) { if ($options & LIBAUDIT_NODELETE()) {
...@@ -186,6 +196,9 @@ sub AuditStart($;$$) ...@@ -186,6 +196,9 @@ sub AuditStart($;$$)
$ENV{'TBAUDITON'} = "$SCRIPTNAME:$USERNAME"; $ENV{'TBAUDITON'} = "$SCRIPTNAME:$USERNAME";
return; return;
} }
# Clear this in case left behind, as for long running process.
unlink($PREFORKFILE)
if (-e $PREFORKFILE);
if (!defined($logname)) { if (!defined($logname)) {
$logfile = TBMakeLogname("$SCRIPTNAME"); $logfile = TBMakeLogname("$SCRIPTNAME");
...@@ -354,9 +367,12 @@ sub AuditAbort() ...@@ -354,9 +367,12 @@ sub AuditAbort()
undef($logfile); undef($logfile);
} }
delete @ENV{'TBAUDITLOG', 'TBAUDITON'}; delete @ENV{'TBAUDITLOG', 'TBAUDITON'};
system("/usr/bin/touch $prefork") if (defined($prefork)) {
if (defined($prefork)); my $oldmask = umask(0000);
system("/usr/bin/touch $prefork");
umask($oldmask);
}
} }
return 0; return 0;
} }
...@@ -372,7 +388,7 @@ sub AuditPrefork() ...@@ -372,7 +388,7 @@ sub AuditPrefork()
return 0 return 0
if (!$auditing); if (!$auditing);
$prefork = "/var/tmp/auditfork_$PID"; $prefork = $PREFORKFILE;
} }
# #
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment