summaryrefslogtreecommitdiffstats
path: root/scan_ldapmessage.c
blob: baa117386ac2fae816ca5533594d361f3ea095ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}