From c22650cd6450854e1a75064b698d7dcbb4a8821a Mon Sep 17 00:00:00 2001
From: Noah Misch <noah@leadboat.com>
Date: Fri, 1 Apr 2016 21:53:18 -0400
Subject: [PATCH] Refer to a TOKEN_USER payload as a "token user," not as a
 "user token".

This corrects messages for can't-happen errors.  The corresponding "user
token" appears in the HANDLE argument of GetTokenInformation().
---
 src/backend/libpq/auth.c | 2 +-
 src/common/exec.c        | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 899da712f7a..2751183c3e6 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -1252,7 +1252,7 @@ pg_SSPI_recvauth(Port *port)
 
 	if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
 		ereport(ERROR,
-				(errmsg_internal("could not get user token: error code %lu",
+				(errmsg_internal("could not get token user: error code %lu",
 								 GetLastError())));
 
 	CloseHandle(token);
diff --git a/src/common/exec.c b/src/common/exec.c
index 927d03c3b75..ec8c6556365 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -672,13 +672,10 @@ AddUserToTokenDacl(HANDLE hToken)
 		goto cleanup;
 	}
 
-	/*
-	 * Get the user token for the current user, which provides us with the SID
-	 * that is needed for creating the ACL.
-	 */
+	/* Get the current user SID */
 	if (!GetTokenUser(hToken, &pTokenUser))
 	{
-		log_error("could not get user token: error code %lu", GetLastError());
+		log_error("could not get token user: error code %lu", GetLastError());
 		goto cleanup;
 	}
 
-- 
GitLab