~ubuntu-branches/debian/experimental/smokeping/experimental

« back to all changes in this revision

Viewing changes to lib/Smokeping/probes/TCPPing.pm

  • Committer: Package Import Robot
  • Author(s): Antoine Beaupré
  • Date: 2013-03-16 11:34:03 UTC
  • mfrom: (1.3.1) (7.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20130316113403-ht1ik5dtc457l6jj
Tags: 2.6.9-1~exp0
* New upstream release to properly fix CVE-2012-0790 (Closes: #659899)
* Acknowledge the NMU, thanks gregor!

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
        return $class->_makevars($class->SUPER::probevars, {
90
90
                _mandatory => [ 'binary' ],
91
91
                binary => { 
92
 
                        _doc => "The location of your TCPPing script.",
 
92
                        _doc => "The location of your tcpping script.",
93
93
                        _example => '/usr/bin/tcpping',
94
94
                        _sub => sub { 
95
95
                                my $val = shift;
98
98
                                        unless -f $val and -x _;
99
99
 
100
100
                                my $return = `$val -C -x 1 localhost 2>&1`;
101
 
                                return "ERROR: TCPPing must be installed setuid root or it will not work\n"
 
101
                                return "ERROR: tcpping must be installed setuid root or it will not work\n"
102
102
                                        if $return =~ m/only.+root/;
103
103
 
104
104
                                return undef;
105
105
                        },
106
106
                },
 
107
                tcptraceroute => { 
 
108
                        _doc => "tcptraceroute Options to pass to tcpping.",
 
109
                        _example => '-e "sudo /bin/tcptraceroute"',
 
110
                },
107
111
        });
108
112
}
109
113
 
140
144
 
141
145
    my @cmd = (
142
146
                    $self->{properties}{binary},
143
 
                    '-C', '-x', $self->pings($target), 
144
 
                    $target->{addr}, @port);
 
147
                    '-C', '-x', $self->pings($target)
 
148
        );
 
149
 
 
150
    if ($self->{properties}{tcptraceroute})
 
151
    {
 
152
        push @cmd, '-e', $self->{properties}{tcptraceroute};
 
153
    }
 
154
 
 
155
    push @cmd, $target->{addr}, @port;
 
156
 
145
157
    $self->do_debug("Executing @cmd");
146
158
    my $pid = open3($inh,$outh,$errh, @cmd);
147
159
    while (<$outh>){
148
160
        chomp;
 
161
        $self->do_debug("Received: $outh");
149
162
        next unless /^\S+\s+:\s+[\d\.]/; #filter out error messages from tcpping
150
163
        @times = split /\s+/;
151
164
        my $ip = shift @times;