LDAP lookup of connection parameters
This patch for libpq allows you to enter an LDAP URL in pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.
The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.
On Windows the native library wldap32.dll is used, else OpenLDAP.
If --enable_thread_safety has been given, -lldap_r is appended to
PTHREAD_LIBS so that libpq will be linked against the tread safe
library.
There should probably also be a documentation patch for the --with-ldap
option of ./configure, but I didn't write it because it also belongs to
the
"LDAP Auth" patch.
I have added German translations for the new messages - how can I get
translations into other languages?
Yours,
Laurenz Albe
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.
I forgot to mention that there was a discussion on Hackers about this:
http://archives.postgresql.org/pgsql-hackers/2006-02/msg01182.php
I have implemented a solution following the idea of
http://archives.postgresql.org/pgsql-hackers/2006-02/msg01198.php
because I thought that it was better to have something existing to
talk about.
Yours,
Laurenz Albe
Import Notes
Resolved by subject fallback
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.
I forgot to mention that there was a brief discussion about this on
Hackers:
http://archives.postgresql.org/pgsql-hackers/2006-02/msg00828.php
My implementation follows the idea from
http://archives.postgresql.org/pgsql-hackers/2006-02/msg01198.php
I thought it would be good to have some real code as a basis for
further discussion whether this is a desirable feature or not.
I felt somewhat encouraged because PostgreSQL already has a
dependency on OpenLDAP since
http://archives.postgresql.org/pgsql-patches/2005-12/msg00375.php
and I do not have to introduce a new dependency.
Yours,
Laurenz Albe
Import Notes
Resolved by subject fallback
Albe Laurenz wrote:
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.I forgot to mention that there was a brief discussion about this on
Hackers:
http://archives.postgresql.org/pgsql-hackers/2006-02/msg00828.phpMy implementation follows the idea from
http://archives.postgresql.org/pgsql-hackers/2006-02/msg01198.phpI thought it would be good to have some real code as a basis for
further discussion whether this is a desirable feature or not.I felt somewhat encouraged because PostgreSQL already has a
dependency on OpenLDAP since
http://archives.postgresql.org/pgsql-patches/2005-12/msg00375.php
and I do not have to introduce a new dependency.
Where are we on this? It allows pg_service.conf to query LDAP for
connection strings. Is it a feature people want?
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
I am confused why this patch requires libldap_r. Is there a need for
threading? Should this be contingent on whether the threading flag was
passed to configure?
---------------------------------------------------------------------------
Albe Laurenz wrote:
This patch for libpq allows you to enter an LDAP URL in pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.On Windows the native library wldap32.dll is used, else OpenLDAP.
If --enable_thread_safety has been given, -lldap_r is appended to
PTHREAD_LIBS so that libpq will be linked against the tread safe
library.There should probably also be a documentation patch for the --with-ldap
option of ./configure, but I didn't write it because it also belongs to
the
"LDAP Auth" patch.I have added German translations for the new messages - how can I get
translations into other languages?Yours,
Laurenz Albe
Content-Description: ldap_service.patch
[ Attachment, skipping... ]
Content-Description: ldap_service_doc.patch
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Albe Laurenz wrote:
This patch for libpq allows you to enter an LDAP URL in pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.The idea is to have connection information stored centrally on an LDAP
server rather than on the client machine.On Windows the native library wldap32.dll is used, else OpenLDAP.
If --enable_thread_safety has been given, -lldap_r is appended to
PTHREAD_LIBS so that libpq will be linked against the tread safe
library.There should probably also be a documentation patch for the --with-ldap
option of ./configure, but I didn't write it because it also belongs to
the "LDAP Auth" patch.I have added German translations for the new messages - how can I get
translations into other languages?
Translations are done later in the release process.
I have heavily modified your patch to be clearer. Please review the
attached version and test it to make sure it still works properly.
Thanks.
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachments:
/pgpatches/ldaptext/x-diffDownload+509-2
Bruce Momjian wrote:
Albe Laurenz wrote:
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.I have heavily modified your patch to be clearer. Please review the
attached version and test it to make sure it still works properly.
Thanks.
Most of your modifications are fine, but a quick look tells me that your
modifications in the parsing of the LDAP URL have been too invasive,
e.g.:
- you look for the port number in the 'dn' and not in the 'hostname'
- you check the validity of 'scopestr' and 'attrs[0]' before it is
'\0'-terminated
Would you prefer that I try to fix your fixes (and stick with your
coding style)
or do you want another go?
Yours,
Laurenz Albe
Import Notes
Resolved by subject fallback
Albe Laurenz wrote:
Bruce Momjian wrote:
Albe Laurenz wrote:
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.I have heavily modified your patch to be clearer. Please review the
attached version and test it to make sure it still works properly.
Thanks.Most of your modifications are fine, but a quick look tells me that your
modifications in the parsing of the LDAP URL have been too invasive,
e.g.:- you look for the port number in the 'dn' and not in the 'hostname'
- you check the validity of 'scopestr' and 'attrs[0]' before it is
'\0'-terminatedWould you prefer that I try to fix your fixes (and stick with your
coding style)
or do you want another go?
Thanks for the review. Updated patch attached. Is that OK?
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachments:
/pgpatches/ldaptext/x-diffDownload+512-2
Bruce Momjian wrote:
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.I have heavily modified your patch to be clearer. Please
review the
attached version and test it to make sure it still works
properly.Thanks for the review. Updated patch attached. Is that OK?
Mostly yes, and I must admit that the code has become more
readable. There were two syntax errors and some minor odds
and ends (partly my fault).
I have slightly changed your patch and submit it again
(diff the patches to see).
Thanks for the effort,
Laurenz Albe
Attachments:
ldap_v2.patchapplication/octet-stream; name=ldap_v2.patchDownload+512-2
Import Notes
Resolved by subject fallback
Patch applied. Thanks.
---------------------------------------------------------------------------
Albe Laurenz wrote:
Bruce Momjian wrote:
This patch for libpq allows you to enter an LDAP URL in
pg_service.conf.
The URL will be queried and the resulting string(s) parsed for
keyword = value connection options.I have heavily modified your patch to be clearer. Please
review the
attached version and test it to make sure it still works
properly.Thanks for the review. Updated patch attached. Is that OK?
Mostly yes, and I must admit that the code has become more
readable. There were two syntax errors and some minor odds
and ends (partly my fault).I have slightly changed your patch and submit it again
(diff the patches to see).Thanks for the effort,
Laurenz Albe
Content-Description: ldap_v2.patch
[ Attachment, skipping... ]
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +