This file is indexed.

/usr/share/sympa/lib/Datasource.pm is in sympa 6.1.7~dfsg-2.

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

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
# Datasource.pm - This module includes external datasources related functions
#<!-- RCS Identication ; $Revision: 6554 $ --> 

#
# Sympa - SYsteme de Multi-Postage Automatique
# Copyright (c) 1997, 1998, 1999, 2000, 2001 Comite Reseau des Universites
# Copyright (c) 1997,1998, 1999 Institut Pasteur & Christophe Wolfhugel
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

package Datasource;

use strict;

use Carp;

use Conf;
use Log;

############################################################
#  constructor
############################################################
#  Create a new datasource object. Handle SQL source only
#  at this moment. 
#  
# IN : -$type (+): the type of datasource to create
#         'SQL' or 'MAIN' for main sympa database
#      -$param_ref (+): ref to a Hash of config data
#
# OUT : instance of Datasource
#     | undef
#
##############################################################
sub new {
    my($pkg, $type, $param_ref) = @_;
    my $datasrc;
    &do_log('debug2', 'Datasource::new(%s)',$type);
    
    # import the desirable subs
    eval "use ${type}Source qw(connect query disconnect fetch ping quote set_fetch_timeout)";
    return undef if ($@);

    $datasrc->{'param'} = $param_ref;

    ## Bless Message object
    bless $datasrc, $pkg;
    return $datasrc;
}

# Returns a unique ID for an include datasource
sub _get_datasource_id {
    my ($source) = shift;
    if (ref($source) eq 'Datasource') {
    	$source = shift;
    }

    if (ref ($source)) {
	## Ordering values so that order of keys in a hash don't mess the value comparison
	## Warning: Only the first level of the hash is ordered. Should a datasource 
	## be described with a hash containing more than one level (a hash of hash) we should transform
	## the following algorithm into something that would be recursive. Unlikely it happens.
	my @orderedValues;
	foreach my $key (sort (keys %{$source})) {
	    @orderedValues = (@orderedValues,$key,$source->{$key});
	}
	return substr(Digest::MD5::md5_hex(join('/', @orderedValues)), -8);
    }else {
	return substr(Digest::MD5::md5_hex($source), -8);
    }
	
}

## Packages must return true.
1;