Commit fcbca73f authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Merged LDAPworldCurrent (P1-10,13,15,16,19-22)

Cleaned up old rcs keyworld subs
parents df38bf83 271d678b
......@@ -197,6 +197,10 @@ LDAP_DEBUG=-DLDAP_DEBUG
# uncomment this line to enable support for LDAP referrals in libldap
LDAP_REFERRALS=-DLDAP_REFERRALS
# uncomment this line to enable support for CRYPT passwords in LDBM
# requires UNIX crypt(3)
LDAP_CRYPT=-DLDAP_CRYPT
# uncomment this line to use soundex for approximate matches in slapd.
# the default is to use the metaphone algorithm.
#PHONETIC=-DSOUNDEX
......@@ -21,7 +21,7 @@
# DEFS are included in CFLAGS
DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(KERBEROS) $(AFSKERBEROS) \
$(UOFM) $(UOFA) $(NO_USERINTERFACE) $(CLDAP) $(NO_CACHE) \
$(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \
$(LDAP_REFERRALS) $(LDAP_CRYPT) $(LDAP_DNS) $(STR_TRANSLATION) \
$(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET) \
$(SLAPD_BACKENDS) $(LDBMBACKEND) $(LDBMINCLUDE) $(PHONETIC)
......
......@@ -14,4 +14,6 @@
CC = cc
PLATFORMCFLAGS= -Dfreebsd
PLATFORMLIBS= -lcrypt
# uncomment this line if using for LDAP_CRYPT
PLATFORMLIBS= -lcrypt
: run this script through /bin/sh
#! /bin/sh
RP500=ETCDIR/rp500
......
......@@ -111,8 +111,8 @@ ldapsearch.o: ../../include/ldapconfig.h
ldapmodify.o: ldapmodify.c ../../include/lber.h ../../include/proto-ldap.h
ldapmodify.o: ../../include/ldapconfig.h
ldapdelete.o: ldapdelete.c ../../include/proto-lber.h
ldapdelete.o: ../../include/ldapconfig.h
ldapdelete.o: ../../include/proto-ldap.h
ldapmodrdn.o: ldapmodrdn.c ../../include/proto-lber.h
ldapmodrdn.o: ../../include/ldapconfig.h
ldapmodrdn.o: ../../include/proto-ldap.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
......@@ -722,3 +722,22 @@ SIG_FN chwinsz()
(void) signal(SIGWINCH, chwinsz);
}
#endif
#if defined(NO_CACHE)
void ldap_uncache_entry( LDAP *ld, char *dn )
{
}
int ldap_enable_cache( LDAP *ld, long timeout, long maxmem )
{
return 0;
}
void ldap_flush_cache( LDAP *ld )
{
}
#endif /* NO_CACHE */
......@@ -226,8 +226,6 @@ FILE *where;
fatal(s)
char *s;
{
void exit();
if (errno != 0)
perror(s);
#ifdef KERBEROS
......
......@@ -21,7 +21,7 @@
typedef struct avlnode {
caddr_t avl_data;
char avl_bf;
signed char avl_bf;
struct avlnode *avl_left;
struct avlnode *avl_right;
} Avlnode;
......
......@@ -295,7 +295,7 @@ typedef struct ldapmsg {
BerElement *lm_ber; /* the ber encoded message contents */
struct ldapmsg *lm_chain; /* for search - next msg in the resp */
struct ldapmsg *lm_next; /* next response */
unsigned long lm_time; /* used to maintain cache */
unsigned int lm_time; /* used to maintain cache */
} LDAPMessage;
#define NULLMSG ((LDAPMessage *) NULL)
......@@ -318,7 +318,7 @@ typedef struct ldap_server {
typedef struct ldap_conn {
Sockbuf *lconn_sb;
int lconn_refcnt;
unsigned long lconn_lastused; /* time */
unsigned int lconn_lastused; /* time */
int lconn_status;
#define LDAP_CONNST_NEEDSOCKET 1
#define LDAP_CONNST_CONNECTING 2
......@@ -569,6 +569,8 @@ extern char *strdup();
#else /* NEEDPROTOS */
#if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK)
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#endif
#if defined(WINSOCK)
......
......@@ -3,7 +3,40 @@
#ifndef _LTHREAD_H
#define _LTHREAD_H
#if defined( THREAD_SUNOS4_LWP )
#if defined ( THREAD_NEXT_CTHREADS )
#define _THREAD
#include <mach/cthreads.h>
typedef cthread_fn_t VFP;
typedef int pthread_attr_t;
typedef cthread_t pthread_t;
/* default attr states */
#define pthread_mutexattr_default NULL
#define pthread_condattr_default NULL
/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE 0
#define PTHREAD_CREATE_DETACHED 1
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS 0
#define PTHREAD_SCOPE_SYSTEM 1
/* mutex attributes and mutex type */
typedef int pthread_mutexattr_t;
typedef struct mutex pthread_mutex_t;
/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE 0
#define PTHREAD_SHARE_PROCESS 1
/* condition variable attributes and condition variable type */
typedef int pthread_condattr_t;
typedef struct condition pthread_cond_t;
#elif defined( THREAD_SUNOS4_LWP )
/***********************************
* *
* thread definitions for sunos4 *
......
......@@ -61,9 +61,9 @@
#endif
/*
* on many systems, we should use waitpid() instead of waitN()
* on most systems, we should use waitpid() instead of waitN()
*/
#if !defined( USE_WAITPID ) && ( defined( SYSV ) || defined( sunos4 ) || defined( ultrix ) || defined( aix ))
#if !defined( USE_WAITPID ) && !defined( nextstep )
#define USE_WAITPID
#endif
......
......@@ -157,6 +157,7 @@ ber_getnint( BerElement *ber, long *num, int len )
{
int diff, sign, i;
long netnum;
char *p;
/*
* The tag and length have already been stripped off. We should
......@@ -174,11 +175,12 @@ ber_getnint( BerElement *ber, long *num, int len )
if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )
return( -1 );
/* sign extend if necessary */
sign = ((0x80 << ((len - 1) * 8)) & netnum);
if ( sign && len < sizeof(long) ) {
for ( i = sizeof(long) - 1; i > len - 1; i-- ) {
netnum |= (0xffL << (i * 8));
/* sign extend if necessary */
p = (char *) &netnum;
sign = (0x80 & *(p+diff) );
if ( sign && len < sizeof(long) ) {
for ( i = 0; i < diff; i++ ) {
*(p+i) = 0xff;
}
}
*num = LBER_NTOHL( netnum );
......
......@@ -118,11 +118,11 @@ unbind.o: unbind.c ../../include/proto-lber.h ../../include/proto-ldap.h
friendly.o: friendly.c ../../include/lber.h ../../include/proto-ldap.h
cldap.o: cldap.c
free.o: free.c ../../include/ldap.h
disptmpl.o: disptmpl.c ../../include/proto-lber.h ../../include/proto-ldap.h
srchpref.o: srchpref.c ../../include/proto-lber.h ../../include/proto-ldap.h
dsparse.o: dsparse.c ../../include/proto-lber.h ../../include/proto-ldap.h
disptmpl.o: disptmpl.c ../../include/proto-lber.h ../../include/disptmpl.h
srchpref.o: srchpref.c ../../include/proto-lber.h ../../include/srchpref.h
dsparse.o: dsparse.c ../../include/proto-lber.h
tmplout.o: tmplout.c ../../include/proto-lber.h ../../include/proto-ldap.h
sort.o: sort.c ../../include/proto-lber.h
sort.o: sort.c ../../include/proto-lber.h ../../include/proto-ldap.h
getdn.o: getdn.c ../../include/lber.h ../../include/proto-ldap.h
getentry.o: getentry.c ../../include/lber.h ../../include/proto-ldap.h
getattr.o: getattr.c ../../include/lber.h ../../include/proto-ldap.h
......
......@@ -107,7 +107,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
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 {
......@@ -151,10 +151,10 @@ do_abandon( LDAP *ld, int origid, int msgid )
#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 */
......
......@@ -69,7 +69,7 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
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 );
}
......@@ -103,7 +103,7 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
}
/* 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
......
......@@ -214,12 +214,12 @@ uncache_entry_or_req( LDAP *ld,
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 ||
......@@ -229,7 +229,7 @@ add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
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;
}
......@@ -256,12 +256,12 @@ add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
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 ||
......@@ -369,14 +369,14 @@ add_result_to_cache( LDAP *ld, LDAPMessage *result )
* 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 )) {
......
......@@ -170,7 +170,7 @@ cldap_open( char *host, int port )
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 );
......@@ -316,7 +316,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
"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;
......@@ -432,7 +432,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
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*/
......@@ -506,7 +506,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
add_result_to_cache( ld, ldm );
ldap_add_result_to_cache( ld, ldm );
}
#endif /* NO_CACHE */
......
......@@ -52,7 +52,7 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
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 );
}
......@@ -65,17 +65,17 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
#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
......
......@@ -51,7 +51,7 @@ ldap_delete( LDAP *ld, char *dn )
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 );
}
......@@ -63,7 +63,7 @@ ldap_delete( LDAP *ld, char *dn )
}
/* send the message */
return ( send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
}
......
......@@ -36,7 +36,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **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 );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment