diff options
9 files changed, 812 insertions, 53 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch index 1908846245..b8a325295d 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 1b2e24e14ee72e54e466be2512c78272f62d60b4 Mon Sep 17 00:00:00 2001 | 1 | From 8295bb6a60896fed54d6450bca091aea4eea4fb2 Mon Sep 17 00:00:00 2001 |
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | 2 | From: Vincent Prince <vincent.prince.fr@gmail.com> |
3 | Date: Mon, 16 Sep 2019 13:21:44 +0200 | 3 | Date: Mon, 16 Sep 2019 13:21:44 +0200 |
4 | Subject: [PATCH 01/10] Tell scons to use build settings from environment | 4 | Subject: [PATCH 01/10] Tell scons to use build settings from environment |
@@ -7,14 +7,14 @@ Subject: [PATCH 01/10] Tell scons to use build settings from environment | |||
7 | Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> | 7 | Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> |
8 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | 8 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> |
9 | --- | 9 | --- |
10 | SConstruct | 8 ++++++-- | 10 | SConstruct | 8 ++++++-- |
11 | 1 files changed, 8 insertions(+), 2 deletions(-) | 11 | 1 file changed, 6 insertions(+), 2 deletions(-) |
12 | 12 | ||
13 | diff --git a/SConstruct b/SConstruct | 13 | diff --git a/SConstruct b/SConstruct |
14 | index 7ebbcbc..e63cf15 100644 | 14 | index 89c044ab78..2044c0ddb8 100644 |
15 | --- a/SConstruct | 15 | --- a/SConstruct |
16 | +++ b/SConstruct | 16 | +++ b/SConstruct |
17 | @@ -608,6 +608,7 @@ def variable_arch_converter(val): | 17 | @@ -593,6 +593,7 @@ def variable_arch_converter(val): |
18 | 'amd64': 'x86_64', | 18 | 'amd64': 'x86_64', |
19 | 'emt64': 'x86_64', | 19 | 'emt64': 'x86_64', |
20 | 'x86': 'i386', | 20 | 'x86': 'i386', |
@@ -22,7 +22,7 @@ index 7ebbcbc..e63cf15 100644 | |||
22 | } | 22 | } |
23 | val = val.lower() | 23 | val = val.lower() |
24 | 24 | ||
25 | @@ -695,7 +696,8 @@ env_vars.Add( | 25 | @@ -723,7 +724,8 @@ env_vars.Add( |
26 | ) | 26 | ) |
27 | 27 | ||
28 | env_vars.Add('CC', | 28 | env_vars.Add('CC', |
@@ -32,7 +32,7 @@ index 7ebbcbc..e63cf15 100644 | |||
32 | 32 | ||
33 | env_vars.Add('CCFLAGS', | 33 | env_vars.Add('CCFLAGS', |
34 | help='Sets flags for the C and C++ compiler', | 34 | help='Sets flags for the C and C++ compiler', |
35 | @@ -715,7 +717,8 @@ env_vars.Add('CPPPATH', | 35 | @@ -743,7 +745,8 @@ env_vars.Add('CPPPATH', |
36 | converter=variable_shlex_converter) | 36 | converter=variable_shlex_converter) |
37 | 37 | ||
38 | env_vars.Add('CXX', | 38 | env_vars.Add('CXX', |
@@ -42,15 +42,14 @@ index 7ebbcbc..e63cf15 100644 | |||
42 | 42 | ||
43 | env_vars.Add('CXXFLAGS', | 43 | env_vars.Add('CXXFLAGS', |
44 | help='Sets flags for the C++ compiler', | 44 | help='Sets flags for the C++ compiler', |
45 | @@ -1018,6 +1021,7 @@ envDict = dict(BUILD_ROOT=buildDir, | 45 | @@ -1127,6 +1130,7 @@ if get_option('build-tools') == 'next' or get_option('ninja') == 'next': |
46 | ) | 46 | SCons.Tool.DefaultToolpath.insert(0, os.path.abspath('site_scons/site_tools/next')) |
47 | 47 | ||
48 | env = Environment(variables=env_vars, **envDict) | 48 | env = Environment(variables=env_vars, **envDict) |
49 | +env.PrependENVPath('PATH', os.getenv('PATH')) | 49 | +env.PrependENVPath('PATH', os.getenv('PATH')) |
50 | del envDict | ||
51 | |||
52 | for var in ['CC', 'CXX']: | ||
53 | 50 | ||
51 | # Only print the spinner if stdout is a tty | ||
52 | if sys.stdout.isatty(): | ||
54 | -- | 53 | -- |
55 | 2.7.4 | 54 | 2.24.0 |
56 | 55 | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch index d98fa56cbb..8d82be1b57 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From d701ceeb15662038435b80ba556a80c17f76d2dc Mon Sep 17 00:00:00 2001 | 1 | From 6332823f9fdcb571305b716330e67d0b38810868 Mon Sep 17 00:00:00 2001 |
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | 2 | From: Vincent Prince <vincent.prince.fr@gmail.com> |
3 | Date: Mon, 16 Sep 2019 13:30:13 +0200 | 3 | Date: Mon, 16 Sep 2019 13:30:13 +0200 |
4 | Subject: [PATCH 03/10] Use __GLIBC__ to control use of gnu_get_libc_version | 4 | Subject: [PATCH 03/10] Use __GLIBC__ to control use of gnu_get_libc_version |
@@ -10,7 +10,7 @@ Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | |||
10 | 1 file changed, 4 insertions(+), 4 deletions(-) | 10 | 1 file changed, 4 insertions(+), 4 deletions(-) |
11 | 11 | ||
12 | diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp | 12 | diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp |
13 | index cccb91c..45c4b7d 100644 | 13 | index a968c54727..0d8b8874e2 100644 |
14 | --- a/src/mongo/util/processinfo_linux.cpp | 14 | --- a/src/mongo/util/processinfo_linux.cpp |
15 | +++ b/src/mongo/util/processinfo_linux.cpp | 15 | +++ b/src/mongo/util/processinfo_linux.cpp |
16 | @@ -44,10 +44,10 @@ | 16 | @@ -44,10 +44,10 @@ |
@@ -27,7 +27,7 @@ index cccb91c..45c4b7d 100644 | |||
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #include <boost/filesystem.hpp> | 29 | #include <boost/filesystem.hpp> |
30 | @@ -546,7 +546,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() { | 30 | @@ -617,7 +617,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() { |
31 | std::stringstream ss; | 31 | std::stringstream ss; |
32 | ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__; | 32 | ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__; |
33 | bExtra.append("libcVersion", ss.str()); | 33 | bExtra.append("libcVersion", ss.str()); |
@@ -37,5 +37,5 @@ index cccb91c..45c4b7d 100644 | |||
37 | #endif | 37 | #endif |
38 | if (!verSig.empty()) | 38 | if (!verSig.empty()) |
39 | -- | 39 | -- |
40 | 2.7.4 | 40 | 2.24.0 |
41 | 41 | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch index b9c6704075..958e09c3dc 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 20fcbf2a05ee6542aba942f6006d149db70fb9ce Mon Sep 17 00:00:00 2001 | 1 | From 4e7f15346682482bc2071c7209dec97507d3bc4c Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Sat, 2 Sep 2017 10:03:37 -0700 | 3 | Date: Sat, 2 Sep 2017 10:03:37 -0700 |
4 | Subject: [PATCH 02/10] Use long long instead of int64_t | 4 | Subject: [PATCH 02/10] Use long long instead of int64_t |
@@ -8,12 +8,13 @@ error: call to member function 'appendNumber' is ambiguous | |||
8 | since this function expects long long as parameter and not int64_t | 8 | since this function expects long long as parameter and not int64_t |
9 | 9 | ||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
11 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
11 | --- | 12 | --- |
12 | src/mongo/util/procparser.cpp | 10 +++++----- | 13 | src/mongo/util/procparser.cpp | 10 +++++----- |
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | 14 | 1 file changed, 5 insertions(+), 5 deletions(-) |
14 | 15 | ||
15 | diff --git a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp | 16 | diff --git a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp |
16 | index c574a3f..5ea66b7 100644 | 17 | index 24b9d1e2c9..0f274cfff6 100644 |
17 | --- a/src/mongo/util/procparser.cpp | 18 | --- a/src/mongo/util/procparser.cpp |
18 | +++ b/src/mongo/util/procparser.cpp | 19 | +++ b/src/mongo/util/procparser.cpp |
19 | @@ -261,7 +261,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | 20 | @@ -261,7 +261,7 @@ Status parseProcStat(const std::vector<StringData>& keys, |
@@ -23,7 +24,7 @@ index c574a3f..5ea66b7 100644 | |||
23 | - uint64_t value; | 24 | - uint64_t value; |
24 | + long long value; | 25 | + long long value; |
25 | 26 | ||
26 | if (!parseNumberFromString(stringValue, &value).isOK()) { | 27 | if (!NumberParser{}(stringValue, &value).isOK()) { |
27 | value = 0; | 28 | value = 0; |
28 | @@ -273,7 +273,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | 29 | @@ -273,7 +273,7 @@ Status parseProcStat(const std::vector<StringData>& keys, |
29 | } else { | 30 | } else { |
@@ -32,7 +33,7 @@ index c574a3f..5ea66b7 100644 | |||
32 | - uint64_t value; | 33 | - uint64_t value; |
33 | + long long value; | 34 | + long long value; |
34 | 35 | ||
35 | if (!parseNumberFromString(stringValue, &value).isOK()) { | 36 | if (!NumberParser{}(stringValue, &value).isOK()) { |
36 | value = 0; | 37 | value = 0; |
37 | @@ -366,7 +366,7 @@ Status parseProcMemInfo(const std::vector<StringData>& keys, | 38 | @@ -366,7 +366,7 @@ Status parseProcMemInfo(const std::vector<StringData>& keys, |
38 | 39 | ||
@@ -41,7 +42,7 @@ index c574a3f..5ea66b7 100644 | |||
41 | - uint64_t value; | 42 | - uint64_t value; |
42 | + long long value; | 43 | + long long value; |
43 | 44 | ||
44 | if (!parseNumberFromString(stringValue, &value).isOK()) { | 45 | if (!NumberParser{}(stringValue, &value).isOK()) { |
45 | value = 0; | 46 | value = 0; |
46 | @@ -522,7 +522,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, | 47 | @@ -522,7 +522,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, |
47 | StringData data, | 48 | StringData data, |
@@ -59,8 +60,8 @@ index c574a3f..5ea66b7 100644 | |||
59 | - uint64_t value; | 60 | - uint64_t value; |
60 | + long long value; | 61 | + long long value; |
61 | 62 | ||
62 | if (!parseNumberFromString(stringValue, &value).isOK()) { | 63 | if (!NumberParser{}(stringValue, &value).isOK()) { |
63 | value = 0; | 64 | value = 0; |
64 | -- | 65 | -- |
65 | 2.7.4 | 66 | 2.24.0 |
66 | 67 | ||
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 new file mode 100644 index 0000000000..df4cee2b42 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch | |||
@@ -0,0 +1,714 @@ | |||
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/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch index 869d2849df..57f4168f5a 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 73c6374ceb0c062e91210cc9ef3e0e9fa30ee514 Mon Sep 17 00:00:00 2001 | 1 | From 28f34191eef1e70c24d2f81b66e4dd40dbefcd35 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Sat, 2 Sep 2017 12:42:30 -0700 | 3 | Date: Sat, 2 Sep 2017 12:42:30 -0700 |
4 | Subject: [PATCH 04/10] Add a definition for the macro __ELF_NATIVE_CLASS | 4 | Subject: [PATCH 04/10] Add a definition for the macro __ELF_NATIVE_CLASS |
@@ -6,17 +6,18 @@ Subject: [PATCH 04/10] Add a definition for the macro __ELF_NATIVE_CLASS | |||
6 | It depends on the native arch's word size. | 6 | It depends on the native arch's word size. |
7 | 7 | ||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
9 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
9 | --- | 10 | --- |
10 | src/mongo/util/stacktrace_posix.cpp | 9 +++++++++ | 11 | src/mongo/util/stacktrace_posix.cpp | 9 +++++++++ |
11 | 1 file changed, 9 insertions(+) | 12 | 1 file changed, 9 insertions(+) |
12 | 13 | ||
13 | diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp | 14 | diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp |
14 | index 1d7b3d7..f81e329 100644 | 15 | index 531e21bdc2..fa611499e4 100644 |
15 | --- a/src/mongo/util/stacktrace_posix.cpp | 16 | --- a/src/mongo/util/stacktrace_posix.cpp |
16 | +++ b/src/mongo/util/stacktrace_posix.cpp | 17 | +++ b/src/mongo/util/stacktrace_posix.cpp |
17 | @@ -39,6 +39,15 @@ | 18 | @@ -42,6 +42,15 @@ |
19 | #include <iostream> | ||
18 | #include <string> | 20 | #include <string> |
19 | #include <sys/utsname.h> | ||
20 | 21 | ||
21 | +#if !defined(__GLIBC__) | 22 | +#if !defined(__GLIBC__) |
22 | +#if defined __x86_64__ && !defined __ILP32__ | 23 | +#if defined __x86_64__ && !defined __ILP32__ |
@@ -28,8 +29,8 @@ index 1d7b3d7..f81e329 100644 | |||
28 | +#endif | 29 | +#endif |
29 | + | 30 | + |
30 | #include "mongo/base/init.h" | 31 | #include "mongo/base/init.h" |
32 | #include "mongo/bson/json.h" | ||
31 | #include "mongo/config.h" | 33 | #include "mongo/config.h" |
32 | #include "mongo/db/jsobj.h" | ||
33 | -- | 34 | -- |
34 | 2.7.4 | 35 | 2.24.0 |
35 | 36 | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch index 3a27aacfe4..910ef0b5f4 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch | |||
@@ -2,7 +2,7 @@ Index: git/SConstruct | |||
2 | =================================================================== | 2 | =================================================================== |
3 | --- git.orig/SConstruct | 3 | --- git.orig/SConstruct |
4 | +++ git/SConstruct | 4 | +++ git/SConstruct |
5 | @@ -884,6 +884,14 @@ env_vars.Add('WINDOWS_OPENSSL_BIN', | 5 | @@ -977,6 +977,14 @@ env_vars.Add('WINDOWS_OPENSSL_BIN', |
6 | help='Sets the path to the openssl binaries for packaging', | 6 | help='Sets the path to the openssl binaries for packaging', |
7 | default='c:/openssl/bin') | 7 | default='c:/openssl/bin') |
8 | 8 | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/1296.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/1296.patch index ae84bcb569..e4ae30776b 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/1296.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/1296.patch | |||
@@ -15,15 +15,16 @@ src/mongo/util/net/ssl_manager.cpp:575:79: error: invalid conversion from 'size_ | |||
15 | if (mongoUnsignedAddOverflow64(tagAndLengthByteCount, derLength, outLength) || | 15 | if (mongoUnsignedAddOverflow64(tagAndLengthByteCount, derLength, outLength) || |
16 | 16 | ||
17 | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> | 17 | Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
18 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
18 | --- | 19 | --- |
19 | src/mongo/util/net/ssl_manager.cpp | 6 +++--- | 20 | src/mongo/util/net/ssl_manager.cpp | 6 +++--- |
20 | 1 file changed, 3 insertions(+), 3 deletions(-) | 21 | 1 file changed, 3 insertions(+), 3 deletions(-) |
21 | 22 | ||
22 | diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp | 23 | diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp |
23 | index b93ebe84a4a3..3511eb5d998f 100644 | 24 | index 455a1662a5..e8497bc0d1 100644 |
24 | --- a/src/mongo/util/net/ssl_manager.cpp | 25 | --- a/src/mongo/util/net/ssl_manager.cpp |
25 | +++ b/src/mongo/util/net/ssl_manager.cpp | 26 | +++ b/src/mongo/util/net/ssl_manager.cpp |
26 | @@ -782,7 +782,7 @@ class DERToken { | 27 | @@ -810,7 +810,7 @@ public: |
27 | * | 28 | * |
28 | * Returns a DERToken which consists of the (tag, length, value) tuple. | 29 | * Returns a DERToken which consists of the (tag, length, value) tuple. |
29 | */ | 30 | */ |
@@ -32,7 +33,7 @@ index b93ebe84a4a3..3511eb5d998f 100644 | |||
32 | 33 | ||
33 | private: | 34 | private: |
34 | DERType _type{DERType::EndOfContent}; | 35 | DERType _type{DERType::EndOfContent}; |
35 | @@ -799,7 +799,7 @@ struct DataType::Handler<DERToken> { | 36 | @@ -827,7 +827,7 @@ struct DataType::Handler<DERToken> { |
36 | size_t length, | 37 | size_t length, |
37 | size_t* advanced, | 38 | size_t* advanced, |
38 | std::ptrdiff_t debug_offset) { | 39 | std::ptrdiff_t debug_offset) { |
@@ -41,7 +42,7 @@ index b93ebe84a4a3..3511eb5d998f 100644 | |||
41 | 42 | ||
42 | auto swPair = DERToken::parse(ConstDataRange(ptr, length), &outLength); | 43 | auto swPair = DERToken::parse(ConstDataRange(ptr, length), &outLength); |
43 | 44 | ||
44 | @@ -844,7 +844,7 @@ StatusWith<std::string> readDERString(ConstDataRangeCursor& cdc) { | 45 | @@ -889,7 +889,7 @@ StatusWith<DERInteger> readDERInt(ConstDataRangeCursor& cdc) { |
45 | } | 46 | } |
46 | 47 | ||
47 | 48 | ||
@@ -50,3 +51,6 @@ index b93ebe84a4a3..3511eb5d998f 100644 | |||
50 | const size_t kTagLength = 1; | 51 | const size_t kTagLength = 1; |
51 | const size_t kTagLengthAndInitialLengthByteLength = kTagLength + 1; | 52 | const size_t kTagLengthAndInitialLengthByteLength = kTagLength + 1; |
52 | 53 | ||
54 | -- | ||
55 | 2.24.0 | ||
56 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch index 15bd7da702..1a7bf0fc52 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From c9fc9e9a44b0fb764ce86a5e57f17d3c5bbfd8cd Mon Sep 17 00:00:00 2001 | 1 | From 298d958148f1fb2bb7725fed15c68c09677c14c9 Mon Sep 17 00:00:00 2001 |
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | 2 | From: Vincent Prince <vincent.prince.fr@gmail.com> |
3 | Date: Mon, 16 Sep 2019 13:37:10 +0200 | 3 | Date: Mon, 16 Sep 2019 13:37:10 +0200 |
4 | Subject: [PATCH 05/10] Add alises for arm64 which is same as aarch64 | 4 | Subject: [PATCH 05/10] Add alises for arm64 which is same as aarch64 |
@@ -12,10 +12,10 @@ Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | |||
12 | 3 files changed, 3 insertions(+), 2 deletions(-) | 12 | 3 files changed, 3 insertions(+), 2 deletions(-) |
13 | 13 | ||
14 | diff --git a/SConstruct b/SConstruct | 14 | diff --git a/SConstruct b/SConstruct |
15 | index e63cf15..5593c78 100644 | 15 | index 448939bdd0..abfd816f3e 100644 |
16 | --- a/SConstruct | 16 | --- a/SConstruct |
17 | +++ b/SConstruct | 17 | +++ b/SConstruct |
18 | @@ -1129,6 +1129,7 @@ elif endian == "big": | 18 | @@ -1228,6 +1228,7 @@ if endian == "auto": |
19 | processor_macros = { | 19 | processor_macros = { |
20 | 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, | 20 | 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, |
21 | 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, | 21 | 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, |
@@ -24,10 +24,10 @@ index e63cf15..5593c78 100644 | |||
24 | 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, | 24 | 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, |
25 | 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, | 25 | 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, |
26 | diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript | 26 | diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript |
27 | index f23c071..fb82cd6 100644 | 27 | index 58e1b7ba65..bffe83b462 100644 |
28 | --- a/src/third_party/IntelRDFPMathLib20U1/SConscript | 28 | --- a/src/third_party/IntelRDFPMathLib20U1/SConscript |
29 | +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript | 29 | +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript |
30 | @@ -308,7 +308,7 @@ if processor == 'i386' or processor == 'emscripten': | 30 | @@ -309,7 +309,7 @@ if processor == 'i386' or processor == 'emscripten': |
31 | elif processor == 'arm': | 31 | elif processor == 'arm': |
32 | cpp_defines['IA32'] = '1' | 32 | cpp_defines['IA32'] = '1' |
33 | cpp_defines['ia32'] = '1' | 33 | cpp_defines['ia32'] = '1' |
@@ -37,7 +37,7 @@ index f23c071..fb82cd6 100644 | |||
37 | cpp_defines['EFI2'] = '1' | 37 | cpp_defines['EFI2'] = '1' |
38 | # Using 64 bit little endian | 38 | # Using 64 bit little endian |
39 | diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript | 39 | diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript |
40 | index cdd090b..97a1b3b 100644 | 40 | index d6bd665e23..2f1e656a19 100644 |
41 | --- a/src/third_party/wiredtiger/SConscript | 41 | --- a/src/third_party/wiredtiger/SConscript |
42 | +++ b/src/third_party/wiredtiger/SConscript | 42 | +++ b/src/third_party/wiredtiger/SConscript |
43 | @@ -152,7 +152,7 @@ condition_map = { | 43 | @@ -152,7 +152,7 @@ condition_map = { |
@@ -50,5 +50,5 @@ index cdd090b..97a1b3b 100644 | |||
50 | 'X86_HOST' : env['TARGET_ARCH'] == 'x86_64', | 50 | 'X86_HOST' : env['TARGET_ARCH'] == 'x86_64', |
51 | 'ZSERIES_HOST' : env['TARGET_ARCH'] == 's390x', | 51 | 'ZSERIES_HOST' : env['TARGET_ARCH'] == 's390x', |
52 | -- | 52 | -- |
53 | 2.7.4 | 53 | 2.24.0 |
54 | 54 | ||
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 58841ef319..0606e34407 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 | |||
@@ -9,12 +9,13 @@ DEPENDS = "openssl libpcap zlib boost curl python3 \ | |||
9 | python3-psutil-native python3-regex-native \ | 9 | python3-psutil-native python3-regex-native \ |
10 | " | 10 | " |
11 | 11 | ||
12 | inherit scons dos2unix siteinfo python3native | 12 | inherit scons dos2unix siteinfo python3native systemd useradd |
13 | 13 | ||
14 | PV = "4.2.2" | 14 | PV = "4.4.1" |
15 | #v4.2.2 | 15 | #v4.4.1 |
16 | SRCREV = "a0bbbff6ada159e19298d37946ac8dc4b497eadf" | 16 | SRCREV = "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1" |
17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.2 \ | 17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \ |
18 | file://0001-kms-message-bump-libmongocrypto-to-v1.0.4.patch \ | ||
18 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ | 19 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ |
19 | file://0001-Use-long-long-instead-of-int64_t.patch \ | 20 | file://0001-Use-long-long-instead-of-int64_t.patch \ |
20 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ | 21 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ |
@@ -35,6 +36,7 @@ SRC_URI_append_toolchain-clang = "\ | |||
35 | file://0001-asio-Dont-use-experimental-with-clang.patch \ | 36 | file://0001-asio-Dont-use-experimental-with-clang.patch \ |
36 | " | 37 | " |
37 | 38 | ||
39 | |||
38 | S = "${WORKDIR}/git" | 40 | S = "${WORKDIR}/git" |
39 | 41 | ||
40 | COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux' | 42 | COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux' |
@@ -51,26 +53,64 @@ PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools," | |||
51 | PACKAGECONFIG[shell] = ",--js-engine=none,," | 53 | PACKAGECONFIG[shell] = ",--js-engine=none,," |
52 | PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre," | 54 | PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre," |
53 | 55 | ||
54 | EXTRA_OESCONS = "--prefix=${D}${prefix} \ | 56 | EXTRA_OESCONS = "PREFIX=${prefix} \ |
57 | DESTDIR=${D} \ | ||
55 | LIBPATH=${STAGING_LIBDIR} \ | 58 | LIBPATH=${STAGING_LIBDIR} \ |
56 | LINKFLAGS='${LDFLAGS}' \ | 59 | LINKFLAGS='${LDFLAGS}' \ |
57 | CXXFLAGS='${CXXFLAGS}' \ | 60 | CXXFLAGS='${CXXFLAGS}' \ |
58 | TARGET_ARCH=${TARGET_ARCH} \ | 61 | TARGET_ARCH=${TARGET_ARCH} \ |
62 | MONGO_VERSION=${PV} \ | ||
59 | --ssl \ | 63 | --ssl \ |
60 | --disable-warnings-as-errors \ | 64 | --disable-warnings-as-errors \ |
61 | --use-system-zlib \ | 65 | --use-system-zlib \ |
62 | --nostrip \ | 66 | --nostrip \ |
63 | --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ | 67 | --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ |
64 | --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \ | 68 | --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \ |
65 | ${PACKAGECONFIG_CONFARGS} \ | 69 | --separate-debug \ |
66 | core" | 70 | ${PACKAGECONFIG_CONFARGS}" |
71 | |||
72 | |||
73 | USERADD_PACKAGES = "${PN}" | ||
74 | USERADD_PARAM_${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}" | ||
75 | |||
67 | 76 | ||
68 | scons_do_compile() { | 77 | scons_do_compile() { |
69 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} || \ | 78 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || \ |
70 | die "scons build execution failed." | 79 | die "scons build execution failed." |
71 | } | 80 | } |
72 | 81 | ||
73 | scons_do_install() { | 82 | scons_do_install() { |
74 | ${STAGING_BINDIR_NATIVE}/scons install ${EXTRA_OESCONS}|| \ | 83 | # install binaries |
75 | die "scons install execution failed." | 84 | install -d ${D}${bindir} |
85 | for i in mongod mongos mongo | ||
86 | do | ||
87 | if [ -f ${B}/build/opt/mongo/${i} ] | ||
88 | then | ||
89 | install -m 0755 ${B}/build/opt/mongo/${i} ${D}${bindir}/${i} | ||
90 | else | ||
91 | bbnote "${i} does not exist" | ||
92 | fi | ||
93 | done | ||
94 | |||
95 | # install config | ||
96 | install -d ${D}${sysconfdir} | ||
97 | install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}/ | ||
98 | |||
99 | # install systemd service | ||
100 | install -d ${D}${systemd_system_unitdir} | ||
101 | install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir} | ||
102 | |||
103 | # install mongo data folder | ||
104 | install -m 755 -d ${D}${localstatedir}/lib/${BPN} | ||
105 | chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN} | ||
106 | |||
107 | # Log files | ||
108 | install -m 755 -d ${D}${localstatedir}/log/${BPN} | ||
109 | chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN} | ||
76 | } | 110 | } |
111 | |||
112 | CONFFILES_${PN} = "${sysconfdir}/mongod.conf" | ||
113 | |||
114 | SYSTEMD_SERVICE_${PN} = "mongod.service" | ||
115 | |||
116 | |||