Bug 1126607, part 2: Integrate the imported code into moz.build, r=glandium.
authorJoshua Cranmer <Pidgeot18@gmail.com>
Sun, 19 Apr 2015 22:20:41 -0500
changeset 22480 2b00be2ded7f6b20d5b10523f73ff29bb02edd43
parent 22479 f9f973c875f8e70cdb12586f50c5799419c31c07
child 22481 557498f58325bd8367e00c40869bcbc6b8310506
push idunknown
push userunknown
push dateunknown
reviewersglandium
bugs1126607
Bug 1126607, part 2: Integrate the imported code into moz.build, r=glandium.
ldap/Makefile.in
ldap/c-sdk/include/Makefile.in
ldap/c-sdk/include/ldap-standard-tmpl.h
ldap/c-sdk/include/ldap-standard.h
ldap/c-sdk/include/portable.h
ldap/c-sdk/libraries/libiutil/Makefile.in
ldap/c-sdk/libraries/libiutil/moz.build
ldap/c-sdk/libraries/liblber/Makefile.in
ldap/c-sdk/libraries/liblber/moz.build
ldap/c-sdk/libraries/libldap/Makefile.in
ldap/c-sdk/libraries/libldap/getfilter.c
ldap/c-sdk/libraries/libldap/libldap.def
ldap/c-sdk/libraries/libldap/moz.build
ldap/c-sdk/libraries/libldif/Makefile.in
ldap/c-sdk/libraries/libldif/libldif.def
ldap/c-sdk/libraries/libldif/moz.build
ldap/c-sdk/libraries/libprldap/Makefile.in
ldap/c-sdk/libraries/libprldap/libprldap.def
ldap/c-sdk/libraries/libprldap/moz.build
ldap/c-sdk/libraries/libutil/Makefile.in
ldap/c-sdk/libraries/libutil/moz.build
ldap/c-sdk/libraries/moz.build
ldap/ldap-sdk.mozbuild
ldap/moz.build
ldap/xpcom/src/Makefile.in
ldap/xpcom/src/moz.build
mail/configure.in
suite/configure.in
deleted file mode 100644
--- a/ldap/Makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# The LDAP C SDK tries to build everything when calling make export. Since NSPR
-# isn't yet built during export, we can't let that happen, so we are going to
-# reach in and just install the headers that we need.
-
-export::
-	$(MAKE) -j1 -C $(DEPTH)/ldap/sdks/c-sdk/config export
-	$(MAKE) -j1 -C $(DEPTH)/ldap/sdks/c-sdk/ldap/include export
-
-libs clean distclean::
-	$(MAKE) -j1 -C $(DEPTH)/ldap/sdks/c-sdk $@
-
-target::
-	$(MAKE) -j1 -C $(DEPTH)/ldap/sdks/c-sdk export
deleted file mode 100644
--- a/ldap/c-sdk/include/Makefile.in
+++ /dev/null
@@ -1,104 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-MOD_DEPTH	= ../..
-srcdir		= @srcdir@
-topsrcdir	= @top_srcdir@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-CHMOD		= chmod
-RM		= rm -f
-SED		= sed
-
-HEADERS		= \
-		  disptmpl.h \
-		  lber.h \
-		  ldap.h \
-		  ldap-extension.h \
-		  ldap-platform.h \
-		  ldap-to-be-deprecated.h \
-		  ldap-deprecated.h \
-		  ldap_ssl.h \
-		  ldappr.h \
-		  ldif.h \
-		  iutil.h \
-		  srchpref.h \
-		  $(NULL)
-HEADERS := $(addprefix $(srcdir)/, $(HEADERS))
-
-PRIVATEHEADERS	= \
-		  ../libraries/libldap/ldap-int.h \
-		  ../libraries/liblber/lber-int.h \
-		  portable.h \
-		  ldaprot.h \
-		  ldaplog.h \
-		  $(NULL)
-PRIVATEHEADERS := $(addprefix $(srcdir)/, $(PRIVATEHEADERS))
-
-LDAP_STD_HEADER = ldap-standard.h
-
-RELEASE_HEADERS	= $(HEADERS) $(LDAP_STD_HEADER)
-
-include $(topsrcdir)/config/rules.mk
-
-INCLUDEDIR	= $(DIST)/public/ldap
-PRIVATEINCDIR	= $(DIST)/public/ldap-private
-
-GARBAGE		+= sdkver.h dirver.h $(LDAP_STD_HEADER)
-
-###########################################################################
-
-all export:: $(INCLUDEDIR) $(LDAP_STD_HEADER)
-	$(NSINSTALL) -D $(PRIVATEINCDIR)
-	$(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(LDAP_STD_HEADER) $(INCLUDEDIR)
-	$(INSTALL) $(INSTALLFLAGS) -m 644 $(PRIVATEHEADERS) $(PRIVATEINCDIR)
-
-$(INCLUDEDIR):	FORCE
-	$(NSINSTALL) -D $(INCLUDEDIR)
-
-
-$(LDAP_STD_HEADER): ldap-standard-tmpl.h
-	$(PERL) $(srcdir)/../build/replace.pl \
-			LDAP_VENDOR_NAME="$(VENDOR_NAME)" \
-			LDAP_VENDOR_VERSION="$(VENDOR_VERSION)" \
-			< $< > $@
-
-FORCE:
-
rename from ldap/c-sdk/include/ldap-standard-tmpl.h
rename to ldap/c-sdk/include/ldap-standard.h
--- a/ldap/c-sdk/include/ldap-standard-tmpl.h
+++ b/ldap/c-sdk/include/ldap-standard.h
@@ -1,9 +1,8 @@
-/* This file is a template.  The generated file is ldap-standard.h>
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  * 
  * The contents of this file are subject to the Mozilla Public License Version 
  * 1.1 (the "License"); you may not use this file except in compliance with 
  * the License. You may obtain a copy of the License at 
  * http://www.mozilla.org/MPL/
  * 
@@ -53,18 +52,18 @@ extern "C" {
 
 #define LDAP_PORT       	389
 #define LDAPS_PORT      	636
 #define LDAP_VERSION2   	2
 #define LDAP_VERSION3   	3
 #define LDAP_VERSION_MIN	LDAP_VERSION1
 #define LDAP_VERSION_MAX	LDAP_VERSION3
 
-#define LDAP_VENDOR_VERSION	{{LDAP_VENDOR_VERSION}}	/* version # * 100 */
-#define LDAP_VENDOR_NAME	"{{LDAP_VENDOR_NAME}}"
+#define LDAP_VENDOR_VERSION	607	/* version # * 100 */
+#define LDAP_VENDOR_NAME	"mozilla.org"
 /*
  * The following will be an RFC number once the LDAP C API Internet Draft
  * is published as a Proposed Standard RFC.  For now we use 2000 + the
  * draft revision number (currently 5) since we are close to compliance
  * with revision 5 of the draft.
  */
 #define LDAP_API_VERSION	2005
 
--- a/ldap/c-sdk/include/portable.h
+++ b/ldap/c-sdk/include/portable.h
@@ -145,24 +145,18 @@
 #define SYSERRLIST_IN_STDIO
 #endif
 #endif
 
 
 /*
  * Is snprintf() part of the standard C runtime library?
  */
-#if !defined(HAVE_SNPRINTF)
-#if defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined(AIX)
-#define HAVE_SNPRINTF
-#endif
 #if defined(_WINDOWS)
 #define snprintf _snprintf
-#define HAVE_SNPRINTF
-#endif
 #endif
 
 
 /*
  * Async IO.  Use a non blocking implementation of connect() and 
  * dns functions
  */
 #if !defined(LDAP_ASYNC_IO)
deleted file mode 100644
--- a/ldap/c-sdk/libraries/libiutil/Makefile.in
+++ /dev/null
@@ -1,110 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-
-MOD_DEPTH	= ../../..
-srcdir		= @srcdir@
-topsrcdir 	= @top_srcdir@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-ifeq ($(HAVE_CCONF), 1)
-SRCS		= iutil-lock.c
-else
-SRCS		= iutil-lock.c
-endif
-
-REALOBJS        = $(SRCS:.c=.$(OBJ_SUFFIX))
-
-IUTILOBJDEST	= $(OBJDIR_NAME)
-OBJS		= $(addprefix $(IUTILOBJDEST)/, $(REALOBJS))
-
-DISTHDIR	= $(DIST)/public/ldap
-HDIR		= $(topsrcdir)/ldap/include
-
-LIBIUTIL	= $(addprefix $(IUTILOBJDEST)/, \
-		  $(LIB_PREFIX)$(IUTIL_LIBNAME).$(LIB_SUFFIX))
-
-INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-
-include $(topsrcdir)/config/rules.mk
-
-GARBAGE 	+= $(LIBIUTIL)
-
-LOCAL_INCLUDES  = -I$(PUBLIC)/nspr
-INCLUDES	+= -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include -I$(DIST)/include
-ifeq ($(HAVE_CCONF), 1)
-INCLUDES	+= -I$(srcdir)/../libldap/
-endif
-DEFINES		+= $(DEFS)
-
-PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
-PLATFORMLIBS	=
-THREADS		=
-THREADSLIB	=
-
-###########################################################################
-
-versiont.c:	Makefile.client Version.c
-	@$(RM) $@
-	@(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \
-	h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Version.c > $@)
-
-export::    $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBIUTIL)
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBIUTIL): $(OBJS) $(LIBDIR)
-	@echo ======= making $(LIBIUTIL)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-	$(LINK_LIB)
-
-veryclean:: clean
-
-$(OBJDEST):
-	$(MKDIR) $(OBJDEST)
-
-export::	$(LIBIUTIL)
-	$(INSTALL) -m 444 $(LIBIUTIL) $(dist_libdir)
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libiutil/moz.build
@@ -0,0 +1,20 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+Library(get_ldap_name('iutil'))
+
+SOURCES += [
+    'iutil-lock.c'
+]
+
+DEFINES['USE_WAITPID'] = True
+DEFINES['NEEDPROTOS'] = True
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
+
deleted file mode 100644
--- a/ldap/c-sdk/libraries/liblber/Makefile.in
+++ /dev/null
@@ -1,104 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-MOD_DEPTH	= ../../..
-srcdir		= @srcdir@
-topsrcdir 	= @top_srcdir@
-HAVE_SASL	= @HAVE_SASL@
-SASL_CFLAGS	= @SASL_CFLAGS@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-SRCS		= decode.c \
-		  encode.c \
-		  io.c \
-		  bprint.c
-
-REALOBJS        = $(SRCS:.c=.$(OBJ_SUFFIX))
-OBJS		= $(addprefix $(OBJDIR_NAME)/, $(REALOBJS))
-HDIR		= $(topsrcdir)/ldap/include
-
-LIBLBER		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LBER_LIBNAME).$(LIB_SUFFIX))
-
-INSTALLDIR	= $(DIST)/$(OBJDIR_NAME)
-
-include $(topsrcdir)/config/rules.mk
-
-GARBAGE 	+= $(LIBLBER)
-
-LOCAL_INCLUDES  =
-INCLUDES	+= -I$(HDIR)  -I$(INSTALLDIR)/include 
-
-DEFINES		+= $(DEFS)
-
-PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
-PLATFORMLIBS	=
-THREADS		=
-THREADSLIB	=
-
-###########################################################################
-
-versiont.c:	Makefile.client Version.c
-	@$(RM) $@
-	@(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \
-	h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Version.c > $@)
-
-export::    $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLBER)
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBLBER): $(OBJS) $(LIBDIR)
-	@echo ======= making $(LIBLBER)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-	$(LINK_LIB)
-
-veryclean:: clean
-
-$(OBJDEST):
-	$(MKDIR) $(OBJDEST)
-
-export::  $(LIBLBER)
-	$(INSTALL) -m 444 $(LIBLBER) $(dist_libdir)
-
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/liblber/moz.build
@@ -0,0 +1,23 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+Library(get_ldap_name('lber'))
+
+SOURCES += [
+    'bprint.c',
+    'decode.c',
+    'encode.c',
+    'io.c',
+]
+
+DEFINES['USE_WAITPID'] = True
+DEFINES['NEEDPROTOS'] = True
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
+
deleted file mode 100644
--- a/ldap/c-sdk/libraries/libldap/Makefile.in
+++ /dev/null
@@ -1,375 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-MOD_DEPTH 	= ../../..
-srcdir		= @srcdir@
-topsrcdir	= @top_srcdir@
-SASL_CFLAGS     = @SASL_CFLAGS@
-SASL_LIBS       = @SASL_LIBS@
-HAVE_SASL	= @HAVE_SASL@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-SRCS		= abandon.c \
-		  add.c \
-		  authzidctrl.c \
-		  bind.c \
-		  cache.c \
-		  charray.c \
-		  charset.c \
-		  compare.c \
-		  compat.c \
-		  control.c \
-		  countvalues.c \
-		  delete.c \
-		  disptmpl.c \
-		  dsparse.c \
-		  error.c \
-		  extendop.c \
-		  free.c \
-		  freevalues.c \
-		  friendly.c \
-		  getattr.c \
-		  getdn.c \
-		  getdxbyname.c \
-		  geteffectiverightsctrl.c \
-		  getentry.c \
-		  getfilter.c \
-		  getoption.c \
-		  getvalues.c \
-		  memcache.c \
-		  message.c \
-		  modify.c \
-		  open.c \
-		  os-ip.c \
-		  proxyauthctrl.c \
-		  psearch.c \
-		  pwmodext.c \
-		  pwpctrl.c \
-		  referral.c \
-		  regex.c \
-		  rename.c \
-		  request.c \
-		  reslist.c \
-		  result.c \
-		  saslbind.c \
-		  sbind.c \
-		  search.c \
-		  setoption.c \
-		  sort.c \
-		  sortctrl.c \
-		  srchpref.c \
-		  tmplout.c \
-		  ufn.c \
-		  unbind.c \
-		  unescape.c \
-		  url.c \
-		  userstatusctrl.c \
-		  utf8.c \
-		  vlistctrl.c \
-		  whoami.c
-
-ifeq ($(HAVE_SASL), 1)
-SRCS		+= saslio.c
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-SRCS		+= dllmain.c \
-                   mozock.c
-endif
-RELEASE_LIBS	= $(SHARED_LIBRARY) $(DLLLDAP)
-
-REALOBJS	= $(SRCS:.c=.$(OBJ_SUFFIX))
-OBJS		= $(addprefix $(OBJDIR_NAME)/, $(REALOBJS))
-
-DISTHDIR	= $(DIST)/public/ldap
-HDIR		= $(topsrcdir)/ldap/include
-
-LIBLDAP		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
-DLLLDAP		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
-
-INSTALLDIR	= $(DIST)/$(OBJDIR_NAME)
-
-include $(topsrcdir)/config/rules.mk
-
-GARBAGE 	+= $(LIBLDAP) $(DLLLDAP)
-
-LOCAL_INCLUDES  = -I$(PUBLIC)/nspr
-INCLUDES	+= -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/public
-
-ifeq ($(HAVE_SASL), 1)
-INCLUDES        += $(SASL_CFLAGS)
-endif
-
-DEFINES		+= $(DEFS) -UMOZILLA_CLIENT
-
-ifdef USE_PTHREADS
-DEFINES   += -DUSE_PTHREADS
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-PLATFORMCFLAGS	= -DNEEDPROTOS
-else
-PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
-endif
-THREADS		=
-THREADSLIB	=
-
-ETCFILENAMES	= ldapfilter.conf \
-		  ldapfriendly \
-		  ldapsearchprefs.conf \
-		  ldaptemplates.conf \
-		  $(NULL)
-
-ETCDIR		= $(INSTALLDIR)/etc
-ETCFILES	= $(addprefix $(srcdir)/, $(ETCFILENAMES))
-
-#
-# if you want things to run in a different directory from where they
-# are installed, set this accordingly (this path gets compiled into a
-# few binaries). otherwise, leave it alone.
-#
-RUNTIMEETCDIR	= $(ETCDIR)
-
-#
-# shared library symbol export definitions
-#
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-ifeq ($(OS_ARCH), WINNT)
-GENEXPORTS=cmd /c  $(PERL) $(topsrcdir)/ldap/build/genexports.pl
-else
-GENEXPORTS=$(PERL) $(topsrcdir)/ldap/build/genexports.pl
-endif
-
-# variable definitions for exported symbols
-ifeq ($(OS_ARCH), WINNT)
-        LDAP_EXPORT_DEFS= $(WIN_TOP_SRC)/ldap/libraries/msdos/winsock/nsldap32.def
-else
-ifeq ($(OS_ARCH), OS2)
-        LDAP_EXPORT_DEFS= $(OBJDIR_NAME)/libldap.def
-else
-        LDAP_EXPORT_DEFS= $(OBJDIR_NAME)/libldap.exp
-endif
-GARBAGE += $(LDAP_EXPORT_DEFS)
-endif
-
-LDAP_EXPORT_FLAGS=$(addprefix $(DLLEXPORTS_PREFIX), $(LDAP_EXPORT_DEFS))
-
-GENEXPARGS=$(BUILD_DEBUG) $(LDAPVERS_SUFFIX) $(LDAPVERS)
-endif # USE_DLL_EXPORTS_FILE
-
-ifeq ($(OS_ARCH), SunOS)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(OS_ARCH), IRIX)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) $(OS_LIBS) -lc
-endif
-
-ifeq ($(OS_ARCH), Linux)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(OS_ARCH), WINNT)
-ifdef NS_USE_GCC
-EXTRA_DLL_LIBS=-L$(dist_libdir) -l$(LBER_LIBNAME)
-else
-EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
-            comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
-            rpcrt4.lib uuid.lib winmm.lib
-EXTRA_LIBS += $(dist_libdir)/$(LDIF_LIBNAME).lib
-EXTRA_LIBS += $(dist_libdir)/$(LBER_LIBNAME).lib
-endif
-endif
-
-ifeq ($(OS_ARCH), OS2)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) $(OS_LIBS)
-endif
-
-ifeq ($(OS_ARCH), OSF1)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-EXTRA_LIBS += -L/usr/lib -lcxx -lpthread -lrt -lmach -lexc
-endif
-
-ifeq ($(OS_ARCH), AIX)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-EXTRA_LIBS += -ldl -brtl -lpthreads -lc_r -lm
-endif
-
-ifeq ($(OS_ARCH), HP-UX)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-ifdef USE_PTHREADS
-EXTRA_LIBS += -ldld -lm -lpthread
-else
-EXTRA_LIBS += -ldld -lm
-endif
-endif
-
-ifeq ($(OS_ARCH), Darwin)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(OS_ARCH), OpenVMS)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) $(OS_LIBS)
-SHARED_LIBRARY_LIBS = $(dist_libdir)/lib$(LBER_LIBNAME).a
-endif
-
-ifeq ($(OS_ARCH), BeOS)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) -lbe
-endif
-
-ifeq ($(OS_ARCH), FreeBSD)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(OS_ARCH), NetBSD)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(OS_ARCH), OpenBSD)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) -pthread
-endif
-
-ifeq ($(OS_ARCH), DragonFly)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME)
-endif
-
-ifeq ($(HAVE_SASL), 1)
-EXTRA_LIBS += $(SASL_LINK)
-endif
-
-###########################################################################
-
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-# recursive gmake rule to create exported symbols file
-$(LDAP_EXPORT_DEFS):: $(srcdir)/../libldap.ex
-ifeq ($(OS_ARCH), WINNT)
-	$(GENEXPORTS) Win32 $(srcdir)/../msdos/winsock/nsldap32.tdf $< $(GENEXPARGS) > $@
-else
-ifeq ($(OS_ARCH), OS2)
-	echo LIBRARY $(LDAP_LIBNAME) INITINSTANCE TERMINSTANCE > $@
-	echo PROTMODE >> $@
-	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
-	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
-	echo EXPORTS >> $@
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) >> $@
-else
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) > $@
-endif
-endif
-endif # USE_DLL_EXPORTS_FILE
-
-versiont.c:	Makefile.client Version.c
-	@$(RM) $@
-	@(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \
-	h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Version.c > $@)
-
-# Set the default sources for the export target
-EXPDEPS = $(OBJDIR_NAME) $(LIBDIR) $(OBJS) $(LIBLDAP) $(DLLLDAP)
-# Remove the LIB source if on win32 and using MSVC
-# This avoids problems with -jX builds where 'link' will make both the
-# .dll and .lib files in one pass
-ifeq ($(OS_ARCH), WINNT)
-ifeq ($(LD),link)
-EXPDEPS = $(OBJDIR_NAME) $(LIBDIR) $(OBJS) $(DLLLDAP)
-endif
-endif
-
-export::	$(EXPDEPS)
-
-ltest::	$(LIBLDAP) test.o
-		$(LINK_EXE) test.o
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS)
-	@echo ======= making $(LIBLDAP)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-ifneq (,$(filter AIX Linux HP-UX Darwin BeOS QNX NetBSD OSF1 OpenBSD, $(OS_ARCH)))
-	$(LINK_LIB)
-else
-ifeq ($(OS_ARCH),OS2)
-# create import library for OS/2
-	rm -f $@
-	$(IMPLIB) $@ $(LDAP_EXPORT_DEFS)
-else
-	$(LINK_LIB)
-endif
-endif
-
-$(DLLLDAP): $(OBJS) $(LIBDIR) $(LDAP_EXPORT_DEFS)
-	@echo ======= making $(DLLLDAP)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-	$(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
-
-veryclean:: clean
-
-# the $(dist_bindir) line is for the mozilla client, which for reasons
-# unknown wants shared libraries in /bin also
-#
-# Set the default sources for the export target
-EXPDEPS2 = $(LIBLDAP) $(DLLLDAP)
-# Remove the LIB source if on win32 and using MSVC
-# This avoids problems with -jX builds where 'link' will make both the
-# .dll and .lib files in one pass
-ifeq ($(OS_ARCH), WINNT)
-ifeq ($(LD),link)
-EXPDEPS2 = $(DLLLDAP)
-endif
-endif
-
-export::	$(EXPDEPS2)
-ifdef MKSHLIB
-	$(INSTALL) -m 444 $(LIBLDAP) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLLDAP) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLLDAP) $(dist_bindir)
-endif
-ifeq ($(OS_ARCH), WINNT)
-	$(INSTALL) -m 444 $(LIBLDAP) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLLDAP) $(dist_libdir)
-endif
-	$(INSTALL) -m 444 $(ETCFILES) $(ETCDIR)
--- a/ldap/c-sdk/libraries/libldap/getfilter.c
+++ b/ldap/c-sdk/libraries/libldap/getfilter.c
@@ -144,21 +144,17 @@ ldap_init_getfilter_buf( char *buf, long
 		ldap_getfilter_free( lfdp );
 		return( NULL );
 	    }
 	    nextflp->lfl_tag = nsldapi_strdup( tag );
 	    nextflp->lfl_pattern = tok[ 0 ];
 	    if (( errmsg = re_comp( nextflp->lfl_pattern )) != NULL ) {
 		char    msg[512];
 		ldap_getfilter_free( lfdp );
-#ifdef HAVE_SNPRINTF
 		snprintf( msg, sizeof(msg),
-#else
-		sprintf( msg,
-#endif
 			"bad regular expression \"%s\" - %s\n",
 			nextflp->lfl_pattern, errmsg );
 		ber_err_print( msg );
 		nsldapi_free_strarray( tok );
 		return( NULL );
 	    }
 		
 	    nextflp->lfl_delims = tok[ 1 ];
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libldap/libldap.def
@@ -0,0 +1,357 @@
+;
+; ***** BEGIN LICENSE BLOCK *****
+; Version: MPL 1.1/GPL 2.0/LGPL 2.1
+; 
+; The contents of this file are subject to the Mozilla Public License Version 
+; 1.1 (the "License"); you may not use this file except in compliance with 
+; the License. You may obtain a copy of the License at 
+; http://www.mozilla.org/MPL/
+; 
+; Software distributed under the License is distributed on an "AS IS" basis,
+; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+; for the specific language governing rights and limitations under the
+; License.
+; 
+; The Original Code is Mozilla Communicator client code.
+; 
+; The Initial Developer of the Original Code is
+; Netscape Communications Corporation.
+; Portions created by the Initial Developer are Copyright (C) 1996-1999
+; the Initial Developer. All Rights Reserved.
+; 
+; Contributor(s):
+; 
+; Alternatively, the contents of this file may be used under the terms of
+; either of the GNU General Public License Version 2 or later (the "GPL"),
+; or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+; in which case the provisions of the GPL or the LGPL are applicable instead
+; of those above. If you wish to allow use of your version of this file only
+; under the terms of either the GPL or the LGPL, and not to allow others to
+; use your version of this file under the terms of the MPL, indicate your
+; decision by deleting the provisions above and replace them with the notice
+; and other provisions required by the GPL or the LGPL. If you do not delete
+; the provisions above, a recipient may use your version of this file under
+; the terms of any one of the MPL, the GPL or the LGPL.
+; 
+; ***** END LICENSE BLOCK ***** 
+
+LIBRARY         NSLDAP32V60
+DESCRIPTION     'Lightweight Directory Access Protocol Client API for 32-bit Windows'
+VERSION		6.0
+HEAPSIZE        4096
+
+EXPORTS
+; we need to manually assign ordinal numbers so we can add new routines
+; and not disturb the ordinals and thus not require callers to relink.
+; 
+; exports list (generated by genexports.pl)
+; 
+
+	ldap_abandon		@10
+	ldap_add		@11
+	ldap_unbind		@13
+
+; 	ldap_enable_cache		@14
+; 	ldap_disable_cache		@15
+; 	ldap_destroy_cache		@16
+; 	ldap_flush_cache		@17
+; 	ldap_uncache_entry		@18
+
+	ldap_compare		@19
+	ldap_delete		@20
+	ldap_result2error		@21
+	ldap_err2string		@22
+	ldap_modify		@23
+	ldap_modrdn		@24
+	ldap_open		@25
+	ldap_first_entry		@26
+	ldap_next_entry		@27
+	ldap_get_dn		@30
+	ldap_dn2ufn		@31
+	ldap_first_attribute		@32
+	ldap_next_attribute		@33
+	ldap_get_values		@34
+	ldap_get_values_len		@35
+	ldap_count_entries		@36
+	ldap_count_values		@37
+	ldap_value_free		@38
+	ldap_explode_dn		@39
+	ldap_result		@40
+	ldap_msgfree		@41
+	ldap_search		@43
+	ldap_add_s		@44
+	ldap_bind_s		@45
+	ldap_unbind_s		@46
+	ldap_delete_s		@47
+	ldap_modify_s		@48
+	ldap_modrdn_s		@49
+	ldap_search_s		@50
+	ldap_search_st		@51
+	ldap_compare_s		@52
+	ldap_ufn_search_c		@53
+	ldap_ufn_search_s		@54
+	ldap_init_getfilter		@55
+	ldap_getfilter_free		@56
+	ldap_getfirstfilter		@57
+	ldap_getnextfilter		@58
+	ldap_simple_bind		@59
+	ldap_simple_bind_s		@60
+	ldap_bind		@61
+	ldap_friendly_name		@62
+	ldap_free_friendlymap		@63
+	ldap_ufn_search_ct		@64
+
+; 	ldap_set_cache_options		@65
+; 	ldap_uncache_request		@66
+
+	ldap_modrdn2		@67
+	ldap_modrdn2_s		@68
+	ldap_ufn_setfilter		@69
+	ldap_ufn_setprefix		@70
+	ldap_ufn_timeout		@71
+	ldap_init_getfilter_buf		@72
+	ldap_setfilteraffixes		@73
+	ldap_sort_entries		@74
+	ldap_sort_values		@75
+	ldap_sort_strcasecmp		@76
+	ldap_count_values_len		@77
+	ldap_name2template		@78
+	ldap_value_free_len		@79
+
+;  manually comment and uncomment these five as necessary
+; 	ldap_kerberos_bind1		@80
+; 	ldap_kerberos_bind2		@81
+; 	ldap_kerberos_bind_s		@82
+; 	ldap_kerberos_bind1_s		@83
+; 	ldap_kerberos_bind2_s		@84
+
+	ldap_init		@85
+	ldap_is_dns_dn		@86
+	ldap_explode_dns		@87
+	ldap_mods_free		@88
+
+	ldap_is_ldap_url		@89
+	ldap_free_urldesc		@90
+	ldap_url_parse		@91
+	ldap_url_search		@92
+	ldap_url_search_s		@93
+	ldap_url_search_st		@94
+	ldap_set_rebind_proc		@95
+	ber_skip_tag		@100
+	ber_peek_tag		@101
+	ber_get_int		@102
+	ber_get_stringb		@103
+	ber_get_stringa		@104
+	ber_get_stringal		@105
+	ber_get_bitstringa		@106
+	ber_get_null		@107
+	ber_get_boolean		@108
+	ber_first_element		@109
+	ber_next_element		@110
+	ber_scanf		@111
+	ber_bvfree		@112
+	ber_bvecfree		@113
+	ber_put_int		@114
+	ber_put_ostring		@115
+	ber_put_string		@116
+	ber_put_bitstring		@117
+	ber_put_null		@118
+	ber_put_boolean		@119
+	ber_start_seq		@120
+	ber_start_set		@121
+	ber_put_seq		@122
+	ber_put_set		@123
+	ber_printf		@124
+	ber_read		@125
+	ber_write		@126
+	ber_free		@127
+	ber_flush		@128
+	ber_alloc		@129
+	ber_dup		@130
+	ber_get_next		@131
+	ber_get_tag		@132
+	ber_put_enum		@133
+	der_alloc		@134
+	ber_alloc_t		@135
+	ber_bvdup		@136
+	ber_init_w_nullchar		@137
+	ber_reset		@138
+	ber_get_option		@139
+	ber_set_option		@140
+	ber_sockbuf_alloc		@141
+	ber_sockbuf_get_option		@142
+	ber_sockbuf_set_option		@143
+	ber_init		@144
+	ber_flatten		@145
+	ber_special_alloc		@146
+	ber_special_free		@147
+	ber_get_next_buffer		@148
+	ber_err_print		@149
+	ber_sockbuf_free		@150
+	ber_get_next_buffer_ext		@151
+	ber_svecfree		@152
+	ber_get_buf_datalen		@153
+	ber_get_buf_databegin		@154
+	ber_stack_init		@155
+	ber_sockbuf_free_data		@156
+
+	ldap_memfree		@200
+	ldap_ber_free		@201
+
+	ldap_init_searchprefs		@300
+	ldap_init_searchprefs_buf		@301
+	ldap_free_searchprefs		@302
+	ldap_first_searchobj		@303
+	ldap_next_searchobj		@304
+	ldap_build_filter		@305
+
+	ldap_init_templates		@400
+	ldap_init_templates_buf		@401
+	ldap_free_templates		@402
+	ldap_first_disptmpl		@403
+	ldap_next_disptmpl		@404
+	ldap_oc2template		@405
+	ldap_tmplattrs		@406
+	ldap_first_tmplrow		@407
+	ldap_next_tmplrow		@408
+	ldap_first_tmplcol		@409
+	ldap_next_tmplcol		@410
+	ldap_entry2text_search		@411
+	ldap_entry2text		@412
+	ldap_vals2text		@413
+	ldap_entry2html		@414
+	ldap_entry2html_search		@415
+	ldap_vals2html		@416
+	ldap_tmplerr2string		@417
+	ldap_set_option		@418
+	ldap_get_option		@419
+	ldap_charray_merge		@420
+	ldap_get_lderrno		@430
+	ldap_set_lderrno		@431
+	ldap_perror		@432
+	ldap_set_filter_additions		@433
+	ldap_create_filter		@434
+	ldap_version		@440
+	ldap_multisort_entries		@441
+	ldap_msgid		@442
+	ldap_explode_rdn		@443
+	ldap_msgtype		@444
+	ldap_cache_flush		@445
+	ldap_str2charray		@446
+	ldap_charray_add		@447
+	ldap_charray_dup		@448
+	ldap_charray_free		@449
+
+;  Windows ordinals 450-469 are reserved for SSL routines
+
+	ldap_charray_inlist		@470
+	ldap_charray_position		@471
+	ldap_rename		@472
+	ldap_rename_s		@473
+	ldap_utf8len		@474
+	ldap_utf8next		@475
+	ldap_utf8prev		@476
+	ldap_utf8copy		@477
+	ldap_utf8characters		@478
+	ldap_utf8strtok_r		@479
+	ldap_utf8isalnum		@480
+	ldap_utf8isalpha		@481
+	ldap_utf8isdigit		@482
+	ldap_utf8isxdigit		@483
+	ldap_utf8isspace		@484
+	ldap_control_free		@485
+	ldap_controls_free		@486
+	ldap_sasl_bind		@487
+	ldap_sasl_bind_s		@488
+	ldap_parse_sasl_bind_result		@489
+	ldap_sasl_interactive_bind_s		@490
+	ldap_sasl_interactive_bind_ext_s		@491
+;  LDAPv3 simple paging controls are not supported by Netscape at this time.
+;  490	ldap_create_page_control
+;  491	ldap_parse_page_control
+	ldap_create_sort_control		@492
+	ldap_parse_sort_control		@493
+;  an LDAPv3 language control was proposed but then retracted.
+;  494	ldap_create_language_control
+	ldap_get_lang_values		@495
+	ldap_get_lang_values_len		@496
+	ldap_free_sort_keylist		@497
+	ldap_create_sort_keylist		@498
+	ldap_utf8getcc		@499
+	ldap_get_entry_controls		@500
+	ldap_create_persistentsearch_control		@501
+	ldap_parse_entrychange_control		@502
+	ldap_parse_result		@503
+	ldap_parse_extended_result		@504
+	ldap_parse_reference		@505
+	ldap_abandon_ext		@506
+	ldap_add_ext		@507
+	ldap_add_ext_s		@508
+	ldap_modify_ext		@509
+	ldap_modify_ext_s		@510
+	ldap_first_message		@511
+	ldap_next_message		@512
+	ldap_compare_ext		@513
+	ldap_compare_ext_s		@514
+	ldap_delete_ext		@515
+	ldap_delete_ext_s		@516
+	ldap_search_ext		@517
+	ldap_search_ext_s		@518
+	ldap_extended_operation		@519
+	ldap_extended_operation_s		@520
+	ldap_first_reference		@521
+	ldap_next_reference		@522
+	ldap_count_references		@523
+	ldap_count_messages		@524
+	ldap_create_virtuallist_control		@525
+	ldap_parse_virtuallist_control		@526
+	ldap_create_proxyauth_control		@527
+	ldap_unbind_ext		@528
+	ldap_x_hostlist_first		@529
+	ldap_x_hostlist_next		@530
+	ldap_x_hostlist_statusfree		@531
+	ldap_x_malloc		@532
+	ldap_x_calloc		@533
+	ldap_x_realloc		@534
+	ldap_x_free		@535
+; 
+	ldap_create_proxiedauth_control		@536
+; 
+	ldap_create_geteffectiveRights_control		@537
+; 
+	ldap_find_control		@538
+; 
+	ldap_url_parse_no_defaults		@539
+; 
+	ldap_create_userstatus_control		@550
+	ldap_parse_userstatus_control		@551
+; 
+	ldap_create_passwordpolicy_control		@560
+	ldap_create_passwordpolicy_control_ext		@561
+	ldap_parse_passwordpolicy_control		@562
+	ldap_parse_passwordpolicy_control_ext		@563
+	ldap_passwordpolicy_err2txt		@564
+; 
+	ldap_passwd		@570
+	ldap_parse_passwd		@571
+	ldap_passwd_s		@573
+; 
+	ldap_delete_result_entry		@580
+	ldap_add_result_entry		@581
+; 
+	ldap_whoami		@590
+	ldap_parse_whoami		@591
+	ldap_whoami_s		@592
+; 
+	ldap_create_authzid_control		@600
+	ldap_parse_authzid_control		@601
+; 
+	ldap_memcache_init		@1000
+	ldap_memcache_set		@1001
+	ldap_memcache_get		@1002
+	ldap_memcache_flush		@1003
+	ldap_memcache_destroy		@1004
+	ldap_memcache_update		@1005
+	ldap_keysort_entries		@1006
+; 
+; end of generated exports list.
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libldap/moz.build
@@ -0,0 +1,88 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+SharedLibrary(get_ldap_name('ldap'))
+
+SOURCES += [
+    'abandon.c',
+    'add.c',
+    'authzidctrl.c',
+    'bind.c',
+    'cache.c',
+    'charray.c',
+    'charset.c',
+    'compare.c',
+    'compat.c',
+    'control.c',
+    'countvalues.c',
+    'delete.c',
+    'disptmpl.c',
+    'dsparse.c',
+    'error.c',
+    'extendop.c',
+    'free.c',
+    'freevalues.c',
+    'friendly.c',
+    'getattr.c',
+    'getdn.c',
+    'getdxbyname.c',
+    'geteffectiverightsctrl.c',
+    'getentry.c',
+    'getfilter.c',
+    'getoption.c',
+    'getvalues.c',
+    'memcache.c',
+    'message.c',
+    'modify.c',
+    'open.c',
+    'os-ip.c',
+    'proxyauthctrl.c',
+    'psearch.c',
+    'pwmodext.c',
+    'pwpctrl.c',
+    'referral.c',
+    'regex.c',
+    'rename.c',
+    'request.c',
+    'reslist.c',
+    'result.c',
+    'saslbind.c',
+    'sbind.c',
+    'search.c',
+    'setoption.c',
+    'sort.c',
+    'sortctrl.c',
+    'srchpref.c',
+    'tmplout.c',
+    'ufn.c',
+    'unbind.c',
+    'unescape.c',
+    'url.c',
+    'userstatusctrl.c',
+    'utf8.c',
+    'vlistctrl.c',
+    'whoami.c',
+]
+
+if CONFIG['OS_TARGET'] == 'WINNT':
+    SOURCES += [
+        'dllmain.c',
+        'mozock.c',
+    ]
+    DEFFILE = SRCDIR + '/libldap.def'
+
+if CONFIG['OS_TARGET'] != 'WINNT':
+    DEFINES['USE_WAITPID'] = True
+    DEFINES['USE_PTHREADS'] = True
+
+DEFINES['NEEDPROTOS'] = True
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
+
+USE_LIBS += [get_ldap_name('lber')]
deleted file mode 100644
--- a/ldap/c-sdk/libraries/libldif/Makefile.in
+++ /dev/null
@@ -1,166 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-MOD_DEPTH = ../../..
-srcdir = @srcdir@
-topsrcdir = @top_srcdir@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-SRCS		= line64.c
-
-RELEASE_LIBS    = $(SHARED_LIBRARY) $(DLLLDIF)
-
-REALOBJS	= $(SRCS:.c=.$(OBJ_SUFFIX))
-OBJS		= $(addprefix $(OBJDIR_NAME)/, $(REALOBJS))
-
-HDIR		= $(topsrcdir)/ldap/include
-
-LIBLDIF		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDIF_LIBNAME).$(LIB_SUFFIX))
-DLLLDIF         = $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDIF_LIBNAME).$(DLL_SUFFIX))
-
-INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-
-include $(topsrcdir)/config/rules.mk
-
-GARBAGE 	+= $(LIBLDIF) $(DLLLDIF)
-
-LOCAL_INCLUDES  = -I$(PUBLIC)/nspr
-INCLUDES	+= -I$(HDIR) -I$(INSTALLDIR)/include -I$(DIST)/include
-DEFINES		+= $(DEFS)
-
-PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
-PLATFORMLIBS	=
-THREADS		=
-THREADSLIB	=
-
-ifeq ($(OS_ARCH), AIX)
-PLATFORMLIBS	+= -ldl -brtl -lpthreads -lc_r -lm
-endif
-
-#
-# shared library symbol export definitions
-#
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-ifeq ($(OS_ARCH), WINNT)
-GENEXPORTS=cmd /c  $(PERL) $(topsrcdir)/ldap/build/genexports.pl
-else
-GENEXPORTS=$(PERL) $(topsrcdir)/ldap/build/genexports.pl
-endif
-
-# variable definitions for exported symbols
-ifeq ($(OS_ARCH), WINNT)
-        LDIF_EXPORT_DEFS= $(WIN_TOP_SRC)/ldap/libraries/msdos/winsock/nsldif32.def
-else
-ifeq ($(OS_ARCH), OS2)
-        LDIF_EXPORT_DEFS= $(OBJDIR_NAME)/libldif.def
-else
-        LDIF_EXPORT_DEFS= $(OBJDIR_NAME)/libldif.exp
-endif
-GARBAGE += $(LDIF_EXPORT_DEFS)
-endif
-
-LDIF_EXPORT_FLAGS=$(addprefix $(DLLEXPORTS_PREFIX), $(LDIF_EXPORT_DEFS))
-
-GENEXPARGS=$(BUILD_DEBUG) $(LDIFVERS_SUFFIX) $(LDIFVERS)
-endif # USE_DLL_EXPORTS_FILE
-
-
-###########################################################################
-
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-# recursive gmake rule to create exported symbols file
-$(LDIF_EXPORT_DEFS):: $(srcdir)/../libldif.ex
-ifeq ($(OS_ARCH), WINNT)
-	$(GENEXPORTS) Win32 $(srcdir)/../msdos/winsock/nsldif32.tdf $< $(GENEXPARGS) > $@
-else
-ifeq ($(OS_ARCH), OS2)
-	echo LIBRARY $(LDIF_LIBNAME) INITINSTANCE TERMINSTANCE > $@
-	echo PROTMODE >> $@
-	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
-	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
-	echo EXPORTS >> $@
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) >> $@
-else
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) > $@
-endif
-endif
-endif # USE_DLL_EXPORTS_FILE
-
-versiont.c:	Makefile.client Version.c
-	@$(RM) $@
-	@(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \
-	h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Version.c > $@)
-
-export::    $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF)
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBLDIF): $(OBJS) $(LIBDIR)
-	@echo ======= making $(LIBLDIF)
-
-	$(LINK_LIB)
-
-$(DLLLDIF): $(OBJS) $(LIBDIR) $(LDIF_EXPORT_DEFS)
-	@echo ======= making $(DLLLDIF)
-
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-
-	$(LINK_DLL) $(LDIF_EXPORT_FLAGS) $(PLATFORMLIBS) $(EXTRA_LIBS)
-
-
-veryclean:: clean
-
-$(OBJDEST):
-	$(MKDIR) $(OBJDEST)
-
-export::	$(DLLLDIF) $(LIBLDIF)
-	$(INSTALL) -m 444 $(LIBLDIF) $(dist_libdir)
-
-ifdef MKSHLIB
-	$(INSTALL) -m 444 $(LIBLDIF) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLLDIF) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLLDIF) $(dist_bindir)
-endif
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libldif/libldif.def
@@ -0,0 +1,63 @@
+;
+; ***** BEGIN LICENSE BLOCK *****
+; Version: MPL 1.1/GPL 2.0/LGPL 2.1
+; 
+; The contents of this file are subject to the Mozilla Public License Version 
+; 1.1 (the "License"); you may not use this file except in compliance with 
+; the License. You may obtain a copy of the License at 
+; http://www.mozilla.org/MPL/
+; 
+; Software distributed under the License is distributed on an "AS IS" basis,
+; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+; for the specific language governing rights and limitations under the
+; License.
+; 
+; The Original Code is Mozilla Communicator client code.
+; 
+; The Initial Developer of the Original Code is
+; Netscape Communications Corporation.
+; Portions created by the Initial Developer are Copyright (C) 1996-1999
+; the Initial Developer. All Rights Reserved.
+; 
+; Contributor(s):
+; 
+; Alternatively, the contents of this file may be used under the terms of
+; either of the GNU General Public License Version 2 or later (the "GPL"),
+; or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+; in which case the provisions of the GPL or the LGPL are applicable instead
+; of those above. If you wish to allow use of your version of this file only
+; under the terms of either the GPL or the LGPL, and not to allow others to
+; use your version of this file under the terms of the MPL, indicate your
+; decision by deleting the provisions above and replace them with the notice
+; and other provisions required by the GPL or the LGPL. If you do not delete
+; the provisions above, a recipient may use your version of this file under
+; the terms of any one of the MPL, the GPL or the LGPL.
+; 
+; ***** END LICENSE BLOCK ***** 
+
+LIBRARY         NSLDIF32V60
+DESCRIPTION     'Lightweight Directory Access Protocol LDIF Client API for 32-bit Windows'
+VERSION		6.0
+HEAPSIZE        4096
+
+EXPORTS
+; we need to manually assign ordinal numbers so we can add new routines
+; and not disturb the ordinals and thus not require callers to relink.
+; 
+; exports list (generated by genexports.pl)
+; 
+
+	ldif_parse_line		@3001
+	ldif_getline		@3002
+	ldif_put_type_and_value		@3003
+	ldif_put_type_and_value_nowrap		@3004
+	ldif_put_type_and_value_with_options		@3005
+	ldif_type_and_value		@3006
+	ldif_type_and_value_nowrap		@3007
+	ldif_type_and_value_with_options		@3008
+	ldif_base64_decode		@3009
+	ldif_base64_encode		@3010
+	ldif_base64_encode_nowrap		@3011
+	ldif_get_entry		@3012
+; 
+; end of generated exports list.
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libldif/moz.build
@@ -0,0 +1,23 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+SharedLibrary(get_ldap_name('ldif'))
+
+SOURCES += [
+    'line64.c'
+]
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DEFFILE = SRCDIR + '/libldif.def'
+
+DEFINES['USE_WAITPID'] = True
+DEFINES['NEEDPROTOS'] = True
+
deleted file mode 100644
--- a/ldap/c-sdk/libraries/libprldap/Makefile.in
+++ /dev/null
@@ -1,250 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is Mozilla Communicator client code, released
-# March 31, 1998.
-# 
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-MOD_DEPTH	= ../../..
-srcdir		= @srcdir@
-topsrcdir 	= @top_srcdir@
-NSPR_LIBS   = @NSPR_LIBS@
-NSPR_CFLAGS = @NSPR_CFLAGS@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-SRCS		= ldappr-dns.c \
-		  ldappr-error.c \
-		  ldappr-io.c \
-		  ldappr-public.c \
-		  ldappr-threads.c
-
-REALOBJS        = $(SRCS:.c=.$(OBJ_SUFFIX))
-OBJS		= $(addprefix $(OBJDIR_NAME)/, $(REALOBJS)) 
-
-DISTHDIR	= $(DIST)/public/ldap
-HDIR		= $(topsrcdir)/ldap/include
-
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
-LIBPRLDAP	= $(addprefix $(OBJDIR_NAME)/, \
-			$(LIB_PREFIX)$(PRLDAP_LIBNAME).$(LIB_SUFFIX))
-else
-LIBPRLDAP =
-endif
-DLLPRLDAP	= $(addprefix $(OBJDIR_NAME)/, \
-			$(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
-
-INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-
-RELEASE_LIBS	= $(DLLPRLDAP)
-
-include $(topsrcdir)/config/rules.mk
-
-GARBAGE 	+= $(LIBPRLDAP) $(DLLPRLDAP)
-
-LOCAL_INCLUDES  =
-INCLUDES	+= -I$(DISTHDIR) -I$(HDIR) -I$(INSTALLDIR)/include \
-                   $(NSPR_CFLAGS)
-DEFINES		+= $(DEFS)
-
-PLATFORMCFLAGS	= -DUSE_WAITPID -DNEEDPROTOS
-PLATFORMLIBS	=
-THREADS		=
-THREADSLIB	=
-
-#
-# shared library symbol export definitions
-#
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-ifeq ($(OS_ARCH), WINNT)
-GENEXPORTS=cmd /c  $(PERL) $(topsrcdir)/ldap/build/genexports.pl
-else
-GENEXPORTS=$(PERL) $(topsrcdir)/ldap/build/genexports.pl
-endif
-
-# variable definitions for exported symbols
-ifeq ($(OS_ARCH), WINNT)
-        PRLDAP_EXPORT_DEFS= $(WIN_TOP_SRC)/ldap/libraries/msdos/winsock/nsldappr32.def
-else
-ifeq ($(OS_ARCH), OS2)
-        PRLDAP_EXPORT_DEFS= $(OBJDIR_NAME)/libprldap.def
-else
-        PRLDAP_EXPORT_DEFS= $(OBJDIR_NAME)/libprldap.exp
-endif
-GARBAGE += $(LDAP_EXPORT_DEFS)
-endif
-
-PRLDAP_EXPORT_FLAGS=$(addprefix $(DLLEXPORTS_PREFIX), $(PRLDAP_EXPORT_DEFS))
-
-GENEXPARGS=$(BUILD_DEBUG) $(PRLDAPVERS_SUFFIX) $(PRLDAPVERS)
-endif # USE_DLL_EXPORTS_FILE
-
-ifeq ($(OS_ARCH), WINNT)
-ifdef NS_USE_GCC
-EXTRA_DLL_LIBS =-L$(dist_libdir) -l$(LDAP_LIBNAME) \
-	$(NSPRLINK)
-else
-EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
-            comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
-            rpcrt4.lib uuid.lib winmm.lib
-EXTRA_LIBS += $(dist_libdir)/$(LDAP_LIBNAME).lib
-EXTRA_LIBS += $(NSPRLINK)
-endif
-CUSTOM_LIBS=1
-endif
-
-ifeq ($(OS_ARCH),OS2)
-EXTRA_LIBS = $(dist_libdir)/$(LDAP_LIBNAME).lib
-EXTRA_LIBS += $(dist_libdir)/$(LBER_LIBNAME).lib
-EXTRA_LIBS += $(NSPRLINK)
-EXTRA_LIBS += $(OS_LIBS)
-CUSTOM_LIBS=1
-endif
-
-ifeq ($(OS_ARCH), OSF1)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
-EXTRA_LIBS += $(NSPRLINK)
-EXTRA_LIBS += -lcxx -lpthread -lrt -lmach -lexc
-CUSTOM_LIBS=1
-endif
-
-ifeq ($(OS_ARCH), AIX)
-EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
-EXTRA_LIBS += $(NSPRLINK)
-EXTRA_LIBS += -ldl -brtl -lpthreads -lc_r -lm
-CUSTOM_LIBS=1
-endif
-
-# no extra libs on HP-UX
-ifeq ($(OS_ARCH), HP-UX)
-CUSTOM_LIBS=1
-endif
-
-# if you need to do something extra for extra_libs or extra_dll_libs for a
-# specific platform, do them above according the other ones for WINNT, OS2, etc.
-# then define CUSTOM_LIBS=1 - if you just want the standard ones as defined
-# below, you don't have to do anything
-ifndef CUSTOM_LIBS
-EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
-EXTRA_LIBS += $(NSPRLINK)
-endif
-
-OBJDEST = $(OBJDIR_NAME)
-
-###########################################################################
-
-ifeq ($(USE_DLL_EXPORTS_FILE), 1)
-# recursive gmake rule to create exported symbols file
-$(PRLDAP_EXPORT_DEFS):: $(srcdir)/libprldap.ex
-ifeq ($(OS_ARCH), WINNT)
-	$(GENEXPORTS) Win32 $(srcdir)/../msdos/winsock/nsldappr32.tdf $< $(GENEXPARGS) > $@
-else
-ifeq ($(OS_ARCH), OS2)
-	echo LIBRARY $(PRLDAP_LIBNAME) INITINSTANCE TERMINSTANCE > $@
-	echo PROTMODE >> $@
-	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
-	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
-	echo EXPORTS >> $@
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) >> $@
-else
-	$(GENEXPORTS) $(OS_ARCH) Standard $< $(GENEXPARGS) > $@
-endif
-endif
-endif # USE_DLL_EXPORTS_FILE
-
-versiont.c:	Makefile.client Version.c
-	@$(RM) $@
-	@(u="$${USER-root}" v="$(shell cat ../../build/version)" d="$(shell pwd)" \
-	h="$(shell hostname)" t="$(shell date)"; $(SED) -e "s|%WHEN%|$${t}|" \
-	-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
-	-e "s|%VERSION%|$${v}|" \
-	< Version.c > $@)
-
-export::    $(OBJDEST) $(LIBDIR) $(OBJS) $(DLLPRLDAP)
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBPRLDAP): $(OBJS) $(LIBDIR) $(PRLDAP_EXPORT_DEFS)
-	@echo ======= making $(LIBPRLDAP)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-ifeq ($(OS_ARCH),OS2)
-# create import library for OS/2
-	rm -f $@
-	$(IMPLIB) $@ $(PRLDAP_EXPORT_DEFS)
-else
-	$(LINK_LIB) $(EXTRA_LIBS)
-endif
-
-$(DLLPRLDAP): $(OBJS) $(LIBDIR) $(PRLDAP_EXPORT_DEFS)
-	@echo ======= making $(DLLPRLDAP)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-	$(LINK_DLL) $(PRLDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
-
-veryclean:: clean
-
-$(OBJDEST):
-	$(MKDIR) $(OBJDEST)
-
-# the $(dist_bindir) line is for the mozilla client, which for reasons
-# unknown wants shared libraries in /bin also
-#
-# Set the default sources for the export target
-EXPDEPS2 = $(LIBPRLDAP) $(DLLPRLDAP)	
-# Remove the LIB source if on win32 and using MSVC
-# This avoids problems with -jX builds where 'link' will make both the
-# .dll and .lib files in one pass
-ifeq ($(OS_ARCH), WINNT)
-ifeq ($(LD),link)
-EXPDEPS2 = $(DLLPRLDAP)	
-endif
-endif
-
-export::	$(EXPDEPS2)
-ifeq ($(OS_ARCH), WINNT)
-	$(INSTALL) -m 555 $(LIBPRLDAP) $(dist_libdir)
-	$(INSTALL) -m 555 $(DLLPRLDAP) $(dist_libdir)
-endif
-ifeq ($(OS_ARCH),OS2)
-	$(INSTALL) -m 444 $(LIBPRLDAP) $(dist_libdir)
-endif
-ifdef MKSHLIB
-	$(INSTALL) -m 555 $(DLLPRLDAP) $(dist_libdir)
-	$(INSTALL) -m 444 $(DLLPRLDAP) $(dist_bindir)
-endif
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libprldap/libprldap.def
@@ -0,0 +1,63 @@
+;
+; ***** BEGIN LICENSE BLOCK *****
+; Version: MPL 1.1/GPL 2.0/LGPL 2.1
+; 
+; The contents of this file are subject to the Mozilla Public License Version 
+; 1.1 (the "License"); you may not use this file except in compliance with 
+; the License. You may obtain a copy of the License at 
+; http://www.mozilla.org/MPL/
+; 
+; Software distributed under the License is distributed on an "AS IS" basis,
+; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+; for the specific language governing rights and limitations under the
+; License.
+; 
+; The Original Code is Mozilla Communicator client code.
+; 
+; The Initial Developer of the Original Code is
+; Netscape Communications Corporation.
+; Portions created by the Initial Developer are Copyright (C) 1996-1999
+; the Initial Developer. All Rights Reserved.
+; 
+; Contributor(s):
+; 
+; Alternatively, the contents of this file may be used under the terms of
+; either of the GNU General Public License Version 2 or later (the "GPL"),
+; or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+; in which case the provisions of the GPL or the LGPL are applicable instead
+; of those above. If you wish to allow use of your version of this file only
+; under the terms of either the GPL or the LGPL, and not to allow others to
+; use your version of this file under the terms of the MPL, indicate your
+; decision by deleting the provisions above and replace them with the notice
+; and other provisions required by the GPL or the LGPL. If you do not delete
+; the provisions above, a recipient may use your version of this file under
+; the terms of any one of the MPL, the GPL or the LGPL.
+; 
+; ***** END LICENSE BLOCK ***** 
+
+LIBRARY         NSLDAPPR32V60
+DESCRIPTION     'LDAP to NSPR glue library for 32-bit Windows'
+VERSION		6.0
+HEAPSIZE        4096
+
+EXPORTS
+; we need to manually assign ordinal numbers so we can add new routines
+; and not disturb the ordinals and thus not require callers to relink.
+; 
+; exports list (generated by genexports.pl)
+; 
+
+	prldap_init		@2010
+	prldap_install_routines		@2011
+	prldap_set_session_info		@2012
+	prldap_get_session_info		@2013
+	prldap_set_socket_info		@2014
+	prldap_get_socket_info		@2015
+	prldap_set_session_option		@2016
+	prldap_get_session_option		@2017
+	prldap_is_installed		@2018
+	prldap_import_connection		@2019
+	prldap_set_default_socket_info		@2020
+	prldap_get_default_socket_info		@2021
+; 
+; end of generated exports list.
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libprldap/moz.build
@@ -0,0 +1,31 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+SharedLibrary('nsldappr32v60' if CONFIG['OS_ARCH'] == 'WINNT' else 'prldap60')
+
+SOURCES += [
+    'ldappr-dns.c',
+    'ldappr-error.c',
+    'ldappr-io.c',
+    'ldappr-public.c',
+    'ldappr-threads.c',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DEFFILE = SRCDIR + '/libprldap.def'
+
+DEFINES['USE_WAITPID'] = True
+DEFINES['NEEDPROTOS'] = True
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
+
+USE_LIBS += [
+    get_ldap_name('ldap'),
+    'nspr'
+]
deleted file mode 100644
--- a/ldap/c-sdk/libraries/libutil/Makefile.in
+++ /dev/null
@@ -1,85 +0,0 @@
-# 
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-# 
-# The contents of this file are subject to the Mozilla Public License Version 
-# 1.1 (the "License"); you may not use this file except in compliance with 
-# the License. You may obtain a copy of the License at 
-# http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-# 
-# The Original Code is mozilla.org code.
-# 
-# The Initial Developer of the Original Code is
-#   Rich Megginson <richm@stanfordalumni.org>
-# Portions created by the Initial Developer are Copyright (C) 2006
-# the Initial Developer. All Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-# 
-# ***** END LICENSE BLOCK ***** 
-
-
-
-MOD_DEPTH	= ../../..
-srcdir		= @srcdir@
-topsrcdir 	= @top_srcdir@
-
-include $(MOD_DEPTH)/config/autoconf.mk
-include $(topsrcdir)/build.mk
-
-SRCS = getopt.c
-
-REALOBJS        = $(SRCS:.c=.$(OBJ_SUFFIX))
-
-UTILOBJDEST	= $(OBJDIR_NAME)
-OBJS		= $(addprefix $(UTILOBJDEST)/, $(REALOBJS))
-
-DISTHDIR	= $(DIST)/public/ldap
-HDIR		= $(topsrcdir)/ldap/include
-
-LIBUTIL	= $(addprefix $(UTILOBJDEST)/, \
-		  $(LIB_PREFIX)$(UTIL_LIBNAME).$(LIB_SUFFIX))
-
-INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-
-include $(topsrcdir)/config/rules.mk
-
-DEFINES		+= $(DEFS)
-
-
-export::    $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBUTIL)
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(LIBUTIL): $(OBJS) $(LIBDIR)
-	@echo ======= making $(LIBUTIL)
-ifdef SO_FILES_TO_REMOVE
-	-$(RM) $(SO_FILES_TO_REMOVE)
-endif
-	$(LINK_LIB)
-
-veryclean:: clean
-
-$(OBJDEST):
-	$(MKDIR) $(OBJDEST)
-
-export::	$(LIBUTIL)
-	$(INSTALL) -m 444 $(LIBUTIL) $(dist_libdir)
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/libutil/moz.build
@@ -0,0 +1,16 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/ldap/ldap-sdk.mozbuild')
+
+Library(get_ldap_name('util'))
+
+SOURCES += [
+    'getopt.c',
+]
+
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include'
+]
new file mode 100644
--- /dev/null
+++ b/ldap/c-sdk/libraries/moz.build
@@ -0,0 +1,16 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+DIRS += [
+    'liblber',
+    'libldif',
+    'libiutil',
+    'libldap',
+    'libprldap'
+]
+ 
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DIRS += ['libutil']
+ 
new file mode 100644
--- /dev/null
+++ b/ldap/ldap-sdk.mozbuild
@@ -0,0 +1,30 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+NO_VISIBILITY_FLAGS = True
+DISABLE_STL_WRAPPING = True
+
+if CONFIG['OS_TARGET'] == 'Linux':
+    DEFINES['LINUX'] = 1
+    DEFINES['LINUX2_0'] = True
+    DEFINES['linux'] = 1
+elif CONFIG['OS_TARGET'] == 'Darwin':
+    DEFINES["DARWIN"] = 1
+elif CONFIG['OS_TARGET'] in ('OpenBSD', 'FreeBSD', 'NetBSD'):
+    DEFINES[CONFIG['OS_TARGET'].upper()] = True
+elif CONFIG['OS_ARCH'] == 'WINNT':
+    DEFINES['_WINDOWS'] = True
+
+DEFINES['_PR_PTHREADS'] = True
+DEFINES['NET_SSL'] = True
+DEFINES['NS_DOMESTIC'] = True
+
+if CONFIG['MOZ_DEBUG']:
+    DEFINES['LDAP_DEBUG'] = True
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+    get_ldap_name = lambda simple: 'ns%s32v60' % simple
+else:
+    get_ldap_name = lambda simple: '%s60' % simple
--- a/ldap/moz.build
+++ b/ldap/moz.build
@@ -1,21 +1,23 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 Library('ldapsdks')
 
