pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [COMMITTERS] pgsql: Refer to a TOKEN_USER payload as a "token user, " not as a "user
Date: Sat, 2 Apr 2016 23:02:23 -0400
Message-ID: <20160403030223.GA1583947@tornado.leadboat.com> (raw)
In-Reply-To: <9653.1459566421@sss.pgh.pa.us>
References: <E1amAnM-00064w-Mf@gemulon.postgresql.org>
	<20160402021211.GH10850@tamriel.snowman.net>
	<20160402024613.GC1545657@tornado.leadboat.com>
	<20160402025113.GI10850@tamriel.snowman.net>
	<9653.1459566421@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Fri, Apr 01, 2016 at 11:07:01PM -0400, Tom Lane wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> > * Noah Misch (noah@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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments: download all (2 files, .tar.gz)

token-msg-dedup-v1.patch (text/plain, 520B) download 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) +
token-user-v1.patch (text/plain, 2.6K) download 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); }

view thread (8+ messages)  latest in thread

Message-ID: <20160403030223.GA1583947@tornado.leadboat.com>
Permalink:  ../20160403030223.GA1583947@tornado.leadboat.com/
Also on:    postgresql.org/message-id/20160403030223.GA1583947@tornado.leadboat.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, sfrost@snowman.net, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Refer to a TOKEN_USER payload as a "token user, " not as a "user
  In-Reply-To: <20160403030223.GA1583947@tornado.leadboat.com>
  References: <E1amAnM-00064w-Mf@gemulon.postgresql.org> <20160402021211.GH10850@tamriel.snowman.net> <20160402024613.GC1545657@tornado.leadboat.com> <20160402025113.GI10850@tamriel.snowman.net> <9653.1459566421@sss.pgh.pa.us> <20160403030223.GA1583947@tornado.leadboat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox