Sorry I didn't specifiy that attributes I was returning. The first search returns subschemaSubentry and the 2nd returns attributeTypes.
I think the problem is the OpenLDAP SDK doesn't recognise the basedns I'm passing in and it returns 32 (No such Object) and this is the problem I need to solve.
Thanks for your help
Jonathan White
-----Original Message-----
From: Howard Chu [mailto:hyc@symas.com]
Sent: 13 August 2002 10:38
To: Andrew Findlay; White, Jonathan
Cc: openldap-software@OpenLDAP.org
Subject: RE: Problem using ldap_search_s to get attributeTypes
The subschemaSubentry is an operational attribute and OpenLDAP, per the LDAP spec, does not return operational attributes unless they are explicitly requested. You can use the '+' attribute wildcard to request all operational attributes. If you just use the search commands given below with no attributes specified, you will get a fairly uninteresting rootDSE entry returned and no subschemasubentry info.
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support
> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org
> [mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Andrew
> Findlay
> Sent: Tuesday, August 13, 2002 1:45 AM
> To: White, Jonathan
> Cc: openldap-software@OpenLDAP.org
> Subject: Re: Problem using ldap_search_s to get attributeTypes
>
>
> On Mon, Aug 12, 2002 at 02:56:16PM +0100, White, Jonathan wrote:
> >
> > For the program I am writing I need to return a list of all the
> attributes
> > in a directory.
>
> I don't think there is an easy way to list all the attributes actually
> *present* but you can certainly get hold of all those *known* in the
> schema.
>
> > The two ldap_search_s calls I am making to get the attributeTypes
> > are:
> > 1) Get the subschemaSubentry for the root DSE - scope=base, basedn="",
> > filter="objectClass=*"
> > 2) Get the list of attributeTypes - scope=base, basedn=<result
> of search 1>,
> > filter="objectclass=subschema"
> >
> > Using Ldp I get the desired results, however using OpenLDAP I always
> > get return code 32 (No such Object), and my question is why, what am
> > I doing wrong?
>
> Try this:
>
> ldapsearch -H ldap://cat.ourshack.com/ -s base -x subschemaSubentry
>
> That will return something like:
>
> subschemaSubentry: cn=Subschema
>
> (subschemaSubentry is an operational attribute so you have to request
> it explicitly)
>
> So next you do:
>
> ldapsearch -H ldap://<your ldap server>/ -s base -x -b 'cn=Subschema' \
> objectclass=subschema attributeTypes
>
> Another useful query is:
>
> ldapsearch -H ldap://<your ldap server>/ -s base -x 'objectclass=*' \
> namingcontexts
>
> And if you want *all* of the operational attributes:
>
> ldapsearch -H ldap://cat.ourshack.com/ -s base -x subschemaSubentry