Branch Coverage

blib/lib/Net/LDAP.pm
Criterion Covered Total %
branch 43 372 11.5


line true false branch
37 0 0 eval { do { require IO::Socket::INET6 } } ? :
21 0 eval { do { require IO::Socket::IP; 'IO::Socket::IP'->VERSION(0.2) } } ? :
65 0 0 unless $once++
69 0 0 ref($_) =~ /[^A-Z]/ ? :
74 0 0 ref $ret{'control'} eq 'ARRAY' ? :
0 4 if exists $ret{'control'}
80 0 2 if @_ & 1
87 0 0 if $errstr
102 0 0 $ldap->{'net_ldap_onerror'} && !$ldap->{'net_ldap_async'} ? :
109 2 0 if @_ % 2
113 0 2 ref $host ? :
116 2 0 if (defined $h)
117 0 2 if $h =~ s[^(\w+)://][]
121 0 2 unless my $meth = $obj->can("connect_$scheme")
122 2 0 if (&$meth($obj, $h, $arg))
129 0 2 unless $obj->{'net_ldap_socket'}
132 0 0 $arg->{'keepalive'} ? :
0 2 if defined $arg->{'keepalive'}
137 2 0 $arg->{'async'} ? :
138 0 2 if $arg->{'raw'}
140 0 2 if (defined(my $onerr = $arg->{'onerror'}))
141 0 0 if exists $onerror{$onerr}
154 0 0 $arg->{'inet6'} ? :
0 0 $arg->{'inet4'} ? :
157 0 0 if $host =~ s/^([^:]+|\[.*\]):(\d+)$/$1/
159 0 0 if ($arg->{'inet6'} and !1)
173 0 0 $class eq 'IO::Socket::IP' ? :
0 0 defined $arg->{'timeout'} ? :
0 0 unless $ldap->{'net_ldap_socket'} = $class->new('PeerAddr', $host, 'PeerPort', $port, 'LocalAddr', $arg->{'localaddr'} || undef, 'Proto', 'tcp', $class eq 'IO::Socket::IP' ? 'Family' : 'Domain', $domain, 'MultiHomed', $arg->{'multihomed'}, 'Timeout', defined $arg->{'timeout'} ? $arg->{'timeout'} : 120)
187 0 0 $arg->{'inet6'} ? :
0 0 $arg->{'inet4'} ? :
189 0 0 if ($arg->{'inet6'} and !1)
197 0 0 if $host =~ s/^([^:]+|\[.*\]):(\d+)$/$1/
205 0 0 defined $arg->{'timeout'} ? :
0 0 unless $ldap->{'net_ldap_socket'} = 'IO::Socket::SSL'->new('PeerAddr', $host, 'PeerPort', $port, 'LocalAddr', $arg->{'localaddr'} || undef, 'Proto', 'tcp', 'Domain', $domain, 'Timeout', defined $arg->{'timeout'} ? $arg->{'timeout'} : 120, _SSL_context_init_args({'sslserver', $host, %$arg}))
220 0 0 if (exists $arg->{'verify'})
222 0 0 exists $ssl_verify{$v} ? :
224 0 0 if ($verify)
227 0 0 if defined $arg->{'sslserver'}
231 0 0 if (exists $arg->{'clientcert'})
233 0 0 if (exists $arg->{'clientkey'}) { }
241 0 0 if ($arg->{'checkcrl'} and not $arg->{'capath'})
246 0 0 if (exists $arg->{'keydecrypt'})
251 0 0 if (defined $arg->{'sslversion'})
264 0 0 defined $arg->{'ciphers'} ? :
0 0 defined $arg->{'sslversion'} ? :
0 0 exists $arg->{'cafile'} ? :
0 0 exists $arg->{'capath'} ? :
0 0 $clientcert ? :
0 0 $arg->{'checkcrl'} ? :
0 0 $clientcert ? :
275 0 0 unless length $peer
284 0 0 defined $arg->{'timeout'} ? :
0 0 unless $ldap->{'net_ldap_socket'} = 'IO::Socket::UNIX'->new('Peer', $peer, 'Timeout', defined $arg->{'timeout'} ? $arg->{'timeout'} : 120)
289 0 0 if ('Socket'->can('getnameinfo') and 'Socket'->can('getaddrinfo'))
293 0 0 unless $err
295 0 0 if $_->{'canonname'}
0 0 unless $err
313 0 2 @_ ? :
319 0 4 if $_[0]
323 2 2 @_ ? :
336 0 2 exists $opt{'sasl_layer'} && !$opt{'sasl_layer'} ? :
343 0 0 $ldap->{'net_ldap_scheme'} ne 'ldapi' ? :
347 0 0 unless $_[0]{'net_ldap_port'}
366 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
369 0 0 unless $mesg->encode('unbindRequest', 1, 'controls', $control)
383 0 0 if $^W
407 0 2 if exists $arg->{'version'}
411 0 2 if my $control = delete $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
414 0 2 ref $dn ? :
419 0 2 scalar keys %$arg ? :
423 0 16 if (exists $arg->{$param})
424 0 0 $type eq 'anon' ? :
425 0 0 if $type eq 'simple' and $passwd eq ''
431 0 2 unless $auth_type
434 0 2 if ($auth_type eq 'sasl')
437 0 0 if $ldap->{'net_ldap_version'} < 3
442 0 0 if (ref $sasl and $sasl->isa('Authen::SASL')) { }
450 0 0 if (exists $arg->{'sasl_host'})
451 0 0 if ($arg->{'sasl_host'}) { }
0 0 elsif ($ldap->{'net_ldap_rawsocket'}->can('peerhost')) { }
469 0 0 unless defined $sasl_conn
480 0 0 unless defined $initial
494 0 2 unless $mesg->encode('bindRequest', \%stash, 'controls', $control)
513 0 0 if $ldap->{'raw'} and not defined $arg->{'raw'}
518 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
524 0 0 unless (ref($filter = $arg->{'filter'}))
527 0 0 unless $f->parse($filter)
540 0 0 ref $base ? :
543 0 0 if (exists $arg->{'scope'})
545 0 0 exists $scope{$sc} ? :
548 0 0 if (exists $arg->{'deref'})
550 0 0 exists $deref{$dr} ? :
554 0 0 unless $mesg->encode('searchRequest', \%stash, 'controls', $control)
569 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
573 0 0 unless my $entry = $arg->{'dn'}
575 0 0 unless (ref $entry)
579 0 0 unless $arg->{'attrs'} or $arg->{'attr'}
583 0 0 unless $mesg->encode('addRequest', $entry->asn, 'controls', $control)
600 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
604 0 0 unless my $dn = $arg->{'dn'}
609 0 0 if (exists $arg->{'changes'}) { }
614 0 0 unless defined($opcode = $opcode{$arg->{'changes'}[$j++]})
617 0 0 if (ref $chg)
620 0 0 ref $$chg[$i + 1] ? :
634 0 0 unless exists $arg->{$op}
638 0 0 if (ref $opt eq 'HASH') { }
0 0 elsif (ref $opt eq 'ARRAY') { }
640 0 0 ref $v ? :
654 0 0 $opcode == 1 ? :
655 0 0 ref $val ? :
676 0 0 ref $dn ? :
0 0 unless $mesg->encode('modifyRequest', {'object', ref $dn ? $dn->dn : $dn, 'modification', \@ops}, 'controls', $control)
694 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
698 0 0 unless my $dn = $arg->{'dn'}
700 0 0 ref $dn ? :
0 0 unless $mesg->encode('delRequest', ref $dn ? $dn->dn : $dn, 'controls', $control)
717 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
721 0 0 unless my $dn = $arg->{'dn'}
724 0 0 unless my $new = $arg->{'newrdn'} || $arg->{'new'}
726 0 0 ref $dn ? :
0 0 ref $new ? :
0 0 ref $newsup ? :
0 0 unless $mesg->encode('modDNRequest', {'entry', ref $dn ? $dn->dn : $dn, 'newrdn', ref $new ? $new->dn : $new, 'deleteoldrdn', $del, 'newSuperior', ref $newsup ? $newsup->dn : $newsup}, 'controls', $control)
749 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
753 0 0 unless my $dn = $arg->{'dn'}
758 0 0 exists $arg->{'attrs'} ? :
0 0 exists $arg->{'attr'} ? :
764 0 0 exists $arg->{'attrs'} ? :
0 0 exists $arg->{'value'} ? :
768 0 0 ref $dn ? :
0 0 unless $mesg->encode('compareRequest', {'entry', ref $dn ? $dn->dn : $dn, 'ava', {'attributeDesc', $attr, 'assertionValue', $value}}, 'controls', $control)
784 0 0 if @_ & 1
792 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
795 0 0 ref $id ? :
0 0 unless $mesg->encode('abandonRequest', ref $id ? $id->mesg_id : $id, 'controls', $control)
811 0 0 if $ldap->{'net_ldap_version'} < 3
819 0 0 unless $mesg->encode('extendedReq', {'requestName', $arg->{'name'}, 'requestValue', $arg->{'value'}}, 'controls', $arg->{'control'})
830 0 0 unless defined $table
832 0 0 if ref $mid
833 0 0 defined $mid ? :
834 0 0 if $err = $ldap->process($mid)
850 0 2 if ($debug = $ldap->debug)
854 0 0 if $debug & 1
857 0 0 if $debug & 4
861 0 2 unless my $socket = $ldap->socket
872 0 2 unless my $n = syswrite($socket, $s, length $s)
883 2 0 unless ($mesg->done)
887 0 2 if ($sync)
889 0 0 if $err
894 0 2 $sync && $ldap->{'net_ldap_onerror'} && $mesg->is_error ? :
900 0 0 unless my $sock = $ldap->socket
909 0 0 unless my $sock = $ldap->socket
913 0 0 unless asn_read($sock, $pdu)
917 0 0 if ($debug = $ldap->debug)
921 0 0 if $debug & 2
924 0 0 if $debug & 8
928 0 0 unless my $result = $Net::LDAP::LDAPResponse->decode($pdu)
934 0 0 unless ($mesg)
935 0 0 if (my $ext = $result->{'protocolOp'}{'extendedResp'})
936 0 0 if (($ext->{'responseName'} || '') eq '1.3.6.1.4.1.1466.20036')
942 0 0 if $debug & 10
946 0 0 unless $mesg->decode($result)
949 0 0 if defined $what and $what == $mid
965 2 0 if $sock
967 2 0 if (my $msgs = delete $self->{'net_ldap_mesg'})
969 0 2 unless defined $mesg
1008 0 0 if (exists $arg{'dn'}) { }
1012 0 0 unless my $root = $self->root_dse('attrs', ['subschemaSubentry'])
1035 0 0 $mesg->code ? :
1058 0 0 if $root
1069 0 0 if $root
1071 0 0 unless $arg{'attrs'}
1085 0 0 if $sock->isa('IO::Socket::SSL')
1088 0 0 if $ldap->version < 3
1100 0 0 if $mesg->code
1105 0 0 unless defined $arg->{'sslserver'}
1109 0 0 if 'IO::Socket::SSL'->start_SSL($sock, {_SSL_context_init_args($arg)})
1114 0 0 if ($sock_class ne ref $sock)
1124 0 0 $ldap->socket->isa('IO::Socket::SSL') ? :
1131 0 0 $ldap->socket->isa('IO::Socket::SSL') ? :
1142 0 2 @_ ? :
1147 0 3 if tied %$self
1155 0 3 unless tied %{$_[0];}
1164 2 3 unless my $inner = tied %$ldap
1166 2 1 unless --$inner->{'net_ldap_refcnt'}