Permalink
Browse files

anti none oracle sourced connection

  • Loading branch information...
1 parent 988bfe8 commit cbc1305b0d7e6fac4b2842e039b9aab28a93f3e2 @kaven276 committed Sep 28, 2012
Showing with 14 additions and 1 deletion.
  1. +13 −0 lib/db.js
  2. +1 −1 oracle/psp/gateway.bdy
View
@@ -68,6 +68,19 @@ function Slot(c){
var dbListener = net.createServer({allowHalfOpen : true}, function(c){
c.once('data', function onHandshake(data){
+
+ try {
+ var ptoken = data.readInt32BE(0);
+ } catch (e) {
+ ptoken = -1;
+ }
+ if (ptoken !== 197610261) {
+ console.warn('none oracle connection attempt found');
+ c.end();
+ c.destroy();
+ return;
+ }
+
c.sid = data.readInt32BE(0);
c.serial = data.readInt32BE(4);
c.pseq = data.readInt32BE(8);
View
@@ -70,7 +70,7 @@ create or replace package body gateway is
out_buffer_size => 0,
tx_timeout => 3);
select a.sid, a.serial# into v_sid, v_serial from v$session a where a.sid = sys_context('userenv', 'sid');
- v_result := utl_tcp.write_raw(c, utl_raw.concat(pi2r(v_sid), pi2r(v_serial), pi2r(pv.seq_in_id * flag)));
+ v_result := utl_tcp.write_raw(c, utl_raw.concat(pi2r(197610261), pi2r(v_sid), pi2r(v_serial), pi2r(pv.seq_in_id * flag)));
end;
-- Refactored procedure quit

0 comments on commit cbc1305

Please sign in to comment.