Christopher Poole Oracle Database Consultancy
Applications - XUTL_FINDFILES


Home My CV Applications Tips About
     
 
The XUTL_FINDFILES package        
10 Jan 2007  

Package Information

   

 

This package provides the ability to list files in a directory using native PL/SQL only. I wrote this package to safely and securely expose the functionality I discovered and documented here.

This package is a pure PL/SQL implementation that uses directory objects, so has numerous advantages over Java or external procedure implementations:

  • Easy install - no Java classes or C libraries
  • Easy security compared with Java - no required separate Java permissions for each directory
  • Easy security compared with external procedures - no OS security headaches such as separate OS users, no need for EXTPROC listener configuration

This implementation has the following security features:

  • Uses directory objects (use CREATE DIRECTORY...) not path name strings, consistent with UTL_FILE, DBMS_LOB, external tables, etc
  • Users must have READ or WRITE on the directory object in question to execute a search
  • Views restrict results to files actually in the directory referred to by the object (no sub directory searches)
  • Execute is no longer required on dbms_backup_restore
  • Direct select on magic x$ views not required

Objects installed into the SYS schema:

  • One secure application context
  • Two views
  • One package

How a call to search_for() works:

  1. The values stored in the xutl$ff application context are cleared
  2. The directory path for the given directory object is retrieved from the data dictionary (if the object does not exist an exception is raised)
  3. Another data dictionary call retrieves permissions on this object for the calling USER (no privileges means an exception is raised)
  4. The search string is created from the directory path and the filter passed in the call
  5. A call is made to dbms_backup_restore.searchfiles() passing the search string
  6. The value of the directory path is stored in the xutl$ff application context
  7. The results of the search are now available through the views findfiles_listing and findfiles_listing2
 

Download XUTL_FINDFILES!

for 10g only

File Information

Name - xutlff.rar
Size -  5kb
Version - 2.0
Date - 10 Jan 2007

xutlff.rar

   
         
 

Counter

long distance

 


Copyright © Christopher Poole
30 April 2006
Disclaimer