Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7940415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:22:55+00:00 2026-06-03T23:22:55+00:00

I am using a Perl script which deletes the data from mqueue folder for

  • 0

I am using a Perl script which deletes the data from mqueue folder for sendmail.

When I setuid to that Perl script and try to run it from user it throws this message:

Insecure dependency in chdir while running setuid at /file/find

How to solve it and succesfully run the script with root priveleges?

!/usr/bin/perl

use strict;

my $qtool = "/usr/local/bin/qtool.pl";
my $mqueue_directory = "/var/spool/mqueue";
my $messages_removed = 0;

use File::Find;
# Recursively find all files and directories in $mqueue_directory
find(\&wanted, $mqueue_directory);

sub wanted {
   # Is this a qf* file?
   if ( /^qf(\w{14})/ ) {
      my $qf_file = $_;
      my $queue_id = $1;
      my $deferred = 0;
      my $from_postmaster = 0;
      my $delivery_failure = 0;
      my $double_bounce = 0;
      open (QF_FILE, $_);
      while(<QF_FILE>) {
         $deferred = 1 if ( /^MDeferred/ );
         $from_postmaster = 1 if ( /^S<>$/ );
         $delivery_failure = 1 if \
            ( /^H\?\?Subject: DELIVERY FAILURE: (User|Recipient)/ );
         if ( $deferred && $from_postmaster && $delivery_failure ) {
            $double_bounce = 1;
            last;
         }
      }
      close (QF_FILE);
      if ($double_bounce) {
         print "Removing $queue_id...\n";
         system "$qtool", "-d", $qf_file;
         $messages_removed++;
      }
   }
}

print "\n$messages_removed total \"double bounce\" message(s) removed from ";
print "mail queue.\n";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:22:57+00:00Added an answer on June 3, 2026 at 11:22 pm

    “Insecure dependency” is a Taint thing: http://perldoc.perl.org/perlsec.html.

    Taint is being enforced because you have run the script setuid. You need to specify untaint as an %option key to File::Find:

    http://metacpan.org/pod/File::Find

    my %options = (
        wanted => \&wanted,
        untaint => 1
    );
    
    find(\%options, $mqueue_directory);
    

    You should also have a look at the untaint_pattern in the POD for File::Find.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a command line application from within the perl script(using system()) that sometimes
I have a perl script which is used to process some data files from
I have a Perl script that I'd like to run on Windows, using either
I have a perl script which when run from the command line generates a
I have a Perl script which retrieves data from MySQL Database. this is the
I have a simple Perl script which runs as a Linux daemon using an
I'm writing a script using Perl and Net::FTP, which is trying to upload a
I've got a Perl script I'm using for running a file processing tool which
I am writing a Perl script (in Windows) that is using File::Find to index
I am writing a script that executes a command remotely via SSH using perl.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.