[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3674) jdbcLdap - SqlToLdap.java - WHERE/LIKE bug

Full_Name: Jason Millard
OS: Solaris 2.8
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

While using jdbcLdap, I am having problems performing queries against Active
Directory when using the following WHERE command:

SELECT * FROM OU=People,DC=test,DC=com WHERE (sAMAccountName LIKE 'jsm%')

Any names that are longer than 6 chars cause an index out of bounds StringBuffer

Currently in the CVS, SqlToLdap.java, around line 299, the code reads:

	private String transformToFilter(StringBuffer buf) {
		String stmp = buf.toString().trim();

		int like = stmp.toLowerCase().indexOf(" like ");

		if (like != -1) 
---->			buf.delete(like, 6);
			stmp = buf.toString();

I believe this should actually be:

			buf.delete(like, like + 6);

With this fix, I can perform these queries successfully.

-- Jason Millard