[SR-Users] ldap returning attributes list

Daniel-Constantin Mierla miconda at gmail.com
Fri Sep 5 10:33:52 CEST 2014


Hello,

On 04/09/14 14:49, Virmantas Variakojis wrote:
> Hi,
>
> I'm trying to fetch attribute list with kamailio ldap_search:
>
> ldap_search("ldap://agents/ou=Xxxxx,dc=xxxx,dc=yyyyyy,dc=zz?memberOf?sub?(sAMAccountName=$fU)");
>
> ldap_result("memberOf/$avp(s:ldapmemberof1)");
> xlog("L_INFO", "LDAP $fU memberOf = $avp(s:ldapmemberof1)");
> if (ldap_result_next())
> {
> xlog("L_INFO", "if loop ldap_result");
>            ldap_result("memberOf/$avp(s:ldapmemberof2)");
>            xlog("L_INFO", "LDAP $fU memberOf = $avp(s:ldapmemberof2)");
> }
>
> There's must be seven returning attributes list of memberOf, but I can 
> only retrieve only one of them (looks like last of seven). First xlog 
> output log into my log file, but if loop didn't start. What I'm doing 
> wrong?

IF is not a loop, it does one time testing. If you want a loop, then use 
WHILE, like:

while(ldap_result_next()) {
...
}

Cheers,
Daniel
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140905/6547c477/attachment.html>


More information about the sr-users mailing list