diff options
author | Oran Agra <oran@redislabs.com> | 2022-04-05 14:25:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 14:25:02 +0300 |
commit | fb4e0d400ff82117104bde5296c477ad95f8dd41 (patch) | |
tree | 4ede2d02b134a84ff29bb7398902c398cd4ff454 /tests/modules/auth.c | |
parent | d2b5a579dd8b785690aa7714df8776ffc452d242 (diff) | |
parent | 8b242ef977b88d6cae38d451130a88116bcbb638 (diff) | |
download | redis-7.0-rc3.tar.gz |
Merge pull request #10532 from oranagra/7.0-rc37.0-rc3
Release 7.0 rc3
Diffstat (limited to 'tests/modules/auth.c')
-rw-r--r-- | tests/modules/auth.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/modules/auth.c b/tests/modules/auth.c index 040a447ec..612320dbc 100644 --- a/tests/modules/auth.c +++ b/tests/modules/auth.c @@ -54,6 +54,16 @@ int Auth_AuthRealUser(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { return RedisModule_ReplyWithLongLong(ctx, (uint64_t) client_id); } +/* This command redacts every other arguments and returns OK */ +int Auth_RedactedAPI(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { + REDISMODULE_NOT_USED(argv); + for(int i = argc - 1; i > 0; i -= 2) { + int result = RedisModule_RedactClientCommandArgument(ctx, i); + RedisModule_Assert(result == REDISMODULE_OK); + } + return RedisModule_ReplyWithSimpleString(ctx, "OK"); +} + int Auth_ChangeCount(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { REDISMODULE_NOT_USED(argv); REDISMODULE_NOT_USED(argc); @@ -87,6 +97,10 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) Auth_ChangeCount,"",0,0,0) == REDISMODULE_ERR) return REDISMODULE_ERR; + if (RedisModule_CreateCommand(ctx,"auth.redact", + Auth_RedactedAPI,"",0,0,0) == REDISMODULE_ERR) + return REDISMODULE_ERR; + return REDISMODULE_OK; } |