err = 0;
if ( sendabandon ) {
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
} else {
#ifdef LDAP_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
- free_connection( ld, lr->lr_conn, 0, 1 );
+ ldap_free_connection( ld, lr->lr_conn, 0, 1 );
}
if ( origid == msgid ) {
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
}
#endif /* LDAP_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "ldap_add\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
}
int
void
-add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
+ldap_add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
{
LDAPMessage *new;
long len;
- Debug( LDAP_DEBUG_TRACE, "add_request_to_cache\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
if ( ld->ld_cache == NULLLDCACHE ||
if (( new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) ))
!= NULL ) {
- if (( new->lm_ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if (( new->lm_ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
free( (char *)new );
return;
}
void
-add_result_to_cache( LDAP *ld, LDAPMessage *result )
+ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
{
LDAPMessage *m, **mp, *req, *new, *prev;
int err, keep;
- Debug( LDAP_DEBUG_TRACE, "add_result_to_cache: id %d, type %d\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
result->lm_msgid, result->lm_msgtype, 0 );
if ( ld->ld_cache == NULLLDCACHE ||
* will find them.
*/
int
-check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
+ldap_check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
{
LDAPMessage *m, *new, *prev, *next;
BerElement reqber;
int first, hash;
unsigned long validtime;
- Debug( LDAP_DEBUG_TRACE, "check_cache\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
if ( ld->ld_cache == NULLLDCACHE ||
( ld->ld_cache->lc_enabled == 0 )) {
if ( ld->ld_sb.sb_addrs == NULL
#ifdef LDAP_REFERRALS
- || ( ld->ld_defconn = new_connection( ld, NULL, 1,0,0 )) == NULL
+ || ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,0 )) == NULL
#endif /* LDAP_REFERRALS */
) {
free( ld );
"cldap_result waiting up to %d seconds for a response\n",
tv.tv_sec, 0, 0 );
ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ ldap_set_ber_options( ld, &ber );
if ( cldap_getmsg( ld, &tv, &ber ) == -1 ) {
ret = ld->ld_errno;
tag != LBER_DEFAULT && rc != LDAP_SUCCESS;
tag = ber_next_element( ber, &len, cookie )) {
if (( ldm = (LDAPMessage *)calloc( 1, sizeof(LDAPMessage)))
- == NULL || ( ldm->lm_ber = alloc_ber_with_options( ld ))
+ == NULL || ( ldm->lm_ber = ldap_alloc_ber_with_options( ld ))
== NULLBER ) {
rc = LDAP_NO_MEMORY;
break; /* return w/error*/
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, ldm );
+ ldap_add_result_to_cache( ld, ldm );
}
#endif /* NO_CACHE */
Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- if ( check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
+ if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
ber_free( ber, 1 );
ld->ld_errno = LDAP_SUCCESS;
return( ld->ld_msgid );
}
- add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
+ ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
}
#endif /* NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
}
int
Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
}
Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
- if ( (*ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULL );
}
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*
- * getdxbyname - retrieve DX records from the DNS (from TXT records for now)
+ * ldap_getdxbyname - retrieve DX records from the DNS (from TXT records for now)
*/
#include <stdio.h>
#include <string.h>
/*
- * getdxbyname - lookup DNS DX records for domain and return an ordered
+ * ldap_getdxbyname - lookup DNS DX records for domain and return an ordered
* array.
*/
char **
-getdxbyname( char *domain )
+ldap_getdxbyname( char *domain )
{
unsigned char buf[ PACKETSZ ];
char **dxs;
int rc;
- Debug( LDAP_DEBUG_TRACE, "getdxbyname( %s )\n", domain, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_getdxbyname( %s )\n", domain, 0, 0 );
memset( buf, 0, sizeof( buf ));
BerElement *ber;
char *cred;
int rc, credlen;
- char *get_kerberosv4_credentials();
+ char *ldap_get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "ldapserver",
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "ldapserver",
&credlen )) == NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
free( cred );
return( -1 );
}
#endif /* !NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
int
BerElement *ber;
char *cred;
int rc, credlen;
- char *get_kerberosv4_credentials();
+ char *ldap_get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
== NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
free( cred );
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
/* synchronous bind to DSA using kerberos */
#ifndef AUTHMAN
/*
- * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
+ * ldap_get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
* The dn of the entry to which to bind is supplied. It's assumed the
* user already has a tgt.
*/
char *
-get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
+ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
{
KTEXT_ST ktxt;
int err;
char realm[REALM_SZ], *cred, *krbinstance;
- Debug( LDAP_DEBUG_TRACE, "get_kerberosv4_credentials\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
#ifndef NO_USERINTERFACE
* in cache.c
*/
#ifdef NEEDPROTOS
-void add_request_to_cache( LDAP *ld, unsigned long msgtype,
+void ldap_add_request_to_cache( LDAP *ld, unsigned long msgtype,
BerElement *request );
-void add_result_to_cache( LDAP *ld, LDAPMessage *result );
-int check_cache( LDAP *ld, unsigned long msgtype, BerElement *request );
+void ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result );
+int ldap_check_cache( LDAP *ld, unsigned long msgtype, BerElement *request );
#else /* NEEDPROTOS */
-void add_request_to_cache();
-void add_result_to_cache();
-int check_cache();
+void ldap_add_request_to_cache();
+void ldap_add_result_to_cache();
+int ldap_check_cache();
#endif /* NEEDPROTOS */
* in kerberos.c
*/
#ifdef NEEDPROTOS
-char *get_kerberosv4_credentials( LDAP *ld, char *who, char *service,
+char *ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service,
int *len );
#else /* NEEDPROTOS */
-char *get_kerberosv4_credentials();
+char *ldap_get_kerberosv4_credentials();
#endif /* NEEDPROTOS */
#endif /* KERBEROS */
* in os-ip.c
*/
#ifdef NEEDPROTOS
-int connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
+int ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
int async );
-void close_connection( Sockbuf *sb );
+void ldap_close_connection( Sockbuf *sb );
#else /* NEEDPROTOS */
-int connect_to_host();
-void close_connection();
+int ldap_connect_to_host();
+void ldap_close_connection();
#endif /* NEEDPROTOS */
#ifdef KERBEROS
#ifdef NEEDPROTOS
-char *host_connected_to( Sockbuf *sb );
+char *ldap_host_connected_to( Sockbuf *sb );
#else /* NEEDPROTOS */
char *host_connected_to();
#endif /* NEEDPROTOS */
#ifdef LDAP_REFERRALS
#ifdef NEEDPROTOS
int do_ldap_select( LDAP *ld, struct timeval *timeout );
-void *new_select_info( void );
-void free_select_info( void *sip );
-void mark_select_write( LDAP *ld, Sockbuf *sb );
-void mark_select_read( LDAP *ld, Sockbuf *sb );
-void mark_select_clear( LDAP *ld, Sockbuf *sb );
-int is_read_ready( LDAP *ld, Sockbuf *sb );
-int is_write_ready( LDAP *ld, Sockbuf *sb );
+void *ldap_new_select_info( void );
+void ldap_free_select_info( void *sip );
+void ldap_mark_select_write( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
+int ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
+int ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
#else /* NEEDPROTOS */
int do_ldap_select();
-void *new_select_info();
-void free_select_info();
-void mark_select_write();
-void mark_select_read();
-void mark_select_clear();
-int is_read_ready();
-int is_write_ready();
+void *ldap_new_select_info();
+void ldap_free_select_info();
+void ldap_mark_select_write();
+void ldap_mark_select_read();
+void ldap_mark_select_clear();
+int ldap_is_read_ready();
+int ldap_is_write_ready();
#endif /* NEEDPROTOS */
#endif /* LDAP_REFERRALS */
* in request.c
*/
#ifdef NEEDPROTOS
-int send_initial_request( LDAP *ld, unsigned long msgtype,
+int ldap_send_initial_request( LDAP *ld, unsigned long msgtype,
char *dn, BerElement *ber );
-BerElement *alloc_ber_with_options( LDAP *ld );
-void set_ber_options( LDAP *ld, BerElement *ber );
+BerElement *ldap_alloc_ber_with_options( LDAP *ld );
+void ldap_set_ber_options( LDAP *ld, BerElement *ber );
#else /* NEEDPROTOS */
-int send_initial_request();
-BerElement *alloc_ber_with_options();
-void set_ber_options();
+int ldap_send_initial_request();
+BerElement *ldap_alloc_ber_with_options();
+void ldap_set_ber_options();
#endif /* NEEDPROTOS */
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
#ifdef NEEDPROTOS
-int send_server_request( LDAP *ld, BerElement *ber, int msgid,
+int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
int bind );
-LDAPConn *new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
+LDAPConn *ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
int connect, int bind );
-LDAPRequest *find_request_by_msgid( LDAP *ld, int msgid );
-void free_request( LDAP *ld, LDAPRequest *lr );
-void free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
-void dump_connection( LDAP *ld, LDAPConn *lconns, int all );
-void dump_requests_and_responses( LDAP *ld );
+LDAPRequest *ldap_find_request_by_msgid( LDAP *ld, int msgid );
+void ldap_free_request( LDAP *ld, LDAPRequest *lr );
+void ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
+void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
+void ldap_dump_requests_and_responses( LDAP *ld );
#else /* NEEDPROTOS */
-int send_server_request();
-LDAPConn *new_connection();
-LDAPRequest *find_request_by_msgid();
-void free_request();
-void free_connection();
-void dump_connection();
-void dump_requests_and_responses();
+int ldap_send_server_request();
+LDAPConn *ldap_new_connection();
+LDAPRequest *ldap_find_request_by_msgid();
+void ldap_free_request();
+void ldap_free_connection();
+void ldap_dump_connection();
+void ldap_dump_requests_and_responses();
#endif /* NEEDPROTOS */
#endif /* LDAP_REFERRALS || LDAP_DNS */
#ifdef LDAP_REFERRALS
#ifdef NEEDPROTOS
-int chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
-int append_referral( LDAP *ld, char **referralsp, char *s );
+int ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
+int ldap_append_referral( LDAP *ld, char **referralsp, char *s );
#else /* NEEDPROTOS */
-int chase_referrals();
-int append_referral();
+int ldap_chase_referrals();
+int ldap_append_referral();
#endif /* NEEDPROTOS */
#endif /* LDAP_REFERRALS */
*/
#ifdef NEEDPROTOS
int ldap_ld_free( LDAP *ld, int close );
-int send_unbind( LDAP *ld, Sockbuf *sb );
+int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
#else /* NEEDPROTOS */
int ldap_ld_free();
-int send_unbind();
+int ldap_send_unbind();
#endif /* NEEDPROTOS */
* in getdxbyname.c
*/
#ifdef NEEDPROTOS
-char **getdxbyname( char *domain );
+char **ldap_getdxbyname( char *domain );
#else /* NEEDPROTOS */
-char **getdxbyname();
+char **ldap_getdxbyname();
#endif /* NEEDPROTOS */
#endif /* LDAP_DNS */
Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
}
int
Debug( LDAP_DEBUG_TRACE, "ldap_modrdn\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
}
int
}
srv->lsrv_port = ld->ld_defport;
- if (( ld->ld_defconn = new_connection( ld, &srv, 1,1,0 )) == NULL ) {
+ if (( ld->ld_defconn = ldap_new_connection( ld, &srv, 1,1,0 )) == NULL ) {
if ( ld->ld_defhost != NULL ) free( srv->lsrv_host );
free( (char *)srv );
ldap_ld_free( ld, 0 );
}
#ifdef LDAP_REFERRALS
- if (( ld->ld_selectinfo = new_select_info()) == NULL ) {
+ if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
free( (char*)ld );
return( NULL );
}
if ( defhost != NULL &&
( ld->ld_defhost = strdup( defhost )) == NULL ) {
#ifdef LDAP_REFERRALS
- free_select_info( ld->ld_selectinfo );
+ ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */
free( (char*)ld );
return( NULL );
port = defport;
}
- if (( rc = connect_to_host( sb, curhost, 0L,
+ if (( rc = ldap_connect_to_host( sb, curhost, 0L,
port, async )) != -1 ) {
break;
}
}
} else {
- rc = connect_to_host( sb, NULL, htonl( INADDR_LOOPBACK ),
+ rc = ldap_connect_to_host( sb, NULL, htonl( INADDR_LOOPBACK ),
defport, async );
}
if ( krbinstancep != NULL ) {
#ifdef KERBEROS
- if (( *krbinstancep = host_connected_to( sb )) != NULL &&
+ if (( *krbinstancep = ldap_host_connected_to( sb )) != NULL &&
( p = strchr( *krbinstancep, '.' )) != NULL ) {
*p = '\0';
}
#endif /* DOS */
#endif /* MACOS */
+#include "ldap-int.h"
int
-connect_to_host( Sockbuf *sb, char *host, unsigned long address,
+ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
int port, int async )
/*
* if host == NULL, connect using address
#endif /* LDAP_REFERRALS */
#endif /* notyet */
- Debug( LDAP_DEBUG_TRACE, "connect_to_host: %s:%d\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n",
( host == NULL ) ? "(by address)" : host, ntohs( port ), 0 );
connected = use_hp = 0;
void
-close_connection( Sockbuf *sb )
+ldap_close_connection( Sockbuf *sb )
{
tcp_close( sb->sb_sd );
}
#ifdef KERBEROS
char *
-host_connected_to( Sockbuf *sb )
+ldap_host_connected_to( Sockbuf *sb )
{
struct hostent *hp;
char *p;
void
-mark_select_write( LDAP *ld, Sockbuf *sb )
+ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
void
-mark_select_read( LDAP *ld, Sockbuf *sb )
+ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
void
-mark_select_clear( LDAP *ld, Sockbuf *sb )
+ldap_mark_select_clear( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
int
-is_write_ready( LDAP *ld, Sockbuf *sb )
+ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
int
-is_read_ready( LDAP *ld, Sockbuf *sb )
+ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
void *
-new_select_info()
+ldap_new_select_info()
{
struct selectinfo *sip;
void
-free_select_info( void *sip )
+ldap_free_select_info( void *sip )
{
free( sip );
}
BerElement *
-alloc_ber_with_options( LDAP *ld )
+ldap_alloc_ber_with_options( LDAP *ld )
{
BerElement *ber;
ld->ld_errno = LDAP_NO_MEMORY;
#ifdef STR_TRANSLATION
} else {
- set_ber_options( ld, ber );
+ ldap_set_ber_options( ld, ber );
#endif /* STR_TRANSLATION */
}
void
-set_ber_options( LDAP *ld, BerElement *ber )
+ldap_set_ber_options( LDAP *ld, BerElement *ber )
{
ber->ber_options = ld->ld_lberoptions;
#ifdef STR_TRANSLATION
int
-send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
+ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
BerElement *ber )
{
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
LDAPServer *servers;
#endif /* LDAP_REFERRALS || LDAP_DNS */
- Debug( LDAP_DEBUG_TRACE, "send_initial_request\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
#if !defined( LDAP_REFERRALS ) && !defined( LDAP_DNS )
if ( ber_flush( &ld->ld_sb, ber, 1 ) != 0 ) {
}
#endif /* LDAP_DNS */
- return( send_server_request( ld, ber, ld->ld_msgid, NULL, servers,
+ return( ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, servers,
NULL, 0 ));
#endif /* !LDAP_REFERRALS && !LDAP_DNS */
}
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
int
-send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest
+ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest
*parentreq, LDAPServer *srvlist, LDAPConn *lc, int bind )
{
LDAPRequest *lr;
int incparent;
- Debug( LDAP_DEBUG_TRACE, "send_server_request\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_server_request\n", 0, 0, 0 );
incparent = 0;
ld->ld_errno = LDAP_SUCCESS; /* optimistic */
incparent = 1;
++parentreq->lr_outrefcnt;
}
- lc = new_connection( ld, &srvlist, 0, 1, bind );
+ lc = ldap_new_connection( ld, &srvlist, 0, 1, bind );
}
free_servers( srvlist );
}
if (( lr = (LDAPRequest *)calloc( 1, sizeof( LDAPRequest ))) ==
NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
- free_connection( ld, lc, 0, 0 );
+ ldap_free_connection( ld, lc, 0, 0 );
ber_free( ber, 1 );
if ( incparent ) {
/* Forget about the bind */
if ( errno == EWOULDBLOCK ) {
/* need to continue write later */
lr->lr_status = LDAP_REQST_WRITING;
- mark_select_write( ld, lc->lconn_sb );
+ ldap_mark_select_write( ld, lc->lconn_sb );
} else {
#else /* notyet */
ld->ld_errno = LDAP_SERVER_DOWN;
- free_request( ld, lr );
- free_connection( ld, lc, 0, 0 );
+ ldap_free_request( ld, lr );
+ ldap_free_connection( ld, lc, 0, 0 );
return( -1 );
#endif /* notyet */
#ifdef notyet
}
/* sent -- waiting for a response */
- mark_select_read( ld, lc->lconn_sb );
+ ldap_mark_select_read( ld, lc->lconn_sb );
}
ld->ld_errno = LDAP_SUCCESS;
LDAPConn *
-new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
+ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
int connect, int bind )
{
LDAPConn *lc;
}
if ( err != 0 ) {
- free_connection( ld, lc, 1, 0 );
+ ldap_free_connection( ld, lc, 1, 0 );
lc = NULL;
}
}
void
-free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
+ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
{
LDAPConn *tmplc, *prevlc;
- Debug( LDAP_DEBUG_TRACE, "free_connection\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection\n", 0, 0, 0 );
if ( force || --lc->lconn_refcnt <= 0 ) {
if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) {
- mark_select_clear( ld, lc->lconn_sb );
+ ldap_mark_select_clear( ld, lc->lconn_sb );
if ( unbind ) {
- send_unbind( ld, lc->lconn_sb );
+ ldap_send_unbind( ld, lc->lconn_sb );
}
- close_connection( lc->lconn_sb );
+ ldap_close_connection( lc->lconn_sb );
if ( lc->lconn_sb->sb_ber.ber_buf != NULL ) {
free( lc->lconn_sb->sb_ber.ber_buf );
}
free( (char *)lc->lconn_sb );
}
free( lc );
- Debug( LDAP_DEBUG_TRACE, "free_connection: actually freed\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",
0, 0, 0 );
} else {
lc->lconn_lastused = time( 0 );
- Debug( LDAP_DEBUG_TRACE, "free_connection: refcnt %d\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: refcnt %d\n",
lc->lconn_refcnt, 0, 0 );
}
}
#ifdef LDAP_DEBUG
void
-dump_connection( LDAP *ld, LDAPConn *lconns, int all )
+ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all )
{
LDAPConn *lc;
void
-dump_requests_and_responses( LDAP *ld )
+ldap_dump_requests_and_responses( LDAP *ld )
{
LDAPRequest *lr;
LDAPMessage *lm, *l;
void
-free_request( LDAP *ld, LDAPRequest *lr )
+ldap_free_request( LDAP *ld, LDAPRequest *lr )
{
LDAPRequest *tmplr, *nextlr;
- Debug( LDAP_DEBUG_TRACE, "free_request (origid %d, msgid %d)\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
lr->lr_origid, lr->lr_msgid, 0 );
if ( lr->lr_parent != NULL ) {
/* free all referrals (child requests) */
for ( tmplr = lr->lr_refnext; tmplr != NULL; tmplr = nextlr ) {
nextlr = tmplr->lr_refnext;
- free_request( ld, tmplr );
+ ldap_free_request( ld, tmplr );
}
}
* XXX merging of errors in this routine needs to be improved
*/
int
-chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
+ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
{
int rc, count, len, newdn;
#ifdef LDAP_DNS
LDAPServer *srv;
BerElement *ber;
- Debug( LDAP_DEBUG_TRACE, "chase_referrals\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_chase_referrals\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS; /* optimistic */
*hadrefp = 0;
} else {
Debug( LDAP_DEBUG_TRACE,
"ignoring unknown referral <%s>\n", ref, 0, 0 );
- rc = append_referral( ld, &unfollowed, ref );
+ rc = ldap_append_referral( ld, &unfollowed, ref );
*hadrefp = 1;
continue;
}
}
#endif /* LDAP_DNS */
- if ( srv != NULL && send_server_request( ld, ber, ld->ld_msgid,
+ if ( srv != NULL && ldap_send_server_request( ld, ber, ld->ld_msgid,
lr, srv, NULL, 1 ) >= 0 ) {
++count;
} else {
Debug( LDAP_DEBUG_ANY,
"Unable to chase referral (%s)\n",
ldap_err2string( ld->ld_errno ), 0, 0 );
- rc = append_referral( ld, &unfollowed, ref );
+ rc = ldap_append_referral( ld, &unfollowed, ref );
}
if ( !newdn && refdn != NULL ) {
int
-append_referral( LDAP *ld, char **referralsp, char *s )
+ldap_append_referral( LDAP *ld, char **referralsp, char *s )
{
int first;
return( NULL );
}
- if (( ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if (( ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULL );
}
LDAPRequest *
-find_request_by_msgid( LDAP *ld, int msgid )
+ldap_find_request_by_msgid( LDAP *ld, int msgid )
{
LDAPRequest *lr;
domain = dn;
}
- if (( dxs = getdxbyname( domain )) == NULL ) {
+ if (( dxs = ldap_getdxbyname( domain )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( NULL );
}
#else /* !LDAP_REFERRALS */
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
- dump_connection( ld, ld->ld_conns, 1 );
- dump_requests_and_responses( ld );
+ ldap_dump_connection( ld, ld->ld_conns, 1 );
+ ldap_dump_requests_and_responses( ld );
}
#endif /* LDAP_DEBUG */
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
nextlc = lc->lconn_next;
if ( lc->lconn_status ==
LDAP_CONNST_CONNECTED &&
- is_read_ready( ld,
+ ldap_is_read_ready( ld,
lc->lconn_sb )) {
rc = read1msg( ld, msgid, all,
lc->lconn_sb, lc, result );
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 );
ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ ldap_set_ber_options( ld, &ber );
/* get the next message */
if ( (tag = ber_get_next( sb, &len, &ber ))
}
#ifdef LDAP_REFERRALS
- if (( lr = find_request_by_msgid( ld, id )) == NULL ) {
+ if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
id, 0, 0 );
!= LBER_ERROR ) {
if ( lderr != LDAP_SUCCESS ) {
/* referrals are in error string */
- refer_cnt = chase_referrals( ld, lr,
+ refer_cnt = ldap_chase_referrals( ld, lr,
&lr->lr_res_error, &hadref );
}
}
}
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
if ( lc != NULL ) {
- free_connection( ld, lc, 0, 1 );
+ ldap_free_connection( ld, lc, 0, 1 );
}
}
}
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, new );
+ ldap_add_result_to_cache( ld, new );
}
#endif /* NO_CACHE */
long along;
ber_init( ber, 0 );
- set_ber_options( ld, ber );
+ ldap_set_ber_options( ld, ber );
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
(long)lr->lr_res_msgtype, lr->lr_res_errno,
lr->lr_res_matched ? lr->lr_res_matched : "",
if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) {
parentr->lr_res_errno = lr->lr_res_errno;
if ( lr->lr_res_error != NULL ) {
- (void)append_referral( ld, &parentr->lr_res_error,
+ (void)ldap_append_referral( ld, &parentr->lr_res_error,
lr->lr_res_error );
}
} else if ( lr->lr_res_errno != LDAP_SUCCESS &&
passwd = "";
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
#endif /* !NO_CACHE */
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
/*
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- if ( check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
+ if ( ldap_check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
ber_free( ber, 1 );
ld->ld_errno = LDAP_SUCCESS;
return( ld->ld_msgid );
}
- add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
+ ldap_add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
}
#endif /* NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
}
*/
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULLBER );
}
/* free LDAP structure and outstanding requests/responses */
for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
nextlr = lr->lr_next;
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
/* free and unbind from all open connections */
while ( ld->ld_conns != NULL ) {
- free_connection( ld, ld->ld_conns, 1, close );
+ ldap_free_connection( ld, ld->ld_conns, 1, close );
}
#else /* LDAP_REFERRALS */
if ( close ) {
- err = send_unbind( ld, &ld->ld_sb );
- close_connection( &ld->ld_sb );
+ err = ldap_send_unbind( ld, &ld->ld_sb );
+ ldap_close_connection( &ld->ld_sb );
}
#endif /* LDAP_REFERRALS */
} else {
#ifdef LDAP_REFERRALS
if ( ld->ld_selectinfo != NULL )
- free_select_info( ld->ld_selectinfo );
+ ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */
if ( ld->ld_defhost != NULL )
int
-send_unbind( LDAP *ld, Sockbuf *sb )
+ldap_send_unbind( LDAP *ld, Sockbuf *sb )
{
BerElement *ber;
- Debug( LDAP_DEBUG_TRACE, "send_unbind\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_unbind\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( ld->ld_errno );
}
ber_free( ber, 1 );
} else {
#ifdef LDAP_REFERRALS
- err = send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
+ err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
NULL, 1 );
#else /* LDAP_REFERRALS */
- err = send_initial_request( ld, LDAP_REQ_SEARCH,
+ err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH,
ludp->lud_dn, ber );
#endif /* LDAP_REFERRALS */
}
#include "ldap-int.h"
/*
- * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
+ * ldap_get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
*/
/* ARGSUSED */
char *
-get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
+ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
{
static short authman_refnum = 0;
char *cred, ticket[ MAX_KTXT_LEN ];
#include "ldap-int.h"
int
-connect_to_host( Sockbuf *sb, char *host, unsigned long address,
+ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
int port, int async )
/*
* if host == NULL, connect using address
struct hostInfo hi;
#endif /* SUPPORT_OPENTRANSPORT */
- Debug( LDAP_DEBUG_TRACE, "connect_to_host: %s:%d\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n",
( host == NULL ) ? "(by address)" : host, ntohs( port ), 0 );
if ( host != NULL && gethostinfobyname( host, &hi ) != noErr ) {
void
-close_connection( Sockbuf *sb )
+ldap_close_connection( Sockbuf *sb )
{
tcpclose( (tcpstream *)sb->sb_sd );
}
#ifdef KERBEROS
char *
-host_connected_to( Sockbuf *sb )
+ldap_host_connected_to( Sockbuf *sb )
{
ip_addr addr;
void
-mark_select_read( LDAP *ld, Sockbuf *sb )
+ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
struct tcpstreaminfo *tcpsip;
short i;
- Debug( LDAP_DEBUG_TRACE, "mark_select_read: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_mark_select_read: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 );
if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) {
return;
void
-mark_select_clear( LDAP *ld, Sockbuf *sb )
+ldap_mark_select_clear( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
short i;
- Debug( LDAP_DEBUG_TRACE, "mark_select_clear: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_mark_select_clear: stream %x\n", (tcpstream *)sb->sb_sd, 0, 0 );
sip = (struct selectinfo *)ld->ld_selectinfo;
if ( sip != NULL && sip->si_count > 0 && sip->si_streaminfo != NULL ) {
int
-is_read_ready( LDAP *ld, Sockbuf *sb )
+ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
short i;
if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) {
#ifdef LDAP_DEBUG
if ( sip->si_streaminfo[ i ].tcpsi_is_read_ready ) {
- Debug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x READY\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_is_read_ready: stream %x READY\n",
(tcpstream *)sb->sb_sd, 0, 0 );
} else {
- Debug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x Not Ready\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_is_read_ready: stream %x Not Ready\n",
(tcpstream *)sb->sb_sd, 0, 0 );
}
#endif /* LDAP_DEBUG */
}
}
- Debug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x: NOT FOUND\n", (tcpstream *)sb->sb_sd, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_is_read_ready: stream %x: NOT FOUND\n", (tcpstream *)sb->sb_sd, 0, 0 );
return( 0 );
}
void *
-new_select_info()
+ldap_new_select_info()
{
return( (void *)calloc( 1, sizeof( struct selectinfo )));
}
void
-free_select_info( void *sip )
+ldap_free_select_info( void *sip )
{
if ( sip != NULL ) {
free( sip );