aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2016-04-06 23:41:43 -0400
committerNoah Misch <noah@leadboat.com>2016-04-06 23:41:43 -0400
commitf2b1b3079ce9d2965f6e450585f24d18cdf5647b (patch)
tree7db788c4736fad71d68c79565f578679c50e5be8 /src
parent33d3fc5e2aac32fcf356c09cee4bfded6613a1f3 (diff)
downloadpostgresql-f2b1b3079ce9d2965f6e450585f24d18cdf5647b.tar.gz
postgresql-f2b1b3079ce9d2965f6e450585f24d18cdf5647b.zip
Standardize GetTokenInformation() error reporting.
Commit c22650cd6450854e1a75064b698d7dcbb4a8821a sparked a discussion about diverse interpretations of "token user" in error messages. Expel old and new specimens of that phrase by making all GetTokenInformation() callers report errors the way GetTokenUser() has been reporting them. These error conditions almost can't happen, so users are unlikely to observe this change. Reviewed by Tom Lane and Stephen Frost.
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/auth.c8
-rw-r--r--src/port/win32security.c4
-rw-r--r--src/test/regress/pg_regress.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 2751183c3e6..f21056e2445 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -1242,8 +1242,8 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
ereport(ERROR,
- (errmsg_internal("could not get token user size: error code %lu",
- GetLastError())));
+ (errmsg_internal("could not get token information buffer size: error code %lu",
+ GetLastError())));
tokenuser = malloc(retlen);
if (tokenuser == NULL)
@@ -1252,8 +1252,8 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
ereport(ERROR,
- (errmsg_internal("could not get token user: error code %lu",
- GetLastError())));
+ (errmsg_internal("could not get token information: error code %lu",
+ GetLastError())));
CloseHandle(token);
diff --git a/src/port/win32security.c b/src/port/win32security.c
index d3eba9a20b5..ab9cd67748d 100644
--- a/src/port/win32security.c
+++ b/src/port/win32security.c
@@ -248,14 +248,14 @@ pgwin32_get_dynamic_tokeninfo(HANDLE token, TOKEN_INFORMATION_CLASS class,
if (GetTokenInformation(token, class, NULL, 0, &InfoBufferSize))
{
snprintf(errbuf, errsize,
- "could not get token information: got zero size\n");
+ "could not get token information buffer size: got zero size\n");
return FALSE;
}
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
snprintf(errbuf, errsize,
- "could not get token information: error code %lu\n",
+ "could not get token information buffer size: error code %lu\n",
GetLastError());
return FALSE;
}
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 343fd19b554..167444591df 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -904,7 +904,7 @@ current_windows_user(const char **acct, const char **dom)
if (!GetTokenInformation(token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
{
fprintf(stderr,
- _("%s: could not get token user size: error code %lu\n"),
+ _("%s: could not get token information buffer size: error code %lu\n"),
progname, GetLastError());
exit(2);
}
@@ -912,7 +912,7 @@ current_windows_user(const char **acct, const char **dom)
if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
{
fprintf(stderr,
- _("%s: could not get token user: error code %lu\n"),
+ _("%s: could not get token information: error code %lu\n"),
progname, GetLastError());
exit(2);
}