This file is indexed.

/usr/share/globus/aggrexec/globus-rls-aggregatorsource.pl is in globus-rls-server 4.9-11.

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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#! /usr/bin/perl

# 
# Copyright 1999-2006 University of Chicago
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 


# Constants
# NOTE: The rvalues have no particular significance.
$LRC_TYPE = 1;
$RLI_TYPE = 2;
$BLOOMFILTER = 1;
$LFNLIST = 2;

# Variables
$debug = 0;
$gotStats = 0;
@stats;
$type = 0;
$error = 0;
$errmsg = 0;
$rls_version = "unknown";
$rls_uptime = "unknown";
@rls_type;
@lrc_update_methods;
@lrc_updates;
$lrc_lfnlist_update_int = "unknown";
$lrc_bloomfilter_update_int = "unknown";
$lrc_numlfn = "unknown";
$lrc_numpfn = "unknown";
$lrc_nummap = "unknown";
@rli_updatedby;
@rli_updatedvia;

# Command line input
$rlsurl = $ARGV[0];
$globus_location = $ENV{GLOBUS_LOCATION};
$globus_location = "/usr" unless defined $globus_location;
$rlsstatscmd = $globus_location . "/sbin/globus-rls-admin -S " . $rlsurl;

if ($debug) {
    print "CMD: ", $rlsstatscmd, "\n";
}

# Invoke RLS stats command
if (open(FD, "$rlsstatscmd 2>&1 |")) {
    @stats = <FD>;
    close(FD);
    $gotStats = 1;
}
else {
    $error = 1;
    $errmsg = "Failed to execute command: \"$rlsstatscmd\"";
    do toXml();
}

if ($gotStats) {
    do parseRlsStats();
    do toXml();
}

if ($debug) {
    do dumpVariables();
}

# Parse RLS statistics from output array
sub parseRlsStats
{
    # Parse stats output
    foreach $line (@stats)
    {
        if ($debug) {
            print "LINE: $line";
        }

        if ($line =~ /^LRC/) {
            $type = $LRC_TYPE;
            push(@rls_type, 'lrc');
        }
        elsif ($line =~ /^RLI/) {
            $type = $RLI_TYPE;
            push(@rls_type, 'rli');
        }
        elsif ($type == $LRC_TYPE) {
            do parseLrcStats($line);
        }
        elsif ($type == $RLI_TYPE) {
            do parseRliStats($line);
        }
        else {
            #Parse general stats
            if ($line =~ /^Version:/) {
                $_ = $line;
                ($ignore, $rls_version) = split;
            }
            elsif ($line =~ /^Uptime:/) {
                $_ = $line;
                ($ignore, $rls_uptime) = split;
            }
            else {
                # Most likely, this indicates an error
                $errmsg = $line;
                $error = 1;
                return 1;
            }
        }
    }
}

# Parses LRC statistics
sub parseLrcStats {
    local($input) = $_[0];
    if ($input =~ /^\s*update method/) {
        $_ = $input;
        ($ignore, $ignore, $method) = split;
        push(@lrc_update_methods, $method);
    }
    elsif ($input =~ /^\s*updates/) {
        $_ = $input;
        ($ignore, $method, $site, $ignore, $date, $time) = split;
        chop($method);
        push(@lrc_updates, ($site, $method, $date, $time));
    }
    elsif ($input =~ /^\s*lfnlist update interval/) {
        $_ = $input;
        ($ignore, $ignore, $ignore, $lrc_lfnlist_update_int) = split;
    }
    elsif ($input =~ /^\s*bloomfilter update interval/) {
        $_ = $input;
        ($ignore, $ignore, $ignore, $lrc_bloomfilter_update_int) = split;
    }
    elsif ($input =~ /^\s*numlfn/) {
        $_ = $input;
        ($ignore, $lrc_numlfn) = split;
    }
    elsif ($input =~ /^\s*numpfn/) {
        $_ = $input;
        ($ignore, $lrc_numpfn) = split;
    }
    elsif ($input =~ /^\s*nummap/) {
        $_ = $input;
        ($ignore, $lrc_nummap) = split;
    }
    else {
        # This is an unexpected condition
    }
}

