You are here: Home / presentations / 389-ds / Application Programming APIs

Application Programming APIs

by Alan Milligan last modified Aug 14, 2013 06:41 AM

import ldap

slapd = ldap.initialize("ldap://127.0.0.1")
slapd.simple_bind_s("cn=Manager,dc=last-bastion,dc=net", "secret")

resultseq = slapd.search_s('',
ldap.SCOPE_SUBTREE,
'(objectClass=*)',
())

print str(resultseq)


[('cn=monitor', {'backendmonitordn': ['cn=monitor,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'], 'dtablesize': ['1024'], 
'nbackends': ['1'], 'cn': ['monitor'], 'entriessent': ['34'], 'objectClass': ['top', 'extensibleObject'],
'aci': ['(target ="ldap:///cn=monitor*")(targetattr != "aci || connection")(version 3.0; acl "monitor"; allow( read, search, compare ) userdn = "ldap:///anyone";)'],
'currenttime': ['20130814062304Z'], 'totalconnections': ['55'], 'readwaiters': ['0'], 'opsinitiated': ['149'], 'currentconnections': ['3'],
'connection': ['64:20130813160650Z:2:2::cn=manager,dc=last-bastion,dc=net', '65:20130813160705Z:2:2::cn=manager,dc=last-bastion,dc=net',
'66:20130814062304Z:2:1::cn=manager,dc=last-bastion,dc=net'], 'Version': ['389-Directory/1.3.1.0 B2013.132.840'], 'threads': ['30'],
'bytessent': ['216294'], 'opscompleted': ['148'], 'starttime': ['20130813151440Z']}), ('cn=counters,cn=monitor', {'objectClass': ['top', 'extensibleObject'],
'cn': ['counters']}), ('cn=snmp,cn=monitor', {'modifyrdnops': ['0'], 'listops': ['0'], 'cn': ['snmp'], 'strongauthbinds': ['0'], 'readops': ['0'],
'objectClass': ['top', 'extensibleObject'], 'securityerrors': ['0'], 'connections': ['107'], 'slavehits': ['0'], 'connectionseq': ['55'], 'copyentries': ['0'],
'errors': ['166'], 'addentryops': ['0'], 'simpleauthbinds': ['42'], 'unauthbinds': ['24'], 'masterentries': ['0'], 'cachehits': ['0'], 'bytesrecv': ['0'],
 'inops': ['149'], 'modifyentryops': ['0'], 'bytessent': ['216294'], 'removeentryops': ['0'], 'onelevelsearchops': ['4'], 'compareops': ['0'],
'anonymousbinds': ['10'], 'referralsreturned': ['0'], 'searchops': ['55'], 'entriesreturned': ['34'], 'cacheentries': ['0'], 'chainings': ['0'],
'wholesubtreesearchops': ['32'], 'referrals': ['0'], 'bindsecurityerrors': ['15']})]