Home » RDBMS Server » Networking and Gateways » using dbms_ldap to unlock user accounts in Oracle Internet Directory
using dbms_ldap to unlock user accounts in Oracle Internet Directory [message #156227] Mon, 23 January 2006 15:54
bdenkers
Messages: 1
Registered: January 2006
Junior Member
Can anyone explain how to unlock an account using dbms_ldap package. Here is what I have tried so far but I get an error " Error Message : ORA-31202: DBMS_LDAP: LDAP client/server error: DSA is unwilling to perform. Account Policy Error :9051: GSL_ACCOUNTUNLOCK_EXCP : Only Modify-add allowed on orclpwdaccountunlock attribute. Modify-delete and Modify-replace are not allowed."

set serveroutput on size 30000

DECLARE
retval PLS_INTEGER;
emp_session DBMS_LDAP.session;
emp_dn VARCHAR2(256);
emp_rdn VARCHAR2(256);
emp_array DBMS_LDAP.MOD_ARRAY;
emp_vals DBMS_LDAP.STRING_COLLECTION ;
ldap_host VARCHAR2(256);
ldap_port VARCHAR2(256);
ldap_user VARCHAR2(256);
ldap_passwd VARCHAR2(256);
ldap_base VARCHAR2(256);
BEGIN

retval := -1;
ldap_host := <hostname>;
ldap_port := '3060';
ldap_user := 'cn=orcladmin';
ldap_passwd := <password>;
emp_dn := 'cn=test,cn=Users,dc=tmx,dc=com';


-- Initialize ldap library and get session handle.
emp_session := DBMS_LDAP.init(ldap_host,ldap_port);


-- Bind to the directory
retval := DBMS_LDAP.simple_bind_s(emp_session,
ldap_user,ldap_passwd);

-- Create and setup MOD_ARRAY for list of modifications
emp_array := DBMS_LDAP.create_mod_array(1);

emp_vals(1) := '1';

-- Populate MOD_ARRAY with Modifications to value of 'title' attribute
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_REPLACE,
'orclpwdaccountunlock',emp_vals);

DBMS_OUTPUT.PUT_LINE(RPAD('Modify Entry DN ',25,' ') || ': ['
|| emp_dn || ']');

-- Apply the changes to the LDAP entry
retval := DBMS_LDAP.modify_s(emp_session,emp_dn,emp_array);
DBMS_OUTPUT.PUT_LINE(RPAD('modify_s Returns ',25,' ') || ': '
|| TO_CHAR(retval));

-- Free attribute array (emp_array)
DBMS_LDAP.free_mod_array(emp_array);

-- Unbind from ldap directory
retval := DBMS_LDAP.unbind_s(emp_session);

DBMS_OUTPUT.PUT_LINE(RPAD('unbind_res Returns ',25,' ') || ': ' ||
TO_CHAR(retval));

DBMS_OUTPUT.PUT_LINE('Directory operation Successful .. exiting');

-- Handle Exceptions
EXCEPTION
WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE(' Exception encountered .. exiting');

END;
/

Someone please help!!!! I need to get away from using OIDDAS the customer wants something integrated into our software so I need it to use the dbms_ldap package.

Thanks
Previous Topic: Oracle Installation error: TNS adapter error
Next Topic: TNSLSNR Error on Unix box, (.logsdb0: error creating log stream /usr/app/oracle/product/XHRSDB_8.1.7
Goto Forum:
  


Current Time: Mon Nov 25 16:10:05 CST 2024