summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-06-01 17:54:59 +0200
committerSimon Rettberg2017-06-01 17:54:59 +0200
commit5f9e750486e0e0370dbe04ba6108e51ae967a2c7 (patch)
tree1d88586a5fd8e87148a04710f676171164fa0372
parentSmarter mangling of filters, comments, better handling of unknown server resp... (diff)
downloadldadp-5f9e750486e0e0370dbe04ba6108e51ae967a2c7.tar.gz
ldadp-5f9e750486e0e0370dbe04ba6108e51ae967a2c7.tar.xz
ldadp-5f9e750486e0e0370dbe04ba6108e51ae967a2c7.zip
Fix PRESENT filter handling
-rw-r--r--fmt_ldapsearchfilter.c3
-rw-r--r--scan_ldapsearchfilterstring.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/fmt_ldapsearchfilter.c b/fmt_ldapsearchfilter.c
index ceb3746..380bb15 100644
--- a/fmt_ldapsearchfilter.c
+++ b/fmt_ldapsearchfilter.c
@@ -51,7 +51,7 @@ size_t fmt_ldapsearchfilter(char* dest,const struct Filter* f) {
}
break;
case PRESENT:
- return fmt_asn1string(dest,PRIVATE,PRIMITIVE,(enum asn1_tag)f->type,f->ava.desc.s,f->ava.desc.l);
+ sum=fmt_asn1string(dest,PRIVATE,PRIMITIVE,(enum asn1_tag)f->type,f->ava.desc.s,f->ava.desc.l);
break;
default: return 0;
}
@@ -61,6 +61,7 @@ size_t fmt_ldapsearchfilter(char* dest,const struct Filter* f) {
if (dest) sum+=fmt_ldapsearchfilter(dest+sum,f->next);
else sum+=fmt_ldapsearchfilter(dest,f->next);
}
+ if (f->type == PRESENT) return sum;
tmp=fmt_asn1length(0,savesum);
if (!dest) return sum+tmp+1;
diff --git a/scan_ldapsearchfilterstring.c b/scan_ldapsearchfilterstring.c
index 8f8b9ff..4e35523 100644
--- a/scan_ldapsearchfilterstring.c
+++ b/scan_ldapsearchfilterstring.c
@@ -46,7 +46,7 @@ scan_filterlist:
if (*(++s)=='*') {
if (*(++s)==')') {
(*f)->type=PRESENT;
- return s-src;
+ return s-src+1;
}
(*f)->type=SUBSTRING;
substring: