peterr has asked for the wisdom of the Perl Monks concerning the following question:
I noticed the following message in a log file:
"Insecure dependency in sysopen while running with -T switch at process.pl line 725."
The shebang line, etc
#!/usr/bin/perl -wT use CGI qw/:standard/; use DBI; use Net::SMTP; #use CGI::Carp qw(fatalsToBrowser); #comment this out when in produ +ction BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/home/username/cgi-bin/process-log") or die("Unable to open process-log: $!\n"); carpout(LOG); } # resource limits $CGI::DISABLE_UPLOADS = 1; # no uploads $CGI::POST_MAX = 1024 * 10; # max 10K posts
and the subroutine where the error occurred
sub create_order_file { my (undef, undef, undef, $day, $month, $year, @rest) = localtime(time) +; $month = $month + 1; #localtime returns mth as 0 to 11 $outfile = sprintf "%s/%4d-%2.2d-%2.2d-", $base_dir, $year + 1900, $month, $day; umask(); -d $base_dir || mkdir $base_dir, 0700; my $got_lock; use Fcntl; # to get constants for O_CREAT | O_EXCL | O_RDWR for ( 0 .. 5 ) { if ( sysopen(my $fh, "$base_dir/.lock", O_CREAT | O_EXCL | O_RDWR, + 0600) ) { $got_lock = 1; close $fh; last; } sleep 2; } diehtml("Lock error $!\n") unless $got_lock; # create unique suffix if (-f "$base_dir/$seq_file") { open(SEQ, "+<$base_dir/$seq_file") or diehtml("Error opening seq file: $!\n"); $seq = <SEQ>; seek SEQ, 0, 0; } else { open(SEQ, ">$base_dir/$seq_file") or diehtml("Error creating seq file: $!\n"); $seq = 0; } $outfile .= sprintf "%7.7d", $seq; $ordernumber = $seq; #store this order no. before 'next' is cal +c. print SEQ ++$seq; close SEQ or warn "Something wrong closing seq: $!\n"; unlink "$base_dir/.lock" or diehtml("Unlock error: $!\n"); use Fcntl; # to get constants for O_CREAT | O_EXCL | O_RDWR sysopen(ORDERFILE, $outfile, O_WRONLY | O_EXCL | O_CREAT) or diehtml("Can't open order records: $!\n"); print ORDERFILE @_; close ORDERFILE or warn "Something fishy with closing the order: $ +!\n"; }
Line 725 is the "sysopen(ORDERFILE,..." , just near the end of the sub routine. I've read a recent node about a similar problem, something about running in taint mode. I've never seen this type of error/msg in the logs before, and am wondering what could have caused it ? The file that controls the "sequence" has been incremented, possibly the user pressed 'STOP' on their browser, or exited before the Perl script had completed. It looks like I need to do something other than the current msg to the browser, because I have no way of knowing that the error occured; it was only by chance that I saw the logs were dated yesterday. What concerns me of course is that, at this stage of the Perl processing, the user has entered all the details, reviewed the details, and then pressed 'Confirm order', therefore they may think they have ordered, but we actually have no details at all, because the script crashed.
Please advise. :)
Peter
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Insecure dependency message ?
by exussum0 (Vicar) on Jan 06, 2004 at 02:45 UTC | |
by peterr (Scribe) on Jan 06, 2004 at 03:41 UTC | |
by exussum0 (Vicar) on Jan 06, 2004 at 04:06 UTC | |
by peterr (Scribe) on Jan 06, 2004 at 04:52 UTC | |
by exussum0 (Vicar) on Jan 06, 2004 at 04:57 UTC | |
| |
by duff (Parson) on Jan 06, 2004 at 04:10 UTC | |
by peterr (Scribe) on Jan 06, 2004 at 04:40 UTC | |
|
Re: Insecure dependency message ?
by Zaxo (Archbishop) on Jan 06, 2004 at 02:48 UTC | |
by peterr (Scribe) on Jan 06, 2004 at 04:14 UTC | |
|
Re: Insecure dependency message ?
by duff (Parson) on Jan 06, 2004 at 03:57 UTC | |
by peterr (Scribe) on Jan 06, 2004 at 04:29 UTC | |
by duff (Parson) on Jan 06, 2004 at 04:39 UTC | |
by peterr (Scribe) on Jan 07, 2004 at 01:09 UTC | |
|
Re: Insecure dependency message ?
by peterr (Scribe) on Jan 07, 2004 at 03:56 UTC | |
by peterr (Scribe) on Jan 07, 2004 at 04:46 UTC | |
by peterr (Scribe) on Jan 07, 2004 at 04:58 UTC |