auth.patch

text/plain

Filename: auth.patch
Type: text/plain
Part: 0
Message: krb_server_keyfile setting doesn't work on Windows

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
auth.c 26 0
Index: auth.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/libpq/auth.c,v
retrieving revision 1.188
diff -c -r1.188 auth.c
*** auth.c	12 Dec 2009 21:35:21 -0000	1.188
--- auth.c	30 Dec 2009 15:03:51 -0000
***************
*** 877,882 ****
--- 877,905 ----
  			 errdetail("%s: %s", msg_major, msg_minor)));
  }
  
+ #ifdef	WIN32
+ static void
+ msvc_krb5_ktname(const char *kt_path)
+ {
+ 	typedef int (_cdecl * PUTENVPROC) (const char *);
+ 	const char *msvcrdll = "msvcr71";
+ 	static	bool	initialized = false;
+ 	HMODULE		hmodule;
+ 	static PUTENVPROC putenvFunc = NULL;
+ 
+ 	if (initialized)
+ 	{
+ 		if (!putenvFunc)
+ 			return;
+ 	}
+ 	else if (hmodule = GetModuleHandle(msvcrdll), hmodule != NULL)
+ 		putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv");
+ 	initialized = true;
+ 	if (putenvFunc != NULL)
+ 		putenvFunc(kt_path);
+ }
+ #endif /* WIN32 */
+ 
  static int
  pg_GSS_recvauth(Port *port)
  {
***************
*** 923,928 ****
--- 946,954 ----
  				return STATUS_ERROR;
  			}
  			snprintf(kt_path, kt_len, "KRB5_KTNAME=%s", pg_krb_server_keyfile);
+ #ifdef	WIN32
+ 			msvc_krb5_ktname(kt_path);
+ #endif /* WIN32 */
  			putenv(kt_path);
  		}
  	}