More fixes from Thomas
This commit is contained in:
@@ -28,12 +28,13 @@ static int substringmatch(struct Substring* x,const char* attr,int ignorecase) {
|
||||
found:
|
||||
break;
|
||||
case any:
|
||||
if (x->s.l<strlen(attr)) return 0;
|
||||
for (i=0; i<x->s.l-strlen(attr); ++i)
|
||||
if (!diff(x->s.s+i,x->s.l,attr)) goto found;
|
||||
if (x->s.l>strlen(attr)) return 0;
|
||||
for (i=0; i<x->s.l-strlen(attr); ++i) {
|
||||
if (!diff(x->s.s,x->s.l,attr+i)) goto found;
|
||||
}
|
||||
return 0;
|
||||
case suffix:
|
||||
if (diff(x->s.s+x->s.l-strlen(attr),x->s.l,attr)) return 0;
|
||||
if (diff(x->s.s,x->s.l,attr+strlen(attr)-x->s.l)) return 0;
|
||||
}
|
||||
x=x->next;
|
||||
}
|
||||
|
||||
27
tinyldap.c
27
tinyldap.c
@@ -464,6 +464,7 @@ static void answerwith(uint32 ofs,struct SearchRequest* sr,long messageid,int ou
|
||||
for (; i<j; ++i)
|
||||
if (!matchstring(&adl->a,map+uint32_read(map+ofs+i*8))) {
|
||||
val=map+uint32_read(map+ofs+i*8+4);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -477,19 +478,19 @@ nomem:
|
||||
(*pal)->type=adl->a;
|
||||
{
|
||||
struct AttributeDescriptionList** a=&(*pal)->values;
|
||||
while (i<j) {
|
||||
*a=malloc(sizeof(struct AttributeDescriptionList));
|
||||
if (!*a) goto nomem;
|
||||
(*a)->a.s=val;
|
||||
(*a)->a.l=strlen(val);
|
||||
(*a)->next=0;
|
||||
for (;i<j; ++i)
|
||||
if (!matchstring(&adl->a,map+uint32_read(map+ofs+i*8))) {
|
||||
val=map+uint32_read(map+ofs+i*8+4);
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
add_attribute:
|
||||
*a=malloc(sizeof(struct AttributeDescriptionList));
|
||||
if (!*a) goto nomem;
|
||||
(*a)->a.s=val;
|
||||
(*a)->a.l=strlen(val);
|
||||
for (;i<j; ++i)
|
||||
if (!matchstring(&adl->a,map+uint32_read(map+ofs+i*8))) {
|
||||
val=map+uint32_read(map+ofs+i*8+4);
|
||||
++i;
|
||||
a=&(*a)->next;
|
||||
goto add_attribute;
|
||||
}
|
||||
(*a)->next=0;
|
||||
}
|
||||
(*pal)->next=0;
|
||||
pal=&(*pal)->next;
|
||||
|
||||
Reference in New Issue
Block a user