Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to kill the session in a logon trigger

Status
Not open for further replies.

stefes007

Programmer
Apr 24, 2001
21
0
0
BE
Hi,

i'm trying to write a logon trigger that would refuse incoming connection from user externally authenticated from a non trusted server list: there are too many risks that someone root on a machine can create an account scott on that machine to logon externally as scott on oracle.

My problem is that I don't know how to "kill" or exit current session in the pl/sql trigger ...

I've been looking in the packages dbms*, I've tried to create an application error in that trigger, but nothing does it.

Does anyone knows how to manage this ?

Here is my trigger:


create or replace trigger
system.logon_audit_trigger
after LOGON ON DATABASE
BEGIN

if(sys_context('USERENV','AUTHENTICATION_TYPE') <>'DATABASE' AND user = 'STEPHANE') then
-- during test, I do it on myself
-- kill me !!!
end if;

insert into system.stats_user_log values(
user,
sys_context('USERENV','SESSIONID'),
sys_context('USERENV','HOST'),
null,
sysdate,
null,
null
);
--COMMIT;
END;
/




Dekeyzer Stephane.
Belgium :)
 
found the solution: you have to throw a exception inside the trigger, and the connection will be killed.

It doesn't work if you have the DBA role.

Stephane.

Dekeyzer Stephane.
Belgium :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top