sub parseRliStats {
    local($input) = $_[0];
    if ($input =~ /^\s*updated by/) {
        $_ = $input;
        ($ignore, $ignore, $site, $ignore, $date, $time) = split;
        push(@rli_updatedby, ($site, $date, $time));
    }
    elsif ($input =~ /^\s*updated via/) {
        $_ = $input;
        ($ignore, $ignore, $method) = split;
        push(@rli_updatedvia, $method);
    }
    else {
        # This is an unexpected condition
    }
}

# Print XML (user-friendly format for debugging purposes only)
sub toXml {

    # Header
    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

    # If error encountered, output relevant fields only
    if ($error) {
        print "<rlsStats>\n";
        print "  <site>$rlsurl</site>\n";
        print "  <uptime>$rls_uptime</uptime>\n";
        print "  <error>$errmsg</error>\n";
        print "</rlsStats>\n";
        return 1;
    }

    # Normal output follows
    print "<rlsStats>\n";
    print "  <site>$rlsurl</site>\n";
    print "  <version>$rls_version</version>\n";
    print "  <uptime>$rls_uptime</uptime>\n";
    print "  <serviceList>\n";
    foreach $type (@rls_type) {
        print "    <service>$type</service>\n";
    }
    print "  </serviceList>\n";
    if ("@rls_type" =~ /lrc/) {
        print "  <lrc>\n";
        print "    <updateMethodList>\n";
        foreach $method (@lrc_update_methods) {
            print "      <updateMethod>$method</updateMethod>\n";
        }
        print "    </updateMethodList>\n";
        print "    <updatesList>\n";
        for ($count=0; $count<length(@lrc_updates); $count++) {
            print "      <updates>\n";
            print "        <site>".$lrc_updates[$count*4+0]."</site>\n";
            print "        <method>".$lrc_updates[$count*4+1]."</method>\n";
            print "        <date>".$lrc_updates[$count*4+2]."</date>\n";
            print "        <time>".$lrc_updates[$count*4+3]."</time>\n";
            print "      </updates>\n";
        }
        print "    </updatesList>\n";
        print "    <numlfn>$lrc_numlfn</numlfn>\n";
        print "    <numpfn>$lrc_numpfn</numpfn>\n";
        print "    <nummap>$lrc_nummap</nummap>\n";
        print "  </lrc>\n";
    }
    if ("@rls_type" =~ /rli/) {
        print "  <rli>\n";
        print "    <updatedViaList>\n";
        foreach $method (@rli_updatedvia) {
            print "      <updatedVia>$method</updatedVia>\n";
        }
        print "    </updatedViaList>\n";
        print "    <updatedByList>\n";
        for ($count=0; $count<length(@rli_updatedby); $count++) {
            print "      <updatedBy>\n";
            print "        <site>".$rli_updatedby[$count*3+0]."</site>\n";
            print "        <date>".$rli_updatedby[$count*3+1]."</date>\n";
            print "        <time>".$rli_updatedby[$count*3+2]."</time>\n";
            print "      </updatedBy>\n";
        }
        print "    </updatedByList>\n";
        print "  </rli>\n";
    }
    print "</rlsStats>\n";
}

# Provided for debug purposes
sub dumpVariables {
    print "\nDUMP:\n";
    print "  Version: $rls_version\n";
    print "  Uptime: $rls_uptime\n";
    print "  RLS type: @rls_type\n";
    print "  Update methods: @lrc_update_methods\n";
    print "  Updates: @lrc_updates\n";
    print "  Lfnlist update int: $lrc_lfnlist_update_int\n";
    print "  Bloomfilter update int: $lrc_bloomfilter_update_int\n";
    print "  Numlfn: $lrc_numlfn\n";
    print "  Numpfn: $lrc_numpfn\n";
    print "  Nummap: $lrc_nummap\n";
    print "  Updated by: @rli_updatedby\n";
    print "  Updated via: @rli_updatedvia\n";
}