[pmwiki-users] got ldaps working

Michael Brenner mik.admin at nurfuerspam.de
Tue Aug 15 02:38:54 CDT 2006


PmWiki is so great, especially the LDAP feature. Since I have a ldaps Server 
aviable I tried to use it. By default it doesn't work but with some trail and 
error I finally succed. Because other people might find this feature useful, 
too: Here are the necessary modification.


In function AuthUserId
if(!preg_match_all('/\\b(?:ldap|ldaps):\\S+|[^\\s,]+/', $m[2], $v))
//if (!preg_match_all('/\\bldap:\\S+|[^\\s,]+/', $m[2], $v))

in function AuthUserLDAP
if(!preg_match('!((?:ldaps|ldap)://[^/]+)?/(.+)$!', $ldap, $match))
//if (!preg_match('!ldap://([^:]+)(?::(\\d+))?/(.+)$!', $ldap, $match))
//if(!isset($port)) $port=389; // is obsolet
$ds = ldap_connect($server); // no portargument is need -> URL contains it

PLEASE BE CAREFUL WITH THIS CODE. I never programmed PHP more than 'hello 
world' the same is with regex.
URL feature of ldap_connect is used, see 

Greetings from Germany

More information about the pmwiki-users mailing list