diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-05-04 11:41:11 -0700 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2021-06-13 12:27:09 -0700 |
| commit | 83dffbffc58b02026bec32cf09e0a9aa0d5e1013 (patch) | |
| tree | e032ecfb9d577764e01248ed76b254f14a903e62 | |
| parent | f8bd86c9b2f7ed5d15e04af585258987410ab89e (diff) | |
| download | meta-openembedded-83dffbffc58b02026bec32cf09e0a9aa0d5e1013.tar.gz | |
mongodb: Update to 4.4.6-rc0
Drop upstreamed patch
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 44664a2d66ea848d927164685c283f0ea8d3d12f)
[Bug fix only update:
Issues fixed:
SERVER-55298: Reproduce and Investigate BSONObjectTooLarge error
SERVER-53566: Investigate and reproduce "opCtx != nullptr && _opCtx == nullptr" invariant
SERVER-51281: mongod live locked
SERVER-46686: Explain does not respect maxTimeMS
SERVER-45836: Provide more LDAP details (like server IP) at default log level
All JIRA issues closed in 4.4.5
4.4.5 Changelog]
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2 files changed, 3 insertions, 718 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch deleted file mode 100644 index df4cee2b42..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch +++ /dev/null | |||
| @@ -1,714 +0,0 @@ | |||
| 1 | From 44272ce47e768e090263df5cb9cb7ce17e544ad3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Prince <vincent.prince.external@saftbatteries.com> | ||
| 3 | Date: Tue, 15 Sep 2020 11:40:15 +0200 | ||
| 4 | Subject: [PATCH] kms-message: bump libmongocrypto to v1.0.4 | ||
| 5 | |||
| 6 | This fixes compilation with alpinelinux | ||
| 7 | see https://github.com/mongodb/libmongocrypt/pull/89 | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
| 12 | --- | ||
| 13 | .../kms-message/THIRD_PARTY_NOTICES | 2 +- | ||
| 14 | src/third_party/kms-message/src/hexlify.c | 21 +---- | ||
| 15 | src/third_party/kms-message/src/hexlify.h | 2 - | ||
| 16 | .../kms-message/src/kms_crypto_apple.c | 5 + | ||
| 17 | .../kms-message/src/kms_crypto_libcrypto.c | 94 +++++++++++++++++++ | ||
| 18 | .../kms-message/src/kms_crypto_none.c | 4 + | ||
| 19 | .../kms-message/src/kms_crypto_windows.c | 4 + | ||
| 20 | .../kms-message/src/kms_decrypt_request.c | 2 +- | ||
| 21 | .../kms-message/src/kms_encrypt_request.c | 2 +- | ||
| 22 | src/third_party/kms-message/src/kms_kv_list.c | 11 ++- | ||
| 23 | .../kms-message/src/kms_message/kms_message.h | 2 + | ||
| 24 | .../src/kms_message/kms_message_defines.h | 10 ++ | ||
| 25 | src/third_party/kms-message/src/kms_port.c | 33 +++++++ | ||
| 26 | src/third_party/kms-message/src/kms_port.h | 27 +++--- | ||
| 27 | src/third_party/kms-message/src/kms_request.c | 41 +++++--- | ||
| 28 | .../kms-message/src/kms_request_str.c | 13 ++- | ||
| 29 | .../kms-message/src/kms_request_str.h | 5 - | ||
| 30 | .../kms-message/src/kms_response_parser.c | 26 ++++- | ||
| 31 | .../scripts/kms_message_get_sources.sh | 2 +- | ||
| 32 | 19 files changed, 244 insertions(+), 62 deletions(-) | ||
| 33 | create mode 100644 src/third_party/kms-message/src/kms_crypto_libcrypto.c | ||
| 34 | create mode 100644 src/third_party/kms-message/src/kms_port.c | ||
| 35 | |||
| 36 | diff --git a/src/third_party/kms-message/THIRD_PARTY_NOTICES b/src/third_party/kms-message/THIRD_PARTY_NOTICES | ||
| 37 | index 3fc095170c..4110c1b91e 100644 | ||
| 38 | --- a/src/third_party/kms-message/THIRD_PARTY_NOTICES | ||
| 39 | +++ b/src/third_party/kms-message/THIRD_PARTY_NOTICES | ||
| 40 | @@ -1,4 +1,4 @@ | ||
| 41 | -License notice for common-b64.c | ||
| 42 | +License notice for kms_b64.c | ||
| 43 | ------------------------------------------------------------------------------- | ||
| 44 | |||
| 45 | ISC License | ||
| 46 | diff --git a/src/third_party/kms-message/src/hexlify.c b/src/third_party/kms-message/src/hexlify.c | ||
| 47 | index be9ee030b9..941fc93d1b 100644 | ||
| 48 | --- a/src/third_party/kms-message/src/hexlify.c | ||
| 49 | +++ b/src/third_party/kms-message/src/hexlify.c | ||
| 50 | @@ -24,6 +24,8 @@ char * | ||
| 51 | hexlify (const uint8_t *buf, size_t len) | ||
| 52 | { | ||
| 53 | char *hex_chars = malloc (len * 2 + 1); | ||
| 54 | + KMS_ASSERT (hex_chars); | ||
| 55 | + | ||
| 56 | char *p = hex_chars; | ||
| 57 | size_t i; | ||
| 58 | |||
| 59 | @@ -35,22 +37,3 @@ hexlify (const uint8_t *buf, size_t len) | ||
| 60 | |||
| 61 | return hex_chars; | ||
| 62 | } | ||
| 63 | - | ||
| 64 | -uint8_t * | ||
| 65 | -unhexlify (const char *hex_chars, size_t *len) | ||
| 66 | -{ | ||
| 67 | - uint8_t *buf; | ||
| 68 | - uint8_t *pos; | ||
| 69 | - | ||
| 70 | - *len = strlen (hex_chars) / 2; | ||
| 71 | - buf = malloc (*len); | ||
| 72 | - pos = buf; | ||
| 73 | - | ||
| 74 | - while (*hex_chars) { | ||
| 75 | - KMS_ASSERT (1 == sscanf (hex_chars, "%2hhx", pos)); | ||
| 76 | - pos++; | ||
| 77 | - hex_chars += 2; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - return buf; | ||
| 81 | -} | ||
| 82 | diff --git a/src/third_party/kms-message/src/hexlify.h b/src/third_party/kms-message/src/hexlify.h | ||
| 83 | index e0096eb6ca..a6a504ebe8 100644 | ||
| 84 | --- a/src/third_party/kms-message/src/hexlify.h | ||
| 85 | +++ b/src/third_party/kms-message/src/hexlify.h | ||
| 86 | @@ -19,5 +19,3 @@ | ||
| 87 | |||
| 88 | char * | ||
| 89 | hexlify (const uint8_t *buf, size_t len); | ||
| 90 | -uint8_t * | ||
| 91 | -unhexlify (const char *hex_chars, size_t *len); | ||
| 92 | diff --git a/src/third_party/kms-message/src/kms_crypto_apple.c b/src/third_party/kms-message/src/kms_crypto_apple.c | ||
| 93 | index 61da0a6288..a26e0d65e8 100644 | ||
| 94 | --- a/src/third_party/kms-message/src/kms_crypto_apple.c | ||
| 95 | +++ b/src/third_party/kms-message/src/kms_crypto_apple.c | ||
| 96 | @@ -16,9 +16,12 @@ | ||
| 97 | |||
| 98 | #include "kms_crypto.h" | ||
| 99 | |||
| 100 | +#ifdef KMS_MESSAGE_ENABLE_CRYPTO_COMMON_CRYPTO | ||
| 101 | + | ||
| 102 | #include <CommonCrypto/CommonDigest.h> | ||
| 103 | #include <CommonCrypto/CommonHMAC.h> | ||
| 104 | |||
| 105 | + | ||
| 106 | int | ||
| 107 | kms_crypto_init () | ||
| 108 | { | ||
| 109 | @@ -54,3 +57,5 @@ kms_sha256_hmac (void *unused_ctx, | ||
| 110 | CCHmac (kCCHmacAlgSHA256, key_input, key_len, input, len, hash_out); | ||
| 111 | return true; | ||
| 112 | } | ||
| 113 | + | ||
| 114 | +#endif /* KMS_MESSAGE_ENABLE_CRYPTO_COMMON_CRYPTO */ | ||
| 115 | diff --git a/src/third_party/kms-message/src/kms_crypto_libcrypto.c b/src/third_party/kms-message/src/kms_crypto_libcrypto.c | ||
| 116 | new file mode 100644 | ||
| 117 | index 0000000000..6f25657fdd | ||
| 118 | --- /dev/null | ||
| 119 | +++ b/src/third_party/kms-message/src/kms_crypto_libcrypto.c | ||
| 120 | @@ -0,0 +1,94 @@ | ||
| 121 | +/* | ||
| 122 | + * Copyright 2018-present MongoDB, Inc. | ||
| 123 | + * | ||
| 124 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 125 | + * you may not use this file except in compliance with the License. | ||
| 126 | + * You may obtain a copy of the License at | ||
| 127 | + * | ||
| 128 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 129 | + * | ||
| 130 | + * Unless required by applicable law or agreed to in writing, software | ||
| 131 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 132 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 133 | + * See the License for the specific language governing permissions and | ||
| 134 | + * limitations under the License. | ||
| 135 | + */ | ||
| 136 | + | ||
| 137 | +#include "kms_crypto.h" | ||
| 138 | + | ||
| 139 | +#ifdef KMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO | ||
| 140 | + | ||
| 141 | +#include <openssl/sha.h> | ||
| 142 | +#include <openssl/evp.h> | ||
| 143 | +#include <openssl/hmac.h> | ||
| 144 | + | ||
| 145 | +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ | ||
| 146 | + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) | ||
| 147 | +static EVP_MD_CTX * | ||
| 148 | +EVP_MD_CTX_new (void) | ||
| 149 | +{ | ||
| 150 | + return calloc (sizeof (EVP_MD_CTX), 1); | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +static void | ||
| 154 | +EVP_MD_CTX_free (EVP_MD_CTX *ctx) | ||
| 155 | +{ | ||
| 156 | + EVP_MD_CTX_cleanup (ctx); | ||
| 157 | + free (ctx); | ||
| 158 | +} | ||
| 159 | +#endif | ||
| 160 | + | ||
| 161 | +int | ||
| 162 | +kms_crypto_init () | ||
| 163 | +{ | ||
| 164 | + return 0; | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +void | ||
| 168 | +kms_crypto_cleanup () | ||
| 169 | +{ | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | +bool | ||
| 173 | +kms_sha256 (void *unused_ctx, | ||
| 174 | + const char *input, | ||
| 175 | + size_t len, | ||
| 176 | + unsigned char *hash_out) | ||
| 177 | +{ | ||
| 178 | + EVP_MD_CTX *digest_ctxp = EVP_MD_CTX_new (); | ||
| 179 | + bool rval = false; | ||
| 180 | + | ||
| 181 | + if (1 != EVP_DigestInit_ex (digest_ctxp, EVP_sha256 (), NULL)) { | ||
| 182 | + goto cleanup; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + if (1 != EVP_DigestUpdate (digest_ctxp, input, len)) { | ||
| 186 | + goto cleanup; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + rval = (1 == EVP_DigestFinal_ex (digest_ctxp, hash_out, NULL)); | ||
| 190 | + | ||
| 191 | +cleanup: | ||
| 192 | + EVP_MD_CTX_free (digest_ctxp); | ||
| 193 | + | ||
| 194 | + return rval; | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +bool | ||
| 198 | +kms_sha256_hmac (void *unused_ctx, | ||
| 199 | + const char *key_input, | ||
| 200 | + size_t key_len, | ||
| 201 | + const char *input, | ||
| 202 | + size_t len, | ||
| 203 | + unsigned char *hash_out) | ||
| 204 | +{ | ||
| 205 | + return HMAC (EVP_sha256 (), | ||
| 206 | + key_input, | ||
| 207 | + key_len, | ||
| 208 | + (unsigned char *) input, | ||
| 209 | + len, | ||
| 210 | + hash_out, | ||
| 211 | + NULL) != NULL; | ||
| 212 | +} | ||
| 213 | + | ||
| 214 | +#endif /* KMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO */ | ||
| 215 | diff --git a/src/third_party/kms-message/src/kms_crypto_none.c b/src/third_party/kms-message/src/kms_crypto_none.c | ||
| 216 | index 9ef2147687..94da5abd88 100644 | ||
| 217 | --- a/src/third_party/kms-message/src/kms_crypto_none.c | ||
| 218 | +++ b/src/third_party/kms-message/src/kms_crypto_none.c | ||
| 219 | @@ -16,6 +16,8 @@ | ||
| 220 | |||
| 221 | #include "kms_crypto.h" | ||
| 222 | |||
| 223 | +#ifndef KMS_MESSAGE_ENABLE_CRYPTO | ||
| 224 | + | ||
| 225 | int | ||
| 226 | kms_crypto_init () | ||
| 227 | { | ||
| 228 | @@ -48,3 +50,5 @@ kms_sha256_hmac (void *unused_ctx, | ||
| 229 | /* only gets called if hooks were mistakenly not set */ | ||
| 230 | return false; | ||
| 231 | } | ||
| 232 | + | ||
| 233 | +#endif /* KMS_MESSAGE_ENABLE_CRYPTO */ | ||
| 234 | diff --git a/src/third_party/kms-message/src/kms_crypto_windows.c b/src/third_party/kms-message/src/kms_crypto_windows.c | ||
| 235 | index ccdc7e095d..8177b0ddc0 100644 | ||
| 236 | --- a/src/third_party/kms-message/src/kms_crypto_windows.c | ||
| 237 | +++ b/src/third_party/kms-message/src/kms_crypto_windows.c | ||
| 238 | @@ -16,6 +16,8 @@ | ||
| 239 | |||
| 240 | #include "kms_crypto.h" | ||
| 241 | |||
| 242 | +#ifdef KMS_MESSAGE_ENABLE_CRYPTO_CNG | ||
| 243 | + | ||
| 244 | // tell windows.h not to include a bunch of headers we don't need: | ||
| 245 | #define WIN32_LEAN_AND_MEAN | ||
| 246 | |||
| 247 | @@ -130,3 +132,5 @@ cleanup: | ||
| 248 | |||
| 249 | return status == STATUS_SUCCESS ? 1 : 0; | ||
| 250 | } | ||
| 251 | + | ||
| 252 | +#endif /* KMS_MESSAGE_ENABLE_CRYPTO_CNG */ | ||
| 253 | diff --git a/src/third_party/kms-message/src/kms_decrypt_request.c b/src/third_party/kms-message/src/kms_decrypt_request.c | ||
| 254 | index 06faa43119..f1ca282768 100644 | ||
| 255 | --- a/src/third_party/kms-message/src/kms_decrypt_request.c | ||
| 256 | +++ b/src/third_party/kms-message/src/kms_decrypt_request.c | ||
| 257 | @@ -48,7 +48,7 @@ kms_decrypt_request_new (const uint8_t *ciphertext_blob, | ||
| 258 | if (!(b64 = malloc (b64_len))) { | ||
| 259 | KMS_ERROR (request, | ||
| 260 | "Could not allocate %d bytes for base64-encoding payload", | ||
| 261 | - b64_len); | ||
| 262 | + (int) b64_len); | ||
| 263 | goto done; | ||
| 264 | } | ||
| 265 | |||
| 266 | diff --git a/src/third_party/kms-message/src/kms_encrypt_request.c b/src/third_party/kms-message/src/kms_encrypt_request.c | ||
| 267 | index b5f4d6436e..24b064d95f 100644 | ||
| 268 | --- a/src/third_party/kms-message/src/kms_encrypt_request.c | ||
| 269 | +++ b/src/third_party/kms-message/src/kms_encrypt_request.c | ||
| 270 | @@ -47,7 +47,7 @@ kms_encrypt_request_new (const uint8_t *plaintext, | ||
| 271 | if (!(b64 = malloc (b64_len))) { | ||
| 272 | KMS_ERROR (request, | ||
| 273 | "Could not allocate %d bytes for base64-encoding payload", | ||
| 274 | - b64_len); | ||
| 275 | + (int) b64_len); | ||
| 276 | goto done; | ||
| 277 | } | ||
| 278 | |||
| 279 | diff --git a/src/third_party/kms-message/src/kms_kv_list.c b/src/third_party/kms-message/src/kms_kv_list.c | ||
| 280 | index 2d6845a1aa..0cff3dc2c6 100644 | ||
| 281 | --- a/src/third_party/kms-message/src/kms_kv_list.c | ||
| 282 | +++ b/src/third_party/kms-message/src/kms_kv_list.c | ||
| 283 | @@ -17,6 +17,7 @@ | ||
| 284 | |||
| 285 | #include "kms_kv_list.h" | ||
| 286 | #include "kms_message/kms_message.h" | ||
| 287 | +#include "kms_message_private.h" | ||
| 288 | #include "kms_request_str.h" | ||
| 289 | #include "kms_port.h" | ||
| 290 | #include "sort.h" | ||
| 291 | @@ -39,9 +40,12 @@ kms_kv_list_t * | ||
| 292 | kms_kv_list_new (void) | ||
| 293 | { | ||
| 294 | kms_kv_list_t *lst = malloc (sizeof (kms_kv_list_t)); | ||
| 295 | + KMS_ASSERT (lst); | ||
| 296 | |||
| 297 | lst->size = 16; | ||
| 298 | lst->kvs = malloc (lst->size * sizeof (kms_kv_t)); | ||
| 299 | + KMS_ASSERT (lst->kvs); | ||
| 300 | + | ||
| 301 | lst->len = 0; | ||
| 302 | |||
| 303 | return lst; | ||
| 304 | @@ -72,6 +76,7 @@ kms_kv_list_add (kms_kv_list_t *lst, | ||
| 305 | if (lst->len == lst->size) { | ||
| 306 | lst->size *= 2; | ||
| 307 | lst->kvs = realloc (lst->kvs, lst->size * sizeof (kms_kv_t)); | ||
| 308 | + KMS_ASSERT (lst->kvs); | ||
| 309 | } | ||
| 310 | |||
| 311 | kv_init (&lst->kvs[lst->len], key, value); | ||
| 312 | @@ -84,7 +89,7 @@ kms_kv_list_find (const kms_kv_list_t *lst, const char *key) | ||
| 313 | size_t i; | ||
| 314 | |||
| 315 | for (i = 0; i < lst->len; i++) { | ||
| 316 | - if (0 == strcasecmp (lst->kvs[i].key->str, key)) { | ||
| 317 | + if (0 == kms_strcasecmp (lst->kvs[i].key->str, key)) { | ||
| 318 | return &lst->kvs[i]; | ||
| 319 | } | ||
| 320 | } | ||
| 321 | @@ -119,8 +124,12 @@ kms_kv_list_dup (const kms_kv_list_t *lst) | ||
| 322 | } | ||
| 323 | |||
| 324 | dup = malloc (sizeof (kms_kv_list_t)); | ||
| 325 | + KMS_ASSERT (dup); | ||
| 326 | + | ||
| 327 | dup->size = dup->len = lst->len; | ||
| 328 | dup->kvs = malloc (lst->len * sizeof (kms_kv_t)); | ||
| 329 | + KMS_ASSERT (dup->kvs); | ||
| 330 | + | ||
| 331 | |||
| 332 | for (i = 0; i < lst->len; i++) { | ||
| 333 | kv_init (&dup->kvs[i], lst->kvs[i].key, lst->kvs[i].value); | ||
| 334 | diff --git a/src/third_party/kms-message/src/kms_message/kms_message.h b/src/third_party/kms-message/src/kms_message/kms_message.h | ||
| 335 | index 6ea95dd04c..8048528f2e 100644 | ||
| 336 | --- a/src/third_party/kms-message/src/kms_message/kms_message.h | ||
| 337 | +++ b/src/third_party/kms-message/src/kms_message/kms_message.h | ||
| 338 | @@ -17,6 +17,8 @@ | ||
| 339 | #ifndef KMS_MESSAGE_H | ||
| 340 | #define KMS_MESSAGE_H | ||
| 341 | |||
| 342 | +#include <sys/types.h> | ||
| 343 | + | ||
| 344 | #include "kms_message_defines.h" | ||
| 345 | #include "kms_request_opt.h" | ||
| 346 | #include "kms_request.h" | ||
| 347 | diff --git a/src/third_party/kms-message/src/kms_message/kms_message_defines.h b/src/third_party/kms-message/src/kms_message/kms_message_defines.h | ||
| 348 | index a4d019bd77..a539d531ef 100644 | ||
| 349 | --- a/src/third_party/kms-message/src/kms_message/kms_message_defines.h | ||
| 350 | +++ b/src/third_party/kms-message/src/kms_message/kms_message_defines.h | ||
| 351 | @@ -53,4 +53,14 @@ kms_message_cleanup (void); | ||
| 352 | } /* extern "C" */ | ||
| 353 | #endif | ||
| 354 | |||
| 355 | +#ifdef _MSC_VER | ||
| 356 | +#include <basetsd.h> | ||
| 357 | +#pragma warning(disable : 4142) | ||
| 358 | +#ifndef _SSIZE_T_DEFINED | ||
| 359 | +#define _SSIZE_T_DEFINED | ||
| 360 | +typedef SSIZE_T ssize_t; | ||
| 361 | +#endif | ||
| 362 | +#pragma warning(default : 4142) | ||
| 363 | +#endif | ||
| 364 | + | ||
| 365 | #endif /* KMS_MESSAGE_DEFINES_H */ | ||
| 366 | diff --git a/src/third_party/kms-message/src/kms_port.c b/src/third_party/kms-message/src/kms_port.c | ||
| 367 | new file mode 100644 | ||
| 368 | index 0000000000..ee9e6ed9c9 | ||
| 369 | --- /dev/null | ||
| 370 | +++ b/src/third_party/kms-message/src/kms_port.c | ||
| 371 | @@ -0,0 +1,33 @@ | ||
| 372 | +/* | ||
| 373 | + * Copyright 2020-present MongoDB, Inc. | ||
| 374 | + * | ||
| 375 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 376 | + * you may not use this file except in compliance with the License. | ||
| 377 | + * You may obtain a copy of the License at | ||
| 378 | + * | ||
| 379 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 380 | + * | ||
| 381 | + * Unless required by applicable law or agreed to in writing, software | ||
| 382 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 383 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 384 | + * See the License for the specific language governing permissions and | ||
| 385 | + * limitations under the License. | ||
| 386 | + */ | ||
| 387 | + | ||
| 388 | +#include "kms_port.h" | ||
| 389 | +#if defined(_WIN32) | ||
| 390 | +#include <stdlib.h> | ||
| 391 | +#include <string.h> | ||
| 392 | +char * kms_strndup (const char *src, size_t len) | ||
| 393 | +{ | ||
| 394 | + char *dst = (char *) malloc (len + 1); | ||
| 395 | + if (!dst) { | ||
| 396 | + return 0; | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + memcpy (dst, src, len); | ||
| 400 | + dst[len] = '\0'; | ||
| 401 | + | ||
| 402 | + return dst; | ||
| 403 | +} | ||
| 404 | +#endif | ||
| 405 | \ No newline at end of file | ||
| 406 | diff --git a/src/third_party/kms-message/src/kms_port.h b/src/third_party/kms-message/src/kms_port.h | ||
| 407 | index c3cbbac369..2123a99dc9 100644 | ||
| 408 | --- a/src/third_party/kms-message/src/kms_port.h | ||
| 409 | +++ b/src/third_party/kms-message/src/kms_port.h | ||
| 410 | @@ -15,21 +15,18 @@ | ||
| 411 | * limitations under the License. | ||
| 412 | */ | ||
| 413 | |||
| 414 | -#if defined(_WIN32) | ||
| 415 | -#define strcasecmp _stricmp | ||
| 416 | - | ||
| 417 | -inline char * | ||
| 418 | -strndup (const char *src, size_t len) | ||
| 419 | -{ | ||
| 420 | - char *dst = (char *) malloc (len + 1); | ||
| 421 | - if (!dst) { | ||
| 422 | - return 0; | ||
| 423 | - } | ||
| 424 | - | ||
| 425 | - memcpy (dst, src, len); | ||
| 426 | - dst[len] = '\0'; | ||
| 427 | +#ifndef KMS_PORT_H | ||
| 428 | +#define KMS_PORT_H | ||
| 429 | |||
| 430 | - return dst; | ||
| 431 | -} | ||
| 432 | +#include <stddef.h> | ||
| 433 | |||
| 434 | +#if defined(_WIN32) | ||
| 435 | +#define kms_strcasecmp _stricmp | ||
| 436 | +char * | ||
| 437 | +kms_strndup (const char *src, size_t len); | ||
| 438 | +#else | ||
| 439 | +#define kms_strndup strndup | ||
| 440 | +#define kms_strcasecmp strcasecmp | ||
| 441 | #endif | ||
| 442 | + | ||
| 443 | +#endif /* KMS_PORT_H */ | ||
| 444 | \ No newline at end of file | ||
| 445 | diff --git a/src/third_party/kms-message/src/kms_request.c b/src/third_party/kms-message/src/kms_request.c | ||
| 446 | index fa2d487123..ac2b07ea6b 100644 | ||
| 447 | --- a/src/third_party/kms-message/src/kms_request.c | ||
| 448 | +++ b/src/third_party/kms-message/src/kms_request.c | ||
| 449 | @@ -61,6 +61,7 @@ kms_request_new (const char *method, | ||
| 450 | kms_request_t *request = calloc (1, sizeof (kms_request_t)); | ||
| 451 | const char *question_mark; | ||
| 452 | |||
| 453 | + KMS_ASSERT (request); | ||
| 454 | /* parsing may set failed to true */ | ||
| 455 | request->failed = false; | ||
| 456 | |||
| 457 | @@ -92,10 +93,14 @@ kms_request_new (const char *method, | ||
| 458 | request->header_fields = kms_kv_list_new (); | ||
| 459 | request->auto_content_length = true; | ||
| 460 | |||
| 461 | - kms_request_set_date (request, NULL); | ||
| 462 | + if (!kms_request_set_date (request, NULL)) { | ||
| 463 | + return request; | ||
| 464 | + } | ||
| 465 | |||
| 466 | if (opt && opt->connection_close) { | ||
| 467 | - kms_request_add_header_field (request, "Connection", "close"); | ||
| 468 | + if (!kms_request_add_header_field (request, "Connection", "close")) { | ||
| 469 | + return request; | ||
| 470 | + } | ||
| 471 | } | ||
| 472 | |||
| 473 | if (opt && opt->crypto.sha256) { | ||
| 474 | @@ -164,7 +169,9 @@ kms_request_set_date (kms_request_t *request, const struct tm *tm) | ||
| 475 | kms_request_str_set_chars (request->date, buf, sizeof "YYYYmmDD" - 1); | ||
| 476 | kms_request_str_set_chars (request->datetime, buf, sizeof AMZ_DT_FORMAT - 1); | ||
| 477 | kms_kv_list_del (request->header_fields, "X-Amz-Date"); | ||
| 478 | - kms_request_add_header_field (request, "X-Amz-Date", buf); | ||
| 479 | + if (!kms_request_add_header_field (request, "X-Amz-Date", buf)) { | ||
| 480 | + return false; | ||
| 481 | + } | ||
| 482 | |||
| 483 | return true; | ||
| 484 | } | ||
| 485 | @@ -309,7 +316,8 @@ append_canonical_headers (kms_kv_list_t *lst, kms_request_str_t *str) | ||
| 486 | * values in headers that have multiple values." */ | ||
| 487 | for (i = 0; i < lst->len; i++) { | ||
| 488 | kv = &lst->kvs[i]; | ||
| 489 | - if (previous_key && 0 == strcasecmp (previous_key->str, kv->key->str)) { | ||
| 490 | + if (previous_key && | ||
| 491 | + 0 == kms_strcasecmp (previous_key->str, kv->key->str)) { | ||
| 492 | /* duplicate header */ | ||
| 493 | kms_request_str_append_char (str, ','); | ||
| 494 | kms_request_str_append_stripped (str, kv->value); | ||
| 495 | @@ -339,12 +347,13 @@ append_signed_headers (kms_kv_list_t *lst, kms_request_str_t *str) | ||
| 496 | |||
| 497 | for (i = 0; i < lst->len; i++) { | ||
| 498 | kv = &lst->kvs[i]; | ||
| 499 | - if (previous_key && 0 == strcasecmp (previous_key->str, kv->key->str)) { | ||
| 500 | + if (previous_key && | ||
| 501 | + 0 == kms_strcasecmp (previous_key->str, kv->key->str)) { | ||
| 502 | /* duplicate header */ | ||
| 503 | continue; | ||
| 504 | } | ||
| 505 | |||
| 506 | - if (0 == strcasecmp (kv->key->str, "connection")) { | ||
| 507 | + if (0 == kms_strcasecmp (kv->key->str, "connection")) { | ||
| 508 | continue; | ||
| 509 | } | ||
| 510 | |||
| 511 | @@ -412,7 +421,8 @@ finalize (kms_request_t *request) | ||
| 512 | static int | ||
| 513 | cmp_header_field_names (const void *a, const void *b) | ||
| 514 | { | ||
| 515 | - return strcasecmp (((kms_kv_t *) a)->key->str, ((kms_kv_t *) b)->key->str); | ||
| 516 | + return kms_strcasecmp (((kms_kv_t *) a)->key->str, | ||
| 517 | + ((kms_kv_t *) b)->key->str); | ||
| 518 | } | ||
| 519 | |||
| 520 | static kms_kv_list_t * | ||
| 521 | @@ -447,6 +457,7 @@ kms_request_get_canonical (kms_request_t *request) | ||
| 522 | kms_request_str_append_newline (canonical); | ||
| 523 | normalized = kms_request_str_path_normalized (request->path); | ||
| 524 | kms_request_str_append_escaped (canonical, normalized, false); | ||
| 525 | + kms_request_str_destroy (normalized); | ||
| 526 | kms_request_str_append_newline (canonical); | ||
| 527 | append_canonical_query (request, canonical); | ||
| 528 | kms_request_str_append_newline (canonical); | ||
| 529 | @@ -454,12 +465,14 @@ kms_request_get_canonical (kms_request_t *request) | ||
| 530 | append_canonical_headers (lst, canonical); | ||
| 531 | kms_request_str_append_newline (canonical); | ||
| 532 | append_signed_headers (lst, canonical); | ||
| 533 | - kms_request_str_append_newline (canonical); | ||
| 534 | - kms_request_str_append_hashed ( | ||
| 535 | - &request->crypto, canonical, request->payload); | ||
| 536 | - | ||
| 537 | - kms_request_str_destroy (normalized); | ||
| 538 | kms_kv_list_destroy (lst); | ||
| 539 | + kms_request_str_append_newline (canonical); | ||
| 540 | + if (!kms_request_str_append_hashed ( | ||
| 541 | + &request->crypto, canonical, request->payload)) { | ||
| 542 | + KMS_ERROR (request, "could not generate hash"); | ||
| 543 | + kms_request_str_destroy (canonical); | ||
| 544 | + return NULL; | ||
| 545 | + } | ||
| 546 | |||
| 547 | return kms_request_str_detach (canonical); | ||
| 548 | } | ||
| 549 | @@ -514,6 +527,10 @@ kms_request_get_string_to_sign (kms_request_t *request) | ||
| 550 | kms_request_str_append_chars (sts, "/aws4_request\n", -1); | ||
| 551 | |||
| 552 | creq = kms_request_str_wrap (kms_request_get_canonical (request), -1); | ||
| 553 | + if (!creq) { | ||
| 554 | + goto done; | ||
| 555 | + } | ||
| 556 | + | ||
| 557 | if (!kms_request_str_append_hashed (&request->crypto, sts, creq)) { | ||
| 558 | goto done; | ||
| 559 | } | ||
| 560 | diff --git a/src/third_party/kms-message/src/kms_request_str.c b/src/third_party/kms-message/src/kms_request_str.c | ||
| 561 | index 0f7c19c972..65207d2f4f 100644 | ||
| 562 | --- a/src/third_party/kms-message/src/kms_request_str.c | ||
| 563 | +++ b/src/third_party/kms-message/src/kms_request_str.c | ||
| 564 | @@ -51,10 +51,13 @@ kms_request_str_t * | ||
| 565 | kms_request_str_new (void) | ||
| 566 | { | ||
| 567 | kms_request_str_t *s = malloc (sizeof (kms_request_str_t)); | ||
| 568 | + KMS_ASSERT (s); | ||
| 569 | |||
| 570 | s->len = 0; | ||
| 571 | s->size = 16; | ||
| 572 | s->str = malloc (s->size); | ||
| 573 | + KMS_ASSERT (s->str); | ||
| 574 | + | ||
| 575 | s->str[0] = '\0'; | ||
| 576 | |||
| 577 | return s; | ||
| 578 | @@ -64,11 +67,15 @@ kms_request_str_t * | ||
| 579 | kms_request_str_new_from_chars (const char *chars, ssize_t len) | ||
| 580 | { | ||
| 581 | kms_request_str_t *s = malloc (sizeof (kms_request_str_t)); | ||
| 582 | + KMS_ASSERT (s); | ||
| 583 | + | ||
| 584 | size_t actual_len; | ||
| 585 | |||
| 586 | actual_len = len < 0 ? strlen (chars) : (size_t) len; | ||
| 587 | s->size = actual_len + 1; | ||
| 588 | s->str = malloc (s->size); | ||
| 589 | + KMS_ASSERT (s->str); | ||
| 590 | + | ||
| 591 | memcpy (s->str, chars, actual_len); | ||
| 592 | s->str[actual_len] = '\0'; | ||
| 593 | s->len = actual_len; | ||
| 594 | @@ -86,6 +93,8 @@ kms_request_str_wrap (char *chars, ssize_t len) | ||
| 595 | } | ||
| 596 | |||
| 597 | s = malloc (sizeof (kms_request_str_t)); | ||
| 598 | + KMS_ASSERT (s); | ||
| 599 | + | ||
| 600 | |||
| 601 | s->str = chars; | ||
| 602 | s->len = len < 0 ? strlen (chars) : (size_t) len; | ||
| 603 | @@ -148,8 +157,10 @@ kms_request_str_t * | ||
| 604 | kms_request_str_dup (kms_request_str_t *str) | ||
| 605 | { | ||
| 606 | kms_request_str_t *dup = malloc (sizeof (kms_request_str_t)); | ||
| 607 | + KMS_ASSERT (dup); | ||
| 608 | + | ||
| 609 | |||
| 610 | - dup->str = strndup (str->str, str->len); | ||
| 611 | + dup->str = kms_strndup (str->str, str->len); | ||
| 612 | dup->len = str->len; | ||
| 613 | dup->size = str->len + 1; | ||
| 614 | |||
| 615 | diff --git a/src/third_party/kms-message/src/kms_request_str.h b/src/third_party/kms-message/src/kms_request_str.h | ||
| 616 | index f053a595aa..0898f59067 100644 | ||
| 617 | --- a/src/third_party/kms-message/src/kms_request_str.h | ||
| 618 | +++ b/src/third_party/kms-message/src/kms_request_str.h | ||
| 619 | @@ -25,11 +25,6 @@ | ||
| 620 | #include <stdint.h> | ||
| 621 | #include <string.h> | ||
| 622 | |||
| 623 | -#if defined(_WIN32) | ||
| 624 | -#include <basetsd.h> | ||
| 625 | -typedef SSIZE_T ssize_t; | ||
| 626 | -#endif // _WIN32 | ||
| 627 | - | ||
| 628 | typedef struct { | ||
| 629 | char *str; | ||
| 630 | size_t len; | ||
| 631 | diff --git a/src/third_party/kms-message/src/kms_response_parser.c b/src/third_party/kms-message/src/kms_response_parser.c | ||
| 632 | index 31e4868a68..6f86fac854 100644 | ||
| 633 | --- a/src/third_party/kms-message/src/kms_response_parser.c | ||
| 634 | +++ b/src/third_party/kms-message/src/kms_response_parser.c | ||
| 635 | @@ -1,7 +1,7 @@ | ||
| 636 | #include "kms_message/kms_response_parser.h" | ||
| 637 | #include "kms_message_private.h" | ||
| 638 | |||
| 639 | -#include "kms_message_private.h" | ||
| 640 | +#include <errno.h> | ||
| 641 | #include <limits.h> | ||
| 642 | #include <stdio.h> | ||
| 643 | #include <stdlib.h> | ||
| 644 | @@ -24,6 +24,7 @@ _parser_init (kms_response_parser_t *parser) | ||
| 645 | parser->raw_response = kms_request_str_new (); | ||
| 646 | parser->content_length = -1; | ||
| 647 | parser->response = calloc (1, sizeof (kms_response_t)); | ||
| 648 | + KMS_ASSERT (parser->response); | ||
| 649 | parser->response->headers = kms_kv_list_new (); | ||
| 650 | parser->state = PARSING_STATUS_LINE; | ||
| 651 | parser->start = 0; | ||
| 652 | @@ -34,6 +35,8 @@ kms_response_parser_t * | ||
| 653 | kms_response_parser_new (void) | ||
| 654 | { | ||
| 655 | kms_response_parser_t *parser = malloc (sizeof (kms_response_parser_t)); | ||
| 656 | + KMS_ASSERT (parser); | ||
| 657 | + | ||
| 658 | _parser_init (parser); | ||
| 659 | return parser; | ||
| 660 | } | ||
| 661 | @@ -59,11 +62,26 @@ static bool | ||
| 662 | _parse_int (const char *str, int *result) | ||
| 663 | { | ||
| 664 | char *endptr = NULL; | ||
| 665 | + int64_t long_result; | ||
| 666 | |||
| 667 | - *result = (int) strtol (str, &endptr, 10); | ||
| 668 | - if (*endptr) { | ||
| 669 | + errno = 0; | ||
| 670 | + long_result = strtol (str, &endptr, 10); | ||
| 671 | + if (endptr == str) { | ||
| 672 | + /* No digits were parsed. Consider this an error */ | ||
| 673 | + return false; | ||
| 674 | + } | ||
| 675 | + if (endptr != NULL && *endptr != '\0') { | ||
| 676 | + /* endptr points to the first invalid character. */ | ||
| 677 | + return false; | ||
| 678 | + } | ||
| 679 | + if (errno == EINVAL || errno == ERANGE) { | ||
| 680 | + return false; | ||
| 681 | + } | ||
| 682 | + if (long_result > INT32_MAX || long_result < INT32_MIN) { | ||
| 683 | return false; | ||
| 684 | } | ||
| 685 | + *result = (int) long_result; | ||
| 686 | + | ||
| 687 | return true; | ||
| 688 | } | ||
| 689 | |||
| 690 | @@ -72,6 +90,8 @@ static bool | ||
| 691 | _parse_int_from_view (const char *str, int start, int end, int *result) | ||
| 692 | { | ||
| 693 | char *num_str = malloc (end - start + 1); | ||
| 694 | + KMS_ASSERT (num_str); | ||
| 695 | + | ||
| 696 | bool ret; | ||
| 697 | |||
| 698 | strncpy (num_str, str + start, end - start); | ||
| 699 | diff --git a/src/third_party/scripts/kms_message_get_sources.sh b/src/third_party/scripts/kms_message_get_sources.sh | ||
| 700 | index 6ad2fbb0e6..52ce21b9dd 100755 | ||
| 701 | --- a/src/third_party/scripts/kms_message_get_sources.sh | ||
| 702 | +++ b/src/third_party/scripts/kms_message_get_sources.sh | ||
| 703 | @@ -18,7 +18,7 @@ if grep -q Microsoft /proc/version; then | ||
| 704 | fi | ||
| 705 | |||
| 706 | NAME=libmongocrypt | ||
| 707 | -REVISION=59c8c17bbdfa1cf0fdec60cfdde73a437a868221 | ||
| 708 | +REVISION=052f7fc610f0cea83a2adf3dd263a5ff04833371 | ||
| 709 | |||
| 710 | if grep -q Microsoft /proc/version; then | ||
| 711 | SRC_ROOT=$(wslpath -u $(powershell.exe -Command "Get-ChildItem Env:TEMP | Get-Content | Write-Host")) | ||
| 712 | -- | ||
| 713 | 2.24.0 | ||
| 714 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb index b78255a049..54178bf75a 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb | |||
| @@ -11,11 +11,10 @@ DEPENDS = "openssl libpcap zlib boost curl python3 \ | |||
| 11 | 11 | ||
| 12 | inherit scons dos2unix siteinfo python3native systemd useradd | 12 | inherit scons dos2unix siteinfo python3native systemd useradd |
| 13 | 13 | ||
| 14 | PV = "4.4.4" | 14 | PV = "4.4.5+4.4.6-rc0" |
| 15 | #v4.4.4 | 15 | #v4.4.6-rc0 |
| 16 | SRCREV = "8db30a63db1a9d84bdcad0c83369623f708e0397" | 16 | SRCREV = "72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7" |
| 17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \ | 17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \ |
| 18 | file://0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch \ | ||
| 19 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ | 18 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ |
| 20 | file://0001-Use-long-long-instead-of-int64_t.patch \ | 19 | file://0001-Use-long-long-instead-of-int64_t.patch \ |
| 21 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ | 20 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ |
