summaryrefslogtreecommitdiffstats
path: root/scan_ldapmessage.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 /scan_ldapmessage.c
downloadldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.gz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.xz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.zip
Lean and mean initial commit
Not much functionality yet
Diffstat (limited to 'scan_ldapmessage.c')
-rw-r--r--scan_ldapmessage.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/scan_ldapmessage.c b/scan_ldapmessage.c
new file mode 100644
index 0000000..baa1173
--- /dev/null
+++ b/scan_ldapmessage.c
@@ -0,0 +1,21 @@
+#include "ldap.h"
+
+size_t scan_ldapmessage(const char* src,const char* max,
+ unsigned long* messageid,unsigned long* op,size_t* len) {
+ size_t res,tmp;
+ if (!(res=scan_asn1SEQUENCE(src,max,len))) goto error;
+ if (!(tmp=scan_asn1INTEGER(src+res,max,(long*)messageid))) goto error;
+ res+=tmp;
+ {
+ enum asn1_tagclass tc;
+ enum asn1_tagtype tt;
+ if (!(tmp=scan_asn1tag(src+res,max,&tc,&tt,op))) goto error;
+ if (tc!=APPLICATION) goto error;
+ res+=tmp;
+ if (!(tmp=scan_asn1length(src+res,max,len))) goto error;
+ res+=tmp;
+ }
+ return res;
+error:
+ return 0;
+}