net-tns 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c79686c4bd0a8d905987a42092ec1fa49cb140fa
4
- data.tar.gz: 5a95a383671604fb14980ea2cfe099055f488db5
3
+ metadata.gz: abd5c0ddbf15b9a4e4c3c37795d88dfc92357a45
4
+ data.tar.gz: 83401b9ffebe9ad974a918443196f5bf1493b9a3
5
5
  SHA512:
6
- metadata.gz: c135287fde902c9019eb0da3c5b38c71fb94d13ee90e4625f622bd7c8d71df0ca690c362c971843621da788f73476437aa281c04bb5698ebc073b3d2da35c8f5
7
- data.tar.gz: afdce9a532326bb42af0fc093d6b08f2d4a26bc32369fd2c14c9014524b0b7f911a08e3f5241aa0f85896d021dbb4c80370ca567fb1a8a139a30de21a0b4920a
6
+ metadata.gz: a0b363f8c3c8fb3a156e33f695d7b1220f296b809c787d9e25c66da3ff6ece1706138586fb01219280980e1efce901141dc4460876503631b718aa6a0fd8d34d
7
+ data.tar.gz: f943432ae2af1f05f1f2b7f9e66c53416ba585d99f5fdb63d30158dd3a1302aa6e1150e164738d8bdb221a34f531229dbec95b24e4ecc3eb7469a9adc743a18e
@@ -27,12 +27,14 @@ end
27
27
 
28
28
 
29
29
  dictionary = [
30
- "ORCL",
30
+ "CLRExtProc",
31
31
  "ORACLE",
32
32
  "ORADB",
33
- "XE",
34
- "TEST",
33
+ "ORCL",
35
34
  "PLSExtProc",
35
+ "TEST",
36
+ "XDB",
37
+ "XE"
36
38
  ]
37
39
 
38
40
  sids = Set.new
@@ -47,7 +47,7 @@ module Net
47
47
  begin
48
48
  conn = Connection.new(opts)
49
49
  conn.open_socket()
50
- request = ConnectPacket.new(:data => "(CONNECT_DATA=(COMMAND=STATUS))")
50
+ request = ConnectPacket.new(:data => "(CONNECT_DATA=(COMMAND=STATUS)(VERSION=186647552))")
51
51
 
52
52
  status_response_raw = ""
53
53
  begin
@@ -58,6 +58,8 @@ module Net
58
58
  # a data length that is greater than the available data.
59
59
  end
60
60
 
61
+ response = conn.send_and_receive(ResendPacket.new())
62
+ status_response_raw += response.data
61
63
  # Successful responses are typically spread across multiple Data packets.
62
64
  while ( response = conn.receive_tns_packet() )
63
65
  break unless response.is_a?(DataPacket)
@@ -5,6 +5,7 @@ module Net
5
5
  module TNS
6
6
  class Connection
7
7
  attr_reader :tns_protocol_version
8
+ attr_reader :tns_sdu
8
9
 
9
10
  def initialize(opts={})
10
11
  @socket = nil
@@ -75,11 +76,15 @@ module Net
75
76
  end
76
77
 
77
78
  response = send_and_receive(connect_packet)
78
- unless response.is_a?(AcceptPacket)
79
+ unless response.is_a?(AcceptPacket) || response.is_a?(RedirectPacket)
79
80
  raise Exceptions::ProtocolException.new("Unexpected response to Connect packet: #{response.class}")
80
81
  end
81
-
82
+ if response.is_a?(RedirectPacket)
83
+ # CLR extproc on 12c will end up here
84
+ return
85
+ end
82
86
  @tns_protocol_version = response.version.to_i
87
+ @tns_sdu = response.sdu_size.to_i
83
88
  negotiate_ano()
84
89
  end
85
90
 
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  module TNS
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ module Net
13
13
  end
14
14
 
15
15
  class Packet < BinData::Record
16
- SESSION_DATA_UNIT_SIZE = 2048
16
+ SESSION_DATA_UNIT_SIZE = 8192
17
17
  MAX_PAYLOAD_SIZE = SESSION_DATA_UNIT_SIZE - Header::LENGTH
18
18
 
19
19
  # BinData fields
@@ -9,7 +9,7 @@ module Net
9
9
  uint16be :minimum_version, :initial_value => Net::TNS::Version::ALL_VERSIONS.min
10
10
  uint16be :service_flags
11
11
  # session data unit size
12
- uint16be :sdu_size, :initial_value => 0x0800
12
+ uint16be :sdu_size, :initial_value => Net::TNS::Packet::SESSION_DATA_UNIT_SIZE
13
13
  # maximum transmission data unit size
14
14
  uint16be :maximum_tdu_size, :initial_value => 0x7fff
15
15
  uint16be :protocol_flags, :initial_value => 0xc608
@@ -0,0 +1,40 @@
1
+
2
+ module Net
3
+ module TTI
4
+ class Capabilities
5
+ def initialize(caps_bytes=[])
6
+ @caps_bytes = caps_bytes
7
+ end
8
+
9
+ def self.from_byte_array(bytes)
10
+ Capabilities.new(bytes)
11
+ end
12
+
13
+ def self.from_binary_string(string)
14
+ Capabilities.new( string.unpack("C*") )
15
+ end
16
+
17
+ def [](index)
18
+ @caps_bytes[index]
19
+ end
20
+
21
+ def []=(index, value)
22
+ @caps_bytes[index] = value
23
+ end
24
+
25
+ def length
26
+ @caps_bytes.length
27
+ end
28
+
29
+ def to_binary_s
30
+ @caps_bytes.pack("C*")
31
+ end
32
+
33
+ # Returns hexified bytes, delimited by spaces
34
+ # e.g. [0x01,0x41,0x81,0xa1] -> "01 41 81 a1"
35
+ def to_hexified_s
36
+ to_binary_s.scan(/../).join(" ")
37
+ end
38
+ end
39
+ end
40
+ end
@@ -56,8 +56,9 @@ module Net
56
56
  end
57
57
 
58
58
  def get_pre_auth_request(username)
59
- pre_auth_request = Authentication.create_pre_auth_request( @tti_conn.conn_params.architecture )
59
+ pre_auth_request = Authentication.create_pre_auth_request()
60
60
  pre_auth_request.username = username
61
+ pre_auth_request.add_parameter("AUTH_TERMINAL", "unknown")
61
62
  return pre_auth_request
62
63
  end
63
64
 
@@ -68,17 +69,24 @@ module Net
68
69
  when Net::TNS::Version::VERSION_10G
69
70
  enc_password, enc_client_session_key = Net::TTI::Crypto.get_10g_auth_values( username, password, auth_sesskey )
70
71
  when Net::TNS::Version::VERSION_11G
71
- auth_vfr_data = pre_auth_response.auth_vfr_data
72
- enc_password, enc_client_session_key = Net::TTI::Crypto.get_11g_auth_values( password, auth_sesskey, auth_vfr_data )
72
+ case auth_sesskey.length
73
+ when 32
74
+ enc_password, enc_client_session_key = Net::TTI::Crypto.get_10g_auth_values( username, password, auth_sesskey )
75
+ when 48
76
+ auth_vfr_data = pre_auth_response.auth_vfr_data
77
+ enc_password, enc_client_session_key = Net::TTI::Crypto.get_11g_auth_values( password, auth_sesskey, auth_vfr_data )
78
+ else
79
+ raise Exceptions::ProtocolException.new("Unexpected AUTH_SESSKEY length #{auth_sesskey.length}")
80
+ end
73
81
  else
74
82
  raise Exceptions::UnsupportedTNSVersion.new( @tti_conn.conn_params.tns_version )
75
83
  end
76
84
 
77
- auth_request = Authentication.create_auth_request( @tti_conn.conn_params.architecture )
85
+ auth_request = Authentication.create_auth_request()
78
86
  auth_request.username = username
79
- auth_request.enc_client_session_key = enc_client_session_key
80
87
  auth_request.enc_password = enc_password
81
-
88
+ auth_request.enc_client_session_key = enc_client_session_key
89
+ auth_request.add_parameter("AUTH_TERMINAL", "unknown")
82
90
  return auth_request
83
91
  end
84
92
 
@@ -7,13 +7,23 @@ module Net
7
7
  attr_accessor :platform
8
8
  attr_accessor :architecture
9
9
  attr_accessor :ttc_version
10
+ attr_accessor :ttc_server
10
11
  attr_accessor :tns_version
12
+ attr_accessor :character_set
13
+ attr_accessor :server_flags
14
+ attr_accessor :server_compiletime_capabilities
15
+ attr_accessor :server_runtime_capabilities
11
16
 
12
17
  def to_s
13
18
  return "Platform: #{@platform||nil}" +
14
19
  "; Architecture: #{@architecture||nil}" +
