Index: ldirectord =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v retrieving revision 1.77.2.4 diff -u -r1.77.2.4 ldirectord --- ldirectord 31 May 2004 02:27:57 -0000 1.77.2.4 +++ ldirectord 10 Sep 2004 03:54:41 -0000 @@ -1744,7 +1744,8 @@ } } -sub check_https + +sub check_https_child { my ($v, $r) = @_; require Net::SSLeay; @@ -1773,6 +1774,7 @@ &ld_debug(2, "Testing: $host, $port, $uri"); ($page, $errors, $cert) = &Net::SSLeay::sslcat($host, $port, $msg); + alarm 0; # Cancel the alarm ($head, $body) = split /\s?\n\s?\n/, $page, 2; ($response, $head) = split /\s?\n/, $head, 2; &ld_debug(2, "Result: $response"); @@ -1782,16 +1784,54 @@ alarm(0); die("$result"); } - alarm 0; # Cancel the alarm }; if ($@) { + return 1; + } + return 0; +} + + +sub check_https +{ + my ($v, $r) = @_; + + # The SSLeay module seems to have a memory leak + # that I can't find, so run it in a child process + # to prevent the parent from contiuously growing in size. + my $pid; + my $status; + local $SIG{'CHLD'} = "IGNORE"; + + $pid = fork(); + if ($pid) { + #parent + if (wait) { + $status = $? >> 8; + } + else { + #no child for some reason + return 1; + } + } + elsif (defined $pid) { + exit check_https_child($v, $r); + } + else { + #error + return 1; + } + + &ld_debug(2, "Status: $status"); + if ($status ne 0) { service_set($v, $r, "down"); return 0; } service_set($v, $r, "up"); return 1; } + sub check_nntp