summaryrefslogtreecommitdiffstats
path: root/fmt_ldapresult.c
blob: 6d2b79d5de96bdca32e7b64bb981b654c9955dbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "ldap.h"
#include <str.h>

size_t fmt_ldapresult(char* dest,long result,const char* matcheddn,const char* errormessage,const char* referral) {
  size_t l,sum=0,nlen;
  sum=l=fmt_asn1ENUMERATED(dest,result);
  if (dest) dest+=l;
  nlen=str_len(matcheddn);
  l=fmt_asn1OCTETSTRING(dest,matcheddn,nlen);
  sum+=l; if (dest) dest+=l;
  nlen=str_len(errormessage);
  l=fmt_asn1OCTETSTRING(dest,errormessage,nlen);
  sum+=l; if (dest) dest+=l;
  if (referral && *referral) {
    nlen=str_len(referral);
    l=fmt_asn1OCTETSTRING(dest,referral,nlen);
    sum+=l;
  }
  return sum;
}