Just a quickie - anyone have a snippet to update a userPassword?
If not I'll knock one up and stick in on rubygarden..
Server is OpenLDAP, so exop would be great, but I'll settle for
anything.
Thanks.
···
--
There are three kinds of lies: Lies, Damn Lies, and Statistics.
-- Disraeli
Rasputin :: Jack of All Trades - Master of Nuns
It is like any modification to a given directory:
You need to hash the password:
···
On Mon, 02 Aug 2004 21:54:04 +0900, Dick Davies wrote:
Just a quickie - anyone have a snippet to update a userPassword?
If not I'll knock one up and stick in on rubygarden..
-----
e_password = "{SHA}" + encode64(Digest::SHA1.new(password).digest).chomp
-----
then generate the modification:
-----
# Do the modification
#
reset = [
LDAP.mod(LDAP::LDAP_MOD_REPLACE, "userPassword", [e_password]),
]
conn.bind(USER, PASS) do
begin
conn.modify("uid=#{login},#{BASE}", reset)
rescue LDAP::ResultError => msg
puts "Can't change password: " + msg
exit 0
rescue LDAP::Error => errcode
puts "Can't change password: " + LDAP.err2string(errcode)
exit 0
end
end
-----