mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-26 09:39:45 -05:00
- removed char* in favour of string
- extented Referral chasing (loop detection, hop limit, Rebind) - support for Server Controls - fixed many bugs and memory leaks
This commit is contained in:
parent
35e61c403b
commit
11fbe2a45c
71 changed files with 15530 additions and 1041 deletions
364
contrib/ldapc++/Makefile.in
Normal file
364
contrib/ldapc++/Makefile.in
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
||||
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
|
||||
EXTRA_DIST = BUGS
|
||||
SUBDIRS = src
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ./src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README AUTHORS ChangeLog INSTALL Makefile.am Makefile.in \
|
||||
NEWS TODO aclocal.m4 config.guess config.sub configure configure.in \
|
||||
install-sh ltconfig ltmain.sh missing mkinstalldirs src/config.h.in \
|
||||
src/stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
src/config.h: src/stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f src/stamp-h; \
|
||||
$(MAKE) src/stamp-h; \
|
||||
else :; fi
|
||||
src/stamp-h: $(srcdir)/src/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=src/config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > src/stamp-h 2> /dev/null
|
||||
$(srcdir)/src/config.h.in: $(srcdir)/src/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/src/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/src/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/src/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/src/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f src/config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-recursive
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile
|
||||
all-redirect: all-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
install-data-recursive uninstall-data-recursive install-exec-recursive \
|
||||
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
|
||||
all-recursive check-recursive installcheck-recursive info-recursive \
|
||||
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
@ -1,8 +1,35 @@
|
|||
This is an unstable development release of a LDAPv3 C++ Class Library.
|
||||
It was created as the diploma thesis (final project) of my computer
|
||||
science studies.
|
||||
It is based upon the OpenLDAP C-API and so it needs the C-library and
|
||||
Headerfiles installed.
|
||||
|
||||
A HTML documentation of all classes can be found in the srcdoc directory.
|
||||
Installation:
|
||||
=============
|
||||
Just run the "configure" script with the apropriate options. Especially
|
||||
these two options can be imported, if you didn't install the OpenLDAP-
|
||||
libraries in the default place:
|
||||
|
||||
--with-libldap=<path to libldap> : To tell configure where the OpenLDAP
|
||||
C-libraries are located.
|
||||
--with-ldap-includes=<path to ldap include files> : To tell configure
|
||||
where the OpenLDAP include files are located.
|
||||
(run "configure --help" to see all possible command line options)
|
||||
|
||||
If configure finishes without problems. You can simply call "make" to
|
||||
build the library and "make install" to install it.
|
||||
|
||||
Documentation:
|
||||
==============
|
||||
Docs are very incomplete. You can either look in the source files for
|
||||
the documentation comment of generate documentation using "doxygen"
|
||||
or any other javadoc compatible documentation generator.
|
||||
|
||||
Bugreports and other feedback:
|
||||
==============================
|
||||
If you find bugs please feel free to send me a detailed report. All
|
||||
other kinds of feedback are welcomed as well.
|
||||
|
||||
|
||||
Ralf Haferkamp <rhafer@suse.de>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
SASL Authentication
|
||||
TLS encryption
|
||||
adjustment of search scope for search reference following
|
||||
some more methods in the base classes (LDAPAttribute, LDAPEntry, ..) e.g.:
|
||||
-sorting/searching of Attributes
|
||||
-sorting of Entries
|
||||
localization and subtypes
|
||||
Debugging and Logging
|
||||
LDAPv2 Operations
|
||||
Referral chasing for all operations
|
||||
Classes to make synchronous Operations
|
||||
SASL Authentication
|
||||
TLS encryption
|
||||
|
||||
|
|
|
|||
409
contrib/ldapc++/aclocal.m4
vendored
409
contrib/ldapc++/aclocal.m4
vendored
|
|
@ -125,3 +125,412 @@ for am_file in <<$1>>; do
|
|||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
|
|
|
|||
1125
contrib/ldapc++/config.guess
vendored
Executable file
1125
contrib/ldapc++/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1244
contrib/ldapc++/config.sub
vendored
Executable file
1244
contrib/ldapc++/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
2359
contrib/ldapc++/configure
vendored
Executable file
2359
contrib/ldapc++/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,9 @@ dnl COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
dnl disable config.cache
|
||||
define([AC_CACHE_LOAD], )
|
||||
define([AC_CACHE_SAVE], )
|
||||
|
||||
AC_INIT(src/main.cpp)
|
||||
AM_INIT_AUTOMAKE(main, 0.0.1)
|
||||
|
|
@ -11,8 +14,12 @@ AM_CONFIG_HEADER(src/config.h)
|
|||
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_INSTALL
|
||||
dnl AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_RANLIB
|
||||
dnl AM_DISABLE_SHARED
|
||||
AM_PROG_LIBTOOL
|
||||
dnl AC_PROG_MAKE_SET
|
||||
AC_ARG_ENABLE(debug,--disable-debug,[
|
||||
],[
|
||||
|
|
@ -21,26 +28,54 @@ AC_ARG_ENABLE(debug,--disable-debug,[
|
|||
)
|
||||
|
||||
AC_ARG_WITH(libldap,[ --with-libldap=DIR Path to the libldap library [/usr/local/lib]],[
|
||||
LIBS="$LIBS -L$with_libldap"
|
||||
LIBS="-L$with_libldap $LIBS "
|
||||
],[
|
||||
LIBS="$LIBS -L/usr/local/lib"
|
||||
LIBS="-L/usr/local/lib $LIBS "
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(ldap-includes,[ --with-ldap-includes=DIR Path to the libldap include files [/usr/local/include]],[
|
||||
CPPFLAGS="$CPPFLAGS -I$with_ldap_includes"
|
||||
CPPFLAGS="-I$with_ldap_includes $CPPFLAGS "
|
||||
],[
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
CPPFLAGS="-I/usr/local/include $CPPFLAGS "
|
||||
]
|
||||
)
|
||||
dnl Checks for libraries.
|
||||
AC_CHECK_LIB(resolv,main)
|
||||
AC_CHECK_LIB(lber,main)
|
||||
AC_CHECK_LIB(ldap,main)
|
||||
AC_CHECK_LIB(lber,ber_strdup,[
|
||||
],[
|
||||
echo " didn't find ber_strdup in liblber !";
|
||||
echo " Check for the right version (>= 2.0) of the OpenLDAP libraries";
|
||||
echo " or try the --with-libldap option.";
|
||||
exit
|
||||
])
|
||||
AC_CHECK_LIB(ldap,ldap_add_ext,[
|
||||
],[
|
||||
echo " didn't find ldap_add_ext in libldap !";
|
||||
echo " Check for the right version (>= 2.0) of the OpenLDAP libraries";
|
||||
echo " or try the --with-libldap option.";
|
||||
exit
|
||||
],[
|
||||
-llber
|
||||
])
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_HEADER(ldap.h)
|
||||
AC_EGREP_HEADER(ldap_add_ext,ldap.h,[
|
||||
],[
|
||||
echo " didn't find ldap_add_ext in ldap.h!";
|
||||
echo " Check for the right version (>= 2.0) of the OpenLDAP includes";
|
||||
echo " or try --with-ldap-includes option.";
|
||||
exit
|
||||
])
|
||||
AC_CHECK_HEADER(lber.h)
|
||||
AC_EGREP_HEADER(ber_strdup,lber.h,[
|
||||
],[
|
||||
echo " didn't find ber_strdup in lber.h!";
|
||||
echo " Check for the right version (>= 2.0) of the OpenLDAP includes";
|
||||
echo " or try --with-ldap-includes option.";
|
||||
exit
|
||||
])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ REPEAT_BRIEF = yes
|
|||
# Doxygen will generate a detailed section even if there is only a brief
|
||||
# description.
|
||||
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
ALWAYS_DETAILED_SEC = yes
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
|
||||
# path before files name in the file list and in the header files. If set
|
||||
|
|
@ -123,7 +123,7 @@ CLASS_DIAGRAMS = YES
|
|||
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
|
||||
# be generated. Documented entities will be cross-referenced with these sources.
|
||||
|
||||
SOURCE_BROWSER = Yes
|
||||
SOURCE_BROWSER = no
|
||||
|
||||
# Setting the INLINE_SOURCES tag to YES will include the body
|
||||
# of functions and classes directly in the documentation.
|
||||
|
|
@ -176,7 +176,7 @@ TAB_SIZE = 4
|
|||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = /suse/rhafer/prog/ldapsdk/src
|
||||
INPUT = ./src
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
|
|
|
|||
251
contrib/ldapc++/install-sh
Executable file
251
contrib/ldapc++/install-sh
Executable file
|
|
@ -0,0 +1,251 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
3078
contrib/ldapc++/ltconfig
Executable file
3078
contrib/ldapc++/ltconfig
Executable file
File diff suppressed because it is too large
Load diff
4015
contrib/ldapc++/ltmain.sh
Normal file
4015
contrib/ldapc++/ltmain.sh
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,6 @@
|
|||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.1.1.1 2000/08/02 14:06:27 rhafer Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
|
|
|
|||
|
|
@ -12,38 +12,44 @@
|
|||
#include "LDAPEntry.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPMessageQueue.h"
|
||||
#include "LDAPResult.h"
|
||||
|
||||
LDAPAddRequest::LDAPAddRequest(const LDAPAddRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::LDAPAddRequest(LDAPAddRequest&)"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAddRequest::LDAPAddRequest(&)" << endl);
|
||||
m_entry=new LDAPEntry(*(req.m_entry));
|
||||
}
|
||||
|
||||
LDAPAddRequest::LDAPAddRequest(const LDAPEntry *entry,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false)
|
||||
: LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::LDAPAddRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " entry:" << *entry << endl
|
||||
LDAPAddRequest::LDAPAddRequest(const LDAPEntry* entry,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral, const LDAPRequest* parent)
|
||||
: LDAPRequest(connect, cons, isReferral,parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAddRequest::LDAPAddRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" entry:" << entry << endl
|
||||
<< " isReferral:" << isReferral << endl);
|
||||
m_requestType = LDAPRequest::ADD;
|
||||
m_entry = new LDAPEntry(*entry);
|
||||
}
|
||||
|
||||
LDAPAddRequest::~LDAPAddRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::~LDAPAddRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPAddRequest::~LDAPAddRequest()" << endl);
|
||||
delete m_entry;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAddRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
LDAPAttributeList *attrList = m_entry->getAttributes();
|
||||
const LDAPAttributeList* list=m_entry->getAttributes();
|
||||
LDAPMod** attrs=list->toLDAPModArray();
|
||||
LDAPControl** tmpSrvCtrls = m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls = m_cons->getClCtrlsArray();
|
||||
int err=ldap_add_ext(m_connection->getSessionHandle(),
|
||||
m_entry->getDN(),attrList->toLDAPModArray(),
|
||||
m_cons->getSrvCtrlsArray(), m_cons->getClCtrlsArray(),&msgID);
|
||||
m_entry->getDN().c_str(),attrs,tmpSrvCtrls,tmpClCtrls,&msgID);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
ldap_mods_free(attrs,1);
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
|
|
@ -51,9 +57,20 @@ LDAPMessageQueue* LDAPAddRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPAddRequest::followReferral(LDAPUrlList *urls){
|
||||
LDAPRequest* LDAPAddRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::followReferral()"<< endl);
|
||||
cerr << "to be implemented" << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls = ((LDAPResult*)ref)->getReferralUrls();
|
||||
LDAPAsynConnection* con = 0;
|
||||
try {
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
} catch(LDAPException e){
|
||||
delete con;
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPAddRequest(m_entry, con, m_cons,true,this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,20 +7,23 @@
|
|||
#define LDAP_ADD_REQUEST_H
|
||||
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPEntry.h"
|
||||
|
||||
class LDAPMessageQueue;
|
||||
class LDAPEntry;
|
||||
|
||||
class LDAPAddRequest : LDAPRequest {
|
||||
private:
|
||||
LDAPEntry *m_entry;
|
||||
|
||||
public:
|
||||
LDAPAddRequest(const LDAPAddRequest& req);
|
||||
LDAPAddRequest(const LDAPEntry* entry, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false);
|
||||
LDAPAddRequest(const LDAPEntry* entry,
|
||||
LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false,
|
||||
const LDAPRequest* parent=0);
|
||||
virtual ~LDAPAddRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *refs);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* refs);
|
||||
private:
|
||||
LDAPEntry* m_entry;
|
||||
|
||||
};
|
||||
#endif // LDAP_ADD_REQUEST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAsynConnection.cpp,v 1.3 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
|
@ -19,170 +18,169 @@
|
|||
#include "LDAPModDNRequest.h"
|
||||
#include "LDAPModifyRequest.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPRebind.h"
|
||||
#include "LDAPRebindAuth.h"
|
||||
#include "LDAPSearchRequest.h"
|
||||
|
||||
LDAPAsynConnection::LDAPAsynConnection(const char *hostname, int port,
|
||||
LDAPAsynConnection::LDAPAsynConnection(const string& hostname, int port,
|
||||
LDAPConstraints *cons ){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::LDAPAsynConnection()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," host:" << hostname << endl
|
||||
<< " port:" << port << endl);
|
||||
if (hostname!=0){
|
||||
this->init(hostname, port);
|
||||
}
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPAsynConnection::LDAPAsynConnection()"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" host:" << hostname << endl << " port:" << port << endl);
|
||||
cur_session=0;
|
||||
this->init(hostname, port);
|
||||
this->setConstraints(cons);
|
||||
}
|
||||
|
||||
|
||||
void LDAPAsynConnection::setConstraints(LDAPConstraints *cons){
|
||||
m_constr=cons;
|
||||
LDAPAsynConnection::~LDAPAsynConnection(){
|
||||
DEBUG(LDAP_DEBUG_DESTROY,
|
||||
"LDAPAsynConnection::~LDAPAsynConnection()" << endl);
|
||||
unbind();
|
||||
}
|
||||
|
||||
LDAPConstraints* LDAPAsynConnection::getConstraints() const {
|
||||
return m_constr;
|
||||
}
|
||||
|
||||
LDAPAsynConnection* LDAPAsynConnection::referralConnect(const LDAPUrlList* urls,
|
||||
LDAPUrl** usedUrl) const {
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::referralConnect()" << endl)
|
||||
LDAPUrlList::const_iterator conUrl;
|
||||
LDAPAsynConnection* tmpConn=0;
|
||||
for(conUrl=urls->begin(); conUrl!=urls->end(); conUrl++){
|
||||
char* host= (*conUrl)->getHost();
|
||||
int port= (*conUrl)->getPort();
|
||||
DEBUG(LDAP_DEBUG_TRACE," connecting to: " << host << ":" <<
|
||||
port << endl);
|
||||
tmpConn=new LDAPAsynConnection(host,port);
|
||||
// static bind here, to check for the result immediately and
|
||||
// use the next URL if the bind fails;
|
||||
if( ldap_simple_bind_s(tmpConn->getSessionHandle(), 0,0)
|
||||
== LDAP_SUCCESS ){
|
||||
*usedUrl=*conUrl;
|
||||
return tmpConn;
|
||||
}else{
|
||||
delete tmpConn;
|
||||
tmpConn=0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LDAPAsynConnection::init(const char *hostname, int port){
|
||||
cur_session=ldap_init(hostname,port);
|
||||
void LDAPAsynConnection::init(const string& hostname, int port){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::init" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" hostname:" << hostname << endl
|
||||
<< " port:" << port << endl);
|
||||
cur_session=ldap_init(hostname.c_str(),port);
|
||||
m_host=hostname;
|
||||
m_port=port;
|
||||
int opt=3;
|
||||
ldap_set_option(cur_session, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
|
||||
ldap_set_option(cur_session, LDAP_OPT_PROTOCOL_VERSION, &opt);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::bind(const char *dn, const char *passwd,
|
||||
const LDAPConstraints *cons){
|
||||
LDAPMessageQueue* LDAPAsynConnection::bind(const string& dn,
|
||||
const string& passwd, const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::bind()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
<< " passwd:" << passwd << endl);
|
||||
LDAPBindRequest *req = new LDAPBindRequest(dn,passwd,this,cons);
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::search(const char *base,int scope,
|
||||
const char *filter,
|
||||
char **attrs,
|
||||
LDAPMessageQueue* LDAPAsynConnection::search(const string& base,int scope,
|
||||
const string& filter,
|
||||
const StringList& attrs,
|
||||
bool attrsOnly,
|
||||
const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::search()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " base:" << base << endl
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER, " base:" << base << endl
|
||||
<< " scope:" << scope << endl
|
||||
<< " filter:" << filter << endl );
|
||||
LDAPSearchRequest *req = new LDAPSearchRequest(base, scope,filter, attrs,
|
||||
this, cons);
|
||||
LDAPMessageQueue* ret = req->sendRequest();
|
||||
return ret;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::del(const char *dn,
|
||||
const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::del()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," dn:" << dn << endl);
|
||||
LDAPDeleteRequest *req = new LDAPDeleteRequest(dn, this, cons);
|
||||
LDAPMessageQueue *ret= req->sendRequest();
|
||||
return ret;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::compare(const char *dn,
|
||||
const LDAPAttribute *attr, const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::compare()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," dn:" << dn << endl
|
||||
<< " attr:" << *attr << endl);
|
||||
LDAPCompareRequest *req = new LDAPCompareRequest(dn, attr, this, cons);
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::add(LDAPEntry *le,
|
||||
const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::add()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," entry:" << *le << endl);
|
||||
if (le == 0){
|
||||
return 0;
|
||||
}else{
|
||||
LDAPAddRequest *req = new LDAPAddRequest(le, this, cons);
|
||||
attrsOnly, this, cons);
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
LDAPMessageQueue* LDAPAsynConnection::modify(char *dn, LDAPModification *mod,
|
||||
LDAPMessageQueue* LDAPAsynConnection::del(const string& dn,
|
||||
const LDAPConstraints *cons){
|
||||
LDAPMod** m = new LDAPMod*[2];
|
||||
m[0]=mod->toLDAPMod();
|
||||
m[1]=0;
|
||||
int msgq_id=ldap_modify(cur_session,dn,m,cons);
|
||||
if (msgq_id <= 0){
|
||||
throw LDAPException(this);
|
||||
}else{
|
||||
return new LDAPMessageQueue(msgq_id,this);
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::del()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," dn:" << dn << endl);
|
||||
LDAPDeleteRequest *req = new LDAPDeleteRequest(dn, this, cons);
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::modify(const char *dn, LDAPModList *mod,
|
||||
LDAPMessageQueue* LDAPAsynConnection::compare(const string& dn,
|
||||
const LDAPAttribute& attr, const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::compare()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," dn:" << dn << endl
|
||||
<< " attr:" << attr << endl);
|
||||
LDAPCompareRequest *req = new LDAPCompareRequest(dn, attr, this, cons);
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::add( const LDAPEntry* le,
|
||||
const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::add()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," entry:" << *le << endl);
|
||||
LDAPAddRequest *req = new LDAPAddRequest(le, this, cons);
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::modify(const string& dn,
|
||||
const LDAPModList *mod, const LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::modify()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," dn:" << dn << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," dn:" << dn << endl);
|
||||
LDAPModifyRequest *req = new LDAPModifyRequest(dn, mod, this, cons);
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::rename(const char *dn, const char *newRDN,
|
||||
bool delOldRDN, const char *newParentDN, const LDAPConstraints *cons ){
|
||||
LDAPMessageQueue* LDAPAsynConnection::rename(const string& dn,
|
||||
const string& newRDN, bool delOldRDN, const string& newParentDN,
|
||||
const LDAPConstraints *cons ){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::rename()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," dn:" << dn << endl
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," dn:" << dn << endl
|
||||
<< " newRDN:" << newRDN << endl
|
||||
<< " newParentDN:" << newParentDN << endl
|
||||
<< " delOldRDN:" << delOldRDN << endl);
|
||||
LDAPModDNRequest *req = new LDAPModDNRequest(dn, newRDN, delOldRDN,
|
||||
newParentDN, this, cons );
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LDAPMessageQueue* LDAPAsynConnection::extOperation(const char* oid,
|
||||
BerValue* value, const LDAPConstraints *cons ){
|
||||
LDAPMessageQueue* LDAPAsynConnection::extOperation(const string& oid,
|
||||
const string& value, const LDAPConstraints *cons ){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::extOperation()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," oid:" << oid << endl);
|
||||
if (oid == 0){
|
||||
return 0;
|
||||
}else{
|
||||
LDAPExtRequest *req = new LDAPExtRequest(oid, value, this,cons);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," oid:" << oid << endl);
|
||||
LDAPExtRequest *req = new LDAPExtRequest(oid, value, this,cons);
|
||||
try{
|
||||
LDAPMessageQueue *ret = req->sendRequest();
|
||||
return ret;
|
||||
}catch(LDAPException e){
|
||||
delete req;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LDAPAsynConnection::abandon(LDAPMessageQueue *q){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::*extOperation()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::abandon()" << endl);
|
||||
LDAPRequestStack *reqStack=q->getRequestStack();
|
||||
LDAPRequest *req;
|
||||
while(! reqStack->empty()){
|
||||
|
|
@ -196,8 +194,92 @@ void LDAPAsynConnection::abandon(LDAPMessageQueue *q){
|
|||
}
|
||||
}
|
||||
|
||||
void LDAPAsynConnection::unbind(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::unbind()" << endl);
|
||||
if(cur_session){
|
||||
LDAPControl** tmpSrvCtrls=m_constr->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_constr->getClCtrlsArray();
|
||||
int err=ldap_unbind_ext(cur_session, tmpSrvCtrls, tmpClCtrls);
|
||||
cur_session=0;
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
if(err != LDAP_SUCCESS){
|
||||
throw LDAPException(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LDAP* LDAPAsynConnection::getSessionHandle() const {
|
||||
void LDAPAsynConnection::setConstraints(LDAPConstraints *cons){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::setConstraints()" << endl);
|
||||
m_constr=cons;
|
||||
}
|
||||
|
||||
const LDAPConstraints* LDAPAsynConnection::getConstraints() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::getConstraints()" << endl);
|
||||
return m_constr;
|
||||
}
|
||||
|
||||
LDAP* LDAPAsynConnection::getSessionHandle() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::getSessionHandle()" << endl);
|
||||
return cur_session;
|
||||
}
|
||||
|
||||
const string& LDAPAsynConnection::getHost() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::setHost()" << endl);
|
||||
return m_host;
|
||||
}
|
||||
|
||||
int LDAPAsynConnection::getPort() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::getPort()" << endl);
|
||||
return m_port;
|
||||
}
|
||||
|
||||
LDAPAsynConnection* LDAPAsynConnection::referralConnect(
|
||||
const LDAPUrlList& urls, LDAPUrlList::const_iterator& usedUrl,
|
||||
const LDAPConstraints* cons) const {
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::referralConnect()" << endl)
|
||||
LDAPUrlList::const_iterator conUrl;
|
||||
LDAPAsynConnection* tmpConn=0;
|
||||
const LDAPRebind* rebind = cons->getReferralRebind();
|
||||
LDAPRebindAuth* auth = 0;
|
||||
|
||||
for(conUrl=urls.begin(); conUrl!=urls.end(); conUrl++){
|
||||
string host= conUrl->getHost();
|
||||
int port= conUrl->getPort();
|
||||
DEBUG(LDAP_DEBUG_TRACE," connecting to: " << host << ":" <<
|
||||
port << endl);
|
||||
tmpConn=new LDAPAsynConnection(host.c_str(),port);
|
||||
int err=0;
|
||||
|
||||
if(rebind){
|
||||
auth=rebind->getRebindAuth(host, port);
|
||||
}
|
||||
if(auth){
|
||||
string dn = auth->getDN();
|
||||
string passwd = auth->getPassword();
|
||||
const char* c_dn=0;
|
||||
const char* c_passwd=0;
|
||||
if(dn != ""){
|
||||
c_dn = dn.c_str();
|
||||
}
|
||||
if(passwd != ""){
|
||||
c_passwd = passwd.c_str();
|
||||
}
|
||||
err = ldap_simple_bind_s(tmpConn->getSessionHandle(), c_dn,
|
||||
c_passwd);
|
||||
} else {
|
||||
// Do anonymous bind
|
||||
err = ldap_simple_bind_s(tmpConn->getSessionHandle(), 0,0);
|
||||
}
|
||||
if( err == LDAP_SUCCESS ){
|
||||
usedUrl=conUrl;
|
||||
return tmpConn;
|
||||
}else{
|
||||
delete tmpConn;
|
||||
tmpConn=0;
|
||||
}
|
||||
auth=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAsynConnection.h,v 1.4 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_ASYN_CONNECTION_H
|
||||
#define LDAP_ASYN_CONNECTION_H
|
||||
|
||||
#include<iostream.h>
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
|
||||
#include<ldap.h>
|
||||
#include<lber.h>
|
||||
|
||||
|
|
@ -22,8 +23,8 @@
|
|||
class LDAPEntry;
|
||||
class LDAPAttribute;
|
||||
|
||||
//! Main class for an asynchronous LDAP connection
|
||||
/*!
|
||||
//* Main class for an asynchronous LDAP connection
|
||||
/**
|
||||
* This class represents an asynchronous connection to an LDAP-Server. It
|
||||
* provides the methods for authentication, and all other LDAP-Operations
|
||||
* (e.g. search, add, delete, etc.)
|
||||
|
|
@ -41,62 +42,47 @@ class LDAPAttribute;
|
|||
* 7. Close the connection (feature not implemented yet :) ) <BR>
|
||||
*/
|
||||
class LDAPAsynConnection{
|
||||
|
||||
private :
|
||||
LDAP *cur_session;
|
||||
LDAPConstraints *m_constr;
|
||||
public :
|
||||
static const int SEARCH_BASE=0;
|
||||
static const int SEARCH_ONE=1;
|
||||
static const int SEARCH_SUB=2;
|
||||
// static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
|
||||
// static const int SEARCH_ONE=LDAP_SCOPE_ONELEVEL;
|
||||
// static const int SEARCH_SUB=LDAP_SCOPE_SUBTREE;
|
||||
|
||||
//! Construtor that initializes a connection to a server
|
||||
/*!
|
||||
//* Construtor that initializes a connection to a server
|
||||
/**
|
||||
* @param hostname Name (or IP-Adress) of the destination host
|
||||
* @param port Port the LDAP server is running on
|
||||
* @param cons Default constraints to use with operations over
|
||||
* this connection
|
||||
*/
|
||||
LDAPAsynConnection(const char* hostname="localhost", int port=389,
|
||||
LDAPConstraints *cons=new LDAPConstraints() );
|
||||
LDAPAsynConnection(const string& hostname=string("localhost"),
|
||||
int port=389, LDAPConstraints *cons=new LDAPConstraints() );
|
||||
|
||||
//! Change the default constraints of the connection
|
||||
/*!
|
||||
* @cons cons New LDAPConstraints to use with the connection
|
||||
*/
|
||||
void setConstraints(LDAPConstraints *cons);
|
||||
|
||||
//! Get the default constraints of the connection
|
||||
/*!
|
||||
* @return Pointer to the LDAPConstraints-Object that is currently
|
||||
* used with the Connection
|
||||
*/
|
||||
LDAPConstraints* getConstraints() const;
|
||||
//* Destructor
|
||||
virtual ~LDAPAsynConnection();
|
||||
|
||||
//! used internally only for automatic referral chasing
|
||||
LDAPAsynConnection* referralConnect(const LDAPUrlList *urls,
|
||||
LDAPUrl** usedUrl) const;
|
||||
|
||||
/*!
|
||||
/**
|
||||
* Initzializes a connection to a server. There actually no
|
||||
* communication to the server. Just the object is initialized
|
||||
* (e.g. this method is called with the
|
||||
* LDAPAsynConnection(char*,int,LDAPConstraints) constructor.)
|
||||
*/
|
||||
void init(const char* hostname, int port);
|
||||
void init(const string& hostname, int port);
|
||||
|
||||
//! Simple authentication to a LDAP-Server
|
||||
/*!
|
||||
//* Simple authentication to a LDAP-Server
|
||||
/**
|
||||
* This method does a simple (username, password) bind to the server.
|
||||
* Other, saver, authentcation methods are provided later
|
||||
* @param dn the distiguished name to bind as
|
||||
* @param passwd cleartext password to use
|
||||
*/
|
||||
LDAPMessageQueue* bind(const char* dn, const char *passwd,
|
||||
LDAPMessageQueue* bind(const string& dn="", const string& passwd="",
|
||||
const LDAPConstraints *cons=0);
|
||||
|
||||
//! Performing a search on a directory tree.
|
||||
/*!
|
||||
//* Performing a search on a directory tree.
|
||||
/**
|
||||
* Use the search method to perform a search on the LDAP-Directory
|
||||
* @param base The distinguished name of the starting point for the
|
||||
* search operation
|
||||
|
|
@ -104,24 +90,28 @@ class LDAPAsynConnection{
|
|||
* LDAPAsynConnection::SEARCH_BASE, <BR>
|
||||
* LDAPAsynConnection::SEARCH_ONE, <BR>
|
||||
* LDAPAsynConnection::SEARCH_SUB
|
||||
* @param attrsOnly true if only the attributes names (no values)
|
||||
* should be returned
|
||||
* @param cons A set of constraints that should be used with this
|
||||
* request
|
||||
*/
|
||||
LDAPMessageQueue* search(const char *base, int scope=0,
|
||||
const char *filter=0, char **attrs=0,
|
||||
LDAPMessageQueue* search(const string& base="", int scope=0,
|
||||
const string& filter="objectClass=*",
|
||||
const StringList& attrs=StringList(),
|
||||
bool attrsOnly=false,
|
||||
const LDAPConstraints *cons=0);
|
||||
|
||||
//! Delete an entry from the directory
|
||||
/*!
|
||||
//* Delete an entry from the directory
|
||||
/**
|
||||
* This method sends a delete request to the server
|
||||
* @param dn Distinguished name of the entry that should be deleted
|
||||
* @param cons A set of constraints that should be used with this
|
||||
* request
|
||||
*/
|
||||
LDAPMessageQueue* del(const char *dn, const LDAPConstraints *cons=0);
|
||||
LDAPMessageQueue* del(const string& dn, const LDAPConstraints *cons=0);
|
||||
|
||||
//! Perform the compare operation on an attribute
|
||||
/*!
|
||||
//* Perform the compare operation on an attribute
|
||||
/**
|
||||
* @param dn Distinguished name of the entry for which the compare
|
||||
* should be performed
|
||||
* @param attr An Attribute (one (!) value) to use for the
|
||||
|
|
@ -129,34 +119,94 @@ class LDAPAsynConnection{
|
|||
* @param cons A set of constraints that should be used with this
|
||||
* request
|
||||
*/
|
||||
LDAPMessageQueue* compare(const char *dn, const LDAPAttribute *attr,
|
||||
const LDAPConstraints *cons);
|
||||
LDAPMessageQueue* compare(const string& dn, const LDAPAttribute& attr,
|
||||
const LDAPConstraints *cons=0);
|
||||
|
||||
//! Add an entry to the directory
|
||||
/*!
|
||||
//* Add an entry to the directory
|
||||
/**
|
||||
* @see LDAPEntry
|
||||
* @param le The entry that will be added to the directory
|
||||
*/
|
||||
LDAPMessageQueue* add(LDAPEntry *le, const LDAPConstraints *const=0);
|
||||
LDAPMessageQueue* add( const LDAPEntry* le,
|
||||
const LDAPConstraints *const=0);
|
||||
|
||||
//! Apply one modification to an attribute of a datebase entry
|
||||
LDAPMessageQueue* modify(char *dn, LDAPModification *mod);
|
||||
//* Apply modifications to attributes of an entry
|
||||
/**
|
||||
* @param dn Distiguished Name of the Entry to modify
|
||||
* @param modlist A set of modification that should be applied
|
||||
* to the Entry
|
||||
* @param cons A set of constraints that should be used with this
|
||||
* request
|
||||
*/
|
||||
LDAPMessageQueue* modify(const string& dn, const LDAPModList *modlist,
|
||||
const LDAPConstraints *cons=0);
|
||||
|
||||
//! Apply multiple modifications to attrbutes of an entry
|
||||
LDAPMessageQueue* modify(const char *dn, LDAPModList *modlist,
|
||||
const LDAPConstraints *cons);
|
||||
|
||||
LDAPMessageQueue* rename(const char *dn, const char *newRDN,
|
||||
bool delOldRDN, const char *newParentDN,
|
||||
const LDAPConstraints *cons);
|
||||
//* modify the DN of an entry
|
||||
/**
|
||||
* @param dn DN to modify
|
||||
* @param newRDN The new relative DN for the entry
|
||||
* @param delOldRDN true=The old RDN will be removed from the
|
||||
* attributes <BR>
|
||||
* false=The old RDN will still be present in the
|
||||
* attributes of the entry
|
||||
* @param newParentDN The DN of the new parent entry of the entry
|
||||
* 0 to keep the old one
|
||||
*/
|
||||
LDAPMessageQueue* rename(const string& dn, const string& newRDN,
|
||||
bool delOldRDN=false, const string& newParentDN="",
|
||||
const LDAPConstraints* cons=0);
|
||||
|
||||
LDAPMessageQueue* extOperation(const char* oid, BerValue* value,
|
||||
const LDAPConstraints *cons);
|
||||
//* Perform a LDAP extended Operation
|
||||
/**
|
||||
* e.g. requesting TLS security features
|
||||
* @param oid The dotted decimal representation of the extended
|
||||
* Operation that should be performed
|
||||
* @param value The data asociated with this operation
|
||||
* @param cons A set of constraints that should be used with this
|
||||
* request
|
||||
*/
|
||||
LDAPMessageQueue* extOperation(const string& oid,
|
||||
const string& value="", const LDAPConstraints *cons=0);
|
||||
|
||||
//* End an outstanding request
|
||||
/**
|
||||
* @param q All outstanding request related to this LDAPMessageQueue
|
||||
* will be abandoned
|
||||
*/
|
||||
void abandon(LDAPMessageQueue *q);
|
||||
|
||||
void unbind();
|
||||
LDAP* getSessionHandle() const ;
|
||||
const string& getHost() const;
|
||||
int getPort() const;
|
||||
|
||||
//* Change the default constraints of the connection
|
||||
/**
|
||||
* @cons cons New LDAPConstraints to use with the connection
|
||||
*/
|
||||
void setConstraints(LDAPConstraints *cons);
|
||||
|
||||
//* Get the default constraints of the connection
|
||||
/**
|
||||
* @return Pointer to the LDAPConstraints-Object that is currently
|
||||
* used with the Connection
|
||||
*/
|
||||
const LDAPConstraints* getConstraints() const;
|
||||
|
||||
//* used internally only for automatic referral chasing
|
||||
LDAPAsynConnection* referralConnect(const LDAPUrlList& urls,
|
||||
LDAPUrlList::const_iterator& usedUrl,
|
||||
const LDAPConstraints* cons) const;
|
||||
|
||||
|
||||
private :
|
||||
// no copy constructor
|
||||
LDAPAsynConnection(const LDAPAsynConnection& lc){};
|
||||
LDAP *cur_session;
|
||||
LDAPConstraints *m_constr;
|
||||
string m_host;
|
||||
int m_port;
|
||||
|
||||
};
|
||||
#endif //LDAP_CONNECTION_H
|
||||
#endif //LDAP_ASYN_CONNECTION_H
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,144 +3,180 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAttribute.cpp,v 1.3 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
//TODO!!!
|
||||
// * Spend some thoughts about binary attributes
|
||||
// * some kind of iterator to step through the attribute values
|
||||
// * remove values from Attribute
|
||||
// * handling of subtypes (;de; and so on)
|
||||
// * For binary attributes use one of the other constructors (provided later )
|
||||
// * creatind LDAPAttributes from the CAPI-structures.
|
||||
// * Defining return values and error codes
|
||||
// * some documentation
|
||||
|
||||
|
||||
#include <ldap.h>
|
||||
#include <ac/string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "StringList.h"
|
||||
|
||||
#include "LDAPAttribute.h"
|
||||
|
||||
|
||||
//Copy-constructor
|
||||
LDAPAttribute::LDAPAttribute(const LDAPAttribute& attr){
|
||||
this->setName(attr.m_name);
|
||||
ValueList::const_iterator i;
|
||||
for (i=attr.m_values.begin(); i!=attr.m_values.end(); i++){
|
||||
this->m_values.push_back(ber_bvdup(*i));
|
||||
}
|
||||
LDAPAttribute::LDAPAttribute(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute( )" << endl);
|
||||
m_name=string();
|
||||
}
|
||||
|
||||
//This Constructor expects the parameter value to be either UTF-8 encoded
|
||||
// (for LDAPv3) or T.61 encoded (for LDAPv2).
|
||||
LDAPAttribute::LDAPAttribute(const char *name=0, const char *value=0){
|
||||
this->setName(name);
|
||||
this->addValue(value);
|
||||
LDAPAttribute::LDAPAttribute(const LDAPAttribute& attr){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute(&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" attr:" << attr << endl);
|
||||
m_name=attr.m_name;
|
||||
m_values=StringList(attr.m_values);
|
||||
}
|
||||
|
||||
LDAPAttribute::LDAPAttribute(const string& name, const string& value){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" name:" << name << endl << " value:" << value << endl);
|
||||
this->setName(name);
|
||||
if(value != ""){
|
||||
this->addValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LDAPAttribute::LDAPAttribute(const string& name, const StringList& values){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" name:" << name << endl);
|
||||
m_name=name;
|
||||
m_values=values;
|
||||
}
|
||||
|
||||
LDAPAttribute::LDAPAttribute(const char *name, char **values){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" name:" << name << endl);
|
||||
this->setName(name);
|
||||
this->setValues(values);
|
||||
}
|
||||
|
||||
|
||||
LDAPAttribute::LDAPAttribute(const char *name, BerValue **values){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttribute::LDAPAttribute()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" name:" << name << endl);
|
||||
this->setName(name);
|
||||
this->setValues(values);
|
||||
}
|
||||
|
||||
LDAPAttribute::~LDAPAttribute(){
|
||||
delete[] m_name;
|
||||
ValueList::const_iterator i;
|
||||
for(i=m_values.begin(); i!=m_values.end(); i++){
|
||||
ber_bvfree(*i);
|
||||
}
|
||||
m_values.clear();
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPAttribute::~LDAPAttribute()" << endl);
|
||||
}
|
||||
|
||||
int LDAPAttribute::addValue(const char *value){
|
||||
if(value!=0){
|
||||
BerValue *berval=new BerValue;
|
||||
berval->bv_len=strlen(value);
|
||||
berval->bv_val=strdup(value);
|
||||
m_values.push_back(berval);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
void LDAPAttribute::addValue(const string& value){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::addValue()" << endl);
|
||||
m_values.add(value);
|
||||
}
|
||||
|
||||
int LDAPAttribute::addValue(const BerValue *value){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::addValue()" << endl);
|
||||
if(value!=0){
|
||||
m_values.push_back(ber_bvdup(value));
|
||||
this->addValue(string(value->bv_val, value->bv_len));
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int LDAPAttribute::setValues(char **values){
|
||||
ValueList::const_iterator i;
|
||||
for(i=m_values.begin(); i!=m_values.end(); i++){
|
||||
delete[](*i);
|
||||
}
|
||||
m_values.clear();
|
||||
for( char **i=values; *i!=0; i++){
|
||||
this->addValue(*i);
|
||||
}
|
||||
return 0;
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::setValues()" << endl);
|
||||
if(values){
|
||||
m_values.clear();
|
||||
for( char **i=values; *i!=0; i++){
|
||||
this->addValue(*i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LDAPAttribute::setValues(BerValue **values){
|
||||
ValueList::const_iterator i;
|
||||
for(i=m_values.begin(); i!=m_values.end(); i++){
|
||||
delete[](*i);
|
||||
}
|
||||
m_values.clear();
|
||||
for( BerValue **i=values; *i!=0; i++){
|
||||
this->addValue(*i);
|
||||
}
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::setValues()" << endl);
|
||||
if(values){
|
||||
m_values.clear();
|
||||
for( BerValue **i=values; *i!=0; i++){
|
||||
if( this->addValue(*i) ){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BerValue** LDAPAttribute::getValues() const{
|
||||
size_t size=m_values.size();
|
||||
BerValue **temp = new BerValue*[size+1];
|
||||
ValueList::const_iterator i;
|
||||
int p;
|
||||
|
||||
for(i=m_values.begin(), p=0; i!=m_values.end(); i++,p++){
|
||||
temp[p]=ber_bvdup( (*i) );
|
||||
}
|
||||
temp[size]=0;
|
||||
return temp;
|
||||
void LDAPAttribute::setValues(const StringList& values){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::setValues()" << endl);
|
||||
m_values=values;
|
||||
}
|
||||
|
||||
const StringList& LDAPAttribute::getValues() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::getValues()" << endl);
|
||||
return m_values;
|
||||
}
|
||||
|
||||
BerValue** LDAPAttribute::getBerValues() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::getBerValues()" << endl);
|
||||
size_t size=m_values.size();
|
||||
if (size == 0){
|
||||
return 0;
|
||||
}else{
|
||||
BerValue **temp = new BerValue*[size+1];
|
||||
StringList::const_iterator i;
|
||||
int p=0;
|
||||
|
||||
for(i=m_values.begin(), p=0; i!=m_values.end(); i++,p++){
|
||||
temp[p]=new BerValue;
|
||||
temp[p]->bv_len= i->size();
|
||||
temp[p]->bv_val= new char[i->size()+1];
|
||||
i->copy(temp[p]->bv_val,string::npos);
|
||||
}
|
||||
temp[size]=0;
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
int LDAPAttribute::getNumValues() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::getNumValues()" << endl);
|
||||
return m_values.size();
|
||||
}
|
||||
|
||||
char* LDAPAttribute::getName(){
|
||||
return strdup(m_name);
|
||||
const string& LDAPAttribute::getName() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAttribute::getName()" << endl);
|
||||
return m_name;
|
||||
}
|
||||
|
||||
int LDAPAttribute::setName(const char *name){
|
||||
if (name!=0){
|
||||
m_name=strdup(name);
|
||||
}
|
||||
return 0;
|
||||
void LDAPAttribute::setName(const string& name){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAttribute::setName()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," name:" << name << endl);
|
||||
m_name.erase();
|
||||
m_name=name;
|
||||
}
|
||||
|
||||
// The bin-FLAG of the mod_op is always set to LDAP_MOD_BVALUES (0x80)
|
||||
LDAPMod* LDAPAttribute::toLDAPMod() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPAttribute::toLDAPMod()" << endl);
|
||||
LDAPMod* ret=new LDAPMod();
|
||||
ret->mod_op=LDAP_MOD_BVALUES; //alway asume binary-Values
|
||||
ret->mod_type=strdup(m_name);
|
||||
ret->mod_bvalues=this->getValues();
|
||||
ret->mod_op=LDAP_MOD_BVALUES; //always assume binary-Values
|
||||
ret->mod_type= new char[m_name.size()+1];
|
||||
m_name.copy(ret->mod_type,string::npos);
|
||||
cerr << " " << m_name<< endl;
|
||||
ret->mod_type[m_name.size()]=0;
|
||||
ret->mod_bvalues=this->getBerValues();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LDAPAttribute::isNotPrintable() const {
|
||||
ValueList::const_iterator i;
|
||||
StringList::const_iterator i;
|
||||
for(i=m_values.begin(); i!=m_values.end(); i++){
|
||||
ber_len_t len=(*i)->bv_len;
|
||||
for(ber_len_t j=0; j<len; j++){
|
||||
if (! isprint( (*i)->bv_val[j] ) ){
|
||||
size_t len = i->size();
|
||||
for(size_t j=0; j<len; j++){
|
||||
if (! isprint( (i->data())[j] ) ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -150,12 +186,12 @@ bool LDAPAttribute::isNotPrintable() const {
|
|||
|
||||
ostream& operator << (ostream& s, const LDAPAttribute& attr){
|
||||
s << attr.m_name << "=";
|
||||
ValueList::const_iterator i;
|
||||
StringList::const_iterator i;
|
||||
if (attr.isNotPrintable()){
|
||||
s << "NOT_PRINTABLE" ;
|
||||
}else{
|
||||
for(i=attr.m_values.begin(); i!=attr.m_values.end(); i++){
|
||||
s << (*i)->bv_val << " ";
|
||||
s << *i << " ";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
|
|
|||
|
|
@ -3,45 +3,153 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAttribute.h,v 1.5 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_ATTRIBUTE_H
|
||||
#define LDAP_ATTRIBUTE_H
|
||||
|
||||
#include<iostream>
|
||||
#include<list>
|
||||
#include<string>
|
||||
#include<ldap.h>
|
||||
#include<lber.h>
|
||||
|
||||
typedef list<BerValue*> ValueList;
|
||||
#include "StringList.h"
|
||||
|
||||
//! Represents the name an value(s) of an Attribute
|
||||
class LDAPAttribute{
|
||||
public :
|
||||
//! Default constructor
|
||||
/*!
|
||||
* initializes an empty object
|
||||
*/
|
||||
LDAPAttribute();
|
||||
|
||||
private :
|
||||
char *m_name;
|
||||
ValueList m_values;
|
||||
//!Copy constructor
|
||||
/*!
|
||||
* Copies all values of an Attribute to a new one
|
||||
* @param attr The Attribute that should be copied
|
||||
*/
|
||||
LDAPAttribute(const LDAPAttribute& attr);
|
||||
|
||||
public :
|
||||
//Copy constructor
|
||||
LDAPAttribute(const LDAPAttribute& attr);
|
||||
LDAPAttribute(const char* name=0, const char *value=0);
|
||||
LDAPAttribute(const char* name, char **values);
|
||||
LDAPAttribute(const char* name, BerValue **values);
|
||||
~LDAPAttribute();
|
||||
//! Construct an Attribute with a single string value
|
||||
/*!
|
||||
* @param name The attribute's name (type)
|
||||
* @param value The string value of the attribute, if 0 the
|
||||
* will have no values, for LDAPv3 this values must
|
||||
* be UTF-8 encoded
|
||||
*/
|
||||
LDAPAttribute(const string& name, const string& value="");
|
||||
|
||||
int addValue(const char *value);
|
||||
int addValue(const BerValue *value);
|
||||
int setValues(char** values);
|
||||
int setValues(BerValue** values);
|
||||
int setValues(ValueList values);
|
||||
BerValue** getValues() const;
|
||||
int getNumValues() const;
|
||||
char* getName();
|
||||
int setName(const char *name);
|
||||
bool isNotPrintable() const ;
|
||||
//! Construct an attribute with multiple string values
|
||||
/*!
|
||||
* @param name The attribute's name (type)
|
||||
* @param values A 0-terminated array of char*. Each char* specifies
|
||||
* one value of the attribute (UTF-8 encoded)
|
||||
*/
|
||||
LDAPAttribute(const char* name, char **values);
|
||||
LDAPAttribute(const string& name, const StringList& values);
|
||||
//! Construct an attribute with multiple binary coded values
|
||||
/*!
|
||||
* @param name The attribute's name (type)
|
||||
* @param values 0-terminated array of binary attribute values
|
||||
* The BerValue struct is declared as:<BR>
|
||||
* struct berval{
|
||||
* unsigned long bv_len;
|
||||
* char *bv_val;
|
||||
* } BerValue;
|
||||
*/
|
||||
LDAPAttribute(const char* name, BerValue **values);
|
||||
|
||||
//! Destructor
|
||||
~LDAPAttribute();
|
||||
|
||||
LDAPMod* toLDAPMod() const ;
|
||||
|
||||
friend ostream& operator << (ostream& s, const LDAPAttribute& attr);
|
||||
//! Add a single string value(bin/char) to the Attribute
|
||||
/*!
|
||||
* @param value Value that should be added, it is copied inside the
|
||||
* object
|
||||
*
|
||||
* @return 0 no problem <BR>
|
||||
* -1 failure (mem. allocation problem)
|
||||
*/
|
||||
void addValue(const string& value);
|
||||
|
||||
//! Add a single binary value to the Attribute
|
||||
/*!
|
||||
* @param value The binary coded value that should be added to the
|
||||
* Attribute.
|
||||
*
|
||||
* @return 0 no problem <BR>
|
||||
* -1 failure (mem. allocation problem)
|
||||
*/
|
||||
int addValue(const BerValue *value);
|
||||
|
||||
/*!
|
||||
* Set the values of the attribute. If the object contains some values
|
||||
* already, they are deleted
|
||||
* @param values 0-terminated array of char*, each char*
|
||||
* representing a string value to add to the entry
|
||||
*
|
||||
* @return 0 no problem <BR>
|
||||
* -1 failure (mem. allocation problem)
|
||||
*/
|
||||
int setValues(char** values);
|
||||
|
||||
/*!
|
||||
* Set the values of the attribute. If the object does already contain
|
||||
* some values, they will be deleted
|
||||
* @param values 0-terminated array of BerValue*, each BerValue
|
||||
* representing a binary value to add to the entry
|
||||
*
|
||||
* @return 0 no problem <BR>
|
||||
* -1 failure (mem. allocation problem)
|
||||
*/
|
||||
int setValues(BerValue** values);
|
||||
void setValues(const StringList& values);
|
||||
/*!
|
||||
* @return The Values of the Attribute as an 0-terminated Array of
|
||||
* BerValue* (is dynamically allocated, delete it after usage)
|
||||
* <BR>
|
||||
* 0-pointer in case of error
|
||||
*/
|
||||
BerValue** getBerValues() const;
|
||||
const StringList& getValues() const;
|
||||
/*!
|
||||
* @return The Number of values of the attribute
|
||||
*/
|
||||
int getNumValues() const;
|
||||
|
||||
/*!
|
||||
* @return The name(type) of the attribute
|
||||
* <BR>
|
||||
* 0-pointer in case of error
|
||||
*/
|
||||
const string& getName() const ;
|
||||
|
||||
/*!
|
||||
* @param the new name of the object
|
||||
*
|
||||
* @return 0 no problem <BR>
|
||||
* -1 failure (mem. allocation problem)
|
||||
*/
|
||||
void setName(const string& name);
|
||||
|
||||
/*!
|
||||
* for internal use only
|
||||
*/
|
||||
LDAPMod* toLDAPMod() const ;
|
||||
|
||||
bool isNotPrintable() const ;
|
||||
|
||||
private :
|
||||
string m_name;
|
||||
StringList m_values;
|
||||
/*!
|
||||
* @return true if the values contains nonprintable characters,
|
||||
* otherwise false
|
||||
*/
|
||||
|
||||
/*!
|
||||
* just for debugging at the moment
|
||||
*/
|
||||
friend ostream& operator << (ostream& s, const LDAPAttribute& attr);
|
||||
};
|
||||
#endif //#ifndef LDAP_ATTRIBUTE_H
|
||||
|
|
|
|||
|
|
@ -3,58 +3,104 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAttributeList.cpp,v 1.6 2000/08/31 17:43:48 rhafer Exp $
|
||||
#include <ldap.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include "LDAPAttributeList.h"
|
||||
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPAttribute.h"
|
||||
#include "LDAPAsynConnection.h"
|
||||
#include "LDAPMessage.h"
|
||||
|
||||
LDAPAttributeList::LDAPAttributeList(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPAttributeList::LDAPAttributList( )" << endl);
|
||||
}
|
||||
|
||||
LDAPAttributeList::LDAPAttributeList(const LDAPAttributeList& al){
|
||||
m_attrs=al.m_attrs;
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPAttributeList::LDAPAttributList(&)" << endl);
|
||||
m_attrs=al.m_attrs;
|
||||
}
|
||||
|
||||
LDAPAttributeList::LDAPAttributeList(const LDAPAsynConnection *ld,
|
||||
LDAPMessage *msg){
|
||||
BerElement *ptr;
|
||||
char *name;
|
||||
for (name=ldap_first_attribute(ld->getSessionHandle(), msg, &ptr);
|
||||
name !=0;
|
||||
name=ldap_next_attribute(ld->getSessionHandle(),msg,ptr) ){
|
||||
BerValue **values=ldap_get_values_len(ld->getSessionHandle(),
|
||||
msg, name);
|
||||
this->addAttribute(LDAPAttribute(name, values));
|
||||
}
|
||||
}
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPAttributeList::LDAPAttributList()" << endl);
|
||||
BerElement *ptr=0;
|
||||
char *name=ldap_first_attribute(ld->getSessionHandle(), msg, &ptr);
|
||||
/*
|
||||
This code was making problems if no attribute were returned
|
||||
How am I supposed to find decoding errors? ldap_first/next_attribute
|
||||
return 0 in case of error or if there are no more attributes. In either
|
||||
case they set the LDAP* error code to 0x54 (Decoding error) ??? Strange..
|
||||
|
||||
|
||||
void LDAPAttributeList::addAttribute(const LDAPAttribute& attr){
|
||||
m_attrs.push_back(attr);
|
||||
There will be some changes in the new version of the C-API so that this
|
||||
code should work in the future.
|
||||
if(name == 0){
|
||||
ber_free(ptr,0);
|
||||
ldap_memfree(name);
|
||||
throw LDAPException(ld);
|
||||
}else{
|
||||
*/ BerValue **values;
|
||||
for (;name !=0;
|
||||
name=ldap_next_attribute(ld->getSessionHandle(),msg,ptr) ){
|
||||
values=ldap_get_values_len(ld->getSessionHandle(),
|
||||
msg, name);
|
||||
this->addAttribute(LDAPAttribute(name, values));
|
||||
ldap_memfree(name);
|
||||
ldap_value_free_len(values);
|
||||
}
|
||||
ber_free(ptr,0);
|
||||
// }
|
||||
}
|
||||
|
||||
LDAPAttributeList::~LDAPAttributeList(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttributeList::~LDAPAttributList()" << endl);
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPAttributeList::~LDAPAttributList()" << endl);
|
||||
}
|
||||
|
||||
void LDAPAttributeList::find(char *name){
|
||||
size_t LDAPAttributeList::size() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::size()" << endl);
|
||||
return m_attrs.size();
|
||||
}
|
||||
|
||||
LDAPMod** LDAPAttributeList::toLDAPModArray(){
|
||||
LDAPMod **ret = new LDAPMod*[m_attrs.size()+1];
|
||||
AttrList::const_iterator i;
|
||||
int j=0;
|
||||
for (i=m_attrs.begin(); i!= m_attrs.end(); i++, j++){
|
||||
ret[j]=i->toLDAPMod();
|
||||
}
|
||||
ret[m_attrs.size()]=0;
|
||||
return ret;
|
||||
LDAPAttributeList::const_iterator LDAPAttributeList::begin() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::begin()" << endl);
|
||||
return m_attrs.begin();
|
||||
}
|
||||
|
||||
LDAPAttributeList::const_iterator LDAPAttributeList::end() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::end()" << endl);
|
||||
return m_attrs.end();
|
||||
}
|
||||
|
||||
void LDAPAttributeList::addAttribute(const LDAPAttribute& attr){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::addAttribute()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" attr:" << attr << endl);
|
||||
m_attrs.push_back(attr);
|
||||
}
|
||||
|
||||
|
||||
LDAPMod** LDAPAttributeList::toLDAPModArray() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPAttribute::toLDAPModArray()" << endl);
|
||||
LDAPMod **ret = new LDAPMod*[m_attrs.size()+1];
|
||||
AttrList::const_iterator i;
|
||||
int j=0;
|
||||
for (i=m_attrs.begin(); i!= m_attrs.end(); i++, j++){
|
||||
ret[j]=i->toLDAPMod();
|
||||
}
|
||||
ret[m_attrs.size()]=0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& s, const LDAPAttributeList& al){
|
||||
AttrList::const_iterator i;
|
||||
for(i=al.m_attrs.begin(); i!=al.m_attrs.end(); i++){
|
||||
s << *i << "; ";
|
||||
}
|
||||
return s;
|
||||
AttrList::const_iterator i;
|
||||
for(i=al.m_attrs.begin(); i!=al.m_attrs.end(); i++){
|
||||
s << *i << "; ";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,31 +3,38 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPAttributeList.h,v 1.5 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_ATTRIBUTE_LIST_H
|
||||
#define LDAP_ATTRIBUTE_LIST_H
|
||||
|
||||
#include <list>
|
||||
#include <ldap.h>
|
||||
#include "LDAPAttribute.h"
|
||||
#include "LDAPAsynConnection.h"
|
||||
#include "LDAPMessage.h"
|
||||
class LDAPAttribute;
|
||||
class LDAPAsynConnection;
|
||||
class LDAPMsg;
|
||||
|
||||
typedef list<LDAPAttribute> AttrList;
|
||||
|
||||
class LDAPAttributeList{
|
||||
typedef AttrList::const_iterator const_iterator;
|
||||
|
||||
private :
|
||||
AttrList m_attrs;
|
||||
|
||||
public :
|
||||
LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
|
||||
LDAPAttributeList(const LDAPAttributeList& al);
|
||||
|
||||
/*!
|
||||
* @throws LDAPException if msg does not contain an entry
|
||||
*/
|
||||
LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
|
||||
LDAPAttributeList();
|
||||
~LDAPAttributeList();
|
||||
virtual ~LDAPAttributeList();
|
||||
|
||||
size_t size() const;
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
void addAttribute(const LDAPAttribute& attr);
|
||||
void find(char* name);
|
||||
LDAPMod** toLDAPModArray();
|
||||
LDAPMod** toLDAPModArray() const;
|
||||
|
||||
friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,36 +12,56 @@
|
|||
|
||||
LDAPBindRequest::LDAPBindRequest(const LDAPBindRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPBindRequest::LDAPBindRequest(LDAPBindRequest&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPBindRequest::LDAPBindRequest(&)" << endl);
|
||||
m_dn=req.m_dn;
|
||||
m_cred=req.m_cred;
|
||||
m_mech=req.m_mech;
|
||||
}
|
||||
|
||||
LDAPBindRequest::LDAPBindRequest(const char *dn, const char *passwd,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
LDAPBindRequest::LDAPBindRequest(const string& dn,const string& passwd,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false) : LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::LDAPBindRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPBindRequest::LDAPBindRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
<< " passwd:" << passwd << endl);
|
||||
m_dn = strdup(dn);
|
||||
m_cred = ber_bvstr(passwd);
|
||||
m_mech = LDAP_SASL_SIMPLE;
|
||||
m_dn = dn;
|
||||
m_cred = passwd;
|
||||
m_mech = "";
|
||||
}
|
||||
|
||||
LDAPBindRequest::~LDAPBindRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::~LDAPBindRequest()" << endl);
|
||||
delete[] m_dn;
|
||||
ber_bvfree(m_cred);
|
||||
delete[] m_mech;
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPBindRequest::~LDAPBindRequest()" << endl);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPBindRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
int err=ldap_sasl_bind(m_connection->getSessionHandle(),m_dn,
|
||||
m_mech, m_cred, m_cons->getSrvCtrlsArray(),
|
||||
m_cons->getClCtrlsArray(),&msgID);
|
||||
|
||||
const char* mech = (m_mech == "" ? 0 : m_mech.c_str());
|
||||
BerValue* tmpcred=0;
|
||||
if(m_cred != ""){
|
||||
char* tmppwd = new char[m_cred.size()+1];
|
||||
m_cred.copy(tmppwd,string::npos);
|
||||
tmppwd[m_cred.size()]=0;
|
||||
tmpcred=ber_bvstr(tmppwd);
|
||||
}else{
|
||||
tmpcred=new BerValue;
|
||||
tmpcred->bv_len=0;
|
||||
tmpcred->bv_val=0;
|
||||
}
|
||||
const char* dn = 0;
|
||||
if(m_dn != ""){
|
||||
dn = m_dn.c_str();
|
||||
}
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
int err=ldap_sasl_bind(m_connection->getSessionHandle(),dn,
|
||||
mech, tmpcred, tmpSrvCtrls, tmpClCtrls, &msgID);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
ber_bvfree(tmpcred);
|
||||
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
|
|
@ -49,8 +69,9 @@ LDAPMessageQueue* LDAPBindRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPBindRequest::followReferral(LDAPUrlList *urls){
|
||||
LDAPRequest* LDAPBindRequest::followReferral(LDAPMsg* urls){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::followReferral()" << endl);
|
||||
cerr << "ReferralChasing for bind-operation not implemented yet" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,19 +10,19 @@
|
|||
|
||||
class LDAPBindRequest : LDAPRequest {
|
||||
private:
|
||||
char *m_dn;
|
||||
BerValue *m_cred;
|
||||
char *m_mech;
|
||||
string m_dn;
|
||||
string m_cred;
|
||||
string m_mech;
|
||||
|
||||
public:
|
||||
LDAPBindRequest(const LDAPBindRequest& req);
|
||||
//just for simple authentication
|
||||
LDAPBindRequest(const char *dn, const char *passwd,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
LDAPBindRequest(const string&, const string& passwd,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false);
|
||||
virtual ~LDAPBindRequest();
|
||||
virtual LDAPMessageQueue *sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *urls);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* urls);
|
||||
};
|
||||
#endif //LDAP_BIND_REQUEST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -10,47 +10,47 @@
|
|||
#include "LDAPCompareRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPMessageQueue.h"
|
||||
#include "LDAPResult.h"
|
||||
|
||||
LDAPCompareRequest::LDAPCompareRequest(const LDAPCompareRequest& req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPCompareRequest::LDAPCompareRequest(LDAPCompareRequest&)"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPCompareRequest::LDAPCompareRequest(&)" << endl);
|
||||
m_dn=req.m_dn;
|
||||
m_attr=req.m_attr;
|
||||
}
|
||||
|
||||
LDAPCompareRequest::LDAPCompareRequest(const char *dn,
|
||||
const LDAPAttribute *attr, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false) :
|
||||
LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPCompareRequest::LDAPCompareRequest()"
|
||||
LDAPCompareRequest::LDAPCompareRequest(const string& dn,
|
||||
const LDAPAttribute& attr, LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral,
|
||||
const LDAPRequest* parent) :
|
||||
LDAPRequest(connect, cons, isReferral,parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPCompareRequest::LDAPCompareRequest()"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
<< " attr:" << attr << endl);
|
||||
m_requestType=LDAPRequest::COMPARE;
|
||||
if(dn != 0){
|
||||
m_dn=strdup(dn);
|
||||
}
|
||||
if(attr != 0){
|
||||
//TODO: test for number of values ???
|
||||
m_attr = new LDAPAttribute(*attr);
|
||||
}
|
||||
m_dn=dn;
|
||||
m_attr=attr;
|
||||
}
|
||||
|
||||
LDAPCompareRequest::~LDAPCompareRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPCompareRequest::~LDAPCompareRequest()"
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPCompareRequest::~LDAPCompareRequest()"
|
||||
<< endl);
|
||||
delete[] m_dn;
|
||||
delete m_attr;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPCompareRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPCompareRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
BerValue **tmp=m_attr->getValues();
|
||||
int err=ldap_compare_ext(m_connection->getSessionHandle(),m_dn,
|
||||
m_attr->getName(), tmp[0], m_cons->getSrvCtrlsArray(),
|
||||
m_cons->getClCtrlsArray(), &msgID);
|
||||
BerValue **val=m_attr.getBerValues();
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
int err=ldap_compare_ext(m_connection->getSessionHandle(),m_dn.c_str(),
|
||||
m_attr.getName().c_str(), val[0], tmpSrvCtrls,
|
||||
tmpClCtrls, &msgID);
|
||||
ber_bvecfree(val);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
|
|
@ -58,9 +58,19 @@ LDAPMessageQueue* LDAPCompareRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPCompareRequest::followReferral(LDAPUrlList *urls){
|
||||
LDAPRequest* LDAPCompareRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPCompareRequest::followReferral()" << endl);
|
||||
cerr << "to be implemented" << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls = ((LDAPResult*)ref)->getReferralUrls();
|
||||
LDAPAsynConnection* con = 0;
|
||||
try{
|
||||
con=getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
}catch(LDAPException e){
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPCompareRequest(m_dn, m_attr, con, m_cons, true, this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,18 +11,19 @@
|
|||
class LDAPMessageQueue;
|
||||
|
||||
class LDAPCompareRequest : public LDAPRequest {
|
||||
private :
|
||||
char *m_dn;
|
||||
LDAPAttribute *m_attr;
|
||||
|
||||
public :
|
||||
LDAPCompareRequest(const LDAPCompareRequest& req);
|
||||
LDAPCompareRequest(const char* dn, const LDAPAttribute* attr,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false);
|
||||
LDAPCompareRequest(const string& dn, const LDAPAttribute& attr,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false, const LDAPRequest* parent=0);
|
||||
virtual ~LDAPCompareRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *urls);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* urls);
|
||||
|
||||
private :
|
||||
string m_dn;
|
||||
LDAPAttribute m_attr;
|
||||
|
||||
};
|
||||
#endif //LDAP_COMPARE_REQUEST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -3,58 +3,154 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPConstraints.cpp,v 1.10 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "debug.h"
|
||||
#include "LDAPConstraints.h"
|
||||
//#include "LDAPAsynConnection.h"
|
||||
#include "LDAPControlSet.h"
|
||||
|
||||
LDAPConstraints::LDAPConstraints(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPConstraints::LDAPConstraints()" << endl);
|
||||
m_aliasDeref=LDAPConstraints::DEREF_NEVER;
|
||||
m_maxTime=LDAP_NO_LIMIT;
|
||||
m_maxSize=LDAP_NO_LIMIT;
|
||||
m_referralChase=true;
|
||||
m_referralChase=false;
|
||||
m_HopLimit=7;
|
||||
m_serverControls=0;
|
||||
m_clientControls=0;
|
||||
m_refRebind=0;
|
||||
}
|
||||
|
||||
LDAPConstraints::LDAPConstraints(const LDAPConstraints& c){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPConstraints::LDAPConstraints(&)" << endl);
|
||||
m_aliasDeref=c.m_aliasDeref;
|
||||
m_maxTime=c.m_maxTime;
|
||||
m_maxSize=c.m_maxSize;
|
||||
m_referralChase=c.m_referralChase;
|
||||
m_HopLimit=c.m_HopLimit;
|
||||
m_deref=c.m_deref;
|
||||
if(c.m_serverControls){
|
||||
m_serverControls=new LDAPControlSet(*c.m_serverControls);
|
||||
}else{
|
||||
m_serverControls=0;
|
||||
}
|
||||
if(c.m_clientControls){
|
||||
m_clientControls=new LDAPControlSet(*c.m_clientControls);
|
||||
}else{
|
||||
m_clientControls=0;
|
||||
}
|
||||
m_refRebind=c.m_refRebind;
|
||||
}
|
||||
|
||||
LDAPConstraints::~LDAPConstraints(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::~LDAPConstraints()" << endl);
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPConstraints::~LDAPConstraints()" << endl);
|
||||
delete m_clientControls;
|
||||
delete m_serverControls;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setAliasDeref(int deref){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setAliasDeref()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" deref:" << deref << endl);
|
||||
if( (deref == LDAPConstraints::DEREF_NEVER) ||
|
||||
(deref == LDAPConstraints::DEREF_SEARCHING) ||
|
||||
(deref == LDAPConstraints::DEREF_FINDING) ||
|
||||
(deref == LDAPConstraints::DEREF_ALWAYS)
|
||||
){
|
||||
m_aliasDeref=deref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LDAPConstraints::setMaxTime(int t){
|
||||
m_maxTime=t;
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setMaxTime()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," time:" << t << endl);
|
||||
m_maxTime=t;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setSizeLimit(int s){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setSizeLimit()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," size:" << s << endl);
|
||||
m_maxSize=s;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setReferralChase(bool rc){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setReferralChase()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER," rc:" << rc << endl);
|
||||
m_referralChase=rc;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setHopLimit(int limit){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setHopLimit()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" limit:" << limit << endl);
|
||||
m_HopLimit=limit;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setReferralRebind(const LDAPRebind* rebind){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setReferralRebind()" << endl);
|
||||
m_refRebind = rebind;
|
||||
}
|
||||
|
||||
void LDAPConstraints::setServerControls(const LDAPControlSet* ctrls){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setServerControls()" << endl);
|
||||
m_serverControls=new LDAPControlSet(*ctrls);
|
||||
}
|
||||
|
||||
void LDAPConstraints::setClientControls(const LDAPControlSet* ctrls){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::setClientControls()" << endl);
|
||||
m_clientControls=new LDAPControlSet(*ctrls);
|
||||
}
|
||||
|
||||
int LDAPConstraints::getAliasDeref() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getAliasDeref()" << endl);
|
||||
return m_aliasDeref;
|
||||
}
|
||||
|
||||
int LDAPConstraints::getMaxTime() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getMaxTime()" << endl);
|
||||
return m_maxTime;
|
||||
}
|
||||
|
||||
int LDAPConstraints::getSizeLimit() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getSizeLimit()" << endl);
|
||||
return m_maxSize;
|
||||
}
|
||||
|
||||
//TODO
|
||||
LDAPControl** LDAPConstraints::getSrvCtrlsArray() const {
|
||||
return 0;
|
||||
const LDAPRebind* LDAPConstraints::getReferralRebind() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getReferralRebind()" << endl);
|
||||
return m_refRebind;
|
||||
}
|
||||
|
||||
const LDAPControlSet* LDAPConstraints::getServerControls() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getServerControls()" << endl);
|
||||
return m_serverControls;
|
||||
}
|
||||
|
||||
const LDAPControlSet* LDAPConstraints::getClientControls() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::getClientControls()" << endl);
|
||||
return m_clientControls;
|
||||
}
|
||||
|
||||
LDAPControl** LDAPConstraints::getSrvCtrlsArray() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPContstraints::getSrvCtrlsArray()" << endl);
|
||||
if(m_serverControls){
|
||||
return m_serverControls->toLDAPControlArray();
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
LDAPControl** LDAPConstraints::getClCtrlsArray() const {
|
||||
return 0;
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPContstraints::getClCtrlsArray()" << endl);
|
||||
if(m_clientControls){
|
||||
return m_clientControls->toLDAPControlArray();
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
timeval* LDAPConstraints::getTimeoutStruct() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPContstraints::getTimeoutStruct()" << endl);
|
||||
if(m_maxTime == LDAP_NO_LIMIT){
|
||||
return 0;
|
||||
}else{
|
||||
|
|
@ -66,6 +162,12 @@ timeval* LDAPConstraints::getTimeoutStruct() const {
|
|||
}
|
||||
|
||||
bool LDAPConstraints::getReferralChase() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPContstraints::getReferralChase()" << endl);
|
||||
return m_referralChase;
|
||||
}
|
||||
|
||||
int LDAPConstraints::getHopLimit() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPContstraints::getHopLimit()" << endl);
|
||||
return m_HopLimit;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPConstraints.h,v 1.10 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_CONSTRAINTS_H
|
||||
#define LDAP_CONSTRAINTS_H
|
||||
|
|
@ -12,59 +11,89 @@
|
|||
#include "ac/time.h"
|
||||
|
||||
#include "LDAPControl.h"
|
||||
#include <ldap.h>
|
||||
|
||||
#include "LDAPControlSet.h"
|
||||
#include "LDAPRebind.h"
|
||||
|
||||
//TODO!!
|
||||
// * implement the Alias-Handling Option (OPT_DEREF)
|
||||
// * the Restart-Option ???
|
||||
// * default Server(s)
|
||||
|
||||
typedef list<LDAPCtrl*> LDAPControlSet;
|
||||
//! Class for representating the various protocol options
|
||||
/*! This class represents some options that can be set for a LDAPConnection
|
||||
//* Class for representating the various protocol options
|
||||
/** This class represents some options that can be set for a LDAPConnection
|
||||
* operation. Namely these are time and size limits. Options for referral
|
||||
* chasing and a default set of client of server controls to be used with
|
||||
* every request
|
||||
*/
|
||||
class LDAPConstraints{
|
||||
|
||||
private :
|
||||
//! max. time the server may spend for a search request
|
||||
int m_maxTime;
|
||||
|
||||
//! max number of entries to be return from a search request
|
||||
int m_maxSize;
|
||||
|
||||
//! Flag for enabling automatic referral/reference chasing
|
||||
bool m_referralChase;
|
||||
|
||||
//! Alias dereferencing option
|
||||
int m_deref;
|
||||
|
||||
//! List of Client Controls that should be used for each request
|
||||
LDAPControlSet m_clientControls;
|
||||
|
||||
//! List of Server Controls that should be used for each request
|
||||
LDAPControlSet m_serverControls;
|
||||
|
||||
|
||||
public :
|
||||
//! Constructs a LDAPConstraints object with default values
|
||||
const static int DEREF_NEVER = 0x00;
|
||||
const static int DEREF_SEARCHING = 0x01;
|
||||
const static int DEREF_FINDING = 0x02;
|
||||
const static int DEREF_ALWAYS = 0x04;
|
||||
|
||||
//* Constructs a LDAPConstraints object with default values
|
||||
LDAPConstraints();
|
||||
|
||||
//! Copy constructor
|
||||
//* Copy constructor
|
||||
LDAPConstraints(const LDAPConstraints& c);
|
||||
|
||||
~LDAPConstraints();
|
||||
|
||||
void setMaxTime(int t);
|
||||
void setAliasDeref(int deref);
|
||||
void setMaxTime(int t);
|
||||
void setSizeLimit(int s);
|
||||
void setReferralChase(bool rc);
|
||||
int getMaxTime() const ;
|
||||
void setHopLimit(int hop);
|
||||
void setReferralRebind(const LDAPRebind* rebind);
|
||||
void setServerControls(const LDAPControlSet* ctrls);
|
||||
void setClientControls(const LDAPControlSet* ctrls);
|
||||
|
||||
int getAliasDeref() const;
|
||||
int getMaxTime() const ;
|
||||
int getSizeLimit() const;
|
||||
const LDAPRebind* getReferralRebind() const;
|
||||
const LDAPControlSet* getServerControls() const;
|
||||
const LDAPControlSet* getClientControls() const;
|
||||
|
||||
//*for internal use only
|
||||
LDAPControl** getSrvCtrlsArray() const;
|
||||
|
||||
//*for internal use only
|
||||
LDAPControl** getClCtrlsArray() const;
|
||||
|
||||
//*for internal use only
|
||||
timeval* getTimeoutStruct() const;
|
||||
bool getReferralChase() const ;
|
||||
int getHopLimit() const;
|
||||
|
||||
private :
|
||||
int m_aliasDeref;
|
||||
|
||||
//* max. time the server may spend for a search request
|
||||
int m_maxTime;
|
||||
|
||||
//* max number of entries to return from a search request
|
||||
int m_maxSize;
|
||||
|
||||
//* Flag for enabling automatic referral/reference chasing
|
||||
bool m_referralChase;
|
||||
|
||||
//* HopLimit for referral chasing
|
||||
int m_HopLimit;
|
||||
|
||||
//* Alias dereferencing option
|
||||
int m_deref;
|
||||
|
||||
//* Object used to do bind for Referral chasing
|
||||
const LDAPRebind* m_refRebind;
|
||||
|
||||
//* List of Client Controls that should be used for each request
|
||||
LDAPControlSet* m_clientControls;
|
||||
|
||||
//* List of Server Controls that should be used for each request
|
||||
LDAPControlSet* m_serverControls;
|
||||
|
||||
};
|
||||
#endif //LDAP_CONSTRAINTS_H
|
||||
|
|
|
|||
|
|
@ -3,11 +3,76 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPControl.cpp,v 1.3 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "LDAPControl.h"
|
||||
|
||||
LDAPCtrl::LDAPCtrl(char *oid, bool critical, char *value=0, int length=0){
|
||||
|
||||
#include "debug.h"
|
||||
LDAPCtrl::LDAPCtrl(const LDAPCtrl& c){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPCtrl::LDAPCtrl(&)" << endl);
|
||||
m_oid=c.m_oid;
|
||||
m_data=c.m_data;
|
||||
m_isCritical=c.m_isCritical;
|
||||
}
|
||||
|
||||
LDAPCtrl::LDAPCtrl(const char *oid, bool critical, const char* data,
|
||||
int length){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPCtrl::LDAPCtrl()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" oid:" << oid << endl << " critical:" << critical << endl);
|
||||
m_oid = oid;
|
||||
m_isCritical=critical;
|
||||
if (data != 0 && length !=0){
|
||||
m_data.assign(data,length);
|
||||
}else{
|
||||
m_data=string();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LDAPCtrl::LDAPCtrl(const string& oid, bool critical, const string& data){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPCtrl::LDAPCtrl()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" oid:" << oid << endl << " critical:" << critical << endl);
|
||||
m_oid=oid;
|
||||
m_isCritical=critical;
|
||||
m_data=data;
|
||||
}
|
||||
|
||||
LDAPCtrl::LDAPCtrl(const LDAPControl* ctrl){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPCtrl::LDAPCtrl()" << endl);
|
||||
m_oid = string(ctrl->ldctl_oid);
|
||||
m_oid = ctrl->ldctl_iscritical ? true : false;
|
||||
m_oid = string(ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len );
|
||||
}
|
||||
|
||||
LDAPCtrl::~LDAPCtrl(){
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPCtrl::~LDAPCtrl" << endl);
|
||||
}
|
||||
|
||||
string LDAPCtrl::getOID() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPCtrl::getOID()" << endl);
|
||||
return m_oid;
|
||||
}
|
||||
|
||||
bool LDAPCtrl::isCritical()const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPCtrl::isCritical()" << endl);
|
||||
return m_isCritical;
|
||||
}
|
||||
|
||||
string LDAPCtrl::getData() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPCtrl::getData()" << endl);
|
||||
return m_data;
|
||||
}
|
||||
|
||||
LDAPControl* LDAPCtrl::getControlStruct() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPCtrl::getControlStruct()" << endl);
|
||||
LDAPControl* ret = new LDAPControl;
|
||||
ret->ldctl_oid= new char[m_oid.size() + 1];
|
||||
m_oid.copy(ret->ldctl_oid,string::npos);
|
||||
ret->ldctl_oid[m_oid.size()]=0;
|
||||
ret->ldctl_value.bv_len=m_data.size();
|
||||
ret->ldctl_value.bv_val= new char[m_data.size()];
|
||||
m_data.copy(ret->ldctl_value.bv_val,string::npos);
|
||||
ret->ldctl_iscritical = ( m_isCritical ? 1:0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,22 +3,32 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPControl.h,v 1.4 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_CONTROL_H
|
||||
#define LDAP_CONTROL_H
|
||||
#include <string>
|
||||
#include <ldap.h>
|
||||
|
||||
#include <lber.h>
|
||||
|
||||
class LDAPCtrl{
|
||||
private :
|
||||
char *m_oid;
|
||||
BerValue *m_data;
|
||||
bool m_isCritical;
|
||||
|
||||
public :
|
||||
LDAPCtrl(char *oid, bool critical, char *value=0, int length=0);
|
||||
|
||||
LDAPCtrl(const LDAPCtrl& c);
|
||||
LDAPCtrl(const char *oid, bool critical, const char *data=0,
|
||||
int length=0);
|
||||
LDAPCtrl(const string& oid, bool critical=false,
|
||||
const string& data=string());
|
||||
LDAPCtrl(const LDAPControl* ctrl);
|
||||
~LDAPCtrl();
|
||||
|
||||
string getOID() const;
|
||||
string getData() const;
|
||||
bool isCritical() const;
|
||||
LDAPControl* getControlStruct() const;
|
||||
|
||||
private :
|
||||
string m_oid;
|
||||
string m_data;
|
||||
bool m_isCritical;
|
||||
};
|
||||
|
||||
#endif //LDAP_CONTROL_H
|
||||
|
|
|
|||
|
|
@ -10,38 +10,41 @@
|
|||
#include "LDAPDeleteRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPMessageQueue.h"
|
||||
#include "LDAPResult.h"
|
||||
|
||||
LDAPDeleteRequest::LDAPDeleteRequest( const LDAPDeleteRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPDeleteRequest::LDAPDeleteRequest(LDAPDeleteRequest&)"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPDeleteRequest::LDAPDeleteRequest(&)" << endl);
|
||||
m_dn = req.m_dn;
|
||||
}
|
||||
|
||||
LDAPDeleteRequest::LDAPDeleteRequest(const char *dn,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false) : LDAPRequest(connect, cons, isReferral) {
|
||||
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::LDAPDeleteRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl);
|
||||
LDAPDeleteRequest::LDAPDeleteRequest(const string& dn,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral, const LDAPRequest* parent)
|
||||
: LDAPRequest(connect, cons, isReferral, parent) {
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPDeleteRequest::LDAPDeleteRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER, " dn:" << dn << endl);
|
||||
m_requestType=LDAPRequest::DELETE;
|
||||
if(dn != 0){
|
||||
m_dn=strdup(dn);
|
||||
}
|
||||
m_dn=dn;
|
||||
}
|
||||
|
||||
LDAPDeleteRequest::~LDAPDeleteRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
|
||||
delete[] m_dn;
|
||||
DEBUG(LDAP_DEBUG_DESTROY,
|
||||
"LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPDeleteRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
int err=ldap_delete_ext(m_connection->getSessionHandle(),m_dn,
|
||||
m_cons->getSrvCtrlsArray(), m_cons->getClCtrlsArray(),&msgID);
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
int err=ldap_delete_ext(m_connection->getSessionHandle(),m_dn.c_str(),
|
||||
tmpSrvCtrls, tmpClCtrls ,&msgID);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
|
|
@ -49,9 +52,21 @@ LDAPMessageQueue* LDAPDeleteRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPDeleteRequest::followReferral(LDAPUrlList *refs){
|
||||
LDAPRequest* LDAPDeleteRequest::followReferral(LDAPMsg* refs){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::followReferral()" << endl);
|
||||
cerr << "to be implemented" << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls= ((LDAPResult*)refs)->getReferralUrls();
|
||||
LDAPAsynConnection* con=0;
|
||||
try{
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
}catch (LDAPException e){
|
||||
delete con;
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPDeleteRequest(m_dn, con, m_cons, true, this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,16 @@
|
|||
class LDAPMessageQueue;
|
||||
|
||||
class LDAPDeleteRequest : public LDAPRequest{
|
||||
private :
|
||||
char *m_dn;
|
||||
public :
|
||||
LDAPDeleteRequest(const LDAPDeleteRequest& req);
|
||||
LDAPDeleteRequest(const char *dn, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false);
|
||||
LDAPDeleteRequest(const string& dn, LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false,
|
||||
const LDAPRequest* parent=0);
|
||||
virtual ~LDAPDeleteRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *refs);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* refs);
|
||||
|
||||
private :
|
||||
string m_dn;
|
||||
};
|
||||
#endif //LDAP_DELETE_REQUEST_H
|
||||
|
|
|
|||
|
|
@ -3,60 +3,68 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPEntry.cpp,v 1.6 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "debug.h"
|
||||
#include "LDAPEntry.h"
|
||||
|
||||
#include "LDAPException.h"
|
||||
|
||||
LDAPEntry::LDAPEntry(const LDAPEntry& entry){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::LDAPEntry(LDAPEntry&)" << endl);
|
||||
this->setDN(entry.m_dn);
|
||||
this->setAttributes(entry.m_attrs);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry(&)" << endl);
|
||||
m_dn=entry.m_dn;
|
||||
m_attrs=new LDAPAttributeList( *(entry.m_attrs));
|
||||
}
|
||||
|
||||
|
||||
LDAPEntry::LDAPEntry(const char *dn,
|
||||
LDAPAttributeList *attrs=new LDAPAttributeList()){
|
||||
m_attrs=attrs;
|
||||
m_dn=strdup(dn);
|
||||
LDAPEntry::LDAPEntry(const string& dn, const LDAPAttributeList *attrs){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" dn:" << dn << endl << " attrs:" << *attrs << endl);
|
||||
m_attrs=new LDAPAttributeList(*attrs);
|
||||
m_dn=dn;
|
||||
}
|
||||
|
||||
LDAPEntry::LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::LDAPEntry()" << endl);
|
||||
m_dn = ldap_get_dn(ld->getSessionHandle(),msg);
|
||||
m_attrs = new LDAPAttributeList(ld, msg);
|
||||
m_attrs->find("objectClass");
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPEntry::LDAPEntry()" << endl);
|
||||
char* tmp=ldap_get_dn(ld->getSessionHandle(),msg);
|
||||
m_dn=string(tmp);
|
||||
delete[] tmp;
|
||||
m_attrs = new LDAPAttributeList(ld, msg);
|
||||
}
|
||||
|
||||
LDAPEntry::~LDAPEntry(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::~LDAPEntry()" << endl);
|
||||
delete[] m_dn;
|
||||
delete m_attrs;
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPEntry::~LDAPEntry()" << endl);
|
||||
delete m_attrs;
|
||||
}
|
||||
|
||||
void LDAPEntry::setDN(const char* dn){
|
||||
if (m_dn != 0){
|
||||
delete[] m_dn;
|
||||
}
|
||||
m_dn=strdup(dn);
|
||||
void LDAPEntry::setDN(const string& dn){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setDN()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" dn:" << dn << endl);
|
||||
m_dn=dn;
|
||||
}
|
||||
|
||||
void LDAPEntry::setAttributes(LDAPAttributeList *attrs){
|
||||
if (m_attrs != 0){
|
||||
delete m_attrs;
|
||||
}
|
||||
m_attrs=attrs;
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::setAttributes()" << endl);
|
||||
DEBUG(LDAP_DEBUG_TRACE | LDAP_DEBUG_PARAMETER,
|
||||
" attrs:" << *attrs << endl);
|
||||
if (m_attrs != 0){
|
||||
delete m_attrs;
|
||||
}
|
||||
m_attrs=attrs;
|
||||
}
|
||||
|
||||
char* LDAPEntry::getDN(){
|
||||
return strdup(m_dn);
|
||||
const string LDAPEntry::getDN() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getDN()" << endl);
|
||||
return m_dn;
|
||||
}
|
||||
|
||||
LDAPAttributeList* LDAPEntry::getAttributes(){
|
||||
return m_attrs;
|
||||
const LDAPAttributeList* LDAPEntry::getAttributes() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::getAttributes()" << endl);
|
||||
return m_attrs;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& s, const LDAPEntry& le){
|
||||
s << "DN: " << le.m_dn << ": " << *(le.m_attrs);
|
||||
return s;
|
||||
s << "DN: " << le.m_dn << ": " << *(le.m_attrs);
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPEntry.h,v 1.4 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_ENTRY_H
|
||||
#define LDAP_ENTRY_H
|
||||
|
|
@ -13,19 +12,21 @@
|
|||
#include "LDAPAttributeList.h"
|
||||
|
||||
class LDAPEntry{
|
||||
private :
|
||||
LDAPAttributeList *m_attrs;
|
||||
char *m_dn;
|
||||
|
||||
public :
|
||||
LDAPEntry(const LDAPEntry& entry);
|
||||
LDAPEntry(const char *dn, LDAPAttributeList *attrs);
|
||||
LDAPEntry(const string& dn=string(),
|
||||
const LDAPAttributeList *attrs=new LDAPAttributeList());
|
||||
LDAPEntry(const LDAPAsynConnection *ld, LDAPMessage *msg);
|
||||
~LDAPEntry();
|
||||
void setDN(const char* dn);
|
||||
void setDN(const string& dn);
|
||||
void setAttributes(LDAPAttributeList *attrs);
|
||||
char* getDN();
|
||||
LDAPAttributeList* getAttributes();
|
||||
const string getDN() const ;
|
||||
const LDAPAttributeList* getAttributes() const;
|
||||
friend ostream& operator << (ostream& s, const LDAPEntry& le);
|
||||
|
||||
private :
|
||||
LDAPAttributeList *m_attrs;
|
||||
string m_dn;
|
||||
};
|
||||
#endif //LDAP_ENTRY_H
|
||||
|
|
|
|||
|
|
@ -3,44 +3,46 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPException.cpp,v 1.7 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
|
||||
#include <ldap.h>
|
||||
#include "config.h"
|
||||
#include "ac/string.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPReferralException.h"
|
||||
|
||||
LDAPException::LDAPException(int res_code, char *err_string=0){
|
||||
#include "LDAPAsynConnection.h"
|
||||
|
||||
LDAPException::LDAPException(int res_code, const string& err_string){
|
||||
m_res_code=res_code;
|
||||
m_res_string=ldap_err2string(res_code);
|
||||
if(err_string != 0){
|
||||
m_err_string=strdup(err_string);
|
||||
}else{
|
||||
m_err_string=0;
|
||||
}
|
||||
m_res_string=string(ldap_err2string(res_code));
|
||||
m_err_string=err_string;
|
||||
}
|
||||
|
||||
LDAPException::LDAPException(const LDAPAsynConnection *lc){
|
||||
m_err_string=0;
|
||||
m_res_string=0;
|
||||
m_err_string=string();
|
||||
m_res_string=string();
|
||||
LDAP *l = lc->getSessionHandle();
|
||||
ldap_get_option(l,LDAP_OPT_ERROR_NUMBER,&m_res_code);
|
||||
m_res_string=ldap_err2string(m_res_code);
|
||||
ldap_get_option(l,LDAP_OPT_ERROR_STRING,&m_err_string);
|
||||
m_res_string=string(ldap_err2string(m_res_code));
|
||||
char* err_string;
|
||||
ldap_get_option(l,LDAP_OPT_ERROR_STRING,&err_string);
|
||||
m_err_string=string(err_string);
|
||||
}
|
||||
|
||||
int LDAPException::getResultCode(){
|
||||
LDAPException::~LDAPException(){
|
||||
}
|
||||
|
||||
int LDAPException::getResultCode() const{
|
||||
return m_res_code;
|
||||
}
|
||||
|
||||
char* LDAPException::getResultMsg(){
|
||||
return strdup(m_res_string);
|
||||
const string& LDAPException::getResultMsg() const{
|
||||
return m_res_string;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& s, LDAPException e){
|
||||
s << "Error " << e.m_res_code << ": " << e.m_res_string;
|
||||
if (e.m_err_string != 0) {
|
||||
if (e.m_err_string.size() > 0) {
|
||||
s << endl << "additional info: " << e.m_err_string ;
|
||||
}
|
||||
return s;
|
||||
|
|
|
|||
|
|
@ -3,26 +3,28 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPException.h,v 1.6 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_EXCEPTION_H
|
||||
#define LDAP_EXCEPTION_H
|
||||
|
||||
#include <iostream>
|
||||
#include "LDAPAsynConnection.h"
|
||||
#include <string>
|
||||
|
||||
class LDAPAsynConnection;
|
||||
|
||||
class LDAPException{
|
||||
|
||||
private :
|
||||
int m_res_code;
|
||||
char* m_res_string;
|
||||
char* m_err_string;
|
||||
string m_res_string;
|
||||
string m_err_string;
|
||||
|
||||
public :
|
||||
LDAPException(int res_code, char *err_string=0);
|
||||
LDAPException(int res_code, const string& err_string=string());
|
||||
LDAPException(const LDAPAsynConnection *lc);
|
||||
int getResultCode();
|
||||
char* getResultMsg();
|
||||
virtual ~LDAPException();
|
||||
int getResultCode() const;
|
||||
const string& getResultMsg() const;
|
||||
friend ostream& operator << (ostream &s, LDAPException e);
|
||||
};
|
||||
#endif //LDAP_EXCEPTION_H
|
||||
|
|
|
|||
|
|
@ -10,39 +10,47 @@
|
|||
|
||||
#include "LDAPExtRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPResult.h"
|
||||
|
||||
LDAPExtRequest::LDAPExtRequest(const LDAPExtRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPExtRequest::LDAPExtRequest(LDAPExtRequest&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPExtRequest::LDAPExtRequest(&)" << endl);
|
||||
m_data=req.m_data;
|
||||
m_oid=req.m_oid;
|
||||
}
|
||||
|
||||
LDAPExtRequest::LDAPExtRequest(const char *oid, const BerValue* data,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false) : LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::LDAPExtRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " oid:" << oid << endl);
|
||||
assert(oid);
|
||||
m_oid=strdup(oid);
|
||||
if(data){
|
||||
m_data=ber_bvdup(data);
|
||||
}else{
|
||||
m_data=0;
|
||||
}
|
||||
LDAPExtRequest::LDAPExtRequest(const string& oid, const string& data,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral, const LDAPRequest* parent)
|
||||
: LDAPRequest(connect, cons, isReferral, parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPExtRequest::LDAPExtRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" oid:" << oid << endl);
|
||||
m_oid=oid;
|
||||
m_data=data;
|
||||
}
|
||||
|
||||
LDAPExtRequest::~LDAPExtRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::~LDAPExtRequest()" << endl);
|
||||
delete[] m_oid;
|
||||
ber_bvfree(m_data);
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPExtRequest::~LDAPExtRequest()" << endl);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPExtRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
int err=ldap_extended_operation(m_connection->getSessionHandle(),m_oid,
|
||||
m_data, m_cons->getSrvCtrlsArray(), m_cons->getClCtrlsArray(),
|
||||
&msgID);
|
||||
BerValue* tmpdata=0;
|
||||
if(m_data != ""){
|
||||
tmpdata=new BerValue;
|
||||
tmpdata->bv_len = m_data.size();
|
||||
tmpdata->bv_val = new char[m_data.size()];
|
||||
m_data.copy(tmpdata->bv_val, string::npos);
|
||||
}
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
int err=ldap_extended_operation(m_connection->getSessionHandle(),
|
||||
m_oid.c_str(), tmpdata, tmpSrvCtrls, tmpClCtrls, &msgID);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
ber_bvfree(tmpdata);
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
|
|
@ -52,9 +60,21 @@ LDAPMessageQueue* LDAPExtRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPExtRequest::followReferral(LDAPUrlList *urls){
|
||||
LDAPRequest* LDAPExtRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::followReferral()" << endl);
|
||||
cerr << "to be implemented" << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls = ((LDAPResult*)ref)->getReferralUrls();
|
||||
LDAPAsynConnection* con = 0;
|
||||
try {
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
} catch(LDAPException e){
|
||||
delete con;
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPExtRequest(m_oid, m_data, con, m_cons,true,this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,17 +10,18 @@
|
|||
|
||||
class LDAPExtRequest : LDAPRequest {
|
||||
|
||||
private:
|
||||
char *m_oid;
|
||||
BerValue *m_data;
|
||||
public:
|
||||
LDAPExtRequest(const LDAPExtRequest& req);
|
||||
LDAPExtRequest(const char *oid, const BerValue *data,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false);
|
||||
LDAPExtRequest(const string& oid, const string& data,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false, const LDAPRequest* parent=0);
|
||||
virtual ~LDAPExtRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *urls);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* urls);
|
||||
|
||||
private:
|
||||
string m_oid;
|
||||
string m_data;
|
||||
};
|
||||
|
||||
#endif // LDAP_EXT_REQUEST_H
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPMessage.cpp,v 1.6 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "LDAPMessage.h"
|
||||
|
||||
#include "LDAPResult.h"
|
||||
#include "LDAPExtResult.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPSearchResult.h"
|
||||
#include "LDAPSearchReference.h"
|
||||
|
|
@ -14,19 +15,23 @@
|
|||
#include <iostream>
|
||||
|
||||
LDAPMsg::LDAPMsg(LDAPMessage *msg){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::LDAPMsg()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPMsg::LDAPMsg()" << endl);
|
||||
msgType=ldap_msgtype(msg);
|
||||
m_hasControls=false;
|
||||
}
|
||||
|
||||
LDAPMsg* LDAPMsg::create(LDAPRequest *req, LDAPMessage *msg){
|
||||
LDAPMsg* LDAPMsg::create(const LDAPRequest *req, LDAPMessage *msg){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl);
|
||||
switch(ldap_msgtype(msg)){
|
||||
case LDAP_RES_SEARCH_ENTRY :
|
||||
case SEARCH_ENTRY :
|
||||
return new LDAPSearchResult(req,msg);
|
||||
break;
|
||||
case LDAP_RES_SEARCH_REFERENCE :
|
||||
case SEARCH_REFERENCE :
|
||||
return new LDAPSearchReference(req, msg);
|
||||
break;
|
||||
case EXTENDED_RESPONSE :
|
||||
return new LDAPExtResult(req,msg);
|
||||
break;
|
||||
default :
|
||||
return new LDAPResult(req, msg);
|
||||
}
|
||||
|
|
@ -35,10 +40,20 @@ LDAPMsg* LDAPMsg::create(LDAPRequest *req, LDAPMessage *msg){
|
|||
|
||||
|
||||
int LDAPMsg::getMessageType(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMessageType()" << endl);
|
||||
return msgType;
|
||||
}
|
||||
|
||||
int LDAPMsg::getMsgID(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMsgID()" << endl);
|
||||
return msgID;
|
||||
}
|
||||
|
||||
bool LDAPMsg::hasControls() const{
|
||||
return m_hasControls;
|
||||
}
|
||||
|
||||
const LDAPControlSet& LDAPMsg::getSrvControls() const {
|
||||
return m_srvControls;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPMessage.h,v 1.7 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_MSG_H
|
||||
#define LDAP_MSG_H
|
||||
#include <ldap.h>
|
||||
|
||||
//#include "LDAPConnection.h"
|
||||
#include "LDAPControlSet.h"
|
||||
|
||||
class LDAPRequest;
|
||||
//! Represents an LDAPMsg returned from the server
|
||||
|
|
@ -19,14 +18,7 @@ class LDAPRequest;
|
|||
* static method create() (see below)
|
||||
*/
|
||||
class LDAPMsg{
|
||||
private:
|
||||
int msgID;
|
||||
protected:
|
||||
int msgType;
|
||||
LDAPMsg(LDAPMessage *msg);
|
||||
|
||||
public:
|
||||
|
||||
//public Constants defining the Message types
|
||||
static const int BIND_RESPONSE=LDAP_RES_BIND;
|
||||
static const int SEARCH_ENTRY=LDAP_RES_SEARCH_ENTRY;
|
||||
|
|
@ -48,8 +40,19 @@ class LDAPMsg{
|
|||
* *msg-Parameter. *msg is e.g. a Message returned by the C-API's
|
||||
* ldap_result call.
|
||||
*/
|
||||
static LDAPMsg* create(LDAPRequest *req, LDAPMessage *msg);
|
||||
static LDAPMsg* create(const LDAPRequest *req, LDAPMessage *msg);
|
||||
int getMessageType();
|
||||
int getMsgID();
|
||||
bool hasControls() const;
|
||||
const LDAPControlSet& getSrvControls() const;
|
||||
|
||||
protected:
|
||||
LDAPMsg(LDAPMessage *msg);
|
||||
LDAPControlSet m_srvControls;
|
||||
bool m_hasControls;
|
||||
|
||||
private:
|
||||
int msgType;
|
||||
int msgID;
|
||||
};
|
||||
#endif //ifndef LDAP_MSG_H
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPMessageQueue.cpp,v 1.17 2000/08/31 17:43:48 rhafer Exp $
|
||||
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
|
@ -19,46 +18,60 @@
|
|||
#include "LDAPUrlList.h"
|
||||
#include "LDAPException.h"
|
||||
|
||||
// TODO: How to handel unsolicited notifications, like notice of
|
||||
// TODO: How to handle unsolicited notifications, like notice of
|
||||
// disconnection
|
||||
|
||||
LDAPMessageQueue::LDAPMessageQueue(LDAPRequest *req){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPMessageQueue::LDAPMessageQueue()" << endl);
|
||||
m_reqQueue.push(req);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPMessageQueue::LDAPMessageQueue()" << endl);
|
||||
m_activeReq.push(req);
|
||||
m_issuedReq.push_back(req);
|
||||
}
|
||||
|
||||
LDAPMessageQueue::~LDAPMessageQueue(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPMessageQueue::~LDAPMessageQueue()" << endl);
|
||||
LDAPRequest *req;
|
||||
while(! m_reqQueue.empty()){
|
||||
req=m_reqQueue.top();
|
||||
delete req;
|
||||
m_reqQueue.pop();
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPMessageQueue::~LDAPMessageQueue()" << endl);
|
||||
for(LDAPRequestList::iterator i=m_issuedReq.begin();
|
||||
i != m_issuedReq.end(); i++){
|
||||
delete *i;
|
||||
}
|
||||
m_issuedReq.clear();
|
||||
}
|
||||
|
||||
|
||||
LDAPMsg *LDAPMessageQueue::getNext(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMessageQueue::getNext()" << endl);
|
||||
LDAPMessage *msg;
|
||||
LDAPRequest *req=m_reqQueue.top();
|
||||
const LDAPConstraints *constr=req->getConstraints();
|
||||
LDAPRequest *req=m_activeReq.top();
|
||||
int msg_id = req->getMsgID();
|
||||
int res;
|
||||
const LDAPAsynConnection *con=req->getConnection();
|
||||
res=ldap_result(con->getSessionHandle(),msg_id,0,0,&msg);
|
||||
if (res <= 0){
|
||||
ldap_msgfree(msg);
|
||||
res=ldap_result(con->getSessionHandle(),msg_id,0,0,&msg);
|
||||
if (res <= 0){
|
||||
if(msg != 0){
|
||||
ldap_msgfree(msg);
|
||||
}
|
||||
throw LDAPException(con);
|
||||
}else{
|
||||
LDAPMsg *ret = LDAPMsg::create(req,msg);
|
||||
ldap_msgfree(msg);
|
||||
const LDAPConstraints *constr=req->getConstraints();
|
||||
LDAPMsg *ret=0;
|
||||
//this can throw an exception (Decoding Error)
|
||||
try{
|
||||
ret = LDAPMsg::create(req,msg);
|
||||
ldap_msgfree(msg);
|
||||
}catch(LDAPException e){
|
||||
//do some clean up
|
||||
delete req;
|
||||
m_activeReq.top();
|
||||
throw;
|
||||
}
|
||||
switch (ret->getMessageType()) {
|
||||
case LDAPMsg::SEARCH_REFERENCE :
|
||||
if (constr->getReferralChase() ){
|
||||
LDAPSearchReference *ref=(LDAPSearchReference *)ret;
|
||||
LDAPRequest *refReq=chaseReferral(ref->getURLs());
|
||||
//throws Exception (limit Exceeded)
|
||||
LDAPRequest *refReq=chaseReferral(ret);
|
||||
if(refReq != 0){
|
||||
m_reqQueue.push(refReq);
|
||||
m_activeReq.push(refReq);
|
||||
m_issuedReq.push_back(refReq);
|
||||
delete ret;
|
||||
return getNext();
|
||||
}
|
||||
}
|
||||
|
|
@ -68,40 +81,66 @@ LDAPMsg *LDAPMessageQueue::getNext(){
|
|||
return ret;
|
||||
break;
|
||||
case LDAPMsg::SEARCH_DONE :
|
||||
if (req->isReferral()){
|
||||
LDAPResult* res_p=(LDAPResult*)ret;
|
||||
switch (res_p->getResultCode()) {
|
||||
case LDAPResult::REFERRAL :
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"referral chasing to be implemented"
|
||||
<< endl);
|
||||
if(req->isReferral()){
|
||||
req->unbind();
|
||||
}
|
||||
switch ( ((LDAPResult*)ret)->getResultCode()) {
|
||||
case LDAPResult::REFERRAL :
|
||||
if(constr->getReferralChase()){
|
||||
//throws Exception (limit Exceeded)
|
||||
LDAPRequest *refReq=chaseReferral(ret);
|
||||
if(refReq != 0){
|
||||
m_activeReq.pop();
|
||||
m_activeReq.push(refReq);
|
||||
m_issuedReq.push_back(refReq);
|
||||
delete ret;
|
||||
return getNext();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
break;
|
||||
case LDAPResult::SUCCESS :
|
||||
if(req->isReferral()){
|
||||
delete ret;
|
||||
m_activeReq.pop();
|
||||
return getNext();
|
||||
}else{
|
||||
m_activeReq.pop();
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
return ret;
|
||||
}
|
||||
delete req;
|
||||
m_reqQueue.pop();
|
||||
return getNext();
|
||||
}else{
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
m_activeReq.pop();
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
//must be some kind of LDAPResultMessage
|
||||
default:
|
||||
if(req->isReferral()){
|
||||
req->unbind();
|
||||
}
|
||||
LDAPResult* res_p=(LDAPResult*)ret;
|
||||
switch (res_p->getResultCode()) {
|
||||
case LDAPResult::REFERRAL :
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"referral chasing to be implemented"
|
||||
<< endl);
|
||||
//for now just end it here
|
||||
delete req;
|
||||
if(constr->getReferralChase()){
|
||||
//throws Exception (limit Exceeded)
|
||||
LDAPRequest *refReq=chaseReferral(ret);
|
||||
if(refReq != 0){
|
||||
m_activeReq.pop();
|
||||
m_activeReq.push(refReq);
|
||||
m_issuedReq.push_back(refReq);
|
||||
delete ret;
|
||||
return getNext();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
delete req;
|
||||
m_reqQueue.pop();
|
||||
m_activeReq.pop();
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
|
@ -111,16 +150,25 @@ LDAPMsg *LDAPMessageQueue::getNext(){
|
|||
|
||||
// TODO Maybe moved to LDAPRequest::followReferral seems more reasonable
|
||||
//there
|
||||
LDAPRequest* LDAPMessageQueue::chaseReferral(LDAPUrlList *refs){
|
||||
LDAPRequest* LDAPMessageQueue::chaseReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMessageQueue::chaseReferra()" << endl);
|
||||
LDAPRequest *req=m_reqQueue.top();
|
||||
LDAPRequest *refReq=req->followReferral(refs);
|
||||
LDAPRequest *req=m_activeReq.top();
|
||||
LDAPRequest *refReq=req->followReferral(ref);
|
||||
if(refReq !=0){
|
||||
if(refReq->getConstraints()->getHopLimit() < refReq->getHopCount()){
|
||||
cout << "LIMIT:" << refReq->getConstraints()->getHopLimit()
|
||||
<< " COUNT:" << refReq->getHopCount() << endl;
|
||||
delete(refReq);
|
||||
throw LDAPException(LDAP_REFERRAL_LIMIT_EXCEEDED);
|
||||
}
|
||||
if(refReq->isCycle()){
|
||||
delete(refReq);
|
||||
throw LDAPException(LDAP_CLIENT_LOOP);
|
||||
}
|
||||
try {
|
||||
refReq->sendRequest();
|
||||
return refReq;
|
||||
}catch (LDAPException e){
|
||||
cout << e << endl;
|
||||
DEBUG(LDAP_DEBUG_TRACE," caught exception" << endl);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -130,6 +178,7 @@ LDAPRequest* LDAPMessageQueue::chaseReferral(LDAPUrlList *refs){
|
|||
}
|
||||
|
||||
LDAPRequestStack* LDAPMessageQueue::getRequestStack(){
|
||||
return &m_reqQueue;
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPMessageQueue::getRequestStack()" << endl);
|
||||
return &m_activeReq;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPMessageQueue.h,v 1.10 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_MESSAGE_QUEUE_H
|
||||
#define LDAP_MESSAGE_QUEUE_H
|
||||
|
|
@ -18,17 +17,19 @@ class LDAPRequest;
|
|||
class LDAPSearchRequest;
|
||||
class LDAPUrl;
|
||||
typedef stack<LDAPRequest*> LDAPRequestStack;
|
||||
typedef list<LDAPRequest*> LDAPRequestList;
|
||||
|
||||
class LDAPMessageQueue{
|
||||
private :
|
||||
LDAPRequestStack m_reqQueue;
|
||||
void chaseReference(LDAPSearchRequest *req);
|
||||
public :
|
||||
LDAPMessageQueue(LDAPRequest *conn);
|
||||
~LDAPMessageQueue();
|
||||
LDAPMsg* getNext();
|
||||
LDAPRequest* chaseReferral(LDAPUrlList *ref);
|
||||
LDAPRequest* chaseReferral(LDAPMsg* ref);
|
||||
LDAPRequestStack* getRequestStack();
|
||||
|
||||
private :
|
||||
LDAPRequestStack m_activeReq;
|
||||
LDAPRequestList m_issuedReq;
|
||||
};
|
||||
#endif //ifndef LDAP_MESSAGE_QUEUE_H
|
||||
|
||||
|
|
|
|||
|
|
@ -9,61 +9,77 @@
|
|||
|
||||
#include "LDAPModDNRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPResult.h"
|
||||
#include "LDAPUrlList.h"
|
||||
|
||||
LDAPModDNRequest::LDAPModDNRequest(const LDAPModDNRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPModDNRequest::LDAPModDNRequest(LDAPModDNRequest&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPModDNRequest::LDAPModDNRequest(&)" << endl);
|
||||
m_dn = req.m_dn;
|
||||
m_newRDN = req.m_newRDN;
|
||||
m_newParentDN = req.m_newParentDN;
|
||||
m_deleteOld = req.m_deleteOld;
|
||||
}
|
||||
|
||||
LDAPModDNRequest::LDAPModDNRequest(const char *dn, const char *newRDN,
|
||||
bool deleteOld, const char *newParentDN,
|
||||
const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false):
|
||||
LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModDNRequest::LDAPModDNRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
|
||||
<< " newRDN:" << newRDN << endl
|
||||
<< " deleteOld:" << deleteOld << endl
|
||||
<< " newParentDN:" << newParentDN << endl);
|
||||
assert(dn);
|
||||
m_dn = strdup(dn);
|
||||
assert(newRDN);
|
||||
m_newRDN = strdup(newRDN);
|
||||
if (newParentDN){
|
||||
m_newParentDN = strdup(newParentDN);
|
||||
}else{
|
||||
m_newParentDN = 0;
|
||||
}
|
||||
LDAPModDNRequest::LDAPModDNRequest(const string& dn, const string& newRDN,
|
||||
bool deleteOld, const string& newParentDN,
|
||||
LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral,
|
||||
const LDAPRequest* parent):
|
||||
LDAPRequest(connect, cons, isReferral, parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPModDNRequest::LDAPModDNRequest(&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" dn:" << dn << endl << " newRDN:" << newRDN << endl
|
||||
<< " deleteOld:" << deleteOld << endl
|
||||
<< " newParent:" << newParentDN << endl);
|
||||
m_dn = dn;
|
||||
m_newRDN = newRDN;
|
||||
m_newParentDN = newParentDN;
|
||||
m_deleteOld=deleteOld;
|
||||
}
|
||||
|
||||
LDAPModDNRequest::~LDAPModDNRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModDNRequest::~LDAPModDNRequest()" << endl);
|
||||
delete[] m_dn;
|
||||
delete[] m_newRDN;
|
||||
delete[] m_newParentDN;
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPModDNRequest::~LDAPModDNRequest()" << endl);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPModDNRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModDNRequest::sendRequest()" << endl);
|
||||
int msg_id;
|
||||
int err=ldap_rename(m_connection->getSessionHandle(),m_dn,m_newRDN,
|
||||
m_newParentDN,m_deleteOld ? 1 : 0, m_cons->getSrvCtrlsArray(),
|
||||
m_cons->getClCtrlsArray(),&msg_id);
|
||||
const char* newRDN = (m_newRDN == "" ? 0 :m_newRDN.c_str());
|
||||
const char* newParentDN = (m_newParentDN == "" ?
|
||||
0 :
|
||||
m_newParentDN.c_str());
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
int err=ldap_rename(m_connection->getSessionHandle(),m_dn.c_str(),newRDN,
|
||||
newParentDN,m_deleteOld ? 1 : 0, tmpSrvCtrls, tmpClCtrls,&msg_id);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
if(err!=LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msg_id;
|
||||
return new LDAPMessageQueue(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPModDNRequest::followReferral(LDAPUrlList *urls){
|
||||
LDAPRequest* LDAPModDNRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::followReferral()" << endl);
|
||||
cerr << "to be implemented ..." << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls = ((LDAPResult*)ref)->getReferralUrls();
|
||||
LDAPAsynConnection* con = 0;
|
||||
try {
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
} catch(LDAPException e){
|
||||
delete con;
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPModDNRequest(m_dn, m_newRDN, m_deleteOld, m_newParentDN,
|
||||
con, m_cons,true,this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,21 +9,23 @@
|
|||
#include "LDAPRequest.h"
|
||||
|
||||
class LDAPModDNRequest : LDAPRequest {
|
||||
private:
|
||||
char *m_dn;
|
||||
char *m_newRDN;
|
||||
char *m_newParentDN;
|
||||
bool m_deleteOld;
|
||||
|
||||
public:
|
||||
LDAPModDNRequest(const LDAPModDNRequest& req);
|
||||
LDAPModDNRequest(const char *dn, const char *newRDN, bool deleteOld,
|
||||
const char *newParentDN, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false);
|
||||
LDAPModDNRequest(const string& dn, const string& newRDN,
|
||||
bool deleteOld, const string& newParentDN,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false, const LDAPRequest* parent=0);
|
||||
virtual ~LDAPModDNRequest();
|
||||
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList* urls);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* urls);
|
||||
|
||||
private:
|
||||
string m_dn;
|
||||
string m_newRDN;
|
||||
string m_newParentDN;
|
||||
bool m_deleteOld;
|
||||
};
|
||||
|
||||
#endif // LDAP_MOD_DN_REQUEST_H
|
||||
|
|
|
|||
|
|
@ -3,21 +3,26 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPModList.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include "LDAPModList.h"
|
||||
#include "debug.h"
|
||||
|
||||
LDAPModList::LDAPModList(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl);
|
||||
}
|
||||
|
||||
LDAPModList::LDAPModList(const LDAPModList&){
|
||||
LDAPModList::LDAPModList(const LDAPModList& ml){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList(&)" << endl);
|
||||
m_modList=ml.m_modList;
|
||||
}
|
||||
|
||||
void LDAPModList::addModification(const LDAPModification &mod){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::addModification()" << endl);
|
||||
m_modList.push_back(mod);
|
||||
}
|
||||
|
||||
LDAPMod** LDAPModList::toLDAPModArray(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::toLDAPModArray()" << endl);
|
||||
LDAPMod **ret = new LDAPMod*[m_modList.size()+1];
|
||||
ret[m_modList.size()]=0;
|
||||
ModList::const_iterator i;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPModList.h,v 1.3 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_MOD_LIST_H
|
||||
#define LDAP_MOD_LIST_H
|
||||
|
|
@ -15,8 +14,6 @@
|
|||
typedef list<LDAPModification> ModList;
|
||||
|
||||
class LDAPModList{
|
||||
private :
|
||||
ModList m_modList;
|
||||
|
||||
public :
|
||||
LDAPModList();
|
||||
|
|
@ -25,6 +22,8 @@ class LDAPModList{
|
|||
void addModification(const LDAPModification &mod);
|
||||
LDAPMod** toLDAPModArray();
|
||||
|
||||
private :
|
||||
ModList m_modList;
|
||||
};
|
||||
#endif //LDAP_MOD_LIST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -3,21 +3,25 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPModification.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include "LDAPModification.h"
|
||||
#include "debug.h"
|
||||
|
||||
LDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModification::LDAPModification()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" attr:" << attr << endl);
|
||||
m_attr = attr;
|
||||
m_mod_op = op;
|
||||
}
|
||||
|
||||
LDAPMod *LDAPModification::toLDAPMod() const {
|
||||
LDAPMod* LDAPModification::toLDAPMod() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPModification::toLDAPMod()" << endl);
|
||||
LDAPMod* ret=m_attr.toLDAPMod();
|
||||
|
||||
//The mod_op value of the LDAPMod-struct needs to be ORed with the right
|
||||
// LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for explanation of
|
||||
// the LDAPMod struct)
|
||||
// LDAP_MOD_* constant to preserve the BIN-flag (see CAPI-draft for
|
||||
// explanation of the LDAPMod struct)
|
||||
switch (m_mod_op){
|
||||
case OP_ADD :
|
||||
ret->mod_op |= LDAP_MOD_ADD;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPModification.h,v 1.3 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_MODIFICATION_H
|
||||
#define LDAP_MODIFICATION_H
|
||||
|
|
|
|||
|
|
@ -10,41 +10,46 @@
|
|||
#include "LDAPModifyRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPMessageQueue.h"
|
||||
#include "LDAPResult.h"
|
||||
|
||||
LDAPModifyRequest::LDAPModifyRequest(const LDAPModifyRequest& req) :
|
||||
LDAPRequest(req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPModifyRequest::LDAPModifyRequest(LDAPModifyRequest&)"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPModifyRequest::LDAPModifyRequest(&)" << endl);
|
||||
m_modList = new LDAPModList(*(req.m_modList));
|
||||
m_dn = req.m_dn;
|
||||
}
|
||||
|
||||
LDAPModifyRequest::LDAPModifyRequest(const char *dn,
|
||||
const LDAPModList *modList, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral=false) :
|
||||
LDAPRequest(connect, cons, isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPModifyRequest::LDAPModifyRequest(LDAPModifyRequest&)"
|
||||
<< endl);
|
||||
DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl);
|
||||
|
||||
m_dn = strdup(dn);
|
||||
LDAPModifyRequest::LDAPModifyRequest(const string& dn,
|
||||
const LDAPModList *modList, LDAPAsynConnection *connect,
|
||||
const LDAPConstraints *cons, bool isReferral,
|
||||
const LDAPRequest* parent) :
|
||||
LDAPRequest(connect, cons, isReferral, parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPModifyRequest::LDAPModifyRequest(&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" dn:" << dn << endl);
|
||||
m_dn = dn;
|
||||
m_modList = new LDAPModList(*modList);
|
||||
}
|
||||
|
||||
LDAPModifyRequest::~LDAPModifyRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::~LDAPModifyRequest()" << endl);
|
||||
delete m_dn;
|
||||
DEBUG(LDAP_DEBUG_DESTROY,
|
||||
"LDAPModifyRequest::~LDAPModifyRequest()" << endl);
|
||||
delete m_modList;
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPModifyRequest::sendRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::sendRequest()" << endl);
|
||||
int msgID=0;
|
||||
int err=ldap_modify_ext(m_connection->getSessionHandle(),m_dn,
|
||||
m_modList->toLDAPModArray(), m_cons->getSrvCtrlsArray(),
|
||||
m_cons->getClCtrlsArray(),&msgID);
|
||||
LDAPControl** tmpSrvCtrls=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrls=m_cons->getClCtrlsArray();
|
||||
LDAPMod** tmpMods=m_modList->toLDAPModArray();
|
||||
int err=ldap_modify_ext(m_connection->getSessionHandle(),m_dn.c_str(),
|
||||
tmpMods, tmpSrvCtrls, tmpClCtrls,&msgID);
|
||||
ldap_controls_free(tmpSrvCtrls);
|
||||
ldap_controls_free(tmpClCtrls);
|
||||
if(err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
|
|
@ -52,9 +57,21 @@ LDAPMessageQueue* LDAPModifyRequest::sendRequest(){
|
|||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPModifyRequest::followReferral(LDAPUrlList *refs){
|
||||
LDAPRequest* LDAPModifyRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::followReferral()" << endl);
|
||||
cerr << "to be implemented ..." << endl;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPUrlList urls = ((LDAPResult*)ref)->getReferralUrls();
|
||||
LDAPAsynConnection* con = 0;
|
||||
try {
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
} catch(LDAPException e){
|
||||
delete con;
|
||||
return 0;
|
||||
}
|
||||
if(con != 0){
|
||||
return new LDAPModifyRequest(m_dn, m_modList, con, m_cons,true,this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ class LDAPMessageQueue;
|
|||
|
||||
class LDAPModifyRequest : LDAPRequest {
|
||||
private :
|
||||
char *m_dn;
|
||||
string m_dn;
|
||||
LDAPModList *m_modList;
|
||||
|
||||
public:
|
||||
LDAPModifyRequest(const LDAPModifyRequest& mod);
|
||||
LDAPModifyRequest(const char *dn, const LDAPModList *modList,
|
||||
const LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false);
|
||||
LDAPModifyRequest(const string& dn, const LDAPModList *modList,
|
||||
LDAPAsynConnection *connect, const LDAPConstraints *cons,
|
||||
bool isReferral=false, const LDAPRequest* req=0);
|
||||
virtual ~LDAPModifyRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *refs);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* refs);
|
||||
};
|
||||
|
||||
#endif // LDAP_MODIFY_REQUEST_H
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPReferral.cpp,v 1.8 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include <iostream>
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPReferral.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPUrl.h"
|
||||
|
||||
LDAPReferral::LDAPReferral() {
|
||||
}
|
||||
|
||||
LDAPReferral::~LDAPReferral(){
|
||||
LDAPUrlList::const_iterator i;
|
||||
for(i=m_urlList.begin(); i!=m_urlList.end(); i++){
|
||||
delete *i;
|
||||
}
|
||||
}
|
||||
|
||||
LDAPUrl* LDAPReferral::getURL(){
|
||||
return m_urlList.front();
|
||||
}
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPReferral.h,v 1.8 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_REFERRAL_H
|
||||
#define LDAP_REFERRAL_H
|
||||
|
||||
#include <list>
|
||||
#include "LDAPMessage.h"
|
||||
|
||||
class LDAPRequest;
|
||||
class LDAPUrl;
|
||||
|
||||
|
||||
class LDAPReferral {
|
||||
|
||||
private :
|
||||
LDAPUrlList m_urlList;
|
||||
|
||||
public :
|
||||
LDAPReferral();
|
||||
~LDAPReferral();
|
||||
LDAPUrl* getURL();
|
||||
};
|
||||
|
||||
#endif //LDAP_REFERRAL_H
|
||||
|
|
@ -3,59 +3,110 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPRequest.cpp,v 1.11 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include "debug.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPReferral.h"
|
||||
|
||||
LDAPRequest::LDAPRequest(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPRequest::LDAPRequest()" << endl);
|
||||
}
|
||||
|
||||
LDAPRequest::LDAPRequest(const LDAPRequest& req){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPRequest::LDAPRequest(LDAPRequest&)" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPRequest::LDAPRequest(&)" << endl);
|
||||
m_isReferral=req.m_isReferral;
|
||||
m_cons = new LDAPConstraints(*(req.m_cons));
|
||||
m_connection = req.m_connection;
|
||||
m_parent = req.m_parent;
|
||||
m_hopCount = req.m_hopCount;
|
||||
m_msgID = req.m_msgID;
|
||||
}
|
||||
|
||||
LDAPRequest::LDAPRequest(const LDAPAsynConnection* con,
|
||||
const LDAPConstraints* cons, bool isReferral){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::LDAPRequest()" << endl);
|
||||
LDAPRequest::LDAPRequest(LDAPAsynConnection* con,
|
||||
const LDAPConstraints* cons,bool isReferral, const LDAPRequest* parent){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPRequest::LDAPRequest()" << endl);
|
||||
m_connection=con;
|
||||
if(cons == 0){
|
||||
cons=con->getConstraints();
|
||||
m_cons=new LDAPConstraints( *(con->getConstraints()) );
|
||||
}else{
|
||||
m_cons=new LDAPConstraints( *cons);
|
||||
}
|
||||
m_isReferral=isReferral;
|
||||
if(m_isReferral){
|
||||
m_hopCount = (parent->getHopCount()+1);
|
||||
m_parent= parent;
|
||||
}else{
|
||||
m_hopCount=0;
|
||||
m_parent=0;
|
||||
}
|
||||
m_cons=new LDAPConstraints( *cons);
|
||||
m_isReferral=isReferral;
|
||||
}
|
||||
|
||||
LDAPRequest::~LDAPRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::~LDAPRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPRequest::~LDAPRequest()" << endl);
|
||||
delete m_cons;
|
||||
}
|
||||
|
||||
const LDAPConstraints* LDAPRequest::getConstraints(){
|
||||
const LDAPConstraints* LDAPRequest::getConstraints() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConstraints()" << endl);
|
||||
return m_cons;
|
||||
}
|
||||
|
||||
const LDAPAsynConnection* LDAPRequest::getConnection(){
|
||||
const LDAPAsynConnection* LDAPRequest::getConnection() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getConnection()" << endl);
|
||||
return m_connection;
|
||||
}
|
||||
|
||||
int LDAPRequest::getType() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getType()" << endl);
|
||||
return m_requestType;
|
||||
}
|
||||
|
||||
int LDAPRequest::getMsgID() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getMsgId()" << endl);
|
||||
return m_msgID;
|
||||
}
|
||||
|
||||
int LDAPRequest::getHopCount() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getHopCount()" << endl);
|
||||
return m_hopCount;
|
||||
}
|
||||
|
||||
const LDAPRequest* LDAPRequest::getParent() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::getParent()" << endl);
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
bool LDAPRequest::isReferral() const {
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isReferral()" << endl);
|
||||
return m_isReferral;
|
||||
}
|
||||
|
||||
/*
|
||||
bool LDAPRequest::doRebind() const {
|
||||
cerr << "doRebind not implemented always returns true" << endl;
|
||||
return true;
|
||||
bool LDAPRequest::equals(const LDAPRequest* req) const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::equals()" << endl);
|
||||
if( (this->m_requestType == req->getType()) &&
|
||||
(this->m_connection->getHost() == req->m_connection->getHost()) &&
|
||||
(this->m_connection->getPort() == req->m_connection->getPort())
|
||||
){
|
||||
return true;
|
||||
}return false;
|
||||
}
|
||||
*/
|
||||
|
||||
bool LDAPRequest::isCycle() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::isCycle()" << endl);
|
||||
const LDAPRequest* parent=m_parent;
|
||||
if(parent != 0){
|
||||
do{
|
||||
if(this->equals(parent)){
|
||||
return true;
|
||||
}else{
|
||||
parent=parent->getParent();
|
||||
}
|
||||
}
|
||||
while(parent != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LDAPRequest::unbind() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::unbind()" << endl);
|
||||
m_connection->unbind();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPRequest.h,v 1.11 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_REQUEST_H
|
||||
#define LDAP_REQUEST_H
|
||||
|
|
@ -16,29 +15,8 @@ class LDAPUrl;
|
|||
|
||||
//!virtual class for Requests
|
||||
class LDAPRequest{
|
||||
|
||||
protected :
|
||||
bool m_isReferral;
|
||||
int m_requestType;
|
||||
LDAPConstraints *m_cons;
|
||||
const LDAPAsynConnection *m_connection;
|
||||
int m_msgID; //the associated C-API Message ID
|
||||
LDAPRequest();
|
||||
|
||||
public :
|
||||
LDAPRequest(const LDAPRequest& req);
|
||||
LDAPRequest(const LDAPAsynConnection* conn, const LDAPConstraints* cons,
|
||||
bool isReferral=false);
|
||||
virtual ~LDAPRequest();
|
||||
virtual LDAPMessageQueue* sendRequest()=0;
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *ref)=0;
|
||||
const LDAPConstraints* getConstraints();
|
||||
const LDAPAsynConnection* getConnection();
|
||||
int getType()const;
|
||||
int getMsgID() const;
|
||||
bool isReferral() const;
|
||||
bool doRebind() const;
|
||||
|
||||
static const int BIND=0;
|
||||
static const int UNBIND=2;
|
||||
static const int SEARCH=3;
|
||||
|
|
@ -46,6 +24,36 @@ class LDAPRequest{
|
|||
static const int ADD=8;
|
||||
static const int DELETE=10;
|
||||
static const int COMPARE=14;
|
||||
|
||||
LDAPRequest(const LDAPRequest& req);
|
||||
LDAPRequest(LDAPAsynConnection* conn,
|
||||
const LDAPConstraints* cons, bool isReferral=false,
|
||||
const LDAPRequest* parent=0);
|
||||
virtual ~LDAPRequest();
|
||||
|
||||
const LDAPConstraints* getConstraints() const;
|
||||
const LDAPAsynConnection* getConnection() const;
|
||||
int getType()const;
|
||||
int getMsgID() const;
|
||||
int getHopCount() const;
|
||||
const LDAPRequest* getParent() const;
|
||||
|
||||
bool isReferral() const;
|
||||
void unbind() const;
|
||||
virtual LDAPMessageQueue* sendRequest()=0;
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* ref)=0;
|
||||
virtual bool equals(const LDAPRequest* req) const;
|
||||
bool isCycle() const;
|
||||
|
||||
protected :
|
||||
bool m_isReferral;
|
||||
int m_requestType;
|
||||
LDAPConstraints *m_cons;
|
||||
LDAPAsynConnection *m_connection;
|
||||
const LDAPRequest* m_parent;
|
||||
int m_hopCount;
|
||||
int m_msgID; //the associated C-API Message ID
|
||||
LDAPRequest();
|
||||
};
|
||||
#endif //LDAP_REQUEST_H
|
||||
|
||||
|
|
|
|||
|
|
@ -3,55 +3,83 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPResult.cpp,v 1.10 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include "debug.h"
|
||||
#include"LDAPResult.h"
|
||||
#include"LDAPAsynConnection.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPException.h"
|
||||
|
||||
LDAPResult::LDAPResult(LDAPRequest *req, LDAPMessage *msg) : LDAPMsg(msg){
|
||||
if(msg != 0){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::LDAPResult()" << endl);
|
||||
LDAPResult::LDAPResult(const LDAPRequest *req, LDAPMessage *msg) :
|
||||
LDAPMsg(msg){
|
||||
if(msg != 0){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPResult::LDAPResult()" << endl);
|
||||
const LDAPAsynConnection *con=req->getConnection();
|
||||
|
||||
//TODO!!:
|
||||
//handle referrals and controls
|
||||
char **refs=0;
|
||||
ldap_parse_result(con->getSessionHandle(),msg,&m_resCode,
|
||||
&m_matchedDN, &m_errMsg,&refs,0,0);
|
||||
if (refs != 0){
|
||||
for (char **tmp=refs;*tmp != 0; tmp++){
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," url:" << *tmp << endl);
|
||||
LDAPControl** srvctrls=0;
|
||||
char* matchedDN=0;
|
||||
char* errMsg=0;
|
||||
int err=ldap_parse_result(con->getSessionHandle(),msg,&m_resCode,
|
||||
&matchedDN, &errMsg,&refs,&srvctrls,0);
|
||||
if(err != LDAP_SUCCESS){
|
||||
ldap_value_free(refs);
|
||||
ldap_controls_free(srvctrls);
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
if (refs){
|
||||
m_referrals=LDAPUrlList(refs);
|
||||
ldap_value_free(refs);
|
||||
}
|
||||
if (srvctrls){
|
||||
m_srvControls = LDAPControlSet(srvctrls);
|
||||
m_hasControls = true;
|
||||
ldap_controls_free(srvctrls);
|
||||
}else{
|
||||
m_hasControls = false;
|
||||
}
|
||||
if(matchedDN != 0){
|
||||
m_matchedDN=string(matchedDN);
|
||||
delete[] matchedDN;
|
||||
}
|
||||
if(errMsg != 0){
|
||||
m_errMsg=string(errMsg);
|
||||
delete[] errMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LDAPResult::~LDAPResult(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::~LDAPResult()" << endl);
|
||||
delete[] m_matchedDN;
|
||||
delete[] m_errMsg;
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPResult::~LDAPResult()" << endl);
|
||||
}
|
||||
|
||||
int LDAPResult::getResultCode(){
|
||||
int LDAPResult::getResultCode() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::getResultCode()" << endl);
|
||||
return m_resCode;
|
||||
}
|
||||
|
||||
char* LDAPResult::resToString(){
|
||||
return ldap_err2string(m_resCode);
|
||||
string LDAPResult::resToString() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::resToString()" << endl);
|
||||
return string(ldap_err2string(m_resCode));
|
||||
}
|
||||
|
||||
char* LDAPResult::getErrMsg(){
|
||||
return strdup(m_errMsg);
|
||||
const string& LDAPResult::getErrMsg() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::getErrMsg()" << endl);
|
||||
return m_errMsg;
|
||||
}
|
||||
|
||||
char* LDAPResult::getMatchedDN(){
|
||||
return strdup(m_matchedDN);
|
||||
const string& LDAPResult::getMatchedDN() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::getMatchedDN()" << endl);
|
||||
return m_matchedDN;
|
||||
}
|
||||
|
||||
const LDAPUrlList& LDAPResult::getReferralUrls() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::getReferralUrl()" << endl);
|
||||
return m_referrals;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream &s,LDAPResult &l){
|
||||
return s << "Result: " << l.m_resCode << ": "
|
||||
return s << "Result: " << l.m_resCode << ": "
|
||||
<< ldap_err2string(l.m_resCode) << endl
|
||||
<< "Matched: " << l.m_matchedDN << endl << "ErrMsg: " << l.m_errMsg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPResult.h,v 1.7 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_RESPNSE_H
|
||||
#define LDAP_RESPONSE_H
|
||||
|
|
@ -11,26 +10,96 @@
|
|||
#include<iostream>
|
||||
#include<ldap.h>
|
||||
#include "LDAPMessage.h"
|
||||
#include "LDAPControlSet.h"
|
||||
#include "LDAPUrlList.h"
|
||||
|
||||
class LDAPRequest;
|
||||
class LDAPAsynConnection;
|
||||
class LDAPResult : public LDAPMsg{
|
||||
private :
|
||||
int m_resCode;
|
||||
char *m_matchedDN;
|
||||
char *m_errMsg;
|
||||
|
||||
public :
|
||||
static const int SUCCESS=0;
|
||||
static const int REFERRAL=10;
|
||||
|
||||
LDAPResult(LDAPRequest *req, LDAPMessage *msg);
|
||||
class LDAPResult : public LDAPMsg{
|
||||
public :
|
||||
//Error codes from RFC 2251
|
||||
static const int SUCCESS = 0;
|
||||
static const int OPERATIONS_ERROR = 1;
|
||||
static const int PROTOCOL_ERROR = 2;
|
||||
static const int TIME_LIMIT_EXCEEDED = 3;
|
||||
static const int SIZE_LIMIT_EXCEEDED = 4;
|
||||
static const int COMPARE_FALSE = 5;
|
||||
static const int COMPARE_TRUE = 6;
|
||||
static const int AUTH_METHOD_NOT_SUPPORTED = 7;
|
||||
static const int STRONG_AUTH_REQUIRED = 8;
|
||||
|
||||
static const int REFERRAL = 10;
|
||||
static const int ADMIN_LIMIT_EXCEEDED = 11;
|
||||
static const int UNAVAILABLE_CRITICAL_EXTENSION = 12;
|
||||
static const int CONFIDENTIALITY_REQUIRED = 13;
|
||||
static const int SASL_BIND_IN_PROGRESS = 14;
|
||||
|
||||
static const int NO_SUCH_ATTRIBUTE = 16;
|
||||
static const int UNDEFINED_ATTRIBUTE_TYP = 17;
|
||||
static const int INAPPROPRIATE_MATCHING = 18;
|
||||
static const int CONSTRAINT_VIOLATION = 19;
|
||||
static const int ATTRIBUTE_OR_VALUE_EXISTS = 20;
|
||||
static const int INVALID_ATTRIBUTE_SYNTAX = 21;
|
||||
|
||||
static const int NO_SUCH_OBJECT = 32;
|
||||
static const int ALIAS_PROBLEM = 33;
|
||||
static const int INVALID_DN_SYNTAX = 34;
|
||||
|
||||
static const int ALIAS_DEREFERENCING_PROBLEM = 36;
|
||||
|
||||
static const int INAPPROPRIATE_AUTENTICATION = 48;
|
||||
static const int INVALID_CREDENTIALS = 49;
|
||||
static const int INSUFFICIENT_ACCESS = 50;
|
||||
static const int BUSY = 51;
|
||||
static const int UNAVAILABLE = 52;
|
||||
static const int UNWILLING_TO_PERFORM = 53;
|
||||
static const int LOOP_DETECT = 54;
|
||||
|
||||
static const int NAMING_VIOLATION = 64;
|
||||
static const int OBJECT_CLASS_VIOLATION = 65;
|
||||
static const int NOT_ALLOWED_ON_NONLEAF = 66;
|
||||
static const int NOT_ALLOWED_ON_RDN = 67;
|
||||
static const int ENTRY_ALREADY_EXISTS = 68;
|
||||
static const int OBJECT_CLASS_MODS_PROHIBITED = 69;
|
||||
|
||||
static const int AFFECTS_MULTIPLE_DSAS = 71;
|
||||
|
||||
// some Errorcodes defined in the LDAP C API DRAFT
|
||||
static const int OTHER = 80;
|
||||
static const int SERVER_DOWN = 81;
|
||||
static const int LOCAL_ERROR = 82;
|
||||
static const int ENCODING_ERROR = 83;
|
||||
static const int DECODING_ERROR = 84;
|
||||
static const int TIMEOUT = 85;
|
||||
static const int AUTH_UNKNOWN = 86;
|
||||
static const int FILTER_ERROR = 87;
|
||||
static const int USER_CANCELLED = 88;
|
||||
static const int PARAM_ERROR = 89;
|
||||
static const int NO_MEMORY = 90;
|
||||
static const int CONNECT_ERROR = 91;
|
||||
static const int NOT_SUPPORTED = 92;
|
||||
static const int CONTROL_NOT_FOUND = 93;
|
||||
static const int NO_RESULTS_RETURNED = 94;
|
||||
static const int MORE_RESULTS_TO_RETURN = 95;
|
||||
static const int CLIENT_LOOP = 96;
|
||||
static const int REFERRAL_LIMIT_EXCEEDED = 97;
|
||||
|
||||
LDAPResult(const LDAPRequest *req, LDAPMessage *msg);
|
||||
virtual ~LDAPResult();
|
||||
int getResultCode();
|
||||
char* resToString();
|
||||
char* getErrMsg();
|
||||
char* getMatchedDN();
|
||||
friend ostream& operator<<(ostream &s,LDAPResult &l);
|
||||
int getResultCode() const;
|
||||
string resToString() const;
|
||||
const string& getErrMsg() const;
|
||||
const string& getMatchedDN() const;
|
||||
const LDAPUrlList& getReferralUrls() const;
|
||||
|
||||
private :
|
||||
int m_resCode;
|
||||
string m_matchedDN;
|
||||
string m_errMsg;
|
||||
LDAPUrlList m_referrals;
|
||||
|
||||
friend ostream& operator<<(ostream &s,LDAPResult &l);
|
||||
};
|
||||
#endif //LDAP_RESPONSE_H
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPSearchReference.cpp,v 1.7 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -13,32 +12,39 @@
|
|||
#include "LDAPRequest.h"
|
||||
#include "LDAPUrl.h"
|
||||
|
||||
LDAPSearchReference::LDAPSearchReference(LDAPRequest *req, LDAPMessage *msg) :
|
||||
LDAPMsg(msg){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::LDAPSearchReference()"
|
||||
<< endl;)
|
||||
LDAPSearchReference::LDAPSearchReference(const LDAPRequest *req,
|
||||
LDAPMessage *msg) : LDAPMsg(msg){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPSearchReference::LDAPSearchReference()" << endl;)
|
||||
char **ref=0;
|
||||
LDAPControl** srvctrls=0;
|
||||
const LDAPAsynConnection* con=req->getConnection();
|
||||
int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref, 0,0);
|
||||
int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref,
|
||||
&srvctrls,0);
|
||||
if (err != LDAP_SUCCESS){
|
||||
ldap_value_free(ref);
|
||||
ldap_controls_free(srvctrls);
|
||||
throw LDAPException(err);
|
||||
}else{
|
||||
char **tmp;
|
||||
for (tmp=ref; *tmp != 0; tmp++){
|
||||
m_urlList.push_back( new LDAPUrl(*tmp) );
|
||||
DEBUG(LDAP_DEBUG_PARAMETER," URL:" << *tmp << endl);
|
||||
m_urlList=LDAPUrlList(ref);
|
||||
ldap_value_free(ref);
|
||||
if (srvctrls){
|
||||
m_srvControls = LDAPControlSet(srvctrls);
|
||||
m_hasControls = true;
|
||||
ldap_controls_free(srvctrls);
|
||||
}else{
|
||||
m_hasControls = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LDAPSearchReference::~LDAPSearchReference(){
|
||||
LDAPUrlList::const_iterator i;
|
||||
for(i=m_urlList.begin(); i!=m_urlList.end(); i++){
|
||||
delete *i;
|
||||
}
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchReference::~LDAPSearchReference()"
|
||||
<< endl);
|
||||
}
|
||||
|
||||
LDAPUrlList* LDAPSearchReference::getURLs(){
|
||||
return &m_urlList;
|
||||
const LDAPUrlList& LDAPSearchReference::getUrls() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::getUrls()" << endl);
|
||||
return m_urlList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPSearchReference.h,v 1.7 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_SEARCH_REFERENCE_H
|
||||
#define LDAP_SEARCH_REFERENCE_H
|
||||
|
|
@ -16,14 +15,14 @@ class LDAPUrl;
|
|||
|
||||
class LDAPSearchReference : public LDAPMsg{
|
||||
|
||||
public :
|
||||
LDAPSearchReference(const LDAPRequest* req, LDAPMessage* msg);
|
||||
~LDAPSearchReference();
|
||||
const LDAPUrlList& getUrls() const;
|
||||
|
||||
private :
|
||||
LDAPUrlList m_urlList;
|
||||
LDAPSearchReference();
|
||||
|
||||
public :
|
||||
LDAPSearchReference(LDAPRequest* req, LDAPMessage* msg);
|
||||
~LDAPSearchReference();
|
||||
LDAPUrlList* getURLs();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,94 +7,125 @@
|
|||
#include "LDAPSearchRequest.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPSearchReference.h"
|
||||
#include "LDAPResult.h"
|
||||
#include "LDAPRequest.h"
|
||||
#include "LDAPReferral.h"
|
||||
#include "LDAPUrl.h"
|
||||
|
||||
LDAPSearchRequest::LDAPSearchRequest(const LDAPSearchRequest& req ) :
|
||||
LDAPRequest (req){
|
||||
DEBUG(LDAP_DEBUG_TRACE,
|
||||
"LDAPSearchRequest::LDAPSearchRequest(LDAPSearchRequest&" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPSearchRequest::LDAPSearchRequest(&)" << endl);
|
||||
m_base=req.m_base;
|
||||
m_scope=req.m_scope;
|
||||
m_filter=req.m_filter;
|
||||
m_attrs=req.m_attrs;
|
||||
m_attrsOnly=req.m_attrsOnly;
|
||||
}
|
||||
|
||||
|
||||
LDAPSearchRequest::LDAPSearchRequest(const char *base, int scope,
|
||||
const char *filter, char **attrs, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints* cons, bool isReferral)
|
||||
: LDAPRequest (connect,cons,isReferral) {
|
||||
LDAPSearchRequest::LDAPSearchRequest(const string& base, int scope,
|
||||
const string& filter, const StringList& attrs, bool attrsOnly,
|
||||
LDAPAsynConnection *connect,
|
||||
const LDAPConstraints* cons, bool isReferral,
|
||||
const LDAPRequest* parent)
|
||||
: LDAPRequest (connect,cons,isReferral,parent) {
|
||||
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchRequest:LDAPSearchRequest" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,
|
||||
"LDAPSearchRequest:LDAPSearchRequest()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT & LDAP_DEBUG_PARAMETER,
|
||||
" base:" << base << endl << " scope:" << scope << endl
|
||||
<< " filter:" << filter << endl);
|
||||
m_requestType=LDAPRequest::SEARCH;
|
||||
//insert some validating and copying here
|
||||
m_base=strdup(base);
|
||||
m_base=base;
|
||||
m_scope=scope;
|
||||
|
||||
if (filter != 0 ){
|
||||
m_filter=strdup(filter);
|
||||
if(filter == ""){
|
||||
m_filter="objectClass=*";
|
||||
}else{
|
||||
m_filter=0;
|
||||
}
|
||||
|
||||
if (attrs != 0){
|
||||
size_t size=0;
|
||||
for (char** i=attrs; *i != 0; i++){
|
||||
size++;
|
||||
}
|
||||
m_attrs = new char*[size+1];
|
||||
m_attrs[size]=0;
|
||||
int j=0;
|
||||
for (char** i=attrs; *i != 0; i++,j++){
|
||||
m_attrs[j]=strdup(*i);
|
||||
}
|
||||
}else{
|
||||
m_attrs = 0;
|
||||
m_filter=filter;
|
||||
}
|
||||
m_attrs=attrs;
|
||||
m_attrsOnly=attrsOnly;
|
||||
}
|
||||
|
||||
LDAPSearchRequest::~LDAPSearchRequest(){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPSearchRequest::~LDAPSearchRequest" << endl);
|
||||
delete[] m_base;
|
||||
delete[] m_filter;
|
||||
if (m_attrs != 0){
|
||||
for (char** i=m_attrs; *i != 0; i++){
|
||||
delete[] *i;
|
||||
}
|
||||
}
|
||||
delete[] m_attrs;
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPSearchRequest::~LDAPSearchRequest" << endl);
|
||||
}
|
||||
|
||||
LDAPMessageQueue* LDAPSearchRequest::sendRequest(){
|
||||
int msgID;
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPSearchRequest::sendRequest()" << endl);
|
||||
int err=ldap_search_ext(m_connection->getSessionHandle(), m_base, m_scope,
|
||||
m_filter, m_attrs, 0, m_cons->getSrvCtrlsArray(),
|
||||
m_cons->getClCtrlsArray(), m_cons->getTimeoutStruct(),
|
||||
m_cons->getSizeLimit(), &msgID );
|
||||
timeval* tmptime=m_cons->getTimeoutStruct();
|
||||
char** tmpattrs=m_attrs.toCharArray();
|
||||
LDAPControl** tmpSrvCtrl=m_cons->getSrvCtrlsArray();
|
||||
LDAPControl** tmpClCtrl=m_cons->getClCtrlsArray();
|
||||
int aliasDeref = m_cons->getAliasDeref();
|
||||
ldap_set_option(m_connection->getSessionHandle(), LDAP_OPT_DEREF,
|
||||
&aliasDeref);
|
||||
int err=ldap_search_ext(m_connection->getSessionHandle(), m_base.c_str(),
|
||||
m_scope, m_filter.c_str(), tmpattrs, m_attrsOnly, tmpSrvCtrl,
|
||||
tmpClCtrl, tmptime, m_cons->getSizeLimit(), &msgID );
|
||||
delete tmptime;
|
||||
ldap_value_free(tmpattrs);
|
||||
ldap_controls_free(tmpSrvCtrl);
|
||||
ldap_controls_free(tmpClCtrl);
|
||||
|
||||
if (err != LDAP_SUCCESS){
|
||||
delete this;
|
||||
throw LDAPException(err);
|
||||
} else {
|
||||
} else if (isReferral()){
|
||||
m_msgID=msgID;
|
||||
return 0;
|
||||
}else{
|
||||
m_msgID=msgID;
|
||||
return new LDAPMessageQueue(this);
|
||||
}
|
||||
}
|
||||
|
||||
LDAPRequest* LDAPSearchRequest::followReferral(LDAPUrlList *ref){
|
||||
LDAPUrl *usedUrl;
|
||||
LDAPRequest* LDAPSearchRequest::followReferral(LDAPMsg* ref){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPSearchRequest::followReferral()" << endl);
|
||||
LDAPAsynConnection *con = getConnection()->referralConnect(ref, &usedUrl);
|
||||
if (con != 0){
|
||||
const char *base= usedUrl->getDN();
|
||||
// TODO maybe the scope and filter have to be adjusted
|
||||
int scope = m_scope;
|
||||
char *filter=0;
|
||||
if (m_filter != 0){
|
||||
filter = strdup(m_filter);
|
||||
LDAPUrlList urls;
|
||||
LDAPUrlList::const_iterator usedUrl;
|
||||
LDAPAsynConnection* con;
|
||||
string filter;
|
||||
int scope;
|
||||
if(ref->getMessageType() == LDAPMsg::SEARCH_REFERENCE){
|
||||
urls = ((LDAPSearchReference *)ref)->getUrls();
|
||||
}else{
|
||||
urls = ((LDAPResult *)ref)->getReferralUrls();
|
||||
}
|
||||
con = getConnection()->referralConnect(urls,usedUrl,m_cons);
|
||||
if(con != 0){
|
||||
cerr << usedUrl->getFilter();
|
||||
if((usedUrl->getFilter() != "") &&
|
||||
(usedUrl->getFilter() != m_filter)){
|
||||
filter=usedUrl->getFilter();
|
||||
}else{
|
||||
filter=m_filter;
|
||||
}
|
||||
if( (ref->getMessageType() == LDAPMsg::SEARCH_REFERENCE) &&
|
||||
(m_scope == LDAPAsynConnection::SEARCH_ONE)
|
||||
){
|
||||
scope = LDAPAsynConnection::SEARCH_BASE;
|
||||
DEBUG(LDAP_DEBUG_TRACE," adjusted scope to BASE" << endl);
|
||||
}else{
|
||||
scope = m_scope;
|
||||
}
|
||||
return new LDAPSearchRequest(base, scope, filter, 0, con, m_cons,true);
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
return new LDAPSearchRequest(usedUrl->getDN(), scope, filter,
|
||||
m_attrs, m_attrsOnly, con, m_cons,true,this);
|
||||
}
|
||||
|
||||
|
||||
bool LDAPSearchRequest::equals(const LDAPRequest* req)const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchRequest::equals()" << endl);
|
||||
if( LDAPRequest::equals(req)){
|
||||
LDAPSearchRequest* sreq = (LDAPSearchRequest*)req;
|
||||
if ( (m_base == sreq->m_base) &&
|
||||
(m_scope == sreq->m_scope)
|
||||
){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,24 +14,29 @@ class LDAPReferral;
|
|||
class LDAPUrl;
|
||||
|
||||
class LDAPSearchRequest : public LDAPRequest{
|
||||
private :
|
||||
const char *m_base;
|
||||
int m_scope;
|
||||
const char *m_filter;
|
||||
char **m_attrs;
|
||||
|
||||
//no default constructor
|
||||
LDAPSearchRequest();
|
||||
|
||||
public :
|
||||
LDAPSearchRequest(const LDAPSearchRequest& req);
|
||||
|
||||
LDAPSearchRequest(const char *base, int scope, const char* filter,
|
||||
char **attrs, const LDAPAsynConnection *connect,
|
||||
const LDAPConstraints* cons, bool isReferral=false);
|
||||
LDAPSearchRequest(const string& base, int scope, const string& filter,
|
||||
const StringList& attrs, bool attrsOnly,
|
||||
LDAPAsynConnection *connect,
|
||||
const LDAPConstraints* cons, bool isReferral=false,
|
||||
const LDAPRequest* parent=0);
|
||||
virtual ~LDAPSearchRequest();
|
||||
virtual LDAPMessageQueue* sendRequest();
|
||||
virtual LDAPRequest* followReferral(LDAPUrlList *ref);
|
||||
virtual LDAPRequest* followReferral(LDAPMsg* ref);
|
||||
virtual bool equals(const LDAPRequest* req) const;
|
||||
|
||||
private :
|
||||
string m_base;
|
||||
int m_scope;
|
||||
string m_filter;
|
||||
StringList m_attrs;
|
||||
bool m_attrsOnly;
|
||||
|
||||
//no default constructor
|
||||
LDAPSearchRequest(){};
|
||||
};
|
||||
|
||||
#endif //LDAP_SEARCH_REQUEST_H
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPSearchResult.cpp,v 1.6 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -11,18 +10,38 @@
|
|||
#include"LDAPSearchResult.h"
|
||||
#include "LDAPRequest.h"
|
||||
|
||||
LDAPSearchResult::LDAPSearchResult(LDAPRequest *req, LDAPMessage *msg)
|
||||
: LDAPMsg(msg){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::LDAPSearchResult()" << endl);
|
||||
LDAPSearchResult::LDAPSearchResult(const LDAPRequest *req,
|
||||
LDAPMessage *msg) : LDAPMsg(msg){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPSearchResult::LDAPSearchResult()" << endl);
|
||||
entry = new LDAPEntry(req->getConnection(), msg);
|
||||
//retrieve the controls here
|
||||
LDAPControl** srvctrls=0;
|
||||
int err = ldap_get_entry_controls(req->getConnection()->getSessionHandle(),
|
||||
msg,&srvctrls);
|
||||
if(err != LDAP_SUCCESS){
|
||||
ldap_controls_free(srvctrls);
|
||||
}else{
|
||||
if (srvctrls){
|
||||
m_srvControls = LDAPControlSet(srvctrls);
|
||||
m_hasControls = true;
|
||||
ldap_controls_free(srvctrls);
|
||||
}else{
|
||||
m_hasControls = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LDAPSearchResult::LDAPSearchResult(const LDAPSearchResult& res) :
|
||||
LDAPMsg(res){
|
||||
entry = new LDAPEntry(*(res.entry));
|
||||
}
|
||||
|
||||
LDAPSearchResult::~LDAPSearchResult(){
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::~LDAPSearchResult()" << endl);
|
||||
DEBUG(LDAP_DEBUG_DESTROY,"LDAPSearchResult::~LDAPSearchResult()" << endl);
|
||||
delete entry;
|
||||
}
|
||||
|
||||
LDAPEntry* LDAPSearchResult::getEntry(){
|
||||
const LDAPEntry* LDAPSearchResult::getEntry() const{
|
||||
DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::getEntry()" << endl);
|
||||
return entry;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPSearchResult.h,v 1.4 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_SEARCH_RESULT_H
|
||||
#define LDAP_SEARCH_RESULT_H
|
||||
|
|
@ -14,11 +13,13 @@
|
|||
class LDAPRequest;
|
||||
|
||||
class LDAPSearchResult : public LDAPMsg{
|
||||
private:
|
||||
LDAPEntry *entry;
|
||||
public:
|
||||
LDAPSearchResult(LDAPRequest *req, LDAPMessage *msg);
|
||||
LDAPSearchResult(const LDAPRequest *req, LDAPMessage *msg);
|
||||
LDAPSearchResult(const LDAPSearchResult& res);
|
||||
virtual ~LDAPSearchResult();
|
||||
LDAPEntry* getEntry();
|
||||
const LDAPEntry* getEntry() const;
|
||||
|
||||
private:
|
||||
LDAPEntry *entry;
|
||||
};
|
||||
#endif //LDAP_SEARCH_RESULT_H
|
||||
|
|
|
|||
|
|
@ -3,68 +3,70 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPUrl.cpp,v 1.6 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#include "LDAPUrl.h"
|
||||
|
||||
#include <ldap.h>
|
||||
#include <ac/string.h>
|
||||
#include "debug.h"
|
||||
|
||||
LDAPUrl::LDAPUrl(char *url){
|
||||
DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::LDAPUrl()" << endl);
|
||||
LDAPUrl::LDAPUrl(const char *url){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPUrl::LDAPUrl()" << endl);
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT | LDAP_DEBUG_PARAMETER,
|
||||
" url:" << url << endl);
|
||||
if (ldap_is_ldap_url(url)){
|
||||
m_urlString = strdup(url);
|
||||
ldap_url_parse(url, &m_urlDesc);
|
||||
LDAPURLDesc *urlDesc;
|
||||
ldap_url_parse(url, &urlDesc);
|
||||
if(urlDesc->lud_host){
|
||||
m_Host = string(urlDesc->lud_host);
|
||||
}
|
||||
m_Port = urlDesc->lud_port;
|
||||
if(urlDesc->lud_dn){
|
||||
m_DN = string(urlDesc->lud_dn);
|
||||
}
|
||||
m_Attrs = StringList(urlDesc->lud_attrs);
|
||||
m_Scope = urlDesc->lud_scope;
|
||||
if(urlDesc->lud_filter){
|
||||
m_Filter = string(urlDesc->lud_filter);
|
||||
}else{
|
||||
m_Filter = "";
|
||||
}
|
||||
m_urlString= string(url);
|
||||
ldap_free_urldesc(urlDesc);
|
||||
}else{
|
||||
DEBUG(LDAP_DEBUG_TRACE," noUrl:" << url << endl);
|
||||
}
|
||||
}
|
||||
|
||||
LDAPUrl::LDAPUrl(char *host, int port, char *dn, char **attrs, int scope,
|
||||
char *filter){
|
||||
|
||||
}
|
||||
|
||||
LDAPUrl::~LDAPUrl(){
|
||||
delete[] m_urlString;
|
||||
ldap_free_urldesc(m_urlDesc);
|
||||
DEBUG(LDAP_DEBUG_DESTROY, "LDAPUrl::~LDAPUrl()" << endl);
|
||||
m_Attrs.clear();
|
||||
}
|
||||
|
||||
int LDAPUrl::getPort() const {
|
||||
return m_urlDesc->lud_port;
|
||||
return m_Port;
|
||||
}
|
||||
|
||||
int LDAPUrl::getScope() const {
|
||||
return m_urlDesc->lud_scope;
|
||||
return m_Scope;
|
||||
}
|
||||
|
||||
char* LDAPUrl::getURLString() const {
|
||||
return strdup(m_urlString);
|
||||
const string& LDAPUrl::getURLString() const {
|
||||
return m_urlString;
|
||||
}
|
||||
|
||||
char* LDAPUrl::getHost() const {
|
||||
return strdup(m_urlDesc->lud_host);
|
||||
const string& LDAPUrl::getHost() const {
|
||||
return m_Host;
|
||||
}
|
||||
|
||||
char* LDAPUrl::getDN() const {
|
||||
return strdup(m_urlDesc->lud_dn);
|
||||
const string& LDAPUrl::getDN() const {
|
||||
return m_DN;
|
||||
}
|
||||
|
||||
char* LDAPUrl::getFilter() const {
|
||||
return strdup(m_urlDesc->lud_filter);
|
||||
const string& LDAPUrl::getFilter() const {
|
||||
return m_Filter;
|
||||
}
|
||||
|
||||
char** LDAPUrl::getAttrs() const {
|
||||
size_t s;
|
||||
for ( char** i=m_urlDesc->lud_attrs; *i != 0; i++){
|
||||
s++;
|
||||
}
|
||||
char** ret=new char*[s+1];
|
||||
ret[s]=0;
|
||||
int j=0;
|
||||
for (char** i=m_urlDesc->lud_attrs; *i != 0; j++, i++){
|
||||
ret[j] = strdup(*i);
|
||||
}
|
||||
return ret;
|
||||
const StringList& LDAPUrl::getAttrs() const {
|
||||
return m_Attrs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,32 +3,35 @@
|
|||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
// $Id: LDAPUrl.h,v 1.5 2000/08/31 17:43:49 rhafer Exp $
|
||||
|
||||
#ifndef LDAP_URL_H
|
||||
#define LDAP_URL_H
|
||||
|
||||
#include <ldap.h>
|
||||
|
||||
#include "StringList.h"
|
||||
class LDAPUrl{
|
||||
|
||||
protected :
|
||||
int m_Port;
|
||||
int m_Scope;
|
||||
string m_Host;
|
||||
string m_DN;
|
||||
string m_Filter;
|
||||
StringList m_Attrs;
|
||||
LDAPURLDesc *m_urlDesc;
|
||||
char *m_urlString;
|
||||
string m_urlString;
|
||||
|
||||
public :
|
||||
LDAPUrl(char *url);
|
||||
LDAPUrl(char *host, int port, char *dn, char **attrs, int scope=0,
|
||||
char *filter=0);
|
||||
LDAPUrl(const char *url);
|
||||
~LDAPUrl();
|
||||
|
||||
int getPort() const;
|
||||
int getScope() const;
|
||||
char* getURLString() const;
|
||||
char* getHost() const;
|
||||
char* getDN() const;
|
||||
char* getFilter() const;
|
||||
char** getAttrs() const;
|
||||
const string& getURLString() const;
|
||||
const string& getHost() const;
|
||||
const string& getDN() const;
|
||||
const string& getFilter() const;
|
||||
const StringList& getAttrs() const;
|
||||
};
|
||||
|
||||
#endif //LDAP_URL_H
|
||||
|
|
|
|||
|
|
@ -4,4 +4,46 @@
|
|||
*/
|
||||
|
||||
#include "LDAPUrlList.h"
|
||||
#include "debug.h"
|
||||
|
||||
LDAPUrlList::LDAPUrlList(){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList()" << endl);
|
||||
m_urls=UrlList();
|
||||
}
|
||||
|
||||
LDAPUrlList::LDAPUrlList(const LDAPUrlList& urls){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList(&)" << endl);
|
||||
m_urls = urls.m_urls;
|
||||
}
|
||||
|
||||
|
||||
LDAPUrlList::LDAPUrlList(char** url){
|
||||
DEBUG(LDAP_DEBUG_CONSTRUCT," LDAPUrlList::LDAPUrlList()" << endl);
|
||||
char** i;
|
||||
assert(url);
|
||||
for(i = url; *i != 0; i++){
|
||||
add(LDAPUrl(*i));
|
||||
}
|
||||
}
|
||||
|
||||
LDAPUrlList::~LDAPUrlList(){
|
||||
DEBUG(LDAP_DEBUG_DESTROY," LDAPUrlList::~LDAPUrlList()" << endl);
|
||||
m_urls.clear();
|
||||
}
|
||||
|
||||
size_t LDAPUrlList::size() const{
|
||||
return m_urls.size();
|
||||
}
|
||||
|
||||
LDAPUrlList::const_iterator LDAPUrlList::begin() const{
|
||||
return m_urls.begin();
|
||||
}
|
||||
|
||||
LDAPUrlList::const_iterator LDAPUrlList::end() const{
|
||||
return m_urls.end();
|
||||
}
|
||||
|
||||
void LDAPUrlList::add(const LDAPUrl& url){
|
||||
m_urls.push_back(url);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,24 @@
|
|||
#include <list>
|
||||
#include "LDAPUrl.h"
|
||||
|
||||
typedef list<LDAPUrl*> LDAPUrlList;
|
||||
typedef list<LDAPUrl> UrlList;
|
||||
|
||||
class LDAPUrlList{
|
||||
typedef UrlList::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
LDAPUrlList();
|
||||
LDAPUrlList(const LDAPUrlList& urls);
|
||||
LDAPUrlList(char** urls);
|
||||
~LDAPUrlList();
|
||||
|
||||
size_t size() const;
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
void add(const LDAPUrl& url);
|
||||
|
||||
private :
|
||||
UrlList m_urls;
|
||||
};
|
||||
#endif //LDAP_URL_LIST_H
|
||||
|
|
|
|||
|
|
@ -3,37 +3,86 @@
|
|||
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
##
|
||||
|
||||
lib_LIBRARIES = libldapcpp.a
|
||||
libldapcpp_a_SOURCES = LDAPAddRequest.cpp \
|
||||
lib_LTLIBRARIES = libldapcpp.la
|
||||
|
||||
libldapcpp_la_SOURCES = LDAPAddRequest.cpp \
|
||||
LDAPAsynConnection.cpp \
|
||||
LDAPAttribute.cpp \
|
||||
LDAPAttributeList.cpp \
|
||||
LDAPBindRequest.cpp \
|
||||
LDAPCompareRequest.cpp \
|
||||
LDAPConnection.cpp \
|
||||
LDAPConstraints.cpp \
|
||||
LDAPControl.cpp \
|
||||
LDAPControlSet.cpp \
|
||||
LDAPDeleteRequest.cpp \
|
||||
LDAPEntry.cpp \
|
||||
LDAPEntryList.cpp \
|
||||
LDAPException.cpp \
|
||||
LDAPExtRequest.cpp \
|
||||
LDAPExtResult.cpp \
|
||||
LDAPMessage.cpp \
|
||||
LDAPMessageQueue.cpp \
|
||||
LDAPModDNRequest.cpp \
|
||||
LDAPModification.cpp \
|
||||
LDAPModifyRequest.cpp \
|
||||
LDAPModList.cpp \
|
||||
LDAPReferral.cpp \
|
||||
LDAPRebind.cpp \
|
||||
LDAPRebindAuth.cpp \
|
||||
LDAPReferralException.cpp \
|
||||
LDAPReferenceList.cpp \
|
||||
LDAPRequest.cpp \
|
||||
LDAPResult.cpp \
|
||||
LDAPSearchReference.cpp \
|
||||
LDAPSearchRequest.cpp \
|
||||
LDAPSearchResult.cpp \
|
||||
LDAPSearchResults.cpp \
|
||||
LDAPUrl.cpp \
|
||||
LDAPUrlList.cpp
|
||||
LDAPUrlList.cpp \
|
||||
StringList.cpp \
|
||||
RebindTest.cpp
|
||||
|
||||
include_HEADERS = LDAPAsynConnection.h \
|
||||
LDAPAttribute.h \
|
||||
LDAPAttributeList.h \
|
||||
LDAPConnection.h \
|
||||
LDAPConstraints.h \
|
||||
LDAPControl.h \
|
||||
LDAPEntry.h \
|
||||
LDAPEntryList.h \
|
||||
LDAPException.h \
|
||||
LDAPExtResult.h \
|
||||
LDAPMessage.h \
|
||||
LDAPMessageQueue.h \
|
||||
LDAPModification.h \
|
||||
LDAPModList.h \
|
||||
LDAPRebind.h \
|
||||
LDAPRebindAuth.h \
|
||||
LDAPReferralException.h \
|
||||
LDAPReferenceList.h \
|
||||
LDAPResult.h \
|
||||
LDAPSearchReference.h \
|
||||
LDAPSearchResult.h \
|
||||
LDAPUrl.h \
|
||||
LDAPUrlList.h \
|
||||
StringList.h
|
||||
|
||||
noinst_HEADERS = LDAPAddRequest.h \
|
||||
LDAPBindRequest.h \
|
||||
LDAPCompareRequest.h \
|
||||
LDAPDeleteRequest.h \
|
||||
LDAPExtRequest.h \
|
||||
LDAPModDNRequest.h \
|
||||
LDAPModifyRequest.h \
|
||||
LDAPRequest.h \
|
||||
LDAPSearchRequest.h
|
||||
|
||||
libldapcpp_la_LIBADD = -lldap -llber
|
||||
libldapcpp_la_LDFLAGS = -version-info 0:1:0
|
||||
|
||||
bin_PROGRAMS = main
|
||||
noinst_PROGRAMS = main
|
||||
|
||||
main_SOURCES = main.cpp
|
||||
main_LDADD = ./libldapcpp.a
|
||||
main_LDADD = ./libldapcpp.la
|
||||
|
||||
|
||||
|
|
|
|||
475
contrib/ldapc++/src/Makefile.in
Normal file
475
contrib/ldapc++/src/Makefile.in
Normal file
|
|
@ -0,0 +1,475 @@
|
|||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
|
||||
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
|
||||
lib_LTLIBRARIES = libldapcpp.la
|
||||
|
||||
libldapcpp_la_SOURCES = LDAPAddRequest.cpp LDAPAsynConnection.cpp LDAPAttribute.cpp LDAPAttributeList.cpp LDAPBindRequest.cpp LDAPCompareRequest.cpp LDAPConnection.cpp LDAPConstraints.cpp LDAPControl.cpp LDAPControlSet.cpp LDAPDeleteRequest.cpp LDAPEntry.cpp LDAPEntryList.cpp LDAPException.cpp LDAPExtRequest.cpp LDAPExtResult.cpp LDAPMessage.cpp LDAPMessageQueue.cpp LDAPModDNRequest.cpp LDAPModification.cpp LDAPModifyRequest.cpp LDAPModList.cpp LDAPRebind.cpp LDAPRebindAuth.cpp LDAPReferralException.cpp LDAPReferenceList.cpp LDAPRequest.cpp LDAPResult.cpp LDAPSearchReference.cpp LDAPSearchRequest.cpp LDAPSearchResult.cpp LDAPSearchResults.cpp LDAPUrl.cpp LDAPUrlList.cpp StringList.cpp RebindTest.cpp
|
||||
|
||||
|
||||
include_HEADERS = LDAPAsynConnection.h LDAPAttribute.h LDAPAttributeList.h LDAPConnection.h LDAPConstraints.h LDAPControl.h LDAPEntry.h LDAPEntryList.h LDAPException.h LDAPExtResult.h LDAPMessage.h LDAPMessageQueue.h LDAPModification.h LDAPModList.h LDAPRebind.h LDAPRebindAuth.h LDAPReferralException.h LDAPReferenceList.h LDAPResult.h LDAPSearchReference.h LDAPSearchResult.h LDAPUrl.h LDAPUrlList.h StringList.h
|
||||
|
||||
|
||||
noinst_HEADERS = LDAPAddRequest.h LDAPBindRequest.h LDAPCompareRequest.h LDAPDeleteRequest.h LDAPExtRequest.h LDAPModDNRequest.h LDAPModifyRequest.h LDAPRequest.h LDAPSearchRequest.h
|
||||
|
||||
|
||||
libldapcpp_la_LIBADD = -lldap -llber
|
||||
libldapcpp_la_LDFLAGS = -version-info 0:1:0
|
||||
|
||||
noinst_PROGRAMS = main
|
||||
|
||||
main_SOURCES = main.cpp
|
||||
main_LDADD = ./libldapcpp.la
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libldapcpp_la_DEPENDENCIES =
|
||||
libldapcpp_la_OBJECTS = LDAPAddRequest.lo LDAPAsynConnection.lo \
|
||||
LDAPAttribute.lo LDAPAttributeList.lo LDAPBindRequest.lo \
|
||||
LDAPCompareRequest.lo LDAPConnection.lo LDAPConstraints.lo \
|
||||
LDAPControl.lo LDAPControlSet.lo LDAPDeleteRequest.lo LDAPEntry.lo \
|
||||
LDAPEntryList.lo LDAPException.lo LDAPExtRequest.lo LDAPExtResult.lo \
|
||||
LDAPMessage.lo LDAPMessageQueue.lo LDAPModDNRequest.lo \
|
||||
LDAPModification.lo LDAPModifyRequest.lo LDAPModList.lo LDAPRebind.lo \
|
||||
LDAPRebindAuth.lo LDAPReferralException.lo LDAPReferenceList.lo \
|
||||
LDAPRequest.lo LDAPResult.lo LDAPSearchReference.lo \
|
||||
LDAPSearchRequest.lo LDAPSearchResult.lo LDAPSearchResults.lo \
|
||||
LDAPUrl.lo LDAPUrlList.lo StringList.lo RebindTest.lo
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
main_OBJECTS = main.o
|
||||
main_DEPENDENCIES = ./libldapcpp.la
|
||||
main_LDFLAGS =
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/LDAPAddRequest.P .deps/LDAPAsynConnection.P \
|
||||
.deps/LDAPAttribute.P .deps/LDAPAttributeList.P .deps/LDAPBindRequest.P \
|
||||
.deps/LDAPCompareRequest.P .deps/LDAPConnection.P \
|
||||
.deps/LDAPConstraints.P .deps/LDAPControl.P .deps/LDAPControlSet.P \
|
||||
.deps/LDAPDeleteRequest.P .deps/LDAPEntry.P .deps/LDAPEntryList.P \
|
||||
.deps/LDAPException.P .deps/LDAPExtRequest.P .deps/LDAPExtResult.P \
|
||||
.deps/LDAPMessage.P .deps/LDAPMessageQueue.P .deps/LDAPModDNRequest.P \
|
||||
.deps/LDAPModList.P .deps/LDAPModification.P .deps/LDAPModifyRequest.P \
|
||||
.deps/LDAPRebind.P .deps/LDAPRebindAuth.P .deps/LDAPReferenceList.P \
|
||||
.deps/LDAPReferralException.P .deps/LDAPRequest.P .deps/LDAPResult.P \
|
||||
.deps/LDAPSearchReference.P .deps/LDAPSearchRequest.P \
|
||||
.deps/LDAPSearchResult.P .deps/LDAPSearchResults.P .deps/LDAPUrl.P \
|
||||
.deps/LDAPUrlList.P .deps/RebindTest.P .deps/StringList.P .deps/main.P
|
||||
SOURCES = $(libldapcpp_la_SOURCES) $(main_SOURCES)
|
||||
OBJECTS = $(libldapcpp_la_OBJECTS) $(main_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .cpp .lo .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=src/config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libldapcpp.la: $(libldapcpp_la_OBJECTS) $(libldapcpp_la_DEPENDENCIES)
|
||||
$(CXXLINK) -rpath $(libdir) $(libldapcpp_la_LDFLAGS) $(libldapcpp_la_OBJECTS) $(libldapcpp_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
main: $(main_OBJECTS) $(main_DEPENDENCIES)
|
||||
@rm -f main
|
||||
$(CXXLINK) $(main_LDFLAGS) $(main_OBJECTS) $(main_LDADD) $(LIBS)
|
||||
.cpp.o:
|
||||
$(CXXCOMPILE) -c $<
|
||||
.cpp.lo:
|
||||
$(LTCXXCOMPILE) -c $<
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = src
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
|
||||
%.o: %.cpp
|
||||
@echo '$(CXXCOMPILE) -c $<'; \
|
||||
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.cpp
|
||||
@echo '$(LTCXXCOMPILE) -c $<'; \
|
||||
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-libLTLIBRARIES \
|
||||
mostlyclean-compile mostlyclean-libtool \
|
||||
mostlyclean-noinstPROGRAMS mostlyclean-tags \
|
||||
mostlyclean-depend mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-hdr clean-libLTLIBRARIES clean-compile clean-libtool \
|
||||
clean-noinstPROGRAMS clean-tags clean-depend \
|
||||
clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-noinstPROGRAMS \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr \
|
||||
maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool mostlyclean-noinstPROGRAMS \
|
||||
distclean-noinstPROGRAMS clean-noinstPROGRAMS \
|
||||
maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \
|
||||
install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
|
||||
clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck all-recursive-am install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
14
contrib/ldapc++/src/config.h.in
Normal file
14
contrib/ldapc++/src/config.h.in
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#define LDAP_DEBUG_NONE 0x0000
|
||||
#define LDAP_DEBUG_TRACE 0x0001
|
||||
#define LDAP_DEBUG_RESPONSE 0x0002
|
||||
#define LDAP_DEBUG_REQUEST 0x0004
|
||||
#define LDAP_DEBUG_CONSTRUCT 0x0002
|
||||
#define LDAP_DEBUG_DESTROY 0x0004
|
||||
#define LDAP_DEBUG_PARAMETER 0x0008
|
||||
#define LDAP_DEBUG_ANY -1
|
||||
|
||||
|
|
@ -20,10 +20,13 @@
|
|||
cerr << "file: " __FILE__ << " line: " << __LINE__
|
||||
|
||||
#define DEBUG(level, arg) \
|
||||
if(level & DEBUGLEVEL){ \
|
||||
if((level) & DEBUGLEVEL){ \
|
||||
cerr << arg ; \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* #undef DEBUG
|
||||
* #define DEBUG(level,arg)
|
||||
*/
|
||||
|
||||
#endif // DEBUG_H
|
||||
|
|
|
|||
|
|
@ -5,41 +5,103 @@
|
|||
|
||||
#include<iostream.h>
|
||||
#include<strstream>
|
||||
#include"LDAPAsynConnection.h"
|
||||
#include "LDAPConnection.h"
|
||||
#include "LDAPConstraints.h"
|
||||
#include"LDAPResult.h"
|
||||
#include"LDAPSearchResult.h"
|
||||
#include"LDAPSearchReference.h"
|
||||
#include"LDAPAttribute.h"
|
||||
#include"LDAPAttributeList.h"
|
||||
#include"LDAPEntry.h"
|
||||
#include"LDAPException.h"
|
||||
#include"LDAPModification.h"
|
||||
#include "LDAPSearchReference.h"
|
||||
#include "LDAPSearchResults.h"
|
||||
#include "LDAPAttribute.h"
|
||||
#include "LDAPAttributeList.h"
|
||||
#include "LDAPEntry.h"
|
||||
#include "LDAPException.h"
|
||||
#include "LDAPModification.h"
|
||||
#include "LDAPReferralException.h"
|
||||
#include "RebindTest.h"
|
||||
|
||||
#include"debug.h"
|
||||
|
||||
int main(){
|
||||
LDAPAsynConnection *lc=new LDAPAsynConnection("localhost",9009);
|
||||
LDAPConstraints* cons=new LDAPConstraints;
|
||||
LDAPControlSet* ctrls=new LDAPControlSet;
|
||||
ctrls->add(LDAPCtrl(LDAP_CONTROL_MANAGEDSAIT));
|
||||
cons->setServerControls(ctrls);
|
||||
LDAPConnection *lc=new LDAPConnection("localhost",9009);
|
||||
lc->setConstraints(cons);
|
||||
cout << "----------------------doing bind...." << endl;
|
||||
try{
|
||||
LDAPMessageQueue *q=lc->bind("cn=Manager,o=Organisation,c=DE" ,
|
||||
"secret");
|
||||
LDAPMsg *res=q->getNext();
|
||||
if( ((LDAPResult*)res)->getResultCode() == LDAPResult::SUCCESS){
|
||||
cout << "--------------------...successfully bound" << endl;
|
||||
lc->bind("cn=Manager,o=Organisation,c=DE" , "secret",cons);
|
||||
cout << lc->getHost() << endl;
|
||||
bool result = lc->compare("cn=Manager,o=Organisation,c=DE",
|
||||
LDAPAttribute("cn","Manaer"));
|
||||
cout << "Compare: " << result << endl;
|
||||
|
||||
LDAPAttributeList* attrs=new LDAPAttributeList();
|
||||
StringList values;
|
||||
values.add("top");
|
||||
values.add("Person");
|
||||
attrs->addAttribute(LDAPAttribute("objectClass",values));
|
||||
attrs->addAttribute(LDAPAttribute("cn","Peter"));
|
||||
attrs->addAttribute(LDAPAttribute("sn","Peter,hallo"));
|
||||
LDAPEntry* entry=new LDAPEntry(
|
||||
"cn=Peter , o=Organisation, c=DE", attrs);
|
||||
// lc->add(entry);
|
||||
|
||||
// lc->del("ou=Groups,o=Organisation,c=DE");
|
||||
|
||||
LDAPSearchResults* entries = lc->search("o=Organisation,c=DE",
|
||||
LDAPConnection::SEARCH_ONE);
|
||||
if (entries != 0){
|
||||
LDAPEntry* entry = entries->getNext();
|
||||
if(entry != 0){
|
||||
cout << *(entry) << endl;
|
||||
}
|
||||
while(entry){
|
||||
try{
|
||||
entry = entries->getNext();
|
||||
if(entry != 0){
|
||||
cout << *(entry) << endl;
|
||||
}
|
||||
delete entry;
|
||||
}catch(LDAPReferralException e){
|
||||
cout << "Caught Referral" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (LDAPException e){
|
||||
cout << "-------------------------...error during bind" << endl;
|
||||
|
||||
lc->unbind();
|
||||
delete lc;
|
||||
}catch (LDAPException e){
|
||||
cout << "------------------------- caught Exception ---------"<< endl;
|
||||
cout << e << endl;
|
||||
}
|
||||
|
||||
/*
|
||||
cout << "--------------------starting search" << endl;
|
||||
LDAPAttributeList* attrs=new LDAPAttributeList();
|
||||
StringList values;
|
||||
values.add("top");
|
||||
values.add("organizationalUnit");
|
||||
attrs->addAttribute(LDAPAttribute("objectClass",values));
|
||||
attrs->addAttribute(LDAPAttribute("ou","Groups"));
|
||||
LDAPEntry* entry=new LDAPEntry(
|
||||
"ou=Groups, o=Organisation, c=DE", attrs);
|
||||
|
||||
LDAPAttribute newattr("description");
|
||||
LDAPModification::mod_op op = LDAPModification::OP_DELETE;
|
||||
LDAPModList *mod=new LDAPModList();
|
||||
mod->addModification(LDAPModification(newattr,op));
|
||||
LDAPMessageQueue* q=0;
|
||||
try{
|
||||
LDAPMessageQueue *q=lc->search("");
|
||||
LDAPMsg *res=q->getNext();
|
||||
q=lc->search("o=Organisation,c=de",LDAPAsynConnection::SEARCH_SUB,
|
||||
"objectClass=*",StringList());
|
||||
// q=lc->add(entry);
|
||||
// q=lc->modify("cn=Manager,o=Organisation,c=DE",
|
||||
// mod);
|
||||
LDAPMsg *res=q->getNext();
|
||||
bool cont=true;
|
||||
while( cont ) {
|
||||
while( cont ) {
|
||||
switch(res->getMessageType()){
|
||||
LDAPSearchResult *res2;
|
||||
LDAPEntry *entry;
|
||||
const LDAPEntry *entry;
|
||||
case LDAP_RES_SEARCH_ENTRY :
|
||||
res2= (LDAPSearchResult*)res;
|
||||
entry= res2->getEntry();
|
||||
|
|
@ -48,21 +110,25 @@ int main(){
|
|||
res=q->getNext();
|
||||
break;
|
||||
case LDAP_RES_SEARCH_REFERENCE :
|
||||
cout << "Reference: " << endl;
|
||||
delete res;
|
||||
res=q->getNext();
|
||||
break;
|
||||
default :
|
||||
cout << ( *(LDAPResult*) res) << endl;
|
||||
cout << ( *(LDAPResult*) res) << endl;
|
||||
delete res;
|
||||
cout << "-----------------search done" << endl;
|
||||
cont=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
}catch (LDAPException e){
|
||||
}catch (LDAPException e){
|
||||
cout << "----------------error during search" << endl;
|
||||
cout << e << endl;
|
||||
}
|
||||
delete q;
|
||||
cout << e << endl;
|
||||
}
|
||||
lc->unbind();
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
|||
1
contrib/ldapc++/src/stamp-h.in
Normal file
1
contrib/ldapc++/src/stamp-h.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
timestamp
|
||||
Loading…
Reference in a new issue