Re: ppolicy control and change password exop (again)
Guillaume Rousse <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.ldap |
|---|---|
| Message-ID | <[email protected]> |
Graham Barr a écrit : > > On May 27, 2009, at 2:58 AM, Guillaume Rousse wrote: > >> Chris Ridd a écrit : >>> which is "passwordTooShort". So... the server seems OK and it must be >>> the perl code that's going wrong somewhere. If you single-step into >>> result->control does it look like it is finding and returning the >>> right thing? >> Actually, it returns a list of controls, and the code enforce a scalar >> context... >> >> Changing the code to >> my ($response) = $result->control(LDAP_CONTROL_PASSWORDPOLICY); >> is enough to fix the issue. And the documentation is correct, I just >> misread it :( >> >> Having the method named controlS would have been less error-prone but >> I guess it's a bit late to change it. > > Actually I htink there is a bug. As you only have one control in your > response, if you did > > my $response = $result->control; > > you would have got the control. > > That is because when there are arguments to ->control, the code is > returning an array, not a list, which in a scalar context returns its > length. > > Also, the current code only supports passing one OID, although the docs > suggest otherwise > > Try this patch It works as expected. -- BOFH excuse #61: not approved by the FCC