diff --git a/src/module.c b/src/module.c index bfe7d6886..65d22b713 100644 --- a/src/module.c +++ b/src/module.c @@ -5638,6 +5638,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;