Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG5Tq-0004C7-Ng for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2017 15:56:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG5Tp-0007ME-UP for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Nov 2017 15:56:29 +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 1eG5Tp-0007M2-B5 for pgsql-hackers@lists.postgresql.org; Sat, 18 Nov 2017 15:56:29 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eG5Tl-00041T-Ox for pgsql-hackers@postgresql.org; Sat, 18 Nov 2017 15:56:27 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 228A720754; Sat, 18 Nov 2017 10:56:24 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Sat, 18 Nov 2017 10:56:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=kw0DJP t2fMwhKn3yTl2jj6OgX7x0QxMEEkEthkvi50w=; b=AmT4p/xUzrVRiT+WnVZwhJ EfhdxuR4nbK64SAFPDA5ta4PpBrsVzoPrbhT4/vDMzvIcoTIF44jeWZpc9UHJInO UeGMD9EjzfJwtaca7BaJ5Qm6igGkW11aXsILm6vzcRp087ohfdcGvPi5mL5iVt6g I3R3GxL2b4inQECbKeIBVznUG0xhUJ8IvRBJkB+32K0rzTWmnsFi4ElVC71mlRv3 DQyNkjlYZJxE/rQg6H5WzdnPLl61++MA0ZLSFPbTCPn1vqt5tdwnChOcD7VDGO45 96g1tuvXN2+LHOIOkhRQTCgRP2xP03XNv9o8lBOdj0gzTT7V3ilgTPKWZNGqGKyQ == X-ME-Sender: Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id B45707F961; Sat, 18 Nov 2017 10:56:23 -0500 (EST) Subject: Re: [JDBC] [HACKERS] Channel binding support for SCRAM-SHA-256 To: Michael Paquier References: <20170530151432.GW3151@tamriel.snowman.net> <20170601155042.GG3151@tamriel.snowman.net> <20170602010826.GP3151@tamriel.snowman.net> <7fe055c6-0885-833b-054d-124e3c3acdf9@2ndquadrant.com> <887b6fb7-15fe-239e-2aad-5911d2b0945b@2ndquadrant.com> Cc: =?UTF-8?Q?=c3=81lvaro_Hern=c3=a1ndez_Tortosa?= , "pgsql-hackers@postgresql.org" From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Sat, 18 Nov 2017 10:56:23 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/18/17 06:32, Michael Paquier wrote: > Here are some comments. > > + * The client requires channel biding. Channel binding type > s/biding/binding/. fixed > if (!state->ssl_in_use) > + /* > + * Without SSL, we don't support channel binding. > + * > Better to add brackets if adding a comment. done > + * Read value provided by client; only tls-unique is supported > + * for now. XXX Not sure whether it would be safe to print > + * the name of an unsupported binding type in the error > + * message. Pranksters could print arbitrary strings into the > + * log that way. > That's why I didn't show those strings in the error messages of the > previous versions. Those are useless as well, except for debugging the > feature and the protocol. Right. I left the comment in there as a note to future hackers who want to improve error messages (often myself). > + cbind_header_len = 4 + strlen(state->channel_binding_type); /* > p=type,, */ > + cbind_input_len = cbind_header_len + cbind_data_len; > + cbind_input = malloc(cbind_input_len); > + if (!cbind_input) > + goto oom_error; > + snprintf(cbind_input, cbind_input_len, "p=%s", > state->channel_binding_type); > + memcpy(cbind_input + cbind_header_len, cbind_data, cbind_data_len); > By looking at RFC5802, a base64 encoding of cbind-input is used: > cbind-input = gs2-header [ cbind-data ] > gs2-cbind-flag "," [ authzid ] "," > However you are missing two commands after p=%s, no? fixed I have committed the patch with the above fixes. I'll be off for a week, so perhaps by that time you could make a rebased version of the rest? I'm not sure how much more time I'll have, so maybe it will end up being moved to the next CF. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services