Files
mars-tinyldap/fmt_ldapbindrequest.c
leitner 6ef84457cc fix two bugs in the indexing code found by Georg Lehner
silence if statement indentation warnings (gcc has become more picky)
2017-02-25 08:40:23 +00:00

21 lines
575 B
C

#include <string.h>
#include "ldap.h"
#include "str.h"
#include "rangecheck.h"
size_t fmt_ldapbindrequest(char* dest,long version,const char* name,const char* simple) {
size_t l,sum;
size_t nlen=str_len(name);
sum=l=fmt_asn1INTEGER(dest,version);
if (dest) dest+=l;
l=fmt_asn1OCTETSTRING(dest,name,nlen);
if (add_of(sum,sum,l)) return (size_t)-1;
if (dest) dest+=l;
// sum+=l; if (dest) dest+=l;
nlen=str_len(simple);
l=fmt_asn1string(dest,PRIVATE,PRIMITIVE,0,simple,nlen);
if (add_of(sum,sum,l)) return (size_t)-1;
if (dest) dest+=l;
return sum;
}