I'm having difficulty retrieving binary data from an OpenLDAP server and was hoping someone could point me in the right direction. I read on the message board that binary data comes back as incomplete or corrupted unless the client specifies what attribute is binary.

I wrote similar functionality in another language to test and everything worked as expected. I'm able to retrieve all other values (Strings) except binary data.

def ldap = org.apache.directory.groovyldap.LDAP.newInstance('ldap://some.server.com/ou=People,o=Acme')
ldap.eachEntry (filter: 'id=1234567') { entry ->
  def image = entry.image.getBytes()
new File('/var/dir/something.jpg').withOutputStream {
it.write image

Where would I specify the attribute "image" is binary?