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

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



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


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
exception.

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.setLength(0);
			buf.append(stmp);
                       
---->			buf.delete(like, 6);
			buf.insert(like,'=');
			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