Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Password Verification Function Help
kingkongbubdy4_at_yahoo.com wrote:
> Hi,
>
> I am relatively new to Oracle 9i and trying to (at this point) create a
> password verification function for the DEFAULT profile that will allow
> me to produce some output to the screen (if possible) when I change a
> user password. I have....
>
> CREATE or REPLACE FUNCTION verify_function
> (username varchar2, password varchar2, old_password varchar2)
> RETURN boolean is
> BEGIN
> dbms_output.put_line('Hello World');
> return(TRUE);
> END;
> /
>
> The commands (as sys sysdba)
> SQL> alter profile default limit password_verify_function
> verify_function;
> SQL>set serveroutput on;
> SQL> alter user test_user identified by new_password;
>
> report no errors, but I do not get 'Hello World' to show up on the
> screen. I can create other functions on the server and they will
> produce output to the screen ('Hello World' e.g. ) as
>
> SQL>exec dbms_output.put_line( my_other_function(arg_list));
>
> Is it possible to get output to the screen through the
> PASSWORD_VERIFY_FUNCTION when a password is changed? If so, can anyone
> point me in the right direction? If not, can the the equivalent 'Hello
> World' output be saved to a file instead of the screen?
>
> Thanks,
> kingkong
>
Yes, you can generate output from your password verify function to a file (on the server) using the UTL_FILE package.
For example, after creating a directory object named TMP,
CREATE OR REPLACE FUNCTION "SYS"."VERIFY_FUNCTION"
(username varchar2, new_password varchar2, old_password varchar2)
RETURN boolean is
line varchar2(255);
f1 UTL_FILE.FILE_TYPE;
BEGIN
f1 := utl_file.fopen('TMP', 'password.out', 'w');
line := 'Hello password World';
utl_file.put_line(f1, line);
utl_file.fclose(f1);
return(TRUE);
END;
-Mark Bole
Received on Sun Feb 13 2005 - 12:37:20 CST