Changing the LDAP Password [message #449819] |
Thu, 01 April 2010 02:40 |
purva
Messages: 1 Registered: March 2010 Location: Houston,US
|
Junior Member |
|
|
Hi All,
We have a requirement of changing the LDAP Password if it is null/has a value through a procedure using Pl-SQL.
As of now we have written a procedure and checked for the Server connection which is working fine .
But trying to change the password with a procedure created is not working.The code is given below. Please do help on this regard as we are not able to find the MOD_REPLACE PROCEDURE.
create or replace PROCEDURE RESET_PWD (
I_USERNAME IN VARCHAR2, I_O_PWD IN VARCHAR2,
I_N_PWD IN VARCHAR2 )
IS
ldap_host VARCHAR2(256);
ldap_port PLS_INTEGER;
ldap_user VARCHAR2(256);
ldap_passwd VARCHAR2(256);
ldap_base VARCHAR2(256);
random_pwd BINARY_INTEGER;
retval PLS_INTEGER;
my_session DBMS_LDAP.session;
emp_array DBMS_LDAP.MOD_ARRAY;
emp_dn VARCHAR2(256);
emp_vals DBMS_LDAP.STRING_COLLECTION ;
BEGIN
ldap_host := 'N/W Host';
ldap_port := 'N/W Port';
ldap_user := 'cn='|| 'PWRESET1';
--ldap_passwd := I_O_PWD;
ldap_passwd := 'As123456';
Ldap_Base := 'OU=Weatherford,DC=wft,DC=root,DC=loc';
DBMS_LDAP.USE_EXCEPTION := TRUE;
my_session := DBMS_LDAP.init(ldap_host,ldap_port);
retval := DBMS_LDAP.simple_bind_s(my_session,ldap_user, ldap_passwd);
emp_array := DBMS_LDAP.create_mod_array(1);
--emp_vals(1) := I_N_PWD;
emp_vals(1) := '1234546';
DBMS_LDAP.POPULATE_MOD_ARRAY(emp_array,DBMS_LDAP.MOD_REPLACE,'userpassword',emp_vals);
commit;
emp_dn := 'cn='||I_USERNAME||',' || ldap_base;
retval := DBMS_LDAP.modify_s(my_session,emp_dn,emp_array);
retval := DBMS_LDAP.unbind_s(my_session);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(sqlerrm);
END RESET_PWD;
|
|
|
Re: Changing the LDAP Password [message #449821 is a reply to message #449819] |
Thu, 01 April 2010 03:05 |
|
Michel Cadot
Messages: 68712 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:is not working
This is not an Oracle error.
1/ Remove WHEN OTHERS clause
2/ Read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.
3/ Use SQL*Plus and copy an paste:
a) creation of the procedure
b) execution of the procedure
c) anything that can help to diagnose the problem
Regards
Michel
[Updated on: Thu, 01 April 2010 03:05] Report message to a moderator
|
|
|