1*0Sstevel@tonic-gate/* LINTLIBRARY */ 2*0Sstevel@tonic-gate/* PROTOLIB1 */ 3*0Sstevel@tonic-gate 4*0Sstevel@tonic-gate/* 5*0Sstevel@tonic-gate * Copyright (c) 1997 by Sun Microsystems, Inc. 6*0Sstevel@tonic-gate * All rights reserved. 7*0Sstevel@tonic-gate */ 8*0Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate#include <stdio.h> 11*0Sstevel@tonic-gate#include <sys/types.h> 12*0Sstevel@tonic-gate#include <lber.h> 13*0Sstevel@tonic-gate#include <ldap.h> 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate/* 16*0Sstevel@tonic-gate * /usr/src/lib/libldap routines 17*0Sstevel@tonic-gate */ 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gate/* 21*0Sstevel@tonic-gate * in abandon.c: 22*0Sstevel@tonic-gate */ 23*0Sstevel@tonic-gateint ldap_abandon_ext(LDAP *ld, int msgid, LDAPControl **serverctrls, LDAPControl ** clientctrls); 24*0Sstevel@tonic-gateint ldap_abandon( LDAP *ld, int msgid ); 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate/* 27*0Sstevel@tonic-gate * in add.c: 28*0Sstevel@tonic-gate */ 29*0Sstevel@tonic-gateint ldap_add_ext( LDAP *ld, char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp); 30*0Sstevel@tonic-gateint ldap_add_ext_s( LDAP *ld, char *dn, LDAPMod **attrs, LDAPControl ** serverctrls, LDAPControl **clientctrls); 31*0Sstevel@tonic-gateint ldap_add( LDAP *ld, char *dn, LDAPMod **attrs ); 32*0Sstevel@tonic-gateint ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs ); 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate/* 35*0Sstevel@tonic-gate * in bind.c: 36*0Sstevel@tonic-gate */ 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate/* 39*0Sstevel@tonic-gate * in sbind.c: 40*0Sstevel@tonic-gate */ 41*0Sstevel@tonic-gateint ldap_simple_bind( LDAP *ld, char *who, char *passwd ); 42*0Sstevel@tonic-gateint ldap_simple_bind_s( LDAP *ld, char *who, char *passwd ); 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate/* 45*0Sstevel@tonic-gate * in saslbind.c: 46*0Sstevel@tonic-gate */ 47*0Sstevel@tonic-gateint ldap_sasl_bind(LDAP *ld, char *dn, char *mechanism, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 48*0Sstevel@tonic-gateint ldap_sasl_bind_s(LDAP *ld, char *dn, char *mechanism, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, struct berval **servercredp); 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate/* 51*0Sstevel@tonic-gate * in kbind.c: 52*0Sstevel@tonic-gate */ 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate#ifndef NO_CACHE 55*0Sstevel@tonic-gate/* 56*0Sstevel@tonic-gate * in cache.c 57*0Sstevel@tonic-gate */ 58*0Sstevel@tonic-gateint ldap_enable_cache( LDAP *ld, time_t timeout, ssize_t maxmem ); 59*0Sstevel@tonic-gatevoid ldap_disable_cache( LDAP *ld ); 60*0Sstevel@tonic-gatevoid ldap_set_cache_options( LDAP *ld, unsigned int opts ); 61*0Sstevel@tonic-gatevoid ldap_destroy_cache( LDAP *ld ); 62*0Sstevel@tonic-gatevoid ldap_flush_cache( LDAP *ld ); 63*0Sstevel@tonic-gatevoid ldap_uncache_entry( LDAP *ld, char *dn ); 64*0Sstevel@tonic-gatevoid ldap_uncache_request( LDAP *ld, int msgid ); 65*0Sstevel@tonic-gate#endif /* !NO_CACHE */ 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate/* 68*0Sstevel@tonic-gate * in compare.c: 69*0Sstevel@tonic-gate */ 70*0Sstevel@tonic-gateint ldap_compare_ext(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp); 71*0Sstevel@tonic-gateint ldap_compare_ext_s(LDAP *ld, char *dn, char *attr, struct berval *bvalue, LDAPControl ** serverctrls, LDAPControl **clientctrls) ; 72*0Sstevel@tonic-gateint ldap_compare( LDAP *ld, char *dn, char *attr, char *value ); 73*0Sstevel@tonic-gateint ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value ); 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate/* 76*0Sstevel@tonic-gate * in delete.c: 77*0Sstevel@tonic-gate */ 78*0Sstevel@tonic-gateint ldap_delete_ext(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 79*0Sstevel@tonic-gateint ldap_delete_ext_s(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls); 80*0Sstevel@tonic-gateint ldap_delete( LDAP *ld, char *dn ); 81*0Sstevel@tonic-gateint ldap_delete_s( LDAP *ld, char *dn ); 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate/* 84*0Sstevel@tonic-gate * in error.c: 85*0Sstevel@tonic-gate */ 86*0Sstevel@tonic-gatechar *ldap_err2string( int err ); 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate/* 90*0Sstevel@tonic-gate * in modify.c: 91*0Sstevel@tonic-gate */ 92*0Sstevel@tonic-gateint ldap_modify_ext(LDAP *ld, char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp); 93*0Sstevel@tonic-gateint ldap_modify_ext_s(LDAP *ld, char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls) ; 94*0Sstevel@tonic-gateint ldap_modify( LDAP *ld, char *dn, LDAPMod **mods ); 95*0Sstevel@tonic-gateint ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods ); 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate/* 98*0Sstevel@tonic-gate * in modrdn.c: 99*0Sstevel@tonic-gate */ 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate/* 102*0Sstevel@tonic-gate * in rename.c: 103*0Sstevel@tonic-gate */ 104*0Sstevel@tonic-gateint ldap_rename(LDAP *ld, char *dn, char *newrdn, char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls, int *msgidp); 105*0Sstevel@tonic-gateint ldap_rename_s(LDAP *ld, char *dn, char *newrdn, char *newparent, int deleteoldrdn, LDAPControl ** serverctrls, LDAPControl **clientctrls); 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate/* 108*0Sstevel@tonic-gate * in open.c: 109*0Sstevel@tonic-gate */ 110*0Sstevel@tonic-gateLDAP *ldap_init( char *defhost, int defport ); 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate#ifdef LDAP_SSL 114*0Sstevel@tonic-gateLDAP *ldap_ssl_init(char *defhost, int defport, char *keyname ); 115*0Sstevel@tonic-gate#endif 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate/* 118*0Sstevel@tonic-gate * in getentry.c: 119*0Sstevel@tonic-gate */ 120*0Sstevel@tonic-gateLDAPMessage *ldap_first_entry( LDAP *ld, LDAPMessage *res ); 121*0Sstevel@tonic-gateLDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry ); 122*0Sstevel@tonic-gateint ldap_count_entries( LDAP *ld, LDAPMessage *res ); 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate/* 125*0Sstevel@tonic-gate * in getmsg.c: 126*0Sstevel@tonic-gate */ 127*0Sstevel@tonic-gateLDAPMessage *ldap_first_message( LDAP *ld, LDAPMessage *res ); 128*0Sstevel@tonic-gateLDAPMessage *ldap_next_message( LDAP *ld, LDAPMessage *msg ); 129*0Sstevel@tonic-gateint ldap_count_messages( LDAP *ld, LDAPMessage *res ); 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate/* 132*0Sstevel@tonic-gate * in getref.c: 133*0Sstevel@tonic-gate */ 134*0Sstevel@tonic-gateLDAPMessage *ldap_first_reference( LDAP *ld, LDAPMessage *res ); 135*0Sstevel@tonic-gateLDAPMessage *ldap_next_reference( LDAP *ld, LDAPMessage *msg ); 136*0Sstevel@tonic-gateint ldap_count_references( LDAP *ld, LDAPMessage *res ); 137*0Sstevel@tonic-gatechar ** ldap_get_reference_urls( LDAP *ld, LDAPMessage *res ); 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate/* 140*0Sstevel@tonic-gate * in addentry.c 141*0Sstevel@tonic-gate */ 142*0Sstevel@tonic-gateLDAPMessage *ldap_delete_result_entry( LDAPMessage **list, 143*0Sstevel@tonic-gate LDAPMessage *e ); 144*0Sstevel@tonic-gatevoid ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e ); 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate/* 147*0Sstevel@tonic-gate * in getdn.c 148*0Sstevel@tonic-gate */ 149*0Sstevel@tonic-gatechar *ldap_get_dn( LDAP *ld, LDAPMessage *entry ); 150*0Sstevel@tonic-gatechar **ldap_explode_dn( char *dn, int notypes ); 151*0Sstevel@tonic-gatechar ** ldap_explode_rdn( char *rdn, int notypes ); 152*0Sstevel@tonic-gatechar *ldap_dn2ufn( char *dn ); 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gatechar **ldap_explode_dns( char *dn ); 155*0Sstevel@tonic-gateint ldap_is_dns_dn( char *dn ); 156*0Sstevel@tonic-gatechar *ldap_dns_to_dn(char *dns_name, int *nameparts); 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate/* 159*0Sstevel@tonic-gate * in getattr.c 160*0Sstevel@tonic-gate */ 161*0Sstevel@tonic-gatechar *ldap_first_attribute( LDAP *ld, LDAPMessage *entry, 162*0Sstevel@tonic-gate BerElement **ber ); 163*0Sstevel@tonic-gatechar *ldap_next_attribute( LDAP *ld, LDAPMessage *entry, 164*0Sstevel@tonic-gate BerElement *ber ); 165*0Sstevel@tonic-gatevoid ldap_memfree(char *mem); 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate/* 168*0Sstevel@tonic-gate * in getvalues.c 169*0Sstevel@tonic-gate */ 170*0Sstevel@tonic-gatechar **ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target ); 171*0Sstevel@tonic-gatestruct berval **ldap_get_values_len( LDAP *ld, LDAPMessage *entry, 172*0Sstevel@tonic-gate char *target ); 173*0Sstevel@tonic-gateint ldap_count_values( char **vals ); 174*0Sstevel@tonic-gateint ldap_count_values_len( struct berval **vals ); 175*0Sstevel@tonic-gatevoid ldap_value_free( char **vals ); 176*0Sstevel@tonic-gatevoid ldap_value_free_len( struct berval **vals ); 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate/* 179*0Sstevel@tonic-gate * in result.c: 180*0Sstevel@tonic-gate */ 181*0Sstevel@tonic-gateint ldap_result( LDAP *ld, int msgid, int all, 182*0Sstevel@tonic-gate struct timeval *timeout, LDAPMessage **result ); 183*0Sstevel@tonic-gateint ldap_msgdelete( LDAP *ld, int msgid ); 184*0Sstevel@tonic-gateint ldap_msgfree( LDAPMessage *lm ); 185*0Sstevel@tonic-gateint ldap_msgtype( LDAPMessage *res ); 186*0Sstevel@tonic-gateint ldap_msgid( LDAPMessage *res ); 187*0Sstevel@tonic-gateint ldap_parse_result(LDAP *ld, LDAPMessage *res, int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp, LDAPControl ***serverctrlsp, int freeit) ; 188*0Sstevel@tonic-gateint ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res, struct berval **servercredp, int freeit); 189*0Sstevel@tonic-gateint ldap_parse_extended_result(LDAP *ld, LDAPMessage *res, char **resultoidp, struct berval **resultdata, int freeit); 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate/* 192*0Sstevel@tonic-gate * in search.c: 193*0Sstevel@tonic-gate */ 194*0Sstevel@tonic-gateint 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); 195*0Sstevel@tonic-gateint 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); 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gateint ldap_search( LDAP *ld, char *base, int scope, char *filter, 198*0Sstevel@tonic-gate char **attrs, int attrsonly ); 199*0Sstevel@tonic-gateint ldap_search_s( LDAP *ld, char *base, int scope, char *filter, 200*0Sstevel@tonic-gate char **attrs, int attrsonly, LDAPMessage **res ); 201*0Sstevel@tonic-gateint ldap_search_st( LDAP *ld, char *base, int scope, char *filter, 202*0Sstevel@tonic-gate char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res ); 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate/* 205*0Sstevel@tonic-gate * in ufn.c 206*0Sstevel@tonic-gate */ 207*0Sstevel@tonic-gateint ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, 208*0Sstevel@tonic-gate int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ), 209*0Sstevel@tonic-gate void *cancelparm ); 210*0Sstevel@tonic-gateint ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, 211*0Sstevel@tonic-gate int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ), 212*0Sstevel@tonic-gate void *cancelparm, char *tag1, char *tag2, char *tag3 ); 213*0Sstevel@tonic-gateint ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, 214*0Sstevel@tonic-gate int attrsonly, LDAPMessage **res ); 215*0Sstevel@tonic-gateLDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname ); 216*0Sstevel@tonic-gatevoid ldap_ufn_setprefix( LDAP *ld, char *prefix ); 217*0Sstevel@tonic-gateint ldap_ufn_timeout( void *tvparam ); 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate/* 221*0Sstevel@tonic-gate * in unbind.c 222*0Sstevel@tonic-gate */ 223*0Sstevel@tonic-gateint ldap_unbind( LDAP *ld ); 224*0Sstevel@tonic-gateint ldap_unbind_s( LDAP *ld ); 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate/* 228*0Sstevel@tonic-gate * in getfilter.c 229*0Sstevel@tonic-gate */ 230*0Sstevel@tonic-gateLDAPFiltDesc *ldap_init_getfilter( char *fname ); 231*0Sstevel@tonic-gateLDAPFiltDesc *ldap_init_getfilter_buf( char *buf, ssize_t buflen ); 232*0Sstevel@tonic-gateLDAPFiltInfo *ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, 233*0Sstevel@tonic-gate char *value ); 234*0Sstevel@tonic-gateLDAPFiltInfo *ldap_getnextfilter( LDAPFiltDesc *lfdp ); 235*0Sstevel@tonic-gatevoid ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix ); 236*0Sstevel@tonic-gatevoid ldap_build_filter( char *buf, size_t buflen, 237*0Sstevel@tonic-gate char *pattern, char *prefix, char *suffix, char *attr, 238*0Sstevel@tonic-gate char *value, char **valwords ); 239*0Sstevel@tonic-gate 240*0Sstevel@tonic-gate/* 241*0Sstevel@tonic-gate * in free.c 242*0Sstevel@tonic-gate */ 243*0Sstevel@tonic-gatevoid ldap_getfilter_free( LDAPFiltDesc *lfdp ); 244*0Sstevel@tonic-gatevoid ldap_mods_free( LDAPMod **mods, int freemods ); 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate/* 247*0Sstevel@tonic-gate * in friendly.c 248*0Sstevel@tonic-gate */ 249*0Sstevel@tonic-gatechar *ldap_friendly_name( char *filename, char *uname, 250*0Sstevel@tonic-gate FriendlyMap **map ); 251*0Sstevel@tonic-gatevoid ldap_free_friendlymap( FriendlyMap **map ); 252*0Sstevel@tonic-gate 253*0Sstevel@tonic-gate 254*0Sstevel@tonic-gate/* 255*0Sstevel@tonic-gate * in cldap.c 256*0Sstevel@tonic-gate */ 257*0Sstevel@tonic-gateLDAP *cldap_open( char *host, int port ); 258*0Sstevel@tonic-gatevoid cldap_close( LDAP *ld ); 259*0Sstevel@tonic-gateint cldap_search_s( LDAP *ld, char *base, int scope, char *filter, 260*0Sstevel@tonic-gate char **attrs, int attrsonly, LDAPMessage **res, char *logdn ); 261*0Sstevel@tonic-gatevoid cldap_setretryinfo( LDAP *ld, int tries, time_t timeout ); 262*0Sstevel@tonic-gate 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate/* 265*0Sstevel@tonic-gate * in sort.c 266*0Sstevel@tonic-gate */ 267*0Sstevel@tonic-gateint ldap_sort_entries( LDAP *ld, LDAPMessage **chain, char *attr, 268*0Sstevel@tonic-gate int (*cmp)() ); 269*0Sstevel@tonic-gateint ldap_sort_values( LDAP *ld, char **vals, int (*cmp)() ); 270*0Sstevel@tonic-gateint ldap_sort_strcasecmp( char **a, char **b ); 271*0Sstevel@tonic-gate 272*0Sstevel@tonic-gate 273*0Sstevel@tonic-gate/* 274*0Sstevel@tonic-gate * in url.c 275*0Sstevel@tonic-gate */ 276*0Sstevel@tonic-gateint ldap_is_ldap_url( char *url ); 277*0Sstevel@tonic-gateint ldap_url_parse( char *url, LDAPURLDesc **ludpp ); 278*0Sstevel@tonic-gatevoid ldap_free_urlexts( LDAPURLExt **lues ); 279*0Sstevel@tonic-gatevoid ldap_free_urldesc( LDAPURLDesc *ludp ); 280*0Sstevel@tonic-gateint ldap_url_search( LDAP *ld, char *url, int attrsonly ); 281*0Sstevel@tonic-gateint ldap_url_search_s( LDAP *ld, char *url, int attrsonly, 282*0Sstevel@tonic-gate LDAPMessage **res ); 283*0Sstevel@tonic-gateint ldap_url_search_st( LDAP *ld, char *url, int attrsonly, 284*0Sstevel@tonic-gate struct timeval *timeout, LDAPMessage **res ); 285*0Sstevel@tonic-gatechar *ldap_dns_to_url(LDAP *ld, char *dns_name, char *attrs, 286*0Sstevel@tonic-gatechar *scope, char *filter); 287*0Sstevel@tonic-gatechar *ldap_dn_to_url(LDAP *ld, char *dn, int nameparts); 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate 290*0Sstevel@tonic-gate/* 291*0Sstevel@tonic-gate * in charset.c 292*0Sstevel@tonic-gate */ 293*0Sstevel@tonic-gate#ifdef STR_TRANSLATION 294*0Sstevel@tonic-gatevoid ldap_set_string_translators( LDAP *ld, 295*0Sstevel@tonic-gate BERTranslateProc encode_proc, BERTranslateProc decode_proc ); 296*0Sstevel@tonic-gateint ldap_translate_from_t61( LDAP *ld, char **bufp, 297*0Sstevel@tonic-gate unsigned int *lenp, int free_input ); 298*0Sstevel@tonic-gateint ldap_translate_to_t61( LDAP *ld, char **bufp, 299*0Sstevel@tonic-gate unsigned int *lenp, int free_input ); 300*0Sstevel@tonic-gatevoid ldap_enable_translation( LDAP *ld, LDAPMessage *entry, 301*0Sstevel@tonic-gate int enable ); 302*0Sstevel@tonic-gate 303*0Sstevel@tonic-gate#ifdef LDAP_CHARSET_8859 304*0Sstevel@tonic-gateint ldap_t61_to_8859( char **bufp, unsigned int *buflenp, 305*0Sstevel@tonic-gate int free_input ); 306*0Sstevel@tonic-gateint ldap_8859_to_t61( char **bufp, unsigned int *buflenp, 307*0Sstevel@tonic-gate int free_input ); 308*0Sstevel@tonic-gate#endif /* LDAP_CHARSET_8859 */ 309*0Sstevel@tonic-gate#endif /* STR_TRANSLATION */ 310*0Sstevel@tonic-gate 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate#ifdef WINSOCK 313*0Sstevel@tonic-gate/* 314*0Sstevel@tonic-gate * in msdos/winsock/wsa.c 315*0Sstevel@tonic-gate */ 316*0Sstevel@tonic-gatevoid ldap_memfree( void *p ); 317*0Sstevel@tonic-gate#endif /* WINSOCK */ 318