summaryrefslogtreecommitdiffstats
path: root/fmt_ldappal.c
blob: 1a6bef359afeb824e136907dbbc868060cb0474c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "ldap.h"

size_t fmt_ldappal(char* dest,const struct PartialAttributeList* pal) {
//  int l,l2,sum;
  size_t sum,l,l2;
  if (!pal) return 0;
  sum=fmt_ldapstring(0,&pal->type);
  /* look how much space the adl needs */
  l=fmt_ldapavl(0,pal->values);
  /* write sequence header */
  l2=fmt_asn1SEQUENCE(dest,l+sum);
  if (dest) {
    fmt_ldapstring(dest+l2,&pal->type);
    dest+=sum+l2;
  }
  sum+=l+l2;
  if (dest) {
    fmt_ldapavl(dest,pal->values);
    dest+=l;
  }
  return sum+fmt_ldappal(dest,pal->next);
}