couchbase 3.2.2 → 3.2.5
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.
- package/binding.gyp +5 -0
- package/deps/lcb/CMakeLists.txt +1 -1
- package/deps/lcb/CONTRIBUTING.md +1 -1
- package/deps/lcb/README.markdown +2 -2
- package/deps/lcb/RELEASE_NOTES.markdown +84 -17
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
- package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -6
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/example/minimal/query.c +9 -7
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
- package/deps/lcb/include/libcouchbase/couchbase.h +55 -1
- package/deps/lcb/include/libcouchbase/error.h +6 -1
- package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
- package/deps/lcb/include/libcouchbase/tracing.h +2 -2
- package/deps/lcb/include/memcached/protocol_binary.h +21 -0
- package/deps/lcb/libcouchbase.gyp +353 -349
- package/deps/lcb/packaging/deb/control +1 -1
- package/deps/lcb/src/analytics/analytics_handle.cc +7 -5
- package/deps/lcb/src/analytics/analytics_handle.hh +28 -0
- package/deps/lcb/src/capi/cmd_counter.hh +18 -0
- package/deps/lcb/src/capi/cmd_exists.hh +18 -0
- package/deps/lcb/src/capi/cmd_get.hh +17 -0
- package/deps/lcb/src/capi/cmd_get_replica.hh +20 -1
- package/deps/lcb/src/capi/cmd_query.cc +13 -0
- package/deps/lcb/src/capi/cmd_query.hh +22 -14
- package/deps/lcb/src/capi/cmd_remove.hh +18 -0
- package/deps/lcb/src/capi/cmd_search.hh +6 -0
- package/deps/lcb/src/capi/cmd_store.hh +28 -21
- package/deps/lcb/src/capi/cmd_subdoc.hh +30 -0
- package/deps/lcb/src/capi/cmd_touch.hh +18 -0
- package/deps/lcb/src/capi/cmd_unlock.hh +18 -0
- package/deps/lcb/src/capi/cmd_view.hh +6 -0
- package/deps/lcb/src/capi/collection_qualifier.hh +6 -8
- package/deps/lcb/src/cntl.cc +42 -8
- package/deps/lcb/src/dns-srv.cc +5 -3
- package/deps/lcb/src/errmap.cc +5 -9
- package/deps/lcb/src/errmap.h +7 -3
- package/deps/lcb/src/handler.cc +24 -18
- package/deps/lcb/src/internal.h +2 -1
- package/deps/lcb/src/lcbio/ctx.cc +4 -2
- package/deps/lcb/src/mcserver/mcserver.cc +8 -5
- package/deps/lcb/src/mcserver/negotiate.cc +42 -17
- package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
- package/deps/lcb/src/n1ql/n1ql.cc +5 -1
- package/deps/lcb/src/n1ql/query_handle.cc +80 -44
- package/deps/lcb/src/n1ql/query_handle.hh +41 -3
- package/deps/lcb/src/operations/counter.cc +13 -1
- package/deps/lcb/src/operations/exists.cc +14 -2
- package/deps/lcb/src/operations/get.cc +14 -2
- package/deps/lcb/src/operations/get_replica.cc +18 -6
- package/deps/lcb/src/operations/observe.cc +1 -1
- package/deps/lcb/src/operations/remove.cc +13 -1
- package/deps/lcb/src/operations/store.cc +13 -1
- package/deps/lcb/src/operations/subdoc.cc +13 -2
- package/deps/lcb/src/operations/touch.cc +14 -2
- package/deps/lcb/src/operations/unlock.cc +14 -2
- package/deps/lcb/src/search/search_handle.cc +26 -8
- package/deps/lcb/src/search/search_handle.hh +29 -0
- package/deps/lcb/src/ssl/ssl_common.c +7 -8
- package/deps/lcb/src/tracing/span.cc +43 -10
- package/deps/lcb/src/tracing/tracing-internal.h +105 -93
- package/deps/lcb/src/utilities.cc +21 -0
- package/deps/lcb/src/utilities.h +3 -0
- package/deps/lcb/src/views/view_handle.cc +13 -5
- package/deps/lcb/src/views/view_handle.hh +29 -0
- package/deps/lcb/tests/CMakeLists.txt +21 -0
- package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
- package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
- package/deps/lcb/tests/iotests/mock-environment.cc +25 -1
- package/deps/lcb/tests/iotests/mock-environment.h +49 -1
- package/deps/lcb/tests/iotests/mock-unit-test.cc +96 -5
- package/deps/lcb/tests/iotests/mock-unit-test.h +32 -0
- package/deps/lcb/tests/iotests/serverparams.h +7 -2
- package/deps/lcb/tests/iotests/t_collections.cc +1 -1
- package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
- package/deps/lcb/tests/iotests/t_get.cc +14 -4
- package/deps/lcb/tests/iotests/t_n1ql.cc +17 -1
- package/deps/lcb/tests/iotests/t_ratelimit.cc +729 -0
- package/deps/lcb/tests/iotests/t_views.cc +1 -0
- package/deps/lcb/tests/iotests/testutil.cc +342 -0
- package/deps/lcb/tests/iotests/testutil.h +164 -0
- package/deps/lcb/tests/mocksupport/procutil.c +32 -28
- package/deps/lcb/tests/mocksupport/server.c +0 -1
- package/deps/lcb/tools/cbc.cc +7 -0
- package/dist/analyticsexecutor.js +2 -2
- package/dist/analyticsindexmanager.js +512 -524
- package/dist/binarycollection.d.ts +17 -0
- package/dist/binding.d.ts +2 -0
- package/dist/binding.js +1 -1
- package/dist/bindingutilities.js +9 -1
- package/dist/bucketmanager.d.ts +32 -23
- package/dist/bucketmanager.js +197 -189
- package/dist/cluster.js +37 -36
- package/dist/collection.js +17 -23
- package/dist/collectionmanager.js +181 -200
- package/dist/connection.js +6 -3
- package/dist/connspec.js +5 -1
- package/dist/couchbase.js +7 -14
- package/dist/datastructures.js +239 -310
- package/dist/diagnosticsexecutor.js +70 -85
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +26 -2
- package/dist/eventingfunctionmanager.js +267 -294
- package/dist/httpexecutor.js +31 -38
- package/dist/logging.js +1 -1
- package/dist/queryexecutor.js +3 -3
- package/dist/queryindexmanager.js +236 -263
- package/dist/scope.js +8 -2
- package/dist/searchexecutor.js +3 -0
- package/dist/searchindexmanager.js +240 -271
- package/dist/searchquery.d.ts +17 -0
- package/dist/searchquery.js +22 -1
- package/dist/searchtypes.d.ts +7 -2
- package/dist/searchtypes.js +2 -2
- package/dist/usermanager.js +250 -263
- package/dist/utilities.d.ts +3 -2
- package/dist/utilities.js +16 -4
- package/dist/viewexecutor.js +1 -1
- package/dist/viewindexmanager.js +131 -150
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/constants.cpp +2 -0
- package/src/instance.cpp +8 -1
- package/src/instance.h +1 -0
- package/src/uv-plugin-all.cpp +1 -0
- package/dist/cas.d.ts +0 -0
- package/dist/cas.js +0 -1
package/binding.gyp
CHANGED
package/deps/lcb/CMakeLists.txt
CHANGED
|
@@ -30,7 +30,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
|
|
|
30
30
|
# Couchbase mock path to download
|
|
31
31
|
SET(COUCHBASE_MOCK_VERSION 1.5.25)
|
|
32
32
|
SET(COUCHBASE_MOCK_URL "https://github.com/couchbase/CouchbaseMock/releases/download/${COUCHBASE_MOCK_VERSION}/CouchbaseMock-${COUCHBASE_MOCK_VERSION}.jar")
|
|
33
|
-
project(libcouchbase VERSION 3.2.
|
|
33
|
+
project(libcouchbase VERSION 3.2.5 LANGUAGES C CXX)
|
|
34
34
|
|
|
35
35
|
if (NOT CMAKE_VERSION VERSION_LESS "3.13")
|
|
36
36
|
# CMP0077: option() honors normal variables
|
package/deps/lcb/CONTRIBUTING.md
CHANGED
|
@@ -66,7 +66,7 @@ Add your public SSH key to gerrit before submitting.
|
|
|
66
66
|
Assuming you have a repository created like so:
|
|
67
67
|
|
|
68
68
|
```
|
|
69
|
-
$ git clone
|
|
69
|
+
$ git clone https://github.com/couchbase/libcouchbase.git
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
you can simply perform two simple steps to get started with gerrit:
|
package/deps/lcb/README.markdown
CHANGED
|
@@ -48,7 +48,7 @@ Provided is a convenience script called `cmake/configure`. It is a Perl
|
|
|
48
48
|
script and functions like a normal `autotools` script.
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
$ git clone
|
|
51
|
+
$ git clone https://github.com/couchbase/libcouchbase.git
|
|
52
52
|
$ cd libcouchbase && mkdir build && cd build
|
|
53
53
|
$ ../cmake/configure
|
|
54
54
|
$ make
|
|
@@ -60,7 +60,7 @@ $ ctest
|
|
|
60
60
|
Assuming `git` and Visual Studio 2010 are installed, from a `CMD` shell, do:
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
-
C:\> git clone
|
|
63
|
+
C:\> git clone https://github.com/couchbase/libcouchbase.git
|
|
64
64
|
C:\> mkdir lcb-build
|
|
65
65
|
C:\> cd lcb-build
|
|
66
66
|
C:\> cmake -G "Visual Studio 10" ..\libcouchbase
|
|
@@ -1,15 +1,82 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## 3.2.5 (2022-02-08)
|
|
4
|
+
|
|
5
|
+
CCBC-1486: Add support for preserve expiry to query options
|
|
6
|
+
CCBC-1534, CCBC-1411: improve query error handling
|
|
7
|
+
CCBC-1519: pass extra privilege with KV "on-behalf-of".
|
|
8
|
+
CCBC-1521: fix bootstrap process when client cert is used and error map is supported. If client cert auth is used, once
|
|
9
|
+
the error map response has been received, the negotiation is complete.
|
|
10
|
+
CCBC-1529: load authentication certificate as chain file.
|
|
11
|
+
CCBC-1525: remove stringstream in `collection_qualifier`. Constructing a stringstream object every time
|
|
12
|
+
`collection_qualifier` is constructed is very expensive.
|
|
13
|
+
CCBC-1528: update parsing of "quota limit" error for FTS
|
|
14
|
+
|
|
15
|
+
## 3.2.4 (2021-11-23)
|
|
16
|
+
|
|
17
|
+
CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
|
|
18
|
+
|
|
19
|
+
CCBC-1521: Fixed bootstrap process when client certificate is used. We always pipeline error map request with `HELLO`
|
|
20
|
+
request, and usually await for `hello`+`error_map` responses, because after that goes SASL authentication (and then
|
|
21
|
+
optional selection of the bucket) which cannot be completely pipelined. But in case of client certificate, we might
|
|
22
|
+
terminate bootstrap process too early if the bootstrap process does not require immediate selection of the bucket.
|
|
23
|
+
|
|
24
|
+
CCBC-1432: Support for rate limiting error codes: `LCB_ERR_RATE_LIMITED` and `LCB_ERR_QUOTA_LIMITED`.
|
|
25
|
+
|
|
26
|
+
CCBC-1514: Do not translate unknown error with "item-only" attribute into `LCB_ERR_CAS_MISMATCH`.
|
|
27
|
+
|
|
28
|
+
CCBC-1515: Performance optimization: replace `sstream` with string `append()`. Only if list of IO vectors supplied for
|
|
29
|
+
value in mutation operations.
|
|
30
|
+
|
|
31
|
+
## 3.2.3 (2021-10-20)
|
|
32
|
+
|
|
33
|
+
* CCBC-1484: Fixed tracing tags in accordance to RFC.
|
|
34
|
+
|
|
35
|
+
* CCBC-1510: Fixed key length calculation for exists/get/touch/unlock.
|
|
36
|
+
|
|
37
|
+
* CCBC-1495: Fixed payload encoding in query index management helpers. Query index management helpers now explicitly
|
|
38
|
+
declared deperecated.
|
|
39
|
+
|
|
40
|
+
* CCBC-1506: Duration values now accepted golang style encoding. Connection string and `lcb_cntl_string` now can parse
|
|
41
|
+
strings with duration encoded in golang style, e.g. `analytics_timeout=5s42us`. The result still converted into 32-bit
|
|
42
|
+
value with microsecond resolution.
|
|
43
|
+
|
|
44
|
+
* Improved test coverage, stability and documentation.
|
|
45
|
+
|
|
46
|
+
## 3.2.2 (2021-09-22)
|
|
47
|
+
|
|
48
|
+
* CCBC-1485: Allow disabling tracer for connected instance.
|
|
49
|
+
|
|
50
|
+
* CCBC-1472: Ensure strict JSON parsing mode for query meta.
|
|
51
|
+
|
|
52
|
+
* CCBC-1494: Disconnect logger after `lcb_destroy` invoked to avoid double free errors.
|
|
53
|
+
|
|
54
|
+
* CCBC-1457: improve error message when server enforces encryption
|
|
55
|
+
|
|
56
|
+
* CCBC-1489: Fixed get_and_touch to use the correct expiry.
|
|
57
|
+
|
|
58
|
+
* CCBC-1487: Fixed `retryq` erasing already sent packets.
|
|
59
|
+
|
|
60
|
+
* CCBC-1488: Fixed incorrect refcounting in `Connstart`.
|
|
61
|
+
|
|
62
|
+
* CCBC-1479: Initialize fields of custom tracer struct.
|
|
63
|
+
|
|
64
|
+
* CCBC-1478: Do not retry successful query with empty result.
|
|
65
|
+
|
|
66
|
+
* CCBC-1216: Implement user impersonation API
|
|
67
|
+
|
|
68
|
+
* Improved test coverage and stability.
|
|
69
|
+
|
|
3
70
|
## 3.2.1 (2021-08-20)
|
|
4
71
|
|
|
5
72
|
* CCBC-1429: Fixed positional parameters for query/analtyics:
|
|
6
|
-
|
|
73
|
+
|
|
7
74
|
* reverts behaviour `lcb_cmdquery_positional_param` and `lcb_cmdanalytics_positional_param` to append single
|
|
8
75
|
JSON-encoded value to arguments array.
|
|
9
|
-
|
|
76
|
+
|
|
10
77
|
* introduces new functions `lcb_cmdquery_positional_params` and `lcb_cmdanalytics_positional_params` that accept all
|
|
11
78
|
positional arguments at once as JSON-encoded array.
|
|
12
|
-
|
|
79
|
+
|
|
13
80
|
* document, that old functions will emit compiler warning since 3.3.0 release and will be removed later.
|
|
14
81
|
|
|
15
82
|
* CCBC-1428: Clear callback upon error in `lcb_search`.
|
|
@@ -35,56 +102,56 @@
|
|
|
35
102
|
* Various improvements and fixes in test and build infrastruture
|
|
36
103
|
|
|
37
104
|
* CBCC-1280 Support for OpenTelemetry tracing.
|
|
38
|
-
|
|
105
|
+
|
|
39
106
|
Tracing updated to allow for an external tracer that creates and finishes spans, adds tags, destroys spans. Also,
|
|
40
107
|
spans now have the notion of being the 'outer' span. That is the span that has all the outer span tags, and is the
|
|
41
108
|
one whose duration is used to determine whether or not the operation has exceeded the threshold if the
|
|
42
109
|
ThresholdLoggingTracer is used.
|
|
43
|
-
|
|
110
|
+
|
|
44
111
|
If you pass in a parent that is an outer span, you must call `lcbtrace_span_finish` yourself. When an operation
|
|
45
112
|
begins, if there is no parent span passed in, or if there is but it isn't an 'outer' span, then the operation creates
|
|
46
113
|
the outer span itself.
|
|
47
114
|
See `/examples/tracing/otel_tracing.cc` for an example.
|
|
48
|
-
|
|
115
|
+
|
|
49
116
|
* CCBC-1362: Support for metrics.
|
|
50
|
-
|
|
117
|
+
|
|
51
118
|
When enabled, by default will output a histogram of latencies for various kv operations plus query, search, analytics
|
|
52
119
|
and view queries.
|
|
53
|
-
|
|
120
|
+
|
|
54
121
|
If desired, an external metrics collector can be passed in when the instance is created, which will then be called
|
|
55
122
|
with latencies for each operation. This can be used to call into an opentelemetry meter for aggregation and export.
|
|
56
123
|
See `/examples/metrics/otel_metrics.cc` for an example.
|
|
57
124
|
|
|
58
125
|
* CCBC-1421: Allow empty path for subdocument array methods.
|
|
59
|
-
|
|
126
|
+
|
|
60
127
|
* CCBC-1417: Depecate CAS usage with counter operation.
|
|
61
128
|
|
|
62
129
|
* CCBC-1418: Map query error 13014 to `LCB_ERR_AUTHENTICATION_FAILURE`.
|
|
63
|
-
|
|
130
|
+
|
|
64
131
|
* CCBC-1357: Allow to preserve expiration with Replace, Upsert and MutateIn operations.
|
|
65
132
|
|
|
66
133
|
* CCBC-1384: Allow the operations to be deferred until the instance will be connected to cluster.
|
|
67
134
|
|
|
68
135
|
* CCBC-1410: Refactor dynamic authenticator. NOTE: this API still volatile and might be changed in future.
|
|
69
|
-
|
|
136
|
+
|
|
70
137
|
In order to improve UX and allow caller to implement credential caching the API for authenticator was revised:
|
|
71
|
-
|
|
138
|
+
|
|
72
139
|
* instead of separate callbacks for username/password, now it uses single callback
|
|
73
|
-
|
|
140
|
+
|
|
74
141
|
* in the callback, the caller can figure out the reason of credentials request using `lcbauth_credentials_reason()`
|
|
75
|
-
|
|
142
|
+
|
|
76
143
|
* the caller can signal that it failed to retrieve credentials from external provider, and set result with
|
|
77
144
|
`lcbauth_credentials_result()`. In this case the SDK will not retry the operation.
|
|
78
|
-
|
|
145
|
+
|
|
79
146
|
|
|
80
147
|
* CCBC-1413: Skip `SELECT_BUCKET` packets waiting retry queue.
|
|
81
148
|
|
|
82
149
|
* CCBC-1169: Request copy from active vbucket for `get_all_replicas` operation.
|
|
83
150
|
|
|
84
151
|
* CCBC-1406: Fill in prepared statement handle on retry.
|
|
85
|
-
|
|
152
|
+
|
|
86
153
|
* CCBC-1405: Remove const from command cookie.
|
|
87
|
-
|
|
154
|
+
|
|
88
155
|
* CCBC-1402: Fix parsing JSON primitives as query rows.
|
|
89
156
|
|
|
90
157
|
## 3.1.3 (2021-05-10)
|
|
@@ -65,7 +65,7 @@ IF(APPLE)
|
|
|
65
65
|
ELSE()
|
|
66
66
|
SET(LCB_SONAME_MAJOR "8")
|
|
67
67
|
ENDIF()
|
|
68
|
-
SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.
|
|
68
|
+
SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.6")
|
|
69
69
|
|
|
70
70
|
MESSAGE(STATUS "libcouchbase ${LCB_VERSION_MAJOR},${LCB_VERSION_MINOR},${LCB_VERSION_PATCH}")
|
|
71
71
|
MESSAGE(STATUS "Building libcouchbase ${LCB_VERSION}/${LCB_VERSION_CHANGESET}")
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
#include "scram_utils.h"
|
|
18
18
|
#include "config.h"
|
|
19
|
-
#include <
|
|
20
|
-
#include <
|
|
19
|
+
#include <ctime>
|
|
20
|
+
#include <cctype>
|
|
21
21
|
#include "strcodecs/strcodecs.h"
|
|
22
22
|
|
|
23
23
|
#ifndef LCB_NO_SSL
|
|
@@ -46,9 +46,9 @@ void seed_rand(void)
|
|
|
46
46
|
// The entropy of these values is not good, but that's enough for generating nonces.
|
|
47
47
|
|
|
48
48
|
#ifdef LCB_NO_SSL
|
|
49
|
-
srand(time(
|
|
49
|
+
srand(time(nullptr));
|
|
50
50
|
#else
|
|
51
|
-
time_t current_time = time(
|
|
51
|
+
time_t current_time = time(nullptr);
|
|
52
52
|
clock_t clk;
|
|
53
53
|
#ifdef _WIN32
|
|
54
54
|
int pid;
|
|
@@ -73,7 +73,7 @@ void seed_rand(void)
|
|
|
73
73
|
*/
|
|
74
74
|
void generate_nonce(char *buffer, int buffer_length)
|
|
75
75
|
{
|
|
76
|
-
if ((
|
|
76
|
+
if ((nullptr == buffer) || (0 == buffer_length)) {
|
|
77
77
|
// invalid input arguments
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
@@ -88,14 +88,13 @@ void generate_nonce(char *buffer, int buffer_length)
|
|
|
88
88
|
int aRandom = 0;
|
|
89
89
|
unsigned int aMaxRandBits = 0, aRandRange,
|
|
90
90
|
aMaxRand = RAND_MAX; // we have to compute how many bits the rand() function can return
|
|
91
|
-
int i;
|
|
92
91
|
while (aMaxRand >>= 1) {
|
|
93
92
|
aMaxRandBits++;
|
|
94
93
|
}
|
|
95
94
|
aRandRange = aMaxRandBits / 8; // number of bytes we can extract from a rand() value.
|
|
96
95
|
// To avoid generating a new random number for each character, we call rand() only once every 5 characters.
|
|
97
96
|
// A 32-bits integer can give 5 values of 6 bits.
|
|
98
|
-
for (i = 0; i < buffer_length; ++i) {
|
|
97
|
+
for (int i = 0; i < buffer_length; ++i) {
|
|
99
98
|
if (i % aRandRange == 0) {
|
|
100
99
|
// we refill aRandom
|
|
101
100
|
aRandom = rand();
|
|
@@ -115,8 +114,7 @@ void generate_nonce(char *buffer, int buffer_length)
|
|
|
115
114
|
int compute_special_chars(const char *buffer, int buffer_length)
|
|
116
115
|
{
|
|
117
116
|
int result = 0;
|
|
118
|
-
int i;
|
|
119
|
-
for (i = 0; i < buffer_length; ++i) {
|
|
117
|
+
for (int i = 0; i < buffer_length; ++i) {
|
|
120
118
|
char c = buffer[i];
|
|
121
119
|
if (iscntrl(c)) {
|
|
122
120
|
return -1; // control characters are not allowed
|
|
@@ -140,13 +138,12 @@ int compute_special_chars(const char *buffer, int buffer_length)
|
|
|
140
138
|
void usernmcpy(char *dest, const char *src, size_t n)
|
|
141
139
|
{
|
|
142
140
|
char *newdest = dest;
|
|
143
|
-
unsigned int i;
|
|
144
141
|
|
|
145
|
-
if (
|
|
142
|
+
if (nullptr == dest || nullptr == src || 0 == n) {
|
|
146
143
|
return; // invalid arguments
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
for (i = 0; i < n; ++i) {
|
|
146
|
+
for (size_t i = 0; i < n; ++i) {
|
|
150
147
|
char c = src[i];
|
|
151
148
|
switch (c) {
|
|
152
149
|
case '=':
|
|
@@ -178,7 +175,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
|
|
|
178
175
|
const char *oldptr = serverin;
|
|
179
176
|
unsigned int remainlen = serverinlen;
|
|
180
177
|
|
|
181
|
-
if (
|
|
178
|
+
if (nullptr == serverin || 0 == serverinlen) {
|
|
182
179
|
return SASL_BADPARAM;
|
|
183
180
|
}
|
|
184
181
|
|
|
@@ -186,7 +183,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
|
|
|
186
183
|
do {
|
|
187
184
|
unsigned int attrlen; // attribute length
|
|
188
185
|
ptr = static_cast<const char *>(memchr(ptr, ',', remainlen));
|
|
189
|
-
if (ptr !=
|
|
186
|
+
if (ptr != nullptr) {
|
|
190
187
|
// oldptr points to the beginning of the attribute
|
|
191
188
|
// Ex: "r=xxxxx,s=zzzzzz,i=10"
|
|
192
189
|
// ^ ^
|
|
@@ -209,7 +206,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
|
|
|
209
206
|
}
|
|
210
207
|
switch (oldptr[0]) {
|
|
211
208
|
case 'r': // nonce
|
|
212
|
-
if (*nonce !=
|
|
209
|
+
if (*nonce != nullptr) {
|
|
213
210
|
// it looks like we already stored a previous occurrence of the nonce attribute
|
|
214
211
|
return SASL_BADPARAM;
|
|
215
212
|
}
|
|
@@ -217,7 +214,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
|
|
|
217
214
|
*noncelength = attrlen - 2;
|
|
218
215
|
break;
|
|
219
216
|
case 's': // salt
|
|
220
|
-
if (*salt !=
|
|
217
|
+
if (*salt != nullptr) {
|
|
221
218
|
// it looks like we already stored a previous occurrence of the salt attribute
|
|
222
219
|
return SASL_BADPARAM;
|
|
223
220
|
}
|
|
@@ -244,7 +241,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
|
|
|
244
241
|
|
|
245
242
|
remainlen = remainlen - attrlen - 1;
|
|
246
243
|
oldptr = ptr;
|
|
247
|
-
} while (ptr !=
|
|
244
|
+
} while (ptr != nullptr);
|
|
248
245
|
|
|
249
246
|
return SASL_OK;
|
|
250
247
|
}
|
|
@@ -313,17 +310,17 @@ static cbsasl_error_t HMAC_digest(cbsasl_auth_mechanism_t auth_mech, const unsig
|
|
|
313
310
|
{
|
|
314
311
|
switch (auth_mech) {
|
|
315
312
|
case SASL_AUTH_MECH_SCRAM_SHA1:
|
|
316
|
-
if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) ==
|
|
313
|
+
if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
|
|
317
314
|
return SASL_FAIL;
|
|
318
315
|
}
|
|
319
316
|
break;
|
|
320
317
|
case SASL_AUTH_MECH_SCRAM_SHA256:
|
|
321
|
-
if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) ==
|
|
318
|
+
if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
|
|
322
319
|
return SASL_FAIL;
|
|
323
320
|
}
|
|
324
321
|
break;
|
|
325
322
|
case SASL_AUTH_MECH_SCRAM_SHA512:
|
|
326
|
-
if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) ==
|
|
323
|
+
if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
|
|
327
324
|
return SASL_FAIL;
|
|
328
325
|
}
|
|
329
326
|
break;
|
|
@@ -369,19 +366,19 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
|
|
|
369
366
|
unsigned int storedkeylen = 0;
|
|
370
367
|
switch (auth_mech) {
|
|
371
368
|
case SASL_AUTH_MECH_SCRAM_SHA1:
|
|
372
|
-
if (SHA1(clientkeyhmac, hmaclen, storedkey) ==
|
|
369
|
+
if (SHA1(clientkeyhmac, hmaclen, storedkey) == nullptr) {
|
|
373
370
|
return SASL_FAIL;
|
|
374
371
|
}
|
|
375
372
|
storedkeylen = SHA_DIGEST_LENGTH;
|
|
376
373
|
break;
|
|
377
374
|
case SASL_AUTH_MECH_SCRAM_SHA256:
|
|
378
|
-
if (SHA256(clientkeyhmac, hmaclen, storedkey) ==
|
|
375
|
+
if (SHA256(clientkeyhmac, hmaclen, storedkey) == nullptr) {
|
|
379
376
|
return SASL_FAIL;
|
|
380
377
|
}
|
|
381
378
|
storedkeylen = SHA256_DIGEST_LENGTH;
|
|
382
379
|
break;
|
|
383
380
|
case SASL_AUTH_MECH_SCRAM_SHA512:
|
|
384
|
-
if (SHA512(clientkeyhmac, hmaclen, storedkey) ==
|
|
381
|
+
if (SHA512(clientkeyhmac, hmaclen, storedkey) == nullptr) {
|
|
385
382
|
return SASL_FAIL;
|
|
386
383
|
}
|
|
387
384
|
storedkeylen = SHA512_DIGEST_LENGTH;
|
|
@@ -396,7 +393,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
|
|
|
396
393
|
// client-final-message-without-proof
|
|
397
394
|
unsigned int authmesslen = cfblen + 1 + sfmlen + 1 + cfwplen;
|
|
398
395
|
char *authmess = static_cast<char *>(calloc(authmesslen + 1, 1)); // +1 for the binary zero
|
|
399
|
-
if (
|
|
396
|
+
if (nullptr == authmess) {
|
|
400
397
|
return SASL_NOMEM;
|
|
401
398
|
}
|
|
402
399
|
memcpy(authmess, clientfirstbare, cfblen);
|
|
@@ -419,8 +416,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
|
|
|
419
416
|
// final step:
|
|
420
417
|
// ClientProof := ClientKey XOR ClientSignature
|
|
421
418
|
char clientproof[EVP_MAX_MD_SIZE]; // binary client proof
|
|
422
|
-
unsigned
|
|
423
|
-
for (i = 0; i < clientsignlen; ++i) {
|
|
419
|
+
for (unsigned i = 0; i < clientsignlen; ++i) {
|
|
424
420
|
clientproof[i] = clientkeyhmac[i] ^ clientsign[i];
|
|
425
421
|
}
|
|
426
422
|
|
|
@@ -288,6 +288,7 @@ bool Reader::parse(const char* beginDoc,
|
|
|
288
288
|
const char* endDoc,
|
|
289
289
|
Value& root,
|
|
290
290
|
bool collectComments) {
|
|
291
|
+
try {
|
|
291
292
|
if (!features_.allowComments_) {
|
|
292
293
|
collectComments = false;
|
|
293
294
|
}
|
|
@@ -324,6 +325,21 @@ bool Reader::parse(const char* beginDoc,
|
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
327
|
return successful;
|
|
328
|
+
} catch (const RuntimeError &e) {
|
|
329
|
+
Token token;
|
|
330
|
+
token.type_ = tokenError;
|
|
331
|
+
token.start_ = beginDoc;
|
|
332
|
+
token.end_ = endDoc;
|
|
333
|
+
addError(std::string("RuntimeError: ") + e.what(), token);
|
|
334
|
+
return false;
|
|
335
|
+
} catch (const LogicError &e) {
|
|
336
|
+
Token token;
|
|
337
|
+
token.type_ = tokenError;
|
|
338
|
+
token.start_ = beginDoc;
|
|
339
|
+
token.end_ = endDoc;
|
|
340
|
+
addError(std::string("LogicError: ") + e.what(), token);
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
327
343
|
}
|
|
328
344
|
|
|
329
345
|
bool Reader::readValue() {
|
|
@@ -2356,15 +2372,13 @@ RuntimeError::RuntimeError(std::string const& msg)
|
|
|
2356
2372
|
LogicError::LogicError(std::string const& msg)
|
|
2357
2373
|
: Exception(msg)
|
|
2358
2374
|
{}
|
|
2359
|
-
void throwRuntimeError(std::string const& )
|
|
2375
|
+
void throwRuntimeError(std::string const& msg)
|
|
2360
2376
|
{
|
|
2361
|
-
|
|
2362
|
-
// throw RuntimeError(msg);
|
|
2377
|
+
throw RuntimeError(msg);
|
|
2363
2378
|
}
|
|
2364
|
-
void throwLogicError(std::string const&)
|
|
2379
|
+
void throwLogicError(std::string const& msg)
|
|
2365
2380
|
{
|
|
2366
|
-
|
|
2367
|
-
// throw LogicError(msg);
|
|
2381
|
+
throw LogicError(msg);
|
|
2368
2382
|
}
|
|
2369
2383
|
|
|
2370
2384
|
// //////////////////////////////////////////////////////////////////
|
package/deps/lcb/doc/Doxyfile
CHANGED
|
@@ -38,7 +38,7 @@ PROJECT_NAME = "Couchbase C Client"
|
|
|
38
38
|
# could be handy for archiving the generated documentation or if some version
|
|
39
39
|
# control system is used.
|
|
40
40
|
|
|
41
|
-
PROJECT_NUMBER = 3.2.
|
|
41
|
+
PROJECT_NUMBER = 3.2.5
|
|
42
42
|
|
|
43
43
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
|
44
44
|
# for a project that appears at the top of each page and should give viewer a
|
|
@@ -71,7 +71,7 @@ static void row_callback(lcb_INSTANCE *instance, int type, const lcb_RESPQUERY *
|
|
|
71
71
|
|
|
72
72
|
lcb_respquery_row(resp, &row, &nrow);
|
|
73
73
|
ln2space(row, nrow);
|
|
74
|
-
fprintf(stderr, "[\x1b[%dmQUERY\x1b[0m] %s, (
|
|
74
|
+
fprintf(stderr, "[\x1b[%dmQUERY\x1b[0m] %s, (size=%d) %.*s\n", err2color(rc), lcb_strerror_short(rc), (int)nrow,
|
|
75
75
|
(int)nrow, row);
|
|
76
76
|
if (lcb_respquery_is_final(resp)) {
|
|
77
77
|
fprintf(stderr, "\n");
|
|
@@ -120,7 +120,6 @@ static void sigint_handler(int unused)
|
|
|
120
120
|
|
|
121
121
|
int main(int argc, char *argv[])
|
|
122
122
|
{
|
|
123
|
-
lcb_STATUS err;
|
|
124
123
|
lcb_INSTANCE *instance;
|
|
125
124
|
char *bucket = NULL;
|
|
126
125
|
const char *key = "user:king_arthur";
|
|
@@ -171,11 +170,14 @@ int main(int argc, char *argv[])
|
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
cmd
|
|
177
|
-
|
|
178
|
-
check(
|
|
173
|
+
lcb_CMDQUERY *cmd;
|
|
174
|
+
char query[1024] = {0};
|
|
175
|
+
lcb_cmdquery_create(&cmd);
|
|
176
|
+
snprintf(query, sizeof(query), "CREATE PRIMARY INDEX ON `%s` USING gsi", bucket);
|
|
177
|
+
check(lcb_cmdquery_statement(cmd, query, strlen(query)), "set QUERY statement");
|
|
178
|
+
lcb_cmdquery_callback(cmd, row_callback);
|
|
179
|
+
check(lcb_query(instance, NULL, cmd), "schedule QUERY INDEX create operation");
|
|
180
|
+
lcb_cmdquery_destroy(cmd);
|
|
179
181
|
lcb_wait(instance, LCB_WAIT_DEFAULT);
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
/** @brief libcouchbase version string */
|
|
36
|
-
#define LCB_VERSION_STRING "3.2.
|
|
36
|
+
#define LCB_VERSION_STRING "3.2.5-njs"
|
|
37
37
|
|
|
38
38
|
/**@brief libcouchbase hex version
|
|
39
39
|
*
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
* 2.1.3 | 0x020103
|
|
51
51
|
* 3.0.15 | 0x030015
|
|
52
52
|
*/
|
|
53
|
-
#define LCB_VERSION
|
|
53
|
+
#define LCB_VERSION 0x030205
|
|
54
54
|
|
|
55
55
|
/**@brief The SCM revision ID
|
|
56
56
|
* @see LCB_CNTL_CHANGESET
|
|
57
57
|
*/
|
|
58
|
-
#define LCB_VERSION_CHANGESET "
|
|
58
|
+
#define LCB_VERSION_CHANGESET "e4de408c96550b48745b3a142d9827c898d4e96f"
|
|
59
59
|
|
|
60
60
|
/**@brief The client ID
|
|
61
61
|
*/
|