From aa61444f10a1caf65a1355b2211b50b4bc8ca996 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 14 Jan 2002 18:46:30 +0000 Subject: [PATCH] enhance t2, and scan_ldapbindrequest doesn't count the method tag. --- Makefile | 5 ++-- scan_ldapbindrequest.c | 1 - scan_ldapsearchrequest.c | 2 +- t2.c | 51 ++++++++++++++++++++++++---------------- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index b7fce02..6b54169 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -#DEBUG=1 +DEBUG=1 all: t t1 t2 bindrequest tinyldap ldapclient @@ -10,7 +10,8 @@ scan_asn1BOOLEAN.o ldap.a: scan_ldapmessage.o fmt_ldapmessage.o fmt_ldapbindrequest.o \ scan_ldapbindrequest.o fmt_ldapbindresponse.o scan_ldapbindresponse.o \ -scan_ldapstring.o scan_ldapsearchfilter.o +scan_ldapstring.o scan_ldapsearchfilter.o scan_ldapsearchrequest.o \ +freefilter.o DIET=diet -Os CC=gcc diff --git a/scan_ldapbindrequest.c b/scan_ldapbindrequest.c index eff9862..c3ae4b4 100644 --- a/scan_ldapbindrequest.c +++ b/scan_ldapbindrequest.c @@ -13,7 +13,6 @@ int scan_ldapbindrequest(const char* src,const char* max, long method; if (!(tmp=scan_asn1tag(src+res,max,&tc,&tt,&method))) return 0; if (tc!=PRIVATE || tt!=PRIMITIVE) return 0; - res+=tmp; } return res; } diff --git a/scan_ldapsearchrequest.c b/scan_ldapsearchrequest.c index 93eb35d..5f34203 100644 --- a/scan_ldapsearchrequest.c +++ b/scan_ldapsearchrequest.c @@ -5,7 +5,7 @@ int scan_ldapsearchrequest(const char* src,const char* max, struct SearchRequest* s) { int res,tmp; unsigned long etmp; - if (!(res=scan_ldapstring(src,max,s->LDAPDN))) goto error; + if (!(res=scan_ldapstring(src,max,&s->LDAPDN))) goto error; if (!(tmp=scan_asn1ENUMERATED(src+res,max,&etmp))) goto error; if (etmp>2) goto error; s->scope=etmp; res+=tmp; if (!(tmp=scan_asn1ENUMERATED(src+res,max,&etmp))) goto error; diff --git a/t2.c b/t2.c index 89dfe86..3fbdac2 100644 --- a/t2.c +++ b/t2.c @@ -5,31 +5,42 @@ #include "ldap.h" int main(int argc,char* argv[]) { -#if 0 +#if 1 unsigned long size; // char* ldapsequence=mmap_read("req",&size); char* ldapsequence=mmap_read(argc>1?argv[1]:"capture/127.000.000.001.32779-127.000.000.001.00389",&size); long messageid, op, len; - int res; - printf("%d\n",res=scan_ldapmessage(ldapsequence,ldapsequence+size,&messageid,&op,&len)); - printf("message id %lu, op %lu, len %lu\n",messageid,op,len); - if (op==0) { - long version,namelen,method; - const char* name; - printf("%d\n",res=scan_ldapbindrequest(ldapsequence+res,ldapsequence+size,&version,&name,&namelen,&method)); - printf("version %lu, name \"%*s\", method %lu\n",version,namelen,name,method); - if (method==0) { - printf("%d\n",scan_asn1STRING(ldapsequence+res,ldapsequence+size,&name,&namelen)); - printf("simple \"%*s\"\n",namelen,name); + int res,done=0; + while (done