/* LINTLIBRARY */
/* PROTOLIB1 */
/*
* Copyright 2001, 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <sys/types.h>
#include <lber.h>
#include <ldap.h>
/*
* in abandon.c:
*/
int ldap_abandon_ext(LDAP *ld, int msgid, LDAPControl **serverctrls, LDAPControl ** clientctrls);
int ldap_abandon( LDAP *ld, int msgid );
/*
* in add.c:
*/
int ldap_add_ext( LDAP *ld, const char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_add_ext_s( LDAP *ld, const char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls);
int ldap_add( LDAP *ld, const char *dn, LDAPMod **attrs );
int ldap_add_s( LDAP *ld, const char *dn, LDAPMod **attrs );
/*
* in bind.c:
*/
int ldap_bind(LDAP *ld, const char *dn, const char *passwd, int authmethod);
int ldap_bind_s(LDAP *ld, const char *dn, const char *passwd, int authmethod);
void ldap_set_rebind_proc(LDAP *ld, LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg);
/*
* in sbind.c:
*/
int ldap_simple_bind( LDAP *ld, const char *dn, const char *passwd );
int ldap_simple_bind_s( LDAP *ld, const char *dn, const char *passwd );
/*
* in saslbind.c:
*/
int ldap_sasl_bind(LDAP *ld, const char *dn, const char *mechanism, const struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism, const struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, struct berval **servercredp);
/*
* in kbind.c:
*/
/*
* in cache.c
*/
/*
* in compare.c:
*/
int ldap_compare_ext(LDAP *ld, const char *dn, const char *attr, const struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_compare_ext_s(LDAP *ld, const char *dn, const char *attr, const struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls) ;
int ldap_compare( LDAP *ld, const char *dn, const char *attr, const char *value );
int ldap_compare_s( LDAP *ld, const char *dn, const char *attr, const char *value );
/*
* in delete.c:
*/
int ldap_delete_ext(LDAP *ld, const char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_delete_ext_s(LDAP *ld, const char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls);
int ldap_delete( LDAP *ld, const char *dn );
int ldap_delete_s( LDAP *ld, const char *dn );
/*
* in error.c:
*/
char *ldap_err2string( int err );
void ldap_perror(LDAP *ld, const char *s);
int ldap_result2error(LDAP *ld, LDAPMessage *r, int freeit);
int ldap_get_lderrno(LDAP *ld, char **m, char **s);
int ldap_set_lderrno(LDAP *ld, int e, char *m, char *s);
/*
* in modify.c:
*/
int ldap_modify_ext(LDAP *ld, const char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_modify_ext_s(LDAP *ld, const char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls) ;
int ldap_modify( LDAP *ld, const char *dn, LDAPMod **mods );
int ldtap_modify_s( LDAP *ld, const char *dn, LDAPMod **mods );
/*
* in modrdn.c:
*/
/*
* in rename.c:
*/
int ldap_rename(LDAP *ld, const char *dn, const char *newrdn, const char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_rename_s(LDAP *ld, const char *dn, const char *newrdn, const char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls);
int ldap_modrdn(LDAP *ld, const char *dn, const char *newrdn);
int ldap_modrdn_s(LDAP *ld, const char *dn, const char *newrdn);
int ldap_modrdn2(LDAP *ld, const char *dn, const char *newrdn, int deleteoldrdn);
int ldap_modrdn2_s(LDAP *ld, const char *dn, const char *newrdn, int deleteoldrdn);
/*
* in open.c:
*/
LDAP *ldap_init( const char *defhost, int defport );
LDAP *ldap_open(const char *host, int port);
int ldap_version(LDAPVersion *ver);
/*
* in getentry.c:
*/
LDAPMessage *ldap_first_entry( LDAP *ld, LDAPMessage *res );
LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry );
int ldap_count_entries( LDAP *ld, LDAPMessage *res );
int ldap_get_entry_controls(LDAP *ld, LDAPMessage *entry, LDAPControl ***serverctrlsp);
/*
* in getmsg.c:
*/
LDAPMessage *ldap_first_message( LDAP *ld, LDAPMessage *res );
LDAPMessage *ldap_next_message( LDAP *ld, LDAPMessage *msg );
int ldap_count_messages( LDAP *ld, LDAPMessage *res );
/*
* in getref.c:
*/
LDAPMessage *ldap_first_reference( LDAP *ld, LDAPMessage *res );
LDAPMessage *ldap_next_reference( LDAP *ld, LDAPMessage *entry );
int ldap_count_references( LDAP *ld, LDAPMessage *res );
/*
* in getdn.c
*/
char *ldap_get_dn( LDAP *ld, LDAPMessage *entry );
char **ldap_explode_dn( const char *dn, const int notypes );
char ** ldap_explode_rdn( const char *rdn, const int notypes );
char *ldap_dn2ufn( const char *dn );
char **ldap_explode_dns( const char *dn );
int ldap_is_dns_dn( const char *dn );
char *ldap_dns_to_dn(char *dns_name, int *nameparts);
/*
* in getattr.c
*/
char *ldap_first_attribute( LDAP *ld, LDAPMessage *entry,
BerElement **ber );
char *ldap_next_attribute( LDAP *ld, LDAPMessage *entry,
BerElement *ber );
void ldap_memfree(void *p);
/*
* in getvalues.c
*/
char **ldap_get_values( LDAP *ld, LDAPMessage *entry, const char *target );
int ldap_count_values( char **vals );
int ldap_count_values_len( struct berval **vals );
void ldap_value_free( char **vals );
void ldap_value_free_len( struct berval **vals );
struct berval **ldap_get_values_len(LDAP *ld, LDAPMessage *entry, const char *target);
char **ldap_get_lang_values(LDAP *ld, LDAPMessage *entry, const char *target, char **type);
struct berval **ldap_get_lang_values_len(LDAP *ld, LDAPMessage *entry, const char *target, char **type);
/*
* in referral.c:
*/
int ldap_parse_reference(LDAP *ld, LDAPMessage *ref,
char ***referralsp, LDAPControl ***serverctrlsp, int freeit);
char ** ldap_get_reference_urls(LDAP *ld, LDAPMessage *res);
/*
* in result.c:
*/
int ldap_result( LDAP *ld, int msgid, int all,
struct timeval *timeout, LDAPMessage **result );
int ldap_msgfree( LDAPMessage *lm );
int ldap_msgtype( LDAPMessage *res );
int ldap_msgid( LDAPMessage *res );
int ldap_parse_result(LDAP *ld, LDAPMessage *res, int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp, LDAPControl ***serverctrlsp, int freeit) ;
int ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res, struct berval **servercredp, int freeit);
int ldap_parse_extended_result(LDAP *ld, LDAPMessage *res, char **resultoidp, struct berval **resultdata, int freeit);
/*
* in search.c:
*/
int ldap_search_ext(LDAP *ld, const char *base, int scope, const char *filter, char **attrs, int attrsonly, LDAPControl **serverctrls, LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit, int *msgidp);
int ldap_search_ext_s(LDAP *ld, const char *base, int scope, const char *filter, char **attrs, int attrsonly, LDAPControl **serverctrls, LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit, LDAPMessage **res);
int ldap_search( LDAP *ld, const char *base, int scope, const char *filter,
char **attrs, int attrsonly );
int ldap_search_s( LDAP *ld, const char *base, int scope, const char *filter,
char **attrs, int attrsonly, LDAPMessage **res );
int ldap_search_st( LDAP *ld, const char *base, int scope, const char *filter,
char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res );
/*
* in ufn.c
*/
int ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs,
int attrsonly, LDAPMessage **res, LDAP_CANCELPROC_CALLBACK cancelproc,
void *cancelparm );
int ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs,
int attrsonly, LDAPMessage **res, LDAP_CANCELPROC_CALLBACK cancelproc,
void *cancelparm, char *tag1, char *tag2, char *tag3 );
int ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs,
int attrsonly, LDAPMessage **res );
LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
void ldap_ufn_setprefix( LDAP *ld, char *prefix );
int ldap_ufn_timeout( void *tvparam );
/*
* in unbind.c
*/
int ldap_unbind( LDAP *ld );
int ldap_unbind_s( LDAP *ld );
int ldap_unbind_ext(LDAP *ld, LDAPControl **serverctrls, LDAPControl **clientctrls);
/*
* in getfilter.c
*/
LDAPFiltDesc *ldap_init_getfilter( char *fname );
LDAPFiltDesc *ldap_init_getfilter_buf( char *buf, ssize_t buflen );
LDAPFiltInfo *ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat,
char *value );
LDAPFiltInfo *ldap_getnextfilter( LDAPFiltDesc *lfdp );
void ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix );
void ldap_build_filter( char *filtbuf, size_t buflen,
char *pattern, char *prefix, char *suffix, char *attr,
char *value, char **valwords );
int ldap_create_filter(char *buf, unsigned long buflen, char *pattern, char *prefix, char *suffix, char *attr, char *value, char **valwords);
/*
* in free.c
*/
void ldap_getfilter_free( LDAPFiltDesc *lfdp );
void ldap_mods_free( LDAPMod **mods, int freemods );
void ldap_ber_free(BerElement *ber, int freebuf);
/*
* in friendly.c
*/
char *ldap_friendly_name( char *filename, char *uname,
FriendlyMap *map );
void ldap_free_friendlymap( FriendlyMap *map );
/*
* in cldap.c
*/
/*
* in sort.c
*/
int ldap_sort_entries( LDAP *ld, LDAPMessage **chain, char *attr,
int (*cmp)() );
int ldap_sort_values( LDAP *ld, char **vals, int (*cmp)() );
int ldap_sort_strcasecmp( const char **a, const char **b );
int ldap_multisort_entries(LDAP *ld, LDAPMessage **chain, char **attr, LDAP_CMP_CALLBACK *cmp);
/*
* in url.c
*/
int ldap_is_ldap_url( const char *url );
int ldap_url_parse( const char *url, LDAPURLDesc **ludpp );
int ldap_url_parse_nodn(const char *url, LDAPURLDesc **ludpp);
void ldap_free_urldesc( LDAPURLDesc *ludp );
int ldap_url_search( LDAP *ld, const char *url, int attrsonly );
int ldap_url_search_s( LDAP *ld, const char *url, int attrsonly,
LDAPMessage **res );
int ldap_url_search_st( LDAP *ld, const char *url, int attrsonly,
struct timeval *timeout, LDAPMessage **res );
char *ldap_dns_to_url(LDAP *ld, char *dns_name, char *attrs,
char *scope, char *filter);
char *ldap_dn_to_url(LDAP *ld, char *dn, int nameparts);
/*
* in charset.c
*/
void ldap_set_string_translators( LDAP *ld,
BERTranslateProc encode_proc, BERTranslateProc decode_proc );
int ldap_translate_from_t61( LDAP *ld, char **bufp,
unsigned int *lenp, int free_input );
int ldap_translate_to_t61( LDAP *ld, char **bufp,
unsigned int *lenp, int free_input );
void ldap_enable_translation( LDAP *ld, LDAPMessage *entry,
int enable );
int ldap_t61_to_8859(char **bufp, unsigned long *buflenp,
int free_input);
int ldap_8859_to_t61(char **bufp, unsigned long *buflenp,
int free_input);
/*
* in io.c
*/
BerElement *ber_alloc_t(int options);
int ber_flatten(BerElement *ber, struct berval **bvPtr);
void ber_free(BerElement *ber, int freebuf);
BerElement *ber_alloc(void);
BerElement *ber_init(const struct berval *bv);
/*
* in decode.c
*/
struct berval *ber_bvdup(const struct berval *bv);
void ber_bvecfree(struct berval **bv);
void ber_bvfree(struct berval *bv);
ber_tag_t ber_first_element(BerElement *ber, unsigned int *len, char **last);
ber_tag_t ber_next_element(BerElement *ber, ber_tag_t *len, char *last);
ber_tag_t ber_peek_tag(BerElement *ber, ber_tag_t *len);
ber_tag_t ber_scanf(BerElement *ber, const char *fmt, ...);
ber_tag_t ber_skip_tag(BerElement *ber, ber_tag_t *len);
ber_tag_t ber_get_int(BerElement *ber, ber_int_t *num);
/*
* in encode.c
*/
int ber_printf(BerElement *ber, const char *fmt, ...);
/*
* in control.c
*/
void ldap_control_free (LDAPControl *ctrl);
void ldap_controls_free (LDAPControl **ctrls);
/*
* in spagectrl.c
*/
int ldap_create_page_control(LDAP *ld, unsigned int pagesize, struct berval *cookie, char isCritical, LDAPControl **output);
int ldap_parse_page_control(LDAP *ld, LDAPControl **controls, unsigned int *totalcount, struct berval **cookie);
/*
* in tmplout.c
*/
int ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry, struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol, int rdncount, unsigned long opts, char *urlprefix, char *base);
int ldap_entry2html_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry, struct ldap_disptmpl*tmpllist, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol,int rdncount, unsigned long opts, char *urlprefix);
int ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry, struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol, int rdncount, unsigned long opts);
int ldap_entry2text_search(LDAP *ld,char *dn, char *base, LDAPMessage *entry, struct ldap_disptmpl*tmpllist, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol,int rdncount, unsigned long opts);
int ldap_vals2html(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, unsigned long syntaxid, writeptype writeproc, void *writeparm, char *eol, int rdncount, char *urlprefix);
int ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label, int labelwidth, unsigned long syntaxid, writeptype writeproc, void *writeparm, char *eol, int rdncount);
/*
* in extendop.c
*/
int ldap_extended_operation(LDAP *ld, const char *requestoid, const struct berval *requestdata, LDAPControl **serverctrls, LDAPControl**clientctrls, int *msgidp);
int ldap_extended_operation_s(LDAP *ld, const char *requestoid, const struct berval *requestdata, LDAPControl **serverctrls, LDAPControl **clientctrls, char **retoidp, struct berval **retdatap);
/*
* in disptmpl.c
*/
struct ldap_disptmpl *ldap_first_disptmpl(struct ldap_disptmpl *tmpllist);
struct ldap_tmplitem *ldap_first_tmplcol(struct ldap_disptmpl *tmpl,struct ldap_tmplitem *row);
struct ldap_tmplitem *ldap_first_tmplrow(struct ldap_disptmpl *tmpl);
void ldap_free_templates(struct ldap_disptmpl *tmpllist);
int ldap_init_templates(char *file, struct ldap_disptmpl **tmpllistp);
int ldap_init_templates_buf(char *buf, long buflen, struct ldap_disptmpl **tmpllistp);
struct ldap_disptmpl *ldap_next_disptmpl(struct ldap_disptmpl *tmpllist, struct ldap_disptmpl *tmpl);
struct ldap_tmplitem *ldap_next_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, struct ldap_tmplitem *col);
struct ldap_tmplitem *ldap_next_tmplrow(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row);
struct ldap_disptmpl *ldap_oc2template(char **oclist, struct ldap_disptmpl *tmpllist);
char **ldap_tmplattrs(struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, unsigned long syntaxmask);
struct ldap_disptmpl *ldap_name2template(char *name, struct ldap_disptmpl *tmpllist);
/*
* in cram_md5.c
*/
int ldap_sasl_cram_md5_bind_s(LDAP *ld, char *dn, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls);
/*
* in setoption.c
*/
int ldap_set_option (LDAP *ld, int option, const void *optdata);
/*
* in log.c
*/
void ldaplogconfigf(FILE *fd);
/*
* in line64.c
*/
char *ldif_type_and_value(char *type, char *val, int vlen);
char *str_getline(char **next);
int str_parse_line(char *line, char **type, char **value, int *vlen);
/*
* in sortctrl.c
*/
int ldap_create_sort_control (LDAP *ld, LDAPsortkey **sortKeyList, const char ctl_iscritical, LDAPControl **ctrlp);
int ldap_parse_sort_control(LDAP *ld, LDAPControl **ctrlp, unsigned long *result, char **attribute);
int ldap_create_sort_keylist(LDAPsortkey ***sortKeyList, const char *string_rep);
void ldap_free_sort_keylist(LDAPsortkey **sortKeyList);
/*
* in vlistctrl.c
*/
int ldap_create_virtuallist_control(LDAP *ld, LDAPVirtualList *ldvlistp, LDAPControl **ctrlp);
int ldap_parse_virtuallist_control(LDAP *ld, LDAPControl **ctrls, unsigned long *target_posp, unsigned long *list_sizep, int *errcodep);
/*
* in ldapsinit.c
*/
LDAP * ldapssl_init( const char *defhost, int defport, int defsecure );
int ldapssl_install_routines( LDAP *ld );
int ldapssl_enable_clientauth( LDAP *ld, char *keynickname, char *keypasswd, char *certnickname );
/*
* in clientinit.c
*/
int ldapssl_client_init( const char *certdbpath, void *certdbhandle);
int ldapssl_clientauth_init(const char *certdbpath, void *certdbhandle, const int needkeydb, const char *keydbpath, void *keydbhandle);
int ldapssl_advclientauth_init( const char *certdbpath, void *certdbhandle, const int needkeydb, const char *keydbpath, void *keydbhandle, const int needsecmoddb, const char *secmoddbpath, const int sslstrength );
int ldapssl_pkcs_init( const struct ldapssl_pkcs_fns *pfns);
/*
* in errormap.c
*/
const char * ldapssl_err2string( const int prerrno );
/*
* in psearch.c
*/
int ldap_create_persistentsearch_control(LDAP *ld, int changetypes, int changesonly, int return_echg_ctls, char ctl_iscritical, LDAPControl **ctrlp);
int ldap_parse_entrychange_control(LDAP *ld, LDAPControl **ctrls, int *chgtypep, char **prevdnp, int *chgnumpresentp, ber_int_t *chgnump);
/*
* in proxyauthctrl.c
*/
int ldap_create_proxyauth_control(LDAP *ld, const char *dn, const char ctl_iscritical, LDAPControl **ctrlp);
int ldap_create_proxiedauth_control(LDAP *ld, const char *authzid, LDAPControl **ctrlp);
/*
* in srchpref.c
*/
struct ldap_searchobj *ldap_first_searchobj(struct ldap_searchobj *solist);
void ldap_free_searchprefs(struct ldap_searchobj *solist);
int ldap_init_searchprefs(char *file, struct ldap_searchobj **solistp);
int ldap_init_searchprefs_buf(char *buf, long buflen, struct ldap_searchobj **solistp);
struct ldap_searchobj *ldap_next_searchobj(struct ldap_searchobj *solist, struct ldap_searchobj *so);
/*
* in getoption.c
*/
int ldap_get_option (LDAP *ld, int option, void *outvalue);
/*
* in memcache.c
*/
int ldap_memcache_init(unsigned long ttl, unsigned long size, char **baseDNs, struct ldap_thread_fns *thread_fns, LDAPMemCache **cachep);
int ldap_memcache_set(LDAP *ld, LDAPMemCache *cache);
int ldap_memcache_get(LDAP *ld, LDAPMemCache **cachep);
void ldap_memcache_flush(LDAPMemCache *cache, char *dn, int scope);
void ldap_memcache_destroy(LDAPMemCache *cache);
void ldap_memcache_update(LDAPMemCache *cache);
/*
* in digest_md5.c
*/
int ldap_x_sasl_digest_md5_bind_s(LDAP *ld, char *dn, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls);