Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amYJ7-00059Y-OV for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Apr 2016 03:02:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1amYJ7-0005sC-9Q for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Apr 2016 03:02:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1amYJ6-0005rU-1j for pgsql-hackers@postgresql.org; Sun, 03 Apr 2016 03:02:32 +0000 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1amYJ2-0004Oq-VW for pgsql-hackers@postgresql.org; Sun, 03 Apr 2016 03:02:30 +0000 Received: by mail-pf0-x232.google.com with SMTP id 184so19300852pff.0 for ; Sat, 02 Apr 2016 20:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=b/QfzrcCp0pC53ECFAoek+ptlZWotqMOvzPtSMwhOoI=; b=BDSIw55uXodR1V9n5M5pMlaGYDNJj6ETFW9JZBjwV3TY6Ldosrn44VMtglhWyGnxFd 4f00ntWAWNCZ3G6YTRf6rso39I6CuED6v1pc9LaFC8ygRQmehtuF1ZJ+TxdYMyszL8gc AyKuKIYY1uiMJAmYnYSCRdgSYol31BxLn3yb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=b/QfzrcCp0pC53ECFAoek+ptlZWotqMOvzPtSMwhOoI=; b=WsqzT/81gXNfiqp2nrIUboLJG0dOUOH5bs7pszyAHmAsMDB5eaz5pzT5YFEQi2vOO7 +H+slUsast8wtx1hGtn6ToZuPSXB4Uhu8yBSyZVTq2ekg9LOdh8shAGHQfSGEvKM6tg3 To96PYKx9odmmi3cUgaZm+25HQG8y7QYi6Op8j7zWdqakKcjzGyx0FNLeIflnVu6XLpc qdiKPb7Exb6QaR/ivQq2DgSNVRO600gfOfqJwmVnMHgMBdSrk0y1nfp7jxjSWt1QS9RC JMhfeztAIKB4A/Kc31yAiL7Lk+JibF/VISXiwgU1vAwdhKWc1Yo+UkJMf8mF8YJL39xQ nicA== X-Gm-Message-State: AD7BkJI1lKXd4hzfg6QO0NtkTeW47zmL7mjlkxlinjb1yz4eCG35I7Sq9l/eUkpI2o9swA== X-Received: by 10.98.15.145 with SMTP id 17mr9903467pfp.19.1459652547142; Sat, 02 Apr 2016 20:02:27 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id tp9sm31952551pab.14.2016.04.02.20.02.25 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 02 Apr 2016 20:02:26 -0700 (PDT) Date: Sat, 2 Apr 2016 23:02:23 -0400 From: Noah Misch To: Tom Lane Cc: Stephen Frost , pgsql-hackers@postgresql.org Subject: Re: Re: [COMMITTERS] pgsql: Refer to a TOKEN_USER payload as a "token user, " not as a "user Message-ID: <20160403030223.GA1583947@tornado.leadboat.com> References: <20160402021211.GH10850@tamriel.snowman.net> <20160402024613.GC1545657@tornado.leadboat.com> <20160402025113.GI10850@tamriel.snowman.net> <9653.1459566421@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <9653.1459566421@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 01, 2016 at 11:07:01PM -0400, Tom Lane wrote: > Stephen Frost 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 --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="token-msg-dedup-v1.patch" 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) + --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="token-user-v1.patch" 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); } --k+w/mQv8wyuph6w0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --k+w/mQv8wyuph6w0--