On 2012-12-04 10:18:36 +0100, Boszormenyi Zoltan wrote:
> 2012-11-13 04:38 keltezéssel, Peter Eisentraut írta:
> >Here is a patch to support RFC 2255 LDAP URLs in pg_hba.conf.  So,
> >instead of, say
> >
> >host ... ldap ldapserver=ldap.example.net ldapbasedn="dc=example, dc=net" 
> >ldapsearchattribute=uid
> >
> >you could write
> >
> >host ... ldap lapurl="ldap://ldap.example.net/dc=example,dc=net?uid?sub";
> >
> >Apache and probably other software uses the same format, and it's easier
> >to have a common format for all such configuration instead of having to
> >translate the information provided by the LDAP admin into each
> >software's particular configuration spellings.
> >
> >I'm using the OpenLDAP-provided URL parsing routine, which means this
> >wouldn't be supported on Windows.  But we already support different
> >authentication settings on different platforms, so this didn't seem such
> >a big problem.
>
> This patch was committed today but it fails to compile for non-ldap configs:
>
> $ ./configure --prefix=$HOME/pg93dev --enable-debug --enable-cassert 
> --enable-depend
>
> make[3]: Entering directory
> `/home/zozo/crosscolumn/psql-c-relax/postgresql.1/src/backend/libpq'
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
> -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
> -g -I../../../src/include -D_GNU_SOURCE   -c -o hba.o hba.c -MMD -MP -MF
> .deps/hba.Po
> hba.c: In function ‘parse_hba_auth_opt’:
> hba.c:1388:23: error: ‘LDAP_SCOPE_SUBTREE’ undeclared (first use in this 
> function)
> hba.c:1388:23: note: each undeclared identifier is reported only once for
> each function it appears in
> hba.c:1451:3: error: unknown type name ‘LDAPURLDesc’
> hba.c:1452:7: warning: unused variable ‘rc’ [-Wunused-variable]
> hba.c:1451:16: warning: unused variable ‘urldata’ [-Wunused-variable]
> make[3]: *** [hba.o] Error 1
>
> The code could use some #ifdef USE_LDAP conditionals.

As I needed to base some stuff on a later commit (5ce108bf3) and I
didn't want to include a revert in the tree, here's what I applied
locally to fix this. Maybe somebody can apply something like that to get
the buildfarm green again?

Greetings,

Andres Freund

--
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
>From 1222c05b6335297e19fd843d3971dab3f5f5a4a7 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@anarazel.de>
Date: Tue, 4 Dec 2012 11:49:38 +0100
Subject: [PATCH] fix build without ldap support after a2fec0a18e4d

---
 src/backend/libpq/hba.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 2bb661c..36ece55 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -1385,7 +1385,9 @@ parse_hba_line(List *line, int line_num)
 static bool
 parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, int line_num)
 {
+#ifdef USE_LDAP
 	hbaline->ldapscope = LDAP_SCOPE_SUBTREE;
+#endif
 
 	if (strcmp(name, "map") == 0)
 	{
@@ -1448,12 +1450,12 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, int line_num)
 	}
 	else if (strcmp(name, "ldapurl") == 0)
 	{
+#ifdef LDAP_API_FEATURE_X_OPENLDAP
 		LDAPURLDesc *urldata;
 		int rc;
 
 		REQUIRE_AUTH_OPTION(uaLDAP, "ldapurl", "ldap");
 
-#ifdef LDAP_API_FEATURE_X_OPENLDAP
 		rc = ldap_url_parse(val, &urldata);
 		if (rc != LDAP_SUCCESS)
 		{
-- 
1.7.10.4

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to