This file is indexed.

/usr/bin/dspam_logrotate is in dspam 3.10.2+dfsg-13.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/perl
#
# $Id: dspam_logrotate,v 1.00 2009/12/22 12:25:59 sbajic Exp $
#
# dspam_logrotate - Removed old entries from DSPAM log files.
# Steve Pellegrin <spellegrin@convoglio.com>
#
# Patched for working on dspam installation with thousends of users. 
# Norman Maurer <nm@byteaction.de>
#
# Usage:
#    dspam_logrotate -v -a days logfile ...
#      -v: Print verbose output
#      -a days: All log entries older than 'days' will be removed.
#      -l logfile: A list of one or more files to process.
#      -d dspamdir: The home directory of dspam.

###########################################################
#
# Print usage info
#
sub usage {
	print "Usage: " . $0 . " -a age [-v] -l logfiles\n";
	print "or\n";
	print "Usage: " . $0 . " -a age [-v] -d /var/dspam\n";
}
###########################################################


###########################################################
#
# "Rotate" one log file
#
sub rotate {
    # Give names to input args.
    my($filename);
    my($cutoffTimestamp);
    my($printStats);
    ($filename, $cutoffTimestamp, $printStats) = @_;

    # Generate names for the temporary files.
    my($tempInputFile) = $filename . ".in";
    my($tempOutputFile) = $filename . ".out";

    # Rename the log file to the temporary input file name.
    rename $filename, $tempInputFile;

    # Open the temporary input and output files.
    open INFILE, "< $tempInputFile"
        or die "Cannot open input file: $tempInputFile\n$!";
    open OUTFILE, "> $tempOutputFile"
        or die "Cannot open output file: $tempOutputFile\n$!";

    # Read the input file and copy eligible records to the output.
    # Count the number of delete records in case printStats is true.
    my($linesDeleted) = 0;
    while (defined($thisLine = <INFILE>)) {
        # Get this line's timestamp.
	my($lineTimestamp) = substr($thisLine, 0, index($thisLine, "\t"));

	# Write lines with newer timestamps to the output file.
	if ($lineTimestamp >= $cutoffTimestamp) {
	    print OUTFILE $thisLine;
	} else {
	    $linesDeleted++;
	}
    }
    close INFILE;

    # It is possible that records have been written to the log file while
    # we have been processing the temporary files. If so, append them to 
    # our temporary output file.
    if (-e $filename) {
        open INFILE, "< $filename"
            or die "Cannot open log file: $filename\n$!";
        while (defined($thisLine = <INFILE>)) {
	    print OUTFILE $thisLine;
        }
        close INFILE;
    }

    close OUTFILE;

    #Set the original uid, gid and perms
    my @filestat = stat($tempInputFile);
    chmod @filestat[2], $tempOutputFile;
    chown @filestat[4], @filestat[5], $tempOutputFile;
    
    # Rename our temporary output file to the original log file name.
    rename $tempOutputFile, $filename;

    # Remove our temporary input file.
    unlink $tempInputFile;

    # Print statistics, if desired.
    if ($printStats != 0) {
        print "Deleted $linesDeleted lines from $filename \n";
    }
}
###########################################################


###########################################################
#
# Mainline
#
###########################################################

# Extract the command line arguments
#    -a days: All log entries older than 'days' will be removed.
#    -v: Print verbose output
#    logfile: A list of one or more files to process.
#
my($ageDays) = undef;
my($logfiles);
my($help) = 0;
my($verbose) = 0;

while ($arg = shift(@ARGV)) {
    if ($arg eq "-a") {
        $ageDays = shift(@ARGV);
    } elsif ($arg eq "-v") {
        $verbose = 1;
    } elsif ($arg eq "-l") {
        @logfiles = @ARGV;
    } elsif ($arg eq "-d") {
    	my $dspamdir = shift(@ARGV);
        @logfiles = split(/\n/, `find $dspamdir -name \"*.log\"`);
    } elsif ($arg eq "-h") {
        $help = 1;
    }
}

#
# Quit now if the command line looks screwy.
#
if (!defined($ageDays) || (scalar @logfiles == 0) || $help == 1) {
    usage();
    exit(-1);
}

#
# Determine the earliest timestamp allowed to stay in the file.
#
my($minimumTimestamp) = (time - ($ageDays * 60 * 60 * 24));

#
# Rotate each logfile specified on the command line.
#
foreach $logfile (@logfiles) {
    rotate($logfile, $minimumTimestamp, $verbose);
}