Permalink
Browse files

initial working on the phoenix

  • Loading branch information...
guedes committed Jan 24, 2013
1 parent 99620ed commit e769a60c152bb67fcfac19d99adf4bb8fc4b16d4
Showing with 452 additions and 325 deletions.
  1. +5 −1 Makefile
  2. +24 −0 results/base.out
  3. +2 −6 sql/ldap_fdw.sql
  4. +381 −310 src/ldap_fdw.c
  5. +24 −2 test/expected/base.out
  6. +16 −6 test/sql/base.sql
View
@@ -6,8 +6,12 @@ DOCS = $(wildcard doc/*.md)
TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-language=plpgsql
-MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
+#MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
+MODULE_big = $(EXTENSION)
+OBJS = src/ldap_fdw.o
PG_CONFIG = `which pg_config`
+SHLIB_LINK += -lldap
+
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)
ifeq ($(PG91),yes)
View
@@ -0,0 +1,24 @@
+CREATE EXTENSION ldap_fdw;
+CREATE SERVER ldap_test_server
+FOREIGN DATA WRAPPER ldap_fdw
+OPTIONS ( address 'localhost', port '389');
+CREATE USER MAPPING FOR current_user
+SERVER ldap_test_server
+OPTIONS (user_dn 'cn=admin,dc=guedesoft,dc=net', password 'ldap');
+CREATE FOREIGN TABLE ldap_people (
+ dn text,
+ object_body text
+)
+SERVER ldap_test_server
+OPTIONS (base_dn 'DC=guedesoft,DC=net');
+SELECT * FROM ldap_people WHERE dn = 'cn=admin,dc=guedesoft,dc=net';
+ dn | object_body
+------------------------------+------------------------------------------------------
+ cn=admin,dc=guedesoft,dc=net | objectClass: simpleSecurityObject +
+ | ,organizationalRole +
+ | cn: admin +
+ | description: LDAP administrator +
+ | userPassword: {SSHA}W0P/R7GRoqr1sl2JMMnG0TXn1UP1uVn6+
+ |
+(1 row)
+
View
@@ -7,18 +7,14 @@
-- create wrapper with validator and handler
CREATE OR REPLACE FUNCTION ldap_fdw_validator (text[], oid)
RETURNS bool
-AS 'MODULE_PATHNAME'
+AS 'ldap_fdw'
LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION ldap_fdw_handler ()
RETURNS fdw_handler
-AS 'MODULE_PATHNAME'
+AS 'ldap_fdw'
LANGUAGE C STRICT;
CREATE FOREIGN DATA WRAPPER ldap_fdw
VALIDATOR ldap_fdw_validator HANDLER ldap_fdw_handler;
-CREATE SERVER ldap_local_service
-FOREIGN DATA WRAPPER ldap_fdw
-OPTIONS ( address 'localhost', port '389');
-
Oops, something went wrong.

0 comments on commit e769a60

Please sign in to comment.