How PHP Gets the LDAP server schema data

Source: Internet
Author: User
Tags ldap
Working with LDAP recently, it is easy to find the API for each language in the officially recommended Client-apis to interact with the LDAP server. But in the use of Apachedirectorystudio, the software can show the schema data, and then carefully read the official documents, or do not see a description of the schema data query where (if there is a small partner in the document to see the relevant instructions, I hope to leave a message to tell me). But found in PHP written by the client phpldapadmin, and then through its source code, found how to query schema data.

Using the official documentation, we found that the schema data contains the following four sections

    • syntaxes

    • Attributes

    • Matching_rules

    • Objectclasses

To query objectclasses as an example (you can also query one time), the corresponding query method is as follows

First case

$read _ret = Ldap_read ($ds, ' Cn=subschema ', ' (Objectclass=subschema) ', [' objectclasses ']); $read _ret = Ldap_read ($ds, ' Cn=subschema ', ' (objectclass=*) ', [' objectclasses ']);

If the first query is not available, the second type of

$read _ret = Ldap_read ($ds, ' cn=aggregate,cn=schema,cn=configuration,dc=example,dc=com ', ' (objectclass=*) '; $read _ ret = Ldap_read ($ds, ' cn=schema,cn=configuration,dc=example,dc=com ', ' (objectclass=*) ', [' objectclasses ']); $read _ ret = Ldap_read ($ds, ' cn=schema,ou=admin,dc=example,dc=com ', ' (objectclass=*) ', [' objectclasses ']);

If the second query is not available, the third type of

$read _ret = Ldap_read ($ds, ' cn=schema,cn=config ', ' (objectclass=*) ', [' objectclasses ']);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.