Skip to content

Commit 2668563

Browse files
committed
MB-44777: Remove support for legacy bucket users
The old bucket password is gone and it is no longer possible to set a password for the bucket. The logic in for authentication in memcached does no longer need to try to look for users with the ';legacy' part in the username. Change-Id: Ib4444b479824692688de5568c7169d68479c5be5 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/148654 Reviewed-by: Dave Rigby <[email protected]> Tested-by: Trond Norbye <[email protected]>
1 parent c3fc516 commit 2668563

File tree

7 files changed

+1
-173
lines changed

7 files changed

+1
-173
lines changed

cbsasl/plain/plain.cc

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,6 @@
1919

2020
namespace cb::sasl::mechanism::plain {
2121

22-
/**
23-
* ns_server creates a legacy bucket user as part of the upgrade
24-
* process which is used by the XDCR clients when they connect
25-
* to they system. These clients _always_ connect by using PLAIN
26-
* authentication so we should look up and try those users first.
27-
* If it exists and we have a matching password we're good to go,
28-
* otherwise we'll have to try the "normal" user.
29-
*/
30-
bool ServerBackend::try_legacy_user(const std::string& password) {
31-
const std::string lecacy_username{username + ";legacy"};
32-
cb::sasl::pwdb::User user;
33-
if (!find_user(lecacy_username, user)) {
34-
return false;
35-
}
36-
37-
if (cb::sasl::plain::check_password(&context, user, password) ==
38-
Error::OK) {
39-
username.assign(lecacy_username);
40-
return true;
41-
}
42-
43-
return false;
44-
}
45-
4622
std::pair<Error, std::string_view> ServerBackend::start(
4723
std::string_view input) {
4824
if (input.empty()) {
@@ -81,10 +57,6 @@ std::pair<Error, std::string_view> ServerBackend::start(
8157
this->username.assign(username);
8258
const std::string userpw(password, pwlen);
8359

84-
if (try_legacy_user(userpw)) {
85-
return std::make_pair<Error, std::string_view>(Error::OK, {});
86-
}
87-
8860
cb::sasl::pwdb::User user;
8961
if (!find_user(username, user)) {
9062
return std::pair<Error, std::string_view>{Error::NO_USER, {}};

cbsasl/plain/plain.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ class ServerBackend : public server::MechanismBackend {
3030
std::string getName() const override {
3131
return "PLAIN";
3232
}
33-
34-
protected:
35-
bool try_legacy_user(const std::string& password);
3633
};
3734

3835
class ClientBackend : public client::MechanismBackend {

daemon/protocol/mcbp/sasl_auth_command_context.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ cb::engine_errc SaslAuthCommandContext::tryHandleSaslOk(
7474

7575
/* associate the connection with the appropriate bucket */
7676
{
77-
std::string username = connection.getUser().name;
78-
auto idx = username.find(";legacy");
79-
if (idx != username.npos) {
80-
username.resize(idx);
81-
}
82-
77+
const auto username = connection.getUser().name;
8378
if (mayAccessBucket(cookie, username)) {
8479
associate_bucket(cookie, username.c_str());
8580
// Auth succeeded but the connection may not be valid for the

tests/testapp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ set(memcached_testapp_SOURCES
5050
testapp_interfaces.cc
5151
testapp_ioctl.cc
5252
testapp_ipv6.cc
53-
testapp_legacy_users.cc
5453
testapp_lock.cc
5554
testapp_logging.cc
5655
testapp_maxconn.cc

tests/testapp/cbsaslpw.json

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,6 @@
152152
"i": 10
153153
}
154154
}, {
155-
"n": "legacy;legacy",
156-
"plain": "yvB+y0qzqfNCXbkuzuiXf52okTZWNVJy8rQTnHqF+QdzLLLl"
157-
}, {
158-
"n": "legacy",
159-
"plain": "LWO8xng2gjJ5QbRHCrL6Adg+87yzK8vseSKRGTLEKU3iUsh7",
160-
"sha1": {
161-
"h": "yfhDxQJW/qY9pnjbVZHQ/HUtFEM=",
162-
"s": "PwICG3Sauqikl6j6i2l1S1Rzw+0=",
163-
"i": 10
164-
},
165-
"sha256": {
166-
"h": "SG0NvatYEvxJSeap0GsA64h3JidPy3daJedOu2oyBGI=",
167-
"s": "amVllupY5Ft5zHRJ2gzqi+rGwQhbEjc3CKPd6M+1SDo=",
168-
"i": 10
169-
},
170-
"sha512": {
171-
"h": "3PCq8SshbcAanC7kbpnC6eQxYUFCAmV0rLNj0fIGx0rk/O4DjCqVMBfnC/CB7ADTV4qFrdh0RZnFBz/WVntjEQ==",
172-
"s": "7gnuoQjA4xIzAf5LB9mEy/PzdieJqgSyT6rIp09bn6jWFxUdLYw9MmmowOMsFnbLk+NSPcIJeURLWajkVrrqiQ==",
173-
"i": 10
174-
}
175-
},
176-
{
177155
"n": "default",
178156
"plain": "x7ZPbYpo05MCE6QzC+AIEPLL9XjKZpyLcLX+Xc7+eTEFV9P2"
179157
}

tests/testapp/rbac.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,5 @@
113113
"all"
114114
],
115115
"domain": "local"
116-
},
117-
"legacy;legacy": {
118-
"buckets": {
119-
"default": [
120-
"all"
121-
]
122-
},
123-
"domain": "local"
124-
},
125-
"legacy": {
126-
"buckets": {
127-
"default": [
128-
"all"
129-
]
130-
},
131-
"domain": "local"
132116
}
133117
}

tests/testapp/testapp_legacy_users.cc

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)