From: Randy Kunkee Date: Wed, 10 Feb 1999 23:56:49 +0000 (+0000) Subject: Place NeoSoft Inc. LDAP Tcl client code into OpenLDAP contrib tree. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~598 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ef123c1ceccd8890dacba21e0e71311ad985d7e9;p=openldap Place NeoSoft Inc. LDAP Tcl client code into OpenLDAP contrib tree. --- diff --git a/contrib/ldaptcl/COPYRIGHT b/contrib/ldaptcl/COPYRIGHT new file mode 100644 index 0000000000..e9be9a737c --- /dev/null +++ b/contrib/ldaptcl/COPYRIGHT @@ -0,0 +1,23 @@ +NeoSoft Tcl client extensions to Lightweight Directory Access Protocol. + +Copyright (c) 1998-1999 NeoSoft, Inc. +All Rights Reserved. + +This software may be used, modified, copied, distributed, and sold, +in both source and binary form provided that these copyrights are +retained and their terms are followed. + +Under no circumstances are the authors or NeoSoft Inc. responsible +for the proper functioning of this software, nor do the authors +assume any liability for damages incurred with its use. + +Redistribution and use in source and binary forms are permitted +provided that this notice is preserved and that due credit is given +to NeoSoft, Inc. + +NeoSoft, Inc. 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. + +Requests for permission may be sent to NeoSoft Inc, 1770 St. James Place, +Suite 500, Houston, TX, 77056. diff --git a/contrib/ldaptcl/Makefile.in b/contrib/ldaptcl/Makefile.in new file mode 100644 index 0000000000..a7db9517eb --- /dev/null +++ b/contrib/ldaptcl/Makefile.in @@ -0,0 +1,192 @@ +# +# This file is a Makefile for Neo, the NeoSoft extensions to Tcl. +# If it has the name "Makefile.in" then it is a template for a +# Makefile; to generate the actual Makefile, run "./configure", +# which is a configuration script generated by the "autoconf" program +# (constructs like "@foo@" will get replaced in the actual Makefile. +# + +VERSION = @NEO_VERSION@ +LIBNAME = @NEO_SHARED_LIB_FILE@ + +# Default top-level directories in which to install architecture- +# specific files (exec_prefix) and machine-independent files such +# as scripts (prefix). The values specified here may be overridden +# at configure-time with the --exec-prefix and --prefix options +# to the "configure" script. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# The following definition can be set to non-null for special systems +# like AFS with replication. It allows the pathnames used for installation +# to be different than those used for actually reference files at +# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix +# when installing files. +INSTALL_ROOT = + +# Directory in which to search for tcl libraries +NEO_LIBRARY = $(exec_prefix)/lib/ldaptcl$(VERSION) + +# Directory in which to install the ldaptcl binary: +BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin + +# Directory in which to install the .a or .so binary for the Neo library: +LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib + +# Path to use at runtime to refer to LIB_INSTALL_DIR: +LIB_RUNTIME_DIR = $(exec_prefix)/lib + +# Top-level directory for man entries: +MANN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man/mann + + +# The symbols below provide support for dynamic loading and shared +# libraries. The values of the symbols are normally set by the +# configure script. You shouldn't normally need to modify any of +# these definitions by hand. + +SHLIB_CFLAGS = @NEO_SHLIB_CFLAGS@ + +NEO_LIB_FILE = @NEO_LIB_FILE@ + +NEO_SHARED_LIB_FILE = @NEO_SHARED_LIB_FILE@ + +# The directory containing the Tcl sources and headers appropriate +# for this version of Neo ("srcdir" will be replaced or has already +# been replaced by the configure script): +TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic + +# The top of the TclX directory tree +TCLX_TOP_DIR = @TCLX_TOP_DIR@ + +# The directory where tclExtend.h will be: +TCLX_TCL_GEN_DIR = ${TCLX_TOP_DIR}/tcl/generic + +# The directory where tclXunixPort.h will be: +TCLX_TCL_UNIX_DIR = ${TCLX_TOP_DIR}/tcl/unix + +# The path to tclX the runtcl script: +TCLX_RUNTCL = ${TCLX_TOP_DIR}/unix/runtcl + +# The directory containing the Tcl library archive file appropriate +# for this version of Neo: +TCL_BIN_DIR = @TCL_BIN_DIR@ + + +# The symbol below provides support for dynamic loading and shared +# libraries. See configure.in for a description of what it means. +# The values of the symbolis normally set by the configure script. + +SHLIB_LD = @SHLIB_LD@ + +# Set to the options to include libldap.a and liblber.a +# (eg. -L../tools/blah -lldap -llber) + +LDAP_LIBFLAGS = @ldaplibflags@ +LDAP_CFLAGS = @ldapinclude@ +LDAP_BUILD = @ldapbuild@ +LDAP_DIR = @ldapdir@ + + +#---------------------------------------------------------------- +# The information below is modified by the configure script when +# Makefile is generated from Makefile.in. You shouldn't normally +# modify any of this stuff by hand. +#---------------------------------------------------------------- + +AC_FLAGS = @DEFS@ +INSTALL= @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +RANLIB = @RANLIB@ +SRC_DIR = @srcdir@/.. +TOP_DIR = @srcdir@/.. +GENERIC_DIR = $(TOP_DIR)/generic + +#---------------------------------------------------------------- +# The information below should be usable as is. The configure +# script won't modify it and you shouldn't need to modify it +# either. +#---------------------------------------------------------------- + + +OBJS= neoXldap.o + +LIBDIR=$(exec_prefix)/lib +INCDIR=$(prefix)/include + +LIBS= @LIBS@ @TCLX_LIB_SPEC@ @TCL_LIB_SPEC@ @TCL_LIBS@ $(LDAP_LIBFLAGS) -lc +TK_LIBS=@TKX_LIB_SPEC@ @TK_LIB_SPEC@ @TK_LIBS@ +TK_VERSION=@TK_VERSION@ + +LDAPINCDIR=/usr/local/include + +CC = @CC@ +CC_SWITCHES = ${CFLAGS} @NEO_SHLIB_CFLAGS@ -I. \ +-I@prefix@/include ${AC_FLAGS} ${PROTO_FLAGS} \ +${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \ +-DNEO_LIBRARY=\"${NEO_LIBRARY}\" + +TK_SWITCHES = ${CC_SWITCHES} @TK_XINCLUDES@ + +.c.o: + $(CC) -c $(CC_SWITCHES) $< + +all: @NEO_LIB_FILE@ ldaptclsh @LDAPWISH@ + +@NEO_LIB_FILE@: $(OBJS) + rm -f @NEO_LIB_FILE@ + @MAKE_LIB@ + $(RANLIB) @NEO_LIB_FILE@ + +neoXldap.o: neoXldap.c + $(CC) -c $(LDAP_CFLAGS) $(CC_SWITCHES) $< + +clean: + -rm -f ldaptclsh ldapwish + -rm -f *.o *.a *.so* + +distclean: clean + rm -f Makefile pkgIndex.tcl config.cache config.log config.status + +install: install-binaries install-man + +install-binaries: @NEO_LIB_FILE@ ldaptclsh @LDAPWISH@ + @-mkdir -p $(BIN_INSTALL_DIR) + $(INSTALL_PROGRAM) ldaptclsh $(BIN_INSTALL_DIR)/ldaptclsh + @if [ -n "@LDAPWISH@" ] ; then \ + echo $(INSTALL_PROGRAM) ldapwish $(BIN_INSTALL_DIR)/ldapwish; \ + $(INSTALL_PROGRAM) ldapwish $(BIN_INSTALL_DIR)/ldapwish; \ + fi + $(INSTALL_DATA) @NEO_LIB_FILE@ $(LIB_INSTALL_DIR) + @if [ "$(NEO_LIB_FILE)" = "$(NEO_SHARED_LIB_FILE)" ] ; then \ + echo Installing pkgIndex.tcl in $(NEO_LIBRARY); \ + mkdir -p $(NEO_LIBRARY); \ + $(INSTALL_DATA) pkgIndex.tcl $(NEO_LIBRARY); \ + fi + + +install-man: + @for i in ldap.n; \ + do \ + echo "Installing $$i"; \ + rm -f $(MANN_INSTALL_DIR)/$$i; \ + sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \ + $$i > $(MANN_INSTALL_DIR)/$$i; \ + chmod 444 $(MANN_INSTALL_DIR)/$$i; \ + done; + + +TCLOFILES= tclAppInit.o + +ldaptclsh:$(TCLOFILES) @NEO_LIB_FILE@ + $(CC) @LD_FLAGS@ $(TCLOFILES) @NEO_BUILD_LIB_SPEC@ $(LIBS) \ + @TCL_LD_SEARCH_FLAGS@ -o ldaptclsh + +tkAppInit.o: tkAppInit.c + $(CC) -c ${TK_SWITCHES} tkAppInit.c + +ldapwish:tkAppInit.o @NEO_LIB_FILE@ + $(CC) @LD_FLAGS@ tkAppInit.o @NEO_BUILD_LIB_SPEC@ $(TK_LIBS) $(LIBS) \ + @TCL_LD_SEARCH_FLAGS@ -o ldapwish diff --git a/contrib/ldaptcl/README b/contrib/ldaptcl/README new file mode 100644 index 0000000000..50c2930e00 --- /dev/null +++ b/contrib/ldaptcl/README @@ -0,0 +1,66 @@ +Copyright (c) 1998-1999 NeoSoft, Inc. + +For licensing information, see the file neoXldap.c and the COPYRIGHT +file contains in the directory you found this file. + +This directory contains an extension to Tcl to interface with an +LDAP server. While this software is being released to the OpenLDAP +community, it is the authors' intention that support continue (and +be added) for other client libraries as well. As time goes on, it +is expected that code will converge rather than diverge. + +Support is provided for University of Michigan LDAP version 3.3, +OpenLDAP, and Netscape. + +It uses GNU autoconf. It builds and installs without requiring +parallel directories, but it does require that Tcl and Extended Tcl +are installed in the directory pointed to by --prefix (/usr/local +by default). + +For further info, try "./configure --help". + +For example, I run: + + ./configure --prefix=/opt/neosoft97 --enable-shared \ + --with-ldap=/usr/isp2000/ldap + +Remember that --prefix must be the same prefix used when building +and installint Tcl. + +Netscape configuration has not been well tested, and you may have to +play with the resulting Makefile to get it to work. In particular, +you will probably need to modify the LDAP_LIBFLAGS. However, the +C code itself is reasonably well tested with Netscape. + +This module will install a regular shell (ldaptclsh) a windowing +shell (ldapwish) a library, a pkgIndex.tcl, and a manpage (ldap.n). + +If your Tcl installation has been configured with --enable-shared, +then it is highly recommended that you also use --enable-shared +here. + +Shared libraries and Tcl packages. + +If Tcl is built with --enable-shared, and OpenLDAP (or another version +for that matter) has been build to create -llber and -lldap as shared +libaries, and you build ldaptcl with --enable-shared, it should be +possible to run a plain Tcl interpreter (eg. tclsh8.0) and do + + package require Ldaptcl + +which will install the "ldap" command into the interpreter. + +This may require that you set the LD_LIBRARY_PATH environment variable +appropriately, or use -R or -W,-rpath ld command options. +It also may require that you modify the +If you configure with --enable-shared, and you have shared libraries +for -lldap and -llber, then you might be able to +"package require Ldaptcl", provided that everything is set up +exactly right, ie. -R ld flags, LD_LIBRARY_PATH environment variables, +etc. + +This package was test built on a Sparc Solaris 2.5 using the SUN Pro C +compiler. + +You may email comments or bug fixes to openldap-devel@OpenLDAP.org, +or to kunkee@OpenLDAP.org. diff --git a/contrib/ldaptcl/configure b/contrib/ldaptcl/configure new file mode 100755 index 0000000000..5eaac3d2c9 --- /dev/null +++ b/contrib/ldaptcl/configure @@ -0,0 +1,1606 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-gcc allow use of gcc if available" +ac_help="$ac_help + --enable-gcc allow use of gcc if available" +ac_help="$ac_help + --with-tk=DIR use Tk 8.0 binaries from DIR" +ac_help="$ac_help + --without-x do not build/install ldapwish" +ac_help="$ac_help + --enable-shared build libldaptcl as a shared library" +ac_help="$ac_help + --with-ldap= common parent of ldap include and lib dirs" +ac_help="$ac_help + --with-ldap-incdir= path to ldap.h" +ac_help="$ac_help + --with-ldap-libdir= path to ldap and lber libs" +ac_help="$ac_help + --with-ldap-libflags= -l flags for ldap libraries" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=neoXldap.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +# $Id: configure.in,v 1.15 1998/05/22 21:26:25 kunkee Exp $ + +NEO_VERSION=1.0 +NEO_MAJOR_VERSION=1 +NEO_MINOR_VERSION=0 +VERSION=${NEO_VERSION} + +if test "${prefix}" = "NONE"; then + prefix=/usr/local +fi +if test "${exec_prefix}" = "NONE"; then + exec_prefix=$prefix +fi + +# Check whether --enable-gcc or --disable-gcc was given. +if test "${enable_gcc+set}" = set; then + enableval="$enable_gcc" + neo_ok=$enableval +else + neo_ok=no +fi + +if test "$neo_ok" = "yes"; then + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:566: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:595: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:643: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:677: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:682: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:706: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +else + CC=${CC-cc} + +fi +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:738: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + + +# Check whether --enable-gcc or --disable-gcc was given. +if test "${enable_gcc+set}" = set; then + enableval="$enable_gcc" + neo_ok=$enableval +else + neo_ok=no +fi + +if test "$neo_ok" = "yes"; then + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:811: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:840: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:927: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:951: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +else + CC=${CC-cc} + +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1013: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1065: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test ! -f $exec_prefix/lib/tclConfig.sh +then + { echo "configure: error: Tcl must be installed first" 1>&2; exit 1; } +fi + +. $exec_prefix/lib/tclConfig.sh + +if test ! -f $exec_prefix/lib/tclxConfig.sh +then + { echo "configure: error: Extended Tcl must be installed first" 1>&2; exit 1; } +fi +. $exec_prefix/lib/tclxConfig.sh + + +#-------------------------------------------------------------------- +# See if there was a command-line option for where Tk is; if +# not, assume that its top-level directory is a sibling of ours. +#-------------------------------------------------------------------- + +# Check whether --with-tk or --without-tk was given. +if test "${with_tk+set}" = set; then + withval="$with_tk" + : +else + with_tk=yes +fi + + +case "$with_tk" in + yes) + if test -f $exec_prefix/lib/tkConfig.sh -a $exec_prefix/lib/tkxConfig.sh + then + : + else + { echo "configure: error: Tk does not appear to be installed at $exec_prefix" 1>&2; exit 1; } + fi + ;; + no) ;; + *) { echo "configure: error: Tk cannot be specified and must be in $exec_prefix" 1>&2; exit 1; } + ;; +esac + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +if test "$with_x" = "no" +then + with_tk=no +fi + +if test "$with_tk" != "no" +then + LDAPWISH=ldapwish + . $exec_prefix/lib/tkConfig.sh + . $exec_prefix/lib/tkxConfig.sh +fi + + + + + + + +#-------------------------------------------------------------------- +# Read in configuration information generated by Tcl for shared +# libraries, and arrange for it to be substituted into our +# Makefile. +#-------------------------------------------------------------------- + +CC=$TCL_CC +SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS +SHLIB_LD=$TCL_SHLIB_LD +SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS +SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX +SHLIB_VERSION=$TCL_SHLIB_VERSION +DL_LIBS=$TCL_DL_LIBS +LD_FLAGS=$TCL_LD_FLAGS +NEO_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS + +eval "NEO_SHARED_LIB_FILE=libldap${TCL_SHARED_LIB_SUFFIX}" +eval "NEO_UNSHARED_LIB_FILE=libldap${TCL_UNSHARED_LIB_SUFFIX}" + +#-------------------------------------------------------------------- +# The statements below define a collection of symbols related to +# building libldap as a shared library instead of a static library. +#-------------------------------------------------------------------- + +# Warning: in order to use the following code for libldap and libdb versions, +# the VERSION shell variable is modified, and then is restored after. + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + ok=$enableval +else + ok=no +fi + +if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then + NEO_SHLIB_CFLAGS="${SHLIB_CFLAGS}" + eval "NEO_LIB_FILE=libldaptcl${TCL_SHARED_LIB_SUFFIX}" + MAKE_LIB="\${SHLIB_LD} $TCL_LIB_HNAME -o ${NEO_LIB_FILE} \${OBJS}" + RANLIB=":" +else + NEO_SHLIB_CFLAGS="" + eval "NEO_LIB_FILE=libldaptcl${TCL_UNSHARED_LIB_SUFFIX}" + MAKE_LIB="ar cr ${NEO_LIB_FILE} \${OBJS}" +fi + +# Check whether --with-ldap or --without-ldap was given. +if test "${with_ldap+set}" = set; then + withval="$with_ldap" + neo_ldap=$withval + case $withval in + yes) ldapdir=/usr/local + ;; + no) ;; + *) ldapdir=$withval + neo_ldap=yes + ;; + esac + +else + + neo_ldap=yes + ldapdir=/usr/local + +fi + + +ldapincdir=$ldapdir/include +# Check whether --with-ldap-incdir or --without-ldap-incdir was given. +if test "${with_ldap_incdir+set}" = set; then + withval="$with_ldap_incdir" + ldapincdir=$withval +fi + + +ldaplibdir=$ldapdir/lib +# Check whether --with-ldap-libdir or --without-ldap-libdir was given. +if test "${with_ldap_libdir+set}" = set; then + withval="$with_ldap_libdir" + ldapincdir=$withval +fi + + +# Check whether --with-ldap-libraries or --without-ldap-libraries was given. +if test "${with_ldap_libraries+set}" = set; then + withval="$with_ldap_libraries" + ldaplibflags="-L$ldaplibdir $withval" +else + ldaplibflags="-L$ldaplibdir -lldap -llber" +fi + + +ldapinclude="-I$ldapincdir" + +ldapbuild=yes + + + + + + + +VERSION=${NEO_VERSION} +# Note: in the following variable, it's important to use the absolute +# path name of the Tcl directory rather than "..": this is because +# AIX remembers this path and will attempt to use it at run-time to look +# up the Tcl library. + +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl${VERSION}" + NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl${VERSION}" +else + NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl`echo ${VERSION} | tr -d .`" + NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl`echo ${VERSION} | tr -d .`" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile pkgIndex.tcl" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@TK_LIBS@%$TK_LIBS%g +s%@TK_LIB_SPEC@%$TK_LIB_SPEC%g +s%@TK_XINCLUDES@%$TK_XINCLUDES%g +s%@TK_VERSION@%$TK_VERSION%g +s%@TKX_LIB_SPEC@%$TKX_LIB_SPEC%g +s%@LDAPWISH@%$LDAPWISH%g +s%@ldaplibflags@%$ldaplibflags%g +s%@ldapinclude@%$ldapinclude%g +s%@ldapbuild@%$ldapbuild%g +s%@ldapdir@%$ldapdir%g +s%@DL_LIBS@%$DL_LIBS%g +s%@LD_FLAGS@%$LD_FLAGS%g +s%@MATH_LIBS@%$MATH_LIBS%g +s%@MAKE_LIB@%$MAKE_LIB%g +s%@SHLIB_CFLAGS@%$SHLIB_CFLAGS%g +s%@SHLIB_LD@%$SHLIB_LD%g +s%@SHLIB_LD_LIBS@%$SHLIB_LD_LIBS%g +s%@SHLIB_SUFFIX@%$SHLIB_SUFFIX%g +s%@SHLIB_VERSION@%$SHLIB_VERSION%g +s%@TCLX_TOP_DIR@%$TCLX_TOP_DIR%g +s%@TCLX_TCL_DIR@%$TCLX_TCL_DIR%g +s%@TCLX_LIB_SPEC@%$TCLX_LIB_SPEC%g +s%@ITCL_LIB_SPEC@%$ITCL_LIB_SPEC%g +s%@TCL_LIBS@%$TCL_LIBS%g +s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g +s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g +s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g +s%@TCL_LD_SEARCH_FLAGS@%$TCL_LD_SEARCH_FLAGS%g +s%@TCL_LIB_HNAME@%$TCL_LIB_HNAME%g +s%@TCL_VERSION@%$TCL_VERSION%g +s%@NEO_BUILD_LIB_SPEC@%$NEO_BUILD_LIB_SPEC%g +s%@NEO_LD_SEARCH_FLAGS@%$NEO_LD_SEARCH_FLAGS%g +s%@NEO_SHARED_LIB_FILE@%$NEO_SHARED_LIB_FILE%g +s%@NEO_UNSHARED_LIB_FILE@%$NEO_UNSHARED_LIB_FILE%g +s%@NEO_LIB_FILE@%$NEO_LIB_FILE%g +s%@NEO_LIB_SPEC@%$NEO_LIB_SPEC%g +s%@NEO_MAJOR_VERSION@%$NEO_MAJOR_VERSION%g +s%@NEO_MINOR_VERSION@%$NEO_MINOR_VERSION%g +s%@NEO_SHLIB_CFLAGS@%$NEO_SHLIB_CFLAGS%g +s%@NEO_VERSION@%$NEO_VERSION%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/contrib/ldaptcl/configure.in b/contrib/ldaptcl/configure.in new file mode 100644 index 0000000000..8b5d743a0c --- /dev/null +++ b/contrib/ldaptcl/configure.in @@ -0,0 +1,224 @@ +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tk installation +dnl to configure the system for the local environment. +AC_INIT(neoXldap.c) +# $Id: configure.in,v 1.15 1998/05/22 21:26:25 kunkee Exp $ + +NEO_VERSION=1.0 +NEO_MAJOR_VERSION=1 +NEO_MINOR_VERSION=0 +VERSION=${NEO_VERSION} + +if test "${prefix}" = "NONE"; then + prefix=/usr/local +fi +if test "${exec_prefix}" = "NONE"; then + exec_prefix=$prefix +fi + +AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available], + [neo_ok=$enableval], [neo_ok=no]) +if test "$neo_ok" = "yes"; then + AC_PROG_CC +else + CC=${CC-cc} + AC_SUBST(CC) +fi +AC_PROG_CPP + +AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available], + [neo_ok=$enableval], [neo_ok=no]) +if test "$neo_ok" = "yes"; then + AC_PROG_CC +else + CC=${CC-cc} +AC_SUBST(CC) +fi + +AC_PROG_INSTALL(install-sh) +AC_PROG_RANLIB + +if test ! -f $exec_prefix/lib/tclConfig.sh +then + AC_MSG_ERROR(Tcl must be installed first) +fi + +. $exec_prefix/lib/tclConfig.sh + +if test ! -f $exec_prefix/lib/tclxConfig.sh +then + AC_MSG_ERROR(Extended Tcl must be installed first) +fi +. $exec_prefix/lib/tclxConfig.sh + + +#-------------------------------------------------------------------- +# See if there was a command-line option for where Tk is; if +# not, assume that its top-level directory is a sibling of ours. +#-------------------------------------------------------------------- + +AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.0 binaries from DIR], + , with_tk=yes) + +case "$with_tk" in + yes) + if test -f $exec_prefix/lib/tkConfig.sh -a $exec_prefix/lib/tkxConfig.sh + then + : + else + AC_MSG_ERROR(Tk does not appear to be installed at $exec_prefix) + fi + ;; + no) ;; + *) AC_MSG_ERROR(Tk cannot be specified and must be in $exec_prefix) + ;; +esac + +AC_ARG_WITH(x, [ --without-x do not build/install ldapwish]) +if test "$with_x" = "no" +then + with_tk=no +fi + +if test "$with_tk" != "no" +then + LDAPWISH=ldapwish + . $exec_prefix/lib/tkConfig.sh + . $exec_prefix/lib/tkxConfig.sh +fi +AC_SUBST(TK_LIBS) +AC_SUBST(TK_LIB_SPEC) +AC_SUBST(TK_XINCLUDES) +AC_SUBST(TK_VERSION) +AC_SUBST(TKX_LIB_SPEC) +AC_SUBST(LDAPWISH) + +#-------------------------------------------------------------------- +# Read in configuration information generated by Tcl for shared +# libraries, and arrange for it to be substituted into our +# Makefile. +#-------------------------------------------------------------------- + +CC=$TCL_CC +SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS +SHLIB_LD=$TCL_SHLIB_LD +SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS +SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX +SHLIB_VERSION=$TCL_SHLIB_VERSION +DL_LIBS=$TCL_DL_LIBS +LD_FLAGS=$TCL_LD_FLAGS +NEO_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS + +eval "NEO_SHARED_LIB_FILE=libldap${TCL_SHARED_LIB_SUFFIX}" +eval "NEO_UNSHARED_LIB_FILE=libldap${TCL_UNSHARED_LIB_SUFFIX}" + +#-------------------------------------------------------------------- +# The statements below define a collection of symbols related to +# building libldap as a shared library instead of a static library. +#-------------------------------------------------------------------- + +# Warning: in order to use the following code for libldap and libdb versions, +# the VERSION shell variable is modified, and then is restored after. + +AC_ARG_ENABLE(shared, + [ --enable-shared build libldaptcl as a shared library], + [ok=$enableval], [ok=no]) +if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then + NEO_SHLIB_CFLAGS="${SHLIB_CFLAGS}" + eval "NEO_LIB_FILE=libldaptcl${TCL_SHARED_LIB_SUFFIX}" + MAKE_LIB="\${SHLIB_LD} $TCL_LIB_HNAME -o ${NEO_LIB_FILE} \${OBJS}" + RANLIB=":" +else + NEO_SHLIB_CFLAGS="" + eval "NEO_LIB_FILE=libldaptcl${TCL_UNSHARED_LIB_SUFFIX}" + MAKE_LIB="ar cr ${NEO_LIB_FILE} \${OBJS}" +fi + +AC_ARG_WITH(ldap, [ --with-ldap= common parent of ldap include and lib dirs], + [neo_ldap=$withval + case $withval in + yes) ldapdir=/usr/local + ;; + no) ;; + *) ldapdir=$withval + neo_ldap=yes + ;; + esac + ], [ + neo_ldap=yes + ldapdir=/usr/local + ]) + +ldapincdir=$ldapdir/include +AC_ARG_WITH(ldap-incdir, [ --with-ldap-incdir= path to ldap.h], + [ldapincdir=$withval]) + +ldaplibdir=$ldapdir/lib +AC_ARG_WITH(ldap-libdir, [ --with-ldap-libdir= path to ldap and lber libs], + [ldapincdir=$withval]) + +AC_ARG_WITH(ldap-libraries, [ --with-ldap-libflags= -l flags for ldap libraries], + [ldaplibflags="-L$ldaplibdir $withval"], + [ldaplibflags="-L$ldaplibdir -lldap -llber"]) + +ldapinclude="-I$ldapincdir" + +ldapbuild=yes + +AC_SUBST(ldaplibflags) +AC_SUBST(ldapinclude) +AC_SUBST(ldapbuild) +AC_SUBST(ldapdir) + + +VERSION=${NEO_VERSION} +# Note: in the following variable, it's important to use the absolute +# path name of the Tcl directory rather than "..": this is because +# AIX remembers this path and will attempt to use it at run-time to look +# up the Tcl library. + +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl${VERSION}" + NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl${VERSION}" +else + NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl`echo ${VERSION} | tr -d .`" + NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl`echo ${VERSION} | tr -d .`" +fi + +AC_SUBST(CC) +AC_SUBST(LIBS) +AC_SUBST(DL_LIBS) +AC_SUBST(LD_FLAGS) +AC_SUBST(MATH_LIBS) +AC_SUBST(MAKE_LIB) +AC_SUBST(SHLIB_CFLAGS) +AC_SUBST(SHLIB_LD) +AC_SUBST(SHLIB_LD_LIBS) +AC_SUBST(SHLIB_SUFFIX) +AC_SUBST(SHLIB_VERSION) +AC_SUBST(TCLX_TOP_DIR) +AC_SUBST(TCLX_TCL_DIR) +AC_SUBST(TCLX_LIB_SPEC) +AC_SUBST(ITCL_LIB_SPEC) +AC_SUBST(TCL_LIBS) +AC_SUBST(TCL_SRC_DIR) +AC_SUBST(TCL_BIN_DIR) +AC_SUBST(TCL_LIB_SPEC) +AC_SUBST(TCL_LD_SEARCH_FLAGS) +AC_SUBST(TCL_LIB_HNAME) +AC_SUBST(TCL_SRC_DIR) +AC_SUBST(TCL_VERSION) +AC_SUBST(NEO_BUILD_LIB_SPEC) +AC_SUBST(NEO_LD_SEARCH_FLAGS) +AC_SUBST(NEO_SHARED_LIB_FILE) +AC_SUBST(NEO_UNSHARED_LIB_FILE) +AC_SUBST(NEO_LIB_FILE) +AC_SUBST(NEO_LIB_SPEC) +AC_SUBST(NEO_MAJOR_VERSION) +AC_SUBST(NEO_MINOR_VERSION) +AC_SUBST(NEO_SHLIB_CFLAGS) +AC_SUBST(NEO_VERSION) +dnl AC_SUBST(XINCLUDES) +dnl AC_SUBST(XLIBSW) + +AC_OUTPUT(Makefile pkgIndex.tcl) diff --git a/contrib/ldaptcl/install-sh b/contrib/ldaptcl/install-sh new file mode 100755 index 0000000000..0ff4b6a08e --- /dev/null +++ b/contrib/ldaptcl/install-sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 diff --git a/contrib/ldaptcl/ldap.n b/contrib/ldaptcl/ldap.n new file mode 100644 index 0000000000..b117bee9d5 --- /dev/null +++ b/contrib/ldaptcl/ldap.n @@ -0,0 +1,365 @@ +'\" +'\" Copyright (c) 1998 NeoSoft, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.so man.macros +.TH ldap n "" Ldap "Ldap Tcl Extension" +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +ldap \- connect to and query an LDAP server +.SH SYNOPSIS +\fBldap \fBopen \fR \fIcommand\fR \fIhostlist\fR +.br +\fBldap \fBinit \fR \fIcommand\fR \fIhostlist\fR +.br +\fBldap \fBexplode ?-nonames|-list?\fR \fIdn\fR +.br +\fIcommand \fBsubcommand \fIoptions ...\fR +.BE + +.SH OVERVIEW +.PP +A new command by the name of \fIcommand\fR will be created to access +the LDAP database at \fIhostlist\fR. \fIhostlist\fR may contain elements +of the format \fBhost:port\fR if a port other than the default LDAP port +of 389 is required. The LDAP library will attempt to connect to each +host in turn until it succeeds. +.PP +The \fBexplode\fR form provides a means (via ldap_explode(3)) to explode a DN +into its component parts. \fB-nonames\fR strips off the attribute names, +and -list returns a list suitable for \fBarray set\fR. +.PP +Finally, the last form, described in more detail below, refers genericly +to how the command created by the first two examples is used. +.SH DESCRIPTION + +The Lightweight Directory Access Protocol provides TCP/IP access to +X.500 directory services and/or to a stand-alone LDAP server. + +This code provides a Tcl interface to the +Lightweight Directory Access Protocol package using the Netscape +Software Development Kit. It can also be used with the freely +redistributable University of +Michigan (http://www.umich.edu/~rsug/ldap) version by defining the +UMICH_LDAP macro during compilation. + +.SH CONNECTING TO AN LDAP SERVER + +To create an ldap interface entity, we use the "ldap" command. + + ldap open foo foo.bar.com + +This opens a connection to a LDAP server on foo.bar.com, and makes +a new Tcl command, foo, through which we will manipulate the interface +and make queries to the remote LDAP server. + + ldap init foo foo.bar.com + +Same as above, foo is created, but for "init", opening the connection is +deferred until we actually try to do something. + +For the purposes of this example, we're going to assume that "foo" is the +command created by opening a connection using "ldap open". + +Note: Karl is particularly dissatisfied with the syntax of this option, +so it is one of the most likely things to change in a subsequent release. + +.SH BINDING + +After a connection is made to an LDAP server, an LDAP bind operation must +be performed before other operations can be attempted over the connection. + +Both simple authentication and kerberos authentication are available. +LDAP version 3 supports many new "SSL"-style authentication and encryption +systems, which are not currently supported by the UMich server, and hence +by this interface package. + +Currently simple authentication, and kerberos-based authentication, are +supported. + +To use LDAP and still have reasonable security in a networked, +Internet/Intranet environment, secure shell can be used to setup +secure, encrypted connections between client machines and the LDAP +server, and between the LDAP server and any replica or slave servers +that might be used. + +To perform the LDAP "bind" operation: + + foo bind simple dn password + + foo bind kerberos_ldap + foo bind kerberos_dsa + foo bind kerberos_both + +It either returns nothing (success), or a Tcl error with appropriate error +text. + +For example, + + foo bind simple "cn=Manager,o=NeoSoft Inc,c=us" "secret" + +If you attempt to bind with one of the kerberos authentication types +described above and your LDAP library was not built with KERBEROS +defined, you will get an unknown auth type error. + +To unbind an LDAP connection previously bound with "bind": + + foo unbind + +Note that unbinding also deletes the command (\fBfoo\fR in this case). +Deleting the command has the same affect. + +The ability of the library to callback to the client, enabling re-binding +while following referrals, is not currently supported. + +.SH DELETING OBJECTS + +To delete an object in the LDAP database, use + + foo delete dn + +To rename an object to another relative distinguished name, use + + foo rename_rdn dn rdn + +To rename an object to another relative distinguished name, leaving +the old entry as some kind of attribute (FIX: not sure if this is +right or how it works) + + foo modify_rdn dn rdn + + +.SH ADDING NEW OBJECTS + + foo add dn attributePairList + +This creates a new distinguished name and defines zero or more attributes. + +"attributePairList" is a list of key-value pairs, the same as would +be returned by "array get" if an array had been set up containing the +key-value pairs. Note that, right now, the sort of lowest-level pair +of the DN must also appear in the attributePairList, as in: + + foo add "cn=karl, ou=People, o=NeoSoft Inc, c=US" {cn karl ...} + +Here is a more precise description of how an attributePairList looks: + + {cn {karl {Karl Lehenbauer}} telephone 713-968-5800} + +Note here that two cn values, "karl" and "Karl Lehenbauer", are added. +A command error is to write + + {cn {Karl Lehenbauer}} + +Which adds two cn values, "Karl" and "Lehenbauer", when the intention +was to give a single cn value of "Karl Lehenbauer". In real life, one +finds oneself making prodigous use of the \fBlist\fR command rather than +typing hard-coded lists. + +We have noticed that the Netscape server will automatically add the +left-most rdn portion of the DN (ie. cn=karl), whereas the University +of Michigan version does not. + +.SH ADDING, DELETING, AND REPLACING OBJECT ATTRIBUTES + +You can have multiple occurrences of the same attribute in a record. +These are represented in search results, through the Tcl interface, +as a list. + + foo add_attributes dn attributePairList + +This adds key-value pairs to an existing DN. If an attribute being +added already exists, the new value will be appended to the list. + + foo replace_attributes dn attributePairList + +This replaces specified key-value pairs in an existing DN, leaving +unnamed ones untouched. + + foo delete_attributes dn attributePairList + +This deletes attributes in the list. If a pair is "foo {bar snap}" and +you delete "foo bar", "foo" will still have "snap". + +If you provide an empty string ("") for the value part of the key-value +pair, the entire attribute will be deleted. To reiterate, if you provide +a non-empty string for the value part, only that value will be removed +from the value list. + +.SH SEARCHING + +The Tcl interface to searching takes a control array, which contains +a couple of mandatory key-value pairs, and can contain a number of +optional key-value pairs as well, for controlling the search, a +destination array, into which the specified attributes (or all attributes +of matching DNs if none are specified) and values are stored. + +The "code" part is executed repeatedly, once for each DN matching the +search criteria. + + foo search controlArray destArray code + + Using data in the control array, a search is performed of the + LDAP server opened when foo was created. Possible elements + of the control array are enumerated blow. + + controlArray(base) is the DN being searched from. (required) + + controlArray(filter) contains the search criteria. (required) + + controlArray(scope) must be "base", "one_level", or "subtree". + If not specified, scope defaults to "subtree". + + controlArray(deref) must be "never", "search", "find", or "always" + If not specified, deref defaults to "never" + + controlArray(attributes) is a list of attributes to be fetched. + If not specified, all attributes are fetched. + + For each matching record, destArray is populated with none, + some or all attribute-value pairs. + +Note: There are some additional parameters that can be set, such as +how long the synchronous version of the routines should wait before +timing out, the interfaces for which are not available in the current +version. + +.SH CACHING (Note: Netscape clients do not have caching interfaces). + +The UMich LDAP library offers the client application fairly fine- +grained control of caching of results retrieved from searches, +offering significant performance improvement and reduced +network traffic. + +By default, the cache is disabled. + +To enable caching of data received from an LDAP connection, + + foo cache enable timeout maxmem + + ...where timeout is specified in seconds, and maxmem is the + maximum memory to be used fo caching, in bytes. + + If maxmem is 0, the cache size is restricted only by the timeout. + + foo cache disable + + ...temporarily inhibits use of the cache (while disabled, new requests + are not cached and the cache is not checked when returning results). + + Disabling the cache does not delete its contents. + + foo cache destroy + + ...turns off caching and completely removes the cache from memory. + + foo cache flush + + ...deletes the entire cache contents, but does not affect + whether or not the cache is being used. + + foo cache uncache dn + + ...removes from the cache all request results that make reference + to the specified DN. + + This should be used, for example, after doing an add_attributes, + delete_attributes, or replace_attributes (ldap_modify(3)) + involving the requested DN. + + foo cache no_errors + + ...suppresses caching of any requests that result in an error. + + foo cache size_errors + + ...suppresses caching of any requests that result in an error, + except for requests resulting in "sizelimit exceeded", which + are cached. This is the default. + + foo cache all_errors + + ...enables caching of all requests, including those that result + in errors. + +.SH IMPLEMENTATION DECISIONS + +Because we used the new "Tcl object" C interfaces, this package only works +with Tcl 8.0 or above. + +This package interfaces with the University of Michigan LDAP protocol +package, version 3.3, an implementation of version 2 of the LDAP protocol. + +Although an LDAP client (or server) could be written in native Tcl 8.0, +as Tcl 8.0 and above can do binary I/O, and Tcl 8 and above have strings +that are fully eight-bit clean, for a first implementation, to minimize +compatibility problems, we created a C interface to the UMich LDAP library. + +A native Tcl implementation would be cool because we could bring the receiving +of messages into the normal Tcl event loop and run the LDAP interface fully +asynchronous. + +This implementation is blocking, and blocking only. That is to say that +the Tcl event loop is frozen while the ldap routines are waiting on data. + +This could be fixed either by recoding all of the I/O in the LDAP library +to use Tcl's I/O system instead, or by simply coding the LDAP interface in +native Tcl, as mentioned above. + +Another advantage of coding in high-level Tcl, of course, is that the +client would immediately be cross-platform to Windows and the Mac, as +well as Unix. + +Binary data is not currently supported. It will probably be trivial to +add, we just haven't dug into it yet. + + +.SH FOR MORE INFORMATION + +This document principally describes how to use our Tcl interface to the +LDAP library works. + +For more information on LDAP and the University of Michigan LDAP package, +please visit the website mentioned above. The package includes substantial +documentation in the form of UNIX manual pages, a SLAPD/SLURPD guide +in Adobe Portable Document Format (pdf), and a number of Internet RFCs +related to LDAP services. + +.SH AUTHORS +It was written by Karl Lehenbauer, of NeoSoft, Inc., in August and +September of 1997. Ldap explode, and numerous bug fixes by Randy +Kunkee, also of NeoSoft, Inc., in 1998. + +.SH KEYWORDS +element, join, list, separator +.SH BUGS +The \fBldap init\fR syntax fails to return anything useful. Use +\fBldap open\fR instead. + +\fBPackage require Ldaptcl\fR won't work unless the ldap and lber libraries +are also shared, and ldaptcl.so is itself created with the correct flags +(eg. -R for Solaris). In short there's a lot of details to make this part +work, but it should work out of the box for Solaris. Other systems may +require that LD_LIBRARY_PATH or other appropraite environment variables +be set at build and/or runtime. + +An asynchronous interface should be provided with callbacks. + +We have never tested Kerberos authentication. + +It does not tolerate some illegal operations very well. + +It is possible to create empty attributes, ie. attributes which are present +but have no value. This is done by deleting the attribute values rather +than, eg. "foo delete_attributes dn {telephone {}}" which would delete +the telephone attribute altogether. A search for presence of the attribute +may return an object, and yet it may have no value. This interface presents +such an object as not having the attribute at all (ie. you cannot tell). +The Netscape SDK does this for you, so this makes the behavior consistent +when using UMICH_LDAP. + +\--enable-netscape configuration support has not been tested and probably +has bugs. diff --git a/contrib/ldaptcl/man.macros b/contrib/ldaptcl/man.macros new file mode 100644 index 0000000000..3af2da9293 --- /dev/null +++ b/contrib/ldaptcl/man.macros @@ -0,0 +1,236 @@ +'\" The definitions below are for supplemental macros used in Tcl/Tk +'\" manual entries. +'\" +'\" .AP type name in/out ?indent? +'\" Start paragraph describing an argument to a library procedure. +'\" type is type of argument (int, etc.), in/out is either "in", "out", +'\" or "in/out" to describe whether procedure reads or modifies arg, +'\" and indent is equivalent to second arg of .IP (shouldn't ever be +'\" needed; use .AS below instead) +'\" +'\" .AS ?type? ?name? +'\" Give maximum sizes of arguments for setting tab stops. Type and +'\" name are examples of largest possible arguments that will be passed +'\" to .AP later. If args are omitted, default tab stops are used. +'\" +'\" .BS +'\" Start box enclosure. From here until next .BE, everything will be +'\" enclosed in one large box. +'\" +'\" .BE +'\" End of box enclosure. +'\" +'\" .CS +'\" Begin code excerpt. +'\" +'\" .CE +'\" End code excerpt. +'\" +'\" .VS ?version? ?br? +'\" Begin vertical sidebar, for use in marking newly-changed parts +'\" of man pages. The first argument is ignored and used for recording +'\" the version when the .VS was added, so that the sidebars can be +'\" found and removed when they reach a certain age. If another argument +'\" is present, then a line break is forced before starting the sidebar. +'\" +'\" .VE +'\" End of vertical sidebar. +'\" +'\" .DS +'\" Begin an indented unfilled display. +'\" +'\" .DE +'\" End of indented unfilled display. +'\" +'\" .SO +'\" Start of list of standard options for a Tk widget. The +'\" options follow on successive lines, in four columns separated +'\" by tabs. +'\" +'\" .SE +'\" End of list of standard options for a Tk widget. +'\" +'\" .OP cmdName dbName dbClass +'\" Start of description of a specific option. cmdName gives the +'\" option's name as specified in the class command, dbName gives +'\" the option's name in the option database, and dbClass gives +'\" the option's class in the option database. +'\" +'\" .UL arg1 arg2 +'\" Print arg1 underlined, then print arg2 normally. +'\" +'\" SCCS: @(#) man.macros 1.9 97/08/22 18:50:59 +'\" +'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. +.if t .wh -1.3i ^B +.nr ^l \n(.l +.ad b +'\" # Start an argument description +.de AP +.ie !"\\$4"" .TP \\$4 +.el \{\ +. ie !"\\$2"" .TP \\n()Cu +. el .TP 15 +.\} +.ie !"\\$3"" \{\ +.ta \\n()Au \\n()Bu +\&\\$1 \\fI\\$2\\fP (\\$3) +.\".b +.\} +.el \{\ +.br +.ie !"\\$2"" \{\ +\&\\$1 \\fI\\$2\\fP +.\} +.el \{\ +\&\\fI\\$1\\fP +.\} +.\} +.. +'\" # define tabbing values for .AP +.de AS +.nr )A 10n +.if !"\\$1"" .nr )A \\w'\\$1'u+3n +.nr )B \\n()Au+15n +.\" +.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n +.nr )C \\n()Bu+\\w'(in/out)'u+2n +.. +.AS Tcl_Interp Tcl_CreateInterp in/out +'\" # BS - start boxed text +'\" # ^y = starting y location +'\" # ^b = 1 +.de BS +.br +.mk ^y +.nr ^b 1u +.if n .nf +.if n .ti 0 +.if n \l'\\n(.lu\(ul' +.if n .fi +.. +'\" # BE - end boxed text (draw box now) +.de BE +.nf +.ti 0 +.mk ^t +.ie n \l'\\n(^lu\(ul' +.el \{\ +.\" Draw four-sided box normally, but don't draw top of +.\" box if the box started on an earlier page. +.ie !\\n(^b-1 \{\ +\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.el \}\ +\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.\} +.fi +.br +.nr ^b 0 +.. +'\" # VS - start vertical sidebar +'\" # ^Y = starting y location +'\" # ^v = 1 (for troff; for nroff this doesn't matter) +.de VS +.if !"\\$2"" .br +.mk ^Y +.ie n 'mc \s12\(br\s0 +.el .nr ^v 1u +.. +'\" # VE - end of vertical sidebar +.de VE +.ie n 'mc +.el \{\ +.ev 2 +.nf +.ti 0 +.mk ^t +\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' +.sp -1 +.fi +.ev +.\} +.nr ^v 0 +.. +'\" # Special macro to handle page bottom: finish off current +'\" # box/sidebar if in box/sidebar mode, then invoked standard +'\" # page bottom macro. +.de ^B +.ev 2 +'ti 0 +'nf +.mk ^t +.if \\n(^b \{\ +.\" Draw three-sided box if this is the box's first page, +.\" draw two sides but no top otherwise. +.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.\} +.if \\n(^v \{\ +.nr ^x \\n(^tu+1v-\\n(^Yu +\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c +.\} +.bp +'fi +.ev +.if \\n(^b \{\ +.mk ^y +.nr ^b 2 +.\} +.if \\n(^v \{\ +.mk ^Y +.\} +.. +'\" # DS - begin display +.de DS +.RS +.nf +.sp +.. +'\" # DE - end display +.de DE +.fi +.RE +.sp +.. +'\" # SO - start of list of standard options +.de SO +.SH "STANDARD OPTIONS" +.LP +.nf +.ta 4c 8c 12c +.ft B +.. +'\" # SE - end of list of standard options +.de SE +.fi +.ft R +.LP +See the \\fBoptions\\fR manual entry for details on the standard options. +.. +'\" # OP - start of full description for a single option +.de OP +.LP +.nf +.ta 4c +Command-Line Name: \\fB\\$1\\fR +Database Name: \\fB\\$2\\fR +Database Class: \\fB\\$3\\fR +.fi +.IP +.. +'\" # CS - begin code excerpt +.de CS +.RS +.nf +.ta .25i .5i .75i 1i +.. +'\" # CE - end code excerpt +.de CE +.fi +.RE +.. +.de UL +\\$1\l'|0\(ul'\\$2 +.. diff --git a/contrib/ldaptcl/neoXldap.c b/contrib/ldaptcl/neoXldap.c new file mode 100644 index 0000000000..e19fa9712f --- /dev/null +++ b/contrib/ldaptcl/neoXldap.c @@ -0,0 +1,1043 @@ +/* + * NeoSoft Tcl client extensions to Lightweight Directory Access Protocol. + * + * Copyright (c) 1998-1999 NeoSoft, Inc. + * All Rights Reserved. + * + * This software may be used, modified, copied, distributed, and sold, + * in both source and binary form provided that these copyrights are + * retained and their terms are followed. + * + * Under no circumstances are the authors or NeoSoft Inc. responsible + * for the proper functioning of this software, nor do the authors + * assume any liability for damages incurred with its use. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to NeoSoft, Inc. + * + * NeoSoft, Inc. 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. + * + * Requests for permission may be sent to NeoSoft Inc, 1770 St. James Place, + * Suite 500, Houston, TX, 77056. + * + * $Id: neoXldap.c,v 1.5 1999/02/05 18:45:14 kunkee Exp $ + * + */ + +/* + * This code was originally developed by Karl Lehenbauer to work with + * Umich-3.3 LDAP. It was debugged against the Netscape LDAP server + * and their much more reliable SDK, and again backported to the + * Umich-3.3 client code. The UMICH_LDAP define is used to include + * code that will work with the Umich-3.3 LDAP, but not with Netscape's + * SDK. OpenLDAP may support some of these, but they have not been tested. + * Current support is by Randy Kunkee. + */ + +#include "tclExtend.h" + +#include +#include +#include + +/* + * Macros to do string compares. They pre-check the first character before + * checking of the strings are equal. + */ + +#define STREQU(str1, str2) \ + (((str1) [0] == (str2) [0]) && (strcmp (str1, str2) == 0)) + +/* + * The following section defines some common macros used by the rest + * of the code. It's ugly, and can use some work. This code was + * originally developed to work with Umich-3.3 LDAP. It was debugged + * against the Netscape LDAP server and the much more reliable SDK, + * and then again backported to the Umich-3.3 client code. + */ + +#if defined(LDAP_API_VERSION) + /* LDAP_API_VERSION must be defined per the current draft spec + ** it's value will be assigned RFC number. However, as + ** no RFC is defined, it's value is currently implementation + ** specific (though I would hope it's value is greater than 1823). + ** In OpenLDAP 2.x-devel, its 2000 + the draft number, ie 2002. + ** This section is for OPENLDAP. + */ +#define ldap_attributefree(p) ldap_memfree(p) +#define LDAP_ERR_STRING(ld) \ + ldap_err2string(ldap_get_lderrno(ldap)) +#elif defined( LDAP_OPT_SIZELIMIT ) + /* + ** Netscape SDK w/ ldap_set_option, ldap_get_option + */ +#define ldap_attributefree(p) ldap_memfree(p) +#define LDAP_ERR_STRING(ld) \ + ldap_err2string(ldap_get_lderrno(ldap, (char**)NULL, (char**)NULL)) +#else + /* U-Mich/OpenLDAP 1.x API */ + /* RFC-1823 w/ changes */ +#define UMICH_LDAP +#define ldap_memfree(p) free(p) +#define ldap_ber_free(p, n) ber_free(p, n) +#define ldap_get_lderrno(ld, dummy1, dummy2) (ld->ld_errno) +#define ldap_value_free_len(bvals) ber_bvecfree(bvals) +#define ldap_attributefree(p) +#define LDAP_ERR_STRING(ld) \ + ldap_err2string(ldap_get_lderrno(ldap)) +#endif + +#if defined(LDAP_API_VERSION) +#ifdef LDAP_OPT_ERROR_NUMBER +static int ldap_get_lderrno(LDAP *ld) +{ + int ld_errno = 0; + ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, (void*)&ld_errno); + return ld_errno; +} +#endif +#endif + + + +/*----------------------------------------------------------------------------- + * LDAP_ProcessOneSearchResult -- + * + * Process one result return from an LDAP search. + * + * Paramaters: + * o interp - Tcl interpreter; Errors are returned in result. + * o ldap - LDAP structure pointer. + * o entry - LDAP message pointer. + * o destArrayNameObj - Name of Tcl array in which to store attributes. + * o evalCodeObj - Tcl_Obj pointer to code to eval against this result. + * Returns: + * o TCL_OK if processing succeeded.. + * o TCL_ERROR if an error occured, with error message in interp. + *----------------------------------------------------------------------------- + */ +static int +LDAP_ProcessOneSearchResult (interp, ldap, entry, destArrayNameObj, evalCodeObj) + Tcl_Interp *interp; + LDAP *ldap; + LDAPMessage *entry; + Tcl_Obj *destArrayNameObj; + Tcl_Obj *evalCodeObj; +{ + char *attributeName; + Tcl_Obj *attributeNameObj; + Tcl_Obj *attributeDataObj; + int i; + BerElement *ber; + struct berval **bvals; + char *dn; + + Tcl_UnsetVar (interp, Tcl_GetStringFromObj (destArrayNameObj, NULL), 0); + + dn = ldap_get_dn(ldap, entry); + if (dn != NULL) { + if (Tcl_SetVar2(interp, /* set dn */ + Tcl_GetStringFromObj(destArrayNameObj, NULL), + "dn", + dn, + TCL_LEAVE_ERR_MSG) == NULL) + return TCL_ERROR; + ldap_memfree(dn); + } + for (attributeName = ldap_first_attribute (ldap, entry, &ber); + attributeName != NULL; + attributeName = ldap_next_attribute(ldap, entry, ber)) { + + bvals = ldap_get_values_len(ldap, entry, attributeName); + + if (bvals != NULL) { + /* Note here that the U.of.M. ldap will return a null bvals + when the last attribute value has been deleted, but still + retains the attributeName. Even though this is documented + as an error, we ignore it to present a consistent interface + with Netscape's server + */ + attributeNameObj = Tcl_NewStringObj (attributeName, -1); + Tcl_IncrRefCount (attributeNameObj); + attributeDataObj = Tcl_NewObj(); + for (i = 0; bvals[i] != NULL; i++) { + Tcl_Obj *singleAttributeValueObj; + + singleAttributeValueObj = Tcl_NewStringObj (bvals[i]->bv_val, -1); + if (Tcl_ListObjAppendElement (interp, + attributeDataObj, + singleAttributeValueObj) + == TCL_ERROR) { + return TCL_ERROR; + } + } + + ldap_value_free_len(bvals); + + if (Tcl_ObjSetVar2 (interp, + destArrayNameObj, + attributeNameObj, + attributeDataObj, + TCL_LEAVE_ERR_MSG) == NULL) { + return TCL_ERROR; + } + Tcl_DecrRefCount (attributeNameObj); + } + ldap_attributefree(attributeName); + } + return Tcl_EvalObj (interp, evalCodeObj); +} + +/*----------------------------------------------------------------------------- + * LDAP_PerformSearch -- + * + * Perform an LDAP search. + * + * Paramaters: + * o interp - Tcl interpreter; Errors are returned in result. + * o ldap - LDAP structure pointer. + * o base - Base DN from which to perform search. + * o scope - LDAP search scope, must be one of LDAP_SCOPE_BASE, + * LDAP_SCOPE_ONELEVEL, or LDAP_SCOPE_SUBTREE. + * o attrs - Pointer to array of char * pointers of desired + * attribute names, or NULL for all attributes. + * o filtpatt LDAP filter pattern. + * o value Value to get sprintf'ed into filter pattern. + * o destArrayNameObj - Name of Tcl array in which to store attributes. + * o evalCodeObj - Tcl_Obj pointer to code to eval against this result. + * Returns: + * o TCL_OK if processing succeeded.. + * o TCL_ERROR if an error occured, with error message in interp. + *----------------------------------------------------------------------------- + */ +static int +LDAP_PerformSearch (interp, ldap, base, scope, attrs, filtpatt, value, destArrayNameObj, evalCodeObj) + Tcl_Interp *interp; + LDAP *ldap; + char *base; + int scope; + char **attrs; + char *filtpatt; + char *value; + Tcl_Obj *destArrayNameObj; + Tcl_Obj *evalCodeObj; +{ + char filter[BUFSIZ]; + int resultCode; + int errorCode; + int abandon; + int tclResult = TCL_OK; + int msgid; + LDAPMessage *resultMessage; + LDAPMessage *entryMessage; + + Tcl_Obj *resultObj; + int lderr; + + resultObj = Tcl_GetObjResult (interp); + + sprintf(filter, filtpatt, value); + + if ((msgid = ldap_search (ldap, base, scope, filter, attrs, 0)) == -1) { + Tcl_AppendStringsToObj (resultObj, + "LDAP start search error: ", + LDAP_ERR_STRING(ldap), + (char *)NULL); + return TCL_ERROR; + } + + abandon = 0; + while ((resultCode = ldap_result (ldap, + msgid, + 0, + NULL, + &resultMessage)) == LDAP_RES_SEARCH_ENTRY) { + + entryMessage = ldap_first_entry(ldap, resultMessage); + + tclResult = LDAP_ProcessOneSearchResult (interp, + ldap, + entryMessage, + destArrayNameObj, + evalCodeObj); + ldap_msgfree(resultMessage); + if (tclResult != TCL_OK) { + if (tclResult == TCL_CONTINUE) { + tclResult = TCL_OK; + } else if (tclResult == TCL_BREAK) { + tclResult = TCL_OK; + abandon = 1; + break; + } else if (tclResult == TCL_ERROR) { + char msg[100]; + sprintf(msg, "\n (\"search\" body line %d)", + interp->errorLine); + Tcl_AddObjErrorInfo(interp, msg, -1); + abandon = 1; + break; + } else { + abandon = 1; + break; + } + } + } + + if (abandon) { + ldap_abandon(ldap, msgid); + } else { + if (resultCode == LDAP_RES_SEARCH_RESULT) { + if ((errorCode = ldap_result2error (ldap, resultMessage, 0)) + != LDAP_SUCCESS) { + Tcl_AppendStringsToObj (resultObj, + "LDAP search error: ", + ldap_err2string(errorCode), + (char *)NULL); + ldap_msgfree(resultMessage); + return TCL_ERROR; + } + } + + + if (resultCode == -1) { + Tcl_AppendStringsToObj (resultObj, + "LDAP result search error: ", + LDAP_ERR_STRING(ldap), + (char *)NULL); + return TCL_ERROR; + } else + ldap_msgfree(resultMessage); + } + + return tclResult; +} + +/*----------------------------------------------------------------------------- + * NeoX_LdapTargetObjCmd -- + * + * Implements the body of commands created by Neo_LdapObjCmd. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + *----------------------------------------------------------------------------- + */ +static int +NeoX_LdapTargetObjCmd (clientData, interp, objc, objv) + ClientData clientData; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + char *command; + char *subCommand; + LDAP *ldap = (LDAP *)clientData; + char *dn; + int is_add = 0; + int is_add_or_modify = 0; + int mod_op = 0; + char *m, *s, *errmsg; + int errcode; + + Tcl_Obj *resultObj = Tcl_GetObjResult (interp); + + if (objc < 2) + return TclX_WrongArgs (interp, + objv [0], + "subcommand [args...]"); + + command = Tcl_GetStringFromObj (objv[0], NULL); + subCommand = Tcl_GetStringFromObj (objv[1], NULL); + + /* object bind authtype name password */ + if (STREQU (subCommand, "bind")) { + char *binddn; + char *passwd; + int stringLength; + char *ldap_authString; + int ldap_authInt; + + if (objc != 5) + return TclX_WrongArgs (interp, objv [0], "bind authtype dn passwd"); + + ldap_authString = Tcl_GetStringFromObj (objv[2], NULL); + + if (STREQU (ldap_authString, "simple")) { + ldap_authInt = LDAP_AUTH_SIMPLE; + } +#ifdef UMICH_LDAP + else if (STREQU (ldap_authString, "kerberos_ldap")) { + ldap_authInt = LDAP_AUTH_KRBV41; + } else if (STREQU (ldap_authString, "kerberos_dsa")) { + ldap_authInt = LDAP_AUTH_KRBV42; + } else if (STREQU (ldap_authString, "kerberos_both")) { + ldap_authInt = LDAP_AUTH_KRBV4; + } +#endif + else { + Tcl_AppendStringsToObj (resultObj, + "\"", + command, + " ", + subCommand, +#ifdef UMICH_LDAP + "\" authtype must be one of \"simple\", ", + "\"kerberos_ldap\", \"kerberos_dsa\" ", + "or \"kerberos_both\"", +#else + "\" authtype must be \"simple\", ", +#endif + (char *)NULL); + return TCL_ERROR; + } + + binddn = Tcl_GetStringFromObj (objv[3], &stringLength); + if (stringLength == 0) + binddn = NULL; + + passwd = Tcl_GetStringFromObj (objv[4], &stringLength); + if (stringLength == 0) + passwd = NULL; + +/* ldap_bind_s(ldap, dn, pw, method) */ + +#ifdef UMICH_LDAP +#define LDAP_BIND(ldap, dn, pw, method) \ + ldap_bind_s(ldap, dn, pw, method) +#else +#define LDAP_BIND(ldap, dn, pw, method) \ + ldap_simple_bind_s(ldap, dn, pw) +#endif + if ((errcode = LDAP_BIND (ldap, + binddn, + passwd, + ldap_authInt)) != LDAP_SUCCESS) { + + Tcl_AppendStringsToObj (resultObj, + "LDAP bind error: ", + ldap_err2string(errcode), + (char *)NULL); + return TCL_ERROR; + } + return TCL_OK; + } + + if (STREQU (subCommand, "unbind")) { + if (objc != 2) + return TclX_WrongArgs (interp, objv [0], "unbind"); + + return Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], NULL)); + } + + /* object delete dn */ + if (STREQU (subCommand, "delete")) { + if (objc != 3) + return TclX_WrongArgs (interp, objv [0], "delete dn"); + + dn = Tcl_GetStringFromObj (objv [2], NULL); + if ((errcode = ldap_delete_s(ldap, dn)) != LDAP_SUCCESS) { + Tcl_AppendStringsToObj (resultObj, + "LDAP delete error: ", + ldap_err2string(errcode), + (char *)NULL); + return TCL_ERROR; + } + return TCL_OK; + } + + /* object rename_rdn dn rdn */ + /* object modify_rdn dn rdn */ + if (STREQU (subCommand, "rename_rdn") || STREQU (subCommand, "modify_rdn")) { + char *rdn; + int deleteOldRdn; + + if (objc != 4) + return TclX_WrongArgs (interp, + objv [0], + "delete_rdn|modify_rdn dn rdn"); + + dn = Tcl_GetStringFromObj (objv [2], NULL); + rdn = Tcl_GetStringFromObj (objv [3], NULL); + + deleteOldRdn = (*subCommand == 'r'); + + if ((errcode = ldap_modrdn2_s (ldap, dn, rdn, deleteOldRdn)) != LDAP_SUCCESS) { + Tcl_AppendStringsToObj (resultObj, + "LDAP ", + subCommand, + " error: ", + ldap_err2string(errcode), + (char *)NULL); + return TCL_ERROR; + } + return TCL_OK; + } + + /* object add dn attributePairList */ + /* object add_attributes dn attributePairList */ + /* object replace_attributes dn attributePairList */ + /* object delete_attributes dn attributePairList */ + + if (STREQU (subCommand, "add")) { + is_add = 1; + is_add_or_modify = 1; + } else { + is_add = 0; + if (STREQU (subCommand, "add_attributes")) { + is_add_or_modify = 1; + mod_op = LDAP_MOD_ADD; + } else if (STREQU (subCommand, "replace_attributes")) { + is_add_or_modify = 1; + mod_op = LDAP_MOD_REPLACE; + } else if (STREQU (subCommand, "delete_attributes")) { + is_add_or_modify = 1; + mod_op = LDAP_MOD_DELETE; + } + } + + if (is_add_or_modify) { + int result; + LDAPMod **modArray; + LDAPMod *mod; + char **valPtrs = NULL; + int attribObjc; + Tcl_Obj **attribObjv; + int valuesObjc; + Tcl_Obj **valuesObjv; + int nPairs; + int i; + int j; + + Tcl_Obj *resultObj = Tcl_GetObjResult (interp); + + if (objc != 4) { + Tcl_AppendStringsToObj (resultObj, + "wrong # args: ", + Tcl_GetStringFromObj (objv [0], NULL), + " ", + subCommand, + " dn attributePairList", + (char *)NULL); + return TCL_ERROR; + } + + dn = Tcl_GetStringFromObj (objv [2], NULL); + + if (Tcl_ListObjGetElements (interp, objv [3], &attribObjc, &attribObjv) + == TCL_ERROR) { + return TCL_ERROR; + } + + if (attribObjc & 1) { + Tcl_AppendStringsToObj (resultObj, + "attribute list does not contain an ", + "even number of key-value elements", + (char *)NULL); + return TCL_ERROR; + } + + nPairs = attribObjc / 2; + + modArray = (LDAPMod **)ckalloc (sizeof(LDAPMod *) * (nPairs + 1)); + modArray[nPairs] = (LDAPMod *) NULL; + + for (i = 0; i < nPairs; i++) { + mod = modArray[i] = (LDAPMod *) ckalloc (sizeof(LDAPMod)); + mod->mod_op = mod_op; + mod->mod_type = Tcl_GetStringFromObj (attribObjv [i * 2], NULL); + + if (Tcl_ListObjGetElements (interp, attribObjv [i * 2 + 1], &valuesObjc, &valuesObjv) == TCL_ERROR) { + /* FIX: cleanup memory here */ + return TCL_ERROR; + } + + valPtrs = mod->mod_vals.modv_strvals = \ + (char **)ckalloc (sizeof (char *) * (valuesObjc + 1)); + valPtrs[valuesObjc] = (char *)NULL; + + for (j = 0; j < valuesObjc; j++) { + valPtrs [j] = Tcl_GetStringFromObj (valuesObjv[j], NULL); + + /* If it's "delete" and value is an empty string, make + * value be NULL to indicate entire attribute is to be + * deleted */ + if ((*valPtrs [j] == '\0') + && (mod->mod_op == LDAP_MOD_DELETE)) { + valPtrs [j] = NULL; + } + } + } + + if (is_add) { + result = ldap_add_s (ldap, dn, modArray); + } else { + result = ldap_modify_s (ldap, dn, modArray); + } + + /* free the modArray elements, then the modArray itself. */ + for (i = 0; i < nPairs; i++) { + ckfree ((char *) modArray[i]->mod_vals.modv_strvals); + ckfree ((char *) modArray[i]); + } + ckfree ((char *) modArray); + + /* FIX: memory cleanup required all over the place here */ + if (result != LDAP_SUCCESS) { + Tcl_AppendStringsToObj (resultObj, + "LDAP ", + subCommand, + " error: ", + ldap_err2string(result), + (char *)NULL); + return TCL_ERROR; + } + return TCL_OK; + } + + /* object search controlArray dn pattern */ + if (STREQU (subCommand, "search")) { + char *controlArrayName; + Tcl_Obj *controlArrayNameObj; + + char *scopeString; + int scope; + + char *derefString; + int deref; + + char *baseString; + + char **attributesArray; + char *attributesString; + int attributesArgc; + + char *filterPatternString; + + Tcl_Obj *destArrayNameObj; + Tcl_Obj *evalCodeObj; + + if (objc != 5) + return TclX_WrongArgs (interp, + objv [0], + "search controlArray destArray code"); + + controlArrayNameObj = objv [2]; + controlArrayName = Tcl_GetStringFromObj (controlArrayNameObj, NULL); + + destArrayNameObj = objv [3]; + + evalCodeObj = objv [4]; + + baseString = Tcl_GetVar2 (interp, + controlArrayName, + "base", + 0); + + if (baseString == (char *)NULL) { + Tcl_AppendStringsToObj (resultObj, + "required element \"base\" ", + "is missing from ldap control array \"", + controlArrayName, + "\"", + (char *)NULL); + return TCL_ERROR; + } + + filterPatternString = Tcl_GetVar2 (interp, + controlArrayName, + "filter", + 0); + if (filterPatternString == (char *)NULL) { + Tcl_AppendStringsToObj (resultObj, + "required element \"filter\" ", + "is missing from ldap control array \"", + controlArrayName, + "\"", + (char *)NULL); + + return TCL_ERROR; + } + + /* Fetch scope setting from control array. + * If it doesn't exist, default to subtree scoping. + */ + scopeString = Tcl_GetVar2 (interp, controlArrayName, "scope", 0); + if (scopeString == NULL) { + scope = LDAP_SCOPE_SUBTREE; + } else { + if (STREQU(scopeString, "base")) + scope = LDAP_SCOPE_BASE; + else if (STREQU(scopeString, "onelevel")) + scope = LDAP_SCOPE_ONELEVEL; + else if (STREQU(scopeString, "subtree")) + scope = LDAP_SCOPE_SUBTREE; + else { + Tcl_AppendStringsToObj (resultObj, + "\"scope\" element of \"", + controlArrayName, + "\" array is not one of ", + "\"base\", \"one_level\", ", + "or \"subtree\"", + (char *) NULL); + return TCL_ERROR; + } + } + + /* Fetch dereference control setting from control array. + * If it doesn't exist, default to never dereference. */ + derefString = Tcl_GetVar2 (interp, + controlArrayName, + "deref", + 0); + + if (derefString == (char *)NULL) { + deref = LDAP_DEREF_NEVER; + } else { + if (STREQU(derefString, "never")) + deref = LDAP_DEREF_NEVER; + else if (STREQU(derefString, "search")) + deref = LDAP_DEREF_SEARCHING; + else if (STREQU(derefString, "find") == 0) + deref = LDAP_DEREF_FINDING; + else if (STREQU(derefString, "always")) + deref = LDAP_DEREF_ALWAYS; + else { + Tcl_AppendStringsToObj (resultObj, + "\"deref\" element of \"", + controlArrayName, + "\" array is not one of ", + "\"never\", \"search\", \"find\", ", + "or \"always\"", + (char *) NULL); + return TCL_ERROR; + } + } + + /* Fetch list of attribute names from control array. + * If entry doesn't exist, default to NULL (all). + */ + attributesString = Tcl_GetVar2 (interp, + controlArrayName, + "attributes", + 0); + if (attributesString == (char *)NULL) { + attributesArray = NULL; + } else { + if ((Tcl_SplitList (interp, + attributesString, + &attributesArgc, + &attributesArray)) != TCL_OK) { + return TCL_ERROR; + } + } + +#ifdef UMICH_LDAP + ldap->ld_deref = deref; + ldap->ld_timelimit = 0; + ldap->ld_sizelimit = 0; + ldap->ld_options = 0; +#endif + + return LDAP_PerformSearch (interp, + ldap, + baseString, + scope, + attributesArray, + filterPatternString, + "", + destArrayNameObj, + evalCodeObj); + } + +#if UMICH_LDAP + if (STREQU (subCommand, "cache")) { + char *cacheCommand; + + if (objc < 3) + badargs: + return TclX_WrongArgs (interp, + objv [0], + "cache command [args...]"); + + cacheCommand = Tcl_GetStringFromObj (objv [2], NULL); + + if (STREQU (cacheCommand, "uncache")) { + char *dn; + + if (objc != 4) + return TclX_WrongArgs (interp, + objv [0], + "cache uncache dn"); + + dn = Tcl_GetStringFromObj (objv [3], NULL); + ldap_uncache_entry (ldap, dn); + return TCL_OK; + } + + if (STREQU (cacheCommand, "enable")) { + long timeout; + long maxmem; + + if (objc != 5) + return TclX_WrongArgs (interp, + objv [0], + "cache enable timeout maxmem"); + + if (Tcl_GetLongFromObj (interp, objv [3], &timeout) == TCL_ERROR) + return TCL_ERROR; + + if (Tcl_GetLongFromObj (interp, objv [4], &maxmem) == TCL_ERROR) + return TCL_ERROR; + + if (ldap_enable_cache (ldap, timeout, maxmem) == -1) { + Tcl_AppendStringsToObj (resultObj, + "LDAP cache enable error: ", + LDAP_ERR_STRING(ldap), + (char *)NULL); + return TCL_ERROR; + } + return TCL_OK; + } + + if (objc != 3) goto badargs; + + if (STREQU (cacheCommand, "disable")) { + ldap_disable_cache (ldap); + return TCL_OK; + } + + if (STREQU (cacheCommand, "destroy")) { + ldap_destroy_cache (ldap); + return TCL_OK; + } + + if (STREQU (cacheCommand, "flush")) { + ldap_flush_cache (ldap); + return TCL_OK; + } + + if (STREQU (cacheCommand, "no_errors")) { + ldap_set_cache_options (ldap, LDAP_CACHE_OPT_CACHENOERRS); + return TCL_OK; + } + + if (STREQU (cacheCommand, "all_errors")) { + ldap_set_cache_options (ldap, LDAP_CACHE_OPT_CACHEALLERRS); + return TCL_OK; + } + + if (STREQU (cacheCommand, "size_errors")) { + ldap_set_cache_options (ldap, 0); + return TCL_OK; + } + Tcl_AppendStringsToObj (resultObj, + "\"", + command, + " ", + subCommand, + "\" subcommand", + " must be one of \"enable\", ", + "\"disable\", ", + "\"destroy\", \"flush\", \"uncache\", ", + "\"no_errors\", \"size_errors\",", + " or \"all_errors\"", + (char *)NULL); + return TCL_ERROR; + } +#endif +#ifdef LDAP_DEBUG + if (STREQU (subCommand, "debug")) { + if (objc != 3) { + Tcl_AppendStringsToObj(resultObj, "Wrong # of arguments", + (char*)NULL); + return TCL_ERROR; + } + return Tcl_GetIntFromObj(interp, objv[2], &ldap_debug); + } +#endif + + /* FIX: this needs to enumerate all the possibilities */ + Tcl_AppendStringsToObj (resultObj, + "subcommand \"", + subCommand, + "\" must be one of \"add\", ", + "\"add_attributes\", ", + "\"bind\", \"cache\", \"delete\", ", + "\"delete_attributes\", \"modify\", ", + "\"modify_rdn\", \"rename_rdn\", ", + "\"replace_attributes\", ", + "\"search\" or \"unbind\".", + (char *)NULL); + return TCL_ERROR; +} + +/* + * Delete and LDAP command object + * + */ +static void +NeoX_LdapObjDeleteCmd(clientData) + ClientData clientData; +{ + LDAP *ldap = (LDAP *)clientData; + + ldap_unbind(ldap); +} + +/*----------------------------------------------------------------------------- + * NeoX_LdapObjCmd -- + * + * Implements the `ldap' command: + * ldap open newObjName host [port] + * ldap init newObjName host [port] + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + *----------------------------------------------------------------------------- + */ +static int +NeoX_LdapObjCmd (clientData, interp, objc, objv) + ClientData clientData; + Tcl_Interp *interp; + int objc; + Tcl_Obj *CONST objv[]; +{ + extern int errno; + char *subCommand; + char *newCommand; + char *ldapHost; + int ldapPort = 389; + LDAP *ldap; + + Tcl_Obj *resultObj = Tcl_GetObjResult (interp); + + if (objc < 3 || objc > 5) + return TclX_WrongArgs (interp, objv [0], + "(open|init) new_command host [port]|explode dn"); + + subCommand = Tcl_GetStringFromObj (objv[1], NULL); + + if (STREQU(subCommand, "explode")) { + char *param; + int nonames = 0; + int list = 0; + char **exploded, **p; + + param = Tcl_GetStringFromObj (objv[2], NULL); + if (param[0] == '-') { + if (STREQU(param, "-nonames")) { + nonames = 1; + } else if (STREQU(param, "-list")) { + list = 1; + } else { + return TclX_WrongArgs (interp, objv [0], "explode ?-nonames|-list? dn"); + } + } + if (nonames || list) + param = Tcl_GetStringFromObj (objv[3], NULL); + exploded = ldap_explode_dn(param, nonames); + for (p = exploded; *p; p++) { + if (list) { + char *q = strchr(*p, '='); + if (!q) { + Tcl_SetObjLength(resultObj, 0); + Tcl_AppendStringsToObj(resultObj, "rdn ", *p, + " missing '='", NULL); + ldap_value_free(exploded); + return TCL_ERROR; + } + *q = '\0'; + if (Tcl_ListObjAppendElement(interp, resultObj, + Tcl_NewStringObj(*p, -1)) != TCL_OK || + Tcl_ListObjAppendElement(interp, resultObj, + Tcl_NewStringObj(q+1, -1)) != TCL_OK) { + ldap_value_free(exploded); + return TCL_ERROR; + } + } else { + if (Tcl_ListObjAppendElement(interp, resultObj, + Tcl_NewStringObj(*p, -1))) { + ldap_value_free(exploded); + return TCL_ERROR; + } + } + } + ldap_value_free(exploded); + return TCL_OK; + } + +#ifdef UMICH_LDAP + if (STREQU(subCommand, "friendly")) { + char *friendly = ldap_dn2ufn(Tcl_GetStringFromObj(objv[2], NULL)); + Tcl_SetStringObj(resultObj, friendly, -1); + free(friendly); + return TCL_OK; + } +#endif + + newCommand = Tcl_GetStringFromObj (objv[2], NULL); + ldapHost = Tcl_GetStringFromObj (objv[3], NULL); + + if (objc == 5) { + if (Tcl_GetIntFromObj (interp, objv [4], &ldapPort) == TCL_ERROR) { + Tcl_AppendStringsToObj (resultObj, + "LDAP port number is non-numeric", + (char *)NULL); + return TCL_ERROR; + } + } + + if (STREQU (subCommand, "open")) { + ldap = ldap_open (ldapHost, ldapPort); + } else if (STREQU (subCommand, "init")) { + ldap = ldap_init (ldapHost, ldapPort); + } else { + Tcl_AppendStringsToObj (resultObj, + "option was not \"open\" or \"init\""); + return TCL_ERROR; + } + + if (ldap == (LDAP *)NULL) { + Tcl_SetErrno(errno); + Tcl_AppendStringsToObj (resultObj, + Tcl_PosixError (interp), + (char *)NULL); + return TCL_ERROR; + } + +#if UMICH_LDAP + ldap->ld_deref = LDAP_DEREF_NEVER; /* Turn off alias dereferencing */ +#endif + + Tcl_CreateObjCommand (interp, + newCommand, + NeoX_LdapTargetObjCmd, + (ClientData) ldap, + NeoX_LdapObjDeleteCmd); + return TCL_OK; +} + +/*----------------------------------------------------------------------------- + * Neo_initLDAP -- + * Initialize the LDAP interface. + *----------------------------------------------------------------------------- + */ +int +Ldaptcl_Init (interp) +Tcl_Interp *interp; +{ + Tcl_CreateObjCommand (interp, + "ldap", + NeoX_LdapObjCmd, + (ClientData) NULL, + (Tcl_CmdDeleteProc*) NULL); + Tcl_PkgProvide(interp, "Ldaptcl", "1.1"); + return TCL_OK; +} diff --git a/contrib/ldaptcl/pkgIndex.tcl.in b/contrib/ldaptcl/pkgIndex.tcl.in new file mode 100644 index 0000000000..8f67e31ef0 --- /dev/null +++ b/contrib/ldaptcl/pkgIndex.tcl.in @@ -0,0 +1 @@ +package ifneeded Neo @NEO_VERSION@ "package require Tclx 8.0; load [file join $dir .. @NEO_SHARED_LIB_FILE@] Ldaptcl" diff --git a/contrib/ldaptcl/tclAppInit.c b/contrib/ldaptcl/tclAppInit.c new file mode 100644 index 0000000000..f84e1826f2 --- /dev/null +++ b/contrib/ldaptcl/tclAppInit.c @@ -0,0 +1,140 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and Tcl_AppInit + * procedure for Tcl applications (without Tk). + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1995 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclAppInit.c 1.17 96/03/26 12:45:29 + */ + +#include "tcl.h" + +/* + * The following variable is a special hack that is needed in order for + * Sun shared libraries to be used for Tcl. + */ + +extern int matherr(); +int *tclDummyMathPtr = (int *) matherr; + +#ifdef TCL_TEST +EXTERN int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#endif /* TCL_TEST */ + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never + * returns either. + * + * Side effects: + * Whatever the application does. + * + *---------------------------------------------------------------------- + */ + +int +main(argc, argv) + int argc; /* Number of command-line arguments. */ + char **argv; /* Values of command-line arguments. */ +{ +#ifdef USE_TCLX + TclX_Main(argc, argv, Tcl_AppInit); +#else + Tcl_Main(argc, argv, Tcl_AppInit); +#endif + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + +#ifdef USE_ITCL + if (Itcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage (interp, "Itcl", Itcl_Init, NULL); +#endif + +#ifdef TCL_TEST + if (Tcltest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, + (Tcl_PackageInitProc *) NULL); +#endif /* TCL_TEST */ + +#ifdef USE_TCLX + if (Tclx_Init (interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage (interp, "Tclx", Tclx_Init, NULL); +#endif + + if (Ldaptcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Ldaptcl", Ldaptcl_Init, + (Tcl_PackageInitProc *) NULL); + + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + */ + + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + + Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); + return TCL_OK; +} diff --git a/contrib/ldaptcl/tkAppInit.c b/contrib/ldaptcl/tkAppInit.c new file mode 100644 index 0000000000..6782228812 --- /dev/null +++ b/contrib/ldaptcl/tkAppInit.c @@ -0,0 +1,119 @@ +/* + * tkXAppInit.c -- + * + * Provides a default version of the Tcl_AppInit procedure for use with + * applications built with Extended Tcl and Tk on Unix systems. This is based + * on the the UCB Tk file tkAppInit.c + *----------------------------------------------------------------------------- + * Copyright 1991-1996 Karl Lehenbauer and Mark Diekhans. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies. Karl Lehenbauer and + * Mark Diekhans make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + *----------------------------------------------------------------------------- + * $Id: tkAppInit.c,v 1.1 1997/10/20 09:10:29 kunkee Exp $ + *----------------------------------------------------------------------------- + */ + +#include "tclExtend.h" +#include "tk.h" + +/* + * The following variable is a special hack that insures the tcl + * version of matherr() is used when linking against shared libraries + * Even if matherr is not used on this system, there is a dummy version + * in libtcl. + */ +EXTERN int matherr (); +int (*tclDummyMathPtr)() = matherr; + + +/*----------------------------------------------------------------------------- + * main -- + * + * This is the main program for the application. + *----------------------------------------------------------------------------- + */ +#ifdef __cplusplus +int +main (int argc, + char **argv) +#else +int +main (argc, argv) + int argc; + char **argv; +#endif +{ +#ifdef USE_TCLX + TkX_Main(argc, argv, Tcl_AppInit); +#else + Tk_Main(argc, argv, Tcl_AppInit); +#endif + return 0; /* Needed only to prevent compiler warning. */ +} + +/*----------------------------------------------------------------------------- + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. Most + * applications, especially those that incorporate additional packages, will + * have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error message in + * interp->result if an error occurs. + *----------------------------------------------------------------------------- + */ +#ifdef __cplusplus +int +Tcl_AppInit (Tcl_Interp *interp) +#else +int +Tcl_AppInit (interp) + Tcl_Interp *interp; +#endif +{ + if (Tcl_Init (interp) == TCL_ERROR) { + return TCL_ERROR; + } +#ifdef USE_TCLX + if (Tclx_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tclx", Tclx_Init, Tclx_SafeInit); +#endif + if (Tk_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL); +#ifdef USE_TCLX + if (Tkx_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tkx", Tkx_Init, (Tcl_PackageInitProc *) NULL); +#endif + + if (Ldaptcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Ldaptcl", Ldaptcl_Init, + (Tcl_PackageInitProc *) NULL); + + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishxrc", TCL_GLOBAL_ONLY); + return TCL_OK; +}