|
On Fri, 28 Jun 2002, Haas, Matt wrote:
[SNIP]
> I'm attempting to call the LDAP API ldap_get_values and I'm getting the
> message 'Decoding error' back after the API call. I've spent quite a bit
> of time looking at the API documentation (which hasn't been much help in
> troubleshooting) and searching the web looking for a solution.
>
[SNIP]
> I'm pretty sure that I've either prototyped the API wrong or I'm missing
> an API call somewhere. I'd rather not send the complete source to the
> list (it's even longer than this post is getting to be <G>) but if
> someone needs it or the output from the ldapsearch utility to tell me
> what I'm doing wrong, I'll gladly send it privately.
confusingly, your text says that you're calling ldap_first_attribute,
as well as ldap_get_values, but your example only shows that you're
calling ldap_first_entry followed by ldap_first_attribute.
In either case, you don't appear to be passing the same pointer returned
by ldap_first_attribute as the attribute name to ldap_get_values. The
docs don't say that it's required, but maybe it is? At least, that's
the way that I do it.
I don't have enough time/energy/information to actually debug your
program, but here's some example code that works for me:
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('QC2LE')
H OPTION(*SRCSTMT: *NODEBUGIO)
D/copy mylib/qrpglesrc,ldap_h
D LOGIN_ACCT C 'cn=Administrator'
D LOGIN_PASSWD C 'keepwishing'
D MY_BASE_DN C 'o=klement sausage co'
D MAX_ATTR C 50
D SearchParm S 32A
D ld S *
D rc S 10I 0
D Msg S 52A
D Filter S 100A varying
D SearchArg S 32A varying
D AttrPtr S * DIM(MAX_ATTR)
D AttrVal S 101A DIM(MAX_ATTR)
D timeout S like(timeval)
D result S *
D entry S *
D attr S *
D berptr S *
D vals S *
D p_valelem S *
D p_value S * based(p_valelem)
c *entry plist
c parm SearchParm
c eval *inlr = *on
c eval ld = ldap_init(*NULL: LDAP_PORT)
c if ld = *NULL
c eval rc = ldap_get_errno(ld)
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c return
c endif
c eval rc = ldap_simple_bind_s(ld:
c LOGIN_ACCT: LOGIN_PASSWD)
c if rc <> LDAP_SUCCESS
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c return
c endif
c eval SearchArg = %trimr(SearchParm)
c eval Filter = '(|(cn=*'+SearchArg+'*)' +
c '(mail=*'+SearchArg+'*))'
c eval AttrVal(1) = 'cn' + x'00'
c eval AttrVal(2) = 'mail' + x'00'
c eval AttrPtr(1) = %addr(AttrVal(1))
c eval AttrPtr(2) = %addr(AttrVal(2))
c eval AttrPtr(3) = *NULL
c eval p_timeval = %addr(timeout)
c eval tv_sec = 120
c eval tv_usec = 0
c eval rc = ldap_search_st( ld:
c MY_BASE_DN:
c LDAP_SCOPE_SUBTREE:
c Filter:
c %addr(AttrPtr):
c 0:
c %addr(timeout):
c result)
c if rc <> LDAP_SUCCESS
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c callp ldap_unbind(ld)
c return
c endif
c eval entry = ldap_first_entry(ld: result)
c if entry = *NULL
c eval rc = ldap_get_errno(ld)
c if rc <> LDAP_SUCCESS
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c callp ldap_unbind(ld)
c return
c endif
c endif
c dow entry <> *NULL
c eval attr = ldap_first_attribute(ld: entry:
c berptr)
c if attr = *NULL
c eval rc = ldap_get_errno(ld)
c if rc <> LDAP_SUCCESS
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c callp ldap_msgfree(result)
c callp ldap_unbind(ld)
c return
c endif
c endif
c dow attr <> *NULL
c exsr DsplyVals
c callp ldap_memfree(attr)
c eval attr = ldap_next_attribute(ld: entry:
c berptr)
c enddo
c eval entry = ldap_next_entry(ld: entry)
c enddo
c callp ldap_msgfree(result)
c callp ldap_unbind(ld)
C*===============================================================
C*===============================================================
csr DsplyVals begsr
c*------------------------
c eval vals = ldap_get_values(ld: entry: attr)
c if vals = *NULL
c eval rc = ldap_get_errno(ld)
c if rc <> LDAP_SUCCESS
c eval Msg = %str(ldap_err2string(rc))
c dsply Msg
c callp ldap_memfree(attr)
c callp ldap_msgfree(result)
c callp ldap_unbind(ld)
c return
c endif
c endif
c eval p_valelem = vals
c dow p_value <> *NULL
c eval Msg = %str(attr)
c Msg dsply
c eval Msg = %str(p_value)
c dsply Msg
c eval p_valelem = p_valelem + %size(p_valelem)
c enddo
c callp ldap_value_free(vals)
c*------------------------
csr endsr
And here's the /copy member containing the prototypes and constants
that I'm using:
** Lightweight Directory Access Protocol (LDAP) API Header Member
** (For use in programs which work with the LDAP API.)
**
** SCK 06/27/2002
**
**
/if defined(LDAP_H)
/eof
/endif
/define LDAP_H
D LDAP_VERSION2 C CONST(2)
D LDAP_VERSION3 C CONST(3)
/if defined(LDAPV3)
D LDAP_VERSION C CONST(3)
/else
D LDAP_VERSION C CONST(2)
/endif
D LDAP_PORT C CONST(389)
D LDAPS_PORT C CONST(636)
D LDAP_MAX_ATTR_LEN...
D C CONST(100)
D LDAP_CODESET_UTF8...
D C CONST('UTF-8')
D LDAP_CODESET_UNICODE...
D C CONST('UCS-2')
**
** possible result types a server can return
**
D LDAP_RES_BIND C CONST(97)
D LDAP_RES_SEARCH_ENTRY...
D C CONST(100)
D LDAP_RES_SEARCH_RESULT...
D C CONST(101)
D LDAP_RES_MODIFY...
D C CONST(103)
D LDAP_RES_ADD C CONST(105)
D LDAP_RES_DELETE...
D C CONST(107)
D LDAP_RES_MODRDN...
D C CONST(109)
D LDAP_RES_COMPARE...
D C CONST(111)
D LDAP_RES_SEARCH_REFERENCE...
D C CONST(115)
D LDAP_RES_EXTENDED...
D C CONST(120)
D LDAP_EXTENDED_RES_NAME...
D C CONST(138)
D LDAP_EXTENDED_RES_VALUE...
D C CONST(139)
D LDAP_RES_REFERRAL...
D C CONST(163)
D LDAP_RES_ANY...
D C CONST(-1)
**
** authentication methods available
**
D LDAP_AUTH_SIMPLE...
D C CONST(128)
D LDAP_AUTH_SASL_30...
D C CONST(163)
D LDAP_SASL_SIMPLE...
D C CONST('')
**
** Search scopes:
**
D LDAP_SCOPE_BASE...
D C CONST(0)
D LDAP_SCOPE_ONELEVEL...
D C CONST(1)
D LDAP_SCOPE_SUBTREE...
D C CONST(2)
**
** mod_op constants:
**
D LDAP_MOD_ADD C CONST(0)
D LDAP_MOD_DELETE...
D C CONST(1)
D LDAP_MOD_REPLACE...
D C CONST(2)
D LDAP_MOD_BVALUES...
D C CONST(128)
**
** Options that can be set/retrieved
**
D LDAP_OPT_SIZELIMIT...
D C CONST(0)
D LDAP_OPT_TIMELIMIT...
D C CONST(1)
D LDAP_OPT_REFERRALS...
D C CONST(2)
D LDAP_OPT_DEREF...
D C CONST(3)
D LDAP_OPT_RESTART...
D C CONST(4)
D LDAP_OPT_REFHOPLIMIT...
D C CONST(5)
D LDAP_OPT_DEBUG...
D C CONST(6)
D LDAP_OPT_SSL_CIPHER...
D C CONST(7)
D LDAP_OPT_SSL_TIMEOUT...
D C CONST(8)
D LDAP_OPT_REBIND_FN...
D C CONST(9)
D LDAP_OPT_SSL...
D C CONST(10)
D LDAP_OPT_PROTOCOL_VERSION...
D C CONST(17)
D LDAP_OPT_SERVER_CONTROLS...
D C CONST(18)
D LDAP_OPT_CLIENT_CONTROLS...
D C CONST(19)
D LDAP_OPT_HOST_NAME...
D C CONST(48)
D LDAP_OPT_ERROR_NUMBER...
D C CONST(49)
D LDAP_OPT_ERROR_STRING...
D C CONST(50)
D LDAP_OPT_EXT_ERROR...
D C CONST(51)
D LDAP_OPT_UTF8_IO...
D C CONST(224)
D LDAP_OPT_UTF8_XLATE...
D C CONST(225)
D LDAP_OPT_LOCALE...
D C CONST(226)
D LDAP_OPT_LCS...
D C CONST(15)
D LDAP_NO_LIMIT...
D C CONST(0)
**
** option values for binary options
**
D LDAP_OPT_ON...
D C CONST(1)
D LDAP_OPT_OFF...
D C CONST(0)
**
** option values for UTF-8 xlates
**
D LDAP_UTF8_XLATE_OFF...
D C CONST(1)
D LDAP_UTF8_XLATE_ON...
D C CONST(0)
**
** option values for dereferencing aliases
**
D LDAP_DEREF_NEVER...
D C CONST(0)
D LDAP_DEREF_SEARCHING...
D C CONST(1)
D LDAP_DEREF_FINDING...
D C CONST(2)
D LDAP_DEREF_ALWAYS...
D C CONST(3)
D LDAP_DEFAULT_REFHOPLIMIT...
D C CONST(10)
**
** Server request search source types
**
D LDAP_LSI_CONF_DNS...
D C CONST(0)
D LDAP_LSI_CONF_ONLY...
D C CONST(1)
D LDAP_LSI_DNS_ONLY...
D C CONST(2)
**
** Server request connection types
**
D LDAP_LSI_UDP_TCP...
D C CONST(0)
D LDAP_LSI_UDP...
D C CONST(1)
D LDAP_LSI_TCP...
D C CONST(2)
**
** LDAP Server types
**
D LDAP_LSI_MASTER...
D C CONST(1)
D LDAP_LSI_REPLICA...
D C CONST(2)
**
** LDAP error codes
**
D LDAP_SUCCESS C CONST(0)
D LDAP_OPERATIONS_ERROR...
D C CONST(1)
D LDAP_PROTOCOL_ERROR...
D C CONST(2)
D LDAP_TIMELIMIT_EXCEEDED...
D C CONST(3)
D LDAP_SIZELIMIT_EXCEEDED...
D C CONST(4)
D LDAP_COMPARE_FALSE...
D C CONST(5)
D LDAP_COMPARE_TRUE...
D C CONST(6)
D LDAP_STRONG_AUTH_NOT_SUPPORTED...
D C CONST(7)
D LDAP_STRONG_AUTH_REQUIRED...
D C CONST(8)
D LDAP_PARTIAL_RESULTS...
D C CONST(9)
D LDAP_REFERRAL...
D C CONST(10)
D LDAP_ADMIN_LIMIT_EXCEEDED...
D C CONST(11)
D LDAP_UNAVAILABLE_CRITICAL_EXTENSION...
D C CONST(12)
D LDAP_CONFIDENTIALITY_REQUIRED...
D C CONST(13)
D LDAP_SASLBIND_IN_PROGRESS...
D C CONST(14)
D LDAP_NO_SUCH_ATTRIBUTE...
D C CONST(16)
D LDAP_UNDEFINED_TYPE...
D C CONST(17)
D LDAP_INAPPROPRIATE_MATCHING...
D C CONST(18)
D LDAP_CONSTRAINT_VIOLATION...
D C CONST(19)
D LDAP_TYPE_OR_VALUE_EXISTS...
D C CONST(20)
D LDAP_INVALID_SYNTAX...
D C CONST(21)
D LDAP_NO_SUCH_OBJECT...
D C CONST(32)
D LDAP_ALIAS_PROBLEM...
D C CONST(33)
D LDAP_INVALID_DN_SYNTAX...
D C CONST(34)
D LDAP_IS_LEAF...
D C CONST(35)
D LDAP_ALIAS_DEREF_PROBLEM...
D C CONST(36)
D LDAP_INAPPROPRIATE_AUTH...
D C CONST(48)
D LDAP_INVALID_CREDENTIALS...
D C CONST(49)
D LDAP_INSUFFICIENT_ACCESS...
D C CONST(50)
D LDAP_BUSY...
D C CONST(51)
D LDAP_UNAVAILABLE...
D C CONST(52)
D LDAP_UNWILLING_TO_PERFORM...
D C CONST(53)
D LDAP_LOOP_DETECT...
D C CONST(54)
D LDAP_NAMING_VIOLATION...
D C CONST(64)
D LDAP_OBJECT_CLASS_VIOLATION...
D C CONST(65)
D LDAP_NOT_ALLOWED_ON_NONLEAF...
D C CONST(66)
D LDAP_NOT_ALLOWED_ON_RDN...
D C CONST(67)
D LDAP_ALREADY_EXISTS...
D C CONST(68)
D LDAP_NO_OBJECT_CLASS_MODS...
D C CONST(69)
D LDAP_RESULTS_TOO_LARGE...
D C CONST(70)
D LDAP_AFFECTS_MULTIPLE_DSAS...
D C CONST(71)
D LDAP_OTHER...
D C CONST(80)
D LDAP_SERVER_DOWN...
D C CONST(81)
D LDAP_LOCAL_ERROR...
D C CONST(82)
D LDAP_ENCODING_ERROR...
D C CONST(83)
D LDAP_DECODING_ERROR...
D C CONST(84)
D LDAP_TIMEOUT...
D C CONST(85)
D LDAP_AUTH_UNKNOWN...
D C CONST(86)
D LDAP_FILTER_ERROR...
D C CONST(87)
D LDAP_USER_CANCELLED...
D C CONST(88)
D LDAP_PARAM_ERROR...
D C CONST(89)
D LDAP_NO_MEMORY...
D C CONST(90)
D LDAP_CONNECT_ERROR...
D C CONST(91)
D LDAP_NOT_SUPPORTED...
D C CONST(92)
D LDAP_CONTROL_NOT_FOUND...
D C CONST(93)
D LDAP_NO_RESULTS_RETURNED...
D C CONST(94)
D LDAP_MORE_RESULTS_TO_RETURN...
D C CONST(95)
D LDAP_URL_ERR_NOTLDAP...
D C CONST(96)
D LDAP_URL_ERR_NODN...
D C CONST(97)
D LDAP_URL_ERR_BADSCOPE...
D C CONST(98)
D LDAP_URL_ERR_MEM...
D C CONST(99)
D LDAP_CLIENT_LOOP...
D C CONST(100)
D LDAP_REFERRAL_LIMIT_EXCEEDED...
D C CONST(101)
D LDAP_SSL_ALREADY_INITIALIZED...
D C CONST(112)
D LDAP_SSL_INITIALIZE_FAILED...
D C CONST(113)
D LDAP_SSL_CLIENT_INIT_NOT_CALLED...
D C CONST(114)
D LDAP_SSL_PARAM_ERROR...
D C CONST(115)
D LDAP_SSL_HANDSHAKE_FAILED...
D C CONST(116)
D LDAP_SSL_GET_CIPHER_FAILED...
D C CONST(117)
D LDAP_SSL_NOT_AVAILABLE...
D C CONST(118)
D LDAP_SSL_KEYRING_NOT_FOUND...
D C CONST(119)
D LDAP_SSL_PASSWORD_NOT_SPECIFIED...
D C CONST(120)
D LDAP_NO_EXPLICIT_OWNER...
D C CONST(128)
D LDAP_NO_LOCK...
D C CONST(129)
D LDAP_DNS_NO_SERVERS...
D C CONST(133)
D LDAP_DNS_TRUNCATED...
D C CONST(134)
D LDAP_DNS_INVALID_DATA...
D C CONST(135)
D LDAP_DNS_RESOLVE_ERROR...
D C CONST(136)
D LDAP_DNS_CONF_FILE_ERROR...
D C CONST(137)
D LDAP_XLATE_E2BIG...
D C CONST(160)
D LDAP_XLATE_EINVAL...
D C CONST(161)
D LDAP_XLATE_EILSEQ...
D C CONST(162)
D LDAP_XLATE_NO_ENTRY...
D C CONST(163)
D LDAP_REG_FILE_NOT_FOUND...
D C CONST(176)
D LDAP_REG_CANNOT_OPEN...
D C CONST(177)
D LDAP_REG_ENTRY_NOT_FOUND...
D C CONST(178)
D LDAP_CONF_FILE_NOT_OPENED...
D C CONST(192)
D LDAP_PLUGIN_NOT_LOADED...
D C CONST(193)
D LDAP_PLUGIN_FUNCTION_NOT_RESOLVED...
D C CONST(194)
D LDAP_PLUGIN_NOT_INITIALIZED...
D C CONST(195)
D LDAP_PLUGIN_COULD_NOT_BIND...
D C CONST(196)
*-----------------------------------------------------------------
* Time Value Structure (for the ldap_search_st function, etc)
*
* contrains a structure for specifying a wait time.
*
* tv_sec = seconds. tv_usec = microseconds
*-----------------------------------------------------------------
/IF NOT DEFINED(TIMEVAL_STRUCT)
D p_timeval S *
D timeval DS based(p_timeval)
D tv_sec 10I 0
D tv_usec 10I 0
/DEFINE TIMEVAL_STRUCT
/ENDIF
*-----------------------------------------------------------------
* LDAPMod -- structure to contain info about attributes for
* adding or modifying.
*
* typedef struct ldapmod {
* int mod_op;
* char *mod_type;
* union {
* char **modv_strvals;
* struct berval **modv_bvals;
* } mod_vals;
*
*-----------------------------------------------------------------
D p_LDAPMOD S *
D LdapMod DS based(p_LdapMod) align
D mod_op 10I 0
D mod_type *
D modv_strvals *
D mod_values * overlay(modv_strvals:1)
D modv_bvals * overlay(modv_strvals:1)
D mod_bvalues * overlay(modv_strvals:1)
D mod_next *
*-----------------------------------------------------------------
* binary value structure
*
* struct berval {
* unsigned long bv_len;
* char *bv_val;
* };
*
*-----------------------------------------------------------------
D p_berval S *
D berval DS based(p_berval) align
D bv_len 10U 0
D bv_val *
*-----------------------------------------------------------------
* ldap_init() -- Perform an LDAP Initialization Operation
*
* LDAP *ldap_init ( char *defhost, int defport );
*
* defhost = default host(s) to connect to (can be a space
* separated list) or *NULL for localhost.
* defport = default port number to connect to.
* LDAP_PORT can be specified to default to port 389.
*
* Returns a pointer to an LDAP struct, or *NULL if failure
*-----------------------------------------------------------------
D ldap_init PR * extproc('ldap_init')
D defhost * value options(*string)
D defport 10I 0 value
*-----------------------------------------------------------------
* ldap_simple_bind_s()--Perform a Simple LDAP Bind Request (Synch)
*
* int ldap_simple_bind_s ( LDAP *ld, char *who, char *passwd );
*
* ld = pointer to struct returned by ldap_init
* dn = distinguished name of entry to bind as
* passwd = password associated with DN
*
* Returns LDAP_SUCCESS or an error code
*-----------------------------------------------------------------
D ldap_simple_bind_s...
D PR 10I 0 EXTPROC('ldap_simple_bind_s')
D ld * value
D who * value options(*string)
D passwd * value options(*string)
*-----------------------------------------------------------------
* ldap_search_st()--Perform an LDAP Search Operation (Timed & Synch)
*
* int ldap_search_st ( LDAP *ld, char *base, int scope,
* char *filter, char **attrs, int attrsonly,
* struct timeval *timeout, LDAPMessage **res );
*
* ld = ldap descriptor returned by ldap_init
* base = base DN to search
* scope = scope of the search. Can be LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL or LDAP_SCOPE_SUBTREE
* filter = filter of search
* attrs = null-terminated array of strings containing
* attribute types to return from entries which
* match the filter (or NULL for all attribs)
* attrsonly = specify 1 if you only want the attribute names,
* or 0 to return names & values.
* timeout = timeval structure specifying the time-out duration
* for this search.
* res = result of search. This result will be passed to
* LDAP parsing routines (ldap_first_entry, etc)
* When you're done with this, call ldap_msgfree()
* to de-allocate the memory its using.
*
* returns LDAP_SUCCESS or an LDAP error code.
*
*-----------------------------------------------------------------
D ldap_search_st PR 10I 0 ExtProc('ldap_search_st')
D ld * value
D base * value options(*string)
D scope 10I 0 value
D filter * value options(*string)
D attrs * value
D attrsonly 10I 0 value
D timeout * value
D res *
*-----------------------------------------------------------------
* ldap_first_entry()--Retrieve First LDAP Entry
*
* LDAPMessage *ldap_first_entry(LDAP *ld, LDAPMessage *result);
*
* ld = ldap descriptor
* result = result returned by ldap_result or ldap_search_st
* or ldap_search_s, etc.
*
* Returns NULL if error, or next entry if successful
*-----------------------------------------------------------------
D ldap_first_entry...
D PR * ExtProc('ldap_first_entry')
D ld * value
D result * value
*-----------------------------------------------------------------
* ldap_next_entry()--Retrieve Next LDAP Entry
*
* LDAPMessage *ldap_next_entry(LDAP *ld, LDAPMessage *entry);
*
* ld = ldap descriptor
* entry = pointer to entry returned on previous call to
* ldap_first_entry() or ldap_next_entry()
*
* Returns NULL if end of list, or the entry if successful
*-----------------------------------------------------------------
D ldap_next_entry...
D PR * ExtProc('ldap_next_entry')
D ld * value
D entry * value
*-----------------------------------------------------------------
* ldap_first_attribute()--Retrieve first attribute in an Entry
*
* char *ldap_first_attribute(LDAP *ld, LDAPMessage *entry,
* BerElement **berptr);
*
* ld = ldap descriptor
* entry = pointer to entry returned on previous call to
* ldap_first_entry() or ldap_next_entry()
* berptr = (output) the API uses this to keep track of it's
* internal state. (don't mess with it)
*
* Returns NULL if error, otherwise a pointer to the attribute
* name. You need to call ldap_memfree() to free this
* attribute's space when you're done with it.
*-----------------------------------------------------------------
D ldap_first_attribute...
D PR * ExtProc('ldap_first_attribute')
D ld * value
D entry * value
D berptr *
*-----------------------------------------------------------------
* ldap_next_attribute()--Retrieve next attribute in an Entry
*
* char *ldap_first_attribute(LDAP *ld, LDAPMessage *entry,
* BerElement **berptr);
*
* ld = ldap descriptor
* entry = pointer to entry returned on previous call to
* ldap_first_entry() or ldap_next_entry()
* berptr = (i/o) the API uses this to keep track of it's
* internal state. (don't mess with it)
*
* Returns NULL if error, otherwise a pointer to the attribute
* name. You need to call ldap_memfree() to free this
* attribute's space when you're done with it.
*-----------------------------------------------------------------
D ldap_next_attribute...
D PR * ExtProc('ldap_next_attribute')
D ld * value
D entry * value
D berptr * value
*-----------------------------------------------------------------
* ldap_get_values()--Retrieve a set of attribute values from an entry
*
* char **ldap_get_values(LDAP *ld, LDAPMessage *entry,
* char *attr);
*
* ld = ldap descriptor
* entry = pointer to entry returned on previous call to
* ldap_first_entry() or ldap_next_entry()
* attr = attribute whose values are desired
*
* Returns NULL if error, otherwise a null-terminated array of
* values for the given entry. You should call the
* ldap_value_free() API to free the memory reserved for this.
*-----------------------------------------------------------------
D ldap_get_values...
D PR * ExtProc('ldap_get_values')
D ld * value
D entry * value
D attr * value options(*string)
*-----------------------------------------------------------------
* ldap_get_dn()--Retrieve the Distinguished Name of an Entry
*
* char *ldap_get_dn(LDAP *ld, LDAPMessage *entry);
*
* ld = ldap descriptor
* entry = pointer to entry returned on previous call to
* ldap_first_entry() or ldap_next_entry()
*
* Returns NULL if error, otherwise the DN, which should be
* released by ldap_memfree().
*-----------------------------------------------------------------
D ldap_get_dn PR * ExtProc('ldap_get_dn')
D ld * value
D entry * value
*-----------------------------------------------------------------
* ldap_modify_s()--Perform an LDAP Modify Entry Request (Synchronous)
*
* int ldap_modify_s(LDAP *ld, char *dn, LDAPMod *mods[]);
*
* ld = ldap descriptor
* dn = distinguished name of entry to modify
* mods = NULL terminated array of modifications to make
*
* Returns LDAP_SUCCESS or an LDAP error message
*-----------------------------------------------------------------
D ldap_modify_s PR 10I 0 ExtPRoc('ldap_modify_s')
D ld * value
D dn * value options(*string)
D mods * value
*-----------------------------------------------------------------
* ldap_rename_s()--Change the DN of an Entry (Synchronous)
*
* int ldap_rename_s(LDAP *ld, char *dn, char *newrdn,
* char *newparent, int deleteoldrdn,
* LDAPControl **serverctrls, LDAPControl **clientctrls)
*
* ld = ldap descriptor
* dn = distinguished name of entry to modify
* newrdn = New relative distinguished name to assign
* newparent = New parent DN to assign
* deleteoldrdn = Delete old RDN? 1=yes, 0=no
* serverctrls = server controls or *NULL
* clientctrls = client controls or *NULL
*
* Returns LDAP_SUCCESS or an LDAP error message
*-----------------------------------------------------------------
D ldap_rename_s PR 10I 0 ExtPRoc('ldap_rename_s')
D ld * value
D dn * value options(*string)
D newrdn * value options(*string)
D newparent * value options(*string)
D deleteoldrdn 10I 0 value
D serverctrls * value
D clientctrls * value
*-----------------------------------------------------------------
* ldap_add_s()--Perform an LDAP Add Operation (Synchronous)
*
* int ldap_add_s(LDAP *ld, char *dn, LDAPMod *attrs[]);
*
* ld = ldap descriptor
* dn = distinguished name of entry to modify
* attrs = NULL terminated array of attributes to add
* (the mod_op field is ignored, except for
* checking for LDAP_MOD_BVALUES)
*
* Returns LDAP_SUCCESS or an LDAP error message
*-----------------------------------------------------------------
D ldap_add_s PR 10I 0 ExtProc('ldap_add_s')
D ld * value
D dn * value options(*string)
D attrs * value
*-----------------------------------------------------------------
* ldap_delete_s()--Delete LDAP entry (synchronus)
*
* int ldap_delete_s(LDAP *ld, char *dn);
*
* ld = ldap descriptor
* dn = distinguished name of entry to modify
*
* Returns LDAP_SUCCESS or an LDAP error message
*-----------------------------------------------------------------
D ldap_delete_s PR 10I 0 ExtProc('ldap_delete_s')
D ld * value
D dn * value options(*string)
*-----------------------------------------------------------------
* ldap_msgfree()--Free LDAP Result Message
*
* int ldap_msgfree(LDAPMessage *msg);
*
* msg = pointer to message to free
*
* Returns the type of the message freed up, or 0 if msg=NULL
*-----------------------------------------------------------------
D ldap_msgfree PR 10I 0 ExtProc('ldap_msgfree')
D msg * value
*-----------------------------------------------------------------
* ldap_memfree()--Free Memory allocated by LDAP API
*
* void ldap_memfree(char *mem);
*
* mem = pointer to memory to free
*
*-----------------------------------------------------------------
D ldap_memfree PR ExtProc('ldap_memfree')
D mem * value
*-----------------------------------------------------------------
* ldap_value_free()--Free Memory allocated by ldap_get_values()
*
* void ldap_value_free(char **vals);
*
* vals = pointer to memory to free
*
*-----------------------------------------------------------------
D ldap_value_free...
D PR ExtProc('ldap_value_free')
D mem * value
*-----------------------------------------------------------------
* ldap_unbind()--Perform an LDAP Unbind Request (Synch)
*
* Unbind & Terminate an LDAP session.
*
* int ldap_unbind(LDAP *ld);
*
* ld = LDAP descriptor from ldap_init() call
*
* returns LDAP_SUCCES or an LDAP error code.
*
* ldap_unbind() and ldap_unbind_s() are both synch, and do
* the exact same thing.
*-----------------------------------------------------------------
D ldap_unbind PR ExtProc('ldap_unbind')
D ld * value
*-----------------------------------------------------------------
* ldap_get_errno()--Retrieve error information
*
* int ldap_get_errno(LDAP *ld);
*
* ld = LDAP descriptor from ldap_init() call
*
* returns error number
*-----------------------------------------------------------------
D ldap_get_errno PR 10I 0 ExtProc('ldap_get_errno')
D ld * value
*-----------------------------------------------------------------
* ldap_err2string()--Retrieve LDAP error message string
*
* char *ldap_err2string ( int err );
*
* Returns the English text description for a given error number
*-----------------------------------------------------------------
D ldap_err2string...
D PR * ExtProc('ldap_err2string')
D error 10I 0 value
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.