This file is indexed.

/usr/share/perl5/MMM/Common/Socket.pm is in mysql-mmm-common 2.2.1-1.1.

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

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
package MMM::Common::Socket;

use strict;
use warnings FATAL => 'all';
use Log::Log4perl qw(:easy);
use IO::Socket::INET;

our $VERSION = '0.01';


=head1 NAME

MMM::Common::Socket - functions for socket creation

=cut


=head1 FUNCTIONS

=over 4

=item create_listener($host, $port)

Create a listening (ssl) socket on $host:$port.

=cut

sub create_listener($$) {
	my $host = shift;
	my $port = shift;

	my $socket_class = 'IO::Socket::INET';
	my %socket_opts;
	my $err = sub {''};
	if (defined($main::config->{'socket'}) && $main::config->{'socket'}->{type} eq 'ssl') {
 		require IO::Socket::SSL;
		$socket_class = 'IO::Socket::SSL';
		%socket_opts = (
			SSL_cert_file	=> $main::config->{'socket'}->{cert_file},
			SSL_key_file	=> $main::config->{'socket'}->{key_file},
			SSL_ca_file		=> $main::config->{'socket'}->{ca_file},
			SSL_verify_mode	=> 0x03
		);
		$err = sub {"\n  ", IO::Socket::SSL::errstr()};
	}

	my $sock = $socket_class->new(
		LocalHost => $host,
		LocalPort => $port, 
		Proto => 'tcp', 
		Listen => 10, 
		Reuse => 1,
		%socket_opts,
	) or LOGDIE "Listener: Can't create socket!", $err->();


	$sock->timeout(3);
	return($sock);
}

=item create_sender($host, $port, $timeout)

Create a (ssl) client socket on $host:$port with timeout $timeout.

=cut

sub create_sender($$$) {
	my $host = shift;
	my $port = shift;
	my $timeout = shift;

	my $socket_class = 'IO::Socket::INET';
	my %socket_opts;

	if (defined($main::config->{'socket'}) && $main::config->{'socket'}->{type} eq "ssl") {
		require IO::Socket::SSL;
		$socket_class = 'IO::Socket::SSL';
		%socket_opts = (
			SSL_use_cert	=> 1,
			SSL_cert_file	=> $main::config->{'socket'}->{cert_file},
			SSL_key_file	=> $main::config->{'socket'}->{key_file},
			SSL_ca_file		=> $main::config->{'socket'}->{ca_file},
		);
	}

	return $socket_class->new(
		PeerAddr	=> $host,
		PeerPort	=> $port,
		Proto		=> 'tcp',
		($timeout ? (Timeout => $timeout) : ()),
		%socket_opts,
	);
}

1;