## Makefile Template for Shared Libraries
##
-NT_LTFLAGS = --only-$(LINKAGE)
-LTFLAGS = $(@PLAT@_LTFLAGS)
-
-NT_DYN_LT_NO_UNDEF = -no-undefined
-LT_NO_UNDEF = $(@PLAT@_@LIB_LINKAGE@_LT_NO_UNDEF)
-
-COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(EXTRA_DEFS) -c
-LTLIBLINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) -rpath $(libdir) \
- $(CFLAGS) $(LDFLAGS) $(LTVERSION) $(LT_NO_UNDEF)
-
MKDEPFLAG = -l
.SUFFIXES: .c .o .lo
.c.lo:
- $(COMPILE) $<
-
-
-# DYN_EXT (@DYN_EXT@) describes the extension assoicated with a
-# dynamic library, e.g. so, dll
-
-DYN_EXT=@DYN_EXT@
-
-$(LIBRARY): version.lo
- $(LTLIBLINK) -o $@ $(OBJS) version.lo $(EXTRA_LIBS)
- $(RM) ../$@
- d=`$(PWD)`; d=`$(BASENAME) $$d`; cd ..; $(LN_S) $$d/$@ $@; \
- t=`$(BASENAME) $@ .la`.a; $(RM) $$t; $(LN_S) $$d/.libs/$$t $$t
- if test "$(LINK_BINS_DYNAMIC)" = "yes"; then \
- d=`$(PWD)`; d=`$(BASENAME) $$d`; b=`$(BASENAME) $@ .la`; \
- cd .libs; t=`echo $$b*.$(DYN_EXT)`; (cd ../.. ; $(RM) $$t; \
- $(LN_S) $$d/.libs/$$t $$t); \
- if test "$(DYN_EXT)" != dll; then \
- t=`echo $$b.$(DYN_EXT).?`; cd ../.. ; \
- $(RM) $$t; \
- $(LN_S) $$d/.libs/$$t $$t; \
- fi \
- fi
+ $(LTCOMPILE_LIB) $<
+
+#
+# symlinks for libraries: UNIX and Windows (a.k.a. NT) need to be handled
+# differently. In UNIX, the static and shared libraries, as well as shared
+# library symlinks, can all be symlinked in the 'libraries' directory. In
+# Windows, only the static library (.a file) or the shared library (.dll)
+# file should be present. The current mingw linker (i.e. ld) WILL look
+# for a .dll file at link time and internally generate an import library
+# for it. However, ld will not do this if a static library is present.
+# That doesn't seem very correct, but that's the behavior, like it or not.
+#
+# Note that there doesn't seem to be a true need for the .la file at
+# this level, so it is left out.
+#
+# The set of symlinks are determined by examining the library's .la file.
+#
+$(LIBRARY): version.lo
+ $(LTLINK_LIB) -o $@ $(OBJS) version.lo $(LINK_LIBS)
+ @d=`$(PWD)`; b=`$(BASENAME) $$d`; \
+ echo cd ..; \
+ cd ..; \
+ arlib=`grep '^old_library=' $$b/$@`; \
+ arlib=`expr "$$arlib" : "[^']*'\(.*\)'"`; \
+ libs=$$arlib; \
+ if test "$(BUILD_LIBS_DYNAMIC)" = "shared"; then \
+ shlibs=`grep '^library_names' $$b/$@`; \
+ shlibs=`expr "$$shlibs" : "[^']*'\(.*\)'"`; \
+ libs="$$libs $$shlibs"; \
+ fi; \
+ for i in $$libs; do \
+ echo $(RM) $$i; \
+ $(RM) $$i; \
+ echo $(LN_S) $$b/.libs/$$i $$i; \
+ $(LN_S) $$b/.libs/$$i $$i; \
+ done
Makefile: $(top_srcdir)/build/lib-shared.mk
lint5: lint5-local FORCE
$(5LINT) $(DEFS) $(DEFINES) $(SRCS)
+#
+# In the mingw/cygwin environment, the so and dll files must be
+# deleted separately, instead of using the {.so*,*.dll} construct
+# that was previously used. It just didn't work.
+#
clean-common: FORCE
$(RM) $(LIBRARY) ../$(LIBRARY) $(XLIBRARY) \
$(PROGRAMS) $(XPROGRAMS) $(XSRCS) $(XXSRCS) \
*.o *.lo a.out *.exe core version.c .libs/* \
- ../`$(BASENAME) $(LIBRARY) .la`{.a,.so*,*.dll}
+ ../`$(BASENAME) $(LIBRARY) .la`.so* \
+ ../`$(BASENAME) $(LIBRARY) .la`*.dll
depend-common: FORCE
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS) $(XXSRCS)
lint5-local: FORCE
Makefile: $(top_srcdir)/build/lib.mk
+
LIBRARY = $(LIBBASE).la
LIBSTAT = lib$(LIBBASE).a
-LTFLAGS = --only-$(LINKAGE)
-
-COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(MODDEFS) -c
-LTLIBLINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) -rpath $(moduledir) \
- $(CFLAGS) $(LDFLAGS) $(LTVERSION) $(LT_NO_UNDEF)
-
MKDEPFLAG = -l
.SUFFIXES: .c .o .lo
.c.lo:
- $(COMPILE) $<
+ $(LTCOMPILE_MOD) $<
all-no lint-no 5lint-no depend-no install-no: FORCE
@echo "run configure with $(BUILD_OPT) to make $(LIBBASE)"
$(RM) $@
$(MKVERSION) $(LIBBASE) > $@
-$(LIBRARY): $(MODDEPS) version.lo
- $(LTLIBLINK) -module -o $@ $(OBJS) version.lo \
- $(MODLIBS)
+$(LIBRARY): version.lo
+ $(LTLINK_MOD) -module -o $@ $(OBJS) version.lo $(LINK_LIBS)
$(LIBSTAT): version.lo
$(AR) ruv $@ `echo $(OBJS) | sed 's/\.lo/.o/g'` version.o
if test $ac_cv_func__beginthread = yes ; then
AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
+ ol_cv_nt_threads=yes
fi
])
dnl ====================================================================
sysconfdir = @sysconfdir@$(ldap_subdir)
schemadir = $(sysconfdir)/schema
+PLAT = @PLAT@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
+BUILD_LIBS_DYNAMIC = @BUILD_LIBS_DYNAMIC@
+
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LIBTOOL = @LIBTOOL@
LIBVERSION = @OPENLDAP_LIBVERSION@
LTVERSION = -version-info $(LIBVERSION)
-#We don't use our own shared libraries (yet)
-#LTLINK = $(LIBTOOL) --mode=link $(CC) -rpath $(libdir) \
-# $(CFLAGS) $(LDFLAGS)
-LTLINK = $(LIBTOOL) --mode=link $(CC) \
- $(CFLAGS) $(LDFLAGS)
+
+# libtool --only flag for libraries: platform specific
+NT_LTONLY_LIB = --only-$(BUILD_LIBS_DYNAMIC)
+LTONLY_LIB = $(@PLAT@_LTONLY_LIB)
+
+# libtool --only flag for modules: depends on linkage of module
+# The BUILD_MOD_DYNAMIC macro is defined in each backend Makefile.in file
+LTONLY_MOD = --only-$(BUILD_MOD_DYNAMIC)
+
+# platform-specific libtool flags
+NT_LTFLAGS_LIB = -no-undefined -avoid-version -rpath $(libdir)
+NT_LTFLAGS_MOD = -no-undefined -avoid-version -rpath $(moduledir)
+UNIX_LTFLAGS_LIB = $(LTVERSION) -rpath $(libdir)
+UNIX_LTFLAGS_MOD = $(LTVERSION) -rpath $(moduledir)
+
+# libtool flags
+LTFLAGS = $(@PLAT@_LTFLAGS)
+LTFLAGS_LIB = $(@PLAT@_LTFLAGS_LIB)
+LTFLAGS_MOD = $(@PLAT@_LTFLAGS_MOD)
+
+# LIB_DEFS defined in liblber and libldap Makefile.in files.
+# MOD_DEFS defined in backend Makefile.in files.
+
+# platform-specific LINK_LIBS defined in various Makefile.in files.
+# LINK_LIBS referenced in library and module link commands.
+LINK_LIBS = $(@PLAT@_LINK_LIBS)
+
+LTLINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LTFLAGS)
+
+LTCOMPILE_LIB = $(LIBTOOL) $(LTONLY_LIB) --mode=compile \
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LIB_DEFS) -c
+
+LTLINK_LIB = $(LIBTOOL) $(LTONLY_LIB) --mode=link \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LTFLAGS_LIB)
+
+LTCOMPILE_MOD = $(LIBTOOL) $(LTONLY_MOD) --mode=compile \
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(MOD_DEFS) -c
+
+LTLINK_MOD = $(LIBTOOL) $(LTONLY_MOD) --mode=link \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LTFLAGS_MOD)
+
LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
# Misc UNIX commands used in build environment
MODULES_LIBS = @MODULES_LIBS@
TERMCAP_LIBS = @TERMCAP_LIBS@
SLAPD_PERL_LDFLAGS = @SLAPD_PERL_LDFLAGS@
-LINK_BINS_DYNAMIC = @LINK_BINS_DYNAMIC@
SLAPD_SQL_LDFLAGS = @SLAPD_SQL_LDFLAGS@
SLAPD_SQL_INCLUDES = @SLAPD_SQL_INCLUDES@
# Our Defaults
CC = $(AC_CC)
DEFS = $(LDAP_INCPATH) $(XINCPATH) $(XDEFS) $(AC_DEFS) $(DEFINES)
-CFLAGS = $(AC_CFLAGS) $(DEFS)
+CFLAGS = $(AC_CFLAGS)
+CPPFLAGS = $(DEFS)
LDFLAGS = $(LDAP_LIBPATH) $(AC_LDFLAGS) $(XLDFLAGS)
LIBS = $(XLIBS) $(XXLIBS) $(AC_LIBS) $(XXXLIBS)
##
## Clients Makefile.in for OpenLDAP
-SUBDIRS= tools ud
+SUBDIRS = tools ud
+CLEANDIRS = finger mail500 maildap
+
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
-
XLIBS = -llutil -lldif -lldap -llber
XXLIBS = $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
OBJS= main.o find.o mod.o print.o auth.o util.o help.o \
group.o globals.o edit.o
HDRS= ud.h
-PROGRAMS= ud
+
+UNIX_PRGS = ud
+PROGRAMS = $(@PLAT@_PRGS)
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
-
XLIBS = -llutil -lldif -lldap -llber
-XXLIBS = $(TERMCAP_LIBS) $(SECURITY_LIBS) $(LUTIL_LIBS)
+XXLIBS = $(TERMCAP_LIBS) $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
ud : version.o
$(LTLINK) -o $@ version.o $(OBJS) $(LIBS)
termios.h \
unistd.h \
winsock.h \
+ winsock2.h \
)
dnl HP-UX requires -lV3
AC_CHECK_LIB(V3, sigset)
-dnl Gotta check for winsock manually
-if test $ac_cv_header_winsock_h = yes; then
- AC_CACHE_CHECK([for winsock], [ol_cv_winsock],
- AC_TRY_LINK([#include <winsock.h>],[
- socket(0,0,0);
- select(0,NULL,NULL,NULL,NULL);
- closesocket(0);
- gethostname(NULL,0);
- ],[ol_cv_winsock=yes],[ol_cv_winsock=no]))
-
- if test $ol_cv_winsock = yes ; then
- AC_DEFINE(HAVE_WINSOCK,1,[define if you have winsock])
+dnl The following is INTENTIONALLY scripted out because shell does not
+dnl support variable names with the '@' character, which is what
+dnl autoconf would try to generate if one merely used AC_SEARCH_LIBS
+AC_MSG_CHECKING(for winsock)
+save_LIBS="$LIBS"
+for curlib in ws2_32 wsock32; do
+ LIBS="$LIBS -l$curlib"
+ AC_TRY_LINK([
+ char socket@12();
+ char select@20();
+ char closesocket@4();
+ char gethostname@8();
+ ],
+ [
+ socket@12();
+ select@20();
+ closesocket@4();
+ gethostname@8();
+ ],
+ have_winsock=yes, have_winsock=no)
+
+ if test $have_winsock = yes; then
+ AC_DEFINE(HAVE_WINSOCK, 1, [define if you have winsock])
ac_cv_func_socket=yes
ac_cv_func_select=yes
ac_cv_func_closesocket=yes
ac_cv_func_gethostname=yes
+ if test $curlib = ws2_32; then
+ have_winsock=winsock2
+ AC_DEFINE(HAVE_WINSOCK2, 1,
+ [define if you have winsock2])
+ fi
+ break
fi
-fi
+ LIBS="$save_LIBS"
+done
+AC_MSG_RESULT($have_winsock)
dnl Find socket()
dnl Likely combinations:
if test "$ac_cv_header_regex_h" != yes ; then
AC_MSG_ERROR([POSIX regex.h required.])
fi
-AC_CHECK_FUNC(regfree, :, AC_MSG_ERROR([POSIX regex required.]))
+AC_SEARCH_LIBS(regfree, [regex gnuregex],
+ :, AC_MSG_ERROR([POSIX regex required.]))
OL_POSIX_REGEX
if test "$ol_cv_c_posix_regex" = no ; then
dnl ----------------------------------------------------------------
if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then
- LINK_BINS_DYNAMIC="yes"
+ BUILD_LIBS_DYNAMIC=shared
+ AC_DEFINE(LDAP_LIBS_DYNAMIC, 1, [define if LDAP libs are dynamic])
else
- LINK_BINS_DYNAMIC="no"
+ BUILD_LIBS_DYNAMIC=static
fi
dnl ----------------------------------------------------------------
dnl ----------------------------------------------------------------
dnl Check for entropy sources
-if test $cross_compiling != yes ; then
+if test $cross_compiling != yes -a $ac_cv_mingw32 != yes ; then
dev=no
if test -r /dev/urandom ; then
dev="/dev/urandom";
dnl ----------------------------------------------------------------
-if test "$LINK_BINS_DYNAMIC" = yes; then
- LIB_LINKAGE=DYN
- LT_LIB_LINKAGE=shared
-else
- LIB_LINKAGE=STAT
- LT_LIB_LINKAGE=static
-fi
+dnl
+dnl For Windows build, we don't want to include -dlopen flags.
+dnl They hurt more than they help.
+dnl
if test "$ac_cv_mingw32" = yes ; then
PLAT=NT
- DYN_EXT=dll
+ SLAPD_MODULES_LDFLAGS=
+ SLAPD_MODULES_LIST=
else
PLAT=UNIX
- DYN_EXT=so
fi
AC_SUBST(LIBSRCS)
-
AC_SUBST(PLAT)
-AC_SUBST(LIB_LINKAGE)
-AC_SUBST(LT_LIB_LINKAGE)
-AC_SUBST(DYN_EXT)
+AC_SUBST(BUILD_LIBS_DYNAMIC)
AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_BDB)
AC_SUBST(LUTIL_LIBS)
AC_SUBST(WRAP_LIBS)
AC_SUBST(MOD_TCL_LIB)
-AC_SUBST(LINK_BINS_DYNAMIC)
AC_SUBST(SLAPD_MODULES_CPPFLAGS)
AC_SUBST(SLAPD_MODULES_LDFLAGS)
@$(RM) $@
@echo "Making $@"
@echo "/* Generated from $(LDAP_CONFIG) on `date` */" > $@; \
+ if test $(PLAT) = NT; then \
+ sysconfdir=`cygpath -w $(sysconfdir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ datadir=`cygpath -w $(datadir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ bindir=`cygpath -w $(bindir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ sbindir=`cygpath -w $(sbindir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ libexecdir=`cygpath -w $(libexecdir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ localstatedir=`cygpath -w $(localstatedir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ editor=`cygpath -w $(EDITOR) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ finger=`cygpath -w $(FINGER) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ sendmail=`cygpath -w $(SENDMAIL) | \
+ $(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
+ else \
+ sysconfdir=$(sysconfdir); \
+ datadir=$(datadir); \
+ bindir=$(bindir); \
+ sbindir=$(sbindir); \
+ libexecdir=$(libexecdir); \
+ localstatedir=$(localstatedir); \
+ editor=$(EDITOR); \
+ finger=$(FINGER); \
+ sendmail=$(SENDMAIL); \
+ fi; \
$(SED) \
- -e 's;%SYSCONFDIR%;$(sysconfdir);' \
- -e 's;%DATADIR%;$(datadir);' \
- -e 's;%BINDIR%;$(bindir);' \
- -e 's;%SBINDIR%;$(sbindir);' \
- -e 's;%LIBEXECDIR%;$(libexecdir);' \
- -e 's;%RUNDIR%;$(localstatedir);' \
- -e 's;%EDITOR%;$(EDITOR);' \
- -e 's;%FINGER%;$(FINGER);' \
- -e 's;%SENDMAIL%;$(SENDMAIL);' \
+ -e "s;%SYSCONFDIR%;$$sysconfdir;" \
+ -e "s;%DATADIR%;$$datadir;" \
+ -e "s;%BINDIR%;$$bindir;" \
+ -e "s;%SBINDIR%;$$sbindir;" \
+ -e "s;%LIBEXECDIR%;$$libexecdir;" \
+ -e "s;%RUNDIR%;$$localstatedir;" \
+ -e "s;%EDITOR%;$$editor;" \
+ -e "s;%FINGER%;$$finger;" \
+ -e "s;%SENDMAIL%;$$sendmail;" \
$(LDAP_CONFIG) >> $@; \
$(CHMOD) 444 $@
clean-common: clean-local
veryclean-common: veryclean-local
depend-common: depend-local
+
/* strdup() is missing, declare our own version */
# undef strdup
# define strdup(s) ber_strdup(s)
-#else
+#elif !defined(_WIN32)
/* some systems fail to declare strdup */
+ /* Windows does not require this declaration */
LDAP_LIBC_F(char *) (strdup)();
#endif
int opt,
void *arg ));
-LBER_F( Sockbuf_IO ) ber_sockbuf_io_tcp;
-LBER_F( Sockbuf_IO ) ber_sockbuf_io_readahead;
-LBER_F( Sockbuf_IO ) ber_sockbuf_io_fd;
-LBER_F( Sockbuf_IO ) ber_sockbuf_io_debug;
+LBER_V( Sockbuf_IO ) ber_sockbuf_io_tcp;
+LBER_V( Sockbuf_IO ) ber_sockbuf_io_readahead;
+LBER_V( Sockbuf_IO ) ber_sockbuf_io_fd;
+LBER_V( Sockbuf_IO ) ber_sockbuf_io_debug;
#ifdef LDAP_CONNECTIONLESS
-LBER_F( Sockbuf_IO ) ber_sockbuf_io_udp;
+LBER_V( Sockbuf_IO ) ber_sockbuf_io_udp;
#endif
/*
/*
* bprint.c
*/
-LBER_F( BER_LOG_PRINT_FN ) ber_pvt_log_print;
+LBER_V( BER_LOG_PRINT_FN ) ber_pvt_log_print;
LBER_F( int )
ber_pvt_log_printf LDAP_P((
# define LDAP_GCCATTR(attrs)
#endif
-
-/* Support for NT dynamic libraries. */
+/*
+ * Support for Windows DLLs.
+ *
+ * When external source code includes header files for dynamic libraries,
+ * the external source code is "importing" DLL symbols into its resulting
+ * object code. On Windows, symbols imported from DLLs must be explicitly
+ * indicated in header files with the __declspec(dllimport) directive.
+ * This is not totally necessary for functions because the compiler
+ * (gcc or MSVC) will generate stubs when this directive is absent.
+ * However, this is required for imported variables.
+ *
+ * The LDAP libraries, i.e. liblber and libldap, can be built as
+ * static or shared, based on configuration. Just about all other source
+ * code in OpenLDAP use these libraries. If the LDAP libraries
+ * are configured as shared, 'configure' defines the LDAP_LIBS_DYNAMIC
+ * macro. When other source files include LDAP library headers, the
+ * LDAP library symbols will automatically be marked as imported. When
+ * the actual LDAP libraries are being built, the symbols will not
+ * be marked as imported because the LBER_LIBRARY or LDAP_LIBRARY macros
+ * will be respectively defined.
+ *
+ * Any project outside of OpenLDAP with source code wanting to use
+ * LDAP dynamic libraries should explicitly define LDAP_LIBS_DYNAMIC.
+ * This will ensure that external source code appropriately marks symbols
+ * that will be imported.
+ *
+ * The slapd executable, itself, can be used as a dynamic library.
+ * For example, if a backend module is compiled as shared, it will
+ * import symbols from slapd. When this happens, the slapd symbols
+ * must be marked as imported in header files that the backend module
+ * includes. Remember that slapd links with various static libraries.
+ * If the LDAP libraries were configured as static, their object
+ * code is also part of the monolithic slapd executable. Thus, when
+ * a backend module imports symbols from slapd, it imports symbols from
+ * all of the static libraries in slapd as well. Thus, the SLAP_IMPORT
+ * macro, when defined, will appropriately mark symbols as imported.
+ * This macro should be used by shared backend modules as well as any
+ * other external source code that imports symbols from the slapd
+ * executable as if it were a DLL.
+ *
+ * Note that we don't actually have to worry about using the
+ * __declspec(dllexport) directive anywhere. This is because both
+ * MSVC and Mingw provide alternate (more effective) methods for exporting
+ * symbols out of binaries, i.e. the use of a DEF file.
+ *
+ * NOTE ABOUT BACKENDS: Backends can be configured as static or dynamic.
+ * When a backend is configured as dynamic, slapd will load the backend
+ * explicitly and populate function pointer structures by calling
+ * the backend's well-known initialization function. Because of this
+ * procedure, slapd never implicitly imports symbols from dynamic backends.
+ * This makes it unnecessary to tag various backend functions with the
+ * __declspec(dllimport) directive. This is because neither slapd nor
+ * any other external binary should ever be implicitly loading a backend
+ * dynamic module.
+ *
+ * Backends are supposed to be self-contained. However, it appears that
+ * back-meta DOES implicitly import symbols from back-ldap. This means
+ * that the __declspec(dllimport) directive should be marked on back-ldap
+ * functions (in its header files) if and only if we're compiling for
+ * windows AND back-ldap has been configured as dynamic AND back-meta
+ * is the client of back-ldap. When client is slapd, there is no effect
+ * since slapd does not implicitly import symbols.
+ *
+ * TODO(?): Currently, back-meta nor back-ldap is supported for Mingw32.
+ * Thus, there's no need to worry about this right now. This is something that
+ * may or may not have to be addressed in the future.
+ */
/* LBER library */
-#if defined(LBER_DECL) && defined(_WIN32)
-# define LBER_F(type) extern __declspec(LBER_DECL) type
-# define LBER_V(type) extern __declspec(LBER_DECL) type
+#if defined(_WIN32) && \
+ ((defined(LDAP_LIBS_DYNAMIC) && !defined(LBER_LIBRARY)) || \
+ (!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
+# define LBER_F(type) extern __declspec(dllimport) type
+# define LBER_V(type) extern __declspec(dllimport) type
#else
# define LBER_F(type) extern type
# define LBER_V(type) extern type
#endif
/* LDAP library */
-#if defined(LDAP_DECL) && defined(_WIN32)
-# define LDAP_F(type) extern __declspec(LDAP_DECL) type
-# define LDAP_V(type) extern __declspec(LDAP_DECL) type
+#if defined(_WIN32) && \
+ ((defined(LDAP_LIBS_DYNAMIC) && !defined(LDAP_LIBRARY)) || \
+ (!defined(LDAP_LIBS_DYNAMIC) && defined(SLAPD_IMPORT)))
+# define LDAP_F(type) extern __declspec(dllimport) type
+# define LDAP_V(type) extern __declspec(dllimport) type
#else
# define LDAP_F(type) extern type
# define LDAP_V(type) extern type
#endif
-/*
- * C library. Mingw32 links with the C run-time library by default,
- * so the explicit definition of CSTATIC will keep dllimport from
- * being defined.
- */
-#if (defined(__MINGW32__) && !defined(CSTATIC) || \
- defined(_WIN32) && defined(_DLL))
-# define LDAP_LIBC_F(type) extern __declspec(dllimport) type
-# define LDAP_LIBC_V(type) extern __declspec(dllimport) type
-#else
-# define LDAP_LIBC_F(type) extern type
-# define LDAP_LIBC_V(type) extern type
-#endif
-
/* AVL library */
-#if defined(LDAP_AVL_DECL) && defined(_WIN32)
-# define LDAP_AVL_F(type) extern __declspec(LDAP_AVL_DECL) type
-# define LDAP_AVL_V(type) extern __declspec(LDAP_AVL_DECL) type
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_AVL_F(type) extern __declspec(dllimport) type
+# define LDAP_AVL_V(type) extern __declspec(dllimport) type
#else
-# define LDAP_AVL_F(type) extern type
-# define LDAP_AVL_V(type) extern type
+# define LDAP_AVL_F(type) extern type
+# define LDAP_AVL_V(type) extern type
#endif
/* LDBM library */
-#if defined(LDAP_LDBM_DECL) && defined(_WIN32)
-# define LDAP_LDBM_F(type) extern __declspec(LDAP_LDBM_DECL) type
-# define LDAP_LDBM_V(type) extern __declspec(LDAP_LDBM_DECL) type
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_LDBM_F(type) extern __declspec(dllimport) type
+# define LDAP_LDBM_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LDBM_F(type) extern type
# define LDAP_LDBM_V(type) extern type
#endif
/* LDIF library */
-#if defined(LDAP_LDIF_DECL) && defined(_WIN32)
-# define LDAP_LDIF_F(type) extern __declspec(LDAP_LDIF_DECL) type
-# define LDAP_LDIF_V(type) extern __declspec(LDAP_LDIF_DECL) type
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_LDIF_F(type) extern __declspec(dllimport) type
+# define LDAP_LDIF_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LDIF_F(type) extern type
# define LDAP_LDIF_V(type) extern type
#endif
/* LUNICODE library */
-#if defined(LDAP_LUNICODE_DECL) && defined(_WIN32)
-# define LDAP_LUNICODE_F(type) extern __declspec(LDAP_LUNICODE_DECL) type
-# define LDAP_LUNICODE_V(type) extern __declspec(LDAP_LUNICODE_DECL) type
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_LUNICODE_F(type) extern __declspec(dllimport) type
+# define LDAP_LUNICODE_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LUNICODE_F(type) extern type
# define LDAP_LUNICODE_V(type) extern type
#endif
/* LUTIL library */
-#if defined(LDAP_LUTIL_DECL) && defined(_WIN32)
-# define LDAP_LUTIL_F(type) extern __declspec(LDAP_LUTIL_DECL) type
-# define LDAP_LUTIL_V(type) extern __declspec(LDAP_LUTIL_DECL) type
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_LUTIL_F(type) extern __declspec(dllimport) type
+# define LDAP_LUTIL_V(type) extern __declspec(dllimport) type
#else
# define LDAP_LUTIL_F(type) extern type
# define LDAP_LUTIL_V(type) extern type
#endif
-/* SLAPD (as a module exporting symbols) */
-#if defined(LDAP_SLAPD_DECL) && defined(_WIN32)
-# define LDAP_SLAPD_F(type) extern __declspec(LDAP_SLAPD_DECL) type
-# define LDAP_SLAPD_V(type) extern __declspec(LDAP_SLAPD_DECL) type
+/* REWRITE library */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_REWRITE_F(type) extern __declspec(dllimport) type
+# define LDAP_REWRITE_V(type) extern __declspec(dllimport) type
+#else
+# define LDAP_REWRITE_F(type) extern type
+# define LDAP_REWRITE_V(type) extern type
+#endif
+
+/* SLAPD (as a dynamic library exporting symbols) */
+#if defined(_WIN32) && defined(SLAPD_IMPORT)
+# define LDAP_SLAPD_F(type) extern __declspec(dllimport) type
+# define LDAP_SLAPD_V(type) extern __declspec(dllimport) type
#else
# define LDAP_SLAPD_F(type) extern type
# define LDAP_SLAPD_V(type) extern type
#endif
+/*
+ * C library. Mingw32 links with the dynamic C run-time library by default,
+ * so the explicit definition of CSTATIC will keep dllimport from
+ * being defined, if desired.
+ *
+ * MSVC defines the _DLL macro when the compiler is invoked with /MD or /MDd,
+ * which means the resulting object code will be linked with the dynamic
+ * C run-time library.
+ *
+ * Technically, it shouldn't be necessary to redefine any functions that
+ * the headers for the C library should already contain. Nevertheless, this
+ * is here as a safe-guard.
+ *
+ * TODO: Determine if these macros ever get expanded for Windows. If not,
+ * the declspec expansion can probably be removed.
+ */
+#if (defined(__MINGW32__) && !defined(CSTATIC)) || \
+ (defined(_MSC_VER) && defined(_DLL))
+# define LDAP_LIBC_F(type) extern __declspec(dllimport) type
+# define LDAP_LIBC_V(type) extern __declspec(dllimport) type
+#else
+# define LDAP_LIBC_F(type) extern type
+# define LDAP_LIBC_V(type) extern type
+#endif
+
#endif /* _LDAP_CDEFS_H */
#if defined( SLAPD_SPASSWD ) && defined( HAVE_CYRUS_SASL )
/* cheat to avoid pulling in <sasl.h> */
-LDAP_LUTIL_F( struct sasl_conn * ) lutil_passwd_sasl_conn;
+LDAP_LUTIL_V( struct sasl_conn * ) lutil_passwd_sasl_conn;
#endif
LDAP_LUTIL_F( int )
LDAP_LUTIL_F( int )
lutil_pair( ber_socket_t sd[2] );
+/*
+ * Sometimes not all declarations in a header file are needed.
+ * An indicator to this is whether or not the symbol's type has
+ * been defined. Thus, we don't need to include a symbol if
+ * its type has not been defined through another header file.
+ */
+
+#ifdef HAVE_NT_SERVICE_MANAGER
+LDAP_LUTIL_V (int) is_NT_Service;
+
+#ifdef _LDAP_PVT_THREAD_H
+LDAP_LUTIL_V (ldap_pvt_thread_cond_t) started_event;
+#endif /* _LDAP_PVT_THREAD_H */
+
+#ifdef _WINSVC_H
+LDAP_LUTIL_V (SERVICE_STATUS) SLAPDServiceStatus;
+LDAP_LUTIL_V (SERVICE_STATUS_HANDLE) hSLAPDServiceStatus;
+#endif /* _WINSVC_H */
+
+#endif /* HAVE_NT_SERVICE_MANAGER */
+
LDAP_END_DECL
#endif /* _LUTIL_H */
/*
* Inits the info
*/
-extern struct rewrite_info *
+LDAP_REWRITE_F (struct rewrite_info *)
rewrite_info_init(
int mode
);
/*
* Cleans up the info structure
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_info_delete(
struct rewrite_info *info
);
* rewriteMap mapType mapName [mapArgs]
* rewriteParam paramName paramValue
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_parse(
struct rewrite_info *info,
const char *fname,
* - ok with copy of string as result,
* - use the default rewrite context.
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite(
struct rewrite_info *info,
const char *rewriteContext,
/*
* Same as above; the cookie relates the rewrite to a session
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session(
struct rewrite_info *info,
const char *rewriteContext,
/*
* Inits a session
*/
-extern struct rewrite_session *
+LDAP_REWRITE_F (struct rewrite_session *)
rewrite_session_init(
struct rewrite_info *info,
const void *cookie
/*
* Defines and inits a variable with session scope
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_var_set(
struct rewrite_info *info,
const void *cookie,
/*
* Deletes a session
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_delete(
struct rewrite_info *info,
const void *cookie
/*
* Defines and inits a variable with global scope
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_param_set(
struct rewrite_info *info,
const char *name,
/*
* Gets a var with global scope
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_param_get(
struct rewrite_info *info,
const char *name,
/*
* Destroys the parameter tree
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_param_destroy(
struct rewrite_info *info
);
#ifdef CSRIMALLOC
#define ber_memalloc malloc
#define ber_memrealloc realloc
+#else
+#include "lber.h"
#endif
#define AVL_INTERNAL
NT_SRCS = nt_err.c
NT_OBJS = nt_err.lo
+LIB_DEFS = -DLBER_LIBRARY
+
SRCS= assert.c decode.c encode.c io.c bprint.c \
memory.c options.c sockbuf.c $(@PLAT@_SRCS)
OBJS= assert.lo decode.lo encode.lo io.lo bprint.lo \
XLIBS = -llber
XXLIBS =
-
-LINKAGE = @LT_LIB_LINKAGE@
-
-NT_DYN_TEST_DEFS = -DLBER_DECL=dllimport
-
-# Extras for building the library
-EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-EXTRA_LIBS =
-
-# Only the test programs will pick up these defs.
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+NT_LINK_LIBS = $(AC_LIBS)
dtest: $(LIBRARY) dtest.o
$(LTLINK) -o $@ dtest.o $(LIBS)
LDAP_BEGIN_DECL
-LBER_F (BER_ERRNO_FN) ber_int_errno_fn;
+LBER_V (BER_ERRNO_FN) ber_int_errno_fn;
struct lber_options {
short lbo_valid;
#define LBER_VALID_BERELEMENT 0x2
#define LBER_VALID_SOCKBUF 0x3
-LBER_F (struct lber_options) ber_int_options;
+LBER_V (struct lber_options) ber_int_options;
#define ber_int_debug ber_int_options.lbo_debug
struct berelement {
/*
* io.c
*/
-int ber_realloc LDAP_P((
+LBER_F( int )
+ber_realloc LDAP_P((
BerElement *ber,
ber_len_t len ));
/* memory.c */
/* simple macros to realloc for now */
-LBER_F (BerMemoryFunctions *) ber_int_memory_fns;
+LBER_V (BerMemoryFunctions *) ber_int_memory_fns;
LBER_F (char *) ber_strndup( LDAP_CONST char *, ber_len_t );
LBER_F (char *) ber_strndup__( LDAP_CONST char *, size_t );
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-XLIBS = -lldap -llber -llutil
-XXLIBS = $(SECURITY_LIBS) $(TLS_LIBS)
-
-LINKAGE = @LT_LIB_LINKAGE@
-
-NT_DYN_LIB_LIBS = -llber -llutil $(AC_LIBS)
-NT_DYN_LIB_DEFS = -DLBER_DECL=dllimport
-NT_DYN_TEST_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-
-NT_XXLIBS = $(SECURITY_LIBS)
+LIB_DEFS = -DLDAP_LIBRARY
-UNIX_DYN_LIB_LIBS = -llber $(AC_LIBS)
-UNIX_XXLIBS = $(SECURITY_LIBS)
-
-# Extras for building the library
-EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-EXTRA_LIBS = $(@PLAT@_@LIB_LINKAGE@_LIB_LIBS) $(@PLAT@_XXLIBS)
-
-# Only the test programs will pick up these defs.
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+XLIBS = -lldap -llber -llutil
+XXLIBS = $(SECURITY_LIBS) $(LUTIL_LIBS)
+NT_LINK_LIBS = -llber $(AC_LIBS) $(SECURITY_LIBS)
apitest: $(LIBRARY) apitest.o $(LDAP_LIBLBER_DEPEND)
$(LTLINK) -o $@ apitest.o $(LIBS)
/*
* in error.c
*/
-void ldap_int_error_init( void );
+LDAP_F (void) ldap_int_error_init( void );
/*
* in unit-int.c
/*
* in os-ip.c
*/
-LDAP_F (int) ldap_int_tblsize;
+LDAP_V (int) ldap_int_tblsize;
LDAP_F (int) ldap_int_timeval_dup( struct timeval **dest, const struct timeval *tm );
LDAP_F (int) ldap_connect_to_host( LDAP *ld, Sockbuf *sb,
int proto, const char *host, unsigned long address, int port,
return -1;
}
-LDAP_F(int) ldap_pvt_url_scheme2tls( const char *scheme )
+int
+ldap_pvt_url_scheme2tls( const char *scheme )
{
assert( scheme );
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
+LIB_DEFS = -DLDAP_LIBRARY
+
XDEFS = -DLDAP_R_COMPILE -I$(XXDIR)
XLIBS = -lldap_r -llber -llutil
XXLIBS = $(SECURITY_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS)
-
-LINKAGE = @LT_LIB_LINKAGE@
-
-NT_DYN_LIB_LIBS = -llber -llutil $(AC_LIBS)
-NT_DYN_LIB_DEFS = -DLBER_DECL=dllimport
-NT_DYN_TEST_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-
-NT_XXLIBS = $(SECURITY_LIBS)
-
-UNIX_DYN_LIB_LIBS = -llber $(AC_LIBS)
-UNIX_XXLIBS = $(SECURITY_LIBS)
-
-# Extras for building the library
-EXTRA_DEFS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-EXTRA_LIBS = $(@PLAT@_@LIB_LINKAGE@_LIB_LIBS) $(@PLAT@_XXLIBS)
-
-# Only the test programs will pick up these defs.
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_TEST_DEFS)
+NT_LINK_LIBS = -llber $(AC_LIBS) $(SECURITY_LIBS)
.links :
@for i in $(XXSRCS); do \
install-local: $(CFFILES) FORCE
-$(MKDIR) $(DESTDIR)$(libdir)
$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+
#include "ldap_pvt_thread.h"
+/* mingw compiler very sensitive about getting prototypes right */
+typedef unsigned __stdcall thrfunc_t(void *);
+
int
ldap_int_thread_initialize( void )
{
void *(*start_routine)( void *),
void *arg)
{
- unsigned long tid;
+ unsigned tid;
HANDLE thd;
- thd = _beginthreadex( NULL, 0,
- (LPTHREAD_START_ROUTINE) start_routine, arg,
- 0, &tid );
+ thd = (HANDLE) _beginthreadex(NULL, 0, (thrfunc_t *) start_routine,
+ arg, 0, &tid);
*thread = (ldap_pvt_thread_t) thd;
- return thd == NULL ? -1 : 0;
+ return thd == NULL ? -1 : 0;
}
void
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-NT_DYN_LIB_DEFS = -DLDAP_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-
XLIBS = -lldbm -lavl
XXLIBS = $(LDBM_LIBS)
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-NT_DYN_LIB_DEFS = -DLDAP_DECL=dllimport -DLBER_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-
* of properties. The macros that test for various character properties all
* call this function with some set of masks.
*/
-extern int ucisprop LDAP_P((unsigned long code, unsigned long mask1,
- unsigned long mask2));
+LDAP_LUNICODE_F (int)
+ucisprop LDAP_P((unsigned long code, unsigned long mask1,
+ unsigned long mask2));
#define ucisalpha(cc) ucisprop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT, 0)
#define ucisdigit(cc) ucisprop(cc, UC_ND, 0)
*
**************************************************************************/
-extern unsigned long uctoupper LDAP_P((unsigned long code));
-extern unsigned long uctolower LDAP_P((unsigned long code));
-extern unsigned long uctotitle LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (unsigned long) uctoupper LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (unsigned long) uctolower LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (unsigned long) uctotitle LDAP_P((unsigned long code));
/**************************************************************************
*
* If it returns 0, there is no composition. Any other value indicates a
* composition was returned in comp.
*/
-extern int uccomp LDAP_P((unsigned long node1, unsigned long node2,
+LDAP_LUNICODE_F (int) uccomp LDAP_P((unsigned long node1, unsigned long node2,
unsigned long *comp));
/*
* Does Hangul composition on the string str with length len, and returns
* the length of the composed string.
*/
-extern int uccomp_hangul LDAP_P((unsigned long *str, int len));
+LDAP_LUNICODE_F (int) uccomp_hangul LDAP_P((unsigned long *str, int len));
/*
* Does canonical composition on the string str with length len, and returns
* the length of the composed string.
*/
-extern int uccanoncomp LDAP_P((unsigned long *str, int len));
+LDAP_LUNICODE_F (int) uccanoncomp LDAP_P((unsigned long *str, int len));
/**************************************************************************
*
* there is no decomposition. Any other value indicates a decomposition was
* returned.
*/
-extern int ucdecomp LDAP_P((unsigned long code, unsigned long *num,
- unsigned long **decomp));
+LDAP_LUNICODE_F (int)
+ucdecomp LDAP_P((unsigned long code, unsigned long *num,
+ unsigned long **decomp));
/*
* If the code is a Hangul syllable, this routine decomposes it into the array
* passed. The array size should be at least 3.
*/
-extern int ucdecomp_hangul LDAP_P((unsigned long code, unsigned long *num,
- unsigned long decomp[]));
+LDAP_LUNICODE_F (int)
+ucdecomp_hangul LDAP_P((unsigned long code, unsigned long *num,
+ unsigned long decomp[]));
/*
* This routine does canonical decomposition of the string in of length
* The memory for out is allocated by this routine. It returns the length
* of the decomposed string if okay, and -1 on error.
*/
-extern int uccanondecomp LDAP_P((const unsigned long *in, int inlen,
- unsigned long **out, int *outlen));
+LDAP_LUNICODE_F (int)
+uccanondecomp LDAP_P((const unsigned long *in, int inlen,
+ unsigned long **out, int *outlen));
/**************************************************************************
*
* This will return the combining class for a character to be used with the
* Canonical Ordering algorithm.
*/
-extern unsigned long uccombining_class LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (unsigned long) uccombining_class LDAP_P((unsigned long code));
/**************************************************************************
*
int denominator;
};
-extern int ucnumber_lookup LDAP_P((unsigned long code, struct ucnumber *num));
-extern int ucdigit_lookup LDAP_P((unsigned long code, int *digit));
+LDAP_LUNICODE_F (int)
+ucnumber_lookup LDAP_P((unsigned long code, struct ucnumber *num));
+
+LDAP_LUNICODE_F (int)
+ucdigit_lookup LDAP_P((unsigned long code, int *digit));
/*
* For compatibility with John Cowan's "uctype" package.
*/
-extern struct ucnumber ucgetnumber LDAP_P((unsigned long code));
-extern int ucgetdigit LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (struct ucnumber) ucgetnumber LDAP_P((unsigned long code));
+LDAP_LUNICODE_F (int) ucgetdigit LDAP_P((unsigned long code));
/**************************************************************************
*
/*
* Functions to load, unload, and reload specific data files.
*/
-extern int ucdata_load LDAP_P((char *paths, int mask));
-extern void ucdata_unload LDAP_P((int mask));
-extern int ucdata_reload LDAP_P((char *paths, int mask));
+LDAP_LUNICODE_F (int) ucdata_load LDAP_P((char *paths, int mask));
+LDAP_LUNICODE_F (void) ucdata_unload LDAP_P((int mask));
+LDAP_LUNICODE_F (int) ucdata_reload LDAP_P((char *paths, int mask));
#ifdef UCDATA_DEPRECATED
/*
* of a string containing no strong direction characters and the default
* cursor motion should be provided.
*/
-extern ucstring_t *ucstring_create LDAP_P((unsigned long *source,
- unsigned long start,
- unsigned long end,
- int default_direction,
- int cursor_motion));
+LDAP_LUNICODE_F (ucstring_t *)
+ucstring_create LDAP_P((unsigned long *source,
+ unsigned long start,
+ unsigned long end,
+ int default_direction,
+ int cursor_motion));
/*
* This releases the string.
*/
-extern void ucstring_free LDAP_P((ucstring_t *string));
+LDAP_LUNICODE_F (void) ucstring_free LDAP_P((ucstring_t *string));
/*
* This changes the cursor motion flag for the string.
*/
-extern int ucstring_set_cursor_motion LDAP_P((ucstring_t *string,
- int cursor_motion));
+LDAP_LUNICODE_F (int)
+ucstring_set_cursor_motion LDAP_P((ucstring_t *string,
+ int cursor_motion));
/*
* This function will move the cursor to the right depending on the
* A 0 is returned if no cursor motion is performed, otherwise a
* 1 is returned.
*/
-extern int ucstring_cursor_right LDAP_P((ucstring_t *string, int count));
+LDAP_LUNICODE_F (int)
+ucstring_cursor_right LDAP_P((ucstring_t *string, int count));
/*
* This function will move the cursor to the left depending on the
* A 0 is returned if no cursor motion is performed, otherwise a
* 1 is returned.
*/
-extern int ucstring_cursor_left LDAP_P((ucstring_t *string, int count));
+LDAP_LUNICODE_F (int)
+ucstring_cursor_left LDAP_P((ucstring_t *string, int count));
/*
* This routine retrieves the direction of the run containing the cursor
* and the actual position in the original text string.
*/
-extern void ucstring_cursor_info LDAP_P((ucstring_t *string, int *direction,
- unsigned long *position));
+LDAP_LUNICODE_F (void)
+ucstring_cursor_info LDAP_P((ucstring_t *string, int *direction,
+ unsigned long *position));
LDAP_END_DECL
*
*************************************************************************/
-extern ure_buffer_t ure_buffer_create LDAP_P((void));
+LDAP_LUNICODE_F (ure_buffer_t) ure_buffer_create LDAP_P((void));
-extern void ure_buffer_free LDAP_P((ure_buffer_t buf));
+LDAP_LUNICODE_F (void) ure_buffer_free LDAP_P((ure_buffer_t buf));
-extern ure_dfa_t ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
- int casefold, ure_buffer_t buf));
+LDAP_LUNICODE_F (ure_dfa_t)
+ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
+ int casefold, ure_buffer_t buf));
-extern void ure_dfa_free LDAP_P((ure_dfa_t dfa));
+LDAP_LUNICODE_F (void) ure_dfa_free LDAP_P((ure_dfa_t dfa));
-extern void ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
+LDAP_LUNICODE_F (void) ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
-extern int ure_exec LDAP_P((ure_dfa_t dfa, int flags,
- ucs2_t *text, unsigned long textlen,
- unsigned long *match_start, unsigned long *match_end));
+LDAP_LUNICODE_F (int)
+ure_exec LDAP_P((ure_dfa_t dfa, int flags, ucs2_t *text,
+ unsigned long textlen, unsigned long *match_start,
+ unsigned long *match_end));
/*************************************************************************
*
*
*************************************************************************/
-extern ucs4_t _ure_tolower LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (ucs4_t) _ure_tolower LDAP_P((ucs4_t c));
-extern int _ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
+LDAP_LUNICODE_F (int)
+_ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
LDAP_END_DECL
*
*************************************************************************/
-extern utbm_pattern_t utbm_create_pattern LDAP_P((void));
+LDAP_LUNICODE_F (utbm_pattern_t) utbm_create_pattern LDAP_P((void));
-extern void utbm_free_pattern LDAP_P((utbm_pattern_t pattern));
+LDAP_LUNICODE_F (void) utbm_free_pattern LDAP_P((utbm_pattern_t pattern));
-extern void utbm_compile LDAP_P((ucs2_t *pat, unsigned long patlen,
- unsigned long flags, utbm_pattern_t pattern));
+LDAP_LUNICODE_F (void)
+utbm_compile LDAP_P((ucs2_t *pat, unsigned long patlen,
+ unsigned long flags, utbm_pattern_t pattern));
-extern int utbm_exec LDAP_P((utbm_pattern_t pat, ucs2_t *text,
- unsigned long textlen, unsigned long *match_start,
- unsigned long *match_end));
+LDAP_LUNICODE_F (int)
+utbm_exec LDAP_P((utbm_pattern_t pat, ucs2_t *text,
+ unsigned long textlen, unsigned long *match_start,
+ unsigned long *match_end));
/*************************************************************************
*
*
*************************************************************************/
-extern int _utbm_isspace LDAP_P((ucs4_t c, int compress));
+LDAP_LUNICODE_F (int) _utbm_isspace LDAP_P((ucs4_t c, int compress));
-extern int _utbm_iscntrl LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (int) _utbm_iscntrl LDAP_P((ucs4_t c));
-extern int _utbm_nonspacing LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (int) _utbm_nonspacing LDAP_P((ucs4_t c));
-extern ucs4_t _utbm_tolower LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (ucs4_t) _utbm_tolower LDAP_P((ucs4_t c));
-extern ucs4_t _utbm_toupper LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (ucs4_t) _utbm_toupper LDAP_P((ucs4_t c));
-extern ucs4_t _utbm_totitle LDAP_P((ucs4_t c));
+LDAP_LUNICODE_F (ucs4_t) _utbm_totitle LDAP_P((ucs4_t c));
LDAP_END_DECL
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries
-NT_DYN_LIB_DEFS = -DLDAP_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_LIB_DEFS)
-
# These rules are for a Mingw32 build, specifically.
# It's ok for them to be here because the clean rule is harmless, and
# slapdmsg.res won't get built unless it's declared in OBJS.
#include <ldap.h>
+/*
+ * The whole debug implementation is a bit of a hack.
+ * We have to define this LDAP_SLAPD_V macro here since the slap.h
+ * header file isn't included (and really shouldn't be).
+ * TODO: re-implement debug functions so that the debug level can
+ * be passed around instead of having to count on the existence of
+ * ldap_debug, slap_debug, etc.
+ */
#define ldap_debug slap_debug
-extern int slap_debug;
+LDAP_SLAPD_V (int) slap_debug;
#include "ldap_log.h"
#include "ldap_pvt_thread.h"
/*
* Parses a map (also in legacy 'x' version)
*/
-extern struct rewrite_map *
+LDAP_REWRITE_F (struct rewrite_map *)
rewrite_map_parse(
struct rewrite_info *info,
const char *s,
const char **end
);
-extern struct rewrite_map *
+LDAP_REWRITE_F (struct rewrite_map *)
rewrite_xmap_parse(
struct rewrite_info *info,
const char *s,
/*
* Resolves key in val by means of map (also in legacy 'x' version)
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_map_apply(
struct rewrite_info *info,
struct rewrite_op *op,
struct berval *val
);
-extern int
+LDAP_REWRITE_F (int)
rewrite_xmap_apply(
struct rewrite_info *info,
struct rewrite_op *op,
/*
* Compiles a substitution pattern
*/
-extern struct rewrite_subst *
+LDAP_REWRITE_F (struct rewrite_subst *)
rewrite_subst_compile(
struct rewrite_info *info,
const char *result
* Substitutes a portion of rewritten string according to substitution
* pattern using submatches
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_subst_apply(
struct rewrite_info *info,
struct rewrite_op *op,
/*
* Compiles the rule and appends it at the running context
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_rule_compile(
struct rewrite_info *info,
struct rewrite_context *context,
* REWRITE_REGEXEC_UNWILL: rule matched; force 'unwilling to perform'
* REWRITE_REGEXEC_ERR: an error occurred
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_rule_apply(
struct rewrite_info *info,
struct rewrite_op *op,
/*
* Fetches a struct rewrite_session
*/
-extern struct rewrite_session *
+LDAP_REWRITE_F (struct rewrite_session *)
rewrite_session_find(
struct rewrite_info *info,
const void *cookie
/*
* Defines and inits a variable with session scope
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_var_set(
struct rewrite_info *info,
const void *cookie,
/*
* Gets a var with session scope
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_var_get(
struct rewrite_info *info,
const void *cookie,
/*
* Deletes a session
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_delete(
struct rewrite_info *info,
const void *cookie
/*
* Destroys the cookie tree
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_session_destroy(
struct rewrite_info *info
);
/*
* Finds a var
*/
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
rewrite_var_find(
Avlnode *tree,
const char *name
/*
* Inserts a newly created var
*/
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
rewrite_var_insert(
Avlnode **tree,
const char *name,
/*
* Sets/inserts a var
*/
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
rewrite_var_set(
Avlnode **tree,
const char *name,
/*
* Deletes a var tree
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_var_delete(
Avlnode *tree
);
/*
* Finds the context named rewriteContext in the context tree
*/
-extern struct rewrite_context *
+LDAP_REWRITE_F (struct rewrite_context *)
rewrite_context_find(
struct rewrite_info *info,
const char *rewriteContext
/*
* Creates a new context called rewriteContext and stores in into the tree
*/
-extern struct rewrite_context *
+LDAP_REWRITE_F (struct rewrite_context *)
rewrite_context_create(
struct rewrite_info *info,
const char *rewriteContext
* STOP: fine, rule matched; stop processing following rules
* UNWILL: rule matched; force 'unwilling to perform'
*/
-extern int
+LDAP_REWRITE_F (int)
rewrite_context_apply(
struct rewrite_info *info,
struct rewrite_op *op,
/*
* Retrieves a builtin map
*/
-struct rewrite_builtin_map *
+LDAP_REWRITE_F (struct rewrite_builtin_map *)
rewrite_builtin_map_find(
struct rewrite_info *info,
const char *name
/*
* LDAP map
*/
-void *
+LDAP_REWRITE_F (void *)
map_ldap_parse(
struct rewrite_info *info,
const char *fname,
char **argv
);
-int
+LDAP_REWRITE_F (int)
map_ldap_apply( struct rewrite_builtin_map *map,
const char *filter,
struct berval *val
# $(LTHREAD_LIBS) must be last
XLIBS = libbackends.a -lavl @LDBM_LIB@ -lldif -llutil -llunicode -lldap_r -llber
-XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) \
- $(SECURITY_LIBS) \
- $(LDIF_LIBS) $(LUTIL_LIBS)
+XXLIBS = $(LDBM_LIBS) $(SLAPD_LIBS) $(SECURITY_LIBS) $(LDIF_LIBS) $(LUTIL_LIBS)
XXXLIBS = $(LTHREAD_LIBS) $(MODULES_LIBS)
BUILD_OPT = "--enable-slapd"
all-local-srv: all-cffiles
-NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-
-DEFINES = $(@PLAT@_@LIB_LINKAGE@_DEFS)
-
-# The tricky part about building slapd in NT is that it will export symbols
-# like a DLL. The symbols that it exports should be representative of all
-# of the static symbols that it knows about.
-
-NT_EXP = slapd.exp
-NT_IMPLIB = libslapd.a
-NT_DUMMY = symdummy.o
-
-# Add extra def targets here
-EXTRA_DEFS =
-
-# NT needs this if libltdl is built statically. You'll have to fix the path
-# to point to where libltdl was built, then put ltdl.def in EXTRA_DEFS
-ltdl.def: ../../../libtool/libltdl/*.o
- dlltool --export-all-symbols --output-def $@ $^
-
-DYNAMIC_DEFS = liblber.def libldap_r.def
-
-STATIC_DEFS = libavl.def libldbm.def libldif.def liblutil.def slapd.def \
- $(EXTRA_DEFS)
-
-libavl.def: $(LDAP_LIBDIR)/libavl/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-liblber.def: $(LDAP_LIBDIR)/liblber/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-libldap_r.def: $(LDAP_LIBDIR)/libldap_r/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-libldbm.def: $(LDAP_LIBDIR)/libldbm/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-libldif.def: $(LDAP_LIBDIR)/libldif/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-liblutil.def: $(LDAP_LIBDIR)/liblutil/*.o
- dlltool --export-all-symbols --output-def $@ `ls $^ | grep -v test`
-
-slapd.def: $(OBJS) version.o
- dlltool --export-all-symbols --exclude-symbols main,ServiceMain@8 --output-def $@ `ls $^ | grep -v test`
-
-# We don't want to include symbols from dynamic libraries.
-all.def: $(STATIC_DEFS) $(DYNAMIC_DEFS)
- cat $(STATIC_DEFS) | grep " @ " | sed -e 's/ @ [0-9]*//' > $@
- if test "@LIB_LINKAGE@" != "DYN" ; then \
- cat $(DYNAMIC_DEFS) | grep " @ " | sed -e 's/ @ [0-9]*//' >> $@; \
- fi
- echo EXPORTS > tmp.def
- sort $@ >> tmp.def
- rm -f $@
- dlltool --input-def tmp.def --output-def $@
- rm -f tmp.def
-
-DUMMYTMP = symdummytmp.c
-
-symdummy.c: all.def $(ALL_DEFS)
- rm -f $@
- echo "static void never_called() {" > $(DUMMYTMP)
- cat $< | grep " @ " | while read line; \
+NT_SLAPD_DEPENDS = slapd.exp
+NT_SLAPD_OBJECTS = slapd.exp symdummy.o $(OBJS) version.o
+
+UNIX_SLAPD_DEPENDS = libbackends.a version.o
+UNIX_SLAPD_OBJECTS = $(OBJS) version.o
+
+SLAPD_DEPENDS = $(@PLAT@_SLAPD_DEPENDS)
+SLAPD_OBJECTS = $(@PLAT@_SLAPD_OBJECTS)
+
+# Notes about slapd for Windows
+# =============================
+# slapd.exe must export all of its global symbols, just like a DLL.
+# The purpose of this is to allow dynamic modules (dynamic backends
+# or external dynamic modules) to bind with the symbols at run-time.
+#
+# Exporting symbols from an .EXE is a bit tricky and involves multiple
+# steps. First a .DEF file must be generated. The .DEF file indicates
+# the set of symbols that are to be exported. Many times, it's possible
+# to manually create this file with an editor. However, with slapd,
+# we want to export EVERY global symbol that it knows about (NOT including
+# symbols that are imported from other DLLs). The set of symbols to
+# export INCLUDES symbols from all static libraries that slapd gets
+# linked with, e.g. avl, ldbm, ldif, lunicode, lutil, etc. This list
+# will also include liblber and libldap_r if they were built as static
+# libraries. ALSO included will be symbols from other STATIC libraries
+# outside the domain of the OpenLDAP source tree, e.g. regex, ltdl,
+# crypto, ssl, sasl, etc. (If these libraries are dynamic, we won't want
+# to include their symbols in the list). The correct set of symbols
+# CAN be determined at build time. The slapd.def target automatically
+# determines the correct set of symbols and generates the slapd.def file.
+#
+# The slapd.def file, serving multiple purposes, will:
+#
+# 1) be used to generate libslapd.a, the import library for slapd.exe.
+#
+# 2) be used to generate the symdummy.c file.
+#
+# 3) be used to help create slapd.exp, the binary-formated slapd export file.
+#
+# The import library is used by dynamic modules at link time. With this
+# library, dynamic modules indicate to the linker that it will resolve
+# these symbols from the slapd.exe binary at run-time. Of course, whenever
+# a module imports dynamic symbols, those symbols should be marked with
+# the __declspec(dllimport) directive in the header files that the dynamic
+# modules build with. In OpenLDAP, this is handled automatically in the
+# header files. (See ldap_cdefs.h for an explanation). Writers of
+# dynamic backend modules should keep in mind that slapd.exe might export
+# other global symbols that are not part of OpenLDAP (e.g. regex, ltdl,
+# crypto, ssl, sasl, etc.) When a writer actually uses (i.e. imports) these
+# symbols, he must verify that the header files from these external packages
+# include a mechanism to mark imported symbols with the __declspec(dllimport)
+# directive. Whether or not such a mechanism exists, the writer must be
+# able to include these directives appropriately when their symbols are
+# being imported from slapd.exe. The directive is not completely necessary
+# for functions, but it is required for variables.
+#
+# The symdummy.c file basically references EVERY symbol available to slapd.exe,
+# including symbols that slapd.exe never actually refereneced. The file
+# is compiled and included at link time. Without this object file, slapd.exe
+# would NOT export symbols that it never referenced. The reason that these
+# symbols must still be exported is because a dynamic module may want to
+# use a symbol even if it had not been referenced by slapd.exe.
+#
+
+#
+# slapd.def REALLY depends upon all slapd objects and all static libraries
+# included in $(LIBS), including static libraries outside of OpenLDAP.
+# When slapd.def is built, the absolute paths to all static libraries
+# (both inside and outside of OpenLDAP) are generated. We don't have
+# any way to include this generated list as a dependency of slapd.def (sigh).
+# Thus, we do the best we can by depending on version.o, which depends
+# on its own very long list of dependencies.
+#
+slapd.def: libbackends.a version.o
+ @for i in $(LDFLAGS) ; do \
+ path=`expr "$$i" : "-L\(.*\)"`; \
+ if test $$? != 0; then continue; fi; \
+ paths="$$paths $$path"; \
+ done; \
+ objs=""; \
+ for i in $(OBJS) version.o $(LIBS) ; do \
+ case $$i in \
+ -l*) \
+ obj="" ; \
+ done="" ;\
+ base=`expr "$$i" : "-l\(.*\)"`; \
+ for p in $$paths ; do \
+ for ext in la dll a ; do \
+ path=$$p/lib$$base.$$ext; \
+ test ! -f $$path && continue; \
+ if test $$ext = la ; then \
+ for t in dlname old_library ; do \
+ line=`grep "^$$t=" $$path`; \
+ lib=`expr "$$line" : "[^']*'\(.*\)'"`; \
+ test -n "$$lib" && test -f $$p/$$lib && \
+ path=$$p/$$lib && break; \
+ done; \
+ test $$t = dlname && ext=dll; \
+ test $$t = old_library && ext=a; \
+ fi; \
+ if test $$ext = a ; then \
+ obj=$$path; \
+ fi; \
+ done=done; \
+ break; \
+ done; \
+ test -n "$$done" && break; \
+ done; \
+ test -z "$$obj" && continue; \
+ ;; \
+ *.o | *.a) \
+ obj=$$i; \
+ esac; \
+ objs="$$objs $$obj"; \
+ done; \
+ echo dlltool --exclude-symbols main,ServiceMain@8 --export-all-symbols \
+ --output-def $@.tmp $$objs; \
+ dlltool --exclude-symbols main,ServiceMain@8 --export-all-symbols \
+ --output-def $@.tmp $$objs;
+ echo EXPORTS > $@
+ $(SED) -e 1,2d -e 's/ @ [0-9][0-9]*//' $@.tmp | sort >> $@
+ $(RM) $@.tmp
+
+symdummy.c: slapd.def
+ $(RM) $@
+ @echo "generating $@..."; \
+ echo "static void never_called() {" > $@.tmp; \
+ cat $< | while read line; \
do \
set dummy $$line; \
case $$# in \
- 5) \
+ 3) \
echo "int $$2();" >> $@; \
- echo "$$2();" >> $(DUMMYTMP); \
+ echo "$$2();" >> $@.tmp; \
;; \
- 6) \
+ 4) \
echo "extern int $$2;" >> $@; \
- echo "$$2 = 0;" >> $(DUMMYTMP); \
+ echo "$$2 = 0;" >> $@.tmp; \
;; \
esac; \
- done
- echo "" >> $@
- echo "}" >> $(DUMMYTMP)
- cat $(DUMMYTMP) >> $@
- rm -f $(DUMMYTMP)
-
-symdummy.o: symdummy.c
- $(CC) $(CFLAGS) -c $<
-
-SLAPD_OBJS = $(OBJS) version.o symdummy.o
-
-slapd.exp: libbackends.a all.def $(SLAPD_OBJS)
- $(LTLINK) -o slapd $(SLAPD_OBJS) $(LIBS) $(WRAP_LIBS) -Wl,--base-file,slapd.base
- rm -f slapd.exe
- dlltool --dllname slapd.exe --input-def all.def --base-file slapd.base --output-exp $@
- $(LTLINK) -o slapd $(SLAPD_OBJS) $(LIBS) $(WRAP_LIBS) $@ -Wl,--base-file,slapd.base
- rm -f slapd.exe
- dlltool --dllname slapd.exe --input-def all.def --base-file slapd.base --output-exp $@
-
-libslapd.a: all.def
- dlltool --dllname slapd.exe --input-def $< --output-lib $@
-
-slapd: libbackends.a version.o $(@PLAT@_EXP) $(@PLAT@_DUMMY)
- $(LTLINK) -o $@ $(@PLAT@_EXP) $(@PLAT@_DUMMY) $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
- (cd tools; $(MAKE) $(MFLAGS) all)
+ done; \
+ echo "" >> $@; \
+ echo "}" >> $@.tmp; \
+ cat $@.tmp >> $@; \
+ $(RM) $@.tmp
+
+libslapd.a: symdummy.o
+ dlltool --dllname slapd.exe --input-def slapd.def --output-lib $@
+
+slapd.exp: libslapd.a
+ @echo $(LTLINK) -Wl,--base-file,slapd.base -o slapd \
+ $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS); \
+ $(LTLINK) -Wl,--base-file,slapd.base -o slapd \
+ $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS)
+ $(RM) slapd.exe
+ @echo dlltool --dllname slapd.exe --input-def slapd.def \
+ --base-file slapd.base --output-exp $@; \
+ dlltool --dllname slapd.exe --input-def slapd.def \
+ --base-file slapd.base --output-exp $@; \
+ echo $(LTLINK) -Wl,--base-file,slapd.base -o slapd $@ \
+ $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS); \
+ $(LTLINK) -Wl,--base-file,slapd.base -o slapd $@ \
+ $(OBJS) symdummy.o version.o $(LIBS) $(WRAP_LIBS)
+ $(RM) slapd.exe
+ @echo dlltool --dllname slapd.exe --input-def slapd.def \
+ --base-file slapd.base --output-exp $@; \
+ dlltool --dllname slapd.exe --input-def slapd.def \
+ --base-file slapd.base --output-exp $@
+
+slapd: $(SLAPD_DEPENDS)
+ $(LTLINK) -o $@ $(SLAPD_OBJECTS) $(LIBS) $(WRAP_LIBS)
+ @msg="building dynamic backends..."; \
+ for i in back-*; do \
+ if test -d $$i -a -f $$i/Makefile ; then \
+ grep '^BUILD_MOD[ ]*=[ ]*mod[ ]*$$' $$i/Makefile \
+ > /dev/null 2>&1; \
+ if test $$? = 0; then \
+ if test -n "$$msg"; then \
+ echo ""; echo "$$msg"; \
+ msg=""; \
+ fi; \
+ echo ""; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
+ ( cd $$i; $(MAKE) $(MFLAGS) all ); \
+ if test $$? != 0 ; then exit 1; fi ; \
+ fi; \
+ fi; \
+ done; \
+ echo ""
+ cd tools; $(MAKE) $(MFLAGS) all
sslapd: version.o
$(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS) $(WRAP_LIBS)
-.backend: $(@PLAT@_IMPLIB) FORCE
- @for i in back-*; do \
- if test -d $$i -a -f $$i/Makefile ; then \
- echo " "; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
- ( cd $$i; $(MAKE) $(MFLAGS) all ); \
- if test $$? != 0 ; then exit 1; fi ; \
+#
+# In Windows, dynamic backends have to be built after slapd. For this
+# reason, we only build static backends now and dynamic backends later.
+#
+.backend: FORCE
+ @echo ""; echo "building static backends..."; \
+ for i in back-*; do \
+ if test -d $$i -a -f $$i/Makefile ; then \
+ grep '^BUILD_MOD[ ]*=[ ]*mod[ ]*$$' $$i/Makefile \
+ > /dev/null 2>&1; \
+ if test $$? != 0; then \
+ echo ""; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
+ ( cd $$i; $(MAKE) $(MFLAGS) all ); \
+ if test $$? != 0 ; then exit 1; fi ; \
fi; \
+ fi; \
done; \
- echo " "
+ echo ""
libbackends.a: .backend
@$(RM) -r tmp
( \
cd tmp; \
$(AR) x ../$$i; \
- pre=`echo $$i | sed -e 's/\/.*$$//' -e 's/back-//'`; \
+ pre=`echo $$i | $(SED) -e 's/\/.*$$//' -e 's/back-//'`; \
for j in *.o; do \
mv $$j $${pre}$$j; \
done; \
$(AR) ruv libbackends.a *.o 2>&1 | grep -v truncated; \
$(RM) *.o __.SYMDEF ________64ELEL_ ; \
echo "added backend library $$i"; \
+ echo ""; \
); \
done
@mv -f tmp/libbackends.a ./libbackends.a
@if test ! -z "$(RANLIB)" ; then \
$(RANLIB) libbackends.a; \
fi
- @ls -l libbackends.a
+ @ls -l libbackends.a; echo ""
version.c: $(OBJS) $(SLAPD_LIBDEPEND)
@-$(RM) $@
-$(MKDIR) $(DESTDIR)$(localstatedir)
$(LTINSTALL) $(INSTALLFLAGS) -s -m 755 \
slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
- @if test ! -z "$(SLAPD_MODULES)" ; then \
- for i in back-* shell-backends tools; do \
- if test -d $$i -a -f $$i/Makefile ; then \
- echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \
- ( cd $$i; $(MAKE) $(MFLAGS) install ); \
- if test $$? != 0 ; then exit 1; fi ; \
- fi; \
- done; \
- fi
+ @for i in back-* shell-backends tools; do \
+ if test -d $$i -a -f $$i/Makefile ; then \
+ echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \
+ ( cd $$i; $(MAKE) $(MFLAGS) install ); \
+ if test $$? != 0 ; then exit 1; fi ; \
+ fi; \
+ done
all-cffiles: slapd
- $(SED) -e 's;%SYSCONFDIR%;$(sysconfdir);' \
- -e 's;%LOCALSTATEDIR%;$(localstatedir);' \
- -e 's;%MODULEDIR%;$(moduledir);' \
+ @if test $(PLAT) = NT; then \
+ sysconfdir=`cygpath -w $(sysconfdir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\/g'`; \
+ localstatedir=`cygpath -w $(localstatedir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\/g'`; \
+ moduledir=`cygpath -w $(moduledir) | \
+ $(SED) -e 's/\\\\/\\\\\\\\/g'`; \
+ else \
+ sysconfdir=$(sysconfdir); \
+ localstatedir=$(localstatedir); \
+ moduledir=$(moduledir); \
+ fi; \
+ $(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
+ -e "s;%LOCALSTATEDIR%;$$localstatedir;" \
+ -e "s;%MODULEDIR%;$$moduledir;" \
$(srcdir)/slapd.conf > slapd.conf.tmp ; \
touch all-cffiles
BUILD_OPT = "--enable-bdb"
BUILD_MOD = @BUILD_BDB@
-LINKAGE = @BUILD_BDB_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_BDB_DYNAMIC@
-DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_BDB@_DEFS)
-# TODO
-#NT_mod_DYN_MODDEFS =
-#NT_mod_STAT_MODDEFS =
-
-NT_yes_DYN_MODDEFS = $(DYN_DEFS)
-NT_yes_STAT_MODDEFS =
-
-MODDEFS = $(@PLAT@_@BUILD_LDBM@_@LIB_LINKAGE@_MODDEFS)
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_bdb
BUILD_OPT = "--enable-dnssrv"
BUILD_MOD = @BUILD_DNSSRV@
-LINKAGE = @BUILD_DNSSRV_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_DNSSRV_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_DNSSRV@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_dnssrv
BUILD_OPT = "--enable-ldap"
BUILD_MOD = @BUILD_LDAP@
-LINKAGE = @BUILD_LDAP_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_LDAP_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_LDAP@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_ldap
# $OpenLDAP$
-SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \
- index.c id2children.c nextid.c abandon.c compare.c group.c \
- modify.c modrdn.c delete.c init.c config.c bind.c attr.c \
- filterindex.c unbind.c close.c alias.c tools.c key.c \
- extended.c passwd.c sasl.c referral.c attribute.c
-OBJS = idl.lo add.lo search.lo cache.lo dbcache.lo dn2id.lo entry.lo id2entry.lo \
- index.lo id2children.lo nextid.lo abandon.lo compare.lo group.lo \
- modify.lo modrdn.lo delete.lo init.lo config.lo bind.lo attr.lo \
- filterindex.lo unbind.lo close.lo alias.lo tools.lo key.lo \
- extended.lo passwd.lo sasl.lo referral.lo attribute.lo
+SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c \
+ id2entry.c index.c id2children.c nextid.c abandon.c \
+ compare.c group.c modify.c modrdn.c delete.c init.c \
+ config.c bind.c attr.c filterindex.c unbind.c close.c \
+ alias.c tools.c key.c extended.c passwd.c sasl.c \
+ referral.c attribute.c
+OBJS = idl.lo add.lo search.lo cache.lo dbcache.lo dn2id.lo entry.lo \
+ id2entry.lo index.lo id2children.lo nextid.lo abandon.lo \
+ compare.lo group.lo modify.lo modrdn.lo delete.lo init.lo \
+ config.lo bind.lo attr.lo filterindex.lo unbind.lo close.lo \
+ alias.lo tools.lo key.lo extended.lo passwd.lo sasl.lo \
+ referral.lo attribute.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
BUILD_OPT = "--enable-ldbm"
BUILD_MOD = @BUILD_LDBM@
-LINKAGE = @BUILD_LDBM_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_LDBM_DYNAMIC@
-DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_LDBM@_DEFS)
-# TODO
-#NT_mod_DYN_MODDEFS =
-#NT_mod_STAT_MODDEFS =
-
-NT_yes_DYN_MODDEFS = $(DYN_DEFS)
-NT_yes_STAT_MODDEFS =
-
-MODDEFS = $(@PLAT@_@BUILD_LDBM@_@LIB_LINKAGE@_MODDEFS)
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_ldbm
BUILD_OPT = "--enable-meta"
BUILD_MOD = @BUILD_META@
-LINKAGE = @BUILD_META_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_META_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_META@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_meta
BUILD_OPT = "--enable-monitor"
BUILD_MOD = @BUILD_MONITOR@
-LINKAGE = @BUILD_MONITOR_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_MONITOR_DYNAMIC@
-DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_MONITOR@_DEFS)
-# TODO
-#NT_mod_DYN_MODDEFS =
-#NT_mod_STAT_MODDEFS =
-
-NT_yes_DYN_MODDEFS = $(DYN_DEFS)
-NT_yes_STAT_MODDEFS =
-
-MODDEFS = $(@PLAT@_@BUILD_MONITOR@_@LIB_LINKAGE@_MODDEFS)
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_monitor
BUILD_OPT = "--enable-passwd"
BUILD_MOD = @BUILD_PASSWD@
-LINKAGE = @BUILD_PASSWD_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_PASSWD_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_PASSWD@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_passwd
BUILD_OPT = "--enable-perl"
BUILD_MOD = @BUILD_PERL@
-LINKAGE = @BUILD_PERL_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_PERL_DYNAMIC@
PERL_CPPFLAGS = @PERL_CPPFLAGS@
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_PERL@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
+
LIBBASE = back_perl
-MODLIBS = @MOD_PERL_LDFLAGS@
XINCPATH = -I.. -I$(srcdir)/..
XDEFS = $(PERL_CPPFLAGS) $(MODULES_CPPFLAGS)
## Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
-SRCS = init.c config.c fork.c search.c bind.c unbind.c add.c delete.c \
- modify.c modrdn.c compare.c abandon.c result.c
-OBJS = init.lo config.lo fork.lo search.lo bind.lo unbind.lo add.lo delete.lo \
- modify.lo modrdn.lo compare.lo abandon.lo result.lo
+SRCS = init.c config.c fork.c search.c bind.c unbind.c add.c \
+ delete.c modify.c modrdn.c compare.c abandon.c result.c
+OBJS = init.lo config.lo fork.lo search.lo bind.lo unbind.lo add.lo \
+ delete.lo modify.lo modrdn.lo compare.lo abandon.lo result.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
BUILD_OPT = "--enable-shell"
BUILD_MOD = @BUILD_SHELL@
-LINKAGE = @BUILD_SHELL_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_SHELL_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_SHELL@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_shell
BUILD_OPT = "--enable-sql"
BUILD_MOD = @BUILD_SQL@
-LINKAGE = @BUILD_SQL_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_SQL_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_SQL@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_sql
BUILD_OPT = "--enable-tcl"
BUILD_MOD = @BUILD_TCL@
-LINKAGE = @BUILD_TCL_DYNAMIC@
+BUILD_MOD_DYNAMIC = @BUILD_TCL_DYNAMIC@
+
+mod_DEFS = -DSLAPD_IMPORT
+MOD_DEFS = $(@BUILD_TCL@_DEFS)
+
+shared_LDAP_LIBS = $(LDAP_LIBPATH) -lldap_r -llber
+NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_tcl
-MODLIBS = @MOD_TCL_LIB@
XDEFS = $(MODULES_CPPFLAGS)
XINCPATH = -I.. -I$(srcdir)/..
../.backend: lib$(LIBBASE).a
@touch $@
+
#include "slap.h"
#include "lutil.h"
-#ifdef SLAPD_BDB
+/*
+ * If a module is configured as dynamic, its header should not
+ * get included into slapd. While this is a general rule and does
+ * not have much of an effect in UNIX, this rule should be adhered
+ * to for Windows, where dynamic object code should not be implicitly
+ * imported into slapd without appropriate __declspec(dllimport) directives.
+ */
+
+#if defined(SLAPD_BDB) && !defined(SLAPD_BDB_DYNAMIC)
#include "back-bdb/external.h"
#endif
-#ifdef SLAPD_DNSSRV
+#if defined(SLAPD_DNSSRV) && !defined(SLAPD_DNSSRV_DYNAMIC)
#include "back-dnssrv/external.h"
#endif
-#ifdef SLAPD_LDAP
+#if defined(SLAPD_LDAP) && !defined(SLAPD_LDAP_DYNAMIC)
#include "back-ldap/external.h"
#endif
-#ifdef SLAPD_LDBM
+#if defined(SLAPD_LDBM) && !defined(SLAPD_LDBM_DYNAMIC)
#include "back-ldbm/external.h"
#endif
-#ifdef SLAPD_META
+#if defined(SLAPD_META) && !defined(SLAPD_META_DYNAMIC)
#include "back-meta/external.h"
#endif
-#ifdef SLAPD_MONITOR
+#if defined(SLAPD_MONITOR) && !defined(SLAPD_MONITOR_DYNAMIC)
#include "back-monitor/external.h"
#endif
-#ifdef SLAPD_PASSWD
+#if defined(SLAPD_PASSWD) && !defined(SLAPD_PASSWD_DYNAMIC)
#include "back-passwd/external.h"
#endif
-#ifdef SLAPD_PERL
+#if defined(SLAPD_PERL) && !defined(SLAPD_PERL_DYNAMIC)
#include "back-perl/external.h"
#endif
-#ifdef SLAPD_SHELL
+#if defined(SLAPD_SHELL) && !defined(SLAPD_SHELL_DYNAMIC)
#include "back-shell/external.h"
#endif
-#ifdef SLAPD_TCL
+#if defined(SLAPD_TCL) && !defined(SLAPD_TCL_DYNAMIC)
#include "back-tcl/external.h"
#endif
-#ifdef SLAPD_SQL
+#if defined(SLAPD_SQL) && !defined(SLAPD_SQL_DYNAMIC)
#include "back-sql/external.h"
#endif
-#ifdef SLAPD_PRIVATE
+#if defined(SLAPD_PRIVATE) && !defined(SLAPD_PRIVATE_DYNAMIC)
#include "private/external.h"
#endif
#include <ac/unistd.h>
#include "ldap_pvt.h"
+#include "ldap_pvt_thread.h"
#include "lutil.h"
#include "slap.h"
do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
#endif
-#ifdef HAVE_NT_SERVICE_MANAGER
-/* in nt_main.c */
-/* externs are frowned upon, but so is NT :-) */
-extern ldap_pvt_thread_cond_t started_event;
-extern int is_NT_Service;
-#endif
-
#ifndef HAVE_WINSOCK
static
#endif
#define MAIN_RETURN(x) return
struct sockaddr_in bind_addr;
-/* in nt_main.c */
-LDAP_LUTIL_V(SERVICE_STATUS) SLAPDServiceStatus;
-LDAP_LUTIL_V(SERVICE_STATUS_HANDLE) hSLAPDServiceStatus;
-/* externs are frowned upon, but so is NT :-) */
-extern ldap_pvt_thread_cond_t started_event, stopped_event;
-extern int is_NT_Service;
-
void CommenceStartupProcessing( LPCTSTR serverName,
void(*stopper)(int));
void ReportSlapdShutdownComplete( void );
#include <stdio.h>
#include <ac/string.h>
#include "slap.h"
+#include "lutil.h"
#ifdef HAVE_NT_SERVICE_MANAGER
{
int length;
char filename[MAX_PATH], *fname_start;
- extern int is_NT_Service;
/*
* Because the service was registered as SERVICE_WIN32_OWN_PROCESS,
LDAP_BEGIN_DECL
-LDAP_SLAPD_F( int ) schema_init_done;
-LDAP_SLAPD_F( struct slap_internal_schema ) slap_schema;
+LDAP_SLAPD_V( int ) schema_init_done;
+LDAP_SLAPD_V( struct slap_internal_schema ) slap_schema;
LDAP_SLAPD_F( int ) slap_valid_descr( const char * );
* entry.c
*/
-extern const Entry slap_entry_root;
+LDAP_SLAPD_V (const Entry) slap_entry_root;
LDAP_SLAPD_F (int) entry_destroy LDAP_P((void));
/*
* controls.c
*/
-LDAP_SLAPD_F (char *) supportedControls[];
+LDAP_SLAPD_V (char *) supportedControls[];
/*
* mra.c
* kerberos.c
*/
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
-extern char *ldap_srvtab;
-LDAP_SLAPD_F (int) krbv4_ldap_auth();
+LDAP_SLAPD_V (char) *ldap_srvtab;
+LDAP_SLAPD_V (int) krbv4_ldap_auth();
#endif
/*
#define SLAP_SB_MAX_INCOMING_DEFAULT ((1<<18) - 1)
#define SLAP_SB_MAX_INCOMING_AUTH ((1<<24) - 1)
-LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming;
-LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming_auth;
-
-LDAP_SLAPD_F (slap_mask_t) global_restrictops;
-LDAP_SLAPD_F (slap_mask_t) global_allows;
-LDAP_SLAPD_F (slap_mask_t) global_disallows;
-LDAP_SLAPD_F (slap_mask_t) global_requires;
-LDAP_SLAPD_F (slap_ssf_set_t) global_ssf_set;
-
-LDAP_SLAPD_F (struct berval **) default_referral;
-LDAP_SLAPD_F (char *) replogfile;
-LDAP_SLAPD_F (const char) Versionstr[];
-LDAP_SLAPD_F (struct slap_limits_set) deflimit;
-LDAP_SLAPD_F (int) g_argc;
-LDAP_SLAPD_F (slap_access_t) global_default_access;
-LDAP_SLAPD_F (int) global_lastmod;
-LDAP_SLAPD_F (int) global_idletimeout;
-LDAP_SLAPD_F (int) global_schemacheck;
-LDAP_SLAPD_F (char) *global_host;
-LDAP_SLAPD_F (char) *global_realm;
-LDAP_SLAPD_F (int) sasl_external_x509dn_convert;
-LDAP_SLAPD_F (char) *default_passwd_hash;
-LDAP_SLAPD_F (int) lber_debug;
-LDAP_SLAPD_F (int) ldap_syslog;
-LDAP_SLAPD_F (char *) default_search_base;
-LDAP_SLAPD_F (char *) default_search_nbase;
-
-LDAP_SLAPD_F (int) nSaslRegexp;
-LDAP_SLAPD_F (SaslRegexp_t*) SaslRegexp;
-
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) num_sent_mutex;
-LDAP_SLAPD_F (long) num_bytes_sent;
-LDAP_SLAPD_F (long) num_pdu_sent;
-LDAP_SLAPD_F (long) num_entries_sent;
-LDAP_SLAPD_F (long) num_refs_sent;
-
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) num_ops_mutex;
-LDAP_SLAPD_F (long) num_ops_completed;
-LDAP_SLAPD_F (long) num_ops_initiated;
-
-LDAP_SLAPD_F (char *) slapd_pid_file;
-LDAP_SLAPD_F (char *) slapd_args_file;
-LDAP_SLAPD_F (char) **g_argv;
-LDAP_SLAPD_F (time_t) starttime;
+LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming;
+LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming_auth;
+
+LDAP_SLAPD_V (slap_mask_t) global_restrictops;
+LDAP_SLAPD_V (slap_mask_t) global_allows;
+LDAP_SLAPD_V (slap_mask_t) global_disallows;
+LDAP_SLAPD_V (slap_mask_t) global_requires;
+LDAP_SLAPD_V (slap_ssf_set_t) global_ssf_set;
+
+LDAP_SLAPD_V (struct berval **) default_referral;
+LDAP_SLAPD_V (char *) replogfile;
+LDAP_SLAPD_V (const char) Versionstr[];
+LDAP_SLAPD_V (struct slap_limits_set) deflimit;
+LDAP_SLAPD_V (int) g_argc;
+LDAP_SLAPD_V (slap_access_t) global_default_access;
+LDAP_SLAPD_V (int) global_lastmod;
+LDAP_SLAPD_V (int) global_idletimeout;
+LDAP_SLAPD_V (int) global_schemacheck;
+LDAP_SLAPD_V (char) *global_host;
+LDAP_SLAPD_V (char) *global_realm;
+LDAP_SLAPD_V (int) sasl_external_x509dn_convert;
+LDAP_SLAPD_V (char) *default_passwd_hash;
+LDAP_SLAPD_V (int) lber_debug;
+LDAP_SLAPD_V (int) ldap_syslog;
+LDAP_SLAPD_V (char *) default_search_base;
+LDAP_SLAPD_V (char *) default_search_nbase;
+
+LDAP_SLAPD_V (int) nSaslRegexp;
+LDAP_SLAPD_V (SaslRegexp_t*) SaslRegexp;
+
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) num_sent_mutex;
+LDAP_SLAPD_V (long) num_bytes_sent;
+LDAP_SLAPD_V (long) num_pdu_sent;
+LDAP_SLAPD_V (long) num_entries_sent;
+LDAP_SLAPD_V (long) num_refs_sent;
+
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) num_ops_mutex;
+LDAP_SLAPD_V (long) num_ops_completed;
+LDAP_SLAPD_V (long) num_ops_initiated;
+
+LDAP_SLAPD_V (char *) slapd_pid_file;
+LDAP_SLAPD_V (char *) slapd_args_file;
+LDAP_SLAPD_V (char) **g_argv;
+LDAP_SLAPD_V (time_t) starttime;
/* use time(3) -- no mutex */
#define slap_get_time() time( NULL )
-LDAP_SLAPD_F (ldap_pvt_thread_pool_t) connection_pool;
+LDAP_SLAPD_V (ldap_pvt_thread_pool_t) connection_pool;
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) entry2str_mutex;
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) replog_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;
#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) passwd_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) passwd_mutex;
#endif
-LDAP_SLAPD_F (ldap_pvt_thread_mutex_t) gmtime_mutex;
+LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) gmtime_mutex;
-LDAP_SLAPD_F (AccessControl *) global_acl;
+LDAP_SLAPD_V (AccessControl *) global_acl;
LDAP_SLAPD_F (int) slap_init LDAP_P((int mode, const char* name));
LDAP_SLAPD_F (int) slap_startup LDAP_P(( Backend *be ));
LDAP_SLAPD_F (int) do_extended LDAP_P((Connection *conn, Operation *op));
-LDAP_SLAPD_F (ber_socket_t) dtblsize;
+LDAP_SLAPD_V (ber_socket_t) dtblsize;
LDAP_END_DECL
*/
typedef char **(*SET_GATHER) (void *cookie, char *name, char *attr);
-long set_size (char **set);
-void set_dispose (char **set);
+LDAP_SLAPD_F (long) set_size (char **set);
+LDAP_SLAPD_F (void) set_dispose (char **set);
-int set_filter (SET_GATHER gatherer, void *cookie, char *filter, char *user, char *this, char ***results);
+LDAP_SLAPD_F (int)
+set_filter (SET_GATHER gatherer, void *cookie, char *filter,
+ char *user, char *this, char ***results);
#define SLAPD_TOP_OID "2.5.6.0"
-LDAP_SLAPD_F (int) slap_debug;
+LDAP_SLAPD_V (int) slap_debug;
typedef unsigned long slap_mask_t;
typedef struct slap_backend_info BackendInfo; /* per backend type */
typedef struct slap_backend_db BackendDB; /* per backend database */
-LDAP_SLAPD_F (int) nBackendInfo;
-LDAP_SLAPD_F (int) nBackendDB;
-LDAP_SLAPD_F (BackendInfo *) backendInfo;
-LDAP_SLAPD_F (BackendDB *) backendDB;
+LDAP_SLAPD_V (int) nBackendInfo;
+LDAP_SLAPD_V (int) nBackendDB;
+LDAP_SLAPD_V (BackendInfo *) backendInfo;
+LDAP_SLAPD_V (BackendDB *) backendDB;
-LDAP_SLAPD_F (int) slapMode;
+LDAP_SLAPD_V (int) slapMode;
#define SLAP_UNDEFINED_MODE 0x0000
#define SLAP_SERVER_MODE 0x0001
#define SLAP_TOOL_MODE 0x0002
PROGRAMS=slapadd slapcat slapindex slappasswd
-# CPPFLAGS will include the defines for dynamic libs in Mingw32.
-NT_DYN_DEFS = -DLBER_DECL=dllimport -DLDAP_DECL=dllimport
-CPPFLAGS = $(@PLAT@_@LIB_LINKAGE@_DEFS)
-
SRCS = mimic.c slapcommon.c \
slapadd.c slapcat.c slapindex.c slappasswd.c
SLAPD_OBJS = ../config.o ../ch_malloc.o ../backend.o ../charray.o \
- ../module.o ../aclparse.o ../filterentry.o \
- ../schema.o ../schema_check.o ../schema_init.o ../schema_prep.o \
- ../schemaparse.o ../ad.o ../at.o ../mr.o ../oc.o ../syntax.o \
- ../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \
- ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \
- ../controls.o ../kerberos.o ../passwd.o ../index.o \
- ../extended.o ../starttls.o ../sets.o ../mra.o \
+ ../module.o ../aclparse.o ../filterentry.o ../schema.o \
+ ../schema_check.o ../schema_init.o ../schema_prep.o \
+ ../schemaparse.o ../ad.o ../at.o ../mr.o ../oc.o \
+ ../syntax.o ../acl.o ../phonetic.o ../attr.o ../value.o \
+ ../entry.o ../dn.o ../filter.o ../str2filter.o ../ava.o \
+ ../init.o ../controls.o ../kerberos.o ../passwd.o \
+ ../index.o ../extended.o ../starttls.o ../sets.o ../mra.o \
../referral.o
SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o