| 1 |
|
| #include "pack.h" |
| 2 |
|
| #include "util.h" |
| 3 |
|
| |
| 4 |
|
| #include <string.h> |
| 5 |
|
| |
| 6 |
|
| void |
| 7 |
0 |
| pack_bind_request_args(SV* dest, U32 version, SV *dn, I32 method, SV *arg1, SV *arg2) { |
| 8 |
0 |
| STRLEN offset = start_constructed(dest, |
| 9 |
|
| ASN1_APPLICATION|ASN1_CONSTRUCTED, |
| 10 |
|
| LDAP_OP_BIND_REQUEST); |
| 11 |
|
| |
| 12 |
0 |
| pack_int(dest, version); |
| 13 |
0 |
| pack_string_utf8(dest, dn); |
| 14 |
|
| |
| 15 |
0 |
▶ | switch(method) { |
Branch: 1 branch
| Branch | True | False | Total |
| switch(method) { |
0 |
0 |
0 |
|
| 16 |
0 |
| case LDAP_AUTH_SIMPLE: |
| 17 |
0 |
| pack_raw_utf8(dest, ASN1_CONTEXT_SPECIFIC|ASN1_PRIMITIVE, LDAP_AUTH_SIMPLE, arg1); |
| 18 |
0 |
| break; |
| 19 |
0 |
| case LDAP_AUTH_SASL: |
| 20 |
|
| |
| 21 |
|
| default: |
| 22 |
0 |
| croak("unsupported authentication schema %d", (int)method); |
| 23 |
|
| break; |
| 24 |
|
| } |
| 25 |
|
| |
| 26 |
0 |
| end_constructed(dest, offset); |
| 27 |
0 |
| } |
| 28 |
|
| |
| 29 |
|
| void |
| 30 |
1 |
| pack_bind_request_ref(SV *dest, HV *hv) { |
| 31 |
|
| I32 method; |
| 32 |
|
| SV **svp; |
| 33 |
|
| |
| 34 |
1 |
| STRLEN offset = start_constructed(dest, |
| 35 |
|
| ASN1_APPLICATION|ASN1_CONSTRUCTED, |
| 36 |
|
| LDAP_OP_BIND_REQUEST); |
| 37 |
1 |
| svp = hv_fetchs(hv, "version", 0); |
| 38 |
1 |
▶ | pack_int(dest, (svp ? SvIV(*svp) : 3)); |
Branch: 1 branch
| Branch | True | False | Total |
| pack_int(dest, (svp ? SvIV(*svp) : 3)); |
1 |
0 |
1 |
|
| 39 |
1 |
| pack_string_utf8(dest, hv_fetchs_def_no(hv, "dn")); |
| 40 |
1 |
| svp = hv_fetchs(hv, "method", 0); |
| 41 |
1 |
▶ | method = (svp ? SvIV(*svp) : LDAP_AUTH_SIMPLE); |
Branch: 1 branch
| Branch | True | False | Total |
| method = (svp ? SvIV(*svp) : LDAP_AUTH_SIMPLE); |
1 |
0 |
1 |
|
| 42 |
1 |
▶ | switch(method) { |
Branch: 1 branch
| Branch | True | False | Total |
| switch(method) { |
1 |
0 |
1 |
|
| 43 |
1 |
| case LDAP_AUTH_SIMPLE: |
| 44 |
1 |
| pack_raw_utf8(dest, |
| 45 |
|
| ASN1_CONTEXT_SPECIFIC|ASN1_PRIMITIVE, |
| 46 |
|
| LDAP_AUTH_SIMPLE, |
| 47 |
|
| hv_fetchs_def_no(hv, "password")); |
| 48 |
1 |
| break; |
| 49 |
0 |
| case LDAP_AUTH_SASL: |
| 50 |
|
| default: |
| 51 |
0 |
| croak("unsupported authentication schema %d", (int)method); |
| 52 |
|
| break; |
| 53 |
|
| } |
| 54 |
1 |
| end_constructed(dest, offset); |
| 55 |
1 |
| } |