#! /bin/sh
# $OpenLDAP$
-# from OpenLDAP: pkg/ldap/configure.in,v 1.560.2.9 2005/06/10 15:11:24 kurt Exp
+# from OpenLDAP: pkg/ldap/configure.in,v 1.560.2.11 2005/08/09 16:41:26 kurt Exp
# This work is part of OpenLDAP Software <http://www.openldap.org/>.
#
ac_help="$ac_help
--enable-modules enable dynamic module support [no]"
ac_help="$ac_help
- --enable-rewrite enable DN rewriting in back-ldap and the rwm overlay [auto]"
+ --enable-rewrite enable DN rewriting in back-ldap and rwm overlay [auto]"
ac_help="$ac_help
--enable-rlookups enable reverse lookups of client hostnames [no]"
ac_help="$ac_help
SLAPD Backend Options:"
ac_help="$ac_help
- --enable-backends enable all available backends no|yes|mod [no]"
+ --enable-backends enable all available backends no|yes|mod"
ac_help="$ac_help
- --enable-bdb enable Berkeley DB backend no|yes|mod [yes]"
+ --enable-bdb enable Berkeley DB backend no|yes|mod [${ol_dflt_backends-yes}]"
ac_help="$ac_help
- --enable-dnssrv enable dnssrv backend no|yes|mod [no]"
+ --enable-dnssrv enable dnssrv backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-hdb enable Hierarchical DB backend no|yes|mod [yes]"
+ --enable-hdb enable Hierarchical DB backend no|yes|mod [${ol_dflt_backends-yes}]"
ac_help="$ac_help
- --enable-ldap enable ldap backend no|yes|mod [no]"
+ --enable-ldap enable ldap backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-ldbm enable ldbm backend no|yes|mod [no]"
+ --enable-ldbm enable ldbm backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
--with-ldbm-api with LDBM API auto|berkeley|bcompat|mdbm|gdbm [auto]"
ac_help="$ac_help
--with-ldbm-type use LDBM type auto|btree|hash [auto]"
ac_help="$ac_help
- --enable-meta enable metadirectory backend no|yes|mod [no]"
+ --enable-meta enable metadirectory backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-monitor enable monitor backend no|yes|mod [yes]"
+ --enable-monitor enable monitor backend no|yes|mod [${ol_dflt_backends-yes}]"
ac_help="$ac_help
- --enable-null enable null backend no|yes|mod [no]"
+ --enable-null enable null backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-passwd enable passwd backend no|yes|mod [no]"
+ --enable-passwd enable passwd backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-perl enable perl backend no|yes|mod [no]"
+ --enable-perl enable perl backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-relay enable relay backend no|yes|mod [yes]"
+ --enable-relay enable relay backend no|yes|mod [${ol_dflt_backends-yes}]"
ac_help="$ac_help
- --enable-shell enable shell backend no|yes|mod [no]"
+ --enable-shell enable shell backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
- --enable-sql enable sql backend no|yes|mod [no]"
+ --enable-sql enable sql backend no|yes|mod [${ol_dflt_backends-no}]"
ac_help="$ac_help
SLAPD Overlay Options:"
ac_help="$ac_help
- --enable-overlays enable all available overlays no|yes|mod [no]"
+ --enable-overlays enable all available overlays no|yes|mod"
ac_help="$ac_help
- --enable-accesslog In-Directory Access Logging overlay no|yes|mod [no]"
+ --enable-accesslog In-Directory Access Logging overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-denyop Deny Operation overlay no|yes|mod [no]"
+ --enable-denyop Deny Operation overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-dyngroup Dynamic Group overlay no|yes|mod [no]"
+ --enable-dyngroup Dynamic Group overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-dynlist Dynamic List overlay no|yes|mod [no]"
+ --enable-dynlist Dynamic List overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-glue Backend Glue overlay no|yes|mod [yes]"
+ --enable-glue Backend Glue overlay no|yes|mod [${ol_dflt_overlays-yes}]"
ac_help="$ac_help
- --enable-lastmod Last Modification overlay no|yes|mod [no]"
+ --enable-lastmod Last Modification overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-ppolicy Password Policy overlay no|yes|mod [no]"
+ --enable-ppolicy Password Policy overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-proxycache Proxy Cache overlay no|yes|mod [no]"
+ --enable-proxycache Proxy Cache overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-refint Referential Integrity overlay no|yes|mod [no]"
+ --enable-refint Referential Integrity overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-rwm Rewrite/Remap overlay no|yes|mod [no]"
+ --enable-retcode Return Code testing overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-syncprov Syncrepl Provider overlay no|yes|mod [yes]"
+ --enable-rwm Rewrite/Remap overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
- --enable-translucent Translucent Proxy overlay no|yes|mod [no]"
+ --enable-syncprov Syncrepl Provider overlay no|yes|mod [${ol_dflt_overlays-yes}]"
ac_help="$ac_help
- --enable-unique Attribute Uniqueness overlay no|yes|mod [no]"
+ --enable-translucent Translucent Proxy overlay no|yes|mod [${ol_dflt_overlays-no}]"
+ac_help="$ac_help
+ --enable-unique Attribute Uniqueness overlay no|yes|mod [${ol_dflt_overlays-no}]"
ac_help="$ac_help
SLURPD (Replication Daemon) Options:"
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:897: checking host system type" >&5
+echo "configure:899: checking host system type" >&5
if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then
# Make sure we can run config.sub.
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:938: checking target system type" >&5
+echo "configure:940: checking target system type" >&5
if test "x$ac_cv_target" = "x" || (test "x$target" != "xNONE" && test "x$target" != "x$ac_cv_target_alias"); then
# Make sure we can run config.sub.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:978: checking build system type" >&5
+echo "configure:980: checking build system type" >&5
if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then
# Make sure we can run config.sub.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1055: checking for a BSD compatible install" >&5
+echo "configure:1057: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"\${ac_cv_path_install+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1112: checking whether build environment is sane" >&5
+echo "configure:1114: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1173: checking for $ac_word" >&5
+echo "configure:1175: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
done
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1203: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1205: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1243: checking for working aclocal" >&5
+echo "configure:1245: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1256: checking for working autoconf" >&5
+echo "configure:1258: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1269: checking for working automake" >&5
+echo "configure:1271: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1282: checking for working autoheader" >&5
+echo "configure:1284: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1295: checking for working makeinfo" >&5
+echo "configure:1297: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1315: checking for $ac_word" >&5
+echo "configure:1317: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking configure arguments""... $ac_c" 1>&6
-echo "configure:1387: checking configure arguments" >&5
+echo "configure:1389: checking configure arguments" >&5
top_builddir=`pwd`
fi
ol_enable_backends="$ol_arg"
-else
- ol_enable_backends="no"
fi
# end --enable-backends
+test -n "$ol_enable_backends" && ol_dflt_backends="$ol_enable_backends"
# OpenLDAP --enable-bdb
# Check whether --enable-bdb or --disable-bdb was given.
if test "${enable_bdb+set}" = set; then
ol_enable_bdb="$ol_arg"
else
- ol_enable_bdb="yes"
+ ol_enable_bdb="${ol_dflt_backends-yes}"
fi
# end --enable-bdb
# OpenLDAP --enable-dnssrv
ol_enable_dnssrv="$ol_arg"
else
- ol_enable_dnssrv="no"
+ ol_enable_dnssrv="${ol_dflt_backends-no}"
fi
# end --enable-dnssrv
# OpenLDAP --enable-hdb
ol_enable_hdb="$ol_arg"
else
- ol_enable_hdb="yes"
+ ol_enable_hdb="${ol_dflt_backends-yes}"
fi
# end --enable-hdb
# OpenLDAP --enable-ldap
ol_enable_ldap="$ol_arg"
else
- ol_enable_ldap="no"
+ ol_enable_ldap="${ol_dflt_backends-no}"
fi
# end --enable-ldap
# OpenLDAP --enable-ldbm
ol_enable_ldbm="$ol_arg"
else
- ol_enable_ldbm="no"
+ ol_enable_ldbm="${ol_dflt_backends-no}"
fi
# end --enable-ldbm
# OpenLDAP --with-ldbm_api
ol_enable_meta="$ol_arg"
else
- ol_enable_meta="no"
+ ol_enable_meta="${ol_dflt_backends-no}"
fi
# end --enable-meta
# OpenLDAP --enable-monitor
ol_enable_monitor="$ol_arg"
else
- ol_enable_monitor="yes"
+ ol_enable_monitor="${ol_dflt_backends-yes}"
fi
# end --enable-monitor
# OpenLDAP --enable-null
ol_enable_null="$ol_arg"
else
- ol_enable_null="no"
+ ol_enable_null="${ol_dflt_backends-no}"
fi
# end --enable-null
# OpenLDAP --enable-passwd
ol_enable_passwd="$ol_arg"
else
- ol_enable_passwd="no"
+ ol_enable_passwd="${ol_dflt_backends-no}"
fi
# end --enable-passwd
# OpenLDAP --enable-perl
ol_enable_perl="$ol_arg"
else
- ol_enable_perl="no"
+ ol_enable_perl="${ol_dflt_backends-no}"
fi
# end --enable-perl
# OpenLDAP --enable-relay
ol_enable_relay="$ol_arg"
else
- ol_enable_relay="yes"
+ ol_enable_relay="${ol_dflt_backends-yes}"
fi
# end --enable-relay
# OpenLDAP --enable-shell
ol_enable_shell="$ol_arg"
else
- ol_enable_shell="no"
+ ol_enable_shell="${ol_dflt_backends-no}"
fi
# end --enable-shell
# OpenLDAP --enable-sql
ol_enable_sql="$ol_arg"
else
- ol_enable_sql="no"
+ ol_enable_sql="${ol_dflt_backends-no}"
fi
# end --enable-sql
Overlays="accesslog denyop dyngroup dynlist glue lastmod ppolicy proxycache \
- refint rwm syncprov translucent unique"
+ refint retcode rwm syncprov translucent unique"
# Check whether --with-xxslapoverlays or --without-xxslapoverlays was given.
if test "${with_xxslapoverlays+set}" = set; then
fi
ol_enable_overlays="$ol_arg"
-else
- ol_enable_overlays="no"
fi
# end --enable-overlays
+test -n "$ol_enable_overlays" && ol_dflt_overlays="$ol_enable_overlays"
# OpenLDAP --enable-accesslog
# Check whether --enable-accesslog or --disable-accesslog was given.
if test "${enable_accesslog+set}" = set; then
ol_enable_accesslog="$ol_arg"
else
- ol_enable_accesslog="no"
+ ol_enable_accesslog="${ol_dflt_overlays-no}"
fi
# end --enable-accesslog
ol_enable_denyop="$ol_arg"
else
- ol_enable_denyop="no"
+ ol_enable_denyop="${ol_dflt_overlays-no}"
fi
# end --enable-denyop
ol_enable_dyngroup="$ol_arg"
else
- ol_enable_dyngroup="no"
+ ol_enable_dyngroup="${ol_dflt_overlays-no}"
fi
# end --enable-dyngroup
ol_enable_dynlist="$ol_arg"
else
- ol_enable_dynlist="no"
+ ol_enable_dynlist="${ol_dflt_overlays-no}"
fi
# end --enable-dynlist
ol_enable_glue="$ol_arg"
else
- ol_enable_glue="yes"
+ ol_enable_glue="${ol_dflt_overlays-yes}"
fi
# end --enable-glue
ol_enable_lastmod="$ol_arg"
else
- ol_enable_lastmod="no"
+ ol_enable_lastmod="${ol_dflt_overlays-no}"
fi
# end --enable-lastmod
ol_enable_ppolicy="$ol_arg"
else
- ol_enable_ppolicy="no"
+ ol_enable_ppolicy="${ol_dflt_overlays-no}"
fi
# end --enable-ppolicy
ol_enable_proxycache="$ol_arg"
else
- ol_enable_proxycache="no"
+ ol_enable_proxycache="${ol_dflt_overlays-no}"
fi
# end --enable-proxycache
ol_enable_refint="$ol_arg"
else
- ol_enable_refint="no"
+ ol_enable_refint="${ol_dflt_overlays-no}"
fi
# end --enable-refint
+# OpenLDAP --enable-retcode
+ # Check whether --enable-retcode or --disable-retcode was given.
+if test "${enable_retcode+set}" = set; then
+ enableval="$enable_retcode"
+
+ ol_arg=invalid
+ for ol_val in no yes mod ; do
+ if test "$enableval" = "$ol_val" ; then
+ ol_arg="$ol_val"
+ fi
+ done
+ if test "$ol_arg" = "invalid" ; then
+ { echo "configure: error: bad value $enableval for --enable-retcode" 1>&2; exit 1; }
+ fi
+ ol_enable_retcode="$ol_arg"
+
+else
+ ol_enable_retcode="${ol_dflt_overlays-no}"
+fi
+# end --enable-retcode
+
# OpenLDAP --enable-rwm
# Check whether --enable-rwm or --disable-rwm was given.
if test "${enable_rwm+set}" = set; then
ol_enable_rwm="$ol_arg"
else
- ol_enable_rwm="no"
+ ol_enable_rwm="${ol_dflt_overlays-no}"
fi
# end --enable-rwm
ol_enable_syncprov="$ol_arg"
else
- ol_enable_syncprov="yes"
+ ol_enable_syncprov="${ol_dflt_overlays-yes}"
fi
# end --enable-syncprov
ol_enable_translucent="$ol_arg"
else
- ol_enable_translucent="no"
+ ol_enable_translucent="${ol_dflt_overlays-no}"
fi
# end --enable-translucent
ol_enable_unique="$ol_arg"
else
- ol_enable_unique="no"
+ ol_enable_unique="${ol_dflt_overlays-no}"
fi
# end --enable-unique
-# Activate any backends that were not explicitly enabled.
-# Note that back_bdb defaults to "yes" so this loop won't touch it.
-if test $ol_enable_backends != no ; then
- for i in $Backends; do
- eval "ol_tmp=\$ol_enable_$i"
- if test $ol_tmp = no ; then
- eval "ol_enable_$i=$ol_enable_backends"
- fi
- done
-fi
-# Activate the overlays
-if test $ol_enable_overlays != no ; then
- for i in $Overlays; do
- eval "ol_tmp=\$ol_enable_$i"
- if test $ol_tmp = no ; then
- eval "ol_enable_$i=$ol_enable_overlays"
- fi
- done
-fi
-
# validate options
if test $ol_enable_slapd = no ; then
if test $ol_enable_slapi = yes ; then
echo "configure: warning: slapd disabled, ignoring --enable-slapi argument" 1>&2
fi
- if test $ol_enable_backends != no ; then
+ case "$ol_enable_backends" in yes | mod)
echo "configure: warning: slapd disabled, ignoring --enable-backends argument" 1>&2
- fi
+ esac
for i in $Backends; do
eval "ol_tmp=\$ol_enable_$i"
if test $ol_tmp != no ; then
if test $ol_enable_rewrite = yes ; then
echo "configure: warning: slapd disabled, ignoring --enable-rewrite argument" 1>&2
fi
- if test $ol_enable_overlays != no ; then
+ case "$ol_enable_overlays" in yes | mod)
echo "configure: warning: slapd disabled, ignoring --enable-overlays argument" 1>&2
- fi
+ esac
for i in $Overlays; do
eval "ol_tmp=\$ol_enable_$i"
if test $ol_tmp != no ; then
# force settings to no
ol_enable_slapi=no
- ol_enable_backends=no
- ol_enable_overlays=no
+ ol_enable_backends=
+ ol_enable_overlays=
ol_enable_modules=no
ol_enable_multimaster=no
ol_enable_rlookups=no
BUILD_PPOLICY=no
BUILD_PROXYCACHE=no
BUILD_REFINT=no
+BUILD_RETCODE=no
BUILD_RWM=no
BUILD_SYNCPROV=no
BUILD_TRANSLUCENT=no
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2926: checking for $ac_word" >&5
+echo "configure:2928: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2978: checking for $ac_word" >&5
+echo "configure:2980: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3020: checking for $ac_word" >&5
+echo "configure:3022: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AR+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:3070: checking for Cygwin environment" >&5
+echo "configure:3072: checking for Cygwin environment" >&5
if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3075 "configure"
+#line 3077 "configure"
#include "confdefs.h"
int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:3086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:3102: checking for mingw32 environment" >&5
+echo "configure:3104: checking for mingw32 environment" >&5
if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3107 "configure"
+#line 3109 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:3114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
MINGW32=
test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for EMX OS/2 environment""... $ac_c" 1>&6
-echo "configure:3130: checking for EMX OS/2 environment" >&5
+echo "configure:3132: checking for EMX OS/2 environment" >&5
if eval "test \"\${ac_cv_emxos2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3135 "configure"
+#line 3137 "configure"
#include "confdefs.h"
int main() {
return __EMX__;
; return 0; }
EOF
-if { (eval echo configure:3142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_emxos2=yes
else
EMXOS2=
test "$ac_cv_emxos2" = yes && EMXOS2=yes
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3158: checking how to run the C preprocessor" >&5
+echo "configure:3160: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 3173 "configure"
+#line 3175 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 3190 "configure"
+#line 3192 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 3207 "configure"
+#line 3209 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3263: checking for $ac_word" >&5
+echo "configure:3265: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3293: checking for $ac_word" >&5
+echo "configure:3295: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3344: checking for $ac_word" >&5
+echo "configure:3346: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:3376: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
+echo "configure:3378: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 3387 "configure"
+#line 3389 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:3392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:3418: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:3420: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:3423: checking whether we are using GNU C" >&5
+echo "configure:3425: checking whether we are using GNU C" >&5
if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:3432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:3434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:3451: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:3453: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:3494: checking for ld used by GCC" >&5
+echo "configure:3496: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:3524: checking for GNU ld" >&5
+echo "configure:3526: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:3527: checking for non-GNU ld" >&5
+echo "configure:3529: checking for non-GNU ld" >&5
fi
if eval "test \"\${lt_cv_path_LD+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:3562: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:3564: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"\${lt_cv_prog_gnu_ld+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:3579: checking for $LD option to reload object files" >&5
+echo "configure:3581: checking for $LD option to reload object files" >&5
if eval "test \"\${lt_cv_ld_reload_flag+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:3591: checking for BSD-compatible nm" >&5
+echo "configure:3593: checking for BSD-compatible nm" >&5
if eval "test \"\${lt_cv_path_NM+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
-echo "configure:3629: checking for a sed that does not truncate output" >&5
+echo "configure:3631: checking for a sed that does not truncate output" >&5
if eval "test \"\${lt_cv_path_SED+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo "$ac_t""$SED" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3713: checking whether ln -s works" >&5
+echo "configure:3715: checking whether ln -s works" >&5
if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
-echo "configure:3734: checking how to recognise dependent libraries" >&5
+echo "configure:3736: checking how to recognise dependent libraries" >&5
if eval "test \"\${lt_cv_deplibs_check_method+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:3924: checking for object suffix" >&5
+echo "configure:3926: checking for object suffix" >&5
if eval "test \"\${ac_cv_objext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:3930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:3951: checking for executable suffix" >&5
+echo "configure:3953: checking for executable suffix" >&5
if eval "test \"\${ac_cv_exeext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:3961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:3963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.C | *.o | *.obj | *.xcoff) ;;
# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
-echo "configure:3992: checking command to parse $NM output" >&5
+echo "configure:3994: checking command to parse $NM output" >&5
if eval "test \"\${lt_cv_sys_global_symbol_pipe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
int main(){nm_test_var='a';nm_test_func();return(0);}
EOF
- if { (eval echo configure:4075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:4077: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
# Now try to grab the symbols.
nlist=conftest.nm
- if { (eval echo configure:4078: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+ if { (eval echo configure:4080: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
save_CFLAGS="$CFLAGS"
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
- if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
+ if { (eval echo configure:4131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
pipe_works=yes
fi
LIBS="$save_LIBS"
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4178: checking for $ac_hdr" >&5
+echo "configure:4180: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4183 "configure"
+#line 4185 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:4224: checking for ${ac_tool_prefix}file" >&5
+echo "configure:4226: checking for ${ac_tool_prefix}file" >&5
if eval "test \"\${lt_cv_path_MAGIC_CMD+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:4286: checking for file" >&5
+echo "configure:4288: checking for file" >&5
if eval "test \"\${lt_cv_path_MAGIC_CMD+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4357: checking for $ac_word" >&5
+echo "configure:4359: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4389: checking for $ac_word" >&5
+echo "configure:4391: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4424: checking for $ac_word" >&5
+echo "configure:4426: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_STRIP+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4456: checking for $ac_word" >&5
+echo "configure:4458: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_STRIP+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4505 "configure"' > conftest.$ac_ext
- if { (eval echo configure:4506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 4507 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:4508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:4527: checking whether the C compiler needs -belf" >&5
+echo "configure:4529: checking whether the C compiler needs -belf" >&5
if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 4540 "configure"
+#line 4542 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4577: checking for $ac_word" >&5
+echo "configure:4579: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4609: checking for $ac_word" >&5
+echo "configure:4611: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_DLLTOOL+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4644: checking for $ac_word" >&5
+echo "configure:4646: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4676: checking for $ac_word" >&5
+echo "configure:4678: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_AS+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4711: checking for $ac_word" >&5
+echo "configure:4713: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "objdump", so it can be a program name with args.
set dummy objdump; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4743: checking for $ac_word" >&5
+echo "configure:4745: checking for $ac_word" >&5
if eval "test \"\${ac_cv_prog_OBJDUMP+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# recent cygwin and mingw systems supply a stub DllMain which the user
# can override, but on older systems we have to supply one
echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6
-echo "configure:4779: checking if libtool should supply DllMain function" >&5
+echo "configure:4781: checking if libtool should supply DllMain function" >&5
if eval "test \"\${lt_cv_need_dllmain+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4784 "configure"
+#line 4786 "configure"
#include "confdefs.h"
int main() {
DllMain (0, 0, 0);
; return 0; }
EOF
-if { (eval echo configure:4792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_need_dllmain=no
else
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mdll"
echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6
-echo "configure:4813: checking how to link DLLs" >&5
+echo "configure:4815: checking how to link DLLs" >&5
if eval "test \"\${lt_cv_cc_dll_switch+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4818 "configure"
+#line 4820 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:4825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_dll_switch=-mdll
else
compiler="$2"
echo $ac_n "checking for objdir""... $ac_c" 1>&6
-echo "configure:4939: checking for objdir" >&5
+echo "configure:4941: checking for objdir" >&5
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
# in isolation, and that seeing it set (from the cache) indicates that
# the associated values are set (in the cache) correctly too.
echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
-echo "configure:4966: checking for $compiler option to produce PIC" >&5
+echo "configure:4968: checking for $compiler option to produce PIC" >&5
if eval "test \"\${lt_cv_prog_cc_pic+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Check to make sure the pic_flag actually works.
echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
-echo "configure:5118: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+echo "configure:5120: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
if eval "test \"\${lt_cv_prog_cc_pic_works+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
cat > conftest.$ac_ext <<EOF
-#line 5125 "configure"
+#line 5127 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:5132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
case $host_os in
hpux9* | hpux10* | hpux11*)
fi
echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
-echo "configure:5184: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+echo "configure:5186: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
if eval "test \"\${lt_cv_prog_cc_static_works+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
cat > conftest.$ac_ext <<EOF
-#line 5192 "configure"
+#line 5194 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:5199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_prog_cc_static_works=yes
else
# Check to see if options -o and -c are simultaneously supported by compiler
echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
-echo "configure:5226: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo "configure:5228: checking if $compiler supports -c -o file.$ac_objext" >&5
if eval "test \"\${lt_cv_compiler_c_o+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:5245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:5247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
if test x"$compiler_c_o" = x"yes"; then
# Check to see if we can write to a .lo
echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
-echo "configure:5274: checking if $compiler supports -c -o file.lo" >&5
+echo "configure:5276: checking if $compiler supports -c -o file.lo" >&5
if eval "test \"\${lt_cv_compiler_o_lo+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_objext="$ac_objext"
ac_objext=lo
cat > conftest.$ac_ext <<EOF
-#line 5285 "configure"
+#line 5287 "configure"
#include "confdefs.h"
int main() {
int some_variable = 0;
; return 0; }
EOF
-if { (eval echo configure:5292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test "$compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
-echo "configure:5323: checking if we can lock with hard links" >&5
+echo "configure:5325: checking if we can lock with hard links" >&5
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
if test "$GCC" = yes; then
# Check to see if options -fno-rtti -fno-exceptions are supported by compiler
echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
-echo "configure:5342: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo "configure:5344: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
echo "int some_variable = 0;" > conftest.$ac_ext
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
compiler_rtti_exceptions=no
cat > conftest.$ac_ext <<EOF
-#line 5348 "configure"
+#line 5350 "configure"
#include "confdefs.h"
int main() {
int some_variable = 0;
; return 0; }
EOF
-if { (eval echo configure:5355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
# See if the linker supports building shared libraries.
echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
-echo "configure:5382: checking whether the linker ($LD) supports shared libraries" >&5
+echo "configure:5384: checking whether the linker ($LD) supports shared libraries" >&5
allow_undefined_flag=
no_undefined_flag=
# Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
-echo "configure:6087: checking how to hardcode library paths into programs" >&5
+echo "configure:6089: checking how to hardcode library paths into programs" >&5
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" || \
test -n "$runpath_var"; then
striplib=
old_striplib=
echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
-echo "configure:6115: checking whether stripping libraries is possible" >&5
+echo "configure:6117: checking whether stripping libraries is possible" >&5
if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
# PORTME Fill in your ld.so characteristics
echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
-echo "configure:6129: checking dynamic linker characteristics" >&5
+echo "configure:6131: checking dynamic linker characteristics" >&5
library_names_spec=
libname_spec='lib$name'
soname_spec=
# Report the final consequences.
echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
-echo "configure:6551: checking if libtool supports shared libraries" >&5
+echo "configure:6553: checking if libtool supports shared libraries" >&5
echo "$ac_t""$can_build_shared" 1>&6
echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
-echo "configure:6555: checking whether to build shared libraries" >&5
+echo "configure:6557: checking whether to build shared libraries" >&5
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
echo "$ac_t""$enable_shared" 1>&6
echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
-echo "configure:6578: checking whether to build static libraries" >&5
+echo "configure:6580: checking whether to build static libraries" >&5
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
echo "$ac_t""$enable_static" 1>&6
*)
echo $ac_n "checking for dllload""... $ac_c" 1>&6
-echo "configure:6619: checking for dllload" >&5
+echo "configure:6621: checking for dllload" >&5
if eval "test \"\${ac_cv_func_dllload+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6624 "configure"
+#line 6626 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dllload(); below. */
; return 0; }
EOF
-if { (eval echo configure:6648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dllload=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "configure:6666: checking for shl_load" >&5
+echo "configure:6668: checking for shl_load" >&5
if eval "test \"\${ac_cv_func_shl_load+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6671 "configure"
+#line 6673 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shl_load(); below. */
; return 0; }
EOF
-if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shl_load=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:6713: checking for shl_load in -ldld" >&5
+echo "configure:6715: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6721 "configure"
+#line 6723 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
shl_load()
; return 0; }
EOF
-if { (eval echo configure:6732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:6751: checking for dlopen" >&5
+echo "configure:6753: checking for dlopen" >&5
if eval "test \"\${ac_cv_func_dlopen+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6756 "configure"
+#line 6758 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */
; return 0; }
EOF
-if { (eval echo configure:6780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:6798: checking for dlopen in -ldl" >&5
+echo "configure:6800: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6806 "configure"
+#line 6808 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlopen()
; return 0; }
EOF
-if { (eval echo configure:6817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
-echo "configure:6836: checking for dlopen in -lsvld" >&5
+echo "configure:6838: checking for dlopen in -lsvld" >&5
ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsvld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6844 "configure"
+#line 6846 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlopen()
; return 0; }
EOF
-if { (eval echo configure:6855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "configure:6874: checking for dld_link in -ldld" >&5
+echo "configure:6876: checking for dld_link in -ldld" >&5
ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6882 "configure"
+#line 6884 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dld_link()
; return 0; }
EOF
-if { (eval echo configure:6893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
LIBS="$lt_cv_dlopen_libs $LIBS"
echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "configure:6952: checking whether a program can dlopen itself" >&5
+echo "configure:6954: checking whether a program can dlopen itself" >&5
if eval "test \"\${lt_cv_dlopen_self+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 6962 "configure"
+#line 6964 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
exit (status);
}
EOF
- if { (eval echo configure:7023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ if { (eval echo configure:7025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) 2>/dev/null
lt_status=$?
case x$lt_status in
if test "x$lt_cv_dlopen_self" = xyes; then
LDFLAGS="$LDFLAGS $link_static_flag"
echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
-echo "configure:7046: checking whether a statically linked program can dlopen itself" >&5
+echo "configure:7048: checking whether a statically linked program can dlopen itself" >&5
if eval "test \"\${lt_cv_dlopen_self_static+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 7056 "configure"
+#line 7058 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
exit (status);
}
EOF
- if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ if { (eval echo configure:7119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) 2>/dev/null
lt_status=$?
case x$lt_status in
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
-echo "configure:7166: checking whether -lc should be explicitly linked in" >&5
+echo "configure:7168: checking whether -lc should be explicitly linked in" >&5
if eval "test \"\${lt_cv_archive_cmds_need_lc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
$rm conftest*
echo 'static int dummy;' > conftest.$ac_ext
- if { (eval echo configure:7173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:7175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
libname=conftest
save_allow_undefined_flag=$allow_undefined_flag
allow_undefined_flag=
- if { (eval echo configure:7186: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+ if { (eval echo configure:7188: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
then
lt_cv_archive_cmds_need_lc=no
else
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7776: checking for $ac_word" >&5
+echo "configure:7778: checking for $ac_word" >&5
if eval "test \"\${ac_cv_path_PERLBIN+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:7829: checking how to run the C preprocessor" >&5
+echo "configure:7831: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 7844 "configure"
+#line 7846 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 7861 "configure"
+#line 7863 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 7878 "configure"
+#line 7880 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7884: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:7911: checking for Cygwin environment" >&5
+echo "configure:7913: checking for Cygwin environment" >&5
if eval "test \"\${ac_cv_cygwin+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7916 "configure"
+#line 7918 "configure"
#include "confdefs.h"
int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:7927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:7943: checking for mingw32 environment" >&5
+echo "configure:7945: checking for mingw32 environment" >&5
if eval "test \"\${ac_cv_mingw32+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7948 "configure"
+#line 7950 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:7955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:7974: checking for executable suffix" >&5
+echo "configure:7976: checking for executable suffix" >&5
if eval "test \"\${ac_cv_exeext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:7984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:7986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.C | *.o | *.obj | *.xcoff) ;;
ac_exeext=$EXEEXT
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:8005: checking for object suffix" >&5
+echo "configure:8007: checking for object suffix" >&5
if eval "test \"\${ac_cv_objext+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:8011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
echo $ac_n "checking for be_app in -lbe""... $ac_c" 1>&6
-echo "configure:8035: checking for be_app in -lbe" >&5
+echo "configure:8037: checking for be_app in -lbe" >&5
ac_lib_var=`echo be'_'be_app | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lbe -lroot -lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8043 "configure"
+#line 8045 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
be_app()
; return 0; }
EOF
-if { (eval echo configure:8054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:8080: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:8082: checking for ${CC-cc} option to accept ANSI C" >&5
if eval "test \"\${am_cv_prog_cc_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
CC="$ac_save_CC $ac_arg"
cat > conftest.$ac_ext <<EOF
-#line 8097 "configure"
+#line 8099 "configure"
#include "confdefs.h"
#include <stdarg.h>
#include <stdio.h>
; return 0; }
EOF
-if { (eval echo configure:8134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_prog_cc_stdc="$ac_arg"; break
else
OL_MKDEP="${CC-cc}"
if test -z "${MKDEP_FLAGS}"; then
echo $ac_n "checking for ${OL_MKDEP} depend flag""... $ac_c" 1>&6
-echo "configure:8168: checking for ${OL_MKDEP} depend flag" >&5
+echo "configure:8170: checking for ${OL_MKDEP} depend flag" >&5
if eval "test \"\${ol_cv_mkdep+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
noCode;
EOF
- if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:8178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
+ if { ac_try='$OL_MKDEP $flag conftest.c'; { (eval echo configure:8180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } \
| egrep '^conftest\.'"${ac_objext}" >/dev/null 2>&1
then
if test ! -f conftest."${ac_object}" ; then
fi
echo $ac_n "checking for afopen in -ls""... $ac_c" 1>&6
-echo "configure:8211: checking for afopen in -ls" >&5
+echo "configure:8213: checking for afopen in -ls" >&5
ac_lib_var=`echo s'_'afopen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ls $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8219 "configure"
+#line 8221 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
afopen()
; return 0; }
EOF
-if { (eval echo configure:8230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8274: checking for $ac_hdr" >&5
+echo "configure:8276: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8279 "configure"
+#line 8281 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
-echo "configure:8316: checking for lt_dlinit in -lltdl" >&5
+echo "configure:8318: checking for lt_dlinit in -lltdl" >&5
ac_lib_var=`echo ltdl'_'lt_dlinit | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lltdl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8324 "configure"
+#line 8326 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
lt_dlinit()
; return 0; }
EOF
-if { (eval echo configure:8335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# test for EBCDIC
echo $ac_n "checking for EBCDIC""... $ac_c" 1>&6
-echo "configure:8387: checking for EBCDIC" >&5
+echo "configure:8389: checking for EBCDIC" >&5
if eval "test \"\${ol_cv_cpp_ebcdic+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8393 "configure"
+#line 8395 "configure"
#include "confdefs.h"
#if !('M' == 0xd4)
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8404: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:8426: checking for ANSI C header files" >&5
+echo "configure:8428: checking for ANSI C header files" >&5
if eval "test \"\${ol_cv_header_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8431 "configure"
+#line 8433 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8439: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 8456 "configure"
+#line 8458 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ol_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 8474 "configure"
+#line 8476 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 8495 "configure"
+#line 8497 "configure"
#include "confdefs.h"
#include <ctype.h>
#ifndef HAVE_EBCDIC
exit (0); }
EOF
-if { (eval echo configure:8513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:8515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
:
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:8547: checking for $ac_hdr that defines DIR" >&5
+echo "configure:8549: checking for $ac_hdr that defines DIR" >&5
if eval "test \"\${ac_cv_header_dirent_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8552 "configure"
+#line 8554 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:8560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:8585: checking for opendir in -ldir" >&5
+echo "configure:8587: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8593 "configure"
+#line 8595 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
opendir()
; return 0; }
EOF
-if { (eval echo configure:8604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:8626: checking for opendir in -lx" >&5
+echo "configure:8628: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8634 "configure"
+#line 8636 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
opendir()
; return 0; }
EOF
-if { (eval echo configure:8645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:8668: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:8670: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"\${ac_cv_header_sys_wait_h+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8673 "configure"
+#line 8675 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:8689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
fi
echo $ac_n "checking POSIX termios""... $ac_c" 1>&6
-echo "configure:8710: checking POSIX termios" >&5
+echo "configure:8712: checking POSIX termios" >&5
if eval "test \"\${am_cv_sys_posix_termios+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8715 "configure"
+#line 8717 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <unistd.h>
tcgetattr(0, 0);
; return 0; }
EOF
-if { (eval echo configure:8725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_sys_posix_termios=yes
else
echo $ac_n "checking whether use of TIOCGWINSZ requires sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:8741: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
+echo "configure:8743: checking whether use of TIOCGWINSZ requires sys/ioctl.h" >&5
if eval "test \"\${am_cv_sys_tiocgwinsz_needs_sys_ioctl_h+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
gwinsz_in_termios_h=no
if test $am_cv_sys_posix_termios = yes; then
cat > conftest.$ac_ext <<EOF
-#line 8750 "configure"
+#line 8752 "configure"
#include "confdefs.h"
#include <sys/types.h>
# include <termios.h>
if test $gwinsz_in_termios_h = no; then
cat > conftest.$ac_ext <<EOF
-#line 8770 "configure"
+#line 8772 "configure"
#include "confdefs.h"
#include <sys/types.h>
# include <sys/ioctl.h>
for ac_hdr in \
arpa/inet.h \
- arpa/nameser.h \
+ arpa/nameser.h \
assert.h \
- bits/types.h \
+ bits/types.h \
conio.h \
crypt.h \
direct.h \
libutil.h \
limits.h \
locale.h \
- netinet/tcp.h \
+ netinet/tcp.h \
malloc.h \
memory.h \
psap.h \
sys/errno.h \
sys/ioctl.h \
sys/param.h \
- sys/resource.h \
- sys/select.h \
- sys/socket.h \
+ sys/resource.h \
+ sys/select.h \
+ sys/socket.h \
sys/stat.h \
- sys/syslog.h \
+ sys/syslog.h \
sys/time.h \
sys/types.h \
sys/ucred.h \
syslog.h \
termios.h \
unistd.h \
+ utime.h \
winsock.h \
winsock2.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8858: checking for $ac_hdr" >&5
+echo "configure:8861: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8863 "configure"
+#line 8866 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in sigaction sigset
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8899: checking for $ac_func" >&5
+echo "configure:8902: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8904 "configure"
+#line 8907 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:8928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test $ac_cv_func_sigaction = no && test $ac_cv_func_sigaction = no ; then
echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:8955: checking for sigset in -lV3" >&5
+echo "configure:8958: checking for sigset in -lV3" >&5
ac_lib_var=`echo V3'_'sigset | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lV3 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 8963 "configure"
+#line 8966 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sigset()
; return 0; }
EOF
-if { (eval echo configure:8974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$ac_cv_cygwin" != yes && test "$ac_cv_header_winsock_h" = yes; then
echo $ac_n "checking for winsock""... $ac_c" 1>&6
-echo "configure:9005: checking for winsock" >&5
+echo "configure:9008: checking for winsock" >&5
if eval "test \"\${ol_cv_winsock+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for curlib in ws2_32 wsock32; do
LIBS="$LIBS -l$curlib"
cat > conftest.$ac_ext <<EOF
-#line 9013 "configure"
+#line 9016 "configure"
#include "confdefs.h"
#include <winsock.h>
; return 0; }
EOF
-if { (eval echo configure:9026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_winsock=yes
else
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:9064: checking for socket" >&5
+echo "configure:9067: checking for socket" >&5
if eval "test \"\${ac_cv_func_socket+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9069 "configure"
+#line 9072 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
; return 0; }
EOF
-if { (eval echo configure:9093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:9112: checking for main in -lsocket" >&5
+echo "configure:9115: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9120 "configure"
+#line 9123 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:9127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:9155: checking for main in -lnet" >&5
+echo "configure:9158: checking for main in -lnet" >&5
ac_lib_var=`echo net'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9163 "configure"
+#line 9166 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:9170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:9198: checking for main in -lnsl_s" >&5
+echo "configure:9201: checking for main in -lnsl_s" >&5
ac_lib_var=`echo nsl_s'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl_s $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9206 "configure"
+#line 9209 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:9213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:9241: checking for main in -lnsl" >&5
+echo "configure:9244: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9249 "configure"
+#line 9252 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:9256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:9284: checking for socket in -linet" >&5
+echo "configure:9287: checking for socket in -linet" >&5
ac_lib_var=`echo inet'_'socket | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-linet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9292 "configure"
+#line 9295 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
socket()
; return 0; }
EOF
-if { (eval echo configure:9303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:9331: checking for main in -lgen" >&5
+echo "configure:9334: checking for main in -lgen" >&5
ac_lib_var=`echo gen'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 9339 "configure"
+#line 9342 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:9346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for select""... $ac_c" 1>&6
-echo "configure:9378: checking for select" >&5
+echo "configure:9381: checking for select" >&5
if eval "test \"\${ac_cv_func_select+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9383 "configure"
+#line 9386 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char select(); below. */
; return 0; }
EOF
-if { (eval echo configure:9407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_select=yes"
else
if test "${ac_cv_header_winsock_h}" != yes; then
echo $ac_n "checking types of arguments for select()""... $ac_c" 1>&6
-echo "configure:9430: checking types of arguments for select()" >&5
+echo "configure:9433: checking types of arguments for select()" >&5
if eval "test \"\${ac_cv_func_select_arg234+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
cat > conftest.$ac_ext <<EOF
-#line 9444 "configure"
+#line 9447 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:9463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_not_found=no ; break 3
else
for ac_func in poll
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9507: checking for $ac_func" >&5
+echo "configure:9510: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9512 "configure"
+#line 9515 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:9536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9564: checking for $ac_hdr" >&5
+echo "configure:9567: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9569 "configure"
+#line 9572 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9605: checking for $ac_hdr" >&5
+echo "configure:9608: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9610 "configure"
+#line 9613 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test "${ac_cv_header_sys_epoll_h}" = yes; then
echo $ac_n "checking for epoll system call""... $ac_c" 1>&6
-echo "configure:9643: checking for epoll system call" >&5
+echo "configure:9646: checking for epoll system call" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""no" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9648 "configure"
+#line 9651 "configure"
#include "confdefs.h"
int main(int argc, char *argv)
{
exit (epfd == -1 ? 1 : 0);
}
EOF
-if { (eval echo configure:9656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:9659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
# strerror checks
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:9676: checking declaration of sys_errlist" >&5
+echo "configure:9679: checking declaration of sys_errlist" >&5
if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9682 "configure"
+#line 9685 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:9695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
ol_cv_have_sys_errlist=yes
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:9718: checking existence of sys_errlist" >&5
+echo "configure:9721: checking existence of sys_errlist" >&5
if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9724 "configure"
+#line 9727 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:9731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
for ac_func in strerror strerror_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9754: checking for $ac_func" >&5
+echo "configure:9757: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9759 "configure"
+#line 9762 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:9783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
ol_cv_func_strerror_r=no
if test "${ac_cv_func_strerror_r}" = yes ; then
echo $ac_n "checking non-posix strerror_r""... $ac_c" 1>&6
-echo "configure:9810: checking non-posix strerror_r" >&5
+echo "configure:9813: checking non-posix strerror_r" >&5
if eval "test \"\${ol_cv_nonposix_strerror_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9816 "configure"
+#line 9819 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ol_decl_strerror_r = yes ; then
cat > conftest.$ac_ext <<EOF
-#line 9832 "configure"
+#line 9835 "configure"
#include "confdefs.h"
#include <string.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:9843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_nonposix_strerror_r=yes
else
ol_cv_nonposix_strerror=no
else
cat > conftest.$ac_ext <<EOF
-#line 9858 "configure"
+#line 9861 "configure"
#include "confdefs.h"
main() {
}
EOF
-if { (eval echo configure:9869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:9872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_nonposix_strerror_r=yes
else
elif test "${ac_cv_func_strerror}" = no ; then
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:9895: checking declaration of sys_errlist" >&5
+echo "configure:9898: checking declaration of sys_errlist" >&5
if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9901 "configure"
+#line 9904 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:9914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
ol_cv_have_sys_errlist=yes
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:9937: checking existence of sys_errlist" >&5
+echo "configure:9940: checking existence of sys_errlist" >&5
if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9943 "configure"
+#line 9946 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:9950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9978: checking for $ac_hdr" >&5
+echo "configure:9981: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 9983 "configure"
+#line 9986 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
fi
echo $ac_n "checking for library containing regfree""... $ac_c" 1>&6
-echo "configure:10019: checking for library containing regfree" >&5
+echo "configure:10022: checking for library containing regfree" >&5
if eval "test \"\${ac_cv_search_regfree+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_regfree="no"
cat > conftest.$ac_ext <<EOF
-#line 10026 "configure"
+#line 10029 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
regfree()
; return 0; }
EOF
-if { (eval echo configure:10037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_regfree="none required"
else
test "$ac_cv_search_regfree" = "no" && for ac_lib in regex gnuregex; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10048 "configure"
+#line 10051 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
regfree()
; return 0; }
EOF
-if { (eval echo configure:10059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_regfree="-l$ac_lib"
break
echo $ac_n "checking for compatible POSIX regex""... $ac_c" 1>&6
-echo "configure:10082: checking for compatible POSIX regex" >&5
+echo "configure:10085: checking for compatible POSIX regex" >&5
if eval "test \"\${ol_cv_c_posix_regex+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_c_posix_regex=cross
else
cat > conftest.$ac_ext <<EOF
-#line 10091 "configure"
+#line 10094 "configure"
#include "confdefs.h"
#include <sys/types.h>
return rc;
}
EOF
-if { (eval echo configure:10117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:10120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_c_posix_regex=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10143: checking for $ac_hdr" >&5
+echo "configure:10146: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10148 "configure"
+#line 10151 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
save_LIBS="$LIBS"
echo $ac_n "checking for library containing uuid_to_str""... $ac_c" 1>&6
-echo "configure:10183: checking for library containing uuid_to_str" >&5
+echo "configure:10186: checking for library containing uuid_to_str" >&5
if eval "test \"\${ac_cv_search_uuid_to_str+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_uuid_to_str="no"
cat > conftest.$ac_ext <<EOF
-#line 10190 "configure"
+#line 10193 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
uuid_to_str()
; return 0; }
EOF
-if { (eval echo configure:10201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_uuid_to_str="none required"
else
test "$ac_cv_search_uuid_to_str" = "no" && for ac_lib in uuid; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10212 "configure"
+#line 10215 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
uuid_to_str()
; return 0; }
EOF
-if { (eval echo configure:10223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_uuid_to_str="-l$ac_lib"
break
if test $have_uuid = no ; then
echo $ac_n "checking to see if -lrpcrt4 is needed for win32 UUID support""... $ac_c" 1>&6
-echo "configure:10258: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
+echo "configure:10261: checking to see if -lrpcrt4 is needed for win32 UUID support" >&5
save_LIBS="$LIBS"
LIBS="$LIBS -lrpcrt4"
cat > conftest.$ac_ext <<EOF
-#line 10262 "configure"
+#line 10265 "configure"
#include "confdefs.h"
int __stdcall UuidCreate(void *);
; return 0; }
EOF
-if { (eval echo configure:10275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
need_rpcrt=yes
else
ol_cv_lib_resolver=no
if test $ol_cv_lib_resolver = no ; then
echo $ac_n "checking for resolver link (default)""... $ac_c" 1>&6
-echo "configure:10295: checking for resolver link (default)" >&5
+echo "configure:10298: checking for resolver link (default)" >&5
if eval "test \"\${ol_cv_resolver_none+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_RESOLVER_LIB $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10305 "configure"
+#line 10308 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
}
; return 0; }
EOF
-if { (eval echo configure:10352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_resolver_none=yes
else
if test $ol_cv_lib_resolver = no ; then
echo $ac_n "checking for resolver link (-lresolv)""... $ac_c" 1>&6
-echo "configure:10376: checking for resolver link (-lresolv)" >&5
+echo "configure:10379: checking for resolver link (-lresolv)" >&5
if eval "test \"\${ol_cv_resolver_resolv+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_RESOLVER_LIB $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10386 "configure"
+#line 10389 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
}
; return 0; }
EOF
-if { (eval echo configure:10433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_resolver_resolv=yes
else
if test $ol_cv_lib_resolver = no ; then
echo $ac_n "checking for resolver link (-lbind)""... $ac_c" 1>&6
-echo "configure:10457: checking for resolver link (-lbind)" >&5
+echo "configure:10460: checking for resolver link (-lbind)" >&5
if eval "test \"\${ol_cv_resolver_bind+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_RESOLVER_LIB $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10467 "configure"
+#line 10470 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
}
; return 0; }
EOF
-if { (eval echo configure:10514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_resolver_bind=yes
else
for ac_func in hstrerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:10565: checking for $ac_func" >&5
+echo "configure:10568: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10570 "configure"
+#line 10573 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:10594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in getaddrinfo getnameinfo gai_strerror inet_ntop
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:10622: checking for $ac_func" >&5
+echo "configure:10625: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10627 "configure"
+#line 10630 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:10651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
fi
elif test $ol_enable_ipv6 != no ; then
echo $ac_n "checking INET6_ADDRSTRLEN""... $ac_c" 1>&6
-echo "configure:10683: checking INET6_ADDRSTRLEN" >&5
+echo "configure:10686: checking INET6_ADDRSTRLEN" >&5
if eval "test \"\${ol_cv_inet6_addrstrlen+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10689 "configure"
+#line 10692 "configure"
#include "confdefs.h"
# include <netinet/in.h>
echo $ac_n "checking struct sockaddr_storage""... $ac_c" 1>&6
-echo "configure:10714: checking struct sockaddr_storage" >&5
+echo "configure:10717: checking struct sockaddr_storage" >&5
if eval "test \"\${ol_cv_struct_sockaddr_storage+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10720 "configure"
+#line 10723 "configure"
#include "confdefs.h"
#include <sys/types.h>
; return 0; }
EOF
-if { (eval echo configure:10732: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_struct_sockaddr_storage=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10763: checking for $ac_hdr" >&5
+echo "configure:10766: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10768 "configure"
+#line 10771 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10819: checking for $ac_hdr" >&5
+echo "configure:10822: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10824 "configure"
+#line 10827 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10861: checking for $ac_hdr" >&5
+echo "configure:10864: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 10866 "configure"
+#line 10869 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $krb5_impl = mit; then
echo $ac_n "checking for main in -lk5crypto""... $ac_c" 1>&6
-echo "configure:10905: checking for main in -lk5crypto" >&5
+echo "configure:10908: checking for main in -lk5crypto" >&5
ac_lib_var=`echo k5crypto'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lk5crypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10913 "configure"
+#line 10916 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:10920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
-echo "configure:10943: checking for main in -lkrb5" >&5
+echo "configure:10946: checking for main in -lkrb5" >&5
ac_lib_var=`echo krb5'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb5 -l$krb5crypto -lcom_err $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10951 "configure"
+#line 10954 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:10958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
elif test $krb5_impl = heimdal; then
echo $ac_n "checking for main in -ldes""... $ac_c" 1>&6
-echo "configure:10983: checking for main in -ldes" >&5
+echo "configure:10986: checking for main in -ldes" >&5
ac_lib_var=`echo des'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldes $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 10991 "configure"
+#line 10994 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:10998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for main in -lkrb5""... $ac_c" 1>&6
-echo "configure:11021: checking for main in -lkrb5" >&5
+echo "configure:11024: checking for main in -lkrb5" >&5
ac_lib_var=`echo krb5'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11029 "configure"
+#line 11032 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11095: checking for $ac_hdr" >&5
+echo "configure:11098: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11100 "configure"
+#line 11103 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_kerberosIV_krb_h = yes ; then
if test $krb5_impl = mit; then
echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:11135: checking for main in -lkrb4" >&5
+echo "configure:11138: checking for main in -lkrb4" >&5
ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb4 -ldes425 -lkrb5 -l$krb5crypto -lcom_err $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11143 "configure"
+#line 11146 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
elif test $krb5_impl = heimdal; then
echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:11175: checking for main in -lkrb4" >&5
+echo "configure:11178: checking for main in -lkrb4" >&5
ac_lib_var=`echo krb4'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb4 -lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11183 "configure"
+#line 11186 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for des_debug in Kerberos libraries""... $ac_c" 1>&6
-echo "configure:11232: checking for des_debug in Kerberos libraries" >&5
+echo "configure:11235: checking for des_debug in Kerberos libraries" >&5
if eval "test \"\${ol_cv_var_des_debug+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_LIBS="$LIBS"
LIBS="$KRB4_LIBS $KRB5_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11240 "configure"
+#line 11243 "configure"
#include "confdefs.h"
#include <kerberosIV/krb.h>
; return 0; }
EOF
-if { (eval echo configure:11253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_var_des_debug=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11292: checking for $ac_hdr" >&5
+echo "configure:11295: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11297 "configure"
+#line 11300 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11305: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_krb_h = yes ; then
echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:11331: checking for main in -lkrb" >&5
+echo "configure:11334: checking for main in -lkrb" >&5
ac_lib_var=`echo krb'_'main | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb -ldes $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11339 "configure"
+#line 11342 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:11346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11413: checking for $ac_hdr" >&5
+echo "configure:11416: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11418 "configure"
+#line 11421 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_openssl_ssl_h = yes \
-o $ac_cv_header_ssl_h = yes ; then
echo $ac_n "checking for SSLeay_add_ssl_algorithms in -lssl""... $ac_c" 1>&6
-echo "configure:11453: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
+echo "configure:11456: checking for SSLeay_add_ssl_algorithms in -lssl" >&5
ac_lib_var=`echo ssl'_'SSLeay_add_ssl_algorithms | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11461 "configure"
+#line 11464 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SSLeay_add_ssl_algorithms()
; return 0; }
EOF
-if { (eval echo configure:11472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_ssleay = no ; then
echo $ac_n "checking for SSL_library_init in -lssl""... $ac_c" 1>&6
-echo "configure:11497: checking for SSL_library_init in -lssl" >&5
+echo "configure:11500: checking for SSL_library_init in -lssl" >&5
ac_lib_var=`echo ssl'_'SSL_library_init | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11505 "configure"
+#line 11508 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SSL_library_init()
; return 0; }
EOF
-if { (eval echo configure:11516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $have_ssleay = no ; then
echo $ac_n "checking for ssl3_accept in -lssl""... $ac_c" 1>&6
-echo "configure:11542: checking for ssl3_accept in -lssl" >&5
+echo "configure:11545: checking for ssl3_accept in -lssl" >&5
ac_lib_var=`echo ssl'_'ssl3_accept | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lssl -lcrypto -lRSAglue -lrsaref $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 11550 "configure"
+#line 11553 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
ssl3_accept()
; return 0; }
EOF
-if { (eval echo configure:11561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
fi
echo $ac_n "checking OpenSSL library version (CRL checking capability)""... $ac_c" 1>&6
-echo "configure:11606: checking OpenSSL library version (CRL checking capability)" >&5
+echo "configure:11609: checking OpenSSL library version (CRL checking capability)" >&5
if eval "test \"\${ol_cv_ssl_crl_compat+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11612 "configure"
+#line 11615 "configure"
#include "confdefs.h"
#ifdef HAVE_OPENSSL_SSL_H
echo $ac_n "checking for _beginthread""... $ac_c" 1>&6
-echo "configure:11689: checking for _beginthread" >&5
+echo "configure:11692: checking for _beginthread" >&5
if eval "test \"\${ac_cv_func__beginthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11694 "configure"
+#line 11697 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _beginthread(); below. */
; return 0; }
EOF
-if { (eval echo configure:11718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__beginthread=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11774: checking for $ac_hdr" >&5
+echo "configure:11777: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11779 "configure"
+#line 11782 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_pthread_h = yes ; then
echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
-echo "configure:11813: checking POSIX thread version" >&5
+echo "configure:11816: checking POSIX thread version" >&5
if eval "test \"\${ol_cv_pthread_version+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11819 "configure"
+#line 11822 "configure"
#include "confdefs.h"
# include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:11830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 11834 "configure"
+#line 11837 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 11854 "configure"
+#line 11857 "configure"
#include "confdefs.h"
# include <pthread.h>
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 11871 "configure"
+#line 11874 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 11883 "configure"
+#line 11886 "configure"
#include "confdefs.h"
# include <pthread.h>
echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:11930: checking for LinuxThreads pthread.h" >&5
+echo "configure:11933: checking for LinuxThreads pthread.h" >&5
if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11935 "configure"
+#line 11938 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
-echo "configure:11962: checking for GNU Pth pthread.h" >&5
+echo "configure:11965: checking for GNU Pth pthread.h" >&5
if eval "test \"\${ol_cv_header_gnu_pth_pthread_h+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 11967 "configure"
+#line 11970 "configure"
#include "confdefs.h"
#include <pthread.h>
#ifdef _POSIX_THREAD_IS_GNU_PTH
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11996: checking for $ac_hdr" >&5
+echo "configure:11999: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 12001 "configure"
+#line 12004 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:12006: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:12009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for pthread_create in default libraries""... $ac_c" 1>&6
-echo "configure:12036: checking for pthread_create in default libraries" >&5
+echo "configure:12039: checking for pthread_create in default libraries" >&5
if eval "test \"\${ol_cv_pthread_create+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12043 "configure"
+#line 12046 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:12110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_create=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 12122 "configure"
+#line 12125 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:12194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:12197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_create=yes
else
if test "$ol_link_threads" = no ; then
# try -kthread
echo $ac_n "checking for pthread link with -kthread""... $ac_c" 1>&6
-echo "configure:12219: checking for pthread link with -kthread" >&5
+echo "configure:12222: checking for pthread link with -kthread" >&5
if eval "test \"\${ol_cv_pthread_kthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12230 "configure"
+#line 12233 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:12297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_kthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 12309 "configure"
+#line 12312 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:12381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:12384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_kthread=yes
else
if test "$ol_link_threads" = no ; then
# try -pthread
echo $ac_n "checking for pthread link with -pthread""... $ac_c" 1>&6
-echo "configure:12411: checking for pthread link with -pthread" >&5
+echo "configure:12414: checking for pthread link with -pthread" >&5
if eval "test \"\${ol_cv_pthread_pthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12422 "configure"
+#line 12425 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:12489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_pthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 12501 "configure"
+#line 12504 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:12573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:12576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_pthread=yes
else
if test "$ol_link_threads" = no ; then
# try -pthreads
echo $ac_n "checking for pthread link with -pthreads""... $ac_c" 1>&6
-echo "configure:12603: checking for pthread link with -pthreads" >&5
+echo "configure:12606: checking for pthread link with -pthreads" >&5
if eval "test \"\${ol_cv_pthread_pthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12614 "configure"
+#line 12617 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:12681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_pthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 12693 "configure"
+#line 12696 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:12765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:12768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_pthreads=yes
else
if test "$ol_link_threads" = no ; then
# try -mthreads
echo $ac_n "checking for pthread link with -mthreads""... $ac_c" 1>&6
-echo "configure:12795: checking for pthread link with -mthreads" >&5
+echo "configure:12798: checking for pthread link with -mthreads" >&5
if eval "test \"\${ol_cv_pthread_mthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12806 "configure"
+#line 12809 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:12873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_mthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 12885 "configure"
+#line 12888 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:12957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:12960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_mthreads=yes
else
if test "$ol_link_threads" = no ; then
# try -thread
echo $ac_n "checking for pthread link with -thread""... $ac_c" 1>&6
-echo "configure:12987: checking for pthread link with -thread" >&5
+echo "configure:12990: checking for pthread link with -thread" >&5
if eval "test \"\${ol_cv_pthread_thread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 12998 "configure"
+#line 13001 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:13065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_thread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 13077 "configure"
+#line 13080 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:13149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:13152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_thread=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -lmach -lexc -lc_r
echo $ac_n "checking for pthread link with -lpthread -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:13180: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo "configure:13183: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 13191 "configure"
+#line 13194 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:13258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 13270 "configure"
+#line 13273 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:13342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:13345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -lmach -lexc
echo $ac_n "checking for pthread link with -lpthread -lmach -lexc""... $ac_c" 1>&6
-echo "configure:13372: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo "configure:13375: checking for pthread link with -lpthread -lmach -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthread_lmach_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 13383 "configure"
+#line 13386 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:13450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread_lmach_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 13462 "configure"
+#line 13465 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:13534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:13537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthread_lmach_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread -Wl,-woff,85
echo $ac_n "checking for pthread link with -lpthread -Wl,-woff,85""... $ac_c" 1>&6
-echo "configure:13565: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo "configure:13568: checking for pthread link with -lpthread -Wl,-woff,85" >&5
if eval "test \"\${ol_cv_pthread_lib_lpthread_woff+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 13576 "configure"
+#line 13579 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:13643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lib_lpthread_woff=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 13655 "configure"
+#line 13658 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:13727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:13730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lib_lpthread_woff=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthread
echo $ac_n "checking for pthread link with -lpthread""... $ac_c" 1>&6
-echo "configure:13758: checking for pthread link with -lpthread" >&5
+echo "configure:13761: checking for pthread link with -lpthread" >&5
if eval "test \"\${ol_cv_pthread_lpthread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 13769 "configure"
+#line 13772 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:13836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthread=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 13848 "configure"
+#line 13851 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:13920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:13923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthread=yes
else
if test "$ol_link_threads" = no ; then
# try -lc_r
echo $ac_n "checking for pthread link with -lc_r""... $ac_c" 1>&6
-echo "configure:13950: checking for pthread link with -lc_r" >&5
+echo "configure:13953: checking for pthread link with -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 13961 "configure"
+#line 13964 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 14040 "configure"
+#line 14043 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:14112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:14115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -threads
echo $ac_n "checking for pthread link with -threads""... $ac_c" 1>&6
-echo "configure:14143: checking for pthread link with -threads" >&5
+echo "configure:14146: checking for pthread link with -threads" >&5
if eval "test \"\${ol_cv_pthread_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 14154 "configure"
+#line 14157 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_threads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 14233 "configure"
+#line 14236 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:14305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:14308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_threads=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lmach -lexc -lc_r
echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc -lc_r""... $ac_c" 1>&6
-echo "configure:14336: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo "configure:14339: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 14347 "configure"
+#line 14350 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 14426 "configure"
+#line 14429 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:14498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:14501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lmach -lexc
echo $ac_n "checking for pthread link with -lpthreads -lmach -lexc""... $ac_c" 1>&6
-echo "configure:14528: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo "configure:14531: checking for pthread link with -lpthreads -lmach -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lmach_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 14539 "configure"
+#line 14542 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lmach_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 14618 "configure"
+#line 14621 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:14690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:14693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthreads_lmach_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads -lexc
echo $ac_n "checking for pthread link with -lpthreads -lexc""... $ac_c" 1>&6
-echo "configure:14720: checking for pthread link with -lpthreads -lexc" >&5
+echo "configure:14723: checking for pthread link with -lpthreads -lexc" >&5
if eval "test \"\${ol_cv_pthread_lpthreads_lexc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 14731 "configure"
+#line 14734 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lpthreads_lexc=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 14810 "configure"
+#line 14813 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:14882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:14885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lpthreads_lexc=yes
else
if test "$ol_link_threads" = no ; then
# try -lpthreads
echo $ac_n "checking for pthread link with -lpthreads""... $ac_c" 1>&6
-echo "configure:14913: checking for pthread link with -lpthreads" >&5
+echo "configure:14916: checking for pthread link with -lpthreads" >&5
if eval "test \"\${ol_cv_pthread_lib_lpthreads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
cat > conftest.$ac_ext <<EOF
-#line 14924 "configure"
+#line 14927 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
; return 0; }
EOF
-if { (eval echo configure:14991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_pthread_lib_lpthreads=yes
else
rm -f conftest*
else
cat > conftest.$ac_ext <<EOF
-#line 15003 "configure"
+#line 15006 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:15075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:15078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_lib_lpthreads=yes
else
for ac_func in sched_yield pthread_yield thr_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15112: checking for $ac_func" >&5
+echo "configure:15115: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15117 "configure"
+#line 15120 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
$ac_cv_func_pthread_yield = no -a \
$ac_cv_func_thr_yield = no ; then
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:15170: checking for sched_yield in -lrt" >&5
+echo "configure:15173: checking for sched_yield in -lrt" >&5
ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 15178 "configure"
+#line 15181 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:15189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in pthread_kill pthread_rwlock_destroy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15225: checking for $ac_func" >&5
+echo "configure:15228: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15230 "configure"
+#line 15233 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
-echo "configure:15280: checking for pthread_detach with <pthread.h>" >&5
+echo "configure:15283: checking for pthread_detach with <pthread.h>" >&5
if eval "test \"\${ol_cv_func_pthread_detach+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15286 "configure"
+#line 15289 "configure"
#include "confdefs.h"
#include <pthread.h>
pthread_detach(NULL);
; return 0; }
EOF
-if { (eval echo configure:15298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_func_pthread_detach=yes
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15330: checking for $ac_func" >&5
+echo "configure:15333: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15335 "configure"
+#line 15338 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in pthread_kill_other_threads_np
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15388: checking for $ac_func" >&5
+echo "configure:15391: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15393 "configure"
+#line 15396 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
done
echo $ac_n "checking for LinuxThreads implementation""... $ac_c" 1>&6
-echo "configure:15442: checking for LinuxThreads implementation" >&5
+echo "configure:15445: checking for LinuxThreads implementation" >&5
if eval "test \"\${ol_cv_sys_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for LinuxThreads consistency""... $ac_c" 1>&6
-echo "configure:15455: checking for LinuxThreads consistency" >&5
+echo "configure:15458: checking for LinuxThreads consistency" >&5
if eval "test \"\${ol_cv_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking if pthread_create() works""... $ac_c" 1>&6
-echo "configure:15480: checking if pthread_create() works" >&5
+echo "configure:15483: checking if pthread_create() works" >&5
if eval "test \"\${ol_cv_pthread_create_works+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_pthread_create_works=yes
else
cat > conftest.$ac_ext <<EOF
-#line 15489 "configure"
+#line 15492 "configure"
#include "confdefs.h"
/* pthread test headers */
#include <pthread.h>
}
EOF
-if { (eval echo configure:15561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:15564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_create_works=yes
else
if test $ol_with_yielding_select = auto ; then
echo $ac_n "checking if select yields when using pthreads""... $ac_c" 1>&6
-echo "configure:15583: checking if select yields when using pthreads" >&5
+echo "configure:15586: checking if select yields when using pthreads" >&5
if eval "test \"\${ol_cv_pthread_select_yields+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_pthread_select_yields=cross
else
cat > conftest.$ac_ext <<EOF
-#line 15592 "configure"
+#line 15595 "configure"
#include "confdefs.h"
#include <sys/types.h>
exit(2);
}
EOF
-if { (eval echo configure:15669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:15672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_pthread_select_yields=no
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15713: checking for $ac_hdr" >&5
+echo "configure:15716: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15718 "configure"
+#line 15721 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ol_with_threads=found
echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:15753: checking for cthread_fork" >&5
+echo "configure:15756: checking for cthread_fork" >&5
if eval "test \"\${ac_cv_func_cthread_fork+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15758 "configure"
+#line 15761 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char cthread_fork(); below. */
; return 0; }
EOF
-if { (eval echo configure:15782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_cthread_fork=yes"
else
if test $ol_link_threads = no ; then
echo $ac_n "checking for cthread_fork with -all_load""... $ac_c" 1>&6
-echo "configure:15804: checking for cthread_fork with -all_load" >&5
+echo "configure:15807: checking for cthread_fork with -all_load" >&5
if eval "test \"\${ol_cv_cthread_all_load+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
save_LIBS="$LIBS"
LIBS="-all_load $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 15812 "configure"
+#line 15815 "configure"
#include "confdefs.h"
#include <mach/cthreads.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:15821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_cthread_all_load=yes
else
save_LIBS="$LIBS"
LIBS="$LIBS -lthreads"
echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:15851: checking for cthread_fork" >&5
+echo "configure:15854: checking for cthread_fork" >&5
if eval "test \"\${ac_cv_func_cthread_fork+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15856 "configure"
+#line 15859 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char cthread_fork(); below. */
; return 0; }
EOF
-if { (eval echo configure:15880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_cthread_fork=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15930: checking for $ac_hdr" >&5
+echo "configure:15933: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 15935 "configure"
+#line 15938 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_pth_h = yes ; then
echo $ac_n "checking for pth_version in -lpth""... $ac_c" 1>&6
-echo "configure:15969: checking for pth_version in -lpth" >&5
+echo "configure:15972: checking for pth_version in -lpth" >&5
ac_lib_var=`echo pth'_'pth_version | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpth $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 15977 "configure"
+#line 15980 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pth_version()
; return 0; }
EOF
-if { (eval echo configure:15988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16033: checking for $ac_hdr" >&5
+echo "configure:16036: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16038 "configure"
+#line 16041 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:16071: checking for thr_create in -lthread" >&5
+echo "configure:16074: checking for thr_create in -lthread" >&5
ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 16079 "configure"
+#line 16082 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
thr_create()
; return 0; }
EOF
-if { (eval echo configure:16090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16130: checking for $ac_func" >&5
+echo "configure:16133: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16135 "configure"
+#line 16138 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:16159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16190: checking for $ac_hdr" >&5
+echo "configure:16193: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16195 "configure"
+#line 16198 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_lwp_lwp_h = yes ; then
echo $ac_n "checking for lwp_create in -llwp""... $ac_c" 1>&6
-echo "configure:16228: checking for lwp_create in -llwp" >&5
+echo "configure:16231: checking for lwp_create in -llwp" >&5
ac_lib_var=`echo lwp'_'lwp_create | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-llwp $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 16236 "configure"
+#line 16239 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
lwp_create()
; return 0; }
EOF
-if { (eval echo configure:16247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16300: checking for $ac_hdr" >&5
+echo "configure:16303: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16305 "configure"
+#line 16308 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in sched_yield pthread_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16339: checking for $ac_func" >&5
+echo "configure:16342: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16344 "configure"
+#line 16347 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:16368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:16394: checking for LinuxThreads pthread.h" >&5
+echo "configure:16397: checking for LinuxThreads pthread.h" >&5
if eval "test \"\${ol_cv_header_linux_threads+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16399 "configure"
+#line 16402 "configure"
#include "confdefs.h"
#include <pthread.h>
EOF
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16429: checking for $ac_hdr" >&5
+echo "configure:16432: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16434 "configure"
+#line 16437 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16439: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16469: checking for $ac_hdr" >&5
+echo "configure:16472: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16474 "configure"
+#line 16477 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16509: checking for $ac_hdr" >&5
+echo "configure:16512: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16514 "configure"
+#line 16517 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
-echo "configure:16578: checking for thread specific errno" >&5
+echo "configure:16581: checking for thread specific errno" >&5
if eval "test \"\${ol_cv_errno_thread_specific+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16584 "configure"
+#line 16587 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
errno = 0;
; return 0; }
EOF
-if { (eval echo configure:16591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_errno_thread_specific=yes
else
echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6
echo $ac_n "checking for thread specific h_errno""... $ac_c" 1>&6
-echo "configure:16607: checking for thread specific h_errno" >&5
+echo "configure:16610: checking for thread specific h_errno" >&5
if eval "test \"\${ol_cv_h_errno_thread_specific+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16613 "configure"
+#line 16616 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
h_errno = 0;
; return 0; }
EOF
-if { (eval echo configure:16620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_h_errno_thread_specific=yes
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16673: checking for $ac_func" >&5
+echo "configure:16676: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16678 "configure"
+#line 16681 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:16702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
ol_cv_func_ctime_r_nargs=0
else
echo $ac_n "checking number of arguments of ctime_r""... $ac_c" 1>&6
-echo "configure:16731: checking number of arguments of ctime_r" >&5
+echo "configure:16734: checking number of arguments of ctime_r" >&5
if eval "test \"\${ol_cv_func_ctime_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16736 "configure"
+#line 16739 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t ti; char *buffer; ctime_r(&ti,buffer,32);
; return 0; }
EOF
-if { (eval echo configure:16743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_ctime_r_nargs3=yes
else
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 16755 "configure"
+#line 16758 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t ti; char *buffer; ctime_r(&ti,buffer);
; return 0; }
EOF
-if { (eval echo configure:16762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_ctime_r_nargs2=yes
else
if test "$ac_cv_func_gethostbyname_r" = yes ; then
echo $ac_n "checking number of arguments of gethostbyname_r""... $ac_c" 1>&6
-echo "configure:16802: checking number of arguments of gethostbyname_r" >&5
+echo "configure:16805: checking number of arguments of gethostbyname_r" >&5
if eval "test \"\${ol_cv_func_gethostbyname_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16807 "configure"
+#line 16810 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
buffer, bufsize, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:16821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyname_r_nargs5=yes
else
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 16833 "configure"
+#line 16836 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
&rhent, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:16848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyname_r_nargs6=yes
else
if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
echo $ac_n "checking number of arguments of gethostbyaddr_r""... $ac_c" 1>&6
-echo "configure:16889: checking number of arguments of gethostbyaddr_r" >&5
+echo "configure:16892: checking number of arguments of gethostbyaddr_r" >&5
if eval "test \"\${ol_cv_func_gethostbyaddr_r_nargs+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16894 "configure"
+#line 16897 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
alen, AF_INET, &hent, buffer, bufsize, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:16910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyaddr_r_nargs7=yes
else
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 16922 "configure"
+#line 16925 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
&rhent, &h_errno);
; return 0; }
EOF
-if { (eval echo configure:16940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:16943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_func_gethostbyaddr_r_nargs8=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16990: checking for $ac_hdr" >&5
+echo "configure:16993: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 16995 "configure"
+#line 16998 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:17000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_db_185_h = yes -o $ac_cv_header_db_h = yes; then
echo $ac_n "checking if Berkeley DB header compatibility""... $ac_c" 1>&6
-echo "configure:17028: checking if Berkeley DB header compatibility" >&5
+echo "configure:17031: checking if Berkeley DB header compatibility" >&5
if eval "test \"\${ol_cv_header_db1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 17034 "configure"
+#line 17037 "configure"
#include "confdefs.h"
#if HAVE_DB_185_H
ol_cv_lib_db=no
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (default)""... $ac_c" 1>&6
-echo "configure:17071: checking for Berkeley DB link (default)" >&5
+echo "configure:17074: checking for Berkeley DB link (default)" >&5
if eval "test \"\${ol_cv_db_none+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17081 "configure"
+#line 17084 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_none=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb43)""... $ac_c" 1>&6
-echo "configure:17152: checking for Berkeley DB link (-ldb43)" >&5
+echo "configure:17155: checking for Berkeley DB link (-ldb43)" >&5
if eval "test \"\${ol_cv_db_db43+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17162 "configure"
+#line 17165 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db43=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-43)""... $ac_c" 1>&6
-echo "configure:17233: checking for Berkeley DB link (-ldb-43)" >&5
+echo "configure:17236: checking for Berkeley DB link (-ldb-43)" >&5
if eval "test \"\${ol_cv_db_db_43+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17243 "configure"
+#line 17246 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_43=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.3)""... $ac_c" 1>&6
-echo "configure:17314: checking for Berkeley DB link (-ldb-4.3)" >&5
+echo "configure:17317: checking for Berkeley DB link (-ldb-4.3)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17324 "configure"
+#line 17327 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-3)""... $ac_c" 1>&6
-echo "configure:17395: checking for Berkeley DB link (-ldb-4-3)" >&5
+echo "configure:17398: checking for Berkeley DB link (-ldb-4-3)" >&5
if eval "test \"\${ol_cv_db_db_4_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17405 "configure"
+#line 17408 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb42)""... $ac_c" 1>&6
-echo "configure:17476: checking for Berkeley DB link (-ldb42)" >&5
+echo "configure:17479: checking for Berkeley DB link (-ldb42)" >&5
if eval "test \"\${ol_cv_db_db42+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17486 "configure"
+#line 17489 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db42=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-42)""... $ac_c" 1>&6
-echo "configure:17557: checking for Berkeley DB link (-ldb-42)" >&5
+echo "configure:17560: checking for Berkeley DB link (-ldb-42)" >&5
if eval "test \"\${ol_cv_db_db_42+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17567 "configure"
+#line 17570 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_42=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.2)""... $ac_c" 1>&6
-echo "configure:17638: checking for Berkeley DB link (-ldb-4.2)" >&5
+echo "configure:17641: checking for Berkeley DB link (-ldb-4.2)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17648 "configure"
+#line 17651 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-2)""... $ac_c" 1>&6
-echo "configure:17719: checking for Berkeley DB link (-ldb-4-2)" >&5
+echo "configure:17722: checking for Berkeley DB link (-ldb-4-2)" >&5
if eval "test \"\${ol_cv_db_db_4_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17729 "configure"
+#line 17732 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
-echo "configure:17800: checking for Berkeley DB link (-ldb-4)" >&5
+echo "configure:17803: checking for Berkeley DB link (-ldb-4)" >&5
if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17810 "configure"
+#line 17813 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:17881: checking for Berkeley DB link (-ldb4)" >&5
+echo "configure:17884: checking for Berkeley DB link (-ldb4)" >&5
if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17891 "configure"
+#line 17894 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:17938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db4=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
-echo "configure:17962: checking for Berkeley DB link (-ldb)" >&5
+echo "configure:17965: checking for Berkeley DB link (-ldb)" >&5
if eval "test \"\${ol_cv_db_db+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 17972 "configure"
+#line 17975 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb41)""... $ac_c" 1>&6
-echo "configure:18043: checking for Berkeley DB link (-ldb41)" >&5
+echo "configure:18046: checking for Berkeley DB link (-ldb41)" >&5
if eval "test \"\${ol_cv_db_db41+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18053 "configure"
+#line 18056 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db41=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-41)""... $ac_c" 1>&6
-echo "configure:18124: checking for Berkeley DB link (-ldb-41)" >&5
+echo "configure:18127: checking for Berkeley DB link (-ldb-41)" >&5
if eval "test \"\${ol_cv_db_db_41+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18134 "configure"
+#line 18137 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_41=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.1)""... $ac_c" 1>&6
-echo "configure:18205: checking for Berkeley DB link (-ldb-4.1)" >&5
+echo "configure:18208: checking for Berkeley DB link (-ldb-4.1)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18215 "configure"
+#line 18218 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-1)""... $ac_c" 1>&6
-echo "configure:18286: checking for Berkeley DB link (-ldb-4-1)" >&5
+echo "configure:18289: checking for Berkeley DB link (-ldb-4-1)" >&5
if eval "test \"\${ol_cv_db_db_4_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18296 "configure"
+#line 18299 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
-echo "configure:18367: checking for Berkeley DB link (-ldb3)" >&5
+echo "configure:18370: checking for Berkeley DB link (-ldb3)" >&5
if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18377 "configure"
+#line 18380 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-3)""... $ac_c" 1>&6
-echo "configure:18448: checking for Berkeley DB link (-ldb-3)" >&5
+echo "configure:18451: checking for Berkeley DB link (-ldb-3)" >&5
if eval "test \"\${ol_cv_db_db_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18458 "configure"
+#line 18461 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
-echo "configure:18529: checking for Berkeley DB link (-ldb2)" >&5
+echo "configure:18532: checking for Berkeley DB link (-ldb2)" >&5
if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18539 "configure"
+#line 18542 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-2)""... $ac_c" 1>&6
-echo "configure:18610: checking for Berkeley DB link (-ldb-2)" >&5
+echo "configure:18613: checking for Berkeley DB link (-ldb-2)" >&5
if eval "test \"\${ol_cv_db_db_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18620 "configure"
+#line 18623 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
-echo "configure:18691: checking for Berkeley DB link (-ldb1)" >&5
+echo "configure:18694: checking for Berkeley DB link (-ldb1)" >&5
if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18701 "configure"
+#line 18704 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-1)""... $ac_c" 1>&6
-echo "configure:18772: checking for Berkeley DB link (-ldb-1)" >&5
+echo "configure:18775: checking for Berkeley DB link (-ldb-1)" >&5
if eval "test \"\${ol_cv_db_db_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18782 "configure"
+#line 18785 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_1=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:18864: checking for $ac_hdr" >&5
+echo "configure:18867: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 18869 "configure"
+#line 18872 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:18877: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ol_cv_lib_db=no
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (default)""... $ac_c" 1>&6
-echo "configure:18904: checking for Berkeley DB link (default)" >&5
+echo "configure:18907: checking for Berkeley DB link (default)" >&5
if eval "test \"\${ol_cv_db_none+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18914 "configure"
+#line 18917 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:18961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_none=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb43)""... $ac_c" 1>&6
-echo "configure:18985: checking for Berkeley DB link (-ldb43)" >&5
+echo "configure:18988: checking for Berkeley DB link (-ldb43)" >&5
if eval "test \"\${ol_cv_db_db43+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 18995 "configure"
+#line 18998 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db43=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-43)""... $ac_c" 1>&6
-echo "configure:19066: checking for Berkeley DB link (-ldb-43)" >&5
+echo "configure:19069: checking for Berkeley DB link (-ldb-43)" >&5
if eval "test \"\${ol_cv_db_db_43+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19076 "configure"
+#line 19079 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_43=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.3)""... $ac_c" 1>&6
-echo "configure:19147: checking for Berkeley DB link (-ldb-4.3)" >&5
+echo "configure:19150: checking for Berkeley DB link (-ldb-4.3)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19157 "configure"
+#line 19160 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-3)""... $ac_c" 1>&6
-echo "configure:19228: checking for Berkeley DB link (-ldb-4-3)" >&5
+echo "configure:19231: checking for Berkeley DB link (-ldb-4-3)" >&5
if eval "test \"\${ol_cv_db_db_4_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19238 "configure"
+#line 19241 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb42)""... $ac_c" 1>&6
-echo "configure:19309: checking for Berkeley DB link (-ldb42)" >&5
+echo "configure:19312: checking for Berkeley DB link (-ldb42)" >&5
if eval "test \"\${ol_cv_db_db42+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19319 "configure"
+#line 19322 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db42=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-42)""... $ac_c" 1>&6
-echo "configure:19390: checking for Berkeley DB link (-ldb-42)" >&5
+echo "configure:19393: checking for Berkeley DB link (-ldb-42)" >&5
if eval "test \"\${ol_cv_db_db_42+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19400 "configure"
+#line 19403 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_42=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.2)""... $ac_c" 1>&6
-echo "configure:19471: checking for Berkeley DB link (-ldb-4.2)" >&5
+echo "configure:19474: checking for Berkeley DB link (-ldb-4.2)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19481 "configure"
+#line 19484 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-2)""... $ac_c" 1>&6
-echo "configure:19552: checking for Berkeley DB link (-ldb-4-2)" >&5
+echo "configure:19555: checking for Berkeley DB link (-ldb-4-2)" >&5
if eval "test \"\${ol_cv_db_db_4_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19562 "configure"
+#line 19565 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4)""... $ac_c" 1>&6
-echo "configure:19633: checking for Berkeley DB link (-ldb-4)" >&5
+echo "configure:19636: checking for Berkeley DB link (-ldb-4)" >&5
if eval "test \"\${ol_cv_db_db_4+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19643 "configure"
+#line 19646 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:19714: checking for Berkeley DB link (-ldb4)" >&5
+echo "configure:19717: checking for Berkeley DB link (-ldb4)" >&5
if eval "test \"\${ol_cv_db_db4+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19724 "configure"
+#line 19727 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db4=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
-echo "configure:19795: checking for Berkeley DB link (-ldb)" >&5
+echo "configure:19798: checking for Berkeley DB link (-ldb)" >&5
if eval "test \"\${ol_cv_db_db+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19805 "configure"
+#line 19808 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb41)""... $ac_c" 1>&6
-echo "configure:19876: checking for Berkeley DB link (-ldb41)" >&5
+echo "configure:19879: checking for Berkeley DB link (-ldb41)" >&5
if eval "test \"\${ol_cv_db_db41+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19886 "configure"
+#line 19889 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:19933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db41=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-41)""... $ac_c" 1>&6
-echo "configure:19957: checking for Berkeley DB link (-ldb-41)" >&5
+echo "configure:19960: checking for Berkeley DB link (-ldb-41)" >&5
if eval "test \"\${ol_cv_db_db_41+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 19967 "configure"
+#line 19970 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_41=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4.1)""... $ac_c" 1>&6
-echo "configure:20038: checking for Berkeley DB link (-ldb-4.1)" >&5
+echo "configure:20041: checking for Berkeley DB link (-ldb-4.1)" >&5
if eval "test \"\${ol_cv_db_db_4_dot_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20048 "configure"
+#line 20051 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_dot_1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-4-1)""... $ac_c" 1>&6
-echo "configure:20119: checking for Berkeley DB link (-ldb-4-1)" >&5
+echo "configure:20122: checking for Berkeley DB link (-ldb-4-1)" >&5
if eval "test \"\${ol_cv_db_db_4_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20129 "configure"
+#line 20132 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_4_1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
-echo "configure:20200: checking for Berkeley DB link (-ldb3)" >&5
+echo "configure:20203: checking for Berkeley DB link (-ldb3)" >&5
if eval "test \"\${ol_cv_db_db3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20210 "configure"
+#line 20213 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-3)""... $ac_c" 1>&6
-echo "configure:20281: checking for Berkeley DB link (-ldb-3)" >&5
+echo "configure:20284: checking for Berkeley DB link (-ldb-3)" >&5
if eval "test \"\${ol_cv_db_db_3+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20291 "configure"
+#line 20294 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_3=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
-echo "configure:20362: checking for Berkeley DB link (-ldb2)" >&5
+echo "configure:20365: checking for Berkeley DB link (-ldb2)" >&5
if eval "test \"\${ol_cv_db_db2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20372 "configure"
+#line 20375 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-2)""... $ac_c" 1>&6
-echo "configure:20443: checking for Berkeley DB link (-ldb-2)" >&5
+echo "configure:20446: checking for Berkeley DB link (-ldb-2)" >&5
if eval "test \"\${ol_cv_db_db_2+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20453 "configure"
+#line 20456 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_2=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
-echo "configure:20524: checking for Berkeley DB link (-ldb1)" >&5
+echo "configure:20527: checking for Berkeley DB link (-ldb1)" >&5
if eval "test \"\${ol_cv_db_db1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20534 "configure"
+#line 20537 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db1=yes
else
if test $ol_cv_lib_db = no ; then
echo $ac_n "checking for Berkeley DB link (-ldb-1)""... $ac_c" 1>&6
-echo "configure:20605: checking for Berkeley DB link (-ldb-1)" >&5
+echo "configure:20608: checking for Berkeley DB link (-ldb-1)" >&5
if eval "test \"\${ol_cv_db_db_1+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 20615 "configure"
+#line 20618 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
; return 0; }
EOF
-if { (eval echo configure:20662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_db_db_1=yes
else
if test "$ol_cv_lib_db" != no ; then
ol_cv_berkeley_db=yes
echo $ac_n "checking for Berkeley DB version match""... $ac_c" 1>&6
-echo "configure:20688: checking for Berkeley DB version match" >&5
+echo "configure:20691: checking for Berkeley DB version match" >&5
if eval "test \"\${ol_cv_berkeley_db_version+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_berkeley_db_version=cross
else
cat > conftest.$ac_ext <<EOF
-#line 20703 "configure"
+#line 20706 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
return 0;
}
EOF
-if { (eval echo configure:20739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:20742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_berkeley_db_version=yes
else
fi
echo $ac_n "checking for Berkeley DB thread support""... $ac_c" 1>&6
-echo "configure:20763: checking for Berkeley DB thread support" >&5
+echo "configure:20766: checking for Berkeley DB thread support" >&5
if eval "test \"\${ol_cv_berkeley_db_thread+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_berkeley_db_thread=cross
else
cat > conftest.$ac_ext <<EOF
-#line 20778 "configure"
+#line 20781 "configure"
#include "confdefs.h"
#ifdef HAVE_DB_185_H
return rc;
}
EOF
-if { (eval echo configure:20845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:20848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_berkeley_db_thread=yes
else
{ echo "configure: error: BDB/HDB: BerkeleyDB not available" 1>&2; exit 1; }
else
echo $ac_n "checking Berkeley DB version for BDB backend""... $ac_c" 1>&6
-echo "configure:20908: checking Berkeley DB version for BDB backend" >&5
+echo "configure:20911: checking Berkeley DB version for BDB backend" >&5
if eval "test \"\${ol_cv_bdb_compat+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 20914 "configure"
+#line 20917 "configure"
#include "confdefs.h"
#include <db.h>
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
echo $ac_n "checking for MDBM library""... $ac_c" 1>&6
-echo "configure:20961: checking for MDBM library" >&5
+echo "configure:20964: checking for MDBM library" >&5
if eval "test \"\${ol_cv_lib_mdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for mdbm_set_chain""... $ac_c" 1>&6
-echo "configure:20967: checking for mdbm_set_chain" >&5
+echo "configure:20970: checking for mdbm_set_chain" >&5
if eval "test \"\${ac_cv_func_mdbm_set_chain+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 20972 "configure"
+#line 20975 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mdbm_set_chain(); below. */
; return 0; }
EOF
-if { (eval echo configure:20996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_mdbm_set_chain=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for mdbm_set_chain in -lmdbm""... $ac_c" 1>&6
-echo "configure:21015: checking for mdbm_set_chain in -lmdbm" >&5
+echo "configure:21018: checking for mdbm_set_chain in -lmdbm" >&5
ac_lib_var=`echo mdbm'_'mdbm_set_chain | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lmdbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21023 "configure"
+#line 21026 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
mdbm_set_chain()
; return 0; }
EOF
-if { (eval echo configure:21034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21069: checking for $ac_hdr" >&5
+echo "configure:21072: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21074 "configure"
+#line 21077 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:21106: checking for db" >&5
+echo "configure:21109: checking for db" >&5
if eval "test \"\${ol_cv_mdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
echo $ac_n "checking for GDBM library""... $ac_c" 1>&6
-echo "configure:21139: checking for GDBM library" >&5
+echo "configure:21142: checking for GDBM library" >&5
if eval "test \"\${ol_cv_lib_gdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for gdbm_open""... $ac_c" 1>&6
-echo "configure:21145: checking for gdbm_open" >&5
+echo "configure:21148: checking for gdbm_open" >&5
if eval "test \"\${ac_cv_func_gdbm_open+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21150 "configure"
+#line 21153 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gdbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:21174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gdbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:21193: checking for gdbm_open in -lgdbm" >&5
+echo "configure:21196: checking for gdbm_open in -lgdbm" >&5
ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgdbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21201 "configure"
+#line 21204 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gdbm_open()
; return 0; }
EOF
-if { (eval echo configure:21212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21247: checking for $ac_hdr" >&5
+echo "configure:21250: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21252 "configure"
+#line 21255 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:21284: checking for db" >&5
+echo "configure:21287: checking for db" >&5
if eval "test \"\${ol_cv_gdbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test $ol_with_ldbm_api = ndbm ; then
echo $ac_n "checking for NDBM library""... $ac_c" 1>&6
-echo "configure:21318: checking for NDBM library" >&5
+echo "configure:21321: checking for NDBM library" >&5
if eval "test \"\${ol_cv_lib_ndbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_LIBS="$LIBS"
echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:21324: checking for dbm_open" >&5
+echo "configure:21327: checking for dbm_open" >&5
if eval "test \"\${ac_cv_func_dbm_open+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21329 "configure"
+#line 21332 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:21353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:21372: checking for dbm_open in -lndbm" >&5
+echo "configure:21375: checking for dbm_open in -lndbm" >&5
ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lndbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21380 "configure"
+#line 21383 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:21391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:21411: checking for dbm_open in -ldbm" >&5
+echo "configure:21414: checking for dbm_open in -ldbm" >&5
ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21419 "configure"
+#line 21422 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:21430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21467: checking for $ac_hdr" >&5
+echo "configure:21470: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21472 "configure"
+#line 21475 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:21504: checking for db" >&5
+echo "configure:21507: checking for db" >&5
if eval "test \"\${ol_cv_ndbm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21564: checking for $ac_hdr" >&5
+echo "configure:21567: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21569 "configure"
+#line 21572 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
EOF
echo $ac_n "checking for TCP wrappers library""... $ac_c" 1>&6
-echo "configure:21596: checking for TCP wrappers library" >&5
+echo "configure:21599: checking for TCP wrappers library" >&5
save_LIBS="$LIBS"
LIBS="$LIBS -lwrap"
cat > conftest.$ac_ext <<EOF
-#line 21600 "configure"
+#line 21603 "configure"
#include "confdefs.h"
#include <tcpd.h>
; return 0; }
EOF
-if { (eval echo configure:21615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""-lwrap" 1>&6
have_wrappers=yes
LIBS="$LIBS -lnsl"
cat > conftest.$ac_ext <<EOF
-#line 21627 "configure"
+#line 21630 "configure"
#include "confdefs.h"
#include <tcpd.h>
; return 0; }
EOF
-if { (eval echo configure:21642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""-lwrap -lnsl" 1>&6
have_wrappers=yes
if test $ol_enable_syslog != no ; then
echo $ac_n "checking for openlog""... $ac_c" 1>&6
-echo "configure:21682: checking for openlog" >&5
+echo "configure:21685: checking for openlog" >&5
if eval "test \"\${ac_cv_func_openlog+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21687 "configure"
+#line 21690 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char openlog(); below. */
; return 0; }
EOF
-if { (eval echo configure:21711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_openlog=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21743: checking for $ac_hdr" >&5
+echo "configure:21746: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21748 "configure"
+#line 21751 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21753: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
LIBS="$LTHREAD_LIBS"
echo $ac_n "checking for SQLDriverConnect in -liodbc""... $ac_c" 1>&6
-echo "configure:21786: checking for SQLDriverConnect in -liodbc" >&5
+echo "configure:21789: checking for SQLDriverConnect in -liodbc" >&5
ac_lib_var=`echo iodbc'_'SQLDriverConnect | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-liodbc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21794 "configure"
+#line 21797 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SQLDriverConnect()
; return 0; }
EOF
-if { (eval echo configure:21805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ol_link_sql="-liodbc"
else
echo $ac_n "checking for SQLDriverConnect in -lodbc""... $ac_c" 1>&6
-echo "configure:21830: checking for SQLDriverConnect in -lodbc" >&5
+echo "configure:21833: checking for SQLDriverConnect in -lodbc" >&5
ac_lib_var=`echo odbc'_'SQLDriverConnect | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lodbc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21838 "configure"
+#line 21841 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SQLDriverConnect()
; return 0; }
EOF
-if { (eval echo configure:21849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:21893: checking for $ac_hdr" >&5
+echo "configure:21896: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 21898 "configure"
+#line 21901 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:21903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:21906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_sasl_sasl_h = yes -o $ac_cv_header_sasl_h = yes; then
echo $ac_n "checking for sasl_client_init in -lsasl2""... $ac_c" 1>&6
-echo "configure:21932: checking for sasl_client_init in -lsasl2" >&5
+echo "configure:21935: checking for sasl_client_init in -lsasl2" >&5
ac_lib_var=`echo sasl2'_'sasl_client_init | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsasl2 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21940 "configure"
+#line 21943 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sasl_client_init()
; return 0; }
EOF
-if { (eval echo configure:21951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sasl_client_init in -lsasl""... $ac_c" 1>&6
-echo "configure:21970: checking for sasl_client_init in -lsasl" >&5
+echo "configure:21973: checking for sasl_client_init in -lsasl" >&5
ac_lib_var=`echo sasl'_'sasl_client_init | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lsasl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 21978 "configure"
+#line 21981 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sasl_client_init()
; return 0; }
EOF
-if { (eval echo configure:21989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
else
echo $ac_n "checking Cyrus SASL library version""... $ac_c" 1>&6
-echo "configure:22025: checking Cyrus SASL library version" >&5
+echo "configure:22028: checking Cyrus SASL library version" >&5
if eval "test \"\${ol_cv_sasl_compat+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22031 "configure"
+#line 22034 "configure"
#include "confdefs.h"
#ifdef HAVE_SASL_SASL_H
ac_save_LIBS="$LIBS"
LIBS="$LIBS $ol_link_sasl"
echo $ac_n "checking for sasl_version""... $ac_c" 1>&6
-echo "configure:22080: checking for sasl_version" >&5
+echo "configure:22083: checking for sasl_version" >&5
if eval "test \"\${ac_cv_func_sasl_version+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22085 "configure"
+#line 22088 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sasl_version(); below. */
; return 0; }
EOF
-if { (eval echo configure:22109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_sasl_version=yes"
else
ol_LIBS=$LIBS
LIBS="-lfetch -lcom_err $LIBS"
echo $ac_n "checking fetch(3) library""... $ac_c" 1>&6
-echo "configure:22170: checking fetch(3) library" >&5
+echo "configure:22173: checking fetch(3) library" >&5
if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22176 "configure"
+#line 22179 "configure"
#include "confdefs.h"
#include <sys/param.h>
struct url *u = fetchParseURL("file:///");
; return 0; }
EOF
-if { (eval echo configure:22186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_lib_fetch=yes
else
LIBS="$TLS_LIBS $LIBS"
echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:22223: checking for crypt" >&5
+echo "configure:22226: checking for crypt" >&5
if eval "test \"\${ac_cv_func_crypt+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22228 "configure"
+#line 22231 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char crypt(); below. */
; return 0; }
EOF
-if { (eval echo configure:22252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_crypt=yes"
else
LIBS="$save_LIBS"
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:22272: checking for crypt in -lcrypt" >&5
+echo "configure:22275: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 22280 "configure"
+#line 22283 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
crypt()
; return 0; }
EOF
-if { (eval echo configure:22291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test $ol_enable_proctitle != no ; then
echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:22336: checking for setproctitle" >&5
+echo "configure:22339: checking for setproctitle" >&5
if eval "test \"\${ac_cv_func_setproctitle+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22341 "configure"
+#line 22344 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char setproctitle(); below. */
; return 0; }
EOF
-if { (eval echo configure:22365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_setproctitle=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:22384: checking for setproctitle in -lutil" >&5
+echo "configure:22387: checking for setproctitle in -lutil" >&5
ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lutil $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 22392 "configure"
+#line 22395 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
setproctitle()
; return 0; }
EOF
-if { (eval echo configure:22403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:22443: checking for $ac_hdr" >&5
+echo "configure:22446: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22448 "configure"
+#line 22451 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:22453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:22456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_slp_h = yes ; then
echo $ac_n "checking for SLPOpen in -lslp""... $ac_c" 1>&6
-echo "configure:22482: checking for SLPOpen in -lslp" >&5
+echo "configure:22485: checking for SLPOpen in -lslp" >&5
ac_lib_var=`echo slp'_'SLPOpen | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lslp $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 22490 "configure"
+#line 22493 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
SLPOpen()
; return 0; }
EOF
-if { (eval echo configure:22501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:22543: checking for $ac_hdr" >&5
+echo "configure:22546: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22548 "configure"
+#line 22551 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:22553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:22556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:22583: checking for $ac_hdr" >&5
+echo "configure:22586: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22588 "configure"
+#line 22591 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:22593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:22596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:22623: checking for $ac_hdr" >&5
+echo "configure:22626: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22628 "configure"
+#line 22631 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:22633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:22636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_gmp_h = yes ; then
echo $ac_n "checking for __gmpz_add_ui in -lgmp""... $ac_c" 1>&6
-echo "configure:22682: checking for __gmpz_add_ui in -lgmp" >&5
+echo "configure:22685: checking for __gmpz_add_ui in -lgmp" >&5
ac_lib_var=`echo gmp'_'__gmpz_add_ui | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lgmp $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 22690 "configure"
+#line 22693 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
__gmpz_add_ui()
; return 0; }
EOF
-if { (eval echo configure:22701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for multiple precision support""... $ac_c" 1>&6
-echo "configure:22728: checking for multiple precision support" >&5
+echo "configure:22731: checking for multiple precision support" >&5
ol_mp_support="none"
case "$ol_with_multiple_precision" in
echo $ac_n "checking long long""... $ac_c" 1>&6
-echo "configure:22787: checking long long" >&5
+echo "configure:22790: checking long long" >&5
if eval "test \"\${ol_cv_type_long_long+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22793 "configure"
+#line 22796 "configure"
#include "confdefs.h"
int main() {
long long x;
; return 0; }
EOF
-if { (eval echo configure:22800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_type_long_long=yes
else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:22821: checking for ANSI C header files" >&5
+echo "configure:22824: checking for ANSI C header files" >&5
if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22826 "configure"
+#line 22829 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:22834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:22837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 22851 "configure"
+#line 22854 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 22869 "configure"
+#line 22872 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 22890 "configure"
+#line 22893 "configure"
#include "confdefs.h"
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
exit (0); }
EOF
-if { (eval echo configure:22908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:22911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
:
else
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:22932: checking for mode_t" >&5
+echo "configure:22935: checking for mode_t" >&5
if eval "test \"\${ac_cv_type_mode_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22937 "configure"
+#line 22940 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:22968: checking for off_t" >&5
+echo "configure:22971: checking for off_t" >&5
if eval "test \"\${ac_cv_type_off_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 22973 "configure"
+#line 22976 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:23004: checking for pid_t" >&5
+echo "configure:23007: checking for pid_t" >&5
if eval "test \"\${ac_cv_type_pid_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23009 "configure"
+#line 23012 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:23040: checking for ptrdiff_t" >&5
+echo "configure:23043: checking for ptrdiff_t" >&5
if eval "test \"\${am_cv_type_ptrdiff_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23045 "configure"
+#line 23048 "configure"
#include "confdefs.h"
#include <stddef.h>
int main() {
ptrdiff_t p
; return 0; }
EOF
-if { (eval echo configure:23052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_type_ptrdiff_t=yes
else
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:23073: checking return type of signal handlers" >&5
+echo "configure:23076: checking return type of signal handlers" >&5
if eval "test \"\${ac_cv_type_signal+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23078 "configure"
+#line 23081 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:23095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:23114: checking for size_t" >&5
+echo "configure:23117: checking for size_t" >&5
if eval "test \"\${ac_cv_type_size_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23119 "configure"
+#line 23122 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:23151: checking for ssize_t" >&5
+echo "configure:23154: checking for ssize_t" >&5
if eval "test \"\${ac_cv_type_ssize_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23156 "configure"
+#line 23159 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for caddr_t""... $ac_c" 1>&6
-echo "configure:23187: checking for caddr_t" >&5
+echo "configure:23190: checking for caddr_t" >&5
if eval "test \"\${ac_cv_type_caddr_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23192 "configure"
+#line 23195 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:23224: checking for socklen_t" >&5
+echo "configure:23227: checking for socklen_t" >&5
if eval "test \"\${ol_cv_type_socklen_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23229 "configure"
+#line 23232 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
socklen_t len;
; return 0; }
EOF
-if { (eval echo configure:23243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_type_socklen_t=yes
else
fi
echo $ac_n "checking for member st_blksize in aggregate type struct stat""... $ac_c" 1>&6
-echo "configure:23264: checking for member st_blksize in aggregate type struct stat" >&5
+echo "configure:23267: checking for member st_blksize in aggregate type struct stat" >&5
if eval "test \"\${ac_cv_c_struct_member_st_blksize+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23269 "configure"
+#line 23272 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat foo; foo.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:23277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_struct_member_st_blksize=yes
else
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:23299: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:23302: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"\${ac_cv_header_time+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23304 "configure"
+#line 23307 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:23313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:23334: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:23337: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"\${ac_cv_struct_tm+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23339 "configure"
+#line 23342 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:23347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:23368: checking for uid_t in sys/types.h" >&5
+echo "configure:23371: checking for uid_t in sys/types.h" >&5
if eval "test \"\${ac_cv_type_uid_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23373 "configure"
+#line 23376 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
-echo "configure:23402: checking for sig_atomic_t" >&5
+echo "configure:23405: checking for sig_atomic_t" >&5
if eval "test \"\${ol_cv_type_sig_atomic_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23407 "configure"
+#line 23410 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
sig_atomic_t atomic;
; return 0; }
EOF
-if { (eval echo configure:23414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_type_sig_atomic_t=yes
else
# test for pw_gecos in struct passwd
echo $ac_n "checking struct passwd for pw_gecos""... $ac_c" 1>&6
-echo "configure:23438: checking struct passwd for pw_gecos" >&5
+echo "configure:23441: checking struct passwd for pw_gecos" >&5
if eval "test \"\${ol_cv_struct_passwd_pw_gecos+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23444 "configure"
+#line 23447 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:23454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_struct_passwd_pw_gecos=yes
else
# test for pw_passwd in struct passwd
echo $ac_n "checking struct passwd for pw_passwd""... $ac_c" 1>&6
-echo "configure:23476: checking struct passwd for pw_passwd" >&5
+echo "configure:23479: checking struct passwd for pw_passwd" >&5
if eval "test \"\${ol_cv_struct_passwd_pw_passwd+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23482 "configure"
+#line 23485 "configure"
#include "confdefs.h"
#include <pwd.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:23492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23495: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_struct_passwd_pw_passwd=yes
else
echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:23514: checking if toupper() requires islower()" >&5
+echo "configure:23517: checking if toupper() requires islower()" >&5
if eval "test \"\${ol_cv_c_upper_lower+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ol_cv_c_upper_lower=safe
else
cat > conftest.$ac_ext <<EOF
-#line 23523 "configure"
+#line 23526 "configure"
#include "confdefs.h"
#include <ctype.h>
exit(1);
}
EOF
-if { (eval echo configure:23535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:23538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ol_cv_c_upper_lower=no
else
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:23558: checking for working const" >&5
+echo "configure:23561: checking for working const" >&5
if eval "test \"\${ac_cv_c_const+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23563 "configure"
+#line 23566 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:23612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
-echo "configure:23633: checking if compiler understands volatile" >&5
+echo "configure:23636: checking if compiler understands volatile" >&5
if eval "test \"\${ol_cv_c_volatile+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 23638 "configure"
+#line 23641 "configure"
#include "confdefs.h"
int x, y, z;
int main() {
*b = 0;
; return 0; }
EOF
-if { (eval echo configure:23647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_c_volatile=yes
else
else
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:23678: checking whether byte ordering is bigendian" >&5
+echo "configure:23681: checking whether byte ordering is bigendian" >&5
if eval "test \"\${ac_cv_c_bigendian+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 23685 "configure"
+#line 23688 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:23696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 23700 "configure"
+#line 23703 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:23711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 23731 "configure"
+#line 23734 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:23744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:23747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ac_cv_c_bigendian=no
else
fi
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:23770: checking size of short" >&5
+echo "configure:23773: checking size of short" >&5
if eval "test \"\${ac_cv_sizeof_short+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 23776 "configure"
+#line 23779 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <stdlib.h>
switch (0) case 0: case (sizeof (short) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:23787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_short=$ac_size
else
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:23810: checking size of int" >&5
+echo "configure:23813: checking size of int" >&5
if eval "test \"\${ac_cv_sizeof_int+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 23816 "configure"
+#line 23819 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <stdlib.h>
switch (0) case 0: case (sizeof (int) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:23827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_int=$ac_size
else
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:23850: checking size of long" >&5
+echo "configure:23853: checking size of long" >&5
if eval "test \"\${ac_cv_sizeof_long+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 23856 "configure"
+#line 23859 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <stdlib.h>
switch (0) case 0: case (sizeof (long) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:23867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_long=$ac_size
else
echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6
-echo "configure:23890: checking size of wchar_t" >&5
+echo "configure:23893: checking size of wchar_t" >&5
if eval "test \"\${ac_cv_sizeof_wchar_t+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 23896 "configure"
+#line 23899 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <stdlib.h>
switch (0) case 0: case (sizeof (wchar_t) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:23907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:23910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_wchar_t=$ac_size
else
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:23958: checking for 8-bit clean memcmp" >&5
+echo "configure:23961: checking for 8-bit clean memcmp" >&5
if eval "test \"\${ac_cv_func_memcmp_clean+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 23966 "configure"
+#line 23969 "configure"
#include "confdefs.h"
main()
}
EOF
-if { (eval echo configure:23976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
+if { (eval echo configure:23979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>&5
then
ac_cv_func_memcmp_clean=yes
else
fi
echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:24002: checking for strftime" >&5
+echo "configure:24005: checking for strftime" >&5
if eval "test \"\${ac_cv_func_strftime+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24007 "configure"
+#line 24010 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strftime(); below. */
; return 0; }
EOF
-if { (eval echo configure:24031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strftime=yes"
else
echo "$ac_t""no" 1>&6
# strftime is in -lintl on SCO UNIX.
echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:24053: checking for strftime in -lintl" >&5
+echo "configure:24056: checking for strftime in -lintl" >&5
ac_lib_var=`echo intl'_'strftime | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 24061 "configure"
+#line 24064 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
strftime()
; return 0; }
EOF
-if { (eval echo configure:24072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for inet_aton()""... $ac_c" 1>&6
-echo "configure:24100: checking for inet_aton()" >&5
+echo "configure:24103: checking for inet_aton()" >&5
if eval "test \"\${ol_cv_func_inet_aton+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24105 "configure"
+#line 24108 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
int rc = inet_aton( "255.255.255.255", &in );
; return 0; }
EOF
-if { (eval echo configure:24127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_func_inet_aton=yes
else
echo $ac_n "checking for _spawnlp""... $ac_c" 1>&6
-echo "configure:24149: checking for _spawnlp" >&5
+echo "configure:24152: checking for _spawnlp" >&5
if eval "test \"\${ac_cv_func__spawnlp+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24154 "configure"
+#line 24157 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _spawnlp(); below. */
; return 0; }
EOF
-if { (eval echo configure:24178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__spawnlp=yes"
else
echo $ac_n "checking for _snprintf""... $ac_c" 1>&6
-echo "configure:24202: checking for _snprintf" >&5
+echo "configure:24205: checking for _snprintf" >&5
if eval "test \"\${ac_cv_func__snprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24207 "configure"
+#line 24210 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _snprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:24231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__snprintf=yes"
else
echo $ac_n "checking for _vsnprintf""... $ac_c" 1>&6
-echo "configure:24257: checking for _vsnprintf" >&5
+echo "configure:24260: checking for _vsnprintf" >&5
if eval "test \"\${ac_cv_func__vsnprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24262 "configure"
+#line 24265 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _vsnprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:24286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__vsnprintf=yes"
else
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:24312: checking for vprintf" >&5
+echo "configure:24315: checking for vprintf" >&5
if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24317 "configure"
+#line 24320 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:24341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:24365: checking for _doprnt" >&5
+echo "configure:24368: checking for _doprnt" >&5
if eval "test \"\${ac_cv_func__doprnt+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24370 "configure"
+#line 24373 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:24394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
for ac_func in snprintf vsnprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:24423: checking for $ac_func" >&5
+echo "configure:24426: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24428 "configure"
+#line 24431 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:24452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:24535: checking for $ac_func" >&5
+echo "configure:24538: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24540 "configure"
+#line 24543 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:24564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in getopt getpeereid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:24592: checking for $ac_func" >&5
+echo "configure:24595: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24597 "configure"
+#line 24600 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:24621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
fi
if test "$ac_cv_func_getpeereid" != yes; then
echo $ac_n "checking for msg_accrights in msghdr""... $ac_c" 1>&6
-echo "configure:24653: checking for msg_accrights in msghdr" >&5
+echo "configure:24656: checking for msg_accrights in msghdr" >&5
if eval "test \"\${ol_cv_msghdr_msg_accrights+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24658 "configure"
+#line 24661 "configure"
#include "confdefs.h"
#include <sys/socket.h>
int main() {
struct msghdr m; m.msg_accrightslen=0
; return 0; }
EOF
-if { (eval echo configure:24665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:24668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_msghdr_msg_accrights=yes
else
if test "$ac_cv_func_getpeereid" != yes; then
echo $ac_n "checking for msg_control in msghdr""... $ac_c" 1>&6
-echo "configure:24688: checking for msg_control in msghdr" >&5
+echo "configure:24691: checking for msg_control in msghdr" >&5
if eval "test \"\${ol_cv_msghdr_msg_control+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24693 "configure"
+#line 24696 "configure"
#include "confdefs.h"
#include <sys/socket.h>
int main() {
struct msghdr m; m.msg_control=(struct cmsghdr *)0
; return 0; }
EOF
-if { (eval echo configure:24700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:24703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_msghdr_msg_control=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:24745: checking for $ac_hdr" >&5
+echo "configure:24748: checking for $ac_hdr" >&5
if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 24750 "configure"
+#line 24753 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:24755: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:24758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
{ echo "configure: error: could not locate <ltdl.h>" 1>&2; exit 1; }
fi
echo $ac_n "checking for lt_dlinit in -lltdl""... $ac_c" 1>&6
-echo "configure:24786: checking for lt_dlinit in -lltdl" >&5
+echo "configure:24789: checking for lt_dlinit in -lltdl" >&5
ac_lib_var=`echo ltdl'_'lt_dlinit | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lltdl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 24794 "configure"
+#line 24797 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
lt_dlinit()
; return 0; }
EOF
-if { (eval echo configure:24805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:24808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
+if test "$ol_enable_retcode" != no ; then
+ BUILD_RETCODE=$ol_enable_retcode
+ if test "$ol_enable_retcode" = mod ; then
+ MFLAG=SLAPD_MOD_DYNAMIC
+ SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS retcode.la"
+ else
+ MFLAG=SLAPD_MOD_STATIC
+ SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS retcode.o"
+ fi
+ cat >> confdefs.h <<EOF
+#define SLAPD_OVER_RETCODE $MFLAG
+EOF
+
+fi
+
if test "$ol_enable_rwm" != no ; then
BUILD_REWRITE=yes
BUILD_RWM=$ol_enable_rwm
+
s%@BUILD_PPOLICY@%$BUILD_PPOLICY%g
s%@BUILD_PROXYCACHE@%$BUILD_PROXYCACHE%g
s%@BUILD_REFINT@%$BUILD_REFINT%g
+s%@BUILD_RETCODE@%$BUILD_RETCODE%g
s%@BUILD_RWM@%$BUILD_RWM%g
s%@BUILD_SYNCPROV@%$BUILD_SYNCPROV%g
s%@BUILD_TRANSLUCENT@%$BUILD_TRANSLUCENT%g
#define LDAP_CONTROL_X_SEARCH_OPTIONS "1.2.840.113556.1.4.1340"
#define LDAP_SEARCH_FLAG_DOMAIN_SCOPE 1 /* do not generate referrals */
#define LDAP_SEARCH_FLAG_PHANTOM_ROOT 2 /* search all NCs subordinate to base */
+#define LDAP_CONTROL_X_EXTENDED_DN "1.2.840.113556.1.4.529"
/* LDAP Unsolicited Notifications */
#define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" /* RFC 2251 */
* LDAP Transactions
* in txn.c
*/
-#ifdef LDAP_GROUPING_TRANSACTION
+#ifdef LDAP_GROUP_TRANSACTION
LDAP_F( int )
ldap_parse_txn_create LDAP_P((
LDAP *ld,
# define LDAP_SLAPD_V(type) extern type
#endif
+/* SLAPD (as a dynamic library exporting symbols) */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_SLAPI_F(type) extern __declspec(dllimport) type
+# define LDAP_SLAPI_V(type) extern __declspec(dllimport) type
+#else
+# define LDAP_SLAPI_F(type) extern type
+# define LDAP_SLAPI_V(type) extern type
+#endif
+
+/* SLAPD (as a dynamic library exporting symbols) */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define SLAPI_F(type) extern __declspec(dllimport) type
+# define SLAPI_V(type) extern __declspec(dllimport) type
+#else
+# define SLAPI_F(type) extern type
+# define SLAPI_V(type) extern type
+#endif
+
/*
* C library. Mingw32 links with the dynamic C run-time library by default,
* so the explicit definition of CSTATIC will keep dllimport from
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
/* Define if you have the <winsock.h> header file. */
#undef HAVE_WINSOCK_H
/* define for Referential Integrity overlay */
#undef SLAPD_OVER_REFINT
+/* define for Referential Integrity overlay */
+#undef SLAPD_OVER_RETCODE
+
/* define for Rewrite/Remap overlay */
#undef SLAPD_OVER_RWM
typedef struct slapi_mods Slapi_Mods;
typedef struct slapi_componentid Slapi_ComponentId;
+#define SLAPI_ATTR_UNIQUEID "entryUUID"
+#define SLAPI_ATTR_OBJECTCLASS "objectClass"
+
/* pblock routines */
int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
char *slapi_dn_normalize_case( char *dn );
int slapi_dn_issuffix( char *dn, char *suffix );
char *slapi_dn_beparent( Slapi_PBlock *pb, const char *dn );
+int slapi_dn_isbesuffix( Slapi_PBlock *pb, char *dn );
char *slapi_dn_parent( const char *dn );
int slapi_dn_isparent( const char *parentdn, const char *childdn );
char *slapi_dn_ignore_case( char *dn );
Slapi_Value *slapi_value_new_string(const char *s);
Slapi_Value *slapi_value_init(Slapi_Value *v);
Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval);
-Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
+Slapi_Value *slapi_value_init_string(Slapi_Value *v, const char *s);
Slapi_Value *slapi_value_dup(const Slapi_Value *v);
void slapi_value_free(Slapi_Value **value);
const struct berval *slapi_value_get_berval( const Slapi_Value *value );
long slapi_value_get_long(const Slapi_Value *value);
unsigned long slapi_value_get_ulong(const Slapi_Value *value);
size_t slapi_value_get_length(const Slapi_Value *value);
-int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2);
+int slapi_value_compare(const Slapi_Attr *a, const Slapi_Value *v1, const Slapi_Value *v2);
Slapi_ValueSet *slapi_valueset_new( void );
void slapi_valueset_free(Slapi_ValueSet *vs);
int slapi_valueset_count( const Slapi_ValueSet *vs);
void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
+/* DNs */
+Slapi_DN *slapi_sdn_new( void );
+Slapi_DN *slapi_sdn_new_dn_byval( const char *dn );
+Slapi_DN *slapi_sdn_new_ndn_byval( const char *ndn );
+Slapi_DN *slapi_sdn_new_dn_byref( const char *dn );
+Slapi_DN *slapi_sdn_new_ndn_byref( const char *ndn );
+Slapi_DN *slapi_sdn_new_dn_passin( const char *dn );
+Slapi_DN *slapi_sdn_set_dn_byval( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_dn_byref( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_dn_passin( Slapi_DN *sdn, const char *dn );
+Slapi_DN *slapi_sdn_set_ndn_byval( Slapi_DN *sdn, const char *ndn );
+Slapi_DN *slapi_sdn_set_ndn_byref( Slapi_DN *sdn, const char *ndn );
+void slapi_sdn_done( Slapi_DN *sdn );
+void slapi_sdn_free( Slapi_DN **sdn );
+const char * slapi_sdn_get_dn( const Slapi_DN *sdn );
+const char * slapi_sdn_get_ndn( const Slapi_DN *sdn );
+void slapi_sdn_get_parent( const Slapi_DN *sdn,Slapi_DN *sdn_parent );
+void slapi_sdn_get_backend_parent( const Slapi_DN *sdn, Slapi_DN *sdn_parent, const Slapi_Backend *backend );
+Slapi_DN * slapi_sdn_dup( const Slapi_DN *sdn );
+void slapi_sdn_copy( const Slapi_DN *from, Slapi_DN *to );
+int slapi_sdn_compare( const Slapi_DN *sdn1, const Slapi_DN *sdn2 );
+int slapi_sdn_isempty( const Slapi_DN *sdn );
+int slapi_sdn_issuffix(const Slapi_DN *sdn, const Slapi_DN *suffixsdn );
+int slapi_sdn_isparent( const Slapi_DN *parent, const Slapi_DN *child );
+int slapi_sdn_isgrandparent( const Slapi_DN *parent, const Slapi_DN *child );
+int slapi_sdn_get_ndn_len( const Slapi_DN *sdn );
+int slapi_sdn_scope_test( const Slapi_DN *dn, const Slapi_DN *base, int scope );
+void slapi_sdn_get_rdn( const Slapi_DN *sdn,Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_set_rdn( Slapi_DN *sdn, const Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_set_parent( Slapi_DN *sdn, const Slapi_DN *parentdn );
+int slapi_sdn_is_rdn_component( const Slapi_DN *rdn, const Slapi_Attr *a, const Slapi_Value *v );
+char * slapi_moddn_get_newdn( Slapi_DN *dn_olddn, char *newrdn, char *newsuperiordn );
+
+/* RDNs */
+Slapi_RDN *slapi_rdn_new( void );
+Slapi_RDN *slapi_rdn_new_dn( const char *dn );
+Slapi_RDN *slapi_rdn_new_sdn( const Slapi_DN *sdn );
+Slapi_RDN *slapi_rdn_new_rdn( const Slapi_RDN *fromrdn );
+void slapi_rdn_init( Slapi_RDN *rdn );
+void slapi_rdn_init_dn( Slapi_RDN *rdn, const char *dn );
+void slapi_rdn_init_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn );
+void slapi_rdn_init_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn );
+void slapi_rdn_set_dn( Slapi_RDN *rdn, const char *dn );
+void slapi_rdn_set_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn );
+void slapi_rdn_set_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn );
+void slapi_rdn_free( Slapi_RDN **rdn );
+void slapi_rdn_done( Slapi_RDN *rdn );
+int slapi_rdn_get_first( Slapi_RDN *rdn, char **type, char **value );
+int slapi_rdn_get_next( Slapi_RDN *rdn, int index, char **type, char **value );
+int slapi_rdn_get_index( Slapi_RDN *rdn, const char *type, const char *value, size_t length );
+int slapi_rdn_get_index_attr( Slapi_RDN *rdn, const char *type, char **value );
+int slapi_rdn_contains( Slapi_RDN *rdn, const char *type, const char *value,size_t length );
+int slapi_rdn_contains_attr( Slapi_RDN *rdn, const char *type, char **value );
+int slapi_rdn_add( Slapi_RDN *rdn, const char *type, const char *value );
+int slapi_rdn_remove_index( Slapi_RDN *rdn, int atindex );
+int slapi_rdn_remove( Slapi_RDN *rdn, const char *type, const char *value, size_t length );
+int slapi_rdn_remove_attr( Slapi_RDN *rdn, const char *type );
+int slapi_rdn_isempty( const Slapi_RDN *rdn );
+int slapi_rdn_get_num_components( Slapi_RDN *rdn );
+int slapi_rdn_compare( Slapi_RDN *rdn1, Slapi_RDN *rdn2 );
+const char *slapi_rdn_get_rdn( const Slapi_RDN *rdn );
+const char *slapi_rdn_get_nrdn( const Slapi_RDN *rdn );
+Slapi_DN *slapi_sdn_add_rdn( Slapi_DN *sdn, const Slapi_RDN *rdn );
+
/* locks and synchronization */
typedef struct slapi_mutex Slapi_Mutex;
typedef struct slapi_condvar Slapi_CondVar;
void slapi_ch_free_string( char **ptr );
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
char *slapi_ch_realloc( char *block, unsigned long size );
-char *slapi_ch_strdup( char *s );
+char *slapi_ch_strdup( const char *s );
void slapi_ch_array_free( char **arrayp );
struct berval *slapi_ch_bvdup(const struct berval *v);
struct berval **slapi_ch_bvecdup(const struct berval **v);
char **slapi_get_supported_saslmechanisms();
char **slapi_get_supported_extended_ops(void);
+/* operation */
+int slapi_op_abandoned( Slapi_PBlock *pb );
+unsigned long slapi_op_get_type(Slapi_Operation * op);
+void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag);
+void slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag);
+int slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag);
+char *slapi_op_type_to_string(unsigned long type);
/* send ldap result back */
void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type );
+int slapi_x_filter_set_attribute_type( Slapi_Filter *f, const char *type );
int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
char ***any, char **final );
Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2);
Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn,
int deloldrdn, LDAPControl **controls,
int log_change );
-#if 0
-Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn,
- char *newParent, int deloldrdn, LDAPControl **controls,
- int log_change );
-#endif
+Slapi_PBlock *slapi_rename_internal( const char * olddn, const char *newrdn,
+ const char *newsuperior, int delolrdn,
+ LDAPControl **controls, int log_change );
void slapi_free_search_results_internal(Slapi_PBlock *pb);
+/* new internal add/delete/search/modify routines */
+typedef void (*plugin_result_callback)( int rc, void *callback_data );
+typedef int (*plugin_referral_entry_callback)( char * referral,
+ void *callback_data );
+typedef int (*plugin_search_entry_callback)( Slapi_Entry *e,
+ void *callback_data );
+void slapi_free_search_results_internal( Slapi_PBlock *pb );
+
+#define SLAPI_OP_FLAG_NEVER_CHAIN 0x0800
+
+int slapi_search_internal_pb( Slapi_PBlock *pb );
+int slapi_search_internal_callback_pb( Slapi_PBlock *pb, void *callback_data,
+ plugin_result_callback prc, plugin_search_entry_callback psec,
+ plugin_referral_entry_callback prec );
+int slapi_add_internal_pb( Slapi_PBlock *pb );
+int slapi_modify_internal_pb( Slapi_PBlock *pb );
+int slapi_modrdn_internal_pb( Slapi_PBlock *pb );
+int slapi_delete_internal_pb( Slapi_PBlock *pb );
+
+int slapi_seq_internal_callback_pb(Slapi_PBlock *pb, void *callback_data,
+ plugin_result_callback res_callback,
+ plugin_search_entry_callback srch_callback,
+ plugin_referral_entry_callback ref_callback);
+
+void slapi_search_internal_set_pb( Slapi_PBlock *pb, const char *base,
+ int scope, const char *filter, char **attrs, int attrsonly,
+ LDAPControl **controls, const char *uniqueid,
+ Slapi_ComponentId *plugin_identity, int operation_flags );
+void slapi_add_entry_internal_set_pb( Slapi_PBlock *pb, Slapi_Entry *e,
+ LDAPControl **controls, Slapi_ComponentId *plugin_identity,
+ int operation_flags );
+int slapi_add_internal_set_pb( Slapi_PBlock *pb, const char *dn,
+ LDAPMod **attrs, LDAPControl **controls,
+ Slapi_ComponentId *plugin_identity, int operation_flags );
+void slapi_modify_internal_set_pb( Slapi_PBlock *pb, const char *dn,
+ LDAPMod **mods, LDAPControl **controls, const char *uniqueid,
+ Slapi_ComponentId *plugin_identity, int operation_flags );
+void slapi_rename_internal_set_pb( Slapi_PBlock *pb, const char *olddn,
+ const char *newrdn, const char *newsuperior, int deloldrdn,
+ LDAPControl **controls, const char *uniqueid,
+ Slapi_ComponentId *plugin_identity, int operation_flags );
+void slapi_delete_internal_set_pb( Slapi_PBlock *pb, const char *dn,
+ LDAPControl **controls, const char *uniqueid,
+ Slapi_ComponentId *plugin_identity, int operation_flags );
+void slapi_seq_internal_set_pb( Slapi_PBlock *pb, char *ibase, int type,
+ char *attrname, char *val, char **attrs, int attrsonly,
+ LDAPControl **controls, Slapi_ComponentId *plugin_identity,
+ int operation_flags );
+
/* connection related routines */
int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL);
int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort);
int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn);
int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb);
+/* backend routines */
+void slapi_be_set_readonly( Slapi_Backend *be, int readonly );
+int slapi_be_get_readonly( Slapi_Backend *be );
+const char *slapi_x_be_get_updatedn( Slapi_Backend *be );
+Slapi_Backend *slapi_be_select( const Slapi_DN *sdn );
+
/* ACL plugins; only SLAPI_PLUGIN_ACL_ALLOW_ACCESS supported now */
typedef int (*slapi_acl_callback_t)(Slapi_PBlock *pb,
Slapi_Entry *e,
/* operation params */
#define SLAPI_OPINITIATED_TIME 140
#define SLAPI_REQUESTOR_DN 141
-#define SLAPI_REQUESTOR_ISUPDATEDN 142
+#define SLAPI_IS_REPLICATED_OPERATION 142
+#define SLAPI_REQUESTOR_ISUPDATEDN SLAPI_IS_REPLICATED_OPERATION
/* connection structure params*/
#define SLAPI_CONN_DN 143
#define SLAPI_X_CONN_IS_UDP 1302
#define SLAPI_X_CONN_SSF 1303
#define SLAPI_X_CONN_SASL_CONTEXT 1304
+#define SLAPI_X_OPERATION_DELETE_GLUE_PARENT 1305
+#define SLAPI_X_MANAGEDIT 1306
+#define SLAPI_X_OPERATION_NO_SCHEMA_CHECK 1307
/* Authentication types */
#define SLAPD_AUTH_NONE "none"
#define SLAPI_PLUGIN_OBJECT 10
#define SLAPI_PLUGIN_DESTROY_FN 11
#define SLAPI_PLUGIN_DESCRIPTION 12
+#define SLAPI_PLUGIN_IDENTITY 13
/* internal opreations params */
#define SLAPI_PLUGIN_INTOP_RESULT 15
#define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
#define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
+/* transaction arguments */
+#define SLAPI_PARENT_TXN 190
+#define SLAPI_TXN 191
+
/* function pointer params for backends */
#define SLAPI_PLUGIN_DB_BIND_FN 200
#define SLAPI_PLUGIN_DB_UNBIND_FN 201
#define SLAPI_PLUGIN_EXT_OP_FN 300
#define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
-/* functions for preoperation functions */
+/* preoperation */
#define SLAPI_PLUGIN_PRE_BIND_FN 401
#define SLAPI_PLUGIN_PRE_UNBIND_FN 402
#define SLAPI_PLUGIN_PRE_SEARCH_FN 403
#define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
#define SLAPI_PLUGIN_PRE_RESULT_FN 412
-/* functions for postoperation functions*/
+/* internal preoperation */
+#define SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN 420
+#define SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN 421
+#define SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN 422
+#define SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN 423
+
+/* backend preoperation */
+#define SLAPI_PLUGIN_BE_PRE_ADD_FN 450
+#define SLAPI_PLUGIN_BE_PRE_MODIFY_FN 451
+#define SLAPI_PLUGIN_BE_PRE_MODRDN_FN 452
+#define SLAPI_PLUGIN_BE_PRE_DELETE_FN 453
+
+/* postoperation */
#define SLAPI_PLUGIN_POST_BIND_FN 501
#define SLAPI_PLUGIN_POST_UNBIND_FN 502
#define SLAPI_PLUGIN_POST_SEARCH_FN 503
#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
#define SLAPI_PLUGIN_POST_RESULT_FN 512
+/* internal postoperation */
+#define SLAPI_PLUGIN_INTERNAL_POST_ADD_FN 520
+#define SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN 521
+#define SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN 522
+#define SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN 523
+
+/* backend postoperation */
+#define SLAPI_PLUGIN_BE_POST_ADD_FN 550
+#define SLAPI_PLUGIN_BE_POST_MODIFY_FN 551
+#define SLAPI_PLUGIN_BE_POST_MODRDN_FN 552
+#define SLAPI_PLUGIN_BE_POST_DELETE_FN 553
+
#define SLAPI_OPERATION_TYPE 590
#define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
#define SLAPI_CONFIG_ARGV 43
/* operational params */
+#define SLAPI_TARGET_ADDRESS 48
+#define SLAPI_TARGET_UNIQUEID 49
#define SLAPI_TARGET_DN 50
-#define SLAPI_REQCONTROLS 51
/* server LDAPv3 controls */
+#define SLAPI_REQCONTROLS 51
#define SLAPI_RESCONTROLS 55
#define SLAPI_ADD_RESCONTROL 56
+#define SLAPI_CONTROLS_ARG 58
/* add params */
#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
#define SLAPI_ADD_ENTRY 60
+#define SLAPI_ADD_EXISTING_DN_ENTRY 61
+#define SLAPI_ADD_PARENT_ENTRY 62
+#define SLAPI_ADD_PARENT_UNIQUEID 63
+#define SLAPI_ADD_EXISTING_UNIQUEID_ENTRY 64
/* bind params */
#define SLAPI_BIND_TARGET SLAPI_TARGET_DN
/* delete params */
#define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
+#define SLAPI_DELETE_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
/* modify params */
#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
#define SLAPI_MODIFY_MODS 90
+#define SLAPI_MODIFY_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
/* modrdn params */
#define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
#define SLAPI_MODRDN_NEWRDN 100
#define SLAPI_MODRDN_DELOLDRDN 101
#define SLAPI_MODRDN_NEWSUPERIOR 102 /* v3 only */
+#define SLAPI_MODRDN_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
+#define SLAPI_MODRDN_PARENT_ENTRY 104
+#define SLAPI_MODRDN_NEWPARENT_ENTRY 105
+#define SLAPI_MODRDN_TARGET_ENTRY 106
+#define SLAPI_MODRDN_NEWSUPERIOR_ADDRESS 107
/* search params */
#define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
#define SLAPI_FAIL_DISKFULL -2
#define SLAPI_FAIL_GENERAL -1
+#define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
#define SLAPI_BIND_SUCCESS 0
#define SLAPI_BIND_FAIL 2
#define SLAPI_BIND_ANONYMOUS 3
ber_int_options.lbo_meminuse -= mh->bm_length;
#ifdef LDAP_MEMORY_TRACE
- fprintf(stderr, "0x%08x 0x%08x -f- %d ber_memfree %d\n",
- mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
+ fprintf(stderr, "0x%08lx 0x%08lx -f- %ld ber_memfree %ld\n",
+ (long)mh->bm_sequence, (long)mh, (long)mh->bm_length,
+ ber_int_options.lbo_meminuse);
#endif
/* Fill the free space with poison */
memset( mh, 0xff, mh->bm_length + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t));
return;
}
- assert( ber_int_memory_fns->bmf_free );
+ assert( ber_int_memory_fns->bmf_free != 0 );
(*ber_int_memory_fns->bmf_free)( p, ctx );
}
#ifdef LDAP_MEMORY_TRACE
mh->bm_sequence = sequence++;
- fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memalloc %d\n",
- mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
+ fprintf(stderr, "0x%08lx 0x%08lx -a- %ld ber_memalloc %ld\n",
+ (long)mh->bm_sequence, (long)mh, (long)mh->bm_length,
+ ber_int_options.lbo_meminuse);
#endif
/* poison new memory */
memset( (char *)&mh[1], 0xff, s);
#ifdef LDAP_MEMORY_TRACE
mh->bm_sequence = sequence++;
- fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memcalloc %d\n",
- mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
+ fprintf(stderr, "0x%08lx 0x%08lx -a- %ld ber_memcalloc %ld\n",
+ (long)mh->bm_sequence, (long)mh, (long)mh->bm_length,
+ ber_int_options.lbo_meminuse);
#endif
BER_MEM_VALID( &mh[1] );
new = &mh[1];
ber_int_options.lbo_meminuse += s - oldlen;
#ifdef LDAP_MEMORY_TRACE
- fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memrealloc %d\n",
- mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
+ fprintf(stderr, "0x%08lx 0x%08lx -a- %ld ber_memrealloc %ld\n",
+ (long)mh->bm_sequence, (long)mh, (long)mh->bm_length,
+ ber_int_options.lbo_meminuse);
#endif
BER_MEM_VALID( &mh[1] );
return &mh[1];
struct lber_options ber_int_options = {
LBER_UNINITIALIZED, 0, 0, 0 };
+static BerMemoryFunctions ber_int_memory_fns_datum;
+
int
ber_get_option(
void *item,
}
if(item == NULL) {
- if(option == LBER_OPT_BER_DEBUG) {
+ switch ( option ) {
+ case LBER_OPT_BER_DEBUG:
* (int *) outvalue = ber_int_debug;
return LBER_OPT_SUCCESS;
- } else if(option == LBER_OPT_MEMORY_INUSE) {
+
+ case LBER_OPT_MEMORY_INUSE:
/* The memory inuse is a global variable on kernal implementations.
* This means that memory debug is shared by all LDAP processes
* so for this variable to have much meaning, only one LDAP process
#else
return LBER_OPT_ERROR;
#endif
- } else if(option == LBER_OPT_LOG_PRINT_FILE) {
+
+ case LBER_OPT_LOG_PRINT_FILE:
*((FILE**)outvalue) = (FILE*)ber_pvt_err_file;
return LBER_OPT_SUCCESS;
}
if( (ber_int_options.lbo_valid == LBER_UNINITIALIZED)
&& ( ber_int_memory_fns == NULL )
&& ( option == LBER_OPT_MEMORY_FNS )
- && ( invalue != NULL ))
+ && ( invalue != NULL ) )
{
const BerMemoryFunctions *f =
(const BerMemoryFunctions *) invalue;
-
/* make sure all functions are provided */
if(!( f->bmf_malloc && f->bmf_calloc
&& f->bmf_realloc && f->bmf_free ))
return LBER_OPT_ERROR;
}
- ber_int_memory_fns = (BerMemoryFunctions *)
- (*(f->bmf_malloc))(sizeof(BerMemoryFunctions), NULL);
-
- if ( ber_int_memory_fns == NULL ) {
- ber_errno = LBER_ERROR_MEMORY;
- return LBER_OPT_ERROR;
- }
+ ber_int_memory_fns = &ber_int_memory_fns_datum;
AC_MEMCPY(ber_int_memory_fns, f, sizeof(BerMemoryFunctions));
}
if(item == NULL) {
- if(option == LBER_OPT_BER_DEBUG) {
+ switch ( option ) {
+ case LBER_OPT_BER_DEBUG:
ber_int_debug = * (const int *) invalue;
return LBER_OPT_SUCCESS;
- } else if(option == LBER_OPT_LOG_PRINT_FN) {
+ case LBER_OPT_LOG_PRINT_FN:
ber_pvt_log_print = (BER_LOG_PRINT_FN) invalue;
return LBER_OPT_SUCCESS;
- } else if(option == LBER_OPT_LOG_PRINT_FILE) {
+
+ case LBER_OPT_LOG_PRINT_FILE:
ber_pvt_err_file = (void *) invalue;
return LBER_OPT_SUCCESS;
- } else if(option == LBER_OPT_MEMORY_INUSE) {
+
+ case LBER_OPT_MEMORY_INUSE:
/* The memory inuse is a global variable on kernal implementations.
* This means that memory debug is shared by all LDAP processes
* so for this variable to have much meaning, only one LDAP process
#else
return LBER_OPT_ERROR;
#endif
- } else if(option == LBER_OPT_LOG_PROC) {
+ case LBER_OPT_LOG_PROC:
ber_int_log_proc = (BER_LOG_FN)invalue;
+ return LBER_OPT_SUCCESS;
}
ber_errno = LBER_ERROR_PARAM;
case LBER_SB_OPT_GET_FD:
if ( arg != NULL ) {
- *((int *)arg) = sb->sb_fd;
+ *((ber_socket_t *)arg) = sb->sb_fd;
}
ret = ( sb->sb_fd == AC_SOCKET_INVALID ? -1 : 1);
break;
case LBER_SB_OPT_SET_FD:
- sb->sb_fd = *((int *)arg);
+ sb->sb_fd = *((ber_socket_t *)arg);
ret = 1;
break;
} else {
/* send the message */
if ( lr != NULL ) {
+ assert( lr->lr_conn != NULL );
sb = lr->lr_conn->lconn_sb;
} else {
sb = ld->ld_sb;
| buf[1] << 16
| buf[2] << 8
| buf[3];
-
+
if ( size > SASL_MAX_BUFF_SIZE ) {
/* somebody is trying to mess me up. */
ber_log_printf( LDAP_DEBUG_ANY, debuglevel,
{ BER_BVC("minssf="), 0, GOT_MINSSF, 0 },
{ BER_BVC("maxssf="), 0, GOT_MAXSSF, INT_MAX },
{ BER_BVC("maxbufsize="), 0, GOT_MAXBUF, 65536 },
- { BER_BVNULL, 0, 0 }
+ { BER_BVNULL, 0, 0, 0 }
};
void ldap_pvt_sasl_secprops_unparse(
comma = 0;
for ( i=0; !BER_BVISNULL( &sprops[i].key ); i++ ) {
if ( sprops[i].ival ) {
- int v;
+ int v = 0;
switch( sprops[i].ival ) {
case GOT_MINSSF: v = secprops->min_ssf; break;
comma = 0;
for ( i=0; !BER_BVISNULL( &sprops[i].key ); i++ ) {
if ( sprops[i].ival ) {
- int v;
+ int v = 0;
switch( sprops[i].ival ) {
case GOT_MINSSF: v = secprops->min_ssf; break;
return SASL_OK;
}
#else /* !LDAP_DEBUG_R_SASL */
- assert( mutex );
+ assert( mutex != NULL );
#endif /* !LDAP_DEBUG_R_SASL */
return ldap_pvt_thread_mutex_lock( (ldap_pvt_thread_mutex_t *)mutex )
? SASL_FAIL : SASL_OK;
return SASL_OK;
}
#else /* !LDAP_DEBUG_R_SASL */
- assert( mutex );
+ assert( mutex != NULL );
#endif /* !LDAP_DEBUG_R_SASL */
return ldap_pvt_thread_mutex_unlock( (ldap_pvt_thread_mutex_t *)mutex )
? SASL_FAIL : SASL_OK;
return;
}
#else /* !LDAP_DEBUG_R_SASL */
- assert( mutex );
+ assert( mutex != NULL );
#endif /* !LDAP_DEBUG_R_SASL */
(void) ldap_pvt_thread_mutex_destroy( (ldap_pvt_thread_mutex_t *)mutex );
LDAP_FREE( mutex );
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( str );
+ assert( str != NULL );
e = ldap_int_error( ld->ld_errno );
Debug( LDAP_DEBUG_TRACE, "ldap_dn_normalize\n", 0, 0, 0 );
- assert( dnout );
+ assert( dnout != NULL );
*dnout = NULL;
* LDAPAVA helpers (will become part of the API for operations
* on structural representations of DNs).
*/
-LDAPAVA *
+static LDAPAVA *
ldapava_new( const struct berval *attr, const struct berval *val,
unsigned flags, void *ctx )
{
LDAPAVA *ava;
- assert( attr );
- assert( val );
+ assert( attr != NULL );
+ assert( val != NULL );
ava = LDAP_MALLOCX( sizeof( LDAPAVA ) + attr->bv_len + 1, ctx );
void
ldapava_free( LDAPAVA *ava, void *ctx )
{
- assert( ava );
+ assert( ava != NULL );
#if 0
/* ava's private must be freed by caller
{
struct berval bv;
- assert( str );
+ assert( str != NULL );
bv.bv_len = strlen( str );
bv.bv_val = (char *) str;
char *str, *end;
struct berval bvtmp, *bv = &bvtmp;
- assert( bvin );
- assert( bvin->bv_val );
- assert( dn );
+ assert( bvin != NULL );
+ assert( bvin->bv_val != NULL );
+ assert( dn != NULL );
*bv = *bvin;
str = bv->bv_val;
{
struct berval bv;
- assert( str );
+ assert( str != NULL );
assert( str[ 0 ] != '\0' ); /* FIXME: is this required? */
bv.bv_len = strlen( str );
char *str;
ber_len_t stoplen;
- assert( bv );
- assert( bv->bv_len );
- assert( bv->bv_val );
+ assert( bv != NULL );
+ assert( bv->bv_len != 0 );
+ assert( bv->bv_val != NULL );
assert( rdn || flags & LDAP_DN_SKIP );
- assert( n );
+ assert( n != NULL );
str = bv->bv_val;
stoplen = bv->bv_len;
const char *p, *end, *startPos, *endPos = NULL;
ber_len_t len, escapes;
- assert( str );
- assert( val );
- assert( next );
+ assert( str != NULL );
+ assert( val != NULL );
+ assert( next != NULL );
*next = NULL;
end = str + stoplen;
const char *p, *startPos, *endPos = NULL;
ber_len_t len, escapes;
- assert( str );
- assert( val );
- assert( next );
+ assert( str != NULL );
+ assert( val != NULL );
+ assert( next != NULL );
*next = NULL;
const char *p, *startPos, *endPos = NULL;
ber_len_t len, escapes;
- assert( str );
- assert( val );
- assert( next );
+ assert( str != NULL );
+ assert( val != NULL );
+ assert( next != NULL );
*next = NULL;
ber_len_t len;
unsigned escapes = 0;
- assert( str );
- assert( val );
- assert( next );
+ assert( str != NULL );
+ assert( val != NULL );
+ assert( next != NULL );
*next = NULL;
{
char c1, c2;
- assert( str );
- assert( c );
+ assert( str != NULL );
+ assert( c != NULL );
c1 = str[ 0 ];
c2 = str[ 1 ];
ber_len_t len;
ber_len_t s, d;
- assert( str );
- assert( val );
- assert( next );
+ assert( str != NULL );
+ assert( val != NULL );
+ assert( next != NULL );
*next = NULL;
{
static const char hexdig[] = "0123456789ABCDEF";
- assert( val );
- assert( pair );
+ assert( val != NULL );
+ assert( pair != NULL );
/*
* we assume the string has enough room for the hex encoding
{
ber_len_t s, d;
- assert( val );
- assert( str );
+ assert( val != NULL );
+ assert( str != NULL );
if ( val->bv_len == 0 ) {
return( 0 );
int escaped_ascii_len = LDAP_DN_IS_PRETTY( flags ) ? 2 : 3;
#endif /* PRETTY_ESCAPE */
- assert( val );
- assert( len );
+ assert( val != NULL );
+ assert( len != NULL );
*len = 0;
if ( val->bv_len == 0 ) {
{
ber_len_t s, d, end;
- assert( val );
- assert( str );
- assert( len );
+ assert( val != NULL );
+ assert( str != NULL );
+ assert( len != NULL );
if ( val->bv_len == 0 ) {
*len = 0;
ber_len_t l;
char *p;
- assert( val );
- assert( len );
+ assert( val != NULL );
+ assert( len != NULL );
*len = 0;
if ( val->bv_len == 0 ) {
{
ber_len_t s, d, end;
- assert( val );
- assert( str );
- assert( len );
+ assert( val != NULL );
+ assert( str != NULL );
+ assert( len != NULL );
if ( val->bv_len == 0 ) {
*len = 0;
ber_len_t l;
char *p;
- assert( val );
- assert( len );
+ assert( val != NULL );
+ assert( len != NULL );
*len = 0;
if ( val->bv_len == 0 ) {
{
ber_len_t s, d;
- assert( val );
- assert( str );
- assert( len );
+ assert( val != NULL );
+ assert( str != NULL );
+ assert( len != NULL );
if ( val->bv_len == 0 ) {
*len = 0;
ber_len_t l;
char *p;
- assert( val );
- assert( len );
+ assert( val != NULL );
+ assert( len != NULL );
*len = 0;
if ( val->bv_len == 0 ) {
{
ber_len_t s, d;
- assert( val );
- assert( str );
- assert( len );
+ assert( val != NULL );
+ assert( str != NULL );
+ assert( len != NULL );
if ( val->bv_len == 0 ) {
*len = 0;
/* we are guaranteed there's enough memory in str */
/* sanity */
- assert( dn );
- assert( bv );
- assert( iRDN );
+ assert( dn != NULL );
+ assert( bv != NULL );
+ assert( iRDN != NULL );
assert( *iRDN >= 0 );
str = bv->bv_val + pos;
LDAPRDN rdn;
LDAPAVA *ava;
- assert( dn[ i ] );
+ assert( dn[ i ] != NULL );
rdn = dn[ i ];
- assert( rdn[ 0 ] );
+ assert( rdn[ 0 ] != NULL );
ava = rdn[ 0 ];
if ( !LDAP_DN_IS_RDN_DC( rdn ) ) {
int iAVA;
ber_len_t l = 0;
- assert( rdn );
- assert( len );
+ assert( rdn != NULL );
+ assert( len != NULL );
*len = 0;
int iAVA;
ber_len_t l = 0;
- assert( rdn );
- assert( len );
+ assert( rdn != NULL );
+ assert( len != NULL );
*len = 0;
struct berval bv;
int rc;
- assert( str );
+ assert( str != NULL );
if((flags & LDAP_DN_FORMAT_MASK) == LDAP_DN_FORMAT_LBER) {
return LDAP_PARAM_ERROR;
int rc, back;
ber_len_t l;
- assert( bv );
+ assert( bv != NULL );
bv->bv_len = 0;
bv->bv_val = NULL;
struct berval bv;
int rc;
- assert( str );
+ assert( str != NULL );
if((flags & LDAP_DN_FORMAT_MASK) == LDAP_DN_FORMAT_LBER) {
return LDAP_PARAM_ERROR;
int ( *sv2l ) ( struct berval *v, unsigned f, ber_len_t *l );
int ( *sv2s ) ( struct berval *v, char *s, unsigned f, ber_len_t *l );
- assert( bv );
+ assert( bv != NULL );
bv->bv_len = 0;
bv->bv_val = NULL;
struct berval Val;
- assert( bv );
+ assert( bv != NULL );
bv->bv_len = 0;
bv->bv_val = NULL;
LDAPControl **cctrls,
int *msgidp )
{
+ return 0;
}
int ldap_grouping_end_s(
LDAPControl **cctrls,
struct berval **retgrpdatap )
{
+ return 0;
}
#endif
#define LDAP_BOOL_TLS 3
#define LDAP_BOOLEANS unsigned long
-#define LDAP_BOOL(n) (1 << (n))
+#define LDAP_BOOL(n) ((LDAP_BOOLEANS)1 << (n))
#define LDAP_BOOL_GET(lo, bool) \
((lo)->ldo_booleans & LDAP_BOOL(bool) ? -1 : 0)
#define LDAP_BOOL_SET(lo, bool) ((lo)->ldo_booleans |= LDAP_BOOL(bool))
LDAPControl *const *controls =
(LDAPControl *const *) invalue;
- ldap_controls_free( lo->ldo_sctrls );
+ if( lo->ldo_sctrls )
+ ldap_controls_free( lo->ldo_sctrls );
if( controls == NULL || *controls == NULL ) {
lo->ldo_sctrls = NULL;
LDAPControl *const *controls =
(LDAPControl *const *) invalue;
- ldap_controls_free( lo->ldo_cctrls );
+ if( lo->ldo_cctrls )
+ ldap_controls_free( lo->ldo_cctrls );
if( controls == NULL || *controls == NULL ) {
lo->ldo_cctrls = NULL;
LDAPPasswordPolicyError *errorp )
{
BerElement *ber;
- int i, exp = -1, grace = -1;
+ int exp = -1, grace = -1;
ber_tag_t tag;
ber_len_t berLen;
char *last;
- LDAPPasswordPolicyError err = PP_noError;
+ int err = PP_noError;
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( ctrl );
+ assert( ctrl != NULL );
/* Create a BerElement from the berval returned in the control. */
ber = ber_init(&ctrl->ldctl_value);
break;
case PPOLICY_ERROR:
- if (ber_get_enum( ber, (int *)&err ) == LBER_DEFAULT) goto exit;
+ if (ber_get_enum( ber, &err ) == LBER_DEFAULT) goto exit;
break;
default:
goto exit;
static LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPURLDesc *srv, int any ));
static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc ));
+static void ldap_free_request_int LDAP_P(( LDAP *ld, LDAPRequest *lr ));
static BerElement *
re_encode_request( LDAP *ld,
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
rc = ldap_send_server_request( ld, ber, msgid, NULL,
- servers, NULL, NULL );
+ servers, NULL, NULL );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
rc = 0;
if ( ld->ld_requests &&
ld->ld_requests->lr_status == LDAP_REQST_WRITING &&
- ldap_int_flush_request( ld, ld->ld_requests ) < 0 ) {
+ ldap_int_flush_request( ld, ld->ld_requests ) < 0 )
+ {
rc = -1;
}
if ( rc ) return rc;
- if (( lr = (LDAPRequest *)LDAP_CALLOC( 1, sizeof( LDAPRequest ))) ==
- NULL ) {
+ lr = (LDAPRequest *)LDAP_CALLOC( 1, sizeof( LDAPRequest ));
+ if ( lr == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
ldap_free_connection( ld, lc, 0, 0 );
ber_free( ber, 1 );
++parentreq->lr_outrefcnt;
}
lr->lr_origid = parentreq->lr_origid;
- lr->lr_parentcnt = parentreq->lr_parentcnt + 1;
+ lr->lr_parentcnt = ++parentreq->lr_parentcnt;
lr->lr_parent = parentreq;
lr->lr_refnext = parentreq->lr_child;
parentreq->lr_child = lr;
lr->lr_origid = lr->lr_msgid;
}
+ lr->lr_prev = NULL;
if (( lr->lr_next = ld->ld_requests ) != NULL ) {
lr->lr_next->lr_prev = lr;
}
ld->ld_requests = lr;
- lr->lr_prev = NULL;
ld->ld_errno = LDAP_SUCCESS;
if ( ldap_int_flush_request( ld, lr ) == -1 ) {
{
LDAPConn *lc;
LDAPURLDesc *srv;
- Sockbuf *sb = NULL;
- Debug( LDAP_DEBUG_TRACE, "ldap_new_connection\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_new_connection %d %d %d\n",
+ use_ldsb, connect, (bind != NULL) );
/*
* make a new LDAP server connection
* XXX open connection synchronously for now
*/
- if (( lc = (LDAPConn *)LDAP_CALLOC( 1, sizeof( LDAPConn ))) == NULL ||
- ( !use_ldsb && ( (sb = ber_sockbuf_alloc()) == NULL ))) {
- if ( lc != NULL ) {
- LDAP_FREE( (char *)lc );
- }
+ lc = (LDAPConn *)LDAP_CALLOC( 1, sizeof( LDAPConn ) );
+ if ( lc == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( NULL );
}
+
+ if ( use_ldsb ) {
+ assert( ld->ld_sb != NULL );
+ lc->lconn_sb = ld->ld_sb;
- lc->lconn_sb = ( use_ldsb ) ? ld->ld_sb : sb;
+ } else {
+ lc->lconn_sb = ber_sockbuf_alloc();
+ if ( lc->lconn_sb == NULL ) {
+ LDAP_FREE( (char *)lc );
+ ld->ld_errno = LDAP_NO_MEMORY;
+ return( NULL );
+ }
+ }
if ( connect ) {
for ( srv = srvlist; srv != NULL; srv = srv->lud_next ) {
- if ( ldap_int_open_connection( ld, lc, srv, 0 ) != -1 ) {
+ if ( ldap_int_open_connection( ld, lc, srv, 0 ) != -1 )
+ {
break;
}
}
if ( !use_ldsb ) {
ber_sockbuf_free( lc->lconn_sb );
}
- LDAP_FREE( (char *)lc );
- ld->ld_errno = LDAP_SERVER_DOWN;
- return( NULL );
+ LDAP_FREE( (char *)lc );
+ ld->ld_errno = LDAP_SERVER_DOWN;
+ return( NULL );
}
- lc->lconn_server = ldap_url_dup(srv);
+ lc->lconn_server = ldap_url_dup( srv );
}
lc->lconn_status = LDAP_CONNST_CONNECTED;
int err = 0;
LDAPConn *savedefconn;
- /* Set flag to prevent additional referrals from being processed on this
+ /* Set flag to prevent additional referrals
+ * from being processed on this
* connection until the bind has completed
*/
lc->lconn_rebind_inprogress = 1;
Debug( LDAP_DEBUG_TRACE, "Call application rebind_proc\n", 0, 0, 0);
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
- ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
#endif
err = (*ld->ld_rebind_proc)( ld,
bind->ri_url, bind->ri_request, bind->ri_msgid,
ld->ld_rebind_params );
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
ld->ld_defconn = savedefconn;
--lc->lconn_refcnt;
- if( err != 0) {
- err = -1;
+ if ( err != 0 ) {
+ err = -1;
ldap_free_connection( ld, lc, 1, 0 );
lc = NULL;
+ }
+ ldap_free_urldesc( srvfunc );
}
- ldap_free_urldesc( srvfunc);
- }
} else {
savedefconn = ld->ld_defconn;
++lc->lconn_refcnt; /* avoid premature free */
ld->ld_defconn = savedefconn;
--lc->lconn_refcnt;
- if ( err != 0 ) {
- ldap_free_connection( ld, lc, 1, 0 );
- lc = NULL;
+ if ( err != 0 ) {
+ ldap_free_connection( ld, lc, 1, 0 );
+ lc = NULL;
+ }
}
- }
- if( lc != NULL)
+ if ( lc != NULL )
lc->lconn_rebind_inprogress = 0;
}
{
LDAPConn *tmplc, *prevlc;
- Debug( LDAP_DEBUG_TRACE, "ldap_free_connection\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE,
+ "ldap_free_connection %d %d\n",
+ force, unbind, 0 );
if ( force || --lc->lconn_refcnt <= 0 ) {
if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) {
}
}
- if( lc->lconn_ber != NULL ) {
+ if ( lc->lconn_ber != NULL ) {
ber_free( lc->lconn_ber, 1 );
}
ldap_int_sasl_close( ld, lc );
prevlc = NULL;
- for ( tmplc = ld->ld_conns; tmplc != NULL;
- tmplc = tmplc->lconn_next ) {
+ for ( tmplc = ld->ld_conns;
+ tmplc != NULL;
+ tmplc = tmplc->lconn_next )
+ {
if ( tmplc == lc ) {
if ( prevlc == NULL ) {
ld->ld_conns = tmplc->lconn_next;
LDAP_FREE( lc->lconn_krbinstance );
}
#endif
+
+ /* FIXME: is this at all possible? */
+ if ( force ) {
+ LDAPRequest *lr;
+
+ for ( lr = ld->ld_requests; lr; ) {
+ LDAPRequest *lr_next = lr->lr_next;
+
+ if ( lr->lr_conn == lc ) {
+ ldap_free_request_int( ld, lr );
+ }
+
+ lr = lr_next;
+ }
+ }
if ( lc->lconn_sb != ld->ld_sb ) {
ber_sockbuf_free( lc->lconn_sb );
}
- if( lc->lconn_rebind_queue != NULL) {
+ if ( lc->lconn_rebind_queue != NULL) {
int i;
- for( i = 0; lc->lconn_rebind_queue[i] != NULL; i++) {
- LDAP_VFREE(lc->lconn_rebind_queue[i]);
+ for( i = 0; lc->lconn_rebind_queue[i] != NULL; i++ ) {
+ LDAP_VFREE( lc->lconn_rebind_queue[i] );
}
- LDAP_FREE( lc->lconn_rebind_queue);
+ LDAP_FREE( lc->lconn_rebind_queue );
}
LDAP_FREE( lc );
- Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",
- 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE,
+ "ldap_free_connection: actually freed\n",
+ 0, 0, 0 );
} else {
lc->lconn_lastused = time( NULL );
Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: refcnt %d\n",
- lc->lconn_refcnt, 0, 0 );
+ lc->lconn_refcnt, 0, 0 );
}
}
}
#endif /* LDAP_DEBUG */
-void
+static void
ldap_free_request_int( LDAP *ld, LDAPRequest *lr )
{
if ( lr->lr_prev == NULL ) {
+ /* free'ing the first request? */
+ assert( ld->ld_requests == lr );
ld->ld_requests = lr->lr_next;
+
} else {
lr->lr_prev->lr_next = lr->lr_next;
}
ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char **errstrp, int *hadrefp )
{
char *unfollowed;
- int unfollowedcnt = 0;
+ int unfollowedcnt = 0;
LDAPRequest *origreq;
LDAPURLDesc *srv = NULL;
BerElement *ber;
}
} /* end for loop */
done:
- LDAP_VFREE(refarray);
- ldap_free_urllist(srv);
+ LDAP_VFREE( refarray );
+ ldap_free_urllist( srv );
LDAP_FREE( *errstrp );
- if( rc == 0) {
+ if( rc == 0 ) {
*errstrp = NULL;
LDAP_FREE( unfollowed );
return count;
rinfo.ri_msgid = origreq->lr_origid;
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
rc = ldap_send_server_request( ld, ber, id,
- lr, srv, NULL, &rinfo );
+ lr, srv, NULL, &rinfo );
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
LDAP_FREE( rinfo.ri_url );
tmp = lm;
}
} else {
- assert(lm->lm_chain_tail);
- assert(lm->lm_chain_tail->lm_chain);
+ assert(lm->lm_chain_tail != NULL);
+ assert(lm->lm_chain_tail->lm_chain != NULL);
if ((lm->lm_chain_tail->lm_chain->lm_msgtype
== LDAP_RES_SEARCH_ENTRY) ||
(lm->lm_chain_tail->lm_chain->lm_msgtype
if ( all == LDAP_MSG_ONE && lm->lm_chain != NULL ) {
lm->lm_chain->lm_next = lm->lm_next;
lm->lm_chain->lm_chain_tail = ( lm->lm_chain_tail != lm ) ? lm->lm_chain_tail : lm->lm_chain;
- assert(lm->lm_chain->lm_chain_tail);
+ assert(lm->lm_chain->lm_chain_tail != NULL);
lm->lm_chain = NULL;
lm->lm_chain_tail = NULL;
}
}
if ( !lc_ready ) {
- rc = ldap_int_select( ld, tvp );
+ rc = ldap_int_select( ld, tvp );
#ifdef LDAP_DEBUG
- if ( rc == -1 ) {
- Debug( LDAP_DEBUG_TRACE,
- "ldap_int_select returned -1: errno %d\n",
- errno, 0, 0 );
- }
+ if ( rc == -1 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "ldap_int_select returned -1: errno %d\n",
+ errno, 0, 0 );
+ }
#endif
- if ( rc == 0 || ( rc == -1 && (
- !LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART)
- || errno != EINTR )))
- {
- ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
- LDAP_TIMEOUT);
- return( rc );
- }
-
- if ( rc == -1 ) {
- rc = -2; /* select interrupted: loop */
- } else {
- rc = -2;
+ if ( rc == 0 || ( rc == -1 && (
+ !LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART)
+ || errno != EINTR )))
+ {
+ ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
+ LDAP_TIMEOUT);
+ return( rc );
+ }
+
+ if ( rc == -1 ) {
+ rc = -2; /* select interrupted: loop */
+ } else {
+ rc = -2;
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
- if ( ld->ld_requests &&
+ if ( ld->ld_requests &&
ld->ld_requests->lr_status == LDAP_REQST_WRITING &&
ldap_is_write_ready( ld,
- ld->ld_requests->lr_conn->lconn_sb ) ) {
+ ld->ld_requests->lr_conn->lconn_sb ) )
+ {
ldap_int_flush_request( ld, ld->ld_requests );
}
#ifdef LDAP_R_COMPILE
- ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
- for ( lc = ld->ld_conns; rc == -2 && lc != NULL;
- lc = nextlc ) {
- nextlc = lc->lconn_next;
- if ( lc->lconn_status ==
- LDAP_CONNST_CONNECTED &&
- ldap_is_read_ready( ld,
- lc->lconn_sb )) {
- rc = try_read1msg( ld, msgid, all,
- lc->lconn_sb, &lc, result );
- if ( lc == NULL ) lc = nextlc;
- }
- }
- }
- }
+ for ( lc = ld->ld_conns; rc == -2 && lc != NULL;
+ lc = nextlc )
+ {
+ nextlc = lc->lconn_next;
+ if ( lc->lconn_status == LDAP_CONNST_CONNECTED &&
+ ldap_is_read_ready( ld, lc->lconn_sb ))
+ {
+ rc = try_read1msg( ld, msgid, all,
+ lc->lconn_sb, &lc, result );
+ if ( lc == NULL ) lc = nextlc;
+ }
+ }
+ }
+ }
}
if ( rc == -2 && tvp != NULL ) {
LDAPMessage **result )
{
BerElement *ber;
- LDAPMessage *new, *l, *prev, *tmp, *chain_head;
+ LDAPMessage *newmsg, *l, *prev;
ber_int_t id;
ber_tag_t tag;
ber_len_t len;
BerElement tmpber;
int rc, refer_cnt, hadref, simple_request;
ber_int_t lderr;
+
#ifdef LDAP_CONNECTIONLESS
+ LDAPMessage *tmp = NULL, *chain_head = NULL;
int firstmsg = 1, moremsgs = 0, isv2 = 0;
#endif
+
/*
* v3ref = flag for V3 referral / search reference
* 0 = not a ref, 1 = sucessfully chased ref, -1 = pass ref to application
return( -2 ); /* continue looking */
}
- if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
+ lr = ldap_find_request_by_msgid( ld, id );
+ if ( lr == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
(long) id, 0, 0 );
Debug( LDAP_DEBUG_TRACE,
"ldap_read: message type %s msgid %ld, original id %ld\n",
- ldap_int_msgtype2str( tag ),
+ ldap_int_msgtype2str( tag ),
(long) lr->lr_msgid, (long) lr->lr_origid );
id = lr->lr_origid;
}
} else {
/* Check for V3 referral */
- ber_len_t len;
+ ber_len_t len;
+ char *lr_res_error = NULL;
+
if ( ber_scanf( &tmpber, "{iaa",/*}*/ &lderr,
- &lr->lr_res_matched, &lr->lr_res_error )
- != LBER_ERROR ) {
+ &lr->lr_res_matched, &lr_res_error )
+ != LBER_ERROR )
+ {
+ if ( lr_res_error != NULL ) {
+ if ( lr->lr_res_error != NULL ) {
+ (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error );
+ LDAP_FREE( (char *)lr_res_error );
+
+ } else {
+ lr->lr_res_error = lr_res_error;
+ }
+ }
+
/* Check if V3 referral */
- if( ber_peek_tag( &tmpber, &len) == LDAP_TAG_REFERRAL ) {
+ if ( ber_peek_tag( &tmpber, &len ) == LDAP_TAG_REFERRAL ) {
/* We have a V3 referral, assume we cannot chase it */
v3ref = -1;
if( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS)
( lr->lr_parent != NULL ||
LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) )
{
+ char *lr_res_error = NULL;
+
tmpber = *ber; /* struct copy */
if ( v3ref == 1 ) {
/* V3 search reference or V3 referral
if ( tag == LDAP_RES_SEARCH_RESULT )
refer_cnt = 0;
} else if ( ber_scanf( &tmpber, "{iaa}", &lderr,
- &lr->lr_res_matched, &lr->lr_res_error )
- != LBER_ERROR ) {
+ &lr->lr_res_matched, &lr_res_error )
+ != LBER_ERROR )
+ {
+ if ( lr_res_error != NULL ) {
+ if ( lr->lr_res_error != NULL ) {
+ (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error );
+ LDAP_FREE( (char *)lr_res_error );
+ } else {
+ lr->lr_res_error = lr_res_error;
+ }
+ }
+
if ( lderr != LDAP_SUCCESS ) {
/* referrals are in error string */
refer_cnt = ldap_chase_referrals( ld, lr,
}
}
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
ldap_free_request( ld, lr );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
}
if ( lc != NULL ) {
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
ldap_free_connection( ld, lc, 0, 1 );
+#ifdef LDAP_R_COMPILE
+ ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
*lcp = NULL;
}
}
}
/* make a new ldap message */
- if ( (new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
- == NULL ) {
+ newmsg = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) );
+ if ( newmsg == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
- new->lm_msgid = (int)id;
- new->lm_msgtype = tag;
- new->lm_ber = ber;
+ newmsg->lm_msgid = (int)id;
+ newmsg->lm_msgtype = tag;
+ newmsg->lm_ber = ber;
#ifdef LDAP_CONNECTIONLESS
/* CLDAP replies all fit in a single datagram. In LDAPv2 RFC1798
/* set up response chain */
if ( firstmsg ) {
firstmsg = 0;
- new->lm_next = ld->ld_responses;
- ld->ld_responses = new;
- new->lm_chain_tail = new;
- chain_head = new;
+ newmsg->lm_next = ld->ld_responses;
+ ld->ld_responses = newmsg;
+ newmsg->lm_chain_tail = newmsg;
+ chain_head = newmsg;
} else {
- tmp->lm_chain = new;
+ assert( tmp != NULL );
+ tmp->lm_chain = newmsg;
chain_head->lm_chain_tail = tmp;
}
- tmp = new;
+ tmp = newmsg;
/* "ok" means there's more to parse */
if (ok) {
if (isv2) goto nextresp2;
* stick the result onto the end of the chain, and then pull the
* first response off the head of the chain.
*/
- tmp->lm_chain = new;
+ tmp->lm_chain = newmsg;
chain_head->lm_chain_tail = tmp;
*result = chkResponseList( ld, msgid, all );
ld->ld_errno = LDAP_SUCCESS;
return( (*result)->lm_msgtype );
}
}
-#endif
+#endif /* LDAP_CONNECTIONLESS */
/* is this the one we're looking for? */
if ( msgid == LDAP_RES_ANY || id == msgid ) {
if ( all == LDAP_MSG_ONE
- || (new->lm_msgtype != LDAP_RES_SEARCH_RESULT
- && new->lm_msgtype != LDAP_RES_SEARCH_ENTRY
- && new->lm_msgtype != LDAP_RES_SEARCH_REFERENCE) ) {
- *result = new;
+ || (newmsg->lm_msgtype != LDAP_RES_SEARCH_RESULT
+ && newmsg->lm_msgtype != LDAP_RES_SEARCH_ENTRY
+ && newmsg->lm_msgtype != LDAP_RES_SEARCH_REFERENCE) ) {
+ *result = newmsg;
ld->ld_errno = LDAP_SUCCESS;
return( tag );
- } else if ( new->lm_msgtype == LDAP_RES_SEARCH_RESULT) {
+ } else if ( newmsg->lm_msgtype == LDAP_RES_SEARCH_RESULT) {
foundit = 1; /* return the chain later */
}
}
prev = NULL;
for ( l = ld->ld_responses; l != NULL; l = l->lm_next ) {
- if ( l->lm_msgid == new->lm_msgid )
+ if ( l->lm_msgid == newmsg->lm_msgid )
break;
prev = l;
}
/* not part of an existing search response */
if ( l == NULL ) {
if ( foundit ) {
- *result = new;
+ *result = newmsg;
goto exit;
}
- new->lm_next = ld->ld_responses;
- ld->ld_responses = new;
- new->lm_chain_tail = new;
+ newmsg->lm_next = ld->ld_responses;
+ ld->ld_responses = newmsg;
+ newmsg->lm_chain_tail = newmsg;
goto exit;
}
Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
- (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
+ (long) newmsg->lm_msgid, (long) newmsg->lm_msgtype, 0 );
/* part of a search response - add to end of list of entries */
if (l->lm_chain == NULL) {
assert(l->lm_chain_tail == l);
- l->lm_chain = new;
+ l->lm_chain = newmsg;
} else {
- assert(l->lm_chain_tail);
- assert(l->lm_chain_tail->lm_chain);
+ assert(l->lm_chain_tail != NULL);
+ assert(l->lm_chain_tail->lm_chain != NULL);
if ((l->lm_chain_tail->lm_chain->lm_msgtype
== LDAP_RES_SEARCH_ENTRY) ||
(l->lm_chain_tail->lm_chain->lm_msgtype
== LDAP_RES_SEARCH_REFERENCE) ||
(l->lm_chain_tail->lm_chain->lm_msgtype
== LDAP_RES_INTERMEDIATE)) {
- l->lm_chain_tail->lm_chain->lm_chain = new;
+ l->lm_chain_tail->lm_chain->lm_chain = newmsg;
l->lm_chain_tail = l->lm_chain_tail->lm_chain;
} else {
/*FIXME: ldap_msgfree( l->lm_chain_tail->lm_chain );*/
- l->lm_chain_tail->lm_chain = new;
+ l->lm_chain_tail->lm_chain = newmsg;
}
}
}
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
- lr->lr_res_msgtype, lr->lr_res_errno,
- lr->lr_res_matched ? lr->lr_res_matched : "",
- lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) {
-
+ lr->lr_res_msgtype, lr->lr_res_errno,
+ lr->lr_res_matched ? lr->lr_res_matched : "",
+ lr->lr_res_error ? lr->lr_res_error : "" ) == -1 )
+ {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free(ber, 1);
return( LBER_ERROR );
lr->lr_res_error );
}
} else if ( lr->lr_res_errno != LDAP_SUCCESS &&
- parentr->lr_res_errno == LDAP_SUCCESS ) {
+ parentr->lr_res_errno == LDAP_SUCCESS )
+ {
parentr->lr_res_errno = lr->lr_res_errno;
if ( parentr->lr_res_error != NULL ) {
LDAP_FREE( parentr->lr_res_error );
}
parentr->lr_res_error = lr->lr_res_error;
lr->lr_res_error = NULL;
- if ( LDAP_NAME_ERROR( lr->lr_res_errno )) {
+ if ( LDAP_NAME_ERROR( lr->lr_res_errno ) ) {
if ( parentr->lr_res_matched != NULL ) {
LDAP_FREE( parentr->lr_res_matched );
}
#define TK_DOLLAR 6
#define TK_QDESCR TK_QDSTRING
-struct token {
- int type;
- char *sval;
-};
-
static int
get_token( const char ** sp, char ** token_val )
{
( allow_quoted && kind == TK_QDSTRING ) ) {
res[pos++] = sval;
res[pos] = NULL;
+ } else if ( kind == TK_RIGHTPAREN ) {
+ /* FIXME: be liberal in what we accept... */
+ parse_whsp(sp);
+ LDAP_FREE(res);
+ return NULL;
} else {
*code = LDAP_SCHERR_UNEXPTOKEN;
LDAP_FREE(sval);
mru->mru_applies_oids = parse_oids(&ss,
code,
flags);
- if ( !mru->mru_applies_oids ) {
+ if ( !mru->mru_applies_oids && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_matchingruleuse_free(mru);
return NULL;
oc->oc_sup_oids = parse_oids(&ss,
code,
flags);
- if ( !oc->oc_sup_oids ) {
+ if ( !oc->oc_sup_oids && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_objectclass_free(oc);
return NULL;
}
seen_must = 1;
oc->oc_at_oids_must = parse_oids(&ss,code,0);
- if ( !oc->oc_at_oids_must ) {
+ if ( !oc->oc_at_oids_must && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_objectclass_free(oc);
return NULL;
}
seen_may = 1;
oc->oc_at_oids_may = parse_oids(&ss,code,0);
- if ( !oc->oc_at_oids_may ) {
+ if ( !oc->oc_at_oids_may && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_objectclass_free(oc);
return NULL;
}
seen_must = 1;
cr->cr_at_oids_must = parse_oids(&ss,code,0);
- if ( !cr->cr_at_oids_must ) {
+ if ( !cr->cr_at_oids_must && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_contentrule_free(cr);
return NULL;
}
seen_may = 1;
cr->cr_at_oids_may = parse_oids(&ss,code,0);
- if ( !cr->cr_at_oids_may ) {
+ if ( !cr->cr_at_oids_may && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_contentrule_free(cr);
return NULL;
}
seen_not = 1;
cr->cr_at_oids_not = parse_oids(&ss,code,0);
- if ( !cr->cr_at_oids_not ) {
+ if ( !cr->cr_at_oids_not && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_contentrule_free(cr);
return NULL;
}
seen_must = 1;
nf->nf_at_oids_must = parse_oids(&ss,code,0);
- if ( !nf->nf_at_oids_must ) {
+ if ( !nf->nf_at_oids_must && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_nameform_free(nf);
return NULL;
}
seen_may = 1;
nf->nf_at_oids_may = parse_oids(&ss,code,0);
- if ( !nf->nf_at_oids_may ) {
+ if ( !nf->nf_at_oids_may && *code != LDAP_SUCCESS ) {
*errp = ss;
ldap_nameform_free(nf);
return NULL;
{
char *s = NULL;
- assert( bv );
+ assert( bv != NULL );
/* to upper */
if ( str ) {
{
char *s = NULL;
- assert( bv );
+ assert( bv != NULL );
/* to lower */
if ( str ) {
}
#endif
+ if ( ld->ld_options.ldo_sctrls != NULL ) {
+ ldap_controls_free( ld->ld_options.ldo_sctrls );
+ ld->ld_options.ldo_sctrls = NULL;
+ }
+
+ if ( ld->ld_options.ldo_cctrls != NULL ) {
+ ldap_controls_free( ld->ld_options.ldo_cctrls );
+ ld->ld_options.ldo_cctrls = NULL;
+ }
+
ber_sockbuf_free( ld->ld_sb );
#ifdef LDAP_R_COMPILE
int ldap_pvt_url_scheme2proto( const char *scheme )
{
- assert( scheme );
+ assert( scheme != NULL );
if( scheme == NULL ) {
return -1;
int ldap_pvt_url_scheme_port( const char *scheme, int port )
{
- assert( scheme );
+ assert( scheme != NULL );
if( port ) return port;
if( scheme == NULL ) return port;
int
ldap_pvt_url_scheme2tls( const char *scheme )
{
- assert( scheme );
+ assert( scheme != NULL );
if( scheme == NULL ) {
return -1;
return LDAP_URL_ERR_BADSCHEME;
}
- assert( scheme );
+ assert( scheme != NULL );
/* make working copy of the remainder of the URL */
url = LDAP_STRDUP( url_tmp );
# include <ldap_pvt_thread.h>
ldap_pvt_thread_mutex_t ldap_int_resolv_mutex;
-#if (defined( HAVE_CTIME_R ) || defined( HAVE_REENTRANT_FUNCTIONS)) \
- && defined( CTIME_R_NARGS )
-# define USE_CTIME_R
+# if (defined( HAVE_CTIME_R ) || defined( HAVE_REENTRANT_FUNCTIONS)) \
+ && defined( CTIME_R_NARGS )
+# define USE_CTIME_R
# else
static ldap_pvt_thread_mutex_t ldap_int_ctime_mutex;
# endif
#define BUFSTART (1024-32)
#define BUFMAX (32*1024-32)
+#if defined(LDAP_R_COMPILE)
static char *safe_realloc( char **buf, int len );
-#if !defined(HAVE_GETHOSTBYNAME_R) && defined(LDAP_R_COMPILE)
+#if !(defined(HAVE_GETHOSTBYNAME_R) && defined(HAVE_GETHOSTBYADDR_R))
static int copy_hostent( struct hostent *res,
char **buf, struct hostent * src );
#endif
+#endif
int ldap_pvt_gethostbyname_a(
const char *name,
#endif
}
-#if !defined( GETNAMEINFO ) && !defined( HAVE_HERROR )
+#if !defined( HAVE_GETNAMEINFO ) && !defined( HAVE_HSTRERROR )
static const char *
hp_strerror( int err )
{
int n_alias=0;
int total_alias_len=0;
int n_addr=0;
- int total_addr_len;
+ int total_addr_len=0;
int total_len;
/* calculate the size needed for the buffer */
if (ctx) {
LDAP_SLIST_REMOVE_HEAD(&pool->ltp_free_list, ltc_next.l);
} else {
- int i;
ctx = (ldap_int_thread_ctx_t *) LDAP_MALLOC(
sizeof(ldap_int_thread_ctx_t));
if (ctx == NULL) {
#ifdef LDAP_PF_LOCAL
#if defined( SO_PEERCRED )
struct ucred peercred;
- size_t peercredlen = sizeof peercred;
+ socklen_t peercredlen = sizeof peercred;
if(( getsockopt( s, SOL_SOCKET, SO_PEERCRED,
(void *)&peercred, &peercredlen ) == 0 )
int i;
ber_len_t len;
- assert( must_b64_encode );
- assert( name );
- assert( oid );
+ assert( must_b64_encode != NULL );
+ assert( name != NULL );
+ assert( oid != NULL );
len = strlen( name );
{
int i;
- assert( must_b64_encode );
+ assert( must_b64_encode != NULL );
if ( must_b64_encode == default_must_b64_encode ) {
return;
int i;
struct berval bv;
- assert( must_b64_encode );
- assert( s );
+ assert( must_b64_encode != NULL );
+ assert( s != NULL );
ber_str2bv( s, 0, 0, &bv );
}
}
- return (const struct pw_scheme *) NULL;
+ return NULL;
}
int lutil_passwd_scheme(
*/
static void lmPasswd_to_key(
- const unsigned char *lmPasswd,
+ const char *lmPasswd,
des_cblock *key)
{
+ const unsigned char *lpw = (const unsigned char *) lmPasswd;
+ unsigned char *k = (unsigned char *) key;
+
/* make room for parity bits */
- ((char *)key)[0] = lmPasswd[0];
- ((char *)key)[1] = ((lmPasswd[0]&0x01)<<7) | (lmPasswd[1]>>1);
- ((char *)key)[2] = ((lmPasswd[1]&0x03)<<6) | (lmPasswd[2]>>2);
- ((char *)key)[3] = ((lmPasswd[2]&0x07)<<5) | (lmPasswd[3]>>3);
- ((char *)key)[4] = ((lmPasswd[3]&0x0F)<<4) | (lmPasswd[4]>>4);
- ((char *)key)[5] = ((lmPasswd[4]&0x1F)<<3) | (lmPasswd[5]>>5);
- ((char *)key)[6] = ((lmPasswd[5]&0x3F)<<2) | (lmPasswd[6]>>6);
- ((char *)key)[7] = ((lmPasswd[6]&0x7F)<<1);
+ k[0] = lpw[0];
+ k[1] = ((lpw[0] & 0x01) << 7) | (lpw[1] >> 1);
+ k[2] = ((lpw[1] & 0x03) << 6) | (lpw[2] >> 2);
+ k[3] = ((lpw[2] & 0x07) << 5) | (lpw[3] >> 3);
+ k[4] = ((lpw[3] & 0x0F) << 4) | (lpw[4] >> 4);
+ k[5] = ((lpw[4] & 0x1F) << 3) | (lpw[5] >> 5);
+ k[6] = ((lpw[5] & 0x3F) << 2) | (lpw[6] >> 6);
+ k[7] = ((lpw[6] & 0x7F) << 1);
des_set_odd_parity( key );
}
const struct berval * cred,
const char **text )
{
- char *cr;
unsigned int i;
- int rc;
for( i=0; i<cred->bv_len; i++) {
if(cred->bv_val[i] == '\0') {
const char **text )
{
unsigned int i;
- char *pw,*cr;
+ char *pw;
for( i=0; i<cred->bv_len; i++) {
if(cred->bv_val[i] == '\0') {
{
struct rewrite_context *context = (struct rewrite_context *)tmp;
- assert( tmp );
+ assert( tmp != NULL );
rewrite_context_destroy( &context );
}
struct rewrite_context *context;
struct rewrite_rule *r;
- assert( pcontext );
- assert( *pcontext );
+ assert( pcontext != NULL );
+ assert( *pcontext != NULL );
context = *pcontext;
- assert( context->lc_rule );
+ assert( context->lc_rule != NULL );
for ( r = context->lc_rule->lr_next; r; ) {
struct rewrite_rule *cr = r;
free( context->lc_rule );
context->lc_rule = NULL;
- assert( context->lc_name );
+ assert( context->lc_name != NULL );
free( context->lc_name );
context->lc_name = NULL;
{
struct ldap_map_data *data;
- assert( pmap );
- assert( *pmap );
+ assert( pmap != NULL );
+ assert( *pmap != NULL );
data = ( struct ldap_map_data * )(*pmap)->lb_private;
{
struct rewrite_builtin_map *map = ( struct rewrite_builtin_map * )tmp;
- assert( map );
+ assert( map != NULL );
switch ( map->lb_type ) {
case REWRITE_BUILTIN_MAP_LDAP:
{
struct rewrite_map *map;
- assert( pmap );
- assert( *pmap );
+ assert( pmap != NULL );
+ assert( *pmap != NULL );
map = *pmap;
{
struct rewrite_action *action;
- assert( paction );
- assert( *paction );
+ assert( paction != NULL );
+ assert( *paction != NULL );
action = *paction;
struct rewrite_rule *rule;
struct rewrite_action *action;
- assert( prule );
- assert( *prule );
+ assert( prule != NULL );
+ assert( *prule != NULL );
rule = *prule;
struct rewrite_session *session
)
{
- assert( session );
+ assert( session != NULL );
ldap_pvt_thread_mutex_unlock( &session->ls_mutex );
}
int n;
struct rewrite_subst *subst;
- assert( psubst );
- assert( *psubst );
+ assert( psubst != NULL );
+ assert( *psubst != NULL );
subst = *psubst;
{
struct rewrite_map *map;
- assert( pmap );
- assert( *pmap );
+ assert( pmap != NULL );
+ assert( *pmap != NULL );
map = *pmap;
touch all-cffiles
install-schema: FORCE
- @-$(MKDIR) $(DESTDIR)$(schemadir)
- i="$(srcdir)/schema/README" ; \
- SF=`basename $$i` ; \
- SD="$(DESTDIR)$(schemadir)/$$SF" ; \
- echo $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \
- $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD
- for i in $(srcdir)/schema/*.schema ; do \
- SF=`basename $$i` ; \
- SD="$(DESTDIR)$(schemadir)/$$SF" ; \
- if test ! -f $$SD ; then \
- echo "installing $$SF in $(schemadir)" ; \
- echo $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \
- $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD ; \
- else \
- echo "PRESERVING EXISTING SCHEMA FILE $$SD" ; \
- fi ; \
- $(INSTALL) $(INSTALLFLAGS) -m 444 $$i $$SD.default ; \
+ @if test -e $(DESTDIR)$(schemadir) ; then \
+ echo "MOVING EXISTING SCHEMA DIR to $(DESTDIR)$(schemadir).$$$$" ; \
+ mv $(DESTDIR)$(schemadir) $(DESTDIR)$(schemadir).$$$$ ; \
+ fi
+ $(MKDIR) $(DESTDIR)$(schemadir)
+ @SD=$(DESTDIR)$(schemadir) ; \
+ files=`cd $(srcdir)/schema ; echo README *.ldif *.schema` ; \
+ for i in $$files ; do \
+ echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
+ $(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
done
install-conf: FORCE
{
ber_int_t id;
Operation *o;
- int i;
Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
#include "lber_pvt.h"
#include "lutil.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif /* LDAPI_SLAPI */
-
#define ACL_BUF_SIZE 1024 /* use most appropriate size */
/*
AccessControlState *state,
slap_mask_t *maskp )
{
- assert( maskp );
+ assert( maskp != NULL );
ACL_PRIV_SET( *maskp, ACL_ACCESS2PRIV( access ) );
assert( attr != NULL );
-#ifdef LDAP_SLAPI
- if ( op->o_pb != NULL ) {
- ret = slapi_int_access_allowed( op, e, desc, val, access, state );
- if ( ret == 0 ) {
- /* ACL plugin denied access */
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
-
/* grant database root access */
if ( be_isroot( op ) ) {
Debug( LDAP_DEBUG_ACL, "<= root access granted\n", 0, 0, 0 );
return ret;
}
+int
+fe_access_allowed(
+ Operation *op,
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val,
+ slap_access_t access,
+ AccessControlState *state,
+ slap_mask_t *maskp )
+{
+ BackendDB *be_orig;
+ int rc;
+
+ /*
+ * NOTE: control gets here if FIXME
+ * if an appropriate backend cannot be selected for the operation,
+ * we assume that the frontend should handle this
+ * FIXME: should select_backend() take care of this,
+ * and return frontendDB instead of NULL? maybe for some value
+ * of the flags?
+ */
+ be_orig = op->o_bd;
+
+ op->o_bd = select_backend( &op->o_req_ndn, 0, 0 );
+ if ( op->o_bd == NULL ) {
+ op->o_bd = frontendDB;
+ }
+ rc = slap_access_allowed( op, e, desc, val, access, state, maskp );
+ op->o_bd = be_orig;
+
+ return rc;
+}
+
int
access_allowed_mask(
Operation *op,
const char *attr;
int st_same_attr = 0;
static AccessControlState state_init = ACL_STATE_INIT;
- BI_access_allowed *bi_access_allowed = NULL;
assert( e != NULL );
assert( desc != NULL );
/* this is enforced in backend_add() */
if ( op->o_bd->bd_info->bi_access_allowed ) {
/* delegate to backend */
- ret = op->o_bd->bd_info->bi_access_allowed( op, e, desc, val, access, state, &mask );
+ ret = op->o_bd->bd_info->bi_access_allowed( op, e,
+ desc, val, access, state, &mask );
} else {
- /* use default */
- ret = slap_access_allowed( op, e, desc, val, access, state, &mask );
+ BackendDB *be_orig = op->o_bd;
+
+ /* use default (but pass through frontend
+ * for global ACL overlays) */
+ op->o_bd = frontendDB;
+ ret = frontendDB->bd_info->bi_access_allowed( op, e,
+ desc, val, access, state, &mask );
+ op->o_bd = be_orig;
}
if ( !ret ) {
}
assert( be != NULL );
-#ifdef LDAP_SLAPI
- if ( op->o_pb != NULL ) {
- ret = slapi_int_access_allowed( op, e, desc, val, access, state );
- if ( ret == 0 ) {
- /* ACL plugin denied access */
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
-
/* grant database root access */
if ( be_isroot( op ) ) {
Debug( LDAP_DEBUG_ACL, "<= root access granted\n", 0, 0, 0 );
continue;
}
+ Debug( LDAP_DEBUG_ACL, "<= check a_group_pat: %s\n",
+ b->a_group_pat.bv_val, 0, 0 );
+
/* b->a_group is an unexpanded entry name, expanded it should be an
* entry with objectclass group* and we test to see if odn is one of
* the values in the attribute group
struct berval bv;
char buf[ACL_BUF_SIZE];
+ Debug( LDAP_DEBUG_ACL, "<= check a_set_pat: %s\n",
+ b->a_set_pat.bv_val, 0, 0 );
+
if ( b->a_set_style == ACL_STYLE_EXPAND ) {
int tmp_nmatch;
regmatch_t tmp_matches[2],
slap_dynacl_t *da;
slap_access_t tgrant, tdeny;
+ Debug( LDAP_DEBUG_ACL, "<= check a_dynacl\n",
+ 0, 0, 0 );
+
/* this case works different from the others above.
* since aci's themselves give permissions, we need
* to first check b->a_access_mask, the ACL's access level.
for ( da = b->a_dynacl; da; da = da->da_next ) {
slap_access_t grant, deny;
+ Debug( LDAP_DEBUG_ACL, " <= check a_dynacl: %s\n",
+ da->da_name, 0, 0 );
+
(void)( *da->da_mask )( da->da_private, op, e, desc, val, nmatch, matches, &grant, &deny );
tgrant |= grant;
BerVarray bvals = NULL;
int ret, stop;
+ Debug( LDAP_DEBUG_ACL, " <= check a_aci_at: %s\n",
+ b->a_aci_at->ad_cname.bv_val, 0, 0 );
+
/* this case works different from the others above.
* since aci's themselves give permissions, we need
* to first check b->a_access_mask, the ACL's access level.
AttributeDescription *ad = ( AttributeDescription * )priv;
char *ptr;
- assert( ad );
+ assert( ad != NULL );
bv->bv_val = ch_malloc( STRLENOF(" aci=") + ad->ad_cname.bv_len + 1 );
ptr = lutil_strcopy( bv->bv_val, " aci=" );
int
acl_init( void )
{
- int i, rc;
#ifdef SLAP_DYNACL
+ int i, rc;
slap_dynacl_t *known_dynacl[] = {
#ifdef SLAPD_ACI_ENABLED
&dynacl_aci,
fprintf( stderr,
"%s: line %d: \"onelevel\" should be used "
"instead of \"level{1}\" in by DN clause\n",
- fname, lineno, 0 );
+ fname, lineno );
} else if ( level == 0 && sty == ACL_STYLE_LEVEL ) {
fprintf( stderr,
"%s: line %d: \"base\" should be used "
"instead of \"level{0}\" in by DN clause\n",
- fname, lineno, 0 );
+ fname, lineno );
}
bdn->a_level = level;
fprintf( stderr, "%s: line %d: "
"deprecated group style \"regex\"; "
"use \"expand\" instead\n",
- fname, lineno, style );
+ fname, lineno );
sty = ACL_STYLE_EXPAND;
break;
{
AccessControl *n;
- for (; a && a!= end; a=n) {
+ for ( ; a && a != end; a = n ) {
n = a->acl_next;
acl_free( a );
}
if ( !BER_BVISEMPTY( &b->a_group_pat ) ) {
ptr = lutil_strcopy( ptr, " group/" );
ptr = lutil_strcopy( ptr, b->a_group_oc ?
- b->a_group_oc->soc_cname.bv_val : "groupOfNames" );
+ b->a_group_oc->soc_cname.bv_val : SLAPD_GROUP_CLASS );
*ptr++ = '/';
ptr = lutil_strcopy( ptr, b->a_group_at ?
- b->a_group_at->ad_cname.bv_val : "member" );
+ b->a_group_at->ad_cname.bv_val : SLAPD_GROUP_ATTR );
*ptr++ = '.';
ptr = lutil_strcopy( ptr, style_strings[b->a_group_style] );
*ptr++ = '=';
for( ; attrs->an_name.bv_val; attrs++ ) {
AttributeType *a;
ObjectClass *oc;
- int rc;
if ( attrs->an_desc ) {
int lr;
}
if( oc != NULL ) {
if ( attrs->an_oc_exclude ) {
- int gotit = 0;
-
if ( oc == slap_schema.si_oc_extensibleObject ) {
/* extensibleObject allows the return of anything */
return 0;
AttributeName *anew;
/* find last element in list */
- for (i = 0; an && an[i].an_name.bv_val; i++);
+ i = 0;
+ if ( an != NULL ) {
+ for ( i = 0; !BER_BVISNULL( &an[ i ].an_name ) ; i++)
+ ;
+ }
/* protect the input string from strtok */
str = ch_strdup( in );
/* Count words in string */
- j=1;
+ j = 1;
for ( s = str; *s; s++ ) {
if ( strchr( brkstr, *s ) != NULL ) {
j++;
anew++;
}
- anew->an_name.bv_val = NULL;
+ BER_BVZERO( &anew->an_name );
free( str );
return( an );
}
while ( fgets( lcur, LBUFSIZ, fp ) != NULL ) {
- char *str, *s, *next;
- const char *delimstr = brkstr;
if ( ( c = strchr( lcur, '\n' ) ) ) {
if ( c == line ) {
*c = '\0';
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-
-static void init_add_pblock( Operation *op, struct berval *dn, Entry *e,
- int manageDSAit );
-static int call_add_preop_plugins( Operation *op );
-static void call_add_postop_plugins( Operation *op );
-#endif /* LDAP_SLAPI */
-
int
do_add( Operation *op, SlapReply *rs )
{
/* temporary; remove if not invoking backend function */
op->ora_modlist = modlist;
+ /* call this so global overlays/SLAPI have access to ora_e */
+ rs->sr_err = slap_mods2entry( op->ora_modlist, &op->ora_e,
+ 1, 0, &rs->sr_text, textbuf, textlen );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ send_ldap_result( op, rs );
+ goto done;
+ }
+
op->o_bd = frontendDB;
rc = frontendDB->be_add( op, rs );
if ( rc == 0 ) {
slap_graduate_commit_csn( op );
if ( modlist != NULL ) {
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 0 );
}
+
if ( op->ora_e != NULL ) {
entry_free( op->ora_e );
}
goto done;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) init_add_pblock( op, &op->o_req_dn, op->ora_e, manageDSAit );
-#endif /* LDAP_SLAPI */
-
/*
* do the add if 1 && (2 || 3)
* 1) there is an add function implemented in this backend;
assert( (*modtail)->sml_desc != NULL );
}
+
rs->sr_err = slap_mods_opattrs( op, modlist,
modtail, &rs->sr_text,
textbuf, textlen, 1 );
send_ldap_result( op, rs );
goto done;
}
- }
- rs->sr_err = slap_mods2entry( modlist, &op->ora_e,
- repl_user, 0, &rs->sr_text, textbuf, textlen );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- send_ldap_result( op, rs );
- goto done;
- }
+ /* check for duplicate values */
+ rs->sr_err = slap_mods_no_repl_user_mod_check( op,
+ modlist, &rs->sr_text, textbuf, textlen );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ send_ldap_result( op, rs );
+ goto done;
+ }
-#ifdef LDAP_SLAPI
- /*
- * Call the preoperation plugin here, because the entry
- * will actually contain something.
- */
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
+ rs->sr_err = slap_mods2entry( *modtail, &op->ora_e,
+ 0, 0, &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
+ send_ldap_result( op, rs );
goto done;
}
}
-#endif /* LDAP_SLAPI */
#ifdef SLAPD_MULTIMASTER
if ( !repl_user )
#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
-#ifdef LDAP_SLAPI
- /*
- * SLAPI_ADD_ENTRY will be empty, but this may be acceptable
- * on replicas (for now, it involves the minimum code intrusion).
- */
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
#endif /* SLAPD_MULTIMASTER */
}
} else {
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
- }
-#endif
Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 );
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"operation not supported within namingContext" );
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_add_postop_plugins( op );
-#endif /* LDAP_SLAPI */
-
done:;
return rc;
}
slap_mods2entry(
Modifications *mods,
Entry **e,
- int repl_user,
+ int initial,
int dup,
const char **text,
char *textbuf, size_t textlen )
{
- Attribute **tail = &(*e)->e_attrs;
- assert( *tail == NULL );
+ Attribute **tail;
+
+ if ( initial ) {
+ assert( (*e)->e_attrs == NULL );
+ }
+
+ for ( tail = &(*e)->e_attrs; *tail != NULL; tail = &(*tail)->a_next )
+ ;
*text = textbuf;
for( ; mods != NULL; mods = mods->sml_next ) {
Attribute *attr;
- if ( !repl_user ) {
- assert( mods->sml_op == LDAP_MOD_ADD );
- }
assert( mods->sml_desc != NULL );
attr = attr_find( (*e)->e_attrs, mods->sml_desc );
#ifdef SLURPD_FRIENDLY
ber_len_t i,j;
- if( !repl_user ) {
- snprintf( textbuf, textlen,
- "attribute '%s' provided more than once",
- mods->sml_desc->ad_cname.bv_val );
- return LDAP_TYPE_OR_VALUE_EXISTS;
+ if ( !initial ) {
+ /*
+ * This check allows overlays to override operational
+ * attributes by setting them directly in the entry.
+ * We assume slap_mods_no_user_mod_check() was called
+ * with the user modifications.
+ */
+ *text = NULL;
+ return LDAP_SUCCESS;
}
for( i=0; attr->a_vals[i].bv_val; i++ ) {
for ( j = 0; mods->sml_values[j].bv_val; j++ ) {
ber_dupbv( &attr->a_vals[i+j], &mods->sml_values[j] );
}
- BER_BVZERO( &attr->a_vals[i+j] );
+ BER_BVZERO( &attr->a_vals[i+j] );
+ j++;
} else {
AC_MEMCPY( &attr->a_vals[i], mods->sml_values,
sizeof( struct berval ) * j );
- ch_free( mods->sml_values );
- mods->sml_values = NULL;
}
if( mods->sml_nvalues ) {
} else {
AC_MEMCPY( &attr->a_nvals[i], mods->sml_nvalues,
sizeof( struct berval ) * j );
- ch_free( mods->sml_nvalues );
- mods->sml_nvalues = NULL;
}
} else {
attr->a_nvals = attr->a_vals;
/* move ad to attr structure */
attr->a_desc = mods->sml_desc;
- if ( !dup ) mods->sml_desc = NULL;
/* move values to attr structure */
/* should check for duplicates */
BER_BVZERO( &attr->a_vals[i] );
} else {
attr->a_vals = mods->sml_values;
- mods->sml_values = NULL;
}
if ( mods->sml_nvalues ) {
BER_BVZERO( &attr->a_nvals[i] );
} else {
attr->a_nvals = mods->sml_nvalues;
- mods->sml_nvalues = NULL;
}
} else {
attr->a_nvals = attr->a_vals;
return LDAP_SUCCESS;
}
-#ifdef LDAP_SLAPI
-static void init_add_pblock( Operation *op,
- struct berval *dn, Entry *e, int manageDSAit )
-{
- slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_ADD_TARGET, (void *)dn->bv_val );
- slapi_pblock_set( op->o_pb, SLAPI_ADD_ENTRY, (void *)e );
- slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
-}
-
-static int call_add_preop_plugins( Operation *op )
-{
- int rc;
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_ADD_FN, op->o_pb );
- if ( rc < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE,
- "do_add: add preoperation plugin failed.\n",
- 0, 0, 0);
-
- if (( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE,
- (void *)&rc ) != 0 ) || rc == LDAP_SUCCESS )
- {
- rc = LDAP_OTHER;
- }
- } else {
- rc = LDAP_SUCCESS;
- }
-
- return rc;
-}
-
-static void call_add_postop_plugins( Operation *op )
-{
- int rc;
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_ADD_FN, op->o_pb );
- if ( rc < 0 ) {
- Debug(LDAP_DEBUG_TRACE,
- "do_add: add postoperation plugin failed\n",
- 0, 0, 0);
- }
-}
-#endif /* LDAP_SLAPI */
a = LDAP_STAILQ_FIRST(&attr_list);
LDAP_STAILQ_REMOVE_HEAD(&attr_list, sat_next);
- if (a->sat_subtypes) ldap_memfree(a->sat_subtypes);
+ if ( a->sat_equality ) {
+ MatchingRule *mr;
+
+ mr = mr_find( a->sat_equality->smr_oid );
+ assert( mr != NULL );
+ if ( mr != a->sat_equality ) {
+ ch_free( a->sat_equality );
+ a->sat_equality = NULL;
+ }
+ }
+
+ assert( a->sat_syntax != NULL );
+ if ( a->sat_syntax != NULL ) {
+ Syntax *syn;
+
+ syn = syn_find( a->sat_syntax->ssyn_oid );
+ assert( syn != NULL );
+ if ( syn != a->sat_syntax ) {
+ ch_free( a->sat_syntax );
+ a->sat_syntax = NULL;
+ }
+ }
+
+ if ( a->sat_oidmacro ) ldap_memfree( a->sat_oidmacro );
+ if ( a->sat_subtypes ) ldap_memfree( a->sat_subtypes );
ad_destroy(a->sat_ad);
ldap_pvt_thread_mutex_destroy(&a->sat_ad_mutex);
ldap_attributetype_free((LDAPAttributeType *)a);
int
at_start( AttributeType **at )
{
- assert( at );
+ assert( at != NULL );
*at = LDAP_STAILQ_FIRST(&attr_list);
int
at_next( AttributeType **at )
{
- assert( at );
+ assert( at != NULL );
#if 1 /* pedantic check */
{
}
}
- assert( tmp );
+ assert( tmp != NULL );
}
#endif
int
at_add(
- LDAPAttributeType *at,
- int user,
- AttributeType **rsat,
- const char **err )
+ LDAPAttributeType *at,
+ int user,
+ AttributeType **rsat,
+ const char **err )
{
AttributeType *sat;
MatchingRule *mr;
if ( supsat == NULL ) {
*err = at->at_sup_oid;
- return SLAP_SCHERR_ATTR_NOT_FOUND;
+ code = SLAP_SCHERR_ATTR_NOT_FOUND;
+ goto error_return;
}
sat->sat_sup = supsat;
if ( at_append_to_list(sat, &supsat->sat_subtypes) ) {
- return SLAP_SCHERR_OUTOFMEM;
+ code = SLAP_SCHERR_OUTOFMEM;
+ goto error_return;
}
if ( sat->sat_usage != supsat->sat_usage ) {
/* subtypes must have same usage as their SUP */
- return SLAP_SCHERR_ATTR_BAD_USAGE;
+ code = SLAP_SCHERR_ATTR_BAD_USAGE;
+ goto error_return;
}
if ( supsat->sat_obsolete && !sat->sat_obsolete ) {
/* subtypes must be obsolete if super is */
- return SLAP_SCHERR_ATTR_BAD_SUP;
+ code = SLAP_SCHERR_ATTR_BAD_SUP;
+ goto error_return;
}
if ( sat->sat_flags & SLAP_AT_FINAL ) {
/* cannot subtype a "final" attribute type */
- return SLAP_SCHERR_ATTR_BAD_SUP;
+ code = SLAP_SCHERR_ATTR_BAD_SUP;
+ goto error_return;
}
}
syn = syn_find(sat->sat_syntax_oid);
if ( syn == NULL ) {
*err = sat->sat_syntax_oid;
- return SLAP_SCHERR_SYN_NOT_FOUND;
+ code = SLAP_SCHERR_SYN_NOT_FOUND;
+ goto error_return;
}
if( sat->sat_syntax != NULL && sat->sat_syntax != syn ) {
- return SLAP_SCHERR_ATTR_BAD_SUP;
+ code = SLAP_SCHERR_ATTR_BAD_SUP;
+ goto error_return;
}
sat->sat_syntax = syn;
} else if ( sat->sat_syntax == NULL ) {
- return SLAP_SCHERR_ATTR_INCOMPLETE;
+ code = SLAP_SCHERR_ATTR_INCOMPLETE;
+ goto error_return;
}
if ( sat->sat_equality_oid ) {
if( mr == NULL ) {
*err = sat->sat_equality_oid;
- return SLAP_SCHERR_MR_NOT_FOUND;
+ code = SLAP_SCHERR_MR_NOT_FOUND;
+ goto error_return;
}
if(( mr->smr_usage & SLAP_MR_EQUALITY ) != SLAP_MR_EQUALITY ) {
*err = sat->sat_equality_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
if( sat->sat_syntax != mr->smr_syntax ) {
if( mr->smr_compat_syntaxes == NULL ) {
*err = sat->sat_equality_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
for(i=0; mr->smr_compat_syntaxes[i]; i++) {
if( i >= 0 ) {
*err = sat->sat_equality_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
}
if ( sat->sat_ordering_oid ) {
if( !sat->sat_equality ) {
*err = sat->sat_ordering_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
mr = mr_find(sat->sat_ordering_oid);
if( mr == NULL ) {
*err = sat->sat_ordering_oid;
- return SLAP_SCHERR_MR_NOT_FOUND;
+ code = SLAP_SCHERR_MR_NOT_FOUND;
+ goto error_return;
}
if(( mr->smr_usage & SLAP_MR_ORDERING ) != SLAP_MR_ORDERING ) {
*err = sat->sat_ordering_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
if( sat->sat_syntax != mr->smr_syntax ) {
if( mr->smr_compat_syntaxes == NULL ) {
*err = sat->sat_ordering_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
for(i=0; mr->smr_compat_syntaxes[i]; i++) {
if( i >= 0 ) {
*err = sat->sat_ordering_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
}
if ( sat->sat_substr_oid ) {
if( !sat->sat_equality ) {
*err = sat->sat_substr_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
mr = mr_find(sat->sat_substr_oid);
if( mr == NULL ) {
*err = sat->sat_substr_oid;
- return SLAP_SCHERR_MR_NOT_FOUND;
+ code = SLAP_SCHERR_MR_NOT_FOUND;
+ goto error_return;
}
if(( mr->smr_usage & SLAP_MR_SUBSTR ) != SLAP_MR_SUBSTR ) {
*err = sat->sat_substr_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
/* due to funky LDAP builtin substring rules,
if( sat->sat_syntax != sat->sat_equality->smr_syntax ) {
if( sat->sat_equality->smr_compat_syntaxes == NULL ) {
*err = sat->sat_substr_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
for(i=0; sat->sat_equality->smr_compat_syntaxes[i]; i++) {
if( i >= 0 ) {
*err = sat->sat_substr_oid;
- return SLAP_SCHERR_ATTR_BAD_MR;
+ code = SLAP_SCHERR_ATTR_BAD_MR;
+ goto error_return;
}
}
}
code = at_insert( sat, err );
- if ( code == 0 && rsat )
+ if ( code != 0 ) {
+error_return:;
+ if ( sat ) {
+ ldap_pvt_thread_mutex_destroy( &sat->sat_ad_mutex );
+ ch_free( sat );
+ }
+
+ if ( oidm ) {
+ SLAP_FREE( at->at_oid );
+ at->at_oid = oidm;
+ }
+
+ } else if ( rsat ) {
*rsat = sat;
+ }
+
return code;
}
BER_BVZERO( &tmp->a_vals[i] );
/* a_nvals must be non null; it may be equal to a_vals */
- assert( a->a_nvals );
+ assert( a->a_nvals != NULL );
if ( a->a_nvals != a->a_vals ) {
tmp->a_nvals = ch_malloc( (i + 1) * sizeof(struct berval) );
ctrls[num_ctrls] = 0;
/* check entry's schema */
- rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e, NULL,
+ rs->sr_err = entry_schema_check( op, op->oq_add.rs_e, NULL,
get_manageDIT(op), &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
if (slot_data->al_appname) free (slot_data->al_appname);
slot_data->al_appname = calloc (1, ALOCK_MAX_APPNAME);
- strncpy (slot_data->al_appname, slotbuf+32, ALOCK_MAX_APPNAME-1);
+ strncpy (slot_data->al_appname, (char *)slotbuf+32, ALOCK_MAX_APPNAME-1);
(slot_data->al_appname) [ALOCK_MAX_APPNAME-1] = '\0';
return 0;
alock_write_iattr (slotbuf+16, slot_data->al_stamp);
alock_write_iattr (slotbuf+24, slot_data->al_pid);
- strncpy (slotbuf+32, slot_data->al_appname, ALOCK_MAX_APPNAME-1);
+ strncpy ((char *)slotbuf+32, slot_data->al_appname, ALOCK_MAX_APPNAME-1);
slotbuf[ALOCK_SLOT_SIZE-1] = '\0';
res = lseek (info->al_fd,
(void) memset ((void *) &slot_data, 0, sizeof (alock_slot_t));
alock_read_slot (info, &slot_data);
- if (slot_data.al_lock == ALOCK_UNLOCKED) return ALOCK_UNLOCKED;
if (slot_data.al_appname != NULL) free (slot_data.al_appname);
slot_data.al_appname = NULL;
+ if (slot_data.al_lock == ALOCK_UNLOCKED) return ALOCK_UNLOCKED;
+
res = alock_test_lock (info->al_fd, info->al_slot);
if (res < 0) return -1;
if (res > 0) {
#define BDB_UPD_CONFIG 0x04
#define BDB_DEL_INDEX 0x08
#define BDB_RE_OPEN 0x10
+#ifdef BDB_HIER
+ int bi_modrdns; /* number of modrdns completed */
+ ldap_pvt_thread_mutex_t bi_modrdns_mutex;
+#endif
};
#define bi_id2entry bi_databases[BDB_ID2ENTRY]
/* Copy an ID "src" to pointer "dst" in big-endian byte order */
#define BDB_ID2DISK( src, dst ) \
do { int i0; ID tmp; unsigned char *_p; \
- tmp = (src); _p = (char *)(dst); \
+ tmp = (src); _p = (unsigned char *)(dst); \
for ( i0=sizeof(ID)-1; i0>=0; i0-- ) { \
_p[i0] = tmp & 0xff; tmp >>= 8; \
} \
- } while(0);
+ } while(0)
/* Copy a pointer "src" to a pointer "dst" from big-endian to native order */
#define BDB_DISK2ID( src, dst ) \
for ( i0=0; i0<sizeof(ID); i0++ ) { \
tmp <<= 8; tmp |= *_p++; \
} *(dst) = tmp; \
- } while (0);
+ } while (0)
LDAP_END_DECL
u_int32_t locker )
{
EntryInfo *new, ei;
- struct berval rdn = e->e_name;
DB_LOCK lock;
int rc;
+#ifdef BDB_HIER
+ struct berval rdn = e->e_name;
+#endif
ei.bei_id = e->e_id;
ei.bei_parent = eip;
*/
int
bdb_cache_modrdn(
+ struct bdb_info *bdb,
Entry *e,
struct berval *nrdn,
Entry *new,
EntryInfo *ein,
- DB_ENV *env,
u_int32_t locker,
DB_LOCK *lock )
{
EntryInfo *ei = BEI(e), *pei;
- struct berval rdn;
int rc;
+#ifdef BDB_HIER
+ struct berval rdn;
+#endif
/* Get write lock on data */
- rc = bdb_cache_entry_db_relock( env, locker, ei, 1, 0, lock );
+ rc = bdb_cache_entry_db_relock( bdb->bi_dbenv, locker, ei, 1, 0, lock );
if ( rc ) return rc;
/* If we've done repeated mods on a cached entry, then e_attrs
}
#ifdef BDB_HIER
{
- int max = ei->bei_modrdns;
/* Record the generation number of this change */
- for ( pei = ein; pei->bei_parent; pei = pei->bei_parent ) {
- if ( pei->bei_modrdns > max ) max = pei->bei_modrdns;
- }
- ei->bei_modrdns = max + 1;
+ ldap_pvt_thread_mutex_lock( &bdb->bi_modrdns_mutex );
+ bdb->bi_modrdns++;
+ ei->bei_modrdns = bdb->bi_modrdns;
+ ldap_pvt_thread_mutex_unlock( &bdb->bi_modrdns_mutex );
}
#endif
avl_insert( &ein->bei_kids, ei, bdb_rdn_cmp, avl_dup_error );
EntryInfo *ei = BEI(e);
int rc;
- assert( e->e_private );
+ assert( e->e_private != NULL );
/* Set this early, warn off any queriers */
ei->bei_state |= CACHE_ENTRY_DELETED;
bdb_locker_id_free( void *key, void *data )
{
DB_ENV *env = key;
- int lockid = (int) data;
+ u_int32_t lockid = (u_int32_t) data;
int rc;
rc = XLOCK_ID_FREE( env, lockid );
if ( rc == EINVAL ) {
DB_LOCKREQ lr;
Debug( LDAP_DEBUG_ANY,
- "bdb_locker_id_free: %d err %s(%d)\n",
- lockid, db_strerror(rc), rc );
+ "bdb_locker_id_free: %lu err %s(%d)\n",
+ (unsigned long) lockid, db_strerror(rc), rc );
/* release all locks held by this locker. */
lr.op = DB_LOCK_PUT_ALL;
lr.obj = NULL;
}
int
-bdb_locker_id( Operation *op, DB_ENV *env, int *locker )
+bdb_locker_id( Operation *op, DB_ENV *env, u_int32_t *locker )
{
- int i, rc, lockid;
+ int i, rc;
+ u_int32_t lockid;
void *data;
void *ctx;
return rc;
}
} else {
- lockid = (int)data;
+ lockid = (u_int32_t) data;
}
*locker = lockid;
return 0;
}
-#endif
+#endif /* BDB_REUSE_LOCKERS */
void
bdb_cache_delete_entry(
id++;
getnext = 1;
}
-out:
+
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
bdb->bi_index_task = NULL;
bdb->bi_flags |= BDB_HAS_CONFIG;
while ( fgets( buf, sizeof(buf), f )) {
ber_str2bv( buf, 0, 1, &bv );
- if ( bv.bv_val[bv.bv_len-1] == '\n' ) {
+ if ( bv.bv_len > 0 && bv.bv_val[bv.bv_len-1] == '\n' ) {
bv.bv_len--;
bv.bv_val[bv.bv_len] = '\0';
}
/* shouldn't need this, but ... */
- if ( bv.bv_val[bv.bv_len-1] == '\r' ) {
+ if ( bv.bv_len > 0 && bv.bv_val[bv.bv_len-1] == '\r' ) {
bv.bv_len--;
bv.bv_val[bv.bv_len] = '\0';
}
}
#else /* BDB_HIER */
-/* Experimental management routines for a hierarchically structured database.
- *
- * Unsupported! Use at your own risk!
- * -- Howard Chu, Symas Corp. 2003.
+/* Management routines for a hierarchically structured database.
*
* Instead of a ldbm-style dn2id database, we use a hierarchical one. Each
* entry in this database is a struct diskNode, keyed by entryID and with
*/
typedef struct diskNode {
unsigned char nrdnlen[2];
- unsigned char nrdn[1];
- unsigned char rdn[1];
- unsigned char entryID[sizeof(ID)];
+ char nrdn[1];
+ char rdn[1]; /* variable placement */
+ unsigned char entryID[sizeof(ID)]; /* variable placement */
} diskNode;
/* This function constructs a full DN for a given entry.
* will fail harmlessly.
*/
if ( eip->bei_id == 0 ) {
- diskNode dummy = {0};
+ diskNode dummy = {{0, 0}, "", "", ""};
data.data = &dummy;
data.size = sizeof(diskNode);
data.flags = DB_DBT_USERMEM;
DBT key, data;
DBC *cursor;
diskNode *d;
- int rc, nrlen;
+ int rc;
ID nid;
unsigned char dlen[2];
diskNode *d;
char *ptr;
unsigned char dlen[2];
- ID idp;
+ ID idp, parentID;
nrlen = dn_rdnlen( op->o_bd, in );
if (!nrlen) nrlen = in->bv_len;
key.data = &idp;
key.ulen = sizeof(ID);
key.flags = DB_DBT_USERMEM;
- BDB_ID2DISK( ei->bei_parent->bei_id, &idp );
+ parentID = ( ei->bei_parent != NULL ) ? ei->bei_parent->bei_id : 0;
+ BDB_ID2DISK( parentID, &idp );
DBTzero(&data);
data.size = sizeof(diskNode) + nrlen - sizeof(ID) - 1;
ei->bei_rdn.bv_len = data.size - sizeof(diskNode) - nrlen;
ptr = d->nrdn + nrlen + 1;
ber_str2bv( ptr, ei->bei_rdn.bv_len, 1, &ei->bei_rdn );
- if ( !ei->bei_parent->bei_dkids ) {
+ if ( ei->bei_parent != NULL && !ei->bei_parent->bei_dkids ) {
db_recno_t dkids;
/* How many children does the parent have? */
/* FIXME: do we need to lock the parent
int rc = 0;
diskNode *d;
char *ptr;
- unsigned char *pt2;
ID nid;
DBTzero(&key);
/* if no GE index, use pres */
Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
if( f->f_ava->aa_desc->ad_type->sat_ordering &&
- ( f->f_ava->aa_desc->ad_type->sat_ordering->smr_usage && SLAP_MR_ORDERED_INDEX ) )
+ ( f->f_ava->aa_desc->ad_type->sat_ordering->smr_usage & SLAP_MR_ORDERED_INDEX ) )
rc = inequality_candidates( op, f->f_ava, ids, tmp, LDAP_FILTER_GE );
else
rc = presence_candidates( op, f->f_ava->aa_desc, ids );
/* if no LE index, use pres */
Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
if( f->f_ava->aa_desc->ad_type->sat_ordering &&
- ( f->f_ava->aa_desc->ad_type->sat_ordering->smr_usage && SLAP_MR_ORDERED_INDEX ) )
+ ( f->f_ava->aa_desc->ad_type->sat_ordering->smr_usage & SLAP_MR_ORDERED_INDEX ) )
rc = inequality_candidates( op, f->f_ava, ids, tmp, LDAP_FILTER_LE );
else
rc = presence_candidates( op, f->f_ava->aa_desc, ids );
*/
int bdb_idl_append_one( ID *ids, ID id )
{
- unsigned x;
-
if (BDB_IDL_IS_RANGE( ids )) {
/* if already in range, treat as a dup */
if (id >= BDB_IDL_FIRST(ids) && id <= BDB_IDL_LAST(ids))
DB *db;
struct berval *keys;
- assert( mask );
+ assert( mask != 0 );
rc = bdb_db_cache( op->o_bd, atname->bv_val, &db );
#ifdef LDAP_COMP_MATCH
ComponentReference *cr_list = NULL;
ComponentReference *cr = NULL, *dupped_cr = NULL;
- void* decoded_comp, *extracted_comp;
+ void* decoded_comp;
ComponentSyntaxInfo* csi_attr;
Syntax* syn;
AttributeType* at;
#include <ac/stdlib.h>
#include <ac/errno.h>
#include <sys/stat.h>
+#ifdef HAVE_UTIME_H
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# include <utime.h>
+#endif /* HAVE_UTIME_H */
#include "back-bdb.h"
#include <lutil.h>
#include <ldap_rq.h>
ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
+#ifdef BDB_HIER
+ ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
+#endif
ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
return bdb_do_recovery( be );
}
-re_exit:
Debug( LDAP_DEBUG_ANY,
"bdb_db_recover: Database cannot be recovered. "\
"Restore from backup!\n", 0, 0, 0);
char path[MAXPATHLEN];
char *ptr;
+ if ( be->be_suffix == NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_open: need suffix\n",
+ 0, 0, 0 );
+ return -1;
+ }
+
Debug( LDAP_DEBUG_ARGS,
"bdb_db_open: %s\n",
be->be_suffix[0].bv_val, 0, 0 );
struct bdb_db_info *db;
bdb_idl_cache_entry_t *entry, *next_entry;
+ /* backend_shutdown closes everything, even if not all were opened */
+ if ( !( bdb->bi_flags & BDB_IS_OPEN ))
+ return 0;
+
bdb->bi_flags &= ~BDB_IS_OPEN;
ber_bvarray_free( bdb->bi_db_config );
db_strerror(rc), rc, 0 );
return rc;
}
+
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 2
+ /* Delete the environment if we were in quick mode. This
+ * works around a bug in bdb4.2 that interferes with the
+ * operation of db_stat and other tools after a slapadd -q
+ * or slapindex -q has taken place.
+ */
+ if( slapMode & SLAP_TOOL_QUICK ) {
+ rc = db_env_create( &bdb->bi_dbenv, 0 );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_close: db_env_create failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return rc;
+ }
+ rc = bdb->bi_dbenv->remove(bdb->bi_dbenv, bdb->bi_dbenv_home,
+ DB_FORCE);
+ bdb->bi_dbenv = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_close: dbenv_remove failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return rc;
+ }
+ }
+#endif
}
rc = alock_close( &bdb->bi_alock_info );
static int
bdb_db_destroy( BackendDB *be )
{
- int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
+#ifdef BDB_HIER
+ ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
+#endif
ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
}
/* check that the entry still obeys the schema */
- rc = entry_schema_check( op->o_bd, e, save_attrs, get_manageDIT(op),
+ rc = entry_schema_check( op, e, save_attrs, get_manageDIT(op),
text, textbuf, textlen );
if ( rc != LDAP_SUCCESS || op->o_noop ) {
attrs_free( e->e_attrs );
}
} else {
- rc = bdb_cache_modrdn( e, &op->orr_nnewrdn, &dummy, neip,
- bdb->bi_dbenv, locker, &lock );
+ rc = bdb_cache_modrdn( bdb, e, &op->orr_nnewrdn, &dummy, neip,
+ locker, &lock );
switch( rc ) {
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
free( mod );
}
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
/* LDAP v3 Support */
{
int rc;
- assert( e );
+ assert( e != NULL );
/* NOTE: this should never happen, but it actually happens
* when using back-relay; until we find a better way to
{
Attribute **ap;
- assert( rs->sr_entry );
+ assert( rs->sr_entry != NULL );
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count */ ;
rc = bdb_hasSubordinates( op, rs->sr_entry, &hasSubordinates );
if ( rc == LDAP_SUCCESS ) {
*ap = slap_operational_hasSubordinate( hasSubordinates == LDAP_COMPARE_TRUE );
- assert( *ap );
+ assert( *ap != NULL );
ap = &(*ap)->a_next;
}
#if 0
void bdb_unlocked_cache_return_entry_rw( Cache *cache, Entry *e, int rw );
#else
-#define bdb_unlocked_cache_return_entry_rw( a, b, c )
+#define bdb_unlocked_cache_return_entry_rw( a, b, c ) ((void)0)
#endif
#define bdb_unlocked_cache_return_entry_r( c, e ) \
bdb_unlocked_cache_return_entry_rw((c), (e), 0)
u_int32_t locker
);
int bdb_cache_modrdn(
+ struct bdb_info *bdb,
Entry *e,
struct berval *nrdn,
Entry *new,
EntryInfo *ein,
- DB_ENV *env,
u_int32_t locker,
DB_LOCK *lock
);
#ifdef BDB_REUSE_LOCKERS
#define bdb_locker_id BDB_SYMBOL(locker_id)
-int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
+int bdb_locker_id( Operation *op, DB_ENV *env, u_int32_t *locker );
-#define LOCK_ID_FREE(env, locker)
+#define LOCK_ID_FREE(env, locker) ((void)0)
#define LOCK_ID(env, locker) bdb_locker_id(op, env, locker)
#else
Entry *matched = NULL;
EntryInfo *ei, ei_root = {0};
struct berval realbase = BER_BVNULL;
+#ifdef SLAP_ACL_HONOR_DISCLOSE
slap_mask_t mask;
+#endif
int manageDSAit;
int tentries = 0;
ID lastid = NOID;
{
int rc = 0;
- assert( f );
+ assert( f != NULL );
if( cur > *max ) *max = cur;
{
Operation op = {0};
Opheader ohdr = {0};
- EntryInfo ei = {0};
+ EntryInfo *ei = NULL;
+ int rc;
if ( BER_BVISEMPTY(dn) )
return 0;
op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs;
- ei.bei_id = NOID;
-
- bdb_dn2id( &op, NULL, dn, &ei );
+ rc = bdb_cache_find_ndn( &op, NULL, dn, &ei );
+ if ( ei ) bdb_cache_entryinfo_unlock( ei );
+ if ( rc == DB_NOTFOUND )
+ return NOID;
- return ei.bei_id;
+ return ei->bei_id;
}
int bdb_tool_id2entry_get(
{
int rc;
Entry *e = NULL;
+#ifndef BDB_HIER
struct berval bv;
+#endif
assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
- assert( text );
- assert( text->bv_val );
+ assert( text != NULL );
+ assert( text->bv_val != NULL );
assert( text->bv_val[0] == '\0' ); /* overconservative? */
Debug( LDAP_DEBUG_TRACE, "=> " LDAP_XSTRING(bdb_tool_entry_put)
assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
- assert( text );
- assert( text->bv_val );
+ assert( text != NULL );
+ assert( text->bv_val != NULL );
assert( text->bv_val[0] == '\0' ); /* overconservative? */
assert ( e->e_id != NOID );
struct berval lc_local_ndn;
int lc_bound;
int lc_ispriv;
- ldap_pvt_thread_mutex_t lc_mutex;
unsigned lc_refcnt;
};
if ( !BER_BVISNULL( &lc->lc_cred ) ) {
memset( lc->lc_cred.bv_val, 0,
lc->lc_cred.bv_len );
- ch_free( lc->lc_cred.bv_val );
}
- ber_dupbv( &lc->lc_cred, &op->orb_cred );
+ ber_bvreplace( &lc->lc_cred, &op->orb_cred );
ldap_set_rebind_proc( lc->lc_ld, ldap_back_rebind, lc );
}
}
ldap_back_conn_cmp );
assert( lc != NULL );
- if ( !BER_BVISNULL( &lc->lc_local_ndn ) ) {
- ch_free( lc->lc_local_ndn.bv_val );
- }
- ber_dupbv( &lc->lc_local_ndn, &op->o_req_ndn );
+ ber_bvreplace( &lc->lc_local_ndn, &op->o_req_ndn );
lerr = avl_insert( &li->conntree, (caddr_t)lc,
ldap_back_conn_cmp, ldap_back_conn_dup );
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
if ( lerr == -1 ) {
- /* handle this! (e.g. wait until refcnt goes to 1...) */
+ /* we can do this because lc_refcnt == 1 */
ldap_back_conn_free( lc );
lc = NULL;
}
ldap_back_freeconn( Operation *op, struct ldapconn *lc )
{
struct ldapinfo *li = (struct ldapinfo *) op->o_bd->be_private;
- int rc = 0;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
assert( lc->lc_refcnt > 0 );
if ( --lc->lc_refcnt == 0 ) {
ldap_back_conn_free( (void *)lc );
}
+
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
- return rc;
+ return 0;
}
static int
if ( rs->sr_err == LDAP_SERVER_DOWN
|| ( rs->sr_err != LDAP_SUCCESS && LDAP_BACK_TLS_CRITICAL( li ) ) )
{
- ldap_unbind_ext_s( ld, NULL, NULL );
+ ldap_unbind_ext( ld, NULL, NULL );
goto error_return;
}
#endif /* HAVE_TLS */
if ( *lcp == NULL ) {
- *lcp = (struct ldapconn *)ch_malloc( sizeof( struct ldapconn ) );
- memset( *lcp, 0, sizeof( struct ldapconn ) );
+ *lcp = (struct ldapconn *)ch_calloc( 1, sizeof( struct ldapconn ) );
}
(*lcp)->lc_ld = ld;
(*lcp)->lc_refcnt = 1;
ldap_back_getconn( Operation *op, SlapReply *rs, ldap_back_send_t sendok )
{
struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private;
- struct ldapconn *lc, lc_curr = { 0 };
+ struct ldapconn *lc,
+ lc_curr = { 0 };
+ int refcnt = 1;
/* Searches for a ldapconn in the avl tree */
}
/* Internal searches are privileged and shared. So is root. */
+ /* FIXME: there seem to be concurrency issues */
if ( op->o_do_not_cache || be_isroot( op ) ) {
lc_curr.lc_local_ndn = op->o_bd->be_rootndn;
lc_curr.lc_conn = NULL;
lc_curr.lc_local_ndn = op->o_ndn;
}
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
lc = (struct ldapconn *)avl_find( li->conntree,
(caddr_t)&lc_curr, ldap_back_conn_cmp );
if ( lc != NULL ) {
- lc->lc_refcnt++;
+ refcnt = ++lc->lc_refcnt;
}
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
/* Looks like we didn't get a bind. Open a new session... */
if ( lc == NULL ) {
- /* lc here must be NULL */
if ( ldap_back_prepare_conn( &lc, op, rs, sendok ) != LDAP_SUCCESS ) {
return NULL;
}
lc->lc_conn = lc_curr.lc_conn;
ber_dupbv( &lc->lc_local_ndn, &lc_curr.lc_local_ndn );
- ldap_pvt_thread_mutex_init( &lc->lc_mutex );
-
if ( lc_curr.lc_ispriv ) {
ber_dupbv( &lc->lc_cred, &li->acl_passwd );
ber_dupbv( &lc->lc_bound_ndn, &li->acl_authcDN );
BER_BVZERO( &lc->lc_cred );
BER_BVZERO( &lc->lc_bound_ndn );
if ( op->o_conn && !BER_BVISEMPTY( &op->o_ndn )
- && op->o_bd == op->o_conn->c_authz_backend )
+ && op->o_bd->be_private == op->o_conn->c_authz_backend->be_private )
{
ber_dupbv( &lc->lc_bound_ndn, &op->o_ndn );
}
lc->lc_bound = 0;
/* Inserts the newly created ldapconn in the avl tree */
-retry_lock2:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock2;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
assert( lc->lc_refcnt == 1 );
rs->sr_err = avl_insert( &li->conntree, (caddr_t)lc,
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: conn %p inserted (refcnt=%u)\n",
- (void *)lc, lc->lc_refcnt, 0 );
+ (void *)lc, refcnt, 0 );
/* Err could be -1 in case a duplicate ldapconn is inserted */
if ( rs->sr_err != 0 ) {
} else {
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: conn %p fetched (refcnt=%u)\n",
- (void *)lc, lc->lc_refcnt, 0 );
+ (void *)lc, refcnt, 0 );
}
return lc;
{
struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
-
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
assert( lc->lc_refcnt > 0 );
lc->lc_refcnt--;
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
* Note: as the check for the value of lc->lc_bound was already here, I removed
* it from all the callers, and I made the function return the flag, so
* it can be used to simplify the check.
+ *
+ * Note: dolock indicates whether li->conn_mutex must be locked or not
*/
static int
ldap_back_dobind_int(
if ( rs->sr_err == LDAP_SERVER_DOWN ) {
if ( retries > 0 ) {
if ( dolock ) {
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
}
assert( lc->lc_refcnt > 0 );
if ( lc->lc_refcnt == 1 ) {
- ldap_unbind_ext_s( lc->lc_ld, NULL, NULL );
+ ldap_unbind_ext( lc->lc_ld, NULL, NULL );
lc->lc_ld = NULL;
/* lc here must be the regular lc, reset and ready for init */
int
ldap_back_dobind( struct ldapconn *lc, Operation *op, SlapReply *rs, ldap_back_send_t sendok )
{
- int rc;
-
- ldap_pvt_thread_mutex_lock( &lc->lc_mutex );
- rc = ldap_back_dobind_int( lc, op, rs, sendok, 1, 1 );
- ldap_pvt_thread_mutex_unlock( &lc->lc_mutex );
-
- return rc;
+ return ldap_back_dobind_int( lc, op, rs, sendok, 1, 1 );
}
/*
int rc = 0;
struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &li->conn_mutex );
if ( lc->lc_refcnt == 1 ) {
- ldap_pvt_thread_mutex_lock( &lc->lc_mutex );
- ldap_unbind_ext_s( lc->lc_ld, NULL, NULL );
+ ldap_unbind_ext( lc->lc_ld, NULL, NULL );
lc->lc_ld = NULL;
lc->lc_bound = 0;
if ( rc == LDAP_SUCCESS ) {
rc = ldap_back_dobind_int( lc, op, rs, sendok, 0, 0 );
}
- ldap_pvt_thread_mutex_unlock( &lc->lc_mutex );
}
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
rs->sr_err = LDAP_SUCCESS;
+ /* FIXME: SASL/EXTERNAL over ldapi:// doesn't honor the authcID,
+ * but if it is not set this test fails. We need a different
+ * means to detect if idassert is enabled */
if ( ( BER_BVISNULL( &li->idassert_authcID ) || BER_BVISEMPTY( &li->idassert_authcID ) )
- && ( BER_BVISNULL( &li->idassert_authcDN ) || BER_BVISEMPTY( &li->idassert_authcDN ) ) ) {
+ && ( BER_BVISNULL( &li->idassert_authcDN ) || BER_BVISEMPTY( &li->idassert_authcDN ) ) )
+ {
goto done;
}
rc = slap_sasl_matches( op, li->idassert_authz,
&authcDN, & authcDN );
if ( rc != LDAP_SUCCESS ) {
- if ( li->idassert_flags & LDAP_BACK_AUTH_PRESCRIPTIVE ) {
+ if ( li->idassert_flags & LDAP_BACK_AUTH_PRESCRIPTIVE )
+ {
/* op->o_conn->c_ndn is not authorized
* to use idassert */
return rc;
ctrls[ 0 ]->ldctl_value.bv_len = assertedID.bv_len + STRLENOF( "dn:" );
ctrls[ 0 ]->ldctl_value.bv_val = ch_malloc( ctrls[ 0 ]->ldctl_value.bv_len + 1 );
AC_MEMCPY( ctrls[ 0 ]->ldctl_value.bv_val, "dn:", STRLENOF( "dn:" ) );
- AC_MEMCPY( ctrls[ 0 ]->ldctl_value.bv_val + STRLENOF( "dn:" ),
+ AC_MEMCPY( &ctrls[ 0 ]->ldctl_value.bv_val[ STRLENOF( "dn:" ) ],
assertedID.bv_val, assertedID.bv_len + 1 );
break;
}
* added by back-ldap, so it's the only one we explicitly
* free */
if ( ctrls && ctrls != op->o_ctrls ) {
- assert( ctrls[ 0 ] );
+ assert( ctrls[ 0 ] != NULL );
if ( !BER_BVISNULL( &ctrls[ 0 ]->ldctl_value ) ) {
free( ctrls[ 0 ]->ldctl_value.bv_val );
* added by the chain overlay, so it's the only one we explicitly
* free */
if ( op->o_ctrls != oldctrls ) {
- assert( op->o_ctrls );
- assert( op->o_ctrls[ 0 ] );
+ assert( op->o_ctrls != NULL );
+ assert( op->o_ctrls[ 0 ] != NULL );
free( op->o_ctrls );
}
break;
case LDAP_REQ_ADD:
- {
- int cleanup_attrs = 0;
-
- if ( op->ora_e->e_attrs == NULL ) {
- char textbuf[ SLAP_TEXT_BUFLEN ];
- size_t textlen = sizeof( textbuf );
-
-#if 0
- /* FIXME: op->o_bd is still set to the BackendDB
- * structure of the database that tried to handle
- * the operation and actually returned a referral
- * ... */
- assert( SLAP_DBFLAGS( op->o_bd ) & SLAP_DBFLAG_GLOBAL_OVERLAY );
-#endif
-
- /* global overlay: create entry */
- /* NOTE: this is a hack to use the chain overlay
- * as global. I expect to be able to remove this
- * soon by using slap_mods2entry() earlier in
- * do_add(), adding the operational attrs later
- * if required. */
- rs->sr_err = slap_mods2entry( op->ora_modlist,
- &op->ora_e, 0, 1,
- &rs->sr_text, textbuf, textlen );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- send_ldap_result( op, rs );
- rc = 1;
- break;
- }
- }
+ /* slap_mods2entry () should be called in do_add() */
+ assert( op->ora_e->e_attrs != NULL );
rc = ldap_chain_op( op, rs, lback->bi_op_add, ref );
- if ( cleanup_attrs ) {
- attrs_free( op->ora_e->e_attrs );
- op->ora_e->e_attrs = NULL;
- }
break;
- }
case LDAP_REQ_DELETE:
rc = ldap_chain_op( op, rs, lback->bi_op_delete, ref );
break;
PC_CHAINING = 1
};
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
static ConfigDriver chain_cf_gen;
-static ConfigLDAPadd chain_ldadd;
static ConfigCfAdd chain_cfadd;
+#endif
+static ConfigLDAPadd chain_ldadd;
static ConfigTable chaincfg[] = {
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
return LDAP_SUCCESS;
}
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
+
static int
chain_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca )
{
return 0;
}
-#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
static slap_verbmasks chaining_mode[] = {
{ BER_BVC("referralsRequired"), LDAP_REFERRALS_REQUIRED },
{ BER_BVC("referralsPreferred"), LDAP_REFERRALS_PREFERRED },
{ BER_BVC("chainingPreferred"), LDAP_CHAINING_PREFERRED },
{ BER_BVNULL, 0 }
};
-#endif
static int
chain_cf_gen( ConfigArgs *c )
{
slap_overinst *on = (slap_overinst *)c->bi;
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
ldap_chain_t *lc = (ldap_chain_t *)on->on_bi.bi_private;
+#endif
int rc = 0;
return rc;
}
+#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
+
static int
ldap_chain_db_config(
BackendDB *be,
"SINGLE-VALUE )",
NULL, NULL },
{ "tls", "what", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_TLS,
+ ARG_MAGIC|LDAP_BACK_CFG_TLS,
ldap_back_cf_gen, "( OLcfgDbAt:3.1 "
"NAME 'olcDbStartTLS' "
"DESC 'StartTLS' "
"SYNTAX OMsDN "
"SINGLE-VALUE )",
NULL, NULL },
- /* deprecated; aliases "acl-authcDN" */
+ /* deprecated, will be removed; aliases "acl-authcDN" */
{ "binddn", "DN", 2, 2, 0,
ARG_DN|ARG_MAGIC|LDAP_BACK_CFG_ACL_AUTHCDN,
ldap_back_cf_gen, NULL, NULL, NULL },
{ "acl-passwd", "cred", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_ACL_PASSWD,
+ ARG_MAGIC|LDAP_BACK_CFG_ACL_PASSWD,
ldap_back_cf_gen, "( OLcfgDbAt:3.3 "
"NAME 'olcDbACLPasswd' "
"DESC 'Remote ACL administrative identity credentials' "
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
- /* deprecated; aliases "acl-passwd" */
+ /* deprecated, will be removed; aliases "acl-passwd" */
{ "bindpw", "cred", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_ACL_PASSWD,
+ ARG_MAGIC|LDAP_BACK_CFG_ACL_PASSWD,
+ ldap_back_cf_gen, NULL, NULL, NULL },
+ /* deprecated, will be removed; aliases "acl-bind" */
+ { "acl-method", "args", 2, 0, 0,
+ ARG_MAGIC|LDAP_BACK_CFG_ACL_METHOD,
ldap_back_cf_gen, NULL, NULL, NULL },
{ "acl-bind", "args", 2, 0, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_ACL_BIND,
+ ARG_MAGIC|LDAP_BACK_CFG_ACL_BIND,
ldap_back_cf_gen, "( OLcfgDbAt:3.4 "
"NAME 'olcDbACLBind' "
"DESC 'Remote ACL administrative identity auth bind configuration' "
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
- /* deprecated; aliases "acl-bind" */
- { "acl-method", "args", 2, 0, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_ACL_BIND,
- ldap_back_cf_gen, NULL, NULL, NULL },
{ "idassert-authcDN", "DN", 2, 2, 0,
ARG_DN|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_AUTHCDN,
ldap_back_cf_gen, "( OLcfgDbAt:3.5 "
"SYNTAX OMsDN "
"SINGLE-VALUE )",
NULL, NULL },
- /* deprecated; partially aliases "idassert-authcDN" */
+ /* deprecated, will be removed; partially aliases "idassert-authcDN" */
{ "proxyauthzdn", "DN", 2, 2, 0,
ARG_DN|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_AUTHCDN,
ldap_back_cf_gen, NULL, NULL, NULL },
{ "idassert-passwd", "cred", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_PASSWD,
+ ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_PASSWD,
ldap_back_cf_gen, "( OLcfgDbAt:3.6 "
"NAME 'olcDbIDAssertPasswd' "
"DESC 'Remote Identity Assertion administrative identity credentials' "
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
- /* deprecated; partially aliases "idassert-passwd" */
+ /* deprecated, will be removed; partially aliases "idassert-passwd" */
{ "proxyauthzpw", "cred", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_PASSWD,
+ ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_PASSWD,
ldap_back_cf_gen, NULL, NULL, NULL },
{ "idassert-bind", "args", 2, 0, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_BIND,
+ ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_BIND,
ldap_back_cf_gen, "( OLcfgDbAt:3.7 "
"NAME 'olcDbIDAssertBind' "
"DESC 'Remote Identity Assertion administrative identity auth bind configuration' "
"SINGLE-VALUE )",
NULL, NULL },
{ "idassert-method", "args", 2, 0, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_BIND,
+ ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_METHOD,
ldap_back_cf_gen, NULL, NULL, NULL },
{ "idassert-mode", "mode>|u:<user>|[dn:]<DN", 2, 0, 0,
ARG_STRING|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_MODE,
"SINGLE-VALUE)",
NULL, NULL },
{ "idassert-authzFrom", "authzRule", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_AUTHZFROM,
+ ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_AUTHZFROM,
ldap_back_cf_gen, "( OLcfgDbAt:3.9 "
"NAME 'olcDbIDAssertAuthzFrom' "
"DESC 'Remote Identity Assertion authz rules' "
"X-ORDERED 'VALUES' )",
NULL, NULL },
{ "rebind-as-user", "NO|yes", 1, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_REBIND,
+ ARG_MAGIC|LDAP_BACK_CFG_REBIND,
ldap_back_cf_gen, "( OLcfgDbAt:3.10 "
"NAME 'olcDbRebindAsUser' "
"DESC 'Rebind as user' "
"SINGLE-VALUE )",
NULL, NULL },
{ "chase-referrals", "YES|no", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_CHASE,
+ ARG_MAGIC|LDAP_BACK_CFG_CHASE,
ldap_back_cf_gen, "( OLcfgDbAt:3.11 "
"NAME 'olcDbChaseReferrals' "
"DESC 'Chase referrals' "
"SINGLE-VALUE )",
NULL, NULL },
{ "t-f-support", "NO|yes|discover", 2, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_T_F,
+ ARG_MAGIC|LDAP_BACK_CFG_T_F,
ldap_back_cf_gen, "( OLcfgDbAt:3.12 "
"NAME 'olcDbTFSupport' "
"DESC 'Absolute filters support' "
"SINGLE-VALUE )",
NULL, NULL },
{ "proxy-whoami", "NO|yes", 1, 2, 0,
- ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_WHOAMI,
+ ARG_MAGIC|LDAP_BACK_CFG_WHOAMI,
ldap_back_cf_gen, "( OLcfgDbAt:3.13 "
"NAME 'olcDbProxyWhoAmI' "
"DESC 'Proxy whoAmI exop' "
rc = 1;
} else {
- ber_dupbv( &c->value_bv, &bv );
+ value_add_one( &c->rvalue_vals, &bv );
}
break;
case LDAP_BACK_CFG_ACL_BIND: {
int i;
- bindconf_unparse( &li->acl_sb, &c->value_bv );
+ bindconf_unparse( &li->acl_sb, &bv );
- for ( i = 0; isspace( c->value_bv.bv_val[ i ] ); i++ )
+ for ( i = 0; isspace( bv.bv_val[ i ] ); i++ )
/* count spaces */ ;
if ( i ) {
- c->value_bv.bv_len -= i;
- AC_MEMCPY( c->value_bv.bv_val, &c->value_bv.bv_val[ i ],
- c->value_bv.bv_len + 1 );
+ bv.bv_len -= i;
+ AC_MEMCPY( bv.bv_val, &bv.bv_val[ i ],
+ bv.bv_len + 1 );
}
-
+
+ ber_bvarray_add( &c->rvalue_vals, &bv );
break;
}
for ( i = 0; !BER_BVISNULL( &li->idassert_authz[ i ] ); i++ )
{
- struct berval bv;
-
- ber_dupbv( &bv, &li->idassert_authz[ i ] );
- ber_bvarray_add( &c->rvalue_vals, &bv );
+ value_add_one( &c->rvalue_vals, &li->idassert_authz[ i ] );
}
break;
}
case LDAP_BACK_CFG_IDASSERT_BIND: {
int i;
- struct berval bv = BER_BVNULL,
- bc = BER_BVNULL;
+ struct berval bc = BER_BVNULL;
char *ptr;
if ( li->idassert_authmethod != LDAP_AUTH_NONE ) {
- ber_len_t len = bv.bv_len
- + STRLENOF( "flags=override,non-prescriptive" );
+ ber_len_t len;
switch ( li->idassert_mode ) {
case LDAP_BACK_IDASSERT_OTHERID:
}
if ( li->idassert_flags & LDAP_BACK_AUTH_NATIVE_AUTHZ ) {
- ber_len_t len = bv.bv_len + STRLENOF( "authz=native" );
+ len = bv.bv_len + STRLENOF( "authz=native" );
if ( !BER_BVISEMPTY( &bv ) ) {
len += STRLENOF( " " );
bv.bv_val = ch_realloc( bv.bv_val, len + 1 );
- ptr = bv.bv_val + bv.bv_len;
+ ptr = &bv.bv_val[ bv.bv_len ];
if ( !BER_BVISEMPTY( &bv ) ) {
ptr = lutil_strcopy( ptr, " " );
(void)lutil_strcopy( ptr, "authz=native" );
}
+ len = bv.bv_len + STRLENOF( "flags=non-prescriptive,override" );
/* flags */
if ( !BER_BVISEMPTY( &bv ) ) {
len += STRLENOF( " " );
bindconf_unparse( &li->idassert_sb, &bc );
if ( !BER_BVISNULL( &bv ) ) {
- char *ptr;
+ ber_len_t len = bv.bv_len + bc.bv_len;
- c->value_bv.bv_len = bv.bv_len + bc.bv_len;
- c->value_bv.bv_val = ch_realloc( bv.bv_val, c->value_bv.bv_len + 1 );
+ bv.bv_val = ch_realloc( bv.bv_val, len + 1 );
assert( bc.bv_val[ 0 ] == ' ' );
- ptr = lutil_strcopy( c->value_bv.bv_val, bv.bv_val );
- (void)lutil_strcopy( ptr, bc.bv_val );
-
+ ptr = lutil_strcopy( &bv.bv_val[ bv.bv_len ], bc.bv_val );
free( bc.bv_val );
+ bv.bv_len = ptr - bv.bv_val;
} else {
for ( i = 0; isspace( bc.bv_val[ i ] ); i++ )
AC_MEMCPY( bc.bv_val, &bc.bv_val[ i ], bc.bv_len + 1 );
}
- c->value_bv = bv;
+ bv = bc;
}
+ ber_bvarray_add( &c->rvalue_vals, &bv );
+
break;
}
rc = 1;
} else {
- ber_dupbv( &c->value_bv, &bv );
+ value_add_one( &c->rvalue_vals, &bv );
}
break;
rc = 1;
} else {
- ber_dupbv( &c->value_bv, &bv );
+ value_add_one( &c->rvalue_vals, &bv );
}
break;
rc = 1;
} else {
- ber_dupbv( &c->value_bv, &bv );
+ value_add_one( &c->rvalue_vals, &bv );
}
break;
rc = 1;
} else {
- ber_dupbv( &c->value_bv, &bv );
+ value_add_one( &c->rvalue_vals, &bv );
}
break;
default:
- /* we need to handle all... */
+ /* FIXME: we need to handle all... */
assert( 0 );
break;
}
break;
case LDAP_BACK_CFG_TLS:
+ rc = 1;
+ break;
+
case LDAP_BACK_CFG_ACL_AUTHCDN:
case LDAP_BACK_CFG_ACL_PASSWD:
case LDAP_BACK_CFG_ACL_METHOD:
break;
default:
- /* we need to handle all... */
+ /* FIXME: we need to handle all... */
assert( 0 );
break;
}
switch( c->type ) {
case LDAP_BACK_CFG_URI: {
LDAPURLDesc *tmpludp;
+#if 0
char **urllist;
+#endif
int urlrc, i;
if ( c->argc != 2 ) {
tmpludp;
i++, tmpludp = tmpludp->lud_next )
/* just count */
-
+ ;
urllist = ch_calloc( sizeof( char * ), i + 1 );
for ( i = 0, tmpludp = li->lud;
li->url = ldap_charray2str( urllist, " " );
ldap_charray_free( urllist );
#else
- li->url = ch_strdup( c->value_string );
+ li->url = c->value_string;
+ c->value_string = NULL;
#endif
break;
}
if ( !BER_BVISNULL( &li->acl_authcDN ) ) {
free( li->acl_authcDN.bv_val );
}
+ ber_memfree_x( c->value_dn.bv_val, NULL );
li->acl_authcDN = c->value_ndn;
+ BER_BVZERO( &c->value_dn );
+ BER_BVZERO( &c->value_ndn );
break;
case LDAP_BACK_CFG_ACL_PASSWD:
if ( !BER_BVISNULL( &li->acl_passwd ) ) {
free( li->acl_passwd.bv_val );
}
- li->acl_passwd = c->value_bv;
+ ber_str2bv( c->argv[ 1 ], 0, 1, &li->acl_passwd );
break;
case LDAP_BACK_CFG_ACL_METHOD:
if ( !BER_BVISNULL( &li->idassert_authcDN ) ) {
free( li->idassert_authcDN.bv_val );
}
+ ber_memfree_x( c->value_dn.bv_val, NULL );
li->idassert_authcDN = c->value_ndn;
+ BER_BVZERO( &c->value_dn );
+ BER_BVZERO( &c->value_ndn );
break;
case LDAP_BACK_CFG_IDASSERT_PASSWD:
if ( !BER_BVISNULL( &li->idassert_passwd ) ) {
free( li->idassert_passwd.bv_val );
}
- li->idassert_passwd = c->value_bv;
+ ber_str2bv( c->argv[ 1 ], 0, 1, &li->idassert_passwd );
break;
- case LDAP_BACK_CFG_IDASSERT_AUTHZFROM:
- ber_bvarray_add( &li->idassert_authz, &c->value_bv );
- break;
+ case LDAP_BACK_CFG_IDASSERT_AUTHZFROM: {
+ struct berval bv;
+
+ ber_str2bv( c->argv[ 1 ], 0, 1, &bv );
+ ber_bvarray_add( &li->idassert_authz, &bv );
+ } break;
case LDAP_BACK_CFG_IDASSERT_METHOD:
/* no longer supported */
return 1;
default:
+ /* FIXME: try to catch inconsistencies */
assert( 0 );
+ break;
}
return 0;
/* URI of server to query (obsoletes "server" directive) */
} else if ( strcasecmp( argv[0], "uri" ) == 0 ) {
LDAPURLDesc *tmpludp;
+#if 0
char **urllist;
+#endif
int urlrc, i;
if ( argc != 2 ) {
tmpludp;
i++, tmpludp = tmpludp->lud_next )
/* just count */
-
+ ;
urllist = ch_calloc( sizeof( char * ), i + 1 );
for ( i = 0, tmpludp = li->lud;
/* else just do the same as before */
bv = (struct berval *) ch_malloc( sizeof(struct berval) );
if ( !BER_BVISEMPTY( &op->o_dn ) ) {
- bv->bv_len = op->o_dn.bv_len + sizeof("dn:") - 1;
+ bv->bv_len = op->o_dn.bv_len + STRLENOF("dn:");
bv->bv_val = ch_malloc( bv->bv_len + 1 );
- AC_MEMCPY( bv->bv_val, "dn:", sizeof("dn:") - 1 );
- AC_MEMCPY( &bv->bv_val[sizeof("dn:") - 1], op->o_dn.bv_val,
+ AC_MEMCPY( bv->bv_val, "dn:", STRLENOF("dn:") );
+ AC_MEMCPY( &bv->bv_val[STRLENOF("dn:")], op->o_dn.bv_val,
op->o_dn.bv_len );
bv->bv_val[bv->bv_len] = '\0';
} else {
lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR );
if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) {
- return -1;
+ return rs->sr_err;
}
ctrls = op->o_ctrls;
rc = ldap_back_proxy_authz_ctrl( lc, op, rs, &ctrls );
if ( rc != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
- rc = -1;
+ rc = rs->sr_err;
goto cleanup;
}
struct ldapconn *lc = v_lc;
if ( lc->lc_ld != NULL ) {
- ldap_unbind_ext_s( lc->lc_ld, NULL, NULL );
+ ldap_unbind_ext( lc->lc_ld, NULL, NULL );
}
if ( !BER_BVISNULL( &lc->lc_bound_ndn ) ) {
ch_free( lc->lc_bound_ndn.bv_val );
if ( !BER_BVISNULL( &lc->lc_local_ndn ) ) {
ch_free( lc->lc_local_ndn.bv_val );
}
- ldap_pvt_thread_mutex_destroy( &lc->lc_mutex );
ch_free( lc );
}
ch_free( li->idassert_sasl_realm.bv_val );
BER_BVZERO( &li->idassert_sasl_realm );
}
+ if ( li->idassert_authz != NULL ) {
+ ber_bvarray_free( li->idassert_authz );
+ li->idassert_authz = NULL;
+ }
if ( li->conntree ) {
avl_free( li->conntree, ldap_back_conn_free );
}
lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR );
if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) {
- return -1;
+ return rs->sr_err;
}
for ( i = 0, ml = op->oq_modify.rs_modlist; ml; i++, ml = ml->sml_next )
lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR );
if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) {
- return -1;
+ return rs->sr_err;
}
if ( op->orr_newSup ) {
ber_int_t msgid, ldap_back_send_t sendok);
int back_ldap_LTX_init_module(int argc, char *argv[]);
+int ldap_back_init_cf( BackendInfo *bi );
+
extern int ldap_back_conn_cmp( const void *c1, const void *c2);
extern int ldap_back_conn_dup( void *c1, void *c2 );
extern void ldap_back_conn_free( void *c );
filter = BER_BVNULL;
int i;
char **attrs = NULL;
- int dontfreetext = 0;
+ int freetext = 0;
int do_retry = 1;
LDAPControl **ctrls = NULL;
ctrls = op->o_ctrls;
rc = ldap_back_proxy_authz_ctrl( lc, op, rs, &ctrls );
if ( rc != LDAP_SUCCESS ) {
- dontfreetext = 1;
goto finish;
}
{
/* check for abandon */
if ( op->o_abandon ) {
+ if ( rc > 0 ) {
+ ldap_msgfree( res );
+ }
ldap_abandon_ext( lc->lc_ld, msgid, NULL, NULL );
rc = SLAPD_ABANDON;
goto finish;
} else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
char **references = NULL;
- int cnt;
do_retry = 0;
rc = ldap_parse_reference( lc->lc_ld, res,
continue;
}
- if ( references == NULL ) {
- continue;
- }
+ /* FIXME: there MUST be at least one */
+ if ( references && references[ 0 ] && references[ 0 ][ 0 ] ) {
+ int cnt;
- for ( cnt = 0; references[ cnt ]; cnt++ )
- /* NO OP */ ;
-
- rs->sr_ref = ch_calloc( cnt + 1, sizeof( struct berval ) );
+ for ( cnt = 0; references[ cnt ]; cnt++ )
+ /* NO OP */ ;
- for ( cnt = 0; references[ cnt ]; cnt++ ) {
- ber_str2bv( references[ cnt ], 0, 0, &rs->sr_ref[ cnt ] );
- }
+ /* FIXME: there MUST be at least one */
+ rs->sr_ref = ch_malloc( ( cnt + 1 ) * sizeof( struct berval ) );
+
+ for ( cnt = 0; references[ cnt ]; cnt++ ) {
+ ber_str2bv( references[ cnt ], 0, 0, &rs->sr_ref[ cnt ] );
+ }
+ BER_BVZERO( &rs->sr_ref[ cnt ] );
+
+ /* ignore return value by now */
+ ( void )send_search_reference( op, rs );
- /* ignore return value by now */
- ( void )send_search_reference( op, rs );
+ } else {
+ Debug( LDAP_DEBUG_ANY,
+ "%s ldap_back_search: "
+ "got SEARCH_REFERENCE "
+ "with no referrals\n",
+ op->o_log_prefix, 0, 0 );
+ }
/* cleanup */
if ( references ) {
rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
&match.bv_val, (char **)&rs->sr_text,
&references, &rs->sr_ctrls, 1 );
+ freetext = 1;
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
rs->sr_err = slap_map_api2result( rs );
- if ( references ) {
+ if ( references && references[ 0 ] && references[ 0 ][ 0 ] ) {
int cnt;
+ if ( rs->sr_err != LDAP_REFERRAL ) {
+ /* FIXME: error */
+ Debug( LDAP_DEBUG_ANY,
+ "%s ldap_back_search: "
+ "got referrals with %d\n",
+ op->o_log_prefix,
+ rs->sr_err, 0 );
+ rs->sr_err = LDAP_REFERRAL;
+ }
+
for ( cnt = 0; references[ cnt ]; cnt++ )
/* NO OP */ ;
- rs->sr_ref = ch_calloc( cnt + 1, sizeof( struct berval ) );
+ rs->sr_ref = ch_malloc( ( cnt + 1 ) * sizeof( struct berval ) );
for ( cnt = 0; references[ cnt ]; cnt++ ) {
+ /* duplicating ...*/
ber_str2bv( references[ cnt ], 0, 1, &rs->sr_ref[ cnt ] );
}
+ BER_BVZERO( &rs->sr_ref[ cnt ] );
+ }
- /* cleanup */
- if ( references ) {
- ldap_value_free( references );
- }
+ /* cleanup */
+ if ( references ) {
+ ldap_value_free( references );
}
rc = 0;
if ( !BER_BVISNULL( &match ) && !BER_BVISEMPTY( &match ) ) {
rs->sr_matched = match.bv_val;
}
+
if ( rs->sr_v2ref ) {
rs->sr_err = LDAP_REFERRAL;
}
}
if ( rs->sr_text ) {
- if ( !dontfreetext ) {
+ if ( freetext ) {
LDAP_FREE( (char *)rs->sr_text );
}
rs->sr_text = NULL;
int last;
/* safe assumptions ... */
- assert( ent );
+ assert( ent != NULL );
BER_BVZERO( &ent->e_bv );
if ( ber_scanf( &ber, "{m{", bdn ) == LBER_ERROR ) {
lc_curr.lc_conn = conn;
lc_curr.lc_local_ndn = conn->c_ndn;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &li->conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
-
+ ldap_pvt_thread_mutex_trylock( &li->conn_mutex );
lc = avl_delete( &li->conntree, (caddr_t)&lc_curr, ldap_back_conn_cmp );
ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n",
op->o_req_dn.bv_val, 0, 0);
- rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e, NULL,
+ rs->sr_err = entry_schema_check( op, op->oq_add.rs_e, NULL,
get_manageDIT(op), &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
BerVarray dnlist,
struct berval *dn )
{
- assert( dnlist );
+ assert( dnlist != NULL );
for( ; dnlist->bv_val != NULL; dnlist++ ) {
if( dnIsSuffix( dnlist, dn ) ) {
void
cache_entry_commit( Entry *e )
{
- assert( e );
- assert( e->e_private );
+ assert( e != NULL );
+ assert( e->e_private != NULL );
assert( LEI(e)->lei_state == CACHE_ENTRY_CREATING );
/* assert( LEI(e)->lei_refcnt == 1 ); */
static int
cache_entry_private_destroy( Entry*e )
{
- assert( e->e_private );
+ assert( e->e_private != NULL );
free( e->e_private );
e->e_private = NULL;
/* set cache mutex */
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
- assert( e->e_private );
+ assert( e->e_private != NULL );
id = e->e_id;
refcnt = --LEI(e)->lei_refcnt;
/* set cache mutex */
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
- assert( e->e_private );
+ assert( e->e_private != NULL );
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
entry_dn_cmp, avl_dup_error ) != 0 )
* we do not need to lock the entry if we only
* check the state, refcnt, LRU, and id.
*/
- assert( ep->e_private );
+ assert( ep->e_private != NULL );
/* save id */
id = ep->e_id;
count++;
- assert( ep->e_private );
+ assert( ep->e_private != NULL );
ep_id = ep->e_id;
state = LEI(ep)->lei_state;
/* set cache mutex */
ldap_pvt_thread_mutex_lock( &cache->c_mutex );
- assert( e->e_private );
+ assert( e->e_private != NULL );
Debug( LDAP_DEBUG_TRACE, "====> cache_delete_entry( %ld )\n",
e->e_id, 0, 0 );
int
ldbm_back_db_close( Backend *be )
{
- struct ldbminfo *li = (struct ldbminfo *) be->be_private;
-
Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
ldbm_cache_flush_all( be );
Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn->bv_val, 0, 0 );
- assert( idp );
+ assert( idp != NULL );
/* first check the cache */
*idp = cache_find_entry_ndn2id( be, &li->li_cache, dn );
}
/* check that the entry still obeys the schema */
- rc = entry_schema_check( op->o_bd, e, save_attrs, get_manageDIT(op),
+ rc = entry_schema_check( op, e, save_attrs, get_manageDIT(op),
text, textbuf, textlen );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n",
int isroot = -1;
int rc_id = 0;
ID id = NOID;
- const char *text = NULL;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
/* Added to support newSuperior */
tmp = mod->sml_next;
free( mod );
}
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
/* LDAP v3 Support */
{
Attribute **ap;
- assert( rs->sr_entry );
+ assert( rs->sr_entry != NULL );
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count */ ;
hs = has_children( op->o_bd, rs->sr_entry );
*ap = slap_operational_hasSubordinate( hs );
- assert( *ap );
+ assert( *ap != NULL );
ap = &(*ap)->a_next;
}
SlapReply *rs )
{
struct ldbminfo *li = (struct ldbminfo *) op->o_bd->be_private;
- int rc, err;
- const char *text = NULL;
+ int rc;
time_t stoptime;
ID_BLOCK *candidates;
ID id, cursor;
? LDAP_SCOPE_BASE
: LDAP_SCOPE_SUBTREE );
+ ber_bvarray_free( erefs );
+
send_search_reference( op, rs );
ber_bvarray_free( rs->sr_ref );
assert( slapMode & SLAP_TOOL_MODE );
assert( id2entry != NULL );
- assert( text );
- assert( text->bv_val );
+ assert( text != NULL );
+ assert( text->bv_val != NULL );
assert( text->bv_val[0] == '\0' ); /* overconservative? */
if ( next_id_get( be, &id ) || id == NOID ) {
? LDAP_SCOPE_BASE : LDAP_SCOPE_SUBTREE );
ck->rs->sr_entry = e;
- rc = send_search_reference( ck->op, ck->rs );
+ rc = send_search_reference( ck->op, ck->rs ) < 0;
ber_bvarray_free( ck->rs->sr_ref );
ber_bvarray_free( erefs );
ck->rs->sr_ref = NULL;
ck->rs->sr_entry = e;
ck->rs->sr_attrs = ck->op->ors_attrs;
ck->rs->sr_flags = REP_ENTRY_MODIFIABLE;
- rc = send_search_entry(ck->op, ck->rs);
+ rc = send_search_entry(ck->op, ck->rs) < 0;
ck->rs->sr_entry = NULL;
}
fd = 1;
while(1) {
struct berval fname, itmp;
struct dirent * dir;
- bvlist *bvl, *prev;
+ bvlist *bvl, **prev;
dir = readdir(dir_of_path);
if(dir == NULL) break; /* end of the directory */
}
}
- for (ptr = list, prev = (bvlist *)&list; ptr;
- prev = ptr, ptr = ptr->next) {
+ for (prev = &list; (ptr = *prev) != NULL; prev = &ptr->next) {
int cmp = strcmp( bvl->bv.bv_val, ptr->bv.bv_val );
if ( !cmp && bvl->num.bv_val )
cmp = bvl->inum - ptr->inum;
if ( cmp < 0 )
break;
}
- prev->next = bvl;
+ *prev = bvl;
bvl->next = ptr;
}
struct ldif_info *ni = (struct ldif_info *) ck->op->o_bd->be_private;
struct berval path;
struct berval pdn, pndn;
+ int rc;
dnParent( &ck->op->o_req_dn, &pdn );
dnParent( &ck->op->o_req_ndn, &pndn );
dn2path( &ck->op->o_req_ndn, &ck->op->o_bd->be_nsuffix[0], &ni->li_base_path, &path);
- return r_enum_tree(ck, &path, &pdn, &pndn);
+ rc = r_enum_tree(ck, &path, &pdn, &pndn);
+ ch_free( path.bv_val );
+ return rc;
}
/* Get the parent path plus the LDIF suffix */
get_permissiveModify(op),
&rs->sr_text, textbuf,
sizeof( textbuf ) );
-
break;
case LDAP_MOD_REPLACE:
get_permissiveModify(op),
&rs->sr_text, textbuf,
sizeof( textbuf ) );
-
break;
+
case LDAP_MOD_INCREMENT:
+ rc = modify_increment_values( entry,
+ mods, get_permissiveModify(op),
+ &rs->sr_text, textbuf,
+ sizeof( textbuf ) );
+ break;
+
break;
+
case SLAP_MOD_SOFTADD:
mods->sm_op = LDAP_MOD_ADD;
rc = modify_add_values(entry, mods,
entry->e_ocflags = 0;
}
/* check that the entry still obeys the schema */
- rc = entry_schema_check(op->o_bd, entry, NULL, 0,
+ rc = entry_schema_check(op, entry, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );
}
return rc;
rs->sr_matched = NULL;
ber_bvarray_free( refs );
-
- entry_free( entry );
}
+ entry_free( entry );
+
return rc;
}
static int ldif_back_search(Operation *op, SlapReply *rs)
{
struct ldif_info *ni = (struct ldif_info *) op->o_bd->be_private;
- enumCookie ck = {0};
+ enumCookie ck = { NULL, NULL, NULL, 0, 0 };
ck.op = op;
ck.rs = rs;
int statres;
char textbuf[SLAP_TEXT_BUFLEN];
- rs->sr_err = entry_schema_check(op->o_bd, e, NULL, 0,
+ rs->sr_err = entry_schema_check(op, e, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) goto send_res;
return 0;
}
-static int ldif_back_compare(Operation *op, SlapReply *rs) {
+/* return LDAP_SUCCESS IFF we can retrieve the specified entry.
+ */
+int ldif_back_entry_get(
+ Operation *op,
+ struct berval *ndn,
+ ObjectClass *oc,
+ AttributeDescription *at,
+ int rw,
+ Entry **ent )
+{
struct ldif_info *ni = (struct ldif_info *) op->o_bd->be_private;
- Entry * e = NULL;
- Attribute *a;
- ldap_pvt_thread_mutex_lock(&ni->li_mutex);
+ ldap_pvt_thread_mutex_lock( &ni->li_mutex );
- e = (Entry *) get_entry(op, &ni->li_base_path);
- if(e != NULL) {
- for(a = attrs_find( e->e_attrs, op->oq_compare.rs_ava->aa_desc );
- a != NULL;
- a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc )) {
- rs->sr_err = LDAP_COMPARE_FALSE;
-
- if (value_find_ex(op->oq_compare.rs_ava->aa_desc,
- SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
- SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- a->a_nvals, &op->oq_compare.rs_ava->aa_value,
- op->o_tmpmemctx ) == 0) {
- rs->sr_err = LDAP_COMPARE_TRUE;
- break;
- }
- }
- }
- else {
- rs->sr_err = LDAP_NO_SUCH_OBJECT;
- }
+ *ent = (Entry *) get_entry( op, &ni->li_base_path );
- if(e != NULL)
- entry_free(e);
- ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
- send_ldap_result(op, rs);
- return 0;
+ ldap_pvt_thread_mutex_unlock( &ni->li_mutex );
+
+ return ( *ent == NULL ? 1 : 0 );
}
static int ldif_tool_entry_open(BackendDB * be, int mode) {
)
{
struct ldif_info *ni = be->be_private;
+
+ ch_free(ni->li_base_path.bv_val);
ldap_pvt_thread_mutex_destroy(&ni->li_mutex);
free( be->be_private );
return 0;
int rc;
bi->bi_flags |=
+ SLAP_BFLAG_INCREMENT |
SLAP_BFLAG_REFERRALS;
bi->bi_controls = controls;
bi->bi_op_bind = ldif_back_bind;
bi->bi_op_unbind = 0;
bi->bi_op_search = ldif_back_search;
- bi->bi_op_compare = ldif_back_compare;
+ bi->bi_op_compare = 0;
bi->bi_op_modify = ldif_back_modify;
bi->bi_op_modrdn = ldif_back_modrdn;
bi->bi_op_add = ldif_back_add;
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
+ bi->bi_entry_get_rw = ldif_back_entry_get;
+
+#if 0 /* NOTE: uncomment to completely disable access control */
+#ifdef SLAP_OVERLAY_ACCESS
+ bi->bi_access_allowed = slap_access_always_allowed;
+#endif /* SLAP_OVERLAY_ACCESS */
+#endif
+
bi->bi_tool_entry_open = ldif_tool_entry_open;
bi->bi_tool_entry_close = ldif_tool_entry_close;
bi->bi_tool_entry_first = ldif_tool_entry_first;
bi->bi_tool_id2entry_get = 0;
bi->bi_tool_entry_modify = 0;
+ bi->bi_cf_ocs = ldifocs;
+
rc = config_register_schema( ldifcfg, ldifocs );
if ( rc ) return rc;
return 0;
LDAPMod **attrs;
struct berval mdn = BER_BVNULL, mapped;
dncookie dc;
+ int msgid;
int do_retry = 1;
Debug(LDAP_DEBUG_ARGS, "==> meta_back_add: %s\n",
attrs[ i ] = NULL;
retry:;
-#if 0
rs->sr_err = ldap_add_ext( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
attrs, op->o_ctrls, NULL, &msgid );
- rs->sr_err = meta_back_op_result( op, rs, &mc->mc_conns[ candidate ], msgid, LDAP_BACK_SENDERR );
-#endif
- rs->sr_err = ldap_add_ext_s( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
- attrs, op->o_ctrls, NULL );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
+
+ } else if ( rs->sr_err == LDAP_SUCCESS ) {
+ struct timeval tv, *tvp = NULL;
+ LDAPMessage *res = NULL;
+ int rc;
+
+ if ( mi->mi_targets[ candidate ].mt_timeout[ META_OP_ADD ] != 0 ) {
+ tv.tv_sec = mi->mi_targets[ candidate ].mt_timeout[ META_OP_ADD ];
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
+
+ rs->sr_err = LDAP_OTHER;
+ rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
+ msgid, LDAP_MSG_ONE, tvp, &res );
+ switch ( rc ) {
+ case -1:
+ send_ldap_result( op, rs );
+ goto cleanup;
+
+ case 0:
+ ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
+ msgid, NULL, NULL );
+ rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+ LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
+ send_ldap_result( op, rs );
+ goto cleanup;
+
+ case LDAP_RES_ADD:
+ rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
+ res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ }
+ break;
+
+ default:
+ ldap_msgfree( res );
+ break;
+ }
}
+ (void)meta_back_op_result( mc, op, rs, candidate );
+
+cleanup:;
for ( --i; i >= 0; --i ) {
free( attrs[ i ]->mod_bvalues );
free( attrs[ i ] );
BER_BVZERO( &mdn );
}
- (void)meta_back_op_result( mc, op, rs, candidate );
-
done:;
meta_back_release_conn( op, mc );
* in one block with the metaconn_t structure */
} metaconn_t;
+enum {
+ META_OP_ADD = 0,
+ META_OP_DELETE,
+ META_OP_MODIFY,
+ META_OP_MODRDN,
+ META_OP_LAST
+};
+
typedef struct metatarget_t {
char *mt_uri;
unsigned mt_flags;
int mt_version;
+ time_t mt_timeout[ META_OP_LAST ];
} metatarget_t;
typedef struct metadncache_t {
#define META_BACK_ONERR_CONTINUE(mi) ( !META_BACK_ONERR_CONTINUE( (mi) ) )
int mi_version;
+ time_t mi_timeout[ META_OP_LAST ];
} metainfo_t;
typedef enum meta_op_type {
tv.tv_usec = META_BIND_TIMEOUT;
switch ( ldap_result( msc->msc_ld, msgid, 0, &tv, &res ) ) {
case 0:
- Debug( LDAP_DEBUG_ANY, "%s meta_back_single_bind: ldap_result=%d nretries=%d\n",
- op->o_log_prefix, 0, nretries );
+ Debug( LDAP_DEBUG_ANY,
+ "%s meta_back_single_bind: "
+ "ldap_result=0 nretries=%d%s\n",
+ op->o_log_prefix, nretries,
+ rebinding ? " rebinding" : "" );
if ( nretries != META_RETRY_NEVER ) {
ldap_pvt_thread_yield();
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
}
- Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_bind: err=%d nretries=%d\n",
+ Debug( LDAP_DEBUG_ANY,
+ "### %s meta_back_single_bind: "
+ "err=%d nretries=%d\n",
op->o_log_prefix, rs->sr_err, nretries );
rc = slap_map_api2result( rs );
if ( rs->sr_err == LDAP_UNAVAILABLE && nretries != META_RETRY_NEVER ) {
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
-
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
if ( mc->mc_refcnt == 1 ) {
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
msc->msc_bound = 0;
- /* mc here must be the regular mc, reset and ready for init */
- rc = meta_back_init_one_conn( op, rs, mt, msc,
- LDAP_BACK_DONTSEND );
+ ( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );
+
+ /* mc here must be the regular mc,
+ * reset and ready for init */
+ rc = meta_back_init_one_conn( op, rs,
+ mt, msc, LDAP_BACK_DONTSEND );
} else {
/* can't do anything about it */
tv.tv_usec = META_BIND_TIMEOUT;
switch ( ldap_result( msc->msc_ld, msgid, 0, &tv, &res ) ) {
case 0:
- Debug( LDAP_DEBUG_ANY, "%s meta_back_single_dobind: ldap_result=%d nretries=%d\n",
- op->o_log_prefix, 0, nretries );
+ Debug( LDAP_DEBUG_ANY,
+ "%s meta_back_single_dobind: "
+ "ldap_result=0 nretries=%d%s\n",
+ op->o_log_prefix, nretries,
+ rebinding ? " rebinding" : "" );
if ( nretries != META_RETRY_NEVER ) {
ldap_pvt_thread_yield();
ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
}
- Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_dobind: err=%d nretries=%d\n",
- op->o_log_prefix, rs->sr_err, nretries );
+ Debug( LDAP_DEBUG_ANY,
+ "### %s meta_back_single_dobind: "
+ "err=%d nretries=%d\n",
+ op->o_log_prefix, rs->sr_err, nretries );
rc = slap_map_api2result( rs );
if ( rc == LDAP_UNAVAILABLE && nretries != META_RETRY_NEVER ) {
if ( dolock ) {
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
}
if ( mc->mc_refcnt == 1 ) {
msc->msc_ld = NULL;
msc->msc_bound = 0;
- /* mc here must be the regular mc, reset and ready for init */
- rc = meta_back_init_one_conn( op, rs, mt, msc, LDAP_BACK_DONTSEND );
+ ( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );
+
+ /* mc here must be the regular mc,
+ * reset and ready for init */
+ rc = meta_back_init_one_conn( op, rs,
+ mt, msc, LDAP_BACK_DONTSEND );
} else {
* A possible extension will include the handling of multiple suffixes
*/
-static int
-meta_back_is_candidate_unique(
- metainfo_t *mi,
- struct berval *ndn );
/*
* returns 1 if suffix is candidate for dn, otherwise 0
return META_NOT_CANDIDATE;
}
+#if 0
/*
* meta_back_is_candidate_unique
*
return 1;
}
+#endif /* 0 */
/*
* meta_back_select_unique_candidate
dc.ctx = "compareDN";
for ( i = 0; i < mi->mi_ntargets; i++ ) {
- metasingleconn_t *msc = &mc->mc_conns[ i ];
struct berval mdn = BER_BVNULL;
struct berval mapped_attr = op->orc_ava->aa_desc->ad_cname;
struct berval mapped_value = op->orc_ava->aa_value;
LDAPURLDesc *ludp, *tmpludp;
struct berval dn;
int rc;
+ int c;
if ( argc != 2 ) {
fprintf( stderr,
mi->mi_targets[ i ].mt_flags = mi->flags;
mi->mi_targets[ i ].mt_version = mi->mi_version;
+ for ( c = 0; c < META_OP_LAST; c++ ) {
+ mi->mi_targets[ i ].mt_timeout[ c ] = mi->mi_timeout[ c ];
+ }
+
/*
* uri MUST be legal!
*/
return 1;
}
+ } else if ( strcasecmp( argv[ 0 ], "timeout" ) == 0 ) {
+ char *sep, *next;
+ time_t *tv = mi->mi_ntargets ?
+ mi->mi_targets[ mi->mi_ntargets - 1 ].mt_timeout
+ : mi->mi_timeout;
+ int c;
+
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: \"timeout [{add|delete|modify|modrdn}=]<val> [...]\" takes at least 1 argument\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ for ( c = 1; c < argc; c++ ) {
+ time_t *t = NULL, val;
+
+ sep = strchr( argv[ c ], '=' );
+ if ( sep != NULL ) {
+ size_t len = sep - argv[ c ];
+
+ if ( strncasecmp( argv[ c ], "add", len ) == 0 ) {
+ t = &tv[ META_OP_ADD ];
+ } else if ( strncasecmp( argv[ c ], "delete", len ) == 0 ) {
+ t = &tv[ META_OP_DELETE ];
+ } else if ( strncasecmp( argv[ c ], "modify", len ) == 0 ) {
+ t = &tv[ META_OP_MODIFY ];
+ } else if ( strncasecmp( argv[ c ], "modrdn", len ) == 0 ) {
+ t = &tv[ META_OP_MODRDN ];
+ } else {
+ fprintf( stderr,
+ "%s: line %d: unknown operation \"%s\" for timeout #%d.\n",
+ fname, lineno, argv[ c ], c );
+ return 1;
+ }
+ sep++;
+
+ } else {
+ sep = argv[ c ];
+ }
+
+ val = strtoul( sep, &next, 10 );
+ if ( next == sep || next[ 0 ] != '\0' ) {
+ fprintf( stderr,
+ "%s: line %d: unable to parse value \"%s\" for timeout.\n",
+ fname, lineno, sep );
+ return 1;
+ }
+
+ if ( t ) {
+ *t = val;
+
+ } else {
+ int i;
+
+ for ( i = 0; i < META_OP_LAST; i++ ) {
+ tv[ i ] = val;
+ }
+ }
+ }
+
/* name to use as pseudo-root dn */
} else if ( strcasecmp( argv[ 0 ], "pseudorootdn" ) == 0 ) {
int i = mi->mi_ntargets - 1;
/* dn massaging */
} else if ( strcasecmp( argv[ 0 ], "suffixmassage" ) == 0 ) {
BackendDB *tmp_be;
- int i = mi->mi_ntargets - 1;
+ int i = mi->mi_ntargets - 1, rc;
struct berval dn, nvnc, pvnc, nrnc, prnc;
if ( i < 0 ) {
return 1;
}
- dn.bv_val = argv[ 1 ];
- dn.bv_len = strlen( argv[ 1 ] );
+ ber_str2bv( argv[ 1 ], 0, 0, &dn );
if ( dnPrettyNormal( NULL, &dn, &pvnc, &nvnc, NULL ) != LDAP_SUCCESS ) {
fprintf( stderr, "%s: line %d: "
"suffix '%s' is invalid\n",
return 1;
}
- dn.bv_val = argv[ 2 ];
- dn.bv_len = strlen( argv[ 2 ] );
+ ber_str2bv( argv[ 2 ], 0, 0, &dn );
if ( dnPrettyNormal( NULL, &dn, &prnc, &nrnc, NULL ) != LDAP_SUCCESS ) {
fprintf( stderr, "%s: line %d: "
"massaged suffix '%s' is invalid\n",
* FIXME: no extra rewrite capabilities should be added
* to the database
*/
- return suffix_massage_config( mi->mi_targets[ i ].mt_rwmap.rwm_rw,
+ rc = suffix_massage_config( mi->mi_targets[ i ].mt_rwmap.rwm_rw,
&pvnc, &nvnc, &prnc, &nrnc );
+
+ free( pvnc.bv_val );
+ free( nvnc.bv_val );
+ free( prnc.bv_val );
+ free( nrnc.bv_val );
+
+ return rc;
/* rewrite stuff ... */
} else if ( strncasecmp( argv[ 0 ], "rewrite", 7 ) == 0 ) {
assert( mc != NULL );
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
if ( --mc->mc_refcnt == 0 ) {
meta_back_conn_free( mc );
* Already init'ed
*/
if ( msc->msc_ld != NULL ) {
- rs->sr_err = LDAP_SUCCESS;
- goto error_return;
+ return rs->sr_err = LDAP_SUCCESS;
}
/*
}
#ifdef HAVE_TLS
- /* start TLS ("start-tls"/"try-start-tls" statements) */
+ /* start TLS ("tls [try-]{start|propagate}" statement) */
if ( ( LDAP_BACK_USE_TLS( mi ) || ( op->o_conn->c_is_tls && LDAP_BACK_PROPAGATE_TLS( mi ) ) )
&& !ldap_is_ldaps_url( mt->mt_uri ) )
{
#ifdef SLAP_STARTTLS_ASYNCHRONOUS
/*
- * use asynchronous StartTLS
- * in case, chase referral (not implemented yet)
+ * use asynchronous StartTLS; in case, chase referral
+ * FIXME: OpenLDAP does not return referral on StartTLS yet
*/
int msgid;
(void *)&network_timeout );
}
- /*
- * Sets a cookie for the rewrite session
- */
- ( void )rewrite_session_init( mt->mt_rwmap.rwm_rw, op->o_conn );
-
/*
* If the connection DN is not null, an attempt to rewrite it is made
*/
msc->msc_bound = META_UNBOUND;
error_return:;
- if ( rs->sr_err != LDAP_SUCCESS ) {
+ if ( rs->sr_err == LDAP_SUCCESS ) {
+ /*
+ * Sets a cookie for the rewrite session
+ */
+ ( void )rewrite_session_init( mt->mt_rwmap.rwm_rw, op->o_conn );
+
+ } else {
rs->sr_err = slap_map_api2result( rs );
if ( sendok & LDAP_BACK_SENDERR ) {
send_ldap_result( op, rs );
metasingleconn_t *msc = &mc->mc_conns[ candidate ];
retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
assert( mc->mc_refcnt > 0 );
if ( mc->mc_refcnt == 1 ) {
- ldap_pvt_thread_mutex_lock( &mc->mc_mutex );
+ while ( ldap_pvt_thread_mutex_trylock( &mc->mc_mutex ) ) {
+ ldap_pvt_thread_mutex_unlock( &mi->mi_conn_mutex );
+ ldap_pvt_thread_yield();
+ goto retry_lock;
+ }
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
msc->msc_bound = 0;
+ ( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );
+
/* mc here must be the regular mc, reset and ready for init */
rc = meta_back_init_one_conn( op, rs, mt, msc, sendok );
{
metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
metacandidates_t *mc;
- SlapReply *rs;
if ( op->o_threadctx ) {
void *data = NULL;
/* Searches for a metaconn in the avl tree */
mc_curr.mc_conn = op->o_conn;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
mc = (metaconn_t *)avl_find( mi->mi_conntree,
(caddr_t)&mc_curr, meta_back_conn_cmp );
if ( mc ) {
* the reason is that the connection might have been
* created by meta_back_get_candidate() */
mc_curr.mc_conn = op->o_conn;
-retry_lock2:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock2;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
mc = (metaconn_t *)avl_find( mi->mi_conntree,
(caddr_t)&mc_curr, meta_back_conn_cmp );
if ( mc != NULL ) {
/*
* Inserts the newly created metaconn in the avl tree
*/
-retry_lock3:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock3;
-
- case 0:
- break;
- }
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
err = avl_insert( &mi->mi_conntree, ( caddr_t )mc,
meta_back_conn_cmp, meta_back_conn_dup );
assert( mc != NULL );
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
-
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
assert( mc->mc_refcnt > 0 );
mc->mc_refcnt--;
ldap_pvt_thread_mutex_unlock( &mi->mi_conn_mutex );
int candidate = -1;
struct berval mdn = BER_BVNULL;
dncookie dc;
+ int msgid;
int do_retry = 1;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
}
retry:;
- rs->sr_err = ldap_delete_ext_s( mc->mc_conns[ candidate ].msc_ld,
- mdn.bv_val, op->o_ctrls, NULL );
+ rs->sr_err = ldap_delete_ext( mc->mc_conns[ candidate ].msc_ld,
+ mdn.bv_val, op->o_ctrls, NULL, &msgid );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
+
+ } else if ( rs->sr_err == LDAP_SUCCESS ) {
+ struct timeval tv, *tvp = NULL;
+ LDAPMessage *res = NULL;
+ int rc;
+
+ if ( mi->mi_targets[ candidate ].mt_timeout[ META_OP_DELETE ] != 0 ) {
+ tv.tv_sec = mi->mi_targets[ candidate ].mt_timeout[ META_OP_DELETE ];
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
+
+ rs->sr_err = LDAP_OTHER;
+ rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
+ msgid, LDAP_MSG_ONE, tvp, &res );
+ switch ( rc ) {
+ case -1:
+ rs->sr_err = LDAP_OTHER;
+ send_ldap_result( op, rs );
+ goto cleanup;
+
+ case 0:
+ ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
+ msgid, NULL, NULL );
+ rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+ LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
+ send_ldap_result( op, rs );
+ goto cleanup;
+
+ case LDAP_RES_DELETE:
+ rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
+ res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ }
+ break;
+
+ default:
+ ldap_msgfree( res );
+ break;
+ }
}
+ rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
+
+cleanup:;
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
free( mdn.bv_val );
BER_BVZERO( &mdn );
}
- rs->sr_err = meta_back_op_result( mc, op, rs, candidate );
-
done:;
meta_back_release_conn( op, mc );
time_t curr_time;
int target = META_TARGET_NONE;
- assert( cache );
- assert( ndn );
+ assert( cache != NULL );
+ assert( ndn != NULL );
tmp_entry.dn = *ndn;
ldap_pvt_thread_mutex_lock( &cache->mutex );
time_t curr_time = 0L;
int err = 0;
- assert( cache );
- assert( ndn );
+ assert( cache != NULL );
+ assert( ndn != NULL );
/*
* if cache->ttl < 0, cache never expires;
metadncacheentry_t *entry,
tmp_entry;
- assert( cache );
- assert( ndn );
+ assert( cache != NULL );
+ assert( ndn != NULL );
tmp_entry.dn = *ndn;
{
struct ldapmapping *mapping;
- assert( m );
+ assert( m != NULL );
*m = NULL;
Avlnode *tree;
struct ldapmapping fmapping;
- assert( m );
+ assert( m != NULL );
if ( remap == BACKLDAP_REMAP ) {
tree = map->remap;
{
int i, last;
- assert( dc );
- assert( a_vals );
+ assert( dc != NULL );
+ assert( a_vals != NULL );
for ( last = 0; !BER_BVISNULL( &a_vals[ last ] ); last++ )
;
struct berval mdn = BER_BVNULL;
struct berval mapped;
dncookie dc;
+ int msgid;
int do_retry = 1;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
modv[ i ] = 0;
retry:;
- rs->sr_err = ldap_modify_ext_s( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
- modv, op->o_ctrls, NULL );
+ rs->sr_err = ldap_modify_ext( mc->mc_conns[ candidate ].msc_ld, mdn.bv_val,
+ modv, op->o_ctrls, NULL, &msgid );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
+
+ } else if ( rs->sr_err == LDAP_SUCCESS ) {
+ struct timeval tv, *tvp = NULL;
+ LDAPMessage *res = NULL;
+
+ if ( mi->mi_targets[ candidate ].mt_timeout[ META_OP_MODIFY ] != 0 ) {
+ tv.tv_sec = mi->mi_targets[ candidate ].mt_timeout[ META_OP_MODIFY ];
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
+
+ rs->sr_err = LDAP_OTHER;
+ rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
+ msgid, LDAP_MSG_ONE, tvp, &res );
+ switch ( rc ) {
+ case -1:
+ rc = -1;
+ break;
+
+ case 0:
+ ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
+ msgid, NULL, NULL );
+ rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+ LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
+ rc = -1;
+ break;
+
+ case LDAP_RES_MODIFY:
+ rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
+ res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ }
+ rc = 0;
+ break;
+
+ default:
+ rc = -1;
+ ldap_msgfree( res );
+ break;
+ }
}
cleanup:;
int
meta_back_modrdn( Operation *op, SlapReply *rs )
{
- metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
- metaconn_t *mc;
- int candidate = -1;
- struct berval mdn = BER_BVNULL,
- mnewSuperior = BER_BVNULL;
- dncookie dc;
- int do_retry = 1;
+ metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
+ metaconn_t *mc;
+ int candidate = -1;
+ struct berval mdn = BER_BVNULL,
+ mnewSuperior = BER_BVNULL;
+ dncookie dc;
+ int msgid;
+ int do_retry = 1;
mc = meta_back_getconn( op, rs, &candidate, LDAP_BACK_SENDERR );
if ( !mc || !meta_back_dobind( op, rs, mc, LDAP_BACK_SENDERR ) ) {
}
retry:;
- rs->sr_err = ldap_rename_s( mc->mc_conns[ candidate ].msc_ld,
+ rs->sr_err = ldap_rename( mc->mc_conns[ candidate ].msc_ld,
mdn.bv_val, op->orr_newrdn.bv_val,
mnewSuperior.bv_val, op->orr_deleteoldrdn,
- op->o_ctrls, NULL );
+ op->o_ctrls, NULL, &msgid );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, mc, candidate, LDAP_BACK_SENDERR ) ) {
goto retry;
}
+
+ } else if ( rs->sr_err == LDAP_SUCCESS ) {
+ struct timeval tv, *tvp = NULL;
+ LDAPMessage *res = NULL;
+ int rc;
+
+ if ( mi->mi_targets[ candidate ].mt_timeout[ META_OP_MODRDN ] != 0 ) {
+ tv.tv_sec = mi->mi_targets[ candidate ].mt_timeout[ META_OP_MODRDN ];
+ tv.tv_usec = 0;
+ tvp = &tv;
+ }
+
+ rs->sr_err = LDAP_OTHER;
+ rc = ldap_result( mc->mc_conns[ candidate ].msc_ld,
+ msgid, LDAP_MSG_ONE, tvp, &res );
+ switch ( rc ) {
+ case -1:
+ break;
+
+ case 0:
+ ldap_abandon_ext( mc->mc_conns[ candidate ].msc_ld,
+ msgid, NULL, NULL );
+ rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+ LDAP_ADMINLIMIT_EXCEEDED : LDAP_OPERATIONS_ERROR;
+ break;
+
+ case LDAP_RES_RENAME:
+ rc = ldap_parse_result( mc->mc_conns[ candidate ].msc_ld,
+ res, &rs->sr_err, NULL, NULL, NULL, NULL, 1 );
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ }
+ break;
+
+ default:
+ ldap_msgfree( res );
+ break;
+ }
}
cleanup:;
if ( rs->sr_err == LDAP_SUCCESS ) {
meta_back_op_result( mc, op, rs, candidate );
+ } else {
+ send_ldap_result( op, rs );
}
- send_ldap_result( op, rs );
-
meta_back_release_conn( op, mc );
return rs->sr_err;
int i, src, dst;
struct berval pretty = {0,NULL}, *dn = odn;
- assert( res );
+ assert( res != NULL );
if ( dn == NULL ) {
res->bv_val = NULL;
metainfo_t *mi = ( metainfo_t * )be->be_private;
metaconn_t *mc,
mc_curr = { 0 };
+ int i;
+
Debug( LDAP_DEBUG_TRACE,
"=>meta_back_conn_destroy: fetching conn %ld\n",
mc_curr.mc_conn = conn;
-retry_lock:;
- switch ( ldap_pvt_thread_mutex_trylock( &mi->mi_conn_mutex ) ) {
- case LDAP_PVT_THREAD_EBUSY:
- default:
- ldap_pvt_thread_yield();
- goto retry_lock;
-
- case 0:
- break;
- }
-
+ ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
mc = avl_delete( &mi->mi_conntree, ( caddr_t )&mc_curr,
meta_back_conn_cmp );
ldap_pvt_thread_mutex_unlock( &mi->mi_conn_mutex );
if ( mc ) {
- int i;
-
Debug( LDAP_DEBUG_TRACE,
"=>meta_back_conn_destroy: destroying conn %ld\n",
mc->mc_conn->c_connid, 0, 0 );
* Cleanup rewrite session
*/
for ( i = 0; i < mi->mi_ntargets; ++i ) {
- rewrite_session_delete( mi->mi_targets[ i ].mt_rwmap.rwm_rw, conn );
-
if ( mc->mc_conns[ i ].msc_ld != NULL ) {
meta_clear_one_candidate( &mc->mc_conns[ i ] );
}
}
+
meta_back_conn_free( mc );
}
- /* no response to unbind */
+ /*
+ * Cleanup rewrite session
+ */
+ for ( i = 0; i < mi->mi_ntargets; ++i ) {
+ rewrite_session_delete( mi->mi_targets[ i ].mt_rwmap.rwm_rw, conn );
+ }
return 0;
}
/* modify callback
for user-defined entries */
int (*mc_free)( Entry *e, void *priv );
- /* update callback
+ /* delete callback
for user-defined entries */
void *mc_private; /* opaque pointer to
private data */
AttributeDescription *mi_ad_monitorConnectionActivityTime;
AttributeDescription *mi_ad_monitorIsShadow;
AttributeDescription *mi_ad_monitorUpdateRef;
+ AttributeDescription *mi_ad_monitorRuntimeConfig;
/*
* Generic description attribute
#define SLAPD_MONITOR_OPS_DN \
SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
-#define SLAPD_MONITOR_OVERLAY_NAME "Overlay"
+#define SLAPD_MONITOR_OVERLAY_NAME "Overlays"
#define SLAPD_MONITOR_OVERLAY_RDN \
SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME
#define SLAPD_MONITOR_OVERLAY_DN \
/* initialize entry and subentries */
int ( *mss_open )( BackendDB *, struct monitor_subsys_t *ms );
+ /* destroy structure */
+ int ( *mss_destroy )( BackendDB *, struct monitor_subsys_t *ms );
/* update existing dynamic entry and subentries */
int ( *mss_update )( Operation *, SlapReply *, Entry * );
/* create new dynamic subentries */
return -1;
}
- if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) )
- {
+ if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to get entry \"%s\"\n",
i = -1;
LDAP_STAILQ_FOREACH( bi, &backendInfo, bi_next ) {
char buf[ BACKMONITOR_BUFSIZE ];
- BackendDB *be;
+ BackendDB *be;
struct berval bv;
int j;
Entry *e;
"objectClass: %s\n"
"structuralObjectClass: %s\n"
"cn: Backend %d\n"
+ "%s: %s\n"
+ "%s: %s\n"
"creatorsName: %s\n"
"modifiersName: %s\n"
"createTimestamp: %s\n"
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
+ mi->mi_ad_monitoredInfo->ad_cname.bv_val,
+ bi->bi_type,
+ mi->mi_ad_monitorRuntimeConfig->ad_cname.bv_val,
+ bi->bi_cf_ocs == NULL ? "FALSE" : "TRUE",
mi->mi_creatorsName.bv_val,
mi->mi_creatorsName.bv_val,
mi->mi_startTime.bv_val,
}
ber_str2bv( bi->bi_type, 0, 0, &bv );
- attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
- &bv, NULL );
attr_merge_normalize_one( e_backend, mi->mi_ad_monitoredInfo,
&bv, NULL );
*/
int
monitor_cache_cmp(
- const void *c1,
- const void *c2
-)
+ const void *c1,
+ const void *c2 )
{
monitor_cache_t *cc1 = ( monitor_cache_t * )c1;
monitor_cache_t *cc2 = ( monitor_cache_t * )c2;
*/
int
monitor_cache_dup(
- void *c1,
- void *c2
-)
+ void *c1,
+ void *c2 )
{
monitor_cache_t *cc1 = ( monitor_cache_t * )c1;
monitor_cache_t *cc2 = ( monitor_cache_t * )c2;
*/
int
monitor_cache_add(
- monitor_info_t *mi,
- Entry *e
-)
+ monitor_info_t *mi,
+ Entry *e )
{
monitor_cache_t *mc;
monitor_entry_t *mp;
*/
int
monitor_cache_lock(
- Entry *e
-)
+ Entry *e )
{
- monitor_entry_t *mp;
+ monitor_entry_t *mp;
- assert( e != NULL );
- assert( e->e_private != NULL );
+ assert( e != NULL );
+ assert( e->e_private != NULL );
- mp = ( monitor_entry_t * )e->e_private;
- ldap_pvt_thread_mutex_lock( &mp->mp_mutex );
+ mp = ( monitor_entry_t * )e->e_private;
+ ldap_pvt_thread_mutex_lock( &mp->mp_mutex );
- return( 0 );
+ return( 0 );
}
/*
*/
int
monitor_cache_get(
- monitor_info_t *mi,
- struct berval *ndn,
- Entry **ep
-)
+ monitor_info_t *mi,
+ struct berval *ndn,
+ Entry **ep )
{
monitor_cache_t tmp_mc, *mc;
assert( ndn != NULL );
assert( ep != NULL );
+ *ep = NULL;
+
tmp_mc.mc_ndn = *ndn;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
if ( mc != NULL ) {
/* entry is returned with mutex locked */
monitor_cache_lock( mc->mc_e );
- ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
*ep = mc->mc_e;
-
- return( 0 );
}
-
+
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
- *ep = NULL;
- return( -1 );
+ return ( *ep == NULL ? -1 : 0 );
}
/*
*/
int
monitor_cache_dn2entry(
- Operation *op,
- SlapReply *rs,
- struct berval *ndn,
- Entry **ep,
- Entry **matched
-)
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry **ep,
+ Entry **matched )
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc;
}
if ( !rc ) {
+ monitor_cache_lock( *ep );
monitor_cache_release( mi, e_parent );
+
} else {
*matched = e_parent;
}
int
monitor_cache_release(
monitor_info_t *mi,
- Entry *e
-)
+ Entry *e )
{
monitor_entry_t *mp;
mc = avl_delete( &mi->mi_cache,
( caddr_t )&tmp_mc, monitor_cache_cmp );
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
- ch_free( mc );
+ if ( mc != NULL ) {
+ ch_free( mc );
+ }
ldap_pvt_thread_mutex_unlock( &mp->mp_mutex );
ldap_pvt_thread_mutex_destroy( &mp->mp_mutex );
return( 0 );
}
+static void
+monitor_entry_destroy( void *v_mc )
+{
+ monitor_cache_t *mc = (monitor_cache_t *)v_mc;
+
+ if ( mc->mc_e != NULL ) {
+ monitor_entry_t *mp;
+
+ assert( mc->mc_e->e_private != NULL );
+
+ mp = ( monitor_entry_t * )mc->mc_e->e_private;
+
+ if ( mp->mp_cb ) {
+ if ( mp->mp_cb->mc_free ) {
+ mp->mp_cb->mc_free( mc->mc_e,
+ mp->mp_cb->mc_private );
+ }
+ ch_free( mp->mp_cb );
+ }
+
+ ldap_pvt_thread_mutex_destroy( &mp->mp_mutex );
+
+ ch_free( mp );
+ mc->mc_e->e_private = NULL;
+ entry_free( mc->mc_e );
+ }
+
+ ch_free( mc );
+}
+
+int
+monitor_cache_destroy(
+ monitor_info_t *mi )
+{
+ if ( mi->mi_cache ) {
+ avl_free( mi->mi_cache, monitor_entry_destroy );
+ }
+
+ return 0;
+}
+
#define MONITOR_LEGACY_CONN
#endif
+static int
+monitor_subsys_conn_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
+static int
+monitor_subsys_conn_create(
+ Operation *op,
+ SlapReply *rs,
+ struct berval *ndn,
+ Entry *e_parent,
+ Entry **ep );
+
int
monitor_subsys_conn_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
Entry *e, **ep, *e_conn;
assert( be != NULL );
+ ms->mss_update = monitor_subsys_conn_update;
+ ms->mss_create = monitor_subsys_conn_create;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_conn_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
current_bv = BER_BVC( "cn=current" );
struct berval rdn;
- assert( mi );
- assert( e );
+ assert( mi != NULL );
+ assert( e != NULL );
dnRdn( &e->e_nname, &rdn );
monitor_info_t *mi,
Connection *c,
Entry **ep,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_entry_t *mp;
struct tm *ltm;
mi->mi_ad_monitorConnectionAuthzDN->ad_cname.bv_val,
c->c_dn.bv_len ? c->c_dn.bv_val : SLAPD_ANONYMOUS,
+ /* NOTE: client connections leave the c_peer_* fields NULL */
mi->mi_ad_monitorConnectionListener->ad_cname.bv_val,
c->c_listener_url.bv_val,
mi->mi_ad_monitorConnectionPeerDomain->ad_cname.bv_val,
- c->c_peer_domain.bv_val,
+ BER_BVISNULL( &c->c_peer_domain ) ? "unknown" : c->c_peer_domain.bv_val,
mi->mi_ad_monitorConnectionLocalAddress->ad_cname.bv_val,
- c->c_peer_name.bv_val,
+ BER_BVISNULL( &c->c_peer_name ) ? "unknown" : c->c_peer_name.bv_val,
mi->mi_ad_monitorConnectionPeerAddress->ad_cname.bv_val,
c->c_sock_name.bv_val,
return SLAP_CB_CONTINUE;
}
-int
+static int
monitor_subsys_conn_create(
Operation *op,
SlapReply *rs,
struct berval *ndn,
Entry *e_parent,
- Entry **ep
-)
+ Entry **ep )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
/* create all the children of e_parent */
for ( c = connection_first( &connindex );
c != NULL;
- c = connection_next( c, &connindex ))
+ c = connection_next( c, &connindex ) )
{
- if ( conn_create( mi, c, &e, ms ) || e == NULL ) {
+ if ( conn_create( mi, c, &e, ms ) != SLAP_CB_CONTINUE
+ || e == NULL )
+ {
for ( ; e_tmp != NULL; ) {
mp = ( monitor_entry_t * )e_tmp->e_private;
e = mp->mp_next;
mp->mp_next = e_tmp;
e_tmp = e;
}
- connection_done(c);
+ connection_done( c );
*ep = e;
} else {
#define PATH_MAX 4095
#endif /* ! PATH_MAX */
+static int
+monitor_subsys_database_modify(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
static struct restricted_ops_t {
struct berval op;
unsigned int tag;
assert( be != NULL );
+ ms->mss_modify = monitor_subsys_database_modify;
+
mi = ( monitor_info_t * )be->be_private;
ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
break;
}
}
- assert( on2 );
+ assert( on2 != NULL );
snprintf( buf, sizeof( buf ),
"cn=Overlay %d,%s",
break;
}
}
- assert( on2 );
+ assert( on2 != NULL );
snprintf( buf, sizeof( buf ),
"dn: cn=Overlay %d,cn=Database %d,%s\n"
return LDAP_SUCCESS;
}
-int
+static int
monitor_subsys_database_modify(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
int rc = LDAP_OTHER;
#include <lutil.h>
#include "slap.h"
+#include "config.h"
#include "lber_pvt.h"
#include "back-monitor.h"
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_backend_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_VOLATILE_CH,
monitor_subsys_conn_init,
- monitor_subsys_conn_update,
- monitor_subsys_conn_create,
+ NULL, /* destroy */
+ NULL, /* update */
+ NULL, /* create */
NULL /* modify */
}, {
SLAPD_MONITOR_DATABASE_NAME,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_database_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
- monitor_subsys_database_modify
+ NULL /* modify */
}, {
SLAPD_MONITOR_LISTENER_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_listener_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_NONE,
monitor_subsys_log_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
- monitor_subsys_log_modify
+ NULL, /* modify */
}, {
SLAPD_MONITOR_OPS_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_ops_init,
- monitor_subsys_ops_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_overlay_init,
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL, /* modify */
BER_BVNULL },
MONITOR_F_NONE,
NULL, /* init */
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_sent_init,
- monitor_subsys_sent_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_thread_init,
- monitor_subsys_thread_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL /* modify */
}, {
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_time_init,
- monitor_subsys_time_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL, /* modify */
}, {
BER_BVNULL },
MONITOR_F_NONE,
NULL, /* init */
+ NULL, /* destroy */
NULL, /* update */
NULL, /* create */
NULL /* modify */
BER_BVNULL },
MONITOR_F_PERSISTENT_CH,
monitor_subsys_rww_init,
- monitor_subsys_rww_update,
+ NULL, /* destroy */
+ NULL, /* update */
NULL, /* create */
NULL /* modify */
}, { NULL }
/* FIXME: this should only be possible
* if be_monitor is already initialized */
- assert( be_monitor );
+ assert( be_monitor != NULL );
if ( ms->mss_open && ( *ms->mss_open )( be_monitor, ms ) ) {
return -1;
op->o_tag = LDAP_REQ_SEARCH;
/* use global malloc for now */
- op->o_tmpmemctx = NULL;
+ if ( op->o_tmpmemctx ) {
+ /* FIXME: connection_fake_init() calls slap_sl_mem_create, so we destroy it for now */
+ slap_sl_mem_destroy( NULL, op->o_tmpmemctx );
+ op->o_tmpmemctx = NULL;
+ }
op->o_tmpmfuncs = &ch_mfuncs;
op->o_bd = be_monitor;
} else {
if ( dnPrettyNormal( NULL, base, &op->o_req_dn, &op->o_req_ndn,
op->o_tmpmemctx ) ) {
- /* error */
+ return -1;
}
}
slap_mask_t flags;
int offset;
} moc[] = {
- { "monitor", "( 1.3.6.1.4.1.4203.666.3.2 "
+ { "monitor", "( 1.3.6.1.4.1.4203.666.3.16.1 "
"NAME 'monitor' "
"DESC 'OpenLDAP system monitoring' "
"SUP top STRUCTURAL "
"$ monitorOverlay "
") )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitor) },
- { "monitorServer", "( 1.3.6.1.4.1.4203.666.3.7 "
+ { "monitorServer", "( 1.3.6.1.4.1.4203.666.3.16.2 "
"NAME 'monitorServer' "
"DESC 'Server monitoring root entry' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitorServer) },
- { "monitorContainer", "( 1.3.6.1.4.1.4203.666.3.8 "
+ { "monitorContainer", "( 1.3.6.1.4.1.4203.666.3.16.3 "
"NAME 'monitorContainer' "
"DESC 'monitor container class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitorContainer) },
- { "monitorCounterObject", "( 1.3.6.1.4.1.4203.666.3.9 "
+ { "monitorCounterObject", "( 1.3.6.1.4.1.4203.666.3.16.4 "
"NAME 'monitorCounterObject' "
"DESC 'monitor counter class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitorCounterObject) },
- { "monitorOperation", "( 1.3.6.1.4.1.4203.666.3.10 "
+ { "monitorOperation", "( 1.3.6.1.4.1.4203.666.3.16.5 "
"NAME 'monitorOperation' "
"DESC 'monitor operation class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitorOperation) },
- { "monitorConnection", "( 1.3.6.1.4.1.4203.666.3.11 "
+ { "monitorConnection", "( 1.3.6.1.4.1.4203.666.3.16.6 "
"NAME 'monitorConnection' "
"DESC 'monitor connection class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitorConnection) },
- { "managedObject", "( 1.3.6.1.4.1.4203.666.3.12 "
+ { "managedObject", "( 1.3.6.1.4.1.4203.666.3.16.7 "
"NAME 'managedObject' "
"DESC 'monitor managed entity class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_managedObject) },
- { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.14 "
+ { "monitoredObject", "( 1.3.6.1.4.1.4203.666.3.16.8 "
"NAME 'monitoredObject' "
"DESC 'monitor monitored entity class' "
"SUP monitor STRUCTURAL )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
offsetof(monitor_info_t, mi_oc_monitoredObject) },
{ NULL, NULL, 0, -1 }
}, mat[] = {
- { "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.14 "
+ { "monitoredInfo", "( 1.3.6.1.4.1.4203.666.1.55.1 "
"NAME 'monitoredInfo' "
"DESC 'monitored info' "
/* "SUP name " */
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitoredInfo) },
- { "managedInfo", "( 1.3.6.1.4.1.4203.666.1.15 "
+ { "managedInfo", "( 1.3.6.1.4.1.4203.666.1.55.2 "
"NAME 'managedInfo' "
"DESC 'monitor managed info' "
"SUP name )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_managedInfo) },
- { "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.16 "
+ { "monitorCounter", "( 1.3.6.1.4.1.4203.666.1.55.3 "
"NAME 'monitorCounter' "
"DESC 'monitor counter' "
"EQUALITY integerMatch "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorCounter) },
- { "monitorOpCompleted", "( 1.3.6.1.4.1.4203.666.1.17 "
+ { "monitorOpCompleted", "( 1.3.6.1.4.1.4203.666.1.55.4 "
"NAME 'monitorOpCompleted' "
"DESC 'monitor completed operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorOpCompleted) },
- { "monitorOpInitiated", "( 1.3.6.1.4.1.4203.666.1.18 "
+ { "monitorOpInitiated", "( 1.3.6.1.4.1.4203.666.1.55.5 "
"NAME 'monitorOpInitiated' "
"DESC 'monitor initiated operations' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorOpInitiated) },
- { "monitorConnectionNumber", "( 1.3.6.1.4.1.4203.666.1.19 "
+ { "monitorConnectionNumber", "( 1.3.6.1.4.1.4203.666.1.55.6 "
"NAME 'monitorConnectionNumber' "
"DESC 'monitor connection number' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionNumber) },
- { "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.20 "
+ { "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.1.55.7 "
"NAME 'monitorConnectionAuthzDN' "
"DESC 'monitor connection authorization DN' "
/* "SUP distinguishedName " */
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionAuthzDN) },
- { "monitorConnectionLocalAddress", "( 1.3.6.1.4.1.4203.666.1.21 "
+ { "monitorConnectionLocalAddress", "( 1.3.6.1.4.1.4203.666.1.55.8 "
"NAME 'monitorConnectionLocalAddress' "
"DESC 'monitor connection local address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionLocalAddress) },
- { "monitorConnectionPeerAddress", "( 1.3.6.1.4.1.4203.666.1.22 "
+ { "monitorConnectionPeerAddress", "( 1.3.6.1.4.1.4203.666.1.55.9 "
"NAME 'monitorConnectionPeerAddress' "
"DESC 'monitor connection peer address' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionPeerAddress) },
- { "monitorTimestamp", "( 1.3.6.1.4.1.4203.666.1.24 "
+ { "monitorTimestamp", "( 1.3.6.1.4.1.4203.666.1.55.10 "
"NAME 'monitorTimestamp' "
"DESC 'monitor timestamp' "
"EQUALITY generalizedTimeMatch "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorTimestamp) },
- { "monitorOverlay", "( 1.3.6.1.4.1.4203.666.1.27 "
+ { "monitorOverlay", "( 1.3.6.1.4.1.4203.666.1.55.11 "
"NAME 'monitorOverlay' "
"DESC 'name of overlays defined for a given database' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorOverlay) },
- { "readOnly", "( 1.3.6.1.4.1.4203.666.1.31 "
+ { "readOnly", "( 1.3.6.1.4.1.4203.666.1.55.12 "
"NAME 'readOnly' "
"DESC 'read/write status of a given database' "
"EQUALITY booleanMatch "
"SINGLE-VALUE "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_readOnly) },
- { "restrictedOperation", "( 1.3.6.1.4.1.4203.666.1.32 "
+ { "restrictedOperation", "( 1.3.6.1.4.1.4203.666.1.55.13 "
"NAME 'restrictedOperation' "
"DESC 'name of restricted operation for a given database' "
"SUP managedInfo )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_restrictedOperation ) },
- { "monitorConnectionProtocol", "( 1.3.6.1.4.1.4203.666.1.39 "
+ { "monitorConnectionProtocol", "( 1.3.6.1.4.1.4203.666.1.55.14 "
"NAME 'monitorConnectionProtocol' "
"DESC 'monitor connection protocol' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionProtocol) },
- { "monitorConnectionOpsReceived", "( 1.3.6.1.4.1.4203.666.1.40 "
+ { "monitorConnectionOpsReceived", "( 1.3.6.1.4.1.4203.666.1.55.15 "
"NAME 'monitorConnectionOpsReceived' "
"DESC 'monitor number of operations received by the connection' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsReceived) },
- { "monitorConnectionOpsExecuting", "( 1.3.6.1.4.1.4203.666.1.41 "
+ { "monitorConnectionOpsExecuting", "( 1.3.6.1.4.1.4203.666.1.55.16 "
"NAME 'monitorConnectionOpsExecuting' "
"DESC 'monitor number of operations in execution within the connection' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsExecuting) },
- { "monitorConnectionOpsPending", "( 1.3.6.1.4.1.4203.666.1.42 "
+ { "monitorConnectionOpsPending", "( 1.3.6.1.4.1.4203.666.1.55.17 "
"NAME 'monitorConnectionOpsPending' "
"DESC 'monitor number of pending operations within the connection' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsPending) },
- { "monitorConnectionOpsCompleted", "( 1.3.6.1.4.1.4203.666.1.43 "
+ { "monitorConnectionOpsCompleted", "( 1.3.6.1.4.1.4203.666.1.55.18 "
"NAME 'monitorConnectionOpsCompleted' "
"DESC 'monitor number of operations completed within the connection' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsCompleted) },
- { "monitorConnectionGet", "( 1.3.6.1.4.1.4203.666.1.44 "
+ { "monitorConnectionGet", "( 1.3.6.1.4.1.4203.666.1.55.19 "
"NAME 'monitorConnectionGet' "
"DESC 'number of times connection_get() was called so far' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionGet) },
- { "monitorConnectionRead", "( 1.3.6.1.4.1.4203.666.1.45 "
+ { "monitorConnectionRead", "( 1.3.6.1.4.1.4203.666.1.55.20 "
"NAME 'monitorConnectionRead' "
"DESC 'number of times connection_read() was called so far' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionRead) },
- { "monitorConnectionWrite", "( 1.3.6.1.4.1.4203.666.1.46 "
+ { "monitorConnectionWrite", "( 1.3.6.1.4.1.4203.666.1.55.21 "
"NAME 'monitorConnectionWrite' "
"DESC 'number of times connection_write() was called so far' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionWrite) },
- { "monitorConnectionMask", "( 1.3.6.1.4.1.4203.666.1.47 "
+ { "monitorConnectionMask", "( 1.3.6.1.4.1.4203.666.1.55.22 "
"NAME 'monitorConnectionMask' "
"DESC 'monitor connection mask' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionMask) },
- { "monitorConnectionListener", "( 1.3.6.1.4.1.4203.666.1.48 "
+ { "monitorConnectionListener", "( 1.3.6.1.4.1.4203.666.1.55.23 "
"NAME 'monitorConnectionListener' "
"DESC 'monitor connection listener' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionListener) },
- { "monitorConnectionPeerDomain", "( 1.3.6.1.4.1.4203.666.1.49 "
+ { "monitorConnectionPeerDomain", "( 1.3.6.1.4.1.4203.666.1.55.24 "
"NAME 'monitorConnectionPeerDomain' "
"DESC 'monitor connection peer domain' "
"SUP monitoredInfo "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionPeerDomain) },
- { "monitorConnectionStartTime", "( 1.3.6.1.4.1.4203.666.1.50 "
+ { "monitorConnectionStartTime", "( 1.3.6.1.4.1.4203.666.1.55.25 "
"NAME 'monitorConnectionStartTime' "
"DESC 'monitor connection start time' "
"SUP monitorTimestamp "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionStartTime) },
- { "monitorConnectionActivityTime", "( 1.3.6.1.4.1.4203.666.1.51 "
+ { "monitorConnectionActivityTime", "( 1.3.6.1.4.1.4203.666.1.55.26 "
"NAME 'monitorConnectionActivityTime' "
"DESC 'monitor connection activity time' "
"SUP monitorTimestamp "
"NO-USER-MODIFICATION "
"USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionActivityTime) },
- { "monitorIsShadow", "( 1.3.6.1.4.1.4203.666.1.52 "
+ { "monitorIsShadow", "( 1.3.6.1.4.1.4203.666.1.55.27 "
"NAME 'monitorIsShadow' "
"DESC 'TRUE if the database is shadow' "
"EQUALITY booleanMatch "
"SINGLE-VALUE "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorIsShadow) },
- { "monitorUpdateRef", "( 1.3.6.1.4.1.4203.666.1.53 "
+ { "monitorUpdateRef", "( 1.3.6.1.4.1.4203.666.1.55.28 "
"NAME 'monitorUpdateRef' "
"DESC 'update referral for shadow databases' "
"SUP monitoredInfo "
"SINGLE-VALUE "
"USAGE directoryOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorUpdateRef) },
+ { "monitorRuntimeConfig", "( 1.3.6.1.4.1.4203.666.1.55.29 "
+ "NAME 'monitorRuntimeConfig' "
+ "DESC 'TRUE if component allows runtime configuration' "
+ "EQUALITY booleanMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 "
+ "SINGLE-VALUE "
+ "USAGE directoryOperation )", SLAP_AT_HIDE,
+ offsetof(monitor_info_t, mi_ad_monitorRuntimeConfig) },
{ NULL, NULL, 0, -1 }
};
-
+ static ConfigTable monitorcfg[] = {
+ { NULL, NULL, 0, 0, 0, ARG_IGNORED,
+ NULL, NULL, NULL, NULL }
+ };
+ static ConfigOCs monitorocs[] = {
+ { "( OLcfgDbOc:4.1 "
+ "NAME 'olcMonitorConfig' "
+ "DESC 'Monitor backend configuration' "
+ "SUP olcDatabaseConfig "
+ ")",
+ Cft_Database, monitorcfg },
+ { NULL, 0, NULL }
+ };
+ int rc;
+
bi->bi_controls = controls;
bi->bi_init = 0;
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;
+ /*
+ * configuration objectClasses (fake)
+ */
+ bi->bi_cf_ocs = monitorocs;
+
+ rc = config_register_schema( monitorcfg, monitorocs );
+ if ( rc ) {
+ return rc;
+ }
+
+ /*
+ * register subsys
+ */
for ( ms = known_monitor_subsys; ms->mss_name != NULL; ms++ ) {
if ( monitor_back_register_subsys( ms ) ) {
return -1;
monitor_back_db_init(
BackendDB *be )
{
- monitor_info_t *mi;
int rc;
struct berval dn, ndn;
struct berval bv;
rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
- "unable to normalize monitor DN \"%s\"\n",
- SLAPD_MONITOR_DN, 0, 0 );
+ "unable to normalize monitor DN \"%s\" (%d)\n",
+ dn.bv_val, rc, 0 );
return -1;
}
/* NOTE: only one monitor database is allowed,
* so we use static storage */
- mi = &monitor_info;
-
- ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
+ ldap_pvt_thread_mutex_init( &monitor_info.mi_cache_mutex );
- be->be_private = mi;
+ be->be_private = &monitor_info;
return 0;
}
#endif
static char tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
- assert( be_monitor );
+ assert( be_monitor != NULL );
if ( be != be_monitor ) {
be_monitor = be;
}
ep = &mp->mp_next;
}
- assert( be );
+ assert( be != NULL );
be->be_private = mi;
int argc,
char **argv )
{
+#if 0
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
+#endif
/*
* eventually, will hold database specific configuration parameters
{
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
+ if ( mi == NULL ) {
+ return -1;
+ }
+
/*
* FIXME: destroys all the data
*/
/* NOTE: mi points to static storage; don't free it */
+ (void)monitor_cache_destroy( mi );
+
+ if ( monitor_subsys ) {
+ int i;
+
+ for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
+ if ( monitor_subsys[ i ]->mss_destroy ) {
+ monitor_subsys[ i ]->mss_destroy( be, monitor_subsys[ i ] );
+ }
+
+ if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_rdn ) ) {
+ ch_free( monitor_subsys[ i ]->mss_rdn.bv_val );
+ }
+ }
+
+ ch_free( monitor_subsys );
+ }
+
+ ldap_pvt_thread_mutex_destroy( &monitor_info.mi_cache_mutex );
+
+ be->be_private = NULL;
+
return 0;
}
#include "ldif.h"
#include "back-monitor.h"
+static int
+monitor_subsys_log_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_log_modify(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
/*
* log mutex
*/
Entry *e;
int i;
+ ms->mss_destroy = monitor_subsys_log_destroy;
+ ms->mss_modify = monitor_subsys_log_modify;
+
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
mi = ( monitor_info_t * )be->be_private;
return( 0 );
}
-int
+static int
+monitor_subsys_log_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; int_2_level[ i ].i != 0; i++ ) {
+ if ( !BER_BVISNULL( &int_2_level[ i ].n ) ) {
+ ch_free( int_2_level[ i ].n.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_log_modify(
Operation *op,
SlapReply *rs,
}
/* check that the entry still obeys the schema */
- rc = entry_schema_check( be_monitor, e, save_attrs, 0,
+ rc = entry_schema_check( op, e, save_attrs, 0,
&text, textbuf, sizeof( textbuf ) );
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
{ BER_BVNULL, BER_BVNULL }
};
+static int
+monitor_subsys_ops_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_ops_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
int
monitor_subsys_ops_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_destroy = monitor_subsys_ops_destroy;
+ ms->mss_update = monitor_subsys_ops_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
return( 0 );
}
-int
+static int
+monitor_subsys_ops_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; i < SLAP_OP_LAST; i++ ) {
+ if ( !BER_BVISNULL( &monitor_op[ i ].nrdn ) ) {
+ ch_free( monitor_op[ i ].nrdn.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_ops_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Attribute *a;
static struct berval bv_ops = BER_BVC( "cn=operations" );
- assert( mi );
- assert( e );
+ assert( mi != NULL );
+ assert( e != NULL );
dnRdn( &e->e_nname, &rdn );
{
Attribute **ap;
- assert( rs->sr_entry );
+ assert( rs->sr_entry != NULL );
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count */ ;
mp = ( monitor_entry_t * )rs->sr_entry->e_private;
- assert( mp );
+ assert( mp != NULL );
hs = MONITOR_HAS_CHILDREN( mp );
*ap = slap_operational_hasSubordinate( hs );
- assert( *ap );
+ assert( *ap != NULL );
ap = &(*ap)->a_next;
}
"objectClass: %s\n"
"structuralObjectClass: %s\n"
"cn: Overlay %d\n"
+ "%s: %s\n"
+ "%s: %s\n"
"creatorsName: %s\n"
"modifiersName: %s\n"
"createTimestamp: %s\n"
mi->mi_oc_monitoredObject->soc_cname.bv_val,
mi->mi_oc_monitoredObject->soc_cname.bv_val,
i,
+ mi->mi_ad_monitoredInfo->ad_cname.bv_val,
+ on->on_bi.bi_type,
+ mi->mi_ad_monitorRuntimeConfig->ad_cname.bv_val,
+ on->on_bi.bi_cf_ocs ? "TRUE" : "FALSE",
mi->mi_creatorsName.bv_val,
mi->mi_creatorsName.bv_val,
mi->mi_startTime.bv_val,
}
ber_str2bv( on->on_bi.bi_type, 0, 0, &bv );
- attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
- &bv, NULL );
attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo,
&bv, NULL );
monitor_info_t *mi,
Entry *e ));
+extern int
+monitor_cache_destroy LDAP_P((
+ monitor_info_t *mi ));
+
/*
* connections
*/
monitor_subsys_conn_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_conn_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
-extern int
-monitor_subsys_conn_create LDAP_P((
- Operation *op,
- SlapReply *rs,
- struct berval *ndn,
- Entry *e_parent,
- Entry **ep ));
/*
* databases
monitor_subsys_database_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_database_modify LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* entry
monitor_subsys_log_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_log_modify LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* operations
monitor_subsys_ops_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_ops_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* overlay
monitor_subsys_sent_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_sent_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* threads
monitor_subsys_thread_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_thread_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* time
extern int monitor_subsys_time_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_time_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* waiters
monitor_subsys_rww_init LDAP_P((
BackendDB *be,
monitor_subsys_t *ms ));
-extern int
-monitor_subsys_rww_update LDAP_P((
- Operation *op,
- SlapReply *rs,
- Entry *e ));
/*
* former external.h
#include "lutil.h"
#include "back-monitor.h"
+static int
+monitor_subsys_rww_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
enum {
MONITOR_RWW_READ = 0,
MONITOR_RWW_WRITE,
assert( be != NULL );
+ ms->mss_update = monitor_subsys_rww_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_conn ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_rww_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = (monitor_info_t *)op->o_bd->be_private;
Connection *c;
snprintf( buf, sizeof( buf ), "%ld", num );
a = attr_find( e->e_attrs, mi->mi_ad_monitorCounter );
- assert( a );
+ assert( a != NULL );
len = strlen( buf );
if ( len > a->a_vals[ 0 ].bv_len ) {
a->a_vals[ 0 ].bv_val = ber_memrealloc( a->a_vals[ 0 ].bv_val, len + 1 );
)
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
- Entry *e, *e_tmp, *e_ch;
+ Entry *e,
+ *e_tmp,
+ *e_ch = NULL,
+ *e_nonvolatile = NULL;
monitor_entry_t *mp;
- int rc;
+ int rc,
+ nonvolatile = 0;
mp = ( monitor_entry_t * )e_parent->e_private;
- e = mp->mp_children;
+ e_nonvolatile = e = mp->mp_children;
- e_ch = NULL;
if ( MONITOR_HAS_VOLATILE_CH( mp ) ) {
monitor_entry_create( op, rs, NULL, e_parent, &e_ch );
}
/* if no persistent, return only volatile */
if ( e == NULL ) {
e = e_ch;
- monitor_cache_lock( e_ch );
/* else append persistent to volatile */
} else {
}
/* return entries */
- for ( ; e != NULL; ) {
- mp = ( monitor_entry_t * )e->e_private;
-
+ for ( monitor_cache_lock( e ); e != NULL; ) {
monitor_entry_update( op, rs, e );
if ( op->o_abandon ) {
- monitor_cache_release( mi, e );
+ /* FIXME: may leak generated children */
+ if ( nonvolatile == 0 ) {
+ for ( e_tmp = e; e_tmp != NULL; ) {
+ mp = ( monitor_entry_t * )e_tmp->e_private;
+ e = e_tmp;
+ e_tmp = mp->mp_next;
+ monitor_cache_release( mi, e );
+
+ if ( e_tmp == e_nonvolatile ) {
+ break;
+ }
+ }
+
+ } else {
+ monitor_cache_release( mi, e );
+ }
+
return SLAPD_ABANDON;
}
rs->sr_entry = NULL;
}
- if ( ( mp->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
- && sub )
- {
+ mp = ( monitor_entry_t * )e->e_private;
+ e_tmp = mp->mp_next;
+
+ if ( sub ) {
rc = monitor_send_children( op, rs, e, sub );
if ( rc ) {
- monitor_cache_release( mi, e );
+ /* FIXME: may leak generated children */
+ if ( nonvolatile == 0 ) {
+ for ( ; e_tmp != NULL; ) {
+ mp = ( monitor_entry_t * )e_tmp->e_private;
+ e = e_tmp;
+ e_tmp = mp->mp_next;
+ monitor_cache_release( mi, e );
+
+ if ( e_tmp == e_nonvolatile ) {
+ break;
+ }
+ }
+ }
+
return( rc );
}
}
- e_tmp = mp->mp_next;
if ( e_tmp != NULL ) {
monitor_cache_lock( e_tmp );
}
- monitor_cache_release( mi, e );
+
+ if ( !sub ) {
+ /* otherwise the recursive call already released */
+ monitor_cache_release( mi, e );
+ }
+
e = e_tmp;
+ if ( e == e_nonvolatile ) {
+ nonvolatile = 1;
+ }
}
return LDAP_SUCCESS;
#include "slap.h"
#include "back-monitor.h"
+static int
+monitor_subsys_sent_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms );
+
+static int
+monitor_subsys_sent_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
enum {
MONITOR_SENT_BYTES = 0,
MONITOR_SENT_PDU,
int
monitor_subsys_sent_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_destroy = monitor_subsys_sent_destroy;
+ ms->mss_update = monitor_subsys_sent_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_sent ) ) {
return( 0 );
}
-int
+static int
+monitor_subsys_sent_destroy(
+ BackendDB *be,
+ monitor_subsys_t *ms )
+{
+ int i;
+
+ for ( i = 0; i < MONITOR_SENT_LAST; i++ ) {
+ if ( !BER_BVISNULL( &monitor_sent[ i ].nrdn ) ) {
+ ch_free( monitor_sent[ i ].nrdn.bv_val );
+ }
+ }
+
+ return 0;
+}
+
+static int
monitor_subsys_sent_update(
Operation *op,
SlapReply *rs,
Attribute *a;
int i;
- assert( mi );
- assert( e );
+ assert( mi != NULL );
+ assert( e != NULL );
dnRdn( &e->e_nname, &nrdn );
ldap_pvt_thread_mutex_unlock(&slap_counters.sc_sent_mutex);
a = attr_find( e->e_attrs, mi->mi_ad_monitorCounter );
- assert( a );
+ assert( a != NULL );
/* NOTE: no minus sign is allowed in the counters... */
UI2BV( &a->a_vals[ 0 ], n );
#include <ldap_rq.h>
+static int
+monitor_subsys_thread_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
/*
-* * initializes log subentry
-* */
+ * initializes log subentry
+ */
int
monitor_subsys_thread_init(
BackendDB *be,
Entry *e, **ep, *e_thread;
static char buf[ BACKMONITOR_BUFSIZE ];
+ ms->mss_update = monitor_subsys_thread_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_thread ) ) {
return( 0 );
}
-int
+static int
monitor_subsys_thread_update(
Operation *op,
SlapReply *rs,
- Entry *e
-)
+ Entry *e )
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
Attribute *a;
#include "proto-slap.h"
#include "back-monitor.h"
+static int
+monitor_subsys_time_update(
+ Operation *op,
+ SlapReply *rs,
+ Entry *e );
+
int
monitor_subsys_time_init(
BackendDB *be,
- monitor_subsys_t *ms
-)
+ monitor_subsys_t *ms )
{
monitor_info_t *mi;
assert( be != NULL );
+ ms->mss_update = monitor_subsys_time_update;
+
mi = ( monitor_info_t * )be->be_private;
if ( monitor_cache_get( mi,
return( 0 );
}
-int
+static int
monitor_subsys_time_update(
Operation *op,
SlapReply *rs,
static struct berval bv_current = BER_BVC( "cn=current" );
struct berval rdn;
- assert( mi );
- assert( e );
+ assert( mi != NULL );
+ assert( e != NULL );
dnRdn( &e->e_nname, &rdn );
SlapReply *rs )
{
int count;
- char *avastr, *ptr;
+ char *avastr;
PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
ri->ri_bd = select_backend( &ri->ri_realsuffix, 0, 1 );
/* must be there: it was during config! */
- assert( ri->ri_bd );
+ assert( ri->ri_bd != NULL );
/* inherit controls */
AC_MEMCPY( be->be_ctrls, ri->ri_bd->be_ctrls, sizeof( be->be_ctrls ) );
SQLHSTMT asth = SQL_NULL_HSTMT;
BACKSQL_ROW_NTS row;
- assert( at );
+ assert( at != NULL );
if ( at->bam_delete_proc == NULL ) {
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_delete_all_values(): "
return rs->sr_err = LDAP_OTHER;
}
- backsql_BindRowAsStrings( asth, &row );
+ backsql_BindRowAsStrings_x( asth, &row, op->o_tmpmemctx );
for ( rc = SQLFetch( asth );
BACKSQL_SUCCESS( rc );
rc = SQLFetch( asth ) )
{
- int i;
+ int i;
/* first parameter no, parameter order */
- SQLUSMALLINT pno, po;
+ SQLUSMALLINT pno = 0,
+ po = 0;
/* procedure return code */
- int prc = LDAP_SUCCESS;
+ int prc = LDAP_SUCCESS;
for ( i = 0; i < row.ncols; i++ ) {
SQLHSTMT sth = SQL_NULL_HSTMT;
sth, rc );
rs->sr_text = "SQL-backend error";
- return rs->sr_err = LDAP_OTHER;
+ rs->sr_err = LDAP_OTHER;
+ goto done;
}
if ( BACKSQL_IS_DEL( at->bam_expect_return ) ) {
SQLFreeStmt( sth, SQL_DROP );
rs->sr_text = "SQL-backend error";
- return rs->sr_err = LDAP_OTHER;
+ rs->sr_err = LDAP_OTHER;
+ goto done;
}
-
- } else {
- pno = 0;
}
po = ( BACKSQL_IS_DEL( at->bam_param_order ) ) > 0;
rc = backsql_BindParamID( sth, pno + 1 + po,
SQLFreeStmt( sth, SQL_DROP );
rs->sr_text = "SQL-backend error";
- return rs->sr_err = LDAP_OTHER;
+ rs->sr_err = LDAP_OTHER;
+ goto done;
}
#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_delete_all_values() "
- "arg%d=%s\n",
+ "arg(%d)=%s\n",
pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
#else /* ! BACKSQL_ARBITRARY_KEY */
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_delete_all_values() "
- "arg%d=%lu\n",
+ "arg(%d)=%lu\n",
pno + 1 + po, e_id->eid_keyval, 0 );
#endif /* ! BACKSQL_ARBITRARY_KEY */
SQLFreeStmt( sth, SQL_DROP );
rs->sr_text = "SQL-backend error";
- return rs->sr_err = LDAP_OTHER;
+ rs->sr_err = LDAP_OTHER;
+ goto done;
}
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_delete_all_values(): "
- "arg%d=%s; executing \"%s\"\n",
+ "arg(%d)=%s; executing \"%s\"\n",
pno + 2 - po, row.cols[ i ],
at->bam_delete_proc );
rc = SQLExecute( sth );
}
rs->sr_text = op->o_req_dn.bv_val;
SQLFreeStmt( sth, SQL_DROP );
- return rs->sr_err;
+ goto done;
}
SQLFreeStmt( sth, SQL_DROP );
}
}
- backsql_FreeRow( &row );
+
+ rs->sr_err = LDAP_SUCCESS;
+
+done:;
+ backsql_FreeRow_x( &row, op->o_tmpmemctx );
SQLFreeStmt( asth, SQL_DROP );
- return LDAP_SUCCESS;
+ return rs->sr_err;
}
int
backsql_entryID *e_id,
Modifications *modlist )
{
- backsql_info *bi = (backsql_info*)op->o_bd->be_private;
+ backsql_info *bi = (backsql_info *)op->o_bd->be_private;
RETCODE rc;
- SQLHSTMT sth = SQL_NULL_HSTMT;
Modifications *ml;
Debug( LDAP_DEBUG_TRACE, "==>backsql_modify_internal(): "
backsql_at_map_rec *at = NULL;
struct berval *at_val;
int i;
- /* first parameter position, parameter order */
- SQLUSMALLINT pno, po;
- /* procedure return code */
- int prc = LDAP_SUCCESS;
ad = ml->sml_mod.sm_desc;
sm_op = ( ml->sml_mod.sm_op & LDAP_MOD_OP );
!BER_BVISNULL( at_val );
i++, at_val++ )
{
+ SQLHSTMT sth = SQL_NULL_HSTMT;
+ /* first parameter position, parameter order */
+ SQLUSMALLINT pno = 0,
+ po;
+ /* procedure return code */
+ int prc = LDAP_SUCCESS;
+
rc = backsql_Prepare( dbh, &sth, at->bam_add_proc, 0 );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
rs->sr_err = LDAP_OTHER;
goto done;
}
-
- } else {
- pno = 0;
}
po = ( BACKSQL_IS_ADD( at->bam_param_order ) ) > 0;
rc = backsql_BindParamID( sth, pno + 1 + po,
#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg%d=\"%s\"\n",
+ "arg(%d)=\"%s\"\n",
pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
#else /* ! BACKSQL_ARBITRARY_KEY */
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg%d=\"%lu\"\n",
+ "arg(%d)=\"%lu\"\n",
pno + 1 + po, e_id->eid_keyval, 0 );
#endif /* ! BACKSQL_ARBITRARY_KEY */
}
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg%d=\"%s\"; executing \"%s\"\n",
+ "arg(%d)=\"%s\"; executing \"%s\"\n",
pno + 2 - po, at_val->bv_val,
at->bam_add_proc );
rc = SQLExecute( sth );
- if ( rc != SQL_SUCCESS ) {
+ if ( rc == SQL_SUCCESS && prc == LDAP_SUCCESS ) {
+ rs->sr_err = LDAP_SUCCESS;
+
+ } else {
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "add_proc execution failed\n",
- 0, 0, 0 );
- backsql_PrintErrors( bi->sql_db_env,
- dbh, sth, rc );
+ "add_proc execution failed "
+ "(rc=%d, prc=%d)\n",
+ rc, prc, 0 );
+ if ( prc != LDAP_SUCCESS ) {
+ /* SQL procedure executed fine
+ * but returned an error */
+ SQLFreeStmt( sth, SQL_DROP );
- SQLFreeStmt( sth, SQL_DROP );
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "SQL-backend error";
- goto done;
+ rs->sr_err = BACKSQL_SANITIZE_ERROR( prc );
+ rs->sr_text = at->bam_ad->ad_cname.bv_val;
+ return rs->sr_err;
+
+ } else {
+ backsql_PrintErrors( bi->sql_db_env, dbh,
+ sth, rc );
+ if ( BACKSQL_FAIL_IF_NO_MAPPING( bi ) )
+ {
+ SQLFreeStmt( sth, SQL_DROP );
+
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "SQL-backend error";
+ goto done;
+ }
+ }
}
SQLFreeStmt( sth, SQL_DROP );
}
!BER_BVISNULL( at_val );
i++, at_val++ )
{
- prc = LDAP_SUCCESS;
+ SQLHSTMT sth = SQL_NULL_HSTMT;
+ /* first parameter position, parameter order */
+ SQLUSMALLINT pno = 0,
+ po;
+ /* procedure return code */
+ int prc = LDAP_SUCCESS;
+
rc = backsql_Prepare( dbh, &sth, at->bam_delete_proc, 0 );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
rs->sr_err = LDAP_OTHER;
goto done;
}
-
- } else {
- pno = 0;
}
po = ( BACKSQL_IS_DEL( at->bam_param_order ) ) > 0;
rc = backsql_BindParamID( sth, pno + 1 + po,
#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg%d=\"%s\"\n",
+ "arg(%d)=\"%s\"\n",
pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
#else /* ! BACKSQL_ARBITRARY_KEY */
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg%d=\"%lu\"\n",
+ "arg(%d)=\"%lu\"\n",
pno + 1 + po, e_id->eid_keyval, 0 );
#endif /* ! BACKSQL_ARBITRARY_KEY */
if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
- rs->sr_err = entry_schema_check( op->o_bd, op->ora_e, NULL, 0,
+ rs->sr_err = entry_schema_check( op, op->ora_e, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
bsi.bsi_e = &p;
rs->sr_err = backsql_init_search( &bsi, &pdn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs, slap_anlist_no_attrs,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
{
backsql_api *ba;
- assert( bi );
- assert( name );
+ assert( bi != NULL );
+ assert( name != NULL );
for ( ba = backsqlapi; ba; ba = ba->ba_next ) {
if ( strcasecmp( name, ba->ba_name ) == 0 ) {
{
backsql_api *ba;
- assert( bi );
+ assert( bi != NULL );
ba = bi->sql_api;
{
backsql_api *ba2;
- assert( ba );
+ assert( ba != NULL );
assert( ba->ba_private == NULL );
if ( ba->ba_name == NULL ) {
* is used */
#define BACKSQL_SCOPE_BASE_LIKE ( LDAP_SCOPE_BASE | 0x1000 )
Filter *bsi_filter;
- int bsi_slimit,
- bsi_tlimit;
time_t bsi_stoptime;
backsql_entryID *bsi_id_list,
bsi.bsi_e = &e;
rc = backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs, anlist,
BACKSQL_ISF_GET_ENTRY );
if ( rc != LDAP_SUCCESS ) {
* Get the entry
*/
bsi.bsi_e = &e;
- rc = backsql_init_search( &bsi, &op->o_req_ndn,
- LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
+ rc = backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE,
(time_t)(-1), NULL, dbh, op, rs, anlist,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
switch ( rc ) {
backsql_info *bi = (backsql_info *)be->be_private;
Debug( LDAP_DEBUG_TRACE, "==>backsql_db_config()\n", 0, 0, 0 );
- assert( bi );
+ assert( bi != NULL );
if ( !strcasecmp( argv[ 0 ], "dbhost" ) ) {
if ( argc < 2 ) {
int rc = 0, lineno = 0, lmax = 0;
char *buf = NULL;
- assert( fname );
+ assert( fname != NULL );
fp = ldif_open( fname, "r" );
if ( fp == NULL ) {
struct berval bv = BER_BVNULL;
const char *text = NULL;
- assert( ava );
+ assert( ava != NULL );
rc = slap_bv2ad( &ava->la_attr, &ad, &text );
if ( rc != LDAP_SUCCESS ) {
struct berval pdn = BER_BVNULL;
int manageDSAit = get_manageDSAit( op );
/* first parameter no */
- SQLUSMALLINT pno;
+ SQLUSMALLINT pno = 0;
Debug( LDAP_DEBUG_TRACE, "==>backsql_delete(): deleting entry \"%s\"\n",
op->o_req_ndn.bv_val, 0, 0 );
bsi.bsi_e = &d;
rs->sr_err = backsql_init_search( &bsi, &op->o_req_ndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs, slap_anlist_no_attrs,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
switch ( rs->sr_err ) {
goto done;
}
- rs->sr_err = backsql_has_children( bi, dbh, &op->o_req_ndn );
+ rs->sr_err = backsql_has_children( op, dbh, &op->o_req_ndn );
switch ( rs->sr_err ) {
case LDAP_COMPARE_FALSE:
rs->sr_err = LDAP_SUCCESS;
e_id = bsi.bsi_base_id;
rs->sr_err = backsql_init_search( &bsi, &pdn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs, slap_anlist_no_attrs,
BACKSQL_ISF_GET_ENTRY );
if ( rs->sr_err != LDAP_SUCCESS ) {
e = NULL;
goto done;
}
-
- } else {
- pno = 0;
}
rc = backsql_BindParamID( sth, pno + 1, SQL_PARAM_INPUT, &e_id.eid_keyval );
{
backsql_entryID *next;
- assert( id );
+ assert( id != NULL );
next = id->eid_next;
/* begin TimesTen */
Debug( LDAP_DEBUG_TRACE, " backsql_dn2id(\"%s\"): id_query \"%s\"\n",
ndn->bv_val, bi->sql_id_query, 0 );
- assert( bi->sql_id_query );
+ assert( bi->sql_id_query != NULL );
rc = backsql_Prepare( dbh, &sth, bi->sql_id_query, 0 );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
goto done;
}
- backsql_BindRowAsStrings( sth, &row );
+ backsql_BindRowAsStrings_x( sth, &row, op->o_tmpmemctx );
rc = SQLFetch( sth );
if ( BACKSQL_SUCCESS( rc ) ) {
char buf[ SLAP_TEXT_BUFLEN ];
}
}
}
- backsql_FreeRow( &row );
done:;
+ backsql_FreeRow_x( &row, op->o_tmpmemctx );
+
Debug( LDAP_DEBUG_TRACE,
"<==backsql_dn2id(\"%s\"): err=%d\n",
ndn->bv_val, res, 0 );
int
backsql_count_children(
- backsql_info *bi,
+ Operation *op,
SQLHDBC dbh,
struct berval *dn,
unsigned long *nchildren )
{
+ backsql_info *bi = (backsql_info *)op->o_bd->be_private;
SQLHSTMT sth = SQL_NULL_HSTMT;
BACKSQL_ROW_NTS row;
RETCODE rc;
/* begin TimesTen */
Debug(LDAP_DEBUG_TRACE, "children id query \"%s\"\n",
bi->sql_has_children_query, 0, 0);
- assert( bi->sql_has_children_query );
+ assert( bi->sql_has_children_query != NULL );
rc = backsql_Prepare( dbh, &sth, bi->sql_has_children_query, 0 );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
return LDAP_OTHER;
}
- backsql_BindRowAsStrings( sth, &row );
+ backsql_BindRowAsStrings_x( sth, &row, op->o_tmpmemctx );
rc = SQLFetch( sth );
if ( BACKSQL_SUCCESS( rc ) ) {
} else {
res = LDAP_OTHER;
}
- backsql_FreeRow( &row );
+ backsql_FreeRow_x( &row, op->o_tmpmemctx );
SQLFreeStmt( sth, SQL_DROP );
int
backsql_has_children(
- backsql_info *bi,
+ Operation *op,
SQLHDBC dbh,
struct berval *dn )
{
unsigned long nchildren;
int rc;
- rc = backsql_count_children( bi, dbh, dn, &nchildren );
+ rc = backsql_count_children( op, dbh, dn, &nchildren );
if ( rc == LDAP_SUCCESS ) {
return nchildren > 0 ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
BACKSQL_ROW_NTS row;
unsigned long i,
k = 0,
- oldcount = 0;
+ oldcount = 0,
+ res = 0;
#ifdef BACKSQL_COUNTQUERY
unsigned long count,
countsize = sizeof( count ),
- j;
+ j,
+ append = 0;
Attribute *attr = NULL;
slap_mr_normalize_func *normfunc = NULL;
slap_syntax_transform_func *pretty = NULL;
#endif /* BACKSQL_PRETTY_VALIDATE */
- assert( at );
- assert( bsi );
+ assert( at != NULL );
+ assert( bsi != NULL );
#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE, "==>backsql_get_attr_vals(): "
}
} else {
- Attribute **ap;
+ append = 1;
/* Make space for the array of values */
attr = (Attribute *) ch_malloc( sizeof( Attribute ) );
} else {
attr->a_nvals = attr->a_vals;
}
-
- for ( ap = &bsi->bsi_e->e_attrs; (*ap) != NULL; ap = &(*ap)->a_next )
- /* goto last */ ;
- *ap = attr;
}
#endif /* BACKSQL_COUNTQUERY */
return 1;
}
- backsql_BindRowAsStrings( sth, &row );
+ backsql_BindRowAsStrings_x( sth, &row, bsi->bsi_op->o_tmpmemctx );
#ifdef BACKSQL_COUNTQUERY
j = oldcount;
#endif /* BACKSQL_COUNTQUERY */
"in schema (%d)\n",
bsi->bsi_e->e_name.bv_val,
row.col_names[ i ].bv_val, retval );
- return 1;
+ res = 1;
+ goto done;
}
if ( ad != at->bam_ad ) {
bsi->bsi_e->e_name.bv_val,
ad->ad_cname.bv_val,
at->bam_ad->ad_cname.bv_val );
- return 1;
+ res = 1;
+ goto done;
}
#endif /* BACKSQL_TRACE */
}
}
- backsql_FreeRow( &row );
+#ifdef BACKSQL_COUNTQUERY
+ if ( BER_BVISNULL( &attr->a_vals[ 0 ] ) ) {
+ /* don't leave around attributes with no values */
+ attr_free( attr );
+
+ } else if ( append ) {
+ Attribute **ap;
+
+ for ( ap = &bsi->bsi_e->e_attrs; (*ap) != NULL; ap = &(*ap)->a_next )
+ /* goto last */ ;
+ *ap = attr;
+ }
+#endif /* BACKSQL_COUNTQUERY */
+
SQLFreeStmt( sth, SQL_DROP );
Debug( LDAP_DEBUG_TRACE, "<==backsql_get_attr_vals()\n", 0, 0, 0 );
if ( at->bam_next ) {
- return backsql_get_attr_vals( at->bam_next, v_bsi );
+ res = backsql_get_attr_vals( at->bam_next, v_bsi );
+ } else {
+ res = 1;
}
- return 1;
+#ifdef BACKSQL_TRACE
+done:;
+#endif /* BACKSQL_TRACE */
+ backsql_FreeRow_x( &row, bsi->bsi_op->o_tmpmemctx );
+
+ return res;
}
int
Debug( LDAP_DEBUG_TRACE, "==>backsql_id2entry()\n", 0, 0, 0 );
- assert( bsi->bsi_e );
+ assert( bsi->bsi_e != NULL );
memset( bsi->bsi_e, 0, sizeof( Entry ) );
BackendDB *bd )
{
backsql_info *bi;
+ int rc = 0;
Debug( LDAP_DEBUG_TRACE, "==>backsql_db_init()\n", 0, 0, 0 );
- bi = (backsql_info *)ch_malloc( sizeof( backsql_info ) );
- memset( bi, '\0', sizeof( backsql_info ) );
+
+ bi = (backsql_info *)ch_calloc( 1, sizeof( backsql_info ) );
ldap_pvt_thread_mutex_init( &bi->sql_dbconn_mutex );
ldap_pvt_thread_mutex_init( &bi->sql_schema_mutex );
- backsql_init_db_env( bi );
+
+ if ( backsql_init_db_env( bi ) != SQL_SUCCESS ) {
+ rc = -1;
+ }
bd->be_private = bi;
+
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_init()\n", 0, 0, 0 );
- return 0;
+
+ return rc;
}
int
backsql_info *bi = (backsql_info*)bd->be_private;
Debug( LDAP_DEBUG_TRACE, "==>backsql_db_destroy()\n", 0, 0, 0 );
+
ldap_pvt_thread_mutex_lock( &bi->sql_dbconn_mutex );
backsql_free_db_env( bi );
ldap_pvt_thread_mutex_unlock( &bi->sql_dbconn_mutex );
backsql_destroy_schema_map( bi );
ldap_pvt_thread_mutex_unlock( &bi->sql_schema_mutex );
ldap_pvt_thread_mutex_destroy( &bi->sql_schema_mutex );
- free( bi->sql_dbname );
- free( bi->sql_dbuser );
+
+ if ( bi->sql_dbname ) {
+ ch_free( bi->sql_dbname );
+ }
+ if ( bi->sql_dbuser ) {
+ ch_free( bi->sql_dbuser );
+ }
if ( bi->sql_dbpasswd ) {
- free( bi->sql_dbpasswd );
+ ch_free( bi->sql_dbpasswd );
}
if ( bi->sql_dbhost ) {
- free( bi->sql_dbhost );
+ ch_free( bi->sql_dbhost );
}
if ( bi->sql_upper_func.bv_val ) {
- free( bi->sql_upper_func.bv_val );
- free( bi->sql_upper_func_open.bv_val );
- free( bi->sql_upper_func_close.bv_val );
+ ch_free( bi->sql_upper_func.bv_val );
+ ch_free( bi->sql_upper_func_open.bv_val );
+ ch_free( bi->sql_upper_func_close.bv_val );
+ }
+ if ( bi->sql_concat_func ) {
+ ber_bvarray_free( bi->sql_concat_func );
+ }
+ if ( !BER_BVISNULL( &bi->sql_strcast_func ) ) {
+ ch_free( bi->sql_strcast_func.bv_val );
+ }
+ if ( !BER_BVISNULL( &bi->sql_children_cond ) ) {
+ ch_free( bi->sql_children_cond.bv_val );
+ }
+ if ( !BER_BVISNULL( &bi->sql_subtree_cond ) ) {
+ ch_free( bi->sql_subtree_cond.bv_val );
+ }
+ if ( !BER_BVISNULL( &bi->sql_dn_oc_aliasing ) ) {
+ ch_free( bi->sql_dn_oc_aliasing.bv_val );
+ }
+ if ( bi->sql_oc_query ) {
+ ch_free( bi->sql_oc_query );
+ }
+ if ( bi->sql_at_query ) {
+ ch_free( bi->sql_at_query );
+ }
+ if ( bi->sql_id_query ) {
+ ch_free( bi->sql_id_query );
+ }
+ if ( bi->sql_has_children_query ) {
+ ch_free( bi->sql_has_children_query );
+ }
+ if ( bi->sql_insentry_stmt ) {
+ ch_free( bi->sql_insentry_stmt );
+ }
+ if ( bi->sql_delentry_stmt ) {
+ ch_free( bi->sql_delentry_stmt );
+ }
+ if ( bi->sql_renentry_stmt ) {
+ ch_free( bi->sql_renentry_stmt );
+ }
+ if ( bi->sql_delobjclasses_stmt ) {
+ ch_free( bi->sql_delobjclasses_stmt );
+ }
+ if ( !BER_BVISNULL( &bi->sql_aliasing ) ) {
+ ch_free( bi->sql_aliasing.bv_val );
+ }
+ if ( !BER_BVISNULL( &bi->sql_aliasing_quote ) ) {
+ ch_free( bi->sql_aliasing_quote.bv_val );
}
-
- free( bi->sql_subtree_cond.bv_val );
- free( bi->sql_oc_query );
- free( bi->sql_at_query );
- free( bi->sql_insentry_stmt );
- free( bi->sql_delentry_stmt );
- free( bi->sql_renentry_stmt );
- free( bi->sql_delobjclasses_stmt );
-
- free( bi->sql_aliasing.bv_val );
- free( bi->sql_aliasing_quote.bv_val );
if ( bi->sql_anlist ) {
int i;
- for ( i = 0; !BER_BVISNULL( &bi->sql_anlist[i].an_name ); i++ )
+ for ( i = 0; !BER_BVISNULL( &bi->sql_anlist[ i ].an_name ); i++ )
{
- ch_free( bi->sql_anlist[i].an_name.bv_val );
+ ch_free( bi->sql_anlist[ i ].an_name.bv_val );
}
ch_free( bi->sql_anlist );
}
entry_free( bi->sql_baseObject );
}
- free( bi );
+ ch_free( bi );
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_destroy()\n", 0, 0, 0 );
return 0;
/* normalize filter values only if necessary */
bi->sql_caseIgnoreMatch = mr_find( "caseIgnoreMatch" );
- assert( bi->sql_caseIgnoreMatch );
+ assert( bi->sql_caseIgnoreMatch != NULL );
bi->sql_telephoneNumberMatch = mr_find( "telephoneNumberMatch" );
- assert( bi->sql_telephoneNumberMatch );
+ assert( bi->sql_telephoneNumberMatch != NULL );
if ( bi->sql_dbuser == NULL ) {
Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
return 1;
}
- if ( bi->sql_subtree_cond.bv_val == NULL ) {
+ if ( BER_BVISNULL( &bi->sql_subtree_cond ) ) {
/*
* Prepare concat function for subtree search condition
*/
&concat );
}
+ ch_free( concat.bv_val );
+
bi->sql_subtree_cond = bb.bb_val;
Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
bi->sql_delobjclasses_stmt = ch_strdup( backsql_def_delobjclasses_stmt );
}
+ /* This should just be to force schema loading */
op->o_hdr = (Opheader *)&op[ 1 ];
op->o_connid = (unsigned long)(-1);
op->o_bd = bd;
return 1;
}
+ if ( backsql_free_db_conn( op ) != SQL_SUCCESS ) {
+ Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
+ "connection free failed\n", 0, 0, 0 );
+ }
+ if ( !BACKSQL_SCHEMA_LOADED( bi ) ) {
+ Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
+ "test failed, schema map not loaded - exiting\n",
+ 0, 0, 0 );
+ return 1;
+ }
+
/*
* Prepare ID selection query
*/
&bi->sql_aliasing_quote, "dn", &bi->sql_aliasing_quote );
bi->sql_dn_oc_aliasing = bb.bb_val;
- backsql_free_db_conn( op );
- if ( !BACKSQL_SCHEMA_LOADED( bi ) ) {
- Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
- "test failed, schema map not loaded - exiting\n",
- 0, 0, 0 );
- return 1;
- }
-
/* should never happen! */
assert( bd->be_nsuffix != NULL );
backsql_db_close(
BackendDB *bd )
{
+ backsql_info *bi = (backsql_info*)bd->be_private;
+
Debug( LDAP_DEBUG_TRACE, "==>backsql_db_close()\n", 0, 0, 0 );
+
+ backsql_conn_destroy( bi );
+
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_close()\n", 0, 0, 0 );
+
return 0;
}
bsi.bsi_e = &m;
rs->sr_err = backsql_init_search( &bsi, &op->o_req_ndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs,
slap_anlist_all_attributes,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
goto do_transact;
}
- rs->sr_err = entry_schema_check( op->o_bd, &m, NULL, 0,
+ rs->sr_err = entry_schema_check( op, &m, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
bsi.bsi_e = &r;
rs->sr_err = backsql_init_search( &bsi, &op->o_req_ndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs,
slap_anlist_all_attributes,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
goto done;
}
- if ( backsql_has_children( bi, dbh, &op->o_req_ndn ) == LDAP_COMPARE_TRUE ) {
+ if ( backsql_has_children( op, dbh, &op->o_req_ndn ) == LDAP_COMPARE_TRUE ) {
Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
"entry \"%s\" has children\n",
op->o_req_dn.bv_val, 0, 0 );
e_id = bsi.bsi_base_id;
rs->sr_err = backsql_init_search( &bsi, &pndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs,
slap_anlist_all_attributes,
BACKSQL_ISF_GET_ENTRY );
bsi.bsi_e = &n;
rs->sr_err = backsql_init_search( &bsi, new_npdn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs,
slap_anlist_all_attributes,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
bsi.bsi_e = &r;
rs->sr_err = backsql_init_search( &bsi, &new_ndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs,
slap_anlist_all_attributes,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
e_id = bsi.bsi_base_id;
- rs->sr_err = entry_schema_check( op->o_bd, &r, NULL, 0,
+ rs->sr_err = entry_schema_check( op, &r, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
#ifdef BACKSQL_SYNCPROV
if ( op->o_sync && op->o_tag == LDAP_REQ_SEARCH ) {
- assert( op->o_private );
+ assert( op->o_private != NULL );
entryCSN = *((struct berval *)op->o_private);
&& !got[ BACKSQL_OP_HASSUBORDINATES ]
&& attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL )
{
- rc = backsql_has_children( bi, dbh, &rs->sr_entry->e_nname );
+ rc = backsql_has_children( op, dbh, &rs->sr_entry->e_nname );
switch( rc ) {
case LDAP_COMPARE_TRUE:
case LDAP_COMPARE_FALSE:
*ap = slap_operational_hasSubordinate( rc == LDAP_COMPARE_TRUE );
- assert( *ap );
+ assert( *ap != NULL );
ap = &(*ap)->a_next;
rc = 0;
break;
rc = backsql_init_search( &bsi, &rs->sr_entry->e_nname,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL, dbh, op, rs, NULL,
BACKSQL_ISF_GET_ID );
if ( rc != LDAP_SUCCESS ) {
int matched, int muck );
/* stores in *nchildren the count of children for an entry */
-int backsql_count_children( backsql_info *bi, SQLHDBC dbh,
+int backsql_count_children( Operation *op, SQLHDBC dbh,
struct berval *dn, unsigned long *nchildren );
/* returns LDAP_COMPARE_TRUE/LDAP_COMPARE_FALSE if the entry corresponding
* to DN has/has not children */
-int backsql_has_children( backsql_info *bi, SQLHDBC dbh, struct berval *dn );
+int backsql_has_children( Operation *op, SQLHDBC dbh, struct berval *dn );
/* frees *id and returns next in list */
backsql_entryID *backsql_free_entryID( Operation *op, backsql_entryID *id,
*/
int backsql_init_search( backsql_srch_info *bsi,
- struct berval *nbase, int scope, int slimit, int tlimit,
+ struct berval *nbase, int scope,
time_t stoptime, Filter *filter, SQLHDBC dbh,
Operation *op, SlapReply *rs, AttributeName *attrs,
unsigned flags );
backsql_BindParamInt( (sth), (par_ind), (io), (id) )
#endif /* ! BACKSQL_ARBITRARY_KEY */
+RETCODE backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx );
+
RETCODE backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row );
+RETCODE backsql_FreeRow_x( BACKSQL_ROW_NTS *row, void *ctx );
+
RETCODE backsql_FreeRow( BACKSQL_ROW_NTS *row );
void backsql_PrintErrors( SQLHENV henv, SQLHDBC hdbc, SQLHSTMT sth, int rc );
+int backsql_conn_destroy( backsql_info *bi );
+
int backsql_init_db_env( backsql_info *si );
int backsql_free_db_env( backsql_info *si );
insert into authors_docs (pers_id,doc_id) values (1,2);
insert into authors_docs (pers_id,doc_id) values (2,1);
-insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9010/');
+insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9012/');
values (4,'referral');
insert into ldap_referrals (entry_id,url)
-values (4,'ldap://localhost:9010/');
+values (4,'ldap://localhost:9012/');
-- support procedures
-DROP TABLE IF EXISTS ldap_referrals;
-
DROP TABLE IF EXISTS ldap_entry_objclasses;
DROP TABLE IF EXISTS ldap_attr_mappings;
insert into authors_docs (pers_id,doc_id) values (1,2);
insert into authors_docs (pers_id,doc_id) values (2,1);
-insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9010/');
+insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9012/');
-- entry_id the "ldap_entries.id" of the entry that should be treated as a referral
-- url the URI of the referral
insert into ldap_referrals (entry_id,url)
-values (4,'ldap://localhost:9010/');
+values (4,'ldap://localhost:9012/');
-- procedures
insert into authors_docs (pers_id,doc_id) values (1,2);
insert into authors_docs (pers_id,doc_id) values (2,1);
-insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9010/');
+insert into referrals (id,name,url) values (1,'Referral','ldap://localhost:9012/');
DROP TABLE authors_docs;
DROP TABLE phones;
DROP TABLE referrals;
+DROP FUNCTION create_person ();
+DROP FUNCTION update_person_cn (varchar, int);
+DROP FUNCTION add_phone (varchar, int);
+DROP FUNCTION create_doc ();
+DROP FUNCTION create_o ();
+DROP FUNCTION create_referral ();
+
values (4,'referral');
insert into ldap_referrals (entry_id,url)
-values (4,'ldap://localhost:9010');
+values (4,'ldap://localhost:9012');
struct supad2at_t va = { 0 };
int rc;
- assert( objclass );
- assert( supad );
- assert( pret );
+ assert( objclass != NULL );
+ assert( supad != NULL );
+ assert( pret != NULL );
*pret = NULL;
ch_free( at->bam_query );
}
+#ifdef BACKSQL_COUNTQUERY
+ if ( at->bam_countquery != NULL ) {
+ ch_free( at->bam_countquery );
+ }
+#endif /* BACKSQL_COUNTQUERY */
+
/* TimesTen */
if ( !BER_BVISNULL( &at->bam_sel_expr_u ) ) {
ch_free( at->bam_sel_expr_u.bv_val );
backsql_srch_info *bsi,
struct berval *nbase,
int scope,
- int slimit,
- int tlimit,
time_t stoptime,
Filter *filter,
SQLHDBC dbh,
BER_BVZERO( &bsi->bsi_base_id.eid_dn );
BER_BVZERO( &bsi->bsi_base_id.eid_ndn );
bsi->bsi_scope = scope;
- bsi->bsi_slimit = slimit;
- bsi->bsi_tlimit = tlimit;
bsi->bsi_filter = filter;
bsi->bsi_dbh = dbh;
bsi->bsi_op = op;
int getentry = BACKSQL_IS_GET_ENTRY( flags );
int gotit = 0;
- assert( op->o_bd->be_private );
+ assert( op->o_bd->be_private != NULL );
rc = backsql_dn2id( op, rs, dbh, nbase, &bsi->bsi_base_id,
matched, 1 );
backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private;
int rc;
- assert( query );
+ assert( query != NULL );
BER_BVZERO( query );
bsi->bsi_use_subtree_shortcut = 0;
int i;
BackendDB *bd = bsi->bsi_op->o_bd;
- assert( bd->be_nsuffix );
+ assert( bd->be_nsuffix != NULL );
for ( i = 0; !BER_BVISNULL( &bd->be_nsuffix[ i ] ); i++ )
{
return BACKSQL_AVL_CONTINUE;
}
- backsql_BindRowAsStrings( sth, &row );
+ backsql_BindRowAsStrings_x( sth, &row, bsi->bsi_op->o_tmpmemctx );
rc = SQLFetch( sth );
for ( ; BACKSQL_SUCCESS( rc ); rc = SQLFetch( sth ) ) {
struct berval dn, pdn, ndn;
break;
}
}
- backsql_FreeRow( &row );
+ backsql_FreeRow_x( &row, bsi->bsi_op->o_tmpmemctx );
SQLFreeStmt( sth, SQL_DROP );
Debug( LDAP_DEBUG_TRACE, "<==backsql_oc_get_candidates(): %d\n",
bsi.bsi_e = &base_entry;
rs->sr_err = backsql_init_search( &bsi, &op->o_req_ndn,
op->ors_scope,
- op->ors_slimit, op->ors_tlimit,
stoptime, op->ors_filter,
dbh, op, rs, op->ors_attrs,
( BACKSQL_ISF_MATCHED | BACKSQL_ISF_GET_ENTRY ) );
}
break;
}
+
+ /* an entry was created; free it */
+ entry_clean( bsi.bsi_e );
+
/* fall thru */
default:
#endif /* SLAP_ACL_HONOR_DISCLOSE */
send_ldap_result( op, rs );
- goto done;
+ if ( rs->sr_ref ) {
+ ber_bvarray_free( rs->sr_ref );
+ rs->sr_ref = NULL;
+ }
+
+ goto done;
}
#ifdef SLAP_ACL_HONOR_DISCLOSE
/* NOTE: __NEW__ "search" access is required
/* check for abandon */
if ( op->o_abandon ) {
+ eid = bsi.bsi_id_list;
rs->sr_err = SLAPD_ABANDON;
goto send_results;
}
rc = backsql_init_search( &bsi2,
&e->e_nname,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL,
dbh, op, rs, NULL,
BACKSQL_ISF_GET_ENTRY );
* filter_has_subordinates()
*/
if ( bsi.bsi_flags & BSQL_SF_FILTER_HASSUBORDINATE ) {
- rc = backsql_has_children( bi, dbh, &e->e_nname );
+ rc = backsql_has_children( op, dbh, &e->e_nname );
switch ( rc ) {
case LDAP_COMPARE_TRUE:
}
next_entry2:;
- if ( op->ors_slimit != SLAP_NO_LIMIT
- && rs->sr_nentries >= op->ors_slimit )
- {
+ if ( --op->ors_slimit == -1 ) {
rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
goto send_results;
}
send_ldap_result( op, rs );
}
+ /* cleanup in case of abandon */
+ for ( ; eid != NULL;
+ eid = backsql_free_entryID( op,
+ eid, eid == &bsi.bsi_base_id ? 0 : 1 ) )
+ ;
+
backsql_entry_clean( op, &base_entry );
/* in case we got here accidentally */
rc = backsql_init_search( &bsi,
ndn,
LDAP_SCOPE_BASE,
- SLAP_NO_LIMIT, SLAP_NO_LIMIT,
(time_t)(-1), NULL,
dbh, op, &rs, at ? anlist : NULL,
BACKSQL_ISF_GET_ENTRY );
}
RETCODE
-backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row )
+backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx )
{
RETCODE rc;
SQLCHAR colname[ 64 ];
"ncols=%d\n", (int)row->ncols, 0, 0 );
#endif /* BACKSQL_TRACE */
- row->col_names = (BerVarray)ch_calloc( row->ncols + 1,
- sizeof( struct berval ) );
- row->cols = (char **)ch_calloc( row->ncols + 1,
- sizeof( char * ) );
- row->col_prec = (UDWORD *)ch_calloc( row->ncols,
- sizeof( UDWORD ) );
- row->value_len = (SQLINTEGER *)ch_calloc( row->ncols,
- sizeof( SQLINTEGER ) );
+ row->col_names = (BerVarray)ber_memcalloc_x( row->ncols + 1,
+ sizeof( struct berval ), ctx );
+ row->cols = (char **)ber_memcalloc_x( row->ncols + 1,
+ sizeof( char * ), ctx );
+ row->col_prec = (UDWORD *)ber_memcalloc_x( row->ncols,
+ sizeof( UDWORD ), ctx );
+ row->value_len = (SQLINTEGER *)ber_memcalloc_x( row->ncols,
+ sizeof( SQLINTEGER ), ctx );
for ( i = 1; i <= row->ncols; i++ ) {
rc = SQLDescribeCol( sth, (SQLSMALLINT)i, &colname[ 0 ],
(SQLUINTEGER)( sizeof( colname ) - 1 ),
&name_len, &col_type,
&col_prec, &col_scale, &col_null );
- ber_str2bv( (char *)colname, 0, 1, &row->col_names[ i - 1 ] );
+ /* FIXME: test rc? */
+
+ ber_str2bv_x( (char *)colname, 0, 1,
+ &row->col_names[ i - 1 ], ctx );
#ifdef BACKSQL_TRACE
Debug( LDAP_DEBUG_TRACE, "backsql_BindRowAsStrings: "
"col_name=%s, col_prec[%d]=%d\n",
colname, (int)i, (int)col_prec );
#endif /* BACKSQL_TRACE */
- if ( col_type == SQL_LONGVARCHAR
- || col_type == SQL_LONGVARBINARY) {
-#if 0
- row->cols[ i - 1 ] = NULL;
- row->col_prec[ i - 1 ] = -1;
-
- /*
- * such fields must be handled
- * in some other way since they return 2G
- * as their precision (at least it does so
- * with MS SQL Server w/native driver)
- * for now, we just set fixed precision
- * for such fields - dirty hack, but...
- * no time to deal with SQLGetData()
- */
-#endif
+ if ( col_type != SQL_CHAR && col_type != SQL_VARCHAR )
+ {
col_prec = MAX_ATTR_LEN;
- row->cols[ i - 1 ] = (char *)ch_calloc( col_prec + 1, sizeof( char ) );
- row->col_prec[ i - 1 ] = col_prec;
- rc = SQLBindCol( sth, (SQLUSMALLINT)i,
- SQL_C_CHAR,
- (SQLPOINTER)row->cols[ i - 1 ],
- col_prec + 1,
- &row->value_len[ i - 1 ] );
- } else {
- row->cols[ i - 1 ] = (char *)ch_calloc( col_prec + 1, sizeof( char ) );
- row->col_prec[ i - 1 ] = col_prec;
- rc = SQLBindCol( sth, (SQLUSMALLINT)i,
- SQL_C_CHAR,
- (SQLPOINTER)row->cols[ i - 1 ],
- col_prec + 1,
- &row->value_len[ i - 1 ] );
}
+
+ row->cols[ i - 1 ] = (char *)ber_memcalloc_x( col_prec + 1,
+ sizeof( char ), ctx );
+ row->col_prec[ i - 1 ] = col_prec;
+ rc = SQLBindCol( sth, (SQLUSMALLINT)i,
+ SQL_C_CHAR,
+ (SQLPOINTER)row->cols[ i - 1 ],
+ col_prec + 1,
+ &row->value_len[ i - 1 ] );
+ /* FIXME: test rc? */
}
- row->col_names[ i - 1 ].bv_val = NULL;
- row->col_names[ i - 1 ].bv_len = 0;
+ BER_BVZERO( &row->col_names[ i - 1 ] );
row->cols[ i - 1 ] = NULL;
}
}
RETCODE
-backsql_FreeRow( BACKSQL_ROW_NTS *row )
+backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row )
+{
+ return backsql_BindRowAsStrings_x( sth, row, NULL );
+}
+
+RETCODE
+backsql_FreeRow_x( BACKSQL_ROW_NTS *row, void *ctx )
{
if ( row->cols == NULL ) {
return SQL_ERROR;
}
- ber_bvarray_free( row->col_names );
- ldap_charray_free( row->cols );
- free( row->col_prec );
- free( row->value_len );
+ ber_bvarray_free_x( row->col_names, ctx );
+ ber_memvfree_x( (void **)row->cols, ctx );
+ ber_memfree_x( row->col_prec, ctx );
+ ber_memfree_x( row->value_len, ctx );
return SQL_SUCCESS;
}
+
+RETCODE
+backsql_FreeRow( BACKSQL_ROW_NTS *row )
+{
+ return backsql_FreeRow_x( row, NULL );
+}
+
static int
backsql_cmp_connid( const void *v_c1, const void *v_c2 )
{
return 0;
}
-static int
-backsql_close_db_conn( backsql_db_conn *conn )
+static void
+backsql_close_db_conn( void *v_conn )
{
- Debug( LDAP_DEBUG_TRACE, "==>backsql_close_db_conn()\n", 0, 0, 0 );
+ backsql_db_conn *conn = (backsql_db_conn *)v_conn;
+
+ Debug( LDAP_DEBUG_TRACE, "==>backsql_close_db_conn(%lu)\n",
+ conn->ldap_cid, 0, 0 );
/*
* Default transact is SQL_ROLLBACK; commit is required only
SQLTransact( SQL_NULL_HENV, conn->dbh, SQL_ROLLBACK );
SQLDisconnect( conn->dbh );
SQLFreeConnect( conn->dbh );
- Debug( LDAP_DEBUG_TRACE, "<==backsql_close_db_conn()\n", 0, 0, 0 );
- return 1;
+ ch_free( conn );
+
+ Debug( LDAP_DEBUG_TRACE, "<==backsql_close_db_conn(%lu)\n",
+ conn->ldap_cid, 0, 0 );
+}
+
+int
+backsql_conn_destroy(
+ backsql_info *bi )
+{
+ avl_free( bi->sql_db_conns, backsql_close_db_conn );
+
+ return 0;
}
int
int ret = SQL_SUCCESS;
Debug( LDAP_DEBUG_TRACE, "==>backsql_init_db_env()\n", 0, 0, 0 );
+
rc = SQLAllocEnv( &bi->sql_db_env );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "init_db_env: SQLAllocEnv failed:\n",
SQL_NULL_HENV, rc );
ret = SQL_ERROR;
}
+
Debug( LDAP_DEBUG_TRACE, "<==backsql_init_db_env()=%d\n", ret, 0, 0 );
+
return ret;
}
{
Debug( LDAP_DEBUG_TRACE, "==>backsql_free_db_env()\n", 0, 0, 0 );
-#ifdef BACKSQL_TRACE
- Debug( LDAP_DEBUG_TRACE, "free_db_env(): delete AVL tree here!!!\n",
- 0, 0, 0 );
-#endif /* BACKSQL_TRACE */
+ (void)SQLFreeEnv( bi->sql_db_env );
+ bi->sql_db_env = SQL_NULL_HENV;
/*
* stop, if frontend waits for all threads to shutdown
* everything is already deleted...
*/
Debug( LDAP_DEBUG_TRACE, "<==backsql_free_db_env()\n", 0, 0, 0 );
+
return SQL_SUCCESS;
}
backsql_db_conn *dbc;
int rc;
- assert( pdbc );
+ assert( pdbc != NULL );
*pdbc = NULL;
- Debug( LDAP_DEBUG_TRACE, "==>backsql_open_db_conn()\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "==>backsql_open_db_conn(%lu)\n",
+ ldap_cid, 0, 0 );
+
dbc = (backsql_db_conn *)ch_calloc( 1, sizeof( backsql_db_conn ) );
dbc->ldap_cid = ldap_cid;
rc = SQLAllocConnect( bi->sql_db_env, &dbc->dbh );
if ( !BACKSQL_SUCCESS( rc ) ) {
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
- "SQLAllocConnect() failed:\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "SQLAllocConnect() failed:\n", ldap_cid, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, SQL_NULL_HDBC,
SQL_NULL_HENV, rc );
return LDAP_UNAVAILABLE;
(SQLCHAR*)bi->sql_dbuser, SQL_NTS,
(SQLCHAR*)bi->sql_dbpasswd, SQL_NTS );
if ( rc != SQL_SUCCESS ) {
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
- "SQLConnect() to database \"%s\" as user \"%s\" "
- "%s:\n", bi->sql_dbname, bi->sql_dbuser,
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "SQLConnect() to database \"%s\" %s.\n",
+ ldap_cid, bi->sql_dbname,
rc == SQL_SUCCESS_WITH_INFO ?
"succeeded with info" : "failed" );
backsql_PrintErrors( bi->sql_db_env, dbc->dbh, SQL_NULL_HENV, rc );
if ( rc == SQL_SUCCESS ) {
if ( strcmp( DBMSName, "TimesTen" ) == 0 ||
strcmp( DBMSName, "Front-Tier" ) == 0 ) {
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
- "TimesTen database!\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "TimesTen database!\n", ldap_cid, 0, 0 );
bi->sql_flags |= BSQLF_USE_REVERSE_DN;
}
} else {
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
- "SQLGetInfo() failed:\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "SQLGetInfo() failed.\n", ldap_cid, 0, 0 );
backsql_PrintErrors( bi->sql_db_env, dbc->dbh, SQL_NULL_HENV, rc );
return rc;
}
/* end TimesTen */
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(): "
- "connected, adding to tree\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "connected, adding to tree.\n", ldap_cid, 0, 0 );
ldap_pvt_thread_mutex_lock( &bi->sql_dbconn_mutex );
if ( avl_insert( &bi->sql_db_conns, dbc, backsql_cmp_connid, avl_dup_error ) ) {
- Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
- "duplicate connection ID\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(%lu): "
+ "duplicate connection ID.\n", ldap_cid, 0, 0 );
return LDAP_OTHER;
}
ldap_pvt_thread_mutex_unlock( &bi->sql_dbconn_mutex );
- Debug( LDAP_DEBUG_TRACE, "<==backsql_open_db_conn()\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "<==backsql_open_db_conn(%lu)\n", ldap_cid, 0, 0 );
*pdbc = dbc;
*/
if ( conn != NULL ) {
Debug( LDAP_DEBUG_TRACE, "backsql_free_db_conn(): "
- "closing db connection\n", 0, 0, 0 );
- backsql_close_db_conn( conn );
+ "closing db connection %lu (%p)\n",
+ op->o_connid, conn, 0 );
+ backsql_close_db_conn( (void *)conn );
}
+
Debug( LDAP_DEBUG_TRACE, "<==backsql_free_db_conn()\n", 0, 0, 0 );
- return SQL_SUCCESS;
+
+ return conn ? SQL_SUCCESS : SQL_ERROR;
}
int
Debug( LDAP_DEBUG_TRACE, "==>backsql_get_db_conn()\n", 0, 0, 0 );
- assert( dbh );
+ assert( dbh != NULL );
*dbh = SQL_NULL_HDBC;
tmp.ldap_cid = op->o_connid;
ber_len_t cdlen, cslen, grow;
char *cstr;
- assert( dest );
+ assert( dest != NULL );
assert( dest->bb_val.bv_val == NULL
|| dest->bb_val.bv_len == strlen( dest->bb_val.bv_val ) );
va_list strs;
ber_len_t cdlen;
- assert( dest );
- assert( fmt );
+ assert( dest != NULL );
+ assert( fmt != NULL );
assert( dest->bb_len == 0 || dest->bb_len > dest->bb_val.bv_len );
assert( dest->bb_val.bv_val == NULL
|| dest->bb_val.bv_len == strlen( dest->bb_val.bv_val ) );
#endif /* BACKSQL_TRACE */
}
- assert( cstr );
+ assert( cstr != NULL );
AC_MEMCPY( dest->bb_val.bv_val + cdlen, cstr, cslen + 1 );
cdlen += cslen;
char *s, *q;
struct berbuf res = BB_NULL;
- assert( p );
- assert( *p );
+ assert( p != NULL );
+ assert( *p != NULL );
s = *p;
while ( **p && **p != ',' ) {
#define SPLIT_CHAR '?'
- assert( _pattern );
- assert( split_pattern );
+ assert( _pattern != NULL );
+ assert( split_pattern != NULL );
pattern = ch_strdup( _pattern );
int i;
struct berbuf bb = BB_NULL;
- assert( res );
+ assert( res != NULL );
for ( i = 0; values[i].bv_val; i++ ) {
if ( split_pattern[i].bv_val == NULL ) {
/* entryUUID is generated as "%08x-%04x-%04x-0000-eaddrXXX"
* with eid_oc_id as %08x and hi and lo eid_id as %04x-%04x */
- assert( bi );
- assert( id );
- assert( entryUUID );
+ assert( bi != NULL );
+ assert( id != NULL );
+ assert( entryUUID != NULL );
#ifdef BACKSQL_ARBITRARY_KEY
snprintf( uuidbuf, sizeof( uuidbuf ),
#include "lutil.h"
#include "lber_pvt.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-
-static void init_group_pblock( Operation *op, Entry *target,
- Entry *e, struct berval *op_ndn, AttributeDescription *group_at );
-static int call_group_preop_plugins( Operation *op );
-static void call_group_postop_plugins( Operation *op );
-#endif /* LDAP_SLAPI */
-
/*
* If a module is configured as dynamic, its header should not
* get included into slapd. While this is a general rule and does
}
for( bi=slap_binfo; bi->bi_type != NULL; bi++,nBackendInfo++ ) {
- assert( bi->bi_init );
+ assert( bi->bi_init != 0 );
rc = bi->bi_init( bi );
{
int rc = 0;
- assert( be );
+ assert( be != NULL );
be->be_pending_csn_list = (struct be_pcl *)
ch_calloc( 1, sizeof( struct be_pcl ));
int backend_shutdown( Backend *be )
{
- int i;
int rc = 0;
BackendInfo *bi;
return 0;
}
-void backend_destroy_one( BackendDB *bd )
+void backend_destroy_one( BackendDB *bd, int dynamic )
{
- LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
+ if ( dynamic ) {
+ LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
+ }
if ( bd->be_syncinfo ) {
syncinfo_free( bd->be_syncinfo );
csne = LDAP_TAILQ_NEXT( csne, ce_csn_link );
ch_free( tmp_csne );
}
+ ch_free( bd->be_pending_csn_list );
}
if ( bd->bd_info->bi_db_destroy ) {
free( bd->be_rootpw.bv_val );
}
acl_destroy( bd->be_acl, frontendDB->be_acl );
- free( bd );
+ limits_destroy( bd->be_limits );
+ if ( bd->be_replogfile ) {
+ ch_free( bd->be_replogfile );
+ }
+ destroy_replica_info( bd );
+ if ( !BER_BVISNULL( &bd->be_update_ndn ) ) {
+ ch_free( bd->be_update_ndn.bv_val );
+ }
+ if ( bd->be_update_refs ) {
+ ber_bvarray_free( bd->be_update_refs );
+ }
+
+ if ( dynamic ) {
+ free( bd );
+ }
}
int backend_destroy(void)
{
- int i;
BackendDB *bd;
BackendInfo *bi;
/* destroy each backend database */
while (( bd = LDAP_STAILQ_FIRST(&backendDB))) {
- backend_destroy_one( bd );
+ backend_destroy_one( bd, 1 );
}
/* destroy each backend type */
free( bd->be_rootpw.bv_val );
}
acl_destroy( bd->be_acl, frontendDB->be_acl );
+
+ assert( bd->be_replogfile == NULL );
+ assert( bd->be_replica == NULL );
}
return 0;
be_db_close( void )
{
BackendDB *be;
- int i;
LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
if ( be->bd_info->bi_db_close ) {
int manageDSAit,
int noSubs )
{
- int i, j;
+ int j;
ber_len_t len, dnlen = dn->bv_len;
Backend *be, *b2 = NULL;
int
backend_unbind( Operation *op, SlapReply *rs )
{
- int i = 0;
BackendDB *be;
LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
-#if defined( LDAP_SLAPI )
- if ( op->o_pb ) {
- int rc;
- if ( i == 0 ) slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_BACKEND, (void *)be );
- rc = slapi_int_call_plugins( be,
- SLAPI_PLUGIN_PRE_UNBIND_FN, (Slapi_PBlock *)op->o_pb );
- if ( rc < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE,
- "do_bind: Unbind preoperation plugin failed\n",
- 0, 0, 0);
- return 0;
- }
- }
-#endif /* defined( LDAP_SLAPI ) */
-
if ( be->be_unbind ) {
op->o_bd = be;
be->be_unbind( op, rs );
}
-
-#if defined( LDAP_SLAPI )
- if ( op->o_pb != NULL && slapi_int_call_plugins( be,
- SLAPI_PLUGIN_POST_UNBIND_FN, (Slapi_PBlock *)op->o_pb ) < 0 )
- {
- Debug(LDAP_DEBUG_TRACE,
- "do_unbind: Unbind postoperation plugins failed\n",
- 0, 0, 0);
- }
-#endif /* defined( LDAP_SLAPI ) */
- i++;
}
return 0;
}
int
-backend_group(
+fe_acl_group(
Operation *op,
Entry *target,
struct berval *gr_ndn,
GroupAssertion *g;
Backend *be = op->o_bd;
- if ( op->o_abandon ) return SLAPD_ABANDON;
-
op->o_bd = select_backend( gr_ndn, 0, 0 );
for ( g = op->o_groups; g; g = g->ga_next ) {
rc = be_entry_get_rw( op, gr_ndn, group_oc, group_at, 0, &e );
}
if ( e ) {
-#ifdef LDAP_SLAPI
- if ( op->o_pb != NULL ) {
- init_group_pblock( op, target, e, op_ndn, group_at );
-
- rc = call_group_preop_plugins( op );
- if ( rc == LDAP_SUCCESS ) {
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
-
a = attr_find( e->e_attrs, group_at );
if ( a ) {
/* If the attribute is a subtype of labeledURI, treat this as
rc = LDAP_NO_SUCH_OBJECT;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_group_postop_plugins( op );
-#endif /* LDAP_SLAPI */
-
if ( op->o_tag != LDAP_REQ_BIND && !op->o_do_not_cache ) {
g = op->o_tmpalloc( sizeof( GroupAssertion ) + gr_ndn->bv_len,
op->o_tmpmemctx );
return rc;
}
-#ifdef LDAP_SLAPI
-static int backend_compute_output_attr(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
+int
+backend_group(
+ Operation *op,
+ Entry *target,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription *group_at )
{
- BerVarray v;
- int rc;
- BerVarray *vals = (BerVarray *)c->cac_private;
- Operation *op = NULL;
- int i, j;
-
- slapi_pblock_get( c->cac_pb, SLAPI_OPERATION, &op );
- if ( op == NULL ) {
- return 1;
- }
+ int rc;
+ BackendDB *be_orig;
- if ( op->o_conn && access_allowed( op,
- e, a->a_desc, NULL, ACL_AUTH,
- &c->cac_acl_state ) == 0 ) {
- return 1;
+ if ( op->o_abandon ) {
+ return SLAPD_ABANDON;
}
- for ( i = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ ) ;
-
- v = op->o_tmpalloc( sizeof(struct berval) * (i+1),
- op->o_tmpmemctx );
- for ( i = 0, j = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ ) {
- if ( op->o_conn && access_allowed( op,
- e, a->a_desc,
- &a->a_nvals[i],
- ACL_AUTH, &c->cac_acl_state ) == 0 ) {
- continue;
- }
- ber_dupbv_x( &v[j],
- &a->a_nvals[i], op->o_tmpmemctx );
- if ( !BER_BVISNULL( &v[j] ) ) {
- j++;
- }
- }
-
- if ( j == 0 ) {
- op->o_tmpfree( v, op->o_tmpmemctx );
- *vals = NULL;
- rc = 1;
- } else {
- BER_BVZERO( &v[j] );
- *vals = v;
- rc = 0;
- }
+ be_orig = op->o_bd;
+ op->o_bd = frontendDB;
+ rc = frontendDB->be_group( op, target, gr_ndn,
+ op_ndn, group_oc, group_at );
+ op->o_bd = be_orig;
return rc;
}
-#endif /* LDAP_SLAPI */
int
-backend_attribute(
+fe_acl_attribute(
Operation *op,
Entry *target,
struct berval *edn,
rc = LDAP_SUCCESS;
}
}
-#ifdef LDAP_SLAPI
- else if ( op->o_pb ) {
- /* try any computed attributes */
- computed_attr_context ctx;
-
- slapi_int_pblock_set_operation( op->o_pb, op );
-
- ctx.cac_pb = op->o_pb;
- ctx.cac_attrs = NULL;
- ctx.cac_userattrs = 0;
- ctx.cac_opattrs = 0;
- ctx.cac_acl_state = acl_state;
- ctx.cac_private = (void *)vals;
-
- rc = compute_evaluator( &ctx, entry_at->ad_cname.bv_val, e, backend_compute_output_attr );
- if ( rc == 1 ) {
- rc = LDAP_INSUFFICIENT_ACCESS;
-
- } else {
- rc = LDAP_SUCCESS;
- }
- }
-#endif /* LDAP_SLAPI */
freeit: if ( e != target ) {
be_entry_release_r( op, e );
}
return rc;
}
-#ifdef LDAP_SLAPI
-static int backend_compute_output_attr_access(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
+int
+backend_attribute(
+ Operation *op,
+ Entry *target,
+ struct berval *edn,
+ AttributeDescription *entry_at,
+ BerVarray *vals,
+ slap_access_t access )
{
- struct berval *nval = (struct berval *)c->cac_private;
- Operation *op = NULL;
+ int rc;
+ BackendDB *be_orig;
- slapi_pblock_get( c->cac_pb, SLAPI_OPERATION, &op );
- if ( op == NULL ) {
- return 1;
- }
+ be_orig = op->o_bd;
+ op->o_bd = frontendDB;
+ rc = frontendDB->be_attribute( op, target, edn,
+ entry_at, vals, access );
+ op->o_bd = be_orig;
- return access_allowed( op, e, a->a_desc, nval, ACL_AUTH, NULL ) == 0;
+ return rc;
}
-#endif /* LDAP_SLAPI */
int
backend_access(
Backend *be = op->o_bd;
/* pedantic */
- assert( op );
- assert( op->o_conn );
- assert( edn );
+ assert( op != NULL );
+ assert( op->o_conn != NULL );
+ assert( edn != NULL );
assert( access > ACL_NONE );
op->o_bd = select_backend( edn, 0, 0 );
}
rc = LDAP_SUCCESS;
}
-#ifdef LDAP_SLAPI
- else if ( op->o_pb ) {
- /* try any computed attributes */
- computed_attr_context ctx;
-
- slapi_int_pblock_set_operation( op->o_pb, op );
-
- ctx.cac_pb = op->o_pb;
- ctx.cac_attrs = NULL;
- ctx.cac_userattrs = 0;
- ctx.cac_opattrs = 0;
- ctx.cac_private = (void *)nval;
-
- rc = compute_evaluator( &ctx, entry_at->ad_cname.bv_val, e, backend_compute_output_attr_access );
- if ( rc == 1 ) {
- rc = LDAP_INSUFFICIENT_ACCESS;
-
- } else {
- rc = LDAP_SUCCESS;
- }
- }
-#endif /* LDAP_SLAPI */
}
freeit: if ( e != target ) {
be_entry_release_r( op, e );
return rc;
}
-int backend_operational(
+int
+fe_aux_operational(
Operation *op,
SlapReply *rs )
{
- Attribute **ap;
- int rc = 0;
- BackendDB *be_orig;
+ Attribute **ap;
+ int rc = 0;
+ BackendDB *be_orig;
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count them */ ;
ap = &(*ap)->a_next;
}
- /* Let the overlays have a chance at this */
- be_orig = op->o_bd;
- if ( SLAP_ISOVERLAY( be_orig ) )
- op->o_bd = select_backend( be_orig->be_nsuffix, 0, 0 );
-
- if ( ( SLAP_OPATTRS( rs->sr_attr_flags ) || rs->sr_attrs ) &&
- op->o_bd && op->o_bd->be_operational != NULL )
+ if ( op->o_bd != NULL )
{
- rc = op->o_bd->be_operational( op, rs );
+ /* Let the overlays have a chance at this */
+ be_orig = op->o_bd;
+ op->o_bd = select_backend( &op->o_req_ndn, 0, 0 );
+ if ( op->o_bd != frontendDB &&
+ ( SLAP_OPATTRS( rs->sr_attr_flags ) || rs->sr_attrs ) &&
+ op->o_bd != NULL && op->o_bd->be_operational != NULL )
+ {
+ rc = op->o_bd->be_operational( op, rs );
+ }
+ op->o_bd = be_orig;
}
- op->o_bd = be_orig;
return rc;
}
-#ifdef LDAP_SLAPI
-static void init_group_pblock( Operation *op, Entry *target,
- Entry *e, struct berval *op_ndn, AttributeDescription *group_at )
-{
- slapi_int_pblock_set_operation( op->o_pb, op );
-
- slapi_pblock_set( op->o_pb,
- SLAPI_X_GROUP_ENTRY, (void *)e );
- slapi_pblock_set( op->o_pb,
- SLAPI_X_GROUP_OPERATION_DN, (void *)op_ndn->bv_val );
- slapi_pblock_set( op->o_pb,
- SLAPI_X_GROUP_ATTRIBUTE, (void *)group_at->ad_cname.bv_val );
- slapi_pblock_set( op->o_pb,
- SLAPI_X_GROUP_TARGET_ENTRY, (void *)target );
-}
-
-static int call_group_preop_plugins( Operation *op )
+int backend_operational( Operation *op, SlapReply *rs )
{
int rc;
+ BackendDB *be_orig;
- rc = slapi_int_call_plugins( op->o_bd,
- SLAPI_X_PLUGIN_PRE_GROUP_FN, op->o_pb );
- if ( rc < 0 ) {
- if (( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE,
- (void *)&rc ) != 0 ) || rc == LDAP_SUCCESS )
- {
- rc = LDAP_NO_SUCH_ATTRIBUTE;
- }
- } else {
- rc = LDAP_SUCCESS;
- }
+ /* Moved this into the frontend so global overlays are called */
- return rc;
-}
+ be_orig = op->o_bd;
+ op->o_bd = frontendDB;
+ rc = frontendDB->be_operational( op, rs );
+ op->o_bd = be_orig;
-static void call_group_postop_plugins( Operation *op )
-{
- (void) slapi_int_call_plugins( op->o_bd, SLAPI_X_PLUGIN_POST_GROUP_FN, op->o_pb );
+ return rc;
}
-#endif /* LDAP_SLAPI */
static slap_overinst *overlays;
-enum db_which { db_open = 0, db_close, db_destroy };
+enum db_which {
+ db_open = 0,
+ db_close,
+ db_destroy,
+ db_last
+};
static int
over_db_func(
BackendInfo *bi_orig = be->bd_info;
struct ConfigOCs *be_cf_ocs = be->be_cf_ocs;
ConfigArgs ca = {0};
- ConfigTable *ct;
int rc = 0;
if ( oi->oi_orig->bi_db_config ) {
return rc;
}
-#endif /* SLAP_OVERLAY_ACCESS */
-enum op_which {
- op_bind = 0,
- op_unbind,
- op_search,
- op_compare,
- op_modify,
- op_modrdn,
- op_add,
- op_delete,
- op_abandon,
- op_cancel,
- op_extended,
- op_aux_operational,
- op_aux_chk_referrals,
- op_aux_chk_controls,
- op_last
-};
+static int
+over_acl_group(
+ Operation *op,
+ Entry *e,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription *group_at )
+{
+ slap_overinfo *oi;
+ slap_overinst *on;
+ BackendInfo *bi = op->o_bd->bd_info;
+ BackendDB *be = op->o_bd, db;
+ int rc = SLAP_CB_CONTINUE;
+
+ /* FIXME: used to happen for instance during abandon
+ * when global overlays are used... */
+ assert( op->o_bd != NULL );
+
+ oi = op->o_bd->bd_info->bi_private;
+ on = oi->oi_list;
+
+ for ( ; on; on = on->on_next ) {
+ if ( on->on_bi.bi_acl_group ) {
+ /* NOTE: do not copy the structure until required */
+ if ( !SLAP_ISOVERLAY( op->o_bd ) ) {
+ db = *op->o_bd;
+ db.be_flags |= SLAP_DBFLAG_OVERLAY;
+ op->o_bd = &db;
+ }
+
+ op->o_bd->bd_info = (BackendInfo *)on;
+ rc = on->on_bi.bi_acl_group( op, e,
+ gr_ndn, op_ndn, group_oc, group_at );
+ if ( rc != SLAP_CB_CONTINUE ) break;
+ }
+ }
+
+ if ( rc == SLAP_CB_CONTINUE ) {
+ BI_acl_group *bi_acl_group;
+
+ /* if the database structure was changed, o_bd points to a
+ * copy of the structure; put the original bd_info in place */
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = oi->oi_orig;
+ }
+
+ if ( oi->oi_orig->bi_acl_group ) {
+ bi_acl_group = oi->oi_orig->bi_acl_group;
+ } else {
+ bi_acl_group = backend_group;
+ }
+
+ rc = bi_acl_group( op, e,
+ gr_ndn, op_ndn, group_oc, group_at );
+ }
+ /* should not fall thru this far without anything happening... */
+ if ( rc == SLAP_CB_CONTINUE ) {
+ /* access not allowed */
+ rc = 0;
+ }
+
+ op->o_bd = be;
+ op->o_bd->bd_info = bi;
+
+ return rc;
+}
+
+static int
+over_acl_attribute(
+ Operation *op,
+ Entry *target,
+ struct berval *entry_ndn,
+ AttributeDescription *entry_at,
+ BerVarray *vals,
+ slap_access_t access )
+{
+ slap_overinfo *oi;
+ slap_overinst *on;
+ BackendInfo *bi = op->o_bd->bd_info;
+ BackendDB *be = op->o_bd, db;
+ int rc = SLAP_CB_CONTINUE;
+
+ /* FIXME: used to happen for instance during abandon
+ * when global overlays are used... */
+ assert( op->o_bd != NULL );
+
+ oi = op->o_bd->bd_info->bi_private;
+ on = oi->oi_list;
+
+ for ( ; on; on = on->on_next ) {
+ if ( on->on_bi.bi_acl_attribute ) {
+ /* NOTE: do not copy the structure until required */
+ if ( !SLAP_ISOVERLAY( op->o_bd ) ) {
+ db = *op->o_bd;
+ db.be_flags |= SLAP_DBFLAG_OVERLAY;
+ op->o_bd = &db;
+ }
+
+ op->o_bd->bd_info = (BackendInfo *)on;
+ rc = on->on_bi.bi_acl_attribute( op, target,
+ entry_ndn, entry_at, vals, access );
+ if ( rc != SLAP_CB_CONTINUE ) break;
+ }
+ }
+
+ if ( rc == SLAP_CB_CONTINUE ) {
+ BI_acl_attribute *bi_acl_attribute;
+
+ /* if the database structure was changed, o_bd points to a
+ * copy of the structure; put the original bd_info in place */
+ if ( SLAP_ISOVERLAY( op->o_bd ) ) {
+ op->o_bd->bd_info = oi->oi_orig;
+ }
+
+ if ( oi->oi_orig->bi_acl_attribute ) {
+ bi_acl_attribute = oi->oi_orig->bi_acl_attribute;
+ } else {
+ bi_acl_attribute = backend_attribute;
+ }
+
+ rc = bi_acl_attribute( op, target,
+ entry_ndn, entry_at, vals, access );
+ }
+ /* should not fall thru this far without anything happening... */
+ if ( rc == SLAP_CB_CONTINUE ) {
+ /* access not allowed */
+ rc = 0;
+ }
+
+ op->o_bd = be;
+ op->o_bd->bd_info = bi;
+
+ return rc;
+}
+#endif /* SLAP_OVERLAY_ACCESS */
/*
* default return code in case of missing backend function
* and overlay stack returning SLAP_CB_CONTINUE
*/
-static int op_rc[] = {
+static int op_rc[ op_last ] = {
LDAP_UNWILLING_TO_PERFORM, /* bind */
LDAP_UNWILLING_TO_PERFORM, /* unbind */
LDAP_UNWILLING_TO_PERFORM, /* search */
SLAP_CB_CONTINUE /* aux_chk_controls; pass to frontend */
};
-static int
-over_op_func(
+int overlay_op_walk(
Operation *op,
SlapReply *rs,
- enum op_which which
+ slap_operation_t which,
+ slap_overinfo *oi,
+ slap_overinst *on
)
{
- slap_overinfo *oi;
- slap_overinst *on;
BI_op_bind **func;
- BackendDB *be = op->o_bd, db;
- slap_callback cb = {NULL, over_back_response, NULL, NULL};
int rc = SLAP_CB_CONTINUE;
- /* FIXME: used to happen for instance during abandon
- * when global overlays are used... */
- assert( op->o_bd != NULL );
-
- oi = op->o_bd->bd_info->bi_private;
- on = oi->oi_list;
-
- if ( !SLAP_ISOVERLAY( op->o_bd )) {
- db = *op->o_bd;
- db.be_flags |= SLAP_DBFLAG_OVERLAY;
- op->o_bd = &db;
- }
- cb.sc_next = op->o_callback;
- cb.sc_private = oi;
- op->o_callback = &cb;
-
for (; on; on=on->on_next ) {
func = &on->on_bi.bi_op_bind;
if ( func[which] ) {
*/
if ( rc == LDAP_UNWILLING_TO_PERFORM ) {
slap_callback *sc_next;
- for ( ; op->o_callback && op->o_callback != cb.sc_next;
- op->o_callback = sc_next ) {
+ for ( ; op->o_callback && op->o_callback->sc_response !=
+ over_back_response; op->o_callback = sc_next ) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_cleanup ) {
op->o_callback->sc_cleanup( op, rs );
}
}
}
+ return rc;
+}
+
+static int
+over_op_func(
+ Operation *op,
+ SlapReply *rs,
+ slap_operation_t which
+)
+{
+ slap_overinfo *oi;
+ slap_overinst *on;
+ BackendDB *be = op->o_bd, db;
+ slap_callback cb = {NULL, over_back_response, NULL, NULL};
+ int rc = SLAP_CB_CONTINUE;
+
+ /* FIXME: used to happen for instance during abandon
+ * when global overlays are used... */
+ assert( op->o_bd != NULL );
+
+ oi = op->o_bd->bd_info->bi_private;
+ on = oi->oi_list;
+
+ if ( !SLAP_ISOVERLAY( op->o_bd )) {
+ db = *op->o_bd;
+ db.be_flags |= SLAP_DBFLAG_OVERLAY;
+ op->o_bd = &db;
+ }
+ cb.sc_next = op->o_callback;
+ cb.sc_private = oi;
+ op->o_callback = &cb;
+
+ rc = overlay_op_walk( op, rs, which, oi, on );
+
op->o_bd = be;
op->o_callback = cb.sc_next;
return rc;
enum conn_which {
conn_init = 0,
- conn_destroy
+ conn_destroy,
+ conn_last
};
static int
{
slap_overinst *on = overlays;
- assert( over_type );
+ assert( over_type != NULL );
for ( ; on; on = on->on_next ) {
if ( strcmp( on->on_bi.bi_type, over_type ) == 0 ) {
{
slap_overinst *on;
- assert( be );
+ assert( be != NULL );
if ( !overlay_is_over( be ) ) {
return 0;
bi->bi_chk_controls = over_aux_chk_controls;
#ifdef SLAP_OVERLAY_ACCESS
- /* this has a specific arglist */
+ /* these have specific arglists */
bi->bi_access_allowed = over_access_allowed;
+ bi->bi_acl_group = over_acl_group;
+ bi->bi_acl_attribute = over_acl_attribute;
#endif /* SLAP_OVERLAY_ACCESS */
bi->bi_connection_init = over_connection_init;
#include "slapi/slapi.h"
#endif
+#include <ldif.h>
#include <lutil.h>
#include "config.h"
static char *passwd_salt;
static char *logfileName;
+#ifdef SLAP_AUTH_REWRITE
static BerVarray authz_rewrites;
+#endif
static struct berval cfdir;
static AttributeDescription *cfAd_backend, *cfAd_database, *cfAd_overlay,
*cfAd_include;
-static ConfigFile cf_prv, *cfn = &cf_prv;
+static ConfigFile *cfn;
static Avlnode *CfOcTree;
static ConfigDriver config_timelimit;
static ConfigDriver config_overlay;
static ConfigDriver config_suffix;
-static ConfigDriver config_deref_depth;
static ConfigDriver config_rootdn;
static ConfigDriver config_rootpw;
static ConfigDriver config_restrict;
static ConfigLDAPadd cfAddSchema, cfAddInclude, cfAddDatabase,
cfAddBackend, cfAddModule, cfAddOverlay;
+/* NOTE: be careful when defining array members
+ * that can be conditionally compiled */
#define CFOC_GLOBAL cf_ocs[1]
#define CFOC_SCHEMA cf_ocs[2]
#define CFOC_BACKEND cf_ocs[3]
#define CFOC_DATABASE cf_ocs[4]
#define CFOC_OVERLAY cf_ocs[5]
#define CFOC_INCLUDE cf_ocs[6]
-#define CFOC_MODULE cf_ocs[7]
+#define CFOC_FRONTEND cf_ocs[7]
+#ifdef SLAPD_MODULES
+#define CFOC_MODULE cf_ocs[8]
+#endif /* SLAPD_MODULES */
static ConfigOCs cf_ocs[] = {
- { "( OLcfgGlOc:1 "
+ { "( OLcfgGlOc:0 "
"NAME 'olcConfig' "
"DESC 'OpenLDAP configuration object' "
"ABSTRACT SUP top )", Cft_Abstract, NULL },
- { "( OLcfgGlOc:2 "
+ { "( OLcfgGlOc:1 "
"NAME 'olcGlobal' "
"DESC 'OpenLDAP Global configuration options' "
"SUP olcConfig STRUCTURAL "
"olcPluginLogFile $ olcReadOnly $ olcReferral $ "
"olcReplicaPidFile $ olcReplicaArgsFile $ olcReplicationInterval $ "
"olcReplogFile $ olcRequires $ olcRestrict $ olcReverseLookup $ "
- "olcRootDSE $ olcRootPW $ "
+ "olcRootDSE $ "
"olcSaslHost $ olcSaslRealm $ olcSaslSecProps $ "
"olcSecurity $ olcSizeLimit $ "
"olcSockbufMaxIncoming $ olcSockbufMaxIncomingAuth $ olcSrvtab $ "
"olcTLSRandFile $ olcTLSVerifyClient $ "
"olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
"olcDitContentRules ) )", Cft_Global },
- { "( OLcfgGlOc:3 "
+ { "( OLcfgGlOc:2 "
"NAME 'olcSchemaConfig' "
"DESC 'OpenLDAP schema object' "
"SUP olcConfig STRUCTURAL "
"MAY ( cn $ olcObjectIdentifier $ olcAttributeTypes $ "
"olcObjectClasses $ olcDitContentRules ) )",
Cft_Schema, NULL, cfAddSchema },
- { "( OLcfgGlOc:4 "
+ { "( OLcfgGlOc:3 "
"NAME 'olcBackendConfig' "
"DESC 'OpenLDAP Backend-specific options' "
"SUP olcConfig STRUCTURAL "
"MUST olcBackend )", Cft_Backend, NULL, cfAddBackend },
- { "( OLcfgGlOc:5 "
+ { "( OLcfgGlOc:4 "
"NAME 'olcDatabaseConfig' "
"DESC 'OpenLDAP Database-specific options' "
"SUP olcConfig STRUCTURAL "
"olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSyncrepl $ "
"olcTimeLimit $ olcUpdateDN $ olcUpdateRef ) )",
Cft_Database, NULL, cfAddDatabase },
- { "( OLcfgGlOc:6 "
+ { "( OLcfgGlOc:5 "
"NAME 'olcOverlayConfig' "
"DESC 'OpenLDAP Overlay-specific options' "
"SUP olcConfig STRUCTURAL "
"MUST olcOverlay )", Cft_Overlay, NULL, cfAddOverlay },
- { "( OLcfgGlOc:7 "
+ { "( OLcfgGlOc:6 "
"NAME 'olcIncludeFile' "
"DESC 'OpenLDAP configuration include file' "
"SUP olcConfig STRUCTURAL "
"MUST olcInclude "
"MAY ( cn $ olcRootDSE ) )",
Cft_Include, NULL, cfAddInclude },
+ /* This should be STRUCTURAL like all the other database classes, but
+ * that would mean inheriting all of the olcDatabaseConfig attributes,
+ * which causes them to be merged twice in config_build_entry.
+ */
+ { "( OLcfgGlOc:7 "
+ "NAME 'olcFrontendConfig' "
+ "DESC 'OpenLDAP frontend configuration' "
+ "AUXILIARY "
+ "MAY olcDefaultSearchBase )",
+ Cft_Database, NULL, NULL },
#ifdef SLAPD_MODULES
{ "( OLcfgGlOc:8 "
"NAME 'olcModuleList' "
static int
config_search_base(ConfigArgs *c) {
- struct berval dn;
-
if(c->op == SLAP_CONFIG_EMIT) {
int rc = 1;
if (!BER_BVISEMPTY(&default_search_base)) {
/* log error */
Debug( SLAPD_DEBUG_CONFIG_ERROR, "%s: (optional) %s overlay \"%s\" configuration failed"
SLAPD_CONF_UNKNOWN_IGNORED ".\n",
- c->log, c->be == frontendDB ? "global " : "", c->argv[1][1]);
+ c->log, c->be == frontendDB ? "global " : "", &c->argv[1][1]);
#ifdef SLAPD_CONF_UNKNOWN_BAILOUT
return 1;
#endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
}
static int
-config_suffix(ConfigArgs *c) {
+config_suffix(ConfigArgs *c)
+{
Backend *tbe;
struct berval pdn, ndn;
- int rc;
+ char *notallowed = NULL;
+
+ if ( c->be == frontendDB ) {
+ notallowed = "frontend";
+
+ } else if ( SLAP_MONITOR(c->be) ) {
+ notallowed = "monitor";
+
+ } else if ( SLAP_CONFIG(c->be) ) {
+ notallowed = "config";
+ }
+
+ if ( notallowed != NULL ) {
+ char buf[ SLAP_TEXT_BUFLEN ] = { '\0' };
+
+ switch ( c->op ) {
+ case LDAP_MOD_ADD:
+ case LDAP_MOD_DELETE:
+ case LDAP_MOD_REPLACE:
+ case LDAP_MOD_INCREMENT:
+ case SLAP_CONFIG_ADD:
+ if ( !BER_BVISNULL( &c->value_dn ) ) {
+ snprintf( buf, sizeof( buf ), "<%s> ",
+ c->value_dn.bv_val );
+ }
+
+ Debug(LDAP_DEBUG_ANY,
+ "%s: suffix %snot allowed in %s database.\n",
+ c->log, buf, notallowed );
+ break;
+
+ case SLAP_CONFIG_EMIT:
+ /* don't complain when emitting... */
+ break;
+
+ default:
+ /* FIXME: don't know what values may be valid;
+ * please remove assertion, or add legal values
+ * to either block */
+ assert( 0 );
+ break;
+ }
- if (c->be == frontendDB || SLAP_MONITOR(c->be) ||
- SLAP_CONFIG(c->be)) return 1;
+ return 1;
+ }
if (c->op == SLAP_CONFIG_EMIT) {
if ( c->be->be_suffix == NULL
}
return 0;
}
+
#ifdef SLAPD_MONITOR_DN
if(!strcasecmp(c->argv[1], SLAPD_MONITOR_DN)) {
sprintf( c->msg, "<%s> DN is reserved for monitoring slapd",
static int
config_rootpw(ConfigArgs *c) {
Backend *tbe;
- /* config_add_internal sets c->be = frontendDB. While the cn=config
- * rootpw is technically inside a backend, we expose it in the
- * global entry, and need to point to it properly here.
- */
- if (c->be == frontendDB)
- c->be = LDAP_STAILQ_FIRST(&backendDB);
if (c->op == SLAP_CONFIG_EMIT) {
if (!BER_BVISEMPTY(&c->be->be_rootpw)) {
- ber_dupbv( &c->value_bv, &c->be->be_rootpw);
+ /* don't copy, because "rootpw" is marked
+ * as CFG_BERVAL */
+ c->value_bv = c->be->be_rootpw;
return 0;
}
return 1;
return(0);
}
+static slap_verbmasks *loglevel_ops;
+
static int
-config_loglevel(ConfigArgs *c) {
- int i;
- char *next;
- slap_verbmasks loglevel_ops[] = {
+loglevel_init( void )
+{
+ slap_verbmasks lo[] = {
{ BER_BVC("Any"), -1 },
{ BER_BVC("Trace"), LDAP_DEBUG_TRACE },
{ BER_BVC("Packets"), LDAP_DEBUG_PACKETS },
{ BER_BVNULL, 0 }
};
+ return slap_verbmasks_init( &loglevel_ops, lo );
+}
+
+static void
+loglevel_destroy( void )
+{
+ if ( loglevel_ops ) {
+ (void)slap_verbmasks_destroy( loglevel_ops );
+ }
+ loglevel_ops = NULL;
+}
+
+static slap_mask_t loglevel_ignore[] = { -1, 0 };
+
+int
+slap_loglevel_register( slap_mask_t m, struct berval *s )
+{
+ int rc;
+
+ if ( loglevel_ops == NULL ) {
+ loglevel_init();
+ }
+
+ rc = slap_verbmasks_append( &loglevel_ops, m, s, loglevel_ignore );
+
+ if ( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY, "slap_loglevel_register(%lu, \"%s\") failed\n",
+ m, s->bv_val, 0 );
+ }
+
+ return rc;
+}
+
+int
+str2loglevel( const char *s, int *l )
+{
+ int i;
+
+ if ( loglevel_ops == NULL ) {
+ loglevel_init();
+ }
+
+ i = verb_to_mask( s, loglevel_ops );
+
+ if ( BER_BVISNULL( &loglevel_ops[ i ].word) ) {
+ return -1;
+ }
+
+ *l = loglevel_ops[ i ].mask;
+
+ return 0;
+}
+
+static int
+config_loglevel(ConfigArgs *c) {
+ int i;
+ char *next;
+
+ if ( loglevel_ops == NULL ) {
+ loglevel_init();
+ }
+
if (c->op == SLAP_CONFIG_EMIT) {
return mask_to_verbs( loglevel_ops, ldap_syslog, &c->rvalue_vals );
} else if ( c->op == LDAP_MOD_DELETE ) {
for( i=1; i < c->argc; i++ ) {
int level;
- if ( isdigit( c->argv[i][0] ) ) {
+ if ( isdigit( c->argv[i][0] ) || c->argv[i][0] == '-' ) {
level = strtol( c->argv[i], &next, 10 );
if ( next == NULL || next[0] != '\0' ) {
sprintf( c->msg, "<%s> unable to parse level", c->argv[0] );
return( 1 );
}
} else {
- int j = verb_to_mask(c->argv[i], loglevel_ops);
- if(BER_BVISNULL(&loglevel_ops[j].word)) {
+ if ( str2loglevel( c->argv[i], &level ) ) {
sprintf( c->msg, "<%s> unknown level", c->argv[0] );
Debug( LDAP_DEBUG_ANY, "%s: %s \"%s\"\n",
c->log, c->msg, c->argv[i]);
return( 1 );
}
- level = loglevel_ops[j].mask;
}
ldap_syslog |= level;
}
{
int len;
char *ptr;
- struct berval bc = {0};
+ struct berval bc = BER_BVNULL;
char numbuf[32];
len = sprintf(numbuf, IFMT, i );
return(1);
}
if(!ludp->lud_host) {
+ ldap_free_urldesc(ludp);
sprintf( c->msg, "<%s> invalid uri - missing hostname",
c->argv[0] );
Debug(LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
static int
config_updatedn(ConfigArgs *c) {
- struct berval dn;
- int rc;
if (c->op == SLAP_CONFIG_EMIT) {
if (!BER_BVISEMPTY(&c->be->be_update_ndn)) {
value_add_one(&c->rvalue_vals, &c->be->be_update_ndn);
return 1;
} else if ( c->op == LDAP_MOD_DELETE ) {
ch_free( c->be->be_update_ndn.bv_val );
- c->be->be_update_ndn.bv_val = NULL;
+ BER_BVZERO( &c->be->be_update_ndn );
SLAP_DBFLAGS(c->be) ^= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
return 0;
}
return(1);
}
- ber_str2bv(c->argv[1], 0, 0, &dn);
-
- rc = dnNormalize(0, NULL, NULL, &dn, &c->be->be_update_ndn, NULL);
-
- if(rc != LDAP_SUCCESS) {
- sprintf( c->msg, "<%s> invalid DN %d (%s)", c->argv[0],
- rc, ldap_err2string(rc));
- Debug(LDAP_DEBUG_ANY, "%s: %s\n",
- c->log, c->msg, 0 );
- return(1);
+ ber_memfree_x( c->value_dn.bv_val, NULL );
+ if ( !BER_BVISNULL( &c->be->be_update_ndn ) ) {
+ ber_memfree_x( c->be->be_update_ndn.bv_val, NULL );
}
+ c->be->be_update_ndn = c->value_ndn;
+ BER_BVZERO( &c->value_dn );
+ BER_BVZERO( &c->value_ndn );
SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
return(0);
static int
config_include(ConfigArgs *c) {
- unsigned long savelineno = c->lineno;
+ int savelineno = c->lineno;
int rc;
ConfigFile *cf;
ConfigFile *cfsave = cfn;
op->o_bd = &cfb->cb_db;
rc = op->o_bd->be_search( op, &rs );
+
+ slap_sl_mem_destroy( NULL, op->o_tmpmemctx );
}
cfb->cb_use_ldif = 1;
rc = read_config_file(cfname, 0, NULL, config_back_cf_table);
if ( rc == 0 )
- ber_str2bv( cfname, 0, 1, &cf_prv.c_file );
+ ber_str2bv( cfname, 0, 1, &cfb->cb_config->c_file );
/* If we got this far and failed, it may be a serious problem. In server
* mode, we should never come to this. However, it may be alright if we're
return LDAP_NAMING_VIOLATION;
gotindex = 1;
index = atoi(ptr1+1);
- if ( index < 0 )
- return LDAP_NAMING_VIOLATION;
+ if ( index < 0 ) {
+ /* Special case, we allow -1 for the frontendDB */
+ if ( index != -1 || ce_type != Cft_Database ||
+ strncmp( ptr2+1, "frontend,", STRLENOF("frontend,") ))
+
+ return LDAP_NAMING_VIOLATION;
+ }
}
/* count related kids */
if ( ca->lineno )
return LDAP_COMPARE_TRUE;
- if ( p->ce_type == Cft_Global )
- cfn = &cf_prv;
- else
- cfn = p->ce_private;
+ cfn = p->ce_private;
ca->private = cfn;
return LDAP_SUCCESS;
}
/* This entry is hardcoded, don't re-parse it */
if ( p->ce_type == Cft_Global ) {
- cfn = &cf_prv;
+ cfn = p->ce_private;
ca->private = cfn;
return LDAP_COMPARE_TRUE;
}
CfEntryInfo *ce, *last;
ConfigOCs **colst;
Attribute *a, *oc_at;
- int i, j, nocs, rc = 0;
+ int i, nocs, rc = 0;
struct berval pdn;
ConfigTable *ct;
char *ptr;
*/
rc = LDAP_CONSTRAINT_VIOLATION;
if ( colst[0]->co_type == Cft_Global && !last ) {
- cfn = &cf_prv;
+ cfn = cfb->cb_config;
ca->private = cfn;
ca->be = frontendDB; /* just to get past check_vals */
rc = LDAP_SUCCESS;
leave:
if ( rc ) {
if ( (colst[0]->co_type == Cft_Database) && ca->be ) {
- backend_destroy_one( ca->be );
+ if ( ca->be != frontendDB )
+ backend_destroy_one( ca->be, 1 );
} else if ( (colst[0]->co_type == Cft_Overlay) && ca->bi ) {
overlay_destroy_one( ca->be, (slap_overinst *)ca->bi );
}
config_back_add( Operation *op, SlapReply *rs )
{
CfBackInfo *cfb;
- CfEntryInfo *ce, *last;
int renumber;
ConfigArgs ca;
config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
ConfigArgs *ca )
{
- CfBackInfo *cfb = (CfBackInfo *)op->o_bd->be_private;
int rc = LDAP_UNWILLING_TO_PERFORM;
Modifications *ml;
Entry *e = ce->ce_entry;
int *idx = NULL;
if ( ct && ( ct->arg_type & ARG_NO_DELETE )) {
rc = LDAP_OTHER;
- snprintf( ca->msg, sizeof(ca->msg),
- "<%s> cannot be deleted" );
snprintf(ca->msg, sizeof(ca->msg), "cannot delete %s",
ml->sml_desc->ad_cname.bv_val );
goto out;
if(rc == LDAP_SUCCESS) {
/* check that the entry still obeys the schema */
- rc = entry_schema_check(op->o_bd, e, NULL, 0,
+ rc = entry_schema_check(op, e, NULL, 0,
&rs->sr_text, ca->msg, sizeof(ca->msg) );
}
if ( rc == LDAP_SUCCESS ) {
{
CfBackInfo *cfb;
CfEntryInfo *ce, *last;
- int rc;
if ( !be_isroot( op ) ) {
rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
CfBackInfo *cfb = be->be_private;
struct berval rdn;
Entry *e, *parent;
- CfEntryInfo *ce, *ceparent, *ceprev;
- int i, rc;
+ CfEntryInfo *ce, *ceparent;
+ int i;
BackendInfo *bi;
- BackendDB *bptr;
ConfigArgs c;
- ConfigTable *ct;
Connection conn = {0};
char opbuf[OPERATION_BUFFER_SIZE];
Operation *op;
}
/* Create database nodes... */
- i = -1;
- LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
+ frontendDB->be_cf_ocs = &CFOC_FRONTEND;
+ LDAP_STAILQ_NEXT(frontendDB, be_next) = LDAP_STAILQ_FIRST(&backendDB);
+ for ( i = -1, be = frontendDB ; be;
+ i++, be = LDAP_STAILQ_NEXT( be, be_next )) {
slap_overinfo *oi = NULL;
- i++;
- if ( i == 0 ) {
- bptr = frontendDB;
- } else {
- bptr = be;
- }
- if ( overlay_is_over( bptr )) {
- oi = bptr->bd_info->bi_private;
+
+ if ( overlay_is_over( be )) {
+ oi = be->bd_info->bi_private;
bi = oi->oi_orig;
} else {
- bi = bptr->bd_info;
+ bi = be->bd_info;
}
rdn.bv_val = c.log;
rdn.bv_len = sprintf(rdn.bv_val, "%s=" IFMT "%s", cfAd_database->ad_cname.bv_val,
i, bi->bi_type);
- c.be = bptr;
+ c.be = be;
c.bi = bi;
e = config_build_entry( op, &rs, ceparent, &c, &rdn, &CFOC_DATABASE,
be->be_cf_ocs );
rdn.bv_val = c.log;
rdn.bv_len = sprintf(rdn.bv_val, "%s=" IFMT "%s",
cfAd_overlay->ad_cname.bv_val, j, on->on_bi.bi_type );
- c.be = bptr;
+ c.be = be;
c.bi = &on->on_bi;
oe = config_build_entry( op, &rs, ce, &c, &rdn,
&CFOC_OVERLAY, c.bi->bi_cf_ocs );
}
}
}
+ if ( op )
+ slap_sl_mem_destroy( NULL, op->o_tmpmemctx );
+
+ return 0;
+}
+
+static void
+cfb_free_cffile( ConfigFile *cf )
+{
+ ConfigFile *next;
+
+ for (; cf; cf=next) {
+ next = cf->c_sibs;
+ if ( cf->c_kids )
+ cfb_free_cffile( cf->c_kids );
+ ch_free( cf->c_file.bv_val );
+ ber_bvarray_free( cf->c_dseFiles );
+ ch_free( cf );
+ }
+}
+
+static void
+cfb_free_entries( CfEntryInfo *ce )
+{
+ CfEntryInfo *next;
+
+ for (; ce; ce=next) {
+ next = ce->ce_sibs;
+ if ( ce->ce_kids )
+ cfb_free_entries( ce->ce_kids );
+ ce->ce_entry->e_private = NULL;
+ entry_free( ce->ce_entry );
+ ch_free( ce );
+ }
+}
+
+static int
+config_back_db_close( BackendDB *be )
+{
+ CfBackInfo *cfb = be->be_private;
+
+ cfb_free_entries( cfb->cb_root );
+ cfb->cb_root = NULL;
+
+ if ( cfb->cb_db.bd_info ) {
+ backend_shutdown( &cfb->cb_db );
+ }
return 0;
}
static int
-config_back_db_destroy( Backend *be )
+config_back_db_destroy( BackendDB *be )
{
+ CfBackInfo *cfb = be->be_private;
+
+ cfb_free_cffile( cfb->cb_config );
+
+ ch_free( cfdir.bv_val );
+
+ avl_free( CfOcTree, NULL );
+
+ if ( cfb->cb_db.bd_info ) {
+ cfb->cb_db.be_suffix = NULL;
+ cfb->cb_db.be_nsuffix = NULL;
+ BER_BVZERO( &cfb->cb_db.be_rootdn );
+ BER_BVZERO( &cfb->cb_db.be_rootndn );
+
+ backend_destroy_one( &cfb->cb_db, 0 );
+ }
+
free( be->be_private );
+
+ loglevel_destroy();
+
return 0;
}
static int
-config_back_db_init( Backend *be )
+config_back_db_init( BackendDB *be )
{
struct berval dn;
CfBackInfo *cfb;
cfb = ch_calloc( 1, sizeof(CfBackInfo));
- cfb->cb_config = &cf_prv;
+ cfb->cb_config = ch_calloc( 1, sizeof(ConfigFile));
+ cfn = cfb->cb_config;
be->be_private = cfb;
ber_dupbv( &be->be_rootdn, &config_rdn );
bi->bi_db_init = config_back_db_init;
bi->bi_db_config = 0;
bi->bi_db_open = config_back_db_open;
- bi->bi_db_close = 0;
+ bi->bi_db_close = config_back_db_close;
bi->bi_db_destroy = config_back_db_destroy;
bi->bi_op_bind = config_back_bind;
#include <ac/socket.h>
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
int
do_bind(
op->o_conn->c_sasl_bind_in_progress = 0;
}
-#ifdef LDAP_SLAPI
-#define pb op->o_pb
- /*
- * Normally post-operation plugins are called only after the
- * backend operation. Because the front-end performs SASL
- * binds on behalf of the backend, we'll make a special
- * exception to call the post-operation plugins after a
- * SASL bind.
- */
- if ( pb ) {
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)op->orb_method );
- slapi_pblock_set( pb,
- SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
- (void) slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_POST_BIND_FN, pb );
- }
-#endif /* LDAP_SLAPI */
-
ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
goto cleanup;
goto cleanup;
}
-#ifdef LDAP_SLAPI
- if ( pb ) {
- int rc;
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)op->orb_method );
- slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
- slapi_pblock_set( pb, SLAPI_CONN_DN, (void *)(0) );
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb );
-
- Debug(LDAP_DEBUG_TRACE,
- "do_bind: Bind preoperation plugin returned %d.\n",
- rs->sr_err, 0, 0);
-
- switch ( rc ) {
- case SLAPI_BIND_SUCCESS:
- /* Continue with backend processing */
- break;
- case SLAPI_BIND_FAIL:
- /* Failure, server sends result */
- rs->sr_err = LDAP_INVALID_CREDENTIALS;
- send_ldap_result( op, rs );
- goto cleanup;
- break;
- case SLAPI_BIND_ANONYMOUS:
- /* SLAPI_BIND_ANONYMOUS is undocumented XXX */
- default:
- /* Authoritative, plugin sent result, or no plugins called. */
- if ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE,
- (void *)&rs->sr_err) != 0 )
- {
- rs->sr_err = LDAP_OTHER;
- }
-
- BER_BVZERO( &op->orb_edn );
-
- if ( rs->sr_err == LDAP_SUCCESS ) {
- slapi_pblock_get( pb, SLAPI_CONN_DN,
- (void *)&op->orb_edn.bv_val );
- if ( BER_BVISNULL( &op->orb_edn ) ) {
- if ( rc == 1 ) {
- /* No plugins were called; continue. */
- break;
- }
- } else {
- op->orb_edn.bv_len = strlen( op->orb_edn.bv_val );
- }
- rs->sr_err = dnPrettyNormal( NULL, &op->orb_edn,
- &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
- ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
- ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
- ber_dupbv(&op->o_conn->c_ndn, &op->o_req_ndn);
- op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
- BER_BVZERO( &op->o_req_dn );
- op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
- BER_BVZERO( &op->o_req_ndn );
- if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
- ber_len_t max = sockbuf_max_incoming_auth;
- ber_sockbuf_ctrl( op->o_conn->c_sb,
- LBER_SB_OPT_SET_MAX_INCOMING, &max );
- }
- /* log authorization identity */
- Statslog( LDAP_DEBUG_STATS,
- "%s BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
- op->o_log_prefix,
- BER_BVISNULL( &op->o_conn->c_dn )
- ? "<empty>" : op->o_conn->c_dn.bv_val,
- mech.bv_val, 0, 0 );
- ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
- }
- goto cleanup;
- break;
- }
- }
-#endif /* LDAP_SLAPI */
-
if( op->o_bd->be_bind ) {
rs->sr_err = (op->o_bd->be_bind)( op, rs );
"operation not supported within naming context" );
}
-#ifdef LDAP_SLAPI
- if ( pb != NULL &&
- slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) < 0 )
- {
- Debug(LDAP_DEBUG_TRACE,
- "do_bind: Bind postoperation plugins failed.\n",
- 0, 0, 0);
- }
-#endif /* LDAP_SLAPI */
-
cleanup:;
return rs->sr_err;
}
int rc;
int opid;
BerElement *ber;
- int i;
assert( ber_bvcmp( &slap_EXOP_CANCEL, &op->ore_reqoid ) == 0 );
#include <ac/string.h>
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
static int compare_entry(
Operation *op,
cleanup:;
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
- if ( ava.aa_value.bv_val ) {
+ if ( !BER_BVISNULL( &ava.aa_value ) ) {
op->o_tmpfree( ava.aa_value.bv_val, op->o_tmpmemctx );
}
op->o_log_prefix, op->o_req_dn.bv_val,
ava.aa_desc->ad_cname.bv_val, 0, 0 );
-#if defined( LDAP_SLAPI )
-#define pb op->o_pb
- if ( pb ) {
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_COMPARE_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
- slapi_pblock_set( pb, SLAPI_COMPARE_TYPE, (void *)ava.aa_desc->ad_cname.bv_val );
- slapi_pblock_set( pb, SLAPI_COMPARE_VALUE, (void *)&ava.aa_value );
-
- rs->sr_err = slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_PRE_COMPARE_FN, pb );
- if ( rs->sr_err < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE,
- "do_compare: compare preoperation plugin failed\n",
- 0, 0, 0);
- if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE,
- (void *)&rs->sr_err ) != 0 ) || rs->sr_err == LDAP_SUCCESS )
- {
- rs->sr_err = LDAP_OTHER;
- }
- goto cleanup;
- }
- }
-#endif /* defined( LDAP_SLAPI ) */
-
op->orc_ava = &ava;
if ( ava.aa_desc == slap_schema.si_ad_entryDN ) {
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
}
}
-#if defined( LDAP_SLAPI )
- if ( pb != NULL && slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_POST_COMPARE_FN, pb ) < 0 )
- {
- Debug(LDAP_DEBUG_TRACE,
- "do_compare: compare postoperation plugins failed\n", 0, 0, 0 );
- }
-#endif /* defined( LDAP_SLAPI ) */
-
cleanup:;
return rs->sr_err;
}
{
ComponentSyntaxInfo *csi_attr = (ComponentSyntaxInfo*)value;
MatchingRuleAssertion * ma = (MatchingRuleAssertion*)assertedValue;
- int num_attr, rc, i;
+ int rc;
if ( !mr || !ma->ma_cf ) return LDAP_INAPPROPRIATE_MATCHING;
static int
slapd_ber2cav( struct berval* bv, ComponentAssertionValue* cav )
{
- int len;
-
cav->cav_ptr = cav->cav_buf = bv->bv_val;
cav->cav_end = bv->bv_val + bv->bv_len;
ComponentReference*
dup_comp_ref ( Operation* op, ComponentReference* cr )
{
- int rc, count = 0;
ComponentReference* dup_cr;
ComponentId* ci_curr;
ComponentId** ci_temp;
- ber_int_t type;
dup_cr = op->o_tmpalloc( sizeof( ComponentReference ), op->o_tmpmemctx );
ComponentAssertion* in_ca,
ComponentAssertion** out_ca )
{
- ComponentAssertion* ca;
int len;
if ( !in_ca->ca_comp_ref ) return SLAPD_DISCONNECT;
int
get_aliased_filter_aa ( Operation* op, AttributeAssertion* a_assert, AttributeAliasing* aa, const char** text )
{
- int rc;
struct berval assert_bv;
- ComponentAssertion* ca;
Debug( LDAP_DEBUG_FILTER, "get_aliased_filter\n", 0, 0, 0 );
MatchingRuleAssertion* ma, AttributeAliasing* aa,
const char** text )
{
- int rc;
struct berval assert_bv;
- ComponentAssertion* ca;
Debug( LDAP_DEBUG_FILTER, "get_aliased_filter\n", 0, 0, 0 );
/*
* TAG : "item", "and", "or", "not"
*/
-static int
+static ber_tag_t
strip_cav_tag( ComponentAssertionValue* cav )
{
{
int rc;
ComponentAssertion* _ca;
- struct berval t_bv;
struct berval value;
MatchingRule* mr;
ComponentSyntaxInfo *csi_attr,
ComponentAssertion *ca )
{
- int rc, len;
+ int rc;
void *attr_nm, *assert_nm;
if ( strcmp(ca->ca_ma_rule->smr_mrule.mr_oid,
#include <ac/socket.h>
#include <ac/errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include "slap.h"
#ifdef LDAP_SLAPI
#include "slapi/slapi.h"
static char *strtok_quote(char *line, char *sep, char **quote_ptr);
-int read_config_file(const char *fname, int depth, ConfigArgs *cf,
- ConfigTable *cft );
-
ConfigArgs *
new_config_args( BackendDB *be, const char *fname, int lineno, int argc, char **argv )
{
return(ARG_BAD_CONF);
}
if(Conf->max_args && (c->argc > Conf->max_args)) {
- sprintf( c->msg, "<%s> extra cruft after <%s> ignored",
+ char *ignored = " ignored";
+
+ sprintf( c->msg, "<%s> extra cruft after <%s>",
c->argv[0], Conf->what );
- Debug(LDAP_DEBUG_CONFIG, "%s: %s\n", c->log, c->msg, 0 );
+
+#ifdef LDAP_DEVEL
+ ignored = "";
+#endif /* LDAP_DEVEL */
+ Debug(LDAP_DEBUG_CONFIG, "%s: %s%s.\n",
+ c->log, c->msg, ignored );
+#ifdef LDAP_DEVEL
+ return(ARG_BAD_CONF);
+#endif /* LDAP_DEVEL */
}
if((arg_type & ARG_DB) && !c->be) {
sprintf( c->msg, "<%s> only allowed within database declaration",
int config_set_vals(ConfigTable *Conf, ConfigArgs *c) {
int rc, arg_type;
- void *ptr;
+ void *ptr = NULL;
arg_type = Conf->arg_type;
if(arg_type & ARG_MAGIC) {
const char *err;
for (i=0; ct[i].name; i++ ) {
+ int freeit = 0;
+
if ( !ct[i].attribute ) continue;
at = ldap_str2attributetype( ct[i].attribute,
&code, &err, LDAP_SCHEMA_ALLOW_ALL );
ct[i].attribute, ldap_scherr2str(code), err );
return code;
}
+
code = at_add( at, 0, NULL, &err );
- if ( code && code != SLAP_SCHERR_ATTR_DUP ) {
- fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
- ct[i].attribute, scherr2str(code), err );
- return code;
+ if ( code ) {
+ if ( code == SLAP_SCHERR_ATTR_DUP ) {
+ freeit = 1;
+
+ } else {
+ fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
+ ct[i].attribute, scherr2str(code), err );
+ return code;
+ }
}
code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
+ if ( freeit ) {
+ ldap_attributetype_free( at );
+ } else {
+ ldap_memfree( at );
+ }
if ( code ) {
fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s\n",
ct[i].attribute, err );
return code;
}
- ldap_memfree( at );
}
return 0;
ConfigTable *ct;
ConfigArgs *c;
int rc;
+ struct stat s;
c = ch_calloc( 1, sizeof( ConfigArgs ) );
if ( c == NULL ) {
c->fname = fname;
init_config_argv( c );
+ if ( stat( fname, &s ) != 0 ) {
+ ldap_syslog = 1;
+ Debug(LDAP_DEBUG_ANY,
+ "could not stat config file \"%s\": %s (%d)\n",
+ fname, strerror(errno), errno);
+ return(1);
+ }
+
+ if ( !S_ISREG( s.st_mode ) ) {
+ ldap_syslog = 1;
+ Debug(LDAP_DEBUG_ANY,
+ "regular file expected, got \"%s\"\n",
+ fname, 0, 0 );
+ return(1);
+ }
+
fp = fopen( fname, "r" );
if ( fp == NULL ) {
ldap_syslog = 1;
continue;
}
- snprintf( c->log, sizeof( c->log ), "%s: line %lu",
+ snprintf( c->log, sizeof( c->log ), "%s: line %d",
c->fname, c->lineno );
c->argc = 0;
return 0;
}
+int
+slap_verbmasks_init( slap_verbmasks **vp, slap_verbmasks *v )
+{
+ int i;
+
+ assert( *vp == NULL );
+
+ for ( i = 0; !BER_BVISNULL( &v[ i ].word ); i++ )
+ ;
+
+ *vp = ch_calloc( i + 1, sizeof( slap_verbmasks ) );
+
+ for ( i = 0; !BER_BVISNULL( &v[ i ].word ); i++ ) {
+ ber_dupbv( &(*vp)[ i ].word, &v[ i ].word );
+ *((slap_mask_t *)&(*vp)[ i ].mask) = v[ i ].mask;
+ }
+
+ BER_BVZERO( &(*vp)[ i ].word );
+
+ return 0;
+}
+
+int
+slap_verbmasks_destroy( slap_verbmasks *v )
+{
+ int i;
+
+ assert( v != NULL );
+
+ for ( i = 0; !BER_BVISNULL( &v[ i ].word ); i++ ) {
+ ch_free( v[ i ].word.bv_val );
+ }
+
+ ch_free( v );
+
+ return 0;
+}
+
+int
+slap_verbmasks_append(
+ slap_verbmasks **vp,
+ slap_mask_t m,
+ struct berval *v,
+ slap_mask_t *ignore )
+{
+ int i;
+
+ if ( !m ) {
+ return LDAP_OPERATIONS_ERROR;
+ }
+
+ for ( i = 0; !BER_BVISNULL( &(*vp)[ i ].word ); i++ ) {
+ if ( !(*vp)[ i ].mask ) continue;
+
+ if ( ignore != NULL ) {
+ int j;
+
+ for ( j = 0; ignore[ j ] != 0; j++ ) {
+ if ( (*vp)[ i ].mask == ignore[ j ] ) {
+ goto check_next;
+ }
+ }
+ }
+
+ if ( ( m & (*vp)[ i ].mask ) == (*vp)[ i ].mask ) {
+ if ( ber_bvstrcasecmp( v, &(*vp)[ i ].word ) == 0 ) {
+ /* already set; ignore */
+ return LDAP_SUCCESS;
+ }
+ /* conflicts */
+ return LDAP_TYPE_OR_VALUE_EXISTS;
+ }
+
+ if ( m & (*vp)[ i ].mask ) {
+ /* conflicts */
+ return LDAP_CONSTRAINT_VIOLATION;
+ }
+check_next:;
+ }
+
+ *vp = ch_realloc( *vp, sizeof( slap_verbmasks ) * ( i + 2 ) );
+ ber_dupbv( &(*vp)[ i ].word, v );
+ *((slap_mask_t *)&(*vp)[ i ].mask) = m;
+ BER_BVZERO( &(*vp)[ i + 1 ].word );
+
+ return LDAP_SUCCESS;
+}
+
int
enum_to_verb(slap_verbmasks *v, slap_mask_t m, struct berval *bv) {
int i;
break;
case 'd':
- assert( tab->aux );
+ assert( tab->aux != NULL );
iptr = (int *)((char *)bc + tab->off);
rc = 1;
break;
case 'd':
- assert( tab->aux );
+ assert( tab->aux != NULL );
iptr = (int *)((char *)bc + tab->off);
for ( i = 0; !BER_BVISNULL( &tab->aux[i].word ); i++ ) {
fp_parse_line(ConfigArgs *c)
{
char *token;
- char *hide[] = { "rootpw", "replica", "bindpw", "pseudorootpw", "dbpasswd", '\0' };
+ static char *const hide[] = {
+ "rootpw", "replica", "syncrepl", /* in slapd */
+ "acl-bind", "acl-method", "idassert-bind", /* in back-ldap */
+ "acl-passwd", "bindpw", /* in back-<ldap/meta> */
+ "pseudorootpw", /* in back-meta */
+ "dbpasswd", /* in back-sql */
+ NULL
+ };
char *quote_ptr;
- int i;
+ int i = (int)(sizeof(hide)/sizeof(hide[0])) - 1;
c->tline = ch_strdup(c->line);
token = strtok_quote(c->tline, " \t", "e_ptr);
if(token) for(i = 0; hide[i]; i++) if(!strcasecmp(token, hide[i])) break;
if(quote_ptr) *quote_ptr = ' ';
- Debug(LDAP_DEBUG_CONFIG, "line %lu (%s%s)\n", c->lineno,
+ Debug(LDAP_DEBUG_CONFIG, "line %d (%s%s)\n", c->lineno,
hide[i] ? hide[i] : c->line, hide[i] ? " ***" : "");
if(quote_ptr) *quote_ptr = '\0';
- for(; token; token = strtok_quote(NULL, " \t", "e_ptr)) {
- if(c->argc == c->argv_size - 1) {
+ for(;; token = strtok_quote(NULL, " \t", "e_ptr)) {
+ if(c->argc >= c->argv_size) {
char **tmp;
tmp = ch_realloc(c->argv, (c->argv_size + ARGS_STEP) * sizeof(*c->argv));
if(!tmp) {
- Debug(LDAP_DEBUG_ANY, "line %lu: out of memory\n", c->lineno, 0, 0);
+ Debug(LDAP_DEBUG_ANY, "line %d: out of memory\n", c->lineno, 0, 0);
return -1;
}
c->argv = tmp;
c->argv_size += ARGS_STEP;
}
+ if(token == NULL)
+ break;
c->argv[c->argc++] = token;
}
c->argv[c->argc] = NULL;
char *line;
char *tline;
const char *fname;
- unsigned long lineno;
+ int lineno;
char log[MAXPATHLEN + STRLENOF(": line 18446744073709551615") + 1];
char msg[SLAP_TEXT_BUFLEN];
int depth;
#define value_ndn values.v_dn.vdn_ndn
int config_register_schema(ConfigTable *ct, ConfigOCs *co);
+int config_del_vals(ConfigTable *cf, ConfigArgs *c);
int config_get_vals(ConfigTable *ct, ConfigArgs *c);
int config_add_vals(ConfigTable *ct, ConfigArgs *c);
+
+void init_config_argv( ConfigArgs *c );
+int init_config_attrs(ConfigTable *ct);
+int init_config_ocs( ConfigOCs *ocs );
+int config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx);
+int config_parse_add(ConfigTable *ct, ConfigArgs *c);
+int read_config_file(const char *fname, int depth, ConfigArgs *cf,
+ ConfigTable *cft );
+
ConfigTable * config_find_keyword(ConfigTable *ct, ConfigArgs *c);
Entry * config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent,
ConfigArgs *c, struct berval *rdn, ConfigOCs *main, ConfigOCs *extra );
ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
}
- if(c->c_authmech.bv_val != NULL ) {
- free(c->c_authmech.bv_val);
+ if ( !BER_BVISNULL( &c->c_authmech ) ) {
+ ch_free(c->c_authmech.bv_val);
}
BER_BVZERO( &c->c_authmech );
- if(c->c_dn.bv_val != NULL) {
- free(c->c_dn.bv_val);
+ if ( !BER_BVISNULL( &c->c_dn ) ) {
+ ch_free(c->c_dn.bv_val);
}
BER_BVZERO( &c->c_dn );
- if(c->c_ndn.bv_val != NULL) {
- free(c->c_ndn.bv_val);
+ if ( !BER_BVISNULL( &c->c_ndn ) ) {
+ ch_free(c->c_ndn.bv_val);
}
BER_BVZERO( &c->c_ndn );
- if(c->c_sasl_authz_dn.bv_val != NULL) {
- free(c->c_sasl_authz_dn.bv_val);
+ if ( !BER_BVISNULL( &c->c_sasl_authz_dn ) ) {
+ ber_memfree_x( c->c_sasl_authz_dn.bv_val, NULL );
}
BER_BVZERO( &c->c_sasl_authz_dn );
static SLAP_CTRL_PARSE_FN parseManageDIT;
#endif
static SLAP_CTRL_PARSE_FN parseManageDSAit;
+#ifdef LDAP_CONTROL_MODIFY_INCREMENT
static SLAP_CTRL_PARSE_FN parseModifyIncrement;
+#endif
static SLAP_CTRL_PARSE_FN parseNoOp;
static SLAP_CTRL_PARSE_FN parsePagedResults;
#ifdef LDAP_DEVEL
slap_controls_init( void )
{
int i, rc;
- struct slap_control *sc;
rc = LDAP_SUCCESS;
get_supported_controls(char ***ctrloidsp,
slap_mask_t **ctrlmasks)
{
- int i, n;
+ int n;
char **oids;
slap_mask_t *masks;
- int rc;
struct slap_control *sc;
n = 0;
op->o_tmpfree( ctrls, op->o_tmpmemctx );
}
+int slap_parse_ctrl(
+ Operation *op,
+ SlapReply *rs,
+ LDAPControl *control,
+ const char **text )
+{
+ struct slap_control *sc;
+
+ sc = find_ctrl( control->ldctl_oid );
+ if( sc != NULL ) {
+ /* recognized control */
+ slap_mask_t tagmask;
+ switch( op->o_tag ) {
+ case LDAP_REQ_ADD:
+ tagmask = SLAP_CTRL_ADD;
+ break;
+ case LDAP_REQ_BIND:
+ tagmask = SLAP_CTRL_BIND;
+ break;
+ case LDAP_REQ_COMPARE:
+ tagmask = SLAP_CTRL_COMPARE;
+ break;
+ case LDAP_REQ_DELETE:
+ tagmask = SLAP_CTRL_DELETE;
+ break;
+ case LDAP_REQ_MODIFY:
+ tagmask = SLAP_CTRL_MODIFY;
+ break;
+ case LDAP_REQ_RENAME:
+ tagmask = SLAP_CTRL_RENAME;
+ break;
+ case LDAP_REQ_SEARCH:
+ tagmask = SLAP_CTRL_SEARCH;
+ break;
+ case LDAP_REQ_UNBIND:
+ tagmask = SLAP_CTRL_UNBIND;
+ break;
+ case LDAP_REQ_ABANDON:
+ tagmask = SLAP_CTRL_ABANDON;
+ break;
+ case LDAP_REQ_EXTENDED:
+ tagmask=~0L;
+ assert( op->ore_reqoid.bv_val != NULL );
+ if( sc->sc_extendedops != NULL ) {
+ int i;
+ for( i=0; sc->sc_extendedops[i] != NULL; i++ ) {
+ if( strcmp( op->ore_reqoid.bv_val,
+ sc->sc_extendedops[i] ) == 0 )
+ {
+ tagmask=0L;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ *text = "controls internal error";
+ return LDAP_OTHER;
+ }
+
+ if (( sc->sc_mask & tagmask ) == tagmask ) {
+ /* available extension */
+ int rc;
+
+ if( !sc->sc_parse ) {
+ *text = "not yet implemented";
+ return LDAP_OTHER;
+ }
+
+ rc = sc->sc_parse( op, rs, control );
+ if ( rc ) {
+ assert( rc != LDAP_UNAVAILABLE_CRITICAL_EXTENSION );
+ return rc;
+ }
+
+ } else if( control->ldctl_iscritical ) {
+ /* unavailable CRITICAL control */
+ *text = "critical extension is unavailable";
+ return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
+ }
+ } else if( control->ldctl_iscritical ) {
+ /* unrecognized CRITICAL control */
+ *text = "critical extension is not recognized";
+ return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
+ }
+
+ return LDAP_SUCCESS;
+}
+
int get_ctrls(
Operation *op,
SlapReply *rs,
ber_len_t len;
char *opaque;
BerElement *ber = op->o_ber;
- struct slap_control *sc;
struct berval bv;
len = ber_pvt_ber_remaining(ber);
"=> get_ctrls: oid=\"%s\" (%scritical)\n",
c->ldctl_oid, c->ldctl_iscritical ? "" : "non", 0 );
- sc = find_ctrl( c->ldctl_oid );
- if( sc != NULL ) {
- /* recognized control */
- slap_mask_t tagmask;
- switch( op->o_tag ) {
- case LDAP_REQ_ADD:
- tagmask = SLAP_CTRL_ADD;
- break;
- case LDAP_REQ_BIND:
- tagmask = SLAP_CTRL_BIND;
- break;
- case LDAP_REQ_COMPARE:
- tagmask = SLAP_CTRL_COMPARE;
- break;
- case LDAP_REQ_DELETE:
- tagmask = SLAP_CTRL_DELETE;
- break;
- case LDAP_REQ_MODIFY:
- tagmask = SLAP_CTRL_MODIFY;
- break;
- case LDAP_REQ_RENAME:
- tagmask = SLAP_CTRL_RENAME;
- break;
- case LDAP_REQ_SEARCH:
- tagmask = SLAP_CTRL_SEARCH;
- break;
- case LDAP_REQ_UNBIND:
- tagmask = SLAP_CTRL_UNBIND;
- break;
- case LDAP_REQ_ABANDON:
- tagmask = SLAP_CTRL_ABANDON;
- break;
- case LDAP_REQ_EXTENDED:
- tagmask=~0L;
- assert( op->ore_reqoid.bv_val != NULL );
- if( sc->sc_extendedops != NULL ) {
- int i;
- for( i=0; sc->sc_extendedops[i] != NULL; i++ ) {
- if( strcmp( op->ore_reqoid.bv_val,
- sc->sc_extendedops[i] ) == 0 )
- {
- tagmask=0L;
- break;
- }
- }
- }
- break;
- default:
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "controls internal error";
- goto return_results;
- }
-
- if (( sc->sc_mask & tagmask ) == tagmask ) {
- /* available extension */
- int rc;
-
- if( !sc->sc_parse ) {
- rs->sr_err = LDAP_OTHER;
- rs->sr_text = "not yet implemented";
- goto return_results;
- }
-
- rc = sc->sc_parse( op, rs, c );
- if ( rc ) {
- assert( rc != LDAP_UNAVAILABLE_CRITICAL_EXTENSION );
- rs->sr_err = rc;
- goto return_results;
- }
-
- } else if( c->ldctl_iscritical ) {
- /* unavailable CRITICAL control */
- rs->sr_err = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
- rs->sr_text = "critical extension is unavailable";
- goto return_results;
- }
-
- } else if( c->ldctl_iscritical ) {
- /* unrecognized CRITICAL control */
- rs->sr_err = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
- rs->sr_text = "critical extension is not recognized";
+ rs->sr_err = slap_parse_ctrl( op, rs, c, &rs->sr_text );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
goto return_results;
}
-next_ctrl:;
}
return_results:
return rs->sr_err;
}
+#ifdef LDAP_CONTROL_MODIFY_INCREMENT
static int parseModifyIncrement (
Operation *op,
SlapReply *rs,
return LDAP_SUCCESS;
}
+#endif
#ifdef LDAP_DEVEL
static int parseManageDIT (
{
BerElement *ber;
struct berval fstr = BER_BVNULL;
- const char *err_msg = "";
if ( op->o_assert != SLAP_CONTROL_NONE ) {
rs->sr_text = "assert control specified multiple times";
return LDAP_SUCCESS;
}
-int parseValuesReturnFilter (
+static int parseValuesReturnFilter (
Operation *op,
SlapReply *rs,
LDAPControl *ctrl )
{
BerElement *ber;
struct berval fstr = BER_BVNULL;
- const char *err_msg = "";
if ( op->o_valuesreturnfilter != SLAP_CONTROL_NONE ) {
rs->sr_text = "valuesReturnFilter control specified multiple times";
cir->cir_name.bv_len = strlen( scr->scr_oid );
cir->cir_cr = scr;
- assert( cir->cir_name.bv_val );
- assert( cir->cir_cr );
+ assert( cir->cir_name.bv_val != NULL );
+ assert( cir->cir_cr != NULL );
if ( avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, avl_dup_error ) )
cir->cir_name.bv_len = strlen( *names );
cir->cir_cr = scr;
- assert( cir->cir_name.bv_val );
- assert( cir->cir_cr );
+ assert( cir->cir_name.bv_val != NULL );
+ assert( cir->cir_cr != NULL );
if ( avl_insert( &cr_index, (caddr_t) cir,
cr_index_cmp, avl_dup_error ) )
ContentRule *cr;
int i, num;
struct berval bv, *bva = NULL, idx;
- char ibuf[32], *ptr;
+ char ibuf[32];
if ( !start )
start = LDAP_STAILQ_FIRST( &cr_list );
)
{
struct slap_csn_entry *csne, *committed_csne = NULL;
- int i = 0;
if ( maxcsn ) {
BER_BVZERO( maxcsn );
struct berval *context_csn )
{
Entry* e;
- int rc;
struct berval bv;
#define SLAP_EVENT_FD(i) SLAP_EV_PTRFD(revents[i].data.ptr)
#define SLAP_SOCK_SET_MUTE(s) SLAP_SOCK_CLR_READ(s)
#define SLAP_SOCK_CLR_MUTE(s) SLAP_SOCK_SET_READ(s)
-#define SLAP_SOCK_IS_MUTE(s) !SLAP_SOCK_IS_READ(s)
+#define SLAP_SOCK_IS_MUTE(s) (!SLAP_SOCK_IS_READ(s))
#define SLAP_SOCK_SET_INIT \
slap_daemon.sd_epolls = ch_malloc(sizeof(struct epoll_event) * dtblsize * 2); \
#define SLAP_SOCK_SET_MUTE(s) FD_CLR(s, &readfds)
#define SLAP_SOCK_CLR_MUTE(s) FD_SET(s, &readfds)
-#define SLAP_SOCK_IS_MUTE(s) FD_ISSET(s, &readfds)
+#define SLAP_SOCK_IS_MUTE(s) (!FD_ISSET(s, &readfds))
#endif
{
int i;
- assert( exts );
- assert( perms );
- assert( crit );
+ assert( exts != NULL );
+ assert( perms != NULL );
+ assert( crit != NULL );
*crit = 0;
for ( i = 0; exts[ i ]; i++ ) {
#ifdef LDAP_PF_LOCAL
case AF_LOCAL: {
char *addr = ((struct sockaddr_un *)*sal)->sun_path;
-#if 0 /* don't muck with socket perms */
- if ( chmod( addr, l.sl_perms ) < 0 && crit ) {
- int err = sock_errno();
- Debug( LDAP_DEBUG_ANY, "daemon: fchmod(%ld) failed errno=%d (%s)",
- (long) l.sl_sd, err, sock_errstr(err) );
- tcp_close( l.sl_sd );
- slap_free_listener_addresses(psal);
- return -1;
- }
-#endif
l.sl_name.bv_len = strlen(addr) + sizeof("PATH=") - 1;
l.sl_name.bv_val = ber_memalloc( l.sl_name.bv_len + 1 );
snprintf( l.sl_name.bv_val, l.sl_name.bv_len + 1,
if ( !SLAP_EVENT_IS_READ( slap_listeners[l]->sl_sd ))
continue;
- ns--;
-
rc = slapd_handle_listener(slap_listeners[l]);
#ifdef LDAP_CONNECTIONLESS
if ( rc ) continue;
#endif
+ ns--;
+
/* Don't need to look at this in the data loops */
SLAP_EVENT_CLR_READ( slap_listeners[l]->sl_sd );
SLAP_EVENT_CLR_WRITE( slap_listeners[l]->sl_sd );
}
-int sockinit(void)
+static int sockinit(void)
{
#if defined( HAVE_WINSOCK2 )
WORD wVersionRequested;
return 0;
}
-int sockdestroy(void)
+static int sockdestroy(void)
{
#if defined( HAVE_WINSOCK2 ) || defined( HAVE_WINSOCK )
WSACleanup();
#include "lutil.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
int
do_delete(
Operation *op,
goto cleanup;
}
-#if defined( LDAP_SLAPI )
-#define pb op->o_pb
- if ( pb ) {
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_DELETE_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
-
- rs->sr_err = slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_PRE_DELETE_FN, pb );
- if ( rs->sr_err < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug (LDAP_DEBUG_TRACE, "do_delete: "
- "delete preoperation plugin failed.\n", 0, 0, 0);
- if ( ( slapi_pblock_get( pb, SLAPI_RESULT_CODE,
- (void *)&rs->sr_err ) != 0 ) ||
- rs->sr_err == LDAP_SUCCESS )
- {
- rs->sr_err = LDAP_OTHER;
- }
- goto cleanup;
- }
- }
-#endif /* defined( LDAP_SLAPI ) */
-
/*
* do the delete if 1 && (2 || 3)
* 1) there is a delete function implemented in this backend;
{
op->o_delete_glue_parent = 0;
if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) {
- slap_callback cb = { NULL };
+ slap_callback cb = { NULL, NULL, NULL, NULL };
cb.sc_response = slap_null_cb;
dnParent( &op->o_req_ndn, &pdn );
op->o_req_dn = pdn;
"operation not supported within namingContext" );
}
-#if defined( LDAP_SLAPI )
- if ( pb != NULL && slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_POST_DELETE_FN, pb ) < 0)
- {
- Debug(LDAP_DEBUG_TRACE,
- "do_delete: delete postoperation plugins failed\n",
- 0, 0, 0 );
- }
-#endif /* defined( LDAP_SLAPI ) */
-
cleanup:;
return rs->sr_err;
}
int iAVA;
int rc;
- assert( rdn );
+ assert( rdn != NULL );
for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
LDAPAVA *ava = rdn[ iAVA ];
AttributeDescription *ad;
slap_syntax_validate_func *validate = NULL;
- assert( ava );
+ assert( ava != NULL );
if ( ( ad = AVA_PRIVATE( ava ) ) == NULL ) {
const char *text = NULL;
int iRDN;
int rc;
- assert( dn );
+ assert( dn != NULL );
for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
LDAPRDN rdn = dn[ iRDN ];
int iAVA;
- assert( rdn );
+ assert( rdn != NULL );
for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
LDAPAVA *ava = rdn[ iAVA ];
AttributeDescription *ad;
slap_syntax_validate_func *validate = NULL;
- assert( ava );
+ assert( ava != NULL );
if ( ( ad = AVA_PRIVATE( ava ) ) == NULL ) {
const char *text = NULL;
int rc;
LDAPDN dn = NULL;
- assert( in );
+ assert( in != NULL );
if ( in->bv_len == 0 ) {
return LDAP_SUCCESS;
LDAPRDN rdn;
char* p;
- assert( in );
+ assert( in != NULL );
if ( in->bv_len == 0 ) {
return LDAP_SUCCESS;
int i;
LDAPAVA *ava_in = rdn[ iAVA ];
- assert( rdn );
- assert( ava_in );
+ assert( rdn != NULL );
+ assert( ava_in != NULL );
for ( i = 0; i < iAVA; i++ ) {
LDAPAVA *ava = rdn[ i ];
int a, j;
- assert( ava );
+ assert( ava != NULL );
a = strcmp( ava_in->la_attr.bv_val, ava->la_attr.bv_val );
struct berval bv = BER_BVNULL;
int do_sort = 0;
- assert( ava );
+ assert( ava != NULL );
if ( ( ad = AVA_PRIVATE( ava ) ) == NULL ) {
const char *text = NULL;
int iRDN;
int rc;
- assert( dn );
+ assert( dn != NULL );
for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
LDAPRDN rdn = dn[ iRDN ];
int iAVA;
- assert( rdn );
+ assert( rdn != NULL );
for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
LDAPAVA *ava = rdn[ iAVA ];
struct berval bv = BER_BVNULL;
int do_sort = 0;
- assert( ava );
+ assert( ava != NULL );
if ( ( ad = AVA_PRIVATE( ava ) ) == NULL ) {
const char *text = NULL;
struct berval *out,
void *ctx)
{
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> dnNormalize: <%s>\n", val->bv_val, 0, 0 );
struct berval *out,
void *ctx)
{
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> dnNormalize: <%s>\n", val->bv_val, 0, 0 );
if ( val->bv_len != 0 ) {
struct berval *out,
void *ctx)
{
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> dnPretty: <%s>\n", val->bv_val, 0, 0 );
struct berval *out,
void *ctx)
{
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> dnPretty: <%s>\n", val->bv_val, 0, 0 );
int flags,
void *ctx )
{
- assert( val );
- assert( dn );
+ assert( val != NULL );
+ assert( dn != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> dn%sDN: <%s>\n",
flags == SLAP_LDAPDN_PRETTY ? "Pretty" : "Normal",
{
Debug( LDAP_DEBUG_TRACE, ">>> dnPrettyNormal: <%s>\n", val->bv_val, 0, 0 );
- assert( val );
- assert( pretty );
- assert( normal );
+ assert( val != NULL );
+ assert( pretty != NULL );
+ assert( normal != NULL );
if ( val->bv_len == 0 ) {
ber_dupbv_x( pretty, val, ctx );
int match;
struct berval *asserted = (struct berval *) assertedValue;
- assert( matchp );
- assert( value );
- assert( assertedValue );
+ assert( matchp != NULL );
+ assert( value != NULL );
+ assert( assertedValue != NULL );
assert( !BER_BVISNULL( value ) );
assert( !BER_BVISNULL( asserted ) );
int match;
struct berval *asserted = (struct berval *) assertedValue;
- assert( matchp );
- assert( value );
- assert( assertedValue );
+ assert( matchp != NULL );
+ assert( value != NULL );
+ assert( assertedValue != NULL );
assert( !BER_BVISNULL( value ) );
assert( !BER_BVISNULL( asserted ) );
int match;
struct berval *asserted = (struct berval *) assertedValue;
- assert( matchp );
- assert( value );
- assert( assertedValue );
+ assert( matchp != NULL );
+ assert( value != NULL );
+ assert( assertedValue != NULL );
match = value->bv_len - asserted->bv_len;
const char *p;
int rc;
- assert( dn );
- assert( rdn );
+ assert( dn != NULL );
+ assert( rdn != NULL );
if( dn->bv_len == 0 ) {
return LDAP_OTHER;
{
const char *p;
- assert( dn_in );
+ assert( dn_in != NULL );
if ( dn_in == NULL ) {
return 0;
{
int d = dn->bv_len - suffix->bv_len;
- assert( dn );
- assert( suffix );
+ assert( dn != NULL );
+ assert( suffix != NULL );
/* empty suffix matches any dn */
if ( suffix->bv_len == 0 ) {
#include "slap.h"
#include "ldif.h"
-static unsigned char *ebuf; /* buf returned by entry2str */
-static unsigned char *ecur; /* pointer to end of currently used ebuf */
+static char *ebuf; /* buf returned by entry2str */
+static char *ecur; /* pointer to end of currently used ebuf */
static int emaxsize;/* max size of ebuf */
/*
{
int rc;
Entry *e;
- struct berval *nvalsp;
struct berval *type, *vals, *nvals;
char *freeval;
AttributeDescription *ad, *ad_prev;
int j, k;
atail->a_next = (Attribute *) ch_malloc( sizeof(Attribute) );
atail = atail->a_next;
+ atail->a_flags = 0;
atail->a_desc = ad_prev;
atail->a_vals = ch_malloc( (attr_cnt + 1) * sizeof(struct berval));
if( ad_prev->ad_type->sat_equality &&
while ( ecur + (n) > ebuf + emaxsize ) { \
ptrdiff_t offset; \
offset = (int) (ecur - ebuf); \
- ebuf = (unsigned char *) ch_realloc( (char *) ebuf, \
+ ebuf = ch_realloc( ebuf, \
emaxsize + GRABSIZE ); \
emaxsize += GRABSIZE; \
ecur = ebuf + offset; \
/* put "dn: <dn>" */
tmplen = e->e_name.bv_len;
MAKE_SPACE( LDIF_SIZE_NEEDED( 2, tmplen ));
- ldif_sput( (char **) &ecur, LDIF_PUT_VALUE, "dn", e->e_dn, tmplen );
+ ldif_sput( &ecur, LDIF_PUT_VALUE, "dn", e->e_dn, tmplen );
}
/* put the attributes */
bv = &a->a_vals[i];
tmplen = a->a_desc->ad_cname.bv_len;
MAKE_SPACE( LDIF_SIZE_NEEDED( tmplen, bv->bv_len ));
- ldif_sput( (char **) &ecur, LDIF_PUT_VALUE,
+ ldif_sput( &ecur, LDIF_PUT_VALUE,
a->a_desc->ad_cname.bv_val,
bv->bv_val, bv->bv_len );
}
*ecur = '\0';
*len = ecur - ebuf;
- return( (char *) ebuf );
+ return( ebuf );
}
void
#include "slap.h"
#include "lber_pvt.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
#define UNSUPPORTED_EXOP "unsupported extended operation"
struct extop_list *ext = NULL;
struct berval reqdata = BER_BVNULL;
-#if defined(LDAP_SLAPI)
- Slapi_PBlock *pb = op->o_pb;
- SLAPI_FUNC funcAddr = NULL;
- int extop_rc;
- int msg_sent = FALSE;
-#endif /* defined(LDAP_SLAPI) */
-
if (op->ore_reqdata) {
reqdata = *op->ore_reqdata;
}
-#ifdef LDAP_SLAPI
- /* NS-SLAPI extended operation */
- slapi_int_get_extop_plugin( &op->ore_reqoid, &funcAddr );
-
- if( !funcAddr && !(ext = find_extop(supp_ext_list, &op->ore_reqoid )))
-#else
if( !(ext = find_extop(supp_ext_list, &op->ore_reqoid )))
-#endif
{
Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
op->ore_reqoid.bv_val, 0 ,0 );
Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n",
op->ore_reqoid.bv_val, 0 ,0 );
-#if defined(LDAP_SLAPI)
- if ( funcAddr != NULL ) {
- rs->sr_err = slapi_pblock_set( pb, SLAPI_EXT_OP_REQ_OID,
- (void *)op->ore_reqoid.bv_val);
- if ( rs->sr_err != LDAP_SUCCESS ) {
- rs->sr_err = LDAP_OTHER;
- goto done;
- }
-
- rs->sr_err = slapi_pblock_set( pb, SLAPI_EXT_OP_REQ_VALUE,
- (void *)&reqdata);
- if ( rs->sr_err != LDAP_SUCCESS ) {
- rs->sr_err = LDAP_OTHER;
- goto done;
- }
-
- rs->sr_err = slapi_int_pblock_set_operation( pb, op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- rs->sr_err = LDAP_OTHER;
- goto done;
- }
-
- extop_rc = (*funcAddr)( pb );
- if ( extop_rc == SLAPI_PLUGIN_EXTENDED_SENT_RESULT ) {
- msg_sent = TRUE;
-
- } else if ( extop_rc == SLAPI_PLUGIN_EXTENDED_NOT_HANDLED ) {
- rs->sr_err = LDAP_PROTOCOL_ERROR;
- rs->sr_text = UNSUPPORTED_EXOP;
-
- } else {
- rs->sr_err = slapi_pblock_get( pb, SLAPI_EXT_OP_RET_OID,
- &rs->sr_rspoid);
- if ( rs->sr_err != LDAP_SUCCESS ) {
- goto done2;
- }
-
- rs->sr_err = slapi_pblock_get( pb, SLAPI_EXT_OP_RET_VALUE,
- &rs->sr_rspdata);
- if ( rs->sr_err != LDAP_SUCCESS ) {
- goto done2;
- }
-
- rs->sr_err = extop_rc;
- send_ldap_extended( op, rs );
- msg_sent = TRUE;
- }
-
-done2:;
- if ( rs->sr_err != LDAP_SUCCESS && msg_sent == FALSE ) {
- send_ldap_result( op, rs );
- }
-
- if ( rs->sr_rspoid != NULL ) {
- ch_free( (char *)rs->sr_rspoid );
- }
-
- if ( rs->sr_rspdata != NULL ) {
- ber_bvfree( rs->sr_rspdata );
- }
- } else
-#endif /* defined( LDAP_SLAPI ) */
{ /* start of OpenLDAP extended operation */
rs->sr_err = (ext->ext_main)( op, rs );
}
}
+ if ( op->o_bd == NULL )
+ op->o_bd = frontendDB;
send_ldap_extended( op, rs );
if ( rs->sr_ref != default_referral ) {
void *ctx )
{
ber_len_t i;
- assert( in );
- assert( out );
+ assert( in != NULL );
+ assert( out != NULL );
i = in->bv_len * 3 + 1;
out->bv_val = ctx ? slap_sl_malloc( i, ctx ) : ch_malloc( i );
int ret;
const char *text;
- assert( ad );
+ assert( ad != NULL );
if ( mra->ma_desc ) {
/* have a mra type? check for subtype */
}
mr = slap_schema.si_ad_entryDN->ad_type->sat_equality;
- assert( mr );
+ assert( mr != NULL );
rc = value_match( &match, slap_schema.si_ad_entryDN, mr,
SLAP_MR_EXT, &e->e_nname, &ava->aa_value, &text );
#include "ldap_rq.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
static BackendInfo slap_frontendInfo;
static BackendDB slap_frontendDB;
BackendDB *frontendDB;
frontendDB->bd_info->bi_op_modrdn = fe_op_modrdn;
frontendDB->bd_info->bi_op_search = fe_op_search;
frontendDB->bd_info->bi_extended = fe_extended;
+ frontendDB->bd_info->bi_operational = fe_aux_operational;
+#if 0
+ frontendDB->bd_info->bi_entry_get_rw = fe_entry_get_rw;
+ frontendDB->bd_info->bi_entry_release_rw = fe_entry_release_rw;
+#endif
+#ifdef SLAP_OVERLAY_ACCESS
+ frontendDB->bd_info->bi_access_allowed = fe_access_allowed;
+ frontendDB->bd_info->bi_acl_group = fe_acl_group;
+ frontendDB->bd_info->bi_acl_attribute = fe_acl_attribute;
+#endif /* SLAP_OVERLAY_ACCESS */
#if 0
/* FIXME: is this too early? */
if( rc == 0 ) {
Slapi_PBlock *pb = slapi_pblock_new();
- if ( slapi_int_call_plugins( NULL, SLAPI_PLUGIN_START_FN, pb ) < 0 ) {
+ if ( slapi_int_call_plugins( frontendDB, SLAPI_PLUGIN_START_FN, pb ) < 0 ) {
rc = -1;
}
slapi_pblock_destroy( pb );
#ifdef LDAP_SLAPI
pb = slapi_pblock_new();
- (void) slapi_int_call_plugins( NULL, SLAPI_PLUGIN_CLOSE_FN, pb );
+ (void) slapi_int_call_plugins( frontendDB, SLAPI_PLUGIN_CLOSE_FN, pb );
slapi_pblock_destroy( pb );
#endif /* LDAP_SLAPI */
int
slap_parse_sync_cookie(
- struct sync_cookie *cookie
+ struct sync_cookie *cookie,
+ void *memctx
)
{
char *csn_ptr;
int csn_str_len;
int valid = 0;
char *rid_ptr;
- char *rid_str;
char *cval;
if ( cookie == NULL )
return -1;
+ cookie->rid = -1;
+ if (( rid_ptr = strstr( cookie->octet_str.bv_val, "rid=" )) != NULL ) {
+ if ( (cval = strchr( rid_ptr, ',' )) != NULL ) {
+ *cval = '\0';
+ }
+ cookie->rid = atoi( rid_ptr + sizeof("rid=") - 1 );
+ if ( cval != NULL ) {
+ *cval = ',';
+ }
+ } else {
+ return -1;
+ }
+
while (( csn_ptr = strstr( cookie->octet_str.bv_val, "csn=" )) != NULL ) {
AttributeDescription *ad = slap_schema.si_ad_modifyTimestamp;
slap_syntax_validate_func *validate;
struct berval stamp;
+ /* This only happens when called from main */
+ if ( ad == NULL )
+ break;
+
csn_str = csn_ptr + STRLENOF("csn=");
cval = strchr( csn_str, ',' );
if ( cval )
break;
}
if ( valid ) {
- ber_str2bv( csn_str, csn_str_len, 1, &cookie->ctxcsn );
+ ber_str2bv_x( csn_str, csn_str_len, 1, &cookie->ctxcsn, memctx );
} else {
BER_BVZERO( &cookie->ctxcsn );
}
- if (( rid_ptr = strstr( cookie->octet_str.bv_val, "rid=" )) != NULL ) {
- rid_str = SLAP_STRNDUP( rid_ptr,
- SLAP_SYNC_RID_SIZE + sizeof("rid=") - 1 );
- if ( (cval = strchr( rid_str, ',' )) != NULL ) {
- *cval = '\0';
- }
- cookie->rid = atoi( rid_str + sizeof("rid=") - 1 );
- ch_free( rid_str );
- } else {
- cookie->rid = -1;
- }
return 0;
}
struct sync_cookie *src
)
{
- int i;
struct sync_cookie *new;
- struct berval tmp_bv;
if ( src == NULL )
return NULL;
{
struct slap_limits **lm;
- assert( op );
- assert( limit );
+ assert( op != NULL );
+ assert( limit != NULL );
Debug( LDAP_DEBUG_TRACE, "==> limits_get: %s dn=\"%s\"\n",
op->o_log_prefix,
switch ( style ) {
case SLAP_LIMITS_EXACT:
- if ( ndn->bv_len == 0 ) {
+ if ( BER_BVISEMPTY( ndn ) ) {
break;
}
case SLAP_LIMITS_CHILDREN: {
size_t d;
- if ( ndn->bv_len == 0 ) {
+ if ( BER_BVISEMPTY( ndn ) ) {
break;
}
}
} else {
/* check for unescaped rdn separator */
- if ( !DN_SEPARATOR( ndn->bv_val[d-1] ) ) {
+ if ( !DN_SEPARATOR( ndn->bv_val[d - 1] ) ) {
break;
}
}
}
case SLAP_LIMITS_REGEX:
- if ( ndn->bv_len == 0 ) {
+ if ( BER_BVISEMPTY( ndn ) ) {
break;
}
if ( regexec( &lm[0]->lm_regex, ndn->bv_val,
break;
case SLAP_LIMITS_ANONYMOUS:
- if ( ndn->bv_len == 0 ) {
+ if ( BER_BVISEMPTY( ndn ) ) {
Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s\n",
limits2str( style ), 0, 0 );
*limit = &lm[0]->lm_limits;
break;
case SLAP_LIMITS_USERS:
- if ( ndn->bv_len != 0 ) {
+ if ( !BER_BVISEMPTY( ndn ) ) {
*limit = &lm[0]->lm_limits;
Debug( LDAP_DEBUG_TRACE, "<== limits_get: type=DN match=%s\n",
limits2str( style ), 0, 0 );
struct slap_limits *lm;
unsigned type, style;
- assert( be );
- assert( limit );
+ assert( be != NULL );
+ assert( limit != NULL );
type = flags & SLAP_LIMITS_TYPE_MASK;
style = flags & SLAP_LIMITS_MASK;
{
int rc;
struct berval bv;
- bv.bv_val = (char *) pattern;
- bv.bv_len = strlen( pattern );
+
+ ber_str2bv( pattern, 0, 0, &bv );
rc = dnNormalize( 0, NULL, NULL, &bv, &lm->lm_pat, NULL );
if ( rc != LDAP_SUCCESS ) {
case SLAP_LIMITS_USERS:
case SLAP_LIMITS_ANY:
lm->lm_flags = style | type;
- lm->lm_pat.bv_val = NULL;
- lm->lm_pat.bv_len = 0;
+ BER_BVZERO( &lm->lm_pat );
break;
}
switch ( type ) {
case SLAP_LIMITS_TYPE_GROUP:
- assert( group_oc );
- assert( group_ad );
+ assert( group_oc != NULL );
+ assert( group_ad != NULL );
lm->lm_group_oc = group_oc;
lm->lm_group_ad = group_ad;
break;
ObjectClass *group_oc = NULL;
AttributeDescription *group_ad = NULL;
- assert( be );
+ assert( be != NULL );
if ( argc < 3 ) {
Debug( LDAP_DEBUG_ANY,
struct slap_limits_set *limit
)
{
- assert( arg );
- assert( limit );
+ assert( arg != NULL );
+ assert( limit != NULL );
if ( strncasecmp( arg, "time", STRLENOF( "time" ) ) == 0 ) {
arg += STRLENOF( "time" );
int
limits_check( Operation *op, SlapReply *rs )
{
- assert( op );
- assert( rs );
+ assert( op != NULL );
+ assert( rs != NULL );
/* FIXME: should this be always true? */
assert( op->o_tag == LDAP_REQ_SEARCH);
return 0;
}
+void
+limits_destroy(
+ struct slap_limits **lm )
+{
+ int i;
+
+ if ( lm == NULL ) {
+ return;
+ }
+
+ for ( i = 0; lm[ i ]; i++ ) {
+ switch ( lm[ i ]->lm_flags & SLAP_LIMITS_MASK ) {
+ case SLAP_LIMITS_REGEX:
+ regfree( &lm[ i ]->lm_regex );
+ break;
+
+ case SLAP_LIMITS_EXACT:
+ case SLAP_LIMITS_ONE:
+ case SLAP_LIMITS_SUBTREE:
+ case SLAP_LIMITS_CHILDREN:
+ if ( !BER_BVISNULL( &lm[ i ]->lm_pat ) ) {
+ ch_free( lm[ i ]->lm_pat.bv_val );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ ch_free( lm[ i ] );
+ }
+
+ ch_free( lm );
+}
#include <stdio.h>
+#include <ac/ctype.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>
const char *oh_usage;
} option_helpers[] = {
{ BER_BVC("slp"), slapd_opt_slp, NULL, "slp[={on|off}] enable/disable SLP" },
- { BER_BVNULL }
+ { BER_BVNULL, 0, NULL, NULL }
};
static void
scp = (struct sync_cookie *) ch_calloc( 1,
sizeof( struct sync_cookie ));
ber_str2bv( optarg, 0, 1, &scp->octet_str );
- slap_parse_sync_cookie( scp );
+
+ /* This only parses out the rid at this point */
+ slap_parse_sync_cookie( scp, NULL );
+
+ if ( scp->rid == -1 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "main: invalid cookie \"%s\"\n",
+ optarg, 0, 0 );
+ slap_sync_cookie_free( scp, 1 );
+ goto destroy;
+ }
LDAP_STAILQ_FOREACH( scp_entry, &slap_sync_cookie, sc_next ) {
if ( scp->rid == scp_entry->rid ) {
case 'd': /* set debug level and 'do not detach' flag */
no_detach = 1;
#ifdef LDAP_DEBUG
- slap_debug |= atoi( optarg );
+ if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
+ {
+ int level;
+
+ if ( str2loglevel( optarg, &level ) ) {
+ fprintf( stderr,
+ "unrecognized log level "
+ "\"%s\"\n", optarg );
+ goto destroy;
+ }
+
+ slap_debug |= level;
+ } else {
+ slap_debug |= atoi( optarg );
+ }
#else
if ( atoi( optarg ) != 0 )
fputs( "must compile with LDAP_DEBUG for debugging\n",
(void) ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &rc );
#endif
-#ifdef LDAP_SLAPI
- if ( slapi_int_initialize() != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "slapi initialization error\n",
- 0, 0, 0 );
-
- goto destroy;
- }
-#endif /* LDAP_SLAPI */
-
if ( frontend_init() ) {
goto destroy;
}
config_destroy();
+ if ( configfile )
+ ch_free( configfile );
+ if ( configdir )
+ ch_free( configdir );
+ if ( urls )
+ ch_free( urls );
+
#ifdef CSRIMALLOC
mal_dumpleaktrace( leakfile );
#endif
#include <ac/time.h>
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
#include "lutil.h"
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
- if ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist );
+ if ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist, 1 );
return rs->sr_err;
}
int manageDSAit;
Modifications *modlist = op->orm_modlist;
Modifications **modtail = &modlist;
-#ifdef LDAP_SLAPI
- LDAPMod **modv = NULL;
-#endif
int increment = op->orm_increment;
- int rc = 0;
BackendDB *op_be;
char textbuf[ SLAP_TEXT_BUFLEN ];
size_t textlen = sizeof( textbuf );
"modify/increment not supported in context" );
}
-#if defined( LDAP_SLAPI )
-#define pb op->o_pb
- if ( pb ) {
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
- modv = slapi_int_modifications2ldapmods( &modlist );
- slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
-
- rs->sr_err = slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
-
- /*
- * It's possible that the preoperation plugin changed the
- * modification array, so we need to convert it back to
- * a Modification list.
- *
- * Calling slapi_int_modifications2ldapmods() destroyed modlist so
- * we don't need to free it.
- */
- slapi_pblock_get( pb, SLAPI_MODIFY_MODS, (void **)&modv );
- modlist = slapi_int_ldapmods2modifications( modv );
-
- if ( rs->sr_err < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE,
- "do_modify: modify preoperation plugin failed.\n",
- 0, 0, 0);
- if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE,
- (void *)&rs->sr_err ) != 0 ) || rs->sr_err == LDAP_SUCCESS )
- {
- rs->sr_err = LDAP_OTHER;
- }
- slapi_int_free_ldapmods( modv );
- modv = NULL;
- goto cleanup;
- }
- }
-
- /*
- * NB: it is valid for the plugin to return no modifications
- * (for example, a plugin might store some attributes elsewhere
- * and remove them from the modification list; if only those
- * attribute types were included in the modification request,
- * then slapi_int_ldapmods2modifications() above will return
- * NULL).
- *
- * However, the post-operation plugin should still be
- * called.
- */
-#endif /* defined( LDAP_SLAPI ) */
-
/*
* do the modify if 1 && (2 || 3)
* 1) there is a modify function implemented in this backend;
"operation not supported within namingContext" );
}
-#if defined( LDAP_SLAPI )
- if ( pb != NULL && slapi_int_call_plugins( op->o_bd,
- SLAPI_PLUGIN_POST_MODIFY_FN, pb ) < 0 )
- {
- Debug(LDAP_DEBUG_TRACE,
- "do_modify: modify postoperation plugins failed.\n", 0, 0, 0);
- }
-#endif /* defined( LDAP_SLAPI ) */
-
cleanup:;
-#if defined( LDAP_SLAPI )
- if ( modv != NULL ) slapi_int_free_ldapmods( modv );
-#endif
-
return rs->sr_err;
}
return LDAP_SUCCESS;
}
+int
+slap_mods_no_repl_user_mod_check(
+ Operation *op,
+ Modifications *ml,
+ const char **text,
+ char *textbuf,
+ size_t textlen )
+{
+ Modifications *mods;
+ Modifications *modp;
+
+ for ( mods = ml; mods != NULL; mods = mods->sml_next ) {
+ assert( mods->sml_op == LDAP_MOD_ADD );
+
+ /* check doesn't already appear */
+ for ( modp = ml; modp != NULL; modp = modp->sml_next ) {
+ if ( mods->sml_desc == modp->sml_desc && mods != modp ) {
+ snprintf( textbuf, textlen,
+ "attribute '%s' provided more than once",
+ mods->sml_desc->ad_cname.bv_val );
+ return LDAP_TYPE_OR_VALUE_EXISTS;
+ }
+ }
+ }
+
+ return LDAP_SUCCESS;
+}
+
/*
* Do basic attribute type checking and syntax validation.
*/
AttributeDescription *ad = NULL;
/* convert to attribute description */
- rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
-
- if( rc != LDAP_SUCCESS ) {
- snprintf( textbuf, textlen, "%s: %s",
- ml->sml_type.bv_val, *text );
- *text = textbuf;
- return rc;
+ if ( ml->sml_desc == NULL ) {
+ rc = slap_bv2ad( &ml->sml_type, &ml->sml_desc, text );
+ if( rc != LDAP_SUCCESS ) {
+ snprintf( textbuf, textlen, "%s: %s",
+ ml->sml_type.bv_val, *text );
+ *text = textbuf;
+ return rc;
+ }
}
ad = ml->sml_desc;
ber_dupbv( &mod->sml_values[0], &tmpval );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &tmpval );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
- assert( mod->sml_nvalues[0].bv_val );
+ assert( mod->sml_nvalues[0].bv_val != NULL );
*modtail = mod;
modtail = &mod->sml_next;
}
ber_dupbv( &mod->sml_values[0], &tmpval );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
(*mod->sml_desc->ad_type->sat_equality->smr_normalize)(
ber_dupbv( &mod->sml_values[0], &name );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
- assert( mod->sml_nvalues[0].bv_val );
+ assert( mod->sml_nvalues[0].bv_val != NULL );
*modtail = mod;
modtail = &mod->sml_next;
ber_dupbv( &mod->sml_values[0], ×tamp );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues = NULL;
*modtail = mod;
modtail = &mod->sml_next;
ber_dupbv( &mod->sml_values[0], &csn );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues = NULL;
*modtail = mod;
modtail = &mod->sml_next;
ber_dupbv( &mod->sml_values[0], &name );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues =
(BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
ber_dupbv( &mod->sml_nvalues[0], &nname );
mod->sml_nvalues[1].bv_len = 0;
mod->sml_nvalues[1].bv_val = NULL;
- assert( mod->sml_nvalues[0].bv_val );
+ assert( mod->sml_nvalues[0].bv_val != NULL );
*modtail = mod;
modtail = &mod->sml_next;
ber_dupbv( &mod->sml_values[0], ×tamp );
mod->sml_values[1].bv_len = 0;
mod->sml_values[1].bv_val = NULL;
- assert( mod->sml_values[0].bv_val );
+ assert( mod->sml_values[0].bv_val != NULL );
mod->sml_nvalues = NULL;
*modtail = mod;
modtail = &mod->sml_next;
#include <ac/string.h>
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
int
do_modrdn(
}
}
-#if defined( LDAP_SLAPI )
-#define pb op->o_pb
- if ( pb ) {
- slapi_int_pblock_set_operation( pb, op );
- slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)op->orr_newrdn.bv_val );
- slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR,
- (void *)op->orr_newSup->bv_val );
- slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)op->orr_deleteoldrdn);
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
-
- rs->sr_err = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_MODRDN_FN, pb );
- if ( rs->sr_err < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn preoperation plugin "
- "failed.\n", 0, 0, 0);
- if ( ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
- rs->sr_err == LDAP_SUCCESS ) {
- rs->sr_err = LDAP_OTHER;
- }
- goto cleanup;
- }
- }
-#endif /* defined( LDAP_SLAPI ) */
-
/*
* do the modrdn if 1 && (2 || 3)
* 1) there is a modrdn function implemented in this backend;
"operation not supported within namingContext" );
}
-#if defined( LDAP_SLAPI )
- if ( pb != NULL && slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_MODRDN_FN, pb ) < 0 ) {
- Debug(LDAP_DEBUG_TRACE, "do_modrdn: modrdn postoperation plugins "
- "failed.\n", 0, 0, 0);
- }
-#endif /* defined( LDAP_SLAPI ) */
-
cleanup:;
return rs->sr_err;
}
for ( p = i = 0; !BER_BVISNULL( &mod->sm_values[i] ); i++ ) {
int match;
- assert( a->a_vals[0].bv_val );
+ assert( a->a_vals[0].bv_val != NULL );
for ( j = 0; !BER_BVISNULL( &a->a_vals[j] ); j++ ) {
if ( mod->sm_nvalues ) {
rc = ordered_value_match( &match, mod->sm_desc, mr,
}
if( mod->sm_nvalues ) {
- assert( a->a_nvals );
+ assert( a->a_nvals != NULL );
rc = ordered_value_match( &match, a->a_desc, mr,
SLAP_MR_EQUALITY | SLAP_MR_VALUE_OF_ASSERTION_SYNTAX
| SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
void
slap_mods_free(
- Modifications *ml )
+ Modifications *ml,
+ int freevals )
{
Modifications *next;
for ( ; ml != NULL; ml = next ) {
next = ml->sml_next;
- slap_mod_free( &ml->sml_mod, 0 );
+ if ( freevals )
+ slap_mod_free( &ml->sml_mod, 0 );
free( ml );
}
}
struct berval type = BER_BVNULL;
struct berval value = BER_BVNULL;
struct berval rule_text = BER_BVNULL;
- MatchingRuleAssertion ma;
+ MatchingRuleAssertion ma = { 0 };
#ifdef LDAP_COMP_MATCH
AttributeAliasing* aa = NULL;
#endif
- memset( &ma, 0, sizeof ma);
-
rtag = ber_scanf( ber, "{t" /*"}"*/, &tag );
if( rtag == LBER_ERROR ) {
if (o->soc_sups) ldap_memfree(o->soc_sups);
if (o->soc_required) ldap_memfree(o->soc_required);
if (o->soc_allowed) ldap_memfree(o->soc_allowed);
+ if (o->soc_oidmacro) ldap_memfree(o->soc_oidmacro);
ldap_objectclass_free((LDAPObjectClass *)o);
}
oir->oir_name.bv_len = strlen( soc->soc_oid );
oir->oir_oc = soc;
- assert( oir->oir_name.bv_val );
- assert( oir->oir_oc );
+ assert( oir->oir_name.bv_val != NULL );
+ assert( oir->oir_oc != NULL );
if ( avl_insert( &oc_index, (caddr_t) oir,
oc_index_cmp, avl_dup_error ) )
oir->oir_name.bv_len = strlen( *names );
oir->oir_oc = soc;
- assert( oir->oir_name.bv_val );
- assert( oir->oir_oc );
+ assert( oir->oir_name.bv_val != NULL );
+ assert( oir->oir_oc != NULL );
if ( avl_insert( &oc_index, (caddr_t) oir,
oc_index_cmp, avl_dup_error ) )
ObjectClass *oc;
int i, num;
struct berval bv, *bva = NULL, idx;
- char ibuf[32], *ptr;
+ char ibuf[32];
if ( !start )
start = LDAP_STAILQ_FIRST( &oc_list );
return 1;
}
- om = (OidMacro *) SLAP_MALLOC( sizeof(OidMacro) );
+ om = (OidMacro *) SLAP_CALLOC( sizeof(OidMacro), 1 );
if( om == NULL ) {
- Debug( LDAP_DEBUG_ANY, "parse_oidm: SLAP_MALLOC failed", 0, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "parse_oidm: SLAP_CALLOC failed", 0, 0, 0 );
return 1;
}
{
OidMacro *om;
int i, j, num;
- struct berval bv, *bva = NULL, idx;
+ struct berval *bva = NULL, idx;
char ibuf[32], *ptr;
if ( !start )
void
slap_op_free( Operation *op )
{
- struct berval slap_empty_bv_dup;
-
assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
if ( op->o_ber != NULL ) {
ber_free( op->o_ber, 1 );
}
if ( !BER_BVISNULL( &op->o_dn ) ) {
- free( op->o_dn.bv_val );
+ ch_free( op->o_dn.bv_val );
}
if ( !BER_BVISNULL( &op->o_ndn ) ) {
- free( op->o_ndn.bv_val );
+ ch_free( op->o_ndn.bv_val );
}
if ( !BER_BVISNULL( &op->o_authmech ) ) {
- free( op->o_authmech.bv_val );
+ ch_free( op->o_authmech.bv_val );
}
if ( op->o_ctrls != NULL ) {
slap_free_ctrls( op, op->o_ctrls );
}
#if defined( LDAP_SLAPI )
- if ( op->o_pb != NULL ) {
- slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
+ if ( slapi_plugins_used ) {
slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
)
{
Operation *op;
- struct berval slap_empty_bv_dup;
ldap_pvt_thread_mutex_lock( &slap_op_mutex );
if ((op = LDAP_STAILQ_FIRST( &slap_free_ops ))) {
#if defined( LDAP_SLAPI )
if ( slapi_plugins_used ) {
- op->o_pb = slapi_pblock_new();
slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
{
Attribute *a;
- assert( e );
+ assert( e != NULL );
assert( !BER_BVISNULL( &e->e_name ) );
assert( !BER_BVISNULL( &e->e_nname ) );
#define LOG_OP_UNBIND 0x080
#define LOG_OP_ABANDON 0x100
#define LOG_OP_EXTENDED 0x200
+#define LOG_OP_UNKNOWN 0x400
#define LOG_OP_WRITES (LOG_OP_ADD|LOG_OP_DELETE|LOG_OP_MODIFY|LOG_OP_MODRDN)
#define LOG_OP_READS (LOG_OP_COMPARE|LOG_OP_SEARCH)
#define LOG_OP_SESSION (LOG_OP_BIND|LOG_OP_UNBIND|LOG_OP_ABANDON)
-#define LOG_OP_ALL (LOG_OP_READS|LOG_OP_WRITES|LOG_OP_SESSION|LOG_OP_EXTENDED)
+#define LOG_OP_ALL (LOG_OP_READS|LOG_OP_WRITES|LOG_OP_SESSION| \
+ LOG_OP_EXTENDED|LOG_OP_UNKNOWN)
typedef struct log_info {
BackendDB *li_db;
{ BER_BVC("unbind"), LOG_OP_UNBIND },
{ BER_BVC("abandon"), LOG_OP_ABANDON },
{ BER_BVC("extended"), LOG_OP_EXTENDED },
+ { BER_BVC("unknown"), LOG_OP_UNKNOWN },
{ BER_BVNULL, 0 }
};
LOG_EN_UNBIND,
LOG_EN_ABANDON,
LOG_EN_EXTENDED,
+ LOG_EN_UNKNOWN,
LOG_EN__COUNT
};
*ad_reqNewSuperior, *ad_reqDeleteOldRDN, *ad_reqMod,
*ad_reqScope, *ad_reqFilter, *ad_reqAttr, *ad_reqEntries,
*ad_reqSizeLimit, *ad_reqTimeLimit, *ad_reqAttrsOnly, *ad_reqData,
- *ad_reqId, *ad_reqMessage, *ad_oldest;
+ *ad_reqId, *ad_reqMessage;
+#if 0
+static AttributeDescription *ad_oldest;
+#endif
static struct {
char *at;
static int
log_age_parse(char *agestr)
{
- char *ptr;
int t1, t2;
int gotdays = 0;
case LDAP_REQ_SEARCH: logop = LOG_EN_SEARCH; break;
case LDAP_REQ_BIND: logop = LOG_EN_BIND; break;
case LDAP_REQ_EXTENDED: logop = LOG_EN_EXTENDED; break;
+ default: /* unknown operation type */
+ logop = LOG_EN_UNKNOWN; break;
} /* Unbind and Abandon never reach here */
lo = logops+logop+EN_OFFSET;
if ( m->sml_values ) {
for (b=m->sml_values; !BER_BVISNULL( b ); b++,i++) {
char c_op;
- vals[i].bv_len = a->a_desc->ad_cname.bv_len + b->bv_len +3;
+ vals[i].bv_len = m->sml_desc->ad_cname.bv_len + b->bv_len +3;
vals[i].bv_val = ch_malloc( vals[i].bv_len+1 );
ptr = lutil_strcopy( vals[i].bv_val,
- a->a_desc->ad_cname.bv_val );
+ m->sml_desc->ad_cname.bv_val );
*ptr++ = ':';
switch( m->sml_op ) {
case LDAP_MOD_ADD: c_op = '+'; break;
case LDAP_MOD_DELETE: c_op = '-'; break;
case LDAP_MOD_REPLACE: c_op = '='; break;
case LDAP_MOD_INCREMENT: c_op = '#'; break;
+
+ /* unknown op. there shouldn't be any of these. we
+ * don't know what to do with it, but we shouldn't just
+ * ignore it.
+ */
+ default: c_op = '?'; break;
}
*ptr++ = c_op;
*ptr++ = ' ';
vals[i].bv_val[vals[i].bv_len] = '\0';
}
} else if ( m->sml_op == LDAP_MOD_DELETE ) {
- vals[i].bv_len = a->a_desc->ad_cname.bv_len + 2;
+ vals[i].bv_len = m->sml_desc->ad_cname.bv_len + 2;
vals[i].bv_val = ch_malloc( vals[i].bv_len+1 );
ptr = lutil_strcopy( vals[i].bv_val,
a->a_desc->ad_cname.bv_val );
attr_merge_one( e, ad_reqData, op->ore_reqdata, NULL );
}
break;
+
+ case LOG_EN_UNKNOWN:
+ /* we don't know its parameters, don't add any */
+ break;
}
op2.o_hdr = op->o_hdr;
char *ptr;
- assert( oldf );
- assert( newf );
+ assert( oldf != NULL );
+ assert( newf != NULL );
assert( !BER_BVISNULL( oldf ) );
assert( !BER_BVISEMPTY( oldf ) );
SlapReply r = { REP_SEARCH };
struct berval *url;
Entry *e;
- int e_flags;
+ slap_mask_t e_flags;
int opattrs,
userattrs;
dynlist_sc_t dlc = { 0 };
int i;
for (i = 0; i<gi->gi_nodes; i++) {
- assert( gi->gi_n[i].gn_be->be_nsuffix );
+ assert( gi->gi_n[i].gn_be->be_nsuffix != NULL );
if (dnIsSuffix(dn, &gi->gi_n[i].gn_be->be_nsuffix[0])) {
return gi->gi_n[i].gn_be;
return 0;
}
-enum glue_which {
- op_modify = 0,
- op_modrdn,
- op_add,
- op_delete
-};
-
static int
glue_op_func ( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
- glueinfo *gi = (glueinfo *)on->on_bi.bi_private;
BackendDB *b0 = op->o_bd;
BackendInfo *bi0 = op->o_bd->bd_info;
BI_op_modify **func;
- enum glue_which which;
+ slap_operation_t which;
int rc;
op->o_bd = glue_back_select (b0, &op->o_req_ndn);
case LDAP_REQ_MODRDN: which = op_modrdn; break;
}
- func = &op->o_bd->bd_info->bi_op_modify;
+ func = &op->o_bd->bd_info->bi_op_bind;
if ( func[which] )
rc = func[which]( op, rs );
else
glue_chk_referrals ( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
- glueinfo *gi = (glueinfo *)on->on_bi.bi_private;
BackendDB *b0 = op->o_bd;
BackendInfo *bi0 = op->o_bd->bd_info;
int rc;
glue_chk_controls ( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
- glueinfo *gi = (glueinfo *)on->on_bi.bi_private;
BackendDB *b0 = op->o_bd;
BackendInfo *bi0 = op->o_bd->bd_info;
int rc = SLAP_CB_CONTINUE;
}
op->o_bd = btmp;
- assert( op->o_bd->be_suffix );
- assert( op->o_bd->be_nsuffix );
+ assert( op->o_bd->be_suffix != NULL );
+ assert( op->o_bd->be_nsuffix != NULL );
if (scope0 == LDAP_SCOPE_ONELEVEL &&
dn_match(pdn, &ndn))
BackendInfo *bi
)
{
- slap_overinst *on = glue_tool_inst( bi );
- glueinfo *gi = on->on_bi.bi_private;
static int glueClosed = 0;
- int i, rc = 0;
+ int rc = 0;
if (glueClosed) return 0;
)
{
BackendDB *be, b2;
- int rc = NOID;
+ int rc = -1;
b2 = *b0;
b2.bd_info = (BackendInfo *)glue_tool_inst( b0->bd_info );
SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_GLUE_INSTANCE;
if ( strcasecmp( argv[0], "glue-sub" ) == 0 ) {
- int i, async = 0, advertise = 0;
- BackendDB *b2;
- struct berval bv, dn;
- gluenode *gn;
+ int i, async = 0, advertise = 0;
+ BackendDB *b2;
+ struct berval bv, dn = BER_BVNULL;
if ( argc < 2 ) {
fprintf( stderr, "%s: line %d: too few arguments in "
return -1;
}
b2 = select_backend( &dn, 0, 1 );
+ ber_memfree( dn.bv_val );
if ( !b2 ) {
fprintf( stderr, "%s: line %d: unknown suffix \"%s\"\n",
fname, lineno, argv[1] );
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
lastmod_info_t *lmi = (lastmod_info_t *)on->on_bi.bi_private;
- unsigned i;
Modifications *ml;
if ( dn_match( &op->o_req_ndn, &lmi->lmi_e->e_nname ) ) {
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
lastmod_info_t *lmi = (lastmod_info_t *)on->on_bi.bi_private;
- unsigned int i;
/* don't record failed operations */
switch ( rs->sr_err ) {
}
ldap_pvt_thread_mutex_unlock( &lmi->lmi_entry_mutex );
-process:;
(void)lastmod_update( op, rs );
return SLAP_CB_CONTINUE;
#include "slap.h"
+#if SLAPD_OVER_ACCESSLOG == SLAPD_MOD_STATIC
+extern int accesslog_init();
+#endif
#if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
extern int denyop_init();
#endif
char *name;
int (*func)();
} funcs[] = {
+#if SLAPD_OVER_ACCESSLOG == SLAPD_MOD_STATIC
+ { "Access Log", accesslog_init },
+#endif
#if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
{ "Deny Operation", denyop_init },
#endif
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = modlist;
op->o_bd->be_modify( op, &sreply );
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
} else if ( rc == LDAP_REFERRAL ||
rc == LDAP_NO_SUCH_OBJECT ) {
syncrepl_add_glue( op, e );
"DESC 'Filter template, attrset, and cache TTL' "
"SYNTAX OMsDirectoryString )", NULL, NULL },
{ "response-callback", "head|tail(default)",
- 2, 2, 0, ARG_MAGIC|ARG_STRING|PC_RESP, pc_cf_gen,
+ 2, 2, 0, ARG_MAGIC|PC_RESP, pc_cf_gen,
"( OLcfgOvAt:2.4 NAME 'olcProxyResponseCB' "
"DESC 'Response callback position in overlay stack' "
"SYNTAX OMsDirectoryString )", NULL, NULL },
break;
case PC_RESP:
if ( cm->response_cb == PCACHE_RESPONSE_CB_HEAD ) {
- bv.bv_val = "head";
- bv.bv_len = STRLENOF("head");
+ BER_BVSTR( &bv, "head" );
} else {
- bv.bv_val = "tail";
- bv.bv_len = STRLENOF("tail");
+ BER_BVSTR( &bv, "tail" );
}
value_add_one( &c->rvalue_vals, &bv );
break;
slap_overinst *on = (slap_overinst *)be->bd_info;
cache_manager *cm = on->on_bi.bi_private;
query_manager *qm = cm->qm;
- int rc = 0;
- if ( cm->db.bd_info->bi_db_destroy ) {
- rc = cm->db.bd_info->bi_db_destroy( &cm->db );
- }
- ldap_pvt_thread_mutex_destroy(&qm->lru_mutex);
- ldap_pvt_thread_mutex_destroy(&cm->cache_mutex);
- ldap_pvt_thread_mutex_destroy(&cm->remove_mutex);
+ /* cleanup stuff inherited from the original database... */
+ cm->db.be_suffix = NULL;
+ cm->db.be_nsuffix = NULL;
+ BER_BVZERO( &cm->db.be_rootdn );
+ BER_BVZERO( &cm->db.be_rootndn );
+ BER_BVZERO( &cm->db.be_rootpw );
+ /* FIXME: there might be more... */
+
+ backend_destroy_one( &cm->db, 0 );
+
+ ldap_pvt_thread_mutex_destroy( &qm->lru_mutex );
+ ldap_pvt_thread_mutex_destroy( &cm->cache_mutex );
+ ldap_pvt_thread_mutex_destroy( &cm->remove_mutex );
free( qm );
free( cm );
- return rc;
+
+ return 0;
}
static slap_overinst proxy_cache;
PassPolicy *pp, Modifications **mod )
{
Attribute *la;
- int rc;
- Entry *de;
- assert(mod);
+ assert(mod != NULL);
if ( (la = attr_find( e->e_attrs, ad_pwdAccountLockedTime )) != NULL ) {
BerVarray vals = la->a_nvals;
*/
if (vals[0].bv_val != NULL) {
time_t then, now;
- struct berval bv;
Modifications *m;
if (!pp->pwdLockoutDuration)
pp_info *pi = on->on_bi.bi_private;
Attribute *a;
BerVarray vals;
- int i, rc, nent;
+ int rc;
Entry *pe = NULL;
- AttributeDescription *oca = slap_schema.si_ad_objectClass;
+#if 0
const char *text;
- AttributeDescription *ad;
- struct berval bv;
+#endif
memset( pp, 0, sizeof(PassPolicy) );
{
int rc = LDAP_SUCCESS, ok = LDAP_SUCCESS;
char *ptr = cred->bv_val;
- char *modpath;
struct berval sch;
assert( cred != NULL );
slap_overinst *on = ppb->on;
Modifications *mod = ppb->mod, *m;
int pwExpired = 0;
- int ngut = -1, warn = -1, age, rc, i;
+ int ngut = -1, warn = -1, age, rc;
Attribute *a;
- time_t now, then, pwtime = (time_t)-1;
- const char *txt;
+ time_t now, pwtime = (time_t)-1;
char nowstr[ LDAP_LUTIL_GENTIME_BUFSIZE ];
struct berval timestamp;
BackendInfo *bi = op->o_bd->bd_info;
op2.o_ndn = op->o_bd->be_rootndn;
op2.o_bd->bd_info = (BackendInfo *)on->on_info;
rc = op->o_bd->be_modify( &op2, &r2 );
- slap_mods_free( mod );
+ slap_mods_free( mod, 1 );
}
if ( ppb->send_ctrl ) {
/* Root bypasses policy */
if ( !be_isroot_dn( op->o_bd, &op->o_req_ndn )) {
Entry *e;
- int i, rc;
+ int rc;
ppbind *ppb;
slap_callback *cb;
SlapReply *rs )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
- int i, send_ctrl = 0;
+ int send_ctrl = 0;
/* Did we receive a password policy request control? */
if ( op->o_ctrlflag[ppolicy_cid] ) {
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
pp_info *pi = on->on_bi.bi_private;
PassPolicy pp;
- int pw;
Attribute *pa;
const char *txt;
ppolicy_get( op, op->ora_e, &pp );
if (pp.pwdCheckQuality > 0 && !be_isroot( op )) {
struct berval *bv = &(pa->a_vals[0]);
- int rc, i, send_ctrl = 0;
+ int rc, send_ctrl = 0;
LDAPPasswordPolicyError pErr = PP_noError;
/* Did we receive a password policy request control? */
hsize = 0;
PassPolicy pp;
Modifications *mods = NULL, *modtail, *ml, *delmod, *addmod;
- Attribute *pa, *ha, *ra, at;
+ Attribute *pa, *ha, at;
const char *txt;
pw_hist *tl = NULL, *p;
int zapReset, send_ctrl = 0;
if (pp.pwdInHistory > 0 && (ha = attr_find( e->e_attrs, ad_pwdHistory ))) {
struct berval oldpw;
time_t oldtime;
- char *oid;
for(i=0; ha->a_nvals[i].bv_val; i++) {
rc = parse_pwdhistory( &(ha->a_nvals[i]), NULL,
struct berval timestamp;
char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
time_t now = slap_get_time();
- Attribute *ga;
/*
* keep the necessary pwd.. operational attributes
ber_dupbv( &mods->sml_values[0], ×tamp );
mods->sml_values[1].bv_len = 0;
mods->sml_values[1].bv_val = NULL;
- assert( mods->sml_values[0].bv_val );
+ assert( mods->sml_values[0].bv_val != NULL );
} else {
mods->sml_op = LDAP_MOD_DELETE;
mods->sml_values = NULL;
rc = nop.o_bd->be_search(&nop, &nrs);
ch_free( nop.ors_filterstr.bv_val );
- while ( fptr = ftop.f_or ) {
+ while ( (fptr = ftop.f_or) != NULL ) {
ftop.f_or = fptr->f_next;
ch_free( fptr );
}
for(dp = dd.mods; dp; dp = dd.mods) {
dd.mods = dp->next;
ch_free(dp->dn.bv_val);
- slap_mods_free(dp->mm);
+ slap_mods_free(dp->mm, 1);
}
dd.mods = NULL;
--- /dev/null
+/* retcode.c - customizable response for client testing purposes */
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2005 The OpenLDAP Foundation.
+ * Portions Copyright 2005 Pierangelo Masarati <ando@sys-net.it>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
+ */
+
+#include "portable.h"
+
+#ifdef SLAPD_OVER_RETCODE
+
+#include <stdio.h>
+
+#include <ac/unistd.h>
+#include <ac/string.h>
+#include <ac/ctype.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "lutil.h"
+
+static slap_overinst retcode;
+
+static AttributeDescription *ad_errCode;
+static AttributeDescription *ad_errText;
+static AttributeDescription *ad_errOp;
+static AttributeDescription *ad_errSleepTime;
+static ObjectClass *oc_errObject;
+
+typedef enum retcode_op_e {
+ SN_DG_OP_NONE = 0x0000,
+ SN_DG_OP_ADD = 0x0001,
+ SN_DG_OP_BIND = 0x0002,
+ SN_DG_OP_COMPARE = 0x0004,
+ SN_DG_OP_DELETE = 0x0008,
+ SN_DG_OP_MODIFY = 0x0010,
+ SN_DG_OP_RENAME = 0x0020,
+ SN_DG_OP_SEARCH = 0x0040,
+ SN_DG_EXTENDED = 0x0080,
+ SN_DG_OP_AUTH = SN_DG_OP_BIND,
+ SN_DG_OP_READ = (SN_DG_OP_COMPARE|SN_DG_OP_SEARCH),
+ SN_DG_OP_WRITE = (SN_DG_OP_ADD|SN_DG_OP_DELETE|SN_DG_OP_MODIFY|SN_DG_OP_RENAME),
+ SN_DG_OP_ALL = (SN_DG_OP_AUTH|SN_DG_OP_READ|SN_DG_OP_WRITE|SN_DG_EXTENDED)
+} retcode_op_e;
+
+typedef struct retcode_item_t {
+ struct berval rdi_dn;
+ struct berval rdi_ndn;
+ struct berval rdi_text;
+ int rdi_err;
+ BerVarray rdi_ref;
+ int rdi_sleeptime;
+ Entry rdi_e;
+ slap_mask_t rdi_mask;
+ struct retcode_item_t *rdi_next;
+} retcode_item_t;
+
+typedef struct retcode_t {
+ struct berval rd_pdn;
+ struct berval rd_npdn;
+
+ retcode_item_t *rd_item;
+
+ unsigned rd_flags;
+#define RETCODE_FNONE 0x00
+#define RETCODE_FINDIR 0x01
+#define RETCODE_INDIR( rd ) ( (rd)->rd_flags & RETCODE_FINDIR )
+} retcode_t;
+
+static int
+retcode_entry_response( Operation *op, SlapReply *rs, Entry *e );
+
+static int
+retcode_cleanup_cb( Operation *op, SlapReply *rs )
+{
+ rs->sr_matched = NULL;
+ rs->sr_text = NULL;
+
+ if ( rs->sr_ref != NULL ) {
+ ber_bvarray_free( rs->sr_ref );
+ rs->sr_ref = NULL;
+ }
+
+ ch_free( op->o_callback );
+ op->o_callback = NULL;
+
+ return SLAP_CB_CONTINUE;
+}
+
+static int
+retcode_send_onelevel( Operation *op, SlapReply *rs )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ retcode_item_t *rdi;
+
+ for ( rdi = rd->rd_item; rdi != NULL; rdi = rdi->rdi_next ) {
+ int rc;
+
+ if ( op->o_abandon ) {
+ return rs->sr_err = SLAPD_ABANDON;
+ }
+
+ rs->sr_err = test_filter( op, &rdi->rdi_e, op->ors_filter );
+ if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
+ if ( op->ors_slimit == rs->sr_nentries ) {
+ rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ goto done;
+ }
+
+ /* safe default */
+ rs->sr_attrs = op->ors_attrs;
+ rs->sr_operational_attrs = NULL;
+ rs->sr_ctrls = NULL;
+ rs->sr_flags = 0;
+ rs->sr_err = LDAP_SUCCESS;
+ rs->sr_entry = &rdi->rdi_e;
+
+ rc = send_search_entry( op, rs );
+
+ switch ( rc ) {
+ case 0: /* entry sent ok */
+ break;
+ case 1: /* entry not sent */
+ break;
+ case -1: /* connection closed */
+ rs->sr_entry = NULL;
+ rs->sr_err = LDAP_OTHER;
+ goto done;
+ }
+ }
+ rs->sr_err = LDAP_SUCCESS;
+ }
+
+done:;
+
+ send_ldap_result( op, rs );
+
+ return rs->sr_err;
+}
+
+static int
+retcode_op_add( Operation *op, SlapReply *rs )
+{
+ return retcode_entry_response( op, rs, op->ora_e );
+}
+
+typedef struct retcode_cb_t {
+ unsigned rdc_flags;
+ ber_tag_t rdc_tag;
+} retcode_cb_t;
+
+static int
+retcode_cb_response( Operation *op, SlapReply *rs )
+{
+ retcode_cb_t *rdc = (retcode_cb_t *)op->o_callback->sc_private;
+
+ if ( rs->sr_type == REP_SEARCH ) {
+ ber_tag_t o_tag = op->o_tag;
+ int rc;
+
+ op->o_tag = rdc->rdc_tag;
+ rc = retcode_entry_response( op, rs, rs->sr_entry );
+ op->o_tag = o_tag;
+
+ return rc;
+ }
+
+ if ( rs->sr_err == LDAP_SUCCESS ) {
+ rdc->rdc_flags = SLAP_CB_CONTINUE;
+ return 0;
+ }
+
+ return SLAP_CB_CONTINUE;
+}
+
+static int
+retcode_op_internal( Operation *op, SlapReply *rs )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+
+ Operation op2 = *op;
+ SlapReply rs2 = { 0 };
+ BackendDB db = *op->o_bd;
+ slap_callback sc = { 0 };
+ retcode_cb_t rdc;
+
+ int rc;
+
+ op2.o_tag = LDAP_REQ_SEARCH;
+ op2.ors_scope = LDAP_SCOPE_BASE;
+ op2.ors_deref = LDAP_DEREF_NEVER;
+ op2.ors_tlimit = SLAP_NO_LIMIT;
+ op2.ors_slimit = SLAP_NO_LIMIT;
+ op2.ors_limit = NULL;
+ op2.ors_attrsonly = 0;
+ op2.ors_attrs = slap_anlist_all_attributes;
+
+ ber_str2bv_x( "(objectClass=errObject)", STRLENOF( "(objectClass=errObject)" ),
+ 1, &op2.ors_filterstr, op2.o_tmpmemctx );
+ op2.ors_filter = str2filter_x( &op2, op2.ors_filterstr.bv_val );
+
+ db.bd_info = on->on_info->oi_orig;
+ op2.o_bd = &db;
+
+ rdc.rdc_flags = RETCODE_FINDIR;
+ rdc.rdc_tag = op->o_tag;
+ sc.sc_response = retcode_cb_response;
+ sc.sc_private = &rdc;
+ op2.o_callback = ≻
+
+ rc = op2.o_bd->be_search( &op2, &rs2 );
+
+ filter_free_x( &op2, op2.ors_filter );
+ ber_memfree_x( op2.ors_filterstr.bv_val, op2.o_tmpmemctx );
+
+ if ( rdc.rdc_flags == SLAP_CB_CONTINUE ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ return rc;
+}
+
+static int
+retcode_op_func( Operation *op, SlapReply *rs )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ retcode_item_t *rdi;
+ struct berval nrdn, npdn;
+
+ slap_callback *cb = NULL;
+
+ if ( !dnIsSuffix( &op->o_req_ndn, &rd->rd_npdn ) ) {
+ if ( RETCODE_INDIR( rd ) ) {
+ switch ( op->o_tag ) {
+ case LDAP_REQ_ADD:
+ return retcode_op_add( op, rs );
+
+ case LDAP_REQ_BIND:
+ if ( be_isroot_pw( op ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+ /* fallthru */
+
+ case LDAP_REQ_MODIFY:
+ case LDAP_REQ_DELETE:
+ case LDAP_REQ_MODRDN:
+ case LDAP_REQ_COMPARE:
+ case LDAP_REQ_SEARCH:
+ return retcode_op_internal( op, rs );
+ }
+ }
+
+ return SLAP_CB_CONTINUE;
+ }
+
+ if ( op->o_tag == LDAP_REQ_SEARCH
+ && op->ors_scope != LDAP_SCOPE_BASE
+ && op->o_req_ndn.bv_len == rd->rd_npdn.bv_len )
+ {
+ return retcode_send_onelevel( op, rs );
+ }
+
+ dnParent( &op->o_req_ndn, &npdn );
+ if ( npdn.bv_len != rd->rd_npdn.bv_len ) {
+ rs->sr_err = LDAP_NO_SUCH_OBJECT;
+ rs->sr_matched = rd->rd_pdn.bv_val;
+ send_ldap_result( op, rs );
+ rs->sr_matched = NULL;
+ return rs->sr_err;
+ }
+
+ dnRdn( &op->o_req_ndn, &nrdn );
+
+ for ( rdi = rd->rd_item; rdi != NULL; rdi = rdi->rdi_next ) {
+ struct berval rdi_nrdn;
+
+ dnRdn( &rdi->rdi_ndn, &rdi_nrdn );
+ if ( dn_match( &nrdn, &rdi_nrdn ) ) {
+ break;
+ }
+ }
+
+ if ( rdi != NULL && rdi->rdi_mask != SN_DG_OP_ALL ) {
+ retcode_op_e o_tag = SN_DG_OP_NONE;
+
+ switch ( op->o_tag ) {
+ case LDAP_REQ_ADD:
+ o_tag = SN_DG_OP_ADD;
+ break;
+
+ case LDAP_REQ_BIND:
+ o_tag = SN_DG_OP_BIND;
+ break;
+
+ case LDAP_REQ_COMPARE:
+ o_tag = SN_DG_OP_COMPARE;
+ break;
+
+ case LDAP_REQ_DELETE:
+ o_tag = SN_DG_OP_DELETE;
+ break;
+
+ case LDAP_REQ_MODIFY:
+ o_tag = SN_DG_OP_MODIFY;
+ break;
+
+ case LDAP_REQ_MODRDN:
+ o_tag = SN_DG_OP_RENAME;
+ break;
+
+ case LDAP_REQ_SEARCH:
+ o_tag = SN_DG_OP_SEARCH;
+ break;
+
+ case LDAP_REQ_EXTENDED:
+ o_tag = SN_DG_EXTENDED;
+ break;
+
+ default:
+ /* Should not happen */
+ break;
+ }
+
+ if ( !( o_tag & rdi->rdi_mask ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+ }
+
+ if ( rdi == NULL ) {
+ rs->sr_matched = rd->rd_pdn.bv_val;
+ rs->sr_err = LDAP_NO_SUCH_OBJECT;
+ rs->sr_text = "retcode not found";
+
+ } else {
+ rs->sr_err = rdi->rdi_err;
+ rs->sr_text = rdi->rdi_text.bv_val;
+
+ /* FIXME: we only honor the rdi_ref field in case rdi_err
+ * is LDAP_REFERRAL otherwise send_ldap_result() bails out */
+ if ( rs->sr_err == LDAP_REFERRAL ) {
+ BerVarray ref;
+
+ if ( rdi->rdi_ref != NULL ) {
+ ref = rdi->rdi_ref;
+ } else {
+ ref = default_referral;
+ }
+
+ if ( ref != NULL ) {
+ rs->sr_ref = referral_rewrite( ref,
+ NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
+
+ } else {
+ rs->sr_err = LDAP_OTHER;
+ rs->sr_text = "bad referral object";
+ }
+ }
+
+ if ( rdi->rdi_sleeptime > 0 ) {
+ sleep( rdi->rdi_sleeptime );
+ }
+ }
+
+ switch ( op->o_tag ) {
+ case LDAP_REQ_EXTENDED:
+ if ( rdi == NULL ) {
+ break;
+ }
+ cb = ( slap_callback * )ch_malloc( sizeof( slap_callback ) );
+ memset( cb, 0, sizeof( slap_callback ) );
+ cb->sc_cleanup = retcode_cleanup_cb;
+ op->o_callback = cb;
+ break;
+
+ default:
+ send_ldap_result( op, rs );
+ if ( rs->sr_ref != NULL ) {
+ ber_bvarray_free( rs->sr_ref );
+ }
+ rs->sr_matched = NULL;
+ rs->sr_text = NULL;
+ break;
+ }
+
+ return rs->sr_err;
+}
+
+static int
+retcode_op2str( ber_tag_t op, struct berval *bv )
+{
+ switch ( op ) {
+ case LDAP_REQ_BIND:
+ BER_BVSTR( bv, "bind" );
+ return 0;
+ case LDAP_REQ_ADD:
+ BER_BVSTR( bv, "add" );
+ return 0;
+ case LDAP_REQ_DELETE:
+ BER_BVSTR( bv, "delete" );
+ return 0;
+ case LDAP_REQ_MODRDN:
+ BER_BVSTR( bv, "modrdn" );
+ return 0;
+ case LDAP_REQ_MODIFY:
+ BER_BVSTR( bv, "modify" );
+ return 0;
+ case LDAP_REQ_COMPARE:
+ BER_BVSTR( bv, "compare" );
+ return 0;
+ case LDAP_REQ_SEARCH:
+ BER_BVSTR( bv, "search" );
+ return 0;
+ case LDAP_REQ_EXTENDED:
+ BER_BVSTR( bv, "extended" );
+ return 0;
+ }
+ return -1;
+}
+
+static int
+retcode_entry_response( Operation *op, SlapReply *rs, Entry *e )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+
+ Attribute *a;
+ int err;
+ char *next;
+
+ if ( get_manageDSAit( op ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ if ( !is_entry_objectclass( e, oc_errObject, 0 ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ /* operation */
+ a = attr_find( e->e_attrs, ad_errOp );
+ if ( a != NULL ) {
+ int i,
+ gotit = 0;
+ struct berval bv = BER_BVNULL;
+
+ (void)retcode_op2str( op->o_tag, &bv );
+
+ if ( BER_BVISNULL( &bv ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ for ( i = 0; !BER_BVISNULL( &a->a_nvals[ i ] ); i++ ) {
+ if ( bvmatch( &a->a_nvals[ i ], &bv ) ) {
+ gotit = 1;
+ break;
+ }
+ }
+
+ if ( !gotit ) {
+ return SLAP_CB_CONTINUE;
+ }
+ }
+
+ /* error code */
+ a = attr_find( e->e_attrs, ad_errCode );
+ if ( a == NULL ) {
+ return SLAP_CB_CONTINUE;
+ }
+ err = strtol( a->a_nvals[ 0 ].bv_val, &next, 0 );
+ if ( next == a->a_nvals[ 0 ].bv_val || next[ 0 ] != '\0' ) {
+ return SLAP_CB_CONTINUE;
+ }
+ rs->sr_err = err;
+
+ /* sleep time */
+ a = attr_find( e->e_attrs, ad_errSleepTime );
+ if ( a != NULL ) {
+ int sleepTime;
+
+ sleepTime = strtoul( a->a_nvals[ 0 ].bv_val, &next, 0 );
+ if ( next != a->a_nvals[ 0 ].bv_val && next[ 0 ] == '\0' ) {
+ sleep( sleepTime );
+ }
+ }
+
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ BackendDB db = *op->o_bd;
+ void *o_callback = op->o_callback;
+
+ /* message text */
+ a = attr_find( e->e_attrs, ad_errText );
+ if ( a != NULL ) {
+ rs->sr_text = a->a_vals[ 0 ].bv_val;
+ }
+
+ db.bd_info = on->on_info->oi_orig;
+ op->o_bd = &db;
+ op->o_callback = NULL;
+
+ /* referral */
+ if ( rs->sr_err == LDAP_REFERRAL ) {
+ BerVarray refs = default_referral;
+
+ a = attr_find( e->e_attrs, slap_schema.si_ad_ref );
+ if ( a != NULL ) {
+ refs = a->a_vals;
+ }
+ rs->sr_ref = referral_rewrite( refs,
+ NULL, &op->o_req_dn, op->oq_search.rs_scope );
+
+ send_search_reference( op, rs );
+ ber_bvarray_free( rs->sr_ref );
+ rs->sr_ref = NULL;
+
+ } else {
+ send_ldap_result( op, rs );
+ }
+
+ rs->sr_text = NULL;
+ op->o_callback = o_callback;
+ }
+
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ op->o_abandon = 1;
+ return rs->sr_err;
+ }
+
+ return SLAP_CB_CONTINUE;
+}
+
+static int
+retcode_response( Operation *op, SlapReply *rs )
+{
+ slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ if ( rs->sr_type != REP_SEARCH || !RETCODE_INDIR( rd ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ return retcode_entry_response( op, rs, rs->sr_entry );
+}
+
+static int
+retcode_db_init( BackendDB *be )
+{
+ slap_overinst *on = (slap_overinst *)be->bd_info;
+ retcode_t *rd;
+
+ rd = (retcode_t *)ch_malloc( sizeof( retcode_t ) );
+ memset( rd, 0, sizeof( retcode_t ) );
+
+ on->on_bi.bi_private = (void *)rd;
+
+ return 0;
+}
+
+static int
+retcode_db_config(
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv )
+{
+ slap_overinst *on = (slap_overinst *)be->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ char *argv0 = argv[ 0 ] + STRLENOF( "retcode-" );
+
+ if ( strncasecmp( argv[ 0 ], "retcode-", STRLENOF( "retcode-" ) ) != 0 ) {
+ return SLAP_CONF_UNKNOWN;
+ }
+
+ if ( strcasecmp( argv0, "parent" ) == 0 ) {
+ struct berval dn;
+ int rc;
+
+ if ( argc != 2 ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "\"retcode-parent <DN>\": missing <DN>\n",
+ fname, lineno );
+ return 1;
+ }
+
+ if ( !BER_BVISNULL( &rd->rd_pdn ) ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "parent already defined.\n", fname, lineno );
+ return 1;
+ }
+
+ ber_str2bv( argv[ 1 ], 0, 0, &dn );
+
+ rc = dnPrettyNormal( NULL, &dn, &rd->rd_pdn, &rd->rd_npdn, NULL );
+ if ( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "unable to normalize parent DN \"%s\": %d\n",
+ fname, lineno, argv[ 1 ], rc );
+ return 1;
+ }
+
+ } else if ( strcasecmp( argv0, "item" ) == 0 ) {
+ retcode_item_t rdi = { BER_BVNULL }, **rdip;
+ struct berval bv, rdn, nrdn;
+ int rc;
+ char *next = NULL;
+
+ if ( argc < 3 ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "\"retcode-item <RDN> <retcode> [<text>]\": "
+ "missing args\n",
+ fname, lineno );
+ return 1;
+ }
+
+ ber_str2bv( argv[ 1 ], 0, 0, &bv );
+
+ rc = dnPrettyNormal( NULL, &bv, &rdn, &nrdn, NULL );
+ if ( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "unable to normalize RDN \"%s\": %d\n",
+ fname, lineno, argv[ 1 ], rc );
+ return 1;
+ }
+
+ if ( !dnIsOneLevelRDN( &nrdn ) ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "value \"%s\" is not a RDN\n",
+ fname, lineno, argv[ 1 ] );
+ return 1;
+ }
+
+ if ( BER_BVISNULL( &rd->rd_npdn ) ) {
+ /* FIXME: we use the database suffix */
+ if ( be->be_nsuffix == NULL ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "either \"retcode-parent\" "
+ "or \"suffix\" must be defined.\n",
+ fname, lineno );
+ return 1;
+ }
+
+ ber_dupbv( &rd->rd_pdn, &be->be_suffix[ 0 ] );
+ ber_dupbv( &rd->rd_npdn, &be->be_nsuffix[ 0 ] );
+ }
+
+ build_new_dn( &rdi.rdi_dn, &rd->rd_pdn, &rdn, NULL );
+ build_new_dn( &rdi.rdi_ndn, &rd->rd_npdn, &nrdn, NULL );
+
+ ch_free( rdn.bv_val );
+ ch_free( nrdn.bv_val );
+
+ rdi.rdi_err = strtol( argv[ 2 ], &next, 0 );
+ if ( next == argv[ 2 ] || next[ 0 ] != '\0' ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "unable to parse return code \"%s\"\n",
+ fname, lineno, argv[ 2 ] );
+ return 1;
+ }
+
+ rdi.rdi_mask = SN_DG_OP_ALL;
+
+ if ( argc > 3 ) {
+ int i;
+
+ for ( i = 3; i < argc; i++ ) {
+ if ( strncasecmp( argv[ i ], "op=", STRLENOF( "op=" ) ) == 0 )
+ {
+ char **ops;
+ int j;
+
+ ops = ldap_str2charray( &argv[ i ][ STRLENOF( "op=" ) ], "," );
+ assert( ops != NULL );
+
+ rdi.rdi_mask = SN_DG_OP_NONE;
+
+ for ( j = 0; ops[ j ] != NULL; j++ ) {
+ if ( strcasecmp( ops[ j ], "add" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_ADD;
+
+ } else if ( strcasecmp( ops[ j ], "bind" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_BIND;
+
+ } else if ( strcasecmp( ops[ j ], "compare" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_COMPARE;
+
+ } else if ( strcasecmp( ops[ j ], "add" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_DELETE;
+
+ } else if ( strcasecmp( ops[ j ], "modify" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_MODIFY;
+
+ } else if ( strcasecmp( ops[ j ], "rename" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_RENAME;
+
+ } else if ( strcasecmp( ops[ j ], "search" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_SEARCH;
+
+ } else if ( strcasecmp( ops[ j ], "extended" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_EXTENDED;
+
+ } else if ( strcasecmp( ops[ j ], "auth" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_AUTH;
+
+ } else if ( strcasecmp( ops[ j ], "read" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_READ;
+
+ } else if ( strcasecmp( ops[ j ], "write" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_WRITE;
+
+ } else if ( strcasecmp( ops[ j ], "all" ) == 0 ) {
+ rdi.rdi_mask |= SN_DG_OP_ALL;
+
+ } else {
+ fprintf( stderr, "retcode: unknown op \"%s\"\n",
+ ops[ j ] );
+ return 1;
+ }
+ }
+
+ ldap_charray_free( ops );
+
+ } else if ( strncasecmp( argv[ i ], "text=", STRLENOF( "text=" ) ) == 0 )
+ {
+ if ( !BER_BVISNULL( &rdi.rdi_text ) ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "\"text\" already provided.\n",
+ fname, lineno );
+ return 1;
+ }
+ ber_str2bv( &argv[ i ][ STRLENOF( "text=" ) ], 0, 1, &rdi.rdi_text );
+
+ } else if ( strncasecmp( argv[ i ], "ref=", STRLENOF( "ref=" ) ) == 0 )
+ {
+ char **refs;
+ int j;
+
+ if ( rdi.rdi_ref != NULL ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "\"ref\" already provided.\n",
+ fname, lineno );
+ return 1;
+ }
+
+ if ( rdi.rdi_err != LDAP_REFERRAL ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "providing \"ref\"\n"
+ "\talong with a non-referral "
+ "resultCode may cause slapd failures\n"
+ "\trelated to internal checks.\n",
+ fname, lineno );
+ }
+
+ refs = ldap_str2charray( &argv[ i ][ STRLENOF( "ref=" ) ], " " );
+ assert( refs != NULL );
+
+ for ( j = 0; refs[ j ] != NULL; j++ ) {
+ struct berval bv;
+
+ ber_str2bv( refs[ j ], 0, 1, &bv );
+ ber_bvarray_add( &rdi.rdi_ref, &bv );
+ }
+
+ ldap_charray_free( refs );
+
+ } else if ( strncasecmp( argv[ i ], "sleeptime=", STRLENOF( "sleeptime=" ) ) == 0 )
+ {
+ char *next;
+ if ( rdi.rdi_sleeptime != 0 ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "\"sleeptime\" already provided.\n",
+ fname, lineno );
+ return 1;
+ }
+
+ rdi.rdi_sleeptime = strtol( &argv[ i ][ STRLENOF( "sleeptime=" ) ], &next, 10 );
+ if ( next == argv[ i ] || next[ 0 ] != '\0' ) {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "unable to parse \"sleeptime=%s\".\n",
+ fname, lineno, &argv[ i ][ STRLENOF( "sleeptime=" ) ] );
+ return 1;
+ }
+
+ } else {
+ fprintf( stderr, "%s: line %d: retcode: "
+ "unknown option \"%s\".\n",
+ fname, lineno, argv[ i ] );
+ return 1;
+ }
+ }
+ }
+
+ for ( rdip = &rd->rd_item; *rdip; rdip = &(*rdip)->rdi_next )
+ /* go to last */ ;
+
+
+ *rdip = ( retcode_item_t * )ch_malloc( sizeof( retcode_item_t ) );
+ *(*rdip) = rdi;
+
+ } else if ( strcasecmp( argv0, "indir" ) == 0 ) {
+ rd->rd_flags |= RETCODE_FINDIR;
+
+ } else {
+ return SLAP_CONF_UNKNOWN;
+ }
+
+ return 0;
+}
+
+static int
+retcode_db_open( BackendDB *be )
+{
+ slap_overinst *on = (slap_overinst *)be->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ retcode_item_t *rdi;
+
+ for ( rdi = rd->rd_item; rdi; rdi = rdi->rdi_next ) {
+ LDAPRDN rdn = NULL;
+ int rc, j;
+ char* p;
+ struct berval val[ 3 ];
+ char buf[ SLAP_TEXT_BUFLEN ];
+
+ /* DN */
+ rdi->rdi_e.e_name = rdi->rdi_dn;
+ rdi->rdi_e.e_nname = rdi->rdi_ndn;
+
+ /* objectClass */
+ val[ 0 ] = oc_errObject->soc_cname;
+ val[ 1 ] = slap_schema.si_oc_extensibleObject->soc_cname;
+ BER_BVZERO( &val[ 2 ] );
+
+ attr_merge( &rdi->rdi_e, slap_schema.si_ad_objectClass, val, NULL );
+
+ /* RDN avas */
+ rc = ldap_bv2rdn( &rdi->rdi_dn, &rdn, (char **) &p,
+ LDAP_DN_FORMAT_LDAP );
+
+ assert( rc == LDAP_SUCCESS );
+
+ for ( j = 0; rdn[ j ]; j++ ) {
+ LDAPAVA *ava = rdn[ j ];
+ AttributeDescription *ad = NULL;
+ const char *text;
+
+ rc = slap_bv2ad( &ava->la_attr, &ad, &text );
+ assert( rc == LDAP_SUCCESS );
+
+ attr_merge_normalize_one( &rdi->rdi_e, ad,
+ &ava->la_value, NULL );
+ }
+
+ ldap_rdnfree( rdn );
+
+ /* error code */
+ snprintf( buf, sizeof( buf ), "%d", rdi->rdi_err );
+ ber_str2bv( buf, 0, 0, &val[ 0 ] );
+
+ attr_merge_one( &rdi->rdi_e, ad_errCode, &val[ 0 ], NULL );
+
+ if ( rdi->rdi_ref != NULL ) {
+ attr_merge_normalize( &rdi->rdi_e, slap_schema.si_ad_ref,
+ rdi->rdi_ref, NULL );
+ }
+
+ /* text */
+ if ( !BER_BVISNULL( &rdi->rdi_text ) ) {
+ val[ 0 ] = rdi->rdi_text;
+
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errText, &val[ 0 ], NULL );
+ }
+
+ /* sleep time */
+ if ( rdi->rdi_sleeptime > 0 ) {
+ snprintf( buf, sizeof( buf ), "%d", rdi->rdi_sleeptime );
+ ber_str2bv( buf, 0, 0, &val[ 0 ] );
+
+ attr_merge_one( &rdi->rdi_e, ad_errSleepTime, &val[ 0 ], NULL );
+ }
+
+ /* operations */
+ if ( rdi->rdi_mask & SN_DG_OP_ADD ) {
+ BER_BVSTR( &val[ 0 ], "add" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_BIND ) {
+ BER_BVSTR( &val[ 0 ], "bind" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_COMPARE ) {
+ BER_BVSTR( &val[ 0 ], "compare" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_DELETE ) {
+ BER_BVSTR( &val[ 0 ], "delete" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_EXTENDED ) {
+ BER_BVSTR( &val[ 0 ], "extended" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_MODIFY ) {
+ BER_BVSTR( &val[ 0 ], "modify" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_RENAME ) {
+ BER_BVSTR( &val[ 0 ], "rename" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+
+ if ( rdi->rdi_mask & SN_DG_OP_SEARCH ) {
+ BER_BVSTR( &val[ 0 ], "search" );
+ attr_merge_normalize_one( &rdi->rdi_e, ad_errOp, &val[ 0 ], NULL );
+ }
+ }
+
+ return 0;
+}
+
+static int
+retcode_db_destroy( BackendDB *be )
+{
+ slap_overinst *on = (slap_overinst *)be->bd_info;
+ retcode_t *rd = (retcode_t *)on->on_bi.bi_private;
+
+ if ( rd ) {
+ retcode_item_t *rdi, *next;
+
+ for ( rdi = rd->rd_item; rdi != NULL; rdi = next ) {
+ ber_memfree( rdi->rdi_dn.bv_val );
+ ber_memfree( rdi->rdi_ndn.bv_val );
+
+ if ( !BER_BVISNULL( &rdi->rdi_text ) ) {
+ ber_memfree( rdi->rdi_text.bv_val );
+ }
+
+ BER_BVZERO( &rdi->rdi_e.e_name );
+ BER_BVZERO( &rdi->rdi_e.e_nname );
+
+ entry_clean( &rdi->rdi_e );
+
+ next = rdi->rdi_next;
+
+ ch_free( rdi );
+ }
+
+ ber_memfree( rd );
+ }
+
+ return 0;
+}
+
+#if SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC
+static
+#endif /* SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC */
+int
+retcode_init( void )
+{
+ int i, code;
+ const char *err;
+
+ static struct {
+ char *name;
+ char *desc;
+ AttributeDescription **ad;
+ } retcode_at[] = {
+ { "errCode", "( 1.3.6.1.4.1.4203.666.11.4.1.1 "
+ "NAME ( 'errCode' ) "
+ "DESC 'LDAP error code' "
+ "EQUALITY integerMatch "
+ "ORDERING integerOrderingMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
+ "SINGLE-VALUE )",
+ &ad_errCode },
+ { "errOp", "( 1.3.6.1.4.1.4203.666.11.4.1.2 "
+ "NAME ( 'errOp' ) "
+ "DESC 'Operations the errObject applies to' "
+ "EQUALITY caseIgnoreMatch "
+ "SUBSTR caseIgnoreSubstringsMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
+ &ad_errOp},
+ { "errText", "( 1.3.6.1.4.1.4203.666.11.4.1.3 "
+ "NAME ( 'errText' ) "
+ "DESC 'LDAP error textual description' "
+ "EQUALITY caseIgnoreMatch "
+ "SUBSTR caseIgnoreSubstringsMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
+ "SINGLE-VALUE )",
+ &ad_errText },
+ { "errSleepTime", "( 1.3.6.1.4.1.4203.666.11.4.1.4 "
+ "NAME ( 'errSleepTime' ) "
+ "DESC 'Time to wait before returning the error' "
+ "EQUALITY integerMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
+ "SINGLE-VALUE )",
+ &ad_errSleepTime },
+ { NULL }
+ };
+
+ static struct {
+ char *name;
+ char *desc;
+ ObjectClass **oc;
+ } retcode_oc[] = {
+ { "errObject", "( 1.3.6.1.4.1.4203.666.11.4.3.1 "
+ "NAME ( 'errObject' ) "
+ "SUP top STRUCTURAL "
+ "MUST ( errCode ) "
+ "MAY ( "
+ "cn "
+ "$ description "
+ "$ errOp "
+ "$ errText "
+ "$ errSleepTime "
+ ") )",
+ &oc_errObject },
+ { NULL }
+ };
+
+
+ for ( i = 0; retcode_at[ i ].name != NULL; i++ ) {
+ LDAPAttributeType *at;
+
+ at = ldap_str2attributetype( retcode_at[ i ].desc,
+ &code, &err, LDAP_SCHEMA_ALLOW_ALL );
+ if ( !at ) {
+ fprintf( stderr, "retcode: "
+ "AttributeType load failed: %s %s\n",
+ ldap_scherr2str( code ), err );
+ return code;
+ }
+
+#if LDAP_VENDOR_VERSION_MINOR == X || LDAP_VENDOR_VERSION_MINOR > 2
+ code = at_add( at, 0, NULL, &err );
+#else
+ code = at_add( at, &err );
+#endif
+ ldap_memfree( at );
+ if ( code != LDAP_SUCCESS ) {
+ fprintf( stderr, "retcode: "
+ "AttributeType load failed: %s %s\n",
+ scherr2str( code ), err );
+ return code;
+ }
+
+ code = slap_str2ad( retcode_at[ i ].name,
+ retcode_at[ i ].ad, &err );
+ if ( code != LDAP_SUCCESS ) {
+ fprintf( stderr, "retcode: unable to find "
+ "AttributeDescription \"%s\": %d (%s)\n",
+ retcode_at[ i ].name, code, err );
+ return 1;
+ }
+ }
+
+ for ( i = 0; retcode_oc[ i ].name != NULL; i++ ) {
+ LDAPObjectClass *oc;
+
+ oc = ldap_str2objectclass( retcode_oc[ i ].desc,
+ &code, &err, LDAP_SCHEMA_ALLOW_ALL );
+ if ( !oc ) {
+ fprintf( stderr, "retcode: "
+ "ObjectClass load failed: %s %s\n",
+ ldap_scherr2str( code ), err );
+ return code;
+ }
+
+#if LDAP_VENDOR_VERSION_MINOR == X || LDAP_VENDOR_VERSION_MINOR > 2
+ code = oc_add( oc, 0, NULL, &err );
+#else
+ code = oc_add( oc, &err );
+#endif
+ ldap_memfree(oc);
+ if ( code != LDAP_SUCCESS ) {
+ fprintf( stderr, "retcode: "
+ "ObjectClass load failed: %s %s\n",
+ scherr2str( code ), err );
+ return code;
+ }
+
+ *retcode_oc[ i ].oc = oc_find( retcode_oc[ i ].name );
+ if ( *retcode_oc[ i ].oc == NULL ) {
+ fprintf( stderr, "retcode: unable to find "
+ "objectClass \"%s\"\n",
+ retcode_oc[ i ].name );
+ return 1;
+ }
+ }
+
+ retcode.on_bi.bi_type = "retcode";
+
+ retcode.on_bi.bi_db_init = retcode_db_init;
+ retcode.on_bi.bi_db_config = retcode_db_config;
+ retcode.on_bi.bi_db_open = retcode_db_open;
+ retcode.on_bi.bi_db_destroy = retcode_db_destroy;
+
+ retcode.on_bi.bi_op_add = retcode_op_func;
+ retcode.on_bi.bi_op_bind = retcode_op_func;
+ retcode.on_bi.bi_op_compare = retcode_op_func;
+ retcode.on_bi.bi_op_delete = retcode_op_func;
+ retcode.on_bi.bi_op_modify = retcode_op_func;
+ retcode.on_bi.bi_op_modrdn = retcode_op_func;
+ retcode.on_bi.bi_op_search = retcode_op_func;
+
+ retcode.on_bi.bi_extended = retcode_op_func;
+
+ retcode.on_response = retcode_response;
+
+ return overlay_register( &retcode );
+}
+
+#if SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC
+int
+init_module( int argc, char *argv[] )
+{
+ return retcode_init();
+}
+#endif /* SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC */
+
+#endif /* SLAPD_OVER_RETCODE */
}
if ( olddn != op->o_req_dn.bv_val ) {
- ch_free( op->ora_e->e_name.bv_val );
- ch_free( op->ora_e->e_nname.bv_val );
-
- ber_dupbv( &op->ora_e->e_name, &op->o_req_dn );
- ber_dupbv( &op->ora_e->e_nname, &op->o_req_ndn );
+ ber_bvreplace( &op->ora_e->e_name, &op->o_req_dn );
+ ber_bvreplace( &op->ora_e->e_nname, &op->o_req_ndn );
}
/* Count number of attributes in entry */
}
if ( mapping != NULL ) {
- assert( mapping->m_dst_ad );
+ assert( mapping->m_dst_ad != NULL );
(*ap)->a_desc = mapping->m_dst_ad;
}
}
rwm_op_bind( Operation *op, SlapReply *rs )
{
slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
- struct ldaprwmap *rwmap =
- (struct ldaprwmap *)on->on_bi.bi_private;
int rc;
#ifdef ENABLE_REWRITE
return -1;
} else if ( mapped_vals[0].bv_val != op->orc_ava->aa_value.bv_val ) {
- free( op->orc_ava->aa_value.bv_val );
- op->orc_ava->aa_value = mapped_vals[0];
+ ber_bvreplace_x( &op->orc_ava->aa_value, &mapped_vals[0], op->o_tmpmemctx );
}
mapped_at = op->orc_ava->aa_desc->ad_cname;
}
} else {
- assert( mapping->m_dst_ad );
+ assert( mapping->m_dst_ad != NULL );
ad = mapping->m_dst_ad;
}
return -1;
}
- op->orc_ava->aa_value = mapped_vals[0];
+ if ( mapped_vals[ 0 ].bv_val != op->orc_ava->aa_value.bv_val ) {
+ /* NOTE: if we get here, rwm_dnattr_rewrite()
+ * already freed the old value, so now
+ * it's invalid */
+ ber_dupbv_x( &op->orc_ava->aa_value, &mapped_vals[0],
+ op->o_tmpmemctx );
+ ber_memfree_x( mapped_vals[ 0 ].bv_val, NULL );
+ }
}
op->orc_ava->aa_desc = ad;
}
next_mod:;
if ( mapping != NULL ) {
/* use new attribute description */
- assert( mapping->m_dst_ad );
+ assert( mapping->m_dst_ad != NULL );
(*mlp)->sml_desc = mapping->m_dst_ad;
}
* the value is replaced by
* ch_alloc'ed memory
*/
- ch_free( bv[0].bv_val );
- ber_dupbv( &bv[0], &mapped );
+ ber_bvreplace( &bv[0], &mapped );
}
}
if ( mapping != NULL ) {
/* rewrite the attribute description */
- assert( mapping->m_dst_ad );
+ assert( mapping->m_dst_ad != NULL );
(*ap)->a_desc = mapping->m_dst_ad;
}
(struct ldaprwmap *)on->on_bi.bi_private;
Entry *e = NULL;
- int flags;
+ slap_mask_t flags;
struct berval dn = BER_BVNULL,
ndn = BER_BVNULL;
dncookie dc;
int rc;
- assert( rs->sr_entry );
+ assert( rs->sr_entry != NULL );
/*
* Rewrite the dn of the result, if needed
slap_overinst *on = (slap_overinst *) be->bd_info;
struct ldapmapping *mapping = NULL;
struct ldaprwmap *rwmap;
+#ifdef ENABLE_REWRITE
+ char *rargv[ 3 ];
+#endif /* ENABLE_REWRITE */
- rwmap = (struct ldaprwmap *)ch_malloc(sizeof(struct ldaprwmap));
- memset(rwmap, 0, sizeof(struct ldaprwmap));
+ rwmap = (struct ldaprwmap *)ch_calloc( 1, sizeof( struct ldaprwmap ) );
#ifdef ENABLE_REWRITE
rwmap->rwm_rw = rewrite_info_init( REWRITE_MODE_USE_DEFAULT );
return -1;
}
- {
- char *rargv[3];
-
- /* this rewriteContext by default must be null;
- * rules can be added if required */
- rargv[ 0 ] = "rewriteContext";
- rargv[ 1 ] = "searchFilter";
- rargv[ 2 ] = NULL;
- rewrite_parse( rwmap->rwm_rw, "<suffix massage>", 1, 2, rargv );
-
- rargv[ 0 ] = "rewriteContext";
- rargv[ 1 ] = "default";
- rargv[ 2 ] = NULL;
- rewrite_parse( rwmap->rwm_rw, "<suffix massage>", 2, 2, rargv );
- }
-
+ /* this rewriteContext by default must be null;
+ * rules can be added if required */
+ rargv[ 0 ] = "rewriteContext";
+ rargv[ 1 ] = "searchFilter";
+ rargv[ 2 ] = NULL;
+ rewrite_parse( rwmap->rwm_rw, "<suffix massage>", 1, 2, rargv );
+
+ rargv[ 0 ] = "rewriteContext";
+ rargv[ 1 ] = "default";
+ rargv[ 2 ] = NULL;
+ rewrite_parse( rwmap->rwm_rw, "<suffix massage>", 2, 2, rargv );
#endif /* ENABLE_REWRITE */
if ( rwm_map_init( &rwmap->rwm_oc, &mapping ) != LDAP_SUCCESS ||
avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
avl_free( rwmap->rwm_at.remap, NULL );
avl_free( rwmap->rwm_at.map, rwm_mapping_free );
+
+ ch_free( rwmap );
}
return rc;
struct berval mdn;
static char *dmy = "";
- assert( dc );
- assert( in );
- assert( dn );
+ assert( dc != NULL );
+ assert( in != NULL );
+ assert( dn != NULL );
rc = rewrite_session( dc->rwmap->rwm_rw, dc->ctx,
( in->bv_val ? in->bv_val : dmy ),
int i, src, dst;
struct berval tmpin;
- assert( dc );
- assert( in );
- assert( dn );
+ assert( dc != NULL );
+ assert( in != NULL );
+ assert( dn != NULL );
BER_BVZERO( dn );
const char *text;
int rc;
- assert( m );
+ assert( m != NULL );
*m = NULL;
}
/* FIXME: I don't think this is needed any more... */
- rc = slap_str2ad( "objectClass", &mapping->m_src_ad, &text );
+ rc = slap_str2ad( "objectClass", &mapping[0].m_src_ad, &text );
if ( rc != LDAP_SUCCESS ) {
return rc;
}
- mapping->m_dst_ad = mapping->m_src_ad;
- ber_dupbv( &mapping->m_dst, &mapping->m_src_ad->ad_cname );
- ber_dupbv( &mapping->m_dst, &mapping->m_src );
+ mapping[0].m_dst_ad = mapping[0].m_src_ad;
+ ber_dupbv( &mapping[0].m_src, &mapping[0].m_src_ad->ad_cname );
+ ber_dupbv( &mapping[0].m_dst, &mapping[0].m_src );
- mapping[1].m_src = mapping->m_src;
- mapping[1].m_dst = mapping->m_dst;
+ mapping[1].m_src = mapping[0].m_src;
+ mapping[1].m_dst = mapping[0].m_dst;
+ mapping[1].m_src_ad = mapping[0].m_src_ad;
+ mapping[1].m_dst_ad = mapping[1].m_src_ad;
- avl_insert( &lm->map, (caddr_t)mapping,
+ avl_insert( &lm->map, (caddr_t)&mapping[0],
rwm_mapping_cmp, rwm_mapping_dup );
avl_insert( &lm->remap, (caddr_t)&mapping[1],
rwm_mapping_cmp, rwm_mapping_dup );
Avlnode *tree;
struct ldapmapping fmapping;
- assert( m );
+ assert( m != NULL );
if ( remap == RWM_REMAP ) {
tree = map->remap;
{
int i, j;
- assert( anp );
+ assert( anp != NULL );
*anp = NULL;
/* better than nothing... */
ber_bvtrue = BER_BVC( "(objectClass=*)" ),
ber_bvtf_true = BER_BVC( "(&)" ),
+#if 0
+ /* no longer needed; preserved for completeness */
ber_bvundefined = BER_BVC( "(?=undefined)" ),
+#endif
ber_bverror = BER_BVC( "(?=error)" ),
ber_bvunknown = BER_BVC( "(?=unknown)" ),
ber_bvnone = BER_BVC( "(?=none)" );
struct berval dn = BER_BVNULL,
ndn = BER_BVNULL;
- assert( a_vals );
+ assert( a_vals != NULL );
/*
* Rewrite the dn if needed
/* This op is done, remove it */
ldap_pvt_thread_mutex_lock( &sm->sm_mutex );
av = avl_find2( sm->sm_mods, &mtdummy, sm_avl_cmp );
- assert(av);
+ assert(av != NULL);
mt = av->avl_data;
{
Attribute* a;
int ret;
- int res;
- const char *text = NULL;
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
{
opcookie *opc = op->o_callback->sc_private;
slap_overinst *on = opc->son;
- syncprov_info_t *si = on->on_bi.bi_private;
slap_callback cb = {0};
Operation fop;
syncprov_sendresp( Operation *op, opcookie *opc, syncops *so, Entry **e, int mode, int queue )
{
slap_overinst *on = opc->son;
- syncprov_info_t *si = on->on_bi.bi_private;
SlapReply rs = { REP_SEARCH };
LDAPControl *ctrls[2];
se->se_tag = op->o_tag;
se->se_uuid.bv_val = (char *)(se+1);
- se->se_csn.bv_val = se->se_uuid.bv_val + opc->suuid.bv_len + 1;
AC_MEMCPY( se->se_uuid.bv_val, opc->suuid.bv_val, opc->suuid.bv_len );
se->se_uuid.bv_len = opc->suuid.bv_len;
+ se->se_csn.bv_val = se->se_uuid.bv_val + opc->suuid.bv_len;
AC_MEMCPY( se->se_csn.bv_val, csn->bv_val, csn->bv_len );
se->se_csn.bv_val[csn->bv_len] = '\0';
se->se_csn.bv_len = csn->bv_len;
struct berval *oldcsn, struct berval *ctxcsn )
{
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
- syncprov_info_t *si = on->on_bi.bi_private;
slog_entry *se;
int i, j, ndel, num, nmods, mmods;
BerVarray uuids;
{
searchstate *ss = op->o_callback->sc_private;
slap_overinst *on = ss->ss_on;
- syncprov_info_t *si = on->on_bi.bi_private;
sync_control *srs = op->o_controls[slap_cids.sc_LDAPsync];
if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) {
- int i;
/* If we got a referral without a referral object, there's
* something missing that we cannot replicate. Just ignore it.
* The consumer will abort because we didn't send the expected
* control.
*/
if ( !rs->sr_entry ) {
- assert( rs->sr_entry );
+ assert( rs->sr_entry != NULL );
Debug( LDAP_DEBUG_ANY, "bogus referral in context\n",0,0,0 );
return SLAP_CB_CONTINUE;
}
LDAPControl *ctrl )
{
ber_tag_t tag;
- BerElement *ber;
+ BerElementBuffer berbuf;
+ BerElement *ber = (BerElement *)&berbuf;
ber_int_t mode;
ber_len_t len;
struct berval cookie = BER_BVNULL;
* }
*/
- ber = ber_init( &ctrl->ldctl_value );
- if( ber == NULL ) {
- rs->sr_text = "internal error";
- return LDAP_OTHER;
- }
+ ber_init2( ber, &ctrl->ldctl_value, 0 );
if ( (tag = ber_scanf( ber, "{i" /*}*/, &mode )) == LBER_ERROR ) {
rs->sr_text = "Sync control : mode decoding error";
tag = ber_peek_tag( ber, &len );
if ( tag == LDAP_TAG_SYNC_COOKIE ) {
- if (( ber_scanf( ber, /*{*/ "o", &cookie )) == LBER_ERROR ) {
+ if (( ber_scanf( ber, /*{*/ "m", &cookie )) == LBER_ERROR ) {
rs->sr_text = "Sync control : cookie decoding error";
return LDAP_PROTOCOL_ERROR;
}
sr = op->o_tmpcalloc( 1, sizeof(struct sync_control), op->o_tmpmemctx );
sr->sr_rhint = rhint;
if (!BER_BVISNULL(&cookie)) {
- ber_dupbv( &sr->sr_state.octet_str, &cookie );
- slap_parse_sync_cookie( &sr->sr_state );
+ ber_dupbv_x( &sr->sr_state.octet_str, &cookie, op->o_tmpmemctx );
+ slap_parse_sync_cookie( &sr->sr_state, op->o_tmpmemctx );
+ if ( sr->sr_state.rid == -1 ) {
+ rs->sr_text = "Sync control : cookie parsing error";
+ return LDAP_PROTOCOL_ERROR;
+ }
}
op->o_controls[slap_cids.sc_LDAPsync] = sr;
- (void) ber_free( ber, 1 );
-
op->o_sync = ctrl->ldctl_iscritical
? SLAP_CONTROL_CRITICAL
: SLAP_CONTROL_NONCRITICAL;
slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
overlay_stack *ov = on->on_bi.bi_private;
- translucent_configuration *cf = ov->config;
void *private = op->o_bd->be_private;
Entry ne, *e, *re = NULL;
Attribute *a, *ax;
mm = m;
m = m->sml_next;
mm->sml_next = NULL; /* hack */
- slap_mods_free(mm);
+ slap_mods_free(mm, 1);
if(m) continue;
}
m->sml_op = LDAP_MOD_ADD;
slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
overlay_stack *ov = on->on_bi.bi_private;
void *private = op->o_bd->be_private;
- translucent_configuration *cf = ov->config;
AttributeAssertion *ava = op->orc_ava;
- Attribute *a, *an, *ra, *as = NULL;
- Entry *e, *ee, *re;
+ Entry *e;
int rc;
Debug(LDAP_DEBUG_TRACE, "==> translucent_compare: <%s> %s:%s\n",
slap_overinst *on;
Entry *e, *re = NULL;
Attribute *a, *ax, *an, *as = NULL;
- BerVarray b, bx;
void *private;
- int i, rc, size;
+ int rc;
if(!op || !rs || rs->sr_type != REP_SEARCH || !rs->sr_entry)
return(SLAP_CB_CONTINUE);
slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
slap_callback cb = { NULL, NULL, NULL, NULL };
overlay_stack *ov = on->on_bi.bi_private;
- translucent_configuration *cf = ov->config;
void *private = op->o_bd->be_private;
int rc;
static int translucent_close(BackendDB *be) {
slap_overinst *on = (slap_overinst *) be->bd_info;
overlay_stack *ov = on->on_bi.bi_private;
- translucent_configuration *cf = ov->config;
void *private = be->be_private;
int rc;
Operation nop = *op;
char *key, *kp;
- int i, rc, ks = 16; /* a handful of extra bytes */
+ int i, ks = 16; /* a handful of extra bytes */
LDAPRDN newrdn;
struct berval bv[2];
op->o_tag = LDAP_REQ_EXTENDED;
op->o_callback = sc;
}
- slap_mods_free( qpw->rs_mods );
+ slap_mods_free( qpw->rs_mods, 1 );
if ( rsp ) {
free( qpw->rs_new.bv_val );
}
new->bv_len = 0;
new->bv_val = NULL;
- assert( hash );
+ assert( hash != NULL );
lutil_passwd_hash( cred , hash, new, text );
}
ispunct((unsigned char) (x)) || \
isdigit((unsigned char) (x)) || (x) == '\0')
+#if 0
static char *
first_word( char *s )
{
return( ret );
}
+#endif /* 0 */
#ifndef MAXPHONEMELEN
#define MAXPHONEMELEN 4
* add.c
*/
LDAP_SLAPD_F (int) slap_mods2entry LDAP_P(( Modifications *mods, Entry **e,
- int repl_user, int dup, const char **text, char *textbuf, size_t textlen ));
+ int initial, int dup, const char **text, char *textbuf, size_t textlen ));
LDAP_SLAPD_F (int) slap_entry2mods LDAP_P(( Entry *e,
Modifications **mods, const char **text,
LDAP_SLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
LDAP_SLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
+#ifdef LDAP_COMP_MATCH
+LDAP_SLAPD_F (void) comp_tree_free LDAP_P(( Attribute *a ));
+#endif
+
#define attr_mergeit( e, d, v ) attr_merge( e, d, v, NULL /* FIXME */ )
#define attr_mergeit_one( e, d, v ) attr_merge_one( e, d, v, NULL /* FIXME */ )
LDAP_SLAPD_F (int) backend_sync LDAP_P((Backend *be));
LDAP_SLAPD_F (int) backend_shutdown LDAP_P((Backend *be));
LDAP_SLAPD_F (int) backend_destroy LDAP_P((void));
-LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd));
+LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd, int dynamic));
LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));
LDAP_SLAPD_F (BackendDB *) backend_db_init LDAP_P(( const char *type ));
LDAP_SLAPD_V(BackendInfo) slap_binfo[];
-/*
- * backglue.c
- */
-
-LDAP_SLAPD_F (int) glue_back_initialize( BackendInfo *bi );
-LDAP_SLAPD_F (int) glue_sub_init( void );
-
/*
* backover.c
*/
-
LDAP_SLAPD_F (int) overlay_register LDAP_P(( slap_overinst *on ));
LDAP_SLAPD_F (int) overlay_config LDAP_P(( BackendDB *be, const char *ov ));
LDAP_SLAPD_F (void) overlay_destroy_one LDAP_P((
LDAP_SLAPD_F (int) overlay_register_control LDAP_P((
BackendDB *be,
const char *oid ));
+LDAP_SLAPD_F (int) overlay_op_walk LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ slap_operation_t which,
+ slap_overinfo *oi,
+ slap_overinst *on ));
+
+/*
+ * bconfig.c
+ */
+LDAP_SLAPD_F (int) slap_loglevel_register LDAP_P (( slap_mask_t m, struct berval *s ));
+LDAP_SLAPD_F (int) str2loglevel LDAP_P(( const char *s, int *l ));
/*
* ch_malloc.c
* component.c
*/
#ifdef LDAP_COMP_MATCH
+struct comp_attribute_aliasing;
+
LDAP_SLAPD_F (int) test_comp_filter_entry LDAP_P((
Operation* op,
Entry* e,
MatchingRuleAssertion* mr));
+LDAP_SLAPD_F (int) dup_comp_filter LDAP_P((
+ Operation* op,
+ struct berval *bv,
+ ComponentFilter *in_f,
+ ComponentFilter **out_f ));
+
+LDAP_SLAPD_F (int) get_aliased_filter_aa LDAP_P((
+ Operation* op,
+ AttributeAssertion* a_assert,
+ struct comp_attribute_aliasing* aa,
+ const char** text ));
+
+LDAP_SLAPD_F (int) get_aliased_filter LDAP_P((
+ Operation* op,
+ MatchingRuleAssertion* ma,
+ struct comp_attribute_aliasing* aa,
+ const char** text ));
+
LDAP_SLAPD_F (int) get_comp_filter LDAP_P((
Operation* op,
BerValue* bv,
ComponentFilter** filt,
const char **text ));
+LDAP_SLAPD_F (int) insert_component_reference LDAP_P((
+ ComponentReference *cr,
+ ComponentReference** cr_list ));
+
+LDAP_SLAPD_F (int) is_component_reference LDAP_P((
+ char *attr ));
+
+LDAP_SLAPD_F (int) extract_component_reference LDAP_P((
+ char* attr,
+ ComponentReference** cr ));
+
LDAP_SLAPD_F (int) componentFilterMatch LDAP_P((
int *matchp,
slap_mask_t flags,
MatchingRule *mr,
struct berval *value,
void *assertedValue ));
+
+LDAP_SLAPD_F (ComponentReference*) dup_comp_ref LDAP_P((
+ Operation *op,
+ ComponentReference *cr ));
LDAP_SLAPD_F (int) componentFilterValidate LDAP_P((
Syntax *syntax,
Syntax *syntax,
struct berval* bv ));
+LDAP_SLAPD_F (void) component_free LDAP_P((
+ ComponentFilter *f ));
+
+LDAP_SLAPD_F (void) free_ComponentData LDAP_P((
+ Attribute *a ));
+
LDAP_SLAPD_V (test_membership_func*) is_aliased_attribute;
LDAP_SLAPD_V (free_component_func*) component_destructor;
LDAP_SLAPD_F (void) slap_free_ctrls LDAP_P((
Operation *op,
LDAPControl **ctrls ));
+LDAP_SLAPD_F (int) slap_parse_ctrl LDAP_P((
+ Operation *op,
+ SlapReply *rs,
+ LDAPControl *control,
+ const char **text ));
LDAP_SLAPD_F (int) get_ctrls LDAP_P((
Operation *op,
SlapReply *rs,
slap_verbmasks *v, slap_mask_t m, BerVarray *bva ));
LDAP_SLAPD_F (int) enum_to_verb LDAP_P((
slap_verbmasks *v, slap_mask_t m, struct berval *bv ));
+LDAP_SLAPD_F (int) slap_verbmasks_init LDAP_P(( slap_verbmasks **vp, slap_verbmasks *v ));
+LDAP_SLAPD_F (int) slap_verbmasks_destroy LDAP_P(( slap_verbmasks *v ));
+LDAP_SLAPD_F (int) slap_verbmasks_append LDAP_P(( slap_verbmasks **vp,
+ slap_mask_t m, struct berval *v, slap_mask_t *ignore ));
LDAP_SLAPD_F (int) bindconf_parse LDAP_P((
const char *word, slap_bindconf *bc ));
LDAP_SLAPD_F (int) bindconf_unparse LDAP_P((
LDAP_SLAPD_F (void) slap_sync_cookie_free LDAP_P((
struct sync_cookie *, int free_cookie ));
LDAP_SLAPD_F (int) slap_parse_sync_cookie LDAP_P((
- struct sync_cookie * ));
+ struct sync_cookie *, void *memctx ));
LDAP_SLAPD_F (int) slap_init_sync_cookie_ctxcsn LDAP_P((
struct sync_cookie * ));
LDAP_SLAPD_F (struct sync_cookie *) slap_dup_sync_cookie LDAP_P((
struct slap_limits_set *limit, int which, struct berval *bv ));
LDAP_SLAPD_F (void) limits_unparse LDAP_P((
struct slap_limits *limit, struct berval *bv ));
+LDAP_SLAPD_F (void) limits_destroy LDAP_P(( struct slap_limits **lm ));
/*
* lock.c
const char **text,
char *textbuf, size_t textlen );
+LDAP_SLAPD_F ( int ) slap_mods_no_repl_user_mod_check(
+ Operation *op,
+ Modifications *ml,
+ const char **text,
+ char *textbuf,
+ size_t textlen );
+
LDAP_SLAPD_F( int ) slap_mods_check(
Modifications *ml,
const char **text,
const char **text, char *textbuf, size_t textlen );
LDAP_SLAPD_F( void ) slap_mod_free( Modification *mod, int freeit );
-LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods );
+LDAP_SLAPD_F( void ) slap_mods_free( Modifications *mods, int freevals );
LDAP_SLAPD_F( void ) slap_modlist_free( LDAPModList *ml );
/*
*/
LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be,
const char *uri, const char *host ));
+LDAP_SLAPD_F (int) destroy_replica_info LDAP_P (( Backend *be ));
LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be,
int nr, const char *suffix ));
LDAP_SLAPD_F (int) add_replica_attrs LDAP_P(( Backend *be,
char *textbuf, size_t textlen );
LDAP_SLAPD_F( int ) entry_schema_check(
- Backend *be,
+ Operation *op,
Entry *e,
Attribute *attrs,
int manage,
LDAP_SLAPD_F (int) fe_op_modify LDAP_P((Operation *op, SlapReply *rs));
LDAP_SLAPD_F (int) fe_op_modrdn LDAP_P((Operation *op, SlapReply *rs));
LDAP_SLAPD_F (int) fe_op_search LDAP_P((Operation *op, SlapReply *rs));
+LDAP_SLAPD_F (int) fe_aux_operational LDAP_P((Operation *op, SlapReply *rs));
#if 0
LDAP_SLAPD_F (int) fe_op_unbind LDAP_P((Operation *op, SlapReply *rs));
#endif
LDAP_SLAPD_F (int) fe_extended LDAP_P((Operation *op, SlapReply *rs));
+LDAP_SLAPD_F (int) fe_acl_group LDAP_P((
+ Operation *op,
+ Entry *target,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription *group_at ));
+LDAP_SLAPD_F (int) fe_acl_attribute LDAP_P((
+ Operation *op,
+ Entry *target,
+ struct berval *edn,
+ AttributeDescription *entry_at,
+ BerVarray *vals,
+ slap_access_t access ));
+LDAP_SLAPD_F (int) fe_access_allowed LDAP_P((
+ Operation *op,
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val,
+ slap_access_t access,
+ AccessControlState *state,
+ slap_mask_t *maskp ));
/* NOTE: this macro assumes that bv has been allocated
* by ber_* malloc functions or is { 0L, NULL } */
(bv)->bv_len = len; \
} while ( 0 )
#else /* ! HAVE_BIGNUM && ! HAVE_GMP */
+#ifdef HAVE_LONG_LONG
+#define UI2BV_FORMAT "%llu"
+#else /* ! HAVE_LONG_LONG */
+#define UI2BV_FORMAT "%lu"
+#endif /* ! HAVE_LONG_LONG */
#define UI2BVX(bv,ui,ctx) \
do { \
char buf[] = "+9223372036854775807L"; \
ber_len_t len; \
- snprintf( buf, sizeof( buf ), "%lu", (ui) ); \
- len = strlen( buf ); \
+ len = snprintf( buf, sizeof( buf ), UI2BV_FORMAT, (ui) ); \
if ( len > (bv)->bv_len ) { \
(bv)->bv_val = ber_memrealloc_x( (bv)->bv_val, len + 1, (ctx) ); \
} \
+ (bv)->bv_len = len; \
AC_MEMCPY( (bv)->bv_val, buf, len + 1 ); \
} while ( 0 )
#endif /* ! HAVE_GMP */
int
add_replica_info(
- Backend *be,
- const char *uri,
- const char *host
-)
+ Backend *be,
+ const char *uri,
+ const char *host )
{
int i = 0;
- assert( be );
- assert( host );
+ assert( be != NULL );
+ assert( host != NULL );
if ( be->be_replica != NULL ) {
for ( ; be->be_replica[ i ] != NULL; i++ );
return( i );
}
+int
+destroy_replica_info(
+ Backend *be )
+{
+ int i = 0;
+
+ assert( be != NULL );
+
+ if ( be->be_replica == NULL ) {
+ return 0;
+ }
+
+ for ( ; be->be_replica[ i ] != NULL; i++ ) {
+
+ ch_free( (char *)be->be_replica[ i ]->ri_uri );
+
+ ber_bvarray_free( be->be_replica[ i ]->ri_nsuffix );
+
+ if ( be->be_replica[ i ]->ri_attrs ) {
+ AttributeName *an = be->be_replica[ i ]->ri_attrs;
+ int j;
+
+ for ( j = 0; !BER_BVISNULL( &an[ j ].an_name ); j++ )
+ {
+ ch_free( an[ j ].an_name.bv_val );
+ }
+ ch_free( an );
+ }
+
+ bindconf_free( &be->be_replica[ i ]->ri_bindconf );
+
+ ch_free( be->be_replica[ i ] );
+ }
+
+ ch_free( be->be_replica );
+
+ return 0;
+}
+
int
add_replica_suffix(
Backend *be,
void
replog( Operation *op )
{
- Modifications *ml = NULL;
- Attribute *a = NULL;
FILE *fp, *lfp;
int i;
/* undef NO_LOG_WHEN_NO_REPLICAS */
case LDAP_REQ_MODIFY:
for ( ml = op->orm_modlist; ml != NULL; ml = ml->sml_next ) {
- char *did, *type = ml->sml_desc->ad_cname.bv_val;
+ char *did = NULL, *type = ml->sml_desc->ad_cname.bv_val;
switch ( ml->sml_op ) {
case LDAP_MOD_ADD:
did = "add"; break;
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-#endif
-
const struct berval slap_dummy_bv = BER_BVNULL;
int slap_null_cb( Operation *op, SlapReply *rs )
int slap_freeself_cb( Operation *op, SlapReply *rs )
{
- assert( op->o_callback );
+ assert( op->o_callback != NULL );
op->o_tmpfree( op->o_callback, op->o_tmpmemctx );
op->o_callback = NULL;
send_ldap_controls( Operation *o, BerElement *ber, LDAPControl **c )
{
int rc;
-#ifdef LDAP_SLAPI
- LDAPControl **sctrls = NULL;
-
- /*
- * Retrieve any additional controls that may be set by the
- * plugin.
- */
-
- if ( o->o_pb &&
- slapi_pblock_get( o->o_pb, SLAPI_RESCONTROLS, &sctrls ) != 0 )
- {
- sctrls = NULL;
- }
- if ( c == NULL && sctrls == NULL ) return 0;
-#else
- if( c == NULL ) return 0;
-#endif /* LDAP_SLAPI */
+ if( c == NULL )
+ return 0;
rc = ber_printf( ber, "t{"/*}*/, LDAP_TAG_CONTROLS );
if( rc == -1 ) return rc;
-#ifdef LDAP_SLAPI
- if ( c != NULL )
-#endif /* LDAP_SLAPI */
- {
- for( ; *c != NULL; c++) {
- rc = send_ldap_control( ber, *c );
- if( rc == -1 ) return rc;
- }
+ for( ; *c != NULL; c++) {
+ rc = send_ldap_control( ber, *c );
+ if( rc == -1 ) return rc;
}
#ifdef LDAP_DEVEL
ber_printf( sber, "{i}", LDAP_UNWILLING_TO_PERFORM );
if( ber_flatten2( ber, &sorted.ldctl_value, 0 ) == -1 ) {
- return LBER_ERROR;
+ return -1;
}
(void) ber_free_buf( ber );
}
#endif
-#ifdef LDAP_SLAPI
- if ( sctrls != NULL ) {
- for ( c = sctrls; *c != NULL; c++ ) {
- rc = send_ldap_control( ber, *c );
- if( rc == -1 ) return rc;
- }
- }
-#endif /* LDAP_SLAPI */
-
rc = ber_printf( ber, /*{*/"N}" );
return rc;
goto cleanup;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE, (void *)rs->sr_err );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED,
- (void *)rs->sr_matched );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT, (void *)rs->sr_text );
- }
-#endif /* LDAP_SLAPI */
-
ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes );
}
}
-#ifdef LDAP_SLAPI
- /*
- * Call pre-result plugins. To avoid infinite recursion plugins
- * should just set SLAPI_RESULT_CODE rather than sending a
- * result if they wish to change the result.
- */
- if ( op->o_callback == NULL && op->o_pb != NULL ) {
- slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE,
- (void *)rs->sr_err );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT,
- (void *)rs->sr_text );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED,
- (void *)rs->sr_matched );
-
- (void) slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_RESULT_FN,
- op->o_pb );
- }
-#endif /* LDAP_SLAPI */
-
if ( op->o_protocol < LDAP_VERSION3 ) {
tmp = v2ref( rs->sr_ref, rs->sr_text );
rs->sr_text = tmp;
char *edn;
int userattrs;
AccessControlState acl_state = ACL_STATE_INIT;
-#ifdef LDAP_SLAPI
- /* Support for computed attribute plugins */
- computed_attr_context ctx;
- AttributeName *anp;
-#endif
+ int attrsonly;
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
/* a_flags: array of flags telling if the i-th element will be
*sc_next = op->o_callback;
rc = SLAP_CB_CONTINUE;
- for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
+ for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next )
+ {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_response ) {
rc = op->o_callback->sc_response( op, rs );
op->o_connid, rs->sr_entry->e_name.bv_val,
op->ors_attrsonly ? " (attrsOnly)" : "" );
+ attrsonly = op->ors_attrsonly;
+
if ( !access_allowed( op, rs->sr_entry, ad_entry, NULL, ACL_READ, NULL )) {
Debug( LDAP_DEBUG_ACL,
"send_search_entry: conn %lu access to entry (%s) not allowed\n",
struct berval bv;
bv.bv_len = entry_flatsize( rs->sr_entry, 0 );
- bv.bv_val = op->o_tmpalloc(bv.bv_len, op->o_tmpmemctx );
+ bv.bv_val = op->o_tmpalloc( bv.bv_len, op->o_tmpmemctx );
ber_init2( ber, &bv, LBER_USE_DER );
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
}
}
- if ( op->ors_attrsonly ) {
+ if ( attrsonly ) {
if ( ! access_allowed( op, rs->sr_entry, desc, NULL,
ACL_READ, &acl_state ) )
{
goto error_return;
}
- if ( ! op->ors_attrsonly ) {
+ if ( ! attrsonly ) {
for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
if ( ! access_allowed( op, rs->sr_entry,
desc, &a->a_vals[i], ACL_READ, &acl_state ) )
}
}
-#ifdef LDAP_SLAPI
- /*
- * First, setup the computed attribute context that is
- * passed to all plugins.
- */
- if ( op->o_pb ) {
- ctx.cac_pb = op->o_pb;
- ctx.cac_attrs = rs->sr_attrs;
- ctx.cac_attrsonly = op->ors_attrsonly;
- ctx.cac_userattrs = userattrs;
- ctx.cac_opattrs = rs->sr_attr_flags;
- ctx.cac_acl_state = acl_state;
- ctx.cac_private = (void *)ber;
-
- /*
- * For each client requested attribute, call the plugins.
- */
- if ( rs->sr_attrs != NULL ) {
- for ( anp = rs->sr_attrs; anp->an_name.bv_val != NULL; anp++ ) {
- rc = compute_evaluator( &ctx, anp->an_name.bv_val,
- rs->sr_entry, slapi_int_compute_output_ber );
- if ( rc == 1 ) break;
- }
- } else {
- /*
- * Technically we shouldn't be returning operational attributes
- * when the user requested only user attributes. We'll let the
- * plugin decide whether to be naughty or not.
- */
- rc = compute_evaluator( &ctx, "*",
- rs->sr_entry, slapi_int_compute_output_ber );
- }
- if ( rc == 1 ) {
- if ( op->o_res_ber == NULL ) ber_free_buf( ber );
- send_ldap_error( op, rs, LDAP_OTHER, "computed attribute error" );
- goto error_return;
- }
- }
-#endif /* LDAP_SLAPI */
-
/* free e_flags */
if ( e_flags ) {
slap_sl_free( e_flags, op->o_tmpmemctx );
myop = *op;
myop.o_bd = NULL;
myop.o_res_ber = ber;
+ myop.o_callback = NULL;
rc = slap_send_search_entry( &myop, rs );
if( rc ) return rc;
c.ldctl_oid = oid->bv_val;
c.ldctl_iscritical = 0;
- if ( ctrl == NULL ) {
+ if ( *ctrl == NULL ) {
/* first try */
*ctrl = (LDAPControl *) slap_sl_calloc( 1, sizeof(LDAPControl), NULL );
} else {
const char **text )
{
Entry *e;
- struct berval val, *bv;
- struct berval nval;
+ struct berval val;
+#ifdef LDAP_SLAPI
+ struct berval *bv;
+#endif
int i, j;
char ** supportedSASLMechanisms;
BackendDB *be;
= slap_schema.si_ad_objectClass;
AttributeDescription *ad_namingContexts
= slap_schema.si_ad_namingContexts;
+#ifdef LDAP_SLAPI
AttributeDescription *ad_supportedExtension
= slap_schema.si_ad_supportedExtension;
+#endif
AttributeDescription *ad_supportedLDAPVersion
= slap_schema.si_ad_supportedLDAPVersion;
AttributeDescription *ad_supportedSASLMechanisms
static const char *slap_propnames[] = {
"*slapConn", "*slapAuthcDN", "*slapAuthzDN", NULL };
-static Filter generic_filter = { LDAP_FILTER_PRESENT };
+static Filter generic_filter = { LDAP_FILTER_PRESENT, { 0 }, NULL };
static struct berval generic_filterstr = BER_BVC("(objectclass=*)");
#define PROP_CONN 0
}
}
}
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
return rc != LDAP_SUCCESS ? SASL_FAIL : SASL_OK;
}
#endif /* SASL_VERSION_FULL >= 2.1.16 */
{
Connection *conn = (Connection *)context;
struct propval auxvals[3];
- struct berval authcDN, authzDN=BER_BVNULL;
+ struct berval authcDN, authzDN = BER_BVNULL;
int rc;
/* Simple Binds don't support proxy authorization, ignore it */
return SASL_NOAUTHZ;
}
- conn->c_sasl_authz_dn = authzDN;
+ /* FIXME: we need yet another dup because slap_sasl_getdn()
+ * is using the bind operation slab */
+ if ( conn->c_sasl_bindop ) {
+ ber_dupbv( &conn->c_sasl_authz_dn, &authzDN );
+ slap_sl_free( authzDN.bv_val,
+ conn->c_sasl_bindop->o_tmpmemctx );
+
+ } else {
+ conn->c_sasl_authz_dn = authzDN;
+ }
+
ok:
if (conn->c_sasl_bindop) {
Statslog( LDAP_DEBUG_STATS,
const char **user,
const char **errstr)
{
- struct berval authcDN, authzDN;
+ struct berval authcDN, authzDN = BER_BVNULL;
int rc;
Connection *conn = context;
char *realm;
return SASL_NOAUTHZ;
}
- rc = slap_sasl_authorized(conn->c_sasl_bindop, &authcDN, &authzDN );
+ rc = slap_sasl_authorized( conn->c_sasl_bindop, &authcDN, &authzDN );
if( rc ) {
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
"proxy authorization disallowed (%d)\n",
ch_free( authzDN.bv_val );
return SASL_NOAUTHZ;
}
- conn->c_sasl_authz_dn = authzDN;
+
+ /* FIXME: we need yet another dup because slap_sasl_getdn()
+ * is using the bind operation slab */
+ if ( conn->c_sasl_bindop ) {
+ ber_dupbv( &conn->c_sasl_authz_dn, &authzDN );
+ slap_sl_free( authzDN.bv_val,
+ conn->c_sasl_bindop->o_tmpmemctx );
+
+ } else {
+ conn->c_sasl_authz_dn = authzDN;
+ }
ok:
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
(long) (conn ? conn->c_connid : -1),
authzDN.bv_val ? authzDN.bv_val : "", 0 );
- if (conn->c_sasl_bindop) {
+ if ( conn->c_sasl_bindop ) {
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu BIND authcid=\"%s\" authzid=\"%s\"\n",
conn->c_connid, conn->c_sasl_bindop->o_opid,
int rc, is_dn = SET_NONE, do_norm = 1;
struct berval dn2, *mech;
- assert( conn );
- assert( id );
+ assert( conn != NULL );
+ assert( id != NULL );
Debug( LDAP_DEBUG_ARGS, "slap_sasl_getdn: conn %lu id=%s [len=%lu]\n",
conn->c_connid,
if ( !op ) {
op = conn->c_sasl_bindop;
}
+ assert( op != NULL );
BER_BVZERO( dn );
irdn++;
DN[ irdn ] = NULL;
- rc = ldap_dn2bv_x( DN, dn, LDAP_DN_FORMAT_LDAPV3, op->o_tmpmemctx );
+ rc = ldap_dn2bv_x( DN, dn, LDAP_DN_FORMAT_LDAPV3,
+ op->o_tmpmemctx );
if ( rc != LDAP_SUCCESS ) {
BER_BVZERO( dn );
return rc;
}
- Debug( LDAP_DEBUG_TRACE, "slap_sasl_getdn: u:id converted to %s\n", dn->bv_val,0,0 );
+ Debug( LDAP_DEBUG_TRACE,
+ "slap_sasl_getdn: u:id converted to %s\n",
+ dn->bv_val, 0, 0 );
} else {
if( !BER_BVISNULL( &dn2 ) ) {
slap_sl_free( dn->bv_val, op->o_tmpmemctx );
*dn = dn2;
- Debug( LDAP_DEBUG_TRACE, "getdn: dn:id converted to %s\n",
+ Debug( LDAP_DEBUG_TRACE,
+ "slap_sasl_getdn: dn:id converted to %s\n",
dn->bv_val, 0, 0 );
}
static int authz_policy = SASL_AUTHZ_NONE;
-static
-int slap_sasl_match( Operation *opx, struct berval *rule,
+static int
+slap_sasl_match( Operation *opx, struct berval *rule,
struct berval *assertDN, struct berval *authc );
int slap_sasl_setpolicy( const char *arg )
{
char u;
- assert( id );
+ assert( id != NULL );
assert( !BER_BVISNULL( id ) );
- assert( user );
- assert( realm );
- assert( mech );
+ assert( user != NULL );
+ assert( realm != NULL );
+ assert( mech != NULL );
u = id->bv_val[ 0 ];
"slap_parseURI: parsing %s\n", uri->bv_val, 0, 0 );
rc = LDAP_PROTOCOL_ERROR;
+
/*
* dn[.<dnstyle>]:<dnpattern>
* <dnstyle> ::= {exact|regex|children|subtree|onelevel}
} else {
group_oc.bv_len = group_dn.bv_val - group_oc.bv_val;
- BER_BVSTR( &member_at, "member" );
+ BER_BVSTR( &member_at, SLAPD_GROUP_ATTR );
}
} else {
- BER_BVSTR( &group_oc, "groupOfNames" );
+ BER_BVSTR( &group_oc, SLAPD_GROUP_CLASS );
}
group_dn.bv_val++;
group_dn.bv_len = uri->bv_len - ( group_dn.bv_val - uri->bv_val );
/*
* must be ldap:///
*/
- return LDAP_PROTOCOL_ERROR;
+ rc = LDAP_PROTOCOL_ERROR;
+ goto done;
}
break;
*
* NOTE: must pass DN normalization
*/
+ ldap_free_urldesc( ludp );
bv.bv_val = uri->bv_val;
*scope = LDAP_X_SCOPE_EXACT;
goto is_dn;
default:
- return LDAP_PROTOCOL_ERROR;
+ rc = LDAP_PROTOCOL_ERROR;
+ goto done;
}
if ( ( ludp->lud_host && *ludp->lud_host )
return( rc );
}
+#ifndef SLAP_AUTH_REWRITE
static int slap_sasl_rx_off(char *rep, int *off)
{
const char *c;
off[n] = -1;
return( LDAP_SUCCESS );
}
+#endif /* ! SLAP_AUTH_REWRITE */
#ifdef SLAP_AUTH_REWRITE
int slap_sasl_rewrite_config(
void slap_sasl_regexp_unparse( BerVarray *out )
{
int i;
- struct berval bv;
BerVarray bva = NULL;
char ibuf[32], *ptr;
struct berval idx;
*out = bva;
}
+#ifndef SLAP_AUTH_REWRITE
/* Perform replacement on regexp matches */
static void slap_sasl_rx_exp(
const char *rep,
out->bv_val[insert] = '\0';
}
+#endif /* ! SLAP_AUTH_REWRITE */
/* Take the passed in SASL name and attempt to convert it into an
LDAP URI to find the matching LDAP entry, using the pattern matching
* The assertDN should not have the dn: prefix
*/
-static
-int slap_sasl_match( Operation *opx, struct berval *rule,
+static int
+slap_sasl_match( Operation *opx, struct berval *rule,
struct berval *assertDN, struct berval *authc )
{
int rc;
AttributeDescription *ad,
struct berval *authc )
{
- int i, rc;
+ int rc;
BerVarray vals = NULL;
Debug( LDAP_DEBUG_TRACE,
* an internal search must be done, and if that search returns exactly one
* entry, return the DN of that one entry.
*/
-void slap_sasl2dn( Operation *opx,
- struct berval *saslname, struct berval *sasldn, int flags )
+void
+slap_sasl2dn(
+ Operation *opx,
+ struct berval *saslname,
+ struct berval *sasldn,
+ int flags )
{
int rc;
slap_callback cb = { NULL, sasl_sc_sasl2dn, NULL, NULL };
}
nvals[0].bv_val = strchr( frontendDB->be_schemandn.bv_val, '=' );
- assert( nvals[0].bv_val );
+ assert( nvals[0].bv_val != NULL );
nvals[0].bv_val++;
nvals[0].bv_len = frontendDB->be_schemandn.bv_len -
(nvals[0].bv_val - frontendDB->be_schemandn.bv_val);
objectclass ( 1.3.6.1.4.1.250.3.15 NAME 'labeledURIObject'
DESC 'RFC2079: object that contains the URI attribute type'
- MAY ( labeledURI )
- SUP top AUXILIARY )
+ SUP top AUXILIARY
+ MAY ( labeledURI ) )
#
# Derived from RFC 1274, but with new "short names"
# ::= {pilotAttributeType 20}
#
attributetype ( 0.9.2342.19200300.100.1.20
- DESC 'RFC1274: home telephone number'
NAME ( 'homePhone' 'homeTelephoneNumber' )
+ DESC 'RFC1274: home telephone number'
EQUALITY telephoneNumberMatch
SUBSTR telephoneNumberSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
# Object Class Definitions
-objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount' SUP top AUXILIARY
+objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount'
DESC 'Abstraction of an account with POSIX attributes'
+ SUP top AUXILIARY
MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
MAY ( userPassword $ loginShell $ gecos $ description ) )
-objectclass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' SUP top AUXILIARY
+objectclass ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount'
DESC 'Additional attributes for shadow passwords'
+ SUP top AUXILIARY
MUST uid
MAY ( userPassword $ shadowLastChange $ shadowMin $
shadowMax $ shadowWarning $ shadowInactive $
shadowExpire $ shadowFlag $ description ) )
-objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.2 NAME 'posixGroup'
DESC 'Abstraction of a group of accounts'
+ SUP top AUXILIARY
MUST ( cn $ gidNumber )
MAY ( userPassword $ memberUid $ description ) )
-objectclass ( 1.3.6.1.1.1.2.3 NAME 'ipService' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.3 NAME 'ipService'
DESC 'Abstraction an Internet Protocol service'
+ SUP top STRUCTURAL
MUST ( cn $ ipServicePort $ ipServiceProtocol )
MAY ( description ) )
-objectclass ( 1.3.6.1.1.1.2.4 NAME 'ipProtocol' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.4 NAME 'ipProtocol'
DESC 'Abstraction of an IP protocol'
+ SUP top STRUCTURAL
MUST ( cn $ ipProtocolNumber $ description )
MAY description )
-objectclass ( 1.3.6.1.1.1.2.5 NAME 'oncRpc' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.5 NAME 'oncRpc'
DESC 'Abstraction of an ONC/RPC binding'
+ SUP top STRUCTURAL
MUST ( cn $ oncRpcNumber $ description )
MAY description )
-objectclass ( 1.3.6.1.1.1.2.6 NAME 'ipHost' SUP top AUXILIARY
+objectclass ( 1.3.6.1.1.1.2.6 NAME 'ipHost'
DESC 'Abstraction of a host, an IP device'
+ SUP top AUXILIARY
MUST ( cn $ ipHostNumber )
MAY ( l $ description $ manager ) )
-objectclass ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork'
DESC 'Abstraction of an IP network'
+ SUP top STRUCTURAL
MUST ( cn $ ipNetworkNumber )
MAY ( ipNetmaskNumber $ l $ description $ manager ) )
-objectclass ( 1.3.6.1.1.1.2.8 NAME 'nisNetgroup' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.8 NAME 'nisNetgroup'
DESC 'Abstraction of a netgroup'
+ SUP top STRUCTURAL
MUST cn
MAY ( nisNetgroupTriple $ memberNisNetgroup $ description ) )
-objectclass ( 1.3.6.1.1.1.2.9 NAME 'nisMap' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.9 NAME 'nisMap'
DESC 'A generic abstraction of a NIS map'
+ SUP top STRUCTURAL
MUST nisMapName
MAY description )
-objectclass ( 1.3.6.1.1.1.2.10 NAME 'nisObject' SUP top STRUCTURAL
+objectclass ( 1.3.6.1.1.1.2.10 NAME 'nisObject'
DESC 'An entry in a NIS map'
+ SUP top STRUCTURAL
MUST ( cn $ nisMapEntry $ nisMapName )
MAY description )
-objectclass ( 1.3.6.1.1.1.2.11 NAME 'ieee802Device' SUP top AUXILIARY
+objectclass ( 1.3.6.1.1.1.2.11 NAME 'ieee802Device'
DESC 'A device with a MAC address'
+ SUP top AUXILIARY
MAY macAddress )
-objectclass ( 1.3.6.1.1.1.2.12 NAME 'bootableDevice' SUP top AUXILIARY
+objectclass ( 1.3.6.1.1.1.2.12 NAME 'bootableDevice'
DESC 'A device with boot parameters'
+ SUP top AUXILIARY
MAY ( bootFile $ bootParameter ) )
int
entry_schema_check(
- Backend *be,
+ Operation *op,
Entry *e,
Attribute *oldattrs,
int manage,
int subentry = is_entry_subentry( e );
int collectiveSubentry = 0;
- if ( SLAP_NO_SCHEMA_CHECK( be )) {
+ if ( SLAP_NO_SCHEMA_CHECK( op->o_bd )) {
+ return LDAP_SUCCESS;
+ }
+
+ if ( get_no_schema_check( op ) ) {
return LDAP_SUCCESS;
}
const char *type = a->a_desc->ad_cname.bv_val;
/* there should be at least one value */
- assert( a->a_vals );
+ assert( a->a_vals != NULL );
assert( a->a_vals[0].bv_val != NULL );
if( a->a_desc->ad_type->sat_check ) {
int rc = (a->a_desc->ad_type->sat_check)(
- be, e, a, text, textbuf, textlen );
+ op->o_bd, e, a, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;
}
}
if ( oc->soc_check ) {
- int rc = (oc->soc_check)( be, e, oc,
+ int rc = (oc->soc_check)( op->o_bd, e, oc,
text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
return rc;
BerVarray *keysp,
void *ctx )
{
- ber_len_t i, j, len, nkeys;
+ ber_len_t i, nkeys;
size_t slen, mlen;
BerVarray keys;
{
SubstringsAssertion *sa;
char pre;
- ber_len_t len, max, nkeys = 0;
+ ber_len_t nkeys = 0;
size_t slen, mlen, klen;
BerVarray keys;
HASH_CONTEXT HASHcontext;
struct berval *out,
void *ctx )
{
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> nameUIDPretty: <%s>\n", val->bv_val, 0, 0 );
struct berval *in )
{
int rc;
- int state;
ber_len_t n;
struct berval sn, i;
if( in->bv_len < 3 ) return LDAP_INVALID_SYNTAX;
void *ctx )
{
int rc;
- int state;
ber_len_t n;
struct berval sn, i, newi;
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> serialNumberAndIssuerPretty: <%s>\n",
val->bv_val, 0, 0 );
out->bv_len = sn.bv_len + newi.bv_len + 1;
out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
- if( BER_BVISNULL( out ) ) {
+ if( out->bv_val == NULL ) {
+ out->bv_len = 0;
slap_sl_free( newi.bv_val, ctx );
return LDAP_OTHER;
}
/* push issuer over */
- AC_MEMCPY( &out->bv_val[sn.bv_len+1], newi.bv_val, newi.bv_len );
+ AC_MEMCPY( &out->bv_val[sn.bv_len+1], out->bv_val, newi.bv_len );
/* insert sn and "$" */
AC_MEMCPY( out->bv_val, sn.bv_val, sn.bv_len );
out->bv_val[sn.bv_len] = '$';
void *ctx )
{
int rc;
- int state;
ber_len_t n;
struct berval sn, i, newi;
- assert( val );
- assert( out );
+ assert( val != NULL );
+ assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> serialNumberAndIssuerNormalize: <%s>\n",
val->bv_val, 0, 0 );
out->bv_len = sn.bv_len + newi.bv_len + 1;
out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx );
- if( BER_BVISNULL( out ) ) {
+ if( out->bv_val == NULL ) {
+ out->bv_len = 0;
slap_sl_free( newi.bv_val, ctx );
return LDAP_OTHER;
}
/* push issuer over */
- AC_MEMCPY( &out->bv_val[sn.bv_len+1], newi.bv_val, newi.bv_len );
+ AC_MEMCPY( &out->bv_val[sn.bv_len+1], out->bv_val, newi.bv_len );
/* insert sn and "$" */
AC_MEMCPY( out->bv_val, sn.bv_val, sn.bv_len );
out->bv_val[sn.bv_len] = '$';
void *ctx )
{
int i, j;
- size_t slen, mlen;
BerVarray keys;
char tmp[5];
BerValue bvtmp; /* 40 bit index */
ocvalues[noc] = sup->soc_cname;
- assert( ocvalues[noc].bv_val );
- assert( ocvalues[noc].bv_len );
+ assert( ocvalues[noc].bv_val != NULL );
+ assert( ocvalues[noc].bv_len != 0 );
noc++;
static ObjectClassSchemaCheckFN aliasObjectClass;
static ObjectClassSchemaCheckFN referralObjectClass;
static ObjectClassSchemaCheckFN subentryObjectClass;
+#ifdef LDAP_DYNAMIC_OBJECTS
static ObjectClassSchemaCheckFN dynamicObjectClass;
+#endif
static struct slap_schema_oc_map {
char *ssom_name;
static AttributeTypeSchemaCheckFN referralAttribute;
static AttributeTypeSchemaCheckFN subentryAttribute;
static AttributeTypeSchemaCheckFN administrativeRoleAttribute;
+#ifdef LDAP_DYNAMIC_OBJECTS
static AttributeTypeSchemaCheckFN dynamicAttribute;
+#endif
static struct slap_schema_ad_map {
char *ssam_name;
mr->smr_filter = ad_map[i].ssam_mr_filter;
}
+ /* FIXME: no-one will free this at exit */
(*adp)->ad_type->sat_equality = mr;
}
}
return LDAP_SUCCESS;
}
+#ifdef LDAP_DYNAMIC_OBJECTS
static int dynamicObjectClass (
Backend *be,
Entry *e,
return LDAP_SUCCESS;
}
+#endif /* LDAP_DYNAMIC_OBJECTS */
static int rootDseAttribute (
Backend *be,
return LDAP_OBJECT_CLASS_VIOLATION;
}
+#ifdef LDAP_DYNAMIC_OBJECTS
static int dynamicAttribute (
Backend *be,
Entry *e,
return LDAP_SUCCESS;
}
+#endif /* LDAP_DYNAMIC_OBJECTS */
#include "lutil.h"
#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-
-static void init_search_pblock( Operation *op, char **attrs, int managedsait );
-static int call_search_preop_plugins( Operation *op );
-static int call_search_rewrite_plugins( Operation *op );
-static void call_search_postop_plugins( Operation *op );
-#endif /* LDAPI_SLAPI */
-
int
do_search(
Operation *op, /* info about the op to which we're responding */
{
int manageDSAit;
int be_manageDSAit;
-#ifdef LDAP_SLAPI
- char **attrs = NULL;
-#endif
manageDSAit = get_manageDSAit( op );
goto return_results;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- attrs = anlist2charray_x( op->ors_attrs, 0, op->o_tmpmemctx );
- init_search_pblock( op, attrs, manageDSAit );
- rs->sr_err = call_search_preop_plugins( op );
- if ( rs->sr_err ) break;
- call_search_rewrite_plugins( op );
- }
-#endif /* LDAP_SLAPI */
rs->sr_err = root_dse_info( op->o_conn, &entry, &rs->sr_text );
} else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) {
goto return_results;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- attrs = anlist2charray_x( op->ors_attrs, 0, op->o_tmpmemctx );
- init_search_pblock( op, attrs, manageDSAit );
- rs->sr_err = call_search_preop_plugins( op );
- if ( rs->sr_err ) break;
- call_search_rewrite_plugins( op );
- }
-#endif /* LDAP_SLAPI */
rs->sr_err = schema_info( &entry, &rs->sr_text );
}
if( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_search_postop_plugins( op );
-#endif /* LDAP_SLAPI */
goto return_results;
} else if ( entry != NULL ) {
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_search_postop_plugins( op );
-#endif /* LDAP_SLAPI */
goto return_results;
}
break;
goto return_results;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- attrs = anlist2charray_x( op->ors_attrs, 0, op->o_tmpmemctx );
- init_search_pblock( op, attrs, manageDSAit );
- rs->sr_err = call_search_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- goto return_results;
- }
-
- call_search_rewrite_plugins( op );
- }
-#endif /* LDAP_SLAPI */
-
/* actually do the search and send the result(s) */
if ( op->o_bd->be_search ) {
if ( limits_check( op, rs ) == 0 ) {
"operation not supported within namingContext" );
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_search_postop_plugins( op );
-#endif /* LDAP_SLAPI */
-
-#ifdef LDAP_SLAPI
- if( attrs != NULL) op->o_tmpfree( attrs, op->o_tmpmemctx );
-#endif /* LDAP_SLAPI */
-
return_results:;
return rs->sr_err;
}
-#ifdef LDAP_SLAPI
-
-static void init_search_pblock( Operation *op,
- char **attrs, int managedsait )
-{
- slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TARGET, (void *)op->o_req_dn.bv_val );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SCOPE, (void *)op->ors_scope );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_DEREF, (void *)op->ors_deref );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_SIZELIMIT, (void *)op->ors_slimit );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_TIMELIMIT, (void *)op->ors_tlimit );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_FILTER, (void *)op->ors_filter );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_STRFILTER, (void *)op->ors_filterstr.bv_val );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
- slapi_pblock_set( op->o_pb, SLAPI_SEARCH_ATTRSONLY, (void *)op->ors_attrsonly );
- slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)managedsait );
-}
-
-static int call_search_preop_plugins( Operation *op )
-{
- int rc;
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_SEARCH_FN, op->o_pb );
- if ( rc < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- Debug(LDAP_DEBUG_TRACE, "call_search_preop_plugins: search preoperation plugin "
- "returned %d.\n", rc, 0, 0);
- if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
- rc == LDAP_SUCCESS ) {
- rc = LDAP_OTHER;
- }
- } else {
- rc = LDAP_SUCCESS;
- }
-
- return rc;
-}
-
-static int call_search_rewrite_plugins( Operation *op )
-{
- if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
- int rc;
-
- /*
- * The plugin can set the SLAPI_SEARCH_FILTER.
- * SLAPI_SEARCH_STRFILER is not normative.
- */
- slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter );
- op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
- filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
-
- /*
- * Also permit other search parameters to be reset. One thing
- * this doesn't (yet) deal with is plugins that change a root
- * DSE search to a non-root DSE search...
- */
- slapi_pblock_get( op->o_pb, SLAPI_SEARCH_TARGET, (void **)&op->o_req_dn.bv_val );
- op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
-
- if( !BER_BVISNULL( &op->o_req_ndn ) ) {
- slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
- }
- rc = dnNormalize( 0, NULL, NULL, &op->o_req_dn, &op->o_req_ndn,
- op->o_tmpmemctx );
- if ( rc != LDAP_SUCCESS ) {
- return rc;
- }
-
- slapi_pblock_get( op->o_pb, SLAPI_SEARCH_SCOPE, (void **)&op->ors_scope );
- slapi_pblock_get( op->o_pb, SLAPI_SEARCH_DEREF, (void **)&op->ors_deref );
-
- Debug( LDAP_DEBUG_ARGS, " after compute_rewrite_search filter: %s\n",
- !BER_BVISEMPTY( &op->ors_filterstr ) ? op->ors_filterstr.bv_val : "empty", 0, 0 );
- }
-
- return LDAP_SUCCESS;
-}
-
-static void call_search_postop_plugins( Operation *op )
-{
- if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_SEARCH_FN, op->o_pb ) < 0 ) {
- Debug(LDAP_DEBUG_TRACE, "call_search_postop_plugins: search postoperation plugins "
- "failed.\n", 0, 0, 0);
- }
-}
-
-void slapi_int_dummy(void)
-{
- /*
- * XXX slapi_search_internal() was no getting pulled
- * in; all manner of linker flags failed to link it.
- * FIXME
- */
- slapi_search_internal( NULL, 0, NULL, NULL, NULL, 0 );
-}
-#endif /* LDAP_SLAPI */
-
void *ctx
)
{
- struct slab_heap *sh = NULL;
+ struct slab_heap *sh;
ber_len_t size_shift;
int pad = 2*sizeof(int)-1, pad_shift;
int order = -1, order_start = -1, order_end = -1;
- int i, k;
+ int i;
struct slab_object *so;
#ifdef NO_THREADS
sh = slheap;
#else
+ void *sh_tmp = NULL;
ldap_pvt_thread_pool_getkey(
- ctx, (void *)slap_sl_mem_init, (void **)&sh, NULL );
+ ctx, (void *)slap_sl_mem_init, &sh_tmp, NULL );
+ sh = sh_tmp;
#endif
/* round up to doubleword boundary */
struct slab_object *so_new, *so_left, *so_right;
ber_len_t *ptr, *new;
unsigned long diff;
- int i, j, k;
+ int i, j;
/* ber_set_option calls us like this */
if (!ctx) return ber_memalloc_x(size, NULL);
slap_sl_realloc(void *ptr, ber_len_t size, void *ctx)
{
struct slab_heap *sh = ctx;
- int size_shift;
- int pad = 2*sizeof(int)-1, pad_shift;
- int order_start = -1, order = -1;
- struct slab_object *so;
+ int pad = 2*sizeof(int) -1;
ber_len_t *p = (ber_len_t *)ptr, *new;
- unsigned long diff;
if (ptr == NULL)
return slap_sl_malloc(size, ctx);
int order_start = -1, order = -1;
struct slab_object *so;
unsigned long diff;
- int i, k, inserted = 0;
+ int i, inserted = 0;
if (!sh || ptr < sh->sh_base || ptr >= sh->sh_end) {
ber_memfree_x(ptr, NULL);
Debug(LDAP_DEBUG_TRACE, "slap_sl_free: "
"free object not found while bit is clear.\n",
0, 0, 0);
- assert(so);
+ assert(so != NULL);
}
} else {
Debug(LDAP_DEBUG_TRACE, "slap_sl_free: "
"free object not found while bit is clear.\n",
0, 0, 0 );
- assert( so );
+ assert(so != NULL);
}
} else {
void *
slap_sl_context( void *ptr )
{
- struct slab_heap *sh = NULL;
- void *ctx;
+ struct slab_heap *sh;
+ void *ctx, *sh_tmp;
if ( slapMode & SLAP_TOOL_MODE ) return NULL;
#else
ctx = ldap_pvt_thread_pool_context();
- ldap_pvt_thread_pool_getkey(ctx, (void *)slap_sl_mem_init,
- (void **)&sh, NULL);
+ sh_tmp = NULL;
+ ldap_pvt_thread_pool_getkey(
+ ctx, (void *)slap_sl_mem_init, &sh_tmp, NULL);
+ sh = sh_tmp;
#endif
if (sh && ptr >= sh->sh_base && ptr <= sh->sh_end) {
#endif
#endif
+#if defined(LDAP_SLAPI) && !defined(SLAP_OVERLAY_ACCESS)
+#define SLAP_OVERLAY_ACCESS
+#endif
+
/*
* ITS#3705: bail out if unknown config directives appear in slapd.conf
*/
typedef int (BI_access_allowed) LDAP_P(( struct slap_op *op, Entry *e,
AttributeDescription *desc, struct berval *val, slap_access_t access,
AccessControlState *state, slap_mask_t *maskp ));
+typedef int (BI_acl_group) LDAP_P(( struct slap_op *op, Entry *target,
+ struct berval *gr_ndn, struct berval *op_ndn,
+ ObjectClass *group_oc, AttributeDescription *group_at ));
+typedef int (BI_acl_attribute) LDAP_P(( struct slap_op *op, Entry *target,
+ struct berval *entry_ndn, AttributeDescription *entry_at,
+ BerVarray *vals, slap_access_t access ));
#endif /* SLAP_OVERLAY_ACCESS */
typedef int (BI_connection_init) LDAP_P(( BackendDB *bd,
BI_has_subordinates *bi_has_subordinates;
#ifdef SLAP_OVERLAY_ACCESS
BI_access_allowed *bi_access_allowed;
+ BI_acl_group *bi_acl_group;
+ BI_acl_attribute *bi_acl_attribute;
#endif /* SLAP_OVERLAY_ACCESS */
BI_connection_init *bi_connection_init;
struct slap_overinfo;
+typedef enum slap_operation_e {
+ op_bind = 0,
+ op_unbind,
+ op_search,
+ op_compare,
+ op_modify,
+ op_modrdn,
+ op_add,
+ op_delete,
+ op_abandon,
+ op_cancel,
+ op_extended,
+ op_aux_operational,
+ op_aux_chk_referrals,
+ op_aux_chk_controls,
+ op_last
+} slap_operation_t;
+
typedef struct slap_overinst {
BackendInfo on_bi;
slap_response *on_response;
char oh_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
#ifdef LDAP_SLAPI
- void *oh_pb; /* NS-SLAPI plugin */
void *oh_extensions; /* NS-SLAPI plugin */
#endif
} Opheader;
#define o_log_prefix o_hdr->oh_log_prefix
-#ifdef LDAP_SLAPI
-#define o_pb o_hdr->oh_pb
-#define o_extensions o_hdr->oh_extensions
-#endif
-
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
int o_tincr; /* counter for multiple ops with same o_time */
char o_nocaching;
char o_delete_glue_parent;
+ char o_no_schema_check;
+#define get_no_schema_check(op) ((op)->o_no_schema_check)
#define SLAP_CONTROL_NONE 0
#define SLAP_CONTROL_IGNORED 1
ID ctxcsn_id, id;
int ret;
struct berval bvtext;
- int i, checkvals;
- struct berval mc;
+ int checkvals;
+ char opbuf[OPERATION_BUFFER_SIZE];
+ Operation *op;
+
slap_tool_init( progname, SLAPADD, argc, argv );
+ memset( opbuf, 0, sizeof(opbuf) );
+ op = (Operation *)opbuf;
+
if( !be->be_entry_open ||
!be->be_entry_close ||
!be->be_entry_put )
}
/* check schema */
- rc = entry_schema_check( be, e, NULL, manage,
+ op->o_bd = be;
+
+ rc = entry_schema_check( op, e, NULL, manage,
&text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
if( continuemode ) continue;
break;
}
- }
-
- if ( verbose ) {
- if ( dryrun ) {
- fprintf( stderr, "added: \"%s\"\n",
- e->e_dn );
- } else {
+ if ( verbose )
fprintf( stderr, "added: \"%s\" (%08lx)\n",
e->e_dn, (long) id );
- }
+ } else {
+ if ( verbose )
+ fprintf( stderr, "added: \"%s\"\n",
+ e->e_dn );
}
-done:;
entry_free( e );
}
LIB_DEFS = -DSLAPI_LIBRARY
-SRCS= plugin.c slapi_pblock.c slapi_utils.c printmsg.c slapi_ops.c slapi_ext.c \
+SRCS= plugin.c slapi_pblock.c slapi_utils.c printmsg.c slapi_ops.c slapi_dn.c slapi_ext.c slapi_overlay.c \
$(@PLAT@_SRCS)
-OBJS= plugin.lo slapi_pblock.lo slapi_utils.lo printmsg.lo slapi_ops.lo slapi_ext.lo \
+OBJS= plugin.lo slapi_pblock.lo slapi_utils.lo printmsg.lo slapi_ops.lo slapi_dn.lo slapi_ext.lo slapi_overlay.lo \
$(@PLAT@_SRCS)
XSRCS= version.c
- This is a very tough task: try to implement a sandbox to execute
plugins in, trap deadly signals and possibly disable unsafe plugins
without crashing slapd (fork from inside thread? trap signals
- and longjump to next plugin execution? Brrr).
+ and longjump to next plugin execution? Brrr).
---
$OpenLDAP$
+++ /dev/null
-/* $OpenLDAP$ */
-/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 2002-2005 The OpenLDAP Foundation.
- * Portions Copyright 1997,2002-2003 IBM Corporation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-/* ACKNOWLEDGEMENTS:
- * This work was initially developed by IBM Corporation for use in
- * IBM products and subsequently ported to OpenLDAP Software by
- * Steve Omrani.
- */
-
-#ifndef _ibm_pblock_params_H
-#define _ibm_pblock_params_H
-
-#define FIRST_PARAM -1
-#define LAST_IBM_PARAM -48
-#define NETSCAPE_RESERVED(p) (p >= 280) && (p <= 299)
-#define IBM_RESERVED(p) (p >= LAST_IBM_PARAM) && (p <= FIRST_PARAM)
-
-#define SLAPI_IBM_THREAD_CONTROL (FIRST_PARAM - 1)
-#define SLAPI_IBM_PBLOCK (FIRST_PARAM - 2)
-#define SLAPI_IBM_CONNECTION_PTR (FIRST_PARAM - 3)
-#define SLAPI_IBM_BACKENDS (FIRST_PARAM - 4)
-#define SLAPI_PRE_BIND_ALL (FIRST_PARAM - 5)
-#define SLAPI_POST_BIND_ALL (FIRST_PARAM - 6)
-#define SLAPI_IBM_ADMIN_DN (FIRST_PARAM - 7)
-#define SLAPI_CONFIG_STATE (FIRST_PARAM - 8)
-#define SLAPI_PLUGIN_DB_REGISTER_SERVICE_FN (FIRST_PARAM - 9)
-#define SLAPI_PLUGIN_DB_INSERT_REPL_ENTRIES_FN (FIRST_PARAM - 10)
-#define SLAPI_PLUGIN_DB_GET_REPL_ENTRIES_FN (FIRST_PARAM - 11)
-#define SLAPI_PLUGIN_DB_REPLICA_DONE_FN (FIRST_PARAM - 12)
-#define SLAPI_PLUGIN_DB_INIT_REPL_LIST_FN (FIRST_PARAM - 13)
-#define SLAPI_PLUGIN_DB_THREAD_INITIALIZE_FN (FIRST_PARAM - 14)
-#define SLAPI_PLUGIN_DB_THREAD_TERMINATE_FN (FIRST_PARAM - 15)
-#define SLAPI_PLUGIN_DB_SCHEMA_MODIFY_ATTRTYPE_FN (FIRST_PARAM - 16)
-#define SLAPI_PLUGIN_DB_SCHEMA_MODIFY_OBJCLASS_FN (FIRST_PARAM - 17)
-#define SLAPI_PLUGIN_DB_INIT_FN (FIRST_PARAM - 18)
-#define SLAPI_IBM_EXTENDED_OPS (FIRST_PARAM - 19)
-#define SLAPI_IBM_CONTROLS (FIRST_PARAM - 20)
-#define SLAPI_IBM_SASLMECHANISMS (FIRST_PARAM - 21)
-#define SLAPI_IBM_BROADCAST_BE (FIRST_PARAM - 22)
-#define SLAPI_IBM_NOTIFY_BIND_FN (FIRST_PARAM - 23)
-#define SLAPI_IBM_SECRET (FIRST_PARAM - 24)
-#define SLAPI_IBM_CL_START_FN (FIRST_PARAM - 25)
-#define SLAPI_IBM_REPLICATE (FIRST_PARAM - 26)
-#define SLAPI_IBM_CL_CLASS (FIRST_PARAM - 27)
-#define SLAPI_IBM_CL_SUFFIX (FIRST_PARAM - 28)
-#define SLAPI_IBM_CL_MAX_ENTRIES (FIRST_PARAM - 29)
-#define SLAPI_IBM_CONNINFO (FIRST_PARAM - 30)
-#define SLAPI_IBM_CL_FIRST_ENTRY (FIRST_PARAM - 31)
-#define SLAPI_IBM_CL_LAST_ENTRY (FIRST_PARAM - 32)
-#define SLAPI_IBM_CONN_DN_ALT (FIRST_PARAM - 33)
-#define SLAPI_IBM_GSSAPI_CONTEXT (FIRST_PARAM - 34)
-#define SLAPI_IBM_ADD_ENTRY (FIRST_PARAM - 35)
-#define SLAPI_IBM_DELETE_ENTRY (FIRST_PARAM - 36)
-#define SLAPI_IBM_MODIFY_ENTRY (FIRST_PARAM - 37)
-#define SLAPI_IBM_MODIFY_MODS (FIRST_PARAM - 38)
-#define SLAPI_IBM_MODRDN_ENTRY (FIRST_PARAM - 39)
-#define SLAPI_IBM_MODRDN_NEWDN (FIRST_PARAM - 40)
-#define SLAPI_IBM_EVENT_ENABLED (FIRST_PARAM - 41)
-#define SLAPI_IBM_EVENT_MAXREG (FIRST_PARAM - 42)
-#define SLAPI_IBM_EVENT_REGPERCONN (FIRST_PARAM - 43)
-#define SLAPI_IBM_EVENT_CURREG (FIRST_PARAM - 44)
-#define SLAPI_IBM_EVENT_SENTREG (FIRST_PARAM - 45)
-#define SLAPI_IBM_CONN_DN_ORIG (FIRST_PARAM - 46)
-#define SLAPI_PLUGIN_DB_DELETE_PROGRESS_FN (FIRST_PARAM - 47)
-#endif /* _ibm_pblock_params_H */
/* pointer to link list of extended objects */
static ExtendedOp *pGExtendedOps = NULL;
-/* global plugins not associated with a specific backend */
-static Slapi_PBlock *pGPlugins = NULL;
/*********************************************************************
* Function Name: plugin_pblock_new
Slapi_PluginDesc *pPluginDesc = NULL;
lt_dlhandle hdLoadHandle;
int rc;
- char **av2 = NULL, **ppPluginArgv;
- char *path = argv[2];
- char *initfunc = argv[3];
+ char **av2 = NULL, **ppPluginArgv;
+ char *path = argv[2];
+ char *initfunc = argv[3];
pPlugin = slapi_pblock_new();
if ( pPlugin == NULL ) {
goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)type );
- if ( rc != 0 ) {
- goto done;
- }
-
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGC, (void *)argc );
- if ( rc != 0 ) {
- goto done;
- }
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGC, (void *)&argc );
av2 = ldap_charray_dup( argv );
- if ( !av2 ) {
+ if ( av2 == NULL ) {
rc = LDAP_NO_MEMORY;
goto done;
}
} else {
ppPluginArgv = NULL;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGV, (void *)ppPluginArgv );
- if ( rc != 0 ) {
- goto done;
- }
- rc = slapi_pblock_set( pPlugin, SLAPI_X_CONFIG_ARGV, (void *)av2 );
- if ( rc != 0 ) {
- goto done;
- }
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGV, (void *)ppPluginArgv );
+ slapi_pblock_set( pPlugin, SLAPI_X_CONFIG_ARGV, (void *)av2 );
- rc = slapi_int_load_plugin( pPlugin, path, initfunc, TRUE, NULL, &hdLoadHandle );
+ rc = slapi_int_load_plugin( pPlugin, path, initfunc, 1, NULL, &hdLoadHandle );
if ( rc != 0 ) {
goto done;
}
if ( rc != 0 && pPlugin != NULL ) {
slapi_pblock_destroy( pPlugin );
pPlugin = NULL;
- if ( av2 ) {
+ if ( av2 != NULL ) {
ldap_charray_free( av2 );
}
}
Backend *be,
Slapi_PBlock *pPB )
{
- Slapi_PBlock *pTmpPB;
- Slapi_PBlock *pSavePB;
- int rc = LDAP_SUCCESS;
+ Slapi_PBlock *pTmpPB;
+ Slapi_PBlock *pSavePB;
+ int rc = LDAP_SUCCESS;
- pTmpPB = ( be == NULL ) ? pGPlugins : (Slapi_PBlock *)(be->be_pb);
+ assert( be != NULL );
+ pTmpPB = SLAPI_BACKEND_PBLOCK( be );
if ( pTmpPB == NULL ) {
- if ( be != NULL )
- be->be_pb = (void *)pPB;
- else
- pGPlugins = pPB;
+ SLAPI_BACKEND_PBLOCK( be ) = pPB;
} else {
while ( pTmpPB != NULL && rc == LDAP_SUCCESS ) {
pSavePB = pTmpPB;
- rc = slapi_pblock_get( pTmpPB, SLAPI_IBM_PBLOCK,
- &pTmpPB );
- if ( rc != LDAP_SUCCESS ) {
- rc = LDAP_OTHER;
- }
+ rc = slapi_pblock_get( pTmpPB, SLAPI_IBM_PBLOCK, &pTmpPB );
}
if ( rc == LDAP_SUCCESS ) {
- rc = slapi_pblock_set( pSavePB, SLAPI_IBM_PBLOCK,
- (void *)pPB );
- if ( rc != LDAP_SUCCESS ) {
- rc = LDAP_OTHER;
- }
+ rc = slapi_pblock_set( pSavePB, SLAPI_IBM_PBLOCK, (void *)pPB );
}
}
- return rc;
+ return ( rc != LDAP_SUCCESS ) ? LDAP_OTHER : LDAP_SUCCESS;
}
/*********************************************************************
int numPB = 0;
int rc = LDAP_SUCCESS;
- assert( ppFuncPtrs );
-
- /*
- * First, count the plugins associated with a specific
- * backend.
- */
- if ( be != NULL ) {
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
-
- while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
- rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
- if ( rc == LDAP_SUCCESS ) {
- if ( FuncPtr != NULL ) {
- numPB++;
- }
- rc = slapi_pblock_get( pCurrentPB,
- SLAPI_IBM_PBLOCK, &pCurrentPB );
- }
- }
- }
+ assert( ppFuncPtrs != NULL );
- if ( rc != LDAP_SUCCESS ) {
+ if ( be == NULL ) {
goto done;
}
- /*
- * Then, count the global plugins.
- */
- pCurrentPB = pGPlugins;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
- while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
+ while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
if ( rc == LDAP_SUCCESS ) {
if ( FuncPtr != NULL ) {
numPB++;
}
rc = slapi_pblock_get( pCurrentPB,
- SLAPI_IBM_PBLOCK, &pCurrentPB );
+ SLAPI_IBM_PBLOCK, &pCurrentPB );
}
}
- if ( rc != LDAP_SUCCESS ) {
- goto done;
- }
-
if ( numPB == 0 ) {
*ppFuncPtrs = NULL;
rc = LDAP_SUCCESS;
goto done;
}
- if ( be != NULL ) {
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
-
- while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
- rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
- if ( rc == LDAP_SUCCESS ) {
- if ( FuncPtr != NULL ) {
- *pTmpFuncPtr = FuncPtr;
- pTmpFuncPtr++;
- }
- rc = slapi_pblock_get( pCurrentPB,
- SLAPI_IBM_PBLOCK, &pCurrentPB );
- }
- }
- }
-
- pCurrentPB = pGPlugins;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
SLAPI_IBM_PBLOCK, &pCurrentPB );
}
}
- *pTmpFuncPtr = NULL ;
+
+ *pTmpFuncPtr = NULL;
+
done:
if ( rc != LDAP_SUCCESS && *ppFuncPtrs != NULL ) {
{
ExtendedOp *ret;
- ret = (ExtendedOp *)ch_malloc(sizeof(ExtendedOp));
- if ( ret != NULL ) {
- ret->ext_oid.bv_val = NULL;
- ret->ext_oid.bv_len = 0;
- ret->ext_func = NULL;
- ret->ext_be = NULL;
- ret->ext_next = NULL;
- }
+ ret = (ExtendedOp *)slapi_ch_malloc(sizeof(ExtendedOp));
+ ret->ext_oid.bv_val = NULL;
+ ret->ext_oid.bv_len = 0;
+ ret->ext_func = NULL;
+ ret->ext_be = NULL;
+ ret->ext_next = NULL;
return ret;
}
int rc = LDAP_SUCCESS;
SLAPI_FUNC fpInitFunc = NULL;
- assert( pLdHandle );
+ assert( pLdHandle != NULL );
if ( lt_dlinit() ) {
return LDAP_LOCAL_ERROR;
/* load in the module */
*pLdHandle = lt_dlopen( path );
if ( *pLdHandle == NULL ) {
+ fprintf( stderr, "failed to load plugin %s: %s\n",
+ path, lt_dlerror() );
return LDAP_LOCAL_ERROR;
}
fpInitFunc = (SLAPI_FUNC)lt_dlsym( *pLdHandle, initfunc );
if ( fpInitFunc == NULL ) {
+ fprintf( stderr, "failed to find symbol %s in plugin %s: %s\n",
+ initfunc, path, lt_dlerror() );
lt_dlclose( *pLdHandle );
return LDAP_LOCAL_ERROR;
}
- if ( doInit == TRUE ) {
+ if ( doInit ) {
rc = ( *fpInitFunc )( pPlugin );
if ( rc != LDAP_SUCCESS ) {
lt_dlclose( *pLdHandle );
}
for ( pGetPlugin = tmpPlugin ; *pGetPlugin != NULL; pGetPlugin++ ) {
- /*
- * FIXME: we should provide here a sort of sandbox,
- * to protect from plugin faults; e.g. trap signals
- * and longjump here, marking the plugin as unsafe for
- * later executions ...
- */
rc = (*pGetPlugin)(pPB);
/*
fname, lineno );
return 1;
}
+
+ /* automatically instantiate overlay if necessary */
+ if ( !slapi_over_is_inst( be ) ) {
+ if ( slapi_over_config( be ) != 0 ) {
+ fprintf( stderr, "Failed to instantiate SLAPI overlay\n");
+ return -1;
+ }
+ }
if ( strcasecmp( argv[1], "preoperation" ) == 0 ) {
iType = SLAPI_PLUGIN_PREOPERATION;
)
{
Slapi_PBlock *pp;
- int i, j, rc;
+ int i, j;
char **argv, ibuf[32], *ptr;
struct berval idx, bv;
*out = NULL;
idx.bv_val = ibuf;
i = 0;
- for ( pp=be->be_pb; pp; slapi_pblock_get( pp, SLAPI_IBM_PBLOCK, &pp ) ) {
+
+ for ( pp = SLAPI_BACKEND_PBLOCK( be );
+ pp != NULL;
+ slapi_pblock_get( pp, SLAPI_IBM_PBLOCK, &pp ) )
+ {
slapi_pblock_get( pp, SLAPI_X_CONFIG_ARGV, &argv );
+ if ( argv == NULL ) /* could be dynamic plugin */
+ continue;
idx.bv_len = sprintf( idx.bv_val, "{%d}", i );
bv.bv_len = idx.bv_len;
for (j=1; argv[j]; j++) {
}
}
-int
-slapi_int_initialize(void)
-{
- if ( ldap_pvt_thread_mutex_init( &slapi_hn_mutex ) ) {
- return -1;
- }
-
- if ( ldap_pvt_thread_mutex_init( &slapi_time_mutex ) ) {
- return -1;
- }
-
- if ( ldap_pvt_thread_mutex_init( &slapi_printmessage_mutex ) ) {
- return -1;
- }
-
- slapi_log_file = ch_strdup( LDAP_RUNDIR LDAP_DIRSEP "errors" );
- if ( slapi_log_file == NULL ) {
- return -1;
- }
-
- if ( slapi_int_init_object_extensions() != 0 ) {
- return -1;
- }
-
- return 0;
-}
-
LDAP_BEGIN_DECL
-/*
- * Was: slapi_utils.h
- */
-
-extern int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
-extern Slapi_Entry *slapi_str2entry( char *s, int flags );
-extern char *slapi_entry2str( Slapi_Entry *e, int *len );
-extern int slapi_entry_attr_merge( Slapi_Entry *e, char *type, struct berval **vals );
-extern int slapi_entry_attr_find( Slapi_Entry *e, char *type, Slapi_Attr **attr );
-extern char *slapi_entry_attr_get_charptr( const Slapi_Entry *e, const char *type );
-extern int slapi_entry_attr_delete( Slapi_Entry *e, char *type );
-extern int slapi_entry_attr_get_int( const Slapi_Entry *e, const char *type );
-extern long slapi_entry_attr_get_long( const Slapi_Entry *e, const char *type );
-extern unsigned int slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type );
-extern unsigned long slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type );
-extern int slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value );
-extern int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value);
-extern void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l);
-extern void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l);
-extern void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l);
-extern void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l);
-extern int slapi_is_rootdse( const char *dn );
-extern int slapi_entry_has_children(const Slapi_Entry *e);
-size_t slapi_entry_size(Slapi_Entry *e);
-extern int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs);
-extern int slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
-extern int slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value);
-extern int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value);
-extern int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value);
-extern int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr );
-extern int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr );
-extern const char *slapi_entry_get_uniqueid( const Slapi_Entry *e );
-extern void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid );
-extern int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e );
-extern int slapi_entry_rdn_values_present( const Slapi_Entry *e );
-extern int slapi_entry_add_rdn_values( Slapi_Entry *e );
-
-extern char *slapi_entry_get_dn( Slapi_Entry *e );
-extern int slapi_x_entry_get_id( Slapi_Entry *e );
-extern void slapi_entry_set_dn( Slapi_Entry *e, char *dn );
-extern Slapi_Entry *slapi_entry_dup( Slapi_Entry *e );
-extern Slapi_Entry *slapi_entry_alloc();
-extern void slapi_entry_free( Slapi_Entry *e );
-extern int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
-
-/* DS 5.x SLAPI */
-extern int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr,
- struct berval *val, int access );
-extern int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods,
- char **errbuf );
-extern Slapi_Attr *slapi_attr_new( void );
-extern Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type );
-extern void slapi_attr_free( Slapi_Attr **a );
-extern Slapi_Attr *slapi_attr_dup( const Slapi_Attr *attr );
-extern int slapi_attr_add_value( Slapi_Attr *a, const Slapi_Value *v );
-extern int slapi_attr_type2plugin( const char *type, void **pi );
-extern int slapi_attr_get_type( const Slapi_Attr *attr, char **type );
-extern int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp );
-extern int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags );
-extern int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag );
-extern int slapi_attr_value_cmp( const Slapi_Attr *attr, const struct berval *v1,
- const struct berval *v2 );
-extern int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v );
-#if 0
-#define SLAPI_TYPE_CMP_EXACT 0
-#define SLAPI_TYPE_CMP_BASE 1
-#define SLAPI_TYPE_CMP_SUBTYPE 2
-#endif
-extern int slapi_attr_type_cmp( const char *t1, const char *t2, int opt );
-extern int slapi_attr_types_equivalent( const char *t1, const char *t2 );
-extern int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v );
-extern int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v );
-extern int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues );
-extern int slapi_attr_get_valueset( const Slapi_Attr *a, Slapi_ValueSet **vs );
-extern int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals );
-extern char *slapi_attr_syntax_normalize( const char *s );
-
-extern Slapi_Value *slapi_value_new( void );
-extern Slapi_Value *slapi_value_new_berval(const struct berval *bval);
-extern Slapi_Value *slapi_value_new_value(const Slapi_Value *v);
-extern Slapi_Value *slapi_value_new_string(const char *s);
-extern Slapi_Value *slapi_value_init(Slapi_Value *v);
-extern Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval);
-extern Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
-extern Slapi_Value *slapi_value_dup(const Slapi_Value *v);
-extern void slapi_value_free(Slapi_Value **value);
-extern const struct berval *slapi_value_get_berval( const Slapi_Value *value );
-extern Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval );
-extern Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom);
-extern Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len);
-extern int slapi_value_set_string(Slapi_Value *value, const char *strVal);
-extern int slapi_value_set_int(Slapi_Value *value, int intVal);
-extern const char*slapi_value_get_string(const Slapi_Value *value);
-extern int slapi_value_get_int(const Slapi_Value *value);
-extern unsigned int slapi_value_get_uint(const Slapi_Value *value);
-extern long slapi_value_get_long(const Slapi_Value *value);
-extern unsigned long slapi_value_get_ulong(const Slapi_Value *value);
-extern size_t slapi_value_get_length(const Slapi_Value *value);
-extern int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2);
-
-extern Slapi_ValueSet *slapi_valueset_new( void );
-extern void slapi_valueset_free(Slapi_ValueSet *vs);
-extern void slapi_valueset_init(Slapi_ValueSet *vs);
-extern void slapi_valueset_done(Slapi_ValueSet *vs);
-extern void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval);
-extern int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v );
-extern int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v);
-extern int slapi_valueset_count( const Slapi_ValueSet *vs);
-extern void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
-
-extern Slapi_Mutex *slapi_new_mutex( void );
-extern void slapi_destroy_mutex( Slapi_Mutex *mutex );
-extern void slapi_lock_mutex( Slapi_Mutex *mutex );
-extern int slapi_unlock_mutex( Slapi_Mutex *mutex );
-extern Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex );
-extern void slapi_destroy_condvar( Slapi_CondVar *cvar );
-extern int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout );
-extern int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all );
-
-extern LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared );
-extern void slapi_ldap_unbind( LDAP *ld );
-
-extern char *slapi_ch_malloc( unsigned long size );
-extern void slapi_ch_free( void **ptr );
-extern void slapi_ch_free_string( char **s );
-extern char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
-extern char *slapi_ch_realloc( char *block, unsigned long size );
-extern char *slapi_ch_strdup( char *s );
-extern void slapi_ch_array_free( char **arrayp );
-extern struct berval *slapi_ch_bvdup(const struct berval *v);
-extern struct berval **slapi_ch_bvecdup(const struct berval **v);
-
-/*
- * FIXME: these two were missing, but widely used in a couple of .c files
- */
-extern size_t slapi_strlen(char *s );
-#define slapi_ch_stlen(s) slapi_strlen(s)
-/*
- * end of FIXME
- */
-extern char *slapi_dn_normalize( char *dn );
-extern char *slapi_dn_normalize_case( char *dn );
-extern char * slapi_esc_dn_normalize( char *dn );
-extern char * slapi_esc_dn_normalize_case( char *dn );
-extern int slapi_dn_isroot( Slapi_PBlock *pb, char *dn );
-extern int slapi_dn_issuffix( char *dn, char *suffix );
-char *slapi_dn_beparent( Slapi_PBlock *pb, const char *dn );
-char *slapi_dn_parent( const char *dn );
-int slapi_dn_isparent( const char *parentdn, const char *childdn );
-extern char *slapi_dn_ignore_case( char *dn );
-extern char *slapi_get_hostname();
-extern void slapi_register_supported_saslmechanism( char *mechanism );
-extern void slapi_send_ldap_result( Slapi_PBlock *pb, int err,
- char *matched, char *text, int nentries, struct berval **urls );
-extern int slapi_send_ldap_extended_response(Connection *conn, Operation *op,
- int errornum, char *respName, struct berval *response);
-extern int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e,
- LDAPControl **ectrls, char **attrs, int attrsonly );
-extern int slapi_send_ldap_search_reference( Slapi_PBlock *pb, Slapi_Entry *e,
- struct berval **references, LDAPControl **ectrls, struct berval **v2refs );
-
-extern void slapi_register_supported_control(char *controloid,
- unsigned long controlops);
-extern int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp);
-extern int slapi_control_present( LDAPControl **controls, char *oid,
- struct berval **val, int *iscritical);
-extern LDAPControl *slapi_dup_control(LDAPControl *control);
-extern void slapi_register_supported_saslmechanism(char *mechanism);
-extern char **slapi_get_supported_saslmechanisms();
-extern char **slapi_get_supported_extended_ops(void);
-extern int checkControlHonored(LDAPControl **controls, char *pControlOid,
- unsigned long operation, int *isHonored );
-extern void slapi_broadcast_be(int funcType, Slapi_PBlock *pPB);
-extern Slapi_Filter *slapi_str2filter( char *str );
-extern Slapi_Filter *slapi_filter_dup( Slapi_Filter *f );
-extern void slapi_filter_free( Slapi_Filter *f, int recurse );
-extern int slapi_filter_get_choice( Slapi_Filter *f);
-extern int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
-extern Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
-extern Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
-extern int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type );
-extern int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
- char ***any, char **final );
-extern Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2);
-extern int slapi_x_filter_append( int choice, Slapi_Filter **pContainingFilter,
- Slapi_Filter **pNextFilter, Slapi_Filter *filterToAppend );
-extern int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
- int verify_access );
-extern int slapi_filter_apply( Slapi_Filter *f, FILTER_APPLY_FN fn, void *arg, int *error_code );
-extern int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f);
-extern void slapi_free_search_results_internal(Slapi_PBlock *pb);
-extern int slapi_is_connection_ssl(Slapi_PBlock *pPB, int *isSSL);
-extern int slapi_get_client_port(Slapi_PBlock *pPB, int *fromPort);
-extern int slapi_get_num_be(char *type);
-extern unsigned long slapi_timer_current_time();
-extern unsigned long slapi_timer_get_time(char *label);
-extern void slapi_timer_elapsed_time(char *label,unsigned long start);
-extern int slapi_audit_init_header( Connection *conn, Operation *op,
- Audit_record **arp, void **audit_op_str,
- int audit_op, int audit_ext_op, int audit_op_str_len);
-extern int slapi_audit_send_record( Slapi_PBlock *pb, Connection *conn,
- Operation *op, int rc);
-
-extern int slapi_int_pblock_set_operation( Slapi_PBlock *pb, Operation *op );
-
-extern LDAPMod **slapi_int_modifications2ldapmods(Modifications **);
-extern Modifications *slapi_int_ldapmods2modifications(LDAPMod **);
-extern void slapi_int_free_ldapmods(LDAPMod **);
-
-extern int slapi_compute_add_evaluator(slapi_compute_callback_t function);
-extern int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function);
-extern int compute_rewrite_search_filter(Slapi_PBlock *pb);
-extern int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn);
-extern int slapi_int_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e);
-extern int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb);
-
-extern int slapi_int_access_allowed(Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state);
-
-extern int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags );
-
-extern ldap_pvt_thread_mutex_t slapi_hn_mutex;
-extern ldap_pvt_thread_mutex_t slapi_time_mutex;
-extern ldap_pvt_thread_mutex_t slapi_printmessage_mutex;
-extern char *slapi_log_file;
-extern int slapi_log_level;
-
-
-/*
- * Was: slapi_pblock.h
- */
-
-extern Slapi_PBlock *slapi_pblock_new( void );
-extern void slapi_pblock_destroy( Slapi_PBlock* );
-extern int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
-extern int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
-extern void slapi_pblock_check_params( Slapi_PBlock *pb, int flag );
-extern int slapi_pblock_delete_param( Slapi_PBlock *p, int param );
-extern void slapi_pblock_clear( Slapi_PBlock *pb );
-
-/*
- * OpenLDAP extensions
- */
-extern int slapi_int_pblock_get_first( Backend *be, Slapi_PBlock **pb );
-extern int slapi_int_pblock_get_next( Slapi_PBlock **pb );
-
-
-/*
- * Was: plugin.h
- */
-
-extern int slapi_int_register_plugin(Backend *be, Slapi_PBlock *pPB);
-extern int slapi_int_call_plugins(Backend *be, int funcType, Slapi_PBlock * pPB);
-extern int slapi_int_get_plugins(Backend *be, int functype, SLAPI_FUNC **ppFuncPtrs);
-extern int slapi_int_register_extop(Backend *pBE, ExtendedOp **opList, Slapi_PBlock *pPB);
-extern int slapi_int_get_extop_plugin(struct berval *reqoid, SLAPI_FUNC *pFuncAddr );
-extern int slapi_int_read_config(Backend *be, const char *fname, int lineno,
- int argc, char **argv );
-extern void slapi_int_plugin_unparse(Backend *be, BerVarray *out );
-extern int slapi_int_initialize(void);
-
-
-/*
- * Was: slapi_ops.h
- */
-
-extern Slapi_PBlock *slapi_search_internal( char *base, int scope, char *filter,
- LDAPControl **controls, char **attrs, int attrsonly );
-extern Slapi_PBlock *slapi_modify_internal( char *dn, LDAPMod **mods,
- LDAPControl **controls, int log_change );
-extern Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e,
- LDAPControl **controls, int log_change );
-extern Slapi_PBlock *slapi_add_internal( char * dn, LDAPMod **attrs,
- LDAPControl **controls, int log_changes );
-extern Slapi_PBlock *slapi_add_entry_internal( Slapi_Entry * e,
- LDAPControl **controls, int log_change );
-extern Slapi_PBlock *slapi_delete_internal( char * dn, LDAPControl **controls,
- int log_change );
-extern Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn,
- int deloldrdn, LDAPControl **controls, int log_change);
-extern char **slapi_get_supported_extended_ops(void);
-extern struct berval *slapi_int_get_supported_extop( int );
-extern Connection *slapi_int_init_connection(char *DN, int OpType);
-extern void slapi_int_connection_destroy( Connection **pConn );
-
-/*
- * Was: slapi_cl.h
- */
-
-extern void slapi_register_changelog_suffix(char *suffix);
-extern char **slapi_get_changelog_suffixes();
-extern void slapi_update_changelog_counters(long curNum, long numEntries);
-extern char *slapi_get_cl_firstNum();
-extern char *slapi_get_cl_lastNum();
-extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix,
- char *chNum, Operation* op);
-extern int slapi_delete_changelog(char *dn, char *suffix,
- char *chNum, Operation* op);
-extern int slapi_modify_changelog(char *dn, LDAPMod *mods,char *suffix,
- char *chNum, Operation* op);
-extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn,
- char *suffix, char *chNum, Operation* op);
-extern Backend * slapi_cl_get_be(char *dn);
-
-int slapi_int_init_object_extensions(void);
-int slapi_int_free_object_extensions(int objecttype, void *object);
-int slapi_int_create_object_extensions(int objecttype, void *object);
-int slapi_int_clear_object_extensions(int objecttype, void *object);
+/* slapi_utils.c */
+LDAP_SLAPI_F (LDAPMod **) slapi_int_modifications2ldapmods LDAP_P(( Modifications * ));
+LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod ** ));
+LDAP_SLAPI_F (int) slapi_int_count_controls LDAP_P(( LDAPControl **ctrls ));
+LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void));
+LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state ));
+
+/* slapi_ops.c */
+LDAP_SLAPI_F (int) slapi_int_response LDAP_P(( Slapi_Operation *op, SlapReply *rs ));
+LDAP_SLAPI_F (void) slapi_int_connection_init_pb LDAP_P(( Slapi_PBlock *pb, ber_tag_t OpType ));
+LDAP_SLAPI_F (void) slapi_int_connection_done_pb LDAP_P(( Slapi_PBlock *pb ));
+
+/* slapi_pblock.c */
+LDAP_SLAPI_F (int) slapi_pblock_delete_param LDAP_P(( Slapi_PBlock *p, int param ));
+LDAP_SLAPI_F (void) slapi_pblock_clear LDAP_P(( Slapi_PBlock *pb ));
+
+LDAP_SLAPI_F (int) slapi_int_pblock_get_first LDAP_P(( Backend *be, Slapi_PBlock **pb ));
+LDAP_SLAPI_F (int) slapi_int_pblock_get_next LDAP_P(( Slapi_PBlock **pb ));
+
+#define PBLOCK_ASSERT_CONN( _pb ) do { \
+ assert( (_pb) != NULL ); \
+ assert( (_pb)->pb_conn != NULL ); \
+ } while (0)
+
+#define PBLOCK_ASSERT_OP( _pb, _tag ) do { \
+ PBLOCK_ASSERT_CONN( _pb ); \
+ assert( (_pb)->pb_op != NULL ); \
+ assert( (_pb)->pb_rs != NULL ); \
+ if ( _tag != 0 ) \
+ assert( (_pb)->pb_op->o_tag == (_tag)); \
+ } while (0)
+
+#define PBLOCK_ASSERT_INTOP( _pb, _tag ) do { \
+ PBLOCK_ASSERT_OP( _pb, _tag ); \
+ assert( (_pb)->pb_intop ); \
+ assert( (_pb)->pb_op == (Operation *)pb->pb_conn->c_pending_ops.stqh_first ); \
+ } while (0)
+
+/* plugin.c */
+LDAP_SLAPI_F (int) slapi_int_register_plugin LDAP_P((Backend *be, Slapi_PBlock *pPB));
+LDAP_SLAPI_F (int) slapi_int_call_plugins LDAP_P((Backend *be, int funcType, Slapi_PBlock * pPB));
+LDAP_SLAPI_F (int) slapi_int_get_plugins LDAP_P((Backend *be, int functype, SLAPI_FUNC **ppFuncPtrs));
+LDAP_SLAPI_F (int) slapi_int_register_extop LDAP_P((Backend *pBE, ExtendedOp **opList, Slapi_PBlock *pPB));
+LDAP_SLAPI_F (int) slapi_int_get_extop_plugin LDAP_P((struct berval *reqoid, SLAPI_FUNC *pFuncAddr ));
+LDAP_SLAPI_F (struct berval *) slapi_int_get_supported_extop LDAP_P(( int ));
+LDAP_SLAPI_F (int) slapi_int_read_config LDAP_P((Backend *be, const char *fname, int lineno,
+ int argc, char **argv ));
+LDAP_SLAPI_F (void) slapi_int_plugin_unparse LDAP_P((Backend *be, BerVarray *out ));
+LDAP_SLAPI_F (int) slapi_int_initialize LDAP_P((void));
+
+/* slapi_ext.c */
+LDAP_SLAPI_F (int) slapi_int_init_object_extensions LDAP_P((void));
+LDAP_SLAPI_F (int) slapi_int_free_object_extensions LDAP_P((int objecttype, void *object));
+LDAP_SLAPI_F (int) slapi_int_create_object_extensions LDAP_P((int objecttype, void *object));
+LDAP_SLAPI_F (int) slapi_int_clear_object_extensions LDAP_P((int objecttype, void *object));
+
+/* slapi_overlay.c */
+LDAP_SLAPI_F (int) slapi_over_is_inst LDAP_P((BackendDB *));
+LDAP_SLAPI_F (int) slapi_over_config LDAP_P((BackendDB *));
LDAP_END_DECL
#ifndef _SLAPI_H
#define _SLAPI_H
-#include "ibm_pblock_params.h"
-
LDAP_BEGIN_DECL
/*
#define slapi_entry slap_entry
#define slapi_attr slap_attr
#define slapi_value berval
-#define slapi_valueset berval*
+#define slapi_valueset berval *
#define slapi_filter slap_filter
LDAP_END_DECL
LDAP_BEGIN_DECL
-/*
- * Was: slapi_common.h
- */
-
-/* a little naif ... */
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#if 0 /* unused (yet?) */
-#define dn_normalize_case dn_normalize
-#define SLAPD_NO_MEMORY 7
-#define ANYBODY_STRING "CN=ANYBODY"
-
-extern int slap_debug;
-
-extern int dn_check(char *, int *);
+#define SLAPI_OVERLAY_NAME "slapi"
-typedef struct strlist {
- char *string;
- struct strlist *next;
-} StrList;
-#endif
+#define SLAPI_OPERATION_PBLOCK(_op) ((_op)->o_callback->sc_private)
+#define SLAPI_CONNECTION_PBLOCK(_conn) ((_conn)->c_pb);
+#define SLAPI_BACKEND_PBLOCK(_be) ((_be)->be_pb)
-/*
- * Was: slapi_utils.h
- */
-typedef struct _Audit_record Audit_record;
+#define SLAPI_OPERATION_EXTENSIONS(_op) ((_op)->o_hdr->oh_extensions)
+#define SLAPI_CONNECTION_EXTENSIONS(_conn) ((_conn)->c_extensions)
#define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT
#define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST
typedef int (*SLAPI_FUNC)( Slapi_PBlock *pb );
-#if 0 /* unused (yet?) */
-#define DOMAIN "Domain"
-#define TCPIPPATH "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#endif
-
typedef struct _slapi_control {
int s_ctrl_num;
char **s_ctrl_oids;
/* Computed attribute support */
struct _computed_attr_context {
- /* slap_send_search_entry() argblock */
Slapi_PBlock *cac_pb;
- AttributeName *cac_attrs;
- int cac_attrsonly : 1;
- int cac_userattrs : 1;
- int cac_opattrs : 1;
- AccessControlState cac_acl_state;
- /* private data */
- void *cac_private;
+ Operation *cac_op;
+ void *cac_private;
};
/* for slapi_attr_type_cmp() */
SLAPI_X_EXT_MAX = 2
} slapi_extension_t;
+struct slapi_dn {
+ unsigned char flag;
+ struct berval dn;
+ struct berval ndn;
+};
+
+struct slapi_rdn {
+ unsigned char flag;
+ struct berval bv;
+ LDAPRDN rdn;
+};
+
/*
* Was: slapi_pblock.h
*/
#define PBLOCK_ERROR (-1)
#define PBLOCK_MAX_PARAMS 100
+union slapi_pblock_value {
+ int pv_integer;
+ long pv_long_integer;
+ void *pv_pointer;
+ int (*pv_function_pointer)();
+};
+
struct slapi_pblock {
- ldap_pvt_thread_mutex_t pblockMutex;
- int ckParams;
- int numParams;
- int curParams[PBLOCK_MAX_PARAMS];
- void *curVals[PBLOCK_MAX_PARAMS];
+ ldap_pvt_thread_mutex_t pb_mutex;
+ int pb_nParams;
+ int pb_params[PBLOCK_MAX_PARAMS];
+ union slapi_pblock_value pb_values[PBLOCK_MAX_PARAMS];
+ /* native types */
+ Connection *pb_conn;
+ Operation *pb_op;
+ SlapReply *pb_rs;
+ int pb_intop;
+ char pb_textbuf[ SLAP_TEXT_BUFLEN ];
};
#endif /* !NO_PBLOCK_CLASS */
* Was: plugin.h
*/
-#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN)
-
-/*
- * Was: slapi_cl.h
- */
-
-#if 0
-#define TIME_SIZE 20
-#define OBJECTCLASS "objectclass"
-#define TOP "top"
-#define CHANGE_TIME "changetime"
-#define CHANGE_TYPE "changetype"
-#define CHANGE_TARGETDN "targetdn"
-#define CHANGES "changes"
-#define CHANGE_NUMBER "changenumber"
-/*
- * FIXME: I get complaints like "ADD" being redefined - first definition
- * being in "/usr/include/arpa/nameser.h:552"
- */
-#undef ADD
-#define ADD "add: "
-#define ADDLEN 5
-#define DEL "delete: "
-#define DELLEN 8
-#define REPLACE "replace: "
-#define REPLEN 9
-#define MOD "modify"
-#define MODRDN "modrdn"
-#define CHANGE_LOGENTRY "changelogentry"
-#define IBM_CHANGE_LOGENTRY "ibm-changelog"
-#define CL_NEWRDN "newrdn"
-#define CL_DELRDN "deleteoldrdn"
-#define CHANGE_INITIATOR "ibm-changeInitiatorsName"
-
-extern void slapi_register_changelog_suffix(char *suffix);
-extern char **slapi_get_changelog_suffixes();
-extern void slapi_update_changelog_counters(long curNum, long numEntries);
-extern char *slapi_get_cl_firstNum();
-extern char *slapi_get_cl_lastNum();
-extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op);
-extern int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op);
-extern int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op);
-extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op);
-extern Backend * slapi_cl_get_be(char *dn);
-#endif
-
+#define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_BE_POST_DELETE_FN)
-/*
- * Attribute flags returned by slapi_attr_get_flags()
- */
-#define SLAPI_ATTR_FLAG_SINGLE 0x0001
-#define SLAPI_ATTR_FLAG_OPATTR 0x0002
-#define SLAPI_ATTR_FLAG_READONLY 0x0004
-#define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
-#define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
-#define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
-#define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
-
-/*
- * ACL levels
- */
-#define SLAPI_ACL_COMPARE 0x01
-#define SLAPI_ACL_SEARCH 0x02
-#define SLAPI_ACL_READ 0x04
-#define SLAPI_ACL_WRITE 0x08
-#define SLAPI_ACL_DELETE 0x10
-#define SLAPI_ACL_ADD 0x20
-#define SLAPI_ACL_SELF 0x40
-#define SLAPI_ACL_PROXY 0x80
-#define SLAPI_ACL_ALL 0x7f
-
-/*
- * Plugin types universally supported by SLAPI
- * implementations
- */
-#define SLAPI_PLUGIN_DATABASE 1
-#define SLAPI_PLUGIN_EXTENDEDOP 2
-#define SLAPI_PLUGIN_PREOPERATION 3
-#define SLAPI_PLUGIN_POSTOPERATION 4
-#define SLAPI_PLUGIN_MATCHINGRULE 5
-#define SLAPI_PLUGIN_SYNTAX 6
-/* XXX this is SLAPI_PLUGIN_ACL in SunDS */
-#define SLAPI_PLUGIN_AUDIT 7
-/*
- * The following plugin types are reserved for future
- * Sun ONE DS compatability.
- */
-#define SLAPI_PLUGIN_BEPREOPERATION 8
-#define SLAPI_PLUGIN_BEPOSTOPERATION 9
-#define SLAPI_PLUGIN_ENTRY 10
-#define SLAPI_PLUGIN_TYPE_OBJECT 11
-#define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
-#define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
-#define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
-#define SLAPI_PLUGIN_VATTR_SP 15
-#define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
-
-#define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
-#define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
-
-#define SLAPI_BIND_SUCCESS 0
-#define SLAPI_BIND_FAIL 2
-#define SLAPI_BIND_ANONYMOUS 3
-
-#define SLAPI_BACKEND 130
-#define SLAPI_CONNECTION 131
-#define SLAPI_OPERATION 132
-#define SLAPI_REQUESTOR_ISROOT 133
-#define SLAPI_BE_MONITORDN 134
-#define SLAPI_BE_TYPE 135
-#define SLAPI_BE_READONLY 136
-#define SLAPI_BE_LASTMOD 137
-#define SLAPI_OPERATION_PARAMETERS 138
-#define SLAPI_CONN_ID 139
-
-#define SLAPI_OPINITIATED_TIME 140
-#define SLAPI_REQUESTOR_DN 141
-#define SLAPI_REQUESTOR_ISUPDATEDN 142
-#define SLAPI_IS_REPLICATED_OPERATION SLAPI_REQUESTOR_ISUPDATEDN
-#define SLAPI_CONN_DN 143
-#define SLAPI_CONN_AUTHTYPE 144
-#define SLAPI_CONN_CLIENTIP 145
-#define SLAPI_CONN_SERVERIP 146
-#define SLAPI_X_CONN_CLIENTPATH 1300
-#define SLAPI_X_CONN_SERVERPATH 1301
-#define SLAPI_X_CONN_IS_UDP 1302
-#define SLAPI_X_CONN_SSF 1303
-#define SLAPI_X_CONN_SASL_CONTEXT 1304
-
-#define SLAPI_X_CONFIG_ARGV 1400
-
-#define SLAPD_AUTH_NONE "none"
-#define SLAPD_AUTH_SIMPLE "simple"
-#define SLAPD_AUTH_SSL "SSL"
-#define SLAPD_AUTH_SASL "SASL "
-
-#define SLAPI_PLUGIN 3
-#define SLAPI_PLUGIN_PRIVATE 4
-#define SLAPI_PLUGIN_TYPE 5
-#define SLAPI_PLUGIN_ARGV 6
-#define SLAPI_PLUGIN_ARGC 7
-#define SLAPI_PLUGIN_VERSION 8
-
-#define SLAPI_PLUGIN_OPRETURN 9
-#define SLAPI_PLUGIN_OBJECT 10
-#define SLAPI_PLUGIN_DESTROY_FN 11
-
-#define SLAPI_PLUGIN_DESCRIPTION 12
-
-#define SLAPI_PLUGIN_INTOP_RESULT 15
-#define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
-#define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
-
-#define SLAPI_PLUGIN_DB_BIND_FN 200
-#define SLAPI_PLUGIN_DB_UNBIND_FN 201
-#define SLAPI_PLUGIN_DB_SEARCH_FN 202
-#define SLAPI_PLUGIN_DB_COMPARE_FN 203
-#define SLAPI_PLUGIN_DB_MODIFY_FN 204
-#define SLAPI_PLUGIN_DB_MODRDN_FN 205
-#define SLAPI_PLUGIN_DB_ADD_FN 206
-#define SLAPI_PLUGIN_DB_DELETE_FN 207
-#define SLAPI_PLUGIN_DB_ABANDON_FN 208
-#define SLAPI_PLUGIN_DB_CONFIG_FN 209
-#define SLAPI_PLUGIN_CLOSE_FN 210
-#define SLAPI_PLUGIN_DB_FLUSH_FN 211
-#define SLAPI_PLUGIN_START_FN 212
-#define SLAPI_PLUGIN_DB_SEQ_FN 213
-#define SLAPI_PLUGIN_DB_ENTRY_FN 214
-#define SLAPI_PLUGIN_DB_REFERRAL_FN 215
-#define SLAPI_PLUGIN_DB_RESULT_FN 216
-#define SLAPI_PLUGIN_DB_LDIF2DB_FN 217
-#define SLAPI_PLUGIN_DB_DB2LDIF_FN 218
-#define SLAPI_PLUGIN_DB_BEGIN_FN 219
-#define SLAPI_PLUGIN_DB_COMMIT_FN 220
-#define SLAPI_PLUGIN_DB_ABORT_FN 221
-#define SLAPI_PLUGIN_DB_ARCHIVE2DB_FN 222
-#define SLAPI_PLUGIN_DB_DB2ARCHIVE_FN 223
-#define SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN 224
-#define SLAPI_PLUGIN_DB_FREE_RESULT_SET_FN 225
-#define SLAPI_PLUGIN_DB_SIZE_FN 226
-#define SLAPI_PLUGIN_DB_TEST_FN 227
-#define SLAPI_PLUGIN_DB_NO_ACL 250
-
-#define SLAPI_PLUGIN_EXT_OP_FN 300
-#define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
-#define SLAPI_PLUGIN_PRE_BIND_FN 401
-#define SLAPI_PLUGIN_PRE_UNBIND_FN 402
-#define SLAPI_PLUGIN_PRE_SEARCH_FN 403
-#define SLAPI_PLUGIN_PRE_COMPARE_FN 404
-#define SLAPI_PLUGIN_PRE_MODIFY_FN 405
-#define SLAPI_PLUGIN_PRE_MODRDN_FN 406
-#define SLAPI_PLUGIN_PRE_ADD_FN 407
-#define SLAPI_PLUGIN_PRE_DELETE_FN 408
-#define SLAPI_PLUGIN_PRE_ABANDON_FN 409
-#define SLAPI_PLUGIN_PRE_ENTRY_FN 410
-#define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
-#define SLAPI_PLUGIN_PRE_RESULT_FN 412
-#define SLAPI_PLUGIN_POST_BIND_FN 501
-#define SLAPI_PLUGIN_POST_UNBIND_FN 502
-#define SLAPI_PLUGIN_POST_SEARCH_FN 503
-#define SLAPI_PLUGIN_POST_COMPARE_FN 504
-#define SLAPI_PLUGIN_POST_MODIFY_FN 505
-#define SLAPI_PLUGIN_POST_MODRDN_FN 506
-#define SLAPI_PLUGIN_POST_ADD_FN 507
-#define SLAPI_PLUGIN_POST_DELETE_FN 508
-#define SLAPI_PLUGIN_POST_ABANDON_FN 509
-#define SLAPI_PLUGIN_POST_ENTRY_FN 510
-#define SLAPI_PLUGIN_POST_REFERRAL_FN 511
-#define SLAPI_PLUGIN_POST_RESULT_FN 512
-
-#define SLAPI_OPERATION_TYPE 590
-
-#define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
-#define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
-#define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
-#define SLAPI_PLUGIN_MR_FILTER_INDEX_FN 603
-#define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
-#define SLAPI_PLUGIN_MR_INDEX_FN 605
-#define SLAPI_PLUGIN_MR_OID 610
-#define SLAPI_PLUGIN_MR_TYPE 611
-#define SLAPI_PLUGIN_MR_VALUE 612
-#define SLAPI_PLUGIN_MR_VALUES 613
-#define SLAPI_PLUGIN_MR_KEYS 614
-#define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
-#define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
-#define SLAPI_PLUGIN_MR_USAGE 617
-
-#define SLAPI_OP_LESS 1
-#define SLAPI_OP_LESS_OR_EQUAL 2
-#define SLAPI_OP_EQUAL 3
-#define SLAPI_OP_GREATER_OR_EQUAL 4
-#define SLAPI_OP_GREATER 5
-#define SLAPI_OP_SUBSTRING 6
-
-#define SLAPI_PLUGIN_MR_USAGE_INDEX 0
-#define SLAPI_PLUGIN_MR_USAGE_SORT 1
-
-#define SLAPI_MATCHINGRULE_NAME 1
-#define SLAPI_MATCHINGRULE_OID 2
-#define SLAPI_MATCHINGRULE_DESC 3
-#define SLAPI_MATCHINGRULE_SYNTAX 4
-#define SLAPI_MATCHINGRULE_OBSOLETE 5
-
-#define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
-#define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
-#define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
-#define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
-#define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
-#define SLAPI_PLUGIN_SYNTAX_NAMES 705
-#define SLAPI_PLUGIN_SYNTAX_OID 706
-#define SLAPI_PLUGIN_SYNTAX_FLAGS 707
-#define SLAPI_PLUGIN_SYNTAX_COMPARE 708
-
-#define SLAPI_PLUGIN_ACL_INIT 730
-#define SLAPI_PLUGIN_ACL_SYNTAX_CHECK 731
-#define SLAPI_PLUGIN_ACL_ALLOW_ACCESS 732
-#define SLAPI_PLUGIN_ACL_MODS_ALLOWED 733
-#define SLAPI_PLUGIN_ACL_MODS_UPDATE 734
-
-#define SLAPI_OPERATION_AUTHTYPE 741
-#define SLAPI_OPERATION_ID 742
-#define SLAPI_CONN_CERT 743
-#define SLAPI_CONN_AUTHMETHOD 746
-
-#define SLAPI_RESULT_CODE 881
-#define SLAPI_RESULT_TEXT 882
-#define SLAPI_RESULT_MATCHED 883
-
-#define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
-#define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
-
-#define SLAPI_PLUGIN_AUDIT_DATA 1100
-#define SLAPI_PLUGIN_AUDIT_FN 1101
-
-/* DS 5.x Computed Attribute Callbacks (not exposed) */
-#define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
-#define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
-
-#define SLAPI_X_PLUGIN_PRE_GROUP_FN 1202
-#define SLAPI_X_PLUGIN_POST_GROUP_FN 1203
-
-/* backend_group extension */
-#define SLAPI_X_GROUP_ENTRY 1250 /* e */
-#define SLAPI_X_GROUP_ATTRIBUTE 1251 /* group_at */
-#define SLAPI_X_GROUP_OPERATION_DN 1252 /* op_ndn */
-#define SLAPI_X_GROUP_TARGET_ENTRY 1253 /* target */
-
-#define SLAPI_MANAGEDSAIT 1000
-
-#define SLAPI_CONFIG_FILENAME 40
-#define SLAPI_CONFIG_LINENO 41
-#define SLAPI_CONFIG_ARGC 42
-#define SLAPI_CONFIG_ARGV 43
-
-#define SLAPI_TARGET_DN 50
-#define SLAPI_REQCONTROLS 51
+#define SLAPI_IBM_PBLOCK -3
#define SLAPI_ENTRY_PRE_OP 52
#define SLAPI_ENTRY_POST_OP 53
-#define SLAPI_RESCONTROLS 55
/* This is the spelling in the SunOne 5.2 docs */
#define SLAPI_RES_CONTROLS SLAPI_RESCONTROLS
-#define SLAPI_ADD_RESCONTROL 56
-
-#define SLAPI_ADD_TARGET SLAPI_TARGET_DN
-#define SLAPI_ADD_ENTRY 60
-
-#define SLAPI_BIND_TARGET SLAPI_TARGET_DN
-#define SLAPI_BIND_METHOD 70
-#define SLAPI_BIND_CREDENTIALS 71
-#define SLAPI_BIND_SASLMECHANISM 72
-#define SLAPI_BIND_RET_SASLCREDS 73
-
-#define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
-#define SLAPI_COMPARE_TYPE 80
-#define SLAPI_COMPARE_VALUE 81
-
-#define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
-
-#define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
-#define SLAPI_MODIFY_MODS 90
-
-#define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
-#define SLAPI_MODRDN_NEWRDN 100
-#define SLAPI_MODRDN_DELOLDRDN 101
-#define SLAPI_MODRDN_NEWSUPERIOR 102
-
-#define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
-#define SLAPI_SEARCH_SCOPE 110
-#define SLAPI_SEARCH_DEREF 111
-#define SLAPI_SEARCH_SIZELIMIT 112
-#define SLAPI_SEARCH_TIMELIMIT 113
-#define SLAPI_SEARCH_FILTER 114
-#define SLAPI_SEARCH_STRFILTER 115
-#define SLAPI_SEARCH_ATTRS 116
-#define SLAPI_SEARCH_ATTRSONLY 117
#define SLAPI_ABANDON_MSGID 120
+#define SLAPI_OPERATION_PARAMETERS 138
+
#define SLAPI_SEQ_TYPE 150
#define SLAPI_SEQ_ATTRNAME 151
#define SLAPI_SEQ_VAL 152
-#define SLAPI_EXT_OP_REQ_OID 160
-#define SLAPI_EXT_OP_REQ_VALUE 161
-#define SLAPI_EXT_OP_RET_OID 162
-#define SLAPI_EXT_OP_RET_VALUE 163
-
#define SLAPI_MR_FILTER_ENTRY 170
#define SLAPI_MR_FILTER_TYPE 171
#define SLAPI_MR_FILTER_VALUE 172
#define SLAPI_DB2LDIF_PRINTKEY 183
-#define SLAPI_PARENT_TXN 190
-#define SLAPI_TXN 191
-
-#define SLAPI_SEARCH_RESULT_SET 193
-#define SLAPI_SEARCH_RESULT_ENTRY 194
-#define SLAPI_NENTRIES 195
-#define SLAPI_SEARCH_REFERRALS 196
-
#define SLAPI_CHANGENUMBER 197
#define SLAPI_LOG_OPERATION 198
#define SLAPI_DBSIZE 199
-#define SLAPI_LOG_FATAL 0
-#define SLAPI_LOG_TRACE 1
-#define SLAPI_LOG_PACKETS 2
-#define SLAPI_LOG_ARGS 3
-#define SLAPI_LOG_CONNS 4
-#define SLAPI_LOG_BER 5
-#define SLAPI_LOG_FILTER 6
-#define SLAPI_LOG_CONFIG 7
-#define SLAPI_LOG_ACL 8
-#define SLAPI_LOG_SHELL 9
-#define SLAPI_LOG_PARSE 10
-#define SLAPI_LOG_HOUSE 11
-#define SLAPI_LOG_REPL 12
-#define SLAPI_LOG_CACHE 13
-#define SLAPI_LOG_PLUGIN 14
-
-#define SLAPI_OPERATION_BIND 0x00000001L
-#define SLAPI_OPERATION_UNBIND 0x00000002L
-#define SLAPI_OPERATION_SEARCH 0x00000004L
-#define SLAPI_OPERATION_MODIFY 0x00000008L
-#define SLAPI_OPERATION_ADD 0x00000010L
-#define SLAPI_OPERATION_DELETE 0x00000020L
-#define SLAPI_OPERATION_MODDN 0x00000040L
-#define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
-#define SLAPI_OPERATION_COMPARE 0x00000080L
-#define SLAPI_OPERATION_ABANDON 0x00000100L
-#define SLAPI_OPERATION_EXTENDED 0x00000200L
-#define SLAPI_OPERATION_ANY 0xFFFFFFFFL
-#define SLAPI_OPERATION_NONE 0x00000000L
+#define SLAPI_PLUGIN_DB_TEST_FN 227
+#define SLAPI_PLUGIN_DB_NO_ACL 250
-LDAP_END_DECL
+/* OpenLDAP private parametrs */
+#define SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN 1200
+#define SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN 1201
+
+#define SLAPI_X_CONFIG_ARGV 1400
+#define SLAPI_X_INTOP_FLAGS 1401
+#define SLAPI_X_INTOP_RESULT_CALLBACK 1402
+#define SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK 1403
+#define SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK 1404
+#define SLAPI_X_INTOP_CALLBACK_DATA 1405
+#define SLAPI_X_OLD_RESCONTROLS 1406
+
+LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_hn_mutex;
+LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_time_mutex;
+LDAP_SLAPI_V (ldap_pvt_thread_mutex_t) slapi_printmessage_mutex;
+LDAP_SLAPI_V (char *) slapi_log_file;
+LDAP_SLAPI_V (int) slapi_log_level;
#include "proto-slapi.h"
--- /dev/null
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2005 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Luke Howard for inclusion
+ * in OpenLDAP Software.
+ */
+
+#include "portable.h"
+
+#include <ac/string.h>
+#include <ac/stdarg.h>
+#include <ac/ctype.h>
+#include <ac/unistd.h>
+#include <ldap_pvt.h>
+
+#include <slap.h>
+#include <slapi.h>
+
+#ifdef LDAP_SLAPI
+#define FLAG_DN 0x1
+#define FLAG_NDN 0x2
+
+void slapi_sdn_init( Slapi_DN *sdn )
+{
+ sdn->flag = 0;
+ BER_BVZERO( &sdn->dn );
+ BER_BVZERO( &sdn->ndn );
+}
+
+Slapi_DN *slapi_sdn_new( void )
+{
+ Slapi_DN *sdn;
+
+ sdn = (Slapi_DN *)slapi_ch_malloc( sizeof(*sdn ));
+ slapi_sdn_init( sdn );
+
+ return sdn;
+}
+
+void slapi_sdn_done( Slapi_DN *sdn )
+{
+ if ( sdn == NULL )
+ return;
+
+ if ( sdn->flag & FLAG_DN ) {
+ slapi_ch_free_string( &sdn->dn.bv_val );
+ }
+ if ( sdn->flag & FLAG_NDN ) {
+ slapi_ch_free_string( &sdn->ndn.bv_val );
+ }
+
+ slapi_sdn_init( sdn );
+}
+
+void slapi_sdn_free( Slapi_DN **sdn )
+{
+ slapi_sdn_done( *sdn );
+ slapi_ch_free( (void **)sdn );
+}
+
+const char *slapi_sdn_get_dn( const Slapi_DN *sdn )
+{
+ if ( !BER_BVISNULL( &sdn->dn ) )
+ return sdn->dn.bv_val;
+ else
+ return sdn->ndn.bv_val;
+}
+
+const char *slapi_sdn_get_ndn( const Slapi_DN *sdn )
+{
+ if ( BER_BVISNULL( &sdn->ndn ) ) {
+ dnNormalize( 0, NULL, NULL,
+ (struct berval *)&sdn->dn, (struct berval *)&sdn->ndn, NULL );
+ ((Slapi_DN *)sdn)->flag |= FLAG_NDN;
+ }
+
+ return sdn->ndn.bv_val;
+}
+
+Slapi_DN *slapi_sdn_new_dn_byval( const char *dn )
+{
+ Slapi_DN *sdn;
+
+ sdn = slapi_sdn_new();
+ return slapi_sdn_set_dn_byval( sdn, dn );
+}
+
+Slapi_DN *slapi_sdn_new_ndn_byval( const char *ndn )
+{
+ Slapi_DN *sdn;
+
+ sdn = slapi_sdn_new();
+ return slapi_sdn_set_ndn_byval( sdn, ndn );
+}
+
+Slapi_DN *slapi_sdn_new_dn_byref( const char *dn )
+{
+ Slapi_DN *sdn;
+
+ sdn = slapi_sdn_new();
+ return slapi_sdn_set_dn_byref( sdn, dn );
+}
+
+Slapi_DN *slapi_sdn_new_ndn_byref( const char *ndn )
+{
+ Slapi_DN *sdn;
+
+ sdn = slapi_sdn_new();
+ return slapi_sdn_set_ndn_byref( sdn, ndn );
+}
+
+Slapi_DN *slapi_sdn_new_dn_passin( const char *dn )
+{
+ Slapi_DN *sdn;
+
+ sdn = slapi_sdn_new();
+ return slapi_sdn_set_dn_passin( sdn, dn );
+}
+
+Slapi_DN *slapi_sdn_set_dn_byval( Slapi_DN *sdn, const char *dn )
+{
+ if ( sdn == NULL ) {
+ return NULL;
+ }
+
+ slapi_sdn_done( sdn );
+ if ( dn != NULL ) {
+ sdn->dn.bv_val = slapi_ch_strdup( dn );
+ sdn->dn.bv_len = strlen( dn );
+ }
+ sdn->flag |= FLAG_DN;
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_dn_byref( Slapi_DN *sdn, const char *dn )
+{
+ if ( sdn == NULL )
+ return NULL;
+
+ slapi_sdn_done( sdn );
+ if ( dn != NULL ) {
+ sdn->dn.bv_val = (char *)dn;
+ sdn->dn.bv_len = strlen( dn );
+ }
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_dn_passin( Slapi_DN *sdn, const char *dn )
+{
+ if ( sdn == NULL )
+ return NULL;
+
+ slapi_sdn_set_dn_byref( sdn, dn );
+ sdn->flag |= FLAG_DN;
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_ndn_byval( Slapi_DN *sdn, const char *ndn )
+{
+ if ( sdn == NULL ) {
+ return NULL;
+ }
+
+ slapi_sdn_done( sdn );
+ if ( ndn != NULL ) {
+ sdn->ndn.bv_val = slapi_ch_strdup( ndn );
+ sdn->ndn.bv_len = strlen( ndn );
+ }
+ sdn->flag |= FLAG_NDN;
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_ndn_byref( Slapi_DN *sdn, const char *ndn )
+{
+ if ( sdn == NULL )
+ return NULL;
+
+ slapi_sdn_done( sdn );
+ if ( ndn != NULL ) {
+ sdn->ndn.bv_val = (char *)ndn;
+ sdn->ndn.bv_len = strlen( ndn );
+ }
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_ndn_passin( Slapi_DN *sdn, const char *ndn )
+{
+ if ( sdn == NULL )
+ return NULL;
+
+ slapi_sdn_set_ndn_byref( sdn, ndn );
+ sdn->flag |= FLAG_NDN;
+
+ return sdn;
+}
+
+void slapi_sdn_get_parent( const Slapi_DN *sdn, Slapi_DN *sdn_parent )
+{
+ struct berval parent_dn;
+
+ dnParent( (struct berval *)&sdn->dn, &parent_dn );
+
+ slapi_sdn_set_dn_byval( sdn_parent, parent_dn.bv_val );
+}
+
+void slapi_sdn_get_backend_parent( const Slapi_DN *sdn,
+ Slapi_DN *sdn_parent,
+ const Slapi_Backend *backend )
+{
+ slapi_sdn_get_ndn( sdn );
+
+ if ( backend == NULL ||
+ be_issuffix( (Slapi_Backend *)backend, (struct berval *)&sdn->ndn ) == 0 ) {
+ slapi_sdn_get_parent( sdn, sdn_parent );
+ }
+
+}
+
+Slapi_DN * slapi_sdn_dup( const Slapi_DN *sdn )
+{
+ Slapi_DN *new_sdn;
+
+ new_sdn = slapi_sdn_new();
+ slapi_sdn_copy( sdn, new_sdn );
+
+ return new_sdn;
+}
+
+void slapi_sdn_copy( const Slapi_DN *from, Slapi_DN *to )
+{
+ slapi_sdn_set_dn_byval( to, from->dn.bv_val );
+}
+
+int slapi_sdn_compare( const Slapi_DN *sdn1, const Slapi_DN *sdn2 )
+{
+ int match = -1;
+
+ slapi_sdn_get_ndn( sdn1 );
+ slapi_sdn_get_ndn( sdn2 );
+
+ dnMatch( &match, 0, slap_schema.si_syn_distinguishedName, NULL,
+ (struct berval *)&sdn1->ndn, (void *)&sdn2->ndn );
+
+ return match;
+}
+
+int slapi_sdn_isempty( const Slapi_DN *sdn)
+{
+ return ( BER_BVISEMPTY( &sdn->dn ) );
+}
+
+int slapi_sdn_issuffix( const Slapi_DN *sdn, const Slapi_DN *suffix_sdn )
+{
+ slapi_sdn_get_ndn( sdn );
+ slapi_sdn_get_ndn( suffix_sdn );
+
+ return dnIsSuffix( &sdn->ndn, &suffix_sdn->ndn );
+}
+
+int slapi_sdn_isparent( const Slapi_DN *parent, const Slapi_DN *child )
+{
+ Slapi_DN child_parent;
+
+ slapi_sdn_get_ndn( child );
+
+ slapi_sdn_init( &child_parent );
+ dnParent( (struct berval *)&child->ndn, &child_parent.ndn );
+
+ return ( slapi_sdn_compare( parent, &child_parent ) == 0 );
+}
+
+int slapi_sdn_isgrandparent( const Slapi_DN *parent, const Slapi_DN *child )
+{
+ Slapi_DN child_grandparent;
+
+ slapi_sdn_get_ndn( child );
+
+ slapi_sdn_init( &child_grandparent );
+ dnParent( (struct berval *)&child->ndn, &child_grandparent.ndn );
+ if ( child_grandparent.ndn.bv_len == 0 ) {
+ return 0;
+ }
+
+ dnParent( &child_grandparent.ndn, &child_grandparent.ndn );
+
+ return ( slapi_sdn_compare( parent, &child_grandparent ) == 0 );
+}
+
+int slapi_sdn_get_ndn_len( const Slapi_DN *sdn )
+{
+ slapi_sdn_get_ndn( sdn );
+
+ return sdn->ndn.bv_len;
+}
+
+int slapi_sdn_scope_test( const Slapi_DN *dn, const Slapi_DN *base, int scope )
+{
+ int rc;
+
+ switch ( scope ) {
+ case LDAP_SCOPE_BASE:
+ rc = ( slapi_sdn_compare( dn, base ) == 0 );
+ break;
+ case LDAP_SCOPE_ONELEVEL:
+ rc = slapi_sdn_isparent( base, dn );
+ break;
+ case LDAP_SCOPE_SUBTREE:
+ rc = slapi_sdn_issuffix( dn, base );
+ break;
+ default:
+ rc = 0;
+ break;
+ }
+
+ return rc;
+}
+
+void slapi_rdn_init( Slapi_RDN *rdn )
+{
+ rdn->flag = 0;
+ BER_BVZERO( &rdn->bv );
+ rdn->rdn = NULL;
+}
+
+Slapi_RDN *slapi_rdn_new( void )
+{
+ Slapi_RDN *rdn;
+
+ rdn = (Slapi_RDN *)slapi_ch_malloc( sizeof(*rdn ));
+ slapi_rdn_init( rdn );
+
+ return rdn;
+}
+
+Slapi_RDN *slapi_rdn_new_dn( const char *dn )
+{
+ Slapi_RDN *rdn;
+
+ rdn = slapi_rdn_new();
+ slapi_rdn_init_dn( rdn, dn );
+ return rdn;
+}
+
+Slapi_RDN *slapi_rdn_new_sdn( const Slapi_DN *sdn )
+{
+ return slapi_rdn_new_dn( slapi_sdn_get_dn( sdn ) );
+}
+
+Slapi_RDN *slapi_rdn_new_rdn( const Slapi_RDN *fromrdn )
+{
+ return slapi_rdn_new_dn( fromrdn->bv.bv_val );
+}
+
+void slapi_rdn_init_dn( Slapi_RDN *rdn, const char *dn )
+{
+ slapi_rdn_init( rdn );
+ slapi_rdn_set_dn( rdn, dn );
+}
+
+void slapi_rdn_init_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn )
+{
+ slapi_rdn_init( rdn );
+ slapi_rdn_set_sdn( rdn, sdn );
+}
+
+void slapi_rdn_init_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn )
+{
+ slapi_rdn_init( rdn );
+ slapi_rdn_set_rdn( rdn, fromrdn );
+}
+
+void slapi_rdn_set_dn( Slapi_RDN *rdn, const char *dn )
+{
+ struct berval bv;
+
+ slapi_rdn_done( rdn );
+
+ BER_BVZERO( &bv );
+
+ if ( dn != NULL ) {
+ bv.bv_val = (char *)dn;
+ bv.bv_len = strlen( dn );
+ }
+
+ dnExtractRdn( &bv, &rdn->bv, NULL );
+ rdn->flag |= FLAG_DN;
+}
+
+void slapi_rdn_set_sdn( Slapi_RDN *rdn, const Slapi_DN *sdn )
+{
+ return slapi_rdn_set_dn( rdn, slapi_sdn_get_dn( sdn ) );
+}
+
+void slapi_rdn_set_rdn( Slapi_RDN *rdn, const Slapi_RDN *fromrdn )
+{
+ return slapi_rdn_set_dn( rdn, fromrdn->bv.bv_val );
+}
+
+void slapi_rdn_free( Slapi_RDN **rdn )
+{
+ slapi_rdn_done( *rdn );
+ slapi_ch_free( (void **)rdn );
+}
+
+void slapi_rdn_done( Slapi_RDN *rdn )
+{
+ if ( rdn->rdn != NULL ) {
+ ldap_rdnfree( rdn->rdn );
+ rdn->rdn = NULL;
+ }
+ slapi_ch_free_string( &rdn->bv.bv_val );
+ slapi_rdn_init( rdn );
+}
+
+const char *slapi_rdn_get_rdn( const Slapi_RDN *rdn )
+{
+ return rdn->bv.bv_val;
+}
+
+static int slapi_int_rdn_explode( Slapi_RDN *rdn )
+{
+ char *next;
+
+ if ( rdn->rdn != NULL ) {
+ return LDAP_SUCCESS;
+ }
+
+ return ldap_bv2rdn( &rdn->bv, &rdn->rdn, &next, LDAP_DN_FORMAT_LDAP );
+}
+
+static int slapi_int_rdn_implode( Slapi_RDN *rdn )
+{
+ struct berval bv;
+ int rc;
+
+ if ( rdn->rdn == NULL ) {
+ return LDAP_SUCCESS;
+ }
+
+ rc = ldap_rdn2bv( rdn->rdn, &bv, LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+ if ( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
+
+ slapi_ch_free_string( &rdn->bv.bv_val );
+ rdn->bv = bv;
+
+ return 0;
+}
+
+int slapi_rdn_get_num_components( Slapi_RDN *rdn )
+{
+ int i;
+
+ if ( slapi_int_rdn_explode( rdn ) != LDAP_SUCCESS )
+ return 0;
+
+ for ( i = 0; rdn->rdn[i] != NULL; i++ )
+ ;
+
+ return i;
+}
+
+int slapi_rdn_get_first( Slapi_RDN *rdn, char **type, char **value )
+{
+ return slapi_rdn_get_next( rdn, 0, type, value );
+}
+
+int slapi_rdn_get_next( Slapi_RDN *rdn, int index, char **type, char **value )
+{
+ slapi_int_rdn_explode( rdn );
+
+ if ( rdn->rdn == NULL || rdn->rdn[index] == NULL )
+ return -1;
+
+ *type = rdn->rdn[index]->la_attr.bv_val;
+ *value = rdn->rdn[index]->la_value.bv_val;
+
+ return index + 1;
+}
+
+int slapi_rdn_get_index( Slapi_RDN *rdn, const char *type, const char *value, size_t length )
+{
+ int i, match;
+ struct berval bv;
+ AttributeDescription *ad = NULL;
+ const char *text;
+
+ slapi_int_rdn_explode( rdn );
+
+ if ( slap_str2ad( type, &ad, &text ) != LDAP_SUCCESS ) {
+ return -1;
+ }
+
+ bv.bv_val = (char *)value;
+ bv.bv_len = length;
+
+ for ( i = 0; rdn->rdn[i] != NULL; i++ ) {
+ if ( !slapi_attr_types_equivalent( ad->ad_cname.bv_val, type ))
+ continue;
+
+ if ( value_match( &match, ad, ad->ad_type->sat_equality, 0,
+ &rdn->rdn[i]->la_value, (void *)&bv, &text ) != LDAP_SUCCESS )
+ match = -1;
+
+ if ( match == 0 )
+ return i;
+ }
+
+ return -1;
+}
+
+int slapi_rdn_get_index_attr( Slapi_RDN *rdn, const char *type, char **value )
+{
+ int i;
+
+ for ( i = 0; rdn->rdn[i] != NULL; i++ ) {
+ if ( slapi_attr_types_equivalent( rdn->rdn[i]->la_attr.bv_val, type ) ) {
+ *value = rdn->rdn[i]->la_value.bv_val;
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+int slapi_rdn_contains( Slapi_RDN *rdn, const char *type, const char *value, size_t length )
+{
+ return ( slapi_rdn_get_index( rdn, type, value, length ) != -1 );
+}
+
+int slapi_rdn_contains_attr( Slapi_RDN *rdn, const char *type, char **value )
+{
+ return ( slapi_rdn_get_index_attr( rdn, type, value ) != -1 );
+}
+
+int slapi_rdn_compare( Slapi_RDN *rdn1, Slapi_RDN *rdn2 )
+{
+ struct berval nrdn1 = BER_BVNULL;
+ struct berval nrdn2 = BER_BVNULL;
+ int match;
+
+ rdnNormalize( 0, NULL, NULL, (struct berval *)&rdn1->bv, &nrdn1, NULL );
+ rdnNormalize( 0, NULL, NULL, (struct berval *)&rdn2->bv, &nrdn2, NULL );
+
+ if ( rdnMatch( &match, 0, NULL, NULL, &nrdn1, (void *)&nrdn2 ) != LDAP_SUCCESS) {
+ match = -1;
+ }
+
+ return match;
+}
+
+int slapi_rdn_isempty( const Slapi_RDN *rdn )
+{
+ return ( BER_BVISEMPTY( &rdn->bv ) );
+}
+
+int slapi_rdn_add( Slapi_RDN *rdn, const char *type, const char *value )
+{
+ char *s;
+ size_t len;
+
+ len = strlen(type) + 1 + strlen( value );
+ if ( !BER_BVISEMPTY( &rdn->bv ) ) {
+ len += 1 + rdn->bv.bv_len;
+ }
+
+ s = slapi_ch_malloc( len + 1 );
+
+ if ( BER_BVISEMPTY( &rdn->bv ) ) {
+ snprintf( s, len + 1, "%s=%s", type, value );
+ } else {
+ snprintf( s, len + 1, "%s=%s+%s", type, value, rdn->bv.bv_val );
+ }
+
+ slapi_rdn_done( rdn );
+
+ rdn->bv.bv_len = len;
+ rdn->bv.bv_val = s;
+
+ return 1;
+}
+
+int slapi_rdn_remove_index( Slapi_RDN *rdn, int atindex )
+{
+ int count, i;
+
+ count = slapi_rdn_get_num_components( rdn );
+
+ if ( atindex < 0 || atindex >= count )
+ return 0;
+
+ if ( rdn->rdn == NULL )
+ return 0;
+
+ slapi_ch_free_string( &rdn->rdn[atindex]->la_attr.bv_val );
+ slapi_ch_free_string( &rdn->rdn[atindex]->la_value.bv_val );
+
+ for ( i = atindex; i < count; i++ ) {
+ rdn->rdn[i] = rdn->rdn[i + 1];
+ }
+
+ if ( slapi_int_rdn_implode( rdn ) != LDAP_SUCCESS )
+ return 0;
+
+ return 1;
+}
+
+int slapi_rdn_remove( Slapi_RDN *rdn, const char *type, const char *value, size_t length )
+{
+ int index = slapi_rdn_get_index( rdn, type, value, length );
+
+ return slapi_rdn_remove_index( rdn, index );
+}
+
+int slapi_rdn_remove_attr( Slapi_RDN *rdn, const char *type )
+{
+ char *value;
+ int index = slapi_rdn_get_index_attr( rdn, type, &value );
+
+ return slapi_rdn_remove_index( rdn, index );
+}
+
+Slapi_DN *slapi_sdn_add_rdn( Slapi_DN *sdn, const Slapi_RDN *rdn )
+{
+ struct berval bv;
+
+ build_new_dn( &bv, &sdn->dn, (struct berval *)&rdn->bv, NULL );
+
+ slapi_sdn_done( sdn );
+ sdn->dn = bv;
+
+ return sdn;
+}
+
+Slapi_DN *slapi_sdn_set_parent( Slapi_DN *sdn, const Slapi_DN *parentdn )
+{
+ Slapi_RDN rdn;
+
+ slapi_rdn_init_sdn( &rdn, sdn );
+ slapi_sdn_set_dn_byref( sdn, slapi_sdn_get_dn( parentdn ) );
+ slapi_sdn_add_rdn( sdn, &rdn );
+ slapi_rdn_done( &rdn );
+
+ return sdn;
+}
+
+#endif /* LDAP_SLAPI */
#include <ac/ctype.h>
#include <ac/unistd.h>
+#ifdef LDAP_SLAPI
+
#include <slap.h>
#include <slapi.h>
-#ifdef LDAP_SLAPI
/*
* Object extensions
*
*parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- *eblock = ((Operation *)object)->o_extensions;
+ *eblock = ((Operation *)object)->o_hdr->oh_extensions;
*parent = ((Operation *)object)->o_conn;
break;
default:
eblock->extensions[extensionhandle] = NULL;
}
}
-#endif /* LDAP_SLAPI */
void *slapi_get_object_extension(int objecttype, void *object, int extensionhandle)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
}
return NULL;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
void slapi_set_object_extension(int objecttype, void *object, int extensionhandle, void *extension)
{
-#ifdef LDAP_SLAPI
struct slapi_extension_block *eblock;
void *parent;
/* constructed by caller */
eblock->extensions[extensionhandle] = extension;
}
-#endif /* LDAP_SLAPI */
}
int slapi_register_object_extension(
int *objecttype,
int *extensionhandle)
{
-#ifdef LDAP_SLAPI
int rc;
slapi_extension_t type;
struct slapi_registered_extension *re;
ldap_pvt_thread_mutex_unlock( ®istered_extensions.mutex );
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int slapi_int_create_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void **peblock;
void *parent;
parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- peblock = &(((Operation *)object)->o_extensions);
+ peblock = &(((Operation *)object)->o_hdr->oh_extensions);
parent = ((Operation *)object)->o_conn;
break;
default:
*peblock = eblock;
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_free_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void **peblock;
void *parent;
parent = NULL;
break;
case SLAPI_X_EXT_OPERATION:
- peblock = &(((Operation *)object)->o_extensions);
+ peblock = &(((Operation *)object)->o_hdr->oh_extensions);
parent = ((Operation *)object)->o_conn;
break;
default:
slapi_ch_free( peblock );
return 0;
-#else
- return -1;
-#endif
}
/* for reusable object types */
int slapi_int_clear_object_extensions(int objecttype, void *object)
{
-#ifdef LDAP_SLAPI
- int i, rc;
+ int i;
struct slapi_extension_block *eblock;
void *parent;
}
return 0;
-#else
- return -1;
-#endif
}
int slapi_int_init_object_extensions(void)
{
-#ifdef LDAP_SLAPI
memset( ®istered_extensions, 0, sizeof( registered_extensions ) );
if ( ldap_pvt_thread_mutex_init( ®istered_extensions.mutex ) != 0 ) {
}
return 0;
-#else
- return -1;
-#endif
}
+
+#endif /* LDAP_SLAPI */
#include <lber_pvt.h>
#include <slapi.h>
-/*
- * use a fake listener when faking a connection,
- * so it can be used in ACLs
- */
-static struct slap_listener slap_unknown_listener = {
- BER_BVC("unknown"), /* FIXME: use a URI form? (e.g. slapi://) */
- BER_BVC("UNKNOWN")
+#ifdef LDAP_SLAPI
+
+static struct slap_listener slapi_listener = {
+ BER_BVC("slapi://"),
+ BER_BVC("slapi://")
};
-static void
-internal_result_v3(
+static LDAPControl **
+slapi_int_dup_controls( LDAPControl **controls )
+{
+ LDAPControl **c;
+ size_t i;
+
+ if ( controls == NULL )
+ return NULL;
+
+ for ( i = 0; controls[i] != NULL; i++ )
+ ;
+
+ c = (LDAPControl **) slapi_ch_calloc( i + 1, sizeof(LDAPControl *) );
+
+ for ( i = 0; controls[i] != NULL; i++ ) {
+ c[i] = slapi_dup_control( controls[i] );
+ }
+
+ return c;
+}
+
+static int
+slapi_int_result(
Operation *op,
SlapReply *rs )
{
-#ifdef notdef
- /* XXX needs review after internal API change */
- /* rs->sr_nentries appears to always be 0 */
- if (op->o_tag == LDAP_REQ_SEARCH)
- slapi_pblock_set( (Slapi_PBlock *)op->o_pb,
- SLAPI_NENTRIES, (void *)rs->sr_nentries );
-#endif
-
- return;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ plugin_result_callback prc = NULL;
+ void *callback_data = NULL;
+ LDAPControl **ctrls = NULL;
+
+ assert( pb != NULL );
+
+ slapi_pblock_get( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void **)&prc );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+
+ /* we need to duplicate controls because they might go out of scope */
+ ctrls = slapi_int_dup_controls( rs->sr_ctrls );
+ slapi_pblock_set( pb, SLAPI_RESCONTROLS, ctrls );
+
+ if ( prc != NULL ) {
+ (*prc)( rs->sr_err, callback_data );
+ }
+
+ return rs->sr_err;
}
static int
-internal_search_entry(
+slapi_int_search_entry(
Operation *op,
SlapReply *rs )
{
- int nentries = 0, len = 0, i = 0;
- Slapi_Entry **head = NULL, **tp;
- Slapi_Entry *entry;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ plugin_search_entry_callback psec = NULL;
+ void *callback_data = NULL;
+ int rc = LDAP_SUCCESS;
- entry = slapi_entry_dup( rs->sr_entry );
- if ( entry == NULL ) {
- return 1;
+ assert( pb != NULL );
+
+ slapi_pblock_get( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void **)&psec );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+
+ if ( psec != NULL ) {
+ rc = (*psec)( rs->sr_entry, callback_data );
}
- slapi_pblock_get( (Slapi_PBlock *)op->o_pb,
- SLAPI_NENTRIES, &nentries );
- slapi_pblock_get( (Slapi_PBlock *)op->o_pb,
- SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &head );
-
- i = nentries + 1;
- if ( nentries == 0 ) {
- tp = (Slapi_Entry **)slapi_ch_malloc( 2 * sizeof(Slapi_Entry *) );
- if ( tp == NULL ) {
- slapi_entry_free( entry );
- return 1;
- }
+ return rc;
+}
- tp[ 0 ] = entry;
- } else {
- tp = (Slapi_Entry **)slapi_ch_realloc( (char *)head,
- sizeof(Slapi_Entry *) * ( i + 1 ) );
- if ( tp == NULL ) {
- slapi_entry_free( entry );
- return 1;
+static int
+slapi_int_search_reference(
+ Operation *op,
+ SlapReply *rs )
+{
+ int i, rc = LDAP_SUCCESS;
+ plugin_referral_entry_callback prec = NULL;
+ void *callback_data = NULL;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+
+ assert( pb != NULL );
+
+ slapi_pblock_get( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void **)&prec );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+
+ if ( prec != NULL ) {
+ for ( i = 0; rs->sr_ref[i].bv_val != NULL; i++ ) {
+ rc = (*prec)( rs->sr_ref[i].bv_val, callback_data );
+ if ( rc != LDAP_SUCCESS ) {
+ break;
+ }
}
- tp[ i - 1 ] = entry;
}
- tp[ i ] = NULL;
-
- slapi_pblock_set( (Slapi_PBlock *)op->o_pb,
- SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
- slapi_pblock_set( (Slapi_PBlock *)op->o_pb,
- SLAPI_NENTRIES, (void *)i );
- return LDAP_SUCCESS;
+ return rc;
}
-static void
-internal_result_ext(
- Operation *op,
- SlapReply *sr )
+int
+slapi_int_response( Slapi_Operation *op, SlapReply *rs )
{
- return;
+ int rc;
+
+ switch ( rs->sr_type ) {
+ case REP_RESULT:
+ rc = slapi_int_result( op, rs );
+ break;
+ case REP_SEARCH:
+ rc = slapi_int_search_entry( op, rs );
+ break;
+ case REP_SEARCHREF:
+ rc = slapi_int_search_reference( op, rs );
+ break;
+ default:
+ rc = LDAP_OTHER;
+ break;
+ }
+
+ assert( rc != SLAP_CB_CONTINUE ); /* never try to send a wire response */
+
+ return rc;
}
static int
-internal_search_reference(
- Operation *op,
- SlapReply *sr )
+slapi_int_get_ctrls( Slapi_PBlock *pb )
{
- return LDAP_SUCCESS;
-}
+ LDAPControl **c;
+ int rc = LDAP_SUCCESS;
-Connection *
-slapi_int_init_connection(
- char *DN,
- int OpType )
-{
- Connection *pConn;
- ber_len_t max = sockbuf_max_incoming;
-
- pConn = (Connection *) slapi_ch_calloc(1, sizeof(Connection));
- if (pConn == NULL) {
- return (Connection *)NULL;
+ if ( pb->pb_op->o_ctrls != NULL ) {
+ for ( c = pb->pb_op->o_ctrls; *c != NULL; c++ ) {
+ rc = slap_parse_ctrl( pb->pb_op, pb->pb_rs, *c, &pb->pb_rs->sr_text );
+ if ( rc != LDAP_SUCCESS )
+ break;
+ }
}
- LDAP_STAILQ_INIT( &pConn->c_pending_ops );
+ return rc;
+}
- pConn->c_pending_ops.stqh_first =
- (Operation *) slapi_ch_calloc( 1, sizeof(Operation) );
- if ( pConn->c_pending_ops.stqh_first == NULL ) {
- slapi_ch_free( (void **)&pConn );
- return (Connection *)NULL;
- }
+void
+slapi_int_connection_init_pb( Slapi_PBlock *pb, ber_tag_t tag )
+{
+ Connection *conn;
+ Operation *op;
+ ber_len_t max = sockbuf_max_incoming;
- pConn->c_pending_ops.stqh_first->o_pb =
- (Slapi_PBlock *) slapi_pblock_new();
- if ( pConn->c_pending_ops.stqh_first->o_pb == NULL ) {
- slapi_ch_free( (void **)&pConn->c_pending_ops.stqh_first );
- slapi_ch_free( (void **)&pConn );
- return (Connection *)NULL;
- }
+ conn = (Connection *) slapi_ch_calloc( 1, sizeof(Connection) );
- /* connection object */
- pConn->c_authmech.bv_val = NULL;
- pConn->c_authmech.bv_len = 0;
- pConn->c_dn.bv_val = NULL;
- pConn->c_dn.bv_len = 0;
- pConn->c_ndn.bv_val = NULL;
- pConn->c_ndn.bv_len = 0;
+ LDAP_STAILQ_INIT( &conn->c_pending_ops );
- pConn->c_listener = &slap_unknown_listener;
- ber_dupbv( &pConn->c_peer_domain, (struct berval *)&slap_unknown_bv );
- ber_dupbv( &pConn->c_peer_name, (struct berval *)&slap_unknown_bv );
+ op = (Operation *) slapi_ch_calloc( 1, OPERATION_BUFFER_SIZE );
+ op->o_hdr = (Opheader *)(op + 1);
+ op->o_controls = (void **)(op->o_hdr + 1);
- LDAP_STAILQ_INIT( &pConn->c_ops );
+ op->o_callback = (slap_callback *) slapi_ch_calloc( 1, sizeof(slap_callback) );
+ op->o_callback->sc_response = slapi_int_response;
+ op->o_callback->sc_cleanup = NULL;
+ op->o_callback->sc_private = pb;
+ op->o_callback->sc_next = NULL;
- pConn->c_sasl_bind_mech.bv_val = NULL;
- pConn->c_sasl_bind_mech.bv_len = 0;
- pConn->c_sasl_authctx = NULL;
- pConn->c_sasl_sockctx = NULL;
- pConn->c_sasl_extra = NULL;
+ conn->c_pending_ops.stqh_first = op;
- pConn->c_sb = ber_sockbuf_alloc( );
+ /* connection object authorization information */
+ conn->c_authtype = LDAP_AUTH_NONE;
+ BER_BVZERO( &conn->c_authmech );
+ BER_BVZERO( &conn->c_dn );
+ BER_BVZERO( &conn->c_ndn );
- ber_sockbuf_ctrl( pConn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
+ conn->c_listener = &slapi_listener;
+ ber_dupbv( &conn->c_peer_domain, (struct berval *)&slap_unknown_bv );
+ ber_dupbv( &conn->c_peer_name, (struct berval *)&slap_unknown_bv );
- pConn->c_currentber = NULL;
+ LDAP_STAILQ_INIT( &conn->c_ops );
+
+ BER_BVZERO( &conn->c_sasl_bind_mech );
+ conn->c_sasl_authctx = NULL;
+ conn->c_sasl_sockctx = NULL;
+ conn->c_sasl_extra = NULL;
+
+ conn->c_sb = ber_sockbuf_alloc();
+
+ ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
+
+ conn->c_currentber = NULL;
/* should check status of thread calls */
- ldap_pvt_thread_mutex_init( &pConn->c_mutex );
- ldap_pvt_thread_mutex_init( &pConn->c_write_mutex );
- ldap_pvt_thread_cond_init( &pConn->c_write_cv );
+ ldap_pvt_thread_mutex_init( &conn->c_mutex );
+ ldap_pvt_thread_mutex_init( &conn->c_write_mutex );
+ ldap_pvt_thread_cond_init( &conn->c_write_cv );
- ldap_pvt_thread_mutex_lock( &pConn->c_mutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
- pConn->c_n_ops_received = 0;
- pConn->c_n_ops_executing = 0;
- pConn->c_n_ops_pending = 0;
- pConn->c_n_ops_completed = 0;
+ conn->c_n_ops_received = 0;
+ conn->c_n_ops_executing = 0;
+ conn->c_n_ops_pending = 0;
+ conn->c_n_ops_completed = 0;
- pConn->c_n_get = 0;
- pConn->c_n_read = 0;
- pConn->c_n_write = 0;
+ conn->c_n_get = 0;
+ conn->c_n_read = 0;
+ conn->c_n_write = 0;
- pConn->c_protocol = LDAP_VERSION3;
+ conn->c_protocol = LDAP_VERSION3;
- pConn->c_activitytime = pConn->c_starttime = slap_get_time();
+ conn->c_activitytime = conn->c_starttime = slap_get_time();
/*
* A real connection ID is required, because syncrepl associates
* Setting a fake connection ID will cause slap_get_commit_csn()
* to return a stale value.
*/
- connection_assign_nextid( pConn );
+ connection_assign_nextid( conn );
- pConn->c_conn_state = 0x01; /* SLAP_C_ACTIVE */
- pConn->c_struct_state = 0x02; /* SLAP_C_USED */
+ conn->c_conn_state = 0x01; /* SLAP_C_ACTIVE */
+ conn->c_struct_state = 0x02; /* SLAP_C_USED */
- pConn->c_ssf = pConn->c_transport_ssf = 0;
- pConn->c_tls_ssf = 0;
+ conn->c_ssf = conn->c_transport_ssf = 0;
+ conn->c_tls_ssf = 0;
- backend_connection_init( pConn );
+ backend_connection_init( conn );
- pConn->c_send_ldap_result = internal_result_v3;
- pConn->c_send_search_entry = internal_search_entry;
- pConn->c_send_ldap_extended = internal_result_ext;
- pConn->c_send_search_reference = internal_search_reference;
+ conn->c_send_ldap_result = slap_send_ldap_result;
+ conn->c_send_search_entry = slap_send_search_entry;
+ conn->c_send_ldap_extended = slap_send_ldap_extended;
+ conn->c_send_search_reference = slap_send_search_reference;
/* operation object */
- pConn->c_pending_ops.stqh_first->o_tag = OpType;
- pConn->c_pending_ops.stqh_first->o_protocol = LDAP_VERSION3;
- pConn->c_pending_ops.stqh_first->o_authmech.bv_val = NULL;
- pConn->c_pending_ops.stqh_first->o_authmech.bv_len = 0;
- pConn->c_pending_ops.stqh_first->o_time = slap_get_time();
- pConn->c_pending_ops.stqh_first->o_do_not_cache = 1;
- pConn->c_pending_ops.stqh_first->o_threadctx = ldap_pvt_thread_pool_context();
- pConn->c_pending_ops.stqh_first->o_tmpmemctx = NULL;
- pConn->c_pending_ops.stqh_first->o_tmpmfuncs = &ch_mfuncs;
- pConn->c_pending_ops.stqh_first->o_conn = pConn;
- pConn->c_pending_ops.stqh_first->o_connid = pConn->c_connid;
-
- ldap_pvt_thread_mutex_unlock( &pConn->c_mutex );
-
- return pConn;
+ op->o_tag = tag;
+ op->o_protocol = LDAP_VERSION3;
+ BER_BVZERO( &op->o_authmech );
+ op->o_time = slap_get_time();
+ op->o_do_not_cache = 1;
+ op->o_threadctx = ldap_pvt_thread_pool_context();
+ op->o_tmpmemctx = NULL;
+ op->o_tmpmfuncs = &ch_mfuncs;
+ op->o_conn = conn;
+ op->o_connid = conn->c_connid;
+ op->o_bd = frontendDB;
+
+ /* extensions */
+ slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
+ slapi_int_create_object_extensions( SLAPI_X_EXT_CONNECTION, conn );
+
+ pb->pb_rs = (SlapReply *)slapi_ch_calloc( 1, sizeof(SlapReply) );
+ pb->pb_op = op;
+ pb->pb_conn = conn;
+ pb->pb_intop = 1;
+
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
}
-void slapi_int_connection_destroy( Connection **pConn )
+static void
+slapi_int_set_operation_dn( Slapi_PBlock *pb )
{
- Connection *conn = *pConn;
- Operation *op;
-
- if ( pConn == NULL ) {
- return;
- }
-
- op = (Operation *)conn->c_pending_ops.stqh_first;
-
- slap_graduate_commit_csn( op );
-
- if ( op->o_req_dn.bv_val != NULL ) {
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- }
- if ( op->o_req_ndn.bv_val != NULL ) {
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
- }
-
- if ( conn->c_sb != NULL ) {
- ber_sockbuf_free( conn->c_sb );
- }
- if ( op != NULL ) {
- slapi_ch_free( (void **)&op );
+ Backend *be;
+ Operation *op = pb->pb_op;
+
+ if ( BER_BVISNULL( &op->o_ndn ) ) {
+ /* set to root DN */
+ be = select_backend( &op->o_req_ndn, get_manageDSAit( op ), 1 );
+ if ( be != NULL ) {
+ ber_dupbv( &op->o_dn, &be->be_rootdn );
+ ber_dupbv( &op->o_ndn, &be->be_rootndn );
+ }
}
- slapi_ch_free( (void **)pConn );
}
-/*
- * Function : values2obj
- * Convert an array of strings into a BerVarray.
- * the strings.
- */
-static int
-values2obj_copy(
- char **ppValue,
- BerVarray *bvobj )
+void
+slapi_int_connection_done_pb( Slapi_PBlock *pb )
{
- int i;
- BerVarray tmpberval;
+ Connection *conn;
+ Operation *op;
- if ( ppValue == NULL ) {
- *bvobj = NULL;
- return LDAP_SUCCESS;
+ PBLOCK_ASSERT_INTOP( pb, 0 );
+
+ conn = pb->pb_conn;
+ op = pb->pb_op;
+
+ /* free allocated DNs */
+ if ( !BER_BVISNULL( &op->o_dn ) )
+ op->o_tmpfree( op->o_dn.bv_val, op->o_tmpmemctx );
+ if ( !BER_BVISNULL( &op->o_ndn ) )
+ op->o_tmpfree( op->o_ndn.bv_val, op->o_tmpmemctx );
+
+ if ( !BER_BVISNULL( &op->o_req_dn ) )
+ op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+ if ( !BER_BVISNULL( &op->o_req_ndn ) )
+ op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+
+ switch ( op->o_tag ) {
+ case LDAP_REQ_MODRDN:
+ if ( !BER_BVISNULL( &op->orr_newrdn ))
+ op->o_tmpfree( op->orr_newrdn.bv_val, op->o_tmpmemctx );
+ if ( !BER_BVISNULL( &op->orr_nnewrdn ))
+ op->o_tmpfree( op->orr_nnewrdn.bv_val, op->o_tmpmemctx );
+ if ( op->orr_newSup != NULL ) {
+ assert( !BER_BVISNULL( op->orr_newSup ) );
+ op->o_tmpfree( op->orr_newSup->bv_val, op->o_tmpmemctx );
+ op->o_tmpfree( op->orr_newSup, op->o_tmpmemctx );
+ }
+ if ( op->orr_nnewSup != NULL ) {
+ assert( !BER_BVISNULL( op->orr_nnewSup ) );
+ op->o_tmpfree( op->orr_nnewSup->bv_val, op->o_tmpmemctx );
+ op->o_tmpfree( op->orr_nnewSup, op->o_tmpmemctx );
+ }
+ break;
+ case LDAP_REQ_ADD:
+ slap_mods_free( op->ora_modlist, 0 );
+ break;
+ case LDAP_REQ_MODIFY:
+ slap_mods_free( op->orm_modlist, 1 );
+ break;
+ case LDAP_REQ_SEARCH:
+ if ( op->ors_attrs != NULL ) {
+ op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
+ op->ors_attrs = NULL;
+ }
+ break;
+ default:
+ break;
}
- for ( i = 0; ppValue[i] != NULL; i++ )
- ; /* EMPTY */
+ slapi_ch_free_string( &conn->c_authmech.bv_val );
+ slapi_ch_free_string( &conn->c_dn.bv_val );
+ slapi_ch_free_string( &conn->c_ndn.bv_val );
+ slapi_ch_free_string( &conn->c_peer_domain.bv_val );
+ slapi_ch_free_string( &conn->c_peer_name.bv_val );
- tmpberval = (BerVarray)slapi_ch_malloc( (i+1) * (sizeof(struct berval)) );
- if ( tmpberval == NULL ) {
- return LDAP_NO_MEMORY;
- }
- for ( i = 0; ppValue[i] != NULL; i++ ) {
- size_t len = strlen( ppValue[i] );
-
- tmpberval[i].bv_val = slapi_ch_malloc( len + 1 );
- AC_MEMCPY( tmpberval[i].bv_val, ppValue[i], len + 1 );
- tmpberval[i].bv_len = len;
+ if ( conn->c_sb != NULL ) {
+ ber_sockbuf_free( conn->c_sb );
}
- tmpberval[i].bv_val = NULL;
- tmpberval[i].bv_len = 0;
- *bvobj = tmpberval;
+ slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
+ slapi_int_free_object_extensions( SLAPI_X_EXT_CONNECTION, conn );
- return LDAP_SUCCESS;
+ slapi_ch_free( (void **)&pb->pb_op->o_callback );
+ slapi_ch_free( (void **)&pb->pb_op );
+ slapi_ch_free( (void **)&pb->pb_conn );
+ slapi_ch_free( (void **)&pb->pb_rs );
}
static int
-bvptr2obj_copy(
- struct berval **bvptr,
- BerVarray *bvobj )
+slapi_int_func_internal_pb( Slapi_PBlock *pb, slap_operation_t which )
{
- int i;
- BerVarray tmpberval;
+ BI_op_bind **func;
+ SlapReply *rs = pb->pb_rs;
+ int rc;
+
+ PBLOCK_ASSERT_INTOP( pb, 0 );
- if ( bvptr == NULL ) {
- *bvobj = NULL;
- return LDAP_SUCCESS;
+ rc = slapi_int_get_ctrls( pb );
+ if ( rc != LDAP_SUCCESS ) {
+ rs->sr_err = rc;
+ return rc;
}
- for ( i = 0; bvptr[i] != NULL; i++ )
- ; /* EMPTY */
+ pb->pb_op->o_bd = frontendDB;
+ func = &frontendDB->be_bind;
- tmpberval = (BerVarray)slapi_ch_malloc( (i + 1) * sizeof(struct berval));
- if ( tmpberval == NULL ) {
- return LDAP_NO_MEMORY;
- }
+ return func[which]( pb->pb_op, pb->pb_rs );
+}
- for ( i = 0; bvptr[i] != NULL; i++ ) {
- tmpberval[i].bv_val = slapi_ch_malloc( bvptr[i]->bv_len );
- tmpberval[i].bv_len = bvptr[i]->bv_len;
- AC_MEMCPY( tmpberval[i].bv_val, bvptr[i]->bv_val, bvptr[i]->bv_len );
+int
+slapi_delete_internal_pb( Slapi_PBlock *pb )
+{
+ if ( pb == NULL ) {
+ return -1;
}
- tmpberval[i].bv_val = NULL;
- tmpberval[i].bv_len = 0;
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_DELETE );
- *bvobj = tmpberval;
+ slapi_int_func_internal_pb( pb, op_delete );
+ slap_graduate_commit_csn( pb->pb_op );
- return LDAP_SUCCESS;
+ return 0;
}
-/*
- * Function : slapi_int_ldapmod_to_entry
- * convert a dn plus an array of LDAPMod struct ptrs to an entry structure
- * with a link list of the correspondent attributes.
- * Return value : LDAP_SUCCESS
- * LDAP_NO_MEMORY
- * LDAP_OTHER
-*/
-static Entry *
-slapi_int_ldapmod_to_entry(
- Connection *pConn,
- char *ldn,
- LDAPMod **mods )
+int
+slapi_add_internal_pb( Slapi_PBlock *pb )
{
- struct berval dn = BER_BVNULL;
- Entry *pEntry=NULL;
- LDAPMod *pMod;
- struct berval *bv;
- Operation *op;
+ SlapReply *rs;
+ Slapi_Entry *entry_orig = NULL;
- Modifications *modlist = NULL;
- Modifications **modtail = &modlist;
- Modifications tmp;
-
- int rc = LDAP_SUCCESS;
- int i;
+ if ( pb == NULL ) {
+ return -1;
+ }
- const char *text = NULL;
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_ADD );
- op = (Operation *)pConn->c_pending_ops.stqh_first;
+ rs = pb->pb_rs;
- pEntry = (Entry *) ch_calloc( 1, sizeof(Entry) );
- if ( pEntry == NULL) {
- rc = LDAP_NO_MEMORY;
- goto cleanup;
- }
+ entry_orig = pb->pb_op->ora_e;
+ pb->pb_op->ora_e = NULL;
- dn.bv_val = slapi_ch_strdup(ldn);
- dn.bv_len = strlen(ldn);
+ /*
+ * The caller can specify a new entry, or a target DN and set
+ * of modifications, but not both.
+ */
+ if ( entry_orig != NULL ) {
+ if ( pb->pb_op->ora_modlist != NULL || !BER_BVISNULL( &pb->pb_op->o_req_ndn )) {
+ rs->sr_err = LDAP_PARAM_ERROR;
+ goto cleanup;
+ }
- rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname, NULL );
- if ( rc != LDAP_SUCCESS ) {
+ assert( BER_BVISNULL( &pb->pb_op->o_req_dn ) ); /* shouldn't get set */
+ ber_dupbv( &pb->pb_op->o_req_dn, &entry_orig->e_name );
+ ber_dupbv( &pb->pb_op->o_req_ndn, &entry_orig->e_nname );
+ } else if ( pb->pb_op->ora_modlist == NULL || BER_BVISNULL( &pb->pb_op->o_req_ndn )) {
+ rs->sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
- if ( rc == LDAP_SUCCESS ) {
- for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod = mods[++i]) {
- Modifications *mod;
-
- if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
- /*
- * Convert an array of pointers to bervals to
- * an array of bervals. Note that we need to copy the
- * values too, as the slap_mods_check() will free the
- * original values after prettying; the modifications
- * being passed in may not have been allocated on the
- * heap.
- */
- rc = bvptr2obj_copy( pMod->mod_bvalues, &bv );
- if ( rc != LDAP_SUCCESS ) goto cleanup;
- tmp.sml_type.bv_val = pMod->mod_type;
- tmp.sml_type.bv_len = strlen( pMod->mod_type );
- tmp.sml_values = bv;
- tmp.sml_nvalues = NULL;
-
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
-
- mod->sml_op = LDAP_MOD_ADD;
- mod->sml_flags = 0;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- mod->sml_type = tmp.sml_type;
- mod->sml_values = tmp.sml_values;
- mod->sml_nvalues = tmp.sml_nvalues;
-
- *modtail = mod;
- modtail = &mod->sml_next;
-
- } else {
- /* attr values are in string format, need to be converted */
- /* to an array of bervals */
- if ( pMod->mod_values == NULL ) {
- rc = LDAP_OTHER;
- } else {
- rc = values2obj_copy( pMod->mod_values, &bv );
- if ( rc != LDAP_SUCCESS ) goto cleanup;
- tmp.sml_type.bv_val = pMod->mod_type;
- tmp.sml_type.bv_len = strlen( pMod->mod_type );
- tmp.sml_values = bv;
- tmp.sml_nvalues = NULL;
-
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
-
- mod->sml_op = LDAP_MOD_ADD;
- mod->sml_flags = 0;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- mod->sml_type = tmp.sml_type;
- mod->sml_values = tmp.sml_values;
- mod->sml_nvalues = tmp.sml_nvalues;
-
- *modtail = mod;
- modtail = &mod->sml_next;
- }
- }
- } /* for each LDAPMod */
- }
+ pb->pb_op->ora_e = (Entry *)slapi_ch_calloc( 1, sizeof(Entry) );
+ ber_dupbv( &pb->pb_op->ora_e->e_name, &pb->pb_op->o_req_dn );
+ ber_dupbv( &pb->pb_op->ora_e->e_nname, &pb->pb_op->o_req_ndn );
+
+ if ( entry_orig != NULL ) {
+ assert( pb->pb_op->ora_modlist == NULL );
- op->o_bd = select_backend( &pEntry->e_nname, 0, 0 );
- if ( op->o_bd == NULL ) {
- rc = LDAP_PARTIAL_RESULTS;
+ rs->sr_err = slap_entry2mods( entry_orig, &pb->pb_op->ora_modlist,
+ &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ) );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ goto cleanup;
+ }
} else {
- int repl_user = be_isupdate_dn( op->o_bd, &op->o_bd->be_rootdn );
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- int update = !BER_BVISNULL( &op->o_bd->be_update_ndn );
- char textbuf[ SLAP_TEXT_BUFLEN ];
- size_t textlen = sizeof( textbuf );
-
- rc = slap_mods_check( modlist, &text,
- textbuf, textlen, NULL );
- if ( rc != LDAP_SUCCESS) {
- goto cleanup;
- }
+ assert( pb->pb_op->ora_modlist != NULL );
+ }
- if ( !update ) {
- rc = slap_mods_no_user_mod_check( op, modlist,
- &text, textbuf, textlen );
- if ( rc != LDAP_SUCCESS) {
- goto cleanup;
- }
- }
+ rs->sr_err = slap_mods_check( pb->pb_op->ora_modlist, &rs->sr_text,
+ pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ goto cleanup;
+ }
- if ( !repl_user ) {
- rc = slap_mods_opattrs( op, modlist, modtail,
- &text, textbuf, textlen, 1 );
- if ( rc != LDAP_SUCCESS) {
- goto cleanup;
- }
- }
+ /* Duplicate the values, because we may call slapi_entry_free() */
+ rs->sr_err = slap_mods2entry( pb->pb_op->ora_modlist, &pb->pb_op->ora_e,
+ 1, 0, &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ) );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ goto cleanup;
+ }
- rc = slap_mods2entry( modlist, &pEntry, repl_user,
- 0, &text, textbuf, textlen );
- if (rc != LDAP_SUCCESS) {
- goto cleanup;
- }
+ if ( slapi_int_func_internal_pb( pb, op_add ) == 0 ) {
+ if ( pb->pb_op->ora_e != NULL && pb->pb_op->o_private != NULL ) {
+ BackendDB *bd = pb->pb_op->o_bd;
- } else {
- rc = LDAP_REFERRAL;
+ pb->pb_op->o_bd = (BackendDB *)pb->pb_op->o_private;
+ pb->pb_op->o_private = NULL;
+ be_entry_release_w( pb->pb_op, pb->pb_op->ora_e );
+ pb->pb_op->ora_e = NULL;
+ pb->pb_op->o_bd = bd;
+ pb->pb_op->o_private = NULL;
}
}
-cleanup:;
- if ( dn.bv_val )
- slapi_ch_free( (void **)&dn.bv_val );
- if ( modlist != NULL )
- slap_mods_free( modlist );
- if ( rc != LDAP_SUCCESS ) {
- if ( pEntry != NULL ) {
- slapi_entry_free( pEntry );
- }
- pEntry = NULL;
+cleanup:
+ slap_graduate_commit_csn( pb->pb_op );
+
+ if ( pb->pb_op->ora_e != NULL ) {
+ slapi_entry_free( pb->pb_op->ora_e );
+ pb->pb_op->ora_e = NULL;
+ }
+ if ( entry_orig != NULL ) {
+ pb->pb_op->ora_e = entry_orig;
+ slap_mods_free( pb->pb_op->ora_modlist, 1 );
+ pb->pb_op->ora_modlist = NULL;
}
- return( pEntry );
+ return 0;
}
-/* Function : slapi_delete_internal
- *
- * Description : Plugin functions call this routine to delete an entry
- * in the backend directly
- * Return values : LDAP_SUCCESS
- * LDAP_PARAM_ERROR
- * LDAP_NO_MEMORY
- * LDAP_OTHER
- * LDAP_UNWILLING_TO_PERFORM
-*/
-Slapi_PBlock *
-slapi_delete_internal(
- char *ldn,
- LDAPControl **controls,
- int log_change )
+int
+slapi_modrdn_internal_pb( Slapi_PBlock *pb )
{
-#ifdef LDAP_SLAPI
- Connection *pConn = NULL;
- Operation *op = NULL;
- Slapi_PBlock *pPB = NULL;
- SlapReply rs = { REP_RESULT };
- struct berval dn = BER_BVNULL;
-
- int manageDsaIt = SLAP_CONTROL_NONE;
- int isCritical;
-
- if ( ldn == NULL ) {
- rs.sr_err = LDAP_PARAM_ERROR;
- goto cleanup;
+ if ( pb == NULL ) {
+ return -1;
}
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_DELETE );
- if (pConn == NULL) {
- rs.sr_err = LDAP_NO_MEMORY;
- goto cleanup;
- }
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODRDN );
- op = (Operation *)pConn->c_pending_ops.stqh_first;
- pPB = (Slapi_PBlock *)op->o_pb;
- op->o_ctrls = controls;
-
- dn.bv_val = slapi_ch_strdup(ldn);
- dn.bv_len = strlen(ldn);
- rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
- if ( rs.sr_err != LDAP_SUCCESS )
- goto cleanup;
-
- if ( slapi_control_present( controls,
- SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical) ) {
- manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
- }
-
- op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
- if ( op->o_bd == NULL ) {
- rs.sr_err = LDAP_PARTIAL_RESULTS;
+ if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) {
+ pb->pb_rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
goto cleanup;
}
- op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
- op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
-
- if ( op->o_bd->be_delete ) {
- int repl_user = be_isupdate( op );
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
- if ( log_change ) op->o_callback = &cb;
- if ( (*op->o_bd->be_delete)( op, &rs ) ) {
- rs.sr_err = LDAP_OTHER;
- }
- } else {
- rs.sr_err = LDAP_REFERRAL;
- }
- } else {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- }
+ slapi_int_func_internal_pb( pb, op_modrdn );
cleanup:
- if ( pPB != NULL ) {
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
- }
- if ( dn.bv_val ) {
- slapi_ch_free( (void **)&dn.bv_val );
- }
-
- slapi_int_connection_destroy( &pConn );
+ slap_graduate_commit_csn( pb->pb_op );
- return pPB;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ return 0;
}
-#ifdef LDAP_SLAPI
-static Slapi_PBlock *
-slapi_int_add_entry_locked(
- Connection *pConn,
- Slapi_Entry **e,
- LDAPControl **controls,
- int log_changes )
+int
+slapi_modify_internal_pb( Slapi_PBlock *pb )
{
- Operation *op = NULL;
- Slapi_PBlock *pPB = NULL;
+ SlapReply *rs;
- int manageDsaIt = SLAP_CONTROL_NONE;
- int isCritical;
- SlapReply rs = { REP_RESULT };
-
- if ( *e == NULL ) {
- rs.sr_err = LDAP_PARAM_ERROR;
- goto cleanup;
+ if ( pb == NULL ) {
+ return -1;
}
- if ( slapi_control_present( controls, LDAP_CONTROL_MANAGEDSAIT,
- NULL, &isCritical ) ) {
- manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
- }
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODIFY );
- op = (Operation *)pConn->c_pending_ops.stqh_first;
- pPB = (Slapi_PBlock *)op->o_pb;
- op->o_ctrls = controls;
+ rs = pb->pb_rs;
- op->o_bd = select_backend( &((*e)->e_nname), manageDsaIt, 1 );
- if ( op->o_bd == NULL ) {
- rs.sr_err = LDAP_PARTIAL_RESULTS;
+ if ( pb->pb_op->orm_modlist == NULL ) {
+ rs->sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
- op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
- op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
- op->oq_add.rs_e = *e;
-
- if ( op->o_bd->be_add ) {
- int repl_user = be_isupdate( op );
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
- if ( log_changes ) op->o_callback = &cb;
- if ( (*op->o_bd->be_add)( op, &rs ) == 0 ) {
- be_entry_release_w( op, *e );
- *e = NULL;
- }
- } else {
- rs.sr_err = LDAP_REFERRAL;
- }
- } else {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- }
-
-cleanup:
- if ( pPB != NULL ) {
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
+ if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) {
+ rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
+ goto cleanup;
}
- return( pPB );
-}
-#endif /* LDAP_SLAPI */
+ rs->sr_err = slap_mods_check( pb->pb_op->orm_modlist,
+ &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ goto cleanup;
+ }
-Slapi_PBlock *
-slapi_add_entry_internal(
- Slapi_Entry *e,
- LDAPControl **controls,
- int log_changes )
-{
-#ifdef LDAP_SLAPI
- Slapi_PBlock *pb = NULL;
- Slapi_Entry *entry = NULL;
- Connection *pConn = NULL;
+ slapi_int_func_internal_pb( pb, op_modify );
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_ADD );
- if ( pConn == NULL ) {
- return NULL;
- }
-
- /*
- * We make a copy to avoid an entry that may be freed later
- * by the caller being placed in the cache.
- */
- entry = slapi_entry_dup( e );
- pb = slapi_int_add_entry_locked( pConn, &entry, controls, log_changes );
- if ( entry != NULL ) {
- slapi_entry_free( entry );
- }
-
- slapi_int_connection_destroy( &pConn );
+cleanup:
+ slap_graduate_commit_csn( pb->pb_op );
- return pb;
-#else
- return NULL;
-#endif
+ return 0;
}
-Slapi_PBlock *
-slapi_add_internal(
- char *dn,
- LDAPMod **mods,
- LDAPControl **controls,
- int log_changes )
+static int
+slapi_int_search_entry_callback( Slapi_Entry *entry, void *callback_data )
{
-#ifdef LDAP_SLAPI
- LDAPMod *pMod = NULL;
- Connection *pConn = NULL;
- Slapi_PBlock *pb = NULL;
- Entry *pEntry = NULL;
- int i, rc = LDAP_SUCCESS;
-
- if ( mods == NULL || *mods == NULL || dn == NULL || *dn == '\0' ) {
- rc = LDAP_PARAM_ERROR ;
- }
+ int nentries = 0, i = 0;
+ Slapi_Entry **head = NULL, **tp;
+ Slapi_PBlock *pb = (Slapi_PBlock *)callback_data;
- if ( rc == LDAP_SUCCESS ) {
- for ( i = 0, pMod = mods[0]; pMod != NULL; pMod = mods[++i] ) {
- if ( (pMod->mod_op & LDAP_MOD_OP ) != LDAP_MOD_ADD ) {
- rc = LDAP_OTHER;
- break;
- }
- }
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_SEARCH );
+
+ entry = slapi_entry_dup( entry );
+ if ( entry == NULL ) {
+ return LDAP_NO_MEMORY;
}
- if ( rc == LDAP_SUCCESS ) {
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_ADD );
- if ( pConn != NULL ) {
- pEntry = slapi_int_ldapmod_to_entry( pConn, dn, mods );
- if ( pEntry == NULL ) {
- rc = LDAP_OTHER;
- }
+ slapi_pblock_get( pb, SLAPI_NENTRIES, &nentries );
+ slapi_pblock_get( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &head );
+
+ i = nentries + 1;
+ if ( nentries == 0 ) {
+ tp = (Slapi_Entry **)slapi_ch_malloc( 2 * sizeof(Slapi_Entry *) );
+ if ( tp == NULL ) {
+ slapi_entry_free( entry );
+ return LDAP_NO_MEMORY;
}
- }
- if ( rc != LDAP_SUCCESS ) {
- pb = slapi_pblock_new();
- slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
+ tp[0] = entry;
} else {
- pb = slapi_int_add_entry_locked( pConn, &pEntry, controls, log_changes );
- }
-
- if ( pEntry != NULL ) {
- slapi_entry_free( pEntry );
+ tp = (Slapi_Entry **)slapi_ch_realloc( (char *)head,
+ sizeof(Slapi_Entry *) * ( i + 1 ) );
+ if ( tp == NULL ) {
+ slapi_entry_free( entry );
+ return LDAP_NO_MEMORY;
+ }
+ tp[i - 1] = entry;
}
+ tp[i] = NULL;
+
+ slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
+ slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)&i );
- slapi_int_connection_destroy( &pConn );
-
- return pb;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ return LDAP_SUCCESS;
}
-/* Function : slapi_modrdn_internal
- *
- * Description : Plugin functions call this routine to modify the rdn
- * of an entry in the backend directly
- * Return values : LDAP_SUCCESS
- * LDAP_PARAM_ERROR
- * LDAP_NO_MEMORY
- * LDAP_OTHER
- * LDAP_UNWILLING_TO_PERFORM
- *
- * NOTE: This function does not support the "newSuperior" option from LDAP V3.
- */
-Slapi_PBlock *
-slapi_modrdn_internal(
- char *olddn,
- char *lnewrdn,
- int deloldrdn,
- LDAPControl **controls,
- int log_change )
+int
+slapi_search_internal_pb( Slapi_PBlock *pb )
{
-#ifdef LDAP_SLAPI
- struct berval dn = BER_BVNULL;
- struct berval newrdn = BER_BVNULL;
- Connection *pConn = NULL;
- Operation *op = NULL;
- Slapi_PBlock *pPB = NULL;
- int manageDsaIt = SLAP_CONTROL_NONE;
- int isCritical;
- SlapReply rs = { REP_RESULT };
-
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_MODRDN );
- if ( pConn == NULL) {
- rs.sr_err = LDAP_NO_MEMORY;
- goto cleanup;
- }
+ return slapi_search_internal_callback_pb( pb,
+ (void *)pb,
+ NULL,
+ slapi_int_search_entry_callback,
+ NULL );
+}
- op = (Operation *)pConn->c_pending_ops.stqh_first;
- pPB = (Slapi_PBlock *)op->o_pb;
- op->o_ctrls = controls;
+int
+slapi_search_internal_callback_pb( Slapi_PBlock *pb,
+ void *callback_data,
+ plugin_result_callback prc,
+ plugin_search_entry_callback psec,
+ plugin_referral_entry_callback prec )
+{
+ int free_filter = 0;
+ SlapReply *rs;
- if ( slapi_control_present( controls,
- SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical ) ) {
- manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
+ if ( pb == NULL ) {
+ return -1;
}
- op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
- if ( op->o_bd == NULL ) {
- rs.sr_err = LDAP_PARTIAL_RESULTS;
- goto cleanup;
- }
+ PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_SEARCH );
- op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
- op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
+ rs = pb->pb_rs;
- dn.bv_val = slapi_ch_strdup( olddn );
- dn.bv_len = strlen( olddn );
+ /* search callback and arguments */
+ slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void *)prc );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void *)psec );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void *)prec );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, (void *)callback_data );
- rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
- if ( rs.sr_err != LDAP_SUCCESS ) {
+ if ( BER_BVISEMPTY( &pb->pb_op->ors_filterstr )) {
+ rs->sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
- if ( op->o_req_dn.bv_len == 0 ) {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- goto cleanup;
+ if ( pb->pb_op->ors_filter == NULL ) {
+ pb->pb_op->ors_filter = slapi_str2filter( pb->pb_op->ors_filterstr.bv_val );
+ if ( pb->pb_op->ors_filter == NULL ) {
+ rs->sr_err = LDAP_PROTOCOL_ERROR;
+ goto cleanup;
+ }
+
+ free_filter = 1;
}
- newrdn.bv_val = slapi_ch_strdup( lnewrdn );
- newrdn.bv_len = strlen( lnewrdn );
+ slapi_int_func_internal_pb( pb, op_search );
- rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn, NULL );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
+cleanup:
+ if ( free_filter ) {
+ slapi_filter_free( pb->pb_op->ors_filter, 1 );
+ pb->pb_op->ors_filter = NULL;
}
- if ( rdn_validate( &op->oq_modrdn.rs_nnewrdn ) != LDAP_SUCCESS ) {
- goto cleanup;
- }
+ slapi_pblock_delete_param( pb, SLAPI_X_INTOP_RESULT_CALLBACK );
+ slapi_pblock_delete_param( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK );
+ slapi_pblock_delete_param( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK );
+ slapi_pblock_delete_param( pb, SLAPI_X_INTOP_CALLBACK_DATA );
- op->oq_modrdn.rs_newSup = NULL;
- op->oq_modrdn.rs_nnewSup = NULL;
- op->oq_modrdn.rs_deleteoldrdn = deloldrdn;
-
- if ( op->o_bd->be_modrdn ) {
- int repl_user = be_isupdate( op );
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
- if ( log_change ) op->o_callback = &cb;
- if ( (*op->o_bd->be_modrdn)( op, &rs ) ) {
- rs.sr_err = LDAP_OTHER;
- }
- } else {
- rs.sr_err = LDAP_REFERRAL;
- }
- } else {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- }
+ return 0;
+}
-cleanup:
+/* Wrappers for old API */
+
+void
+slapi_search_internal_set_pb( Slapi_PBlock *pb,
+ const char *base,
+ int scope,
+ const char *filter,
+ char **attrs,
+ int attrsonly,
+ LDAPControl **controls,
+ const char *uniqueid,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ int no_limit = SLAP_NO_LIMIT;
+ int deref = LDAP_DEREF_NEVER;
+
+ slapi_int_connection_init_pb( pb, LDAP_REQ_SEARCH );
+ slapi_pblock_set( pb, SLAPI_SEARCH_TARGET, (void *)base );
+ slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)&scope );
+ slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, (void *)0 );
+ slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)filter );
+ slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
+ slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)&attrsonly );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_pblock_set( pb, SLAPI_SEARCH_DEREF, (void *)&deref );
+ slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, (void *)&no_limit );
+ slapi_pblock_set( pb, SLAPI_SEARCH_TIMELIMIT, (void *)&no_limit );
+
+ slapi_int_set_operation_dn( pb );
+}
- if ( pPB != NULL ) {
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
- }
-
- if ( dn.bv_val )
- slapi_ch_free( (void **)&dn.bv_val );
+Slapi_PBlock *
+slapi_search_internal(
+ char *ldn,
+ int scope,
+ char *filStr,
+ LDAPControl **controls,
+ char **attrs,
+ int attrsonly )
+{
+ Slapi_PBlock *pb;
- if ( newrdn.bv_val )
- slapi_ch_free( (void **)&newrdn.bv_val );
- if ( op->oq_modrdn.rs_newrdn.bv_val )
- slapi_ch_free( (void **)&op->oq_modrdn.rs_newrdn.bv_val );
- if ( op->oq_modrdn.rs_nnewrdn.bv_val )
- slapi_ch_free( (void **)&op->oq_modrdn.rs_nnewrdn.bv_val );
+ pb = slapi_pblock_new();
- slapi_int_connection_destroy( &pConn );
+ slapi_search_internal_set_pb( pb, ldn, scope, filStr,
+ attrs, attrsonly,
+ controls, NULL, NULL, 0 );
- return pPB;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ slapi_search_internal_pb( pb );
+
+ return pb;
+}
+
+void
+slapi_modify_internal_set_pb( Slapi_PBlock *pb,
+ const char *dn,
+ LDAPMod **mods,
+ LDAPControl **controls,
+ const char *uniqueid,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ slapi_int_connection_init_pb( pb, LDAP_REQ_MODIFY );
+ slapi_pblock_set( pb, SLAPI_MODIFY_TARGET, (void *)dn );
+ slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)mods );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_int_set_operation_dn( pb );
}
/* Function : slapi_modify_internal
LDAPControl **controls,
int log_change )
{
-#ifdef LDAP_SLAPI
- int i;
- Connection *pConn = NULL;
- Operation *op = NULL;
- Slapi_PBlock *pPB = NULL;
-
- struct berval dn = BER_BVNULL;
+ Slapi_PBlock *pb;
- int manageDsaIt = SLAP_CONTROL_NONE;
- int isCritical;
- struct berval *bv;
- LDAPMod *pMod;
+ pb = slapi_pblock_new();
- Modifications *modlist = NULL;
- Modifications **modtail = &modlist;
- Modifications tmp;
-
- SlapReply rs = { REP_RESULT };
-
- if ( mods == NULL || *mods == NULL || ldn == NULL ) {
- rs.sr_err = LDAP_PARAM_ERROR ;
- goto cleanup;
- }
-
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_MODIFY );
- if ( pConn == NULL ) {
- rs.sr_err = LDAP_NO_MEMORY;
- goto cleanup;
- }
+ slapi_modify_internal_set_pb( pb, ldn, mods, controls, NULL, NULL, 0 );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
+ slapi_modify_internal_pb( pb );
- op = (Operation *)pConn->c_pending_ops.stqh_first;
- pPB = (Slapi_PBlock *)op->o_pb;
- op->o_ctrls = controls;
+ return pb;
+}
- dn.bv_val = slapi_ch_strdup( ldn );
- dn.bv_len = strlen( ldn );
- rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
- }
+int
+slapi_add_internal_set_pb( Slapi_PBlock *pb,
+ const char *dn,
+ LDAPMod **attrs,
+ LDAPControl **controls,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ slapi_int_connection_init_pb( pb, LDAP_REQ_ADD );
+ slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn );
+ slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)attrs );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_int_set_operation_dn( pb );
+
+ return 0;
+}
- if ( slapi_control_present( controls,
- SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical ) ) {
- manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
- }
+Slapi_PBlock *
+slapi_add_internal(
+ char * dn,
+ LDAPMod **attrs,
+ LDAPControl **controls,
+ int log_change )
+{
+ Slapi_PBlock *pb;
- op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
- if ( op->o_bd == NULL ) {
- rs.sr_err = LDAP_PARTIAL_RESULTS;
- goto cleanup;
- }
-
- op->o_dn = pConn->c_dn = op->o_bd->be_rootdn;
- op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
-
- for ( i = 0, pMod = mods[0];
- rs.sr_err == LDAP_SUCCESS && pMod != NULL;
- pMod = mods[++i] )
- {
- Modifications *mod;
-
- if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
- /*
- * attr values are in berval format
- * convert an array of pointers to bervals
- * to an array of bervals
- */
- rs.sr_err = bvptr2obj_copy( pMod->mod_bvalues, &bv );
- if ( rs.sr_err != LDAP_SUCCESS )
- goto cleanup;
- tmp.sml_type.bv_val = pMod->mod_type;
- tmp.sml_type.bv_len = strlen( pMod->mod_type );
- tmp.sml_values = bv;
- tmp.sml_nvalues = NULL;
-
- mod = (Modifications *)ch_malloc( sizeof(Modifications) );
-
- mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
- mod->sml_flags = 0;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- mod->sml_type = tmp.sml_type;
- mod->sml_values = tmp.sml_values;
- mod->sml_nvalues = tmp.sml_nvalues;
- } else {
- rs.sr_err = values2obj_copy( pMod->mod_values, &bv );
- if ( rs.sr_err != LDAP_SUCCESS )
- goto cleanup;
- tmp.sml_type.bv_val = pMod->mod_type;
- tmp.sml_type.bv_len = strlen( pMod->mod_type );
- tmp.sml_values = bv;
- tmp.sml_nvalues = NULL;
-
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
-
- mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
- mod->sml_flags = 0;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
- mod->sml_type = tmp.sml_type;
- mod->sml_values = tmp.sml_values;
- mod->sml_nvalues = tmp.sml_nvalues;
- }
- *modtail = mod;
- modtail = &mod->sml_next;
+ pb = slapi_pblock_new();
- switch( pMod->mod_op & LDAP_MOD_OP ) {
- case LDAP_MOD_ADD:
- if ( mod->sml_values == NULL ) {
- rs.sr_err = LDAP_PROTOCOL_ERROR;
- goto cleanup;
- }
+ slapi_add_internal_set_pb( pb, dn, attrs, controls, NULL, 0);
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
+ slapi_add_internal_pb( pb );
- /* fall through */
- case LDAP_MOD_DELETE:
- case LDAP_MOD_REPLACE:
- case LDAP_MOD_INCREMENT:
- break;
+ return pb;
+}
- default:
- rs.sr_err = LDAP_PROTOCOL_ERROR;
- goto cleanup;
- }
- }
- *modtail = NULL;
+void
+slapi_add_entry_internal_set_pb( Slapi_PBlock *pb,
+ Slapi_Entry *e,
+ LDAPControl **controls,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ slapi_int_connection_init_pb( pb, LDAP_REQ_ADD );
+ slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_int_set_operation_dn( pb );
+}
- if ( op->o_req_ndn.bv_len == 0 ) {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- goto cleanup;
- }
+Slapi_PBlock *
+slapi_add_entry_internal(
+ Slapi_Entry *e,
+ LDAPControl **controls,
+ int log_change )
+{
+ Slapi_PBlock *pb;
- op->oq_modify.rs_modlist = modlist;
-
- if ( op->o_bd->be_modify ) {
- int repl_user = be_isupdate( op );
- if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
- const char *text = NULL;
- char textbuf[ SLAP_TEXT_BUFLEN ];
- size_t textlen = sizeof( textbuf );
- slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
-
- rs.sr_err = slap_mods_check( modlist,
- &text, textbuf, textlen, NULL );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
- }
+ pb = slapi_pblock_new();
- if ( !update ) {
- rs.sr_err = slap_mods_no_user_mod_check( op, modlist,
- &text, textbuf, textlen );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
- }
- }
+ slapi_add_entry_internal_set_pb( pb, e, controls, NULL, 0 );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
+ slapi_add_internal_pb( pb );
- if ( !repl_user ) {
- rs.sr_err = slap_mods_opattrs( op, modlist,
- modtail, &text, textbuf,
- textlen, 1 );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
- }
- }
- if ( log_change ) op->o_callback = &cb;
- if ( (*op->o_bd->be_modify)( op, &rs ) ) {
- rs.sr_err = LDAP_OTHER;
- }
- } else {
- rs.sr_err = LDAP_REFERRAL;
- }
- } else {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- }
+ return pb;
+}
-cleanup:
+void
+slapi_rename_internal_set_pb( Slapi_PBlock *pb,
+ const char *olddn,
+ const char *newrdn,
+ const char *newsuperior,
+ int deloldrdn,
+ LDAPControl **controls,
+ const char *uniqueid,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ slapi_int_connection_init_pb( pb, LDAP_REQ_MODRDN );
+ slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)olddn );
+ slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn );
+ slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR, (void *)newsuperior );
+ slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)&deloldrdn );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_int_set_operation_dn( pb );
+}
- if ( pPB != NULL )
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
+/* Function : slapi_modrdn_internal
+ *
+ * Description : Plugin functions call this routine to modify the rdn
+ * of an entry in the backend directly
+ * Return values : LDAP_SUCCESS
+ * LDAP_PARAM_ERROR
+ * LDAP_NO_MEMORY
+ * LDAP_OTHER
+ * LDAP_UNWILLING_TO_PERFORM
+ *
+ * NOTE: This function does not support the "newSuperior" option from LDAP V3.
+ */
+Slapi_PBlock *
+slapi_modrdn_internal(
+ char *olddn,
+ char *lnewrdn,
+ int deloldrdn,
+ LDAPControl **controls,
+ int log_change )
+{
+ Slapi_PBlock *pb;
- if ( dn.bv_val )
- slapi_ch_free( (void **)&dn.bv_val );
+ pb = slapi_pblock_new ();
- if ( modlist != NULL )
- slap_mods_free( modlist );
+ slapi_rename_internal_set_pb( pb, olddn, lnewrdn, NULL,
+ deloldrdn, controls, NULL, NULL, 0 );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
+ slapi_modrdn_internal_pb( pb );
- slapi_int_connection_destroy( &pConn );
+ return pb;
+}
- return pPB;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+void
+slapi_delete_internal_set_pb( Slapi_PBlock *pb,
+ const char *dn,
+ LDAPControl **controls,
+ const char *uniqueid,
+ Slapi_ComponentId *plugin_identity,
+ int operation_flags )
+{
+ slapi_int_connection_init_pb( pb, LDAP_REQ_DELETE );
+ slapi_pblock_set( pb, SLAPI_TARGET_DN, (void *)dn );
+ slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_int_set_operation_dn( pb );
}
+/* Function : slapi_delete_internal
+ *
+ * Description : Plugin functions call this routine to delete an entry
+ * in the backend directly
+ * Return values : LDAP_SUCCESS
+ * LDAP_PARAM_ERROR
+ * LDAP_NO_MEMORY
+ * LDAP_OTHER
+ * LDAP_UNWILLING_TO_PERFORM
+*/
Slapi_PBlock *
-slapi_search_internal(
+slapi_delete_internal(
char *ldn,
- int scope,
- char *filStr,
LDAPControl **controls,
- char **attrs,
- int attrsonly )
-{
-#ifdef LDAP_SLAPI
- Connection *c;
- Operation *op = NULL;
- Slapi_PBlock *pPB = NULL;
- struct berval dn = BER_BVNULL;
- Filter *filter=NULL;
- struct berval fstr = BER_BVNULL;
- AttributeName *an = NULL;
- const char *text = NULL;
-
- int manageDsaIt = SLAP_CONTROL_NONE;
- int isCritical;
- int i;
-
- SlapReply rs = { REP_RESULT };
-
- c = slapi_int_init_connection( NULL, LDAP_REQ_SEARCH );
- if ( c == NULL ) {
- rs.sr_err = LDAP_NO_MEMORY;
- goto cleanup;
- }
-
- op = (Operation *)c->c_pending_ops.stqh_first;
- pPB = (Slapi_PBlock *)op->o_pb;
- op->o_ctrls = controls;
-
- if ( ldn != NULL ) {
- dn.bv_val = slapi_ch_strdup(ldn);
- dn.bv_len = strlen(ldn);
- }
-
- rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
- if ( rs.sr_err != LDAP_SUCCESS ) {
- goto cleanup;
- }
-
- if ( scope != LDAP_SCOPE_BASE &&
- scope != LDAP_SCOPE_ONELEVEL &&
- scope != LDAP_SCOPE_SUBTREE ) {
- rs.sr_err = LDAP_PROTOCOL_ERROR;
- goto cleanup;
- }
-
- filter = slapi_str2filter(filStr);
- if ( filter == NULL ) {
- rs.sr_err = LDAP_PROTOCOL_ERROR;
- goto cleanup;
- }
-
- filter2bv( filter, &fstr );
-
- for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
- ; /* count the number of attributes */
- }
-
- if (i > 0) {
- an = (AttributeName *)slapi_ch_calloc( (i + 1), sizeof(AttributeName) );
- for (i = 0; attrs[i] != 0; i++) {
- an[i].an_desc = NULL;
- an[i].an_oc = NULL;
- an[i].an_oc_exclude = 0;
- an[i].an_name.bv_val = slapi_ch_strdup(attrs[i]);
- an[i].an_name.bv_len = strlen(attrs[i]);
- slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
- }
- an[i].an_name.bv_val = NULL;
- }
-
- memset( &rs, 0, sizeof(rs) );
- rs.sr_type = REP_RESULT;
- rs.sr_err = LDAP_SUCCESS;
- rs.sr_entry = NULL; /* paranoia */
-
- if ( scope == LDAP_SCOPE_BASE ) {
- rs.sr_entry = NULL;
-
- if ( op->o_req_ndn.bv_len == 0 ) {
- rs.sr_err = root_dse_info( c, &rs.sr_entry, &rs.sr_text );
- }
-
- if( rs.sr_err != LDAP_SUCCESS ) {
- send_ldap_result( op, &rs );
- goto cleanup;
- } else if ( rs.sr_entry != NULL ) {
- rs.sr_err = test_filter( op, rs.sr_entry, filter );
-
- if ( rs.sr_err == LDAP_COMPARE_TRUE ) {
- rs.sr_type = REP_SEARCH;
- rs.sr_err = LDAP_SUCCESS;
- rs.sr_attrs = an;
- rs.sr_operational_attrs = NULL;
- rs.sr_flags = REP_ENTRY_MODIFIABLE;
-
- send_search_entry( op, &rs );
- }
-
- entry_free( rs.sr_entry );
-
- rs.sr_type = REP_RESULT;
- rs.sr_err = LDAP_SUCCESS;
-
- send_ldap_result( op, &rs );
-
- goto cleanup;
- }
- }
-
- if ( !op->o_req_ndn.bv_len && default_search_nbase.bv_len ) {
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
-
- ber_dupbv( &op->o_req_dn, &default_search_base );
- ber_dupbv( &op->o_req_ndn, &default_search_nbase );
- }
-
- if ( slapi_control_present( controls,
- LDAP_CONTROL_MANAGEDSAIT, NULL, &isCritical ) ) {
- manageDsaIt = isCritical ? SLAP_CONTROL_CRITICAL : SLAP_CONTROL_NONCRITICAL;
- }
-
- op->o_bd = select_backend( &op->o_req_ndn, manageDsaIt, 1 );
- if ( op->o_bd == NULL ) {
- if ( manageDsaIt > SLAP_CONTROL_NONE ) {
- rs.sr_err = LDAP_NO_SUCH_OBJECT;
- } else {
- rs.sr_err = LDAP_PARTIAL_RESULTS;
- }
- goto cleanup;
- }
-
- op->o_dn = c->c_dn = op->o_bd->be_rootdn;
- op->o_ndn = c->c_ndn = op->o_bd->be_rootndn;
-
- op->oq_search.rs_scope = scope;
- op->oq_search.rs_deref = 0;
- op->oq_search.rs_slimit = SLAP_NO_LIMIT;
- op->oq_search.rs_tlimit = SLAP_NO_LIMIT;
- op->oq_search.rs_attrsonly = attrsonly;
- op->oq_search.rs_attrs = an;
- op->oq_search.rs_filter = filter;
- op->oq_search.rs_filterstr = fstr;
-
- if ( op->o_bd->be_search ) {
- if ( (*op->o_bd->be_search)( op, &rs ) != 0 ) {
- rs.sr_err = LDAP_OTHER;
- }
- } else {
- rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
- }
-
-cleanup:
+ int log_change )
+{
+ Slapi_PBlock *pb;
- if ( pPB != NULL )
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
+ pb = slapi_pblock_new();
- if ( dn.bv_val )
- slapi_ch_free( (void **)&dn.bv_val );
- if ( filter )
- slapi_filter_free( filter, 1 );
- if ( fstr.bv_val )
- slapi_ch_free( (void **)&fstr.bv_val );
- if ( an != NULL )
- slapi_ch_free( (void **)&an );
+ slapi_delete_internal_set_pb( pb, ldn, controls, NULL, NULL, 0 );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
+ slapi_delete_internal_pb( pb );
- slapi_int_connection_destroy( &c );
+ return pb;
+}
- return pPB;
-#else
- return NULL;
#endif /* LDAP_SLAPI */
-}
--- /dev/null
+/* slapi_overlay.c - SLAPI overlay */
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2001-2005 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Luke Howard for inclusion
+ * in OpenLDAP Software.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
+#include "slapi.h"
+
+#ifdef LDAP_SLAPI
+
+static slap_overinst slapi;
+static int slapi_over_initialized = 0;
+
+static int slapi_over_response( Operation *op, SlapReply *rs );
+static int slapi_over_cleanup( Operation *op, SlapReply *rs );
+
+static Slapi_PBlock *
+slapi_over_pblock_new( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb;
+
+ pb = slapi_pblock_new();
+ pb->pb_op = op;
+ pb->pb_conn = op->o_conn;
+ pb->pb_rs = rs;
+ pb->pb_intop = 0;
+
+ PBLOCK_ASSERT_OP( pb, op->o_tag );
+
+ return pb;
+}
+
+static int
+slapi_op_internal_p( Operation *op, SlapReply *rs, slap_callback *cb )
+{
+ int internal_op = 0;
+ Slapi_PBlock *pb = NULL;
+ slap_callback *pcb;
+
+ /*
+ * Abstraction violating check for SLAPI internal operations
+ * allows pblock to remain consistent when invoking internal
+ * op plugins
+ */
+ for ( pcb = op->o_callback; pcb != NULL; pcb = pcb->sc_next ) {
+ if ( pcb->sc_response == slapi_int_response ) {
+ pb = (Slapi_PBlock *)pcb->sc_private;
+ PBLOCK_ASSERT_INTOP( pb, 0 );
+ internal_op = 1;
+ break;
+ }
+ }
+
+ if ( cb != NULL ) {
+ if ( pb == NULL ) {
+ pb = slapi_over_pblock_new( op, rs );
+ }
+
+ cb->sc_response = slapi_over_response;
+ cb->sc_cleanup = slapi_over_cleanup;
+ cb->sc_private = pb;
+ cb->sc_next = op->o_callback;
+ op->o_callback = cb;
+ }
+
+ return internal_op;
+}
+
+static int
+slapi_over_compute_output(
+ computed_attr_context *c,
+ Slapi_Attr *attribute,
+ Slapi_Entry *entry
+)
+{
+ Attribute **a;
+ AttributeDescription *desc;
+ SlapReply *rs = (SlapReply *)c->cac_private;
+
+ if ( c == NULL || attribute == NULL || entry == NULL ) {
+ return 0;
+ }
+
+ assert( rs->sr_entry == entry );
+
+ desc = attribute->a_desc;
+
+ if ( rs->sr_attrs == NULL ) {
+ /* All attrs request, skip operational attributes */
+ if ( is_at_operational( desc->ad_type ) ) {
+ return 0;
+ }
+ } else {
+ /* Specific attributes requested */
+ if ( is_at_operational( desc->ad_type ) ) {
+ if ( !SLAP_OPATTRS( rs->sr_attr_flags ) &&
+ !ad_inlist( desc, rs->sr_attrs ) ) {
+ return 0;
+ }
+ } else {
+ if ( !SLAP_USERATTRS( rs->sr_attr_flags ) &&
+ !ad_inlist( desc, rs->sr_attrs ) ) {
+ return 0;
+ }
+ }
+ }
+
+ /* XXX perhaps we should check for existing attributes and merge */
+ for ( a = &rs->sr_operational_attrs; *a != NULL; a = &(*a)->a_next )
+ ;
+
+ *a = slapi_attr_dup( attribute );
+
+ return 0;
+}
+
+static int
+slapi_over_aux_operational( Operation *op, SlapReply *rs )
+{
+ /* Support for computed attribute plugins */
+ computed_attr_context ctx;
+ AttributeName *anp;
+
+ if ( slapi_op_internal_p( op, rs, NULL ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ ctx.cac_pb = slapi_over_pblock_new( op, rs );
+ ctx.cac_op = op;
+ ctx.cac_private = rs;
+
+ if ( rs->sr_entry != NULL ) {
+ /*
+ * For each client requested attribute, call the plugins.
+ */
+ if ( rs->sr_attrs != NULL ) {
+ for ( anp = rs->sr_attrs; anp->an_name.bv_val != NULL; anp++ ) {
+ if ( compute_evaluator( &ctx, anp->an_name.bv_val,
+ rs->sr_entry, slapi_over_compute_output ) == 1 ) {
+ break;
+ }
+ }
+ } else {
+ /*
+ * Technically we shouldn't be returning operational attributes
+ * when the user requested only user attributes. We'll let the
+ * plugin decide whether to be naughty or not.
+ */
+ compute_evaluator( &ctx, "*", rs->sr_entry, slapi_over_compute_output );
+ }
+ }
+
+ slapi_pblock_destroy( ctx.cac_pb );
+
+ return SLAP_CB_CONTINUE;
+}
+
+/*
+ * We need this function to call frontendDB (global) plugins before
+ * database plugins, if we are invoked by a slap_callback.
+ */
+static int
+slapi_over_call_plugins( Slapi_PBlock *pb, int type )
+{
+ int rc = 1; /* means no plugins called */
+ Operation *op;
+
+ PBLOCK_ASSERT_OP( pb, 0 );
+ op = pb->pb_op;
+
+ if ( op->o_bd != frontendDB ) {
+ rc = slapi_int_call_plugins( frontendDB, type, pb );
+ }
+ if ( rc >= 0 ) {
+ rc = slapi_int_call_plugins( op->o_bd, type, pb );
+ }
+
+ return rc;
+}
+
+static int
+slapi_over_search( Operation *op, SlapReply *rs, int type )
+{
+ int rc;
+ Slapi_PBlock *pb;
+
+ assert( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF );
+
+ /* create a new pblock to not trample on result controls */
+ pb = slapi_over_pblock_new( op, rs );
+
+ rc = slapi_over_call_plugins( pb, type );
+ if ( rc >= 0 ) /* 1 means no plugins called */
+ rc = SLAP_CB_CONTINUE;
+ else
+ rc = LDAP_SUCCESS; /* confusing: don't abort, but don't send */
+
+ slapi_pblock_destroy(pb);
+
+ return rc;
+}
+
+/*
+ * Call pre- and post-result plugins
+ */
+static int
+slapi_over_result( Operation *op, SlapReply *rs, int type )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+
+ assert( rs->sr_type == REP_RESULT );
+
+ slapi_over_call_plugins( pb, type );
+
+ return SLAP_CB_CONTINUE;
+}
+
+
+static int
+slapi_op_bind_callback( Operation *op, SlapReply *rs, int prc )
+{
+ switch ( prc ) {
+ case SLAPI_BIND_SUCCESS:
+ /* Continue with backend processing */
+ break;
+ case SLAPI_BIND_FAIL:
+ /* Failure, frontend (that's us) sends result */
+ rs->sr_err = LDAP_INVALID_CREDENTIALS;
+ send_ldap_result( op, rs );
+ return rs->sr_err;
+ break;
+ case SLAPI_BIND_ANONYMOUS: /* undocumented */
+ default: /* plugin sent result or no plugins called */
+ BER_BVZERO( &op->orb_edn );
+
+ if ( rs->sr_err == LDAP_SUCCESS ) {
+ /*
+ * Plugin will have called slapi_pblock_set(LDAP_CONN_DN) which
+ * will have set conn->c_dn and conn->c_ndn
+ */
+ if ( BER_BVISNULL( &op->o_conn->c_ndn ) && prc == 1 ) {
+ /* No plugins were called; continue processing */
+ return LDAP_SUCCESS;
+ }
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+ if ( !BER_BVISEMPTY( &op->o_conn->c_ndn ) ) {
+ ber_len_t max = sockbuf_max_incoming_auth;
+ ber_sockbuf_ctrl( op->o_conn->c_sb,
+ LBER_SB_OPT_SET_MAX_INCOMING, &max );
+ }
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ /* log authorization identity */
+ Statslog( LDAP_DEBUG_STATS,
+ "%s BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
+ op->o_log_prefix,
+ BER_BVISNULL( &op->o_conn->c_dn )
+ ? "<empty>" : op->o_conn->c_dn.bv_val,
+ op->orb_tmp_mech.bv_val, 0, 0 );
+
+ return -1;
+ }
+ break;
+ }
+
+ return rs->sr_err;
+}
+
+static int
+slapi_op_search_callback( Operation *op, SlapReply *rs, int prc )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+
+ /* check preoperation result code */
+ if ( prc < 0 ) {
+ return rs->sr_err;
+ }
+
+ rs->sr_err = LDAP_SUCCESS;
+
+ if ( slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, pb ) == 0 ) {
+ /*
+ * The plugin can set the SLAPI_SEARCH_FILTER.
+ * SLAPI_SEARCH_STRFILER is not normative.
+ */
+ op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
+ filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
+ }
+
+ return LDAP_SUCCESS;
+}
+
+struct slapi_op_info {
+ int soi_preop; /* preoperation plugin parameter */
+ int soi_postop; /* postoperation plugin parameter */
+ int soi_internal_preop; /* internal preoperation plugin parameter */
+ int soi_internal_postop; /* internal postoperation plugin parameter */
+ int (*soi_callback)(Operation *, SlapReply *, int); /* preoperation result handler */
+} slapi_op_dispatch_table[] = {
+ {
+ SLAPI_PLUGIN_PRE_BIND_FN,
+ SLAPI_PLUGIN_POST_BIND_FN,
+ 0,
+ 0,
+ slapi_op_bind_callback
+ },
+ {
+ SLAPI_PLUGIN_PRE_UNBIND_FN,
+ SLAPI_PLUGIN_POST_UNBIND_FN,
+ 0,
+ 0,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_SEARCH_FN,
+ SLAPI_PLUGIN_POST_SEARCH_FN,
+ 0,
+ 0,
+ slapi_op_search_callback
+ },
+ {
+ SLAPI_PLUGIN_PRE_COMPARE_FN,
+ SLAPI_PLUGIN_POST_COMPARE_FN,
+ 0,
+ 0,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_MODIFY_FN,
+ SLAPI_PLUGIN_POST_MODIFY_FN,
+ SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN,
+ SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_MODRDN_FN,
+ SLAPI_PLUGIN_POST_MODRDN_FN,
+ SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN,
+ SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_ADD_FN,
+ SLAPI_PLUGIN_POST_ADD_FN,
+ SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN,
+ SLAPI_PLUGIN_INTERNAL_POST_ADD_FN,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_DELETE_FN,
+ SLAPI_PLUGIN_POST_DELETE_FN,
+ SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN,
+ SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN,
+ NULL
+ },
+ {
+ SLAPI_PLUGIN_PRE_ABANDON_FN,
+ SLAPI_PLUGIN_POST_ABANDON_FN,
+ 0,
+ 0,
+ NULL
+ },
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ NULL
+ }
+};
+
+slap_operation_t
+slapi_tag2op( ber_tag_t tag )
+{
+ slap_operation_t op;
+
+ switch ( tag ) {
+ case LDAP_REQ_BIND:
+ op = op_bind;
+ break;
+ case LDAP_REQ_ADD:
+ op = op_add;
+ break;
+ case LDAP_REQ_DELETE:
+ op = op_delete;
+ break;
+ case LDAP_REQ_MODRDN:
+ op = op_modrdn;
+ break;
+ case LDAP_REQ_MODIFY:
+ op = op_modify;
+ break;
+ case LDAP_REQ_COMPARE:
+ op = op_compare;
+ break;
+ case LDAP_REQ_SEARCH:
+ op = op_search;
+ break;
+ case LDAP_REQ_UNBIND:
+ op = op_unbind;
+ break;
+ default:
+ op = op_last;
+ break;
+ }
+
+ return op;
+}
+
+/* Add SLAPI_RESCONTROLS to rs->sr_ctrls, with care, because
+ * rs->sr_ctrls could be allocated on the stack */
+static int
+slapi_over_merge_controls( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ LDAPControl **ctrls = NULL;
+ LDAPControl **slapi_ctrls = NULL;
+ size_t n_slapi_ctrls = 0;
+ size_t n_rs_ctrls = 0;
+ size_t i;
+
+ slapi_pblock_get( pb, SLAPI_RESCONTROLS, (void **)&slapi_ctrls );
+
+ n_slapi_ctrls = slapi_int_count_controls( slapi_ctrls );
+ n_rs_ctrls = slapi_int_count_controls( rs->sr_ctrls );
+
+ slapi_pblock_set( pb, SLAPI_X_OLD_RESCONTROLS, (void *)rs->sr_ctrls );
+
+ if ( n_slapi_ctrls == 0 )
+ return LDAP_SUCCESS; /* no SLAPI controls */
+
+ ctrls = (LDAPControl **) op->o_tmpalloc(
+ ( n_slapi_ctrls + n_rs_ctrls + 1 ) * sizeof(LDAPControl *),
+ op->o_tmpmemctx );
+
+ for ( i = 0; i < n_slapi_ctrls; i++ ) {
+ ctrls[i] = slapi_ctrls[i];
+ }
+ if ( rs->sr_ctrls != NULL ) {
+ for ( i = 0; i < n_rs_ctrls; i++ ) {
+ ctrls[n_slapi_ctrls + i] = rs->sr_ctrls[i];
+ }
+ }
+ ctrls[n_slapi_ctrls + n_rs_ctrls] = NULL;
+
+ rs->sr_ctrls = ctrls;
+
+ return LDAP_SUCCESS;
+}
+
+static int
+slapi_over_unmerge_controls( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ LDAPControl **rs_ctrls = NULL;
+
+ slapi_pblock_get( pb, SLAPI_X_OLD_RESCONTROLS, (void **)&rs_ctrls );
+
+ if ( rs->sr_ctrls == NULL || rs->sr_ctrls == rs_ctrls ) {
+ /* no copying done */
+ return LDAP_SUCCESS;
+ }
+
+ op->o_tmpfree( rs->sr_ctrls, op->o_tmpmemctx );
+ rs->sr_ctrls = rs_ctrls;
+
+ return LDAP_SUCCESS;
+}
+
+static int
+slapi_over_response( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ int rc = SLAP_CB_CONTINUE;
+
+ if ( pb->pb_intop == 0 ) {
+ switch ( rs->sr_type ) {
+ case REP_RESULT:
+ rc = slapi_over_result( op, rs, SLAPI_PLUGIN_PRE_RESULT_FN );
+ break;
+ case REP_SEARCH:
+ rc = slapi_over_search( op, rs, SLAPI_PLUGIN_PRE_ENTRY_FN );
+ break;
+ case REP_SEARCHREF:
+ rc = slapi_over_search( op, rs, SLAPI_PLUGIN_PRE_REFERRAL_FN );
+ break;
+ default:
+ break;
+ }
+ }
+
+ slapi_over_merge_controls( op, rs );
+
+ return rc;
+}
+
+static int
+slapi_over_cleanup( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
+ int rc = SLAP_CB_CONTINUE;
+
+ slapi_over_unmerge_controls( op, rs );
+
+ if ( pb->pb_intop == 0 ) {
+ switch ( rs->sr_type ) {
+ case REP_RESULT:
+ rc = slapi_over_result( op, rs, SLAPI_PLUGIN_POST_RESULT_FN );
+ break;
+ case REP_SEARCH:
+ rc = slapi_over_search( op, rs, SLAPI_PLUGIN_POST_ENTRY_FN );
+ break;
+ case REP_SEARCHREF:
+ rc = slapi_over_search( op, rs, SLAPI_PLUGIN_POST_REFERRAL_FN );
+ break;
+ default:
+ break;
+ }
+ }
+
+ return rc;
+}
+
+static int
+slapi_op_func( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb;
+ slap_operation_t which;
+ struct slapi_op_info *opinfo;
+ int rc;
+ slap_overinfo *oi;
+ slap_overinst *on;
+ slap_callback cb;
+ int internal_op;
+ int preop_type, postop_type;
+ BackendDB *be;
+
+ if ( !slapi_plugins_used )
+ return SLAP_CB_CONTINUE;
+
+ /*
+ * Find the SLAPI operation information for this LDAP
+ * operation; this will contain the preop and postop
+ * plugin types, as well as optional callbacks for
+ * setting up the SLAPI environment.
+ */
+ which = slapi_tag2op( op->o_tag );
+ if ( which >= op_last ) {
+ /* invalid operation, but let someone else deal with it */
+ return SLAP_CB_CONTINUE;
+ }
+
+ opinfo = &slapi_op_dispatch_table[which];
+ if ( opinfo == NULL ) {
+ /* no SLAPI plugin types for this operation */
+ return SLAP_CB_CONTINUE;
+ }
+
+ internal_op = slapi_op_internal_p( op, rs, &cb );
+
+ if ( internal_op ) {
+ preop_type = opinfo->soi_internal_preop;
+ postop_type = opinfo->soi_internal_postop;
+ } else {
+ preop_type = opinfo->soi_preop;
+ postop_type = opinfo->soi_postop;
+ }
+
+ if ( preop_type == 0 ) {
+ /* no SLAPI plugin types for this operation */
+ pb = NULL;
+ rc = SLAP_CB_CONTINUE;
+ goto cleanup;
+ }
+
+ pb = SLAPI_OPERATION_PBLOCK( op );
+
+ /* cache backend so we call correct postop plugins */
+ be = pb->pb_op->o_bd;
+
+ rc = slapi_int_call_plugins( be, preop_type, pb );
+
+ /*
+ * soi_callback is responsible for examining the result code
+ * of the preoperation plugin and determining whether to
+ * abort. This is needed because of special SLAPI behaviour
+ e with bind preoperation plugins.
+ *
+ * The soi_callback function is also used to reset any values
+ * returned from the preoperation plugin before calling the
+ * backend (for the success case).
+ */
+ if ( opinfo->soi_callback == NULL ) {
+ /* default behaviour is preop plugin can abort operation */
+ if ( rc < 0 ) {
+ rc = rs->sr_err;
+ goto cleanup;
+ }
+ } else {
+ rc = (opinfo->soi_callback)( op, rs, rc );
+ if ( rc )
+ goto cleanup;
+ }
+
+ /*
+ * Call actual backend (or next overlay in stack). We need to
+ * do this rather than returning SLAP_CB_CONTINUE and calling
+ * postoperation plugins in a response handler to match the
+ * behaviour of SLAPI in OpenLDAP 2.2, where postoperation
+ * plugins are called after the backend has completely
+ * finished processing the operation.
+ */
+ on = (slap_overinst *)op->o_bd->bd_info;
+ oi = on->on_info;
+
+ rc = overlay_op_walk( op, rs, which, oi, on->on_next );
+
+ /*
+ * Call postoperation plugins
+ */
+ slapi_int_call_plugins( be, postop_type, pb );
+
+cleanup:
+ if ( !internal_op ) {
+ slapi_pblock_destroy(pb);
+ cb.sc_private = NULL;
+ }
+
+ op->o_callback = cb.sc_next;
+
+ return rc;
+}
+
+static int
+slapi_over_extended( Operation *op, SlapReply *rs )
+{
+ Slapi_PBlock *pb;
+ SLAPI_FUNC callback;
+ int rc;
+ int internal_op;
+ slap_callback cb;
+
+ slapi_int_get_extop_plugin( &op->ore_reqoid, &callback );
+ if ( callback == NULL ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ internal_op = slapi_op_internal_p( op, rs, &cb );
+ if ( internal_op ) {
+ return SLAP_CB_CONTINUE;
+ }
+
+ pb = SLAPI_OPERATION_PBLOCK( op );
+
+ rc = (*callback)( pb );
+ if ( rc == SLAPI_PLUGIN_EXTENDED_SENT_RESULT ) {
+ goto cleanup;
+ } else if ( rc == SLAPI_PLUGIN_EXTENDED_NOT_HANDLED ) {
+ rc = SLAP_CB_CONTINUE;
+ goto cleanup;
+ }
+
+ assert( rs->sr_rspoid != NULL );
+
+ send_ldap_extended( op, rs );
+
+#if 0
+ slapi_ch_free_string( (char **)&rs->sr_rspoid );
+#endif
+
+ if ( rs->sr_rspdata != NULL )
+ ber_bvfree( rs->sr_rspdata );
+
+ rc = rs->sr_err;
+
+cleanup:
+ slapi_pblock_destroy( pb );
+ op->o_callback = cb.sc_next;
+
+ return rc;
+}
+
+static int
+slapi_over_access_allowed(
+ Operation *op,
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val,
+ slap_access_t access,
+ AccessControlState *state,
+ slap_mask_t *maskp )
+{
+ int rc;
+ Slapi_PBlock *pb;
+ slap_callback cb;
+ int internal_op;
+ SlapReply rs = { REP_RESULT };
+
+ internal_op = slapi_op_internal_p( op, &rs, &cb );
+
+ cb.sc_response = NULL;
+ cb.sc_cleanup = NULL;
+
+ pb = SLAPI_OPERATION_PBLOCK( op );
+
+ rc = slapi_int_access_allowed( op, e, desc, val, access, state );
+ if ( rc ) {
+ rc = SLAP_CB_CONTINUE;
+ }
+
+ if ( !internal_op ) {
+ slapi_pblock_destroy( pb );
+ }
+
+ op->o_callback = cb.sc_next;
+
+ return rc;
+}
+
+static int
+slapi_over_acl_group(
+ Operation *op,
+ Entry *target,
+ struct berval *gr_ndn,
+ struct berval *op_ndn,
+ ObjectClass *group_oc,
+ AttributeDescription *group_at )
+{
+ Slapi_Entry *e;
+ int rc;
+ Slapi_PBlock *pb;
+ BackendDB *be = op->o_bd;
+ GroupAssertion *g;
+ SlapReply rs = { REP_RESULT };
+
+ op->o_bd = select_backend( gr_ndn, 0, 0 );
+
+ for ( g = op->o_groups; g; g = g->ga_next ) {
+ if ( g->ga_be != op->o_bd || g->ga_oc != group_oc ||
+ g->ga_at != group_at || g->ga_len != gr_ndn->bv_len )
+ {
+ continue;
+ }
+ if ( strcmp( g->ga_ndn, gr_ndn->bv_val ) == 0 ) {
+ break;
+ }
+ }
+ if ( g != NULL ) {
+ rc = g->ga_res;
+ goto done;
+ }
+
+ if ( target != NULL && dn_match( &target->e_nname, gr_ndn ) ) {
+ e = target;
+ rc = 0;
+ } else {
+ rc = be_entry_get_rw( op, gr_ndn, group_oc, group_at, 0, &e );
+ }
+ if ( e != NULL ) {
+ int internal_op;
+ slap_callback cb;
+
+ internal_op = slapi_op_internal_p( op, &rs, &cb );
+
+ cb.sc_response = NULL;
+ cb.sc_cleanup = NULL;
+
+ pb = SLAPI_OPERATION_PBLOCK( op );
+
+ slapi_pblock_set( pb, SLAPI_X_GROUP_ENTRY, (void *)e );
+ slapi_pblock_set( pb, SLAPI_X_GROUP_OPERATION_DN, (void *)op_ndn->bv_val );
+ slapi_pblock_set( pb, SLAPI_X_GROUP_ATTRIBUTE, (void *)group_at->ad_cname.bv_val );
+ slapi_pblock_set( pb, SLAPI_X_GROUP_TARGET_ENTRY, (void *)target );
+
+ rc = slapi_over_call_plugins( pb, SLAPI_X_PLUGIN_PRE_GROUP_FN );
+ if ( rc >= 0 ) /* 1 means no plugins called */
+ rc = SLAP_CB_CONTINUE;
+ else
+ rc = pb->pb_rs->sr_err;
+
+ slapi_pblock_delete_param( pb, SLAPI_X_GROUP_ENTRY );
+ slapi_pblock_delete_param( pb, SLAPI_X_GROUP_OPERATION_DN );
+ slapi_pblock_delete_param( pb, SLAPI_X_GROUP_ATTRIBUTE );
+ slapi_pblock_delete_param( pb, SLAPI_X_GROUP_TARGET_ENTRY );
+
+ if ( !internal_op )
+ slapi_pblock_destroy( pb );
+
+ if ( e != target ) {
+ be_entry_release_r( op, e );
+ }
+
+ op->o_callback = cb.sc_next;
+ } else {
+ rc = LDAP_NO_SUCH_OBJECT; /* return SLAP_CB_CONTINUE for correctness? */
+ }
+
+ if ( op->o_tag != LDAP_REQ_BIND && !op->o_do_not_cache &&
+ rc != SLAP_CB_CONTINUE ) {
+ g = op->o_tmpalloc( sizeof( GroupAssertion ) + gr_ndn->bv_len,
+ op->o_tmpmemctx );
+ g->ga_be = op->o_bd;
+ g->ga_oc = group_oc;
+ g->ga_at = group_at;
+ g->ga_res = rc;
+ g->ga_len = gr_ndn->bv_len;
+ strcpy( g->ga_ndn, gr_ndn->bv_val );
+ g->ga_next = op->o_groups;
+ op->o_groups = g;
+ }
+ /*
+ * XXX don't call POST_GROUP_FN, I have no idea what the point of
+ * that plugin function was anyway
+ */
+done:
+ op->o_bd = be;
+ return rc;
+}
+
+static int
+slapi_over_init()
+{
+ memset( &slapi, 0, sizeof(slapi) );
+
+ slapi.on_bi.bi_type = SLAPI_OVERLAY_NAME;
+
+ slapi.on_bi.bi_op_bind = slapi_op_func;
+ slapi.on_bi.bi_op_unbind = slapi_op_func;
+ slapi.on_bi.bi_op_search = slapi_op_func;
+ slapi.on_bi.bi_op_compare = slapi_op_func;
+ slapi.on_bi.bi_op_modify = slapi_op_func;
+ slapi.on_bi.bi_op_modrdn = slapi_op_func;
+ slapi.on_bi.bi_op_add = slapi_op_func;
+ slapi.on_bi.bi_op_delete = slapi_op_func;
+ slapi.on_bi.bi_op_abandon = slapi_op_func;
+ slapi.on_bi.bi_op_cancel = slapi_op_func;
+
+ slapi.on_bi.bi_extended = slapi_over_extended;
+ slapi.on_bi.bi_access_allowed = slapi_over_access_allowed;
+ slapi.on_bi.bi_operational = slapi_over_aux_operational;
+ slapi.on_bi.bi_acl_group = slapi_over_acl_group;
+
+ return overlay_register( &slapi );
+}
+
+int slapi_over_is_inst( BackendDB *be )
+{
+ return overlay_is_inst( be, SLAPI_OVERLAY_NAME );
+}
+
+int slapi_over_config( BackendDB *be )
+{
+ if ( slapi_over_initialized == 0 ) {
+ int rc;
+
+ /* do global initializaiton */
+ ldap_pvt_thread_mutex_init( &slapi_hn_mutex );
+ ldap_pvt_thread_mutex_init( &slapi_time_mutex );
+ ldap_pvt_thread_mutex_init( &slapi_printmessage_mutex );
+
+ slapi_log_file = slapi_ch_strdup( LDAP_RUNDIR LDAP_DIRSEP "errors" );
+
+ rc = slapi_int_init_object_extensions();
+ if ( rc != 0 )
+ return rc;
+
+ rc = slapi_over_init();
+ if ( rc != 0 )
+ return rc;
+
+ slapi_over_initialized = 1;
+ }
+
+ return overlay_config( be, SLAPI_OVERLAY_NAME );
+}
+
+#endif /* LDAP_SLAPI */
#include <slap.h>
#include <slapi.h>
+#ifdef LDAP_SLAPI
+
+/* some parameters require a valid connection and operation */
+#define PBLOCK_LOCK_CONN( _pb ) do { \
+ ldap_pvt_thread_mutex_lock( &(_pb)->pb_conn->c_mutex ); \
+ } while (0)
+
+#define PBLOCK_UNLOCK_CONN( _pb ) do { \
+ ldap_pvt_thread_mutex_unlock( &(_pb)->pb_conn->c_mutex ); \
+ } while (0)
+
+/* some parameters are only settable for internal operations */
+#define PBLOCK_VALIDATE_IS_INTOP( _pb ) do { if ( (_pb)->pb_intop == 0 ) break; } while ( 0 )
+
static slapi_pblock_class_t
-getPBlockClass( int param )
+pblock_get_param_class( int param )
{
switch ( param ) {
case SLAPI_PLUGIN_TYPE:
case SLAPI_PLUGIN_ARGC:
- case SLAPI_PLUGIN_VERSION:
case SLAPI_PLUGIN_OPRETURN:
case SLAPI_PLUGIN_INTOP_RESULT:
case SLAPI_CONFIG_LINENO:
case SLAPI_DB2LDIF_PRINTKEY:
case SLAPI_LDIF2DB_REMOVEDUPVALS:
case SLAPI_MANAGEDSAIT:
- case SLAPI_IBM_BROADCAST_BE:
- case SLAPI_IBM_REPLICATE:
- case SLAPI_IBM_CL_MAX_ENTRIES:
- case SLAPI_IBM_CL_FIRST_ENTRY:
- case SLAPI_IBM_CL_LAST_ENTRY:
- case SLAPI_IBM_EVENT_ENABLED:
- case SLAPI_IBM_EVENT_MAXREG:
- case SLAPI_IBM_EVENT_REGPERCONN:
- case SLAPI_REQUESTOR_ISUPDATEDN:
+ case SLAPI_X_MANAGEDIT:
+ case SLAPI_X_OPERATION_NO_SCHEMA_CHECK:
+ case SLAPI_IS_REPLICATED_OPERATION:
case SLAPI_X_CONN_IS_UDP:
case SLAPI_X_CONN_SSF:
case SLAPI_RESULT_CODE:
+ case SLAPI_LOG_OPERATION:
return PBLOCK_CLASS_INTEGER;
break;
case SLAPI_OPERATION_ID:
case SLAPI_OPINITIATED_TIME:
case SLAPI_ABANDON_MSGID:
+ case SLAPI_X_OPERATION_DELETE_GLUE_PARENT:
return PBLOCK_CLASS_LONG_INTEGER;
break;
- case SLAPI_PLUGIN_DB_INIT_FN:
case SLAPI_PLUGIN_DESTROY_FN:
case SLAPI_PLUGIN_DB_BIND_FN:
case SLAPI_PLUGIN_DB_UNBIND_FN:
case SLAPI_PLUGIN_PRE_ENTRY_FN:
case SLAPI_PLUGIN_PRE_REFERRAL_FN:
case SLAPI_PLUGIN_PRE_RESULT_FN:
+ case SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN:
+ case SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN:
+ case SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN:
+ case SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN:
+ case SLAPI_PLUGIN_BE_PRE_ADD_FN:
+ case SLAPI_PLUGIN_BE_PRE_MODIFY_FN:
+ case SLAPI_PLUGIN_BE_PRE_MODRDN_FN:
+ case SLAPI_PLUGIN_BE_PRE_DELETE_FN:
case SLAPI_PLUGIN_POST_BIND_FN:
case SLAPI_PLUGIN_POST_UNBIND_FN:
case SLAPI_PLUGIN_POST_SEARCH_FN:
case SLAPI_PLUGIN_POST_ENTRY_FN:
case SLAPI_PLUGIN_POST_REFERRAL_FN:
case SLAPI_PLUGIN_POST_RESULT_FN:
+ case SLAPI_PLUGIN_INTERNAL_POST_ADD_FN:
+ case SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN:
+ case SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN:
+ case SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN:
+ case SLAPI_PLUGIN_BE_POST_ADD_FN:
+ case SLAPI_PLUGIN_BE_POST_MODIFY_FN:
+ case SLAPI_PLUGIN_BE_POST_MODRDN_FN:
+ case SLAPI_PLUGIN_BE_POST_DELETE_FN:
case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
case SLAPI_X_CONN_SERVERPATH:
case SLAPI_X_CONN_SASL_CONTEXT:
case SLAPI_X_CONFIG_ARGV:
- case SLAPI_IBM_CONN_DN_ALT:
- case SLAPI_IBM_CONN_DN_ORIG:
- case SLAPI_IBM_GSSAPI_CONTEXT:
+ case SLAPI_X_INTOP_FLAGS:
+ case SLAPI_X_INTOP_RESULT_CALLBACK:
+ case SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK:
+ case SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK:
+ case SLAPI_X_INTOP_CALLBACK_DATA:
case SLAPI_PLUGIN_MR_OID:
case SLAPI_PLUGIN_MR_TYPE:
case SLAPI_PLUGIN_MR_VALUE:
case SLAPI_PLUGIN_ARGV:
case SLAPI_PLUGIN_OBJECT:
case SLAPI_PLUGIN_DESCRIPTION:
+ case SLAPI_PLUGIN_IDENTITY:
case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
case SLAPI_PLUGIN_SYNTAX_COMPARE:
case SLAPI_CONFIG_FILENAME:
case SLAPI_CONFIG_ARGV:
+ case SLAPI_TARGET_ADDRESS:
+ case SLAPI_TARGET_UNIQUEID:
case SLAPI_TARGET_DN:
case SLAPI_REQCONTROLS:
case SLAPI_ENTRY_PRE_OP:
case SLAPI_ENTRY_POST_OP:
case SLAPI_RESCONTROLS:
+ case SLAPI_X_OLD_RESCONTROLS:
case SLAPI_ADD_RESCONTROL:
+ case SLAPI_CONTROLS_ARG:
case SLAPI_ADD_ENTRY:
+ case SLAPI_ADD_EXISTING_DN_ENTRY:
+ case SLAPI_ADD_PARENT_ENTRY:
+ case SLAPI_ADD_PARENT_UNIQUEID:
+ case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
case SLAPI_BIND_CREDENTIALS:
case SLAPI_BIND_SASLMECHANISM:
case SLAPI_BIND_RET_SASLCREDS:
case SLAPI_MODIFY_MODS:
case SLAPI_MODRDN_NEWRDN:
case SLAPI_MODRDN_NEWSUPERIOR:
+ case SLAPI_MODRDN_PARENT_ENTRY:
+ case SLAPI_MODRDN_NEWPARENT_ENTRY:
+ case SLAPI_MODRDN_TARGET_ENTRY:
+ case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
case SLAPI_SEARCH_FILTER:
case SLAPI_SEARCH_STRFILTER:
case SLAPI_SEARCH_ATTRS:
case SLAPI_SEARCH_RESULT_SET:
case SLAPI_SEARCH_RESULT_ENTRY:
case SLAPI_SEARCH_REFERRALS:
- case SLAPI_LOG_OPERATION:
case SLAPI_RESULT_TEXT:
case SLAPI_RESULT_MATCHED:
case SLAPI_X_GROUP_ENTRY:
case SLAPI_X_GROUP_TARGET_ENTRY:
case SLAPI_PLUGIN_AUDIT_DATA:
case SLAPI_IBM_PBLOCK:
+ case SLAPI_PLUGIN_VERSION:
return PBLOCK_CLASS_POINTER;
break;
default:
}
static void
-Lock( Slapi_PBlock *pb )
+pblock_lock( Slapi_PBlock *pb )
{
- ldap_pvt_thread_mutex_lock(&pb->pblockMutex);
+ ldap_pvt_thread_mutex_lock(&pb->pb_mutex);
}
static void
-unLock( Slapi_PBlock *pb )
+pblock_unlock( Slapi_PBlock *pb )
{
- ldap_pvt_thread_mutex_unlock(&pb->pblockMutex);
+ ldap_pvt_thread_mutex_unlock(&pb->pb_mutex);
}
static int
-get( Slapi_PBlock *pb, int param, void **val )
+pblock_get_default( Slapi_PBlock *pb, int param, void **value )
{
int i;
slapi_pblock_class_t pbClass;
- pbClass = getPBlockClass( param );
+ pbClass = pblock_get_param_class( param );
if ( pbClass == PBLOCK_CLASS_INVALID ) {
return PBLOCK_ERROR;
}
- Lock( pb );
-
switch ( pbClass ) {
case PBLOCK_CLASS_INTEGER:
- *((int *)val) = 0;
+ *((int *)value) = 0;
break;
case PBLOCK_CLASS_LONG_INTEGER:
- *((long *)val) = 0L;
+ *((long *)value) = 0L;
break;
case PBLOCK_CLASS_POINTER:
case PBLOCK_CLASS_FUNCTION_POINTER:
- *val = NULL;
+ *value = NULL;
break;
+ case PBLOCK_CLASS_INVALID:
+ return PBLOCK_ERROR;
}
- for ( i = 0; i < pb->numParams; i++ ) {
- if ( pb->curParams[i] == param ) {
+ for ( i = 0; i < pb->pb_nParams; i++ ) {
+ if ( pb->pb_params[i] == param ) {
switch ( pbClass ) {
case PBLOCK_CLASS_INTEGER:
- *((int *)val) = (int)pb->curVals[i];
+ *((int *)value) = pb->pb_values[i].pv_integer;
break;
case PBLOCK_CLASS_LONG_INTEGER:
- *((long *)val) = (long)pb->curVals[i];
+ *((long *)value) = pb->pb_values[i].pv_long_integer;
break;
case PBLOCK_CLASS_POINTER:
+ *value = pb->pb_values[i].pv_pointer;
+ break;
case PBLOCK_CLASS_FUNCTION_POINTER:
- *val = pb->curVals[i];
+ *value = pb->pb_values[i].pv_function_pointer;
break;
default:
break;
break;
}
}
- unLock( pb );
+
return PBLOCK_SUCCESS;
}
+static char *
+pblock_get_authtype( AuthorizationInformation *authz, int is_tls )
+{
+ char *authType;
+
+ switch ( authz->sai_method ) {
+ case LDAP_AUTH_SASL:
+ authType = SLAPD_AUTH_SASL;
+ break;
+ case LDAP_AUTH_SIMPLE:
+ authType = SLAPD_AUTH_SIMPLE;
+ break;
+ case LDAP_AUTH_NONE:
+ authType = SLAPD_AUTH_NONE;
+ break;
+ default:
+ authType = NULL;
+ break;
+ }
+
+ if ( is_tls && authType == NULL ) {
+ authType = SLAPD_AUTH_SSL;
+ }
+
+ return authType;
+}
+
static int
-set( Slapi_PBlock *pb, int param, void *val )
+pblock_set_default( Slapi_PBlock *pb, int param, void *value )
{
-#if defined(LDAP_SLAPI)
- int i, freeit;
- int addcon = 0;
slapi_pblock_class_t pbClass;
+ size_t i;
- pbClass = getPBlockClass( param );
+ pbClass = pblock_get_param_class( param );
if ( pbClass == PBLOCK_CLASS_INVALID ) {
return PBLOCK_ERROR;
}
- Lock( pb );
+ if ( pb->pb_nParams == PBLOCK_MAX_PARAMS ) {
+ return PBLOCK_ERROR;
+ }
- if ( pb->numParams == PBLOCK_MAX_PARAMS ) {
- unLock( pb );
- return PBLOCK_ERROR;
+ for ( i = 0; i < pb->pb_nParams; i++ ) {
+ if ( pb->pb_params[i] == param )
+ break;
+ }
+ if ( i >= pb->pb_nParams ) {
+ pb->pb_params[i] = param;
+ pb->pb_nParams++;
}
- if ( param == SLAPI_ADD_RESCONTROL ) {
- addcon = 1;
- param = SLAPI_RES_CONTROLS;
+ switch ( pbClass ) {
+ case PBLOCK_CLASS_INTEGER:
+ pb->pb_values[i].pv_integer = (*((int *)value));
+ break;
+ case PBLOCK_CLASS_LONG_INTEGER:
+ pb->pb_values[i].pv_long_integer = (*((long *)value));
+ break;
+ case PBLOCK_CLASS_POINTER:
+ pb->pb_values[i].pv_pointer = value;
+ break;
+ case PBLOCK_CLASS_FUNCTION_POINTER:
+ pb->pb_values[i].pv_function_pointer = value;
+ break;
+ default:
+ break;
}
+ return PBLOCK_SUCCESS;
+}
+
+static int
+pblock_be_call( Slapi_PBlock *pb, int (*bep)(Operation *) )
+{
+ BackendDB *be_orig;
+ Operation *op;
+ int rc;
+
+ PBLOCK_ASSERT_OP( pb, 0 );
+ op = pb->pb_op;
+
+ be_orig = op->o_bd;
+ op->o_bd = select_backend( &op->o_req_ndn, 0, 0 );
+ rc = (*bep)( op );
+ op->o_bd = be_orig;
+
+ return rc;
+}
+
+static int
+pblock_get( Slapi_PBlock *pb, int param, void **value )
+{
+ int rc = PBLOCK_SUCCESS;
+
+ pblock_lock( pb );
+
switch ( param ) {
- case SLAPI_CONN_DN:
- case SLAPI_CONN_AUTHMETHOD:
- case SLAPI_IBM_CONN_DN_ALT:
- case SLAPI_IBM_CONN_DN_ORIG:
+ case SLAPI_OPERATION:
+ *value = pb->pb_op;
+ break;
+ case SLAPI_OPINITIATED_TIME:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((long *)value) = pb->pb_op->o_time;
+ break;
+ case SLAPI_OPERATION_ID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((long *)value) = pb->pb_op->o_opid;
+ break;
+ case SLAPI_OPERATION_TYPE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((ber_tag_t *)value) = pb->pb_op->o_tag;
+ break;
+ case SLAPI_X_OPERATION_DELETE_GLUE_PARENT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((ber_tag_t *)value) = pb->pb_op->o_delete_glue_parent;
+ break;
+ case SLAPI_X_OPERATION_NO_SCHEMA_CHECK:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((int *)value) = get_no_schema_check( pb->pb_op );
+ break;
+ case SLAPI_REQCONTROLS:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((LDAPControl ***)value) = pb->pb_op->o_ctrls;
+ break;
+ case SLAPI_REQUESTOR_DN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((char **)value) = pb->pb_op->o_dn.bv_val;
+ break;
+ case SLAPI_MANAGEDSAIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((int *)value) = get_manageDSAit( pb->pb_op );
+ break;
+ case SLAPI_X_MANAGEDIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((int *)value) = get_manageDIT( pb->pb_op );
+ break;
+ case SLAPI_BACKEND:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((BackendDB **)value) = select_backend( &pb->pb_op->o_req_ndn, 0, 0 );
+ break;
+ case SLAPI_BE_TYPE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_bd != NULL )
+ *((char **)value) = pb->pb_op->o_bd->bd_info->bi_type;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_CONNECTION:
+ *value = pb->pb_conn;
+ break;
+ case SLAPI_X_CONN_SSF:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((slap_ssf_t *)value) = pb->pb_conn->c_ssf;
+ break;
+ case SLAPI_X_CONN_SASL_CONTEXT:
+ PBLOCK_ASSERT_CONN( pb );
+ if ( pb->pb_conn->c_sasl_authctx != NULL )
+ *value = pb->pb_conn->c_sasl_authctx;
+ else
+ *value = pb->pb_conn->c_sasl_sockctx;
+ break;
+ case SLAPI_TARGET_DN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((char **)value) = pb->pb_op->o_req_dn.bv_val;
+ break;
+ case SLAPI_REQUESTOR_ISROOT:
+ *((int *)value) = pblock_be_call( pb, be_isroot );
+ break;
+ case SLAPI_IS_REPLICATED_OPERATION:
+ *((int *)value) = pblock_be_call( pb, be_slurp_update );
+ break;
+ case SLAPI_CONN_AUTHTYPE:
+ case SLAPI_CONN_AUTHMETHOD: /* XXX should return SASL mech */
+ PBLOCK_ASSERT_CONN( pb );
+ *((char **)value) = pblock_get_authtype( &pb->pb_conn->c_authz,
+#ifdef HAVE_TLS
+ pb->pb_conn->c_is_tls
+#else
+ 0
+#endif
+ );
+ break;
+ case SLAPI_X_CONN_IS_UDP:
+ PBLOCK_ASSERT_CONN( pb );
+#ifdef LDAP_CONNECTIONLESS
+ *((int *)value) = pb->pb_conn->c_is_udp;
+#else
+ *((int *)value) = 0;
+#endif
+ break;
+ case SLAPI_CONN_ID:
+ PBLOCK_ASSERT_CONN( pb );
+ *((long *)value) = pb->pb_conn->c_connid;
+ break;
+ case SLAPI_CONN_DN:
+ PBLOCK_ASSERT_CONN( pb );
+ *((char **)value) = pb->pb_conn->c_dn.bv_val;
+ break;
+ case SLAPI_CONN_CLIENTIP:
+ PBLOCK_ASSERT_CONN( pb );
+ if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "IP=", 3 ) == 0 )
+ *((char **)value) = &pb->pb_conn->c_peer_name.bv_val[3];
+ else
+ *value = NULL;
+ break;
+ case SLAPI_X_CONN_CLIENTPATH:
+ PBLOCK_ASSERT_CONN( pb );
+ if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "PATH=", 3 ) == 0 )
+ *((char **)value) = &pb->pb_conn->c_peer_name.bv_val[5];
+ else
+ *value = NULL;
+ break;
+ case SLAPI_CONN_SERVERIP:
+ PBLOCK_ASSERT_CONN( pb );
+ if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "IP=", 3 ) == 0 )
+ *((char **)value) = &pb->pb_conn->c_sock_name.bv_val[3];
+ else
+ *value = NULL;
+ break;
+ case SLAPI_X_CONN_SERVERPATH:
+ PBLOCK_ASSERT_CONN( pb );
+ if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "PATH=", 3 ) == 0 )
+ *((char **)value) = &pb->pb_conn->c_sock_name.bv_val[5];
+ else
+ *value = NULL;
+ break;
+ case SLAPI_RESULT_CODE:
+ case SLAPI_PLUGIN_INTOP_RESULT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((int *)value) = pb->pb_rs->sr_err;
+ break;
case SLAPI_RESULT_TEXT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_text;
+ break;
case SLAPI_RESULT_MATCHED:
- freeit = 1;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_matched;
+ break;
+ case SLAPI_ADD_ENTRY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_ADD )
+ *((Slapi_Entry **)value) = pb->pb_op->ora_e;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_MODIFY_MODS: {
+ LDAPMod **mods = NULL;
+
+ pblock_get_default( pb, param, (void **)&mods );
+ if ( mods == NULL && pb->pb_intop == 0 ) {
+ if ( pb->pb_op->o_tag != LDAP_REQ_MODIFY ) {
+ rc = PBLOCK_ERROR;
+ break;
+ }
+ mods = slapi_int_modifications2ldapmods( pb->pb_op->orm_modlist );
+ pblock_set_default( pb, param, (void *)mods );
+ }
+ *((LDAPMod ***)value) = mods;
+ break;
+ }
+ case SLAPI_MODRDN_NEWRDN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN )
+ *((char **)value) = pb->pb_op->orr_newrdn.bv_val;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_MODRDN_NEWSUPERIOR:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN && pb->pb_op->orr_newSup != NULL )
+ *((char **)value) = pb->pb_op->orr_newSup->bv_val;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_MODRDN_DELOLDRDN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN )
+ *((int *)value) = pb->pb_op->orr_deleteoldrdn;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_SCOPE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((int *)value) = pb->pb_op->ors_scope;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_DEREF:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((int *)value) = pb->pb_op->ors_deref;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_SIZELIMIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((int *)value) = pb->pb_op->ors_slimit;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_TIMELIMIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((int *)value) = pb->pb_op->ors_tlimit;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_FILTER:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((Slapi_Filter **)value) = pb->pb_op->ors_filter;
+ else
+ *((Slapi_Filter **)value) = NULL;
+ break;
+ case SLAPI_SEARCH_STRFILTER:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((char **)value) = pb->pb_op->ors_filterstr.bv_val;
+ else
+ *((char **)value) = NULL;
+ break;
+ case SLAPI_SEARCH_ATTRS: {
+ char **attrs = NULL;
+
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag != LDAP_REQ_SEARCH ) {
+ rc = PBLOCK_ERROR;
+ break;
+ }
+ pblock_get_default( pb, param, (void **)&attrs );
+ if ( attrs == NULL && pb->pb_intop == 0 ) {
+ attrs = anlist2charray_x( pb->pb_op->ors_attrs, 0, pb->pb_op->o_tmpmemctx );
+ pblock_set_default( pb, param, (void *)attrs );
+ }
+ *((char ***)value) = attrs;
+ break;
+ }
+ case SLAPI_SEARCH_ATTRSONLY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ *((int *)value) = pb->pb_op->ors_attrsonly;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_SEARCH_RESULT_ENTRY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((Slapi_Entry **)value) = pb->pb_rs->sr_entry;
+ break;
+ case SLAPI_BIND_RET_SASLCREDS:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((struct berval **)value) = pb->pb_rs->sr_sasldata;
+ break;
+ case SLAPI_EXT_OP_REQ_OID:
+ *((const char **)value) = pb->pb_op->ore_reqoid.bv_val;
+ break;
+ case SLAPI_EXT_OP_REQ_VALUE:
+ *((struct berval **)value) = pb->pb_op->ore_reqdata;
+ break;
+ case SLAPI_EXT_OP_RET_OID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_rspoid;
+ break;
+ case SLAPI_EXT_OP_RET_VALUE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((struct berval **)value) = pb->pb_rs->sr_rspdata;
+ break;
+ case SLAPI_BIND_METHOD:
+ if ( pb->pb_op->o_tag == LDAP_REQ_BIND )
+ *((int *)value) = pb->pb_op->orb_method;
+ else
+ *((int *)value) = 0;
+ break;
+ case SLAPI_BIND_CREDENTIALS:
+ if ( pb->pb_op->o_tag == LDAP_REQ_BIND )
+ *((struct berval **)value) = &pb->pb_op->orb_cred;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_COMPARE_TYPE:
+ if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE )
+ *((char **)value) = pb->pb_op->orc_ava->aa_desc->ad_cname.bv_val;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_COMPARE_VALUE:
+ if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE )
+ *((struct berval **)value) = &pb->pb_op->orc_ava->aa_value;
+ else
+ *value = NULL;
+ break;
+ case SLAPI_ABANDON_MSGID:
+ if ( pb->pb_op->o_tag == LDAP_REQ_ABANDON )
+ *((int *)value) = pb->pb_op->orn_msgid;
+ else
+ *((int *)value) = 0;
break;
default:
- freeit = 0;
+ rc = pblock_get_default( pb, param, value );
break;
}
- for( i = 0; i < pb->numParams; i++ ) {
- if ( pb->curParams[i] == param ) {
+
+ pblock_unlock( pb );
+
+ return rc;
+}
+
+static int
+pblock_add_control( Slapi_PBlock *pb, LDAPControl *control )
+{
+ LDAPControl **controls = NULL;
+ size_t i;
+
+ pblock_get_default( pb, SLAPI_RESCONTROLS, (void **)&controls );
+
+ if ( controls != NULL ) {
+ for ( i = 0; controls[i] != NULL; i++ )
+ ;
+ } else {
+ i = 0;
+ }
+
+ controls = (LDAPControl **)slapi_ch_realloc( (char *)controls,
+ ( i + 2 ) * sizeof(LDAPControl *));
+ controls[i++] = slapi_dup_control( control );
+ controls[i] = NULL;
+
+ return pblock_set_default( pb, SLAPI_RESCONTROLS, (void *)controls );
+}
+
+static int
+pblock_set_dn( void *value, struct berval *dn, struct berval *ndn, void *memctx )
+{
+ struct berval bv;
+
+ if ( !BER_BVISNULL( dn )) {
+ slap_sl_free( dn->bv_val, memctx );
+ BER_BVZERO( dn );
+ }
+ if ( !BER_BVISNULL( ndn )) {
+ slap_sl_free( ndn->bv_val, memctx );
+ BER_BVZERO( ndn );
+ }
+
+ bv.bv_val = (char *)value;
+ bv.bv_len = ( value != NULL ) ? strlen( bv.bv_val ) : 0;
+
+ return dnPrettyNormal( NULL, &bv, dn, ndn, memctx );
+}
+
+static int
+pblock_set( Slapi_PBlock *pb, int param, void *value )
+{
+ int rc = PBLOCK_SUCCESS;
+
+ pblock_lock( pb );
+
+ switch ( param ) {
+ case SLAPI_OPERATION:
+ pb->pb_op = (Operation *)value;
+ break;
+ case SLAPI_OPINITIATED_TIME:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_time = *((long *)value);
+ break;
+ case SLAPI_OPERATION_ID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_opid = *((long *)value);
+ break;
+ case SLAPI_OPERATION_TYPE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_tag = *((ber_tag_t *)value);
+ break;
+ case SLAPI_X_OPERATION_DELETE_GLUE_PARENT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_delete_glue_parent = *((int *)value);
+ break;
+ case SLAPI_X_OPERATION_NO_SCHEMA_CHECK:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_no_schema_check = *((int *)value);
+ break;
+ case SLAPI_REQCONTROLS:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_ctrls = (LDAPControl **)value;
+ break;
+ case SLAPI_RESCONTROLS: {
+ LDAPControl **ctrls = NULL;
+
+ pblock_get_default( pb, param, (void **)&ctrls );
+ if ( ctrls != NULL ) {
+ /* free old ones first */
+ ldap_controls_free( ctrls );
+ }
+ rc = pblock_set_default( pb, param, value );
+ break;
+ }
+ case SLAPI_ADD_RESCONTROL:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ rc = pblock_add_control( pb, (LDAPControl *)value );
+ break;
+ case SLAPI_REQUESTOR_DN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ rc = pblock_set_dn( value, &pb->pb_op->o_dn, &pb->pb_op->o_ndn, pb->pb_op->o_tmpmemctx );
+ break;
+ case SLAPI_MANAGEDSAIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_managedsait = *((int *)value);
+ break;
+ case SLAPI_X_MANAGEDIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_managedit = *((int *)value);
+ break;
+ case SLAPI_BACKEND:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_op->o_bd = (BackendDB *)value;
+ break;
+ case SLAPI_CONNECTION:
+ pb->pb_conn = (Connection *)value;
+ break;
+ case SLAPI_X_CONN_SSF:
+ PBLOCK_ASSERT_CONN( pb );
+ PBLOCK_LOCK_CONN( pb );
+ pb->pb_conn->c_ssf = (slap_ssf_t)value;
+ PBLOCK_UNLOCK_CONN( pb );
+ break;
+ case SLAPI_X_CONN_SASL_CONTEXT:
+ PBLOCK_ASSERT_CONN( pb );
+ PBLOCK_LOCK_CONN( pb );
+ pb->pb_conn->c_sasl_authctx = value;
+ PBLOCK_UNLOCK_CONN( pb );
+ break;
+ case SLAPI_TARGET_DN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ rc = pblock_set_dn( value, &pb->pb_op->o_req_dn, &pb->pb_op->o_req_ndn, pb->pb_op->o_tmpmemctx );
+ break;
+ case SLAPI_CONN_ID:
+ PBLOCK_ASSERT_CONN( pb );
+ PBLOCK_LOCK_CONN( pb );
+ pb->pb_conn->c_connid = *((long *)value);
+ PBLOCK_UNLOCK_CONN( pb );
+ break;
+ case SLAPI_CONN_DN:
+ PBLOCK_ASSERT_CONN( pb );
+ PBLOCK_LOCK_CONN( pb );
+ rc = pblock_set_dn( value, &pb->pb_conn->c_dn, &pb->pb_conn->c_ndn, NULL );
+ PBLOCK_UNLOCK_CONN( pb );
+ break;
+ case SLAPI_RESULT_CODE:
+ case SLAPI_PLUGIN_INTOP_RESULT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_err = *((int *)value);
+ break;
+ case SLAPI_RESULT_TEXT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ snprintf( pb->pb_textbuf, sizeof( pb->pb_textbuf ), "%s", (char *)value );
+ pb->pb_rs->sr_text = pb->pb_textbuf;
+ break;
+ case SLAPI_RESULT_MATCHED:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_matched = (char *)value; /* XXX should dup? */
+ break;
+ case SLAPI_ADD_ENTRY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_ADD )
+ pb->pb_op->ora_e = (Slapi_Entry *)value;
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_MODIFY_MODS: {
+ Modifications **mlp;
+ Modifications *newmods;
+
+ PBLOCK_ASSERT_OP( pb, 0 );
+ rc = pblock_set_default( pb, param, value );
+ if ( rc != PBLOCK_SUCCESS ) {
+ break;
+ }
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODIFY ) {
+ mlp = &pb->pb_op->orm_modlist;
+ } else if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) {
+ mlp = &pb->pb_op->ora_modlist;
+ } else {
break;
}
+
+ newmods = slapi_int_ldapmods2modifications( (LDAPMod **)value );
+ if ( newmods != NULL ) {
+ slap_mods_free( *mlp, 1 );
+ *mlp = newmods;
+ }
+ break;
}
+ case SLAPI_MODRDN_NEWRDN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) {
+ rc = pblock_set_dn( value, &pb->pb_op->orr_newrdn, &pb->pb_op->orr_nnewrdn, pb->pb_op->o_tmpmemctx );
+ if ( rc == LDAP_SUCCESS )
+ rc = rdn_validate( &pb->pb_op->orr_nnewrdn );
+ } else {
+ rc = PBLOCK_ERROR;
+ }
+ break;
+ case SLAPI_MODRDN_NEWSUPERIOR:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) {
+ if ( value == NULL ) {
+ if ( pb->pb_op->orr_newSup != NULL ) {
+ pb->pb_op->o_tmpfree( pb->pb_op->orr_newSup, pb->pb_op->o_tmpmemctx );
+ BER_BVZERO( pb->pb_op->orr_newSup );
+ pb->pb_op->orr_newSup = NULL;
+ }
+ if ( pb->pb_op->orr_newSup != NULL ) {
+ pb->pb_op->o_tmpfree( pb->pb_op->orr_nnewSup, pb->pb_op->o_tmpmemctx );
+ BER_BVZERO( pb->pb_op->orr_nnewSup );
+ pb->pb_op->orr_nnewSup = NULL;
+ }
+ } else {
+ if ( pb->pb_op->orr_newSup == NULL ) {
+ pb->pb_op->orr_newSup = (struct berval *)pb->pb_op->o_tmpalloc(
+ sizeof(struct berval), pb->pb_op->o_tmpmemctx );
+ BER_BVZERO( pb->pb_op->orr_newSup );
+ }
+ if ( pb->pb_op->orr_nnewSup == NULL ) {
+ pb->pb_op->orr_nnewSup = (struct berval *)pb->pb_op->o_tmpalloc(
+ sizeof(struct berval), pb->pb_op->o_tmpmemctx );
+ BER_BVZERO( pb->pb_op->orr_nnewSup );
+ }
+ rc = pblock_set_dn( value, pb->pb_op->orr_newSup, pb->pb_op->orr_nnewSup, pb->pb_op->o_tmpmemctx );
+ }
+ } else {
+ rc = PBLOCK_ERROR;
+ }
+ break;
+ case SLAPI_MODRDN_DELOLDRDN:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+ if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN )
+ pb->pb_op->orr_deleteoldrdn = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_SCOPE: {
+ int scope = *((int *)value);
- if ( i >= pb->numParams ) {
- pb->curParams[i] = param;
- pb->numParams++;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) {
+ switch ( *((int *)value) ) {
+ case LDAP_SCOPE_BASE:
+ case LDAP_SCOPE_ONELEVEL:
+ case LDAP_SCOPE_SUBTREE:
+#ifdef LDAP_SCOPE_SUBORDINATE
+ case LDAP_SCOPE_SUBORDINATE:
+#endif
+ pb->pb_op->ors_scope = scope;
+ break;
+ default:
+ rc = PBLOCK_ERROR;
+ break;
+ }
+ } else {
+ rc = PBLOCK_ERROR;
+ }
+ break;
+ }
+ case SLAPI_SEARCH_DEREF:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ pb->pb_op->ors_deref = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_SIZELIMIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ pb->pb_op->ors_slimit = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_TIMELIMIT:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ pb->pb_op->ors_tlimit = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_FILTER:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ pb->pb_op->ors_filter = (Slapi_Filter *)value;
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_STRFILTER:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) {
+ pb->pb_op->ors_filterstr.bv_val = (char *)value;
+ pb->pb_op->ors_filterstr.bv_len = strlen((char *)value);
+ } else {
+ rc = PBLOCK_ERROR;
+ }
+ break;
+ case SLAPI_SEARCH_ATTRS: {
+ AttributeName *an = NULL;
+ size_t i = 0;
+ char **attrs = (char **)value;
+
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag != LDAP_REQ_SEARCH ) {
+ rc = PBLOCK_ERROR;
+ break;
+ }
+ /* also set mapped attrs */
+ rc = pblock_set_default( pb, param, value );
+ if ( rc != PBLOCK_SUCCESS ) {
+ break;
+ }
+ if ( pb->pb_op->ors_attrs != NULL ) {
+ pb->pb_op->o_tmpfree( pb->pb_op->ors_attrs, pb->pb_op->o_tmpmemctx );
+ pb->pb_op->ors_attrs = NULL;
+ }
+ if ( attrs != NULL ) {
+ for ( i = 0; attrs[i] != NULL; i++ )
+ ;
+ }
+ if ( i ) {
+ an = (AttributeName *)pb->pb_op->o_tmpalloc( (i + 1) *
+ sizeof(AttributeName), pb->pb_op->o_tmpmemctx );
+ for ( i = 0; attrs[i] != NULL; i++ ) {
+ an[i].an_desc = NULL;
+ an[i].an_oc = NULL;
+ an[i].an_oc_exclude = 0;
+ an[i].an_name.bv_val = attrs[i];
+ an[i].an_name.bv_len = strlen( attrs[i] );
+ slap_bv2ad( &an[i].an_name, &an[i].an_desc, &pb->pb_rs->sr_text );
+ }
+ an[i].an_name.bv_val = NULL;
+ an[i].an_name.bv_len = 0;
+ }
+ pb->pb_op->ors_attrs = an;
+ break;
}
- if ( addcon ) {
- LDAPControl **ctrls = pb->curVals[i];
- int j;
+ case SLAPI_SEARCH_ATTRSONLY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ pb->pb_op->ors_attrsonly = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_SEARCH_RESULT_ENTRY:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_entry = (Slapi_Entry *)value;
+ break;
+ case SLAPI_BIND_RET_SASLCREDS:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_sasldata = (struct berval *)value;
+ break;
+ case SLAPI_EXT_OP_REQ_OID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
- if ( ctrls ) {
- for (j=0; ctrls[j]; j++);
- ctrls = ch_realloc( ctrls, (j+2)*sizeof(LDAPControl *) );
+ if ( pb->pb_op->o_tag == LDAP_REQ_EXTENDED ) {
+ pb->pb_op->ore_reqoid.bv_val = (char *)value;
+ pb->pb_op->ore_reqoid.bv_len = strlen((char *)value);
} else {
- ctrls = ch_malloc( 2 * sizeof(LDAPControl *) );
- j = 0;
+ rc = PBLOCK_ERROR;
}
- ctrls[j] = val;
- ctrls[j+1] = NULL;
- pb->curVals[i] = ctrls;
- } else {
- if ( freeit ) ch_free( pb->curVals[i] );
- pb->curVals[i] = val;
+ break;
+ case SLAPI_EXT_OP_REQ_VALUE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_EXTENDED )
+ pb->pb_op->ore_reqdata = (struct berval *)value;
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_EXT_OP_RET_OID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_rspoid = (char *)value;
+ break;
+ case SLAPI_EXT_OP_RET_VALUE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_rspdata = (struct berval *)value;
+ break;
+ case SLAPI_BIND_METHOD:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_BIND )
+ pb->pb_op->orb_method = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_BIND_CREDENTIALS:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_BIND )
+ pb->pb_op->orb_cred = *((struct berval *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_COMPARE_TYPE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE ) {
+ const char *text;
+
+ pb->pb_op->orc_ava->aa_desc = NULL;
+ rc = slap_str2ad( (char *)value, &pb->pb_op->orc_ava->aa_desc, &text );
+ } else {
+ rc = PBLOCK_ERROR;
+ }
+ break;
+ case SLAPI_COMPARE_VALUE:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE )
+ pb->pb_op->orc_ava->aa_value = *((struct berval *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_ABANDON_MSGID:
+ PBLOCK_ASSERT_OP( pb, 0 );
+ PBLOCK_VALIDATE_IS_INTOP( pb );
+
+ if ( pb->pb_op->o_tag == LDAP_REQ_ABANDON)
+ pb->pb_op->orn_msgid = *((int *)value);
+ else
+ rc = PBLOCK_ERROR;
+ break;
+ case SLAPI_REQUESTOR_ISROOT:
+ case SLAPI_IS_REPLICATED_OPERATION:
+ case SLAPI_CONN_AUTHTYPE:
+ case SLAPI_CONN_AUTHMETHOD:
+ case SLAPI_X_CONN_IS_UDP:
+ case SLAPI_CONN_CLIENTIP:
+ case SLAPI_X_CONN_CLIENTPATH:
+ case SLAPI_CONN_SERVERIP:
+ case SLAPI_X_CONN_SERVERPATH:
+ /* These parameters cannot be set */
+ rc = PBLOCK_ERROR;
+ break;
+ default:
+ rc = pblock_set_default( pb, param, value );
+ break;
}
- unLock( pb );
- return PBLOCK_SUCCESS;
-#endif /* LDAP_SLAPI */
- return PBLOCK_ERROR;
-}
+ pblock_unlock( pb );
-static void
-clearPB( Slapi_PBlock *pb )
-{
- pb->numParams = 1;
+ return rc;
}
static void
-checkParams( Slapi_PBlock *pb, int flag )
+pblock_clear( Slapi_PBlock *pb )
{
- pb->ckParams = flag;
+ pb->pb_nParams = 1;
}
static int
-deleteParam( Slapi_PBlock *p, int param )
+pblock_delete_param( Slapi_PBlock *p, int param )
{
int i;
- Lock(p);
- for ( i = 0; i < p->numParams; i++ ) {
- if ( p->curParams[i] == param ) {
+ pblock_lock(p);
+
+ for ( i = 0; i < p->pb_nParams; i++ ) {
+ if ( p->pb_params[i] == param ) {
break;
}
}
- if (i >= p->numParams ) {
- unLock( p );
+ if (i >= p->pb_nParams ) {
+ pblock_unlock( p );
return PBLOCK_ERROR;
}
- if ( p->numParams > 1 ) {
- p->curParams[i] = p->curParams[p->numParams];
- p->curVals[i] = p->curVals[p->numParams];
+
+ /* move last parameter to index of deleted parameter */
+ if ( p->pb_nParams > 1 ) {
+ p->pb_params[i] = p->pb_params[p->pb_nParams - 1];
+ p->pb_values[i] = p->pb_values[p->pb_nParams - 1];
}
- p->numParams--;
- unLock( p );
+ p->pb_nParams--;
+
+ pblock_unlock( p );
+
return PBLOCK_SUCCESS;
}
Slapi_PBlock *
-slapi_pblock_new()
+slapi_pblock_new(void)
{
-#if defined(LDAP_SLAPI)
Slapi_PBlock *pb;
- pb = (Slapi_PBlock *) ch_malloc(sizeof(Slapi_PBlock));
+ pb = (Slapi_PBlock *) ch_calloc( 1, sizeof(Slapi_PBlock) );
if ( pb != NULL ) {
- pb->ckParams = TRUE;
- ldap_pvt_thread_mutex_init( &pb->pblockMutex );
- memset( pb->curParams, 0, sizeof(pb->curParams) );
- memset( pb->curVals, 0, sizeof(pb->curVals) );
- pb->curParams[0] = SLAPI_IBM_PBLOCK;
- pb->curVals[0] = NULL;
- pb->numParams = 1;
+ ldap_pvt_thread_mutex_init( &pb->pb_mutex );
+
+ pb->pb_params[0] = SLAPI_IBM_PBLOCK;
+ pb->pb_values[0].pv_pointer = NULL;
+ pb->pb_nParams = 1;
+ pb->pb_conn = NULL;
+ pb->pb_op = NULL;
+ pb->pb_rs = NULL;
+ pb->pb_intop = 0;
}
return pb;
-#endif /* LDAP_SLAPI */
- return NULL;
}
-void
-slapi_pblock_destroy( Slapi_PBlock* pb )
+static void
+pblock_destroy( Slapi_PBlock *pb )
{
-#if defined(LDAP_SLAPI)
- char *str = NULL;
- LDAPControl **rescontrols = NULL;
-
- get( pb, SLAPI_CONN_DN,(void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- str = NULL;
- }
+ LDAPControl **controls = NULL;
+ LDAPMod **mods = NULL;
+ char **attrs = NULL;
- get( pb, SLAPI_CONN_AUTHMETHOD, (void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- str = NULL;
- }
+ assert( pb != NULL );
- get( pb, SLAPI_IBM_CONN_DN_ALT, (void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- str = NULL;
+ pblock_get_default( pb, SLAPI_RESCONTROLS, (void **)&controls );
+ if ( controls != NULL ) {
+ ldap_controls_free( controls );
}
- get( pb, SLAPI_IBM_CONN_DN_ORIG, (void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- }
+ if ( pb->pb_intop ) {
+ slapi_int_connection_done_pb( pb );
+ } else {
+ pblock_get_default( pb, SLAPI_MODIFY_MODS, (void **)&mods );
+ ldap_mods_free( mods, 1 );
- get( pb, SLAPI_RESULT_TEXT, (void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- str = NULL;
+ pblock_get_default( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs );
+ if ( attrs != NULL )
+ pb->pb_op->o_tmpfree( attrs, pb->pb_op->o_tmpmemctx );
}
- get( pb, SLAPI_RESULT_MATCHED, (void **)&str );
- if ( str != NULL ) {
- ch_free( str );
- str = NULL;
- }
+ ldap_pvt_thread_mutex_destroy( &pb->pb_mutex );
+ slapi_ch_free( (void **)&pb );
+}
- get( pb, SLAPI_RESCONTROLS, (void **)&rescontrols );
- if ( rescontrols != NULL ) {
- ldap_controls_free( rescontrols );
- rescontrols = NULL;
+void
+slapi_pblock_destroy( Slapi_PBlock *pb )
+{
+ if ( pb != NULL ) {
+ pblock_destroy( pb );
}
-
- ldap_pvt_thread_mutex_destroy( &pb->pblockMutex );
-
- ch_free( pb );
-#endif /* LDAP_SLAPI */
}
int
slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value )
{
-#if defined(LDAP_SLAPI)
- return get( pb, arg, (void **)value );
-#endif /* LDAP_SLAPI */
- return PBLOCK_ERROR;
+ return pblock_get( pb, arg, (void **)value );
}
int
slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value )
{
-#if defined(LDAP_SLAPI)
- void *pTmp = NULL;
-
- switch ( arg ) {
- case SLAPI_CONN_DN:
- case SLAPI_CONN_AUTHMETHOD:
- case SLAPI_IBM_CONN_DN_ALT:
- case SLAPI_IBM_CONN_DN_ORIG:
- case SLAPI_RESULT_TEXT:
- case SLAPI_RESULT_MATCHED:
- if ( value != NULL ) {
- pTmp = (void *)slapi_ch_strdup((char *)value);
- if ( pTmp == NULL ) {
- return LDAP_NO_MEMORY;
- }
- }
- break;
- default:
- pTmp = value;
- break;
- }
- return set( pb, arg, pTmp );
-#endif /* LDAP_SLAPI */
- return LDAP_NO_MEMORY;
+ return pblock_set( pb, arg, value );
}
void
slapi_pblock_clear( Slapi_PBlock *pb )
{
-#if defined(LDAP_SLAPI)
- clearPB( pb );
-#endif /* LDAP_SLAPI */
+ pblock_clear( pb );
}
int
slapi_pblock_delete_param( Slapi_PBlock *p, int param )
{
-#if defined(LDAP_SLAPI)
- return deleteParam( p, param );
-#endif /* LDAP_SLAPI */
- return PBLOCK_ERROR;
-}
-
-void
-slapi_pblock_check_params( Slapi_PBlock *pb, int flag )
-{
-#if defined(LDAP_SLAPI)
- checkParams( pb, flag );
-#endif /* LDAP_SLAPI */
+ return pblock_delete_param( p, param );
}
/*
int
slapi_int_pblock_get_first( Backend *be, Slapi_PBlock **pb )
{
-#if defined(LDAP_SLAPI)
- assert( pb );
- *pb = (Slapi_PBlock *)be->be_pb;
+ assert( pb != NULL );
+ *pb = SLAPI_BACKEND_PBLOCK( be );
return (*pb == NULL ? LDAP_OTHER : LDAP_SUCCESS);
-#else /* LDAP_SLAPI */
- return LDAP_OTHER;
-#endif /* LDAP_SLAPI */
}
/*
int
slapi_int_pblock_get_next( Slapi_PBlock **pb )
{
-#if defined(LDAP_SLAPI)
- assert( pb );
+ assert( pb != NULL );
return slapi_pblock_get( *pb, SLAPI_IBM_PBLOCK, pb );
-#else /* LDAP_SLAPI */
- return LDAP_OTHER;
-#endif /* LDAP_SLAPI */
}
+#endif /* LDAP_SLAPI */
+
#include <netdb.h>
+#ifdef LDAP_SLAPI
+
/*
* server start time (should we use a struct timeval also in slapd?
*/
ldap_pvt_thread_mutex_t mutex;
};
-#ifdef LDAP_SLAPI
static int checkBVString(const struct berval *bv)
{
int i;
return 1;
}
-#endif /* LDAP_SLAPI */
/*
* This function converts an array of pointers to berval objects to
char *s,
int flags )
{
-#ifdef LDAP_SLAPI
- Slapi_Entry *e = NULL;
- char *pTmpS;
-
- pTmpS = slapi_ch_strdup( s );
- if ( pTmpS != NULL ) {
- e = str2entry( pTmpS );
- slapi_ch_free( (void **)&pTmpS );
- }
-
- return e;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ return str2entry( s );
}
char *
Slapi_Entry *e,
int *len )
{
-#ifdef LDAP_SLAPI
- char *ret;
+ char *ret = NULL;
+ char *s;
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
- ret = entry2str( e, len );
+ s = entry2str( e, len );
+ if ( s != NULL )
+ ret = slapi_ch_strdup( s );
ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
return ret;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char *
slapi_entry_get_dn( Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
return e->e_name.bv_val;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
slapi_x_entry_get_id( Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
return e->e_id;
-#else
- return NOID;
-#endif /* LDAP_SLAPI */
+}
+
+static int
+slapi_int_dn_pretty( struct berval *in, struct berval *out )
+{
+ Syntax *syntax = slap_schema.si_syn_distinguishedName;
+
+ assert( syntax != NULL );
+
+ return (syntax->ssyn_pretty)( syntax, in, out, NULL );
+}
+
+static int
+slapi_int_dn_normalize( struct berval *in, struct berval *out )
+{
+ MatchingRule *mr = slap_schema.si_mr_distinguishedNameMatch;
+ Syntax *syntax = slap_schema.si_syn_distinguishedName;
+
+ assert( mr != NULL );
+
+ return (mr->smr_normalize)( 0, syntax, mr, in, out, NULL );
}
void
Slapi_Entry *e,
char *ldn )
{
-#ifdef LDAP_SLAPI
struct berval dn = BER_BVNULL;
dn.bv_val = ldn;
dn.bv_len = strlen( ldn );
- dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname, NULL );
-#endif /* LDAP_SLAPI */
+ slapi_int_dn_pretty( &dn, &e->e_name );
+ slapi_int_dn_normalize( &dn, &e->e_nname );
}
Slapi_Entry *
slapi_entry_dup( Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
return entry_dup( e );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
Slapi_Entry *e,
char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
} else {
return -1; /* something went wrong */
}
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
Slapi_Entry *
slapi_entry_alloc( void )
{
-#ifdef LDAP_SLAPI
return (Slapi_Entry *)slapi_ch_calloc( 1, sizeof(Slapi_Entry) );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
void
slapi_entry_free( Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
- entry_free( e );
-#endif /* LDAP_SLAPI */
+ if ( e != NULL )
+ entry_free( e );
}
int
char *type,
struct berval **vals )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
BerVarray bv;
int rc;
- rc = bvptr2obj( vals, &bv );
+ rc = slap_str2ad( type, &ad, &text );
if ( rc != LDAP_SUCCESS ) {
return -1;
}
- rc = slap_str2ad( type, &ad, &text );
+ rc = bvptr2obj( vals, &bv );
if ( rc != LDAP_SUCCESS ) {
return -1;
}
ch_free( bv );
return rc;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
int
char *type,
Slapi_Attr **attr )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return 0;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
char *
slapi_entry_attr_get_charptr( const Slapi_Entry *e, const char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
p = slapi_value_get_string( &attr->a_vals[0] );
if ( p != NULL ) {
- return slapi_ch_strdup( (char *)p );
+ return slapi_ch_strdup( p );
}
}
return NULL;
-#else
- return -1;
-#endif
}
int
slapi_entry_attr_get_int( const Slapi_Entry *e, const char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return slapi_value_get_int( attr->a_vals );
-#else
- return 0;
-#endif
}
long
slapi_entry_attr_get_long( const Slapi_Entry *e, const char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return slapi_value_get_long( attr->a_vals );
-#else
- return 0;
-#endif
}
unsigned int
slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return slapi_value_get_uint( attr->a_vals );
-#else
- return 0;
-#endif
}
unsigned long
slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return slapi_value_get_ulong( attr->a_vals );
-#else
- return 0;
-#endif
}
int
slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value )
{
-#ifdef LDAP_SLAPI
struct berval bv;
AttributeDescription *ad = NULL;
const char *text;
bv.bv_len = strlen( value );
return ( slapi_attr_value_find( attr, &bv ) != -1 );
-#else
- return 0;
-#endif
}
void
slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value)
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
bv.bv_len = strlen(value);
attr_merge_normalize_one( e, ad, &bv, NULL );
}
-#endif /* LDAP_SLAPI */
}
void
slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l)
{
-#ifdef LDAP_SLAPI
char buf[64];
snprintf( buf, sizeof( buf ), "%d", l );
slapi_entry_attr_set_charptr( e, type, buf );
-#endif /* LDAP_SLAPI */
}
void
slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l)
{
-#ifdef LDAP_SLAPI
char buf[64];
snprintf( buf, sizeof( buf ), "%u", l );
slapi_entry_attr_set_charptr( e, type, buf );
-#endif /* LDAP_SLAPI */
}
void
slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l)
{
-#ifdef LDAP_SLAPI
char buf[64];
snprintf( buf, sizeof( buf ), "%ld", l );
slapi_entry_attr_set_charptr( e, type, buf );
-#endif /* LDAP_SLAPI */
}
void
slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l)
{
-#ifdef LDAP_SLAPI
char buf[64];
snprintf( buf, sizeof( buf ), "%lu", l );
slapi_entry_attr_set_charptr( e, type, buf );
-#endif /* LDAP_SLAPI */
}
int
slapi_is_rootdse( const char *dn )
{
-#ifdef LDAP_SLAPI
return ( dn == NULL || dn[0] == '\0' );
-#else
- return 0;
-#endif
}
int
-slapi_entry_has_children(const Slapi_Entry *e)
+slapi_entry_has_children( const Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
- Connection *pConn;
- Operation *op;
+ Slapi_PBlock *pb;
int hasSubordinates = 0;
- pConn = slapi_int_init_connection( NULL, LDAP_REQ_SEARCH );
- if ( pConn == NULL ) {
- return 0;
- }
+ pb = slapi_pblock_new();
+ slapi_int_connection_init_pb( pb, LDAP_REQ_SEARCH );
- op = (Operation *)pConn->c_pending_ops.stqh_first;
- op->o_bd = select_backend( (struct berval *)&e->e_nname, 0, 0 );
- if ( op->o_bd == NULL ) {
- return 0;
- }
+ slapi_pblock_set( pb, SLAPI_TARGET_DN, slapi_entry_get_dn( (Entry *)e ) );
- op->o_bd->be_has_subordinates( op, (Entry *)e, &hasSubordinates );
+ pb->pb_op->o_bd = select_backend( (struct berval *)&e->e_nname, 0, 0 );
+ if ( pb->pb_op->o_bd != NULL ) {
+ pb->pb_op->o_bd->be_has_subordinates( pb->pb_op, (Entry *)e, &hasSubordinates );
+ }
- slapi_int_connection_destroy( &pConn );
+ slapi_pblock_destroy( pb );
return ( hasSubordinates == LDAP_COMPARE_TRUE );
-#else
- return 0;
-#endif
}
/*
*/
size_t slapi_entry_size(Slapi_Entry *e)
{
-#ifdef LDAP_SLAPI
size_t size;
Attribute *a;
int i;
size -= (size % 1024);
return size;
-#else
- return 0;
-#endif /* LDAP_SLAPI */
}
/*
int
slapi_entry_add_values( Slapi_Entry *e, const char *type, struct berval **vals )
{
-#ifdef LDAP_SLAPI
Modification mod;
const char *text;
int rc;
rc = modify_add_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
- ch_free( mod.sm_values );
+ slapi_ch_free( (void **)&mod.sm_values );
return (rc == LDAP_SUCCESS) ? LDAP_SUCCESS : LDAP_CONSTRAINT_VIOLATION;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals )
{
-#ifdef LDAP_SLAPI
return slapi_entry_add_values( e, type, vals );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs)
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return attr_merge_normalize( e, ad, *vs, NULL );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_delete_values( Slapi_Entry *e, const char *type, struct berval **vals )
{
-#ifdef LDAP_SLAPI
Modification mod;
const char *text;
int rc;
}
if ( vals[0] == NULL ) {
- /* SLAPI doco says LDAP_OPERATIONS_ERROR but LDAP_OTHER is better */
+ /* SLAPI doco says LDApb_opERATIONS_ERROR but LDAP_OTHER is better */
return attr_delete( &e->e_attrs, mod.sm_desc ) ? LDAP_OTHER : LDAP_SUCCESS;
}
rc = modify_delete_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) );
- ch_free( mod.sm_values );
+ slapi_ch_free( (void **)&mod.sm_values );
return rc;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals )
{
-#ifdef LDAP_SLAPI
return slapi_entry_delete_values( e, type, vals );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals )
{
-#ifdef LDAP_SLAPI
return slapi_entry_attr_merge( e, (char *)type, vals );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
int rc;
const char *text;
}
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value)
{
-#ifdef LDAP_SLAPI
Slapi_Value val;
val.bv_val = (char *)value;
val.bv_len = strlen( value );
return slapi_entry_add_value( e, type, &val );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value)
{
-#ifdef LDAP_SLAPI
Slapi_Value *vals[2];
Slapi_Value val;
vals[1] = NULL;
return slapi_entry_delete_values_sv( e, type, vals );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
-
int
slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals )
{
-#ifdef LDAP_SLAPI
return slapi_entry_attr_merge( e, (char *)type, vals );
-#else
- return -1;
-#endif
}
int
slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr )
{
-#ifdef LDAP_SLAPI
if ( e == NULL ) {
return -1;
}
*attr = e->e_attrs;
return ( *attr != NULL ) ? 0 : -1;
-#else
- return -1;
-#endif
}
int
slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr )
{
-#ifdef LDAP_SLAPI
if ( e == NULL ) {
return -1;
}
*attr = prevattr->a_next;
return ( *attr != NULL ) ? 0 : -1;
-#else
- return -1;
-#endif
}
int
slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
/*
Slapi_Attr *attr,
struct berval ***vals )
{
-#ifdef LDAP_SLAPI
int i, j;
struct berval **bv;
*vals = (struct berval **)bv;
return 0;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
char *
slapi_dn_normalize( char *dn )
{
-#ifdef LDAP_SLAPI
struct berval bdn;
struct berval pdn;
bdn.bv_val = dn;
bdn.bv_len = strlen( dn );
- if ( dnPretty( NULL, &bdn, &pdn, NULL ) != LDAP_SUCCESS ) {
+ if ( slapi_int_dn_pretty( &bdn, &pdn ) != LDAP_SUCCESS ) {
return NULL;
}
return pdn.bv_val;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char *
slapi_dn_normalize_case( char *dn )
{
-#ifdef LDAP_SLAPI
struct berval bdn;
struct berval ndn;
bdn.bv_val = dn;
bdn.bv_len = strlen( dn );
- if ( dnNormalize( 0, NULL, NULL, &bdn, &ndn, NULL ) != LDAP_SUCCESS ) {
+ if ( slapi_int_dn_normalize( &bdn, &ndn ) != LDAP_SUCCESS ) {
return NULL;
}
return ndn.bv_val;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
char *dn,
char *suffix )
{
-#ifdef LDAP_SLAPI
struct berval bdn, ndn;
struct berval bsuffix, nsuffix;
int rc;
slapi_ch_free( (void **)&nsuffix.bv_val );
return rc;
-#else /* LDAP_SLAPI */
- return 0;
-#endif /* LDAP_SLAPI */
}
int
const char *parentdn,
const char *childdn )
{
-#ifdef LDAP_SLAPI
struct berval assertedParentDN, normalizedAssertedParentDN;
struct berval childDN, normalizedChildDN;
struct berval normalizedParentDN;
slapi_ch_free( (void **)&normalizedChildDN.bv_val );
return ( match == 0 );
-#else
- return 0;
-#endif /* LDAP_SLAPI */
}
/*
char *
slapi_dn_parent( const char *_dn )
{
-#ifdef LDAP_SLAPI
struct berval dn, prettyDN;
struct berval parentDN;
+ char *ret;
if ( _dn == NULL ) {
return NULL;
dnParent( &prettyDN, &parentDN ); /* in-place */
- slapi_ch_free( (void **)&prettyDN.bv_val );
-
if ( parentDN.bv_len == 0 ) {
+ slapi_ch_free_string( &prettyDN.bv_val );
return NULL;
}
- return slapi_ch_strdup( parentDN.bv_val );
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ ret = slapi_ch_strdup( parentDN.bv_val );
+ slapi_ch_free_string( &prettyDN.bv_val );
+
+ return ret;
+}
+
+int slapi_dn_isbesuffix( Slapi_PBlock *pb, char *ldn )
+{
+ struct berval ndn;
+ Backend *be;
+
+ if ( slapi_is_rootdse( ldn ) ) {
+ return 0;
+ }
+
+ /* according to spec should already be normalized */
+ ndn.bv_len = strlen( ldn );
+ ndn.bv_val = ldn;
+
+ be = select_backend( &pb->pb_op->o_req_ndn, 0, 0 );
+ if ( be == NULL ) {
+ return 0;
+ }
+
+ return be_issuffix( be, &ndn );
}
/*
* an empty string, if the DN has no parent, or if the
* DN is the suffix of the backend database
*/
-char *slapi_dn_beparent( Slapi_PBlock *pb, const char *_dn )
+char *slapi_dn_beparent( Slapi_PBlock *pb, const char *ldn )
{
-#ifdef LDAP_SLAPI
Backend *be;
struct berval dn, prettyDN;
struct berval normalizedDN, parentDN;
+ char *parent = NULL;
- if ( slapi_pblock_get( pb, SLAPI_BACKEND, (void **)&be ) != 0 )
- be = NULL;
+ if ( pb == NULL ) {
+ return NULL;
+ }
- dn.bv_val = (char *)_dn;
- dn.bv_len = strlen( _dn );
+ PBLOCK_ASSERT_OP( pb, 0 );
- if ( dnPrettyNormal( NULL, &dn, &prettyDN, &normalizedDN, NULL ) != LDAP_SUCCESS ) {
+ if ( slapi_is_rootdse( ldn ) ) {
return NULL;
}
- if ( be != NULL && be_issuffix( be, &normalizedDN ) ) {
- slapi_ch_free( (void **)&prettyDN.bv_val );
- slapi_ch_free( (void **)&normalizedDN.bv_val );
+ dn.bv_val = (char *)ldn;
+ dn.bv_len = strlen( ldn );
+
+ if ( dnPrettyNormal( NULL, &dn, &prettyDN, &normalizedDN, NULL ) != LDAP_SUCCESS ) {
return NULL;
}
- dnParent( &prettyDN, &parentDN );
+ be = select_backend( &pb->pb_op->o_req_ndn, 0, 0 );
- slapi_ch_free( (void **)&prettyDN.bv_val );
- slapi_ch_free( (void **)&normalizedDN.bv_val );
+ if ( be == NULL || be_issuffix( be, &normalizedDN ) == 0 ) {
+ dnParent( &prettyDN, &parentDN );
- if ( parentDN.bv_len == 0 ) {
- return NULL;
+ if ( parentDN.bv_len != 0 )
+ parent = slapi_ch_strdup( parentDN.bv_val );
}
- return slapi_ch_strdup( parentDN.bv_val );
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
+ slapi_ch_free_string( &prettyDN.bv_val );
+ slapi_ch_free_string( &normalizedDN.bv_val );
+
+ return parent;
}
char *
slapi_dn_ignore_case( char *dn )
{
-#ifdef LDAP_SLAPI
return slapi_dn_normalize_case( dn );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char *
slapi_ch_malloc( unsigned long size )
{
-#ifdef LDAP_SLAPI
return ch_malloc( size );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
void
slapi_ch_free( void **ptr )
{
-#ifdef LDAP_SLAPI
+ if ( ptr == NULL || *ptr == NULL )
+ return;
ch_free( *ptr );
*ptr = NULL;
-#endif /* LDAP_SLAPI */
}
void
slapi_ch_free_string( char **ptr )
{
-#ifdef LDAP_SLAPI
slapi_ch_free( (void **)ptr );
-#endif /* LDAP_SLAPI */
}
void
slapi_ch_array_free( char **arrayp )
{
-#ifdef LDAP_SLAPI
char **p;
if ( arrayp != NULL ) {
}
slapi_ch_free( (void **)&arrayp );
}
-#endif
}
struct berval *
slapi_ch_bvdup(const struct berval *v)
{
-#ifdef LDAP_SLAPI
struct berval *bv;
bv = (struct berval *) slapi_ch_malloc( sizeof(struct berval) );
AC_MEMCPY( bv->bv_val, v->bv_val, bv->bv_len );
return bv;
-#else
- return NULL;
-#endif
}
struct berval **
slapi_ch_bvecdup(const struct berval **v)
{
-#ifdef LDAP_SLAPI
int i;
struct berval **rv;
rv[i] = NULL;
return rv;
-#else
- return NULL;
-#endif
}
char *
unsigned long nelem,
unsigned long size )
{
-#ifdef LDAP_SLAPI
return ch_calloc( nelem, size );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char *
char *block,
unsigned long size )
{
-#ifdef LDAP_SLAPI
return ch_realloc( block, size );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char *
-slapi_ch_strdup( char *s )
+slapi_ch_strdup( const char *s )
{
-#ifdef LDAP_SLAPI
- return ch_strdup( (const char *)s );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
+ return ch_strdup( s );
}
size_t
-slapi_ch_stlen( char *s )
+slapi_ch_stlen( const char *s )
{
-#ifdef LDAP_SLAPI
- return strlen( (const char *)s );
-#else /* LDAP_SLAPI */
- return 0;
-#endif /* LDAP_SLAPI */
+ return strlen( s );
}
int
struct berval **val,
int *iscritical )
{
-#ifdef LDAP_SLAPI
int i;
int rc = 0;
rc = 1;
if ( controls[i]->ldctl_value.bv_len != 0 ) {
- /*
- * FIXME: according to 6.1 specification,
- * "The val output parameter is set
- * to point into the controls array.
- * A copy of the control value is
- * not made."
- */
-#if 0
- struct berval *pTmpBval;
-
- pTmpBval = (struct berval *)slapi_ch_malloc( sizeof(struct berval));
- if ( pTmpBval == NULL ) {
- rc = 0;
- } else {
- pTmpBval->bv_len = controls[i]->ldctl_value.bv_len;
- pTmpBval->bv_val = controls[i]->ldctl_value.bv_val;
- if ( val ) {
- *val = pTmpBval;
- } else {
- slapi_ch_free( (void **)&pTmpBval );
- rc = 0;
- }
- }
-#endif /* 0 */
if ( val ) {
*val = &controls[i]->ldctl_value;
}
}
return rc;
-#else /* LDAP_SLAPI */
- return 0;
-#endif /* LDAP_SLAPI */
}
-#ifdef LDAP_SLAPI
static void
slapControlMask2SlapiControlOp(slap_mask_t slap_mask,
unsigned long *slapi_mask)
return LDAP_SUCCESS;
}
-#endif /* LDAP_SLAPI */
void
slapi_register_supported_control(
char *controloid,
unsigned long controlops )
{
-#ifdef LDAP_SLAPI
slap_mask_t controlmask;
slapiControlOp2SlapControlMask( controlops, &controlmask );
register_supported_control( controloid, controlmask, NULL, slapi_int_parse_control, NULL );
-#endif /* LDAP_SLAPI */
}
int
char ***ctrloidsp,
unsigned long **ctrlopsp )
{
-#ifdef LDAP_SLAPI
int i, rc;
rc = get_supported_controls( ctrloidsp, (slap_mask_t **)ctrlopsp );
}
return LDAP_SUCCESS;
-#else /* LDAP_SLAPI */
- return 1;
-#endif /* LDAP_SLAPI */
}
LDAPControl *
slapi_dup_control( LDAPControl *ctrl )
{
-#ifdef LDAP_SLAPI
LDAPControl *ret;
ret = (LDAPControl *)slapi_ch_malloc( sizeof(*ret) );
ret->ldctl_iscritical = ctrl->ldctl_iscritical;
return ret;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
void
slapi_register_supported_saslmechanism( char *mechanism )
{
-#ifdef LDAP_SLAPI
/* FIXME -- can not add saslmechanism to OpenLDAP dynamically */
slapi_log_error( SLAPI_LOG_FATAL, "slapi_register_supported_saslmechanism",
"OpenLDAP does not support dynamic registration of SASL mechanisms\n" );
-#endif /* LDAP_SLAPI */
}
char **
slapi_get_supported_saslmechanisms( void )
{
-#ifdef LDAP_SLAPI
/* FIXME -- can not get the saslmechanism without a connection. */
slapi_log_error( SLAPI_LOG_FATAL, "slapi_get_supported_saslmechanisms",
"can not get the SASL mechanism list "
"without a connection\n" );
return NULL;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
char **
slapi_get_supported_extended_ops( void )
{
-#ifdef LDAP_SLAPI
int i, j, k;
char **ppExtOpOID = NULL;
int numExtOps = 0;
ppExtOpOID[ i + k ] = NULL;
return ppExtOpOID;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
void
int nentries,
struct berval **urls )
{
-#ifdef LDAP_SLAPI
- Operation *op;
- struct berval *s;
- char *extOID = NULL;
- struct berval *extValue = NULL;
- int rc;
- SlapReply rs = { REP_RESULT };
+ SlapReply *rs;
- slapi_pblock_get( pb, SLAPI_OPERATION, &op );
+ PBLOCK_ASSERT_OP( pb, 0 );
- rs.sr_err = err;
- rs.sr_matched = matched;
- rs.sr_text = text;
- rs.sr_ref = NULL;
- rs.sr_ctrls = NULL;
+ rs = pb->pb_rs;
- slapi_pblock_get( pb, SLAPI_RESCONTROLS, &rs.sr_ctrls );
+ rs->sr_err = err;
+ rs->sr_matched = matched;
+ rs->sr_text = text;
+ rs->sr_ref = NULL;
if ( err == LDAP_SASL_BIND_IN_PROGRESS ) {
- slapi_pblock_get( pb, SLAPI_BIND_RET_SASLCREDS, (void *) &rs.sr_sasldata );
- send_ldap_sasl( op, &rs );
- return;
- }
+ send_ldap_sasl( pb->pb_op, rs );
+ } else if ( rs->sr_rspoid != NULL ) {
+ send_ldap_extended( pb->pb_op, rs );
+ } else {
+ if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
+ rs->sr_nentries = nentries;
- slapi_pblock_get( pb, SLAPI_EXT_OP_RET_OID, &extOID );
- if ( extOID != NULL ) {
- rs.sr_rspoid = extOID;
- slapi_pblock_get( pb, SLAPI_EXT_OP_RET_VALUE, &rs.sr_rspdata );
- send_ldap_extended( op, &rs );
- return;
+ send_ldap_result( pb->pb_op, rs );
}
-
- if (op->o_tag == LDAP_REQ_SEARCH)
- rs.sr_nentries = nentries;
-
- send_ldap_result( op, &rs );
-#endif /* LDAP_SLAPI */
}
int
char **attrs,
int attrsonly )
{
-#ifdef LDAP_SLAPI
- Operation *pOp;
- SlapReply rs = { REP_RESULT };
- int i;
- AttributeName *an = NULL;
- const char *text;
+ SlapReply rs = { REP_SEARCH };
+ int i = 0;
+ AttributeName *an = NULL;
+ const char *text;
+ int rc;
+
+ assert( pb->pb_op != NULL );
if ( attrs != NULL ) {
for ( i = 0; attrs[ i ] != NULL; i++ ) {
; /* empty */
}
- } else {
- i = 0;
}
- if ( i > 0 ) {
- an = (AttributeName *) ch_malloc( (i+1) * sizeof(AttributeName) );
+ if ( i ) {
+ an = (AttributeName *) slapi_ch_malloc( (i+1) * sizeof(AttributeName) );
for ( i = 0; attrs[i] != NULL; i++ ) {
- an[i].an_name.bv_val = ch_strdup( attrs[i] );
+ an[i].an_name.bv_val = attrs[i];
an[i].an_name.bv_len = strlen( attrs[i] );
an[i].an_desc = NULL;
- if( slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text ) != LDAP_SUCCESS)
+ rs.sr_err = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
+ if ( rs.sr_err != LDAP_SUCCESS) {
+ slapi_ch_free( (void **)&an );
return -1;
+ }
}
an[i].an_name.bv_len = 0;
an[i].an_name.bv_val = NULL;
rs.sr_v2ref = NULL;
rs.sr_flags = 0;
- if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp ) != 0 ) {
- return LDAP_OTHER;
- }
+ rc = send_search_entry( pb->pb_op, &rs );
- return send_search_entry( pOp, &rs );
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
+ slapi_ch_free( (void **)&an );
+
+ return rc;
}
int
struct berval **v2refs
)
{
-#ifdef LDAP_SLAPI
- Operation *pOp;
SlapReply rs = { REP_SEARCHREF };
int rc;
rs.sr_v2ref = NULL;
}
- if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp ) != 0 ) {
- return LDAP_OTHER;
- }
-
- rc = send_search_reference( pOp, &rs );
-
- if ( rs.sr_ref != NULL )
- slapi_ch_free( (void **)&rs.sr_ref );
+ rc = send_search_reference( pb->pb_op, &rs );
- if ( rs.sr_v2ref != NULL )
- slapi_ch_free( (void **)&rs.sr_v2ref );
+ slapi_ch_free( (void **)&rs.sr_ref );
+ slapi_ch_free( (void **)&rs.sr_v2ref );
return rc;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_str2filter( char *str )
{
-#ifdef LDAP_SLAPI
return str2filter( str );
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
void
Slapi_Filter *f,
int recurse )
{
-#ifdef LDAP_SLAPI
filter_free( f );
-#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_filter_dup( Slapi_Filter *filter )
{
-#ifdef LDAP_SLAPI
Filter *f;
f = (Filter *) slapi_ch_malloc( sizeof(Filter) );
}
return f;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
slapi_filter_get_choice( Slapi_Filter *f )
{
-#ifdef LDAP_SLAPI
int rc;
if ( f != NULL ) {
}
return rc;
-#else /* LDAP_SLAPI */
- return -1; /* invalid filter type */
-#endif /* LDAP_SLAPI */
}
int
char **type,
struct berval **bval )
{
-#ifdef LDAP_SLAPI
int ftype;
int rc = LDAP_SUCCESS;
}
return rc;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_filter_list_first( Slapi_Filter *f )
{
-#ifdef LDAP_SLAPI
int ftype;
if ( f == NULL ) {
} else {
return NULL;
}
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
Slapi_Filter *
Slapi_Filter *f,
Slapi_Filter *fprev )
{
-#ifdef LDAP_SLAPI
int ftype;
if ( f == NULL ) {
}
return NULL;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
slapi_filter_get_attribute_type( Slapi_Filter *f, char **type )
{
-#ifdef LDAP_SLAPI
if ( f == NULL ) {
return -1;
}
}
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
+}
+
+int
+slapi_x_filter_set_attribute_type( Slapi_Filter *f, const char *type )
+{
+ AttributeDescription **adp, *ad = NULL;
+ const char *text;
+ int rc;
+
+ if ( f == NULL ) {
+ return -1;
+ }
+
+ switch ( f->f_choice ) {
+ case LDAP_FILTER_GE:
+ case LDAP_FILTER_LE:
+ case LDAP_FILTER_EQUALITY:
+ case LDAP_FILTER_APPROX:
+ adp = &f->f_av_desc;
+ break;
+ case LDAP_FILTER_SUBSTRINGS:
+ adp = &f->f_sub_desc;
+ break;
+ case LDAP_FILTER_PRESENT:
+ adp = &f->f_desc;
+ break;
+ case LDAP_FILTER_EXT:
+ adp = &f->f_mr_desc;
+ break;
+ default:
+ /* Complex filters need not apply. */
+ return -1;
+ }
+
+ rc = slap_str2ad( type, &ad, &text );
+ if ( rc == LDAP_SUCCESS )
+ *adp = ad;
+
+ return ( rc == LDAP_SUCCESS ) ? 0 : -1;
}
int
slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
char ***any, char **final )
{
-#ifdef LDAP_SLAPI
int i;
if ( f->f_choice != LDAP_FILTER_SUBSTRINGS ) {
*final = f->f_sub_final.bv_val ? slapi_ch_strdup(f->f_sub_final.bv_val) : NULL;
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_filter_join( int ftype, Slapi_Filter *f1, Slapi_Filter *f2 )
{
-#ifdef LDAP_SLAPI
Slapi_Filter *f = NULL;
if ( ftype == LDAP_FILTER_AND ||
}
return f;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
int
Slapi_Filter **pNextFilter,
Slapi_Filter *filterToAppend )
{
-#ifdef LDAP_SLAPI
if ( ftype == LDAP_FILTER_AND ||
ftype == LDAP_FILTER_OR ||
ftype == LDAP_FILTER_NOT )
return 0;
}
-#endif /* LDAP_SLAPI */
return -1;
}
slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
int verify_access )
{
-#ifdef LDAP_SLAPI
Operation *op;
int rc;
}
if ( verify_access ) {
- rc = slapi_pblock_get(pb, SLAPI_OPERATION, (void *)&op);
- if ( rc != 0 ) {
+ op = pb->pb_op;
+ if ( op == NULL )
return LDAP_PARAM_ERROR;
- }
} else {
op = NULL;
}
+
/*
* According to acl.c it is safe to call test_filter() with
* NULL arguments...
}
return rc;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int
slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f)
{
-#ifdef LDAP_SLAPI
return slapi_filter_test( NULL, e, f, 0 );
-#else
- return -1;
-#endif
}
int
slapi_filter_apply( Slapi_Filter *f, FILTER_APPLY_FN fn, void *arg, int *error_code )
{
-#ifdef LDAP_SLAPI
switch ( f->f_choice ) {
case LDAP_FILTER_AND:
case LDAP_FILTER_NOT:
}
return -1;
-#else
- *error_code = SLAPI_FILTER_UNKNOWN_FILTER_TYPE;
- return -1;
-#endif /* LDAP_SLAPI */
-}
-
-int
-slapi_send_ldap_extended_response(
- Connection *conn,
- Operation *op,
- int errornum,
- char *respName,
- struct berval *response )
-{
-#ifdef LDAP_SLAPI
- SlapReply rs;
-
- rs.sr_err = errornum;
- rs.sr_matched = NULL;
- rs.sr_text = NULL;
- rs.sr_ref = NULL;
- rs.sr_ctrls = NULL;
- rs.sr_rspoid = respName;
- rs.sr_rspdata = response;
-
- send_ldap_extended( op, &rs );
-
- return LDAP_SUCCESS;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
int
struct berval **vals,
struct berval *v )
{
-#ifdef LDAP_SLAPI
/*
* FIXME: what's the point?
*/
return 1;
-#else /* LDAP_SLAPI */
- return 1;
-#endif /* LDAP_SLAPI */
}
#define MAX_HOSTNAME 512
char *
slapi_get_hostname( void )
{
-#ifdef LDAP_SLAPI
char *hn = NULL;
static int been_here = 0;
static char *static_hn = NULL;
hn = ch_strdup( static_hn );
return hn;
-#else /* LDAP_SLAPI */
- return NULL;
-#endif /* LDAP_SLAPI */
}
/*
char *fmt,
... )
{
-#ifdef LDAP_SLAPI
int rc = LDAP_SUCCESS;
va_list arglist;
va_end( arglist );
return rc;
-#else /* LDAP_SLAPI */
- return -1;
-#endif /* LDAP_SLAPI */
}
unsigned long
slapi_timer_current_time( void )
{
-#ifdef LDAP_SLAPI
static int first_time = 1;
#if !defined (_WIN32)
struct timeval now;
QueryPerformanceCounter( &now );
return (1000000*(now.QuadPart-base_time.QuadPart))/performance_freq.QuadPart;
#endif /* _WIN32 */
-#else /* LDAP_SLAPI */
- return 0;
-#endif /* LDAP_SLAPI */
}
/*
unsigned long
slapi_timer_get_time( char *label )
{
-#ifdef LDAP_SLAPI
unsigned long start = slapi_timer_current_time();
printf("%10ld %10d usec %s\n", start, 0, label);
return start;
-#else /* LDAP_SLAPI */
- return 0;
-#endif /* LDAP_SLAPI */
}
/*
char *label,
unsigned long start )
{
-#ifdef LDAP_SLAPI
unsigned long stop = slapi_timer_current_time();
printf ("%10ld %10ld usec %s\n", stop, stop - start, label);
-#endif /* LDAP_SLAPI */
}
void
slapi_free_search_results_internal( Slapi_PBlock *pb )
{
-#ifdef LDAP_SLAPI
Slapi_Entry **entries;
int k = 0, nEnt = 0;
slapi_pblock_get( pb, SLAPI_NENTRIES, &nEnt );
slapi_pblock_get( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries );
- if ( nEnt == 0 ) {
- return;
- }
-
- if ( entries == NULL ) {
+ if ( nEnt == 0 || entries == NULL ) {
return;
}
-
+
for ( k = 0; k < nEnt; k++ ) {
slapi_entry_free( entries[k] );
+ entries[k] = NULL;
}
slapi_ch_free( (void **)&entries );
-#endif /* LDAP_SLAPI */
}
-#ifdef LDAP_SLAPI
-/*
- * Internal API to prime a Slapi_PBlock with a Backend.
- */
-static int slapi_int_pblock_set_backend( Slapi_PBlock *pb, Backend *be )
+int slapi_is_connection_ssl( Slapi_PBlock *pb, int *isSSL )
{
- int rc;
-
- rc = slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- if ( be != NULL ) {
- rc = slapi_pblock_set( pb, SLAPI_BE_TYPE, (void *)be->bd_info->bi_type );
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
+ if ( pb == NULL )
+ return LDAP_PARAM_ERROR;
+
+ if ( pb->pb_conn == NULL )
+ return LDAP_PARAM_ERROR;
+
+#ifdef HAVE_TLS
+ *isSSL = pb->pb_conn->c_is_tls;
+#else
+ *isSSL = 0;
+#endif
return LDAP_SUCCESS;
}
/*
- * If oldStyle is TRUE, then a value suitable for setting to
- * the deprecated SLAPI_CONN_AUTHTYPE value is returned
- * (pointer to static storage).
- *
- * If oldStyle is FALSE, then a value suitable for setting to
- * the new SLAPI_CONN_AUTHMETHOD will be returned, which is
- * a pointer to allocated memory and will include the SASL
- * mechanism (if any).
+ * DS 5.x compatability API follow
*/
-static char *Authorization2AuthType( AuthorizationInformation *authz, int is_tls, int oldStyle )
+
+int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags )
{
- size_t len;
- char *authType;
+ AttributeType *at;
- switch ( authz->sai_method ) {
- case LDAP_AUTH_SASL:
- if ( oldStyle ) {
- authType = SLAPD_AUTH_SASL;
- } else {
- len = sizeof(SLAPD_AUTH_SASL) + authz->sai_mech.bv_len;
- authType = slapi_ch_malloc( len );
- snprintf( authType, len, "%s%s", SLAPD_AUTH_SASL, authz->sai_mech.bv_val );
- }
- break;
- case LDAP_AUTH_SIMPLE:
- authType = oldStyle ? SLAPD_AUTH_SIMPLE : slapi_ch_strdup( SLAPD_AUTH_SIMPLE );
- break;
- case LDAP_AUTH_NONE:
- authType = oldStyle ? SLAPD_AUTH_NONE : slapi_ch_strdup( SLAPD_AUTH_NONE );
- break;
- default:
- authType = NULL;
- break;
- }
- if ( is_tls && authType == NULL ) {
- authType = oldStyle ? SLAPD_AUTH_SSL : slapi_ch_strdup( SLAPD_AUTH_SSL );
- }
+ if ( attr == NULL )
+ return LDAP_PARAM_ERROR;
+
+ at = attr->a_desc->ad_type;
+
+ *flags = SLAPI_ATTR_FLAG_STD_ATTR;
+
+ if ( is_at_single_value( at ) )
+ *flags |= SLAPI_ATTR_FLAG_SINGLE;
+ if ( is_at_operational( at ) )
+ *flags |= SLAPI_ATTR_FLAG_OPATTR;
+ if ( is_at_obsolete( at ) )
+ *flags |= SLAPI_ATTR_FLAG_OBSOLETE;
+ if ( is_at_collective( at ) )
+ *flags |= SLAPI_ATTR_FLAG_COLLECTIVE;
+ if ( is_at_no_user_mod( at ) )
+ *flags |= SLAPI_ATTR_FLAG_NOUSERMOD;
- return authType;
+ return LDAP_SUCCESS;
}
-/*
- * Internal API to prime a Slapi_PBlock with a Connection.
- */
-static int slapi_int_pblock_set_connection( Slapi_PBlock *pb, Connection *conn )
+int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag )
{
- char *connAuthType;
- int rc;
-
- rc = slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
- if ( rc != LDAP_SUCCESS )
- return rc;
+ unsigned long flags;
- if ( strncmp( conn->c_peer_name.bv_val, "IP=", 3 ) == 0 ) {
- rc = slapi_pblock_set( pb, SLAPI_CONN_CLIENTIP, (void *)&conn->c_peer_name.bv_val[3] );
- if ( rc != LDAP_SUCCESS )
- return rc;
- } else if ( strncmp( conn->c_peer_name.bv_val, "PATH=", 5 ) == 0 ) {
- rc = slapi_pblock_set( pb, SLAPI_X_CONN_CLIENTPATH, (void *)&conn->c_peer_name.bv_val[5] );
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
+ if ( slapi_attr_get_flags( attr, &flags ) != 0 )
+ return 0;
+ return (flags & flag) ? 1 : 0;
+}
- if ( strncmp( conn->c_sock_name.bv_val, "IP=", 3 ) == 0 ) {
- rc = slapi_pblock_set( pb, SLAPI_CONN_SERVERIP, (void *)&conn->c_sock_name.bv_val[3] );
- if ( rc != LDAP_SUCCESS )
- return rc;
- } else if ( strncmp( conn->c_sock_name.bv_val, "PATH=", 5 ) == 0 ) {
- rc = slapi_pblock_set( pb, SLAPI_X_CONN_SERVERPATH, (void *)&conn->c_sock_name.bv_val[5] );
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
+Slapi_Attr *slapi_attr_new( void )
+{
+ Attribute *ad;
-#ifdef LDAP_CONNECTIONLESS
- rc = slapi_pblock_set( pb, SLAPI_X_CONN_IS_UDP, (void *)conn->c_is_udp );
- if ( rc != LDAP_SUCCESS )
- return rc;
-#endif
+ ad = (Attribute *)slapi_ch_calloc( 1, sizeof(*ad) );
- rc = slapi_pblock_set( pb, SLAPI_CONN_ID, (void *)conn->c_connid );
- if ( rc != LDAP_SUCCESS )
- return rc;
+ return ad;
+}
- /* Returns pointer to static string */
- connAuthType = Authorization2AuthType( &conn->c_authz,
-#ifdef HAVE_TLS
- conn->c_is_tls,
-#else
- 0,
-#endif
- 1 );
- if ( connAuthType != NULL ) {
- rc = slapi_pblock_set(pb, SLAPI_CONN_AUTHTYPE, (void *)connAuthType);
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
+Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type )
+{
+ const char *text;
+ AttributeDescription *ad = NULL;
- /* Returns pointer to allocated string */
- connAuthType = Authorization2AuthType( &conn->c_authz,
-#ifdef HAVE_TLS
- conn->c_is_tls,
-#else
- 0,
-#endif
- 0 );
- if ( connAuthType != NULL ) {
- rc = slapi_pblock_set(pb, SLAPI_CONN_AUTHMETHOD, (void *)connAuthType);
- /* slapi_pblock_set dups this itself */
- slapi_ch_free( (void **)&connAuthType );
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
-
- if ( conn->c_authz.sai_dn.bv_val != NULL ) {
- /* slapi_pblock_set dups this itself */
- rc = slapi_pblock_set(pb, SLAPI_CONN_DN, (void *)conn->c_authz.sai_dn.bv_val);
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
-
- rc = slapi_pblock_set(pb, SLAPI_X_CONN_SSF, (void *)conn->c_ssf);
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set(pb, SLAPI_X_CONN_SASL_CONTEXT,
- ( conn->c_sasl_authctx != NULL ? conn->c_sasl_authctx :
- conn->c_sasl_sockctx ) );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- return rc;
-}
-#endif /* LDAP_SLAPI */
-
-/*
- * Internal API to prime a Slapi_PBlock with an Operation.
- */
-int slapi_int_pblock_set_operation( Slapi_PBlock *pb, Operation *op )
-{
-#ifdef LDAP_SLAPI
- int isRoot = 0;
- int isUpdateDn = 0;
- int rc;
- char *opAuthType;
-
- if ( op->o_bd != NULL ) {
- isRoot = be_isroot( op );
- isUpdateDn = be_isupdate( op );
- }
-
- rc = slapi_int_pblock_set_backend( pb, op->o_bd );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_int_pblock_set_connection( pb, op->o_conn );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_OPINITIATED_TIME, (void *)op->o_time );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_OPERATION_ID, (void *)op->o_opid );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_OPERATION_TYPE, (void *)op->o_tag );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_REQUESTOR_ISROOT, (void *)isRoot );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_REQUESTOR_ISUPDATEDN, (void *)isUpdateDn );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
- if ( rc != LDAP_SUCCESS)
- return rc;
-
- rc = slapi_pblock_set( pb, SLAPI_REQUESTOR_DN, (void *)op->o_ndn.bv_val );
- if ( rc != LDAP_SUCCESS )
- return rc;
-
- rc = slapi_pblock_get( pb, SLAPI_CONN_AUTHMETHOD, (void *)&opAuthType );
- if ( rc == LDAP_SUCCESS && opAuthType != NULL ) {
- /* Not quite sure what the point of this is. */
- rc = slapi_pblock_set( pb, SLAPI_OPERATION_AUTHTYPE, (void *)opAuthType );
- if ( rc != LDAP_SUCCESS )
- return rc;
- }
-
- return LDAP_SUCCESS;
-#else
- return -1;
-#endif
-}
-
-int slapi_is_connection_ssl( Slapi_PBlock *pb, int *isSSL )
-{
-#ifdef LDAP_SLAPI
- Connection *conn;
-
- slapi_pblock_get( pb, SLAPI_CONNECTION, &conn );
-#ifdef HAVE_TLS
- *isSSL = conn->c_is_tls;
-#else
- *isSSL = 0;
-#endif
-
- return LDAP_SUCCESS;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
-}
-
-/*
- * DS 5.x compatability API follow
- */
-
-int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags )
-{
-#ifdef LDAP_SLAPI
- AttributeType *at;
-
- if ( attr == NULL )
- return LDAP_PARAM_ERROR;
-
- at = attr->a_desc->ad_type;
-
- *flags = SLAPI_ATTR_FLAG_STD_ATTR;
-
- if ( is_at_single_value( at ) )
- *flags |= SLAPI_ATTR_FLAG_SINGLE;
- if ( is_at_operational( at ) )
- *flags |= SLAPI_ATTR_FLAG_OPATTR;
- if ( is_at_obsolete( at ) )
- *flags |= SLAPI_ATTR_FLAG_OBSOLETE;
- if ( is_at_collective( at ) )
- *flags |= SLAPI_ATTR_FLAG_COLLECTIVE;
- if ( is_at_no_user_mod( at ) )
- *flags |= SLAPI_ATTR_FLAG_NOUSERMOD;
-
- return LDAP_SUCCESS;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
-}
-
-int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag )
-{
-#ifdef LDAP_SLAPI
- unsigned long flags;
-
- if ( slapi_attr_get_flags( attr, &flags ) != 0 )
- return 0;
- return (flags & flag) ? 1 : 0;
-#else
- return 0;
-#endif /* LDAP_SLAPI */
-}
-
-Slapi_Attr *slapi_attr_new( void )
-{
-#ifdef LDAP_SLAPI
- Attribute *ad;
-
- ad = (Attribute *)slapi_ch_calloc( 1, sizeof(*ad) );
-
- return ad;
-#else
- return NULL;
-#endif
-}
-
-Slapi_Attr *slapi_attr_init( Slapi_Attr *a, const char *type )
-{
-#ifdef LDAP_SLAPI
- const char *text;
- AttributeDescription *ad = NULL;
-
- if( slap_str2ad( type, &ad, &text ) != LDAP_SUCCESS ) {
- return NULL;
+ if( slap_str2ad( type, &ad, &text ) != LDAP_SUCCESS ) {
+ return NULL;
}
a->a_desc = ad;
a->a_flags = 0;
return a;
-#else
- return NULL;
-#endif
}
void slapi_attr_free( Slapi_Attr **a )
{
-#ifdef LDAP_SLAPI
attr_free( *a );
*a = NULL;
-#endif
}
Slapi_Attr *slapi_attr_dup( const Slapi_Attr *attr )
{
-#ifdef LDAP_SLAPI
return attr_dup( (Slapi_Attr *)attr );
-#else
- return NULL;
-#endif
}
int slapi_attr_add_value( Slapi_Attr *a, const Slapi_Value *v )
{
-#ifdef LDAP_SLAPI
struct berval nval;
struct berval *nvalp;
int rc;
}
return rc;
-#else
- return -1;
-#endif
}
int slapi_attr_type2plugin( const char *type, void **pi )
int slapi_attr_get_type( const Slapi_Attr *attr, char **type )
{
-#ifdef LDAP_SLAPI
if ( attr == NULL ) {
return LDAP_PARAM_ERROR;
}
*type = attr->a_desc->ad_cname.bv_val;
return LDAP_SUCCESS;
-#else
- return -1;
-#endif
}
int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp )
{
-#ifdef LDAP_SLAPI
if ( attr == NULL ) {
return LDAP_PARAM_ERROR;
}
*oidp = attr->a_desc->ad_type->sat_oid;
return LDAP_SUCCESS;
-#else
- return -1;
-#endif
}
int slapi_attr_value_cmp( const Slapi_Attr *a, const struct berval *v1, const struct berval *v2 )
{
-#ifdef LDAP_SLAPI
MatchingRule *mr;
int ret;
int rc;
return -1;
return ( ret == 0 ) ? 0 : -1;
-#else
- return -1;
-#endif
}
int slapi_attr_value_find( const Slapi_Attr *a, struct berval *v )
{
-#ifdef LDAP_SLAPI
MatchingRule *mr;
struct berval *bv;
int j;
return 0;
}
}
-#endif /* LDAP_SLAPI */
return -1;
}
int slapi_attr_type_cmp( const char *t1, const char *t2, int opt )
{
-#ifdef LDAP_SLAPI
AttributeDescription *a1 = NULL;
AttributeDescription *a2 = NULL;
const char *text;
}
return ret;
-#else
- return -1;
-#endif
}
int slapi_attr_types_equivalent( const char *t1, const char *t2 )
{
-#ifdef LDAP_SLAPI
- return slapi_attr_type_cmp( t1, t2, SLAPI_TYPE_CMP_EXACT );
-#else
- return -1;
-#endif
+ return ( slapi_attr_type_cmp( t1, t2, SLAPI_TYPE_CMP_EXACT ) == 0 );
}
int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v )
{
-#ifdef LDAP_SLAPI
return slapi_valueset_first_value( &a->a_vals, v );
-#else
- return -1;
-#endif
}
int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v )
{
-#ifdef LDAP_SLAPI
return slapi_valueset_next_value( &a->a_vals, hint, v );
-#else
- return -1;
-#endif
}
int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues )
{
-#ifdef LDAP_SLAPI
*numValues = slapi_valueset_count( &a->a_vals );
return 0;
-#else
- return -1;
-#endif
}
int slapi_attr_get_valueset( const Slapi_Attr *a, Slapi_ValueSet **vs )
{
-#ifdef LDAP_SLAPI
*vs = &((Slapi_Attr *)a)->a_vals;
return 0;
-#else
- return -1;
-#endif
}
int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals )
{
-#ifdef LDAP_SLAPI
return slapi_attr_get_values( a, vals );
-#else
- return -1;
-#endif
}
char *slapi_attr_syntax_normalize( const char *s )
{
-#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
}
return ad->ad_cname.bv_val;
-#else
- return -1;
-#endif
}
Slapi_Value *slapi_value_new( void )
{
-#ifdef LDAP_SLAPI
struct berval *bv;
bv = (struct berval *)slapi_ch_malloc( sizeof(*bv) );
return bv;
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_new_berval(const struct berval *bval)
{
-#ifdef LDAP_SLAPI
return ber_dupbv( NULL, (struct berval *)bval );
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_new_value(const Slapi_Value *v)
{
-#ifdef LDAP_SLAPI
return slapi_value_new_berval( v );
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_new_string(const char *s)
{
-#ifdef LDAP_SLAPI
struct berval bv;
bv.bv_val = (char *)s;
bv.bv_len = strlen( s );
return slapi_value_new_berval( &bv );
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_init(Slapi_Value *val)
{
-#ifdef LDAP_SLAPI
val->bv_val = NULL;
val->bv_len = 0;
return val;
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval)
{
-#ifdef LDAP_SLAPI
return ber_dupbv( v, bval );
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_init_string(Slapi_Value *v, const char *s)
{
-#ifdef LDAP_SLAPI
- v->bv_val = slapi_ch_strdup( (char *)s );
+ v->bv_val = slapi_ch_strdup( s );
v->bv_len = strlen( s );
return v;
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_dup(const Slapi_Value *v)
{
-#ifdef LDAP_SLAPI
return slapi_value_new_value( v );
-#else
- return NULL;
-#endif
}
void slapi_value_free(Slapi_Value **value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) {
return;
}
slapi_ch_free( (void **)&(*value)->bv_val );
slapi_ch_free( (void **)value );
}
-#endif
}
const struct berval *slapi_value_get_berval( const Slapi_Value *value )
{
-#ifdef LDAP_SLAPI
return value;
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval )
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) {
return NULL;
}
slapi_value_init_berval( value, (struct berval *)bval );
return value;
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) {
return NULL;
}
return slapi_value_set_berval( value, vfrom );
-#else
- return NULL;
-#endif
}
Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) {
return NULL;
}
AC_MEMCPY( value->bv_val, val, len );
return value;
-#else
- return NULL;
-#endif
}
int slapi_value_set_string(Slapi_Value *value, const char *strVal)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) {
return -1;
}
slapi_value_set( value, (void *)strVal, strlen( strVal ) );
return 0;
-#else
- return NULL;
-#endif
}
int slapi_value_set_int(Slapi_Value *value, int intVal)
{
-#ifdef LDAP_SLAPI
char buf[64];
snprintf( buf, sizeof( buf ), "%d", intVal );
return slapi_value_set_string( value, buf );
-#else
- return -1;
-#endif
}
const char *slapi_value_get_string(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) return NULL;
if ( value->bv_val == NULL ) return NULL;
if ( !checkBVString( value ) ) return NULL;
return value->bv_val;
-#else
- return NULL;
-#endif
}
int slapi_value_get_int(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) return 0;
if ( value->bv_val == NULL ) return 0;
if ( !checkBVString( value ) ) return 0;
return (int)strtol( value->bv_val, NULL, 10 );
-#else
- return NULL;
-#endif
}
unsigned int slapi_value_get_uint(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) return 0;
if ( value->bv_val == NULL ) return 0;
if ( !checkBVString( value ) ) return 0;
return (unsigned int)strtoul( value->bv_val, NULL, 10 );
-#else
- return NULL;
-#endif
}
long slapi_value_get_long(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) return 0;
if ( value->bv_val == NULL ) return 0;
if ( !checkBVString( value ) ) return 0;
return strtol( value->bv_val, NULL, 10 );
-#else
- return NULL;
-#endif
}
unsigned long slapi_value_get_ulong(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL ) return 0;
if ( value->bv_val == NULL ) return 0;
if ( !checkBVString( value ) ) return 0;
return strtoul( value->bv_val, NULL, 10 );
-#else
- return NULL;
-#endif
}
size_t slapi_value_get_length(const Slapi_Value *value)
{
-#ifdef LDAP_SLAPI
if ( value == NULL )
return 0;
return (size_t) value->bv_len;
-#else
- return 0;
-#endif
}
int slapi_value_compare(const Slapi_Attr *a, const Slapi_Value *v1, const Slapi_Value *v2)
{
-#ifdef LDAP_SLAPI
return slapi_attr_value_cmp( a, v1, v2 );
-#else
- return -1;
-#endif
}
/* A ValueSet is a container for a BerVarray. */
Slapi_ValueSet *slapi_valueset_new( void )
{
-#ifdef LDAP_SLAPI
Slapi_ValueSet *vs;
vs = (Slapi_ValueSet *)slapi_ch_malloc( sizeof( *vs ) );
*vs = NULL;
return vs;
-#else
- return NULL;
-#endif
}
void slapi_valueset_free(Slapi_ValueSet *vs)
{
-#ifdef LDAP_SLAPI
if ( vs != NULL ) {
BerVarray vp = *vs;
*vs = NULL;
}
-#endif
}
void slapi_valueset_init(Slapi_ValueSet *vs)
{
-#ifdef LDAP_SLAPI
if ( vs != NULL && *vs == NULL ) {
*vs = (Slapi_ValueSet)slapi_ch_calloc( 1, sizeof(struct berval) );
(*vs)->bv_val = NULL;
(*vs)->bv_len = 0;
}
-#endif
}
void slapi_valueset_done(Slapi_ValueSet *vs)
{
-#ifdef LDAP_SLAPI
BerVarray vp;
if ( vs == NULL )
slapi_ch_free( (void **)&vp->bv_val );
}
/* but don't free *vs or vs */
-#endif
}
void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval)
{
-#ifdef LDAP_SLAPI
struct berval bv;
ber_dupbv( &bv, (Slapi_Value *)addval );
ber_bvarray_add( vs, &bv );
-#endif
}
int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v )
{
-#ifdef LDAP_SLAPI
return slapi_valueset_next_value( vs, 0, v );
-#else
- return -1;
-#endif
}
int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v)
{
-#ifdef LDAP_SLAPI
int i;
BerVarray vp;
return index + 1;
}
}
-#endif
return -1;
}
int slapi_valueset_count( const Slapi_ValueSet *vs )
{
-#ifdef LDAP_SLAPI
int i;
BerVarray vp;
;
return i;
-#else
- return 0;
-#endif
}
void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2)
{
-#ifdef LDAP_SLAPI
BerVarray vp;
for ( vp = *vs2; vp->bv_val != NULL; vp++ ) {
slapi_valueset_add_value( vs1, vp );
}
-#endif
}
int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr,
struct berval *val, int access )
{
-#ifdef LDAP_SLAPI
- Backend *be;
- Connection *conn;
- Operation *op;
- int ret;
+ int rc;
slap_access_t slap_access;
AttributeDescription *ad = NULL;
const char *text;
- ret = slap_str2ad( attr, &ad, &text );
- if ( ret != LDAP_SUCCESS ) {
- return ret;
+ rc = slap_str2ad( attr, &ad, &text );
+ if ( rc != LDAP_SUCCESS ) {
+ return rc;
}
+ /*
+ * Whilst the SLAPI access types are arranged as a bitmask, the
+ * documentation indicates that they are to be used separately.
+ */
switch ( access & SLAPI_ACL_ALL ) {
case SLAPI_ACL_COMPARE:
slap_access = ACL_COMPARE;
slap_access = ACL_READ;
break;
case SLAPI_ACL_WRITE:
+ slap_access = ACL_WRITE;
+ break;
case SLAPI_ACL_DELETE:
+ slap_access = ACL_WDEL;
+ break;
case SLAPI_ACL_ADD:
- case SLAPI_ACL_SELF:
- /* FIXME: handle ACL_WADD/ACL_WDEL */
- slap_access = ACL_WRITE;
+ slap_access = ACL_WADD;
break;
+ case SLAPI_ACL_SELF: /* not documented */
+ case SLAPI_ACL_PROXY: /* not documented */
default:
return LDAP_INSUFFICIENT_ACCESS;
break;
}
- if ( slapi_pblock_get( pb, SLAPI_BACKEND, (void *)&be ) != 0 ) {
- return LDAP_PARAM_ERROR;
- }
+ assert( pb->pb_op != NULL );
- if ( slapi_pblock_get( pb, SLAPI_CONNECTION, (void *)&conn ) != 0 ) {
- return LDAP_PARAM_ERROR;
- }
-
- if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&op ) != 0 ) {
- return LDAP_PARAM_ERROR;
+ if ( access_allowed( pb->pb_op, e, ad, val, slap_access, NULL ) ) {
+ return LDAP_SUCCESS;
}
- ret = access_allowed( op, e, ad, val, slap_access, NULL );
-
- return ret ? LDAP_SUCCESS : LDAP_INSUFFICIENT_ACCESS;
-#else
- return LDAP_UNWILLING_TO_PERFORM;
-#endif
+ return LDAP_INSUFFICIENT_ACCESS;
}
int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char **errbuf)
{
-#ifdef LDAP_SLAPI
- Operation *op;
int rc = LDAP_SUCCESS;
- Modifications *ml, *mp;
+ Modifications *ml;
- if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&op ) != 0 ) {
+ if ( pb == NULL || pb->pb_op == NULL )
return LDAP_PARAM_ERROR;
- }
ml = slapi_int_ldapmods2modifications( mods );
if ( ml == NULL ) {
return LDAP_OTHER;
}
- for ( mp = ml; mp != NULL; mp = mp->sml_next ) {
- rc = slap_bv2ad( &mp->sml_type, &mp->sml_desc, (const char **)errbuf );
- if ( rc != LDAP_SUCCESS ) {
- break;
- }
- }
-
if ( rc == LDAP_SUCCESS ) {
- rc = acl_check_modlist( op, e, ml ) ? LDAP_SUCCESS : LDAP_INSUFFICIENT_ACCESS;
+ rc = acl_check_modlist( pb->pb_op, e, ml ) ? LDAP_SUCCESS : LDAP_INSUFFICIENT_ACCESS;
}
- /* Careful when freeing the modlist because it has pointers into the mods array. */
- for ( ; ml != NULL; ml = mp ) {
- mp = ml->sml_next;
-
- /* just free the containing array */
- slapi_ch_free( (void **)&ml->sml_values );
- slapi_ch_free( (void **)&ml );
- }
+ slap_mods_free( ml, 1 );
return rc;
-#else
- return LDAP_UNWILLING_TO_PERFORM;
-#endif
}
/*
* Synthesise an LDAPMod array from a Modifications list to pass
- * to SLAPI. This synthesis is destructive and as such the
- * Modifications list may not be used after calling this
- * function.
- *
- * This function must also be called before slap_mods_check().
+ * to SLAPI.
*/
-LDAPMod **slapi_int_modifications2ldapmods(Modifications **pmodlist)
+LDAPMod **slapi_int_modifications2ldapmods( Modifications *modlist )
{
-#ifdef LDAP_SLAPI
- Modifications *ml, *modlist;
+ Modifications *ml;
LDAPMod **mods, *modp;
int i, j;
- modlist = *pmodlist;
-
for( i = 0, ml = modlist; ml != NULL; i++, ml = ml->sml_next )
;
- mods = (LDAPMod **)ch_malloc( (i + 1) * sizeof(LDAPMod *) );
+ mods = (LDAPMod **)slapi_ch_malloc( (i + 1) * sizeof(LDAPMod *) );
for( i = 0, ml = modlist; ml != NULL; ml = ml->sml_next ) {
- mods[i] = (LDAPMod *)ch_malloc( sizeof(LDAPMod) );
+ mods[i] = (LDAPMod *)slapi_ch_malloc( sizeof(LDAPMod) );
modp = mods[i];
modp->mod_op = ml->sml_op | LDAP_MOD_BVALUES;
-
- /* Take ownership of original type. */
- modp->mod_type = ml->sml_type.bv_val;
- ml->sml_type.bv_val = NULL;
+ if ( BER_BVISNULL( &ml->sml_type ) ) {
+ /* may happen for internally generated mods */
+ assert( ml->sml_desc != NULL );
+ modp->mod_type = slapi_ch_strdup( ml->sml_desc->ad_cname.bv_val );
+ } else {
+ modp->mod_type = slapi_ch_strdup( ml->sml_type.bv_val );
+ BER_BVZERO( &ml->sml_type );
+ }
if ( ml->sml_values != NULL ) {
for( j = 0; ml->sml_values[j].bv_val != NULL; j++ )
;
- modp->mod_bvalues = (struct berval **)ch_malloc( (j + 1) *
+ modp->mod_bvalues = (struct berval **)slapi_ch_malloc( (j + 1) *
sizeof(struct berval *) );
for( j = 0; ml->sml_values[j].bv_val != NULL; j++ ) {
- /* Take ownership of original values. */
- modp->mod_bvalues[j] = (struct berval *)ch_malloc( sizeof(struct berval) );
- modp->mod_bvalues[j]->bv_len = ml->sml_values[j].bv_len;
- modp->mod_bvalues[j]->bv_val = ml->sml_values[j].bv_val;
- ml->sml_values[j].bv_len = 0;
- ml->sml_values[j].bv_val = NULL;
+ modp->mod_bvalues[j] = (struct berval *)slapi_ch_malloc(
+ sizeof(struct berval) );
+ ber_dupbv( modp->mod_bvalues[j], &ml->sml_values[j] );
}
modp->mod_bvalues[j] = NULL;
} else {
mods[i] = NULL;
- slap_mods_free( modlist );
- *pmodlist = NULL;
-
return mods;
-#else
- return NULL;
-#endif
}
/*
* Convert a potentially modified array of LDAPMods back to a
- * Modification list.
- *
- * The returned Modification list contains pointers into the
- * LDAPMods array; the latter MUST be freed with
- * slapi_int_free_ldapmods() (see below).
+ * Modification list. Unfortunately the values need to be
+ * duplicated because slap_mods_check() will try to free them
+ * before prettying (and we can't easily get out of calling
+ * slap_mods_check() because we need normalized values).
*/
-Modifications *slapi_int_ldapmods2modifications (LDAPMod **mods)
+Modifications *slapi_int_ldapmods2modifications ( LDAPMod **mods )
{
-#ifdef LDAP_SLAPI
Modifications *modlist = NULL, **modtail;
LDAPMod **modp;
+ char textbuf[SLAP_TEXT_BUFLEN];
+ const char *text;
- if ( mods == NULL ) {
- return NULL;
- }
-
- modtail = &modlist;
-
- for( modp = mods; *modp != NULL; modp++ ) {
- Modifications *mod;
- int i;
- char **p;
- struct berval **bvp;
-
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
- mod->sml_op = (*modp)->mod_op & (~LDAP_MOD_BVALUES);
- mod->sml_flags = 0;
- mod->sml_type.bv_val = (*modp)->mod_type;
- mod->sml_type.bv_len = strlen( mod->sml_type.bv_val );
- mod->sml_desc = NULL;
- mod->sml_next = NULL;
-
- if ( (*modp)->mod_op & LDAP_MOD_BVALUES ) {
- for( i = 0, bvp = (*modp)->mod_bvalues; bvp != NULL && *bvp != NULL; bvp++, i++ )
- ;
- } else {
- for( i = 0, p = (*modp)->mod_values; p != NULL && *p != NULL; p++, i++ )
- ;
- }
-
- if ( i == 0 ) {
- mod->sml_values = NULL;
- } else {
- mod->sml_values = (BerVarray) ch_malloc( (i + 1) * sizeof(struct berval) );
-
- /* NB: This implicitly trusts a plugin to return valid modifications. */
- if ( (*modp)->mod_op & LDAP_MOD_BVALUES ) {
- for( i = 0, bvp = (*modp)->mod_bvalues; bvp != NULL && *bvp != NULL; bvp++, i++ ) {
- mod->sml_values[i].bv_val = (*bvp)->bv_val;
- mod->sml_values[i].bv_len = (*bvp)->bv_len;
- }
- } else {
- for( i = 0, p = (*modp)->mod_values; p != NULL && *p != NULL; p++, i++ ) {
- mod->sml_values[i].bv_val = *p;
- mod->sml_values[i].bv_len = strlen( *p );
- }
- }
- mod->sml_values[i].bv_val = NULL;
- mod->sml_values[i].bv_len = 0;
- }
- mod->sml_nvalues = NULL;
-
- *modtail = mod;
- modtail = &mod->sml_next;
- }
-
- return modlist;
-#else
- return NULL;
-#endif
-}
-
-/*
- * This function only frees the parts of the mods array that
- * are not shared with the Modification list that was created
- * by slapi_int_ldapmods2modifications().
- *
- */
-void slapi_int_free_ldapmods (LDAPMod **mods)
-{
-#ifdef LDAP_SLAPI
- int i, j;
-
- if (mods == NULL)
- return;
-
- for ( i = 0; mods[i] != NULL; i++ ) {
- /*
- * Don't free values themselves; they're owned by the
- * Modification list. Do free the containing array.
- */
- if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
- for ( j = 0; mods[i]->mod_values != NULL && mods[i]->mod_values[j] != NULL; j++ ) {
- ch_free( mods[i]->mod_values[j] );
- }
- ch_free( mods[i]->mod_values );
- } else {
- ch_free( mods[i]->mod_values );
- }
- /* Don't free type, for same reasons. */
- ch_free( mods[i] );
- }
- ch_free( mods );
-#endif /* LDAP_SLAPI */
-}
-
-/*
- * Sun ONE DS 5.x computed attribute support. Computed attributes
- * allow for dynamically generated operational attributes, a very
- * useful thing indeed.
- */
-
-/*
- * Write the computed attribute to a BerElement. Complementary
- * functions need to be defined for anything that replaces
- * op->o_callback->sc_sendentry, if you wish to make computed
- * attributes available to it.
- */
-int slapi_int_compute_output_ber(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e)
-{
-#ifdef LDAP_SLAPI
- Operation *op = NULL;
- BerElement *ber;
- AttributeDescription *desc = NULL;
- int rc;
- int i;
-
- if ( c == NULL ) {
- return 1;
+ if ( mods == NULL ) {
+ return NULL;
}
- if ( a == NULL ) {
- return 1;
- }
+ modtail = &modlist;
- if ( e == NULL ) {
- return 1;
- }
+ for ( modp = mods; *modp != NULL; modp++ ) {
+ Modifications *mod;
+ LDAPMod *lmod = *modp;
+ int i;
+ const char *text;
+ AttributeDescription *ad = NULL;
- rc = slapi_pblock_get( c->cac_pb, SLAPI_OPERATION, (void *)&op );
- if ( rc != 0 || op == NULL ) {
- return rc;
- }
+ if ( slap_str2ad( lmod->mod_type, &ad, &text ) != LDAP_SUCCESS ) {
+ continue;
+ }
- ber = (BerElement *)c->cac_private;
- desc = a->a_desc;
+ mod = (Modifications *) slapi_ch_malloc( sizeof(Modifications) );
+ mod->sml_op = lmod->mod_op & ~(LDAP_MOD_BVALUES);
+ mod->sml_flags = 0;
+ mod->sml_type = ad->ad_cname;
+ mod->sml_desc = ad;
+ mod->sml_next = NULL;
- if ( c->cac_attrs == NULL ) {
- /* All attrs request, skip operational attributes */
- if ( is_at_operational( desc->ad_type ) ) {
- return 0;
- }
- } else {
- /* Specific attrs requested */
- if ( is_at_operational( desc->ad_type ) ) {
- if ( !c->cac_opattrs && !ad_inlist( desc, c->cac_attrs ) ) {
- return 0;
+ i = 0;
+ if ( lmod->mod_op & LDAP_MOD_BVALUES ) {
+ if ( lmod->mod_bvalues != NULL ) {
+ while ( lmod->mod_bvalues[i] != NULL )
+ i++;
}
} else {
- if ( !c->cac_userattrs && !ad_inlist( desc, c->cac_attrs ) ) {
- return 0;
+ if ( lmod->mod_values != NULL ) {
+ while ( lmod->mod_values[i] != NULL )
+ i++;
}
}
- }
-
- if ( !access_allowed( op, e, desc, NULL, ACL_READ, &c->cac_acl_state) ) {
- slapi_log_error( SLAPI_LOG_ACL, "slapi_int_compute_output_ber",
- "acl: access to attribute %s not allowed\n",
- desc->ad_cname.bv_val );
- return 0;
- }
- rc = ber_printf( ber, "{O[" /*]}*/ , &desc->ad_cname );
- if (rc == -1 ) {
- slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
- "ber_printf failed\n");
- return 1;
- }
+ if ( i == 0 ) {
+ mod->sml_values = NULL;
+ } else {
+ mod->sml_values = (BerVarray) slapi_ch_malloc( (i + 1) * sizeof(struct berval) );
- if ( !c->cac_attrsonly && a->a_vals != NULL ) {
- for ( i = 0; a->a_vals[i].bv_val != NULL; i++ ) {
- if ( !access_allowed( op, e,
- desc, &a->a_vals[i], ACL_READ, &c->cac_acl_state)) {
- slapi_log_error( SLAPI_LOG_ACL, "slapi_int_compute_output_ber",
- "conn %lu "
- "acl: access to %s, value %d not allowed\n",
- op->o_connid, desc->ad_cname.bv_val, i );
- continue;
- }
-
- if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
- slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
- "ber_printf failed\n");
- return 1;
+ /* NB: This implicitly trusts a plugin to return valid modifications. */
+ if ( lmod->mod_op & LDAP_MOD_BVALUES ) {
+ for ( i = 0; lmod->mod_bvalues[i] != NULL; i++ ) {
+ ber_dupbv( &mod->sml_values[i], lmod->mod_bvalues[i] );
+ }
+ } else {
+ for ( i = 0; lmod->mod_values[i] != NULL; i++ ) {
+ mod->sml_values[i].bv_val = slapi_ch_strdup( lmod->mod_values[i] );
+ mod->sml_values[i].bv_len = strlen( lmod->mod_values[i] );
+ }
}
+ mod->sml_values[i].bv_val = NULL;
+ mod->sml_values[i].bv_len = 0;
}
+ mod->sml_nvalues = NULL;
+
+ *modtail = mod;
+ modtail = &mod->sml_next;
}
- if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
- slapi_log_error( SLAPI_LOG_BER, "slapi_int_compute_output_ber",
- "ber_printf failed\n" );
- return 1;
+ if ( slap_mods_check( modlist, &text, textbuf, sizeof( textbuf ), NULL ) != LDAP_SUCCESS ) {
+ slap_mods_free( modlist, 1 );
+ modlist = NULL;
}
- return 0;
-#else
- return 1;
-#endif
+ return modlist;
}
+/*
+ * Sun ONE DS 5.x computed attribute support. Computed attributes
+ * allow for dynamically generated operational attributes, a very
+ * useful thing indeed.
+ */
+
/*
* For some reason Sun don't use the normal plugin mechanism
* registration path to register an "evaluator" function (an
*/
int slapi_compute_add_evaluator(slapi_compute_callback_t function)
{
-#ifdef LDAP_SLAPI
Slapi_PBlock *pPlugin = NULL;
int rc;
+ int type = SLAPI_PLUGIN_OBJECT;
pPlugin = slapi_pblock_new();
if ( pPlugin == NULL ) {
goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)SLAPI_PLUGIN_OBJECT );
+ rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
if ( rc != LDAP_SUCCESS ) {
goto done;
}
goto done;
}
- rc = slapi_int_register_plugin( NULL, pPlugin );
+ rc = slapi_int_register_plugin( frontendDB, pPlugin );
if ( rc != 0 ) {
rc = LDAP_OTHER;
goto done;
}
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
/*
*/
int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function)
{
-#ifdef LDAP_SLAPI
Slapi_PBlock *pPlugin = NULL;
int rc;
+ int type = SLAPI_PLUGIN_OBJECT;
pPlugin = slapi_pblock_new();
if ( pPlugin == NULL ) {
goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)SLAPI_PLUGIN_OBJECT );
+ rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
if ( rc != LDAP_SUCCESS ) {
goto done;
}
goto done;
}
- rc = slapi_int_register_plugin( NULL, pPlugin );
+ rc = slapi_int_register_plugin( frontendDB, pPlugin );
if ( rc != 0 ) {
rc = LDAP_OTHER;
goto done;
}
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
/*
*/
int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slapi_compute_output_t outputfn)
{
-#ifdef LDAP_SLAPI
int rc = 0;
slapi_compute_callback_t *pGetPlugin, *tmpPlugin;
- rc = slapi_int_get_plugins( NULL, SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN, (SLAPI_FUNC **)&tmpPlugin );
+ rc = slapi_int_get_plugins( frontendDB, SLAPI_PLUGIN_COMPUTE_EVALUATOR_FN, (SLAPI_FUNC **)&tmpPlugin );
if ( rc != LDAP_SUCCESS || tmpPlugin == NULL ) {
/* Nothing to do; front-end should ignore. */
return 0;
slapi_ch_free( (void **)&tmpPlugin );
return rc;
-#else
- return 1;
-#endif /* LDAP_SLAPI */
}
-int compute_rewrite_search_filter(Slapi_PBlock *pb)
+int
+compute_rewrite_search_filter( Slapi_PBlock *pb )
{
-#ifdef LDAP_SLAPI
- Backend *be;
- int rc;
-
- rc = slapi_pblock_get( pb, SLAPI_BACKEND, (void *)&be );
- if ( rc != 0 ) {
- return rc;
- }
+ if ( pb == NULL || pb->pb_op == NULL )
+ return LDAP_PARAM_ERROR;
- return slapi_int_call_plugins( be, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, pb );
-#else
- return -1;
-#endif /* LDAP_SLAPI */
+ return slapi_int_call_plugins( pb->pb_op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, pb );
}
/*
* New API to provide the plugin with access to the search
* pblock. Have informed Sun DS team.
*/
-int slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb)
+int
+slapi_x_compute_get_pblock(computed_attr_context *c, Slapi_PBlock **pb)
{
-#ifdef LDAP_SLAPI
if ( c == NULL )
return -1;
*pb = c->cac_pb;
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
Slapi_Mutex *slapi_new_mutex( void )
{
-#ifdef LDAP_SLAPI
Slapi_Mutex *m;
m = (Slapi_Mutex *)slapi_ch_malloc( sizeof(*m) );
}
return m;
-#else
- return NULL;
-#endif
}
void slapi_destroy_mutex( Slapi_Mutex *mutex )
{
-#ifdef LDAP_SLAPI
if ( mutex != NULL ) {
ldap_pvt_thread_mutex_destroy( &mutex->mutex );
slapi_ch_free( (void **)&mutex);
}
-#endif
}
void slapi_lock_mutex( Slapi_Mutex *mutex )
{
-#ifdef LDAP_SLAPI
ldap_pvt_thread_mutex_lock( &mutex->mutex );
-#endif
}
int slapi_unlock_mutex( Slapi_Mutex *mutex )
{
-#ifdef LDAP_SLAPI
return ldap_pvt_thread_mutex_unlock( &mutex->mutex );
-#else
- return -1;
-#endif
}
Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex )
{
-#ifdef LDAP_SLAPI
Slapi_CondVar *cv;
if ( mutex == NULL ) {
return NULL;
}
- /* XXX struct copy */
cv->mutex = mutex->mutex;
return cv;
-#else
- return NULL;
-#endif
}
void slapi_destroy_condvar( Slapi_CondVar *cvar )
{
-#ifdef LDAP_SLAPI
if ( cvar != NULL ) {
ldap_pvt_thread_cond_destroy( &cvar->cond );
slapi_ch_free( (void **)&cvar );
}
-#endif
}
int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout )
{
-#ifdef LDAP_SLAPI
if ( cvar == NULL ) {
return -1;
}
return ldap_pvt_thread_cond_wait( &cvar->cond, &cvar->mutex );
-#else
- return -1;
-#endif
}
int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all )
{
-#ifdef LDAP_SLAPI
if ( cvar == NULL ) {
return -1;
}
}
return ldap_pvt_thread_cond_signal( &cvar->cond );
-#else
- return -1;
-#endif
}
int slapi_int_access_allowed( Operation *op,
slap_access_t access,
AccessControlState *state )
{
-#ifdef LDAP_SLAPI
int rc, slap_access = 0;
slapi_acl_callback_t *pGetPlugin, *tmpPlugin;
+ Slapi_PBlock *pb;
- if ( op->o_pb == NULL ) {
+ pb = SLAPI_OPERATION_PBLOCK( op );
+ if ( pb == NULL ) {
/* internal operation */
return 1;
}
switch ( access ) {
- case ACL_WRITE:
- /* FIXME: handle ACL_WADD/ACL_WDEL */
- slap_access |= SLAPI_ACL_ADD | SLAPI_ACL_DELETE | SLAPI_ACL_WRITE;
+ case ACL_COMPARE:
+ slap_access |= SLAPI_ACL_COMPARE;
+ break;
+ case ACL_SEARCH:
+ slap_access |= SLAPI_ACL_SEARCH;
break;
case ACL_READ:
slap_access |= SLAPI_ACL_READ;
break;
- case ACL_SEARCH:
- slap_access |= SLAPI_ACL_SEARCH;
+ case ACL_WRITE:
+ slap_access |= SLAPI_ACL_WRITE;
break;
- case ACL_COMPARE:
- slap_access = ACL_COMPARE;
+ case ACL_WDEL:
+ slap_access |= SLAPI_ACL_DELETE;
+ break;
+ case ACL_WADD:
+ slap_access |= SLAPI_ACL_ADD;
break;
default:
break;
return 1;
}
- slapi_int_pblock_set_operation( op->o_pb, op );
-
rc = 1; /* default allow policy */
for ( pGetPlugin = tmpPlugin; *pGetPlugin != NULL; pGetPlugin++ ) {
* 0 access denied
* 1 access granted
*/
- rc = (*pGetPlugin)( op->o_pb, entry, desc->ad_cname.bv_val,
- val, slap_access, (void *)state );
+ rc = (*pGetPlugin)( pb, entry, desc->ad_cname.bv_val,
+ val, slap_access, (void *)state );
if ( rc == 0 ) {
break;
}
slapi_ch_free( (void **)&tmpPlugin );
return rc;
-#else
- return 1;
-#endif /* LDAP_SLAPI */
}
/*
*/
int slapi_rdn2typeval( char *rdn, char **type, struct berval *bv )
{
-#ifdef LDAP_SLAPI
LDAPRDN lrdn;
LDAPAVA *ava;
int rc;
ldap_rdnfree(lrdn);
return 0;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
char *slapi_dn_plus_rdn( const char *dn, const char *rdn )
{
-#ifdef LDAP_SLAPI
struct berval new_dn, parent_dn, newrdn;
new_dn.bv_val = NULL;
build_new_dn( &new_dn, &parent_dn, &newrdn, NULL );
return new_dn.bv_val;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
- Backend *be;
+ Backend *be_orig;
const char *text;
char textbuf[SLAP_TEXT_BUFLEN] = { '\0' };
size_t textlen = sizeof textbuf;
- int rc;
+ int rc = LDAP_SUCCESS;
- if ( slapi_pblock_get( pb, SLAPI_BACKEND, (void **)&be ) != 0 )
- return -1;
+ PBLOCK_ASSERT_OP( pb, 0 );
+
+ be_orig = pb->pb_op->o_bd;
- rc = entry_schema_check( be, e, NULL, 0,
- &text, textbuf, textlen );
+ pb->pb_op->o_bd = select_backend( &e->e_nname, 0, 0 );
+ if ( pb->pb_op->o_bd != NULL ) {
+ rc = entry_schema_check( pb->pb_op, e, NULL, 0,
+ &text, textbuf, textlen );
+ }
+ pb->pb_op->o_bd = be_orig;
return ( rc == LDAP_SUCCESS ) ? 0 : 1;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
int slapi_entry_rdn_values_present( const Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
LDAPDN dn;
int rc;
int i = 0, match = 0;
ldap_dnfree( dn );
return ( i == match );
-#else
- return 0;
-#endif /* LDAP_SLAPI */
}
int slapi_entry_add_rdn_values( Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
LDAPDN dn;
int i, rc;
ldap_dnfree( dn );
return LDAP_SUCCESS;
-#else
- return LDAP_OTHER;
-#endif /* LDAP_SLAPI */
}
const char *slapi_entry_get_uniqueid( const Slapi_Entry *e )
{
-#ifdef LDAP_SLAPI
Attribute *attr;
- const char *uniqueid;
attr = attr_find( e->e_attrs, slap_schema.si_ad_entryUUID );
if ( attr == NULL ) {
if ( attr->a_vals != NULL && attr->a_vals[0].bv_len != 0 ) {
return slapi_value_get_string( &attr->a_vals[0] );
}
-#endif /* LDAP_SLAPI */
return NULL;
}
void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid )
{
-#ifdef LDAP_SLAPI
struct berval bv;
attr_delete ( &e->e_attrs, slap_schema.si_ad_entryUUID );
bv.bv_val = uniqueid;
bv.bv_len = strlen( uniqueid );
attr_merge_normalize_one( e, slap_schema.si_ad_entryUUID, &bv, NULL );
-#endif /* LDAP_SLAPI */
}
LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared )
{
-#ifdef LDAP_SLAPI
LDAP *ld;
char *url;
size_t size;
slapi_ch_free_string( &url );
return ( rc == LDAP_SUCCESS ) ? ld : NULL;
-#else
- return NULL;
-#endif /* LDAP_SLAPI */
}
void slapi_ldap_unbind( LDAP *ld )
{
-#ifdef LDAP_SLAPI
- ldap_unbind( ld );
-#endif /* LDAP_SLAPI */
+ ldap_unbind_ext_s( ld, NULL, NULL );
}
int slapi_x_backend_get_flags( const Slapi_Backend *be, unsigned long *flags )
{
-#ifdef LDAP_SLAPI
if ( be == NULL )
return LDAP_PARAM_ERROR;
*flags = SLAP_DBFLAGS(be);
return LDAP_SUCCESS;
-#else
- return -1;
-#endif /* LDAP_SLAPI */
}
+int
+slapi_int_count_controls( LDAPControl **ctrls )
+{
+ size_t i;
+
+ if ( ctrls == NULL )
+ return 0;
+
+ for ( i = 0; ctrls[i] != NULL; i++ )
+ ;
+
+ return i;
+}
+
+int
+slapi_op_abandoned( Slapi_PBlock *pb )
+{
+ if ( pb->pb_op == NULL )
+ return 0;
+
+ return ( pb->pb_op->o_abandon );
+}
+
+char *
+slapi_op_type_to_string(unsigned long type)
+{
+ char *str;
+
+ switch (type) {
+ case SLAPI_OPERATION_BIND:
+ str = "bind";
+ break;
+ case SLAPI_OPERATION_UNBIND:
+ str = "unbind";
+ break;
+ case SLAPI_OPERATION_SEARCH:
+ str = "search";
+ break;
+ case SLAPI_OPERATION_MODIFY:
+ str = "modify";
+ break;
+ case SLAPI_OPERATION_ADD:
+ str = "add";
+ break;
+ case SLAPI_OPERATION_DELETE:
+ str = "delete";
+ break;
+ case SLAPI_OPERATION_MODDN:
+ str = "modrdn";
+ break;
+ case SLAPI_OPERATION_COMPARE:
+ str = "compare";
+ break;
+ case SLAPI_OPERATION_ABANDON:
+ str = "abandon";
+ break;
+ case SLAPI_OPERATION_EXTENDED:
+ str = "extended";
+ break;
+ default:
+ str = "unknown operation type";
+ break;
+ }
+ return str;
+}
+
+unsigned long
+slapi_op_get_type(Slapi_Operation * op)
+{
+ unsigned long type;
+
+ switch ( op->o_tag ) {
+ case LDAP_REQ_BIND:
+ type = SLAPI_OPERATION_BIND;
+ break;
+ case LDAP_REQ_UNBIND:
+ type = SLAPI_OPERATION_UNBIND;
+ break;
+ case LDAP_REQ_SEARCH:
+ type = SLAPI_OPERATION_SEARCH;
+ break;
+ case LDAP_REQ_MODIFY:
+ type = SLAPI_OPERATION_MODIFY;
+ break;
+ case LDAP_REQ_ADD:
+ type = SLAPI_OPERATION_ADD;
+ break;
+ case LDAP_REQ_DELETE:
+ type = SLAPI_OPERATION_DELETE;
+ break;
+ case LDAP_REQ_MODRDN:
+ type = SLAPI_OPERATION_MODDN;
+ break;
+ case LDAP_REQ_COMPARE:
+ type = SLAPI_OPERATION_COMPARE;
+ break;
+ case LDAP_REQ_ABANDON:
+ type = SLAPI_OPERATION_ABANDON;
+ break;
+ case LDAP_REQ_EXTENDED:
+ type = SLAPI_OPERATION_EXTENDED;
+ break;
+ default:
+ type = SLAPI_OPERATION_NONE;
+ break;
+ }
+ return type;
+}
+
+void slapi_be_set_readonly( Slapi_Backend *be, int readonly )
+{
+ if ( be == NULL )
+ return;
+
+ if ( readonly )
+ be->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
+ else
+ be->be_restrictops &= ~(SLAP_RESTRICT_OP_WRITES);
+}
+
+int slapi_be_get_readonly( Slapi_Backend *be )
+{
+ if ( be == NULL )
+ return 0;
+
+ return ( (be->be_restrictops & SLAP_RESTRICT_OP_WRITES) == SLAP_RESTRICT_OP_WRITES );
+}
+
+const char *slapi_x_be_get_updatedn( Slapi_Backend *be )
+{
+ if ( be == NULL )
+ return NULL;
+
+ return be->be_update_ndn.bv_val;
+}
+
+Slapi_Backend *slapi_be_select( const Slapi_DN *sdn )
+{
+ Slapi_Backend *be;
+
+ slapi_sdn_get_ndn( sdn );
+
+ be = select_backend( (struct berval *)&sdn->ndn, 0, 0 );
+
+ return be;
+}
+
+#if 0
+void
+slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag)
+{
+}
+
+void
+slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag)
+{
+}
+
+int
+slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag)
+{
+}
+#endif
+
+#endif /* LDAP_SLAPI */
+
int
starttls_extop ( Operation *op, SlapReply *rs )
{
- void *ctx;
int rc;
if ( op->ore_reqdata != NULL ) {
#include "slap.h"
-#if 0 /* unused */
-static char *find_matching_paren( const char *s );
-#endif /* unused */
-static Filter *str2list( const char *str, long unsigned int ftype);
-static Filter *str2simple( const char *str);
-static int str2subvals( const char *val, Filter *f);
Filter *
str2filter_x( Operation *op, const char *str )
LDAP_STAILQ_REMOVE( &slap_sync_cookie, sc, sync_cookie, sc_next );
+ /* ctxcsn wasn't parsed yet, do it now */
+ slap_parse_sync_cookie( sc, op->o_tmpmemctx );
if ( BER_BVISNULL( &sc->ctxcsn ) ) {
/* if cmdline cookie does not have ctxcsn */
/* component, set it to an initial value */
int syncstate;
struct berval syncUUID = BER_BVNULL;
- struct sync_cookie syncCookie = { 0 };
- struct sync_cookie syncCookie_req = { 0 };
+ struct sync_cookie syncCookie = { BER_BVNULL };
+ struct sync_cookie syncCookie_req = { BER_BVNULL };
struct berval cookie = BER_BVNULL;
int rc, err, i;
}
if ( !BER_BVISNULL( &syncCookie.octet_str ) )
{
- slap_parse_sync_cookie( &syncCookie );
+ slap_parse_sync_cookie( &syncCookie, NULL );
}
}
if ( syncrepl_message_to_entry( si, op, msg,
}
ldap_controls_free( rctrls );
if ( modlist ) {
- slap_mods_free( modlist );
+ slap_mods_free( modlist, 1 );
}
if ( rc_efree && entry ) {
entry_free( entry );
}
if ( !BER_BVISNULL( &syncCookie.octet_str ) )
{
- slap_parse_sync_cookie( &syncCookie );
+ slap_parse_sync_cookie( &syncCookie, NULL );
}
}
if ( ber_peek_tag( ber, &len ) == LDAP_TAG_REFRESHDELETES )
}
if ( !BER_BVISNULL( &syncCookie.octet_str ) )
{
- slap_parse_sync_cookie( &syncCookie );
+ slap_parse_sync_cookie( &syncCookie, NULL );
}
}
if ( ber_peek_tag( ber, &len ) ==
}
if ( !BER_BVISNULL( &syncCookie.octet_str ) )
{
- slap_parse_sync_cookie( &syncCookie );
+ slap_parse_sync_cookie( &syncCookie, NULL );
}
}
if ( ber_peek_tag( ber, &len ) ==
return NULL;
}
-int
+static int
syncrepl_message_to_entry(
syncinfo_t *si,
Operation *op,
AttributeDescription **ads;
} dninfo;
-int
+static int
syncrepl_entry(
syncinfo_t* si,
Operation *op,
struct berval* syncCSN )
{
Backend *be = op->o_bd;
- slap_callback cb = { NULL };
+ slap_callback cb = { NULL, NULL, NULL, NULL };
struct berval *syncuuid_bv = NULL;
struct berval syncUUID_strrep = BER_BVNULL;
struct berval uuid_bv = BER_BVNULL;
op->o_tag = LDAP_REQ_MODIFY;
- assert( *modlist );
+ assert( *modlist != NULL );
/* Delete all the old attrs */
for ( i = 0; i < dni.attrs; i++ ) {
return;
}
-void
+static void
syncrepl_updateCookie(
syncinfo_t *si,
Operation *op,
return LDAP_SUCCESS;
}
-struct berval *
+static struct berval *
slap_uuidstr_from_normalized(
struct berval* uuidstr,
struct berval* normalized,
{
struct berval bc;
char buf[BUFSIZ*2], *ptr;
- int i, len;
+ int i;
bindconf_unparse( &si->si_bindconf, &bc );
ptr = buf;
int i, vals;
int index = 0, noindex = 0, renumber = 0, gotnvals = 0;
struct berval tmp;
- char *ptr;
if ( a->a_nvals && a->a_nvals != a->a_vals )
gotnvals = 1;
if ( indexes[0] != 0 || indexes[vals-1] != vals-1 ) {
renumber = 1;
}
+ ch_free( indexes );
} else {
renumber = 1;
}
Debug(LDAP_DEBUG_ANY, "slap_zn_free: "
"free object not found while bit is clear.\n",
0, 0, 0);
- assert(zo);
+ assert(zo != NULL);
}
} else {
Debug(LDAP_DEBUG_ANY, "slap_zn_free: "
"free object not found while bit is clear.\n",
0, 0, 0 );
- assert( zo );
+ assert(zo != NULL);
}
} else {
continue;
}
- assert( ldm );
+ assert( ldm != NULL );
/*
* We should have an attribute: value pair here.
}
#endif /* LDAP_DEBUG */
- assert( newrdn );
+ assert( newrdn != NULL );
/* Do the modrdn */
rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, newrdn, newsup, drdnflag );
}
{ /* set version 3 */
- int err, version = 3;
+ int err, version = LDAP_VERSION3;
err = ldap_set_option(ri->ri_ldp,
LDAP_OPT_PROTOCOL_VERSION, &version);
+#if 0
/*
* Find the first line which is not a "replica:" line in buf.
* Returns a pointer to the line. Returns NULL if there are
}
}
}
+#endif /* 0 */
telephoneNumber: +1 313 555 0895
# Using ldapsearch to retrieve all the entries...
-dn: ou=Add/Delete,dc=example,dc=com
+dn: ou=Add & Delete,dc=example,dc=com
objectClass: organizationalUnit
-ou: Add/Delete
+ou: Add & Delete
-dn: cn=Added by Bjorn (must succeed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (must succeed),ou=Add & Delete,dc=example,dc=com
objectClass: inetOrgPerson
cn: Added by Bjorn (must succeed)
sn: None
description: this attribute value has been added __after__entry creation
description: Bjorn will try to delete this attribute value (should fail)
-dn: cn=Added by Bjorn (renamed by Jaj),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (renamed by Jaj),ou=Add & Delete,dc=example,dc=com
objectClass: inetOrgPerson
sn: None
cn: Added by Bjorn (renamed by Jaj)
facsimileTelephoneNumber: +1 313 555 9700
telephoneNumber: +1 313 555 5331
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
# searching base="o=Example,c=US"...
dn: cn=Added Group,ou=Groups,o=Example,c=US
facsimileTelephoneNumber: +1 313 555 9700
telephoneNumber: +1 313 555 5331
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
# base="o=Example,c=US"...
dn: cn=Added Group,ou=Groups,o=Example,c=US
objectClass: referral
objectClass: extensibleObject
cn: Somewhere
-ref: ldap://:9010
+ref: ldap://localhost:9016
dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,o=Example,c=US
objectClass: OpenLDAPperson
dn: cn=Ursula Hampster,ou=Alumni Association,ou=People,o=Example,c=US
seeAlso: cn=All Staff,ou=Groups,o=Example,c=US
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
# searching filter="(uid=example)"
# attrs="uid"
# base="o=Example,c=US"...
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
# searching filter="(member=cn=Another Added Group,ou=Groups,o=Example,c=US)"
# attrs="member"
member: cn=Added Group,ou=Groups,o=Example,c=US
member: cn=Another Added Group,ou=Groups,o=Example,c=US
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
facsimileTelephoneNumber: +1 313 555 9700
telephoneNumber: +1 313 555 5331
-# refldap://:9010/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
+# refldap://localhost:9016/cn=Somewhere,ou=Meta,dc=example,dc=com??sub
pwdAttribute: 2.5.4.35
pwdLockoutDuration: 15
pwdInHistory: 6
-pwdCheckQuality: 1
+pwdCheckQuality: 2
pwdExpireWarning: 10
pwdMaxAge: 30
pwdMinLength: 5
telephoneNumber: +49 1234-567-890
description: Just added in o=Beispiel,c=DE naming context
-# refldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE??sub
+# refldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE??sub
dn: cn=Added Group,ou=Groups,o=Example,c=US
objectClass: groupOfNames
telephoneNumber: +49 1234-567-890
description: Just added in o=Beispiel,c=DE naming context
-# refldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE??sub
+# refldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE??sub
dn: cn=Added Group,ou=Groups,o=Esempio,c=IT
objectClass: groupOfUniqueNames
ou: Referrals
description: Just added as ldap://localhost.localdomain:389/ou=Referrals,o=Bei
spiel,c=DE
-description: ...and modified as ldap://localhost:9010/ou=Referrals,o=Beispiel,
+description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
c=DE
-ref: ldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE
+ref: ldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE
# base="o=Example,c=US"...
dn: ou=Referrals,o=Example,c=US
ou: Referrals
description: Just added as ldap://localhost.localdomain:389/ou=Referrals,o=Bei
spiel,c=DE
-description: ...and modified as ldap://localhost:9010/ou=Referrals,o=Beispiel,
+description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
c=DE
-ref: ldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE
+ref: ldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE
# base="o=Esempio,c=IT"...
dn: ou=Referrals,o=Esempio,c=IT
ou: Referrals
description: Just added as ldap://localhost.localdomain:389/ou=Referrals,o=Bei
spiel,c=DE
-description: ...and modified as ldap://localhost:9010/ou=Referrals,o=Beispiel,
+description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
c=DE
-ref: ldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE
+ref: ldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE
# searching filter="(seeAlso=cn=all staff,ou=Groups,o=Example,c=US)"
# attrs="seeAlso"
dn: cn=Added User,ou=Alumni Association,ou=People,o=Example,c=US
seeAlso: cn=All Staff,ou=Groups,o=Example,c=US
-# refldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE??sub
+# refldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE??sub
# searching filter="(uid=example)"
# attrs="uid"
dn: o=Example,c=US
uid: example
-# refldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE??sub
+# refldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE??sub
# searching filter="(member=cn=Another Added Group,ou=Groups,o=Example,c=US)"
# attrs="member"
# base="o=Example,c=US"...
-# refldap://localhost:9010/ou=Referrals,o=Beispiel,c=DE??sub
+# refldap://localhost:9012/ou=Referrals,o=Beispiel,c=DE??sub
dn: cn=Another Added Group,ou=Groups,o=Example,c=US
member: cn=Added Group,ou=Groups,o=Example,c=US
--- /dev/null
+# slapo-retcode standard track response codes configuration example
+# $Header$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+#
+# From "ldap.h", revised as per <draft-ietf-ldapbis-protocol>
+
+retcode-item "cn=success" 0x00
+
+retcode-item "cn=success w/ delay" 0x00 sleeptime=2
+
+retcode-item "cn=operationsError" 0x01
+retcode-item "cn=protocolError" 0x02
+retcode-item "cn=timeLimitExceeded" 0x03 op=search
+retcode-item "cn=sizeLimitExceeded" 0x04 op=search
+retcode-item "cn=compareFalse" 0x05 op=compare
+retcode-item "cn=compareTrue" 0x06 op=compare
+retcode-item "cn=authMethodNotSupported" 0x07
+retcode-item "cn=strongAuthNotSupported" 0x07 text="same as authMethodNotSupported"
+retcode-item "cn=strongAuthRequired" 0x08
+retcode-item "cn=strongerAuthRequired" 0x08 text="same as strongAuthRequired"
+#retcode-item "cn=partialResults" 0x09 "LDAPv2+ (not LDAPv3)"
+
+retcode-item "cn=referral" 0x0a text="LDAPv3"
+retcode-item "cn=adminLimitExceeded" 0x0b text="LDAPv3"
+retcode-item "cn=unavailableCriticalExtension" 0x0c text="LDAPv3"
+retcode-item "cn=confidentialityRequired" 0x0d text="LDAPv3"
+retcode-item "cn=saslBindInProgress" 0x0e text="LDAPv3"
+
+# LDAP_ATTR_ERROR(n) LDAP_RANGE((n),0x10,0x15) /* 16-21 */
+
+retcode-item "cn=noSuchAttribute" 0x10
+retcode-item "cn=undefinedAttributeType" 0x11
+retcode-item "cn=inappropriateMatching" 0x12
+retcode-item "cn=constraintViolation" 0x13
+retcode-item "cn=attributeOrValueExists" 0x14
+retcode-item "cn=invalidAttributeSyntax" 0x15
+
+# LDAP_NAME_ERROR(n) LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
+
+retcode-item "cn=noSuchObject" 0x20
+retcode-item "cn=aliasProblem" 0x21
+retcode-item "cn=invalidDNSyntax" 0x22
+#retcode-item "cn=isLeaf" 0x23 text="not LDAPv3"
+retcode-item "cn=aliasDereferencingProblem" 0x24
+
+# LDAP_SECURITY_ERROR(n) LDAP_RANGE((n),0x2F,0x32) /* 47-50 */
+
+retcode-item "cn=proxyAuthzFailure" 0x2F text="LDAPv3 proxy authorization"
+retcode-item "cn=inappropriateAuthentication" 0x30
+retcode-item "cn=invalidCredentials" 0x31
+retcode-item "cn=insufficientAccessRights" 0x32
+
+# LDAP_SERVICE_ERROR(n) LDAP_RANGE((n),0x33,0x36) /* 51-54 */
+
+retcode-item "cn=busy" 0x33
+retcode-item "cn=unavailable" 0x34
+retcode-item "cn=unwillingToPerform" 0x35
+retcode-item "cn=loopDetect" 0x36
+
+# LDAP_UPDATE_ERROR(n) LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
+
+retcode-item "cn=namingViolation" 0x40
+retcode-item "cn=objectClassViolation" 0x41
+retcode-item "cn=notAllowedOnNonleaf" 0x42
+retcode-item "cn=notAllowedOnRDN" 0x43
+retcode-item "cn=entryAlreadyExists" 0x44
+retcode-item "cn=objectClassModsProhibited" 0x45
+retcode-item "cn=resultsTooLarge" 0x46 text="CLDAP"
+retcode-item "cn=affectsMultipleDSAs" 0x47 text="LDAPv3"
+
+retcode-item "cn=other" 0x50
+
+# /* LCUP operation codes (113-117) - not implemented */
+retcode-item "cn=cupResourcesExhausted" 0x71
+retcode-item "cn=cupSecurityViolation" 0x72
+retcode-item "cn=cupInvalidData" 0x73
+retcode-item "cn=cupUnsupportedScheme" 0x74
+retcode-item "cn=cupReloadRequired" 0x75
+
+# /* Cancel operation codes (118-121) */
+retcode-item "cn=cancelled" 0x76
+retcode-item "cn=noSuchOperation" 0x77
+retcode-item "cn=tooLate" 0x78
+retcode-item "cn=cannotCancel" 0x79
+
+
+# /* Experimental result codes */
+# LDAP_E_ERROR(n) LDAP_RANGE((n),0x1000,0x3FFF) /* experimental */
+# LDAP_X_ERROR(n) LDAP_RANGE((n),0x4000,0xFFFF) /* private use */
+
+# /* for the LDAP Sync operation */
+retcode-item "cn=syncRefreshRequired" 0x4100
+
+# /* for the LDAP No-Op control */
+retcode-item "cn=noOperation" 0x410e
+
+# /* for the Assertion control */
+retcode-item "cn=assertionFailed" 0x410f
+
+# /* for the Chaining Behavior control (consecutive result codes requested;
+# * see <draft-sermersheim-ldap-chaining> ) */
+retcode-item "cn=noReferralsFound" 0x4110
+retcode-item "cn=cannotChain" 0x4111
+
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
#access to attr=objectclass dn.subtree="dc=example,dc=com"
access to attr=objectclass
access to filter="(name=X*Y*Z)"
by * continue
-access to dn.subtree="ou=Add/Delete,dc=example,dc=com"
+access to dn.subtree="ou=Add & Delete,dc=example,dc=com"
by dn.exact="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com" add
by dn.exact="cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com" delete
by dn.exact="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com" write
# fall into global ACLs
-#monitor#database monitor
+#monitor#database monitor
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.2.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
#
# uses the chain overlay as database specific;
chain-acl-authcDN "cn=Manager,dc=example,dc=com"
chain-acl-passwd secret
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
#bdb#index objectClass eq
+#hdb#index objectClass eq
+#ldbm#index objectClass eq
-#monitor#database monitor
+#monitor#database monitor
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
--- /dev/null
+# master slapd config -- for testing
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+include ./schema/core.schema
+include ./schema/cosine.schema
+include ./schema/inetorgperson.schema
+include ./schema/openldap.schema
+include ./schema/nis.schema
+include ./schema/ppolicy.schema
+pidfile ./test-db/slapd.m.pid
+argsfile ./test-db/slapd.m.args
+
+#mod#modulepath ../servers/slapd/back-@BACKEND@/
+#mod#moduleload back_@BACKEND@.la
+#relaymod#modulepath ../servers/slapd/back-relay/
+#relaymod#moduleload back_relay.la
+#ldapmod#modulepath ../servers/slapd/back-ldap/
+#ldapmod#moduleload back_ldap.la
+#metamod#modulepath ../servers/slapd/back-meta/
+#metamod#moduleload back_meta.la
+#monitormod#modulepath ../servers/slapd/back-monitor/
+#monitormod#moduleload back_monitor.la
+#rwmmod#modulepath ../servers/slapd/overlays/
+#rwmmod#moduleload rwm.la
+
+overlay rwm
+rwm-suffixmassage "o=Example,c=US" "dc=example,dc=com"
+
+#######################################################################
+# database definitions
+#######################################################################
+
+# remote
+database ldap
+suffix "ou=Meta,dc=example,dc=com"
+uri "@URI2@"
+rootdn "cn=Manager,dc=example,dc=com"
+chase-referrals no
+idassert-bind bindmethod=simple
+ binddn="cn=Manager,ou=Meta,dc=example,dc=com"
+ credentials="secret"
+ mode=none
+ flags=non-prescriptive
+idassert-authzfrom "dn.exact:cn=Manager,dc=example,dc=com"
+
+# local
+database ldap
+suffix "dc=example,dc=com"
+uri "@URI1@"
+rootdn "cn=Manager,dc=example,dc=com"
+rootpw secret
+chase-referrals no
+idassert-bind bindmethod=simple
+ binddn="cn=Manager,dc=example,dc=com"
+ credentials="secret"
+ mode=none
+ flags=non-prescriptive
+idassert-authzfrom "dn.exact:cn=Manager,dc=example,dc=com"
+
+
+overlay glue
+glue-sub "ou=Meta,dc=example,dc=com"
+
+#monitor#database monitor
suffix "ou=Information Technology Division,ou=People,dc=example,dc=com"
directory ./testrun/db.1.a
rootdn "cn=Manager 1,dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#bdb#index entryUUID,entryCSN pres
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
+#hdb#index entryUUID,entryCSN pres
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
-#bdb#index entryUUID,entryCSN pres
overlay syncprov
database @BACKEND@
suffix "ou=Groups,dc=example,dc=com"
directory ./testrun/db.1.b
rootdn "cn=Manager 1,dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#bdb#index entryUUID,entryCSN pres
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
+#hdb#index entryUUID,entryCSN pres
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
-#bdb#index entryUUID,entryCSN pres
syncrepl rid=1
provider=@URI2@
binddn="cn=Manager 2,dc=example,dc=com"
directory ./testrun/db.1.c
rootdn "cn=Manager 1,dc=example,dc=com"
rootpw secret
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
#overlay syncprov
overlay glue
glue-sub "ou=Information Technology Division,ou=People,dc=example,dc=com"
suffix "ou=Information Technology Division,ou=People,dc=example,dc=com"
directory ./testrun/db.2.a
rootdn "cn=Manager 2,dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#bdb#index entryUUID,entryCSN pres
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
+#hdb#index entryUUID,entryCSN pres
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
-#bdb#index entryUUID,entryCSN pres
syncrepl rid=2
provider=@URI1@
binddn="cn=Manager 1,dc=example,dc=com"
suffix "ou=Groups,dc=example,dc=com"
directory ./testrun/db.2.b
rootdn "cn=Manager 2,dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#bdb#index entryUUID,entryCSN pres
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
+#hdb#index entryUUID,entryCSN pres
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
-#bdb#index entryUUID,entryCSN pres
overlay syncprov
directory ./testrun/db.2.c
rootdn "cn=Manager 2,dc=example,dc=com"
rootpw secret
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
#overlay syncprov
overlay glue
glue-sub "ou=Information Technology Division,ou=People,dc=example,dc=com"
suffix "ou=Information Technology Division,ou=People,dc=example,dc=com"
directory ./testrun/db.1.a
rootdn "cn=Manager, dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
database @BACKEND@
suffix "ou=Groups,dc=example,dc=com"
directory ./testrun/db.1.b
rootdn "cn=Manager, dc=example,dc=com"
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
database @BACKEND@
suffix "dc=example,dc=com"
directory ./testrun/db.1.c
rootdn "cn=Manager, dc=example,dc=com"
rootpw secret
+#bdb#index objectclass eq
+#bdb#index uid pres,eq,sub
+#bdb#index cn,sn pres,eq,sub,subany
+#hdb#index objectclass eq
+#hdb#index uid pres,eq,sub
+#hdb#index cn,sn pres,eq,sub,subany
#ldbm#index objectclass eq
#ldbm#index uid pres,eq,sub
#ldbm#index cn,sn pres,eq,sub,subany
#ldbm#dbnosync
#ldbm#dbnolocking
-#bdb#index objectclass eq
-#bdb#index uid pres,eq,sub
-#bdb#index cn,sn pres,eq,sub,subany
overlay glue
-glue-sub "ou=Information Technology Division,ou=People,dc=example,dc=com"
-glue-sub "ou=Groups,dc=example,dc=com"
+glue-sub "ou=Information Technology Division,ou=People,dc=example,dc=com"
+glue-sub "ou=Groups,dc=example,dc=com"
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
access to dn.exact="cn=Proxy,ou=Admin,dc=example,dc=com"
attr=authzTo
directory ./testrun/db.2.a
rootdn "cn=Manager,dc=example,dc=it"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
database ldap
suffix "o=Example,c=US"
by dn.exact="cn=Sandbox,ou=Admin,dc=example,dc=com" search
by * none
-#monitor#database monitor
+#monitor#database monitor
uri "@URI2@"
# FIXME: doesn't work with authz=native
#sasl#idassert-bind bindmethod=sasl authcid=proxy credentials=proxy @SASL_MECH@ mode=self
-#nosasl#idassert-bind bindmethod=simple binddn"uid=proxy,ou=People,dc=example,dc=com" credentials=proxy mode=self
+#nosasl#idassert-bind bindmethod=simple binddn="uid=proxy,ou=People,dc=example,dc=com" credentials=proxy mode=self
# groups branch
database ldap
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
-overlay glue
-glue-sub ou=groups,dc=example,dc=com
-glue-sub ou=people,dc=example,dc=com
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
+overlay glue
+glue-sub "ou=groups,dc=example,dc=com"
+glue-sub "ou=people,dc=example,dc=com"
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.3.a
rootdn "cn=Manager,ou=Groups,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.2.a
rootdn "cn=Manager,ou=People,dc=example,dc=com"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
# Need quality indices on "uid" to check "unchecked" limits...
-#ldbm#index objectClass eq
-#ldbm#index uid eq
#bdb#index objectClass eq
#bdb#index uid eq
#hdb#index objectClass eq
#hdb#index uid eq
+#ldbm#index objectClass eq
+#ldbm#index uid eq
# Need extra limits for pagedResults on backends that support it...
#bdb#limits dn.exact="cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com" size=4 size.pr=unlimited
limits users size.soft=2
limits anonymous size.soft=1
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
#bdb#index objectClass eq
+#hdb#index objectClass eq
+#ldbm#index objectClass eq
-#monitor#database monitor
+#monitor#database monitor
rootdn "cn=Manager,o=Example,c=US"
rootpw secret
chase-referrals no
-#nretries forever
+nretries forever
#nretries 1000
# local
rootdn "cn=Manager,ou=Meta,dc=example,dc=com"
rootpw secret
#bdb#index objectClass eq
+#hdb#index objectClass eq
#ldbm#index objectClass eq
#monitor#database monitor
by self write
by * read
-#monitor#database monitor
+#monitor#database monitor
#bdb#cachesize 20
#hdb#cachesize 20
#ldbm#cachesize 20
-directory ./testrun/db.2.a
+directory ./testrun/db.2.a
#bdb#index objectClass eq
#bdb#index cn,sn,uid,mail pres,eq,sub
#hdb#index objectClass eq
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid,mail pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
by self write
by * read
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.2.a
rootdn "cn=Manager,o=University of Mich,c=US"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,c=us"
rootpw secret
-#ldbm#index objectClass eq
#bdb#index objectClass eq
+#hdb#index objectClass eq
+#ldbm#index objectClass eq
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,o=refint"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
overlay refint
refint_attributes manager secretary member
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-index objectClass eq
+#bdb#index objectClass eq
+#hdb#index objectClass eq
+#ldbm#index objectClass eq
database @RELAY@
suffix "o=Example,c=US"
#relay-meta#uri "@URI1@o=Beispiel,c=DE"
#relay-meta#suffixmassage "o=Beispiel,c=DE" "dc=example,dc=com"
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
replogfile ./testrun/slapd.1.replog
bindmethod=simple
credentials=secret
-#monitor#database monitor
+#monitor#database monitor
rootpw secret
updatedn "cn=Replica,dc=example,dc=com"
updateref @URI1@
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
#monitor#database monitor
--- /dev/null
+# stand-alone slapd config -- for testing (with indexing)
+# $Header$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+include ./schema/core.schema
+include ./schema/cosine.schema
+include ./schema/inetorgperson.schema
+include ./schema/openldap.schema
+include ./schema/nis.schema
+include ./testdata/test.schema
+
+#
+pidfile ./testrun/slapd.1.pid
+argsfile ./testrun/slapd.1.args
+
+#mod#modulepath ../servers/slapd/back-@BACKEND@/
+#mod#moduleload back_@BACKEND@.la
+#monitormod#modulepath ../servers/slapd/back-monitor/
+#monitormod#moduleload back_monitor.la
+#retcodemod#modulepath ../servers/slapd/overlays/
+#retcodemod#moduleload retcode.la
+
+#######################################################################
+# database definitions
+#######################################################################
+
+database @BACKEND@
+suffix "dc=example,dc=com"
+directory ./testrun/db.1.a
+rootdn "cn=Manager,dc=example,dc=com"
+rootpw secret
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
+
+overlay retcode
+retcode-parent "ou=RetCodes,dc=example,dc=com"
+include testdata/retcode.conf
+
+#monitor#database monitor
include ./schema/nis.schema
include ./schema/openldap.schema
#
+include ./schema/duaconf.schema
include ./schema/dyngroup.schema
include ./schema/ppolicy.schema
database @BACKEND@
suffix "o=OpenLDAP Project,l=Internet"
directory ./testrun/db.1.a
-#ldbm#index objectClass eq
#bdb#index objectClass eq
+#hdb#index objectClass eq
+#ldbm#index objectClass eq
#database @BACKEND@
#suffix "dc=example,dc=com"
#directory ./testrun/db.1.b
#index objectClass eq
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.1.a
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
#bdb#index entryUUID,entryCSN eq
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#hdb#index entryUUID,entryCSN eq
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
-overlay syncprov
+overlay syncprov
#syncprov-sessionlog 100
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.4.a
rootdn "cn=Replica,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
-syncrepl rid=1
- provider=@URI1@
- binddn="cn=Manager,dc=example,dc=com"
- bindmethod=simple
- credentials=secret
- searchbase="dc=example,dc=com"
- filter="(objectClass=*)"
- attrs="*,+"
- schemachecking=off
- scope=sub
- type=refreshAndPersist
+syncrepl rid=1
+ provider=@URI1@
+ binddn="cn=Manager,dc=example,dc=com"
+ bindmethod=simple
+ credentials=secret
+ searchbase="dc=example,dc=com"
+ filter="(objectClass=*)"
+ attrs="*,+"
+ schemachecking=off
+ scope=sub
+ type=refreshAndPersist
updateref @URI1@
-overlay syncprov
+overlay syncprov
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.5.a
rootdn "cn=Replica,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
#bdb#index entryUUID,entryCSN eq
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#hdb#index entryUUID,entryCSN eq
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
-syncrepl rid=1
- provider=@URI4@
- binddn="cn=Replica,dc=example,dc=com"
- bindmethod=simple
- credentials=secret
- searchbase="dc=example,dc=com"
- filter="(objectClass=*)"
- attrs="*"
- schemachecking=off
- scope=sub
- type=refreshAndPersist
+syncrepl rid=1
+ provider=@URI4@
+ binddn="cn=Replica,dc=example,dc=com"
+ bindmethod=simple
+ credentials=secret
+ searchbase="dc=example,dc=com"
+ filter="(objectClass=*)"
+ attrs="*"
+ schemachecking=off
+ scope=sub
+ type=refreshAndPersist
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.6.a
rootdn "cn=Replica,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
#bdb#index entryUUID,entryCSN eq
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#hdb#index entryUUID,entryCSN eq
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
-syncrepl rid=1
- provider=@URI1@
- binddn="cn=Manager,dc=example,dc=com"
- bindmethod=simple
- credentials=secret
- searchbase="dc=example,dc=com"
- filter="(objectClass=*)"
- attrs="*"
- schemachecking=off
- scope=sub
- type=refreshAndPersist
+syncrepl rid=1
+ provider=@URI1@
+ binddn="cn=Manager,dc=example,dc=com"
+ bindmethod=simple
+ credentials=secret
+ searchbase="dc=example,dc=com"
+ filter="(objectClass=*)"
+ attrs="*"
+ schemachecking=off
+ scope=sub
+ type=refreshAndPersist
-#monitor#database monitor
+#monitor#database monitor
directory ./testrun/db.2.a
rootdn "cn=Replica,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
-#ldbm#index entryUUID eq
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
#bdb#index entryUUID,entryCSN eq
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#hdb#index entryUUID,entryCSN eq
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
+#ldbm#index entryUUID eq
# Don't change syncrepl spec yet
-syncrepl rid=1
- provider=@URI1@
- binddn="cn=Manager,dc=example,dc=com"
- bindmethod=simple
- credentials=secret
- searchbase="dc=example,dc=com"
- filter="(objectClass=*)"
- attrs="*"
- schemachecking=off
- scope=sub
- type=refreshOnly
- interval=00:00:00:10
+syncrepl rid=1
+ provider=@URI1@
+ binddn="cn=Manager,dc=example,dc=com"
+ bindmethod=simple
+ credentials=secret
+ searchbase="dc=example,dc=com"
+ filter="(objectClass=*)"
+ attrs="*"
+ schemachecking=off
+ scope=sub
+ type=refreshOnly
+ interval=00:00:00:10
updateref @URI1@
-overlay syncprov
+overlay syncprov
syncprov-sessionlog 100
-
-
#monitor#database monitor
directory ./testrun/db.3.a
rootdn "cn=Replica,dc=example,dc=com"
rootpw secret
-#ldbm#index objectClass eq
-#ldbm#index cn,sn,uid pres,eq,sub
-#ldbm#index entryUUID eq
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
#bdb#index entryUUID,entryCSN eq
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#hdb#index entryUUID,entryCSN eq
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
+#ldbm#index entryUUID eq
# Don't change syncrepl spec yet
-syncrepl rid=1
- provider=@URI2@
- binddn="cn=Replica,dc=example,dc=com"
- bindmethod=simple
- credentials=secret
- searchbase="dc=example,dc=com"
- filter="(objectClass=*)"
- attrs="*"
- schemachecking=off
- scope=sub
- type=refreshOnly
- interval=00:00:00:10
+syncrepl rid=1
+ provider=@URI2@
+ binddn="cn=Replica,dc=example,dc=com"
+ bindmethod=simple
+ credentials=secret
+ searchbase="dc=example,dc=com"
+ filter="(objectClass=*)"
+ attrs="*"
+ schemachecking=off
+ scope=sub
+ type=refreshOnly
+ interval=00:00:00:10
-#monitor#database monitor
+#monitor#database monitor
#ldapmod#moduleload back_ldap.la
#translucentmod#modulepath ../servers/slapd/overlays
#translucentmod#moduleload translucent.la
+#monitormod#modulepath ../servers/slapd/back-monitor
+#monitormod#moduleload back_monitor.la
#######################################################################
# database definitions
directory ./testrun/db.2.a
rootdn "o=translucent"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
overlay translucent
translucent_no_glue
#mod#modulepath ../servers/slapd/back-@BACKEND@/:../servers/slapd/overlays
#mod#moduleload back_@BACKEND@.la
+#monitormod#modulepath ../servers/slapd/back-monitor
+#monitormod#moduleload back_monitor.la
#######################################################################
# database definitions
directory ./testrun/db.1.a
rootdn "o=translucent"
rootpw secret
-index objectClass eq
-index cn,sn,uid pres,eq,sub
+#bdb#index objectClass eq
+#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
+#ldbm#index objectClass eq
+#ldbm#index cn,sn,uid pres,eq,sub
unique_ignore o cn sn ou objectClass
unique_attributes employeeNumber
-#monitor#database monitor
+#monitor#database monitor
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
rootpw secret
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#hdb#index objectClass eq
+#hdb#index cn,sn,uid pres,eq,sub
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
index objectClass eq
index cn,sn,uid pres,eq,sub
-#monitor#database monitor
+#monitor#database monitor
--- /dev/null
+cn=James Jones 1,dc=example,dc=com
+objectClass: inetOrgPerson
+cn: James Jones 1
+givenName: James
+sn: Jones 1
+userpassword:: amFq
+telephoneNumber: +1 313 555 4772
+telephoneNumber: +1 313 555 4332
+telephoneNumber: +1 313 555 0895
--- /dev/null
+cn=James Jones 2,dc=example,dc=com
+objectClass: inetOrgPerson
+cn: James Jones 2
+givenName: James
+sn: Jones 2
+userpassword:: amFq
+telephoneNumber: +1 313 555 4772
+telephoneNumber: +1 313 555 3923
+telephoneNumber: +1 313 555 4332
+telephoneNumber: +1 313 555 0895
--- /dev/null
+cn=James Jones 3,dc=example,dc=com
+objectClass: inetOrgPerson
+cn: James Jones 3
+givenName: James
+sn: Jones 3
+userpassword:: amFq
+telephoneNumber: +1 313 555 4772
+telephoneNumber: +1 313 555 3923
+telephoneNumber: +1 313 555 4332
+telephoneNumber: +1 313 555 0895
--- /dev/null
+cn=James Jones 4,dc=example,dc=com
+objectClass: inetOrgPerson
+cn: James Jones 4
+givenName: James
+sn: Jones 4
+userpassword:: amFq
+telephoneNumber: +1 313 555 4772
+telephoneNumber: +1 313 555 3923
+telephoneNumber: +1 313 555 4332
+telephoneNumber: +1 313 555 0895
--- /dev/null
+cn=Mitya Kovalev,dc=example,dc=com
+cn=Torvlobnor Puzdoy,dc=example,dc=com
--- /dev/null
+documentTitle=book1,dc=example,dc=com
+dc=example,dc=com
+cn=Akakiy Zinberstein,dc=example,dc=com
+ou=Referral,dc=example,dc=com
--- /dev/null
+dc=example,dc=com
+cn=Mitya Kovalev
+cn=Akakiy Zinberstein,dc=example,dc=com
+sn=Zinberstein
+dc=example,dc=com
+cn=James*
+dc=example,dc=com
+sn=*
+dc=example,dc=com
+cn=*
+dc=example,dc=com
+cn=James*
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
documentIdentifier: document 2
-# refldap://localhost:9010/dc=example,dc=com??one
+# refldap://localhost:9012/dc=example,dc=com??one
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
documentIdentifier: document 2
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: dc=example,dc=com
objectClass: organization
objectClass: referral
objectClass: extensibleObject
ou: Referral
-ref: ldap://localhost:9010/
+ref: ldap://localhost:9012/
dn: dc=example,dc=com
objectClass: organization
# Testing invalid filter...
# Testing exact search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing substrings initial search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing substrings any search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing substrings final search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing approx search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing extensible filter search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing search for telephoneNumber...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
telephoneNumber: 332-2334
# Testing AND search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
dc: example
# Testing OR search...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
documentIdentifier: document 2
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: dc=example,dc=com
objectClass: organization
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
documentIdentifier: document 2
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
objectClass: inetOrgPerson
dc: example
# Testing hasSubordinates in filter...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: dc=example,dc=com
objectClass: organization
telephoneNumber: 332-2334
# Testing attribute inheritance in requested attributes...
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: cn=Mitya Kovalev,dc=example,dc=com
cn: Mitya Kovalev
dn: documentTitle=book2,dc=example,dc=com
objectClass: document
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: dc=example,dc=com
objectClass: organization
hasSubordinates: FALSE
entryUUID: 00000002-0000-0002-0000-000000000000
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
dn: dc=example,dc=com
structuralObjectClass: organization
givenName: Torvlobnor
telephoneNumber: 545-4563
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
# Using ldapsearch to retrieve all the entries...
dn: cn=Akakiy Zinberstein,dc=example,dc=com
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
documentIdentifier: document 3
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
# Using ldapsearch to retrieve all the entries...
dn: cn=Akakiy Zinberstein,dc=example,dc=com
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
documentIdentifier: document 3
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
# Using ldapsearch to retrieve all the entries...
dn: cn=Akakiy Zinberstein,dc=example,dc=com
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
documentIdentifier: document 3
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
# Using ldapsearch to retrieve all the entries...
dn: cn=Akakiy Zinberstein,dc=example,dc=com
documentAuthor: cn=Lev Tolstoij,dc=subnet,dc=example,dc=com
documentIdentifier: document 3
-# refldap://localhost:9010/dc=example,dc=com??sub
+# refldap://localhost:9012/dc=example,dc=com??sub
# Using ldapsearch to retrieve the modified entry...
dn: ou=Referral,dc=example,dc=com
objectClass: referral
objectClass: extensibleObject
cn: Somewhere
-ref: ldap://:9010
+ref: ldap://localhost:9016
struct ldapmod mod;
struct ldapmod *mods[2];
- char *values[2] = { value, NULL };
+ char *values[2];
pid = getpid();
+ values[0] = value;
+ values[1] = NULL;
mod.mod_op = LDAP_MOD_ADD;
mod.mod_type = attr;
mod.mod_values = values;
AC_pcache=pcache@BUILD_PROXYCACHE@
AC_ppolicy=ppolicy@BUILD_PPOLICY@
AC_refint=refint@BUILD_REFINT@
+AC_retcode=retcode@BUILD_RETCODE@
AC_translucent=translucent@BUILD_TRANSLUCENT@
AC_unique=unique@BUILD_UNIQUE@
AC_rwm=rwm@BUILD_RWM@
AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
export AC_bdb AC_hdb AC_ldap AC_ldbm AC_meta AC_monitor AC_relay AC_sql
-export AC_glue AC_pcache AC_ppolicy AC_refint AC_unique AC_rwm AC_syncprov
+export AC_glue AC_pcache AC_ppolicy AC_refint AC_retcode AC_rwm AC_unique AC_syncprov
export AC_translucent AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED
if test ! -x ../servers/slapd/slapd ; then
sed -e "s/@BACKEND@/${BACKEND}/" \
-e "s/^#${BACKEND}#//" \
-e "s/@RELAY@/${RELAY}/" \
- -e "s/^#relay-${RELAY}#//" \
+ -e "s/^#relay-${RELAY}#//" \
-e "s/^#${BACKENDTYPE}#//" \
- -e "s/^#${AC_glue}#//" \
-e "s/^#${AC_ldap}#//" \
-e "s/^#${AC_meta}#//" \
-e "s/^#${AC_relay}#//" \
-e "s/^#${AC_sql}#//" \
-e "s/^#${RDBMS}#//" \
+ -e "s/^#${AC_glue}#//" \
-e "s/^#${AC_pcache}#//" \
-e "s/^#${AC_ppolicy}#//" \
-e "s/^#${AC_refint}#//" \
+ -e "s/^#${AC_retcode}#//" \
+ -e "s/^#${AC_rwm}#//" \
-e "s/^#${AC_syncprov}#//" \
- -e "s/^#${AC_translucent}#//" \
+ -e "s/^#${AC_translucent}#//" \
-e "s/^#${AC_unique}#//" \
- -e "s/^#${AC_rwm}#//" \
-e "s/^#${MON}#//" \
-e "s/^#${MONMOD}#//" \
-e "s/^#${SASL}#//" \
- -e "s;@URI1@;${URI1};" \
- -e "s;@URI2@;${URI2};" \
- -e "s;@URI3@;${URI3};" \
- -e "s;@URI4@;${URI4};" \
- -e "s;@URI5@;${URI5};" \
- -e "s;@URI6@;${URI6};" \
- -e "s;@PORT1@;${PORT1};" \
- -e "s;@PORT2@;${PORT2};" \
- -e "s;@PORT3@;${PORT3};" \
- -e "s;@PORT4@;${PORT4};" \
- -e "s;@PORT5@;${PORT5};" \
- -e "s;@PORT6@;${PORT6};" \
- -e "s/@SASL_MECH@/${SASL_MECH}/" \
+ -e "s;@URI1@;${URI1};" \
+ -e "s;@URI2@;${URI2};" \
+ -e "s;@URI3@;${URI3};" \
+ -e "s;@URI4@;${URI4};" \
+ -e "s;@URI5@;${URI5};" \
+ -e "s;@URI6@;${URI6};" \
+ -e "s;@PORT1@;${PORT1};" \
+ -e "s;@PORT2@;${PORT2};" \
+ -e "s;@PORT3@;${PORT3};" \
+ -e "s;@PORT4@;${PORT4};" \
+ -e "s;@PORT5@;${PORT5};" \
+ -e "s;@PORT6@;${PORT6};" \
+ -e "s/@SASL_MECH@/${SASL_MECH}/" \
-e "s/@CACHETTL@/${CACHETTL}/" \
-e "s/@ENTRY_LIMIT@/${CACHE_ENTRY_LIMIT}/"
PROXYCACHE=${AC_pcache-pcacheno}
PPOLICY=${AC_ppolicy-ppolicyno}
REFINT=${AC_refint-refintno}
+RETCODE=${AC_retcode-retcodeno}
RWM=${AC_rwm-rwmno}
TRANSLUCENT=${AC_translucent-translucentno}
UNIQUE=${AC_unique-uniqueno}
DBDIR4=$TESTDIR/db.4.a
DBDIR5=$TESTDIR/db.5.a
DBDIR6=$TESTDIR/db.6.a
+SQLCONCURRENCYDIR=$DATADIR/sql-concurrency
CONF=$DATADIR/slapd.conf
CONFTWO=$DATADIR/slapd2.conf
SCHEMACONF=$DATADIR/slapd-schema.conf
GLUECONF=$DATADIR/slapd-glue.conf
REFINTCONF=$DATADIR/slapd-refint.conf
+RETCODECONF=$DATADIR/slapd-retcode.conf
UNIQUECONF=$DATADIR/slapd-unique.conf
LIMITSCONF=$DATADIR/slapd-limits.conf
DNCONF=$DATADIR/slapd-dn.conf
TRANSLUCENTREMOTECONF=$DATADIR/slapd-translucent-remote.conf
METACONF=$DATADIR/slapd-meta.conf
METACONF2=$DATADIR/slapd-meta2.conf
+GLUELDAPCONF=$DATADIR/slapd-glue-ldap.conf
CONF1=$TESTDIR/slapd.1.conf
CONF2=$TESTDIR/slapd.2.conf
BJORNSDN="cn=Bjorn Jensen,ou=Information Technology DivisioN,OU=People,dc=example,dc=com"
JAJDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
REFINTDN="cn=Manager,o=refint"
+RETCODEDN="ou=RetCodes,$BASEDN"
UNIQUEDN="cn=Manager,o=unique"
EMPTYDNDN="cn=Manager,c=US"
TRANSLUCENTROOT="o=translucent"
dn: ou=Referrals,$BASEDN
changetype: modify
replace: ref
-ref: ldap://localhost:9010/ou=Referrals,$BASEDN
+ref: ldap://localhost:9012/ou=Referrals,$BASEDN
-
add: description
-description: ...and modified as ldap://localhost:9010/ou=Referrals,$BASEDN
+description: ...and modified as ldap://localhost:9012/ou=Referrals,$BASEDN
-
EOMODS
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
+case "$BACKEND" in
+bdb|hdb|ldbm)
+ ;;
+*)
+ echo "Test does not support $BACKEND backend"
+ exit 0
+esac
+
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
$LDAPMODIFY -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
$TESTOUT 2>&1 << EOMODS7
-dn: ou=Add/Delete,dc=example,dc=com
+dn: ou=Add & Delete,dc=example,dc=com
changetype: add
objectClass: organizationalUnit
-ou: Add/Delete
+ou: Add & Delete
EOMODS7
$LDAPMODIFY -D "$BABSDN" -h $LOCALHOST -p $PORT1 -w bjensen >> \
$TESTOUT 2>&1 << EOMODS8
-dn: cn=Added by Babs (must fail),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Babs (must fail),ou=Add & Delete,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
cn: Added by Babs (must fail)
$LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT1 -w bjorn >> \
$TESTOUT 2>&1 << EOMODS9
-dn: cn=Added by Bjorn (must succeed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (must succeed),ou=Add & Delete,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
cn: Added by Bjorn (must succeed)
sn: None
-dn: cn=Added by Bjorn (will be deleted),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be deleted),ou=Add & Delete,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
cn: Added by Bjorn (will be deleted)
sn: None
-dn: cn=Added by Bjorn (will be renamed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be renamed),ou=Add & Delete,dc=example,dc=com
changetype: add
objectClass: inetOrgPerson
cn: Added by Bjorn (will be renamed)
sn: None
-dn: cn=Added by Bjorn (must succeed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (must succeed),ou=Add & Delete,dc=example,dc=com
changetype: modify
add: description
description: this attribute value has been added __after__entry creation
$LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT1 -w bjorn >> \
$TESTOUT 2>&1 << EOMODS10
-dn: cn=Added by Bjorn (will be deleted),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be deleted),ou=Add & Delete,dc=example,dc=com
changetype: delete
EOMODS10
$LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT1 -w bjorn >> \
$TESTOUT 2>&1 << EOMODS11
-dn: cn=Added by Bjorn (will be renamed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be renamed),ou=Add & Delete,dc=example,dc=com
changetype: modrdn
newrdn: cn=Added by Bjorn (renamed by Bjorn)
deleteoldrdn: 1
$LDAPMODIFY -D "$BABSDN" -h $LOCALHOST -p $PORT1 -w bjensen >> \
$TESTOUT 2>&1 << EOMODS12
-dn: cn=Added by Bjorn (will be renamed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be renamed),ou=Add & Delete,dc=example,dc=com
changetype: modrdn
newrdn: cn=Added by Bjorn (renamed by Babs)
deleteoldrdn: 1
$LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT1 -w jaj >> \
$TESTOUT 2>&1 << EOMODS13
-dn: cn=Added by Bjorn (will be renamed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be renamed),ou=Add & Delete,dc=example,dc=com
changetype: modrdn
newrdn: cn=Added by Bjorn (renamed by Jaj)
deleteoldrdn: 1
$LDAPMODIFY -D "$BJORNSDN" -h $LOCALHOST -p $PORT1 -w bjorn >> \
$TESTOUT 2>&1 << EOMODS14
-dn: cn=Added by Bjorn (must succeed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (must succeed),ou=Add & Delete,dc=example,dc=com
changetype: modify
delete: description
description: Bjorn will try to delete this attribute value (should fail)
$LDAPMODIFY -D "$BABSDN" -h $LOCALHOST -p $PORT1 -w bjensen >> \
$TESTOUT 2>&1 << EOMODS15
-dn: cn=Added by Bjorn (will be deleted),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (will be deleted),ou=Add & Delete,dc=example,dc=com
changetype: delete
-dn: cn=Added by Bjorn (must succeed),ou=Add/Delete,dc=example,dc=com
+dn: cn=Added by Bjorn (must succeed),ou=Add & Delete,dc=example,dc=com
changetype: modify
delete: description
description: this attribute value will be deleted by Babs (must succeed)
exit 0
fi
+if test "x$LVL" = "x0" ; then
+ echo "test020 needs a minimal log level; setting to LDAP_DEBUG_NONE..."
+ LVL=2048
+fi
+
mkdir -p $TESTDIR $DBDIR1 $DBDIR2
# Test proxy caching:
exit 1
fi
+echo "Testing hashed length requirement..."
+
+$LDAPMODIFY -h $LOCALHOST -p $PORT1 -D "$USER" -w failexpect > \
+ $TESTOUT 2>&1 << EOMODS
+dn: $USER
+changetype: modify
+delete: userPassword
+userPassword: failexpect
+-
+add: userPassword
+userPassword: {MD5}xxxxxx
+
+EOMODS
+RC=$?
+if test $RC = 0 ; then
+ echo "Hashed length requirement test failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+COUNT=`grep "Password fails quality" $TESTOUT | wc -l`
+if test $COUNT != 1 ; then
+ echo "Hashed length requirement test failed"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit 1
+fi
+
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo ">>>>> Test succeeded"
. $SRCDIR/scripts/defines.sh
if test $RWM = rwmno ; then
- echo "Rewrite/remap overlay not available, test skipped"
+ echo "rwm (Rewrite/remap) overlay not available, test skipped"
exit 0
fi
--- /dev/null
+#! /bin/sh
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
+if test $GLUE = glueno; then
+ echo "Backend glue overlay not available, test skipped"
+ exit 0
+fi
+
+mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
+
+echo "Running slapadd to build glued slapd databases..."
+. $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
+$SLAPADD -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
+RC=$?
+if test $RC != 0 ; then
+ echo "slapadd failed ($RC)!"
+ exit $RC
+fi
+
+mv $DBDIR1B $DBDIR2B
+mkdir $DBDIR2A $DBDIR1B
+cp -pr $DBDIR1C $DBDIR2C
+
+echo "Starting slapd 1 on TCP/IP port $PORT1..."
+. $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF1 > $CONF1
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID"
+
+echo "Using ldapsearch to check that slapd 1 is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
+ '(objectclass=*)' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+echo "Starting slapd 2 on TCP/IP port $PORT2..."
+. $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF2 > $CONF2
+$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$KILLPIDS $PID"
+
+echo "Using ldapsearch to check that slapd 2 is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
+ '(objectclass=*)' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+echo "Waiting 15 seconds for shadow subtrees to sync..."
+sleep 15
+
+for P in $PORT1 $PORT2 ; do
+ echo "Using ldapsearch to read all the entries from port $P..."
+ $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $P \
+ -S "" '(objectclass=*)' > $SEARCHOUT 2>&1
+ RC=$?
+
+ if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+ fi
+
+ echo "Filtering ldapsearch results..."
+ . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+ echo "Filtering original ldif used to create database..."
+ . $LDIFFILTER < $GLUESYNCOUT > $LDIFFLT
+ echo "Comparing filter output..."
+ $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+
+ if test $? != 0 ; then
+ echo "comparison failed - database was not created correctly"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit 1
+ fi
+done
+
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
+
+echo ">>>>> Test succeeded"
+exit 0
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
+mkdir -p $TESTDIR $DBDIR1
+
+echo "Running slapadd to build slapd database..."
+. $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
+$SLAPADD -f $CONF1 -l $LDIFORDERED
+RC=$?
+if test $RC != 0 ; then
+ echo "slapadd failed ($RC)!"
+ exit $RC
+fi
+
+echo "Starting slapd on TCP/IP port $PORT1..."
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID"
+
+echo "Testing slapd Manage operations..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+# ITS#3898: #ifndef LDAP_DEVEL, the control is not available
+MANAGEDITOID="1.3.6.1.4.1.4203.666.5.12"
+case `$LDAPSEARCH -s base -b "" -h $LOCALHOST -p $PORT1 \
+ '(supportedControl:objectIdentifierMatch:='${MANAGEDITOID}')' \
+ supportedControl | grep "supportedControl: ${MANAGEDITOID}"` in
+"supportedControl: ${MANAGEDITOID}")
+ ;;
+*)
+ echo "The \"manageDIT\" control appears to be unsupported; test disabled"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit 0
+ ;;
+esac
+
+echo "Testing modify, add, and delete..."
+$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
+ -e \!manageDIT > \
+ $TESTOUT 2>&1 << EOMODS
+version: 1
+#
+# Working Tests
+#
+
+#
+# ObjectClass tests
+#
+
+dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
+ dc=com
+# add obsolete auxiliary objectclass
+changetype: modify
+add: objectClass
+objectClass: obsoletePerson
+
+dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
+ dc=com
+# add obsolete attribute
+changetype: modify
+add: testObsolete
+testObsolete: TRUE
+
+#
+# create/modify timestamp test
+#
+
+dn: ou=Groups,dc=example,dc=com
+# change creatorsName
+changetype: modify
+replace: creatorsName
+creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
+
+dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
+# change modifiersName
+changetype: modify
+replace: modifiersName
+modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
+
+EOMODS
+
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapmodify failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Testing modify, add, and delete..."
+$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
+ -e \!manageDIT > \
+ $TESTOUT 2>&1 << EOMODS
+version: 1
+#
+# Non-working tests
+#
+
+dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
+ dc=com
+# update structural object class of entry via objectClass replace
+changetype: modify
+replace: objectClass
+objectClass: obsoletePerson
+-
+replace: structuralObjectClass
+structuralObjectClass: testPerson
+
+dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
+# update structural object class of entry via objectClass add
+changetype: modify
+add: objectClass
+objectClass: testPerson
+-
+replace: structuralObjectClass
+structuralObjectClass: testPerson
+
+dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
+# update structural object class of entry via objectClass delete/add
+changetype: modify
+delete: objectClass
+objectClass: OpenLDAPperson
+-
+add: objectClass
+objectClass: testPerson
+-
+delete: structuralObjectClass
+-
+add: structuralObjectClass
+structuralObjectClass: testPerson
+
+EOMODS
+
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapmodify failed ($RC)! IGNORED"
+# test $KILLSERVERS != no && kill -HUP $KILLPIDS
+# exit $RC
+fi
+
+echo "Using ldapsearch to retrieve all the entries..."
+$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
+ 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
+RC=$?
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ exit $RC
+fi
+
+LDIF=$MANAGEOUT
+
+echo "Filtering ldapsearch results..."
+. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+echo "Filtering original ldif used to create database..."
+. $LDIFFILTER < $LDIF > $LDIFFLT
+echo "Comparing filter output..."
+$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+
+if test $? != 0 ; then
+ echo "comparison failed - manage operations did not complete correctly"
+ exit 1
+fi
+
+echo ">>>>> Test succeeded"
+exit 0
--- /dev/null
+#! /bin/sh
+# $Header$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
+if test $RETCODE = retcodeno; then
+ echo "Retcode overlay not available, test skipped"
+ exit 0
+fi
+
+mkdir -p $TESTDIR $DBDIR1
+
+echo "Running slapadd to build slapd database..."
+. $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
+$SLAPADD -f $ADDCONF -l $LDIFORDERED
+RC=$?
+if test $RC != 0 ; then
+ echo "slapadd failed ($RC)!"
+ exit $RC
+fi
+
+echo "Running slapindex to index slapd database..."
+. $CONFFILTER $BACKEND $MONITORDB < $RETCODECONF > $CONF1
+$SLAPINDEX -f $CONF1
+RC=$?
+if test $RC != 0 ; then
+ echo "warning: slapindex failed ($RC)"
+ echo " assuming no indexing support"
+fi
+
+echo "Starting slapd on TCP/IP port $PORT1..."
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID"
+
+echo "Testing slapd searching..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
+ '(objectclass=*)' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Testing search for timelimitExceeded..."
+$LDAPSEARCH -b "cn=timelimitExceeded,ou=RetCodes,$BASEDN" \
+ -h $LOCALHOST -p $PORT1 '(objectClass=*)' >> $TESTOUT 2>&1
+RC=$?
+if test $RC != 3 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Testing modify for unwillingToPerform..."
+$LDAPMODIFY -D "$MANAGERDN" -w $PASSWD \
+ -h $LOCALHOST -p $PORT1 >> $TESTOUT 2>&1 << EOMODS
+dn: cn=unwillingToPerform,ou=RetCodes,$BASEDN
+changetype: delete
+EOMODS
+RC=$?
+if test $RC != 53 ; then
+ echo "ldapmodify failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Testing compare for success after sleep (2 s)..."
+$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
+ "cn=Success w/ Delay,ou=RetCodes,$BASEDN" "cn:foo" >> $TESTOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapcompare failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
+
+echo ">>>>> Test succeeded"
+exit 0
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2005 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
+echo ""
+
+if test $BACKLDAP = ldapno ; then
+ echo "ldap backend not available, test skipped"
+ exit 0
+fi
+
+if test $GLUE = "glueno" ; then
+ echo "glue overlay not available, test skipped"
+ exit 0
+fi
+
+if test $RWM = rwmno ; then
+ echo "rwm (rewrite/remap) overlay not available, test skipped"
+ exit 0
+fi
+
+rm -rf $TESTDIR
+
+mkdir -p $TESTDIR $DBDIR1 $DBDIR2
+
+echo "Starting slapd on TCP/IP port $PORT1..."
+. $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID"
+
+echo "Using ldapsearch to check that slapd is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Using ldapadd to populate the database..."
+$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
+ $LDIFORDERED > $TESTOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapadd failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Starting slapd on TCP/IP port $PORT2..."
+. $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
+$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$KILLPIDS $PID"
+
+echo "Using ldapsearch to check that slapd is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Using ldapadd to populate the database..."
+$LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
+ $LDIFMETA >> $TESTOUT 2>&1
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapadd failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Starting slapd on TCP/IP port $PORT3..."
+. $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
+$SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$KILLPIDS $PID"
+
+echo "Using ldapsearch to check that slapd is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+cat /dev/null > $SEARCHOUT
+
+mkdir -p $TESTDIR/$DATADIR
+METABASEDN="o=Example,c=US"
+for f in $DATADIR/do_* ; do
+ sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
+done
+
+# add a read that matches only the local database, but selects
+# also the remote as candidate; this should be removed to compare
+# execution times with test008...
+for f in $TESTDIR/$DATADIR/do_read.* ; do
+ echo "ou=Meta,$METABASEDN" >> $f
+done
+
+# add a read that matches a referral in the local database only,
+# but selects also the remote as candidate; this should be removed
+# to compare execution times with test008...
+for f in $TESTDIR/$DATADIR/do_read.* ; do
+ echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
+done
+
+echo "Using tester for concurrent server access..."
+$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
+RC=$?
+
+if test $RC != 0 ; then
+ echo "slapd-tester failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+echo "Using ldapsearch to retrieve all the entries..."
+$LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
+ '(objectClass=*)' > $SEARCHOUT 2>&1
+RC=$?
+
+test $KILLSERVERS != no && kill -HUP $KILLPIDS
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ exit $RC
+fi
+
+echo "Filtering ldapsearch results..."
+. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+echo "Filtering original ldif used to create database..."
+. $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
+echo "Comparing filter output..."
+$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+
+if test $? != 0 ; then
+ echo "comparison failed - meta search/modification didn't succeed"
+ exit 1
+fi
+
+echo ">>>>> Test succeeded"
+exit 0
+