[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[newbie] How to get struct ldap->ld_lberoptions from application?
- To: <openldap-software@OpenLDAP.org>
- Subject: [newbie] How to get struct ldap->ld_lberoptions from application?
- From: "Ames Andreas" <Andreas.Ames@comergo.com>
- Date: Fri, 11 Feb 2005 15:24:14 +0100
- Content-class: urn:content-classes:message
- Thread-index: AcUQRVyVSqbBC17iSy2BMcP4ut2u7A==
- Thread-topic: [newbie] How to get struct ldap->ld_lberoptions from application?
Hello,
I'm wrapping some server-side controls related stuff in python.
Therefore I want to be able to create variables of type BerElement
without an LDAP* being available, such that control values can be
"first class" objects in my application (without requiring an LDAP*
context).
Unfortunately then I can't use ber_allocate_with_options then and I
have to go with 'ber_alloc_t'. Currently I just specify LBER_USE_DER
in every call to ber_alloc_t as ldapsearch.c does. But my impression
is that it would be preferable to set ber->ber_options to the value of
struct ldap's ld_lberoptions (which obviously is always available when
the BerElement gets actually encoded by ldap_create_control, which is
immediately before the coded value hits the wire in my case).
Is this assumption correct? If so is there a way to get
ld_lberoptions through ldap_get_option or somehow else? What is the
rationale behind requiring that the ber_options must be set at
BerElement's creation time (i. e. why is ber_alloc marked deprecated)?
The only way I can think of currently to achieve this is a dirty hack:
int my_get_beroptions(LDAP *ld) {
BerElement *ber_tmp = ber_allocate_with_options(ld);
int res = ber_tmp->beroptions;
ber_free(ber_tmp, 1);
return res;
}
TIA,
aa
--
Andreas Ames | Programmer | Comergo GmbH |
Voice: +49 69 7505 3213 | andreas . ames AT comergo . com