Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 784fd04

Browse files
committed
Enable GSSAPI to build using MSVC. Always build GSSAPI when Kerberos is
enabled, because the only Kerberos library supported always contains it.
1 parent 65a513c commit 784fd04

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

src/backend/libpq/auth.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.151 2007/07/12 14:36:52 mha Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.152 2007/07/12 14:43:20 mha Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -308,9 +308,9 @@ pg_krb5_recvauth(Port *port)
308308
#include <gssapi/gssapi.h>
309309
#endif
310310

311-
#ifdef WIN32
311+
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
312312
/*
313-
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols
313+
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
314314
* that contain the OIDs required. Redefine here, values copied
315315
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
316316
*/
@@ -381,8 +381,8 @@ pg_GSS_recvauth(Port *port)
381381
*/
382382
if (!getenv("KRB5_KTNAME"))
383383
{
384-
kt_path = palloc(PATH_MAX + 13);
385-
snprintf(kt_path, PATH_MAX + 13,
384+
kt_path = palloc(MAXPGPATH + 13);
385+
snprintf(kt_path, MAXPGPATH + 13,
386386
"KRB5_KTNAME=%s", pg_krb_server_keyfile);
387387
putenv(kt_path);
388388
}

src/include/libpq/libpq-be.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.60 2007/07/12 14:36:52 mha Exp $
14+
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.61 2007/07/12 14:43:21 mha Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -34,8 +34,16 @@
3434
#include <gssapi.h>
3535
#else
3636
#include <gssapi/gssapi.h>
37+
#endif /* HAVE_GSSAPI_H */
38+
/*
39+
* GSSAPI brings in headers that set a lot of things in the global namespace on win32,
40+
* that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
41+
* but also defines a symbol that simply does not exist. Undefine it again.
42+
*/
43+
#ifdef WIN32_ONLY_COMPILER
44+
#undef HAVE_GETADDRINFO
3745
#endif
38-
#endif
46+
#endif /* ENABLE_GSS */
3947

4048
#include "libpq/hba.h"
4149
#include "libpq/pqcomm.h"

src/interfaces/libpq/fe-auth.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.126 2007/07/12 14:36:52 mha Exp $
13+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.127 2007/07/12 14:43:21 mha Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -335,9 +335,9 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, const char *hostname, const char *s
335335
#include <gssapi/gssapi.h>
336336
#endif
337337

338-
#ifdef WIN32
338+
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
339339
/*
340-
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols
340+
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
341341
* that contain the OIDs required. Redefine here, values copied
342342
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
343343
*/

src/tools/msvc/Solution.pm

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package Solution;
33
#
44
# Package that encapsulates a Visual C++ solution file generation
55
#
6-
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.28 2007/07/12 14:10:39 mha Exp $
6+
# $PostgreSQL: pgsql/src/tools/msvc/Solution.pm,v 1.29 2007/07/12 14:43:21 mha Exp $
77
#
88
use Carp;
99
use strict;
@@ -125,6 +125,7 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
125125
print O "#define HAVE_KRB5_TICKET_ENC_PART2 1\n";
126126
print O "#define HAVE_KRB5_FREE_UNPARSED_NAME 1\n";
127127
print O "#define PG_KRB_SRVNAM \"postgres\"\n";
128+
print O "#define ENABLE_GSS\n";
128129
}
129130
if (my $port = $self->{options}->{"--with-pgport"})
130131
{
@@ -332,6 +333,7 @@ sub AddProject
332333
$proj->AddIncludeDir($self->{options}->{krb5} . '\inc\krb5');
333334
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\krb5_32.lib');
334335
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\comerr32.lib');
336+
$proj->AddLibrary($self->{options}->{krb5} . '\lib\i386\gssapi32.lib');
335337
}
336338
if ($self->{options}->{xml})
337339
{

0 commit comments

Comments
 (0)