Remove CLDAP cruft

This commit is contained in:
Kurt Zeilenga 2000-08-18 04:25:00 +00:00
parent 5425a5e4c8
commit 25a9f7427d
29 changed files with 699 additions and 1939 deletions

View File

@ -23,9 +23,6 @@
#include "rcpt500.h"
int dosyslog = 0;
#ifdef LDAP_CONNECTIONLESS
int do_cldap = 0;
#endif /* LDAP_CONNECTIONLESS */
int derefaliases = 1;
int sizelimit = RCPT500_SIZELIMIT;
@ -67,7 +64,7 @@ main( int argc, char **argv )
}
errflg = 0;
while (( c = getopt( argc, argv, "alUh:b:s:z:f:t:p:c:" )) != EOF ) {
while (( c = getopt( argc, argv, "alh:b:s:z:f:t:p:c:" )) != EOF ) {
switch( c ) {
case 'a':
derefaliases = 0;
@ -75,14 +72,6 @@ main( int argc, char **argv )
case 'l':
dosyslog = 1;
break;
case 'U':
#ifdef LDAP_CONNECTIONLESS
do_cldap = 1;
#else /* LDAP_CONNECTIONLESS */
fprintf( stderr,
"Compile with -DLDAP_CONNECTIONLESS for -U support\n" );
#endif /* LDAP_CONNECTIONLESS */
break;
case 'b':
searchbase = optarg;
break;

View File

@ -71,11 +71,6 @@ query_cmd( struct msginfo *msgp, char *reply )
/*
* open connection to LDAP server and bind as dapuser
*/
#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
ldp = cldap_open( ldaphost, ldapport );
else
#endif /* LDAP_CONNECTIONLESS */
ldp = ldap_init( ldaphost, ldapport );
if ( ldp == NULL ) {
@ -85,9 +80,6 @@ query_cmd( struct msginfo *msgp, char *reply )
return( 0 );
}
#ifdef LDAP_CONNECTIONLESS
if ( !do_cldap )
#endif /* LDAP_CONNECTIONLESS */
if ( ldap_simple_bind_s( ldp, dapuser, NULL ) != LDAP_SUCCESS ) {
report_ldap_err( ldp, reply );
close_ldap( ldp );
@ -104,11 +96,7 @@ query_cmd( struct msginfo *msgp, char *reply )
matches = 0;
#ifdef RCPT500_UFN
#ifdef LDAP_CONNECTIONLESS
if ( !do_cldap && strchr( msgp->msg_arg, ',' ) != NULL ) {
#else /* LDAP_CONNECTIONLESS */
if ( strchr( msgp->msg_arg, ',' ) != NULL ) {
#endif /* LDAP_CONNECTIONLESS */
struct timeval tv;
ldap_ufn_setprefix( ldp, searchbase );
@ -127,12 +115,6 @@ query_cmd( struct msginfo *msgp, char *reply )
for ( lfi = ldap_getfirstfilter( lfdp, "rcpt500", msgp->msg_arg );
lfi != NULL; lfi = ldap_getnextfilter( lfdp )) {
#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
rc = cldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
lfi->lfi_filter, attrs, 0, &ldmsgp, dapuser );
else
#endif /* LDAP_CONNECTIONLESS */
rc = ldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
lfi->lfi_filter, attrs, 0, &ldmsgp );
@ -217,11 +199,6 @@ query_cmd( struct msginfo *msgp, char *reply )
static void
close_ldap( LDAP *ld )
{
#ifdef LDAP_CONNECTIONLESS
if ( do_cldap )
cldap_close( ld );
else
#endif /* LDAP_CONNECTIONLESS */
ldap_unbind( ld );
}

View File

@ -44,9 +44,6 @@ int query_cmd LDAP_P((struct msginfo *msgp, char *reply));
extern struct command rcpt_cmds[];
/* main.c */
extern int dosyslog;
#ifdef LDAP_CONNECTIONLESS
extern int do_cldap;
#endif
extern int derefaliases;
extern int sizelimit;
extern int rdncount;

1366
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,6 @@ OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)d
OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
OL_ARG_ENABLE(kbind,[ --enable-kbind enable V2 Kerberos IV bind], auto)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
OL_ARG_ENABLE(ipv6,[ --enable-ipv6 enable IPv6 support], auto)dnl
OL_ARG_ENABLE(local,[ --enable-local enable AF_LOCAL (AF_UNIX) socket support], auto)dnl
OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
@ -2144,9 +2143,6 @@ fi
if test "$ol_enable_referrals" != no ; then
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION)
fi
if test "$ol_enable_cldap" != no ; then
AC_DEFINE(LDAP_CONNECTIONLESS,1,[define to support CLDAP])
fi
if test "$ol_enable_local" != no; then
AC_DEFINE(LDAP_PF_LOCAL,1,[define to support PF_LOCAL])
fi

View File

@ -1,37 +0,0 @@
.TH CLDAP_CLOSE 3 "22 September 1998" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.SH NAME
cldap_close \- Dispose of Connectionless LDAP Pointer
.SH SYNOPSIS
.nf
.ft B
#include <ldap.h>
.LP
.ft B
void cldap_close( ld )
.ft
LDAP *ld;
.SH DESCRIPTION
.LP
The
.B cldap_close()
routine disposes of memory allocated by
.BR cldap_open (3).
It should be called when all CLDAP communication is complete.
.LP
.B cldap_close()
takes a single parameter \fIld\fP, the LDAP pointer
returned by a previous call to
.BR cldap_open (3).
.SH SEE ALSO
.BR ldap (3),
.BR cldap_open (3),
.BR cldap_search_s (3),
.BR cldap_setretryinfo (3)
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
.B OpenLDAP
is derived from University of Michigan LDAP 3.3 Release.

View File

@ -1,60 +0,0 @@
.TH CLDAP_OPEN 3 "22 September 1998" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.SH NAME
cldap_open \- Prepare for Connectionless LDAP Communication
.SH SYNOPSIS
.nf
.ft B
#include <ldap.h>
.LP
.ft B
LDAP *cldap_open(host, port)
.ft
char *host;
int port;
.SH DESCRIPTION
.LP
The
.B cldap_open()
routine is called to prepare for connectionless LDAP
communication (over
.BR udp (4p)).
It allocates an LDAP structure which
is passed to future search requests.
.LP
.B cldap_open()
takes
\fIhost\fP, the nane of the host on which the LDAP server is running, and
\fIport\fP, the port number to which to connect. If the default
IANA-assigned port of 389 is desired, LDAP_PORT should be specified for
\fIport\fP. \fIhost\fP can contain a space-separated list of hosts or
addresses to try.
.B cldap_open()
returns a pointer to an LDAP structure, which should be
passed to subsequent calls to
.BR cldap_search_s (3),
.BR cldap_setretryinfo (3),
and
.BR cldap_close (3).
Certain fields in the LDAP structure can be set to
indicate size limit, time limit, and how aliases are handled during
operations. See
.BR ldap_open (3)
and <ldap.h> for more details.
.SH ERRORS
If an error occurs,
.B cldap_open()
will return NULL and errno will be set appropriately.
.SH SEE ALSO
.BR ldap (3)
.BR cldap_search_s (3),
.BR cldap_setretryinfo (3),
.BR cldap_close (3),
.BR udp (4p)
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
.B OpenLDAP
is derived from University of Michigan LDAP 3.3 Release.

View File

@ -1,112 +0,0 @@
.TH CLDAP_SEARCH_S 3 "22 September 1998" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.SH NAME
cldap_search_s \- Connectionless LDAP Search
.SH SYNOPSIS
.nf
.ft B
#include <ldap.h>
.LP
.ft B
int cldap_search_s( ld, base, scope, filter, attrs, attrsonly,
res, logdn )
.ft
LDAP *ld;
char *base;
int scope;
char *filter;
char **attrs;
int attrsonly;
LDAPMessage **res;
char *logdn;
.SH DESCRIPTION
.LP
The
.B cldap_search_s()
routine performs an LDAP search using the
Connectionless LDAP (CLDAP) protocol.
.LP
.B cldap_search_s()
has parameters and behavior identical to that of
.BR ldap_search_s (3),
except for the addition of the \fIlogdn\fP
parameter. logdn should contain a distinguished name to be used only
for logging purposed by the LDAP server. It should be in the text
format described by RFC 1779 "A String Representation of Distinguished Names".
.SH RETRANSMISSION ALGORITHM
.B cldap_search_s()
operates using the CLDAP protocol over
.BR udp (4p).
Since UDP is a non-reliable protocol, a retry mechanism is used to increase
reliability. The
.BR cldap_setretryinfo (3)
routine can be used to set two
retry parameters: \fItries\fP, a count of the number of times to send
a search request and \fItimeout\fP, an initial timeout that determines
how long to wait for a response before re-trying. \fItimeout\fP is
specified seconds. These values are stored in the \fBld_cldaptries\fP and
\fBld_cldaptimeout\fP members of the \fIld\fP LDAP structure, and the
default values set in
.BR ldap_open (3)
are 4 and 3 respectively. The retransmission algorithm used is:
.LP
Step 1. Set the current timeout to \fBld_cldaptimeout\fP seconds, and
the current LDAP server address to the first LDAP server found during
the
.BR ldap_open (3)
call.
.LP
Step 2: Send the search request to the current LDAP server address.
.LP
Step 3: Set the wait timeout to the current timeout divided by the
number of server addresses found during
.BR ldap_open (3)
or to one
second, whichever is larger. Wait at most that long for a response; if
a response is received, STOP. Note that the wait timeout is always rounded
down to the next lowest second.
.LP
Step 5: Repeat steps 2 and 3 for each LDAP server address.
.LP
Step 6: Set the current timeout to twice its previous value and repeat
Steps 2 through 6 a maximum of \fItries\fP times.
.SH RETRANSMISSION EXAMPLE
Assume that the default values for \fItries\fP and \fItimeout\fP of
4 tries and 3 seconds are used. Further, assume that a space-separated
list of two hosts, each with one address, was passed to
.BR cldap_open (3).
The pattern of requests sent will be (stopping as soon as a response is
received):
.nf
Time Search Request Sent To:
+0 Host A try 1
+1 (0+3/2) Host B try 1
+2 (1+3/2) Host A try 2
+5 (2+6/2) Host B try 2
+8 (5+6/2) Host A try 3
+14 (8+12/2) Host B try 3
+20 (14+12/2) Host A try 4
+32 (20+24/2) Host B try 4
+44 (20+24/2) (give up - no response)
.ft
.SH ERRORS
.B cldap_search_s()
returns LDAP_SUCCESS if a search was successful and the
appropriate LDAP error code otherwise. See
.BR ldap_error (3)
for more information.
.SH SEE ALSO
.BR ldap (3),
.BR ldap_error (3),
.BR ldap_search_s (3),
.BR cldap_open (3),
.BR cldap_setretryinfo (3),
.BR cldap_close (3),
.BR udp (4p)
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
.B OpenLDAP
is derived from University of Michigan LDAP 3.3 Release.

View File

@ -1,49 +0,0 @@
.TH CLDAP_SETRETRYINFO 3 "22 September 1998" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.SH NAME
cldap_setretryinfo \- Set Connectionless LDAP Request Retransmission Parameters
.SH SYNOPSIS
.nf
.ft B
#include <ldap.h>
.LP
.ft B
void cldap_setretryinfo(ld, tries, timeout)
.ft
LDAP *ld;
int tries;
int timeout;
.SH DESCRIPTION
.LP
The
.B cldap_setretryinfo()
routine is used to set the CLDAP
request retransmission behavior for future
.BR cldap_search_s (3)
calls.
.LP
.B cldap_setretryinfo()
takes \fIld\fP, the LDAP pointer returned from a
previous call to
.BR cldap_open (3),
\fItries\fP, the maximum number of
times to send a request, and \fItimeout\fP, the initial time, in
seconds, to wait before re-sending a request. The default values (set by
.BR cldap_open (3))
are 4 tries and 3 seconds between tries. See
.BR cldap_search_s (3)
for a complete description of the retransmission
algorithm used.
.LP
.SH SEE ALSO
.BR ldap (3),
.BR cldap_open (3),
.BR cldap_search_s (3),
.BR cldap_close (3)
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
.B OpenLDAP
is derived from University of Michigan LDAP 3.3 Release.

View File

@ -111,22 +111,6 @@ the ldap search routines. The
routines are
used to map from short two letter country codes (or other strings)
to longer "friendlier" names.
.SH CONNECTIONLESS ACCESS
The
.BR cldap_search_s (3)
routine allows you to access the directory
via Connectionless LDAP (CLDAP), which is similar to LDAP but
operates over UDP, obviating the need to set up and tear down
a connection by calling
.BR ldap_open (3),
.BR ldap_bind (3),
and
.BR ldap_unbind (3).
.BR cldap_open (3)
should be called before using
.BR cldap_search_s (3).
All the same getfilter, parsing, and display that can be used
with regular LDAP routines can be used with the CLDAP routines.
.SH BER LIBRARY
Also included in the distribution is a set of lightweight Basic
Encoding Rules routines. These routines are used by the LDAP library
@ -463,18 +447,6 @@ sort a list of attribute values
.TP
.SM ldap_sort_strcasecmp(3)
case insensitive string comparison
.TP
.SM cldap_open(3)
open a connectionless LDAP (CLDAP) session
.TP
.SM cldap_search_s(3)
perform a search using connectionless LDAP
.TP
.SM cldap_setretryinfo(3)
set retry and timeout information using connectionless LDAP
.TP
.SM cldap_close(3)
terminate a connectionless LDAP session
.SH SEE ALSO
.BR slapd (8)
.SH ACKNOWLEDGEMENTS

View File

@ -1 +0,0 @@
cldap.3

View File

@ -53,8 +53,7 @@ unsigned long opts;
.SH DESCRIPTION
.LP
These routines are used to control the behavior of client caching of
.BR ldap_search (3),
.BR cldap_search_s (3),
.BR ldap_search (3)
and
.BR ldap_compare (3)
operations. By
@ -115,8 +114,7 @@ void and return nothing.
.SH SEE ALSO
.BR ldap (3),
.BR ldap_search (3),
.BR ldap_compare (3),
.BR cldap_search_s (3)
.BR ldap_compare (3)
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).

View File

@ -125,8 +125,6 @@ typedef struct lber_memory_fns {
#define LBER_SB_OPT_SET_FD 2
#define LBER_SB_OPT_HAS_IO 3
#define LBER_SB_OPT_SET_NONBLOCK 4
#define LBER_SB_OPT_UDP_GET_SRC 5
#define LBER_SB_OPT_UDP_SET_DST 6
#define LBER_SB_OPT_GET_SSL 7
#define LBER_SB_OPT_DATA_READY 8
#define LBER_SB_OPT_SET_READAHEAD 9
@ -499,7 +497,6 @@ ber_sockbuf_ctrl LDAP_P((
void *arg ));
LBER_F( Sockbuf_IO ) ber_sockbuf_io_tcp;
LBER_F( Sockbuf_IO ) ber_sockbuf_io_udp;
LBER_F( Sockbuf_IO ) ber_sockbuf_io_readahead;
LBER_F( Sockbuf_IO ) ber_sockbuf_io_fd;
LBER_F( Sockbuf_IO ) ber_sockbuf_io_debug;

View File

@ -1483,37 +1483,6 @@ ldap_free_friendlymap LDAP_P(( /* deprecated */
LDAPFriendlyMap **map ));
/*
* in cldap.c
* (deprecated)
*/
LDAP_F( LDAP * )
cldap_open LDAP_P(( /* deprecated */
LDAP_CONST char *host,
int port ));
LDAP_F( void )
cldap_close LDAP_P(( /* deprecated */
LDAP *ld ));
LDAP_F( int )
cldap_search_s LDAP_P(( /* deprecated */
LDAP *ld,
LDAP_CONST char *base,
int scope,
LDAP_CONST char *filter,
char **attrs,
int attrsonly,
LDAPMessage **res,
char *logdn ));
LDAP_F( void )
cldap_setretryinfo LDAP_P(( /* deprecated */
LDAP *ld,
int tries,
int timeout ));
/*
* in sort.c
*/

View File

@ -21,9 +21,9 @@
LDAP_BEGIN_DECL
#define LDAP_PROTO_TCP 1
#define LDAP_PROTO_UDP 2
#define LDAP_PROTO_IPC 3
#define LDAP_PROTO_TCP 1 /* ldap:// */
#define LDAP_PROTO_UDP 2 /* reserved */
#define LDAP_PROTO_IPC 3 /* ldapi:// */
LDAP_F ( int )
ldap_pvt_url_scheme2proto LDAP_P((

View File

@ -846,9 +846,6 @@
/* define this for LDAP process title support */
#undef LDAP_PROCTITLE
/* define to support CLDAP */
#undef LDAP_CONNECTIONLESS
/* define to support PF_LOCAL */
#undef LDAP_PF_LOCAL

View File

@ -542,142 +542,6 @@ Sockbuf_IO ber_sockbuf_io_tcp =
sb_stream_close /* sbi_close */
};
/*
* Support for UDP (CLDAP)
*/
struct dgram_data
{
struct sockaddr dst;
struct sockaddr src;
};
static int
sb_dgram_setup( Sockbuf_IO_Desc *sbiod, void *arg )
{
struct dgram_data *p;
assert( sbiod != NULL);
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
p = LBER_MALLOC( sizeof( *p ) );
if ( p == NULL )
return -1;
memset( p, '\0', sizeof( *p ) );
sbiod->sbiod_pvt = (void *)p;
if ( arg != NULL )
sbiod->sbiod_sb->sb_fd = *((int *)arg);
return 0;
}
static int
sb_dgram_release( Sockbuf_IO_Desc *sbiod )
{
assert( sbiod != NULL);
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
LBER_FREE( sbiod->sbiod_pvt );
sbiod->sbiod_pvt = NULL;
return 0;
}
static ber_slen_t
sb_dgram_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
{
#ifdef LDAP_CONNECTIONLESS
ber_slen_t rc;
socklen_t addrlen;
struct dgram_data *p;
assert( sbiod != NULL );
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
assert( buf != NULL );
p = (struct dgram_data *)sbiod->sbiod_pvt;
addrlen = sizeof( struct sockaddr );
rc = recvfrom( sbiod->sbiod_sb->sb_fd, buf, len, 0, &p->src,
&addrlen );
return rc;
# else /* LDAP_CONNECTIONLESS */
return -1;
# endif /* LDAP_CONNECTIONLESS */
}
static ber_slen_t
sb_dgram_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len )
{
#ifdef LDAP_CONNECTIONLESS
ber_slen_t rc;
struct dgram_data *p;
assert( sbiod != NULL );
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
assert( buf != NULL );
p = (struct dgram_data *)sbiod->sbiod_pvt;
rc = sendto( sbiod->sbiod_sb->sb_fd, buf, len, 0, &p->dst,
sizeof( struct sockaddr ) );
if ( rc <= 0 )
return -1;
/* fake error if write was not atomic */
if (rc < len) {
# ifdef EMSGSIZE
errno = EMSGSIZE;
# endif
return -1;
}
return rc;
#else
return -1;
#endif
}
static int
sb_dgram_close( Sockbuf_IO_Desc *sbiod )
{
assert( sbiod != NULL );
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
tcp_close( sbiod->sbiod_sb->sb_fd );
return 0;
}
static int
sb_dgram_ctrl( Sockbuf_IO_Desc *sbiod, int opt, void *arg )
{
struct dgram_data *p;
assert( sbiod != NULL );
assert( SOCKBUF_VALID( sbiod->sbiod_sb ) );
p = (struct dgram_data *)sbiod->sbiod_pvt;
if ( opt == LBER_SB_OPT_UDP_SET_DST ) {
AC_MEMCPY( &p->dst, arg, sizeof( struct sockaddr ) );
return 1;
}
else if ( opt == LBER_SB_OPT_UDP_GET_SRC ) {
*(( struct sockaddr **)arg) = &p->src;
return 1;
}
/* This is an end IO descriptor */
return 0;
}
Sockbuf_IO ber_sockbuf_io_udp =
{
sb_dgram_setup, /* sbi_setup */
sb_dgram_release, /* sbi_release */
sb_dgram_ctrl, /* sbi_ctrl */
sb_dgram_read, /* sbi_read */
sb_dgram_write, /* sbi_write */
sb_dgram_close /* sbi_close */
};
/*
* Support for readahead (UDP needs it)

View File

@ -12,7 +12,7 @@ PROGRAMS = apitest ltest ttest
SRCS = bind.c open.c result.c error.c compare.c search.c \
controls.c messages.c references.c extended.c cyrus.c \
modify.c add.c modrdn.c delete.c abandon.c ufn.c cache.c \
getfilter.c sasl.c sbind.c kbind.c unbind.c friendly.c cldap.c \
getfilter.c sasl.c sbind.c kbind.c unbind.c friendly.c \
free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c os-ip.c url.c sortctrl.c vlvctrl.c \
@ -22,7 +22,7 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
controls.lo messages.lo references.lo extended.lo cyrus.lo \
modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo \
getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo friendly.lo cldap.lo \
getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo friendly.lo \
free.lo disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo \
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \

View File

@ -137,18 +137,9 @@ do_abandon(
ld->ld_errno = LDAP_NO_MEMORY;
} else {
#ifdef LDAP_CONNECTIONLESS
if ( ld->ld_cldapnaddr > 0 ) {
err = ber_printf( ber, "{isti", /* '}' */
++ld->ld_msgid, ld->ld_cldapdn,
LDAP_REQ_ABANDON, msgid );
} else
#endif /* LDAP_CONNECTIONLESS */
{
err = ber_printf( ber, "{iti", /* '}' */
++ld->ld_msgid,
LDAP_REQ_ABANDON, msgid );
}
err = ber_printf( ber, "{iti", /* '}' */
++ld->ld_msgid,
LDAP_REQ_ABANDON, msgid );
if( err == -1 ) {
/* encoding error */

View File

@ -1,553 +0,0 @@
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
* Copyright (c) 1990, 1994 Regents of the University of Michigan.
* All rights reserved.
*
* cldap.c - synchronous, retrying interface to the cldap protocol
*/
#include "portable.h"
#ifdef LDAP_CONNECTIONLESS
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>
#include <ac/unistd.h>
#include "ldap-int.h"
#define DEF_CLDAP_TIMEOUT 3
#define DEF_CLDAP_TRIES 4
struct cldap_retinfo {
int cri_maxtries;
int cri_try;
int cri_useaddr;
long cri_timeout;
};
static int add_addr LDAP_P((
LDAP *ld, struct sockaddr *sap ));
static int cldap_result LDAP_P((
LDAP *ld, int msgid, LDAPMessage **res,
struct cldap_retinfo *crip, const char *base ));
static int cldap_parsemsg LDAP_P((
LDAP *ld, int msgid, BerElement *ber,
LDAPMessage **res, const char *base ));
/*
* cldap_open - initialize and connect to an ldap server. A magic cookie to
* be used for future communication is returned on success, NULL on failure.
*
* Example:
* LDAP *ld;
* ld = cldap_open( hostname, port );
*/
LDAP *
cldap_open( LDAP_CONST char *host, int port )
{
int s;
unsigned long address;
struct sockaddr_in sock;
struct hostent *hp;
LDAP *ld;
char *p;
int i;
/* buffers for ldap_pvt_gethostbyname_a ... */
struct hostent he_buf;
int local_h_errno;
char *ha_buf=NULL;
#define DO_RETURN(x) if (ha_buf) LDAP_FREE(ha_buf); return (x);
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
if ( (s = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 ) {
return( NULL );
}
sock.sin_addr.s_addr = 0;
sock.sin_family = AF_INET;
sock.sin_port = 0;
if ( bind(s, (struct sockaddr *) &sock, sizeof(sock)) < 0) {
tcp_close( s );
return( NULL );
}
if (( ld = ldap_init( host, port )) == NULL ) {
tcp_close( s );
return( NULL );
}
ld->ld_cldapnaddr = 0;
ld->ld_cldapaddrs = NULL;
if ( ber_sockbuf_add_io( ld->ld_sb, &ber_sockbuf_io_udp,
LBER_SBIOD_LEVEL_PROVIDER, (void *)&s ) < 0 ) {
ldap_ld_free(ld, 1, NULL, NULL );
tcp_close( s );
return NULL;
}
if ( ber_sockbuf_add_io( ld->ld_sb, &ber_sockbuf_io_readahead,
LBER_SBIOD_LEVEL_PROVIDER, NULL ) < 0 ) {
ldap_ld_free( ld, 1, NULL, NULL );
return NULL;
}
#ifdef LDAP_DEBUG
ber_sockbuf_add_io( ld->ld_sb, &ber_sockbuf_io_debug, INT_MAX, NULL );
#endif
ld->ld_version = LDAP_VERSION2;
sock.sin_family = AF_INET;
sock.sin_port = htons( port );
/*
* 'host' may be a space-separated list.
*/
if ( host != NULL ) {
char *host_dup = LDAP_STRDUP( host );
host = host_dup;
for ( ; host != NULL; host = p ) {
if (( p = strchr( host, ' ' )) != NULL ) {
for (*p++ = '\0'; *p == ' '; p++) {
;
}
}
address = inet_addr( host );
/* This was just a test for -1 until OSF1 let inet_addr return
unsigned int, which is narrower than 'unsigned long address' */
if ( address == 0xffffffff || address == (unsigned long) -1 ) {
if ((ldap_pvt_gethostbyname_a( host, &he_buf, &ha_buf,
&hp,&local_h_errno)<0) ||
(hp==NULL)) {
errno = EHOSTUNREACH;
continue;
}
for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) {
AC_MEMCPY( (char *)&sock.sin_addr,
(char *)hp->h_addr_list[ i ],
sizeof(sock.sin_addr));
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
ldap_ld_free( ld, 1, NULL, NULL );
LDAP_FREE( host_dup );
DO_RETURN( NULL );
}
}
} else {
sock.sin_addr.s_addr = address;
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
ldap_ld_free( ld, 1, NULL, NULL );
LDAP_FREE( host_dup );
DO_RETURN( NULL );
}
}
if ( ld->ld_host == NULL ) {
ld->ld_host = LDAP_STRDUP( host );
}
}
LDAP_FREE( host_dup );
} else {
sock.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
ldap_ld_free( ld, 1, NULL, NULL );
DO_RETURN( NULL );
}
}
if ( ld->ld_cldapaddrs == NULL
|| ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,NULL )) == NULL
) {
ldap_ld_free( ld, 0, NULL, NULL );
DO_RETURN( NULL );
}
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_UDP_SET_DST,
ld->ld_cldapaddrs[0] );
cldap_setretryinfo( ld, 0, 0 );
#ifdef LDAP_DEBUG
putchar( '\n' );
for ( i = 0; i < ld->ld_cldapnaddr; ++i ) {
Debug( LDAP_DEBUG_TRACE, "end of cldap_open address %d is %s\n",
i, inet_ntoa( ((struct sockaddr_in *)
ld->ld_cldapaddrs[ i ])->sin_addr ), 0 );
}
#endif
DO_RETURN( ld );
}
#undef DO_RETURN
void
cldap_close( LDAP *ld )
{
ldap_ld_free( ld, 0, NULL, NULL );
}
void
cldap_setretryinfo( LDAP *ld, int tries, int timeout )
{
ld->ld_cldaptries = ( tries <= 0 ) ? DEF_CLDAP_TRIES : tries;
ld->ld_cldaptimeout = ( timeout <= 0 ) ? DEF_CLDAP_TIMEOUT : timeout;
}
int
cldap_search_s( LDAP *ld,
LDAP_CONST char *base,
int scope,
LDAP_CONST char *filter,
char **attrs,
int attrsonly,
LDAPMessage **res,
char *logdn )
{
int ret, msgid;
struct cldap_retinfo cri;
*res = NULL;
(void) memset( &cri, '\0', sizeof( cri ));
if ( logdn != NULL ) {
ld->ld_cldapdn = logdn;
} else if ( ld->ld_cldapdn == NULL ) {
ld->ld_cldapdn = "";
}
do {
if ( cri.cri_try != 0 ) {
--ld->ld_msgid; /* use same id as before */
}
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_UDP_SET_DST,
(void *)ld->ld_cldapaddrs[cri.cri_useaddr] );
Debug( LDAP_DEBUG_TRACE, "cldap_search_s try %d (to %s)\n",
cri.cri_try, inet_ntoa( ((struct sockaddr_in *)
ld->ld_cldapaddrs[ cri.cri_useaddr ])->sin_addr), 0 );
if ( (msgid = ldap_search( ld, base, scope, filter, attrs,
attrsonly )) == -1 ) {
return( ld->ld_errno );
}
#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL && ld->ld_responses != NULL ) {
Debug( LDAP_DEBUG_TRACE, "cldap_search_s res from cache\n",
0, 0, 0 );
*res = ld->ld_responses;
ld->ld_responses = ld->ld_responses->lm_next;
return( ldap_result2error( ld, *res, 0 ));
}
#endif /* LDAP_NOCACHE */
ret = cldap_result( ld, msgid, res, &cri, base );
} while (ret == -1);
return( ret );
}
static int
add_addr( LDAP *ld, struct sockaddr *sap )
{
struct sockaddr *newsap, **addrs;
if (( newsap = (struct sockaddr *)LDAP_MALLOC( sizeof( struct sockaddr )))
== NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
addrs = (struct sockaddr **)LDAP_REALLOC( ld->ld_cldapaddrs,
( ld->ld_cldapnaddr + 1 ) * sizeof(struct sockaddr *));
if ( addrs == NULL ) {
LDAP_FREE( newsap );
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
AC_MEMCPY( (char *)newsap, (char *)sap, sizeof( struct sockaddr ));
addrs[ ld->ld_cldapnaddr++ ] = newsap;
ld->ld_cldapaddrs = (void **)addrs;
return( 0 );
}
static int
cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
struct cldap_retinfo *crip, const char *base )
{
BerElement ber;
char *logdn;
int ret, fromaddr, i;
ber_int_t id;
struct timeval tv;
fromaddr = -1;
if ( crip->cri_try == 0 ) {
crip->cri_maxtries = ld->ld_cldaptries * ld->ld_cldapnaddr;
crip->cri_timeout = ld->ld_cldaptimeout;
crip->cri_useaddr = 0;
Debug( LDAP_DEBUG_TRACE, "cldap_result tries %d timeout %d\n",
ld->ld_cldaptries, ld->ld_cldaptimeout, 0 );
}
if ((tv.tv_sec = crip->cri_timeout / ld->ld_cldapnaddr) < 1 ) {
tv.tv_sec = 1;
}
tv.tv_usec = 0;
Debug( LDAP_DEBUG_TRACE,
"cldap_result waiting up to %ld seconds for a response\n",
(long) tv.tv_sec, 0, 0 );
ber_init_w_nullc( &ber, 0 );
ldap_set_ber_options( ld, &ber );
if ( cldap_getmsg( ld, &tv, &ber ) == -1 ) {
ret = ld->ld_errno;
Debug( LDAP_DEBUG_TRACE, "cldap_getmsg returned -1 (%d)\n",
ret, 0, 0 );
} else if ( ld->ld_errno == LDAP_TIMEOUT ) {
Debug( LDAP_DEBUG_TRACE,
"cldap_result timed out\n", 0, 0, 0 );
/*
* It timed out; is it time to give up?
*/
if ( ++crip->cri_try >= crip->cri_maxtries ) {
ret = LDAP_TIMEOUT;
--crip->cri_try;
} else {
if ( ++crip->cri_useaddr >= ld->ld_cldapnaddr ) {
/*
* new round: reset address to first one and
* double the timeout
*/
crip->cri_useaddr = 0;
crip->cri_timeout <<= 1;
}
ret = -1;
}
} else {
/*
* Got a response. It should look like:
* { msgid, logdn, { searchresponse...}}
*/
logdn = NULL;
if ( ber_scanf( &ber, "ia", &id, &logdn ) == LBER_ERROR ) {
LDAP_FREE( ber.ber_buf ); /* gack! */
ret = LDAP_DECODING_ERROR;
Debug( LDAP_DEBUG_TRACE,
"cldap_result: ber_scanf returned LBER_ERROR (%d)\n",
ret, 0, 0 );
} else if ( id != msgid ) {
LDAP_FREE( ber.ber_buf ); /* gack! */
Debug( LDAP_DEBUG_TRACE,
"cldap_result: looking for msgid %d; got %d\n",
msgid, id, 0 );
ret = -1; /* ignore and keep looking */
} else {
struct sockaddr_in * src;
/*
* got a result: determine which server it came from
* decode into ldap message chain
*/
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_UDP_GET_SRC, (void *)&src );
for ( fromaddr = 0; fromaddr < ld->ld_cldapnaddr; ++fromaddr ) {
if ( memcmp( &((struct sockaddr_in *)
ld->ld_cldapaddrs[ fromaddr ])->sin_addr,
&(src->sin_addr),
sizeof( struct in_addr )) == 0 ) {
break;
}
}
ret = cldap_parsemsg( ld, msgid, &ber, res, base );
LDAP_FREE( ber.ber_buf ); /* gack! */
Debug( LDAP_DEBUG_TRACE,
"cldap_result got result (%d)\n", ret, 0, 0 );
}
if ( logdn != NULL ) {
LDAP_FREE( logdn );
}
}
/*
* If we are giving up (successfully or otherwise) then
* abandon any outstanding requests.
*/
if ( ret != -1 ) {
i = crip->cri_try;
if ( i >= ld->ld_cldapnaddr ) {
i = ld->ld_cldapnaddr - 1;
}
for ( ; i >= 0; --i ) {
if ( i == fromaddr ) {
continue;
}
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_UDP_SET_DST,
(void *)ld->ld_cldapaddrs[i] );
Debug( LDAP_DEBUG_TRACE, "cldap_result abandoning id %d (to %s)\n",
msgid, inet_ntoa( ((struct sockaddr_in *)
ld->ld_cldapaddrs[i])->sin_addr ), 0 );
(void) ldap_abandon( ld, msgid );
}
}
return( ld->ld_errno = ret );
}
static int
cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
LDAPMessage **res, const char *base )
{
ber_tag_t tag;
ber_len_t len;
int baselen, slen;
ber_tag_t rc;
char *dn, *p, *cookie;
LDAPMessage *chain, *prev, *ldm;
struct berval *bv;
rc = LDAP_DECODING_ERROR; /* pessimistic */
ldm = chain = prev = NULL;
baselen = ( base == NULL ) ? 0 : strlen( base );
bv = NULL;
for ( tag = ber_first_element( ber, &len, &cookie );
tag != LBER_DEFAULT && rc != LDAP_SUCCESS;
tag = ber_next_element( ber, &len, cookie )) {
if (( ldm = (LDAPMessage *)LDAP_CALLOC( 1, sizeof(LDAPMessage)))
== NULL || ( ldm->lm_ber = ldap_alloc_ber_with_options( ld ))
== NULL ) {
rc = LDAP_NO_MEMORY;
break; /* return w/error*/
}
ldm->lm_msgid = msgid;
ldm->lm_msgtype = tag;
if ( tag == LDAP_RES_SEARCH_RESULT ) {
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got search result\n",
0, 0, 0 );
if ( ber_get_stringal( ber, &bv ) == LBER_DEFAULT ) {
break; /* return w/error */
}
if ( ber_printf( ldm->lm_ber, "tO", tag, bv ) == -1 ) {
break; /* return w/error */
}
ber_bvfree( bv );
bv = NULL;
rc = LDAP_SUCCESS;
} else if ( tag == LDAP_RES_SEARCH_ENTRY ) {
if ( ber_scanf( ber, "{aO" /*}*/, &dn, &bv ) == LBER_ERROR ) {
break; /* return w/error */
}
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg entry %s\n", dn, 0, 0 );
if ( dn != NULL && *(dn + ( slen = strlen(dn)) - 1) == '*' &&
baselen > 0 ) {
/*
* substitute original searchbase for trailing '*'
*/
if (( p = (char *)LDAP_MALLOC( slen + baselen )) == NULL ) {
rc = LDAP_NO_MEMORY;
LDAP_FREE( dn );
break; /* return w/error */
}
strcpy( p, dn );
strcpy( p + slen - 1, base );
LDAP_FREE( dn );
dn = p;
}
if ( ber_printf( ldm->lm_ber, "t{so}", tag, dn, bv->bv_val,
bv->bv_len ) == -1 ) {
break; /* return w/error */
}
LDAP_FREE( dn );
ber_bvfree( bv );
bv = NULL;
#ifdef notyet
} else if ( tag == LDAP_RES_SEARCH_REFERENCE ) {
#endif
} else {
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %lu\n",
tag, 0, 0 );
rc = LDAP_DECODING_ERROR;
break; /* return w/error */
}
/* Reset message ber so we can read from it later. Gack! */
ldm->lm_ber->ber_end = ldm->lm_ber->ber_ptr;
ldm->lm_ber->ber_ptr = ldm->lm_ber->ber_buf;
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
fprintf( stderr, "cldap_parsemsg add message id %ld type %ld:\n",
(long) ldm->lm_msgid, (long) ldm->lm_msgtype );
ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 );
}
#endif /* LDAP_DEBUG */
#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
ldap_add_result_to_cache( ld, ldm );
}
#endif /* LDAP_NOCACHE */
if ( chain == NULL ) {
chain = ldm;
} else {
prev->lm_chain = ldm;
}
prev = ldm;
ldm = NULL;
}
/* dispose of any leftovers */
if ( ldm != NULL ) {
if ( ldm->lm_ber != NULL ) {
ber_free( ldm->lm_ber, 1 );
}
LDAP_FREE( ldm );
}
if ( bv != NULL ) {
ber_bvfree( bv );
}
/* return chain, calling result2error if we got anything at all */
*res = chain;
return(( *res == NULL ) ? rc : ldap_result2error( ld, *res, 0 ));
}
#endif /* LDAP_CONNECTIONLESS */

View File

@ -137,11 +137,6 @@ struct ldapoptions {
struct sasl_security_properties ldo_sasl_secprops;
#endif
#ifdef LDAP_CONNECTIONLESS
int ldo_cldaptries; /* connectionless search retry count */
int ldo_cldaptimeout;/* time between retries */
#endif
int ldo_refhoplimit; /* limit on referral nesting */
/* LDAPv3 server and client controls */
@ -243,12 +238,6 @@ typedef struct ldapreqinfo {
char *ri_url;
} LDAPreqinfo;
/*
* handy macro for checking if handle is connectionless
*/
#define LDAP_IS_CLDAP(ld) ((ld)->ld_cldapnaddr>0)
/*
* structure representing an ldap connection
*/
@ -270,8 +259,6 @@ struct ldap {
#define ld_defhost ld_options.ldo_defhost
#define ld_defport ld_options.ldo_defport
#define ld_cldaptries ld_options.ldo_cldaptries
#define ld_cldaptimeout ld_options.ldo_cldaptimeout
#define ld_refhoplimit ld_options.ldo_refhoplimit
#define ld_sctrls ld_options.ldo_sctrls
@ -300,11 +287,6 @@ struct ldap {
ber_int_t *ld_abandoned; /* array of abandoned requests */
LDAPCache *ld_cache; /* non-null if cache is initialized */
/* stuff used by connectionless searches. */
char *ld_cldapdn; /* DN used in connectionless search */
int ld_cldapnaddr; /* number of addresses */
void **ld_cldapaddrs;/* addresses to send request to */
/* do not mess with the rest though */
@ -462,9 +444,6 @@ LDAP_F (int) ldap_append_referral( LDAP *ld, char **referralsp, char *s );
/*
* in result.c:
*/
#ifdef LDAP_CONNECTIONLESS
LDAP_F (int) cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber );
#endif
LDAP_F (char *) ldap_int_msgtype2str( ber_tag_t tag );
/*

View File

@ -319,13 +319,6 @@ ldap_int_open_connection(
sasl_host = ldap_host_connected_to( conn->lconn_sb );
#endif
break;
case LDAP_PROTO_UDP:
rc = ldap_connect_to_host( ld, conn->lconn_sb, 1,
srv->lud_host, addr, port, async );
if ( rc == -1 ) return rc;
ber_sockbuf_add_io( conn->lconn_sb, &ber_sockbuf_io_udp,
LBER_SBIOD_LEVEL_PROVIDER, NULL );
break;
case LDAP_PROTO_IPC:
#ifdef LDAP_PF_LOCAL
/* only IPC mechanism supported is PF_LOCAL (PF_UNIX) */

View File

@ -300,8 +300,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
memset( &hints, '\0', sizeof(hints) );
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = proto == LDAP_PROTO_UDP
? SOCK_DGRAM : SOCK_STREAM;
hints.ai_socktype = SOCK_STREAM;
snprintf(serv, sizeof serv, "%d", ntohs(port));
if ( getaddrinfo(host, serv, &hints, &res) ) {
@ -312,8 +311,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
rc = -1;
do {
/* we assume AF_x and PF_x are equal for all x */
s = ldap_int_socket( ld, sai->ai_family,
proto == LDAP_PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM );
s = ldap_int_socket( ld, sai->ai_family, SOCK_STREAM );
if ( s == -1 ) {
continue;
}
@ -377,8 +375,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
rc = s = -1;
for ( i = 0; !use_hp || (hp->h_addr_list[i] != 0); ++i, rc = -1 ) {
s = ldap_int_socket( ld, PF_INET,
proto == LDAP_PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM );
s = ldap_int_socket( ld, PF_INET, SOCK_STREAM );
if ( s == -1 ) {
/* use_hp ? continue : break; */
break;

View File

@ -910,42 +910,3 @@ ldap_mark_abandoned( LDAP *ld, ber_int_t msgid )
return( 0 );
}
#ifdef LDAP_CONNECTIONLESS
int
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
{
int rc;
ber_tag_t tag;
ber_len_t len;
ber_socket_t sd;
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, &sd );
if ( sd != AC_SOCKET_INVALID ) {
/* restored from ldap_select1() in result.c version 1.24 */
fd_set readfds;
if ( ldap_int_tblsize == 0 )
ldap_int_ip_init();
FD_ZERO( &readfds );
FD_SET( sd, &readfds );
rc = select( ldap_int_tblsize, &readfds, 0, 0, timeout );
if ( rc == -1 || rc == 0 ) {
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
return( rc );
}
}
/* get the next message */
if ( (tag = ber_get_next( ld->ld_sb, &len, ber ))
!= LDAP_TAG_MESSAGE ) {
ld->ld_errno = (tag == LBER_DEFAULT ? LDAP_SERVER_DOWN :
LDAP_LOCAL_ERROR);
return( -1 );
}
return( 0 );
}
#endif /* LDAP_CONNECTIONLESS */

View File

@ -286,23 +286,11 @@ ldap_build_search_req(
}
}
#ifdef LDAP_CONNECTIONLESS
if ( ld->ld_cldapnaddr > 0 ) {
err = ber_printf( ber, "{ist{seeiib", ++ld->ld_msgid,
ld->ld_cldapdn, LDAP_REQ_SEARCH, base, scope, ld->ld_deref,
(sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
(timelimit < 0) ? ld->ld_timelimit : timelimit,
attrsonly );
} else {
#endif /* LDAP_CONNECTIONLESS */
err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid,
LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref,
(sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
(timelimit < 0) ? ld->ld_timelimit : timelimit,
attrsonly );
#ifdef LDAP_CONNECTIONLESS
}
#endif /* LDAP_CONNECTIONLESS */
err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid,
LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref,
(sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
(timelimit < 0) ? ld->ld_timelimit : timelimit,
attrsonly );
if ( err == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;

View File

@ -267,7 +267,7 @@ int
main( int argc, char **argv )
{
LDAP *ld = NULL;
int i, c, port, cldapflg, errflg, method, id, msgtype;
int i, c, port, errflg, method, id, msgtype;
char line[256], command1, command2, command3;
char passwd[64], dn[256], rdn[64], attr[64], value[256];
char filter[256], *host, **types;
@ -284,18 +284,10 @@ main( int argc, char **argv )
host = NULL;
port = LDAP_PORT;
dnsuffix = "";
cldapflg = errflg = 0;
errflg = 0;
while (( c = getopt( argc, argv, "uh:d:s:p:t:T:" )) != -1 ) {
while (( c = getopt( argc, argv, "h:d:s:p:t:T:" )) != -1 ) {
switch( c ) {
case 'u':
#ifdef LDAP_CONNECTIONLESS
cldapflg++;
#else /* LDAP_CONNECTIONLESS */
printf( "Compile with -DLDAP_CONNECTIONLESS for UDP support\n" );
#endif /* LDAP_CONNECTIONLESS */
break;
case 'd':
#ifdef LDAP_DEBUG
ldap_debug = atoi( optarg );
@ -346,20 +338,13 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
printf( "%s( %s, %d )\n",
cldapflg ? "cldap_open" : "ldap_init",
printf( "ldap_init( %s, %d )\n",
host == NULL ? "(null)" : host, port );
if ( cldapflg ) {
#ifdef LDAP_CONNECTIONLESS
ld = cldap_open( host, port );
#endif /* LDAP_CONNECTIONLESS */
} else {
ld = ldap_init( host, port );
}
ld = ldap_init( host, port );
if ( ld == NULL ) {
perror( cldapflg ? "cldap_open" : "ldap_init" );
perror( "ldap_init" );
exit( EXIT_FAILURE );
}
@ -541,14 +526,7 @@ main( int argc, char **argv )
break;
case 'q': /* quit */
#ifdef LDAP_CONNECTIONLESS
if ( cldapflg )
cldap_close( ld );
#endif /* LDAP_CONNECTIONLESS */
if ( !cldapflg ) {
ldap_unbind( ld );
}
ldap_unbind( ld );
exit( EXIT_SUCCESS );
break;
@ -607,28 +585,12 @@ main( int argc, char **argv )
"attrsonly (0=attrs&values, 1=attrs only)? " );
attrsonly = atoi( line );
if ( cldapflg ) {
#ifdef LDAP_CONNECTIONLESS
getline( line, sizeof(line), stdin,
"Requestor DN (for logging)? " );
if ( cldap_search_s( ld, dn, scope, filter, types,
attrsonly, &res, line ) != 0 ) {
ldap_perror( ld, "cldap_search_s" );
} else {
printf( "\nresult: msgid %d\n",
res->lm_msgid );
handle_result( ld, res );
res = NULL;
}
#endif /* LDAP_CONNECTIONLESS */
} else {
if (( id = ldap_search( ld, dn, scope, filter,
types, attrsonly )) == -1 ) {
ldap_perror( ld, "ldap_search" );
} else {
printf( "Search initiated with id %d\n", id );
}
}
free_list( types );
break;

View File

@ -475,15 +475,9 @@ do_entry2text_search(
ocattrs[0] = OCATTRNAME;
ocattrs[1] = NULL;
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE,
NULL, ocattrs, 0, &ldmp, NULL );
else
#endif /* LDAP_CONNECTIONLESS */
err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE,
NULL, ocattrs, 0, &timeout, &ldmp );
err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE,
NULL, ocattrs, 0, &timeout, &ldmp );
if ( err == LDAP_SUCCESS ) {
entry = ldap_first_entry( ld, ldmp );
}
@ -509,12 +503,6 @@ do_entry2text_search(
fetchattrs = ldap_tmplattrs( tmpl, NULL, 1, LDAP_SYN_OPT_DEFER );
}
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE, NULL,
fetchattrs, 0, &ldmp, NULL );
else
#endif /* LDAP_CONNECTIONLESS */
err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, NULL,
fetchattrs, 0, &timeout, &ldmp );
@ -1078,12 +1066,6 @@ searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, char *dn,
timeout.tv_sec = SEARCH_TIMEOUT_SECS;
timeout.tv_usec = 0;
#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
lderr = cldap_search_s( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
0, &ldmp, NULL );
else
#endif /* LDAP_CONNECTIONLESS */
lderr = ldap_search_st( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
0, &timeout, &ldmp );

View File

@ -66,7 +66,6 @@ ldap_ld_free(
int err = LDAP_SUCCESS;
LDAPRequest *lr, *nextlr;
if ( ld->ld_cldapnaddr == 0 ) {
/* free LDAP structure and outstanding requests/responses */
for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
nextlr = lr->lr_next;
@ -77,14 +76,6 @@ ldap_ld_free(
while ( ld->ld_conns != NULL ) {
ldap_free_connection( ld, ld->ld_conns, 1, close );
}
} else {
int i;
for ( i = 0; i < ld->ld_cldapnaddr; ++i ) {
LDAP_FREE( ld->ld_cldapaddrs[ i ] );
}
LDAP_FREE( ld->ld_cldapaddrs );
}
for ( lm = ld->ld_responses; lm != NULL; lm = next ) {
next = lm->lm_next;

View File

@ -13,7 +13,7 @@ XXDIR = $(srcdir)/../libldap
XXSRCS = apitest.c test.c tmpltest.c extended.c \
bind.c controls.c open.c result.c error.c compare.c search.c \
modify.c add.c modrdn.c delete.c abandon.c ufn.c cache.c cyrus.c \
getfilter.c sasl.c sbind.c kbind.c unbind.c friendly.c cldap.c \
getfilter.c sasl.c sbind.c kbind.c unbind.c friendly.c \
free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c os-ip.c url.c sortctrl.c vlvctrl.c \
@ -29,7 +29,7 @@ OBJS = threads.lo rdwr.lo tpool.lo \
extended.lo \
bind.lo controls.lo open.lo result.lo error.lo compare.lo search.lo \
modify.lo add.lo modrdn.lo delete.lo abandon.lo ufn.lo cache.lo cyrus.lo \
getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo friendly.lo cldap.lo \
getfilter.lo sasl.lo sbind.lo kbind.lo unbind.lo friendly.lo \
free.lo disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo \
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \