You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@directory.apache.org by Flavio Mattos <fl...@gmail.com> on 2014/01/09 02:24:30 UTC

possible bugwhen adding {sha} password

Hi everyone!

I have noticed a strage behavior/bug using the client API when I try to
create entries with encrypted password using {SHA}.
I am invoking the method the following constructor:


What is happening is: For some reason the API is adding a "'" for a few
entries. To make sure the problem is not with my code I have tried to use a
hardcoded value.
When I go to the Apache Directory Studio the password is like this:
'{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha} encrypted it
becomes plain text password.
The code below is inside a loop where I add different entries..

Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
finalArray is Object[]

private void addEntry(Entry entry, LdapConnection conn) throws
LdapException {

        AddRequest addRequest = new AddRequestImpl();
        addRequest.setEntry(entry);
        AddResponse response = conn.add(addRequest);

        if
(ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
            logger.log(Level.INFO, "Entry {0} added successfully",
entry.getDn().getName());
        } else {
            logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
Object[]{entry.getDn().getName(), response.getLdapResult().getResultCode()
+ "-" + response.getLdapResult().getResultCode().getMessage()});
            if (!
response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
) {

ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
response.getLdapResult().getResultCode().name(),
response.getLdapResult().getResultCode().getMessage(),
LdapSyncException.ESYNC_TYPE.WALLET));
                throw new
LdapException(response.getLdapResult().getResultCode().name());
            }
        }
}



That is result of the toString method.
Entry:
    dn: uid=30,ou=customer_db,,dc=example,dc=com
    objectclass: inetOrgPerson
    objectclass: organizationalPerson
    objectclass: person
    objectclass: top
    stateorprovincename: NY
    postalcode: 10475
    mail: unittest30@example.com
    sn: Doe
    userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
    cn: John
    street: 999 N TEST AVE
    givenname: John
    localityname: UNITED STATES


Does anybody know if there is a bug already registered for this?

Thanks

Flavio

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
no problem at all, glad that you were able to resolve it.


On Fri, Jan 10, 2014 at 1:25 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Kiran, thank you so much for your time..
>
> The problem is not happening any more.. it must have been some kind of
> cache or something like that..
>
> Thanks again and sorry for the inconvenience!
>
>
>
> On Thu, Jan 9, 2014 at 12:40 AM, Kiran Ayyagari <kayyagari@apache.org
> >wrote:
>
> > On Thu, Jan 9, 2014 at 2:06 PM, Flavio Mattos <flaviomattos86@gmail.com
> > >wrote:
> >
> > > You mean a junit class or the complete code?
> > >
> > > either one is fine, provided I can run that code to reproduce the issue
> > you are having
> >
> > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > >
> > > > do you have a test case to reproduce this?
> > > >
> > > >
> > > > On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <
> > flaviomattos86@gmail.com
> > > <javascript:;>
> > > > >wrote:
> > > >
> > > > > Hi! Thanks for answering me..
> > > > > I am expecting it without the quotes... As I sad it just happens
> for
> > a
> > > > few
> > > > > entries. I would say 5% of the entries. Remembering that I am using
> > the
> > > > > same method to generate the hash value. I also have tried hard
> coded
> > > hash
> > > > > and the problem persist.
> > > > >
> > > > > Thanks
> > > > >
> > > > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > > > >
> > > > > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> > > > flaviomattos86@gmail.com <javascript:;>
> > > > > <javascript:;>
> > > > > > >wrote:
> > > > > >
> > > > > > > Hi everyone!
> > > > > > >
> > > > > > > I have noticed a strage behavior/bug using the client API when
> I
> > > try
> > > > to
> > > > > > > create entries with encrypted password using {SHA}.
> > > > > > > I am invoking the method the following constructor:
> > > > > > >
> > > > > > >
> > > > > > > What is happening is: For some reason the API is adding a "'"
> > for a
> > > > few
> > > > > > > entries. To make sure the problem is not with my code I have
> > tried
> > > to
> > > > > > use a
> > > > > > > hardcoded value.
> > > > > > > When I go to the Apache Directory Studio the password is like
> > this:
> > > > > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > > > > encrypted
> > > > > > it
> > > > > > >
> > > > > > this is the value of the hashed password(including the hash
> > method),
> > > > what
> > > > > > else are you expecting?
> > > > > >
> > > > > > > becomes plain text password.
> > > > > > > The code below is inside a loop where I add different entries..
> > > > > > >
> > > > > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a
> String
> > > and
> > > > > > > finalArray is Object[]
> > > > > > >
> > > > > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > > > > LdapException {
> > > > > > >
> > > > > > >         AddRequest addRequest = new AddRequestImpl();
> > > > > > >         addRequest.setEntry(entry);
> > > > > > >         AddResponse response = conn.add(addRequest);
> > > > > > >
> > > > > > >         if
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > > > > >             logger.log(Level.INFO, "Entry {0} added
> > successfully",
> > > > > > > entry.getDn().getName());
> > > > > > >         } else {
> > > > > > >             logger.log(Level.SEVERE, "Error adding entry {0}
> > {1}",
> > > > new
> > > > > > > Object[]{entry.getDn().getName(),
> > > > > > response.getLdapResult().getResultCode()
> > > > > > > + "-" +
> response.getLdapResult().getResultCode().getMessage()});
> > > > > > >             if (!
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > > > > ) {
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > > > > response.getLdapResult().getResultCode().name(),
> > > > > > > response.getLdapResult().getResultCode().getMessage(),
> > > > > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > > > > >                 throw new
> > > > > > > LdapException(response.getLdapResult().getResultCode().name());
> > > > > > >             }
> > > > > > >         }
> > > > > > > }
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > That is result of the toString method.
> > > > > > > Entry:
> > > > > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > > > > >     objectclass: inetOrgPerson
> > > > > > >     objectclass: organizationalPerson
> > > > > > >     objectclass: person
> > > > > > >     objectclass: top
> > > > > > >     stateorprovincename: NY
> > > > > > >     postalcode: 10475
> > > > > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > > > > >     sn: Doe
> > > > > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > > > > >     cn: John
> > > > > > >     street: 999 N TEST AVE
> > > > > > >     givenname: John
> > > > > > >     localityname: UNITED STATES
> > > > > > >
> > > > > > >
> > > > > > > Does anybody know if there is a bug already registered for
> this?
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > > Flavio
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Kiran Ayyagari
> > > > > > http://keydap.com
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Kiran Ayyagari
> > > > http://keydap.com
> > > >
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
no problem at all, glad that you were able to resolve it.


