BUG #16775: Problem building with Kerberos (--with-gssapi) support on Windows

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: uwe(dot)benner(at)posteo(dot)de
Subject: BUG #16775: Problem building with Kerberos (--with-gssapi) support on Windows
Date: 2020-12-14 21:32:17
Message-ID: 16775-aae444d3bb6f41e1@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16775
Logged by: Uwe Benner
Email address: uwe(dot)benner(at)posteo(dot)de
PostgreSQL version: 12.5
Operating system: Windows 10
Description:

Hello there!

I am building postgres from source on Windows, because I need a 32bit
version, and wanted to have kerberos support a.k.a. `--with-gssapi`
activated.
When compiling, it complains about the line 493 in file
src/backend/be-secure-gssapi.c [0]
```
493 setenv("KRB5_KTNAME", pg_krb_server_keyfile, 1);
```
which seams reasonable, since it seams to be the linux api call. Is it
supposed to be the linux api or does postgres itself define a setenv
function somewhere else?
Is it okay to fix it like this?
```
#ifndef WIN32
setenv("KRB5_KTNAME", pg_krb_server_keyfile, 1);
#else
SetEnvironmentVariable("KRB5_KTNAME", pg_krb_server_keyfile);
#endif
```

Or should `pg_setenv`[1] or something like tat be called instead? `putenv`
would be another, more or less cross platform safe option, but it's
deprecated[2] in Windows and `_putenv`/`_putenv_s` should be used instead.

And another thing, can you check if the call to `SetEnvironmentVariableA` in
the function `pg_setenv`[1] is right? I think it's a typo and should call
`SetEnvironmentVariable`.

Thanks in advance
Uwe Benner

[0]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/libpq/be-secure-gssapi.c;h=5a73302b7b9ea65dc8a3d57d232d473ef54ce2c1;hb=HEAD#l493
[1]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/bin/pg_upgrade/util.c;h=a16c794261b598326253f2665eaea9039724ac45;hb=HEAD#l246
[2]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv?view=msvc-160

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-12-14 22:11:06 Re: BUG #16775: Problem building with Kerberos (--with-gssapi) support on Windows
Previous Message PG Bug reporting form 2020-12-14 20:47:26 BUG #16774: PostgreSQL clean build MINGW64 gcc but initdb fails, cannot find startadress CreateProcessAsUserA