| 1 |
|
| #include "scan.h" |
| 2 |
|
| #include "enum2sv.h" |
| 3 |
|
| |
| 4 |
|
| void |
| 5 |
2 |
| scan_extended_response(const char **src, const char *max, HV *out) { |
| 6 |
|
| I32 r; |
| 7 |
|
| SV *sv; |
| 8 |
|
| U8 type; |
| 9 |
|
| U32 tag; |
| 10 |
|
| |
| 11 |
2 |
| scan_enum(src, max, &r); |
| 12 |
2 |
| hv_stores(out, "result", newSVsv(ldap_error2sv_noinc(r))); |
| 13 |
|
| |
| 14 |
2 |
| sv = newSV(0); |
| 15 |
2 |
| hv_stores(out, "matched_dn", sv); |
| 16 |
2 |
| scan_string_utf8(src, max, sv); |
| 17 |
|
| |
| 18 |
2 |
| sv = newSV(0); |
| 19 |
2 |
| hv_stores(out, "message", sv); |
| 20 |
2 |
| scan_string_utf8(src, max, sv); |
| 21 |
|
| |
| 22 |
2 |
▶ | if (*src == max) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (*src == max) return; |
0 |
2 |
2 |
|
| 23 |
2 |
| scan_tag(src, max, &type, &tag); |
| 24 |
2 |
▶ | if (tag == 3) { /* referral */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (tag == 3) { /* referral */ |
2 |
0 |
2 |
|
| 25 |
|
| AV *referrals; |
| 26 |
|
| const char *nmax; |
| 27 |
|
| STRLEN len; |
| 28 |
|
| |
| 29 |
2 |
▶ | if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED)) |
0 |
2 |
2 |
|
| 30 |
0 |
| croak("bad packed data"); |
| 31 |
2 |
| scan_length(src, max, &len); |
| 32 |
2 |
▶ | if (len > max - *src) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len > max - *src) |
0 |
2 |
2 |
|
| 33 |
0 |
| croak("scan_result_response: packet too short"); |
| 34 |
2 |
| nmax = *src + len; |
| 35 |
2 |
| referrals = newAV(); |
| 36 |
2 |
| hv_stores(out, "referrals", newRV_noinc((SV*)referrals)); |
| 37 |
|
| |
| 38 |
6 |
▶ | while (*src < nmax) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (*src < nmax) { |
4 |
2 |
6 |
|
| 39 |
4 |
| SV *v = newSV(0); |
| 40 |
4 |
| av_push(referrals, v); |
| 41 |
4 |
| scan_string_utf8(src, nmax, v); |
| 42 |
|
| } |
| 43 |
|
| |
| 44 |
2 |
▶ | if (*src == max) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (*src == max) return; |
0 |
2 |
2 |
|
| 45 |
2 |
| scan_tag(src, max, &type, &tag); |
| 46 |
|
| } |
| 47 |
2 |
▶ | if (tag == 10) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (tag == 10) { |
2 |
0 |
2 |
|
| 48 |
|
| SV *name; |
| 49 |
2 |
▶ | if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE)) |
0 |
2 |
2 |
|
| 50 |
0 |
| croak("bad packet data"); |
| 51 |
2 |
| name = newSV(0); |
| 52 |
2 |
| hv_stores(out, "name", name); |
| 53 |
2 |
| scan_raw_notag(src, max, name); |
| 54 |
2 |
▶ | if (*src == max) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (*src == max) return; |
0 |
2 |
2 |
|
| 55 |
2 |
| scan_tag(src, max, &type, &tag); |
| 56 |
|
| } |
| 57 |
2 |
▶ | if (tag == 11) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (tag == 11) { |
2 |
0 |
2 |
|
| 58 |
|
| SV *value; |
| 59 |
2 |
▶ | if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (type != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE)) |
0 |
2 |
2 |
|
| 60 |
0 |
| croak("bad packet data"); |
| 61 |
2 |
| value = newSV(0); |
| 62 |
2 |
| hv_stores(out, "value", value); |
| 63 |
2 |
| scan_raw_notag(src, max, value); |
| 64 |
2 |
▶ | if (*src == max) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (*src == max) return; |
2 |
0 |
2 |
|
| 65 |
|
| } |
| 66 |
0 |
| croak("bad packet data"); |
| 67 |
|
| } |