Added ldapsearch bad filter pattern check (ITS#4647)

This commit is contained in:
Kurt Zeilenga 2006-08-25 04:51:46 +00:00
parent b8fc3a5ffb
commit 04a2843aaf
2 changed files with 21 additions and 0 deletions

View file

@ -1,6 +1,7 @@
OpenLDAP 2.3 Change Log
OpenLDAP 2.3.28 Engineering
Added ldapsearch bad filter pattern check (ITS#4647)
OpenLDAP 2.3.27 Release
Fixed libldap dangling pointer issue (previous fix was broken) (ITS#4405)

View file

@ -611,12 +611,32 @@ main( int argc, char **argv )
}
if ( infile != NULL ) {
int percent = 0;
if ( infile[0] == '-' && infile[1] == '\0' ) {
fp = stdin;
} else if (( fp = fopen( infile, "r" )) == NULL ) {
perror( infile );
return EXIT_FAILURE;
}
for( i=0 ; filtpattern[i] ; i++ ) {
if( filtpattern[i] == '%' ) {
if( percent ) {
fprintf( stderr, _("Bad filter pattern \"%s\"\n"),
filtpattern );
return EXIT_FAILURE;
}
percent++;
if( filtpattern[i+1] != 's' ) {
fprintf( stderr, _("Bad filter pattern \"%s\"\n"),
filtpattern );
return EXIT_FAILURE;
}
}
}
}
if ( tmpdir == NULL ) {