1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "ldap.h"
static size_t doit(char* dest,const struct AttributeDescriptionList* adl,int seq) {
const struct AttributeDescriptionList* x=adl;
size_t sum=0,tmp;
while (x) {
sum+=fmt_asn1OCTETSTRING(0,0,x->a.l);
x=x->next;
}
if (seq)
tmp=fmt_asn1SEQUENCE(dest,sum);
else
tmp=fmt_asn1SET(dest,sum);
sum+=tmp;
if (dest) {
dest+=tmp;
x=adl;
while (x) {
dest+=fmt_ldapstring(dest,&x->a);
x=x->next;
}
}
return sum;
}
size_t fmt_ldapadl(char* dest,const struct AttributeDescriptionList* adl) {
return doit(dest,adl,1);
}
size_t fmt_ldapavl(char* dest,const struct AttributeDescriptionList* adl) {
return doit(dest,adl,0);
}
|