On Fri, Jan 10, 2014 at 1:25 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Kiran, thank you so much for your time..
>
> The problem is not happening any more.. it must have been some kind of
> cache or something like that..
>
> Thanks again and sorry for the inconvenience!
>
>
>
> On Thu, Jan 9, 2014 at 12:40 AM, Kiran Ayyagari <kayyagari@apache.org
> >wrote:
>
> > On Thu, Jan 9, 2014 at 2:06 PM, Flavio Mattos <flaviomattos86@gmail.com
> > >wrote:
> >
> > > You mean a junit class or the complete code?
> > >
> > > either one is fine, provided I can run that code to reproduce the issue
> > you are having
> >
> > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > >
> > > > do you have a test case to reproduce this?
> > > >
> > > >
> > > > On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <
> > flaviomattos86@gmail.com
> > > <javascript:;>
> > > > >wrote:
> > > >
> > > > > Hi! Thanks for answering me..
> > > > > I am expecting it without the quotes... As I sad it just happens
> for
> > a
> > > > few
> > > > > entries. I would say 5% of the entries. Remembering that I am using
> > the
> > > > > same method to generate the hash value. I also have tried hard
> coded
> > > hash
> > > > > and the problem persist.
> > > > >
> > > > > Thanks
> > > > >
> > > > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > > > >
> > > > > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> > > > flaviomattos86@gmail.com <javascript:;>
> > > > > <javascript:;>
> > > > > > >wrote:
> > > > > >
> > > > > > > Hi everyone!
> > > > > > >
> > > > > > > I have noticed a strage behavior/bug using the client API when
> I
> > > try
> > > > to
> > > > > > > create entries with encrypted password using {SHA}.
> > > > > > > I am invoking the method the following constructor:
> > > > > > >
> > > > > > >
> > > > > > > What is happening is: For some reason the API is adding a "'"
> > for a
> > > > few
> > > > > > > entries. To make sure the problem is not with my code I have
> > tried
> > > to
> > > > > > use a
> > > > > > > hardcoded value.
> > > > > > > When I go to the Apache Directory Studio the password is like
> > this:
> > > > > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > > > > encrypted
> > > > > > it
> > > > > > >
> > > > > > this is the value of the hashed password(including the hash
> > method),
> > > > what
> > > > > > else are you expecting?
> > > > > >
> > > > > > > becomes plain text password.
> > > > > > > The code below is inside a loop where I add different entries..
> > > > > > >
> > > > > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a
> String
> > > and
> > > > > > > finalArray is Object[]
> > > > > > >
> > > > > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > > > > LdapException {
> > > > > > >
> > > > > > >         AddRequest addRequest = new AddRequestImpl();
> > > > > > >         addRequest.setEntry(entry);
> > > > > > >         AddResponse response = conn.add(addRequest);
> > > > > > >
> > > > > > >         if
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > > > > >             logger.log(Level.INFO, "Entry {0} added
> > successfully",
> > > > > > > entry.getDn().getName());
> > > > > > >         } else {
> > > > > > >             logger.log(Level.SEVERE, "Error adding entry {0}
> > {1}",
> > > > new
> > > > > > > Object[]{entry.getDn().getName(),
> > > > > > response.getLdapResult().getResultCode()
> > > > > > > + "-" +
> response.getLdapResult().getResultCode().getMessage()});
> > > > > > >             if (!
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > > > > ) {
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > > > > response.getLdapResult().getResultCode().name(),
> > > > > > > response.getLdapResult().getResultCode().getMessage(),
> > > > > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > > > > >                 throw new
> > > > > > > LdapException(response.getLdapResult().getResultCode().name());
> > > > > > >             }
> > > > > > >         }
> > > > > > > }
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > That is result of the toString method.
> > > > > > > Entry:
> > > > > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > > > > >     objectclass: inetOrgPerson
> > > > > > >     objectclass: organizationalPerson
> > > > > > >     objectclass: person
> > > > > > >     objectclass: top
> > > > > > >     stateorprovincename: NY
> > > > > > >     postalcode: 10475
> > > > > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > > > > >     sn: Doe
> > > > > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > > > > >     cn: John
> > > > > > >     street: 999 N TEST AVE
> > > > > > >     givenname: John
> > > > > > >     localityname: UNITED STATES
> > > > > > >
> > > > > > >
> > > > > > > Does anybody know if there is a bug already registered for
> this?
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > > Flavio
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Kiran Ayyagari
> > > > > > http://keydap.com
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Kiran Ayyagari
> > > > http://keydap.com
> > > >
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Flavio Mattos <fl...@gmail.com>.
Kiran, thank you so much for your time..

