# Copyright 2003, OpenLDAP Foundation, All Rights Reserved.
# COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
-noinst_PROGRAMS = main readSchema
+noinst_PROGRAMS = main readSchema urlTest
main_SOURCES = main.cpp
main_LDADD = ../src/libldapcpp.la
readSchema_SOURCES = readSchema.cpp
readSchema_LDADD = ../src/libldapcpp.la
+
+urlTest_SOURCES = urlTest.cpp
+urlTest_LDADD = ../src/libldapcpp.la
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-noinst_PROGRAMS = main$(EXEEXT) readSchema$(EXEEXT)
+noinst_PROGRAMS = main$(EXEEXT) readSchema$(EXEEXT) urlTest$(EXEEXT)
subdir = examples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am_readSchema_OBJECTS = readSchema.$(OBJEXT)
readSchema_OBJECTS = $(am_readSchema_OBJECTS)
readSchema_DEPENDENCIES = ../src/libldapcpp.la
+am_urlTest_OBJECTS = urlTest.$(OBJEXT)
+urlTest_OBJECTS = $(am_urlTest_OBJECTS)
+urlTest_DEPENDENCIES = ../src/libldapcpp.la
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(main_SOURCES) $(readSchema_SOURCES)
-DIST_SOURCES = $(main_SOURCES) $(readSchema_SOURCES)
+SOURCES = $(main_SOURCES) $(readSchema_SOURCES) $(urlTest_SOURCES)
+DIST_SOURCES = $(main_SOURCES) $(readSchema_SOURCES) \
+ $(urlTest_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
main_LDADD = ../src/libldapcpp.la
readSchema_SOURCES = readSchema.cpp
readSchema_LDADD = ../src/libldapcpp.la
+urlTest_SOURCES = urlTest.cpp
+urlTest_LDADD = ../src/libldapcpp.la
all: all-am
.SUFFIXES:
readSchema$(EXEEXT): $(readSchema_OBJECTS) $(readSchema_DEPENDENCIES)
@rm -f readSchema$(EXEEXT)
$(CXXLINK) $(readSchema_LDFLAGS) $(readSchema_OBJECTS) $(readSchema_LDADD) $(LIBS)
+urlTest$(EXEEXT): $(urlTest_OBJECTS) $(urlTest_DEPENDENCIES)
+ @rm -f urlTest$(EXEEXT)
+ $(CXXLINK) $(urlTest_LDFLAGS) $(urlTest_OBJECTS) $(urlTest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readSchema.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urlTest.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
--- /dev/null
+#include <LDAPUrl.h>
+#include <LDAPException.h>
+#include <iostream>
+
+int main(int argc, char *argv[]) {
+ if ( argc != 2 ) {
+ std::cout << argc << std::endl;
+ std::cout << "urlTest <ldap-URI>" << std::endl;
+ exit(1);
+ }
+ std::string uristr = argv[1];
+ try {
+ LDAPUrl url(uristr);
+ std::cout << "Host: " << url.getHost() << std::endl;
+ std::cout << "Port: " << url.getPort() << std::endl;
+ std::cout << "BaseDN: " << url.getDN() << std::endl;
+ std::cout << "Scope: " << url.getScope() << std::endl;
+ StringList attrs = url.getAttrs();
+ std::cout << "Attrs: " << std::endl;
+ StringList::const_iterator i = attrs.begin();
+ for( ; i != attrs.end(); i++ ) {
+ std::cout << " " << *i << std::endl;
+ }
+ std::cout << "Filter: " << url.getFilter() << std::endl;
+ std::cout << "Setting new BaseDN" << std::endl;
+ url.setDN("o=Beispiel, c=DE");
+ std::cout << "Url: " << url.getURLString() << std::endl;
+ } catch (LDAPUrlException e) {
+ std::cout << e.getCode() << std::endl;
+ std::cout << e.getErrorMessage() << std::endl;
+ std::cout << e.getAdditionalInfo() << std::endl;
+ }
+
+}