Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQv64-00066r-RM for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Aug 2022 18:27:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oQv63-0001PP-Ni for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Aug 2022 18:27:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQv62-0001PF-SV for pgsql-hackers@lists.postgresql.org; Wed, 24 Aug 2022 18:27:23 +0000 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQv5w-000303-F0 for pgsql-hackers@lists.postgresql.org; Wed, 24 Aug 2022 18:27:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1661365636; x=1692901636; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=07L7ugwSu2G0pjgwbG5rB8ByyPK5geZYptUL1BJLv/0=; b=MlYPR/m6lp9nnFxYOMRNC26YznXpywe1qSYUwpoL9eR/TvHgN7ppMpn9 vLDj+T12L67rJatY3GJIb+mMAQg/K3QGn7PBfwlKJqSTGcwNjzlphvZhg uu9z0Kgbz6BfJopWS1Cnv7WVGcNw5vnXxQeYjeoQuISiwFf4JNyiqurgu Y=; X-IronPort-AV: E=Sophos;i="5.93,261,1654560000"; d="scan'208";a="1047769304" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-02ee77e7.us-west-2.amazon.com) ([10.25.36.214]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2022 18:26:58 +0000 Received: from EX13D03EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-02ee77e7.us-west-2.amazon.com (Postfix) with ESMTPS id 16B2244B9A; Wed, 24 Aug 2022 18:26:58 +0000 (UTC) Received: from [10.95.69.36] (10.43.161.172) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Wed, 24 Aug 2022 18:26:54 +0000 Message-ID: <1da0e60c-bd85-9f2d-2039-103055338b00@amazon.com> Date: Wed, 24 Aug 2022 20:26:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: SYSTEM_USER reserved word implementation Content-Language: en-US To: Michael Paquier CC: Jacob Champion , Alvaro Herrera , Tom Lane , Joe Conway , PostgreSQL Hackers References: <20220627173250.46lvecpvuunc7pf5@alvherre.pgsql> <24d638c7-16f6-afb9-c25c-6a29c169210e@amazon.com> <8fe1752a-2e3d-4ee8-656c-0caf5d860b0e@amazon.com> From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.161.172] X-ClientProxiedBy: EX13D04UWA002.ant.amazon.com (10.43.160.31) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 8/24/22 6:27 AM, Michael Paquier wrote: > On Wed, Aug 17, 2022 at 04:48:42PM +0200, Drouvot, Bertrand wrote: >> That way one could test the SYSTEM_USER behavior without the need to have >> kerberos enabled. > I was looking at this patch Thanks for looking at it! > and noticed that SYSTEM_USER returns a > "name", meaning that the value would be automatically truncated at 63 > characters. We shouldn't imply that as authn_ids can be longer than > that, and this issue gets a bit worse once with the auth_method > appended to the string. Good catch! I'll fix that in the next version. Hmm, I think it would make sense to keep system_user() with his friends current_user() and session_user(). But now that system_user() will not return a name anymore (but a text), I think name.c is no longer the right place, what do you think? (If so, where would you suggest?) > > +if (!$use_unix_sockets) > +{ > + plan skip_all => > + "authentication tests cannot run without Unix-domain sockets"; > +} > > Are you sure that !$use_unix_sockets is safe here? Could we have > platforms where we use our port's getpeereid() with $use_unix_sockets > works? That would cause the test to fail with ENOSYS. Hmm. Without > being able to rely on HAVE_GETPEEREID, we could check for the error > generated when the fallback implementation does not work, and skip the > rest of the test. Oh right, I did not think about that, thanks for the suggestion. I'll change this in the next version and simply skip the rest of the test in case we get "peer authentication is not supported on this platform". Regards, -- Bertrand Drouvot Amazon Web Services: https://aws.amazon.com