Enable GSSAPI to build using MSVC. Always build GSSAPI when Kerberos is

enabled, because the only Kerberos library supported always contains it.
This commit is contained in:
Magnus Hagander 2007-07-12 14:43:21 +00:00
parent 65a513c249
commit 784fd04940
4 changed files with 21 additions and 11 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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> #include <gssapi/gssapi.h>
#endif #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 * that contain the OIDs required. Redefine here, values copied
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c * 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")) if (!getenv("KRB5_KTNAME"))
{ {
kt_path = palloc(PATH_MAX + 13); kt_path = palloc(MAXPGPATH + 13);
snprintf(kt_path, PATH_MAX + 13, snprintf(kt_path, MAXPGPATH + 13,
"KRB5_KTNAME=%s", pg_krb_server_keyfile); "KRB5_KTNAME=%s", pg_krb_server_keyfile);
putenv(kt_path); putenv(kt_path);
} }

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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> #include <gssapi.h>
#else #else
#include <gssapi/gssapi.h> #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 #endif /* ENABLE_GSS */
#include "libpq/hba.h" #include "libpq/hba.h"
#include "libpq/pqcomm.h" #include "libpq/pqcomm.h"

View File

@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
* *
* IDENTIFICATION * 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> #include <gssapi/gssapi.h>
#endif #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 * that contain the OIDs required. Redefine here, values copied
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c * from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
*/ */

View File

@ -3,7 +3,7 @@ package Solution;
# #
# Package that encapsulates a Visual C++ solution file generation # 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 Carp;
use strict; 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_TICKET_ENC_PART2 1\n";
print O "#define HAVE_KRB5_FREE_UNPARSED_NAME 1\n"; print O "#define HAVE_KRB5_FREE_UNPARSED_NAME 1\n";
print O "#define PG_KRB_SRVNAM \"postgres\"\n"; print O "#define PG_KRB_SRVNAM \"postgres\"\n";
print O "#define ENABLE_GSS\n";
} }
if (my $port = $self->{options}->{"--with-pgport"}) if (my $port = $self->{options}->{"--with-pgport"})
{ {
@ -332,6 +333,7 @@ sub AddProject
$proj->AddIncludeDir($self->{options}->{krb5} . '\inc\krb5'); $proj->AddIncludeDir($self->{options}->{krb5} . '\inc\krb5');
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\krb5_32.lib'); $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\comerr32.lib');
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\gssapi32.lib');
} }
if ($self->{options}->{xml}) if ($self->{options}->{xml})
{ {