--- /dev/null
+Ralf Haferkamp <rhafer@suse.de>
--- /dev/null
+Copyright 1998-2000 The OpenLDAP Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted
+only as authorized by the OpenLDAP Public License. A copy of this
+license is available at http://www.OpenLDAP.org/license.html or
+in file LICENSE in the top-level directory of the distribution.
+
+Individual files and/or contributed packages may be copyright by
+other parties and use subject to additional restrictions.
+
+This work is derived from the University of Michigan LDAP v3.3
+distribution. Information concerning this software is available
+at: http://www.umich.edu/~dirsvcs/ldap/
+
+This work also contains materials derived from public sources.
+
+Additional Information about OpenLDAP can be obtained at:
+ http://www.openldap.org/
+
+or by sending e-mail to:
+ info@OpenLDAP.org
+
+---
+
+Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted
+provided that this notice is preserved and that due credit is given
+to the University of Michigan at Ann Arbor. The name of the University
+may not be used to endorse or promote products derived from this
+software without specific prior written permission. This software
+is provided ``as is'' without express or implied warranty.
+
+---
+$OpenLDAP$
--- /dev/null
+The OpenLDAP Public License
+ Version 2.3, 28 July 2000
+
+Redistribution and use of this software and associated documentation
+("Software"), with or without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistributions of source code must retain copyright statements
+and notices.
+
+2. Redistributions in binary form must reproduce applicable copyright
+statements and notices, this list of conditions, and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+
+3. Redistributions must contain a verbatim copy of this document.
+
+4. The name "OpenLDAP" must not be used to endorse or promote
+products derived from this Software without prior written permission
+of the OpenLDAP Foundation.
+
+5. Products derived from this Software may not be called "OpenLDAP"
+nor may "OpenLDAP" appear in their names without prior written
+permission of the OpenLDAP Foundation.
+
+6. Due credit should be given to the OpenLDAP Project
+(http://www.openldap.org/).
+
+7. The OpenLDAP Foundation may revise this license from time to
+time. Each revision is distinguished by a version number. You
+may use the Software under terms of this license revision or under
+the terms of any subsequent revision of the license.
+
+THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE OPENLDAP FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+OpenLDAP is a trademark of the OpenLDAP Foundation.
+
+Copyright 1999-2000 The OpenLDAP Foundation, Redwood City,
+California, USA. All Rights Reserved. Permission to copy and
+distributed verbatim copies of this document is granted.
+
--- /dev/null
+##
+# Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+
+EXTRA_DIST = BUGS
+SUBDIRS = src
+
--- /dev/null
+This is an unstable development release of a LDAPv3 C++ Class Library.
+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.
+
+ Ralf Haferkamp <rhafer@suse.de>
+
--- /dev/null
+SASL Authentication
+TLS encryption
+adjustment of search scope for search reference following
+Debugging and Logging
+LDAPv2 Operations
+Referral chasing for all operations
+Classes to make synchronous Operations
+
--- /dev/null
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
--- /dev/null
+dnl Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+dnl COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+
+
+dnl Process this file with autoconf to produce a configure script.
+
+
+AC_INIT(src/main.cpp)
+AM_INIT_AUTOMAKE(main, 0.0.1)
+AM_CONFIG_HEADER(src/config.h)
+
+
+dnl Checks for programs.
+AC_PROG_CXX
+AC_PROG_RANLIB
+dnl AC_PROG_MAKE_SET
+AC_ARG_ENABLE(debug,--disable-debug,[
+ ],[
+ CXXFLAGS="-g -O0 -Wall"
+ ]
+)
+
+AC_ARG_WITH(libldap,[ --with-libldap=DIR Path to the libldap library [/usr/local/lib]],[
+ LIBS="$LIBS -L$with_libldap"
+ ],[
+ LIBS="$LIBS -L/usr/local/lib"
+ ]
+)
+
+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="$CPPFLAGS -I/usr/local/include"
+ ]
+)
+dnl Checks for libraries.
+AC_CHECK_LIB(resolv,main)
+AC_CHECK_LIB(lber,main)
+AC_CHECK_LIB(ldap,main)
+dnl Checks for header files.
+AC_HEADER_TIME
+AC_CHECK_HEADER(ldap.h)
+AC_CHECK_HEADER(lber.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+dnl Checks for library functions.
+
+AC_OUTPUT(Makefile src/Makefile)
--- /dev/null
+# Doxyfile 1.0.0
+
+# This file describes the settings to be used by doxygen for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of word surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = ldapsdk
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 0.0.1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = srcdoc
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Dutch, French, Italian, Czech, Swedish, German and Japanese
+
+OUTPUT_LANGUAGE = English
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# If the EXTRACT_ALL tag is set to YES all classes and functions will be
+# included in the documentation, even if no documentation was available.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members inside documented classes or files.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all
+# undocumented classes.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = yes
+
+# If the ALWAYS_DETAILS_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# 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
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path.
+
+STRIP_FROM_PATH =
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a class diagram (in Html and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off.
+
+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
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen
+# will only generate file names in lower case letters. If set to
+# YES upper case letters are also allowed. This is useful if you have
+# classes or files whose names only differ in case and if your file system
+# supports case sensitive file names.
+
+CASE_SENSE_NAMES = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the Javadoc-style will
+# behave just like the Qt-style comments.
+
+JAVADOC_AUTOBRIEF = YES
+
+# if the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# if the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# the TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = /suse/rhafer/prog/ldapsdk/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
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+FILE_PATTERNS = *.cpp *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = yes
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT =
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = no
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT =
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = no
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT =
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed.
+
+MACRO_EXPANSION = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED =
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED tag.
+
+EXPAND_ONLY_PREDEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for
+# details.
+
+CGI_URL =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS =
--- /dev/null
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.1.1.1 2000/08/02 14:06:27 rhafer Exp $
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+
+#include <ldap.h>
+
+#include "debug.h"
+
+#include "LDAPAddRequest.h"
+#include "LDAPEntry.h"
+#include "LDAPException.h"
+#include "LDAPMessageQueue.h"
+
+LDAPAddRequest::LDAPAddRequest(const LDAPAddRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::LDAPAddRequest(LDAPAddRequest&)"
+ << endl);
+}
+
+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
+ << " isReferral:" << isReferral << endl);
+ m_requestType = LDAPRequest::ADD;
+ m_entry = new LDAPEntry(*entry);
+}
+
+LDAPAddRequest::~LDAPAddRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::~LDAPAddRequest()" << endl);
+ delete m_entry;
+}
+
+LDAPMessageQueue* LDAPAddRequest::sendRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::sendRequest()" << endl);
+ int msgID=0;
+ LDAPAttributeList *attrList = m_entry->getAttributes();
+ int err=ldap_add_ext(m_connection->getSessionHandle(),
+ m_entry->getDN(),attrList->toLDAPModArray(),
+ m_cons->getSrvCtrlsArray(), m_cons->getClCtrlsArray(),&msgID);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPAddRequest::followReferral(LDAPUrlList *urls){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAddRequest::followReferral()"<< endl);
+ cerr << "to be implemented" << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_ADD_REQUEST_H
+#define LDAP_ADD_REQUEST_H
+
+#include "LDAPRequest.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);
+ virtual ~LDAPAddRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *refs);
+};
+#endif // LDAP_ADD_REQUEST_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+#include "LDAPAsynConnection.h"
+
+#include "LDAPAddRequest.h"
+#include "LDAPBindRequest.h"
+#include "LDAPCompareRequest.h"
+#include "LDAPDeleteRequest.h"
+#include "LDAPException.h"
+#include "LDAPExtRequest.h"
+#include "LDAPEntry.h"
+#include "LDAPModDNRequest.h"
+#include "LDAPModifyRequest.h"
+#include "LDAPRequest.h"
+#include "LDAPSearchRequest.h"
+
+LDAPAsynConnection::LDAPAsynConnection(const char *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);
+ }
+ this->setConstraints(cons);
+}
+
+
+void LDAPAsynConnection::setConstraints(LDAPConstraints *cons){
+ m_constr=cons;
+}
+
+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);
+ 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){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::bind()" << endl);
+ DEBUG(LDAP_DEBUG_PARAMETER, " dn:" << dn << endl
+ << " passwd:" << passwd << endl);
+ LDAPBindRequest *req = new LDAPBindRequest(dn,passwd,this,cons);
+ LDAPMessageQueue *ret = req->sendRequest();
+ return ret;
+}
+
+LDAPMessageQueue* LDAPAsynConnection::search(const char *base,int scope,
+ const char *filter,
+ char **attrs,
+ const LDAPConstraints *cons){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPAsynConnection::search()" << endl);
+ DEBUG(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);
+ LDAPMessageQueue *ret = req->sendRequest();
+ return ret;
+ }
+}
+
+/*
+LDAPMessageQueue* LDAPAsynConnection::modify(char *dn, LDAPModification *mod,
+ 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);
+ }
+}
+*/
+
+LDAPMessageQueue* LDAPAsynConnection::modify(const char *dn, LDAPModList *mod,
+ const LDAPConstraints *cons){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::modify()" << endl);
+ DEBUG(LDAP_DEBUG_PARAMETER," dn:" << dn << endl);
+ LDAPModifyRequest *req = new LDAPModifyRequest(dn, mod, this, cons);
+ LDAPMessageQueue *ret = req->sendRequest();
+ return ret;
+}
+
+LDAPMessageQueue* LDAPAsynConnection::rename(const char *dn, const char *newRDN,
+ bool delOldRDN, const char *newParentDN, const LDAPConstraints *cons ){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::rename()" << endl);
+ DEBUG(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;
+}
+
+
+LDAPMessageQueue* LDAPAsynConnection::extOperation(const char* oid,
+ BerValue* 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);
+ LDAPMessageQueue *ret = req->sendRequest();
+ return ret;
+ }
+}
+
+
+void LDAPAsynConnection::abandon(LDAPMessageQueue *q){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPAsynConnection::*extOperation()" << endl);
+ LDAPRequestStack *reqStack=q->getRequestStack();
+ LDAPRequest *req;
+ while(! reqStack->empty()){
+ req=reqStack->top();
+ if (ldap_abandon_ext(cur_session, req->getMsgID(), 0, 0)
+ != LDAP_SUCCESS){
+ throw LDAPException(this);
+ }
+ delete req;
+ reqStack->pop();
+ }
+}
+
+
+LDAP* LDAPAsynConnection::getSessionHandle() const {
+ return cur_session;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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<ldap.h>
+#include<lber.h>
+
+#include "LDAPMessageQueue.h"
+#include "LDAPConstraints.h"
+#include "LDAPModification.h"
+#include "LDAPModList.h"
+#include "LDAPUrl.h"
+#include "LDAPUrlList.h"
+
+class LDAPEntry;
+class LDAPAttribute;
+
+//! 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.)
+ * All of the LDAP-Operations return a pointer to a LDAPMessageQueue-Object,
+ * which can be used to obtain the results of that operation.
+ * A basic example of this class could be like this: <BR>
+ * 1. Create a new LDAPAsynConnection Object: <BR>
+ * 2. Use the init-method to initialize the connection <BR>
+ * 3. Call the bind-method to authenticate to the directory <BR>
+ * 4. Obtain the bind results from the return LDAPMessageQueue-Object <BR>
+ * 5. Perform on of the operations on the directory (add, delete, search, ..)
+ * <BR>
+ * 6. Use the return LDAPMessageQueue to obtain the results of the operation
+ * <BR>
+ * 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;
+
+ //! 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() );
+
+ //! 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;
+
+ //! 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);
+
+ //! 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,
+ const LDAPConstraints *cons=0);
+
+ //! 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
+ * @param scope The scope of the search. Possible values: <BR>
+ * LDAPAsynConnection::SEARCH_BASE, <BR>
+ * LDAPAsynConnection::SEARCH_ONE, <BR>
+ * LDAPAsynConnection::SEARCH_SUB
+ * @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,
+ const LDAPConstraints *cons=0);
+
+ //! 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);
+
+ //! 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
+ * compare operation
+ * @param cons A set of constraints that should be used with this
+ * request
+ */
+ LDAPMessageQueue* compare(const char *dn, const LDAPAttribute *attr,
+ const LDAPConstraints *cons);
+
+ //! 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);
+
+ //! Apply one modification to an attribute of a datebase entry
+ LDAPMessageQueue* modify(char *dn, LDAPModification *mod);
+
+ //! 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);
+
+ LDAPMessageQueue* extOperation(const char* oid, BerValue* value,
+ const LDAPConstraints *cons);
+
+ void abandon(LDAPMessageQueue *q);
+
+ LDAP* getSessionHandle() const ;
+};
+#endif //LDAP_CONNECTION_H
+
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+// * 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 "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));
+ }
+}
+
+//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 char *name, char **values){
+ this->setName(name);
+ this->setValues(values);
+}
+
+
+LDAPAttribute::LDAPAttribute(const char *name, BerValue **values){
+ 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();
+}
+
+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;
+}
+
+int LDAPAttribute::addValue(const BerValue *value){
+ if(value!=0){
+ m_values.push_back(ber_bvdup(value));
+ 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;
+}
+
+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);
+ }
+ 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;
+}
+
+int LDAPAttribute::getNumValues() const{
+ return m_values.size();
+}
+
+char* LDAPAttribute::getName(){
+ return strdup(m_name);
+}
+
+int LDAPAttribute::setName(const char *name){
+ if (name!=0){
+ m_name=strdup(name);
+ }
+ return 0;
+}
+
+// The bin-FLAG of the mod_op is always set to LDAP_MOD_BVALUES (0x80)
+LDAPMod* LDAPAttribute::toLDAPMod() const {
+ 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();
+ return ret;
+}
+
+bool LDAPAttribute::isNotPrintable() const {
+ ValueList::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] ) ){
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+ostream& operator << (ostream& s, const LDAPAttribute& attr){
+ s << attr.m_name << "=";
+ ValueList::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 << " ";
+ }
+ }
+ return s;
+}
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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<ldap.h>
+#include<lber.h>
+
+typedef list<BerValue*> ValueList;
+
+class LDAPAttribute{
+
+ private :
+ char *m_name;
+ ValueList m_values;
+
+ 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();
+
+ 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 ;
+
+ LDAPMod* toLDAPMod() const ;
+
+ friend ostream& operator << (ostream& s, const LDAPAttribute& attr);
+};
+#endif //#ifndef LDAP_ATTRIBUTE_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+// $Id: LDAPAttributeList.cpp,v 1.6 2000/08/31 17:43:48 rhafer Exp $
+
+#include "debug.h"
+#include "LDAPAttributeList.h"
+
+LDAPAttributeList::LDAPAttributeList(){
+}
+
+LDAPAttributeList::LDAPAttributeList(const LDAPAttributeList& al){
+ 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));
+ }
+}
+
+
+void LDAPAttributeList::addAttribute(const LDAPAttribute& attr){
+ m_attrs.push_back(attr);
+}
+
+LDAPAttributeList::~LDAPAttributeList(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPAttributeList::~LDAPAttributList()" << endl);
+}
+
+void LDAPAttributeList::find(char *name){
+}
+
+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;
+}
+
+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;
+}
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+typedef list<LDAPAttribute> AttrList;
+
+class LDAPAttributeList{
+ private :
+ AttrList m_attrs;
+
+ public :
+ LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
+ LDAPAttributeList(const LDAPAttributeList& al);
+ LDAPAttributeList();
+ ~LDAPAttributeList();
+ void addAttribute(const LDAPAttribute& attr);
+ void find(char* name);
+ LDAPMod** toLDAPModArray();
+
+ friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
+};
+#endif // LDAP_ATTRIBUTE_LIST_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+
+#include "debug.h"
+
+#include "LDAPBindRequest.h"
+#include "LDAPException.h"
+
+LDAPBindRequest::LDAPBindRequest(const LDAPBindRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPBindRequest::LDAPBindRequest(LDAPBindRequest&)" << endl);
+}
+
+LDAPBindRequest::LDAPBindRequest(const char *dn, const char *passwd,
+ const 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
+ << " passwd:" << passwd << endl);
+ m_dn = strdup(dn);
+ m_cred = ber_bvstr(passwd);
+ m_mech = LDAP_SASL_SIMPLE;
+}
+
+LDAPBindRequest::~LDAPBindRequest(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::~LDAPBindRequest()" << endl);
+ delete[] m_dn;
+ ber_bvfree(m_cred);
+ delete[] m_mech;
+}
+
+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);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPBindRequest::followReferral(LDAPUrlList *urls){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPBindRequest::followReferral()" << endl);
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_BIND_REQUEST_H
+#define LDAP_BIND_REQUEST_H
+
+#include "LDAPRequest.h"
+
+class LDAPBindRequest : LDAPRequest {
+ private:
+ char *m_dn;
+ BerValue *m_cred;
+ char *m_mech;
+
+ public:
+ LDAPBindRequest(const LDAPBindRequest& req);
+ //just for simple authentication
+ LDAPBindRequest(const char *dn, const char *passwd,
+ const LDAPAsynConnection *connect, const LDAPConstraints *cons,
+ bool isReferral=false);
+ virtual ~LDAPBindRequest();
+ virtual LDAPMessageQueue *sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *urls);
+};
+#endif //LDAP_BIND_REQUEST_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+
+#include "debug.h"
+
+#include "LDAPCompareRequest.h"
+#include "LDAPException.h"
+#include "LDAPMessageQueue.h"
+
+LDAPCompareRequest::LDAPCompareRequest(const LDAPCompareRequest& req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPCompareRequest::LDAPCompareRequest(LDAPCompareRequest&)"
+ << endl);
+}
+
+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()"
+ << endl);
+ DEBUG(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);
+ }
+}
+
+LDAPCompareRequest::~LDAPCompareRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "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);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPCompareRequest::followReferral(LDAPUrlList *urls){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPCompareRequest::followReferral()" << endl);
+ cerr << "to be implemented" << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_COMPARE_REQUEST_H
+#define LDAP_COMPARE_REQUEST_H
+
+#include "LDAPRequest.h"
+
+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);
+ virtual ~LDAPCompareRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *urls);
+};
+#endif //LDAP_COMPARE_REQUEST_H
+
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+LDAPConstraints::LDAPConstraints(){
+ m_maxTime=LDAP_NO_LIMIT;
+ m_maxSize=LDAP_NO_LIMIT;
+ m_referralChase=true;
+}
+
+LDAPConstraints::LDAPConstraints(const LDAPConstraints& c){
+ m_maxTime=c.m_maxTime;
+ m_maxSize=c.m_maxSize;
+ m_referralChase=c.m_referralChase;
+}
+
+LDAPConstraints::~LDAPConstraints(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPConstraints::~LDAPConstraints()" << endl);
+}
+
+void LDAPConstraints::setMaxTime(int t){
+ m_maxTime=t;
+}
+
+void LDAPConstraints::setSizeLimit(int s){
+ m_maxSize=s;
+}
+
+void LDAPConstraints::setReferralChase(bool rc){
+}
+
+int LDAPConstraints::getMaxTime() const {
+ return m_maxTime;
+}
+
+int LDAPConstraints::getSizeLimit() const {
+ return m_maxSize;
+}
+
+//TODO
+LDAPControl** LDAPConstraints::getSrvCtrlsArray() const {
+ return 0;
+}
+
+//TODO
+LDAPControl** LDAPConstraints::getClCtrlsArray() const {
+ return 0;
+}
+
+timeval* LDAPConstraints::getTimeoutStruct() const {
+ if(m_maxTime == LDAP_NO_LIMIT){
+ return 0;
+ }else{
+ timeval *ret = new timeval;
+ ret->tv_sec=m_maxTime;
+ ret->tv_usec=0;
+ return ret;
+ }
+}
+
+bool LDAPConstraints::getReferralChase() const {
+ return m_referralChase;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+#include <list>
+#include "config.h"
+#include "ac/time.h"
+
+#include "LDAPControl.h"
+#include <ldap.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
+ * 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
+ LDAPConstraints();
+
+ //! Copy constructor
+ LDAPConstraints(const LDAPConstraints& c);
+
+ ~LDAPConstraints();
+
+ void setMaxTime(int t);
+ void setSizeLimit(int s);
+ void setReferralChase(bool rc);
+ int getMaxTime() const ;
+ int getSizeLimit() const;
+ LDAPControl** getSrvCtrlsArray() const;
+ LDAPControl** getClCtrlsArray() const;
+ timeval* getTimeoutStruct() const;
+ bool getReferralChase() const ;
+};
+#endif //LDAP_CONSTRAINTS_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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){
+
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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 <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);
+
+};
+
+#endif //LDAP_CONTROL_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+
+#include "debug.h"
+
+#include "LDAPDeleteRequest.h"
+#include "LDAPException.h"
+#include "LDAPMessageQueue.h"
+
+LDAPDeleteRequest::LDAPDeleteRequest( const LDAPDeleteRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPDeleteRequest::LDAPDeleteRequest(LDAPDeleteRequest&)"
+ << endl);
+}
+
+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);
+ m_requestType=LDAPRequest::DELETE;
+ if(dn != 0){
+ m_dn=strdup(dn);
+ }
+}
+
+LDAPDeleteRequest::~LDAPDeleteRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
+ delete[] m_dn;
+}
+
+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);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPDeleteRequest::followReferral(LDAPUrlList *refs){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPDeleteRequest::followReferral()" << endl);
+ cerr << "to be implemented" << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_DELETE_REQUEST_H
+#define LDAP_DELETE_REQUEST_H
+
+#include "LDAPRequest.h"
+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);
+ virtual ~LDAPDeleteRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *refs);
+};
+#endif //LDAP_DELETE_REQUEST_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+LDAPEntry::LDAPEntry(const LDAPEntry& entry){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::LDAPEntry(LDAPEntry&)" << endl);
+ this->setDN(entry.m_dn);
+ this->setAttributes(entry.m_attrs);
+}
+
+
+LDAPEntry::LDAPEntry(const char *dn,
+ LDAPAttributeList *attrs=new LDAPAttributeList()){
+ m_attrs=attrs;
+ m_dn=strdup(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");
+}
+
+LDAPEntry::~LDAPEntry(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPEntry::~LDAPEntry()" << endl);
+ delete[] m_dn;
+ delete m_attrs;
+}
+
+void LDAPEntry::setDN(const char* dn){
+ if (m_dn != 0){
+ delete[] m_dn;
+ }
+ m_dn=strdup(dn);
+}
+
+void LDAPEntry::setAttributes(LDAPAttributeList *attrs){
+ if (m_attrs != 0){
+ delete m_attrs;
+ }
+ m_attrs=attrs;
+}
+
+char* LDAPEntry::getDN(){
+ return strdup(m_dn);
+}
+
+LDAPAttributeList* LDAPEntry::getAttributes(){
+ return m_attrs;
+}
+
+ostream& operator << (ostream& s, const LDAPEntry& le){
+ s << "DN: " << le.m_dn << ": " << *(le.m_attrs);
+ return s;
+}
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+#include <ldap.h>
+
+#include "LDAPAsynConnection.h"
+#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 LDAPAsynConnection *ld, LDAPMessage *msg);
+ ~LDAPEntry();
+ void setDN(const char* dn);
+ void setAttributes(LDAPAttributeList *attrs);
+ char* getDN();
+ LDAPAttributeList* getAttributes();
+ friend ostream& operator << (ostream& s, const LDAPEntry& le);
+};
+#endif //LDAP_ENTRY_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+LDAPException::LDAPException(int res_code, char *err_string=0){
+ 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;
+ }
+}
+
+LDAPException::LDAPException(const LDAPAsynConnection *lc){
+ m_err_string=0;
+ m_res_string=0;
+ 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);
+}
+
+int LDAPException::getResultCode(){
+ return m_res_code;
+}
+
+char* LDAPException::getResultMsg(){
+ return strdup(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) {
+ s << endl << "additional info: " << e.m_err_string ;
+ }
+ return s;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+class LDAPException{
+
+ private :
+ int m_res_code;
+ char* m_res_string;
+ char* m_err_string;
+
+ public :
+ LDAPException(int res_code, char *err_string=0);
+ LDAPException(const LDAPAsynConnection *lc);
+ int getResultCode();
+ char* getResultMsg();
+ friend ostream& operator << (ostream &s, LDAPException e);
+};
+#endif //LDAP_EXCEPTION_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+#include <lber.h>
+
+#include "debug.h"
+
+#include "LDAPExtRequest.h"
+#include "LDAPException.h"
+
+LDAPExtRequest::LDAPExtRequest(const LDAPExtRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPExtRequest::LDAPExtRequest(LDAPExtRequest&)" << endl);
+}
+
+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(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::~LDAPExtRequest()" << endl);
+ delete[] m_oid;
+ ber_bvfree(m_data);
+}
+
+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);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPExtRequest::followReferral(LDAPUrlList *urls){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPExtRequest::followReferral()" << endl);
+ cerr << "to be implemented" << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_EXT_REQUEST_H
+#define LDAP_EXT_REQUEST_H
+
+#include "LDAPRequest.h"
+
+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);
+ virtual ~LDAPExtRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *urls);
+};
+
+#endif // LDAP_EXT_REQUEST_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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 "LDAPRequest.h"
+#include "LDAPSearchResult.h"
+#include "LDAPSearchReference.h"
+#include "debug.h"
+#include <iostream>
+
+LDAPMsg::LDAPMsg(LDAPMessage *msg){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::LDAPMsg()" << endl);
+ msgType=ldap_msgtype(msg);
+}
+
+LDAPMsg* LDAPMsg::create(LDAPRequest *req, LDAPMessage *msg){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl);
+ switch(ldap_msgtype(msg)){
+ case LDAP_RES_SEARCH_ENTRY :
+ return new LDAPSearchResult(req,msg);
+ break;
+ case LDAP_RES_SEARCH_REFERENCE :
+ return new LDAPSearchReference(req, msg);
+ break;
+ default :
+ return new LDAPResult(req, msg);
+ }
+ return 0;
+}
+
+
+int LDAPMsg::getMessageType(){
+ return msgType;
+}
+
+int LDAPMsg::getMsgID(){
+ return msgID;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+class LDAPRequest;
+//! Represents an LDAPMsg returned from the server
+/*!
+ * This class is normally not instantiated directly. Normally only
+ * its subclasses are used. The main feature of this class is the
+ * 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;
+ static const int SEARCH_DONE=LDAP_RES_SEARCH_RESULT;
+ static const int SEARCH_REFERENCE=LDAP_RES_SEARCH_REFERENCE;
+ static const int MODIFY_RESPONSE=LDAP_RES_MODIFY;
+ static const int ADD_RESPONSE=LDAP_RES_ADD;
+ static const int DEL_RESPONSE=LDAP_RES_DELETE;
+ static const int MODDN_RESPONSE=LDAP_RES_MODDN;
+ static const int COMPARE_RESPONSE=LDAP_RES_COMPARE;
+ static const int EXTENDED_RESPONSE=LDAP_RES_EXTENDED;
+
+ virtual ~LDAPMsg() {}
+
+ /*!
+ * Based on msgtype-Value of the *msg-Parameter this method creates
+ * an Object of one of the subtypes of LDAPMsg (e.g. LDAPSearchResult
+ * or LDAPResult) that represents the same Message as the
+ * *msg-Parameter. *msg is e.g. a Message returned by the C-API's
+ * ldap_result call.
+ */
+ static LDAPMsg* create(LDAPRequest *req, LDAPMessage *msg);
+ int getMessageType();
+ int getMsgID();
+};
+#endif //ifndef LDAP_MSG_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+#include <ldap.h>
+#include "LDAPMessageQueue.h"
+#include "LDAPRequest.h"
+#include "LDAPAsynConnection.h"
+#include "LDAPMessage.h"
+#include "LDAPResult.h"
+#include "LDAPSearchReference.h"
+#include "LDAPSearchRequest.h"
+#include "LDAPUrl.h"
+#include "LDAPUrlList.h"
+#include "LDAPException.h"
+
+// TODO: How to handel unsolicited notifications, like notice of
+// disconnection
+
+LDAPMessageQueue::LDAPMessageQueue(LDAPRequest *req){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPMessageQueue::LDAPMessageQueue()" << endl);
+ m_reqQueue.push(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();
+ }
+}
+
+LDAPMsg *LDAPMessageQueue::getNext(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPMessageQueue::getNext()" << endl);
+ LDAPMessage *msg;
+ LDAPRequest *req=m_reqQueue.top();
+ const LDAPConstraints *constr=req->getConstraints();
+ 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);
+ throw LDAPException(con);
+ }else{
+ LDAPMsg *ret = LDAPMsg::create(req,msg);
+ ldap_msgfree(msg);
+ switch (ret->getMessageType()) {
+ case LDAPMsg::SEARCH_REFERENCE :
+ if (constr->getReferralChase() ){
+ LDAPSearchReference *ref=(LDAPSearchReference *)ret;
+ LDAPRequest *refReq=chaseReferral(ref->getURLs());
+ if(refReq != 0){
+ m_reqQueue.push(refReq);
+ return getNext();
+ }
+ }
+ return ret;
+ break;
+ case LDAPMsg::SEARCH_ENTRY :
+ 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);
+ return ret;
+ break;
+ default:
+ return ret;
+ }
+ delete req;
+ m_reqQueue.pop();
+ return getNext();
+ }else{
+ return ret;
+ }
+ break;
+ //must be some kind of LDAPResultMessage
+ default:
+ 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;
+ return ret;
+ break;
+ default:
+ delete req;
+ m_reqQueue.pop();
+ return ret;
+ }
+ break;
+ }
+ }
+}
+
+// TODO Maybe moved to LDAPRequest::followReferral seems more reasonable
+//there
+LDAPRequest* LDAPMessageQueue::chaseReferral(LDAPUrlList *refs){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPMessageQueue::chaseReferra()" << endl);
+ LDAPRequest *req=m_reqQueue.top();
+ LDAPRequest *refReq=req->followReferral(refs);
+ if(refReq !=0){
+ try {
+ refReq->sendRequest();
+ return refReq;
+ }catch (LDAPException e){
+ cout << e << endl;
+ DEBUG(LDAP_DEBUG_TRACE," caught exception" << endl);
+ return 0;
+ }
+ }else{
+ return 0;
+ }
+}
+
+LDAPRequestStack* LDAPMessageQueue::getRequestStack(){
+ return &m_reqQueue;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include <stack>
+
+#include "LDAPUrlList.h"
+
+class LDAPAsynConnection;
+class LDAPMsg;
+class LDAPRequest;
+class LDAPSearchRequest;
+class LDAPUrl;
+typedef stack<LDAPRequest*> LDAPRequestStack;
+
+class LDAPMessageQueue{
+ private :
+ LDAPRequestStack m_reqQueue;
+ void chaseReference(LDAPSearchRequest *req);
+ public :
+ LDAPMessageQueue(LDAPRequest *conn);
+ ~LDAPMessageQueue();
+ LDAPMsg* getNext();
+ LDAPRequest* chaseReferral(LDAPUrlList *ref);
+ LDAPRequestStack* getRequestStack();
+};
+#endif //ifndef LDAP_MESSAGE_QUEUE_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+
+#include "debug.h"
+
+#include "LDAPModDNRequest.h"
+#include "LDAPException.h"
+#include "LDAPUrlList.h"
+
+LDAPModDNRequest::LDAPModDNRequest(const LDAPModDNRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPModDNRequest::LDAPModDNRequest(LDAPModDNRequest&)" << endl);
+}
+
+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;
+ }
+ m_deleteOld=deleteOld;
+}
+
+LDAPModDNRequest::~LDAPModDNRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPModDNRequest::~LDAPModDNRequest()" << endl);
+ delete[] m_dn;
+ delete[] m_newRDN;
+ delete[] m_newParentDN;
+}
+
+LDAPMessageQueue* LDAPModDNRequest::sendRequest(){
+ 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);
+ if(err!=LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msg_id;
+ return new LDAPMessageQueue(this);
+ }
+
+}
+
+LDAPRequest* LDAPModDNRequest::followReferral(LDAPUrlList *urls){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::followReferral()" << endl);
+ cerr << "to be implemented ..." << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_MOD_DN_REQUEST_H
+#define LDAP_MOD_DN_REQUEST_H
+
+#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);
+ virtual ~LDAPModDNRequest();
+
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList* urls);
+};
+
+#endif // LDAP_MOD_DN_REQUEST_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+// $Id: LDAPModList.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
+
+#include "LDAPModList.h"
+
+LDAPModList::LDAPModList(){
+}
+
+LDAPModList::LDAPModList(const LDAPModList&){
+}
+
+void LDAPModList::addModification(const LDAPModification &mod){
+ m_modList.push_back(mod);
+}
+
+LDAPMod** LDAPModList::toLDAPModArray(){
+ LDAPMod **ret = new LDAPMod*[m_modList.size()+1];
+ ret[m_modList.size()]=0;
+ ModList::const_iterator i;
+ int j=0;
+ for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){
+ ret[j]=i->toLDAPMod();
+ }
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include <ldap.h>
+#include <list>
+#include "LDAPModification.h"
+
+typedef list<LDAPModification> ModList;
+
+class LDAPModList{
+ private :
+ ModList m_modList;
+
+ public :
+ LDAPModList();
+ LDAPModList(const LDAPModList&);
+
+ void addModification(const LDAPModification &mod);
+ LDAPMod** toLDAPModArray();
+
+};
+#endif //LDAP_MOD_LIST_H
+
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+// $Id: LDAPModification.cpp,v 1.3 2000/08/31 17:43:49 rhafer Exp $
+
+#include "LDAPModification.h"
+
+LDAPModification::LDAPModification(const LDAPAttribute& attr, mod_op op){
+ m_attr = attr;
+ m_mod_op = op;
+}
+
+LDAPMod *LDAPModification::toLDAPMod() const {
+ 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)
+ switch (m_mod_op){
+ case OP_ADD :
+ ret->mod_op |= LDAP_MOD_ADD;
+ break;
+ case OP_DELETE :
+ ret->mod_op |= LDAP_MOD_DELETE;
+ break;
+ case OP_REPLACE :
+ ret->mod_op |= LDAP_MOD_REPLACE;
+ break;
+ }
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include <ldap.h>
+#include "LDAPAttribute.h"
+
+class LDAPModification{
+ public:
+ enum mod_op {OP_ADD, OP_DELETE, OP_REPLACE};
+
+ LDAPModification(const LDAPAttribute& attr, mod_op op);
+ LDAPMod *toLDAPMod() const;
+
+ private:
+ LDAPAttribute m_attr;
+ mod_op m_mod_op;
+
+};
+#endif //LDAP_MODIFICATION_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include <ldap.h>
+
+#include <debug.h>
+
+#include "LDAPModifyRequest.h"
+#include "LDAPException.h"
+#include "LDAPMessageQueue.h"
+
+LDAPModifyRequest::LDAPModifyRequest(const LDAPModifyRequest& req) :
+ LDAPRequest(req){
+ DEBUG(LDAP_DEBUG_TRACE,
+ "LDAPModifyRequest::LDAPModifyRequest(LDAPModifyRequest&)"
+ << endl);
+}
+
+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);
+ m_modList = new LDAPModList(*modList);
+}
+
+LDAPModifyRequest::~LDAPModifyRequest(){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::~LDAPModifyRequest()" << endl);
+ delete m_dn;
+ 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);
+ if(err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ }else{
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPModifyRequest::followReferral(LDAPUrlList *refs){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPModifyRequest::followReferral()" << endl);
+ cerr << "to be implemented ..." << endl;
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_MODIFY_REQUEST_H
+#define LDAP_MODIFY_REQUEST_H
+
+#include "LDAPRequest.h"
+
+class LDAPMessageQueue;
+
+class LDAPModifyRequest : LDAPRequest {
+ private :
+ char *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);
+ virtual ~LDAPModifyRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *refs);
+};
+
+#endif // LDAP_MODIFY_REQUEST_H
+
--- /dev/null
+/*
+ * 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();
+}
+
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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(){
+}
+
+LDAPRequest::LDAPRequest(const LDAPRequest& req){
+ DEBUG(LDAP_DEBUG_TRACE, "LDAPRequest::LDAPRequest(LDAPRequest&)" << endl);
+}
+
+LDAPRequest::LDAPRequest(const LDAPAsynConnection* con,
+ const LDAPConstraints* cons, bool isReferral){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::LDAPRequest()" << endl);
+ m_connection=con;
+ if(cons == 0){
+ cons=con->getConstraints();
+ }
+ m_cons=new LDAPConstraints( *cons);
+ m_isReferral=isReferral;
+}
+
+LDAPRequest::~LDAPRequest(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPRequest::~LDAPRequest()" << endl);
+ delete m_cons;
+}
+
+const LDAPConstraints* LDAPRequest::getConstraints(){
+ return m_cons;
+}
+
+const LDAPAsynConnection* LDAPRequest::getConnection(){
+ return m_connection;
+}
+
+int LDAPRequest::getType() const {
+ return m_requestType;
+}
+
+int LDAPRequest::getMsgID() const {
+ return m_msgID;
+}
+
+bool LDAPRequest::isReferral() const {
+ return m_isReferral;
+}
+
+/*
+ bool LDAPRequest::doRebind() const {
+ cerr << "doRebind not implemented always returns true" << endl;
+ return true;
+}
+*/
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include "LDAPConstraints.h"
+#include "LDAPAsynConnection.h"
+#include "LDAPMessageQueue.h"
+
+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;
+ static const int MODIFY=7;
+ static const int ADD=8;
+ static const int DELETE=10;
+ static const int COMPARE=14;
+};
+#endif //LDAP_REQUEST_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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"
+
+LDAPResult::LDAPResult(LDAPRequest *req, LDAPMessage *msg) : LDAPMsg(msg){
+ if(msg != 0){
+ DEBUG(LDAP_DEBUG_TRACE,"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);
+ }
+ }
+ }
+}
+
+LDAPResult::~LDAPResult(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPResult::~LDAPResult()" << endl);
+ delete[] m_matchedDN;
+ delete[] m_errMsg;
+}
+
+int LDAPResult::getResultCode(){
+ return m_resCode;
+}
+
+char* LDAPResult::resToString(){
+ return ldap_err2string(m_resCode);
+}
+
+char* LDAPResult::getErrMsg(){
+ return strdup(m_errMsg);
+}
+
+char* LDAPResult::getMatchedDN(){
+ return strdup(m_matchedDN);
+}
+
+ostream& operator<<(ostream &s,LDAPResult &l){
+ return s << "Result: " << l.m_resCode << ": "
+ << ldap_err2string(l.m_resCode) << endl
+ << "Matched: " << l.m_matchedDN << endl << "ErrMsg: " << l.m_errMsg;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include<iostream>
+#include<ldap.h>
+#include "LDAPMessage.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);
+ virtual ~LDAPResult();
+ int getResultCode();
+ char* resToString();
+ char* getErrMsg();
+ char* getMatchedDN();
+ friend ostream& operator<<(ostream &s,LDAPResult &l);
+};
+#endif //LDAP_RESPONSE_H
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+// $Id: LDAPSearchReference.cpp,v 1.7 2000/08/31 17:43:49 rhafer Exp $
+
+#include <iostream>
+
+#include "debug.h"
+#include "LDAPSearchReference.h"
+#include "LDAPException.h"
+#include "LDAPRequest.h"
+#include "LDAPUrl.h"
+
+LDAPSearchReference::LDAPSearchReference(LDAPRequest *req, LDAPMessage *msg) :
+ LDAPMsg(msg){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchReference::LDAPSearchReference()"
+ << endl;)
+ char **ref=0;
+ const LDAPAsynConnection* con=req->getConnection();
+ int err = ldap_parse_reference(con->getSessionHandle(), msg, &ref, 0,0);
+ if (err != LDAP_SUCCESS){
+ 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);
+ }
+ }
+}
+
+LDAPSearchReference::~LDAPSearchReference(){
+ LDAPUrlList::const_iterator i;
+ for(i=m_urlList.begin(); i!=m_urlList.end(); i++){
+ delete *i;
+ }
+}
+
+LDAPUrlList* LDAPSearchReference::getURLs(){
+ return &m_urlList;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include "LDAPMessage.h"
+#include "LDAPUrlList.h"
+
+class LDAPRequest;
+class LDAPUrl;
+
+class LDAPSearchReference : public LDAPMsg{
+
+ private :
+ LDAPUrlList m_urlList;
+ LDAPSearchReference();
+
+ public :
+ LDAPSearchReference(LDAPRequest* req, LDAPMessage* msg);
+ ~LDAPSearchReference();
+ LDAPUrlList* getURLs();
+};
+
+
+
+#endif //LDAP_SEARCH_REFERENCE_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "debug.h"
+#include "LDAPSearchRequest.h"
+#include "LDAPException.h"
+#include "LDAPSearchReference.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);
+}
+
+
+LDAPSearchRequest::LDAPSearchRequest(const char *base, int scope,
+ const char *filter, char **attrs, const LDAPAsynConnection *connect,
+ const LDAPConstraints* cons, bool isReferral)
+ : LDAPRequest (connect,cons,isReferral) {
+
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchRequest:LDAPSearchRequest" << endl);
+ m_requestType=LDAPRequest::SEARCH;
+ //insert some validating and copying here
+ m_base=strdup(base);
+ m_scope=scope;
+
+ if (filter != 0 ){
+ m_filter=strdup(filter);
+ }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;
+ }
+}
+
+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;
+}
+
+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 );
+ if (err != LDAP_SUCCESS){
+ delete this;
+ throw LDAPException(err);
+ } else {
+ m_msgID=msgID;
+ return new LDAPMessageQueue(this);
+ }
+}
+
+LDAPRequest* LDAPSearchRequest::followReferral(LDAPUrlList *ref){
+ LDAPUrl *usedUrl;
+ 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);
+ }
+ return new LDAPSearchRequest(base, scope, filter, 0, con, m_cons,true);
+ }else{
+ return 0;
+ }
+}
+
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_SEARCH_REQUEST_H
+#define LDAP_SEARCH_REQUEST_H
+
+#include <queue>
+#include "LDAPRequest.h"
+
+class LDAPSearchReference;
+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);
+ virtual ~LDAPSearchRequest();
+ virtual LDAPMessageQueue* sendRequest();
+ virtual LDAPRequest* followReferral(LDAPUrlList *ref);
+};
+
+#endif //LDAP_SEARCH_REQUEST_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+// $Id: LDAPSearchResult.cpp,v 1.6 2000/08/31 17:43:49 rhafer Exp $
+
+#include <iostream>
+
+#include "debug.h"
+#include"LDAPSearchResult.h"
+#include "LDAPRequest.h"
+
+LDAPSearchResult::LDAPSearchResult(LDAPRequest *req, LDAPMessage *msg)
+ : LDAPMsg(msg){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::LDAPSearchResult()" << endl);
+ entry = new LDAPEntry(req->getConnection(), msg);
+}
+
+LDAPSearchResult::~LDAPSearchResult(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::~LDAPSearchResult()" << endl);
+ delete entry;
+}
+
+LDAPEntry* LDAPSearchResult::getEntry(){
+ DEBUG(LDAP_DEBUG_TRACE,"LDAPSearchResult::getEntry()" << endl);
+ return entry;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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
+
+#include "LDAPMessage.h"
+#include "LDAPEntry.h"
+
+class LDAPRequest;
+
+class LDAPSearchResult : public LDAPMsg{
+ private:
+ LDAPEntry *entry;
+ public:
+ LDAPSearchResult(LDAPRequest *req, LDAPMessage *msg);
+ virtual ~LDAPSearchResult();
+ LDAPEntry* getEntry();
+};
+#endif //LDAP_SEARCH_RESULT_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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);
+ if (ldap_is_ldap_url(url)){
+ m_urlString = strdup(url);
+ ldap_url_parse(url, &m_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);
+}
+
+int LDAPUrl::getPort() const {
+ return m_urlDesc->lud_port;
+}
+
+int LDAPUrl::getScope() const {
+ return m_urlDesc->lud_scope;
+}
+
+char* LDAPUrl::getURLString() const {
+ return strdup(m_urlString);
+}
+
+char* LDAPUrl::getHost() const {
+ return strdup(m_urlDesc->lud_host);
+}
+
+char* LDAPUrl::getDN() const {
+ return strdup(m_urlDesc->lud_dn);
+}
+
+char* LDAPUrl::getFilter() const {
+ return strdup(m_urlDesc->lud_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;
+}
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * 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>
+
+class LDAPUrl{
+
+ protected :
+ LDAPURLDesc *m_urlDesc;
+ char *m_urlString;
+
+ public :
+ LDAPUrl(char *url);
+ LDAPUrl(char *host, int port, char *dn, char **attrs, int scope=0,
+ char *filter=0);
+ ~LDAPUrl();
+
+ int getPort() const;
+ int getScope() const;
+ char* getURLString() const;
+ char* getHost() const;
+ char* getDN() const;
+ char* getFilter() const;
+ char** getAttrs() const;
+};
+
+#endif //LDAP_URL_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "LDAPUrlList.h"
+
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef LDAP_URL_LIST_H
+#define LDAP_URL_LIST_H
+
+#include <list>
+#include "LDAPUrl.h"
+
+typedef list<LDAPUrl*> LDAPUrlList;
+
+#endif //LDAP_URL_LIST_H
--- /dev/null
+##
+# Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+##
+
+lib_LIBRARIES = libldapcpp.a
+libldapcpp_a_SOURCES = LDAPAddRequest.cpp \
+ LDAPAsynConnection.cpp \
+ LDAPAttribute.cpp \
+ LDAPAttributeList.cpp \
+ LDAPBindRequest.cpp \
+ LDAPCompareRequest.cpp \
+ LDAPConstraints.cpp \
+ LDAPControl.cpp \
+ LDAPDeleteRequest.cpp \
+ LDAPEntry.cpp \
+ LDAPException.cpp \
+ LDAPExtRequest.cpp \
+ LDAPMessage.cpp \
+ LDAPMessageQueue.cpp \
+ LDAPModDNRequest.cpp \
+ LDAPModification.cpp \
+ LDAPModifyRequest.cpp \
+ LDAPModList.cpp \
+ LDAPReferral.cpp \
+ LDAPRequest.cpp \
+ LDAPResult.cpp \
+ LDAPSearchReference.cpp \
+ LDAPSearchRequest.cpp \
+ LDAPSearchResult.cpp \
+ LDAPUrl.cpp \
+ LDAPUrlList.cpp
+
+bin_PROGRAMS = main
+
+main_SOURCES = main.cpp
+main_LDADD = ./libldapcpp.a
+
+
--- /dev/null
+/* Generic string.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_STRING_H
+#define _AC_STRING_H
+
+#ifdef STDC_HEADERS
+# include <string.h>
+
+#else
+# ifdef HAVE_STRING_H
+# include <string.h>
+# elif HAVE_STRINGS_H
+# include <strings.h>
+# endif
+
+# ifdef HAVE_MEMORY_H
+# include <memory.h>
+# endif
+
+# ifndef HAVE_STRRCHR
+# undef strchr
+# define strchr index
+# undef strrchr
+# define strrchr rindex
+# endif
+
+# ifndef HAVE_MEMCPY
+# undef memcpy
+# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n)))
+# undef memmove
+# define memmove(d, s, n) ((void) bcopy ((s), (d), (n)))
+# endif
+#endif
+
+/* use ldap_pvt_strtok instead of strtok or strtok_r! */
+LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str, const char *delim,
+ char **pos ));
+
+#ifndef HAVE_STRDUP
+ /* strdup() is missing, declare our own version */
+# undef strdup
+# define strdup(s) ber_strdup(s)
+#else
+ /* some systems fail to declare strdup */
+ LDAP_LIBC_F(char *) (strdup)();
+#endif
+
+/*
+ * some systems fail to declare strcasecmp() and strncasecmp()
+ * we need them declared so we can obtain pointers to them
+ */
+
+/* In Mingw32, strcasecmp is not in the C library, so we don't LIBC_F it */
+int (strcasecmp)();
+int (strncasecmp)();
+
+#ifndef SAFEMEMCPY
+# if defined( HAVE_MEMMOVE )
+# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n))
+# elif defined( HAVE_BCOPY )
+# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
+# else
+ /* nothing left but memcpy() */
+# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n))
+# endif
+#endif
+
+#define AC_MEMCPY( d, s, n ) (SAFEMEMCPY((d),(s),(n)))
+#define AC_FMEMCPY( d, s, n ) do { \
+ if((n) == 1) *((char*)(d)) = *((char*)(s)); \
+ else AC_MEMCPY( (d), (s), (n) ); \
+ } while(0)
+
+#endif /* _AC_STRING_H */
--- /dev/null
+/* Generic time.h */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
+
+#ifndef _AC_TIME_H
+#define _AC_TIME_H
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#elif HAVE_SYS_TIME_H
+# include <sys/time.h>
+# ifdef HAVE_SYS_TIMEB_H
+# include <sys/timeb.h>
+# endif
+#else
+# include <time.h>
+#endif
+
+#endif /* _AC_TIME_H */
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#ifndef DEBUG_H
+#define DEBUG_H
+#include <iostream>
+
+#define LDAP_DEBUG_NONE 0x0000
+#define LDAP_DEBUG_TRACE 0x0001
+#define LDAP_DEBUG_RESPONSE 0x0002
+#define LDAP_DEBUG_REQUEST 0x0004
+#define LDAP_DEBUG_PARAMETER 0x0008
+#define LDAP_DEBUG_ANY -1
+
+#define DEBUGLEVEL LDAP_DEBUG_ANY
+
+#define PRINT_FILE \
+ cerr << "file: " __FILE__ << " line: " << __LINE__
+
+#define DEBUG(level, arg) \
+ if(level & DEBUGLEVEL){ \
+ cerr << arg ; \
+ }
+
+
+
+#endif // DEBUG_H
--- /dev/null
+/*
+ * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include<iostream.h>
+#include<strstream>
+#include"LDAPAsynConnection.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"debug.h"
+
+int main(){
+ LDAPAsynConnection *lc=new LDAPAsynConnection("localhost",9009);
+ 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;
+ }
+ }catch (LDAPException e){
+ cout << "-------------------------...error during bind" << endl;
+ cout << e << endl;
+ }
+ cout << "--------------------starting search" << endl;
+ try{
+ LDAPMessageQueue *q=lc->search("");
+ LDAPMsg *res=q->getNext();
+ bool cont=true;
+ while( cont ) {
+ switch(res->getMessageType()){
+ LDAPSearchResult *res2;
+ LDAPEntry *entry;
+ case LDAP_RES_SEARCH_ENTRY :
+ res2= (LDAPSearchResult*)res;
+ entry= res2->getEntry();
+ cout << "Entry: " << *entry << endl;
+ delete res;
+ res=q->getNext();
+ break;
+ case LDAP_RES_SEARCH_REFERENCE :
+ delete res;
+ res=q->getNext();
+ break;
+ default :
+ cout << ( *(LDAPResult*) res) << endl;
+ delete res;
+ cout << "-----------------search done" << endl;
+ cont=false;
+ break;
+ }
+ }
+ delete q;
+ }catch (LDAPException e){
+ cout << "----------------error during search" << endl;
+ cout << e << endl;
+ }
+}
+