The problem is not happening any more.. it must have been some kind of
cache or something like that..

Thanks again and sorry for the inconvenience!



On Thu, Jan 9, 2014 at 12:40 AM, Kiran Ayyagari <ka...@apache.org>wrote:

> On Thu, Jan 9, 2014 at 2:06 PM, Flavio Mattos <flaviomattos86@gmail.com
> >wrote:
>
> > You mean a junit class or the complete code?
> >
> > either one is fine, provided I can run that code to reproduce the issue
> you are having
>
> > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> >
> > > do you have a test case to reproduce this?
> > >
> > >
> > > On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <
> flaviomattos86@gmail.com
> > <javascript:;>
> > > >wrote:
> > >
> > > > Hi! Thanks for answering me..
> > > > I am expecting it without the quotes... As I sad it just happens for
> a
> > > few
> > > > entries. I would say 5% of the entries. Remembering that I am using
> the
> > > > same method to generate the hash value. I also have tried hard coded
> > hash
> > > > and the problem persist.
> > > >
> > > > Thanks
> > > >
> > > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > > >
> > > > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> > > flaviomattos86@gmail.com <javascript:;>
> > > > <javascript:;>
> > > > > >wrote:
> > > > >
> > > > > > Hi everyone!
> > > > > >
> > > > > > I have noticed a strage behavior/bug using the client API when I
> > try
> > > to
> > > > > > create entries with encrypted password using {SHA}.
> > > > > > I am invoking the method the following constructor:
> > > > > >
> > > > > >
> > > > > > What is happening is: For some reason the API is adding a "'"
> for a
> > > few
> > > > > > entries. To make sure the problem is not with my code I have
> tried
> > to
> > > > > use a
> > > > > > hardcoded value.
> > > > > > When I go to the Apache Directory Studio the password is like
> this:
> > > > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > > > encrypted
> > > > > it
> > > > > >
> > > > > this is the value of the hashed password(including the hash
> method),
> > > what
> > > > > else are you expecting?
> > > > >
> > > > > > becomes plain text password.
> > > > > > The code below is inside a loop where I add different entries..
> > > > > >
> > > > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String
> > and
> > > > > > finalArray is Object[]
> > > > > >
> > > > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > > > LdapException {
> > > > > >
> > > > > >         AddRequest addRequest = new AddRequestImpl();
> > > > > >         addRequest.setEntry(entry);
> > > > > >         AddResponse response = conn.add(addRequest);
> > > > > >
> > > > > >         if
> > > > > >
> > > > >
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > > > >             logger.log(Level.INFO, "Entry {0} added
> successfully",
> > > > > > entry.getDn().getName());
> > > > > >         } else {
> > > > > >             logger.log(Level.SEVERE, "Error adding entry {0}
> {1}",
> > > new
> > > > > > Object[]{entry.getDn().getName(),
> > > > > response.getLdapResult().getResultCode()
> > > > > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > > > > >             if (!
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > > > ) {
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > > > response.getLdapResult().getResultCode().name(),
> > > > > > response.getLdapResult().getResultCode().getMessage(),
> > > > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > > > >                 throw new
> > > > > > LdapException(response.getLdapResult().getResultCode().name());
> > > > > >             }
> > > > > >         }
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > > That is result of the toString method.
> > > > > > Entry:
> > > > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > > > >     objectclass: inetOrgPerson
> > > > > >     objectclass: organizationalPerson
> > > > > >     objectclass: person
> > > > > >     objectclass: top
> > > > > >     stateorprovincename: NY
> > > > > >     postalcode: 10475
> > > > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > > > >     sn: Doe
> > > > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > > > >     cn: John
> > > > > >     street: 999 N TEST AVE
> > > > > >     givenname: John
> > > > > >     localityname: UNITED STATES
> > > > > >
> > > > > >
> > > > > > Does anybody know if there is a bug already registered for this?
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > Flavio
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Kiran Ayyagari
> > > > > http://keydap.com
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Kiran Ayyagari
> > > http://keydap.com
> > >
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
On Thu, Jan 9, 2014 at 2:06 PM, Flavio Mattos <fl...@gmail.com>wrote:

> You mean a junit class or the complete code?
>
> either one is fine, provided I can run that code to reproduce the issue
you are having

> On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
>
> > do you have a test case to reproduce this?
> >
> >
> > On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <flaviomattos86@gmail.com
> <javascript:;>
> > >wrote:
> >
> > > Hi! Thanks for answering me..
> > > I am expecting it without the quotes... As I sad it just happens for a
> > few
> > > entries. I would say 5% of the entries. Remembering that I am using the
> > > same method to generate the hash value. I also have tried hard coded
> hash
> > > and the problem persist.
> > >
> > > Thanks
> > >
> > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > >
> > > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> > flaviomattos86@gmail.com <javascript:;>
> > > <javascript:;>
> > > > >wrote:
> > > >
> > > > > Hi everyone!
> > > > >
> > > > > I have noticed a strage behavior/bug using the client API when I
> try
> > to
> > > > > create entries with encrypted password using {SHA}.
> > > > > I am invoking the method the following constructor:
> > > > >
> > > > >
> > > > > What is happening is: For some reason the API is adding a "'" for a
> > few
> > > > > entries. To make sure the problem is not with my code I have tried
> to
> > > > use a
> > > > > hardcoded value.
> > > > > When I go to the Apache Directory Studio the password is like this:
> > > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > > encrypted
> > > > it
> > > > >
> > > > this is the value of the hashed password(including the hash method),
> > what
> > > > else are you expecting?
> > > >
> > > > > becomes plain text password.
> > > > > The code below is inside a loop where I add different entries..
> > > > >
> > > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String
> and
> > > > > finalArray is Object[]
> > > > >
> > > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > > LdapException {
> > > > >
> > > > >         AddRequest addRequest = new AddRequestImpl();
> > > > >         addRequest.setEntry(entry);
> > > > >         AddResponse response = conn.add(addRequest);
> > > > >
> > > > >         if
> > > > >
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > > > entry.getDn().getName());
> > > > >         } else {
> > > > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}",
> > new
> > > > > Object[]{entry.getDn().getName(),
> > > > response.getLdapResult().getResultCode()
> > > > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > > > >             if (!
> > > > >
> > > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > > ) {
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > > response.getLdapResult().getResultCode().name(),
> > > > > response.getLdapResult().getResultCode().getMessage(),
> > > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > > >                 throw new
> > > > > LdapException(response.getLdapResult().getResultCode().name());
> > > > >             }
> > > > >         }
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > That is result of the toString method.
> > > > > Entry:
> > > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > > >     objectclass: inetOrgPerson
> > > > >     objectclass: organizationalPerson
> > > > >     objectclass: person
> > > > >     objectclass: top
> > > > >     stateorprovincename: NY
> > > > >     postalcode: 10475
> > > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > > >     sn: Doe
> > > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > > >     cn: John
> > > > >     street: 999 N TEST AVE
> > > > >     givenname: John
> > > > >     localityname: UNITED STATES
> > > > >
> > > > >
> > > > > Does anybody know if there is a bug already registered for this?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Flavio
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Kiran Ayyagari
> > > > http://keydap.com
> > > >
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
On Thu, Jan 9, 2014 at 2:06 PM, Flavio Mattos <fl...@gmail.com>wrote:

> You mean a junit class or the complete code?
>
> either one is fine, provided I can run that code to reproduce the issue
you are having

> On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
>
> > do you have a test case to reproduce this?
> >
> >
> > On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <flaviomattos86@gmail.com
> <javascript:;>
> > >wrote:
> >
> > > Hi! Thanks for answering me..
> > > I am expecting it without the quotes... As I sad it just happens for a
> > few
> > > entries. I would say 5% of the entries. Remembering that I am using the
> > > same method to generate the hash value. I also have tried hard coded
> hash
> > > and the problem persist.
> > >
> > > Thanks
> > >
> > > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> > >
> > > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> > flaviomattos86@gmail.com <javascript:;>
> > > <javascript:;>
> > > > >wrote:
> > > >
> > > > > Hi everyone!
> > > > >
> > > > > I have noticed a strage behavior/bug using the client API when I
> try
> > to
> > > > > create entries with encrypted password using {SHA}.
> > > > > I am invoking the method the following constructor:
> > > > >
> > > > >
> > > > > What is happening is: For some reason the API is adding a "'" for a
> > few
> > > > > entries. To make sure the problem is not with my code I have tried
> to
> > > > use a
> > > > > hardcoded value.
> > > > > When I go to the Apache Directory Studio the password is like this:
> > > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > > encrypted
> > > > it
> > > > >
> > > > this is the value of the hashed password(including the hash method),
> > what
> > > > else are you expecting?
> > > >
> > > > > becomes plain text password.
> > > > > The code below is inside a loop where I add different entries..
> > > > >
> > > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String
> and
> > > > > finalArray is Object[]
> > > > >
> > > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > > LdapException {
> > > > >
> > > > >         AddRequest addRequest = new AddRequestImpl();
> > > > >         addRequest.setEntry(entry);
> > > > >         AddResponse response = conn.add(addRequest);
> > > > >
> > > > >         if
> > > > >
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > > > entry.getDn().getName());
> > > > >         } else {
> > > > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}",
> > new
> > > > > Object[]{entry.getDn().getName(),
> > > > response.getLdapResult().getResultCode()
> > > > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > > > >             if (!
> > > > >
> > > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > > ) {
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > > response.getLdapResult().getResultCode().name(),
> > > > > response.getLdapResult().getResultCode().getMessage(),
> > > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > > >                 throw new
> > > > > LdapException(response.getLdapResult().getResultCode().name());
> > > > >             }
> > > > >         }
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > That is result of the toString method.
> > > > > Entry:
> > > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > > >     objectclass: inetOrgPerson
> > > > >     objectclass: organizationalPerson
> > > > >     objectclass: person
> > > > >     objectclass: top
> > > > >     stateorprovincename: NY
> > > > >     postalcode: 10475
> > > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > > >     sn: Doe
> > > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > > >     cn: John
> > > > >     street: 999 N TEST AVE
> > > > >     givenname: John
> > > > >     localityname: UNITED STATES
> > > > >
> > > > >
> > > > > Does anybody know if there is a bug already registered for this?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Flavio
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Kiran Ayyagari
> > > > http://keydap.com
> > > >
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Flavio Mattos <fl...@gmail.com>.
You mean a junit class or the complete code?

