scan_bind_response.c

filter: Statementstmt 88.2% 30 / 34 Branchbran 55.5% 10 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 76.9% 40 / 52 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« pack_controls.c ↑ Summary scan_delete_request.c »
1 #include "scan.h"
2 #include "util.h"
3 #include "enum2sv.h"
4  
5 void
6 2 scan_bind_response(const char **src, const char *max, HV *out) {
7 I32 r;
8 SV *sv;
9 U8 type;
10 U32 tag;
11  
12 2 scan_enum(src, max, &r);
13 2 hv_stores(out, "result", newSVsv(ldap_error2sv_noinc(r)));
14  
15 2 sv = newSV(0);
16 2 hv_stores(out, "matched_dn", sv);
17 2 scan_string_utf8(src, max, sv);
18  
19 2 sv = newSV(0);
20 2 hv_stores(out, "message", sv);
21 2 scan_string_utf8(src, max, sv);
22  
23 2 ▶ if (*src == max) return;
Branch: 1 branch
BranchTrueFalseTotal
if (*src == max) return; 0 2 2
24 2 scan_tag(src, max, &type, &tag);
25 2 ▶ if (tag == 3) { /* referral */
Branch: 1 branch
BranchTrueFalseTotal
if (tag == 3) { /* referral */ 2 0 2
26 AV *referrals;
27 const char *nmax;
28 STRLEN len;
29  
30 2 ▶ if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED))
Branch: 1 branch
BranchTrueFalseTotal
if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED)) 0 2 2
31 0 croak("bad packed data");
32 2 scan_length(src, max, &len);
33 2 ▶ if (len > max - *src)
Branch: 1 branch
BranchTrueFalseTotal
if (len > max - *src) 0 2 2
34 0 croak("scan_result_response: packet too short");
35 2 nmax = *src + len;
36 2 referrals = newAV();
37 2 hv_stores(out, "referrals", newRV_noinc((SV*)referrals));
38  
39 6 ▶ while (*src < nmax) {
Branch: 1 branch
BranchTrueFalseTotal
while (*src < nmax) { 4 2 6
40 4 SV *v = newSV(0);
41 4 av_push(referrals, v);
42 4 scan_string_utf8(src, nmax, v);
43 }
44  
45 2 ▶ if (*src == max) return;
Branch: 1 branch
BranchTrueFalseTotal
if (*src == max) return; 0 2 2
46 2 scan_tag(src, max, &type, &tag);
47 }
48 2 ▶ if (tag == 7) {
Branch: 1 branch
BranchTrueFalseTotal
if (tag == 7) { 2 0 2
49 SV *sasl;
50 STRLEN len;
51 2 ▶ if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE))
Branch: 1 branch
BranchTrueFalseTotal
if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE)) 0 2 2
52 0 croak("bad packet data");
53 2 sasl = newSV(0);
54 2 hv_stores(out, "sasl_credentials", sasl);
55 2 scan_raw_notag(src, max, sasl);
56  
57 2 ▶ if (*src == max) return;
Branch: 1 branch
BranchTrueFalseTotal
if (*src == max) return; 2 0 2
58 }
59
60 0 croak("bad packet data");
61 }
« pack_controls.c ↑ Summary scan_delete_request.c »