summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-01-19 15:38:05 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-01-22 16:17:17 +0100
commit4bcd5c31904550af2fc78f9863980494cfccd52d (patch)
treedfe33b3753286d263bc69510b1a4ff22402d6a7e /external
parentb510f403f9fb9e429ffe9faccf78808d64c5f8b5 (diff)
postgresql: upgrade to release 13.1
Fixes CVE-2020-25694, plus a bunch more CVE that don't look relevant. * --with-krb5 no longer exists, neither does --disable-shared * remove internal-zlib.patch.1: zlib is only used by pg_* tools / contrib/pgcrypto * remove postgresql-libs-leak.patch: some relic from pre-gbuild times, not clear what the point is for static libs * remove postgresql-9.2.1-libreoffice.patch: another dmake .mk file relic, and the win32 nmake build system was removed * add postgres-msvc-build.patch.1 to fix Cygwin perl and openssl * on WNT, libpq.dll is now built, no longer static lib postgresql: fix mistake in RepositoryExternal.mk Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109640 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 234833f7823a1424b62c93e145f0cfe2c6b6efd5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109698 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> (cherry picked from commit 1362bf7fa2957d34a7cef18dd95ede22cc42787f) Change-Id: Ic0232a28801b2f604d9f4e33d5621ae3362defaa
Diffstat (limited to 'external')
-rw-r--r--external/postgresql/ExternalPackage_postgresql.mk16
-rw-r--r--external/postgresql/ExternalProject_postgresql.mk16
-rw-r--r--external/postgresql/Module_postgresql.mk6
-rw-r--r--external/postgresql/UnpackedTarball_postgresql.mk12
-rw-r--r--external/postgresql/config.pl1
-rw-r--r--external/postgresql/internal-zlib.patch.129
-rw-r--r--external/postgresql/postgres-msvc-build.patch.1110
-rw-r--r--external/postgresql/postgresql-9.2.1-autoreconf.patch521
-rw-r--r--external/postgresql/postgresql-9.2.1-libreoffice.patch74
-rw-r--r--external/postgresql/postgresql-libs-leak.patch40
10 files changed, 145 insertions, 680 deletions
diff --git a/external/postgresql/ExternalPackage_postgresql.mk b/external/postgresql/ExternalPackage_postgresql.mk
new file mode 100644
index 000000000000..f6c9a9bb6deb
--- /dev/null
+++ b/external/postgresql/ExternalPackage_postgresql.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,postgresql,postgresql))
+
+$(eval $(call gb_ExternalPackage_use_external_project,postgresql,postgresql))
+
+$(eval $(call gb_ExternalPackage_add_file,postgresql,$(LIBO_LIB_FOLDER)/libpq.dll,$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)/libpq/libpq.dll))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/ExternalProject_postgresql.mk b/external/postgresql/ExternalProject_postgresql.mk
index f6617e52fcd8..1e0c7d848047 100644
--- a/external/postgresql/ExternalProject_postgresql.mk
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_ExternalProject_ExternalProject,postgresql))
$(eval $(call gb_ExternalProject_use_externals,postgresql,\
openldap \
openssl \
- zlib \
))
$(eval $(call gb_ExternalProject_register_targets,postgresql,\
@@ -25,8 +24,9 @@ $(eval $(call gb_ExternalProject_use_nmake,postgresql,build))
$(call gb_ExternalProject_get_state_target,postgresql,build) :
$(call gb_ExternalProject_run,build,\
- nmake -f win32.mak USE_SSL=1 USE_LDAP=1 \
- ,src)
+ MSBFLAGS=/p:Platform=$(if $(filter X86_64,$(CPUNAME)),x64,Win32) \
+ $(PERL) build.pl $(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) libpq \
+ ,src/tools/msvc)
else
@@ -55,20 +55,24 @@ postgresql_LDFLAGS += \
endif
+# note: as of 13.1, zlib is not needed by libpq
+# passing MAKELEVEL=0 is required to find internal headers
$(call gb_ExternalProject_get_state_target,postgresql,build) :
$(call gb_ExternalProject_run,build,\
./configure \
- --without-readline --disable-shared --with-ldap \
+ --without-readline \
+ --without-zlib \
+ --with-ldap \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
$(if $(DISABLE_OPENSSL),,--with-openssl \
- $(if $(WITH_KRB5), --with-krb5) \
$(if $(WITH_GSSAPI),--with-gssapi)) \
+ CFLAGS="-fPIC" \
CPPFLAGS="$(postgresql_CPPFLAGS)" \
LDFLAGS="$(postgresql_LDFLAGS)" \
EXTRA_LDAP_LIBS="-llber -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4" \
&& cd src/interfaces/libpq \
- && MAKEFLAGS= && $(MAKE) all-static-lib)
+ && MAKEFLAGS= && $(MAKE) MAKELEVEL=0 all-static-lib)
endif
diff --git a/external/postgresql/Module_postgresql.mk b/external/postgresql/Module_postgresql.mk
index 1f655c6e5034..7ea89dad3b39 100644
--- a/external/postgresql/Module_postgresql.mk
+++ b/external/postgresql/Module_postgresql.mk
@@ -14,4 +14,10 @@ $(eval $(call gb_Module_add_targets,postgresql,\
UnpackedTarball_postgresql \
))
+ifeq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,postgresql,\
+ ExternalPackage_postgresql \
+))
+endif # WNT
+
# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/UnpackedTarball_postgresql.mk b/external/postgresql/UnpackedTarball_postgresql.mk
index 2e41bf66d806..c95aef25f663 100644
--- a/external/postgresql/UnpackedTarball_postgresql.mk
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -11,18 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,postgresql))
$(eval $(call gb_UnpackedTarball_set_tarball,postgresql,$(POSTGRESQL_TARBALL),,postgresql))
-$(eval $(call gb_UnpackedTarball_set_patchlevel,postgresql,3))
-
$(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
- external/postgresql/postgresql-libs-leak.patch \
- external/postgresql/postgresql-9.2.1-autoreconf.patch \
- external/postgresql/postgresql-9.2.1-libreoffice.patch \
+ external/postgresql/postgres-msvc-build.patch.1 \
))
-ifeq ($(SYSTEM_ZLIB),)
-$(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
- external/postgresql/internal-zlib.patch.1 \
-))
-endif
+$(eval $(call gb_UnpackedTarball_add_file,postgresql,src/tools/msvc/config.pl,external/postgresql/config.pl))
# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/config.pl b/external/postgresql/config.pl
new file mode 100644
index 000000000000..ae163ebbd166
--- /dev/null
+++ b/external/postgresql/config.pl
@@ -0,0 +1 @@
+$config->{openssl} = "$ENV{WORKDIR}/UnpackedTarball/openssl";
diff --git a/external/postgresql/internal-zlib.patch.1 b/external/postgresql/internal-zlib.patch.1
deleted file mode 100644
index ac2b728e1314..000000000000
--- a/external/postgresql/internal-zlib.patch.1
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -up postgresql/configure.dt postgresql/configure
---- postgresql/configure.dt 2016-11-03 17:34:17.282388226 +0100
-+++ postgresql/configure 2016-11-03 17:34:35.004202484 +0100
-@@ -8566,13 +8566,13 @@ fi
-
- if test "$with_zlib" = yes; then
-
--{ $as_echo "$as_me:$LINENO: checking for inflate in -lz" >&5
--$as_echo_n "checking for inflate in -lz... " >&6; }
-+{ $as_echo "$as_me:$LINENO: checking for inflate in -lzlib" >&5
-+$as_echo_n "checking for inflate in -lzlib... " >&6; }
- if test "${ac_cv_lib_z_inflate+set}" = set; then
- $as_echo_n "(cached) " >&6
- else
- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lz $LIBS"
-+LIBS="-lzlib $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h. */
- _ACEOF
-@@ -8636,7 +8636,7 @@ if test "x$ac_cv_lib_z_inflate" = x""yes
- #define HAVE_LIBZ 1
- _ACEOF
-
-- LIBS="-lz $LIBS"
-+ LIBS="-lzlib $LIBS"
-
- else
- { { $as_echo "$as_me:$LINENO: error: zlib library not found
diff --git a/external/postgresql/postgres-msvc-build.patch.1 b/external/postgresql/postgres-msvc-build.patch.1
new file mode 100644
index 000000000000..4ccd82aa28fb
--- /dev/null
+++ b/external/postgresql/postgres-msvc-build.patch.1
@@ -0,0 +1,110 @@
+Cygwin perl calls /bin/sh which can't resolve to .exe
+
+Also Cygwin perl has $Config{osname} different from MSWin32, and why even check that?
+
+--- postgresql/src/tools/msvc/build.pl.orig 2021-01-19 17:36:09.801463500 +0100
++++ postgresql/src/tools/msvc/build.pl 2021-01-19 17:36:20.426821300 +0100
+@@ -55,13 +55,13 @@
+ if ($buildwhat)
+ {
+ system(
+- "msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
++ "msbuild.exe $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
+ );
+ }
+ else
+ {
+ system(
+- "msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
++ "msbuild.exe pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
+ );
+ }
+
+--- postgresql/src/tools/msvc/Project.pm.orig 2021-01-19 17:59:18.799237700 +0100
++++ postgresql/src/tools/msvc/Project.pm 2021-01-19 17:59:48.487711700 +0100
+@@ -22,7 +22,7 @@
+ my $self = {
+ name => $name,
+ type => $type,
+- guid => $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE',
++ guid => Win32::GuidGen(),
+ files => {},
+ references => [],
+ libraries => [],
+--- postgresql/src/tools/msvc/Solution.pm.orig 2021-01-19 18:03:04.594229100 +0100
++++ postgresql/src/tools/msvc/Solution.pm 2021-01-19 18:04:13.677610100 +0100
+@@ -59,7 +59,7 @@
+ {
+ my $self = shift;
+
+- if ($^O eq "MSWin32")
++ if (1) #($^O eq "MSWin32")
+ {
+ # Examine CL help output to determine if we are in 32 or 64-bit mode.
+ my $output = `cl /? 2>&1`;
+@@ -1081,7 +1081,7 @@
+ }
+ if ($fld ne "")
+ {
+- $flduid{$fld} = $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE';
++ $flduid{$fld} = Win32::GuidGen();
+ print $sln <<EOF;
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "$fld", "$fld", "$flduid{$fld}"
+ EndProject
+--- postgresql/src/tools/msvc/VSObjectFactory.pm.orig 2021-01-19 18:06:42.633421700 +0100
++++ postgresql/src/tools/msvc/VSObjectFactory.pm 2021-01-19 18:06:28.663523200 +0100
+@@ -111,7 +111,7 @@
+
+ sub DetermineVisualStudioVersion
+ {
+- if ($^O eq "MSWin32")
++ if (1) # ($^O eq "MSWin32")
+ {
+ # To determine version of Visual Studio we use nmake as it has
+ # existed for a long time and still exists in current Visual
+--- postgresql/src/tools/msvc/Mkvcbuild.pm.orig 2021-01-19 18:23:59.830153900 +0100
++++ postgresql/src/tools/msvc/Mkvcbuild.pm 2021-01-19 18:24:04.095411300 +0100
+@@ -9,7 +9,7 @@
+ use warnings;
+
+ use Carp;
+-use if ($^O eq "MSWin32"), 'Win32';
++use Win32;
+ use Project;
+ use Solution;
+ use Cwd;
+--- postgresql/src/tools/msvc/Solution.pm.orig 2021-01-19 20:27:21.366237600 +0100
++++ postgresql/src/tools/msvc/Solution.pm 2021-01-19 20:28:17.773662900 +0100
+@@ -126,7 +126,8 @@
+ # openssl.exe is in the specified directory.
+ # Quote the .exe name in case it has spaces
+ my $opensslcmd =
+- qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1);
++ qq("$self->{options}->{openssl}\\out32dll\\openssl.exe" version 2>&1);
++ print "$opensslcmd";
+ my $sslout = `$opensslcmd`;
+
+ $? >> 8 == 0
+@@ -964,8 +964,8 @@
+ # On both Win32 and Win64 the same library
+ # names are used without a debugging context.
+ $dbgsuffix = 0;
+- $libsslpath = '\lib\libssl.lib';
+- $libcryptopath = '\lib\libcrypto.lib';
++ $libsslpath = '\libssl.lib';
++ $libcryptopath = '\libcrypto.lib';
+ }
+
+ $proj->AddLibrary($self->{options}->{openssl} . $libsslpath,
+@@ -990,9 +990,9 @@
+ # to be here, so don't ask for it in last
+ # parameter.
+ $proj->AddLibrary(
+- $self->{options}->{openssl} . '\lib\ssleay32.lib', 0);
++ $self->{options}->{openssl} . '\out32dll\ssleay32.lib', 0);
+ $proj->AddLibrary(
+- $self->{options}->{openssl} . '\lib\libeay32.lib', 0);
++ $self->{options}->{openssl} . '\out32dll\libeay32.lib', 0);
+ }
+ }
+ }
diff --git a/external/postgresql/postgresql-9.2.1-autoreconf.patch b/external/postgresql/postgresql-9.2.1-autoreconf.patch
deleted file mode 100644
index 9cbf84f252c8..000000000000
--- a/external/postgresql/postgresql-9.2.1-autoreconf.patch
+++ /dev/null
@@ -1,521 +0,0 @@
---- misc/build/postgresql-9.1.1/configure 2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/configure 2012-02-03 11:50:07.000000000 +0100
-@@ -830,6 +830,7 @@
- with_krb_srvnam
- with_pam
- with_ldap
-+with_mozldap
- with_bonjour
- with_openssl
- with_selinux
-@@ -1527,6 +1528,7 @@
- [postgres]
- --with-pam build with PAM support
- --with-ldap build with LDAP support
-+ --with-mozldap build with Mozilla LDAP support
- --with-bonjour build with Bonjour support
- --with-openssl build with OpenSSL support
- --with-selinux build with SELinux support
-@@ -5412,6 +5414,42 @@
-
-
-
-+{ $as_echo "$as_me:$LINENO: checking whether to use Mozilla C SDK for LDAP support" >&5
-+$as_echo_n "checking whether to use Mozilla C SDK for LDAP support... " >&6; }
-+
-+
-+
-+# Check whether --with-mozldap was given.
-+if test "${with_mozldap+set}" = set; then
-+ withval=$with_mozldap;
-+ case $withval in
-+ yes)
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define USE_MOZLDAP 1
-+_ACEOF
-+
-+ ;;
-+ no)
-+ :
-+ ;;
-+ *)
-+ { { $as_echo "$as_me:$LINENO: error: no argument expected for --with-mozldap option" >&5
-+$as_echo "$as_me: error: no argument expected for --with-mozldap option" >&2;}
-+ { (exit 1); exit 1; }; }
-+ ;;
-+ esac
-+
-+else
-+ with_mozldap=no
-+
-+fi
-+
-+
-+{ $as_echo "$as_me:$LINENO: result: $with_mozldap" >&5
-+$as_echo "$with_mozldap" >&6; }
-+
-+
-
- #
- # Kerberos configuration parameters
-@@ -8627,11 +8665,11 @@
- *** Not using spinlocks will cause poor performance." >&2;}
- fi
-
--if test "$with_gssapi" = yes ; then
-+if test "$with_krb5" = yes ; then
- if test "$PORTNAME" != "win32"; then
-- { $as_echo "$as_me:$LINENO: checking for library containing gss_init_sec_context" >&5
--$as_echo_n "checking for library containing gss_init_sec_context... " >&6; }
--if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
-+ { $as_echo "$as_me:$LINENO: checking for library containing com_err" >&5
-+$as_echo_n "checking for library containing com_err... " >&6; }
-+if test "${ac_cv_search_com_err+set}" = set; then
- $as_echo_n "(cached) " >&6
- else
- ac_func_search_save_LIBS=$LIBS
-@@ -8648,16 +8686,16 @@
- #ifdef __cplusplus
- extern "C"
- #endif
--char gss_init_sec_context ();
-+char com_err ();
- int
- main ()
- {
--return gss_init_sec_context ();
-+return com_err ();
- ;
- return 0;
- }
- _ACEOF
--for ac_lib in '' gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'; do
-+for ac_lib in '' com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
-@@ -8685,7 +8723,7 @@
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
-- ac_cv_search_gss_init_sec_context=$ac_res
-+ ac_cv_search_com_err=$ac_res
- else
- $as_echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5
-@@ -8696,40 +8734,33 @@
- rm -rf conftest.dSYM
- rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
-- if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
-+ if test "${ac_cv_search_com_err+set}" = set; then
- break
- fi
- done
--if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
-+if test "${ac_cv_search_com_err+set}" = set; then
- :
- else
-- ac_cv_search_gss_init_sec_context=no
-+ ac_cv_search_com_err=no
- fi
- rm conftest.$ac_ext
- LIBS=$ac_func_search_save_LIBS
- fi
--{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_gss_init_sec_context" >&5
--$as_echo "$ac_cv_search_gss_init_sec_context" >&6; }
--ac_res=$ac_cv_search_gss_init_sec_context
-+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_com_err" >&5
-+$as_echo "$ac_cv_search_com_err" >&6; }
-+ac_res=$ac_cv_search_com_err
- if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
- else
-- { { $as_echo "$as_me:$LINENO: error: could not find function 'gss_init_sec_context' required for GSSAPI" >&5
--$as_echo "$as_me: error: could not find function 'gss_init_sec_context' required for GSSAPI" >&2;}
-+ { { $as_echo "$as_me:$LINENO: error: could not find function 'com_err' required for Kerberos 5" >&5
-+$as_echo "$as_me: error: could not find function 'com_err' required for Kerberos 5" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-- else
-- LIBS="$LIBS -lgssapi32"
-- fi
--fi
--
--if test "$with_krb5" = yes ; then
-- if test "$PORTNAME" != "win32"; then
-- { $as_echo "$as_me:$LINENO: checking for library containing com_err" >&5
--$as_echo_n "checking for library containing com_err... " >&6; }
--if test "${ac_cv_search_com_err+set}" = set; then
-+ { $as_echo "$as_me:$LINENO: checking for library containing krb5_sendauth" >&5
-+$as_echo_n "checking for library containing krb5_sendauth... " >&6; }
-+if test "${ac_cv_search_krb5_sendauth+set}" = set; then
- $as_echo_n "(cached) " >&6
- else
- ac_func_search_save_LIBS=$LIBS
-@@ -8746,16 +8777,16 @@
- #ifdef __cplusplus
- extern "C"
- #endif
--char com_err ();
-+char krb5_sendauth ();
- int
- main ()
- {
--return com_err ();
-+return krb5_sendauth ();
- ;
- return 0;
- }
- _ACEOF
--for ac_lib in '' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err 'com_err -lssl -lcrypto'; do
-+for ac_lib in '' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
-@@ -8783,7 +8814,7 @@
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
-- ac_cv_search_com_err=$ac_res
-+ ac_cv_search_krb5_sendauth=$ac_res
- else
- $as_echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5
-@@ -8794,33 +8825,34 @@
- rm -rf conftest.dSYM
- rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
-- if test "${ac_cv_search_com_err+set}" = set; then
-+ if test "${ac_cv_search_krb5_sendauth+set}" = set; then
- break
- fi
- done
--if test "${ac_cv_search_com_err+set}" = set; then
-+if test "${ac_cv_search_krb5_sendauth+set}" = set; then
- :
- else
-- ac_cv_search_com_err=no
-+ ac_cv_search_krb5_sendauth=no
- fi
- rm conftest.$ac_ext
- LIBS=$ac_func_search_save_LIBS
- fi
--{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_com_err" >&5
--$as_echo "$ac_cv_search_com_err" >&6; }
--ac_res=$ac_cv_search_com_err
-+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_krb5_sendauth" >&5
-+$as_echo "$ac_cv_search_krb5_sendauth" >&6; }
-+ac_res=$ac_cv_search_krb5_sendauth
- if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
- else
-- { { $as_echo "$as_me:$LINENO: error: could not find function 'com_err' required for Kerberos 5" >&5
--$as_echo "$as_me: error: could not find function 'com_err' required for Kerberos 5" >&2;}
-+ { { $as_echo "$as_me:$LINENO: error: could not find function 'krb5_sendauth' required for Kerberos 5" >&5
-+$as_echo "$as_me: error: could not find function 'krb5_sendauth' required for Kerberos 5" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-- { $as_echo "$as_me:$LINENO: checking for library containing krb5_sendauth" >&5
--$as_echo_n "checking for library containing krb5_sendauth... " >&6; }
--if test "${ac_cv_search_krb5_sendauth+set}" = set; then
-+ else
-+ { $as_echo "$as_me:$LINENO: checking for library containing com_err" >&5
-+$as_echo_n "checking for library containing com_err... " >&6; }
-+if test "${ac_cv_search_com_err+set}" = set; then
- $as_echo_n "(cached) " >&6
- else
- ac_func_search_save_LIBS=$LIBS
-@@ -8837,16 +8869,16 @@
- #ifdef __cplusplus
- extern "C"
- #endif
--char krb5_sendauth ();
-+char com_err ();
- int
- main ()
- {
--return krb5_sendauth ();
-+return com_err ();
- ;
- return 0;
- }
- _ACEOF
--for ac_lib in '' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'; do
-+for ac_lib in '' 'comerr32 -lkrb5_32'; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
-@@ -8874,7 +8906,7 @@
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
-- ac_cv_search_krb5_sendauth=$ac_res
-+ ac_cv_search_com_err=$ac_res
- else
- $as_echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5
-@@ -8885,34 +8917,38 @@
- rm -rf conftest.dSYM
- rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
-- if test "${ac_cv_search_krb5_sendauth+set}" = set; then
-+ if test "${ac_cv_search_com_err+set}" = set; then
- break
- fi
- done
--if test "${ac_cv_search_krb5_sendauth+set}" = set; then
-+if test "${ac_cv_search_com_err+set}" = set; then
- :
- else
-- ac_cv_search_krb5_sendauth=no
-+ ac_cv_search_com_err=no
- fi
- rm conftest.$ac_ext
- LIBS=$ac_func_search_save_LIBS
- fi
--{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_krb5_sendauth" >&5
--$as_echo "$ac_cv_search_krb5_sendauth" >&6; }
--ac_res=$ac_cv_search_krb5_sendauth
-+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_com_err" >&5
-+$as_echo "$ac_cv_search_com_err" >&6; }
-+ac_res=$ac_cv_search_com_err
- if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
- else
-- { { $as_echo "$as_me:$LINENO: error: could not find function 'krb5_sendauth' required for Kerberos 5" >&5
--$as_echo "$as_me: error: could not find function 'krb5_sendauth' required for Kerberos 5" >&2;}
-+ { { $as_echo "$as_me:$LINENO: error: could not find function 'com_err' required for Kerberos 5" >&5
-+$as_echo "$as_me: error: could not find function 'com_err' required for Kerberos 5" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-- else
-- { $as_echo "$as_me:$LINENO: checking for library containing com_err" >&5
--$as_echo_n "checking for library containing com_err... " >&6; }
--if test "${ac_cv_search_com_err+set}" = set; then
-+ fi
-+fi
-+
-+if test "$with_gssapi" = yes ; then
-+ if test "$PORTNAME" != "win32"; then
-+ { $as_echo "$as_me:$LINENO: checking for library containing gss_init_sec_context" >&5
-+$as_echo_n "checking for library containing gss_init_sec_context... " >&6; }
-+if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
- $as_echo_n "(cached) " >&6
- else
- ac_func_search_save_LIBS=$LIBS
-@@ -8929,16 +8965,16 @@
- #ifdef __cplusplus
- extern "C"
- #endif
--char com_err ();
-+char gss_init_sec_context ();
- int
- main ()
- {
--return com_err ();
-+return gss_init_sec_context ();
- ;
- return 0;
- }
- _ACEOF
--for ac_lib in '' 'comerr32 -lkrb5_32'; do
-+for ac_lib in '' gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
-@@ -8966,7 +9002,7 @@
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
-- ac_cv_search_com_err=$ac_res
-+ ac_cv_search_gss_init_sec_context=$ac_res
- else
- $as_echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5
-@@ -8977,30 +9013,32 @@
- rm -rf conftest.dSYM
- rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
-- if test "${ac_cv_search_com_err+set}" = set; then
-+ if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
- break
- fi
- done
--if test "${ac_cv_search_com_err+set}" = set; then
-+if test "${ac_cv_search_gss_init_sec_context+set}" = set; then
- :
- else
-- ac_cv_search_com_err=no
-+ ac_cv_search_gss_init_sec_context=no
- fi
- rm conftest.$ac_ext
- LIBS=$ac_func_search_save_LIBS
- fi
--{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_com_err" >&5
--$as_echo "$ac_cv_search_com_err" >&6; }
--ac_res=$ac_cv_search_com_err
-+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_gss_init_sec_context" >&5
-+$as_echo "$ac_cv_search_gss_init_sec_context" >&6; }
-+ac_res=$ac_cv_search_gss_init_sec_context
- if test "$ac_res" != no; then
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
- else
-- { { $as_echo "$as_me:$LINENO: error: could not find function 'com_err' required for Kerberos 5" >&5
--$as_echo "$as_me: error: could not find function 'com_err' required for Kerberos 5" >&2;}
-+ { { $as_echo "$as_me:$LINENO: error: could not find function 'gss_init_sec_context' required for GSSAPI" >&5
-+$as_echo "$as_me: error: could not find function 'gss_init_sec_context' required for GSSAPI" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
-+ else
-+ LIBS="$LIBS -lgssapi32"
- fi
- fi
-
-@@ -13598,7 +13636,7 @@
- fi
-
- if test "$with_ldap" = yes ; then
-- if test "$PORTNAME" != "win32"; then
-+ if test "$PORTNAME" != "win32" || test "$with_mozldap" = "yes"; then
-
- for ac_header in ldap.h
- do
-@@ -13823,6 +13861,11 @@
-
- done
-
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define USE_MICROSOFT_LDAP 1
-+_ACEOF
-+
- fi
- fi
-
-@@ -23483,7 +23526,99 @@
- # We can test for libldap_r only after we know PTHREAD_LIBS
- if test "$with_ldap" = yes ; then
- _LIBS="$LIBS"
-+ if test "$with_mozldap" = "yes"; then
- if test "$PORTNAME" != "win32"; then
-+ mozlibname=ldap50
-+ else
-+ mozlibname=nsldap32v50
-+ fi
-+
-+as_ac_Lib=`$as_echo "ac_cv_lib_$mozlibname''_ldap_bind" | $as_tr_sh`
-+{ $as_echo "$as_me:$LINENO: checking for ldap_bind in -l$mozlibname" >&5
-+$as_echo_n "checking for ldap_bind in -l$mozlibname... " >&6; }
-+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
-+ $as_echo_n "(cached) " >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-l$mozlibname $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any GCC internal prototype to avoid an error.
-+ Use char because int might match the return type of a GCC
-+ builtin and then its argument prototype would still apply. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+char ldap_bind ();
-+int
-+main ()
-+{
-+return ldap_bind ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (ac_try="$ac_link"
-+case "(($ac_try" in
-+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-+ *) ac_try_echo=$ac_try;;
-+esac
-+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-+$as_echo "$ac_try_echo") >&5
-+ (eval "$ac_link") 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } && {
-+ test -z "$ac_c_werror_flag" ||
-+ test ! -s conftest.err
-+ } && test -s conftest$ac_exeext && {
-+ test "$cross_compiling" = yes ||
-+ $as_test_x conftest$ac_exeext
-+ }; then
-+ eval "$as_ac_Lib=yes"
-+else
-+ $as_echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ eval "$as_ac_Lib=no"
-+fi
-+
-+rm -rf conftest.dSYM
-+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+ac_res=`eval 'as_val=${'$as_ac_Lib'}
-+ $as_echo "$as_val"'`
-+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-+$as_echo "$ac_res" >&6; }
-+as_val=`eval 'as_val=${'$as_ac_Lib'}
-+ $as_echo "$as_val"'`
-+ if test "x$as_val" = x""yes; then
-+ cat >>confdefs.h <<_ACEOF
-+#define `$as_echo "HAVE_LIB$mozlibname" | $as_tr_cpp` 1
-+_ACEOF
-+
-+ LIBS="-l$mozlibname $LIBS"
-+
-+else
-+ { { $as_echo "$as_me:$LINENO: error: library \"$mozlibname\" is required for Mozilla LDAP" >&5
-+$as_echo "$as_me: error: library \"$mozlibname\" is required for Mozilla LDAP" >&2;}
-+ { (exit 1); exit 1; }; }
-+fi
-+
-+ LDAP_LIBS_FE="-l$mozlibname $EXTRA_LDAP_LIBS"
-+ LDAP_LIBS_BE="-l$mozlibname $EXTRA_LDAP_LIBS"
-+ elif test "$PORTNAME" != "win32"; then
-
- { $as_echo "$as_me:$LINENO: checking for ldap_bind in -lldap" >&5
- $as_echo_n "checking for ldap_bind in -lldap... " >&6; }
---- misc/build/postgresql-9.1.1/src/include/pg_config.h.in 2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/src/include/pg_config.h.in 2012-02-03 11:50:07.000000000 +0100
-@@ -758,6 +758,13 @@
- (--with-libxslt) */
- #undef USE_LIBXSLT
-
-+/* Defined when using Microsof LDAP */
-+#undef USE_MICROSOFT_LDAP
-+
-+/* Define to 1 to use the Mozilla LDAP C SDK instead of platform default
-+ (OpenLDAP or Microsoft LDAP). (--with-mozldap) */
-+#undef USE_MOZLDAP
-+
- /* Define to select named POSIX semaphores. */
- #undef USE_NAMED_POSIX_SEMAPHORES
-
-
diff --git a/external/postgresql/postgresql-9.2.1-libreoffice.patch b/external/postgresql/postgresql-9.2.1-libreoffice.patch
deleted file mode 100644
index 174ee8551a78..000000000000
--- a/external/postgresql/postgresql-9.2.1-libreoffice.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/Makefile 2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/Makefile 2011-12-15 09:02:18.000000000 +0100
-@@ -148,3 +148,6 @@
- maintainer-clean: distclean maintainer-clean-lib
- $(MAKE) -C test $@
- rm -f libpq-dist.rc
-+
-+libpq-flags.mk:
-+ @printf '%s\n' 'LIBPQ_DEP_LIBS+=$(SHLIB_LINK)' > '$@'
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak 2011-12-14 14:28:59.000000000 +0100
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak 2011-12-15 09:11:37.000000000 +0100
-@@ -11,14 +11,12 @@
- !ENDIF
-
- !IFDEF DEBUG
--OPT=/Od /Zi /MDd
-+OPT=/Od /Zi
- LOPT=/DEBUG
--DEBUGDEF=/D _DEBUG
--OUTFILENAME=libpqd
-+OUTFILENAME=libpq
- !ELSE
- OPT=/O2 /MD
- LOPT=
--DEBUGDEF=/D NDEBUG
- OUTFILENAME=libpq
- !ENDIF
-
-@@ -67,18 +66,11 @@
- CPP=cl.exe
- RSC=rc.exe
-
--!IFDEF DEBUG
--OUTDIR=.\Debug
--INTDIR=.\Debug
--CPP_OBJS=.\Debug/
--!ELSE
--OUTDIR=.\Release
--INTDIR=.\Release
--CPP_OBJS=.\Release/
--!ENDIF
--
-+OUTDIR=.
-+INTDIR=.
-+CPP_OBJS=./
-
--ALL : config "$(OUTDIR)\$(OUTFILENAME).lib" "$(OUTDIR)\$(OUTFILENAME).dll"
-+ALL : config "$(OUTDIR)\$(OUTFILENAME).lib"
-
- CLEAN :
- -@erase "$(INTDIR)\getaddrinfo.obj"
-@@ -178,10 +170,11 @@
- "$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
--CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. /I "$(SSL_INC)" \
-+CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" /I. $(SOLARINC) /I $(WORKDIR)/UnpackedTarball/openssl/include \
- /D "FRONTEND" $(DEBUGDEF) \
- /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \
- /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
-+ /D "_CRT_NONSTDC_NO_DEPRECATE" \
- /D "_CRT_SECURE_NO_DEPRECATE" $(ADD_DEFINES)
-
- !IFDEF USE_SSL
-@@ -222,7 +215,7 @@
- <<
-
- "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq-dist.rc
-- $(RSC) $(RSC_PROJ) libpq-dist.rc
-+ $(RSC) $(SOLARINC) $(RSC_PROJ) libpq-dist.rc
-
-
- "$(OUTDIR)\$(OUTFILENAME).dll" : "$(OUTDIR)" "$(INTDIR)\libpq.res"
-
diff --git a/external/postgresql/postgresql-libs-leak.patch b/external/postgresql/postgresql-libs-leak.patch
deleted file mode 100644
index 8224137f1f97..000000000000
--- a/external/postgresql/postgresql-libs-leak.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --recursive -u misc/build/postgresql-9.1.1/configure.in misc/build/postgresql-9.1.1.patched/configure.in
---- misc/build/postgresql-9.1.1/configure.in 2011-09-22 23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/configure.in 2012-02-03 11:42:45.000000000 +0100
-@@ -903,18 +903,9 @@
- *** Not using spinlocks will cause poor performance.])
- fi
-
--if test "$with_gssapi" = yes ; then
-- if test "$PORTNAME" != "win32"; then
-- AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
-- [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
-- else
-- LIBS="$LIBS -lgssapi32"
-- fi
--fi
--
- if test "$with_krb5" = yes ; then
- if test "$PORTNAME" != "win32"; then
-- AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err 'com_err -lssl -lcrypto'], [],
-+ AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
- [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
- AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
- [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
-@@ -924,6 +915,15 @@
- fi
- fi
-
-+if test "$with_gssapi" = yes ; then
-+ if test "$PORTNAME" != "win32"; then
-+ AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
-+ [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
-+ else
-+ LIBS="$LIBS -lgssapi32"
-+ fi
-+fi
-+
- if test "$with_openssl" = yes ; then
- dnl Order matters!
- if test "$PORTNAME" != "win32"; then
-