On Wednesday, January 8, 2014, Kiran Ayyagari wrote:

> do you have a test case to reproduce this?
>
>
> On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <flaviomattos86@gmail.com<javascript:;>
> >wrote:
>
> > Hi! Thanks for answering me..
> > I am expecting it without the quotes... As I sad it just happens for a
> few
> > entries. I would say 5% of the entries. Remembering that I am using the
> > same method to generate the hash value. I also have tried hard coded hash
> > and the problem persist.
> >
> > Thanks
> >
> > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> >
> > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> flaviomattos86@gmail.com <javascript:;>
> > <javascript:;>
> > > >wrote:
> > >
> > > > Hi everyone!
> > > >
> > > > I have noticed a strage behavior/bug using the client API when I try
> to
> > > > create entries with encrypted password using {SHA}.
> > > > I am invoking the method the following constructor:
> > > >
> > > >
> > > > What is happening is: For some reason the API is adding a "'" for a
> few
> > > > entries. To make sure the problem is not with my code I have tried to
> > > use a
> > > > hardcoded value.
> > > > When I go to the Apache Directory Studio the password is like this:
> > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > encrypted
> > > it
> > > >
> > > this is the value of the hashed password(including the hash method),
> what
> > > else are you expecting?
> > >
> > > > becomes plain text password.
> > > > The code below is inside a loop where I add different entries..
> > > >
> > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > > > finalArray is Object[]
> > > >
> > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > LdapException {
> > > >
> > > >         AddRequest addRequest = new AddRequestImpl();
> > > >         addRequest.setEntry(entry);
> > > >         AddResponse response = conn.add(addRequest);
> > > >
> > > >         if
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > > entry.getDn().getName());
> > > >         } else {
> > > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}",
> new
> > > > Object[]{entry.getDn().getName(),
> > > response.getLdapResult().getResultCode()
> > > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > > >             if (!
> > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > ) {
> > > >
> > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > response.getLdapResult().getResultCode().name(),
> > > > response.getLdapResult().getResultCode().getMessage(),
> > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > >                 throw new
> > > > LdapException(response.getLdapResult().getResultCode().name());
> > > >             }
> > > >         }
> > > > }
> > > >
> > > >
> > > >
> > > > That is result of the toString method.
> > > > Entry:
> > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > >     objectclass: inetOrgPerson
> > > >     objectclass: organizationalPerson
> > > >     objectclass: person
> > > >     objectclass: top
> > > >     stateorprovincename: NY
> > > >     postalcode: 10475
> > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > >     sn: Doe
> > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > >     cn: John
> > > >     street: 999 N TEST AVE
> > > >     givenname: John
> > > >     localityname: UNITED STATES
> > > >
> > > >
> > > > Does anybody know if there is a bug already registered for this?
> > > >
> > > > Thanks
> > > >
> > > > Flavio
> > > >
> > >
> > >
> > >
> > > --
> > > Kiran Ayyagari
> > > http://keydap.com
> > >
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: possible bugwhen adding {sha} password

