Skip to content
Browse files

anti none oracle sourced connection for ext-hub

  • Loading branch information...
1 parent cbc1305 commit 6d212eac2460a650e18fa6714ec5b94a16d06209 @kaven276 committed Sep 28, 2012
Showing with 20 additions and 7 deletions.
  1. +19 −6 lib/ext_hub.js
  2. +1 −1 oracle/psp/k_ext_call.bdy
View
25 lib/ext_hub.js
@@ -69,9 +69,22 @@ var server = net.createServer(function(oraSock){
});
function onHandshake(data){
- oraSock.sid = sid = data.readInt32BE(0);
- oraSock.serial = serial = data.readInt32BE(4);
- oraSock.oraSeq = data.readInt32BE(8);
+
+ try {
+ var ptoken = data.readInt32BE(0);
+ } catch (e) {
+ ptoken = -1;
+ }
+ if (ptoken !== 197610262) {
+ console.warn('EXT-HUB: none oracle connection attempt found');
+ oraSock.end();
+ oraSock.destroy();
+ return;
+ }
+
+ oraSock.sid = sid = data.readInt32BE(4);
+ oraSock.serial = serial = data.readInt32BE(8);
+ oraSock.oraSeq = data.readInt32BE(12);
oraSocks[sid] = oraSock;
logConnOra(data, sid, serial);
logConnOra('oracle connected sid = %d, serial = %d, initial oraSeq = %d', sid, serial, oraSock.oraSeq);
@@ -83,9 +96,9 @@ var server = net.createServer(function(oraSock){
return;
}
- if (data.length !== 12) {
- logConnOra('first chunk is not 12 bytes length.');
- oraSock.emit('data', data.slice(12));
+ if (data.length !== 16) {
+ logConnOra('first chunk is not 16 bytes length.');
+ oraSock.emit('data', data.slice(16));
}
}
View
2 oracle/psp/k_ext_call.bdy
@@ -63,7 +63,7 @@ create or replace package body k_ext_call is
goto make_connection;
<<connected>>
select a.sid, a.serial# into v_sid, v_serial from v$session a where a.sid = sys_context('userenv', 'sid');
- dcopv.tmp_pi := utl_tcp.write_raw(dcopv.con, utl_raw.concat(pi2r(v_sid), pi2r(v_serial), pi2r(dcopv.rseq2)));
+ dcopv.tmp_pi := utl_tcp.write_raw(dcopv.con, utl_raw.concat(pi2r(197610262), pi2r(v_sid), pi2r(v_serial), pi2r(dcopv.rseq2)));
end;
procedure init is

0 comments on commit 6d212ea

Please sign in to comment.
Something went wrong with that request. Please try again.