This file is indexed.

/usr/bin/refdbsru is in refdb-clients 1.0.2-3.

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
#!/usr/bin/perl

## refdbsru: CGI script providing SRU access to RefDB data
##
## usage: install in the CGI directory of your web server
## todo: how to adapt web server config
##
## Dependencies: perl 5.6.0 or later
##               CGI.pm
##               RefDB::SRU
##               RefDB::Log
##               RefDB::Pref
##
## markus@mhoenicka.de 2007-02-07

##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation; either version 2 of the License, or
##   (at your option) any later version.
##   
##   This program is distributed in the hope that it will be useful,
##   but WITHOUT ANY WARRANTY; without even the implied warranty of
##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##   GNU General Public License for more details.
   
##   You should have received a copy of the GNU General Public License
##   along with this program; if not, see <http://www.gnu.org/licenses/>


## some RefDB modules
use RefDB::Prefs;
use RefDB::SRU;

use Sys::Syslog;

use CGI;

## read config file settings
my $confdir = "/etc/refdb";
my $prefs = RefDB::Prefs::->new("$confdir/refdbsrurc", undef);

# CGI does all the magic related to reading the query
my $query = new CGI;

# this hash receives the parameter-value pairs
my %params = $query->Vars;

# logging options
$params{'logfile'} = (defined($prefs->{"logfile"})) ? $prefs->{"logfile"} : "/var/log/refdbsru.log";
$params{'loglevel'} = (defined($prefs->{"loglevel"})) ? $prefs->{"loglevel"} : 6;
$params{'logdest'} = (defined($prefs->{"logdest"})) ? $prefs->{"logdest"} : 2; ## 0 = stderr, 1 = syslog, 2 = file

# networking options
$params{'server_ip'} = (defined($prefs->{"serverip"})) ? $prefs->{"serverip"} : "127.0.0.1";
$params{'port'} = (defined($prefs->{"port"})) ? $prefs->{"port"} : "9734";
$params{'timeout'} = (defined($prefs->{"timeout"})) ? $prefs->{"timeout"} : "180";

# user authentication
$params{'username'} = (defined($prefs->{"username"})) ? $prefs->{"username"} : "anonymous";
$params{'password'} = (defined($prefs->{"passwd"})) ? $prefs->{"passwd"} : "";


$params{'pdfroot'} = (defined($prefs->{"pdfroot"})) ? $prefs->{"pdfroot"} : "/home/foo/literature";
$params{'xsl_url'} = (defined($prefs->{"xsl_url"})) ? $prefs->{"xsl_url"} : "";
$params{'db_engine'} = (defined($prefs->{"dbserver"})) ? $prefs->{"dbserver"} : undef;

# zeerex parameters
$params{'zeerex_host'} = (defined($prefs->{"zeerex_host"})) ? $prefs->{"zeerex_host"} : "www.change.me";
$params{'zeerex_port'} = (defined($prefs->{"zeerex_port"})) ? $prefs->{"zeerex_port"} : "80";
$params{'zeerex_database'} = (defined($prefs->{"zeerex_database"})) ? $prefs->{"zeerex_database"} : "refs";
$params{'zeerex_databaseInfo_title'} = (defined($prefs->{"zeerex_databaseInfo_title"})) ? $prefs->{"zeerex_databaseInfo_title"} : "Reference Database";
$params{'zeerex_databaseInfo_description'} = (defined($prefs->{"zeerex_databaseInfo_description"})) ? $prefs->{"zeerex_databaseInfo_description"} : "Reference Database";
$params{'zeerex_databaseInfo_author'} = (defined($prefs->{"zeerex_databaseInfo_author"})) ? $prefs->{"zeerex_databaseInfo_author"} : "John Doe";
$params{'zeerex_databaseInfo_contact'} = (defined($prefs->{"zeerex_databaseInfo_contact"})) ? $prefs->{"zeerex_databaseInfo_contact"} : "John\@Doe.org";

# create a new RefDB query object and pass a reference to the
# parameter-value hash 
my $refdbquery = new RefDB::SRU(\%params);

# try to figure out the database name. A default database should be
# provided in the config file. Remote users can override this setting
# by providing an additional path info in the URL. E.g.
# http://myserver.com/cgi-bin/refdbsru/?<query> will use the
# default database, whereas
# http://myserver.com/cgi-bin/refdbsru/foo?<query> will use the
# database "foo" instead
if (defined($query->path_info()) && length($query->path_info()) > 1) {
    $params{'database'} = $query->path_info();
    
    # strip leading slash
    $params{'database'} =~ s/^\///;
}
else {
    $params{'database'} = (defined($prefs->{"defaultdb"})) ? $prefs->{"defaultdb"} : "references";
}

$refdbquery->run();

my $result = $refdbquery->response();

print "Content-type: text/xml\n\n";
print "$result\n";

#$refdbquery->print_vars();



exit 0;