Posted by Flavio Mattos <fl...@gmail.com>.
You mean a junit class or the complete code?

On Wednesday, January 8, 2014, Kiran Ayyagari wrote:

> do you have a test case to reproduce this?
>
>
> On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <flaviomattos86@gmail.com<javascript:;>
> >wrote:
>
> > Hi! Thanks for answering me..
> > I am expecting it without the quotes... As I sad it just happens for a
> few
> > entries. I would say 5% of the entries. Remembering that I am using the
> > same method to generate the hash value. I also have tried hard coded hash
> > and the problem persist.
> >
> > Thanks
> >
> > On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
> >
> > > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <
> flaviomattos86@gmail.com <javascript:;>
> > <javascript:;>
> > > >wrote:
> > >
> > > > Hi everyone!
> > > >
> > > > I have noticed a strage behavior/bug using the client API when I try
> to
> > > > create entries with encrypted password using {SHA}.
> > > > I am invoking the method the following constructor:
> > > >
> > > >
> > > > What is happening is: For some reason the API is adding a "'" for a
> few
> > > > entries. To make sure the problem is not with my code I have tried to
> > > use a
> > > > hardcoded value.
> > > > When I go to the Apache Directory Studio the password is like this:
> > > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> > encrypted
> > > it
> > > >
> > > this is the value of the hashed password(including the hash method),
> what
> > > else are you expecting?
> > >
> > > > becomes plain text password.
> > > > The code below is inside a loop where I add different entries..
> > > >
> > > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > > > finalArray is Object[]
> > > >
> > > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > > LdapException {
> > > >
> > > >         AddRequest addRequest = new AddRequestImpl();
> > > >         addRequest.setEntry(entry);
> > > >         AddResponse response = conn.add(addRequest);
> > > >
> > > >         if
> > > >
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > > entry.getDn().getName());
> > > >         } else {
> > > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}",
> new
> > > > Object[]{entry.getDn().getName(),
> > > response.getLdapResult().getResultCode()
> > > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > > >             if (!
> > > >
> > > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > > ) {
> > > >
> > > >
> > > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > > response.getLdapResult().getResultCode().name(),
> > > > response.getLdapResult().getResultCode().getMessage(),
> > > > LdapSyncException.ESYNC_TYPE.WALLET));
> > > >                 throw new
> > > > LdapException(response.getLdapResult().getResultCode().name());
> > > >             }
> > > >         }
> > > > }
> > > >
> > > >
> > > >
> > > > That is result of the toString method.
> > > > Entry:
> > > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > > >     objectclass: inetOrgPerson
> > > >     objectclass: organizationalPerson
> > > >     objectclass: person
> > > >     objectclass: top
> > > >     stateorprovincename: NY
> > > >     postalcode: 10475
> > > >     mail: unittest30@example.com <javascript:;> <javascript:;>
> > > >     sn: Doe
> > > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > > >     cn: John
> > > >     street: 999 N TEST AVE
> > > >     givenname: John
> > > >     localityname: UNITED STATES
> > > >
> > > >
> > > > Does anybody know if there is a bug already registered for this?
> > > >
> > > > Thanks
> > > >
> > > > Flavio
> > > >
> > >
> > >
> > >
> > > --
> > > Kiran Ayyagari
> > > http://keydap.com
> > >
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
do you have a test case to reproduce this?


On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Hi! Thanks for answering me..
> I am expecting it without the quotes... As I sad it just happens for a few
> entries. I would say 5% of the entries. Remembering that I am using the
> same method to generate the hash value. I also have tried hard coded hash
> and the problem persist.
>
> Thanks
>
> On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
>
> > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <flaviomattos86@gmail.com
> <javascript:;>
> > >wrote:
> >
> > > Hi everyone!
> > >
> > > I have noticed a strage behavior/bug using the client API when I try to
> > > create entries with encrypted password using {SHA}.
> > > I am invoking the method the following constructor:
> > >
> > >
> > > What is happening is: For some reason the API is adding a "'" for a few
> > > entries. To make sure the problem is not with my code I have tried to
> > use a
> > > hardcoded value.
> > > When I go to the Apache Directory Studio the password is like this:
> > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> encrypted
> > it
> > >
> > this is the value of the hashed password(including the hash method), what
> > else are you expecting?
> >
> > > becomes plain text password.
> > > The code below is inside a loop where I add different entries..
> > >
> > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > > finalArray is Object[]
> > >
> > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > LdapException {
> > >
> > >         AddRequest addRequest = new AddRequestImpl();
> > >         addRequest.setEntry(entry);
> > >         AddResponse response = conn.add(addRequest);
> > >
> > >         if
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > entry.getDn().getName());
> > >         } else {
> > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> > > Object[]{entry.getDn().getName(),
> > response.getLdapResult().getResultCode()
> > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > >             if (!
> > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > ) {
> > >
> > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > response.getLdapResult().getResultCode().name(),
> > > response.getLdapResult().getResultCode().getMessage(),
> > > LdapSyncException.ESYNC_TYPE.WALLET));
> > >                 throw new
> > > LdapException(response.getLdapResult().getResultCode().name());
> > >             }
> > >         }
> > > }
> > >
> > >
> > >
> > > That is result of the toString method.
> > > Entry:
> > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > >     objectclass: inetOrgPerson
> > >     objectclass: organizationalPerson
> > >     objectclass: person
> > >     objectclass: top
> > >     stateorprovincename: NY
> > >     postalcode: 10475
> > >     mail: unittest30@example.com <javascript:;>
> > >     sn: Doe
> > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > >     cn: John
> > >     street: 999 N TEST AVE
> > >     givenname: John
> > >     localityname: UNITED STATES
> > >
> > >
> > > Does anybody know if there is a bug already registered for this?
> > >
> > > Thanks
> > >
> > > Flavio
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
do you have a test case to reproduce this?


On Thu, Jan 9, 2014 at 11:43 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Hi! Thanks for answering me..
> I am expecting it without the quotes... As I sad it just happens for a few
> entries. I would say 5% of the entries. Remembering that I am using the
> same method to generate the hash value. I also have tried hard coded hash
> and the problem persist.
>
> Thanks
>
> On Wednesday, January 8, 2014, Kiran Ayyagari wrote:
>
> > On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <flaviomattos86@gmail.com
> <javascript:;>
> > >wrote:
> >
> > > Hi everyone!
> > >
> > > I have noticed a strage behavior/bug using the client API when I try to
> > > create entries with encrypted password using {SHA}.
> > > I am invoking the method the following constructor:
> > >
> > >
> > > What is happening is: For some reason the API is adding a "'" for a few
> > > entries. To make sure the problem is not with my code I have tried to
> > use a
> > > hardcoded value.
> > > When I go to the Apache Directory Studio the password is like this:
> > > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha}
> encrypted
> > it
> > >
> > this is the value of the hashed password(including the hash method), what
> > else are you expecting?
> >
> > > becomes plain text password.
> > > The code below is inside a loop where I add different entries..
> > >
> > > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > > finalArray is Object[]
> > >
> > > private void addEntry(Entry entry, LdapConnection conn) throws
> > > LdapException {
> > >
> > >         AddRequest addRequest = new AddRequestImpl();
> > >         addRequest.setEntry(entry);
> > >         AddResponse response = conn.add(addRequest);
> > >
> > >         if
> > >
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> > >             logger.log(Level.INFO, "Entry {0} added successfully",
> > > entry.getDn().getName());
> > >         } else {
> > >             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> > > Object[]{entry.getDn().getName(),
> > response.getLdapResult().getResultCode()
> > > + "-" + response.getLdapResult().getResultCode().getMessage()});
> > >             if (!
> > >
> > >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > > ) {
> > >
> > >
> > >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > > response.getLdapResult().getResultCode().name(),
> > > response.getLdapResult().getResultCode().getMessage(),
> > > LdapSyncException.ESYNC_TYPE.WALLET));
> > >                 throw new
> > > LdapException(response.getLdapResult().getResultCode().name());
> > >             }
> > >         }
> > > }
> > >
> > >
> > >
> > > That is result of the toString method.
> > > Entry:
> > >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> > >     objectclass: inetOrgPerson
> > >     objectclass: organizationalPerson
> > >     objectclass: person
> > >     objectclass: top
> > >     stateorprovincename: NY
> > >     postalcode: 10475
> > >     mail: unittest30@example.com <javascript:;>
> > >     sn: Doe
> > >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> > >     cn: John
> > >     street: 999 N TEST AVE
> > >     givenname: John
> > >     localityname: UNITED STATES
> > >
> > >
> > > Does anybody know if there is a bug already registered for this?
> > >
> > > Thanks
> > >
> > > Flavio
> > >
> >
> >
> >
> > --
> > Kiran Ayyagari
> > http://keydap.com
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Flavio Mattos <fl...@gmail.com>.
Hi! Thanks for answering me..
I am expecting it without the quotes... As I sad it just happens for a few
entries. I would say 5% of the entries. Remembering that I am using the
same method to generate the hash value. I also have tried hard coded hash
and the problem persist.

Thanks

On Wednesday, January 8, 2014, Kiran Ayyagari wrote:

> On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <flaviomattos86@gmail.com<javascript:;>
> >wrote:
>
> > Hi everyone!
> >
> > I have noticed a strage behavior/bug using the client API when I try to
> > create entries with encrypted password using {SHA}.
> > I am invoking the method the following constructor:
> >
> >
> > What is happening is: For some reason the API is adding a "'" for a few
> > entries. To make sure the problem is not with my code I have tried to
> use a
> > hardcoded value.
> > When I go to the Apache Directory Studio the password is like this:
> > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha} encrypted
> it
> >
> this is the value of the hashed password(including the hash method), what
> else are you expecting?
>
> > becomes plain text password.
> > The code below is inside a loop where I add different entries..
> >
> > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > finalArray is Object[]
> >
> > private void addEntry(Entry entry, LdapConnection conn) throws
> > LdapException {
> >
> >         AddRequest addRequest = new AddRequestImpl();
> >         addRequest.setEntry(entry);
> >         AddResponse response = conn.add(addRequest);
> >
> >         if
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> >             logger.log(Level.INFO, "Entry {0} added successfully",
> > entry.getDn().getName());
> >         } else {
> >             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> > Object[]{entry.getDn().getName(),
> response.getLdapResult().getResultCode()
> > + "-" + response.getLdapResult().getResultCode().getMessage()});
> >             if (!
> >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > ) {
> >
> >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > response.getLdapResult().getResultCode().name(),
> > response.getLdapResult().getResultCode().getMessage(),
> > LdapSyncException.ESYNC_TYPE.WALLET));
> >                 throw new
> > LdapException(response.getLdapResult().getResultCode().name());
> >             }
> >         }
> > }
> >
> >
> >
> > That is result of the toString method.
> > Entry:
> >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> >     objectclass: inetOrgPerson
> >     objectclass: organizationalPerson
> >     objectclass: person
> >     objectclass: top
> >     stateorprovincename: NY
> >     postalcode: 10475
> >     mail: unittest30@example.com <javascript:;>
> >     sn: Doe
> >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> >     cn: John
> >     street: 999 N TEST AVE
> >     givenname: John
> >     localityname: UNITED STATES
> >
> >
> > Does anybody know if there is a bug already registered for this?
> >
> > Thanks
> >
> > Flavio
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: possible bugwhen adding {sha} password

Posted by Flavio Mattos <fl...@gmail.com>.
Hi! Thanks for answering me..
I am expecting it without the quotes... As I sad it just happens for a few
entries. I would say 5% of the entries. Remembering that I am using the
same method to generate the hash value. I also have tried hard coded hash
and the problem persist.

Thanks

On Wednesday, January 8, 2014, Kiran Ayyagari wrote:

> On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <flaviomattos86@gmail.com<javascript:;>
> >wrote:
>
> > Hi everyone!
> >
> > I have noticed a strage behavior/bug using the client API when I try to
> > create entries with encrypted password using {SHA}.
> > I am invoking the method the following constructor:
> >
> >
> > What is happening is: For some reason the API is adding a "'" for a few
> > entries. To make sure the problem is not with my code I have tried to
> use a
> > hardcoded value.
> > When I go to the Apache Directory Studio the password is like this:
> > '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha} encrypted
> it
> >
> this is the value of the hashed password(including the hash method), what
> else are you expecting?
>
> > becomes plain text password.
> > The code below is inside a loop where I add different entries..
> >
> > Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> > finalArray is Object[]
> >
> > private void addEntry(Entry entry, LdapConnection conn) throws
> > LdapException {
> >
> >         AddRequest addRequest = new AddRequestImpl();
> >         addRequest.setEntry(entry);
> >         AddResponse response = conn.add(addRequest);
> >
> >         if
> >
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
> >             logger.log(Level.INFO, "Entry {0} added successfully",
> > entry.getDn().getName());
> >         } else {
> >             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> > Object[]{entry.getDn().getName(),
> response.getLdapResult().getResultCode()
> > + "-" + response.getLdapResult().getResultCode().getMessage()});
> >             if (!
> >
> >
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> > ) {
> >
> >
> >
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> > response.getLdapResult().getResultCode().name(),
> > response.getLdapResult().getResultCode().getMessage(),
> > LdapSyncException.ESYNC_TYPE.WALLET));
> >                 throw new
> > LdapException(response.getLdapResult().getResultCode().name());
> >             }
> >         }
> > }
> >
> >
> >
> > That is result of the toString method.
> > Entry:
> >     dn: uid=30,ou=customer_db,,dc=example,dc=com
> >     objectclass: inetOrgPerson
> >     objectclass: organizationalPerson
> >     objectclass: person
> >     objectclass: top
> >     stateorprovincename: NY
> >     postalcode: 10475
> >     mail: unittest30@example.com <javascript:;>
> >     sn: Doe
> >     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
> >     cn: John
> >     street: 999 N TEST AVE
> >     givenname: John
> >     localityname: UNITED STATES
> >
> >
> > Does anybody know if there is a bug already registered for this?
> >
> > Thanks
> >
> > Flavio
> >
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Hi everyone!
>
> I have noticed a strage behavior/bug using the client API when I try to
> create entries with encrypted password using {SHA}.
> I am invoking the method the following constructor:
>
>
> What is happening is: For some reason the API is adding a "'" for a few
> entries. To make sure the problem is not with my code I have tried to use a
> hardcoded value.
> When I go to the Apache Directory Studio the password is like this:
> '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha} encrypted it
>
this is the value of the hashed password(including the hash method), what
else are you expecting?

