Hello,
I updated ldap4pl to work correctly with UTF-8 (at least on Windows, don’t know whether there were problems on linux, where I think UTF-8 is the internal encoding).
Anyone willing to test (especially on non-windows platforms) is very welcome. (So far I only tested searching, no writes [on production ActiveDirectory …])
It should build without problems at least on MSYS2 x64, but since the changes are minimal, I’d expect it should work on other platforms.
(so far, i neglected updating any package info etc.).
the repository is available at: https://github.com/nuclear-ares/ldap4pl
?- pack_install('git://github.com/nuclear-ares/ldap4pl.git').
testing script (ldtest.pl):
:- module(ldtest, [search/0]).
:- use_module(library(ldap4pl)).
:- use_module(library(ldap4pl_util)).
search :-
ldap_initialize(LDAP, 'ldap://ldap.forumsys.com'),
ldap_set_option(LDAP, ldap_opt_protocol_version, 3),
ldap_simple_bind_s(LDAP,
'cn=read-only-admin,dc=example,dc=com',
'password'),
ldap_search(LDAP,
query(
base('dc=example,dc=com'),
scope(ldap_scope_subtree),
filter('(objectClass=*)'),
attrs([objectClass, description, cn]),
attrsonly(false)
),
MsgID),
ldap_result(LDAP, MsgID, true, Result),
ldap_parse_result(LDAP, Result, _, _, _, _, _, false),
ldap_parse_search_result(LDAP, Result, List),
print_term(List, []),
ldap_msgfree(Result),
ldap_unbind(LDAP).
Pre-set for free internet testing LDAP instance (or substitute your own). Test / sample output:
?- ['ldtest.pl'].
true.
?- ldtest:search.
[ _{ attributes:_{objectClass:[top,dcObject,organization]},
dn:'dc=example,dc=com'
},
_{ attributes:_{ cn:[admin],
description:['LDAP administrator'],
objectClass:[ simpleSecurityObject,
organizationalRole
]
},
dn:'cn=admin,dc=example,dc=com'
},
_{ attributes:_{ cn:['Isaac Newton'],
objectClass:[ inetOrgPerson,
organizationalPerson,
person,
top
]
},
dn:'uid=newton,dc=example,dc=com'
},
... ... ... ...
Thanks in advance to anyone willing to test it (let me know it works on other platforms, and I’ll send pull request to original repo (or update package info if dead).
Cheers, ares.