Directory Client API
  1. Directory Client API
  2. DIRAPI-70

Ldap filter syntax which represent a binary value using escape sequence syntax

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-M8
    • Fix Version/s: 1.0.0-M11
    • Labels:
      None
    • Environment:
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

      Debian Squeeze

      Description

      Using ldap-api to search an object using a binary value.
      Using ldap filter syntax wich represent this binary value using escape sequence syntax.
      Filter is ok when I'm using ldapsearch.

      Getting a java exception:
      LdapNetworkConnection WARN - org.apache.directory.shared.ldap.codec.api.MessageEncoderException: ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL The PDU buffer size is too small !
      org.apache.mina.filter.codec.ProtocolEncoderException: org.apache.directory.shared.ldap.codec.api.MessageEncoderException: ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL The PDU buffer size is too small !
      at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:355)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:509)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:46)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:808)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:734)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:509)
      at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:501)
      at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:490)
      at org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:435)
      at org.apache.directory.ldap.client.api.LdapNetworkConnection.searchAsync(LdapNetworkConnection.java:1694)
      at org.apache.directory.ldap.client.api.LdapNetworkConnection.search(LdapNetworkConnection.java:1729)
      at org.apache.directory.ldap.client.api.LdapNetworkConnection.search(LdapNetworkConnection.java:1625)
      at org.apache.directory.ldap.client.api.LdapNetworkConnection.search(LdapNetworkConnection.java:1635)
      at net.bluemind.lib.ldap.ad.tests.ADTests.testSimpleEscapedString(ADTests.java:464)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at junit.framework.TestCase.runTest(TestCase.java:168)
      at junit.framework.TestCase.runBare(TestCase.java:134)
      at junit.framework.TestResult$1.protect(TestResult.java:110)
      at junit.framework.TestResult.runProtected(TestResult.java:128)
      at junit.framework.TestResult.run(TestResult.java:113)
      at junit.framework.TestCase.run(TestCase.java:124)
      at junit.framework.TestSuite.runTest(TestSuite.java:243)
      at junit.framework.TestSuite.run(TestSuite.java:238)
      at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
      at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
      at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
      Caused by: org.apache.directory.shared.ldap.codec.api.MessageEncoderException: ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL The PDU buffer size is too small !
      at org.apache.directory.shared.ldap.codec.api.LdapEncoder.encodeMessage(LdapEncoder.java:213)
      at org.apache.directory.shared.ldap.codec.protocol.mina.LdapProtocolEncoder.encode(LdapProtocolEncoder.java:61)
      at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:322)
      ... 51 more

      Here is my JUnit test to reproduce this issue:
      public void testSimpleEscapedString() {
      LdapConnection ldapCon = connectAd(true);

      try {
      // Real value \01\a1\52\44\9e\19\23\40\a3\05\08\0e\11\1c\17\e3 - ok with ldapsearch, exception with ldap-api
      EntryCursor result = ldapCon.search("CN=Users,DC=myDomain,DC=loc",
      "(objectGUID=
      af)", SearchScope.SUBTREE, "objectsid",
      "objectguid");

      int count = 0;
      while (result.next())

      { count++; Entry entry = result.get(); System.out.println(entry.getDn()); }

      System.out.println(count + " entries found !");
      } catch (Exception e)

      { e.printStackTrace(); fail("Test thrown an exception"); }

      }

        Issue Links

          Activity

          Anthony Prades created issue -
          Emmanuel Lecharny made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Pierre-Arnaud Marcelot made changes -
          Link This issue blocks DIRSTUDIO-768 [ DIRSTUDIO-768 ]
          Pierre-Arnaud Marcelot made changes -
          Summary Ldap filter syntax wich represent a binary value using escape sequence syntax Ldap filter syntax which represent a binary value using escape sequence syntax
          Emmanuel Lecharny made changes -
          Fix Version/s 1.0.0-M11 [ 12319496 ]
          Gavin made changes -
          Link This issue blocks DIRSTUDIO-768 [ DIRSTUDIO-768 ]
          Gavin made changes -
          Link This issue is depended upon by DIRSTUDIO-768 [ DIRSTUDIO-768 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Anthony Prades
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development