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

Sync with HEAD

parents b464bc20 dfc8e7f6
......@@ -154,9 +154,11 @@ LDAP_INCPATH= -I$(LDAP_INCDIR) -I$(INCLUDEDIR)
LDAP_LIBDIR= $(top_builddir)/libraries
LUTIL_LIBS = @LUTIL_LIBS@
LDBM_LIBS = @LDBM_LIBS@
LTHREAD_LIBS = @LTHREAD_LIBS@
BDB_LIBS = @BDB_LIBS@
LDBM_LIBS = $(BDB_LIBS)
LDAP_LIBLBER_LA = $(LDAP_LIBDIR)/liblber/liblber.la
LDAP_LIBLDAP_LA = $(LDAP_LIBDIR)/libldap/libldap.la
LDAP_LIBLDAP_R_LA = $(LDAP_LIBDIR)/libldap_r/libldap_r.la
......
......@@ -283,7 +283,6 @@ Backends="bdb \
dnssrv \
hdb \
ldap \
ldbm \
meta \
monitor \
null \
......@@ -306,18 +305,6 @@ OL_ARG_ENABLE(hdb,[ --enable-hdb enable Hierarchical DB backend],
yes, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(ldap,[ --enable-ldap enable ldap backend],
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend],
no, [no yes mod], ol_enable_backends)dnl
AC_ARG_WITH(ldbm_api,,[
AC_MSG_WARN([Please use --enable-ldbm-api instead of --with-ldbm-api])
enable_ldbm_api="$with_ldbm_api"])
OL_ARG_ENABLE(ldbm_api,[ --enable-ldbm-api use LDBM API],
auto, [auto berkeley bcompat mdbm gdbm])
AC_ARG_WITH(ldbm_type,,[
AC_MSG_WARN([Please use --enable-ldbm-type instead of --with-ldbm-type])
enable_ldbm_type="$with_ldbm_type"])
OL_ARG_ENABLE(ldbm_type,[ --enable-ldbm-type use LDBM type],
auto, [auto btree hash])
OL_ARG_ENABLE(meta,[ --enable-meta enable metadirectory backend],
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(monitor,[ --enable-monitor enable monitor backend],
......@@ -440,12 +427,6 @@ if test $ol_enable_slapd = no ; then
if test $ol_enable_aci != no ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-aci argument])
fi
if test $ol_enable_ldbm_api != auto ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm-api argument])
fi
if test $ol_enable_ldbm_type != auto ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm-type argument])
fi
if test $ol_enable_slurpd = yes ; then
AC_MSG_ERROR([slurpd requires slapd])
fi
......@@ -475,74 +456,30 @@ if test $ol_enable_slapd = no ; then
ol_enable_aci=no
ol_enable_wrappers=no
ol_enable_ldbm_api=no
ol_enable_ldbm_type=no
ol_enable_slurpd=no
ol_enable_rewrite=no
elif test $ol_enable_ldbm = no ; then
dnl SLAPD without LDBM
if test $ol_enable_ldbm_api != auto ; then
AC_MSG_WARN([LDBM disabled, ignoring --enable-ldbm-api argument])
fi
if test $ol_enable_ldbm_type != auto ; then
AC_MSG_WARN([LDBM disabled, ignoring --enable-ldbm-type argument])
fi
if test $ol_enable_modules != yes &&
test $ol_enable_bdb = no &&
test $ol_enable_dnssrv = no &&
test $ol_enable_hdb = no &&
test $ol_enable_ldap = no &&
test $ol_enable_meta = no &&
test $ol_enable_monitor = no &&
test $ol_enable_null = no &&
test $ol_enable_passwd = no &&
test $ol_enable_perl = no &&
test $ol_enable_relay = no &&
test $ol_enable_shell = no &&
test $ol_enable_sql = no ; then
if test $ol_enable_slapd = yes ; then
AC_MSG_ERROR([slapd requires a backend])
else
AC_MSG_WARN([skipping slapd, no backend specified])
ol_enable_slapd=no
fi
fi
ol_enable_ldbm_api=no
ol_enable_ldbm_type=no
if test $ol_enable_bdb/$ol_enable_hdb != no/no; then
ol_enable_ldbm_api=berkeley
fi
else
dnl SLAPD with LDBM
if test $ol_enable_ldbm_api = gdbm &&
test $ol_enable_ldbm_type = btree ; then
AC_MSG_ERROR([GDBM only supports LDBM type hash])
fi
if test $ol_enable_ldbm_api = mdbm &&
test $ol_enable_ldbm_type = btree ; then
AC_MSG_ERROR([MDBM only supports LDBM type hash])
fi
if test $ol_enable_ldbm_api = ndbm &&
test $ol_enable_ldbm_type = btree ; then
AC_MSG_ERROR([NDBM only supports LDBM type hash])
fi
if test $ol_enable_bdb/$ol_enable_hdb != no/no ; then
if test $ol_enable_ldbm_api = auto ; then
ol_enable_ldbm_api=berkeley
elif test $ol_enable_ldbm_api != berkeley ; then
AC_MSG_ERROR([LDBM API not compatible with BDB/HDB])
fi
elif test $ol_enable_modules != yes &&
test $ol_enable_bdb = no &&
test $ol_enable_dnssrv = no &&
test $ol_enable_hdb = no &&
test $ol_enable_ldap = no &&
test $ol_enable_meta = no &&
test $ol_enable_monitor = no &&
test $ol_enable_null = no &&
test $ol_enable_passwd = no &&
test $ol_enable_perl = no &&
test $ol_enable_relay = no &&
test $ol_enable_shell = no &&
test $ol_enable_sql = no ; then
dnl no slapd backend
if test $ol_enable_slapd = yes ; then
AC_MSG_ERROR([slapd requires a backend])
else
AC_MSG_WARN([skipping slapd, no backend specified])
ol_enable_slapd=no
fi
fi
......@@ -591,7 +528,7 @@ AC_MSG_RESULT(done)
dnl ----------------------------------------------------------------
dnl Initialize vars
LDAP_LIBS=
LDBM_LIBS=
BDB_LIBS=
LTHREAD_LIBS=
LUTIL_LIBS=
......@@ -610,7 +547,6 @@ BUILD_BDB=no
BUILD_DNSSRV=no
BUILD_HDB=no
BUILD_LDAP=no
BUILD_LDBM=no
BUILD_META=no
BUILD_MONITOR=no
BUILD_NULL=no
......@@ -2001,103 +1937,33 @@ else
fi
dnl ----------------------------------------------------------------
ol_link_ldbm=no
case $ol_enable_ldbm_api in auto | berkeley | bcompat)
if test $ol_enable_ldbm_api = bcompat; then \
OL_BERKELEY_COMPAT_DB
else
OL_BERKELEY_DB
fi
if test $ol_cv_berkeley_db != no ; then
AC_DEFINE(HAVE_BERKELEY_DB,1,
[define this if Berkeley DB is available])
ol_link_ldbm=berkeley
ol_enable_ldbm_api=berkeley
if test $ol_enable_ldbm_type = hash ; then
AC_DEFINE(LDBM_USE_DBHASH,1,
[define this to use DBHASH w/ LDBM backend])
else
AC_DEFINE(LDBM_USE_DBBTREE,1,
[define this to use DBBTREE w/ LDBM backend])
fi
dnl $ol_cv_lib_db should be yes or -ldb
dnl (it could be no, but that would be an error
if test $ol_cv_lib_db != yes ; then
LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
fi
fi
;;
esac
ol_link_bdb=no
if test $ol_enable_bdb/$ol_enable_hdb != no/no; then
if test $ol_link_ldbm != berkeley ; then
AC_MSG_ERROR(BDB/HDB: BerkeleyDB not available)
else
OL_BDB_COMPAT
OL_BERKELEY_DB
if test $ol_cv_bdb_compat != yes ; then
AC_MSG_ERROR([BDB/HDB: BerkeleyDB version incompatible])
fi
fi
fi
if test $ol_link_ldbm = no && test $ol_enable_ldbm_type = btree ; then
AC_MSG_WARN([Could not find LDBM with BTREE support])
ol_enable_ldbm_api=none
fi
if test $ol_enable_ldbm_api = auto || test $ol_enable_ldbm_api = mdbm ; then
OL_MDBM
if test $ol_cv_mdbm = yes ; then
ol_link_ldbm=mdbm
ol_enable_ldbm_api=mdbm
if test $ol_cv_lib_mdbm != yes ; then
LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_mdbm"
fi
if test $ol_cv_berkeley_db = no ; then
AC_MSG_ERROR(BDB/HDB: BerkeleyDB not available)
fi
fi
if test $ol_enable_ldbm_api = auto || test $ol_enable_ldbm_api = gdbm ; then
OL_GDBM
AC_DEFINE(HAVE_BERKELEY_DB,1,
[define this if Berkeley DB is available])
if test $ol_cv_gdbm = yes ; then
ol_link_ldbm=gdbm
ol_enable_ldbm_api=gdbm
if test $ol_cv_lib_gdbm != yes ; then
LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
fi
dnl $ol_cv_lib_db should be yes or -ldb
dnl (it could be no, but that would be an error
if test $ol_cv_lib_db != yes ; then
BDB_LIBS="$BDB_LIBS $ol_cv_lib_db"
fi
fi
if test $ol_enable_ldbm_api = ndbm ; then
OL_NDBM
if test $ol_cv_ndbm = yes ; then
ol_link_ldbm=ndbm
ol_enable_ldbm_api=ndbm
OL_BDB_COMPAT
if test $ol_cv_lib_ndbm != yes ; then
LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
fi
if test $ol_cv_bdb_compat != yes ; then
AC_MSG_ERROR([BDB/HDB: BerkeleyDB version incompatible])
fi
fi
if test $ol_link_ldbm = no && test $ol_enable_ldbm != no ; then
AC_MSG_ERROR([could not find suitable LDBM backend])
fi
SLAPD_LIBS="$SLAPD_LIBS \$(BDB_LIBS)"
if test $ol_enable_bdb = yes ||
test $ol_enable_hdb = yes ||
test $ol_enable_ldbm = yes ; then
SLAPD_LIBS="$SLAPD_LIBS \$(LDBM_LIBS)"
ol_link_bdb=yes
fi
dnl ----------------------------------------------------------------
......@@ -2743,19 +2609,6 @@ if test "$ol_enable_ldap" != no ; then
AC_DEFINE_UNQUOTED(SLAPD_LDAP,$MFLAG,[define to support LDAP backend])
fi
if test "$ol_link_ldbm" != no && test $ol_enable_ldbm != no; then
BUILD_SLAPD=yes
BUILD_LDBM=$ol_enable_ldbm
if test "$ol_enable_ldbm" = mod ; then
SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldbm"
MFLAG=SLAPD_MOD_DYNAMIC
else
SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldbm"
MFLAG=SLAPD_MOD_STATIC
fi
AC_DEFINE_UNQUOTED(SLAPD_LDBM,$MFLAG,[define to support LDBM backend])
fi
if test "$ol_enable_meta" != no ; then
BUILD_SLAPD=yes
BUILD_META=$ol_enable_meta
......@@ -3118,7 +2971,6 @@ dnl backends
AC_SUBST(BUILD_DNSSRV)
AC_SUBST(BUILD_HDB)
AC_SUBST(BUILD_LDAP)
AC_SUBST(BUILD_LDBM)
AC_SUBST(BUILD_META)
AC_SUBST(BUILD_MONITOR)
AC_SUBST(BUILD_NULL)
......@@ -3150,7 +3002,7 @@ AC_SUBST(BUILD_SLURPD)
AC_SUBST(LDAP_LIBS)
AC_SUBST(SLAPD_LIBS)
AC_SUBST(SLURPD_LIBS)
AC_SUBST(LDBM_LIBS)
AC_SUBST(BDB_LIBS)
AC_SUBST(LTHREAD_LIBS)
AC_SUBST(LUTIL_LIBS)
AC_SUBST(WRAP_LIBS)
......@@ -3218,7 +3070,6 @@ AC_CONFIG_FILES([Makefile:build/top.mk:Makefile.in:build/dir.mk]
[servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk]
[servers/slapd/back-hdb/Makefile:build/top.mk:servers/slapd/back-hdb/Makefile.in:build/mod.mk]
[servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk]
[servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/mod.mk]
[servers/slapd/back-ldif/Makefile:build/top.mk:servers/slapd/back-ldif/Makefile.in:build/mod.mk]
[servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk]
[servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk]
......
......@@ -6,14 +6,14 @@
# Preamble for all OpenLDAP SDF documents
#
!default VERSION 2.3
!default VERSION 2.4
#
# Paths are relative to the main subdirectories
#
!define DOC_AUTHOR "The OpenLDAP Project <{{URL:http://www.openldap.org/}}>"
!define DOC_NAME "OpenLDAP Software 2.3"
!define DOC_NAME "OpenLDAP Software 2.4"
!define DOC_TYPE "Guide"
!define DOC_LOGO "../images/LDAPlogo.gif"
......
......@@ -104,6 +104,14 @@ returned in the parameter. The caller should free the returned
string using
.BR ber_memfree ().
.TP
.B A
Octet string. A variant of "\fBa\fP". A char ** should be supplied.
Memory is allocated, filled with the contents of the octet string,
null-terminated, and returned in the parameter, unless a zero-length
string would result; in that case, the arg is set to NULL.
The caller should free the returned string using
.BR ber_memfree ().
.TP
.B s
Octet string. A char * buffer should be supplied, followed by a pointer to a
ber_len_t initialized to the size of the buffer. Upon return, the
......
......@@ -3,7 +3,7 @@
.\" Copyright 1998-2006 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.SH NAME
ber_alloc_t, ber_flush, ber_printf, ber_put_int, ber_put_enum, ber_put_ostring, ber_put_string, ber_put_null, ber_put_boolean, ber_put_bitstring, ber_start_seq, ber_start_set, ber_put_seq, ber_put_set \- LBER simplified Basic Encoding Rules library routines for encoding
ber_alloc_t, ber_flush, ber_flush2, ber_printf, ber_put_int, ber_put_enum, ber_put_ostring, ber_put_string, ber_put_null, ber_put_boolean, ber_put_bitstring, ber_start_seq, ber_start_set, ber_put_seq, ber_put_set \- LBER simplified Basic Encoding Rules library routines for encoding
.SH LIBRARY
OpenLDAP LBER (liblber, -llber)
.SH SYNOPSIS
......@@ -13,6 +13,8 @@ OpenLDAP LBER (liblber, -llber)
.LP
.BI "int ber_flush(Sockbuf *" sb ", BerElement *" ber ", int " freeit ");"
.LP
.BI "int ber_flush2(Sockbuf *" sb ", BerElement *" ber ", int " freeit ");"
.LP
.BI "int ber_printf(BerElement *" ber ", const char *" fmt ", ...);"
.LP
.BI "int ber_put_int(BerElement *" ber ", ber_int_t " num ", ber_tag_t " tag ");"
......@@ -56,7 +58,7 @@ are
to allocate a BER element for encoding,
.BR ber_printf ()
to do the actual encoding, and
.BR ber_flush ()
.BR ber_flush2 ()
to actually write the element. The other routines are provided for those
applications that need more control than
.BR ber_printf ()
......@@ -70,7 +72,7 @@ routine is used to allocate a new BER element. It
should be called with an argument of LBER_USE_DER.
.LP
The
.BR ber_flush ()
.BR ber_flush2 ()
routine is used to actually write the element to a socket
(or file) descriptor, once it has been fully encoded (using
.BR ber_printf ()
......@@ -78,7 +80,21 @@ and friends). See
.BR lber-sockbuf (3)
for more details on the Sockbuf implementation of the \fIsb\fP parameter.
If the \fIfreeit\fP parameter is non-zero, the supplied \fIber\fP will
be freed after its contents have been flushed.
be freed.
If \fILBER_FLUSH_FREE_ON_SUCCESS\fP is used, the \fIber\fP is only freed
when successfully flushed, otherwise it is left intact;
if \fILBER_FLUSH_FREE_ON_ERROR\fP is used, the \fIber\fP is only freed
when an error occurs, otherwise it is left intact;
if \fILBER_FLUSH_FREE_ALWAYS\fP is used, the \fIber\fP is freed anyway.
This function differs from the original
.BR ber_flush (3)
function, whose behavior corresponds to that indicated
for \fILBER_FLUSH_FREE_ON_SUCCESS\fP.
Note that in the future, the behavior of
.BR ber_flush (3)
with \fIfreeit\fP non-zero might change into that of
.BR ber_flush2 (3)
with \fIfreeit\fP set to \fILBER_FLUSH_FREE_ALWAYS\fP.
.LP
The
.BR ber_printf ()
......
......@@ -73,7 +73,7 @@ The base must be specified as a Distinguished Name in LDAP format.
.B BINDDN <dn>
Specifies the default bind DN to use when performing ldap operations.
The bind DN must be specified as a Distinguished Name in LDAP format.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B HOST <name[:port] ...>
Specifies the name(s) of an LDAP server(s) to which the
......@@ -137,19 +137,19 @@ there are more options you can specify.
.TP
.B SASL_MECH <mechanism>
Specifies the SASL mechanism to use.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B SASL_REALM <realm>
Specifies the SASL realm.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B SASL_AUTHCID <authcid>
Specifies the authentication identity.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B SASL_AUTHZID <authcid>
Specifies the proxy authorization identity.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B SASL_SECPROPS <properties>
Specifies Cyrus SASL security properties. The
......@@ -221,15 +221,15 @@ is always used before
.TP
.B TLS_CERT <filename>
Specifies the file that contains the client certificate.
This is a user\-only option.
.B This is a user\-only option.
.TP
.B TLS_KEY <filename>
Specifies the file that contains the private key that matches the certificate
stored in the
.B TLS_CERT
file. Currently, the private key must not be protected with a password, so
it is of critical importance that the key file is protected carefully. This
is a user\-only option.
it is of critical importance that the key file is protected carefully.
.B This is a user\-only option.
.TP
.B TLS_CIPHER_SUITE <cipher-suite-spec>
Specifies acceptable cipher suite and preference order.
......
......@@ -423,10 +423,20 @@ LBER_F( void )
ber_free_buf LDAP_P(( BerElement *ber ));
LBER_F( int )
ber_flush LDAP_P((
ber_flush2 LDAP_P((
Sockbuf *sb,
BerElement *ber,
int freeit ));
#define LBER_FLUSH_FREE_NEVER (0x0) /* traditional behavior */
#define LBER_FLUSH_FREE_ON_SUCCESS (0x1) /* traditional behavior */
#define LBER_FLUSH_FREE_ON_ERROR (0x2)
#define LBER_FLUSH_FREE_ALWAYS (LBER_FLUSH_FREE_ON_SUCCESS|LBER_FLUSH_FREE_ON_ERROR)
LBER_F( int )
ber_flush LDAP_P((
Sockbuf *sb,
BerElement *ber,
int freeit )); /* DEPRECATED */
LBER_F( BerElement * )
ber_alloc LDAP_P(( void )); /* DEPRECATED */
......
......@@ -129,9 +129,6 @@
/* define if you have Cyrus SASL */
#undef HAVE_CYRUS_SASL
/* Define to 1 if you have the <db_185.h> header file. */
#undef HAVE_DB_185_H
/* Define to 1 if you have the <db.h> header file. */
#undef HAVE_DB_H
......@@ -190,12 +187,6 @@
/* Define to 1 if you have the `gai_strerror' function. */
#undef HAVE_GAI_STRERROR
/* define if GNU DBM is available */
#undef HAVE_GDBM
/* Define to 1 if you have the <gdbm.h> header file. */
#undef HAVE_GDBM_H
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO
......@@ -379,12 +370,6 @@
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* define if MDBM is available */
#undef HAVE_MDBM
/* Define to 1 if you have the <mdbm.h> header file. */
#undef HAVE_MDBM_H
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
......@@ -406,12 +391,6 @@
/* define this if you have mkversion */
#undef HAVE_MKVERSION
/* define if NDBM is available */
#undef HAVE_NDBM
/* Define to 1 if you have the <ndbm.h> header file. */
#undef HAVE_NDBM_H
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
......@@ -867,12 +846,6 @@
/* Patch */
#undef LDAP_VENDOR_VERSION_PATCH
/* define this to use DBBTREE w/ LDBM backend */
#undef LDBM_USE_DBBTREE
/* define this to use DBHASH w/ LDBM backend */
#undef LDBM_USE_DBHASH
/* define if memcmp is not 8-bit clean or is otherwise broken */
#undef NEED_MEMCMP_REPLACEMENT
......@@ -954,9 +927,6 @@
/* define to support LDAP backend */
#undef SLAPD_LDAP
/* define to support LDBM backend */
#undef SLAPD_LDBM
/* define to support LAN Manager passwords */
#undef SLAPD_LMHASH
......
......@@ -171,8 +171,8 @@ main( int argc, char **argv )
return( EXIT_FAILURE );
}
if ( ber_flush( sb, ber, 1 ) == -1 ) {
perror( "ber_flush" );
if ( ber_flush2( sb, ber, LBER_FLUSH_FREE_ALWAYS ) == -1 ) {
perror( "ber_flush2" );
return( EXIT_FAILURE );
}
......
......@@ -200,9 +200,17 @@ ber_free( BerElement *ber, int freebuf )
int
ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
{
return ber_flush2( sb, ber,
freeit ? LBER_FLUSH_FREE_ON_SUCCESS
: LBER_FLUSH_FREE_NEVER );
}
int
ber_flush2( Sockbuf *sb, BerElement *ber, int freeit )
{
ber_len_t towrite;
ber_slen_t rc;
ber_slen_t rc;
assert( sb != NULL );
assert( ber != NULL );
......@@ -217,7 +225,7 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
if ( sb->sb_debug ) {
ber_log_printf( LDAP_DEBUG_TRACE, sb->sb_debug,
"ber_flush: %ld bytes to sd %ld%s\n",
"ber_flush2: %ld bytes to sd %ld%s\n",
towrite, (long) sb->sb_fd,
ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" );
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
......@@ -231,16 +239,18 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
#else
rc = ber_int_sb_write( sb, ber->ber_rwptr, towrite );
#endif
if (rc<=0) {
if ( rc <= 0 ) {
if ( freeit & LBER_FLUSH_FREE_ON_ERROR ) ber_free( ber, 1 );
return -1;
}
towrite -= rc;
ber->ber_rwptr += rc;
}
if ( freeit ) ber_free( ber, 1 );
done:;
if ( freeit & LBER_FLUSH_FREE_ON_SUCCESS ) ber_free( ber, 1 );
return( 0 );
return 0;
}
BerElement *
......
......@@ -244,7 +244,7 @@ do_abandon(
sb = ld->ld_sb;
}
if ( ber_flush( sb, ber, 1 ) != 0 ) {
if ( ber_flush2( sb, ber, LBER_FLUSH_FREE_ALWAYS ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN;
err = -1;
} else {
......
......@@ -142,7 +142,7 @@ ldap_int_flush_request(
{
LDAPConn *lc = lr->lr_conn;
if ( ber_flush( lc->lconn_sb, lr->lr_ber, 0 ) != 0 ) {
if ( ber_flush2( lc->lconn_sb, lr->lr_ber, LBER_FLUSH_FREE_NEVER ) != 0 ) {
if ( errno == EAGAIN ) {
/* need to continue write later */
lr->lr_status = LDAP_REQST_WRITING;
......@@ -179,7 +179,7 @@ ldap_send_server_request(
LDAPreqinfo *bind )
{
LDAPRequest *lr;
int incparent, rc;
int incparent, rc;
Debug( LDAP_DEBUG_TRACE, "ldap_send_server_request\n", 0, 0, 0 );
......@@ -545,25 +545,12 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
force, unbind, 0 );