[Tutor] python-ldap

Hugo González Monteverde hugonz-lists at h-lab.net
Tue Nov 22 22:04:07 CET 2005


Hi,

Looks like they are just constants. There is really no point in printing 
or making any sense of their content, just use them as they are defined 
in the module. This is like a C #define

But this is all LDAP specific... let's see:

> 
> ## The next lines will also need to be changed to support your search 
> requirements and directory
> baseDN = "ou=Customers, ou=Sales, o=anydomain.com"
> searchScope = ldap.SCOPE_SUBTREE

SCOPE_SUBTREE is one of the avaliable search scopes. According to 
this(http://linuxjournal.com/article/6988) it should search for the 
object and its descendants..

> if result_type == ldap.RES_SEARCH_ENTRY:
> result_set.append(result_data)

Reading it as it is, looks like the result may be something different, 
but only those results that are of type RES_SEARCH_ENTRY are meaningful. 
That's why you check it.

read, read, read. This is what I understand, not knowing crap about 
LDAP, and just using Google.

Check the following docs:
`
http://www.ldapman.org/ldap_rfcs.html

http://www.cse.ohio-state.edu/cs/Services/rfc/rfc-text/rfc1823.txt

Bingo! This is the LDAP application programming interface from which the 
  Python LDAP implementation has been 'stolen' All these definitions are 
explained. For instance:

"
    Parameters are:

    ld        The connection handle;

    base      The dn of the entry at which to start the search;

    scope     One of LDAP_SCOPE_BASE, LDAP_SCOPE_ONELEVEL, or
              LDAP_SCOPE_SUBTREE, indicating the scope of the search;

Upon successful completion, ldap_result() returns the type of the
    result returned in the res parameter. This will be one of the
    following constants.

              LDAP_RES_BIND
              LDAP_RES_SEARCH_ENTRY
              LDAP_RES_SEARCH_RESULT
              LDAP_RES_MODIFY
              LDAP_RES_ADD
              LDAP_RES_DELETE
              LDAP_RES_MODRDN
              LDAP_RES_COMPARE

"

Google is your friend, and going through you may find most of your 
answers...

Hope that help,

Hugo


More information about the Tutor mailing list