trilogy 2.1.0 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -2
- data/ext/trilogy-ruby/inc/trilogy/builder.h +1 -1
- data/ext/trilogy-ruby/inc/trilogy/protocol.h +0 -5
- data/ext/trilogy-ruby/src/protocol.c +11 -16
- data/lib/trilogy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af92055f653afc0f6a507574ae9d1e0dd41ef2bc17519d01521d64075501187d
|
4
|
+
data.tar.gz: b056dbc89c70f108d0038019a0da1cd80782f4b6405ffd1eb58b8ed86acaa5b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5482a88724d329914717b423d9fd1d5ae71818a17b4104122c7c5a2f4cabd77df37e12808644a23d9dc58b9b8a728e00c486072de6e36f2d508531361a794185
|
7
|
+
data.tar.gz: 66e9a9c02a948844d8e806761f1c3993d4e932ebbaa59b31acb686c60044406390f3e46df364860474326bca26f68406cf8abb57bd9fb75f8d95e27c3f54bdc2
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/extensiontask"
|
3
|
+
require "rake/testtask"
|
3
4
|
|
4
5
|
Rake::ExtensionTask.new do |ext|
|
5
6
|
ext.name = "cext"
|
@@ -7,9 +8,12 @@ Rake::ExtensionTask.new do |ext|
|
|
7
8
|
ext.lib_dir = "lib/trilogy"
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
Rake::TestTask.new do |t|
|
12
|
+
t.libs << "test"
|
13
|
+
t.test_files = FileList['test/*_test.rb']
|
14
|
+
t.verbose = true
|
12
15
|
end
|
16
|
+
task :test => :compile
|
13
17
|
|
14
18
|
task :default => :test
|
15
19
|
|
@@ -26,7 +26,7 @@ typedef struct {
|
|
26
26
|
* buffer - A pre-initialized trilogy_buffer_t pointer
|
27
27
|
* seq - The initial sequence number for the packet to be built. This is
|
28
28
|
* the initial number because the builder API will automatically
|
29
|
-
* split buffers that are larger than
|
29
|
+
* split buffers that are larger than TRILOGY_MAX_PACKET_LEN into
|
30
30
|
* multiple packets and increment the sequence number in each packet
|
31
31
|
* following the initial.
|
32
32
|
*
|
@@ -370,11 +370,6 @@ typedef enum {
|
|
370
370
|
#undef XX
|
371
371
|
} TRILOGY_COLUMN_FLAG_t;
|
372
372
|
|
373
|
-
/*
|
374
|
-
* Data between client and server is exchanged in packets of max 16MByte size.
|
375
|
-
*/
|
376
|
-
#define TRILOGY_MAX_PROTO_PACKET_LEN 0xffffff
|
377
|
-
|
378
373
|
// Typical response packet types
|
379
374
|
typedef enum {
|
380
375
|
TRILOGY_PACKET_OK = 0x0,
|
@@ -261,22 +261,15 @@ int trilogy_parse_handshake_packet(const uint8_t *buff, size_t len, trilogy_hand
|
|
261
261
|
// This space is reserved. It should be all NULL bytes but some tools or
|
262
262
|
// future versions of MySQL-compatible clients may use it. This library
|
263
263
|
// opts to skip the validation as some servers don't respect the protocol.
|
264
|
-
|
265
|
-
static const uint8_t null_filler[10] = {0};
|
266
|
-
|
267
|
-
const void *str;
|
268
|
-
CHECKED(trilogy_reader_get_buffer(&reader, 10, &str));
|
269
|
-
|
270
|
-
if (memcmp(str, null_filler, 10) != 0) {
|
271
|
-
// corrupt handshake packet
|
272
|
-
return TRILOGY_PROTOCOL_VIOLATION;
|
273
|
-
}
|
264
|
+
CHECKED(trilogy_reader_get_buffer(&reader, 10, NULL));
|
274
265
|
|
275
266
|
if (out_packet->capabilities & TRILOGY_CAPABILITIES_SECURE_CONNECTION && auth_data_len > 8) {
|
276
267
|
uint8_t remaining_auth_data_len = auth_data_len - 8;
|
277
268
|
|
278
|
-
|
279
|
-
|
269
|
+
// The auth plugins we support all provide exactly 21 bytes of
|
270
|
+
// auth_data. Reject any other values for auth_data_len.
|
271
|
+
if (SCRAMBLE_LEN + 1 != auth_data_len) {
|
272
|
+
return TRILOGY_PROTOCOL_VIOLATION;
|
280
273
|
}
|
281
274
|
|
282
275
|
CHECKED(trilogy_reader_copy_buffer(&reader, remaining_auth_data_len, out_packet->scramble + 8));
|
@@ -577,10 +570,12 @@ int trilogy_build_auth_switch_response_packet(trilogy_builder_t *builder, const
|
|
577
570
|
unsigned int auth_response_len = 0;
|
578
571
|
uint8_t auth_response[EVP_MAX_MD_SIZE];
|
579
572
|
|
580
|
-
if (
|
581
|
-
|
582
|
-
|
583
|
-
|
573
|
+
if (pass_len > 0) {
|
574
|
+
if (!strcmp("caching_sha2_password", auth_plugin)) {
|
575
|
+
trilogy_pack_scramble_sha2_hash(scramble, pass, pass_len, auth_response, &auth_response_len);
|
576
|
+
} else {
|
577
|
+
trilogy_pack_scramble_native_hash(scramble, pass, pass_len, auth_response, &auth_response_len);
|
578
|
+
}
|
584
579
|
}
|
585
580
|
|
586
581
|
CHECKED(trilogy_builder_write_buffer(builder, auth_response, auth_response_len));
|
data/lib/trilogy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trilogy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.3.
|
102
|
+
rubygems_version: 3.3.7
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: A friendly MySQL-compatible library for Ruby, binding to libtrilogy
|