Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • openldap/openldap
  • hyc/openldap
  • ryan/openldap
  • iboukris/openldap
  • ondra/openldap
  • sshanks-kx/openldap
  • blaggacao/openldap
  • pbrezina/openldap
  • quanah/openldap
  • dragos_h/openldap
  • lorenz/openldap
  • tsaarni/openldap
  • fei.ding/openldap
  • orent/openldap
  • arrowplum/openldap
  • barchiesi/openldap
  • jotik/openldap
  • hamano/openldap
  • ingovoss/openldap
  • henson/openldap
  • jlrine2/openldap
  • howeverAT/openldap
  • nivanova/openldap
  • orbea/openldap
  • rdubner/openldap
  • smckinney/openldap
  • jklowden/openldap
  • dpa-openldap/openldap
  • rouzier/openldap
  • orgads/openldap
  • ffontaine/openldap
  • jiaqingz/openldap
  • dcoutadeur/openldap
  • begeragus/openldap
  • pubellit/openldap
  • glandium/openldap
  • facboy/openldap
  • thesamesam/openldap
  • Johan/openldap
  • fkooman/openldap
  • gburd/openldap
  • h-homma/openldap
  • sgallagher/openldap
  • ahmed_zaki/openldap
  • gnoe/openldap
  • mid/openldap
  • clan/openldap
47 results
Show changes
Showing with 513 additions and 87 deletions
#! /bin/sh #! /bin/sh
## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
## ##
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# $OpenLDAP$ # $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
## ##
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
...@@ -44,23 +44,34 @@ echo Release: $RELNAME ...@@ -44,23 +44,34 @@ echo Release: $RELNAME
echo CVS Tag: $CVSTAG echo CVS Tag: $CVSTAG
echo Modules: $* echo Modules: $*
cvs -q export -r $CVSTAG -d $RELNAME $* cvs -q export -kkv -r $CVSTAG -d $RELNAME $*
if test ! -d $RELNAME ; then if test ! -d $RELNAME ; then
echo "error: $RELNAME doesn't exists" echo "error: $RELNAME doesn't exists"
exit 1 exit 1
fi fi
if test -e $RELNAME/doc/guide/admin/guide.sdf ; then
echo "build guide..."
( cd $RELNAME/doc/guide/admin ; make guide.html )
else
echo "No guide"
fi
if test ! -e $RELNAME/build/version.sh ; then if test ! -e $RELNAME/build/version.sh ; then
echo "No build version" echo "No build version"
exit 1 OL_STRING="something"
else
eval `$RELNAME/build/version.sh`
fi fi
eval `$RELNAME/build/version.sh` echo "Rolling up $OL_STRING ..."
tar cf $RELNAME.tar $RELNAME tar cf $RELNAME.tar $RELNAME
gzip -9 -c $RELNAME.tar > $RELNAME.tgz gzip -9 -c $RELNAME.tar > $RELNAME.tgz
md5 $RELNAME.tgz > $RELNAME.md5 md5 $RELNAME.tgz > $RELNAME.md5
sha1 $RELNAME.tgz > $RELNAME.sha1
rm -f $RELNAME.tar rm -f $RELNAME.tar
ls -l $RELNAME.* ls -l $RELNAME.*
......
:: $OpenLDAP$ :: $OpenLDAP$
:: This work is part of OpenLDAP Software <http://www.openldap.org/>. :: This work is part of OpenLDAP Software <http://www.openldap.org/>.
:: ::
:: Copyright 1998-2004 The OpenLDAP Foundation. :: Copyright 1998-2005 The OpenLDAP Foundation.
:: All rights reserved. :: All rights reserved.
:: ::
:: Redistribution and use in source and binary forms, with or without :: Redistribution and use in source and binary forms, with or without
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# $OpenLDAP$ # $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
## ##
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
...@@ -55,7 +55,7 @@ WHOWHERE="$USER@`uname -n`:`pwd`" ...@@ -55,7 +55,7 @@ WHOWHERE="$USER@`uname -n`:`pwd`"
cat << __EOF__ cat << __EOF__
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -68,7 +68,7 @@ cat << __EOF__ ...@@ -68,7 +68,7 @@ cat << __EOF__
*/ */
static const char copyright[] = static const char copyright[] =
"Copyright 1998-2004 The OpenLDAP Foundation. All rights reserved.\n" "Copyright 1998-2005 The OpenLDAP Foundation. All rights reserved.\n"
"COPYING RESTRICTIONS APPLY\n"; "COPYING RESTRICTIONS APPLY\n";
$static $const char $SYMBOL[] = $static $const char $SYMBOL[] =
......
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
...@@ -2,7 +2,7 @@ dnl OpenLDAP Autoconf Macros ...@@ -2,7 +2,7 @@ dnl OpenLDAP Autoconf Macros
dnl $OpenLDAP$ dnl $OpenLDAP$
dnl This work is part of OpenLDAP Software <http://www.openldap.org/>. dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
dnl dnl
dnl Copyright 1998-2004 The OpenLDAP Foundation. dnl Copyright 1998-2005 The OpenLDAP Foundation.
dnl All rights reserved. dnl All rights reserved.
dnl dnl
dnl Redistribution and use in source and binary forms, with or without dnl Redistribution and use in source and binary forms, with or without
...@@ -247,6 +247,75 @@ fi ...@@ -247,6 +247,75 @@ fi
]) ])
dnl dnl
dnl ==================================================================== dnl ====================================================================
dnl DNS resolver macros
AC_DEFUN([OL_RESOLVER_TRY],
[if test $ol_cv_lib_resolver = no ; then
AC_CACHE_CHECK([for resolver link (]ifelse($2,,default,$2)[)],[$1],
[
ol_RESOLVER_LIB=ifelse($2,,,$2)
ol_LIBS=$LIBS
LIBS="$ol_RESOLVER_LIB $LIBS"
AC_TRY_LINK([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <netinet/in.h>
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
],[{
int len, status;
char *request = NULL;
unsigned char reply[64*1024];
unsigned char host[64*1024];
unsigned char *p;
#ifdef NS_HFIXEDSZ
/* Bind 8/9 interface */
len = res_query(request, ns_c_in, ns_t_srv, reply, sizeof(reply));
#else
/* Bind 4 interface */
# ifndef T_SRV
# define T_SRV 33
# endif
len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
#endif
p = reply;
#ifdef NS_HFIXEDSZ
/* Bind 8/9 interface */
p += NS_HFIXEDSZ;
#elif defined(HFIXEDSZ)
/* Bind 4 interface w/ HFIXEDSZ */
p += HFIXEDSZ;
#else
/* Bind 4 interface w/o HFIXEDSZ */
p += sizeof(HEADER);
#endif
status = dn_expand( reply, reply+len, p, host, sizeof(host));
}],[$1=yes],[$1=no])
LIBS="$ol_LIBS"
])
if test $$1 = yes ; then
ol_cv_lib_resolver=ifelse($2,,yes,$2)
fi
fi
])
dnl --------------------------------------------------------------------
dnl Try to locate appropriate library
AC_DEFUN([OL_RESOLVER_LINK],
[ol_cv_lib_resolver=no
OL_RESOLVER_TRY(ol_cv_resolver_none)
OL_RESOLVER_TRY(ol_cv_resolver_resolv,[-lresolv])
OL_RESOLVER_TRY(ol_cv_resolver_bind,[-lbind])
])
dnl
dnl ====================================================================
dnl Berkeley DB macros dnl Berkeley DB macros
dnl dnl
dnl -------------------------------------------------------------------- dnl --------------------------------------------------------------------
...@@ -368,7 +437,10 @@ main() ...@@ -368,7 +437,10 @@ main()
version = db_version( &major, &minor, &patch ); version = db_version( &major, &minor, &patch );
if( major != DB_VERSION_MAJOR || minor < DB_VERSION_MINOR ) { if( major != DB_VERSION_MAJOR ||
minor != DB_VERSION_MINOR ||
patch != DB_VERSION_PATCH )
{
printf("Berkeley DB version mismatch\n" printf("Berkeley DB version mismatch\n"
"\theader: %s\n\tlibrary: %s\n", "\theader: %s\n\tlibrary: %s\n",
DB_VERSION_STRING, version); DB_VERSION_STRING, version);
...@@ -1331,6 +1403,19 @@ AC_DEFUN(OL_MSGHDR_MSG_ACCRIGHTS, ...@@ -1331,6 +1403,19 @@ AC_DEFUN(OL_MSGHDR_MSG_ACCRIGHTS,
[define if struct msghdr has msg_accrights]) [define if struct msghdr has msg_accrights])
fi fi
])dnl ])dnl
dnl ====================================================================
dnl check for cmsghdr
AC_DEFUN(OL_MSGHDR_MSG_CONTROL,
[AC_CACHE_CHECK(for msg_control in msghdr, ol_cv_msghdr_msg_control,
[AC_TRY_COMPILE([#include <sys/socket.h>],
[struct msghdr m; m.msg_control=(struct cmsghdr *)0],
ol_cv_msghdr_msg_control=yes, ol_cv_msghdr_msg_control=no)
])
if test $ol_cv_msghdr_msg_control = "yes" ; then
AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL,1,
[define if struct msghdr has msg_control])
fi
])dnl
AC_DEFUN([OL_SSL_COMPAT], AC_DEFUN([OL_SSL_COMPAT],
[AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)], [ol_cv_ssl_crl_compat],[ [AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)], [ol_cv_ssl_crl_compat],[
AC_EGREP_CPP(__ssl_compat,[ AC_EGREP_CPP(__ssl_compat,[
......
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
...@@ -56,6 +58,8 @@ INSTALL_PROGRAM = $(INSTALL) ...@@ -56,6 +58,8 @@ INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DATA = $(INSTALL) -m 644
INSTALL_SCRIPT = $(INSTALL) INSTALL_SCRIPT = $(INSTALL)
STRIP = -s
LINT = lint LINT = lint
5LINT = 5lint 5LINT = 5lint
...@@ -66,7 +70,8 @@ MKDEP_CFLAGS = @OL_MKDEP_FLAGS@ ...@@ -66,7 +70,8 @@ MKDEP_CFLAGS = @OL_MKDEP_FLAGS@
MKVERSION = $(top_srcdir)/build/mkversion -v "$(VERSION)" MKVERSION = $(top_srcdir)/build/mkversion -v "$(VERSION)"
LIBTOOL = @LIBTOOL@ # libtool 1.5+ requires "--tag=CC", but leave it off until we migrate
LIBTOOL = @LIBTOOL@ # --tag=CC
LIBRELEASE = @OPENLDAP_LIBRELEASE@ LIBRELEASE = @OPENLDAP_LIBRELEASE@
LIBVERSION = @OPENLDAP_LIBVERSION@ LIBVERSION = @OPENLDAP_LIBVERSION@
LTVERSION = -release $(LIBRELEASE) -version-info $(LIBVERSION) LTVERSION = -release $(LIBRELEASE) -version-info $(LIBVERSION)
...@@ -77,9 +82,9 @@ LTONLY_LIB = $(@PLAT@_LTONLY_LIB) ...@@ -77,9 +82,9 @@ LTONLY_LIB = $(@PLAT@_LTONLY_LIB)
# libtool --only flag for modules: depends on linkage of module # libtool --only flag for modules: depends on linkage of module
# The BUILD_MOD macro is defined in each backend Makefile.in file # The BUILD_MOD macro is defined in each backend Makefile.in file
LTONLY_yes = static LTONLY_yes = --tag=disable-shared
LTONLY_mod = shared LTONLY_mod = --tag=disable-static
LTONLY_MOD = # --only-$(BUILD_MOD) LTONLY_MOD = $(LTONLY_$(BUILD_MOD))
# platform-specific libtool flags # platform-specific libtool flags
NT_LTFLAGS_LIB = -no-undefined -avoid-version -rpath $(libdir) NT_LTFLAGS_LIB = -no-undefined -avoid-version -rpath $(libdir)
...@@ -157,7 +162,7 @@ LDAP_LIBLBER_LA = $(LDAP_LIBDIR)/liblber/liblber.la ...@@ -157,7 +162,7 @@ LDAP_LIBLBER_LA = $(LDAP_LIBDIR)/liblber/liblber.la
LDAP_LIBLDAP_LA = $(LDAP_LIBDIR)/libldap/libldap.la LDAP_LIBLDAP_LA = $(LDAP_LIBDIR)/libldap/libldap.la
LDAP_LIBLDAP_R_LA = $(LDAP_LIBDIR)/libldap_r/libldap_r.la LDAP_LIBLDAP_R_LA = $(LDAP_LIBDIR)/libldap_r/libldap_r.la
LDAP_LIBREWRITE_A = $(LDAP_LIBDIR)/librewrite/librewrite.a LDAP_LIBLREWRITE_LA = $(LDAP_LIBDIR)/librewrite/liblrewrite.la
LDAP_LIBLUNICODE_A = $(LDAP_LIBDIR)/liblunicode/liblunicode.a LDAP_LIBLUNICODE_A = $(LDAP_LIBDIR)/liblunicode/liblunicode.a
LDAP_LIBLUTIL_A = $(LDAP_LIBDIR)/liblutil/liblutil.a LDAP_LIBLUTIL_A = $(LDAP_LIBDIR)/liblutil/liblutil.a
...@@ -165,7 +170,7 @@ LDAP_L = $(LDAP_LIBLUTIL_A) \ ...@@ -165,7 +170,7 @@ LDAP_L = $(LDAP_LIBLUTIL_A) \
$(LDAP_LIBLDAP_LA) $(LDAP_LIBLBER_LA) $(LDAP_LIBLDAP_LA) $(LDAP_LIBLBER_LA)
SLURPD_L = $(LDAP_LIBLUTIL_A) \ SLURPD_L = $(LDAP_LIBLUTIL_A) \
$(LDAP_LIBLDAP_R_LA) $(LDAP_LIBLBER_LA) $(LDAP_LIBLDAP_R_LA) $(LDAP_LIBLBER_LA)
SLAPD_L = $(LDAP_LIBLUNICODE_A) $(LDAP_LIBREWRITE_A) \ SLAPD_L = $(LDAP_LIBLUNICODE_A) $(LDAP_LIBLREWRITE_LA) \
$(SLURPD_L) $(SLURPD_L)
WRAP_LIBS = @WRAP_LIBS@ WRAP_LIBS = @WRAP_LIBS@
......
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -13,6 +13,6 @@ ...@@ -13,6 +13,6 @@
*/ */
static const char copyright[] = static const char copyright[] =
"Copyright 1998-2004 The OpenLDAP Foundation. All rights reserved.\n" "Copyright 1998-2005 The OpenLDAP Foundation. All rights reserved.\n"
"COPYING RESTRICTIONS APPLY.\n"; "COPYING RESTRICTIONS APPLY.\n";
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# $OpenLDAP$ # $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
## ##
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# $OpenLDAP$ # $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>. ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
## ##
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
## <http://www.OpenLDAP.org/license.html>. ## <http://www.OpenLDAP.org/license.html>.
ol_package=OpenLDAP ol_package=OpenLDAP
ol_major=2 ol_major=2
ol_minor=X ol_minor=3
ol_patch=X ol_patch=4
ol_api_inc=000000 ol_api_inc=20304
ol_api_current=0 ol_api_current=0
ol_api_revision=0 ol_api_revision=4
ol_api_age=0 ol_api_age=0
ol_release_date="00/00/0000" ol_release_date="2005/06/10"
# Clients Makefile.in for OpenLDAP # Clients Makefile.in for OpenLDAP
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
......
# Makefile for LDAP tools # Makefile for LDAP tools
# $OpenLDAP$ # $OpenLDAP$
## Copyright 1998-2004 The OpenLDAP Foundation. ## Copyright 1998-2005 The OpenLDAP Foundation.
## All rights reserved. ## All rights reserved.
## ##
## Redistribution and use in source and binary forms, with or without ## Redistribution and use in source and binary forms, with or without
...@@ -98,10 +98,10 @@ install-local: FORCE ...@@ -98,10 +98,10 @@ install-local: FORCE
-$(MKDIR) $(DESTDIR)$(bindir) -$(MKDIR) $(DESTDIR)$(bindir)
@( \ @( \
for prg in $(PROGRAMS); do \ for prg in $(PROGRAMS); do \
$(LTINSTALL) $(INSTALLFLAGS) -s -m 755 $$prg$(EXEEXT) \ $(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 $$prg$(EXEEXT) \
$(DESTDIR)$(bindir); \ $(DESTDIR)$(bindir); \
done \ done \
) )
$(RM) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT) $(RM) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
$(LN) $(DESTDIR)$(bindir)/ldapmodify$(EXEEXT) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT) $(LN_S) $(DESTDIR)$(bindir)/ldapmodify$(EXEEXT) $(DESTDIR)$(bindir)/ldapadd$(EXEEXT)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 2003 Kurt D. Zeilenga. * Portions Copyright 2003 Kurt D. Zeilenga.
* Portions Copyright 2003 IBM Corporation. * Portions Copyright 2003 IBM Corporation.
* All rights reserved. * All rights reserved.
...@@ -63,6 +63,7 @@ int use_tls = 0; ...@@ -63,6 +63,7 @@ int use_tls = 0;
int assertctl; int assertctl;
char *assertion = NULL; char *assertion = NULL;
char *authzid = NULL; char *authzid = NULL;
int manageDIT = 0;
int manageDSAit = 0; int manageDSAit = 0;
int noop = 0; int noop = 0;
int ppolicy = 0; int ppolicy = 0;
...@@ -80,6 +81,21 @@ int protocol = -1; ...@@ -80,6 +81,21 @@ int protocol = -1;
int verbose = 0; int verbose = 0;
int version = 0; int version = 0;
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
int chaining = 0;
static int chainingResolve = -1;
static int chainingContinuation = -1;
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
static int gotintr;
static int abcan;
RETSIGTYPE
do_sig( int sig )
{
gotintr = abcan;
}
/* Set in main() */ /* Set in main() */
char *prog = NULL; char *prog = NULL;
...@@ -91,6 +107,17 @@ tool_init( void ) ...@@ -91,6 +107,17 @@ tool_init( void )
ldap_pvt_textdomain(OPENLDAP_PACKAGE); ldap_pvt_textdomain(OPENLDAP_PACKAGE);
} }
void
tool_destroy( void )
{
#ifdef HAVE_CYRUS_SASL
sasl_done();
#endif
#ifdef HAVE_TLS
ldap_pvt_tls_destroy();
#endif
}
void void
tool_common_usage( void ) tool_common_usage( void )
{ {
...@@ -102,6 +129,14 @@ N_(" -D binddn bind DN\n"), ...@@ -102,6 +129,14 @@ N_(" -D binddn bind DN\n"),
N_(" -e [!]<ext>[=<extparam>] general extensions (! indicates criticality)\n") N_(" -e [!]<ext>[=<extparam>] general extensions (! indicates criticality)\n")
N_(" [!]assert=<filter> (an RFC 2254 Filter)\n") N_(" [!]assert=<filter> (an RFC 2254 Filter)\n")
N_(" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n") N_(" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n")
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
N_(" [!]chaining[=<resolveBehavior>[/<continuationBehavior>]]\n")
N_(" one of \"chainingPreferred\", \"chainingRequired\",\n")
N_(" \"referralsPreferred\", \"referralsRequired\"\n")
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
#ifdef LDAP_DEVEL
N_(" [!]manageDIT\n")
#endif
N_(" [!]manageDSAit\n") N_(" [!]manageDSAit\n")
N_(" [!]noop\n") N_(" [!]noop\n")
#ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
...@@ -109,6 +144,7 @@ N_(" ppolicy\n") ...@@ -109,6 +144,7 @@ N_(" ppolicy\n")
#endif #endif
N_(" [!]postread[=<attrs>] (a comma-separated attribute list)\n") N_(" [!]postread[=<attrs>] (a comma-separated attribute list)\n")
N_(" [!]preread[=<attrs>] (a comma-separated attribute list)\n"), N_(" [!]preread[=<attrs>] (a comma-separated attribute list)\n"),
N_(" abandon, cancel (SIGINT sends abandon/cancel; not really controls)\n")
N_(" -f file read operations from `file'\n"), N_(" -f file read operations from `file'\n"),
N_(" -h host LDAP server\n"), N_(" -h host LDAP server\n"),
N_(" -H URI LDAP Uniform Resource Indentifier(s)\n"), N_(" -H URI LDAP Uniform Resource Indentifier(s)\n"),
...@@ -224,6 +260,20 @@ tool_args( int argc, char **argv ) ...@@ -224,6 +260,20 @@ tool_args( int argc, char **argv )
assert( authzid == NULL ); assert( authzid == NULL );
authzid = cvalue; authzid = cvalue;
} else if ( strcasecmp( control, "manageDIT" ) == 0 ) {
if( manageDIT ) {
fprintf( stderr,
"manageDIT control previously specified\n");
exit( EXIT_FAILURE );
}
if( cvalue != NULL ) {
fprintf( stderr,
"manageDIT: no control value expected\n" );
usage();
}
manageDIT = 1 + crit;
} else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
if( manageDSAit ) { if( manageDSAit ) {
fprintf( stderr, fprintf( stderr,
...@@ -286,6 +336,59 @@ tool_args( int argc, char **argv ) ...@@ -286,6 +336,59 @@ tool_args( int argc, char **argv )
postread = 1 + crit; postread = 1 + crit;
postread_attrs = cvalue; postread_attrs = cvalue;
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
} else if ( strcasecmp( control, "chaining" ) == 0 ) {
chaining = 1 + crit;
if ( cvalue != NULL ) {
char *continuation;
continuation = strchr( cvalue, '/' );
if ( continuation ) {
/* FIXME: this makes sense only in searches */
*continuation++ = '\0';
if ( strcasecmp( continuation, "chainingPreferred" ) == 0 ) {
chainingContinuation = LDAP_CHAINING_PREFERRED;
} else if ( strcasecmp( continuation, "chainingRequired" ) == 0 ) {
chainingContinuation = LDAP_CHAINING_REQUIRED;
} else if ( strcasecmp( continuation, "referralsPreferred" ) == 0 ) {
chainingContinuation = LDAP_REFERRALS_PREFERRED;
} else if ( strcasecmp( continuation, "referralsRequired" ) == 0 ) {
chainingContinuation = LDAP_REFERRALS_REQUIRED;
} else {
fprintf( stderr,
"chaining behavior control "
"continuation value \"%s\" invalid\n",
continuation );
exit( EXIT_FAILURE );
}
}
if ( strcasecmp( cvalue, "chainingPreferred" ) == 0 ) {
chainingResolve = LDAP_CHAINING_PREFERRED;
} else if ( strcasecmp( cvalue, "chainingRequired" ) == 0 ) {
chainingResolve = LDAP_CHAINING_REQUIRED;
} else if ( strcasecmp( cvalue, "referralsPreferred" ) == 0 ) {
chainingResolve = LDAP_REFERRALS_PREFERRED;
} else if ( strcasecmp( cvalue, "referralsRequired" ) == 0 ) {
chainingResolve = LDAP_REFERRALS_REQUIRED;
} else {
fprintf( stderr,
"chaining behavior control "
"resolve value \"%s\" invalid\n",
cvalue);
exit( EXIT_FAILURE );
}
}
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
/* this shouldn't go here, really; but it's a feature... */
} else if ( strcasecmp( control, "abandon" ) == 0 ) {
abcan = LDAP_REQ_ABANDON;
} else if ( strcasecmp( control, "cancel" ) == 0 ) {
abcan = LDAP_REQ_EXTENDED;
} else { } else {
fprintf( stderr, "Invalid general control name: %s\n", fprintf( stderr, "Invalid general control name: %s\n",
control ); control );
...@@ -574,28 +677,28 @@ tool_args( int argc, char **argv ) ...@@ -574,28 +677,28 @@ tool_args( int argc, char **argv )
if (api.ldapai_info_version != LDAP_API_INFO_VERSION) { if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
fprintf( stderr, "LDAP APIInfo version mismatch: " fprintf( stderr, "LDAP APIInfo version mismatch: "
"got %d, expected %d\n", "library %d, header %d\n",
api.ldapai_info_version, LDAP_API_INFO_VERSION ); api.ldapai_info_version, LDAP_API_INFO_VERSION );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
if( api.ldapai_api_version != LDAP_API_VERSION ) { if( api.ldapai_api_version != LDAP_API_VERSION ) {
fprintf( stderr, "LDAP API version mismatch: " fprintf( stderr, "LDAP API version mismatch: "
"got %d, expected %d\n", "library %d, header %d\n",
api.ldapai_api_version, LDAP_API_VERSION ); api.ldapai_api_version, LDAP_API_VERSION );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
if( strcmp(api.ldapai_vendor_name, LDAP_VENDOR_NAME ) != 0 ) { if( strcmp(api.ldapai_vendor_name, LDAP_VENDOR_NAME ) != 0 ) {
fprintf( stderr, "LDAP vendor name mismatch: " fprintf( stderr, "LDAP vendor name mismatch: "
"got %s, expected %s\n", "library %s, header %s\n",
api.ldapai_vendor_name, LDAP_VENDOR_NAME ); api.ldapai_vendor_name, LDAP_VENDOR_NAME );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
if( api.ldapai_vendor_version != LDAP_VENDOR_VERSION ) { if( api.ldapai_vendor_version != LDAP_VENDOR_VERSION ) {
fprintf( stderr, "LDAP vendor version mismatch: " fprintf( stderr, "LDAP vendor version mismatch: "
"got %d, expected %d\n", "library %d, header %d\n",
api.ldapai_vendor_version, LDAP_VENDOR_VERSION ); api.ldapai_vendor_version, LDAP_VENDOR_VERSION );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
...@@ -635,7 +738,12 @@ tool_args( int argc, char **argv ) ...@@ -635,7 +738,12 @@ tool_args( int argc, char **argv )
} }
} }
if( protocol == LDAP_VERSION2 ) { if( protocol == LDAP_VERSION2 ) {
if( authzid || manageDSAit || noop || ppolicy ) { if( assertctl || authzid || manageDIT || manageDSAit ||
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
chaining ||
#endif
noop || ppolicy || preread || postread )
{
fprintf( stderr, "%s: -e/-M incompatible with LDAPv2\n", prog ); fprintf( stderr, "%s: -e/-M incompatible with LDAPv2\n", prog );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
...@@ -688,6 +796,10 @@ tool_conn_setup( int not, void (*private_setup)( LDAP * ) ) ...@@ -688,6 +796,10 @@ tool_conn_setup( int not, void (*private_setup)( LDAP * ) )
(void) SIGNAL( SIGPIPE, SIG_IGN ); (void) SIGNAL( SIGPIPE, SIG_IGN );
#endif #endif
if ( abcan ) {
SIGNAL( SIGINT, do_sig );
}
if ( !not ) { if ( !not ) {
int rc; int rc;
...@@ -861,13 +973,25 @@ tool_bind( LDAP *ld ) ...@@ -861,13 +973,25 @@ tool_bind( LDAP *ld )
} }
} }
void
tool_unbind( LDAP *ld )
{
int err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, NULL );
if ( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not unset controls\n");
}
(void) ldap_unbind_ext( ld, NULL, NULL );
}
/* Set server controls. Add controls extra_c[0..count-1], if set. */ /* Set server controls. Add controls extra_c[0..count-1], if set. */
void void
tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
{ {
int i = 0, j, crit = 0, err; int i = 0, j, crit = 0, err;
LDAPControl c[8], **ctrls; LDAPControl c[10], **ctrls;
ctrls = (LDAPControl**) malloc(sizeof(c) + (count+1)*sizeof(LDAPControl*)); ctrls = (LDAPControl**) malloc(sizeof(c) + (count+1)*sizeof(LDAPControl*));
if ( ctrls == NULL ) { if ( ctrls == NULL ) {
...@@ -913,10 +1037,17 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) ...@@ -913,10 +1037,17 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
i++; i++;
} }
if ( manageDIT ) {
c[i].ldctl_oid = LDAP_CONTROL_MANAGEDIT;
BER_BVZERO( &c[i].ldctl_value );
c[i].ldctl_iscritical = manageDIT > 1;
ctrls[i] = &c[i];
i++;
}
if ( manageDSAit ) { if ( manageDSAit ) {
c[i].ldctl_oid = LDAP_CONTROL_MANAGEDSAIT; c[i].ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c[i].ldctl_value.bv_val = NULL; BER_BVZERO( &c[i].ldctl_value );
c[i].ldctl_value.bv_len = 0;
c[i].ldctl_iscritical = manageDSAit > 1; c[i].ldctl_iscritical = manageDSAit > 1;
ctrls[i] = &c[i]; ctrls[i] = &c[i];
i++; i++;
...@@ -924,8 +1055,7 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) ...@@ -924,8 +1055,7 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
if ( noop ) { if ( noop ) {
c[i].ldctl_oid = LDAP_CONTROL_NOOP; c[i].ldctl_oid = LDAP_CONTROL_NOOP;
c[i].ldctl_value.bv_val = NULL; BER_BVZERO( &c[i].ldctl_value );
c[i].ldctl_value.bv_len = 0;
c[i].ldctl_iscritical = noop > 1; c[i].ldctl_iscritical = noop > 1;
ctrls[i] = &c[i]; ctrls[i] = &c[i];
i++; i++;
...@@ -991,6 +1121,52 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) ...@@ -991,6 +1121,52 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
if( attrs ) ldap_charray_free( attrs ); if( attrs ) ldap_charray_free( attrs );
} }
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
if ( chaining ) {
if ( chainingResolve > -1 ) {
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
ber_init2( ber, NULL, LBER_USE_DER );
err = ber_printf( ber, "{e" /* } */, chainingResolve );
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
exit( EXIT_FAILURE );
}
if ( chainingContinuation > -1 ) {
err = ber_printf( ber, "e", chainingContinuation );
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
exit( EXIT_FAILURE );
}
}
err = ber_printf( ber, /* { */ "N}" );
if ( err == -1 ) {
ber_free( ber, 1 );
fprintf( stderr, _("Chaining behavior control encoding error!\n") );
exit( EXIT_FAILURE );
}
if ( ber_flatten2( ber, &c[i].ldctl_value, 0 ) == -1 ) {
exit( EXIT_FAILURE );
}
} else {
BER_BVZERO( &c[i].ldctl_value );
}
c[i].ldctl_oid = LDAP_CONTROL_X_CHAINING_BEHAVIOR;
c[i].ldctl_iscritical = chaining > 1;
ctrls[i] = &c[i];
i++;
}
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
while ( count-- ) { while ( count-- ) {
ctrls[i++] = extra_c++; ctrls[i++] = extra_c++;
} }
...@@ -1011,3 +1187,26 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count ) ...@@ -1011,3 +1187,26 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
} }
int
tool_check_abandon( LDAP *ld, int msgid )
{
int rc;
switch ( gotintr ) {
case LDAP_REQ_EXTENDED:
rc = ldap_cancel_s( ld, msgid, NULL, NULL );
fprintf( stderr, "got interrupt, cancel got %d: %s\n",
rc, ldap_err2string( rc ) );
return -1;
case LDAP_REQ_ABANDON:
rc = ldap_abandon( ld, msgid );
fprintf( stderr, "got interrupt, abandon got %d: %s\n",
rc, ldap_err2string( rc ) );
return -1;
}
return 0;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -45,10 +45,14 @@ extern int use_tls; ...@@ -45,10 +45,14 @@ extern int use_tls;
extern char *assertion; extern char *assertion;
extern char *authzid; extern char *authzid;
extern int manageDIT;
extern int manageDSAit; extern int manageDSAit;
extern int noop; extern int noop;
extern int ppolicy; extern int ppolicy;
extern int preread, postread; extern int preread, postread;
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
extern int chaining;
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
extern int not; extern int not;
extern int want_bindpw; extern int want_bindpw;
...@@ -74,7 +78,10 @@ void tool_common_usage LDAP_P(( void )); ...@@ -74,7 +78,10 @@ void tool_common_usage LDAP_P(( void ));
void tool_args LDAP_P(( int, char ** )); void tool_args LDAP_P(( int, char ** ));
LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) )); LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
void tool_bind LDAP_P(( LDAP * )); void tool_bind LDAP_P(( LDAP * ));
void tool_unbind LDAP_P(( LDAP * ));
void tool_destroy LDAP_P(( void ));
void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int )); void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
LDAP_END_DECL LDAP_END_DECL
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated. * Portions Copyright 1998-2001 Net Boolean Incorporated.
* All rights reserved. * All rights reserved.
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <ac/string.h> #include <ac/string.h>
#include <ac/unistd.h> #include <ac/unistd.h>
#include <ac/errno.h> #include <ac/errno.h>
#include <ac/time.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
...@@ -217,8 +218,8 @@ main( int argc, char **argv ) ...@@ -217,8 +218,8 @@ main( int argc, char **argv )
free( bvalue.bv_val ); free( bvalue.bv_val );
ldap_unbind_ext( ld, NULL, NULL ); tool_unbind( ld );
tool_destroy();
return rc; return rc;
} }
...@@ -232,27 +233,88 @@ static int docompare( ...@@ -232,27 +233,88 @@ static int docompare(
LDAPControl **sctrls, LDAPControl **sctrls,
LDAPControl **cctrls ) LDAPControl **cctrls )
{ {
int rc; int rc, msgid, code;
LDAPMessage *res;
char *matcheddn;
char *text;
char **refs;
if ( not ) { if ( not ) {
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
rc = ldap_compare_ext_s( ld, dn, attr, bvalue, rc = ldap_compare_ext( ld, dn, attr, bvalue,
sctrls, cctrls ); sctrls, cctrls, &msgid );
if ( rc == -1 ) {
return( rc );
}
for ( ; ; ) {
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 100000;
if ( tool_check_abandon( ld, msgid ) ) {
return LDAP_CANCELLED;
}
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
if ( rc < 0 ) {
ldap_perror( ld, "ldapcompare: ldap_result" );
return rc;
}
if ( rc != 0 ) {
break;
}
}
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n",
prog, ldap_err2string( rc ), rc );
return rc;
}
if ( !quiet && ( verbose || ( code != LDAP_SUCCESS && code != LDAP_COMPARE_TRUE && code != LDAP_COMPARE_FALSE )||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) ) )
{
printf( _("Compare Result: %s (%d)\n"),
ldap_err2string( code ), code );
if( text && *text ) {
printf( _("Additional info: %s\n"), text );
}
if( matcheddn && *matcheddn ) {
printf( _("Matched DN: %s\n"), matcheddn );
}
if( refs ) {
int i;
for( i=0; refs[i]; i++ ) {
printf(_("Referral: %s\n"), refs[i] );
}
}
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
/* if we were told to be quiet, use the return value. */ /* if we were told to be quiet, use the return value. */
if ( !quiet ) { if ( !quiet ) {
if ( rc == LDAP_COMPARE_TRUE ) { if ( code == LDAP_COMPARE_TRUE ) {
printf(_("TRUE\n")); printf(_("TRUE\n"));
} else if ( rc == LDAP_COMPARE_FALSE ) { } else if ( code == LDAP_COMPARE_FALSE ) {
printf(_("FALSE\n")); printf(_("FALSE\n"));
} else { } else {
printf(_("UNDEFINED\n")); printf(_("UNDEFINED\n"));
ldap_perror( ld, "ldap_compare" );
} }
} }
return( rc ); return( code );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 1998-2003 Kurt D. Zeilenga.
* All rights reserved. * All rights reserved.
* *
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/unistd.h> #include <ac/unistd.h>
#include <ac/time.h>
#include <ldap.h> #include <ldap.h>
#include "lutil.h" #include "lutil.h"
...@@ -169,7 +170,7 @@ main( int argc, char **argv ) ...@@ -169,7 +170,7 @@ main( int argc, char **argv )
tool_bind( ld ); tool_bind( ld );
if ( assertion || authzid || manageDSAit || noop ) { if ( assertion || authzid || manageDIT || manageDSAit || noop ) {
tool_server_controls( ld, NULL, 0 ); tool_server_controls( ld, NULL, 0 );
} }
...@@ -197,9 +198,9 @@ main( int argc, char **argv ) ...@@ -197,9 +198,9 @@ main( int argc, char **argv )
} }
} }
ldap_unbind_ext( ld, NULL, NULL ); tool_unbind( ld );
tool_destroy();
return( retval ); return retval;
} }
...@@ -233,10 +234,25 @@ static int dodelete( ...@@ -233,10 +234,25 @@ static int dodelete(
return rc; return rc;
} }
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, NULL, &res ); for ( ; ; ) {
if ( rc < 0 ) { struct timeval tv;
ldap_perror( ld, "ldapdelete: ldap_result" );
return rc; if ( tool_check_abandon( ld, id ) ) {
return LDAP_CANCELLED;
}
tv.tv_sec = 0;
tv.tv_usec = 100000;
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
if ( rc < 0 ) {
ldap_perror( ld, "ldapdelete: ldap_result" );
return rc;
}
if ( rc != 0 ) {
break;
}
} }
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 ); rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
...@@ -250,7 +266,8 @@ static int dodelete( ...@@ -250,7 +266,8 @@ static int dodelete(
if( verbose || code != LDAP_SUCCESS || if( verbose || code != LDAP_SUCCESS ||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) ) (matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
{ {
printf( _("Delete Result: %s (%d)\n"), ldap_err2string( code ), code ); printf( _("Delete Result: %s (%d)\n"),
ldap_err2string( code ), code );
if( text && *text ) { if( text && *text ) {
printf( _("Additional info: %s\n"), text ); printf( _("Additional info: %s\n"), text );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated. * Portions Copyright 1998-2001 Net Boolean Incorporated.
* Portions Copyright 2001-2003 IBM Corporation. * Portions Copyright 2001-2003 IBM Corporation.
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/unistd.h> #include <ac/unistd.h>
#include <ac/time.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
...@@ -309,11 +310,11 @@ main( int argc, char **argv ) ...@@ -309,11 +310,11 @@ main( int argc, char **argv )
} }
#endif #endif
if ( assertion || authzid || manageDSAit || noop || preread || postread if ( assertion || authzid || manageDIT || manageDSAit || noop
#ifdef LDAP_GROUP_TRANSACTION #ifdef LDAP_GROUP_TRANSACTION
|| txn || txn
#endif #endif
) || preread || postread )
{ {
int err; int err;
int i = 0; int i = 0;
...@@ -405,13 +406,14 @@ main( int argc, char **argv ) ...@@ -405,13 +406,14 @@ main( int argc, char **argv )
#endif #endif
if ( !not ) { if ( !not ) {
ldap_unbind_ext( ld, NULL, NULL ); tool_unbind( ld );
} }
if ( rejfp != NULL ) { if ( rejfp != NULL ) {
fclose( rejfp ); fclose( rejfp );
} }
tool_destroy();
return( retval ); return( retval );
} }
...@@ -1009,7 +1011,7 @@ domodify( ...@@ -1009,7 +1011,7 @@ domodify(
} }
if ( !not ) { if ( !not ) {
int msgid; int msgid;
if ( newentry ) { if ( newentry ) {
rc = ldap_add_ext( ld, dn, pmods, pctrls, NULL, &msgid ); rc = ldap_add_ext( ld, dn, pmods, pctrls, NULL, &msgid );
} else { } else {
...@@ -1113,21 +1115,37 @@ static int process_response( ...@@ -1113,21 +1115,37 @@ static int process_response(
const char *opstr, const char *opstr,
const char *dn ) const char *dn )
{ {
LDAPMessage *res; LDAPMessage *res;
int rc = LDAP_OTHER; int rc = LDAP_OTHER;
struct timeval tv = { 0 };
if( ldap_result( ld, msgid, for ( ; ; ) {
tv.tv_sec = 0;
tv.tv_usec = 100000;
rc = ldap_result( ld, msgid,
#ifdef LDAP_GROUP_TRANSACTION #ifdef LDAP_GROUP_TRANSACTION
txn ? 0 : 1, txn ? 0 : 1,
#else #else
1, 1,
#endif #endif
NULL, &res ) == -1 ) { &tv, &res );
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc ); if ( tool_check_abandon( ld, msgid ) ) {
return rc; return LDAP_CANCELLED;
}
if ( rc == -1 ) {
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
return rc;
}
if ( rc != 0 ) {
break;
}
} }
if( ldap_msgtype( res ) != LDAP_RES_INTERMEDIATE ) { done:;
if ( ldap_msgtype( res ) != LDAP_RES_INTERMEDIATE ) {
rc = ldap_result2error( ld, res, 1 ); rc = ldap_result2error( ld, res, 1 );
if( rc != LDAP_SUCCESS ) ldap_perror( ld, opstr ); if( rc != LDAP_SUCCESS ) ldap_perror( ld, opstr );
return rc; return rc;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 1998-2004 The OpenLDAP Foundation. * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga. * Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated. * Portions Copyright 1998-2001 Net Boolean Incorporated.
* Portions Copyright 2001-2003 IBM Corporation. * Portions Copyright 2001-2003 IBM Corporation.
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/unistd.h> #include <ac/unistd.h>
#include <ac/time.h>
#include <ldap.h> #include <ldap.h>
#include "lutil.h" #include "lutil.h"
...@@ -227,8 +228,8 @@ main(int argc, char **argv) ...@@ -227,8 +228,8 @@ main(int argc, char **argv)
} }
} }
ldap_unbind_ext( ld, NULL, NULL ); tool_unbind( ld );
tool_destroy();
return( retval ); return( retval );
} }
...@@ -263,10 +264,25 @@ static int domodrdn( ...@@ -263,10 +264,25 @@ static int domodrdn(
return rc; return rc;
} }
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, NULL, &res ); for ( ; ; ) {
if ( rc < 0 ) { struct timeval tv = { 0 };
ldap_perror( ld, "ldapmodrdn: ldap_result" );
return rc; if ( tool_check_abandon( ld, id ) ) {
return LDAP_CANCELLED;
}
tv.tv_sec = 0;
tv.tv_usec = 100000;
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
if ( rc < 0 ) {
ldap_perror( ld, "ldapmodrdn: ldap_result" );
return rc;
}
if ( rc != 0 ) {
break;
}
} }
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 ); rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
......