OID PL/SQL function DBMS_LDAP_UTL.authenticate_user() Returns Error Code 9001 Instead of -14 When the User Account is Locked (Doc ID 820954.1)

Last updated on OCTOBER 03, 2016

Applies to:

Oracle Internet Directory - Version 9.0.4.0.1 and later
Information in this document applies to any platform.

Goal

Per the OID Application Developer's Guide documentation (section 17.3), the following code should return a -14 value when the authenticate_user function is provided with an incorrect password:

DECLARE
retval PLS_INTEGER;
user_handle DBMS_LDAP_UTL.HANDLE;
subscriber_handle DBMS_LDAP_UTL.HANDLE;
my_session DBMS_LDAP.session;

BEGIN
-- Modify OID host name and port on your setup.
my_session:= DBMS_LDAP.init('ldaphost.oracle.com', 389);

-- Modify with the correct password for cn=orcladmin on your setup.
retval:=DBMS_LDAP.simple_bind_s(my_session,'cn=orcladmin','password');

-- Modify appropriate 'cn' on your setup
retval := DBMS_LDAP_UTL.create_user_handle(user_handle,DBMS_LDAP_UTL.TYPE_DN, 'cn=user1,cn=users,dc=us,dc=oracle,dc=com');

retval := DBMS_LDAP_UTL.create_subscriber_handle(subscriber_handle,DBMS_LDAP_UTL.TYPE_DEFAULT, NULL);
retval := DBMS_LDAP_UTL.set_user_handle_properties(user_handle,DBMS_LDAP_UTL.SUBSCRIBER_HANDLE, subscriber_handle);

-- Modify to use an incorrect password and see what value returns
retval := DBMS_LDAP_UTL.authenticate_user(my_session, user_handle,DBMS_LDAP_UTL.AUTH_SIMPLE, 'bad-password', NULL);
dbms_output.put_line('authenticate_user retval= '||retval);

END;
/



However, when the above code is executed it returns the following when the user01 account is locked.

SQL> set serveroutput on
SQL> @lock
authenticate_user retval= 9001

PL/SQL procedure successfully completed.

SQL>

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms