|
From: Joe L. <jl...@op...> - 2001-10-02 18:07:19
|
I've placed on open-it.org the latest release of my python-ldap package in the redhat7.1 directory. Release 5 removes the UFN and URL support that has caused a problem for post openldap 2.0.11 systems. The "final" patch for this release simply removes the code. This may not be ideal. I hope to incorporate the latest mem-leak patches against the cvs tree and release yet another edition within a week if possible. Here for posterity is the patch --- python-ldap-1.10alpha3/Modules/LDAPObject.c.orig Tue Oct 2 09:47:47 2001 +++ python-ldap-1.10alpha3/Modules/LDAPObject.c Tue Oct 2 10:14:42 2001 @@ -1421,149 +1421,6 @@ /* ldap_search_s == ldap_search_st */ -/* ldap_ufn_search_c */ - -/* ldap_ufn_search_ct */ - -/* ldap_ufn_search_s */ - -static PyObject* -l_ldap_ufn_search_s( LDAPObject* self, PyObject* args ) -{ - char *ufn; - PyObject *attrlist; - char **attrs; - int attrsonly = 0; - LDAPMessage *resmsg = NULL; - int result; - - if (!PyArg_ParseTuple( args, "sO|i", - &ufn, &attrlist, &attrsonly)) return NULL; - if (not_valid(self)) return NULL; - - if (!attrs_from_List( attrlist, &attrs )) - return NULL; - - LDAP_BEGIN_ALLOW_THREADS( self ); - result = ldap_ufn_search_s( self->ldap, ufn, - attrs, attrsonly, &resmsg ); - LDAP_END_ALLOW_THREADS( self ); - - free_attrs( &attrs ); - - if (result != LDAP_SUCCESS) - return LDAPerror( self->ldap, "ldap_ufn_search_s" ); - - if (resmsg == NULL) { - Py_INCREF( Py_None ); - return Py_None; - } else { - return LDAPmessage_to_python( self->ldap, resmsg ); - } -} - - -/* ldap_ufn_setfilter */ - -static PyObject* -l_ldap_ufn_setfilter( LDAPObject* self, PyObject* args ) -{ - char* filter; - LDAPFiltDesc* res; - - if (!PyArg_ParseTuple( args, "s", &filter)) return NULL; - if (not_valid(self)) return NULL; - res = ldap_ufn_setfilter( self->ldap, filter ); - - if (res == NULL) - return LDAPerror(NULL, "ldap_ufn_setfilter"); - - Py_INCREF( Py_None ); - return Py_None; -} - -/* ldap_ufn_setprefix */ - -static PyObject* -l_ldap_ufn_setprefix( LDAPObject* self, PyObject* args ) -{ - char* prefix; - - if (!PyArg_ParseTuple( args, "s", &prefix)) return NULL; - if (not_valid(self)) return NULL; - ldap_ufn_setprefix( self->ldap, prefix ); - Py_INCREF( Py_None ); - return Py_None; -} - -static char doc_ufn[] = -"ufn_setfilter(filtername) -> None\n" -"ufn_setprefix(prefix) -> None\n" -"ufn_search_s(url [,attrsonly=0])\n" -"ufn_search_st(url [,attrsonly=0 [,timeout=-1]])\n\n" -"\tSee the LDAP library manual pages for more information on these\n" -"\t`user-friendly name' functions."; - -/* ldap_sort_entries */ - -/* ldap_url_search */ - -/* ldap_url_search_s */ - -/* ldap_url_search_st */ - -static PyObject* -l_ldap_url_search_st( LDAPObject* self, PyObject* args ) -{ - char *url; - int attrsonly = 0; - LDAPMessage *resmsg; - int result; - double timeout = -1.0; - struct timeval tv, *tvp; - - if (!PyArg_ParseTuple( args, "s|id", &url, &attrsonly, &timeout )) - return NULL; - if (not_valid(self)) return NULL; - - if (timeout>=0) { - tvp = &tv; - set_timeval_from_double( tvp, timeout ); - } else { - tvp = NULL; - } - - LDAP_BEGIN_ALLOW_THREADS( self ); - result = ldap_url_search_st( self->ldap, url, attrsonly, tvp, &resmsg ); - LDAP_END_ALLOW_THREADS( self ); - - if (result != LDAP_SUCCESS) - return LDAPerror( self->ldap, "ldap_ufn_search_st" ); - - if (resmsg == NULL) { - Py_INCREF( Py_None ); - return Py_None; - } else { - return LDAPmessage_to_python( self->ldap, resmsg ); - } -} - -static char doc_url_search[] = -"url_search_s(url [,attrsonly=0])\n" -"url_search_s(url [,attrsonly=0 [,timeout=-1]])\n\n" -"\tThese routine works much like search_s*, except that many\n" -"\tsearch parameters are pulled out of the URL url.\n" -"\n" -"\tLDAP URLs look like this:\n" -"\t ldap://host[:port]/dn[?attributes[?scope[?filter]]]\n" -"\n" -"\twhere scope is one of 'base' (default), 'one' or 'sub',\n" -"\tand attributes is a comma-separated list of attributes to\n" -"\tbe retrieved.\n" -"\n" -"\tURLs wrapped in angle-brackets and/or preceded by 'URL:'\n" -"\tare tolerated."; - /* methods */ static PyMethodDef methods[] = { @@ -1631,11 +1488,6 @@ {"search", (PyCFunction)l_ldap_search, METH_VARARGS, doc_search}, {"search_s", (PyCFunction)l_ldap_search_st, METH_VARARGS, doc_search}, {"search_st", (PyCFunction)l_ldap_search_st, METH_VARARGS, doc_search}, - {"ufn_search_s", (PyCFunction)l_ldap_ufn_search_s, METH_VARARGS, doc_ufn}, - {"ufn_setfilter", (PyCFunction)l_ldap_ufn_setfilter, METH_VARARGS, doc_ufn}, - {"ufn_setprefix", (PyCFunction)l_ldap_ufn_setprefix, METH_VARARGS, doc_ufn}, - {"url_search_s", (PyCFunction)l_ldap_url_search_st, METH_VARARGS, doc_url_search}, - {"url_search_st", (PyCFunction)l_ldap_url_search_st, METH_VARARGS, doc_url_search}, { NULL, NULL } }; |