From f6a168e2c38bbf89a6fe6d896242988ee1305121 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 14 Sep 2007 14:31:22 +0000
Subject: [PATCH] Add LDAP URL documentation.

Albe Laurenz
---
 doc/src/sgml/libpq.sgml                     | 15 ++++++++++++++-
 doc/src/sgml/ref/psql-ref.sgml              |  4 +++-
 src/interfaces/libpq/pg_service.conf.sample |  3 ++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 448a24d074c..1c033e30841 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.243 2007/09/02 01:13:55 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.244 2007/09/14 14:31:22 momjian Exp $ -->
 
 <chapter id="libpq">
  <title><application>libpq</application> - C Library</title>
@@ -5085,6 +5085,19 @@ defaultNoticeProcessor(void *arg, const char *message)
     ldap://ldap.mycompany.com/dc=mycompany,dc=com?uniqueMember?one?(cn=mydatabase)
    </synopsis>
   </para>
+
+  <para>
+   You can also mix regular service file entries with LDAP lookups.
+   A complete example for a stanza in <filename>pg_service.conf</filename>
+   would be:
+   <synopsis>
+    # only host and port are stored in LDAP, specify dbname and user explicitly
+    [customerdb]
+    dbname=customer
+    user=appuser
+    ldap://ldap.acme.com/cn=dbserver,cn=hosts?pgconnectinfo?base?(objectclass=*)
+   </synopsis>
+  <para>
  </sect1>
 
 
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index c01f1f5cc8a..bf63e162d20 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1,5 +1,5 @@
 <!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.194 2007/08/22 04:45:20 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.195 2007/09/14 14:31:22 momjian Exp $
 PostgreSQL documentation
 -->
 
@@ -567,6 +567,8 @@ PostgreSQL documentation
 <programlisting>
 $ <userinput>psql "service=myservice sslmode=require"</userinput>
 </programlisting>
+     This way you can also use LDAP for connection parameter lookup as
+     described in <xref linkend="libpq-ldap">.
      See <xref linkend="libpq-connect"> for more information on all the
      available connection options.
     </para>
diff --git a/src/interfaces/libpq/pg_service.conf.sample b/src/interfaces/libpq/pg_service.conf.sample
index 8a22fda95a2..de60028177c 100644
--- a/src/interfaces/libpq/pg_service.conf.sample
+++ b/src/interfaces/libpq/pg_service.conf.sample
@@ -4,7 +4,8 @@
 # A service is a set of named connection parameters.  You may specify
 # multiple services in this file.  Each starts with a service name in  
 # brackets.  Subsequent lines have connection configuration parameters of
-# the pattern  "param=value".  A sample configuration for postgres is 
+# the pattern "param=value" or LDAP URLs starting with "ldap://"
+# to look up such parameters.  A sample configuration for postgres is 
 # included in this file.  Lines beginning with '#' are comments.
 #
 # Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
-- 
GitLab