Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ACL error in Microsoft active directory LDAP

MaahjoorOct 26 2015 — edited Oct 28 2015

dear all,

I am using oracle database 12c on windows server 2012. both 64 bit.

I am facing the following problem.

pastedImage_1.png

I have created a process on a portal home page which generate the above error.

the process code is below

declare
LDAP_SERVER constant varchar2(200) := 'mydomain.org';
LDAP_PORT constant number := 389;
LDAP_USER constant varchar2(200) := mydomain\orcladmin';
LDAP_PASSW constant varchar2(200) := 'mypassword';
LDAP_BASE constant varchar2(200) := 'DC=mydomain,DC=org';
l_url varchar2(2000);

         rc              integer;                                     
         ldapSession     DBMS\_LDAP.session;                           
        ntUser          varchar2(30);                                
        attrName        varchar2(255);                               
        attrList        DBMS\_LDAP.string\_collection;                 
        valList         DBMS\_LDAP.string\_collection;                 
        ldapMessage     DBMS\_LDAP.message;                           
        ldapEntry       DBMS\_LDAP.message;                           
        berElem         DBMS\_LDAP.ber\_element;                       
                                                                     
        --// very primitive assertion interface - should be catering  
        --// for unique error code and messages in a prod environment  
        procedure assert( condition boolean ) is                      
        begin                                                         
                if not condition then                                 
                        raise\_application\_error(                      
                                -20001,                               
                                'LDAP call unsuccessful.'             
                        );                                            
                end if;                                               
        end;                                                          
                                                                      
        procedure W( line varchar2 ) is                               
        begin                                                         
                DBMS\_OUTPUT.put\_line( line );                         
        end;                                                          
begin                                                                 
        --// logon to the Microsoft Active Directory Server           
        DBMS\_LDAP.USE\_EXCEPTION := false;                              
     --   W( 'Logging on to AD server;' );                              
        ldapSession := DBMS\_LDAP.init( LDAP\_SERVER, LDAP\_PORT );      
                                                                      
        rc := DBMS\_LDAP.simple\_bind\_s(                                
                ld => ldapSession,                                    
                dn => LDAP\_USER,                                      
                passwd => LDAP\_PASSW                                  
        );                                                            
        assert( rc = DBMS\_LDAP\_UTL.SUCCESS  );                                                                  
                                                                      
        --// set the NTLM user and attributes that we want                          
        ntUser := :APP\_USER;                                          
        attrList(1) := 'title';     
        --// so a search on the username (NTLM username typically)    
   --     W( 'Doing a basic search on NT username' );                   
        rc := DBMS\_LDAP.search\_s(                                     
                ld => ldapSession,                                    
                base => LDAP\_BASE,                                    
                scope => DBMS\_LDAP.SCOPE\_SUBTREE,                     
                filter => '(&(objectclass=USER)(SAMAccountName='||ntUser||'))',  
                attrs => attrList,                                              
                attronly => 0,                                                  
                res => ldapMessage                                              
        );                                                                      
                                                                                
        assert( rc = DBMS\_LDAP\_UTL.SUCCESS  );                                  
                                                                               
        if DBMS\_LDAP.count\_entries(ldapSession,ldapMessage) > 0 then            
               -- W( '1st entry - only 1 expected as we did a unique account lookup' );  
                ldapEntry := DBMS\_LDAP.first\_entry( ldapSession, ldapMessage );  

                while (ldapEntry is not null) loop  
                        --// get the attribute  
                        attrName := DBMS\_LDAP.first\_attribute(  
                                        ld => ldapSession,  
                                        ldapEntry => ldapEntry,  
                                       ber\_elem  => berElem  
                                );  
                        while (attrName is not null) loop  
                                --// get the list of values for the attribute  
                                valList := DBMS\_LDAP.get\_values(  
                                                ld => ldapSession,  
                                               ldapEntry => ldapEntry,  
                                                attr =>  attrName  
                                       );  
                                --// for simplicity sake, we expect a scalar name-value and  
                               --// thus a single value only  
                             --  W( attrName||'='||valList(0) );  

--l_url := APEX_UTIL.PREPARE_URL('f?p=112:1:&SESSION.');
if valList(0)='Student' then
apex_util.redirect_url('f?p=114:1:&SESSION.', true);
else
apex_util.redirect_url('f?p=113:1:&SESSION.', true);
end if;

-- dbms_output.put_line(valList(0));
--// proceed to process the next attribute
attrName := DBMS_LDAP.next_attribute(
ld => ldapSession,
ldapEntry => ldapEntry,
ber_elem => berElem
);
end loop;

                      --// not really needed in this case as we're processing a single SAMaccount entry  
                       ldapEntry := DBMS\_LDAP.next\_entry( ldapSession, ldapEntry );  
               end loop;  
       end if;

     --  W( 'Disconnecting from AD server' );  
       rc := DBMS\_LDAP.unbind\_s( ld => ldapSession );  

end;

could somebody guide how to fix?

Regards.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2015
Added on Oct 26 2015
6 comments
805 views