Authen-Quiz

 view release on metacpan or  search on metacpan

inc/File/Temp.pm  view on Meta::CPAN

519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# First checks to see if the directory is not owned by the
# current user or root. Then checks to see if anyone else
# can write to the directory and if so, checks to see if
# it has the sticky bit set
 
# Will not work on systems that do not support sticky bit
 
#Args:  directory path to check
#       Optionally: reference to scalar to contain error message
# Returns true if the path is safe and false otherwise.
# Returns undef if can not even run stat() on the path
 
# This routine based on version written by Tom Christiansen
 
# Presumably, by the time we actually attempt to create the
# file or directory in this directory, it may not be safe
# anymore... Have to run _is_safe directly after the open.
 
sub _is_safe {
 
  my $path = shift;
  my $err_ref = shift;
 
  # Stat path
  my @info = stat($path);
  unless (scalar(@info)) {
    $$err_ref = "stat(path) returned no values";
    return 0;
  };
  return 1 if $^O eq 'VMS'# owner delete control at file level
 
  # Check to see whether owner is neither superuser (or a system uid) nor me
  # Use the effective uid from the $> variable
  # UID is in [4]
  if ($info[4] > File::Temp->top_system_uid() && $info[4] != $>) {
 
    Carp::cluck(sprintf "uid=$info[4] topuid=%s euid=$> path='$path'",

inc/File/Temp.pm  view on Meta::CPAN

1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
#line 1934
 
sub unlink0 {
 
  croak 'Usage: unlink0(filehandle, filename)'
    unless scalar(@_) == 2;
 
  # Read args
  my ($fh, $path) = @_;
 
  cmpstat($fh, $path) or return 0;
 
  # attempt remove the file (does not work on some platforms)
  if (_can_unlink_opened_file()) {
 
    # return early (Without unlink) if we have been instructed to retain files.
    return 1 if $KEEP_ALL;
 
    # XXX: do *not* call this on a directory; possible race
    #      resulting in recursive removal
    croak "unlink0: $path has become a directory!" if -d $path;

inc/File/Temp.pm  view on Meta::CPAN

1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
    _deferred_unlink($fh, $path, 0);
    return 1;
  }
 
}
 
#line 1999
 
sub cmpstat {
 
  croak 'Usage: cmpstat(filehandle, filename)'
    unless scalar(@_) == 2;
 
  # Read args
  my ($fh, $path) = @_;
 
  warn "Comparing stat\n"
    if $DEBUG;
 
  # Stat the filehandle - which may be closed if someone has manually
  # closed the file. Can not turn off warnings without using $^W

inc/File/Temp.pm  view on Meta::CPAN

1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
#line 2092
 
sub unlink1 {
  croak 'Usage: unlink1(filehandle, filename)'
    unless scalar(@_) == 2;
 
  # Read args
  my ($fh, $path) = @_;
 
  cmpstat($fh, $path) or return 0;
 
  # Close the file
  close( $fh ) or return 0;
 
  # Make sure the file is writable (for windows)
  _force_writable( $path );
 
  # return early (without unlink) if we have been instructed to retain files.
  return 1 if $KEEP_ALL;

inc/Module/Install.pm  view on Meta::CPAN

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
 
 
 
# If the script that is loading Module::Install is from the future,
# then make will detect this and cause it to re-run over and over
# again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" }
 
Your installer $0 has a modification time in the future.
 
This is known to create infinite loops in make.
 
Please correct this, then run $0 again.
 
END_DIE



( run in 0.226 second using v1.01-cache-2.11-cpan-0f795438458 )