diff --git a/src/module.c b/src/module.c index 2de7f60ed..615a5223f 100644 --- a/src/module.c +++ b/src/module.c @@ -5639,6 +5639,11 @@ static int authenticateClientWithUser(RedisModuleCtx *ctx, user *user, RedisModu return REDISMODULE_ERR; } + /* Avoid settings which are meaningless and will be lost */ + if (!ctx->client || (ctx->client->flags & CLIENT_MODULE)) { + return REDISMODULE_ERR; + } + moduleNotifyUserChanged(ctx->client); ctx->client->user = user;