summaryrefslogtreecommitdiffstats
path: root/fmt_ldapbindrequest.c
diff options
context:
space:
mode:
authorSimon Rettberg2014-03-15 01:49:50 +0100
committerSimon Rettberg2014-03-15 01:49:50 +0100
commitbedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad (patch)
treec7d1995a09f6ed0c4e6873252e957d72f5d07d07 /fmt_ldapbindrequest.c
downloadldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.gz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.xz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.zip
Lean and mean initial commit
Not much functionality yet
Diffstat (limited to 'fmt_ldapbindrequest.c')
-rw-r--r--fmt_ldapbindrequest.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fmt_ldapbindrequest.c b/fmt_ldapbindrequest.c
new file mode 100644
index 0000000..5e92bf2
--- /dev/null
+++ b/fmt_ldapbindrequest.c
@@ -0,0 +1,18 @@
+#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;
+}