bson 3.2.0 → 3.2.1

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: 830d8156be21a282cce7f2ff5c7136c7c0cf5320
4
- data.tar.gz: 1003e647f5ff7789f861838b4d7c4080237556c4
3
+ metadata.gz: 97406446c031dcd1d113981137d7a5f3b7cf931b
4
+ data.tar.gz: 71e76d81578a58363dbb4eb254521e5b5154c9ad
5
5
  SHA512:
6
- metadata.gz: e1acb711445290f976f2754dbc20903f583f1f4c96efd993eb7982ace58742ebe96d0d243f35bb3c2b50e1cdfb7714065f14b2ff4ef5b75afd46c0de5eb52b9f
7
- data.tar.gz: c3b549ae774b91c4af91dafca71ab78d47154c56871163cd4e31c7640f90c5557956ccae84843b85b59df13041977a96868a7cddea2f508639a5b70a921bcf34
6
+ metadata.gz: ce10bfb4026b5830ba571f98f99b4a02075223a5039262c855f9ddd7e676e562895f89db5013826d52b42bd9622580c32815b50731b41b6f4f53f0018ea20708
7
+ data.tar.gz: 009a442c08996a177318e48d41fc637fde1e72354979389123cc7e829c96e9a0051ae202a0c7fae62a308c204f37c2eacf4aaa20da57d48d2fad313727f41018
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,13 @@
1
1
  BSON Changelog
2
2
  ==============
3
3
 
4
+ ## 3.2.1
5
+
6
+ ### Bug Fixes
7
+
8
+ [#39](https://github.com/mongodb/bson-ruby/pull/39) Fixed MD5 hashing of hostname in c extension.
9
+ (James Hudon)
10
+
4
11
  ## 3.2.0
5
12
 
6
13
  ### Bug Fixes
@@ -49,12 +49,12 @@
49
49
  #endif
50
50
 
51
51
  /**
52
- * Define the max hostname length constant if nonexistant.
52
+ * Define the max hostname hash length constant if nonexistant.
53
53
  *
54
- * @since 2.0.0
54
+ * @since 3.2.0
55
55
  */
56
- #ifndef HOST_NAME_MAX
57
- #define HOST_NAME_MAX 256
56
+ #ifndef HOST_NAME_HASH_MAX
57
+ #define HOST_NAME_HASH_MAX 256
58
58
  #endif
59
59
 
60
60
  /**
@@ -136,13 +136,12 @@ static const char rb_bson_null_byte = 0;
136
136
  static const char rb_bson_true_byte = 1;
137
137
 
138
138
  /**
139
- * Holds the machine id for object id generation.
139
+ * Holds the machine id hash for object id generation.
140
140
  *
141
- * @since 2.0.0
141
+ * @since 3.2.0
142
142
  *
143
- * @todo: Need to set this value properly.
144
143
  */
145
- static char rb_bson_machine_id[HOST_NAME_MAX];
144
+ static char rb_bson_machine_id_hash[HOST_NAME_HASH_MAX];
146
145
 
147
146
  /**
148
147
  * The counter for incrementing object ids.
@@ -246,7 +245,7 @@ static VALUE rb_object_id_generator_next(int argc, VALUE* args, VALUE self)
246
245
  c = htonl(rb_bson_object_id_counter << 8);
247
246
 
248
247
  memcpy(&bytes, &t, 4);
249
- memcpy(&bytes[4], rb_bson_machine_id, 3);
248
+ memcpy(&bytes[4], rb_bson_machine_id_hash, 3);
250
249
  memcpy(&bytes[7], &pid, 2);
251
250
  memcpy(&bytes[9], (unsigned char*) &c, 3);
252
251
  rb_bson_object_id_counter++;
@@ -619,12 +618,19 @@ void Init_native()
619
618
  VALUE string = rb_const_get(bson, rb_intern("String"));
620
619
  VALUE true_class = rb_const_get(bson, rb_intern("TrueClass"));
621
620
  VALUE false_class = rb_const_get(bson, rb_intern("FalseClass"));
621
+ // needed to hash the machine id
622
+ rb_require("digest/md5");
623
+ VALUE digest_class = rb_const_get(rb_cObject, rb_intern("Digest"));
624
+ VALUE md5_class = rb_const_get(digest_class, rb_intern("MD5"));
622
625
  rb_bson_utf8_string = rb_const_get(bson, rb_intern("UTF8"));
623
626
  rb_utc_method = rb_intern("utc");
624
627
 
625
- // Get the object id machine id.
628
+ // Get the object id machine id and hash it.
629
+ char rb_bson_machine_id[256];
626
630
  gethostname(rb_bson_machine_id, sizeof rb_bson_machine_id);
627
- rb_bson_machine_id[HOST_NAME_MAX - 1] = '\0';
631
+ rb_bson_machine_id[255] = '\0';
632
+ VALUE digest = rb_funcall(md5_class, rb_intern("digest"), 1, rb_str_new2(rb_bson_machine_id));
633
+ memcpy(rb_bson_machine_id_hash, RSTRING_PTR(digest), RSTRING_LEN(digest));
628
634
 
629
635
  // Integer optimizations.
630
636
  rb_undef_method(integer, "to_bson_int32");
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "3.2.0"
16
+ VERSION = "3.2.1"
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -34,7 +34,7 @@ cert_chain:
34
34
  XZOS48LlWh15EG4yZo/gRzqNAW2LUIkYA5eMS2Kp6r+KV8IBUO/LaHdrXbdilpa8
35
35
  BRsuCo7UZDbFVRns04HLyjVvkj+K/ywIcdKdS0csz5M=
36
36
  -----END CERTIFICATE-----
37
- date: 2015-07-22 00:00:00.000000000 Z
37
+ date: 2015-07-30 00:00:00.000000000 Z
38
38
  dependencies: []
39
39
  description: A full featured BSON specification implementation, in Ruby
40
40
  email:
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: 1.3.6
137
137
  requirements: []
138
138
  rubyforge_project: bson
139
- rubygems_version: 2.4.7
139
+ rubygems_version: 2.4.6
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Ruby Implementation of the BSON specification
metadata.gz.sig CHANGED
Binary file