15
- "; TTC? Version: #{@ttc_version||nil}" +
16
- "; TNS Version: #{@tns_version||nil}"
20
+ "; TNS Version: #{@tns_version||nil}" +
21
+ "; TTC server version: #{@ttc_version||nil}" +
22
+ "; TTC server string: #{@ttc_server||nil}" +
23
+ "; Server character set: #{@character_set||nil}" +
24
+ "; Server flags: #{@server_flags||nil}" +
25
+ "; Server Compiletime Capabilities: #{@server_compiletime_capabilities.to_hexified_s}" +
26
+ "; Server Runtime Capabilities: #{@server_runtime_capabilities.to_hexified_s}"
17
27
  end
18
28
  end
19
29
 
@@ -39,7 +49,7 @@ module Net
39
49
  proto_nego_response.populate_connection_parameters( @conn_params )
40
50
 
41
51
  Net::TTI.logger.debug("Sending data type negotiation request")
42
- dt_nego_request = DataTypeNegotiationRequest.create_request( @conn_params.platform )
52
+ dt_nego_request = DataTypeNegotiationRequest.create_request( @conn_params )
43
53
  dt_nego_response_raw = send_and_receive( dt_nego_request )
44
54
 
45
55
  return nil
@@ -61,7 +71,7 @@ module Net
61
71
  Net::TTI.logger.debug( "Connection#send_tti_message called with #{raw_message.length}-byte #{tti_message.class} message" )
62
72
 
63
73
  # Split the message into multiple packets if necessary
