mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
update(requirepass): behave as redis requirepass (#1996)
* requirepass also updates ACL default user password * update config set requirepass to include the new behaviour * add tests * fix non existent default user when loading empty files
This commit is contained in:
parent
eb50741855
commit
5471827448
4 changed files with 55 additions and 11 deletions
|
@ -678,7 +678,6 @@ void Service::Init(util::AcceptServer* acceptor, std::vector<facade::Listener*>
|
|||
|
||||
config_registry.Register("dbnum"); // equivalent to databases in redis.
|
||||
config_registry.RegisterMutable("dir"); // TODO: to add validation for dir
|
||||
config_registry.RegisterMutable("requirepass");
|
||||
config_registry.RegisterMutable("masterauth");
|
||||
config_registry.RegisterMutable("tcp_keepalive");
|
||||
config_registry.RegisterMutable("replica_partial_sync");
|
||||
|
@ -1238,10 +1237,10 @@ facade::ConnectionContext* Service::CreateContext(util::FiberSocketBase* peer,
|
|||
facade::Connection* owner) {
|
||||
ConnectionContext* res = new ConnectionContext{peer, owner};
|
||||
|
||||
if (owner->IsPrivileged() && !RequirePrivilegedAuth()) {
|
||||
res->req_auth = false;
|
||||
} else {
|
||||
if (owner->IsPrivileged() && RequirePrivilegedAuth()) {
|
||||
res->req_auth = !GetPassword().empty();
|
||||
} else {
|
||||
res->req_auth = !user_registry_.AuthUser("default", "");
|
||||
}
|
||||
|
||||
// a bit of a hack. I set up breaker callback here for the owner.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue