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 defined $arg->{'timeout'} ? :
0 0 unless $ldap->{'net_ldap_socket'} = $class->new('PeerAddr', $host, 'PeerPort', $port, 'LocalAddr', $arg->{'localaddr'} || undef, 'Proto', 'tcp', '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/
199 0 0 unless defined $arg->{'sslserver'}
207 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($arg))
222 0 0 if (exists $arg->{'verify'})
224 0 0 exists $ssl_verify{$v} ? :
226 0 0 if ($verify)
229 0 0 if defined $arg->{'sslserver'}
233 0 0 if (exists $arg->{'clientcert'})
235 0 0 if (exists $arg->{'clientkey'}) { }
243 0 0 if ($arg->{'checkcrl'} and not $arg->{'capath'})
248 0 0 if (exists $arg->{'keydecrypt'})
253 0 0 if (defined $arg->{'sslversion'})
266 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 ? :
277 0 0 unless length $peer
286 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)
291 0 0 if ('Socket'->can('getnameinfo') and 'Socket'->can('getaddrinfo'))
295 0 0 unless $err
297 0 0 if $_->{'canonname'}
0 0 unless $err
315 0 2 @_ ? :
321 0 4 if $_[0]
325 2 2 @_ ? :
338 0 2 exists $opt{'sasl_layer'} && !$opt{'sasl_layer'} ? :
345 0 0 $ldap->{'net_ldap_scheme'} ne 'ldapi' ? :
349 0 0 unless $_[0]{'net_ldap_port'}
368 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
371 0 0 unless $mesg->encode('unbindRequest', 1, 'controls', $control)
385 0 0 if $^W
409 0 2 if exists $arg->{'version'}
413 0 2 if my $control = delete $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
416 0 2 ref $dn ? :
421 0 2 scalar keys %$arg ? :
425 0 16 if (exists $arg->{$param})
426 0 0 $type eq 'anon' ? :
427 0 0 if $type eq 'simple' and $passwd eq ''
433 0 2 unless $auth_type
436 0 2 if ($auth_type eq 'sasl')
439 0 0 if $ldap->{'net_ldap_version'} < 3
444 0 0 if (ref $sasl and $sasl->isa('Authen::SASL')) { }
452 0 0 if (exists $arg->{'sasl_host'})
453 0 0 if ($arg->{'sasl_host'}) { }
0 0 elsif ($ldap->{'net_ldap_rawsocket'}->can('peerhost')) { }
471 0 0 unless defined $sasl_conn
482 0 0 unless defined $initial
496 0 2 unless $mesg->encode('bindRequest', \%stash, 'controls', $control)
515 0 0 if $ldap->{'raw'} and not defined $arg->{'raw'}
520 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
526 0 0 unless (ref($filter = $arg->{'filter'}))
529 0 0 unless $f->parse($filter)
542 0 0 ref $base ? :
545 0 0 if (exists $arg->{'scope'})
547 0 0 exists $scope{$sc} ? :
550 0 0 if (exists $arg->{'deref'})
552 0 0 exists $deref{$dr} ? :
556 0 0 unless $mesg->encode('searchRequest', \%stash, 'controls', $control)
571 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
575 0 0 unless my $entry = $arg->{'dn'}
577 0 0 unless (ref $entry)
581 0 0 unless $arg->{'attrs'} or $arg->{'attr'}
585 0 0 unless $mesg->encode('addRequest', $entry->asn, 'controls', $control)
602 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
606 0 0 unless my $dn = $arg->{'dn'}
611 0 0 if (exists $arg->{'changes'}) { }
616 0 0 unless defined($opcode = $opcode{$arg->{'changes'}[$j++]})
619 0 0 if (ref $chg)
622 0 0 ref $$chg[$i + 1] ? :
636 0 0 unless exists $arg->{$op}
640 0 0 if (ref $opt eq 'HASH') { }
0 0 elsif (ref $opt eq 'ARRAY') { }
642 0 0 ref $v ? :
656 0 0 $opcode == 1 ? :
657 0 0 ref $val ? :
678 0 0 ref $dn ? :
0 0 unless $mesg->encode('modifyRequest', {'object', ref $dn ? $dn->dn : $dn, 'modification', \@ops}, 'controls', $control)
696 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
700 0 0 unless my $dn = $arg->{'dn'}
702 0 0 ref $dn ? :
0 0 unless $mesg->encode('delRequest', ref $dn ? $dn->dn : $dn, 'controls', $control)
719 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
723 0 0 unless my $dn = $arg->{'dn'}
726 0 0 unless my $new = $arg->{'newrdn'} || $arg->{'new'}
728 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)
751 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
755 0 0 unless my $dn = $arg->{'dn'}
760 0 0 exists $arg->{'attrs'} ? :
0 0 exists $arg->{'attr'} ? :
766 0 0 exists $arg->{'attrs'} ? :
0 0 exists $arg->{'value'} ? :
770 0 0 ref $dn ? :
0 0 unless $mesg->encode('compareRequest', {'entry', ref $dn ? $dn->dn : $dn, 'ava', {'attributeDesc', $attr, 'assertionValue', $value}}, 'controls', $control)
786 0 0 if @_ & 1
794 0 0 if my $control = $arg->{'control'} and $ldap->{'net_ldap_version'} < 3
797 0 0 ref $id ? :
0 0 unless $mesg->encode('abandonRequest', ref $id ? $id->mesg_id : $id, 'controls', $control)
813 0 0 if $ldap->{'net_ldap_version'} < 3
821 0 0 unless $mesg->encode('extendedReq', {'requestName', $arg->{'name'}, 'requestValue', $arg->{'value'}}, 'controls', $arg->{'control'})
832 0 0 unless defined $table
834 0 0 if ref $mid
835 0 0 defined $mid ? :
836 0 0 if $err = $ldap->process($mid)
852 0 2 if ($debug = $ldap->debug)
856 0 0 if $debug & 1
859 0 0 if $debug & 4
863 0 2 unless my $socket = $ldap->socket
874 0 2 unless my $n = syswrite($socket, $s, length $s)
885 2 0 unless ($mesg->done)
889 0 2 if ($sync)
891 0 0 if $err
896 0 2 $sync && $ldap->{'net_ldap_onerror'} && $mesg->is_error ? :
902 0 0 unless my $sock = $ldap->socket
911 0 0 unless my $sock = $ldap->socket
915 0 0 unless asn_read($sock, $pdu)
919 0 0 if ($debug = $ldap->debug)
923 0 0 if $debug & 2
926 0 0 if $debug & 8
930 0 0 unless my $result = $Net::LDAP::LDAPResponse->decode($pdu)
936 0 0 unless ($mesg)
937 0 0 if (my $ext = $result->{'protocolOp'}{'extendedResp'})
938 0 0 if (($ext->{'responseName'} || '') eq '1.3.6.1.4.1.1466.20036')
944 0 0 if $debug & 10
948 0 0 unless $mesg->decode($result)
951 0 0 if defined $what and $what == $mid
967 2 0 if $sock
969 2 0 if (my $msgs = delete $self->{'net_ldap_mesg'})
971 0 2 unless defined $mesg
1010 0 0 if (exists $arg{'dn'}) { }
1014 0 0 unless my $root = $self->root_dse('attrs', ['subschemaSubentry'])
1037 0 0 $mesg->code ? :
1060 0 0 if $root
1071 0 0 if $root
1073 0 0 unless $arg{'attrs'}
1087 0 0 if $sock->isa('IO::Socket::SSL')
1090 0 0 if $ldap->version < 3
1102 0 0 if $mesg->code
1107 0 0 unless defined $arg->{'sslserver'}
1111 0 0 if 'IO::Socket::SSL'->start_SSL($sock, {_SSL_context_init_args($arg)})
1116 0 0 if ($sock_class ne ref $sock)
1126 0 0 $ldap->socket->isa('IO::Socket::SSL') ? :
1133 0 0 $ldap->socket->isa('IO::Socket::SSL') ? :
1144 0 2 @_ ? :
1149 0 3 if tied %$self
1157 0 3 unless tied %{$_[0];}
1166 2 3 unless my $inner = tied %$ldap
1168 2 1 unless --$inner->{'net_ldap_refcnt'}