Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6W9u-0004aI-B8 for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 13:56:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s6W9u-000B8R-9c for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 13:56:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6W9t-000B8J-VY for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 13:56:05 +0000 Received: from mail-yb1-f173.google.com ([209.85.219.173]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6W9o-00014J-Nj for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 13:56:05 +0000 Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-de8b66d1726so4403903276.0 for ; Mon, 13 May 2024 06:56:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715608560; x=1716213360; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5QTFnN6x23oWEZbcYRZMz1V0GjalVrlBkjexrbRof84=; b=bnyY9HNqUvwmTVzOC+xYxTBvFea6TNKw/K9+M4DkqFhfC6/9hD+YBA/LLLYpPT2p3e p8I+tcJ6QDi3iuclIotW4p3sjkty5xUV5Md/IZsFfiEgdYGO9uBA3TiR48/pe9rTXN43 K2uESiOWrYn5abux2qrpR/C2w2E74o2U2qRHW4YBpKmBdljkV0hY28pcgjssbFtamgS3 ZRTM0OFKiTeuBDQEJB4ymo61z3O4kqH70/eEBRCLPmYW0fUbh3HFCalUUckjusZ8FJZD u2CxOFYfpLsxI3gePwZigQAanFd+wCCXyhoP+r+A2womhZsgccwIJXx2YszdFh6Li/Vs i0jg== X-Forwarded-Encrypted: i=1; AJvYcCXTAyO3dB4QYrrMmk5CjzxBW5PVKXtH+KfwI9oNyYKam/VQCbo+3Wzq1ZY8C80mD8i1YkSqkLyhPOUkQqZS3nQ9xLSIWizjhdlMBgX4LHkpjOf4 X-Gm-Message-State: AOJu0YzmMcZ3OyA4yyRtcZ5gKXzS2VaIUqQMBV17UsWQnCXTiURhagqJ qNs2fyUIWsozQezC638k6k29klT14jlrlRwtm+mkbuEJO4hFoT6dDkvN8/sEH5RMH2a8Zm4/XEs CizEmqsxjxlmBpMqoPeJ5dK/8+oOjQHo7uRcheQ== X-Google-Smtp-Source: AGHT+IGn+QRgTbzoP2bTR7m4NH7B8Y3+JwstxMVIjfr8+ZbLOj+Td6z4r1fm39ZdI0OEr5RhPNnoXav1PFXvdm/E4HI= X-Received: by 2002:a5b:f52:0:b0:dcf:eb30:c580 with SMTP id 3f1490d57ef6-dee4e478519mr7089719276.3.1715608559815; Mon, 13 May 2024 06:55:59 -0700 (PDT) MIME-Version: 1.0 References: <5a79ed71-b365-4b20-80bc-9c2bf97bf84b@iki.fi> <3a6f126c-e1aa-4dcc-9252-9868308f6cf0@iki.fi> <1a717f65-7390-4111-8efd-c6e9b213805e@iki.fi> <3fdaf4b1-82d1-45bb-8175-f97ff53a1f01@iki.fi> In-Reply-To: <3fdaf4b1-82d1-45bb-8175-f97ff53a1f01@iki.fi> From: Jelte Fennema-Nio Date: Mon, 13 May 2024 15:55:48 +0200 Message-ID: Subject: Re: Direct SSL connection with ALPN and HBA rules To: Heikki Linnakangas Cc: Jacob Champion , Daniel Gustafsson , Robert Haas , Michael Paquier , Postgres hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 13 May 2024 at 15:38, Heikki Linnakangas wrote: > Here's a patch to implement that. + if (conn->sslnegotiation[0] == 'd' && + conn->sslmode[0] != 'r' && conn->sslmode[0] != 'v') I think these checks should use strcmp instead of checking magic first characters. I see this same clever trick is used in the recently added init_allowed_encryption_methods, and I think that should be changed to use strcmp too for readability.