def modify_ext(self, dn, modlist, serverctrls=None, clientctrls=None): """ modify_ext(dn, modlist[,serverctrls=None[,clientctrls=None]]) -> int """ return self._ldap_call(self._l.modify_ext, dn, modlist, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def simple_bind(self, who='', cred='', serverctrls=None, clientctrls=None): """ simple_bind([who='' [,cred='']]) -> int """ return self._ldap_call(self._l.simple_bind, who, cred, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def add_ext(self, dn, modlist, serverctrls=None, clientctrls=None): """ add_ext(dn, modlist[,serverctrls=None[,clientctrls=None]]) -> int This function adds a new entry with a distinguished name specified by dn which means it must not already exist. The parameter modlist is similar to the one passed to modify(), except that no operation integer need be included in the tuples. """ return self._ldap_call(self._l.add_ext, dn, modlist, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def sasl_interactive_bind_s(self, who, auth, serverctrls=None, clientctrls=None, sasl_flags=ldap.SASL_QUIET): """ sasl_interactive_bind_s(who, auth) -> None """ return self._ldap_call(self._l.sasl_interactive_bind_s, who, auth, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls), sasl_flags)
def delete_ext(self, dn, serverctrls=None, clientctrls=None): """ delete(dn) -> int delete_s(dn) -> None delete_ext(dn[,serverctrls=None[,clientctrls=None]]) -> int delete_ext_s(dn[,serverctrls=None[,clientctrls=None]]) -> None Performs an LDAP delete operation on dn. The asynchronous form returns the message id of the initiated request, and the result can be obtained from a subsequent call to result(). """ return self._ldap_call(self._l.delete_ext, dn, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def abandon_ext(self, msgid, serverctrls=None, clientctrls=None): """ abandon_ext(msgid[,serverctrls=None[,clientctrls=None]]) -> None abandon(msgid) -> None Abandons or cancels an LDAP operation in progress. The msgid should be the message id of an outstanding LDAP operation as returned by the asynchronous methods search(), modify() etc. The caller can expect that the result of an abandoned operation will not be returned from a future call to result(). """ return self._ldap_call(self._l.abandon_ext, msgid, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def cancel(self, cancelid, serverctrls=None, clientctrls=None): """ cancel(cancelid[,serverctrls=None[,clientctrls=None]]) -> int Send cancels extended operation for an LDAP operation specified by cancelid. The cancelid should be the message id of an outstanding LDAP operation as returned by the asynchronous methods search(), modify() etc. The caller can expect that the result of an abandoned operation will not be returned from a future call to result(). In opposite to abandon() this extended operation gets an result from the server and thus should be preferred if the server supports it. """ return self._ldap_call(self._l.cancel, cancelid, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def unbind_ext(self, serverctrls=None, clientctrls=None): """ unbind() -> int unbind_s() -> None unbind_ext() -> int unbind_ext_s() -> None This call is used to unbind from the directory, terminate the current association, and free resources. Once called, the connection to the LDAP server is closed and the LDAP object is invalid. Further invocation of methods on the object will yield an exception. The unbind and unbind_s methods are identical, and are synchronous in nature """ return self._ldap_call(self._l.unbind_ext, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def compare_ext(self, dn, attr, value, serverctrls=None, clientctrls=None): """ compare_ext(dn, attr, value [,serverctrls=None[,clientctrls=None]]) -> int compare_ext_s(dn, attr, value [,serverctrls=None[,clientctrls=None]]) -> int compare(dn, attr, value) -> int compare_s(dn, attr, value) -> int Perform an LDAP comparison between the attribute named attr of entry dn, and the value value. The synchronous form returns 0 for false, or 1 for true. The asynchronous form returns the message id of the initiates request, and the result of the asynchronous compare can be obtained using result(). Note that this latter technique yields the answer by raising the exception objects COMPARE_TRUE or COMPARE_FALSE. A design bug in the library prevents value from containing nul characters. """ return self._ldap_call(self._l.compare_ext, dn, attr, value, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def rename(self, dn, newrdn, newsuperior=None, delold=1, serverctrls=None, clientctrls=None): """ rename(dn, newrdn [, newsuperior=None [,delold=1][,serverctrls=None[,clientctrls=None]]]) -> int rename_s(dn, newrdn [, newsuperior=None] [,delold=1][,serverctrls=None[,clientctrls=None]]) -> None Perform a rename entry operation. These routines take dn, the DN of the entry whose RDN is to be changed, newrdn, the new RDN, and newsuperior, the new parent DN, to give to the entry. If newsuperior is None then only the RDN is modified. The optional parameter delold is used to specify whether the old RDN should be kept as an attribute of the entry or not. The asynchronous version returns the initiated message id. This actually corresponds to the rename* routines in the LDAP-EXT C API library. """ return self._ldap_call(self._l.rename, dn, newrdn, newsuperior, delold, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))
def set_option(self, option, invalue): if option == ldap.OPT_SERVER_CONTROLS or option == ldap.OPT_CLIENT_CONTROLS: invalue = EncodeControlTuples(invalue) return self._ldap_call(self._l.set_option, option, invalue)
def search_ext(self, base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0, serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0): """ search(base, scope [,filterstr='(objectClass=*)' [,attrlist=None [,attrsonly=0]]]) -> int search_s(base, scope [,filterstr='(objectClass=*)' [,attrlist=None [,attrsonly=0]]]) search_st(base, scope [,filterstr='(objectClass=*)' [,attrlist=None [,attrsonly=0 [,timeout=-1]]]]) search_ext(base,scope,[,filterstr='(objectClass=*)' [,attrlist=None [,attrsonly=0 [,serverctrls=None [,clientctrls=None [,timeout=-1 [,sizelimit=0]]]]]]]) search_ext_s(base,scope,[,filterstr='(objectClass=*)' [,attrlist=None [,attrsonly=0 [,serverctrls=None [,clientctrls=None [,timeout=-1 [,sizelimit=0]]]]]]]) Perform an LDAP search operation, with base as the DN of the entry at which to start the search, scope being one of SCOPE_BASE (to search the object itself), SCOPE_ONELEVEL (to search the object's immediate children), or SCOPE_SUBTREE (to search the object and all its descendants). filter is a string representation of the filter to apply in the search (see RFC 2254). Each result tuple is of the form (dn,entry), where dn is a string containing the DN (distinguished name) of the entry, and entry is a dictionary containing the attributes. Attributes types are used as string dictionary keys and attribute values are stored in a list as dictionary value. The DN in dn is extracted using the underlying ldap_get_dn(), which may raise an exception of the DN is malformed. If attrsonly is non-zero, the values of attrs will be meaningless (they are not transmitted in the result). The retrieved attributes can be limited with the attrlist parameter. If attrlist is None, all the attributes of each entry are returned. serverctrls=None clientctrls=None The synchronous form with timeout, search_st() or search_ext_s(), will block for at most timeout seconds (or indefinitely if timeout is negative). A TIMEOUT exception is raised if no result is received within the time. The amount of search results retrieved can be limited with the sizelimit parameter if non-zero. """ return self._ldap_call( self._l.search_ext, base, scope, filterstr, attrlist, attrsonly, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls), timeout, sizelimit, )
def passwd(self, user, oldpw, newpw, serverctrls=None, clientctrls=None): return self._ldap_call(self._l.passwd, user, oldpw, newpw, EncodeControlTuples(serverctrls), EncodeControlTuples(clientctrls))