Commit e83d6b0c authored by Yossi Gottlieb's avatar Yossi Gottlieb Committed by Oran Agra
Browse files

Module API: Fail ineffective auth calls.

The client pointed to by the module context may in some cases be a fake
client. RM_Authenticate*() calls in this case would be ineffective but
appear to succeed, and this change fails them to make it easier to catch
such cases.

(cherry picked from commit cfccfbd6)
parent cb070acc
...@@ -5638,6 +5638,11 @@ static int authenticateClientWithUser(RedisModuleCtx *ctx, user *user, RedisModu ...@@ -5638,6 +5638,11 @@ static int authenticateClientWithUser(RedisModuleCtx *ctx, user *user, RedisModu
return REDISMODULE_ERR; 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); moduleNotifyUserChanged(ctx->client);
ctx->client->user = user; ctx->client->user = user;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment