You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Ca...@ibs-ag.com on 2013/02/05 20:34:16 UTC

Getting fully qualified distinguished name from entry

Hi,

I'm searching for an entry that has this format.

uid=123, ou=A, ou=B,o=C

SearchRequest req = new SearchRequestImpl();
                     req.setScope(SearchScope.SUBTREE);
                     req.addAttributes(DEFAULT_ATTRIBUTES);
                     req.setTimeLimit(0);
                     req.setBase("o=C"); // this is the root of tree
                     req.setFilter("(uid=123)");

When I get the entry back,

entry.getDn().getName()  returns  'uid=123'

       List<Rdn> rdns = entry.getDn().getRdns();
The RDNs in the List  rdns are null except for the first value which contains uid=123

I've looked through the api but is there any way to get the entire string 'uid=123, ou=A, ou=B,o=C' from entry or DN?

Thanks.



Re: Getting fully qualified distinguished name from entry

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 2/5/13 9:31 PM, Carlo.Accorsi@ibs-ag.com a écrit :
> OK, this is my mistake.  I restarted everything and it's not happening now. Although it was repeatable  before I sent the message. 
> I kept getting an entry back that looked like this for my group. 
>
>     dn: uid=1343053588198  
>     objectClass: uidObject
>     objectClass: groupOfNames
>     objectClass: top
>     member: uid=admin,ou=system
>     uid: 1343053588198
>     cn: Group Display Name
>     description: Group Description
>
> then when I tried to modify
>
> connection.modify(entry,mods); // group member changes. 
>
> This exception was thrown.. 
>
> 13:51:08,329 ERROR Error updating groups in DN : uid=1343053588198
> org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException: NO_SUCH_OBJECT: failed for MessageType : MODIFY_REQUEST
>
> Message ID : 3
>     Modify Request
>         Object : 'uid=1343053588198'
>             Modification[0]
>                 Operation :  replace
>                 Modification
> member: uid=1329147365652,ou=users,ou=int,o=cpro
> member: uid=admin,ou=system
> org.apache.directory.api.ldap.model.message.ModifyRequestImpl@335407ca: ERR_268 Cannot find a partition for uid=1343053588198
>         at org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:2046)
>         at org.apache.directory.ldap.client.api.LdapNetworkConnection.modify(LdapNetworkConnection.java:2120)
>
>
> I changed some code. I was updating the entry twice consecutively in a very short time. 
> Maybe this had something to do with it. Will keep testing. Thanks. 

I have writen a test to check that the Dn comes back correctly, using
your settings, and it seems to be ok for me...

Strange...

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


RE: Getting fully qualified distinguished name from entry

Posted by Ca...@ibs-ag.com.
OK, this is my mistake.  I restarted everything and it's not happening now. Although it was repeatable  before I sent the message. 
I kept getting an entry back that looked like this for my group. 

    dn: uid=1343053588198  
    objectClass: uidObject
    objectClass: groupOfNames
    objectClass: top
    member: uid=admin,ou=system
    uid: 1343053588198
    cn: Group Display Name
    description: Group Description

then when I tried to modify

connection.modify(entry,mods); // group member changes. 

This exception was thrown.. 

13:51:08,329 ERROR Error updating groups in DN : uid=1343053588198
org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException: NO_SUCH_OBJECT: failed for MessageType : MODIFY_REQUEST

Message ID : 3
    Modify Request
        Object : 'uid=1343053588198'
            Modification[0]
                Operation :  replace
                Modification
member: uid=1329147365652,ou=users,ou=int,o=cpro
member: uid=admin,ou=system
org.apache.directory.api.ldap.model.message.ModifyRequestImpl@335407ca: ERR_268 Cannot find a partition for uid=1343053588198
        at org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:2046)
        at org.apache.directory.ldap.client.api.LdapNetworkConnection.modify(LdapNetworkConnection.java:2120)


I changed some code. I was updating the entry twice consecutively in a very short time. 
Maybe this had something to do with it. Will keep testing. Thanks. 



-----Original Message-----
From: Emmanuel Lécharny [mailto:elecharny@gmail.com] 
Sent: Tuesday, February 05, 2013 2:55 PM
To: users@directory.apache.org
Subject: Re: Getting fully qualified distinguished name from entry

Le 2/5/13 8:34 PM, Carlo.Accorsi@ibs-ag.com a écrit :
> Hi,
>
> I'm searching for an entry that has this format.
>
> uid=123, ou=A, ou=B,o=C
>
> SearchRequest req = new SearchRequestImpl();
>                      req.setScope(SearchScope.SUBTREE);
>                      req.addAttributes(DEFAULT_ATTRIBUTES);
>                      req.setTimeLimit(0);
>                      req.setBase("o=C"); // this is the root of tree
>                      req.setFilter("(uid=123)");
>
> When I get the entry back,
>
> entry.getDn().getName()  returns  'uid=123'
>
>        List<Rdn> rdns = entry.getDn().getRdns(); The RDNs in the List  
> rdns are null except for the first value which contains uid=123
>
> I've looked through the api but is there any way to get the entire string 'uid=123, ou=A, ou=B,o=C' from entry or DN?

That's really strange. The Dn.getName() returns the full Dn. Here, it seems that the entry contains only "uid=123" instead of the full DN.

That means the Dn is not correctly built. I have to investigate this, it's really surprising...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Getting fully qualified distinguished name from entry

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 2/5/13 8:34 PM, Carlo.Accorsi@ibs-ag.com a écrit :
> Hi,
>
> I'm searching for an entry that has this format.
>
> uid=123, ou=A, ou=B,o=C
>
> SearchRequest req = new SearchRequestImpl();
>                      req.setScope(SearchScope.SUBTREE);
>                      req.addAttributes(DEFAULT_ATTRIBUTES);
>                      req.setTimeLimit(0);
>                      req.setBase("o=C"); // this is the root of tree
>                      req.setFilter("(uid=123)");
>
> When I get the entry back,
>
> entry.getDn().getName()  returns  'uid=123'
>
>        List<Rdn> rdns = entry.getDn().getRdns();
> The RDNs in the List  rdns are null except for the first value which contains uid=123
>
> I've looked through the api but is there any way to get the entire string 'uid=123, ou=A, ou=B,o=C' from entry or DN?

That's really strange. The Dn.getName() returns the full Dn. Here, it
seems that the entry contains only "uid=123" instead of the full DN.

That means the Dn is not correctly built. I have to investigate this,
it's really surprising...


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com