[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Providing LDIF support at the LDAP level
- To: OpenLDAP Devel <openldap-devel@openldap.org>
- Subject: Providing LDIF support at the LDAP level
- From: Rich Megginson <rich.megginson@gmail.com>
- Date: Wed, 20 Jan 2010 14:45:39 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=Th4C6IEAKmJTXnjZNo88iZZejuWf41O2ytjDDhD/6mY=; b=cUqp1hrGmQ7ZArIlyGFv4jKqxUpLOt5jcTfz2RdBn2PoM4oc6Z4g2IK6Pp/P1od/kn 9Iqwylj9GXQq3DWFL80r5W0hAxtP1x81amEgE7tYbX8KaNby3YBnxmawmKSgoGevUzna YUu14mbYDObIDMz379LenptUXQXU/f3TWJRCc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=nlcV71SrXxicrc8a4jy4omWziqsFqhUUr2PFYzA2PfzRVrQBd/SXvNoa6Kvd3d+9iE +i+3HSiBPEui7N4C3DU3as3HtjEgTorVGYVQc7xzatmDWizVuumV+aRuGMpOW5Tcl6Ne U9cTF06m9g2moxRwWzOrDa50mgm/eUD8KsQzg=
- User-agent: Thunderbird 2.0.0.22 (X11/20090609)
This patch provides low level LDIF support in libldif and high level
support in libldap.
http://rmeggins.fedorapeople.org/newldif.patch
http://rmeggins.fedorapeople.org/ldifutil.c
The libldap support is in the form of
LDAP_F( int )
ldap_parse_ldif_record LDAP_P((
char *rbuf,
int linenum,
LDIFRecord *lr,
const char *errstr,
unsigned int flags,
void *ctx ));
Where rbuf and linenum come from ldif_read_record; lr is new (see
below); errstr is the string prefix to print for error/debug messages
(usually the program name e.g. "ldapmodify"), flags are one of these:
#define LDIF_DEFAULT_ADD 0x01 /* if changetype missing, assume LDAP_ADD */
#define LDIF_ENTRIES_ONLY 0x02 /* ignore changetypes other than add */
#define LDIF_NO_CONTROLS 0x04 /* ignore control specifications */
and ctx is the memory context (for ber_*alloc_x)
LDIFRecord returns all of the data from the LDIF record, regardless of
what type of operation it is. The lr_op field is used to determine the
type of operation, and the other fields return the operation specific
data. There is also a section of several data fields used by the
internal implementation (lifted almost verbatim from ldapmodify.c).
This is cleaned up properly by ldap_ldif_record_done()
If the LDIF record in rbuf contains no actual record (e.g. the version:
field, comments only, etc.) then the return value of
ldap_parse_ldif_record() will be 0, but the lr_op field will also be 0.