Re: RFR: [PATCH] 8176553 Fix LDAP referral loop

2018-04-04 Thread Jan Kalina
Just note the LDIF expect the LDAP server running at:
ldap://localhost:10389/dc=example,dc=com

The "ref" needs to reference the same server to create referrals loop.

If you are unable to reproduce, does it produce LimitExceededException for you?

On Wed, Apr 4, 2018 at 6:05 PM, Jan Kalina  wrote:
> On Fedora 27, using latest Apache Directory Studio
> (ApacheDirectoryStudio-2.0.0.v20170904-M13-linux.gtk.x86_64.tar.gz)
> created new Apache DS 2.0.0, imported referrals.ldif
> and running JI9048012.java:
>
> export JAVA_HOME=/opt/jdk-9_linux-x64_bin/
> $JAVA_HOME/bin/java JI9048012
ou=test

ldap://localhost:10389/ou=test,dc=example,dc=com
ldap://localhost:10389/dc=example,dc=com
ldap://localhost:10389/ou=test,dc=example,dc=com
ldap://localhost:10389/dc=example,dc=com
ldap://localhost:10389/ou=test,dc=example,dc=com
ldap://localhost:10389/dc=example,dc=com
ldap://localhost:10389/ou=test,dc=example,dc=com
ldap://localhost:10389/dc=example,dc=com
ldap://localhost:10389/ou=test,dc=example,dc=com
ldap://localhost:10389/dc=example,dc=com
>
> Output continues indefinitely, while LimitExceededException is EXPECTED,
> but it does not occur.
>
> On Wed, Apr 4, 2018 at 5:35 PM, Vyom Tewari  wrote:
>>
>>
>> On 4/4/2018 8:59 PM, Jan Kalina wrote:
>>>
>>> Note: Test is not included, as it would require running LDAP server.
>>> (existing ldap tests in JDK use only mocks of the server)
>>>
>>> The patch was manually verified using reproducer attached to issue.
>>
>> Hi Jan,
>>
>> I ran the reproducer long back on my Linux box(Ubuntu 1604) on apacheDS 2
>> and it was not reproducible at my end. can you please let us know your
>> environment detail.
>> Thanks,
>> Vyom
>>
>>> On Wed, Apr 4, 2018 at 4:12 PM, Jan Kalina  wrote:

 Hi,
 I has prepared trivial patch for bug JDK-8176553,
 which I would like to get reviewed and sponsored.

 I am covered by Red Hat OCA.

 The bug affects upstream, JDK9 and JDK8 too.

 The reproducer is available in issue tracker:
 https://bugs.openjdk.java.net/browse/JDK-8176553

 PATCH:
 --
 diff --git
 a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java

 b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
 ---
 a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
 +++
 b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
 @@ -312,7 +312,8 @@

   if ((refEx != null) &&
   (refEx.hasMoreReferrals() ||
 - refEx.hasMoreReferralExceptions())) {
 + refEx.hasMoreReferralExceptions()) &&
 + ! (errEx instanceof LimitExceededException)) {

   if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
   throw (NamingException)(refEx.fillInStackTrace());
 --

 Thanks,
 Jan Kalina
>>
>>


Re: RFR: [PATCH] 8176553 Fix LDAP referral loop

2018-04-04 Thread Jan Kalina
On Fedora 27, using latest Apache Directory Studio
(ApacheDirectoryStudio-2.0.0.v20170904-M13-linux.gtk.x86_64.tar.gz)
created new Apache DS 2.0.0, imported referrals.ldif
and running JI9048012.java:

export JAVA_HOME=/opt/jdk-9_linux-x64_bin/
$JAVA_HOME/bin/java JI9048012
>>>ou=test
>>>
>>>ldap://localhost:10389/ou=test,dc=example,dc=com
>>>ldap://localhost:10389/dc=example,dc=com
>>>ldap://localhost:10389/ou=test,dc=example,dc=com
>>>ldap://localhost:10389/dc=example,dc=com
>>>ldap://localhost:10389/ou=test,dc=example,dc=com
>>>ldap://localhost:10389/dc=example,dc=com
>>>ldap://localhost:10389/ou=test,dc=example,dc=com
>>>ldap://localhost:10389/dc=example,dc=com
>>>ldap://localhost:10389/ou=test,dc=example,dc=com
>>>ldap://localhost:10389/dc=example,dc=com

Output continues indefinitely, while LimitExceededException is EXPECTED,
but it does not occur.

On Wed, Apr 4, 2018 at 5:35 PM, Vyom Tewari  wrote:
>
>
> On 4/4/2018 8:59 PM, Jan Kalina wrote:
>>
>> Note: Test is not included, as it would require running LDAP server.
>> (existing ldap tests in JDK use only mocks of the server)
>>
>> The patch was manually verified using reproducer attached to issue.
>
> Hi Jan,
>
> I ran the reproducer long back on my Linux box(Ubuntu 1604) on apacheDS 2
> and it was not reproducible at my end. can you please let us know your
> environment detail.
> Thanks,
> Vyom
>
>> On Wed, Apr 4, 2018 at 4:12 PM, Jan Kalina  wrote:
>>>
>>> Hi,
>>> I has prepared trivial patch for bug JDK-8176553,
>>> which I would like to get reviewed and sponsored.
>>>
>>> I am covered by Red Hat OCA.
>>>
>>> The bug affects upstream, JDK9 and JDK8 too.
>>>
>>> The reproducer is available in issue tracker:
>>> https://bugs.openjdk.java.net/browse/JDK-8176553
>>>
>>> PATCH:
>>> --
>>> diff --git
>>> a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
>>>
>>> b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
>>> ---
>>> a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
>>> +++
>>> b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
>>> @@ -312,7 +312,8 @@
>>>
>>>   if ((refEx != null) &&
>>>   (refEx.hasMoreReferrals() ||
>>> - refEx.hasMoreReferralExceptions())) {
>>> + refEx.hasMoreReferralExceptions()) &&
>>> + ! (errEx instanceof LimitExceededException)) {
>>>
>>>   if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
>>>   throw (NamingException)(refEx.fillInStackTrace());
>>> --
>>>
>>> Thanks,
>>> Jan Kalina
>
>


Re: RFR: [PATCH] 8176553 Fix LDAP referral loop

2018-04-04 Thread Vyom Tewari



On 4/4/2018 8:59 PM, Jan Kalina wrote:

Note: Test is not included, as it would require running LDAP server.
(existing ldap tests in JDK use only mocks of the server)

The patch was manually verified using reproducer attached to issue.

Hi Jan,

I ran the reproducer long back on my Linux box(Ubuntu 1604) on apacheDS 
2 and it was not reproducible at my end. can you please let us know your 
environment detail.

Thanks,
Vyom

On Wed, Apr 4, 2018 at 4:12 PM, Jan Kalina  wrote:

Hi,
I has prepared trivial patch for bug JDK-8176553,
which I would like to get reviewed and sponsored.

I am covered by Red Hat OCA.

The bug affects upstream, JDK9 and JDK8 too.

The reproducer is available in issue tracker:
https://bugs.openjdk.java.net/browse/JDK-8176553

PATCH:
--
diff --git 
a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
--- 
a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
+++ 
b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
@@ -312,7 +312,8 @@

  if ((refEx != null) &&
  (refEx.hasMoreReferrals() ||
- refEx.hasMoreReferralExceptions())) {
+ refEx.hasMoreReferralExceptions()) &&
+ ! (errEx instanceof LimitExceededException)) {

  if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
  throw (NamingException)(refEx.fillInStackTrace());
--

Thanks,
Jan Kalina




Re: RFR: [PATCH] 8176553 Fix LDAP referral loop

2018-04-04 Thread Jan Kalina
Note: Test is not included, as it would require running LDAP server.
(existing ldap tests in JDK use only mocks of the server)

The patch was manually verified using reproducer attached to issue.

On Wed, Apr 4, 2018 at 4:12 PM, Jan Kalina  wrote:
> Hi,
> I has prepared trivial patch for bug JDK-8176553,
> which I would like to get reviewed and sponsored.
>
> I am covered by Red Hat OCA.
>
> The bug affects upstream, JDK9 and JDK8 too.
>
> The reproducer is available in issue tracker:
> https://bugs.openjdk.java.net/browse/JDK-8176553
>
> PATCH:
> --
> diff --git 
> a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
> b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
> --- 
> a/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
> +++ 
> b/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java
> @@ -312,7 +312,8 @@
>
>  if ((refEx != null) &&
>  (refEx.hasMoreReferrals() ||
> - refEx.hasMoreReferralExceptions())) {
> + refEx.hasMoreReferralExceptions()) &&
> + ! (errEx instanceof LimitExceededException)) {
>
>  if (homeCtx.handleReferrals == LdapClient.LDAP_REF_THROW) {
>  throw (NamingException)(refEx.fillInStackTrace());
> --
>
> Thanks,
> Jan Kalina