/* LINTLIBRARY */
/* PROTOLIB1 */
/*
* Copyright (c) 1997 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <sys/types.h>
#include <lber.h>
#include <ldap.h>
/*
* /usr/src/lib/libldap routines
*/
/*
* 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, char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_add_ext_s( LDAP *ld, char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls);
int ldap_add( LDAP *ld, char *dn, LDAPMod **attrs );
int ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs );
/*
* in bind.c:
*/
/*
* in sbind.c:
*/
int ldap_simple_bind( LDAP *ld, char *who, char *passwd );
int ldap_simple_bind_s( LDAP *ld, char *who, char *passwd );
/*
* in saslbind.c:
*/
int ldap_sasl_bind(LDAP *ld, char *dn, char *mechanism, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_sasl_bind_s(LDAP *ld, char *dn, char *mechanism, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, struct berval **servercredp);
/*
* in kbind.c:
*/
#ifndef NO_CACHE
/*
* in cache.c
*/
int ldap_enable_cache( LDAP *ld, time_t timeout, ssize_t maxmem );
void ldap_disable_cache( LDAP *ld );
void ldap_set_cache_options( LDAP *ld, unsigned int opts );
void ldap_destroy_cache( LDAP *ld );
void ldap_flush_cache( LDAP *ld );
void ldap_uncache_entry( LDAP *ld, char *dn );
void ldap_uncache_request( LDAP *ld, int msgid );
#endif /* !NO_CACHE */
/*
* in compare.c:
*/
int ldap_compare_ext(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_compare_ext_s(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls) ;
int ldap_compare( LDAP *ld, char *dn, char *attr, char *value );
int ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value );
/*
* in delete.c:
*/
int ldap_delete_ext(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_delete_ext_s(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls);
int ldap_delete( LDAP *ld, char *dn );
int ldap_delete_s( LDAP *ld, char *dn );
/*
* in error.c:
*/
char *ldap_err2string( int err );
/*
* in modify.c:
*/
int ldap_modify_ext(LDAP *ld, char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_modify_ext_s(LDAP *ld, char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls) ;
int ldap_modify( LDAP *ld, char *dn, LDAPMod **mods );
int ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods );
/*
* in modrdn.c:
*/
/*
* in rename.c:
*/
int ldap_rename(LDAP *ld, char *dn, char *newrdn, char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_rename_s(LDAP *ld, char *dn, char *newrdn, char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls);
/*
* in open.c:
*/
LDAP *ldap_init( char *defhost, int defport );
#ifdef LDAP_SSL
LDAP *ldap_ssl_init(char *defhost, int defport, char *keyname );
#endif
/*
* 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 );
/*
* 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 *msg );
int ldap_count_references( LDAP *ld, LDAPMessage *res );
char ** ldap_get_reference_urls( LDAP *ld, LDAPMessage *res );
/*
* in addentry.c
*/
LDAPMessage *ldap_delete_result_entry( LDAPMessage **list,
LDAPMessage *e );
void ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e );
/*
* in getdn.c
*/
char *ldap_get_dn( LDAP *ld, LDAPMessage *entry );
char **ldap_explode_dn( char *dn, int notypes );
char ** ldap_explode_rdn( char *rdn, int notypes );
char *ldap_dn2ufn( char *dn );
char **ldap_explode_dns( char *dn );
int ldap_is_dns_dn( 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(char *mem);
/*
* in getvalues.c
*/
char **ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target );
struct berval **ldap_get_values_len( LDAP *ld, LDAPMessage *entry,
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 );
/*
* in result.c:
*/
int ldap_result( LDAP *ld, int msgid, int all,
struct timeval *timeout, LDAPMessage **result );
int ldap_msgdelete( LDAP *ld, int msgid );
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, char *base, int scope, char *filter, char **attrs, int attrsonly, LDAPControl **serverctrls, LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit, int *msgidp);
int ldap_search_ext_s(LDAP *ld, char *base, int scope, char *filter, char **attrs, int attrsonly, LDAPControl **serverctrls, LDAPControl **clientctrls, struct timeval *timeoutp, int sizelimit, LDAPMessage **res);
int ldap_search( LDAP *ld, char *base, int scope, char *filter,
char **attrs, int attrsonly );
int ldap_search_s( LDAP *ld, char *base, int scope, char *filter,
char **attrs, int attrsonly, LDAPMessage **res );
int ldap_search_st( LDAP *ld, char *base, int scope, 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, int (*cancelproc)( void *cl ),
void *cancelparm );
int ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs,
int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ),
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 );
/*
* 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 *buf, size_t 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 );
/*
* in friendly.c
*/
char *ldap_friendly_name( char *filename, char *uname,
FriendlyMap **map );
void ldap_free_friendlymap( FriendlyMap **map );
/*
* in cldap.c
*/
LDAP *cldap_open( char *host, int port );
void cldap_close( LDAP *ld );
int cldap_search_s( LDAP *ld, char *base, int scope, char *filter,
char **attrs, int attrsonly, LDAPMessage **res, char *logdn );
void cldap_setretryinfo( LDAP *ld, int tries, time_t timeout );
/*
* 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( char **a, char **b );
/*
* in url.c
*/
int ldap_is_ldap_url( char *url );
int ldap_url_parse( char *url, LDAPURLDesc **ludpp );
void ldap_free_urlexts( LDAPURLExt **lues );
void ldap_free_urldesc( LDAPURLDesc *ludp );
int ldap_url_search( LDAP *ld, char *url, int attrsonly );
int ldap_url_search_s( LDAP *ld, char *url, int attrsonly,
LDAPMessage **res );
int ldap_url_search_st( LDAP *ld, 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
*/
#ifdef STR_TRANSLATION
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 );
#ifdef LDAP_CHARSET_8859
int ldap_t61_to_8859( char **bufp, unsigned int *buflenp,
int free_input );
int ldap_8859_to_t61( char **bufp, unsigned int *buflenp,
int free_input );
#endif /* LDAP_CHARSET_8859 */
#endif /* STR_TRANSLATION */
#ifdef WINSOCK
/*
* in msdos/winsock/wsa.c
*/
void ldap_memfree( void *p );
#endif /* WINSOCK */