1N/A/*
1N/A * Copyright (c) 2001 by Sun Microsystems, Inc.
1N/A * All rights reserved.
1N/A */
1N/A
1N/A/*
1N/A * Copyright (c) 1990 Regents of the University of Michigan.
1N/A * All rights reserved.
1N/A *
1N/A * Redistribution and use in source and binary forms are permitted
1N/A * provided that this notice is preserved and that due credit is given
1N/A * to the University of Michigan at Ann Arbor. The name of the University
1N/A * may not be used to endorse or promote products derived from this
1N/A * software without specific prior written permission. This software
1N/A * is provided ``as is'' without express or implied warranty.
1N/A */
1N/A
1N/A#ifndef _LDAP_H
1N/A#define _LDAP_H
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A#ifdef __cplusplus
1N/Aextern "C" {
1N/A#endif
1N/A
1N/A#ifdef LDAP_SSL
1N/A#include <security/ssl.h>
1N/A#endif /* LDAP_SSL */
1N/A
1N/A
1N/A#include <pthread.h>
1N/A
1N/A#ifdef LDAP_SSL
1N/A#define SSL_LDAP_PORT 636
1N/A#endif
1N/A
1N/A#if !defined(NEEDPROTOS) && defined(__STDC__)
1N/A#define NEEDPROTOS 1
1N/A#endif
1N/A
1N/A#define LDAP_API_VERSION 2004
1N/A#define LDAP_VERSION_MIN 2
1N/A#define LDAP_VERSION_MAX 3
1N/A#define LDAP_VENDOR_NAME "Sun Microsystems Inc."
1N/A#define LDAP_VENDOR_VERSION 400
1N/A
1N/A#define LDAP_PORT 389
1N/A#define LDAP_VERSION1 1
1N/A#define LDAP_VERSION2 2
1N/A#define LDAP_VERSION3 3
1N/A#define LDAP_VERSION LDAP_VERSION2
1N/A
1N/A/* OPTIONS to use with ldap_set_option and ldap_get_option */
1N/A#define LDAP_OPT_API_INFO 0x00
1N/A#define LDAP_OPT_DESC 0x01 /* Use of this option is depricated */
1N/A/* int, control how aliases are handled during search */
1N/A#define LDAP_OPT_DEREF 0x02
1N/A/* Deref values */
1N/A#define LDAP_DEREF_NEVER 0x00
1N/A#define LDAP_DEREF_SEARCHING 0x01
1N/A#define LDAP_DEREF_FINDING 0x02
1N/A#define LDAP_DEREF_ALWAYS 0x03
1N/A
1N/A#define LDAP_OPT_SIZELIMIT 0x03 /* int, size limit of a search */
1N/A#define LDAP_OPT_TIMELIMIT 0x04 /* int, time limit of a search */
1N/A#define LDAP_OPT_REBIND_FN 0x06 /* Use of this options is depricated */
1N/A#define LDAP_OPT_REBIND_ARG 0x07 /* Use of this options is depricated */
1N/A#define LDAP_OPT_REFERRALS 0x08 /* ON/OFF, chase referrals */
1N/A#define LDAP_OPT_RESTART 0x09 /* ON/OFF, restart if EINTR occurs */
1N/A/* int, protocol version, default 2 */
1N/A#define LDAP_OPT_PROTOCOL_VERSION 0x11
1N/A/* List of ldap controls to be sent with each request */
1N/A#define LDAP_OPT_SERVER_CONTROLS 0x12
1N/A/* List of ldap controls that affect the session */
1N/A#define LDAP_OPT_CLIENT_CONTROLS 0x13
1N/A#define LDAP_OPT_API_FEATURE_INFO 0x15
1N/A/* The hostname of the default ldap server */
1N/A#define LDAP_OPT_HOST_NAME 0x30
1N/A/* The code of the most recent ldap error that occured for this session */
1N/A#define LDAP_OPT_ERROR_NUMBER 0x31
1N/A/* The message returned with the most recent ldap error */
1N/A#define LDAP_OPT_ERROR_STRING 0x32
1N/A/* The Matching DN in case of a naming error */
1N/A#define LDAP_OPT_MATCHED_DN 0x33
1N/A#define LDAP_OPT_ERROR_MATCHED 0x33 /* Use of this options is depricated */
1N/A
1N/A/* The timeout while trying to connect to a server */
1N/A#define LDAP_X_OPT_CONNECT_TIMEOUT 0x4F01
1N/A#define LDAP_X_IO_TIMEOUT_NO_WAIT 0
1N/A#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT -1
1N/A
1N/A/* The Filter List Desc used by UFN functions */
1N/A/* #define LDAP_OPT_FILTERDESC 0x80 */
1N/A/* For on/off options */
1N/A#define LDAP_OPT_ON ((void *)1)
1N/A#define LDAP_OPT_OFF ((void *)0)
1N/A
1N/A/* Used for NO limitation is TIMELIMIT or SIZELIMIT */
1N/A#define LDAP_NO_LIMIT 0
1N/A
1N/A#define LDAP_MAX_ATTR_LEN 100
1N/A#define LDAP_RETURN_NO_ATTR "1.1"
1N/A#define LDAP_RETURN_ALL_ATTR ""
1N/A#define LDAP_RETURN_ALL_ATTR_OPS "*"
1N/A
1N/A/* Begin LDAP Display Template Definitions */
1N/A#define LDAP_TEMPLATE_VERSION 1
1N/A
1N/A/*
1N/A * general types of items (confined to most significant byte)
1N/A */
1N/A#define LDAP_SYN_TYPE_TEXT 0x01000000
1N/A#define LDAP_SYN_TYPE_IMAGE 0x02000000
1N/A#define LDAP_SYN_TYPE_BOOLEAN 0x04000000
1N/A#define LDAP_SYN_TYPE_BUTTON 0x08000000
1N/A#define LDAP_SYN_TYPE_ACTION 0x10000000
1N/A
1N/A/*
1N/A * syntax options (confined to second most significant byte)
1N/A */
1N/A#define LDAP_SYN_OPT_DEFER 0x00010000
1N/A
1N/A
1N/A/*
1N/A * display template item syntax ids (defined by common agreement)
1N/A * these are the valid values for the ti_syntaxid of the tmplitem
1N/A * struct (defined below). A general type is encoded in the
1N/A * most-significant 8 bits, and some options are encoded in the next
1N/A * 8 bits. The lower 16 bits are reserved for the distinct types.
1N/A */
1N/A#define LDAP_SYN_CASEIGNORESTR (1 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_MULTILINESTR (2 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_DN (3 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_BOOLEAN (4 | LDAP_SYN_TYPE_BOOLEAN)
1N/A#define LDAP_SYN_JPEGIMAGE (5 | LDAP_SYN_TYPE_IMAGE)
1N/A#define LDAP_SYN_JPEGBUTTON (6 | LDAP_SYN_TYPE_BUTTON | \
1N/A LDAP_SYN_OPT_DEFER)
1N/A#define LDAP_SYN_FAXIMAGE (7 | LDAP_SYN_TYPE_IMAGE)
1N/A#define LDAP_SYN_FAXBUTTON (8 | LDAP_SYN_TYPE_BUTTON | \
1N/A LDAP_SYN_OPT_DEFER)
1N/A#define LDAP_SYN_AUDIOBUTTON (9 | LDAP_SYN_TYPE_BUTTON | \
1N/A LDAP_SYN_OPT_DEFER)
1N/A#define LDAP_SYN_TIME (10 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_DATE (11 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_LABELEDURL (12 | LDAP_SYN_TYPE_TEXT)
1N/A#define LDAP_SYN_SEARCHACTION (13 | LDAP_SYN_TYPE_ACTION)
1N/A#define LDAP_SYN_LINKACTION (14 | LDAP_SYN_TYPE_ACTION)
1N/A#define LDAP_SYN_ADDDNACTION (15 | LDAP_SYN_TYPE_ACTION)
1N/A#define LDAP_SYN_VERIFYDNACTION (16 | LDAP_SYN_TYPE_ACTION)
1N/A#define LDAP_SYN_RFC822ADDR (17 | LDAP_SYN_TYPE_TEXT)
1N/A#ifdef SUN
1N/A#define LDAP_SYN_PROTECTED (18 | LDAP_SYN_TYPE_TEXT)
1N/A#endif
1N/A
1N/A/*
1N/A * handy macros
1N/A */
1N/A#define LDAP_GET_SYN_TYPE(syid) ((syid) & 0xFF000000)
1N/A#define LDAP_GET_SYN_OPTIONS(syid) ((syid) & 0x00FF0000)
1N/A
1N/A/*
1N/A * display options for output routines (used by entry2text and friends)
1N/A */
1N/A/*
1N/A * use calculated label width (based on length of longest label in
1N/A * template) instead of contant width
1N/A */
1N/A#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001
1N/A#define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002
1N/A
1N/A/*
1N/A * perform search actions (applies to ldap_entry2text_search only)
1N/A */
1N/A#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002
1N/A
1N/A/*
1N/A * include additional info. relevant to "non leaf" entries only
1N/A * used by ldap_entry2html and ldap_entry2html_search to include "Browse"
1N/A * and "Move Up" HREFs
1N/A */
1N/A#define LDAP_DISP_OPT_NONLEAF 0x00000004
1N/A
1N/A
1N/A/*
1N/A * display template item options (may not apply to all types)
1N/A * if this bit is set in ti_options, it applies.
1N/A */
1N/A#define LDAP_DITEM_OPT_READONLY 0x00000001
1N/A#define LDAP_DITEM_OPT_SORTVALUES 0x00000002
1N/A#define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004
1N/A#define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008
1N/A#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010
1N/A#define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020 /* booleans only */
1N/A
1N/A
1N/A/*
1N/A * LDAP API Information structure
1N/A */
1N/Atypedef struct ldapapiinfo {
1N/A int ldapai_info_version; /* version of this struct (1) */
1N/A int ldapai_api_version; /* revision of API supported */
1N/A int ldapai_protocol_version; /* highest LDAP version supported */
1N/A char **ldapai_extensions; /* names of API extensions */
1N/A char *ldapai_vendor_name; /* name of supplier */
1N/A int ldapai_vendor_version; /* supplier-specific version * 100 */
1N/A} LDAPAPIInfo;
1N/A#define LDAP_API_INFO_VERSION 1
1N/A
1N/A
1N/A/*
1N/A * LDAP API Feature Information
1N/A */
1N/Atypedef struct ldap_apifeature_info {
1N/A int ldapaif_info_version; /* version of this struct (1) */
1N/A char *ldapaif_name; /* name of supported feature */
1N/A int ldapaif_version; /* revision of supported feature */
1N/A} LDAPAPIFeatureInfo;
1N/A#define LDAP_FEATURE_INFO_VERSION 1
1N/A
1N/A
1N/A/*
1N/A * display template item structure
1N/A */
1N/Astruct ldap_tmplitem {
1N/A unsigned int ti_syntaxid;
1N/A unsigned int ti_options;
1N/A char *ti_attrname;
1N/A char *ti_label;
1N/A char **ti_args;
1N/A struct ldap_tmplitem *ti_next_in_row;
1N/A struct ldap_tmplitem *ti_next_in_col;
1N/A void *ti_appdata;
1N/A};
1N/A
1N/A
1N/A#define NULLTMPLITEM ((struct ldap_tmplitem *)0)
1N/A
1N/A#define LDAP_SET_TMPLITEM_APPDATA(ti, datap) \
1N/A (ti)->ti_appdata = (void *)(datap)
1N/A
1N/A#define LDAP_GET_TMPLITEM_APPDATA(ti, type) \
1N/A (type)((ti)->ti_appdata)
1N/A
1N/A
1N/A#define LDAP_IS_TMPLITEM_OPTION_SET(ti, option) \
1N/A (((ti)->ti_options & option) != 0)
1N/A
1N/A
1N/A/*
1N/A * object class array structure
1N/A */
1N/Astruct ldap_oclist {
1N/A char **oc_objclasses;
1N/A struct ldap_oclist *oc_next;
1N/A};
1N/A
1N/A#define NULLOCLIST ((struct ldap_oclist *)0)
1N/A
1N/A
1N/A/*
1N/A * add defaults list
1N/A */
1N/Astruct ldap_adddeflist {
1N/A int ad_source;
1N/A#define LDAP_ADSRC_CONSTANTVALUE 1
1N/A#define LDAP_ADSRC_ADDERSDN 2
1N/A char *ad_attrname;
1N/A char *ad_value;
1N/A struct ldap_adddeflist *ad_next;
1N/A};
1N/A
1N/A#define NULLADLIST ((struct ldap_adddeflist *)0)
1N/A
1N/A
1N/A/*
1N/A * display template global options
1N/A * if this bit is set in dt_options, it applies.
1N/A */
1N/A/*
1N/A * users should be allowed to try to add objects of these entries
1N/A */
1N/A#define LDAP_DTMPL_OPT_ADDABLE 0x00000001
1N/A
1N/A/*
1N/A * users should be allowed to do "modify RDN" operation of these entries
1N/A */
1N/A#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002
1N/A
1N/A/*
1N/A * this template is an alternate view, not a primary view
1N/A */
1N/A#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004
1N/A
1N/A
1N/A/*
1N/A * display template structure
1N/A */
1N/Astruct ldap_disptmpl {
1N/A char *dt_name;
1N/A char *dt_pluralname;
1N/A char *dt_iconname;
1N/A unsigned int dt_options;
1N/A char *dt_authattrname;
1N/A char *dt_defrdnattrname;
1N/A char *dt_defaddlocation;
1N/A struct ldap_oclist *dt_oclist;
1N/A struct ldap_adddeflist *dt_adddeflist;
1N/A struct ldap_tmplitem *dt_items;
1N/A void *dt_appdata;
1N/A struct ldap_disptmpl *dt_next;
1N/A};
1N/A
1N/A#define NULLDISPTMPL ((struct ldap_disptmpl *)0)
1N/A
1N/A#define LDAP_SET_DISPTMPL_APPDATA(dt, datap) \
1N/A (dt)->dt_appdata = (void *)(datap)
1N/A
1N/A#define LDAP_GET_DISPTMPL_APPDATA(dt, type) \
1N/A (type)((dt)->dt_appdata)
1N/A
1N/A#define LDAP_IS_DISPTMPL_OPTION_SET(dt, option) \
1N/A (((dt)->dt_options & option) != 0)
1N/A
1N/A#define LDAP_TMPL_ERR_VERSION 1
1N/A#define LDAP_TMPL_ERR_MEM 2
1N/A#define LDAP_TMPL_ERR_SYNTAX 3
1N/A#define LDAP_TMPL_ERR_FILE 4
1N/A
1N/A/*
1N/A * buffer size needed for entry2text and vals2text
1N/A */
1N/A#define LDAP_DTMPL_BUFSIZ 8192
1N/A
1N/A/* END Display Template Definitions */
1N/A
1N/A/* BEGIN Search Prefrences Definitions */
1N/A
1N/Astruct ldap_searchattr {
1N/A char *sa_attrlabel;
1N/A char *sa_attr;
1N/A /* max 32 matchtypes for now */
1N/A unsigned int sa_matchtypebitmap;
1N/A char *sa_selectattr;
1N/A char *sa_selecttext;
1N/A struct ldap_searchattr *sa_next;
1N/A};
1N/A
1N/Astruct ldap_searchmatch {
1N/A char *sm_matchprompt;
1N/A char *sm_filter;
1N/A struct ldap_searchmatch *sm_next;
1N/A};
1N/A
1N/Astruct ldap_searchobj {
1N/A char *so_objtypeprompt;
1N/A unsigned int so_options;
1N/A char *so_prompt;
1N/A short so_defaultscope;
1N/A char *so_filterprefix;
1N/A char *so_filtertag;
1N/A char *so_defaultselectattr;
1N/A char *so_defaultselecttext;
1N/A struct ldap_searchattr *so_salist;
1N/A struct ldap_searchmatch *so_smlist;
1N/A struct ldap_searchobj *so_next;
1N/A};
1N/A
1N/A#define NULLSEARCHOBJ ((struct ldap_searchobj *)0)
1N/A
1N/A/*
1N/A * global search object options
1N/A */
1N/A#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001
1N/A
1N/A#define LDAP_IS_SEARCHOBJ_OPTION_SET(so, option) \
1N/A (((so)->so_options & option) != 0)
1N/A
1N/A#define LDAP_SEARCHPREF_VERSION_ZERO 0
1N/A#define LDAP_SEARCHPREF_VERSION 1
1N/A
1N/A#define LDAP_SEARCHPREF_ERR_VERSION 1
1N/A#define LDAP_SEARCHPREF_ERR_MEM 2
1N/A#define LDAP_SEARCHPREF_ERR_SYNTAX 3
1N/A#define LDAP_SEARCHPREF_ERR_FILE 4
1N/A
1N/A
1N/A/* END Search Prefrences Definitions */
1N/A
1N/A/*
1N/A * Structure for LDAP modifications
1N/A */
1N/Atypedef struct ldapmod {
1N/A int mod_op;
1N/A#define LDAP_MOD_ADD 0x00
1N/A#define LDAP_MOD_DELETE 0x01
1N/A#define LDAP_MOD_REPLACE 0x02
1N/A#define LDAP_MOD_BVALUES 0x80
1N/A char *mod_type;
1N/A union {
1N/A char **modv_strvals;
1N/A struct berval **modv_bvals;
1N/A } mod_vals;
1N/A#define mod_values mod_vals.modv_strvals
1N/A#define mod_bvalues mod_vals.modv_bvals
1N/A/*
1N/A * The following field is commented out since no functions use it in
1N/A * the library and also not part of c-api draft.
1N/A */
1N/A/* struct ldapmod *mod_next */
1N/A} LDAPMod;
1N/A
1N/Atypedef struct ldap LDAP; /* Opaque LDAP connection handle */
1N/A
1N/Atypedef struct ldapmsg LDAPMessage; /* Opaque Result / Entry handle */
1N/A
1N/A#define NULLMSG ((LDAPMessage *) NULL)
1N/A
1N/A/* Call back to get info needed for re-bind */
1N/Atypedef int (LDAP_REBIND_FUNCTION)(LDAP *ld, char **dn, char **passwd,
1N/A int *authmethod, int freeit, void *extraArg);
1N/A
1N/A/*
1N/A * structures for ldap getfilter routines
1N/A */
1N/A
1N/Atypedef struct ldap_filt_info {
1N/A char *lfi_filter;
1N/A char *lfi_desc;
1N/A int lfi_scope; /* LDAP_SCOPE_BASE, etc */
1N/A int lfi_isexact; /* exact match filter? */
1N/A struct ldap_filt_info *lfi_next;
1N/A} LDAPFiltInfo;
1N/A
1N/A
1N/A#define LDAP_FILT_MAXSIZ 1024
1N/A
1N/Atypedef struct ldap_filt_list LDAPFiltList;
1N/Atypedef struct ldap_filt_desc LDAPFiltDesc;
1N/A
1N/A
1N/A/*
1N/A * Simple Page control OID
1N/A */
1N/A#define LDAP_CONTROL_SIMPLE_PAGE "1.2.840.113556.1.4.319"
1N/A
1N/A/*
1N/A * Server Sort Control
1N/A */
1N/A#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473"
1N/A#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474"
1N/A/*
1N/A * structure for a sort-key
1N/A */
1N/Atypedef struct LDAPsortkey {
1N/A char *sk_attrtype;
1N/A char *sk_matchruleoid;
1N/A int sk_reverseorder;
1N/A} LDAPsortkey;
1N/A
1N/A/*
1N/A * Virtual List View (vlv) control
1N/A */
1N/A#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9"
1N/A#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10"
1N/A/*
1N/A * structure that describes a VirtualListViewRequest control.
1N/A * note that ldvlist_index and ldvlist_size are only relevant to
1N/A * ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL.
1N/A */
1N/Atypedef struct ldapvirtuallist {
1N/A unsigned long ldvlist_before_count; /* # entries before target */
1N/A unsigned long ldvlist_after_count; /* # entries after target */
1N/A char *ldvlist_attrvalue; /* jump to this value */
1N/A unsigned long ldvlist_index; /* list offset */
1N/A unsigned long ldvlist_size; /* number of items in vlist */
1N/A void *ldvlist_extradata; /* for use by application */
1N/A} LDAPVirtualList;
1N/A
1N/A/*
1N/A * ldapv3 LDAPControl
1N/A */
1N/Atypedef struct ldapcontrol
1N/A{
1N/A char *ldctl_oid;
1N/A/*
1N/A * the "ldctl_value" field of this structure used to be a pointer to
1N/A * struct berval. To make this structure compliant to the latest c-api
1N/A * draft, it is changed to "struct berval ldctl_value"
1N/A */
1N/A struct berval ldctl_value;
1N/A char ldctl_iscritical;
1N/A} LDAPControl, *PLDAPControl;
1N/A
1N/A/*
1N/A * specific LDAP instantiations of BER types we know about
1N/A */
1N/A
1N/A/* general stuff */
1N/A#define LDAP_TAG_MESSAGE 0x30 /* tag is 16 + constructed bit */
1N/A#define LDAP_TAG_MSGID 0x02
1N/A#define LDAP_TAG_CONTROL_LIST 0xA0 /* Context 0 + constructed */
1N/A#define LDAP_TAG_REFERRAL 0xA3 /* Context 3 + constructed */
1N/A#define LDAP_TAG_SASLCREDS 0x87 /* Context 7 + primitive */
1N/A#define LDAP_TAG_AUTH_SIMPLE 0x80 /* Context 0 + primitive */
1N/A#define LDAP_TAG_AUTH_SASL 0xA3 /* Context 3 + constructed */
1N/A/* Tag for modrdn request */
1N/A#define LDAP_TAG_NEWPARENT 0x80 /* Context 0 + primitive */
1N/A/* Tags for Extensible filter match */
1N/A#define LDAP_TAG_FEXT_RULE 0x81 /* Context 1 + primitive */
1N/A#define LDAP_TAG_FEXT_TYPE 0x82 /* Context 2 + primitive */
1N/A#define LDAP_TAG_FEXT_VAL 0x83 /* Context 3 + primitive */
1N/A#define LDAP_TAG_FEXT_DN 0x84 /* Context 4 + primitive */
1N/A/* tags for EXTENDED OPERATIONS */
1N/A#define LDAP_TAG_EXT_NAME 0x80 /* Context 0 + primitive */
1N/A#define LDAP_TAG_EXT_VAL 0x81 /* Context 1 + primitive */
1N/A#define LDAP_TAG_EXT_RESPNAME 0x8a /* Context 10 + primitive */
1N/A#define LDAP_TAG_EXT_RESPONSE 0x8b /* Context 11 + primitive */
1N/A/* tags for Virtual List View control */
1N/A#define LDAP_TAG_VLV_BY_INDEX 0xa0 /* context specific + constructed + 0 */
1N/A#define LDAP_TAG_VLV_BY_VALUE 0x81 /* context specific + primitive + 1 */
1N/A/* tag for sort control */
1N/A#define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive */
1N/A#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive */
1N/A#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive */
1N/A
1N/A/* possible operations a client can invoke */
1N/A#define LDAP_REQ_BIND 0x60 /* application + constructed */
1N/A#define LDAP_REQ_UNBIND 0x42 /* application + primitive */
1N/A#define LDAP_REQ_SEARCH 0x63 /* application + constructed */
1N/A#define LDAP_REQ_MODIFY 0x66 /* application + constructed */
1N/A#define LDAP_REQ_ADD 0x68 /* application + constructed */
1N/A#define LDAP_REQ_DELETE 0x4a /* application + primitive */
1N/A#define LDAP_REQ_MODRDN 0x6c /* application + constructed */
1N/A#define LDAP_REQ_COMPARE 0x6e /* application + constructed */
1N/A#define LDAP_REQ_ABANDON 0x50 /* application + primitive */
1N/A/* New in ldapv3 application + constructed */
1N/A#define LDAP_REQ_EXTENDED 0x77
1N/A/* version 3.0 compatibility stuff */
1N/A#define LDAP_REQ_UNBIND_30 0x62
1N/A#define LDAP_REQ_DELETE_30 0x6a
1N/A#define LDAP_REQ_ABANDON_30 0x70
1N/A
1N/A/* possible result types a server can return */
1N/A#define LDAP_RES_BIND 0x61 /* application + constructed */
1N/A#define LDAP_RES_SEARCH_ENTRY 0x64 /* application + constructed */
1N/A/* new in ldapv3, application + constructed */
1N/A#define LDAP_RES_SEARCH_REFERENCE 0x73
1N/A#define LDAP_RES_SEARCH_RESULT 0x65 /* application + constructed */
1N/A#define LDAP_RES_MODIFY 0x67 /* application + constructed */
1N/A#define LDAP_RES_ADD 0x69 /* application + constructed */
1N/A#define LDAP_RES_DELETE 0x6b /* application + constructed */
1N/A#define LDAP_RES_MODRDN 0x6d /* application + constructed */
1N/A#define LDAP_RES_COMPARE 0x6f /* application + constructed */
1N/A/* new in ldapv3, application + constructed */
1N/A#define LDAP_RES_EXTENDED 0x78
1N/A#define LDAP_RES_ANY (-1)
1N/A
1N/A/* authentication methods available */
1N/A#define LDAP_AUTH_NONE 0x00 /* no authentication */
1N/A#define LDAP_AUTH_SIMPLE 0x80 /* context specific + primitive */
1N/A#define LDAP_AUTH_KRBV4 0xff /* means do both of the following */
1N/A#define LDAP_AUTH_KRBV41 0x81 /* context specific + primitive */
1N/A#define LDAP_AUTH_KRBV42 0x82 /* context specific + primitive */
1N/A/* New with ldapv3 */
1N/A#define LDAP_AUTH_SASL 0xa3 /* context specific + constructed */
1N/A
1N/A/* 3.0 compatibility auth methods */
1N/A#define LDAP_AUTH_SIMPLE_30 0xa0 /* context specific + constructed */
1N/A#define LDAP_AUTH_KRBV41_30 0xa1 /* context specific + constructed */
1N/A#define LDAP_AUTH_KRBV42_30 0xa2 /* context specific + constructed */
1N/A
1N/A/* filter types */
1N/A#define LDAP_FILTER_AND 0xa0 /* context specific + constructed */
1N/A#define LDAP_FILTER_OR 0xa1 /* context specific + constructed */
1N/A#define LDAP_FILTER_NOT 0xa2 /* context specific + constructed */
1N/A#define LDAP_FILTER_EQUALITY 0xa3 /* context specific + constructed */
1N/A#define LDAP_FILTER_SUBSTRINGS 0xa4 /* context specific + constructed */
1N/A#define LDAP_FILTER_GE 0xa5 /* context specific + constructed */
1N/A#define LDAP_FILTER_LE 0xa6 /* context specific + constructed */
1N/A#define LDAP_FILTER_PRESENT 0x87 /* context specific + primitive */
1N/A#define LDAP_FILTER_APPROX 0xa8 /* context specific + constructed */
1N/A#define LDAP_FILTER_EXTENSIBLE 0xa9 /* context specific + constructed */
1N/A
1N/A/* 3.0 compatibility filter types */
1N/A#define LDAP_FILTER_PRESENT_30 0xa7 /* context specific + constructed */
1N/A
1N/A/* substring filter component types */
1N/A#define LDAP_SUBSTRING_INITIAL 0x80 /* context specific */
1N/A#define LDAP_SUBSTRING_ANY 0x81 /* context specific */
1N/A#define LDAP_SUBSTRING_FINAL 0x82 /* context specific */
1N/A
1N/A/* 3.0 compatibility substring filter component types */
1N/A#define LDAP_SUBSTRING_INITIAL_30 0xa0 /* context specific */
1N/A#define LDAP_SUBSTRING_ANY_30 0xa1 /* context specific */
1N/A#define LDAP_SUBSTRING_FINAL_30 0xa2 /* context specific */
1N/A
1N/A/* search scopes */
1N/A#define LDAP_SCOPE_BASE 0x00
1N/A#define LDAP_SCOPE_ONELEVEL 0x01
1N/A#define LDAP_SCOPE_SUBTREE 0x02
1N/A/* Used when parsing URL, if scope not found. *LDAP_SCOPE_BASE is to use then */
1N/A#define LDAP_SCOPE_UNKNOWN 0xFF
1N/A
1N/A/* ldap_result number of messages that should be returned */
1N/A#define LDAP_MSG_ONE 0x00
1N/A#define LDAP_MSG_ALL 0x01
1N/A#define LDAP_MSG_RECEIVED 0x02
1N/A
1N/A
1N/A/* default limit on nesting of referrals */
1N/A#define LDAP_DEFAULT_REFHOPLIMIT 5
1N/A
1N/A
1N/A/* SASL mechanisms */
1N/A#define LDAP_SASL_SIMPLE ""
1N/A#define LDAP_SASL_CRAM_MD5 "CRAM-MD5"
1N/A#define LDAP_SASL_EXTERNAL "EXTERNAL"
1N/A/* Next ones are not supported so far by SunDS 2.0 */
1N/A#define LDAP_SASL_X511_PROTECTED "X.511-Protected"
1N/A#define LDAP_SASL_X511_STRONG "X.511-Strong"
1N/A#define LDAP_SASL_KERBEROS_V4 "KERBEROS_V4"
1N/A#define LDAP_SASL_GSSAPI "GSSAPI"
1N/A#define LDAP_SASL_SKEY "SKEY"
1N/A
1N/A/*
1N/A * structure for ldap friendly mapping routines
1N/A */
1N/A
1N/Atypedef struct friendly {
1N/A char *f_unfriendly;
1N/A char *f_friendly;
1N/A} FriendlyMap;
1N/A
1N/A
1N/A/*
1N/A * Structures for URL handling
1N/A */
1N/Atypedef struct ldap_url_extension {
1N/A char *lue_type;
1N/A char *lue_value;
1N/A int lue_iscritical;
1N/A} LDAPURLExt;
1N/A
1N/Atypedef struct ldap_url_desc {
1N/A char *lud_host;
1N/A int lud_port;
1N/A char *lud_dn;
1N/A char **lud_attrs;
1N/A int lud_scope;
1N/A char *lud_filter;
1N/A LDAPURLExt **lud_extensions;
1N/A char *lud_string; /* for internal use only */
1N/A} LDAPURLDesc;
1N/A
1N/A#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL)
1N/A
1N/A#define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */
1N/A#define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */
1N/A#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */
1N/A#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */
1N/A
1N/A
1N/A/*
1N/A * possible error codes we can return
1N/A */
1N/A
1N/A#define LDAP_SUCCESS 0x00
1N/A#define LDAP_OPERATIONS_ERROR 0x01
1N/A#define LDAP_PROTOCOL_ERROR 0x02
1N/A#define LDAP_TIMELIMIT_EXCEEDED 0x03
1N/A#define LDAP_SIZELIMIT_EXCEEDED 0x04
1N/A#define LDAP_COMPARE_FALSE 0x05
1N/A#define LDAP_COMPARE_TRUE 0x06
1N/A#define LDAP_AUTH_METHOD_NOT_SUPPORTED 0x07
1N/A#define LDAP_STRONG_AUTH_REQUIRED 0x08
1N/A/* Not used in ldapv3 */
1N/A#define LDAP_PARTIAL_RESULTS 0x09
1N/A
1N/A/* New in ldapv3 */
1N/A#define LDAP_REFERRAL 0x0a
1N/A#define LDAP_ADMINLIMIT_EXCEEDED 0x0b
1N/A#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c
1N/A#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d
1N/A#define LDAP_SASL_BIND_INPROGRESS 0x0e
1N/A/* End of new */
1N/A
1N/A#define LDAP_NO_SUCH_ATTRIBUTE 0x10
1N/A#define LDAP_UNDEFINED_TYPE 0x11
1N/A#define LDAP_INAPPROPRIATE_MATCHING 0x12
1N/A#define LDAP_CONSTRAINT_VIOLATION 0x13
1N/A#define LDAP_TYPE_OR_VALUE_EXISTS 0x14
1N/A#define LDAP_INVALID_SYNTAX 0x15
1N/A
1N/A#define ATTRIBUTE_ERROR(n) ((n & 0xf0) == 0x10)
1N/A
1N/A#define LDAP_NO_SUCH_OBJECT 0x20
1N/A#define LDAP_ALIAS_PROBLEM 0x21
1N/A#define LDAP_INVALID_DN_SYNTAX 0x22
1N/A/* Following in not used in ldapv3 */
1N/A#define LDAP_IS_LEAF 0x23
1N/A#define LDAP_ALIAS_DEREF_PROBLEM 0x24
1N/A
1N/A#define NAME_ERROR(n) ((n & 0xf0) == 0x20)
1N/A
1N/A#define LDAP_INAPPROPRIATE_AUTH 0x30
1N/A#define LDAP_INVALID_CREDENTIALS 0x31
1N/A#define LDAP_INSUFFICIENT_ACCESS 0x32
1N/A#define LDAP_BUSY 0x33
1N/A#define LDAP_UNAVAILABLE 0x34
1N/A#define LDAP_UNWILLING_TO_PERFORM 0x35
1N/A#define LDAP_LOOP_DETECT 0x36
1N/A
1N/A#define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 */
1N/A#define LDAP_INDEX_RANGE_ERROR 0x3D /* 61 */
1N/A
1N/A#define LDAP_NAMING_VIOLATION 0x40
1N/A#define LDAP_OBJECT_CLASS_VIOLATION 0x41
1N/A#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42
1N/A#define LDAP_NOT_ALLOWED_ON_RDN 0x43
1N/A#define LDAP_ALREADY_EXISTS 0x44
1N/A#define LDAP_NO_OBJECT_CLASS_MODS 0x45
1N/A#define LDAP_RESULTS_TOO_LARGE 0x46
1N/A/* Following is new in ldapv3 */
1N/A#define LDAP_AFFECTS_MULTIPLE_DSAS 0x47
1N/A#define LDAP_OTHER 0x50
1N/A
1N/A/* Reserved for API */
1N/A#define LDAP_SERVER_DOWN 0x51
1N/A#define LDAP_LOCAL_ERROR 0x52
1N/A#define LDAP_ENCODING_ERROR 0x53
1N/A#define LDAP_DECODING_ERROR 0x54
1N/A#define LDAP_TIMEOUT 0x55
1N/A#define LDAP_AUTH_UNKNOWN 0x56
1N/A#define LDAP_FILTER_ERROR 0x57
1N/A#define LDAP_USER_CANCELLED 0x58
1N/A#define LDAP_PARAM_ERROR 0x59
1N/A#define LDAP_NO_MEMORY 0x5a
1N/A
1N/A/* New code with ldapv3 ? */
1N/A#define LDAP_CONNECT_ERROR 0x5b
1N/A#define LDAP_NOT_SUPPORTED 0x5c
1N/A#define LDAP_CONTROL_NOT_FOUND 0x5d
1N/A#define LDAP_NO_RESULTS_RETURNED 0x5e
1N/A#define LDAP_MORE_RESULTS_TO_RETURN 0x5f
1N/A#define LDAP_CLIENT_LOOP 0x60
1N/A#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61
1N/A
1N/A/* debugging stuff */
1N/A#ifdef LDAP_DEBUG
1N/Aextern int ldap_debug;
1N/A#ifdef LDAP_SYSLOG
1N/Aextern int ldap_syslog;
1N/Aextern int ldap_syslog_level;
1N/A#endif
1N/A#define LDAP_DEBUG_TRACE 0x001
1N/A#define LDAP_DEBUG_PACKETS 0x002
1N/A#define LDAP_DEBUG_ARGS 0x004
1N/A#define LDAP_DEBUG_CONNS 0x008
1N/A#define LDAP_DEBUG_BER 0x010
1N/A#define LDAP_DEBUG_FILTER 0x020
1N/A#define LDAP_DEBUG_CONFIG 0x040
1N/A#define LDAP_DEBUG_ACL 0x080
1N/A#define LDAP_DEBUG_STATS 0x100
1N/A#define LDAP_DEBUG_STATS2 0x200
1N/A#define LDAP_DEBUG_SHELL 0x400
1N/A#define LDAP_DEBUG_PARSE 0x800
1N/A/* More values for http gateway */
1N/A#define LDAP_DEBUG_GWAY 0x1000
1N/A#define LDAP_DEBUG_GWAYMORE 0x2000
1N/A
1N/A#define LDAP_DEBUG_ANY 0xffff
1N/A
1N/A#ifdef LDAP_SYSLOG
1N/A/* ldaplog is a general logging function that is defined in liblber/i18n.c */
1N/A#define Debug(level, fmt, arg1, arg2, arg3) \
1N/A { \
1N/A if (ldap_debug & level) \
1N/A fprintf(stderr, fmt, arg1, arg2, arg3); \
1N/A if (ldap_syslog & level) \
1N/A ldaplog(level, fmt, arg1, arg2, arg3); \
1N/A }
1N/A#else /* LDAP_SYSLOG */
1N/A#ifndef WINSOCK
1N/A#define Debug(level, fmt, arg1, arg2, arg3) \
1N/A if (ldap_debug & level) \
1N/A fprintf(stderr, fmt, arg1, arg2, arg3);
1N/A#else /* !WINSOCK */
1N/Aextern void Debug(int level, char *fmt, ...);
1N/A#endif /* !WINSOCK */
1N/A#endif /* LDAP_SYSLOG */
1N/A#else /* LDAP_DEBUG */
1N/A#define Debug(level, fmt, arg1, arg2, arg3)
1N/A#endif /* LDAP_DEBUG */
1N/A
1N/A
1N/A#ifndef NEEDPROTOS
1N/Aextern LDAP *ldap_open();
1N/A#ifdef LDAP_SSL
1N/Aextern LDAP *ldap_ssl_open();
1N/A#endif /* LDAP_SSL */
1N/Aextern LDAP *ldap_init();
1N/A#ifdef STR_TRANSLATION
1N/Aextern void ldap_set_string_translators();
1N/A#ifdef LDAP_CHARSET_8859
1N/Aextern int ldap_t61_to_8859();
1N/Aextern int ldap_8859_to_t61();
1N/A#endif /* LDAP_CHARSET_8859 */
1N/A#endif /* STR_TRANSLATION */
1N/Aextern LDAPMessage *ldap_first_entry();
1N/Aextern LDAPMessage *ldap_next_entry();
1N/Aextern char *ldap_get_dn();
1N/Aextern char *ldap_dn2ufn();
1N/Aextern char **ldap_explode_dn();
1N/Aextern char *ldap_first_attribute();
1N/Aextern char *ldap_next_attribute();
1N/Aextern char **ldap_get_values();
1N/Aextern struct berval **ldap_get_values_len();
1N/Aextern void ldap_value_free();
1N/Aextern void ldap_value_free_len();
1N/Aextern int ldap_count_values();
1N/Aextern int ldap_count_values_len();
1N/Aextern char *ldap_err2string();
1N/Aextern void ldap_getfilter_free();
1N/Aextern LDAPFiltDesc *ldap_init_getfilter();
1N/Aextern LDAPFiltDesc *ldap_init_getfilter_buf();
1N/Aextern LDAPFiltInfo *ldap_getfirstfilter();
1N/Aextern LDAPFiltInfo *ldap_getnextfilter();
1N/Aextern void ldap_setfilteraffixes();
1N/Aextern void ldap_build_filter();
1N/Aextern void ldap_flush_cache();
1N/Aextern void ldap_set_cache_options();
1N/Aextern void ldap_uncache_entry();
1N/Aextern void ldap_uncache_request();
1N/Aextern char *ldap_friendly_name();
1N/Aextern void ldap_free_friendlymap();
1N/Aextern LDAP *cldap_open();
1N/Aextern void cldap_setretryinfo();
1N/Aextern void cldap_close();
1N/Aextern LDAPFiltDesc *ldap_ufn_setfilter();
1N/Aextern int ldap_ufn_timeout();
1N/Aextern int ldap_sort_entries();
1N/Aextern int ldap_sort_values();
1N/Aextern int ldap_sort_strcasecmp();
1N/Avoid ldap_free_urldesc();
1N/Avoid ldap_free_urlexts();
1N/Avoid ldap_set_rebind_proc();
1N/Avoid ldap_enable_translation();
1N/A/* Begin Display Template Prototypes */
1N/Atypedef int (*writeptype)();
1N/A
1N/Aint ldap_init_templates();
1N/Aint ldap_init_templates_buf();
1N/Avoid ldap_free_templates();
1N/Astruct ldap_disptmpl *ldap_first_disptmpl();
1N/Astruct ldap_disptmpl *ldap_next_disptmpl();
1N/Astruct ldap_disptmpl *ldap_name2template();
1N/Astruct ldap_disptmpl *ldap_oc2template();
1N/Achar **ldap_tmplattrs();
1N/Astruct ldap_tmplitem *ldap_first_tmplrow();
1N/Astruct ldap_tmplitem *ldap_next_tmplrow();
1N/Astruct ldap_tmplitem *ldap_first_tmplcol();
1N/Astruct ldap_tmplitem *ldap_next_tmplcol();
1N/Aint ldap_entry2text_search();
1N/Aint ldap_entry2text();
1N/Aint ldap_vals2text();
1N/Aint ldap_entry2html_search();
1N/Aint ldap_entry2html();
1N/Aint ldap_vals2html();
1N/A
1N/Aint ldap_init_searchprefs();
1N/Aint ldap_init_searchprefs_buf();
1N/Avoid ldap_free_searchprefs();
1N/Astruct ldap_searchobj *ldap_first_searchobj();
1N/Astruct ldap_searchobj *ldap_next_searchobj();
1N/A
1N/A#else /* NEEDPROTOS */
1N/A#if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK)
1N/A#include <sys/time.h>
1N/A#endif
1N/A
1N/A
1N/A/*
1N/A * Abandon functions
1N/A */
1N/Aint ldap_abandon_ext(LDAP *ld, int msgid, LDAPControl **serverctrls,
1N/A LDAPControl ** clientctrls);
1N/Aint ldap_abandon(LDAP *ld, int msgid);
1N/A
1N/A/*
1N/A * Add functions
1N/A */
1N/Aint ldap_add_ext(LDAP *ld, char *dn, LDAPMod **attrs,
1N/A LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_add_ext_s(LDAP *ld, char *dn, LDAPMod **attrs,
1N/A LDAPControl ** serverctrls, LDAPControl **clientctrls);
1N/Aint ldap_add(LDAP *ld, char *dn, LDAPMod **attrs);
1N/Aint ldap_add_s(LDAP *ld, char *dn, LDAPMod **attrs);
1N/A
1N/A/*
1N/A * Bind functions
1N/A */
1N/A/* DEPRECATED */
1N/Aint ldap_bind(LDAP *ld, char *who, char *passwd, int authmethod);
1N/A/* DEPRECATED */
1N/Aint ldap_bind_s(LDAP *ld, char *who, char *cred, int method);
1N/A#ifdef LDAP_REFERRALS
1N/A/* DEPRECATED */
1N/Avoid ldap_set_rebind_proc(LDAP *ld, LDAP_REBIND_FUNCTION *rebindproc,
1N/A void *extra_arg);
1N/A#endif /* LDAP_REFERRALS */
1N/A
1N/A/*
1N/A * Simple bind functions
1N/A */
1N/Aint ldap_simple_bind(LDAP *ld, char *who, char *passwd);
1N/Aint ldap_simple_bind_s(LDAP *ld, char *who, char *passwd);
1N/A
1N/A/*
1N/A * SASL functions
1N/A */
1N/Aint ldap_sasl_bind(LDAP *ld, char *dn, char *mechanism, struct berval *cred,
1N/A LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_sasl_bind_s(LDAP *ld, char *dn, char *mechanism, struct berval *cred,
1N/A LDAPControl **serverctrls, LDAPControl **clientctrls,
1N/A struct berval **servercredp);
1N/A
1N/A/*
1N/A * Kerberos functions
1N/A */
1N/A/* DEPRECATED */
1N/Aint ldap_kerberos_bind_s(LDAP *ld, char *who);
1N/A/* DEPRECATED */
1N/Aint ldap_kerberos_bind1(LDAP *ld, char *who);
1N/A/* DEPRECATED */
1N/Aint ldap_kerberos_bind1_s(LDAP *ld, char *who);
1N/A/* DEPRECATED */
1N/Aint ldap_kerberos_bind2(LDAP *ld, char *who);
1N/A/* DEPRECATED */
1N/Aint ldap_kerberos_bind2_s(LDAP *ld, char *who);
1N/A
1N/A#ifndef NO_CACHE
1N/A/*
1N/A * Cache functions
1N/A */
1N/Aint ldap_enable_cache(LDAP *ld, time_t timeout, ssize_t maxmem);
1N/Avoid ldap_disable_cache(LDAP *ld);
1N/Avoid ldap_set_cache_options(LDAP *ld, unsigned int opts);
1N/Avoid ldap_destroy_cache(LDAP *ld);
1N/Avoid ldap_flush_cache(LDAP *ld);
1N/Avoid ldap_uncache_entry(LDAP *ld, char *dn);
1N/Avoid ldap_uncache_request(LDAP *ld, int msgid);
1N/A#endif /* !NO_CACHE */
1N/A
1N/A/*
1N/A * Compare functions
1N/A */
1N/Aint ldap_compare_ext(LDAP *ld, char *dn, char *attr, struct berval *bvalue,
1N/A LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_compare_ext_s(LDAP *ld, char *dn, char *attr, struct berval *bvalue,
1N/A LDAPControl ** serverctrls, LDAPControl **clientctrls);
1N/Aint ldap_compare(LDAP *ld, char *dn, char *attr, char *value);
1N/Aint ldap_compare_s(LDAP *ld, char *dn, char *attr, char *value);
1N/A
1N/A/*
1N/A * Delete functions
1N/A */
1N/Aint ldap_delete_ext(LDAP *ld, char *dn, LDAPControl **serverctrls,
1N/A LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_delete_ext_s(LDAP *ld, char *dn, LDAPControl **serverctrls,
1N/A LDAPControl **clientctrls);
1N/Aint ldap_delete(LDAP *ld, char *dn);
1N/Aint ldap_delete_s(LDAP *ld, char *dn);
1N/A
1N/A/*
1N/A * Error functions
1N/A */
1N/Achar *ldap_err2string(int err);
1N/A
1N/A/* DEPRECATED */
1N/Aint ldap_result2error(LDAP *ld, LDAPMessage *r, int freeit);
1N/A/* DEPRECATED */
1N/Avoid ldap_perror(LDAP *ld, char *s);
1N/A
1N/A/*
1N/A * Modify functions
1N/A */
1N/Aint ldap_modify_ext(LDAP *ld, char *dn, LDAPMod **mods,
1N/A LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_modify_ext_s(LDAP *ld, char *dn, LDAPMod **mods,
1N/A LDAPControl **serverctrls, LDAPControl **clientctrls);
1N/Aint ldap_modify(LDAP *ld, char *dn, LDAPMod **mods);
1N/Aint ldap_modify_s(LDAP *ld, char *dn, LDAPMod **mods);
1N/A
1N/A/*
1N/A * Modrdn functions
1N/A */
1N/A
1N/A/* DEPRECATED : use ldap_rename instead */
1N/Aint ldap_modrdn0(LDAP *ld, char *dn, char *newrdn);
1N/A/* DEPRECATED : use ldap_rename_s instead */
1N/Aint ldap_modrdn0_s(LDAP *ld, char *dn, char *newrdn);
1N/A/* DEPRECATED : use ldap_rename instead */
1N/Aint ldap_modrdn(LDAP *ld, char *dn, char *newrdn,
1N/A int deleteoldrdn);
1N/A/* DEPRECATED : use ldap_rename_s instead */
1N/Aint ldap_modrdn_s(LDAP *ld, char *dn, char *newrdn,
1N/A int deleteoldrdn);
1N/A
1N/A/*
1N/A * Rename functions
1N/A */
1N/Aint ldap_rename(LDAP *ld, char *dn, char *newrdn, char *newparent,
1N/A int deleteoldrdn, LDAPControl ** serverctrls,
1N/A LDAPControl **clientctrls, int *msgidp);
1N/Aint ldap_rename_s(LDAP *ld, char *dn, char *newrdn, char *newparent,
1N/A int deleteoldrdn, LDAPControl ** serverctrls,
1N/A LDAPControl **clientctrls);
1N/A
1N/A/*
1N/A * Init/Open functions
1N/A */
1N/ALDAP *ldap_init(char *defhost, int defport);
1N/A
1N/A/* DEPRECATED : use ldap_init instead */
1N/ALDAP *ldap_open(char *host, int port);
1N/A
1N/A#ifdef LDAP_SSL
1N/ALDAP *ldap_ssl_init(char *defhost, int defport, char *keyname);
1N/A
1N/A/* DEPRECATED : use ldap_ssl_init instead */
1N/ALDAP *ldap_ssl_open(char *host, int port, char *keyname);
1N/A#endif
1N/A
1N/A/*
1N/A * Entry functions
1N/A */
1N/ALDAPMessage *ldap_first_entry(LDAP *ld, LDAPMessage *res);
1N/ALDAPMessage *ldap_next_entry(LDAP *ld, LDAPMessage *entry);
1N/Aint ldap_count_entries(LDAP *ld, LDAPMessage *res);
1N/A
1N/A/*
1N/A * Message functions
1N/A */
1N/ALDAPMessage *ldap_first_message(LDAP *ld, LDAPMessage *res);
1N/ALDAPMessage *ldap_next_message(LDAP *ld, LDAPMessage *msg);
1N/Aint ldap_count_messages(LDAP *ld, LDAPMessage *res);
1N/A
1N/A/*
1N/A * Reference functions
1N/A */
1N/ALDAPMessage *ldap_first_reference(LDAP *ld, LDAPMessage *res);
1N/ALDAPMessage *ldap_next_reference(LDAP *ld, LDAPMessage *msg);
1N/Aint ldap_count_references(LDAP *ld, LDAPMessage *res);
1N/Achar ** ldap_get_reference_urls(LDAP *ld, LDAPMessage *res);
1N/A
1N/A/*
1N/A * Entry functions
1N/A */
1N/ALDAPMessage *ldap_delete_result_entry(LDAPMessage **list,
1N/A LDAPMessage *e);
1N/Avoid ldap_add_result_entry(LDAPMessage **list, LDAPMessage *e);
1N/A
1N/A/*
1N/A * DN functions
1N/A */
1N/Achar *ldap_get_dn(LDAP *ld, LDAPMessage *entry);
1N/Achar **ldap_explode_dn(char *dn, int notypes);
1N/Achar ** ldap_explode_rdn(char *rdn, int notypes);
1N/Achar *ldap_dn2ufn(char *dn);
1N/A
1N/Achar **ldap_explode_dns(char *dn);
1N/Aint ldap_is_dns_dn(char *dn);
1N/Achar *ldap_dns_to_dn(char *dns_name, int *nameparts);
1N/A
1N/A/*
1N/A * Attribute parsing functions
1N/A */
1N/Achar *ldap_first_attribute(LDAP *ld, LDAPMessage *entry,
1N/A BerElement **ber);
1N/Achar *ldap_next_attribute(LDAP *ld, LDAPMessage *entry,
1N/A BerElement *ber);
1N/Avoid ldap_memfree(char *mem);
1N/A
1N/A/*
1N/A * Attribute Value functions
1N/A */
1N/Achar **ldap_get_values(LDAP *ld, LDAPMessage *entry, char *target);
1N/Astruct berval **ldap_get_values_len(LDAP *ld, LDAPMessage *entry,
1N/A char *target);
1N/Aint ldap_count_values(char **vals);
1N/Aint ldap_count_values_len(struct berval **vals);
1N/Avoid ldap_value_free(char **vals);
1N/Avoid ldap_value_free_len(struct berval **vals);
1N/A
1N/A/*
1N/A * Result functions
1N/A */
1N/Aint ldap_result(LDAP *ld, int msgid, int all,
1N/A struct timeval *timeout, LDAPMessage **result);
1N/Aint ldap_msgdelete(LDAP *ld, int msgid);
1N/Aint ldap_msgfree(LDAPMessage *lm);
1N/Aint ldap_msgtype(LDAPMessage *res);
1N/Aint ldap_msgid(LDAPMessage *res);
1N/Aint ldap_parse_result(LDAP *ld, LDAPMessage *res, int *errcodep,
1N/A char **matcheddnp, char **errmsgp, char ***referralsp,
1N/A LDAPControl ***serverctrlsp, int freeit);
1N/Aint ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res,
1N/A struct berval **servercredp, int freeit);
1N/Aint ldap_parse_extended_result(LDAP *ld, LDAPMessage *res,
1N/A char **resultoidp, struct berval **resultdata, int freeit);
1N/Aint cldap_getmsg(LDAP *ld, struct timeval *timeout, BerElement *ber);
1N/A
1N/A
1N/A/*
1N/A * Search functions
1N/A */
1N/Aint ldap_search_ext(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly, LDAPControl **serverctrls,
1N/A LDAPControl **clientctrls, struct timeval *timeoutp,
1N/A int sizelimit, int *msgidp);
1N/Aint ldap_search_ext_s(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly, LDAPControl **serverctrls,
1N/A LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit,
1N/A LDAPMessage **res);
1N/A
1N/Aint ldap_search(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly);
1N/Aint ldap_search_s(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly, LDAPMessage **res);
1N/Aint ldap_search_st(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res);
1N/A
1N/A/*
1N/A * UFN functions
1N/A */
1N/Aint ldap_ufn_search_c(LDAP *ld, char *ufn, char **attrs,
1N/A int attrsonly, LDAPMessage **res, int (*cancelproc)(void *cl),
1N/A void *cancelparm);
1N/Aint ldap_ufn_search_ct(LDAP *ld, char *ufn, char **attrs,
1N/A int attrsonly, LDAPMessage **res, int (*cancelproc)(void *cl),
1N/A void *cancelparm, char *tag1, char *tag2, char *tag3);
1N/Aint ldap_ufn_search_s(LDAP *ld, char *ufn, char **attrs,
1N/A int attrsonly, LDAPMessage **res);
1N/ALDAPFiltDesc *ldap_ufn_setfilter(LDAP *ld, char *fname);
1N/Avoid ldap_ufn_setprefix(LDAP *ld, char *prefix);
1N/Aint ldap_ufn_timeout(void *tvparam);
1N/A
1N/A
1N/A/*
1N/A * Unbind functions
1N/A */
1N/Aint ldap_unbind(LDAP *ld);
1N/Aint ldap_unbind_s(LDAP *ld);
1N/A
1N/A
1N/A/*
1N/A * Filter functions
1N/A */
1N/ALDAPFiltDesc *ldap_init_getfilter(char *fname);
1N/ALDAPFiltDesc *ldap_init_getfilter_buf(char *buf, ssize_t buflen);
1N/ALDAPFiltInfo *ldap_getfirstfilter(LDAPFiltDesc *lfdp, char *tagpat,
1N/A char *value);
1N/ALDAPFiltInfo *ldap_getnextfilter(LDAPFiltDesc *lfdp);
1N/Avoid ldap_setfilteraffixes(LDAPFiltDesc *lfdp, char *prefix, char *suffix);
1N/Avoid ldap_build_filter(char *buf, size_t buflen,
1N/A char *pattern, char *prefix, char *suffix, char *attr,
1N/A char *value, char **valwords);
1N/A
1N/A/*
1N/A * Functions to free LDAPFiltDesc and LDAPmod
1N/A */
1N/Avoid ldap_getfilter_free(LDAPFiltDesc *lfdp);
1N/Avoid ldap_mods_free(LDAPMod **mods, int freemods);
1N/A
1N/A/*
1N/A * Friendly name functions
1N/A */
1N/Achar *ldap_friendly_name(char *filename, char *uname,
1N/A FriendlyMap **map);
1N/Avoid ldap_free_friendlymap(FriendlyMap **map);
1N/A
1N/A
1N/A/*
1N/A * Connectionless LDAP functions
1N/A */
1N/ALDAP *cldap_open(char *host, int port);
1N/Avoid cldap_close(LDAP *ld);
1N/Aint cldap_search_s(LDAP *ld, char *base, int scope, char *filter,
1N/A char **attrs, int attrsonly, LDAPMessage **res, char *logdn);
1N/Avoid cldap_setretryinfo(LDAP *ld, int tries, time_t timeout);
1N/A
1N/A
1N/A/*
1N/A * Sort functions
1N/A */
1N/Aint ldap_sort_entries(LDAP *ld, LDAPMessage **chain, char *attr,
1N/A int (*cmp)());
1N/Aint ldap_sort_values(LDAP *ld, char **vals, int (*cmp)());
1N/Aint ldap_sort_strcasecmp(char **a, char **b);
1N/A
1N/A
1N/A/*
1N/A * URL functions
1N/A */
1N/Aint ldap_is_ldap_url(char *url);
1N/Aint ldap_url_parse(char *url, LDAPURLDesc **ludpp);
1N/Avoid ldap_free_urlexts(LDAPURLExt **lues);
1N/Avoid ldap_free_urldesc(LDAPURLDesc *ludp);
1N/Aint ldap_url_search(LDAP *ld, char *url, int attrsonly);
1N/Aint ldap_url_search_s(LDAP *ld, char *url, int attrsonly,
1N/A LDAPMessage **res);
1N/Aint ldap_url_search_st(LDAP *ld, char *url, int attrsonly,
1N/A struct timeval *timeout, LDAPMessage **res);
1N/Achar *ldap_dns_to_url(LDAP *ld, char *dns_name, char *attrs,
1N/Achar *scope, char *filter);
1N/Achar *ldap_dn_to_url(LDAP *ld, char *dn, int nameparts);
1N/A
1N/A
1N/A/*
1N/A * in Character Set functions
1N/A */
1N/A#ifdef STR_TRANSLATION
1N/Avoid ldap_set_string_translators(LDAP *ld,
1N/A BERTranslateProc encode_proc, BERTranslateProc decode_proc);
1N/Aint ldap_translate_from_t61(LDAP *ld, char **bufp,
1N/A unsigned int *lenp, int free_input);
1N/Aint ldap_translate_to_t61(LDAP *ld, char **bufp,
1N/A unsigned int *lenp, int free_input);
1N/Avoid ldap_enable_translation(LDAP *ld, LDAPMessage *entry,
1N/A int enable);
1N/A
1N/A#ifdef LDAP_CHARSET_8859
1N/Aint ldap_t61_to_8859(char **bufp, unsigned int *buflenp,
1N/A int free_input);
1N/Aint ldap_8859_to_t61(char **bufp, unsigned int *buflenp,
1N/A int free_input);
1N/A#endif /* LDAP_CHARSET_8859 */
1N/A#endif /* STR_TRANSLATION */
1N/A
1N/A/*
1N/A * Diplay Template functions
1N/A */
1N/Atypedef int (*writeptype)(void *writeparm, char *p, int len);
1N/A
1N/Aint ldap_init_templates(char *file,
1N/A struct ldap_disptmpl **tmpllistp);
1N/A
1N/Aint ldap_init_templates_buf(char *buf, ssize_t buflen,
1N/A struct ldap_disptmpl **tmpllistp);
1N/A
1N/Avoid ldap_free_templates(struct ldap_disptmpl *tmpllist);
1N/A
1N/Astruct ldap_disptmpl *ldap_first_disptmpl(
1N/A struct ldap_disptmpl *tmpllist);
1N/A
1N/Astruct ldap_disptmpl *ldap_next_disptmpl(
1N/A struct ldap_disptmpl *tmpllist, struct ldap_disptmpl *tmpl);
1N/A
1N/Astruct ldap_disptmpl *ldap_name2template(char *name,
1N/A struct ldap_disptmpl *tmpllist);
1N/A
1N/Astruct ldap_disptmpl *ldap_oc2template(char **oclist,
1N/A struct ldap_disptmpl *tmpllist);
1N/A
1N/Achar **ldap_tmplattrs(struct ldap_disptmpl *tmpl,
1N/A char **includeattrs, int exclude, unsigned int syntaxmask);
1N/A
1N/Astruct ldap_tmplitem *ldap_first_tmplrow(struct ldap_disptmpl *tmpl);
1N/A
1N/Astruct ldap_tmplitem *ldap_next_tmplrow(struct ldap_disptmpl *tmpl,
1N/A struct ldap_tmplitem *row);
1N/A
1N/Astruct ldap_tmplitem *ldap_first_tmplcol(struct ldap_disptmpl *tmpl,
1N/A struct ldap_tmplitem *row);
1N/A
1N/Astruct ldap_tmplitem *ldap_next_tmplcol(struct ldap_disptmpl *tmpl,
1N/A struct ldap_tmplitem *row, struct ldap_tmplitem *col);
1N/A
1N/Aint ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol,
1N/A int rdncount, unsigned int opts);
1N/A
1N/Aint ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label,
1N/A int labelwidth, unsigned int syntaxid, writeptype writeproc,
1N/A void *writeparm, char *eol, int rdncount);
1N/A
1N/Aint ldap_entry2text_search(LDAP *ld, char *dn, char *base,
1N/A LDAPMessage *entry, struct ldap_disptmpl *tmpllist,
1N/A char **defattrs, char ***defvals, writeptype writeproc,
1N/A void *writeparm, char *eol, int rdncount, unsigned int opts);
1N/A
1N/Aint ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry,
1N/A struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
1N/A writeptype writeproc, void *writeparm, char *eol,
1N/A int rdncount, unsigned int opts, char *urlprefix, char *base);
1N/A
1N/Aint ldap_vals2html(LDAP *ld, char *buf, char **vals, char *label,
1N/A int labelwidth, unsigned int syntaxid, writeptype writeproc,
1N/A void *writeparm, char *eol, int rdncount, char *urlprefix);
1N/A
1N/Aint ldap_entry2html_search(LDAP *ld, char *dn, char *base,
1N/A LDAPMessage *entry, struct ldap_disptmpl *tmpllist,
1N/A char **defattrs, char ***defvals, writeptype writeproc,
1N/A void *writeparm, char *eol, int rdncount, unsigned int opts,
1N/A char *urlprefix);
1N/A
1N/A
1N/A/*
1N/A * Search Preferences functions
1N/A */
1N/Aint ldap_init_searchprefs(char *file,
1N/A struct ldap_searchobj **solistp);
1N/A
1N/Aint ldap_init_searchprefs_buf(char *buf, ssize_t buflen,
1N/A struct ldap_searchobj **solistp);
1N/A
1N/Avoid ldap_free_searchprefs(struct ldap_searchobj *solist);
1N/A
1N/Astruct ldap_searchobj *ldap_first_searchobj(
1N/A struct ldap_searchobj *solist);
1N/A
1N/Astruct ldap_searchobj *ldap_next_searchobj(
1N/A struct ldap_searchobj *sollist, struct ldap_searchobj *so);
1N/A
1N/A
1N/A/*
1N/A * Option functions
1N/A */
1N/Aint ldap_get_option(LDAP *ld, int option, void *outvalue);
1N/Aint ldap_set_option(LDAP *ld, int option, void *invalue);
1N/A
1N/A
1N/A/*
1N/A * Control functions
1N/A */
1N/Avoid ldap_control_free(LDAPControl *ctrl);
1N/Avoid ldap_controls_free(LDAPControl **ctrls);
1N/A
1N/A
1N/A/*
1N/A * Simple Page Control functions
1N/A */
1N/Aint ldap_create_page_control(LDAP *ld, unsigned int pagesize,
1N/A struct berval *cookie, char isCritical, LDAPControl **output);
1N/Aint ldap_parse_page_control(LDAP *ld, LDAPControl **controls,
1N/A unsigned int *totalcount, struct berval **cookie);
1N/A
1N/A/*
1N/A * Server Side Sort control functions
1N/A */
1N/Aint ldap_create_sort_control(LDAP *ld, LDAPsortkey **sortKeyList,
1N/A const char ctl_iscritical, LDAPControl **ctrlp);
1N/Aint ldap_parse_sort_control(LDAP *ld, LDAPControl **ctrlp,
1N/A unsigned long *result, char **attribute);
1N/Aint ldap_create_sort_keylist(LDAPsortkey ***sortKeyList, char *string_rep);
1N/Avoid ldap_free_sort_keylist(LDAPsortkey **sortKeyList);
1N/A
1N/A/*
1N/A * Virtual List View control functions
1N/A */
1N/Aint ldap_create_virtuallist_control(LDAP *ld, LDAPVirtualList *ldvlistp,
1N/A LDAPControl **ctrlp);
1N/Aint ldap_parse_virtuallist_control(LDAP *ld, LDAPControl **ctrls,
1N/A unsigned long *target_posp, unsigned long *list_sizep,
1N/A int *errcodep);
1N/A
1N/A#endif /* NEEDPROTOS */
1N/A
1N/A#ifdef __cplusplus
1N/A}
1N/A#endif
1N/A
1N/A#endif /* _LDAP_H */