Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZdVAh-0004bQ-Ep for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Sep 2015 03:20:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZdVAf-000845-VI for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Sep 2015 03:20:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZdUW5-0007CV-FB for pgsql-bugs@postgresql.org; Sun, 20 Sep 2015 02:38:13 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZdUW0-0002sS-M4 for pgsql-bugs@postgresql.org; Sun, 20 Sep 2015 02:38:11 +0000 MIME-Version: 1.0 Subject: BUG #13625: LDAP connections via UNIX sockets To: pgsql-bugs@postgresql.org From: rysiek@hackerspace.pl Date: Sun, 20 Sep 2015 02:37:54 +0000 Message-ID: <20150920023754.313.74771@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13625 Logged by: rysiek Email address: rysiek@hackerspace.pl PostgreSQL version: 9.4.4 Operating system: Debian GNU/Linux Description: PostgreSQL does not seem to support LDAP connections via UNIX sockets, due to use of deprecated function `ldap_init()`. The documentation contains ample information on connecting to LDAP: http://www.postgresql.org/docs/9.4/static/auth-methods.html#AUTH-LDAP However, there seems no way of providing a UNIX socket path for connection. Combinations tried: ldapurl="ldap:///var/run/slapd/ldapi/dc=example,dc=com?cn" ldapurl="ldap://%2fvar%2frun%2fslapd%2fldapi/dc=example,dc=com?cn" ldapurl="ldap://%x2fvar%x2frun%x2fslapd%x2fldapi/dc=example,dc=com?cn" ldapurl="ldapi:///var/run/slapd/ldapi/dc=example,dc=com?cn" ldapurl="ldapi://%2fvar%2frun%2fslapd%2fldapi/dc=example,dc=com?cn" ldapurl="ldapi://%x2fvar%x2frun%x2fslapd%x2fldapi/dc=example,dc=com?cn" ldapserver="/var/run/slapd/ldapi" ldapserver="%2fvar%2frun%2fslapd%2fldapi" ldapserver="%x2fvar%x2frun%x2fslapd%x2fldapi" ldapserver="ldapi:///var/run/slapd/ldapi" ldapserver="ldapi://%2fvar%2frun%2fslapd%2fldapi" ldapserver="ldapi://%x2fvar%x2frun%x2fslapd%x2fldapi" Some of these cause PostgreSQL not to start at all, either with exit code 1 or 139; some fail when authentication is required, either with "LOG: could not initialize LDAP: No such file or directory" or " LOG: could not perform initial LDAP bind for ldapbinddn "(null)" on server "/var/run/slapd/ldapi": Can't contact LDAP server" The socket does exist and `ldapsearch` utility successfuly connects and retrieves data from the LDAP server. PostgreSQL uses `ldap_init()` function in code; http://git.postgresql.org/gitweb/?p=postgresql.git&a=search&h=HEAD&st=grep&s=ldap_init This function is, however, deprecated: http://www.openldap.org/software//man.cgi?query=ldap_init&sektion=3&apropos=0&manpath=OpenLDAP+2.4-Release "At this time, ldap_open() and ldap_init() are deprecated in favor of ldap_initialize(), essentially because the latter allows to specify a schema in the URI and it explicitly returns an error code." Switching to `ldap_initialize()` would not only mean that a deprecated function is not used anymore, but also would allow PostgreSQL to utilize UNIX socket LDAP connections. -- Regards, Michał "rysiek" Woźniak http://rys.io/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs