summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2007-07-12 14:43:21 +0000
committerMagnus Hagander2007-07-12 14:43:21 +0000
commit784fd04940a88e3246001b6024fc4dbf9b9b06e2 (patch)
tree6a396d6684eea228c673d017362f9ad15068f15a
parent65a513c2490983e1b95710a805e7cb71956120bc (diff)
Enable GSSAPI to build using MSVC. Always build GSSAPI when Kerberos is
enabled, because the only Kerberos library supported always contains it.
-rw-r--r--src/backend/libpq/auth.c10
-rw-r--r--src/include/libpq/libpq-be.h12
-rw-r--r--src/interfaces/libpq/fe-auth.c6
-rw-r--r--src/tools/msvc/Solution.pm4
4 files changed, 21 insertions, 11 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index c8cd80958d9..74f6336920a 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.151 2007/07/12 14:36:52 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.152 2007/07/12 14:43:20 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -308,9 +308,9 @@ pg_krb5_recvauth(Port *port)
#include <gssapi/gssapi.h>
#endif
-#ifdef WIN32
+#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
/*
- * MIT Kerberos GSSAPI DLL doesn't properly export the symbols
+ * MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
* that contain the OIDs required. Redefine here, values copied
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
*/
@@ -381,8 +381,8 @@ pg_GSS_recvauth(Port *port)
*/
if (!getenv("KRB5_KTNAME"))
{
- kt_path = palloc(PATH_MAX + 13);
- snprintf(kt_path, PATH_MAX + 13,
+ kt_path = palloc(MAXPGPATH + 13);
+ snprintf(kt_path, MAXPGPATH + 13,
"KRB5_KTNAME=%s", pg_krb_server_keyfile);
putenv(kt_path);
}
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h
index 5e15bcdec73..891ab9614c0 100644
--- a/src/include/libpq/libpq-be.h
+++ b/src/include/libpq/libpq-be.h
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.60 2007/07/12 14:36:52 mha Exp $
+ * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.61 2007/07/12 14:43:21 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,8 +34,16 @@
#include <gssapi.h>
#else
#include <gssapi/gssapi.h>
+#endif /* HAVE_GSSAPI_H */
+/*
+ * GSSAPI brings in headers that set a lot of things in the global namespace on win32,
+ * that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
+ * but also defines a symbol that simply does not exist. Undefine it again.
+ */
+#ifdef WIN32_ONLY_COMPILER
+#undef HAVE_GETADDRINFO
#endif
-#endif
+#endif /* ENABLE_GSS */
#include "libpq/hba.h"
#include "libpq/pqcomm.h"
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index ca92d44f8a9..4c3207f63a6 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.126 2007/07/12 14:36:52 mha Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.127 2007/07/12 14:43:21 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -335,9 +335,9 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, const char *hostname, const char *s
#include <gssapi/gssapi.h>
#endif
-#ifdef WIN32
+#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
/*
- * MIT Kerberos GSSAPI DLL doesn't properly export the symbols
+ * MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
* that contain the OIDs required. Redefine here, values copied
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
*/
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 78844e3d973..3a23a15431d 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -3,7 +3,7 @@ package Solution;
#
# Package that encapsulates a Visual C++ solution file generation
#
-# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.28 2007/07/12 14:10:39 mha Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.29 2007/07/12 14:43:21 mha Exp $
#
use Carp;
use strict;
@@ -125,6 +125,7 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
print O "#define HAVE_KRB5_TICKET_ENC_PART2 1\n";
print O "#define HAVE_KRB5_FREE_UNPARSED_NAME 1\n";
print O "#define PG_KRB_SRVNAM \"postgres\"\n";
+ print O "#define ENABLE_GSS\n";
}
if (my $port = $self->{options}->{"--with-pgport"})
{
@@ -332,6 +333,7 @@ sub AddProject
$proj->AddIncludeDir($self->{options}->{krb5} . '\inc\krb5');
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\krb5_32.lib');
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\comerr32.lib');
+ $proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\gssapi32.lib');
}
if ($self->{options}->{xml})
{