This file is indexed.

/usr/bin/msgcleanup is in ax25mail-utils 0.11-6.1ubuntu1.

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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#! /usr/bin/perl
#----------------------------------------------------------------------------
# ax25mail-tools
#
# msgcleanup - scan the message list and delete all messages with exceeded
#           lifetime (mark them as deleted and delete message files)
#           The message list is truncated to first present or first
#           expired message, it's not changed when no messages expire.
#
# Version 0.02
#
# (c) Radek Burget OK2JBG <xburge01@stud.fee.vutbr.cz> 1999
#
# Usage: msgcleanup <BBS_CALL>
#----------------------------------------------------------------------------

# Normal settings:
#List path
$LIST_PATH = "/var/ax25/ulistd";

#Bulletin path
$BULLETIN_PATH = "/var/ax25/mail";

#Settings file
$CONF_FILE = "/etc/ax25/bulletins";

#Temp output file
$TEMP_FILE = "/tmp/msgcleanup_temp.$$";

#Default lifetime (days)
$DEF_LIFE = 30;

#----------------------------------------------------------------------------

#Seconds a day
$SEC_A_DAY = 24*3600;

#----------------------------------------------------------------------------
# Bulletin list format
format TEMP =
@ @>>>>> @<<<<<@<<<<<< @<<<<< @<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$binfo[1], $binfo[2], $binfo[3], $binfo[4], $binfo[5], $binfo[6], $subj
.

#----------------------------------------------------------------------------

if (@ARGV != 1)
{
  print "Usage: msgcleanup <BBS_CALL>\n";
  exit 0;
}

#Number of deleted messages
$deleted = 0;

#Output flag
$output = 0;

$bbsname = uc $ARGV[0];

# Open files
$bbs_dir = $BULLETIN_PATH . "/" . $bbsname;
die "The bulletin directory for $bbsname ($bbs_dir) doesn't exist\n" unless -d $bbs_dir;

$list_name = $LIST_PATH . "/" . $bbsname;
open LIST, $list_name or die "Cannot open list file for $bbsname ($list_name)\n";

# Read config file to the 'lifes' hash
$conf_name = $CONF_FILE . "." . $bbsname;
open CONF, $conf_name or print "$0 : Warning : No config file for $bbsname - using defaults\n";

while (<CONF>)
{
  chop;
  if ($_ !~ /^#/) 
  {
    @line = split /\W+/;
    if (@line == 2)
    {
      $lifes{uc $line[0]} = $line[1];
    }
    else
    {
      die "Invalid line in config file ($_)\n"
    }
  }
}

close CONF;

# Open temp output
open TEMP, ">".$TEMP_FILE or die "Cannot write to $TEMP_FILE\n";

# Change default lifetime if specified
$DEF_LIFE = $lifes{'DEFAULT'} if $lifes{'DEFAULT'};
print "Default bulletin lifetime: $DEF_LIFE day(s)\n";

# Scan the list and compare the dates
$now = time;

while (<LIST>)
{
  chop;

  # Read and split message info
  @binfo = split /\s+/;
  $num = $binfo[0];    #first entry - message number
  $flag = $binfo[1];   #second entry - flags

  # Split destination to NAME and @FWD
  if ($binfo[3] =~ /@/)
  {
    for ($i = @binfo; $i >= 4; $i--) {$binfo[$i+1] = $binfo[$i];}
    $binfo[4] = substr $binfo[3], index($binfo[3], "@");
    $binfo[3] = substr $binfo[3], 0, index($binfo[3], "@");
  }
  if ($binfo[4] !~ /^@/)
  {
    for ($i = @binfo; $i >= 4; $i--) {$binfo[$i+1] = $binfo[$i];}
    $binfo[4] = "";
  }

  $bname = $binfo[3];  #bulletin name

  # Extract subject
  if ($flag =~ /#/)
  {
    $subj = "";
  }
  else
  {
    $subj = substr $_, index($_, $binfo[6])+7;
  }

  # Read message file info
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
                        $atime,$mtime,$ctime,$blksize,$blocks) 
                            = stat($bbs_dir."/".$num);

  # $nlink should be >0 when the file exists
  if ($nlink && ($flag =~ /[P,B]/))
  {
    $output = 1;
    ### determine the lifetime for this message ###
    if ($lifes{$bname}) {$lifetime = $lifes{$bname};} 
                   else {$lifetime = $DEF_LIFE;}
    ### lifetime in seconds ###
    $lifetime *= $SEC_A_DAY;
    ### check the message dates ###
    if ($mtime < ($now - $lifetime)) 
    {
      $binfo[1] = "D"; ##FLAG = DELETED
      unlink($bbs_dir."/".$num);
      $deleted++;
    }
  }

  if ($output)
  {
    print TEMP "$num  ";
    write TEMP;
  }
}

#Do not allow the empty list
print "$num  #\n" if ($output == 0);

#Cliose the files
close TEMP;
close LIST;

if ($deleted) ##if some messages expired
{
  rename ($TEMP_FILE, $list_name) or die "rename: $!\n";
}
else
{
  unlink $TEMP_FILE;
}

print "$deleted message(s) deleted.\n";

#### END OF SCRIPT #########################################################