64
- max_data = Net::TNS::DataPacket.max_data_length
74
+ max_data = @tns_connection.tns_sdu - 12 # 12 = 10 (HEADER) + 2 (FLAGS)
65
75
  raw_message.scan(/.{1,#{max_data}}/m).each do |raw_message_part|
66
76
  tns_packet = Net::TNS::DataPacket.new()
67
77
  tns_packet.data = raw_message_part
@@ -79,7 +89,7 @@ module Net
79
89
  while ( true )
80
90
  receive_count += 1
81
91
  if ( receive_count >= 3 )
82
- raise Exceptions::TNSException.new( "Maximum receive attempts exceeded - too many Markers received." )
92
+ raise Exceptions::ProtocolException.new( "Maximum receive attempts exceeded - too many Markers received." )
83
93
  end
84
94
 
85
95
  Net::TTI.logger.debug("Attempting to receive packet (try ##{receive_count})")
@@ -90,7 +100,7 @@ module Net
90
100
  # carried into an additional packet. We wouldn't need to do this if
91
101
  # we could fully parse every message (or at least know lengths to
92
102
  # read). I'm looking at you, DataTypeNegotiationResponse.
93
- if tns_packet.num_bytes > 2000
103
+ if @tns_connection.tns_protocol_version <= 313 && tns_packet.num_bytes > 1900
94
104
  begin
95
105
  max_message_length -= message_data.length
96
106
  message_data += receive_tti_message(waiting_for_error_message, max_message_length)
@@ -47,6 +47,7 @@ module Net
47
47
  value_index += MAX_CHUNK_LENGTH
48
48
  end
49
49
  binary_string << [MULTI_CHUNK_TERMINATOR].pack("C")
50
+ return binary_string
50
51
  else
51
52
  return [value.length, value].pack("Ca*")
52
53
  end
@@ -0,0 +1,36 @@
1
+ require "bindata"
2
+
3
+ module Net
4
+ module TTI
5
+ module DataTypes
6
+ class Flags < BinData::Primitive
7
+ uint8 :value_length
8
+ choice :flag_value, :selection => :value_length do
9
+ virtual 0, :value => 0
10
+ uint8 1
11
+ uint16be 2
12
+ uint32be 4
13
+ end
14
+
15
+ def get
16
+ self.flag_value.to_i
17
+ end
18
+
19
+ def set(new_value)
20
+ if new_value > 0xffff
21
+ self.value_length = 4
22
+ self.flag_value = new_value
23
+ elsif new_value > 0xff
24
+ self.value_length = 2
25
+ self.flag_value = new_value
26
+ elsif new_value > 0
27
+ self.value_length = 1
28
+ self.flag_value = new_value
29
+ else
30
+ self.value_length = 0
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,24 +1,24 @@
1
1
  require "bindata"
2
2
  require "net/tti/data_types/chunked_string"
3
+ require "net/tti/data_types/flags"
3
4
 
4
5
  module Net
5
6
  module TTI
6
7
  module DataTypes
7
8
  class KeyValuePair < BinData::Record
8
- # In earlier dialects, the 4 bytes before the strings appeared to contain
9
- # the total length of the string. In more recent dialects, this no longer
10
- # seems to be the case. However, a 32-bit null here still appears to
11
- # signal that there is no value.
12
- uint32le :unknown1, :value => lambda {kvp_key.length}
13
- chunked_string :kvp_key, :onlyif => lambda {unknown1 != 0}
14
- uint32le :unknown2, :value => lambda {kvp_value.length}
15
- chunked_string :kvp_value, :onlyif => lambda {unknown2 != 0}
16
- uint32le :flags
17
-
18
- def set(key, value)
19
- self.kvp_key.data = key
20
- self.kvp_value.data = value
21
- end
9
+ # Follows (simplified) format used by JDBC driver; other clients send
10
+ # KVPs with a longer, more opaque structure (e.g. each chunked string
11
+ # was preceded by a 4-byte value that, in earlier dialects appeared to
12
+ # contain the total length of the string, but in later dialects did not
13
+ # seem related to string length at all).
14
+ uint8 :unknown1, :initial_value => 0x01 # size in bytes of kvp_key_length OR boolean
15
+ uint8 :kvp_key_length, :onlyif => lambda {unknown1 != 0x00}, :value => lambda {kvp_key.length}
16
+ chunked_string :kvp_key, :onlyif => lambda {unknown1 != 0x00 && kvp_key_length != 0x00}
17
+ uint8 :unknown2, :initial_value => 0x01 # size in bytes of kvp_value_length
18
+ uint8 :kvp_value_length, :onlyif => lambda {unknown2 != 0x00}, :value => lambda {kvp_value.length}
19
+ chunked_string :kvp_value, :onlyif => lambda {unknown2 != 0x00 && kvp_value_length != 0x00}
20
+ # flags are used when AUTH_SESSKEY and AUTH_ALTER_SESSION are sent to the server
21
+ flags :flags
22
22
  end
23
23
  end
24
24
  end
@@ -9,6 +9,12 @@ module Net::TTI
9
9
  class UnsupportedTarget < TTIException
10
10
  end
11
11
 
12
+ class UnsupportedArchitecture < TTIException
13
+ def initialize( architecture )
14
+ super( "Unsupported architecture: #{architecture}" )
15
+ end
16
+ end
17
+
12
18
  class UnsupportedPlatform < UnsupportedTarget
13
19
  def initialize( platform )
14
20
  super( "Unsupported platform: #{platform}" )
@@ -32,8 +32,8 @@ module Net
32
32
 
33
33
  def self.from_data_string( raw_message )
34
34
  ttc_code = raw_message[0].unpack("C").first
35
-
36
- unless message_class = @@ttc_classes[ ttc_code ]
35
+
36
+ unless message_class = @@ttc_classes[ttc_code]
37
37
  raise Net::TNS::Exceptions::TNSException.new( "Unknown TTC code: #{ttc_code}" )
38
38
  end
39
39
 
@@ -1,3 +1,5 @@
1
+ require "net/tti/capabilities"
2
+
1
3
  module Net
2
4
  module TTI
3
5
  class DataTypeNegotiationRequest < Message
@@ -10,115 +12,64 @@ module Net
10
12
  # 0x0369 (873) - UTF-8
11
13
  uint16le :charset1
12
14
  uint16le :charset2
13
- uint8 :unknown1
14
- uint8 :unknown2_length, :value => lambda { unknown2.length }
15
+ uint8 :client_flags
16
+ uint8 :client_compiletime_capabilities_length, :value => lambda { client_compiletime_capabilities.length }
17
+ string :client_compiletime_capabilities
18
+ uint8 :client_runtime_capabilities_length, :value => lambda { client_runtime_capabilities.length }
19
+ string :client_runtime_capabilities
20
+ string :unknown1
15
21
  string :unknown2
16
- uint8 :unknown3_length, :value => lambda { unknown3.length }
17
- string :unknown3
18
- string :unknown4
19
-
20
- UNKNOWN4_LINUX = (
21
- "800000003c3c3c80000000d007000100010001000000020002000a0000000800" +
22
- "0800010000000c000c000a000000170017000100000018001800010000001900" +
23
- "190018001900010000001a001a0019001a00010000001b001b000a001b000100" +
24
- "00001c001c0016001c00010000001d001d0017001d00010000001e001e001700" +
25
- "1e00010000001f001f0019001f0001000000200020000a002000010000002100" +
26
- "21000a002100010000000a000a00010000000b000b0001000000280028000100" +
27
- "0000290029000100000075007500010000007800780001000001220122000100" +
28
- "0001230123000101230001000001240124000100000125012500010000012601" +
29
- "2600010000012a012a00010000012b012b00010000012c012c00010000012d01" +
30
- "2d00010000012e012e00010000012f012f000100000130013000010000013101" +
31
- "3100010000013201320001000001330133000100000134013400010000013501" +
32
- "3500010000013601360001000001370137000100000138013800010000013901" +
33
- "3900010000013b013b00010000013c013c00010000013d013d00010000013e01" +
34
- "3e00010000013f013f0001000001400140000100000141014100010000014201" +
35
- "4200010000014301430001000001470147000100000148014800010000014901" +
36
- "4900010000014b014b00010000014d014d00010000014e014e00010000014f01" +
37
- "4f00010000015001500001000001510151000100000152015200010000015301" +
38
- "5300010000015401540001000001550155000100000156015600010000015701" +
39
- "57000101570001000001580158000100000159015900010000015a015a000100" +
40
- "00015c015c00010000015d015d00010000016201620001000001630163000100" +
41
- "000167016700010000016b016b00010000017c017c0001014200010000017d01" +
42
- "7d00010000017e017e00010000017f017f000100000180018000010000018101" +
43
- "8100010000018201820001000001830183000100000184018400010000018501" +
44
- "8500010000018601860001000001870187000100000189018900010000018a01" +
45
- "8a00010000018b018b00010000018c018c00010000018d018d00010000018e01" +
46
- "8e00010000018f018f0001000001900190000100000191019100010000019401" +
47
- "9400010125000100000195019500010000019601960001000001970197000100" +
48
- "00019d019d00010000019e019e00010000019f019f0001000001a001a0000100" +
49
- "0001a101a10001000001a201a20001000001a301a30001000001a401a4000100" +
50
- "0001a501a50001000001a601a60001000001a701a70001000001a801a8000100" +
51
- "0001a901a90001000001aa01aa0001000001ab01ab0001000001ad01ad000100" +
52
- "0001ae01ae0001000001af01af0001000001b001b00001000001b101b1000100" +
53
- "0001c101c10001000001c201c2000101250001000001c601c60001000001c701" +
54
- "c70001000001c801c80001000001c901c90001000001ca01ca0001019f000100" +
55
- "0001cb01cb000101a00001000001cc01cc000101a20001000001cd01cd000101" +
56
- "a30001000001ce01ce000101b10001000001cf01cf000101220001000001d201" +
57
- "d20001000001d301d3000101ab0001000001d401d40001000001d501d5000100" +
58
- "0001d601d60001000001d701d70001000001d801d80001000001d901d9000100" +
59
- "0001da01da0001000001db01db0001000001dc01dc0001000001dd01dd000100" +
60
- "0001de01de0001000001df01df0001000001e001e00001000001e101e1000100" +
61
- "0001e201e20001000001e301e30001016b0001000001e401e40001000001e501" +
62
- "e50001000001e601e60001000001ea01ea0001000001eb01eb0001000001ec01" +
63
- "ec0001000001ed01ed0001000001ee01ee0001000001ef01ef0001000001f001" +
64
- "f00001000001f201f20001000001f301f30001000001f401f40001000001f501" +
65
- "f50001000001f601f60001000001fd01fd0001000001fe01fe00010000020102" +
66
- "0100010000020202020001000002040204000100000205020500010000020602" +
67
- "0600010000020702070001000002080208000100000209020900010000020a02" +
68
- "0a00010000020b020b00010000020c020c00010000020d020d00010000020e02" +
69
- "0e00010000020f020f0001000002100210000100000211021100010000021202" +
70
- "1200010000021302130001000002140214000100000215021500010000021602" +
71
- "1600010000021702170001000002180218000100000219021900010000021a02" +
72
- "1a00010000021b021b00010000021c021c00010000021d021d00010000021e02" +
73
- "1e00010000021f021f0001000002200220000100000221022100010000022202" +
74
- "2200010000022302230001000002240224000100000225022500010000022602" +
75
- "2600010000022702270001000002280228000100000229022900010000022a02" +
76
- "2a00010000022b022b00010000022c022c00010000022d022d00010000022e02" +
77
- "2e00010000022f022f0001000002310231000100000232023200010000023302" +
78
- "3300010000023402340001000002370237000100000238023800010000023902" +
79
- "3900010000023a023a00010000023b023b00010000023c023c00010000023d02" +
80
- "3d00010000023e023e00010000023f023f000100000240024000010000024102" +
81
- "4100010000024202420001000002430243000100000244024400010000024502" +
82
- "4500010000024602460001000002470247000100000248024800010000024902" +
83
- "490001000000030002000a000000040002000a00000005000100010000000600" +
84
- "02000a000000070002000a00000009000100010000000d0000000e0000000f00" +
85
- "1700010000001000000011000000120000001300000014000000150000001600" +
86
- "00002700780001015d0001012600010000003a003a0001000000440002000a00" +
87
- "000045000000460000004a006d00010000004c0000005b0002000a0000005e00" +
88
- "0100010000005f00170001000000600060000100000061006000010000006400" +
89
- "6400010000006500650001000000660066000100000068000000690000006a00" +
90
- "6a00010000006c006d00010000006d006d00010000006e006f00010000006f00" +
91
- "6f00010000007000700001000000710071000100000072007200010000007300" +
92
- "7300010000007400660001000000760000007700000079007900010000007a00" +
93
- "7a00010000007b007b0001000000880000009200920001000000930093000100" +
94
- "0000980002000a000000990002000a0000009a0002000a0000009b0001000100" +
95
- "00009c000c000a000000ac0002000a000000b200b20001000000b300b3000100" +
96
- "0000b400b40001000000b500b50001000000b600b60001000000b700b7000100" +
97
- "0000b8000c000a000000b900b20001000000ba00b30001000000bb00b4000100" +
98
- "0000bc00b50001000000bd00b60001000000be00b70001000000bf000000c000" +
99
- "0000c300700001000000c400710001000000c500720001000000d000d0000100" +
100
- "0000d1000000e700e70001000000e800e70001000000e900e90001000000f100" +
101
- "6d0001000002030203000100000000").tns_unhexify
22
+ string :dty_body
23
+ string :fin
102
24
 
103
25
  def _ttc_code()
104
26
  TTC_CODE_DATA_TYPE_NEGOTIATION
105
27
  end
106
28
  private :_ttc_code
107
29
 
108
- def self.create_request(platform)
30
+ def self.create_request(conn_params)
109
31
  request = self.new
110
- request.character_set = 0x00b2
111
- request.unknown1 = 0x02
112
- request.unknown2 = "060101010d01010401010101010101ffff0308030001003f01073f010101010301".tns_unhexify
113
- request.unknown3 = "0201000018".tns_unhexify
32
+ request.character_set = conn_params.character_set
33
+ request.client_flags = conn_params.server_flags
34
+
35
+ client_ct_caps = Capabilities.from_binary_string( "060100000a0101060101010101010029900307030001004f013704010000000c000006000383".tns_unhexify )
36
+ client_rt_caps = Capabilities.from_binary_string( "02010000000001".tns_unhexify )
37
+
38
+ if(conn_params.server_runtime_capabilities.length <=1 or conn_params.server_runtime_capabilities[1] & 1 != 1)
39
+ client_rt_caps[1] &= 254
40
+ end
41
+
42
+ if(conn_params.server_compiletime_capabilities.length <= 37 or conn_params.server_compiletime_capabilities[37] & 2 != 2)
43
+ client_rt_caps[1] &= 254
44
+ client_ct_caps[37] &= 253
45
+ end
46
+
47
+ if(conn_params.server_compiletime_capabilities.length <= 27 or conn_params.server_compiletime_capabilities[27] == 0)
48
+ client_ct_caps[27] = 0
49
+ end
50
+
51
+ request.client_compiletime_capabilities = client_ct_caps.to_binary_s
52
+ request.client_runtime_capabilities = client_rt_caps.to_binary_s
53
+
54
+ if (client_rt_caps[1] & 1 == 1)
55
+ request.unknown1 = "800000003c3c8000000000".tns_unhexify
56
+ if(client_ct_caps[37] & 2 == 2)
57
+ request.unknown2 = "00000000".tns_unhexify
58
+ end
59
+ end
60
+
61
+ if(conn_params.server_compiletime_capabilities.length <= 7 or conn_params.server_compiletime_capabilities[7] != 5)
62
+ dty_body_bytes = [0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x0a, 0x00, 0x08, 0x08, 0x01, 0x00, 0x0c, 0x0c, 0x0a, 0x00, 0x17, 0x17, 0x01, 0x00, 0x18, 0x18, 0x01, 0x00, 0x19, 0x19, 0x01, 0x00, 0x1a, 0x1a, 0x01, 0x00, 0x1b, 0x1b, 0x01, 0x00, 0x1c, 0x1c, 0x01, 0x00, 0x1d, 0x1d, 0x01, 0x00, 0x1e, 0x1e, 0x01, 0x00, 0x1f, 0x1f, 0x01, 0x00, 0x20, 0x20, 0x01, 0x00, 0x21, 0x21, 0x01, 0x00, 0x0a, 0x0a, 0x01, 0x00, 0xb, 0xb, 0x01, 0x00, 0x28, 0x28, 0x01, 0x00, 0x29, 0x29, 0x01, 0x00, 0x75, 0x75, 0x01, 0x00, 0x78, 0x78, 0x01, 0x00, 0x122, 0x122, 0x01, 0x00, 0x123, 0x123, 0x01, 0x00, 0x124, 0x124, 0x01, 0x00, 0x125, 0x125, 0x01, 0x00, 0x126, 0x126, 0x01, 0x00, 0x12a, 0x12a, 0x01, 0x00, 0x12b, 0x12b, 0x01, 0x00, 0x12c, 0x12c, 0x01, 0x00, 0x12d, 0x12d, 0x01, 0x00, 0x12e, 0x12e, 0x01, 0x00, 0x12f, 0x12f, 0x01, 0x00, 0x130, 0x130, 0x01, 0x00, 0x131, 0x131, 0x01, 0x00, 0x132, 0x132, 0x01, 0x00, 0x133, 0x133, 0x01, 0x00, 0x134, 0x134, 0x01, 0x00, 0x135, 0x135, 0x01, 0x00, 0x136, 0x136, 0x01, 0x00, 0x137, 0x137, 0x01, 0x00, 0x138, 0x138, 0x01, 0x00, 0x139, 0x139, 0x01, 0x00, 0x13b, 0x13b, 0x01, 0x00, 0x13c, 0x13c, 0x01, 0x00, 0x13d, 0x13d, 0x01, 0x00, 0x13e, 0x13e, 0x01, 0x00, 0x13f, 0x13f, 0x01, 0x00, 0x140, 0x140, 0x01, 0x00, 0x141, 0x141, 0x01, 0x00, 0x142, 0x142, 0x01, 0x00, 0x143, 0x143, 0x01, 0x00, 0x147, 0x147, 0x01, 0x00, 0x148, 0x148, 0x01, 0x00, 0x149, 0x149, 0x01, 0x00, 0x14b, 0x14b, 0x01, 0x00, 0x14d, 0x14d, 0x01, 0x00, 0x14e, 0x14e, 0x01, 0x00, 0x14f, 0x14f, 0x01, 0x00, 0x150, 0x150, 0x01, 0x00, 0x151, 0x151, 0x01, 0x00, 0x152, 0x152, 0x01, 0x00, 0x153, 0x153, 0x01, 0x00, 0x154, 0x154, 0x01, 0x00, 0x155, 0x155, 0x01, 0x00, 0x156, 0x156, 0x01, 0x00, 0x157, 0x157, 0x01, 0x00, 0x158, 0x158, 0x01, 0x00, 0x159, 0x159, 0x01, 0x00, 0x15a, 0x15a, 0x01, 0x00, 0x15c, 0x15c, 0x01, 0x00, 0x15d, 0x15d, 0x01, 0x00, 0x162, 0x162, 0x01, 0x00, 0x163, 0x163, 0x01, 0x00, 0x167, 0x167, 0x01, 0x00, 0x16b, 0x16b, 0x01, 0x00, 0x17c, 0x17c, 0x01, 0x00, 0x17d, 0x17d, 0x01, 0x00, 0x17e, 0x17e, 0x01, 0x00, 0x17f, 0x17f, 0x01, 0x00, 0x180, 0x180, 0x01, 0x00, 0x181, 0x181, 0x01, 0x00, 0x182, 0x182, 0x01, 0x00, 0x183, 0x183, 0x01, 0x00, 0x184, 0x184, 0x01, 0x00, 0x185, 0x185, 0x01, 0x00, 0x186, 0x186, 0x01, 0x00, 0x187, 0x187, 0x01, 0x00, 0x189, 0x189, 0x01, 0x00, 0x18a, 0x18a, 0x01, 0x00, 0x18b, 0x18b, 0x01, 0x00, 0x18c, 0x18c, 0x01, 0x00, 0x18d, 0x18d, 0x01, 0x00, 0x18e, 0x18e, 0x01, 0x00, 0x18f, 0x18f, 0x01, 0x00, 0x190, 0x190, 0x01, 0x00, 0x191, 0x191, 0x01, 0x00, 0x194, 0x194, 0x01, 0x00, 0x195, 0x195, 0x01, 0x00, 0x196, 0x196, 0x01, 0x00, 0x197, 0x197, 0x01, 0x00, 0x19d, 0x19d, 0x01, 0x00, 0x19e, 0x19e, 0x01, 0x00, 0x19f, 0x19f, 0x01, 0x00, 0x1a0, 0x1a0, 0x01, 0x00, 0x1a1, 0x1a1, 0x01, 0x00, 0x1a2, 0x1a2, 0x01, 0x00, 0x1a3, 0x1a3, 0x01, 0x00, 0x1a4, 0x1a4, 0x01, 0x00, 0x1a5, 0x1a5, 0x01, 0x00, 0x1a6, 0x1a6, 0x01, 0x00, 0x1a7, 0x1a7, 0x01, 0x00, 0x1a8, 0x1a8, 0x01, 0x00, 0x1a9, 0x1a9, 0x01, 0x00, 0x1aa, 0x1aa, 0x01, 0x00, 0x1ab, 0x1ab, 0x01, 0x00, 0x1ad, 0x1ad, 0x01, 0x00, 0x1ae, 0x1ae, 0x01, 0x00, 0x1af, 0x1af, 0x01, 0x00, 0x1b0, 0x1b0, 0x01, 0x00, 0x1b1, 0x1b1, 0x01, 0x00, 0x1c1, 0x1c1, 0x01, 0x00, 0x1c2, 0x1c2, 0x01, 0x00, 0x1c6, 0x1c6, 0x01, 0x00, 0x1c7, 0x1c7, 0x01, 0x00, 0x1c8, 0x1c8, 0x01, 0x00, 0x1c9, 0x1c9, 0x01, 0x00, 0x1ca, 0x1ca, 0x01, 0x00, 0x1cb, 0x1cb, 0x01, 0x00, 0x1cc, 0x1cc, 0x01, 0x00, 0x1cd, 0x1cd, 0x01, 0x00, 0x1ce, 0x1ce, 0x01, 0x00, 0x1cf, 0x1cf, 0x01, 0x00, 0x1d2, 0x1d2, 0x01, 0x00, 0x1d3, 0x1d3, 0x01, 0x00, 0x1d4, 0x1d4, 0x01, 0x00, 0x1d5, 0x1d5, 0x01, 0x00, 0x1d6, 0x1d6, 0x01, 0x00, 0x1d7, 0x1d7, 0x01, 0x00, 0x1d8, 0x1d8, 0x01, 0x00, 0x1d9, 0x1d9, 0x01, 0x00, 0x1da, 0x1da, 0x01, 0x00, 0x1db, 0x1db, 0x01, 0x00, 0x1dc, 0x1dc, 0x01, 0x00, 0x1dd, 0x1dd, 0x01, 0x00, 0x1de, 0x1de, 0x01, 0x00, 0x1df, 0x1df, 0x01, 0x00, 0x1e0, 0x1e0, 0x01, 0x00, 0x1e1, 0x1e1, 0x01, 0x00, 0x1e2, 0x1e2, 0x01, 0x00, 0x1e3, 0x1e3, 0x01, 0x00, 0x1e4, 0x1e4, 0x01, 0x00, 0x1e5, 0x1e5, 0x01, 0x00, 0x1e6, 0x1e6, 0x01, 0x00, 0x1ea, 0x1ea, 0x01, 0x00, 0x1eb, 0x1eb, 0x01, 0x00, 0x1ec, 0x1ec, 0x01, 0x00, 0x1ed, 0x1ed, 0x01, 0x00, 0x1ee, 0x1ee, 0x01, 0x00, 0x1ef, 0x1ef, 0x01, 0x00, 0x1f0, 0x1f0, 0x01, 0x00, 0x1f2, 0x1f2, 0x01, 0x00, 0x1f3, 0x1f3, 0x01, 0x00, 0x1f4, 0x1f4, 0x01, 0x00, 0x1f5, 0x1f5, 0x01, 0x00, 0x1f6, 0x1f6, 0x01, 0x00, 0x1fd, 0x1fd, 0x01, 0x00, 0x1fe, 0x1fe, 0x01, 0x00, 0x201, 0x201, 0x01, 0x00, 0x202, 0x202, 0x01, 0x00, 0x204, 0x204, 0x01, 0x00, 0x205, 0x205, 0x01, 0x00, 0x206, 0x206, 0x01, 0x00, 0x207, 0x207, 0x01, 0x00, 0x208, 0x208, 0x01, 0x00, 0x209, 0x209, 0x01, 0x00, 0x20a, 0x20a, 0x01, 0x00, 0x20b, 0x20b, 0x01, 0x00, 0x20c, 0x20c, 0x01, 0x00, 0x20d, 0x20d, 0x01, 0x00, 0x20e, 0x20e, 0x01, 0x00, 0x20f, 0x20f, 0x01, 0x00, 0x210, 0x210, 0x01, 0x00, 0x211, 0x211, 0x01, 0x00, 0x212, 0x212, 0x01, 0x00, 0x213, 0x213, 0x01, 0x00, 0x214, 0x214, 0x01, 0x00, 0x215, 0x215, 0x01, 0x00, 0x216, 0x216, 0x01, 0x00, 0x217, 0x217, 0x01, 0x00, 0x218, 0x218, 0x01, 0x00, 0x219, 0x219, 0x01, 0x00, 0x21a, 0x21a, 0x01, 0x00, 0x21b, 0x21b, 0x01, 0x00, 0x21c, 0x21c, 0x01, 0x00, 0x21d, 0x21d, 0x01, 0x00, 0x21e, 0x21e, 0x01, 0x00, 0x21f, 0x21f, 0x01, 0x00, 0x230, 0x230, 0x01, 0x00, 0x235, 0x235, 0x01, 0x00, 0x23c, 0x23c, 0x01, 0x00, 0x23d, 0x23d, 0x01, 0x00, 0x23e, 0x23e, 0x01, 0x00, 0x23f, 0x23f, 0x01, 0x00, 0x240, 0x240, 0x01, 0x00, 0x242, 0x242, 0x01, 0x00, 0x244, 0x244, 0x01, 0x00, 0x245, 0x245, 0x01, 0x00, 0x246, 0x246, 0x01, 0x00, 0x247, 0x247, 0x01, 0x00, 0x248, 0x248, 0x01, 0x00, 0x249, 0x249, 0x01, 0x00, 0x3, 0x02, 0x0a, 0x00, 0x4, 0x02, 0x0a, 0x00, 0x5, 0x01, 0x01, 0x00, 0x6, 0x02, 0x0a, 0x00, 0x7, 0x02, 0x0a, 0x00, 0x9, 0x01, 0x01, 0x00, 0xd, 0x00, 0xe, 0x00, 0xf, 0x17, 0x01, 0x00, 0x10, 0x00, 0x11, 0x00, 0x12, 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, 0x00, 0x16, 0x00, 0x27, 0x78, 0x01, 0x00, 0x3a, 0x00, 0x44, 0x02, 0x0a, 0x00, 0x45, 0x00, 0x46, 0x00, 0x4a, 0x00, 0x4c, 0x00, 0x5b, 0x02, 0x0a, 0x00, 0x5e, 0x01, 0x01, 0x00, 0x5f, 0x17, 0x01, 0x00, 0x60, 0x60, 0x01, 0x00, 0x61, 0x60, 0x01, 0x00, 0x64, 0x64, 0x01, 0x00, 0x65, 0x65, 0x01, 0x00, 0x66, 0x66, 0x01, 0x00, 0x68, 0xb, 0x01, 0x00, 0x69, 0x00, 0x6a, 0x6a, 0x01, 0x00, 0x6c, 0x6d, 0x01, 0x00, 0x6d, 0x6d, 0x01, 0x00, 0x6e, 0x6f, 0x01, 0x00, 0x6f, 0x6f, 0x01, 0x00, 0x70, 0x70, 0x01, 0x00, 0x71, 0x71, 0x01, 0x00, 0x72, 0x72, 0x01, 0x00, 0x73, 0x73, 0x01, 0x00, 0x74, 0x66, 0x01, 0x00, 0x76, 0x00, 0x77, 0x00, 0x79, 0x00, 0x7a, 0x00, 0x7b, 0x00, 0x88, 0x00, 0x92, 0x92, 0x01, 0x00, 0x93, 0x00, 0x98, 0x02, 0x0a, 0x00, 0x99, 0x02, 0x0a, 0x00, 0x9a, 0x02, 0x0a, 0x00, 0x9b, 0x01, 0x01, 0x00, 0x9c, 0x0c, 0x0a, 0x00, 0xac, 0x02, 0x0a, 0x00, 0xb2, 0xb2, 0x01, 0x00, 0xb3, 0xb3, 0x01, 0x00, 0xb4, 0xb4, 0x01, 0x00, 0xb5, 0xb5, 0x01, 0x00, 0xb6, 0xb6, 0x01, 0x00, 0xb7, 0xb7, 0x01, 0x00, 0xb8, 0x0c, 0x0a, 0x00, 0xb9, 0xb9, 0x01, 0x00, 0xba, 0xba, 0x01, 0x00, 0xbb, 0xbb, 0x01, 0x00, 0xbc, 0xbc, 0x01, 0x00, 0xbd, 0xbd, 0x01, 0x00, 0xbe, 0xbe, 0x01, 0x00, 0xbf, 0x00, 0xc0, 0x00, 0xc3, 0x70, 0x01, 0x00, 0xc4, 0x71, 0x01, 0x00, 0xc5, 0x72, 0x01, 0x00, 0xd0, 0xd0, 0x01, 0x00, 0xd1, 0x00, 0xe7, 0xe7, 0x01, 0x00, 0xe8, 0xe7, 0x01, 0x00, 0xe9, 0xe9, 0x01, 0x00, 0xf1, 0x6d, 0x01, 0x00, 0x203, 0x00, 0x24e, 0x24e, 0x01, 0x00, 0x24f, 0x24f, 0x01, 0x00, 0x250, 0x250, 0x01, 0x00]
63
+ else
64
+ dty_body_bytes = [0x01, 0x01, 0x01, 0x00, 0x02, 0x02, 0x0a, 0x00, 0x08, 0x08, 0x01, 0x00, 0x0c, 0x0c, 0x0a, 0x00, 0x17, 0x17, 0x01, 0x00, 0x18, 0x18, 0x01, 0x00, 0x19, 0x19, 0x01, 0x00, 0x1a, 0x1a, 0x01, 0x00, 0x1b, 0x1b, 0x01, 0x00, 0x1c, 0x1c, 0x01, 0x00, 0x1d, 0x1d, 0x01, 0x00, 0x1e, 0x1e, 0x01, 0x00, 0x1f, 0x1f, 0x01, 0x00, 0x20, 0x20, 0x01, 0x00, 0x21, 0x21, 0x01, 0x00, 0x0a, 0x0a, 0x01, 0x00, 0xb, 0xb, 0x01, 0x00, 0x28, 0x28, 0x01, 0x00, 0x29, 0x29, 0x01, 0x00, 0x75, 0x75, 0x01, 0x00, 0x78, 0x78, 0x01, 0x00, 0x122, 0x122, 0x01, 0x00, 0x123, 0x123, 0x01, 0x00, 0x124, 0x124, 0x01, 0x00, 0x125, 0x125, 0x01, 0x00, 0x126, 0x126, 0x01, 0x00, 0x12a, 0x12a, 0x01, 0x00, 0x12b, 0x12b, 0x01, 0x00, 0x12c, 0x12c, 0x01, 0x00, 0x12d, 0x12d, 0x01, 0x00, 0x12e, 0x12e, 0x01, 0x00, 0x12f, 0x12f, 0x01, 0x00, 0x130, 0x130, 0x01, 0x00, 0x131, 0x131, 0x01, 0x00, 0x132, 0x132, 0x01, 0x00, 0x133, 0x133, 0x01, 0x00, 0x134, 0x134, 0x01, 0x00, 0x135, 0x135, 0x01, 0x00, 0x136, 0x136, 0x01, 0x00, 0x137, 0x137, 0x01, 0x00, 0x138, 0x138, 0x01, 0x00, 0x139, 0x139, 0x01, 0x00, 0x13b, 0x13b, 0x01, 0x00, 0x13c, 0x13c, 0x01, 0x00, 0x13d, 0x13d, 0x01, 0x00, 0x13e, 0x13e, 0x01, 0x00, 0x13f, 0x13f, 0x01, 0x00, 0x140, 0x140, 0x01, 0x00, 0x141, 0x141, 0x01, 0x00, 0x142, 0x142, 0x01, 0x00, 0x143, 0x143, 0x01, 0x00, 0x147, 0x147, 0x01, 0x00, 0x148, 0x148, 0x01, 0x00, 0x149, 0x149, 0x01, 0x00, 0x14b, 0x14b, 0x01, 0x00, 0x14d, 0x14d, 0x01, 0x00, 0x14e, 0x14e, 0x01, 0x00, 0x14f, 0x14f, 0x01, 0x00, 0x150, 0x150, 0x01, 0x00, 0x151, 0x151, 0x01, 0x00, 0x152, 0x152, 0x01, 0x00, 0x153, 0x153, 0x01, 0x00, 0x154, 0x154, 0x01, 0x00, 0x155, 0x155, 0x01, 0x00, 0x156, 0x156, 0x01, 0x00, 0x157, 0x157, 0x01, 0x00, 0x158, 0x158, 0x01, 0x00, 0x159, 0x159, 0x01, 0x00, 0x15a, 0x15a, 0x01, 0x00, 0x15c, 0x15c, 0x01, 0x00, 0x15d, 0x15d, 0x01, 0x00, 0x162, 0x162, 0x01, 0x00, 0x163, 0x163, 0x01, 0x00, 0x167, 0x167, 0x01, 0x00, 0x16b, 0x16b, 0x01, 0x00, 0x17c, 0x17c, 0x01, 0x00, 0x17d, 0x17d, 0x01, 0x00, 0x17e, 0x17e, 0x01, 0x00, 0x17f, 0x17f, 0x01, 0x00, 0x180, 0x180, 0x01, 0x00, 0x181, 0x181, 0x01, 0x00, 0x182, 0x182, 0x01, 0x00, 0x183, 0x183, 0x01, 0x00, 0x184, 0x184, 0x01, 0x00, 0x185, 0x185, 0x01, 0x00, 0x186, 0x186, 0x01, 0x00, 0x187, 0x187, 0x01, 0x00, 0x189, 0x189, 0x01, 0x00, 0x18a, 0x18a, 0x01, 0x00, 0x18b, 0x18b, 0x01, 0x00, 0x18c, 0x18c, 0x01, 0x00, 0x18d, 0x18d, 0x01, 0x00, 0x18e, 0x18e, 0x01, 0x00, 0x18f, 0x18f, 0x01, 0x00, 0x190, 0x190, 0x01, 0x00, 0x191, 0x191, 0x01, 0x00, 0x194, 0x194, 0x01, 0x00, 0x195, 0x195, 0x01, 0x00, 0x196, 0x196, 0x01, 0x00, 0x197, 0x197, 0x01, 0x00, 0x19d, 0x19d, 0x01, 0x00, 0x19e, 0x19e, 0x01, 0x00, 0x19f, 0x19f, 0x01, 0x00, 0x1a0, 0x1a0, 0x01, 0x00, 0x1a1, 0x1a1, 0x01, 0x00, 0x1a2, 0x1a2, 0x01, 0x00, 0x1a3, 0x1a3, 0x01, 0x00, 0x1a4, 0x1a4, 0x01, 0x00, 0x1a5, 0x1a5, 0x01, 0x00, 0x1a6, 0x1a6, 0x01, 0x00, 0x1a7, 0x1a7, 0x01, 0x00, 0x1a8, 0x1a8, 0x01, 0x00, 0x1a9, 0x1a9, 0x01, 0x00, 0x1aa, 0x1aa, 0x01, 0x00, 0x1ab, 0x1ab, 0x01, 0x00, 0x1ad, 0x1ad, 0x01, 0x00, 0x1ae, 0x1ae, 0x01, 0x00, 0x1af, 0x1af, 0x01, 0x00, 0x1b0, 0x1b0, 0x01, 0x00, 0x1b1, 0x1b1, 0x01, 0x00, 0x1c1, 0x1c1, 0x01, 0x00, 0x1c2, 0x1c2, 0x01, 0x00, 0x1c6, 0x1c6, 0x01, 0x00, 0x1c7, 0x1c7, 0x01, 0x00, 0x1c8, 0x1c8, 0x01, 0x00, 0x1c9, 0x1c9, 0x01, 0x00, 0x1ca, 0x1ca, 0x01, 0x00, 0x1cb, 0x1cb, 0x01, 0x00, 0x1cc, 0x1cc, 0x01, 0x00, 0x1cd, 0x1cd, 0x01, 0x00, 0x1ce, 0x1ce, 0x01, 0x00, 0x1cf, 0x1cf, 0x01, 0x00, 0x1d2, 0x1d2, 0x01, 0x00, 0x1d3, 0x1d3, 0x01, 0x00, 0x1d4, 0x1d4, 0x01, 0x00, 0x1d5, 0x1d5, 0x01, 0x00, 0x1d6, 0x1d6, 0x01, 0x00, 0x1d7, 0x1d7, 0x01, 0x00, 0x1d8, 0x1d8, 0x01, 0x00, 0x1d9, 0x1d9, 0x01, 0x00, 0x1da, 0x1da, 0x01, 0x00, 0x1db, 0x1db, 0x01, 0x00, 0x1dc, 0x1dc, 0x01, 0x00, 0x1dd, 0x1dd, 0x01, 0x00, 0x1de, 0x1de, 0x01, 0x00, 0x1df, 0x1df, 0x01, 0x00, 0x1e0, 0x1e0, 0x01, 0x00, 0x1e1, 0x1e1, 0x01, 0x00, 0x1e2, 0x1e2, 0x01, 0x00, 0x1e3, 0x1e3, 0x01, 0x00, 0x1e4, 0x1e4, 0x01, 0x00, 0x1e5, 0x1e5, 0x01, 0x00, 0x1e6, 0x1e6, 0x01, 0x00, 0x1ea, 0x1ea, 0x01, 0x00, 0x1eb, 0x1eb, 0x01, 0x00, 0x1ec, 0x1ec, 0x01, 0x00, 0x1ed, 0x1ed, 0x01, 0x00, 0x1ee, 0x1ee, 0x01, 0x00, 0x1ef, 0x1ef, 0x01, 0x00, 0x1f0, 0x1f0, 0x01, 0x00, 0x1f2, 0x1f2, 0x01, 0x00, 0x1f3, 0x1f3, 0x01, 0x00, 0x1f4, 0x1f4, 0x01, 0x00, 0x1f5, 0x1f5, 0x01, 0x00, 0x1f6, 0x1f6, 0x01, 0x00, 0x1fd, 0x1fd, 0x01, 0x00, 0x1fe, 0x1fe, 0x01, 0x00, 0x201, 0x201, 0x01, 0x00, 0x202, 0x202, 0x01, 0x00, 0x204, 0x204, 0x01, 0x00, 0x205, 0x205, 0x01, 0x00, 0x206, 0x206, 0x01, 0x00, 0x207, 0x207, 0x01, 0x00, 0x208, 0x208, 0x01, 0x00, 0x209, 0x209, 0x01, 0x00, 0x20a, 0x20a, 0x01, 0x00, 0x20b, 0x20b, 0x01, 0x00, 0x20c, 0x20c, 0x01, 0x00, 0x20d, 0x20d, 0x01, 0x00, 0x20e, 0x20e, 0x01, 0x00, 0x20f, 0x20f, 0x01, 0x00, 0x210, 0x210, 0x01, 0x00, 0x211, 0x211, 0x01, 0x00, 0x212, 0x212, 0x01, 0x00, 0x213, 0x213, 0x01, 0x00, 0x214, 0x214, 0x01, 0x00, 0x215, 0x215, 0x01, 0x00, 0x216, 0x216, 0x01, 0x00, 0x217, 0x217, 0x01, 0x00, 0x218, 0x218, 0x01, 0x00, 0x219, 0x219, 0x01, 0x00, 0x21a, 0x21a, 0x01, 0x00, 0x21b, 0x21b, 0x01, 0x00, 0x21c, 0x21c, 0x01, 0x00, 0x21d, 0x21d, 0x01, 0x00, 0x21e, 0x21e, 0x01, 0x00, 0x21f, 0x21f, 0x01, 0x00, 0x230, 0x230, 0x01, 0x00, 0x235, 0x235, 0x01, 0x00, 0x23c, 0x23c, 0x01, 0x00, 0x23d, 0x23d, 0x01, 0x00, 0x23e, 0x23e, 0x01, 0x00, 0x23f, 0x23f, 0x01, 0x00, 0x240, 0x240, 0x01, 0x00, 0x242, 0x242, 0x01, 0x00, 0x244, 0x244, 0x01, 0x00, 0x245, 0x245, 0x01, 0x00, 0x246, 0x246, 0x01, 0x00, 0x247, 0x247, 0x01, 0x00, 0x248, 0x248, 0x01, 0x00, 0x249, 0x249, 0x01, 0x00, 0x3, 0x02, 0x0a, 0x00, 0x4, 0x02, 0x0a, 0x00, 0x5, 0x01, 0x01, 0x00, 0x6, 0x02, 0x0a, 0x00, 0x7, 0x02, 0x0a, 0x00, 0x9, 0x01, 0x01, 0x00, 0xd, 0x00, 0xe, 0x00, 0xf, 0x17, 0x01, 0x00, 0x10, 0x00, 0x11, 0x00, 0x12, 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, 0x00, 0x16, 0x00, 0x27, 0x78, 0x01, 0x00, 0x3a, 0x00, 0x44, 0x02, 0x0a, 0x00, 0x45, 0x00, 0x46, 0x00, 0x4a, 0x00, 0x4c, 0x00, 0x5b, 0x02, 0x0a, 0x00, 0x5e, 0x01, 0x01, 0x00, 0x5f, 0x17, 0x01, 0x00, 0x60, 0x60, 0x01, 0x00, 0x61, 0x60, 0x01, 0x00, 0x64, 0x64, 0x01, 0x00, 0x65, 0x65, 0x01, 0x00, 0x66, 0x66, 0x01, 0x00, 0x68, 0xb, 0x01, 0x00, 0x69, 0x00, 0x6a, 0x6a, 0x01, 0x00, 0x6c, 0x6d, 0x01, 0x00, 0x6d, 0x6d, 0x01, 0x00, 0x6e, 0x6f, 0x01, 0x00, 0x6f, 0x6f, 0x01, 0x00, 0x70, 0x70, 0x01, 0x00, 0x71, 0x71, 0x01, 0x00, 0x72, 0x72, 0x01, 0x00, 0x73, 0x73, 0x01, 0x00, 0x74, 0x66, 0x01, 0x00, 0x76, 0x00, 0x77, 0x00, 0x79, 0x00, 0x7a, 0x00, 0x7b, 0x00, 0x88, 0x00, 0x92, 0x92, 0x01, 0x00, 0x93, 0x00, 0x98, 0x02, 0x0a, 0x00, 0x99, 0x02, 0x0a, 0x00, 0x9a, 0x02, 0x0a, 0x00, 0x9b, 0x01, 0x01, 0x00, 0x9c, 0x0c, 0x0a, 0x00, 0xac, 0x02, 0x0a, 0x00, 0xb2, 0xb2, 0x01, 0x00, 0xb3, 0xb3, 0x01, 0x00, 0xb4, 0xb4, 0x01, 0x00, 0xb5, 0xb5, 0x01, 0x00, 0xb6, 0xb6, 0x01, 0x00, 0xb7, 0xb7, 0x01, 0x00, 0xb8, 0x0c, 0x0a, 0x00, 0xb9, 0xb9, 0x01, 0x00, 0xba, 0xba, 0x01, 0x00, 0xbb, 0xbb, 0x01, 0x00, 0xbc, 0xbc, 0x01, 0x00, 0xbd, 0xbd, 0x01, 0x00, 0xbe, 0xbe, 0x01, 0x00, 0xbf, 0x00, 0xc0, 0x00, 0xc3, 0x70, 0x01, 0x00, 0xc4, 0x71, 0x01, 0x00, 0xc5, 0x72, 0x01, 0x00, 0xd0, 0xd0, 0x01, 0x00, 0xd1, 0x00, 0xe7, 0xe7, 0x01, 0x00, 0xe8, 0xe7, 0x01, 0x00, 0xe9, 0xe9, 0x01, 0x00, 0xf1, 0x6d, 0x01, 0x00, 0x203, 0x00]
65
+ end
114
66
 
115
- case platform
116
- when :linux
117
- request.unknown4 = UNKNOWN4_LINUX
118
- when :windows
119
- request.unknown4 = "800000003c3c3c80000000d007".tns_unhexify
67
+ if(client_ct_caps[27] == 0)
68
+ request.dty_body = dty_body_bytes.map { |m| m & 0xff }.pack('C*')
69
+ request.fin = [0x00].pack('C')
120
70
  else
121
- raise Net::TTI::Exceptions::UnsupportedPlatform.new( platform )
71
+ request.dty_body = dty_body_bytes.pack('n*')
72
+ request.fin = [0x00].pack('n')
122
73
  end
123
74
 
124
75
  return request
@@ -4,9 +4,16 @@ module Net
4
4
  handles_response_for_ttc_code TTC_CODE_ERROR
5
5
 
6
6
  # BinData fields
7
- string :unknown1, :read_length => 6
8
- uint16le :unknown2
9
- string :unknown3, :read_length => lambda { unknown2 == 0x01 ? 87 : 57 }
7
+
8
+ uint8 :ucaeocs_length
9
+ string :ucaeocs, :read_length => lambda { ucaeocs_length }
10
+ uint8 :oerrdd_length
11
+ string :oerrdd, :read_length => lambda { oerrdd_length }
12
+ uint8 :current_row_number_length
13
+ string :current_row_number, :read_length => lambda { current_row_number_length }
14
+ uint8 :retcode_length
15
+ string :retcode, :read_length => lambda { retcode_length }
16
+ string :unknown1, :read_length => 24
10
17
  uint8 :message_length
11
18
  string :message, :read_length => lambda { message_length }
12
19
  end
@@ -3,30 +3,51 @@ require "net/tti/data_types"
3
3
  module Net
4
4
  module TTI
5
5
  class Authentication < FunctionCall
6
- LOGON_MODE_PRE_AUTH = 0x00000001
7
- LOGON_MODE_AUTH = 0x00000101
8
-
9
- def self.create_pre_auth_request(target_architecture)
10
- case target_architecture
11
- when :x86
12
- return PreAuthenticationX86.new
13
- when :x64
14
- return PreAuthenticationX64.new
15
- else
16
- raise Net::TTI::Exceptions::UnsupportedPlatform.new(target_architecture)
17
- end
6
+ LOGON_MODE_PRE_AUTH = 0x01
7
+ LOGON_MODE_AUTH = 0x0101
8
+ uint8 :unknown1, :initial_value => 0x01
9
+ uint8 :username_length_length, :initial_value => 0x01
10
+ uint8 :username_length, :value => lambda { username.length }
11
+ uint8 :logon_mode_length, :initial_value => lambda { _logon_mode_length }
12
+ choice :logon_mode, :selection => :_logon_mode do
13
+ uint8 LOGON_MODE_PRE_AUTH, :initial_value => lambda { _logon_mode }
14
+ uint16le LOGON_MODE_AUTH, :initial_value => lambda { _logon_mode }
15
+ end
16
+ uint8 :unknown2, :initial_value => 0x01
17
+ uint8 :parameters_count_length, :initial_value => 0x01
18
+ uint8 :parameters_count, :value => lambda {parameters.count}
19
+ uint8 :unknown3, :initial_value => 0x01
20
+ uint8 :unknown4, :initial_value => 0x01
21
+ string :username
22
+ array :parameters, :type => :key_value_pair, :read_until => lambda {index == parameters_count - 1}
23
+
24
+ def _function_code
25
+ return FUNCTION_CODE_AUTH
18
26
  end
27
+ private :_function_code
19
28
 
20
- def self.create_auth_request(target_architecture)
21
- case target_architecture
22
- when :x86
23
- return AuthenticationX86.new
24
- when :x64
25
- return AuthenticationX64.new
26
- else
27
- raise Net::TTI::Exceptions::UnsupportedPlatform.new(target_architecture)
29
+ def _logon_mode
30
+ return Authentication::LOGON_MODE_AUTH
31
+ end
32
+ private :_logon_mode
33
+
34
+ def _logon_mode_length
35
+ case _logon_mode
36
+ when Authentication::LOGON_MODE_PRE_AUTH
37
+ return 1
38
+ when Authentication::LOGON_MODE_AUTH
39
+ return 2
28
40
  end
29
41
  end
42
+ private :_logon_mode
43
+
44
+ def self.create_pre_auth_request()
45
+ return PreAuthentication.new
46
+ end
47
+
48
+ def self.create_auth_request()
49
+ return Authentication.new
50
+ end
30
51
 
31
52
  def add_parameter( key, value, flags=0 )
32
53
  kvp = DataTypes::KeyValuePair.new( :kvp_key => key, :kvp_value => value, :flags => flags )
@@ -41,5 +62,17 @@ module Net
41
62
  add_parameter( "AUTH_PASSWORD", enc_password.tns_hexify.upcase )
42
63
  end
43
64
  end
65
+
66
+ class PreAuthentication < Authentication
67
+ def _function_code
68
+ return FUNCTION_CODE_PRE_AUTH
69
+ end
70
+ private :_function_code
71
+
72
+ def _logon_mode
73
+ return Authentication::LOGON_MODE_PRE_AUTH
74
+ end
75
+ private :_logon_mode
76
+ end
44
77
  end
45
78
  end
@@ -3,8 +3,9 @@ require "net/tti/data_types"
3
3
  module Net
4
4
  module TTI
5
5
  class PreAuthenticationResponse < Message
6
- uint16le :parameter_count
7
- array :parameters, :type => :key_value_pair, :read_until => lambda {index == parameter_count-1}
6
+ uint8 :unknown1
7
+ uint8 :parameter_count
8
+ array :parameters, :type => :key_value_pair, :read_until => lambda {index == parameter_count - 1}
8
9
 
9
10
  def _ttc_code
10
11
  return TTC_CODE_OK
@@ -6,17 +6,17 @@ module Net
6
6
  # response, this will be the version the server chooses. These are a
7
7
  # concatenated string of version numbers (e.g. 060504).
8
8
  stringz :client_versions_string
9
- stringz :protocol_handler
9
+ stringz :client_string
10
10
 
11
11
  def _ttc_code
12
12
  TTC_CODE_PROTOCOL_NEGOTIATION
13
13
  end
14
14
  private :_ttc_code
15
15
 
16
- def self.create_request(client_versions=[6], protocol_handler="IBMPC/WIN_NT-8.1.0")
16
+ def self.create_request(client_versions=[6, 5, 4, 3, 2, 1, 0], client_string = "Java_TTC-8.2.0")
17
17
  request = self.new
18
18
  request.client_versions = client_versions
19
- request.protocol_handler = protocol_handler
19
+ request.client_string = client_string
20
20
 
21
21
  return request
22
22
  end
@@ -4,39 +4,50 @@ module Net
4
4
  handles_response_for_ttc_code TTC_CODE_PROTOCOL_NEGOTIATION
5
5
 
6
6
  # BinData fields
7
- stringz :versions_string # The protocol (TTC?) version negotiated
8
- stringz :protocol_handler
7
+ uint8 :ttc_version
8
+ # TODO throw if ttc_version is not in (4, 5, 6)
9
+ uint8 :unknown1
10
+ stringz :ttc_server
9
11
  uint16le :character_set
12
+ uint8 :server_flags
13
+ uint16le :character_set_elements_length
14
+ string :character_set_elements, :read_length => lambda {character_set_elements_length * 5}
15
+ # TODO stop parsing here if ttc_version = 4
16
+ uint16be :fdo_length
17
+ string :fdo, :read_length => :fdo_length
18
+ # TODO stop parsing here is ttc_version < 6
19
+ uint8 :server_compiletime_capabilities_length
20
+ string :server_compiletime_capabilities, :read_length => :server_compiletime_capabilities_length
21
+ uint8 :server_runtime_capabilities_length
22
+ string :server_runtime_capabilities, :read_length => :server_runtime_capabilities_length
10
23
 
11
- uint8 :unknown1
12
- uint16le :unknown2_length
13
- string :unknown2, :read_length => lambda {unknown2_length * 5}
14
- uint16be :unknown3_length
15
- string :unknown3, :read_length => :unknown3_length
16
- uint8 :unknown4_length
17
- string :unknown4, :read_length => :unknown4_length
18
- uint8 :unknown5_length
19
- string :unknown5, :read_length => :unknown5_length
24
+ def populate_connection_parameters( conn_params )
25
+ conn_params.ttc_version = self.ttc_version
26
+ conn_params.ttc_server = self.ttc_server
27
+ conn_params.character_set = self.character_set
28
+ conn_params.server_flags = self.server_flags
29
+ conn_params.server_compiletime_capabilities = Capabilities.from_binary_string( server_compiletime_capabilities )
30
+ conn_params.server_runtime_capabilities = Capabilities.from_binary_string( server_runtime_capabilities )
20
31
 
21
- def version
22
- self.versions_string[0,1].unpack("C").first
23
- end
32
+ ttc_server_map = {
33
+ # (start of) protocol handler string => {params}
34
+ "IBMPC/WIN_NT-" => {:architecture => :x86, :platform => :windows},
35
+ "IBMPC/WIN_NT64" => {:architecture => :x64, :platform => :windows},
36
+ "Linuxi386/Linux" => {:architecture => :x86, :platform => :linux},
37
+ "x86_64/Linux" => {:architecture => :x64, :platform => :linux},
38
+ "Sun386i/SunOS" => {:architecture => :x86, :platform => :solaris},
39
+ "AMD64/SunOS" => {:architecture => :x64, :platform => :solaris},
40
+ }
24
41
 
25
- def populate_connection_parameters( conn_params )
26
- conn_params.ttc_version = self.version
42
+ ph_match, match_params = ttc_server_map.find do |ph_start, params|
43
+ ttc_server.start_with?(ph_start)
44
+ end
27
45
 
28
- case self.protocol_handler
29
- when "IBMPC/WIN_NT-8.1.0"
30
- conn_params.architecture = :x86
31
- conn_params.platform = :windows
32
- when "Linuxi386/Linux-2.0.34-8.1.0"
33
- conn_params.architecture = :x86
34
- conn_params.platform = :linux
35
- when "x86_64/Linux 2.4.xx"
36
- conn_params.architecture = :x64
37
- conn_params.platform = :linux
46
+ if ph_match
47
+ conn_params.architecture = match_params[:architecture]
48
+ conn_params.platform = match_params[:platform]
38
49
  else
39
- raise Net::TTI::Exceptions::UnsupportedPlatform.new( self.protocol_handler )
50
+ raise Net::TTI::Exceptions::UnsupportedPlatform.new( ttc_server )
40
51
  end
41
52
  end
42
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-tns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Woodbury
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-31 00:00:00.000000000 Z
12
+ date: 2017-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bindata
@@ -75,8 +75,8 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - LICENSE
77
77
  - bin/tns_oradb_version.rb
78
- - bin/tns_sid_enumeration.rb
79
78
  - bin/tns_sid_list.rb
79
+ - bin/tns_sid_probing.rb
80
80
  - lib/net/tns.rb
81
81
  - lib/net/tns/client.rb
82
82
  - lib/net/tns/connection.rb
@@ -98,11 +98,13 @@ files:
98
98
  - lib/net/tns/packets/resend_packet.rb
99
99
  - lib/net/tns/version.rb
100
100
  - lib/net/tti.rb
101
+ - lib/net/tti/capabilities.rb
101
102
  - lib/net/tti/client.rb
102
103
  - lib/net/tti/connection.rb
103
104
  - lib/net/tti/crypto.rb
104
105
  - lib/net/tti/data_types.rb
105
106
  - lib/net/tti/data_types/chunked_string.rb
107
+ - lib/net/tti/data_types/flags.rb
106
108
  - lib/net/tti/data_types/key_value_pair.rb
107
109
  - lib/net/tti/exceptions.rb
108
110
  - lib/net/tti/message.rb
@@ -111,8 +113,6 @@ files:
111
113
  - lib/net/tti/messages/error_message.rb
112
114
  - lib/net/tti/messages/function_call.rb
113
115
  - lib/net/tti/messages/function_calls/authentication.rb
114
- - lib/net/tti/messages/function_calls/authentication_x64.rb
115
- - lib/net/tti/messages/function_calls/authentication_x86.rb
116
116
  - lib/net/tti/messages/function_calls/pre_authentication_response.rb
117
117
  - lib/net/tti/messages/protocol_negotiation_request.rb
118
118
  - lib/net/tti/messages/protocol_negotiation_response.rb
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.2.2
139
+ rubygems_version: 2.6.7
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Ruby implementation of the Oracle TNS protocol
@@ -1,42 +0,0 @@
1
- require_relative "authentication"
2
-
3
- module Net
4
- module TTI
5
- class AuthenticationX64 < Authentication
6
- uint32le :unknown2, :initial_value => 0x00001201
7
- uint8 :unknown3, :initial_value => 0x00
8
- uint32le :logon_mode, :initial_value => :_logon_mode
9
- uint8 :unknown4, :initial_value => 0x01
10
- uint32le :parameter_count, :value => lambda {parameters.count}
11
- uint16le :unknown5, :initial_value => 0x0101
12
- # username_length and username might be a chunked string, but we
13
- # don't need to worry about chunking since Oracle usernames can't
14
- # be longer than 30 characters.
15
- uint8 :username_length, :value => lambda { username.length }
16
- string :username
17
- array :parameters, :type => :key_value_pair, :read_until => lambda {index == parameter_count-1}
18
-
19
- def _function_code
20
- return FUNCTION_CODE_AUTH
21
- end
22
- private :_function_code
23
-
24
- def _logon_mode
25
- return Authentication::LOGON_MODE_AUTH
26
- end
27
- private :_logon_mode
28
- end
29
-
30
- class PreAuthenticationX64 < AuthenticationX64
31
- def _function_code
32
- return FUNCTION_CODE_PRE_AUTH
33
- end
34
- private :_function_code
35
-
36
- def _logon_mode
37
- return Authentication::LOGON_MODE_PRE_AUTH
38
- end
39
- private :_logon_mode
40
- end
41
- end
42
- end
@@ -1,53 +0,0 @@
1
- require_relative "authentication"
2
-
3
- module Net
4
- module TTI
5
- class AuthenticationX86 < Authentication
6
- # Clients seem to change this without any effect on the server. It looks
7
- # like it's probably 4 8-bit values, but if we're ignoring them all, we
8
- # can ignore them as one structure
9
- uint32le :unknown2, :initial_value => 0xFFFFFFFE
10
- # Some Oracle clients instead send username.length*3 here to 11g servers,
11
- # but it doesn't seem to matter
12
- uint32le :unknown3, :value => lambda { username.length }
13
- # 0x1 => preauth, 0x101 => auth
14
- uint32le :logon_mode, :initial_value => :_logon_mode
15
- # Ditto for unknown2. Oracle clients put the same value into the upper
16
- # 16 bits of unknown4, unknown5 and unknown6 in each request, but I can't
17
- # figure out its meaning
18
- uint32le :unknown4, :initial_value => 0xFFFFFFFE
19
- uint32le :parameter_count, :value => lambda {parameters.count}
20
- # See unknown4
21
- uint32le :unknown5, :initial_value => 0xFFFFFFFE
22
- uint32le :unknown6, :initial_value => 0xFFFFFFFE
23
- # username_length and username might be a chunked string, but we
24
- # don't need to worry about chunking since Oracle usernames can't
25
- # be longer than 30 characters
26
- uint8 :username_length, :value => lambda { username.length }
27
- string :username
28
- array :parameters, :type => :key_value_pair, :read_until => lambda {index == parameter_count-1}
29
-
30
- def _function_code
31
- return FUNCTION_CODE_AUTH
32
- end
33
- private :_function_code
34
-
35
- def _logon_mode
36
- return Authentication::LOGON_MODE_AUTH
37
- end
38
- private :_logon_mode
39
- end
40
-
41
- class PreAuthenticationX86 < AuthenticationX86
42
- def _function_code
43
- return FUNCTION_CODE_PRE_AUTH
44
- end
45
- private :_function_code
46
-
47
- def _logon_mode
48
- return Authentication::LOGON_MODE_PRE_AUTH
49
- end
50
- private :_logon_mode
51
- end
52
- end
53
- end