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.96) (envelope-from ) id 1w6FyK-00474z-00 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 22:48:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6FyH-00Ca48-04 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 22:48:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w6FyG-00Ca3y-2G for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 22:48:05 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6FyF-00000001P2B-06HB for pgsql-hackers@postgresql.org; Fri, 27 Mar 2026 22:48:03 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-486ff3a0fc1so24874265e9.2 for ; Fri, 27 Mar 2026 15:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774651681; x=1775256481; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=29q2we7kStFLeT3qYefAN+KzNcmeH+0gjJ2bHa22ClY=; b=NR63mMlYFudQPeP4r+bAwKNwUf48ZSGuM8vaFQLPqyXqDa8GSuZZ7vVKvpklTsws5l 8kIGdUgQBK8qI9WdH/nypA7hvXWmVNZkqtVs+f2oXgmsRgS0r+nQUqGFInD5l9YjfAus ATpoQNnOZ2uHYKbr2n4dYOhgEzRPWoQEK9pA7r6wrvz3vT7H+86i+4vBXxzcoVj5LPy5 AlWEc1qbhbcb94LTh7I14YJ/bt7fg9IMU2aAi5jFXDMH5aOA8G8QtwFS0QQu4YaQlQte mlHmlctQLInLnUbTpTa0laWCkP2WNRoXbwNBc5cBVR2qg+f9z9+kcOK0cgRM5xGjb1X8 qyjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774651681; x=1775256481; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=29q2we7kStFLeT3qYefAN+KzNcmeH+0gjJ2bHa22ClY=; b=NJtBMRzHrSAMHAfMpUvdJqeqLx1RhtwYdUdwPjl7LdgjwT+oVV54lRvRCRZStMNxMp EN16jEEldgp9M718XIQBC/IUISewHCQAAQbjL+1/W4U1lU5i68kUMQVvbOYxtp8t3u/r 6UsINAyX77fN8Ix3Xv6Yq3crIZN+0A/O69HzzDFWFOL55HoOiUXroMC8Vmhhy3jK29E9 YmWw5neUcQIE7zWTFe5nRU0xsgJPJc5OQHZO0dWt26ya779FfMdopJy1oVWDMq6bJgx6 mk22pSe4AN7h/rE2jtjZh8tw9WiIKixxVL5BEGV2mcUF5Z9yROQVoxsPhNyofDMOUAyt K7wQ== X-Forwarded-Encrypted: i=1; AJvYcCViN2N9B7u6T4bkeeeMnZ9Ckk4wZV0PXHnU8INDT6VrfPuBaSkLPnqgtQ4uIzJFeSuDqsaOIUT10z9yiRaP@postgresql.org X-Gm-Message-State: AOJu0YwRN2QL/SbZJxpBSDkz56RP3RL3FsJwwGDm21eoN0mDzjtMk73p b2HPcedOPEWfG0G81alz9AlJvVJdfr0R005bGHloEjc9qCLkl0ubPCVl08mf3aa7EZ8= X-Gm-Gg: ATEYQzyJrLbpCsCBJTqtFdLE2LLFsmffIUthpYSFUbVX3fvXF7rYmSM4/W9RswZiHk9 5EwJbuquOax+srF8GaCHayNusK/NnTLxgfm5VD0OZ9PyI13Yby8DClLolyTeaM1NZcCo1aFfNbt KDBEZE2iZvqMMq0sFyK/7kf/ufBLT5we9+orptPSu7SggTOMTcBRwjEDc72uEwGYuyfeunO/3Dv WqcLmx7cgf2wVt03SVa2yDVUjm4Ef6ANp/ijIWcArgFlASiEUMsHDmxuXbw2YYq9tZjtZfrmf4B aBlOiXNqypXp7jF7MKFExZrCdvu0EdJee1GttDclp49dNcPmrpwTh2B0mDMeKdg/kK7AIdKlp+6 ZUrM1TuXhT6FVceZf0Zq5k+i5dpcJdlC5xeczHmv4v6JkSFa6tO73Vlu41P6yDCR4cT6utCdM3d +CPHxeW+iFgDuTP4bgUDQ691+2ba6p3gbFTOXESFrlf6jE81FFH5utNFY= X-Received: by 2002:a05:600c:3b95:b0:485:419c:4eba with SMTP id 5b1f17b1804b1-48727d595b5mr63707435e9.1.1774651681288; Fri, 27 Mar 2026 15:48:01 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:4fd5:603f:45c2:9807:c104]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48722c845b8sm107945885e9.4.2026.03.27.15.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 15:48:00 -0700 (PDT) Message-ID: Subject: Re: Add ldapservice connection parameter From: Laurenz Albe To: Andrew Jackson , pgsql-hackers Cc: Roman Khapov , niushiji@gmail.com Date: Fri, 27 Mar 2026 23:48:00 +0100 In-Reply-To: References: <9FF1E1E8-D9EE-43C5-ADFA-7AE94BA57159@yandex-team.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2026-03-22 at 18:38 -0500, Andrew Jackson wrote: > Noticed 1 variable that was unused during non-LDAP builds. Tested > locally and did not see the error/warning. Also some minor cleanup > (comments, definition placement, etc). I don't have an LDAP server handy, so I couldn't test the patch, but I read through it. I think that this is a useful addition. +#ifdef USE_LDAP + if (ldapservice !=3D NULL) + if (strncmp(ldapservice, "ldap", 4) =3D=3D 0) + if (!ldapServiceLookup(ldapservice, options, errorMessage)) + return 0; +#endif I think that the test if the string starts with "ldap" is midguided. It was probably copied from the other call site of ldapServiceLookup(), but there it is necessary, because an entry in the connection service file could start with something else. A value for the parameter "ldapservice" that doesn't start with "ldap" should cause an error. ldapServiceLookup() checks if the string starts with "ldap://" and throws an error if it doesn't. So I'd say that you should simply remove the test if the string starts with "ldap". I also think that it is wrong to return 0 (success) if ldapServiceLookup() fails. Why should it be OK to specify a bad LDAP URL? I don't understand why that code is in parseServiceInfo(). After all, it has nothing to do with a connection service file. Calling it from conninfo_add_defaults() would make more sense to me. For the same reason, I am not entirely happy with the name "ldapservice", but I can't think of anything better. The way your code is now, "ldapservice" sets default values that get overridden by explicitly named parameters. I think the documentation should mention that. Yours, Laurenz Albe