summaryrefslogtreecommitdiff
path: root/src/redis-benchmark.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-05-02 09:48:02 +0200
committerGitHub <noreply@github.com>2019-05-02 09:48:02 +0200
commit0a6090bfd8fbec26f682ff0a1dc7a43699e0c9b7 (patch)
treeea50cee23f70ca24384259ce85a0a2c91ba1e9b3 /src/redis-benchmark.c
parent843de8b786562d8d77c78d83a971060adc61f77a (diff)
parent4e38ced4886446efb70f96685a6a6dfa344095d4 (diff)
downloadredis-0a6090bfd8fbec26f682ff0a1dc7a43699e0c9b7.tar.gz
Merge pull request #6051 from vattezhang/unstable
fix: benchmark auth fails when server have requirepass
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r--src/redis-benchmark.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 2759e6a3c..2785167a8 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -254,6 +254,19 @@ static redisConfig *getRedisConfig(const char *ip, int port,
else fprintf(stderr,"%s: %s\n",hostsocket,err);
goto fail;
}
+
+ if(config.auth){
+ void *authReply = NULL;
+ redisAppendCommand(c, "AUTH %s", config.auth);
+ if (REDIS_OK != redisGetReply(c, &authReply)) goto fail;
+ if (reply) freeReplyObject(reply);
+ reply = ((redisReply *) authReply);
+ if (reply->type == REDIS_REPLY_ERROR) {
+ fprintf(stderr, "ERROR: %s\n", reply->str);
+ goto fail;
+ }
+ }
+
redisAppendCommand(c, "CONFIG GET %s", "save");
redisAppendCommand(c, "CONFIG GET %s", "appendonly");
int i = 0;