summaryrefslogtreecommitdiff
path: root/tests/modules/auth.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-04-05 14:25:02 +0300
committerGitHub <noreply@github.com>2022-04-05 14:25:02 +0300
commitfb4e0d400ff82117104bde5296c477ad95f8dd41 (patch)
tree4ede2d02b134a84ff29bb7398902c398cd4ff454 /tests/modules/auth.c
parentd2b5a579dd8b785690aa7714df8776ffc452d242 (diff)
parent8b242ef977b88d6cae38d451130a88116bcbb638 (diff)
downloadredis-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.c14
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;
}