]> granicus.if.org Git - postgresql/commitdiff
Enable GSSAPI to build using MSVC. Always build GSSAPI when Kerberos is
authorMagnus Hagander <magnus@hagander.net>
Thu, 12 Jul 2007 14:43:21 +0000 (14:43 +0000)
committerMagnus Hagander <magnus@hagander.net>
Thu, 12 Jul 2007 14:43:21 +0000 (14:43 +0000)
enabled, because the only Kerberos library supported always contains it.

src/backend/libpq/auth.c
src/include/libpq/libpq-be.h
src/interfaces/libpq/fe-auth.c
src/tools/msvc/Solution.pm

index c8cd80958d9e04fd475190c0fc2afe027ca56c2a..74f6336920a9446272ca6d0fcf577fd724841e41 100644 (file)
@@ -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);
                }
index 5e15bcdec7330aef9817eae5304b73faa6d6e663..891ab9614c01c4c005e5f02ad4cf4c789d2157dd 100644 (file)
@@ -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 $
  *
  *-------------------------------------------------------------------------
  */
 #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"
index ca92d44f8a957568fc9a7500f815e84a2cce67ee..4c3207f63a6210d1435a55b9daa8a6b87df9b0e1 100644 (file)
@@ -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
  */
index 78844e3d973ad62ccba2c245d41a8880aafe1d88..3a23a15431d5a4797b5820f7646f7f54e1c9a8f4 100644 (file)
@@ -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})
     {