> becomes plain text password.
> The code below is inside a loop where I add different entries..
>
> Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> finalArray is Object[]
>
> private void addEntry(Entry entry, LdapConnection conn) throws
> LdapException {
>
>         AddRequest addRequest = new AddRequestImpl();
>         addRequest.setEntry(entry);
>         AddResponse response = conn.add(addRequest);
>
>         if
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
>             logger.log(Level.INFO, "Entry {0} added successfully",
> entry.getDn().getName());
>         } else {
>             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> Object[]{entry.getDn().getName(), response.getLdapResult().getResultCode()
> + "-" + response.getLdapResult().getResultCode().getMessage()});
>             if (!
>
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> ) {
>
>
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> response.getLdapResult().getResultCode().name(),
> response.getLdapResult().getResultCode().getMessage(),
> LdapSyncException.ESYNC_TYPE.WALLET));
>                 throw new
> LdapException(response.getLdapResult().getResultCode().name());
>             }
>         }
> }
>
>
>
> That is result of the toString method.
> Entry:
>     dn: uid=30,ou=customer_db,,dc=example,dc=com
>     objectclass: inetOrgPerson
>     objectclass: organizationalPerson
>     objectclass: person
>     objectclass: top
>     stateorprovincename: NY
>     postalcode: 10475
>     mail: unittest30@example.com
>     sn: Doe
>     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
>     cn: John
>     street: 999 N TEST AVE
>     givenname: John
>     localityname: UNITED STATES
>
>
> Does anybody know if there is a bug already registered for this?
>
> Thanks
>
> Flavio
>



-- 
Kiran Ayyagari
http://keydap.com

Re: possible bugwhen adding {sha} password

Posted by Kiran Ayyagari <ka...@apache.org>.
On Thu, Jan 9, 2014 at 6:54 AM, Flavio Mattos <fl...@gmail.com>wrote:

> Hi everyone!
>
> I have noticed a strage behavior/bug using the client API when I try to
> create entries with encrypted password using {SHA}.
> I am invoking the method the following constructor:
>
>
> What is happening is: For some reason the API is adding a "'" for a few
> entries. To make sure the problem is not with my code I have tried to use a
> hardcoded value.
> When I go to the Apache Directory Studio the password is like this:
> '{sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=' and instead of being {sha} encrypted it
>
this is the value of the hashed password(including the hash method), what
else are you expecting?

> becomes plain text password.
> The code below is inside a loop where I add different entries..
>
> Entry entry = new DefaultEntry(dn, finalArray); //dn is a String and
> finalArray is Object[]
>
> private void addEntry(Entry entry, LdapConnection conn) throws
> LdapException {
>
>         AddRequest addRequest = new AddRequestImpl();
>         addRequest.setEntry(entry);
>         AddResponse response = conn.add(addRequest);
>
>         if
> (ResultCodeEnum.SUCCESS.equals(response.getLdapResult().getResultCode())) {
>             logger.log(Level.INFO, "Entry {0} added successfully",
> entry.getDn().getName());
>         } else {
>             logger.log(Level.SEVERE, "Error adding entry {0} {1}", new
> Object[]{entry.getDn().getName(), response.getLdapResult().getResultCode()
> + "-" + response.getLdapResult().getResultCode().getMessage()});
>             if (!
>
> response.getLdapResult().getResultCode().equals(ResultCodeEnum.ENTRY_ALREADY_EXISTS)
> ) {
>
>
> ldapExceptionManagerLocal.insert(this.createLdapSyncException(entry.getDn().getName(),
> response.getLdapResult().getResultCode().name(),
> response.getLdapResult().getResultCode().getMessage(),
> LdapSyncException.ESYNC_TYPE.WALLET));
>                 throw new
> LdapException(response.getLdapResult().getResultCode().name());
>             }
>         }
> }
>
>
>
> That is result of the toString method.
> Entry:
>     dn: uid=30,ou=customer_db,,dc=example,dc=com
>     objectclass: inetOrgPerson
>     objectclass: organizationalPerson
>     objectclass: person
>     objectclass: top
>     stateorprovincename: NY
>     postalcode: 10475
>     mail: unittest30@example.com
>     sn: Doe
>     userpassword: {sha}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
>     cn: John
>     street: 999 N TEST AVE
>     givenname: John
>     localityname: UNITED STATES
>
>
> Does anybody know if there is a bug already registered for this?
>
> Thanks
>
> Flavio
>



-- 
Kiran Ayyagari
http://keydap.com