On Fri, Apr 01, 2016 at 11:07:01PM -0400, Tom Lane wrote: > Stephen Frost <sfr...@snowman.net> writes: > > * Noah Misch (n...@leadboat.com) wrote: > >> I see some advantages of writing "TokenUser", as you propose. However, our > >> error style guide says "Avoid mentioning called function names, either; > >> instead say what the code was trying to do." Mentioning an enumerator > >> name is > >> morally similar to mentioning a function name. > > > That's a fair point, but it doesn't mean we should use a different > > spelling for the enumerator name to avoid that piece of the policy. I > > certianly don't see "token user" as saying "what the code was trying to > > do" in this case. > > FWIW, "token user" conveys entirely inappropriate, politically incorrect > connotations to me ;-). I don't have any great suggestions on what to use > instead, but I share Stephen's unhappiness with the wording as-committed.
The wording in GetTokenUser() and AddUserToTokenDacl() seems fine; let's standardize on that. Also, every GetTokenUser() failure has been yielding two messages, the second contributing no further detail. I'll reduce that to the usual one message per failure. nm
diff --git a/src/common/exec.c b/src/common/exec.c index ec8c655..d736b02 100644 --- a/src/common/exec.c +++ b/src/common/exec.c @@ -674,10 +674,7 @@ AddUserToTokenDacl(HANDLE hToken) /* Get the current user SID */ if (!GetTokenUser(hToken, &pTokenUser)) - { - log_error("could not get token user: error code %lu", GetLastError()); - goto cleanup; - } + goto cleanup; /* callee printed a message */ /* Figure out the size of the new ACL */ dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) +
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index 2751183..f21056e 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 d3eba9a..ab9cd67 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 416829d..dcafcf1 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); }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers