| 1 |
|
| #include "scan.h" |
| 2 |
|
| #include "enum2sv.h" |
| 3 |
|
| |
| 4 |
|
| void |
| 5 |
4 |
| scan_modify_request(const char** src, const char* max, HV *out) { |
| 6 |
|
| STRLEN len; |
| 7 |
4 |
| SV *dn = newSV(0); |
| 8 |
|
| AV *changes; |
| 9 |
|
| |
| 10 |
4 |
| hv_stores(out, "dn", dn); |
| 11 |
4 |
| scan_string_utf8(src, max, dn); |
| 12 |
4 |
▶ | scan_sequence(src, max, &len); |
Branch: 2 branches
| Branch | True | False | Total |
| scan_sequence(src, max, &len); |
4 |
0 |
4 |
| scan_sequence(src, max, &len); |
4 |
0 |
4 |
|
| 13 |
|
| |
| 14 |
4 |
▶ | if (len != max - *src) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len != max - *src) |
0 |
4 |
4 |
|
| 15 |
0 |
| croak("scan_modify_request: packet too short"); |
| 16 |
|
| |
| 17 |
4 |
| changes = newAV(); |
| 18 |
4 |
| hv_stores(out, "changes", newRV_noinc((SV*)changes)); |
| 19 |
|
| |
| 20 |
14 |
▶ | while (*src < max) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (*src < max) { |
10 |
4 |
14 |
|
| 21 |
|
| const char *operation_max; |
| 22 |
|
| HV *change; |
| 23 |
|
| I32 operation; |
| 24 |
|
| SV *attribute; |
| 25 |
|
| AV *values; |
| 26 |
|
| |
| 27 |
10 |
| change = newHV(); |
| 28 |
10 |
| av_push(changes, newRV_noinc((SV*)change)); |
| 29 |
10 |
▶ | scan_sequence(src, max, &len); |
Branch: 2 branches
| Branch | True | False | Total |
| scan_sequence(src, max, &len); |
10 |
0 |
10 |
| scan_sequence(src, max, &len); |
10 |
0 |
10 |
|
| 30 |
10 |
| operation_max = *src + len; |
| 31 |
|
| |
| 32 |
10 |
| scan_enum(src, operation_max, &operation); |
| 33 |
10 |
| hv_stores(change, "operation", newSVsv(ldap_modop2sv_noinc(operation))); |
| 34 |
|
| |
| 35 |
10 |
▶ | scan_sequence(src, max, &len); |
Branch: 2 branches
| Branch | True | False | Total |
| scan_sequence(src, max, &len); |
10 |
0 |
10 |
| scan_sequence(src, max, &len); |
10 |
0 |
10 |
|
| 36 |
10 |
▶ | if (len != operation_max - *src) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len != operation_max - *src) |
0 |
10 |
10 |
|
| 37 |
0 |
| croak("scan_modify_request: packet too short"); |
| 38 |
|
| |
| 39 |
10 |
| attribute = newSV(0); |
| 40 |
10 |
| hv_stores(change, "attribute", attribute); |
| 41 |
10 |
| scan_string_utf8(src, operation_max, attribute); |
| 42 |
|
| |
| 43 |
10 |
▶ | scan_set(src, operation_max, &len); |
Branch: 2 branches
| Branch | True | False | Total |
| scan_set(src, operation_max, &len); |
10 |
0 |
10 |
| scan_set(src, operation_max, &len); |
10 |
0 |
10 |
|
| 44 |
10 |
▶ | if (len != operation_max - *src) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len != operation_max - *src) |
0 |
10 |
10 |
|
| 45 |
0 |
| croak("scan_modify_request: packet too short"); |
| 46 |
|
| |
| 47 |
10 |
| values = newAV(); |
| 48 |
10 |
| hv_stores(change, "values", newRV_noinc((SV*)values)); |
| 49 |
22 |
▶ | while (*src < operation_max) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (*src < operation_max) { |
12 |
10 |
22 |
|
| 50 |
12 |
| SV *v = newSV(0); |
| 51 |
12 |
| av_push(values, v); |
| 52 |
12 |
| scan_string_utf8(src, operation_max, v); |
| 53 |
|
| } |
| 54 |
|
| } |
| 55 |
4 |
| } |
| 56 |
|
| |