-USE_LIBS += ['nspr']
+DIRS += [
+    'c-sdk/libraries'
+]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     USE_LIBS += [
-        '/ldap/sdks/c-sdk/ldap/libraries/libldap/nsldap32v60',
-        '/ldap/sdks/c-sdk/ldap/libraries/libldif/nsldif32v60',
-        '/ldap/sdks/c-sdk/ldap/libraries/libprldap/nsldappr32v60',
+        'nsldap32v60',
+        'nsldappr32v60',
+        'nsldif32v60',
     ]
 else:
     USE_LIBS += [
-        '/ldap/sdks/c-sdk/ldap/libraries/libldap/ldap60',
-        '/ldap/sdks/c-sdk/ldap/libraries/libldif/ldif60',
-        '/ldap/sdks/c-sdk/ldap/libraries/libprldap/prldap60',
+        'ldap60',
+        'ldif60',
+        'prldap60',
     ]
--- a/ldap/xpcom/src/Makefile.in
+++ b/ldap/xpcom/src/Makefile.in
@@ -11,10 +11,8 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 ifdef MOZ_PREF_EXTENSIONS
 DEFINES += -DMOZ_PREF_EXTENSIONS
 endif
 
 include $(topsrcdir)/config/rules.mk
 
-LOCAL_INCLUDES	= $(LDAP_CFLAGS)
-
--- a/ldap/xpcom/src/moz.build
+++ b/ldap/xpcom/src/moz.build
@@ -41,8 +41,12 @@ if CONFIG['MOZ_INCOMPLETE_EXTERNAL_LINKA
 # is discarded when it comes first.
     USE_LIBS += [
         'js',
     ]
 else:
     Library('mozldap')
     FINAL_LIBRARY = 'xul'
 
+LOCAL_INCLUDES += [
+    '/ldap/c-sdk/include',
+]
+
--- a/mail/configure.in
+++ b/mail/configure.in
@@ -45,22 +45,17 @@ AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 dnl =========================================================
 dnl = LDAP
 dnl =========================================================
 MOZ_ARG_DISABLE_BOOL(ldap,
 [  --disable-ldap          Disable LDAP support],
     MOZ_LDAP_XPCOM=,
     MOZ_LDAP_XPCOM=1)
 
-if test "$MOZ_LDAP_XPCOM"; then
-    LDAP_CFLAGS='-I${DIST}/public/ldap'
-fi
-
 AC_SUBST(MOZ_LDAP_XPCOM)
-AC_SUBST(LDAP_CFLAGS)
 
 dnl =========================================================
 dnl = MAPI support (Windows only)
 dnl =========================================================
 
 if test "$_WIN32_MSVC"; then
     MOZ_MAPI_SUPPORT=1
 fi
@@ -69,38 +64,8 @@ MOZ_ARG_DISABLE_BOOL(mapi,
 [  --disable-mapi          Disable MAPI support],
     MOZ_MAPI_SUPPORT= )
 
 AC_SUBST(MOZ_MAPI_SUPPORT)
 
 if test -n "$MOZ_MAPI_SUPPORT"; then
     AC_DEFINE(MOZ_MAPI_SUPPORT)
 fi
-
-# if we're building the LDAP XPCOM component, we need to build
-# the c-sdk first.
-if test -n "$COMPILE_ENVIRONMENT" -a -n "$MOZ_LDAP_XPCOM"; then
-    # Save configure args so we can restore them after configuring LDAP.
-    _save_ac_configure_args="$ac_configure_args"
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-
-    mkdir -p ldap/sdks/c-sdk/ldap
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
-    if test -n "$HAVE_64BIT_BUILD"; then
-        dnl A 64-bit OS was (auto-)detected: (explicitly) enable 64-bit support.
-        ac_configure_args="$ac_configure_args --enable-64bit"
-    fi
-    if test -n "$LIBXUL_SDK"; then
-        ac_configure_args="$ac_configure_args --with-nspr=$LIBXUL_DIST"
-    fi
-
-    dnl Explicitly disable the DEBUG RTL
-    if test -n "$MOZ_NO_DEBUG_RTL"; then
-      ac_configure_args="$ac_configure_args --disable-debug-rtl"
-    fi
-
-    dnl The cache file needs to be an absolute path to work properly.
-    cache_file_base=`dirname $cache_file`
-    cache_file=`cd $cache_file_base && pwd`/`basename $cache_file`
-
-    AC_OUTPUT_SUBDIRS(ldap/sdks/c-sdk)
-    ac_configure_args="$_save_ac_configure_args"
-fi # COMPILE_ENVIRONMENT && MOZ_LDAP_XPCOM
--- a/suite/configure.in
+++ b/suite/configure.in
@@ -45,22 +45,17 @@ AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE
 dnl =========================================================
 dnl = LDAP
 dnl =========================================================
 MOZ_ARG_DISABLE_BOOL(ldap,
 [  --disable-ldap          Disable LDAP support],
     MOZ_LDAP_XPCOM=,
     MOZ_LDAP_XPCOM=1)
 
-if test "$MOZ_LDAP_XPCOM"; then
-    LDAP_CFLAGS='-I${DIST}/public/ldap'
-fi
-
 AC_SUBST(MOZ_LDAP_XPCOM)
-AC_SUBST(LDAP_CFLAGS)
 
 dnl =========================================================
 dnl = MAPI support (Windows only)
 dnl =========================================================
 
 if test "$_WIN32_MSVC"; then
     MOZ_MAPI_SUPPORT=1
 fi
@@ -69,34 +64,8 @@ MOZ_ARG_DISABLE_BOOL(mapi,
 [  --disable-mapi          Disable MAPI support],
     MOZ_MAPI_SUPPORT= )
 
 AC_SUBST(MOZ_MAPI_SUPPORT)
 
 if test -n "$MOZ_MAPI_SUPPORT"; then
     AC_DEFINE(MOZ_MAPI_SUPPORT)
 fi
-
-# if we're building the LDAP XPCOM component, we need to build
-# the c-sdk first.
-if test -n "$COMPILE_ENVIRONMENT" -a -n "$MOZ_LDAP_XPCOM"; then
-    # Save configure args so we can restore them after configuring LDAP.
-    _save_ac_configure_args="$ac_configure_args"
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-
-    mkdir -p ldap/sdks/c-sdk/ldap
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
-    if test -n "$HAVE_64BIT_BUILD"; then
-        dnl A 64-bit OS was (auto-)detected: (explicitly) enable 64-bit support.
-        ac_configure_args="$ac_configure_args --enable-64bit"
-    fi
-    if test -n "$LIBXUL_SDK"; then
-        ac_configure_args="$ac_configure_args --with-nspr=$LIBXUL_DIST"
-    fi
-
-    dnl The cache file needs to be an absolute path to work properly.
-    cache_file_base=`dirname $cache_file`
-    cache_file=`cd $cache_file_base && pwd`/`basename $cache_file`
-
-    AC_OUTPUT_SUBDIRS(ldap/sdks/c-sdk)
-    ac_configure_args="$_save_ac_configure_args"
-fi # COMPILE_ENVIRONMENT && MOZ_LDAP_XPCOM
-