diff options
Diffstat (limited to 'postgresql/postgresql-moz-ldap.patch')
-rw-r--r-- | postgresql/postgresql-moz-ldap.patch | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/postgresql/postgresql-moz-ldap.patch b/postgresql/postgresql-moz-ldap.patch new file mode 100644 index 000000000000..ceb82567f798 --- /dev/null +++ b/postgresql/postgresql-moz-ldap.patch @@ -0,0 +1,228 @@ +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 2011-12-14 13:10:11.000000000 +0100 +@@ -662,6 +662,13 @@ + AC_MSG_RESULT([$with_ldap]) + AC_SUBST(with_ldap) + ++AC_MSG_CHECKING([whether to use Mozilla C SDK for LDAP support]) ++PGAC_ARG_BOOL(with, mozldap, no, ++ [build with Mozilla LDAP support], ++ [AC_DEFINE([USE_MOZLDAP], 1, [Define to 1 to use the Mozilla LDAP C SDK instead of platform default (OpenLDAP or Microsoft LDAP). (--with-mozldap)])]) ++AC_MSG_RESULT([$with_mozldap]) ++AC_SUBST(with_mozldap) ++ + + # + # Bonjour +@@ -1077,7 +1084,7 @@ + fi + + if test "$with_ldap" = yes ; then +- if test "$PORTNAME" != "win32"; then ++ if test "$PORTNAME" != "win32" || test "$with_mozldap" = "yes"; then + AC_CHECK_HEADERS(ldap.h, [], + [AC_MSG_ERROR([header file <ldap.h> is required for LDAP])]) + else +@@ -1086,6 +1093,7 @@ + [AC_INCLUDES_DEFAULT + #include <windows.h> + ]) ++ AC_DEFINE([USE_MICROSOFT_LDAP], 1, [Defined when using Microsof LDAP]) + fi + fi + +@@ -1498,7 +1506,18 @@ + # We can test for libldap_r only after we know PTHREAD_LIBS + if test "$with_ldap" = yes ; then + _LIBS="$LIBS" +- if test "$PORTNAME" != "win32"; then ++ if test "$with_mozldap" = "yes"; then ++ if test "$PORTNAME" != "win32"; then ++ mozlibname=ldap50 ++ else ++ mozlibname=nsldap32v50 ++ fi ++ AC_CHECK_LIB($mozlibname, ldap_bind, [], ++ [AC_MSG_ERROR([library "$mozlibname" is required for Mozilla LDAP])], ++ [$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS]) ++ LDAP_LIBS_FE="-l$mozlibname $EXTRA_LDAP_LIBS" ++ LDAP_LIBS_BE="-l$mozlibname $EXTRA_LDAP_LIBS" ++ elif test "$PORTNAME" != "win32"; then + AC_CHECK_LIB(ldap, ldap_bind, [], + [AC_MSG_ERROR([library 'ldap' is required for LDAP])], + [$EXTRA_LDAP_LIBS]) +diff --recursive -u misc/build/postgresql-9.1.1/src/backend/libpq/auth.c misc/build/postgresql-9.1.1.patched/src/backend/libpq/auth.c +--- misc/build/postgresql-9.1.1/src/backend/libpq/auth.c 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/backend/libpq/auth.c 2011-12-14 13:10:11.000000000 +0100 +@@ -93,11 +93,7 @@ + *---------------------------------------------------------------- + */ + #ifdef USE_LDAP +-#ifndef WIN32 +-/* We use a deprecated function to keep the codepath the same as win32. */ +-#define LDAP_DEPRECATED 1 +-#include <ldap.h> +-#else ++#ifdef USE_MICROSOFT_LDAP + #include <winldap.h> + + /* Correct header from the Platform SDK */ +@@ -109,6 +105,10 @@ + IN PLDAPControlA * ServerControls, + IN PLDAPControlA * ClientControls + ); ++#else ++/* We use a deprecated function to keep the codepath the same as win32. */ ++#define LDAP_DEPRECATED 1 ++#include <ldap.h> + #endif + + static int CheckLDAPAuth(Port *port); +@@ -2043,7 +2043,7 @@ + *ldap = ldap_init(port->hba->ldapserver, port->hba->ldapport); + if (!*ldap) + { +-#ifndef WIN32 ++#ifndef USE_MICROSOFT_LDAP + ereport(LOG, + (errmsg("could not initialize LDAP: error code %d", + errno))); +@@ -2065,7 +2065,7 @@ + + if (port->hba->ldaptls) + { +-#ifndef WIN32 ++#ifndef USE_MICROSOFT_LDAP + if ((r = ldap_start_tls_s(*ldap, NULL, NULL)) != LDAP_SUCCESS) + #else + static __ldap_start_tls_sA _ldap_start_tls_sA = NULL; +diff --recursive -u misc/build/postgresql-9.1.1/src/interfaces/libpq/fe-connect.c misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/fe-connect.c +--- misc/build/postgresql-9.1.1/src/interfaces/libpq/fe-connect.c 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/fe-connect.c 2011-12-14 13:10:11.000000000 +0100 +@@ -60,7 +60,7 @@ + #endif + + #ifdef USE_LDAP +-#ifdef WIN32 ++#ifdef USE_MICROSOFT_LDAP + #include <winldap.h> + #else + /* OpenLDAP deprecates RFC 1823, but we want standard conformance */ +diff --recursive -u misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak +--- misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak 2011-12-14 13:11:25.000000000 +0100 +@@ -4,6 +4,8 @@ + # and a dynamic library libpq(d).dll with import library libpq(d)dll.lib + # USE_SSL=1 will compile with OpenSSL + # USE_KFW=1 will compile with kfw(kerberos for Windows) ++# USE_LDAP=1 will compile with LDAP support ++# USE_MOZLDAP=1 when LDAP is enabled, use Mozilla LDAP C SDK instead of Microsoft LDAP + # DEBUG=1 compiles with debugging symbols + # ENABLE_THREAD_SAFETY=1 compiles with threading enabled + +@@ -58,6 +60,16 @@ + !MESSAGE Using default Kerberos Library directory: $(KFW_LIB_PATH) + !ENDIF + ++!IF "$(MOZLDAP_INC)" == "" ++MOZLDAP_INC=C:\ldapcsdk-6.0.7\include ++!MESSAGE Using default Mozilla LDAP Include directory: $(MOZLDAP_INC) ++!ENDIF ++ ++!IF "$(MOZLDAP_LIB_PATH)" == "" ++MOZLDAP_PATH=C:\ldapcsdk-6.0.7\lib ++!MESSAGE Using default Mozilla LDAP Library directory: $(MOZLDAP_LIB_PATH) ++!ENDIF ++ + !IF "$(OS)" == "Windows_NT" + NULL= + !ELSE +@@ -178,7 +190,9 @@ + "$(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. /I "$(SSL_INC)" /I "$(KFW_INC)" /I "$(MOZLDAP_INC)" \ + /D "FRONTEND" $(DEBUGDEF) \ + /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \ + /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \ +@@ -189,6 +203,17 @@ + SSL_LIBS=ssleay32.lib libeay32.lib gdi32.lib + !ENDIF + ++!IFDEF USE_LDAP ++CPP_PROJ=$(CPP_PROJ) /D USE_LDAP ++!IFDEF USE_MOZLDAP ++CPP_PROJ=$(CPP_PROJ) /D USE_MOZLDAP ++LDAP_LIBS=nsldap32v50.lib ++!ELSE ++CPP_PROJ=$(CPP_PROJ) /D USE_MICROSOFT_LDAP ++LDAP_LIBS=wldap32.lib ++!ENDIF ++!ENDIF # DEFINED(USE_LDAP) ++ + !IFDEF USE_KFW + CPP_PROJ=$(CPP_PROJ) /D KRB5 + KFW_LIBS=krb5_32.lib comerr32.lib gssapi32.lib +@@ -203,12 +228,12 @@ + RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res" + + LINK32=link.exe +-LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib wsock32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(KFW_LIB) $(ADD_SECLIB) \ ++LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shfolder.lib wsock32.lib ws2_32.lib secur32.lib $(SSL_LIBS) $(LDAP_LIBS) $(KFW_LIBS) $(ADD_SECLIB) \ + /nologo /subsystem:windows /dll $(LOPT) /incremental:no \ + /pdb:"$(OUTDIR)\libpqdll.pdb" /machine:$(CPU) \ + /out:"$(OUTDIR)\$(OUTFILENAME).dll"\ + /implib:"$(OUTDIR)\$(OUTFILENAME)dll.lib" \ +- /libpath:"$(SSL_LIB_PATH)" /libpath:"$(KFW_LIB_PATH)" \ ++ /libpath:"$(SSL_LIB_PATH)" /libpath:"$(KFW_LIB_PATH)" /libpath:"$(MOZLDAP_LIB_PATH)" \ + /def:$(OUTFILENAME)dll.def + LINK32_OBJS= \ + "$(OUTDIR)\$(OUTFILENAME).lib" \ +diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/config_default.pl misc/build/postgresql-9.1.1.patched/src/tools/msvc/config_default.pl +--- misc/build/postgresql-9.1.1/src/tools/msvc/config_default.pl 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/config_default.pl 2011-12-14 13:10:11.000000000 +0100 +@@ -11,6 +11,7 @@ + # wal_blocksize => 8, # --with-wal-blocksize, 8kB by default + # wal_segsize => 16, # --with-wal-segsize, 16MB by default + ldap=>1, # --with-ldap ++ # mozldap=>1, # --with-mozldap, off by default + nls=>undef, # --enable-nls=<path> + tcl=>undef, # --with-tls=<path> + perl=>undef, # --with-perl +diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/Mkvcbuild.pm misc/build/postgresql-9.1.1.patched/src/tools/msvc/Mkvcbuild.pm +--- misc/build/postgresql-9.1.1/src/tools/msvc/Mkvcbuild.pm 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/Mkvcbuild.pm 2011-12-14 13:10:11.000000000 +0100 +@@ -78,7 +78,8 @@ + $postgres->AddLibrary('wsock32.lib'); + $postgres->AddLibrary('ws2_32.lib'); + $postgres->AddLibrary('secur32.lib'); +- $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap}); ++ $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap} && ! $solution->{options}->{mozldap}); ++ $postgres->AddLibrary('nsldap32v50.lib') if ($solution->{options}->{ldap} && $solution->{options}->{mozldap}); + $postgres->FullExportDLL('postgres.lib'); + + my $snowball = $solution->AddProject('dict_snowball','dll','','src\backend\snowball'); +diff --recursive -u misc/build/postgresql-9.1.1/src/tools/msvc/Solution.pm misc/build/postgresql-9.1.1.patched/src/tools/msvc/Solution.pm +--- misc/build/postgresql-9.1.1/src/tools/msvc/Solution.pm 2011-09-22 23:57:57.000000000 +0200 ++++ misc/build/postgresql-9.1.1.patched/src/tools/msvc/Solution.pm 2011-12-14 13:10:11.000000000 +0100 +@@ -174,6 +174,8 @@ + print O "#define USE_ASSERT_CHECKING 1\n" if ($self->{options}->{asserts}); + print O "#define USE_INTEGER_DATETIMES 1\n" if ($self->{options}->{integer_datetimes}); + print O "#define USE_LDAP 1\n" if ($self->{options}->{ldap}); ++ print O "#define USE_MICROSOFT_LDAP 1\n" if ( ! $self->{options}->{mozldap}); ++ print O "#define USE_MOZLDAP 1\n" if ($self->{options}->{mozldap}); + print O "#define HAVE_LIBZ 1\n" if ($self->{options}->{zlib}); + print O "#define USE_SSL 1\n" if ($self->{options}->{openssl}); + print O "#define ENABLE_NLS 1\n" if ($self->{options}->{nls}); +@@ -559,6 +561,7 @@ + $cfg .= ' --enable-integer-datetimes' if ($self->{options}->{integer_datetimes}); + $cfg .= ' --enable-nls' if ($self->{options}->{nls}); + $cfg .= ' --with-ldap' if ($self->{options}->{ldap}); ++ $cfg .= ' --with-mozldap' if ($self->{options}->{mozldap}); + $cfg .= ' --without-zlib' unless ($self->{options}->{zlib}); + $cfg .= ' --with-openssl' if ($self->{options}->{ssl}); + $cfg .= ' --with-ossp-uuid' if ($self->{options}->{uuid}); |