diff options
author | vattezhang <vattezhang@163.com> | 2019-02-18 22:48:55 +0800 |
---|---|---|
committer | vattezhang <vattezhang@163.com> | 2019-02-18 22:48:55 +0800 |
commit | 4cc43a96f67e155a3526a29816510536ef9380c7 (patch) | |
tree | 3cedb5c95c5650069c3142cb3ebb9cd8649494df /src/redis-benchmark.c | |
parent | e6948b8f2847896d3c6443744a53f7c3f79a1984 (diff) | |
download | redis-4cc43a96f67e155a3526a29816510536ef9380c7.tar.gz |
benchmark: add auth check in benchmark
When we run benchmark but forget to set the right requirepass, benchmark should return error.
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r-- | src/redis-benchmark.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 31f91eb0f..4f0f3404a 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -204,6 +204,12 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) { if (redisBufferRead(c->context) != REDIS_OK) { fprintf(stderr,"Error: %s\n",c->context->errstr); exit(1); + } + else if (strlen(c->context->reader->buf)>=32 + && !strncmp(c->context->reader->buf,"-NOAUTH Authentication required.", 32)) + { + fprintf(stderr,"Error: %s\n",c->context->reader->buf); + exit(1); } else { while(c->pending) { if (redisGetReply(c->context,&reply) != REDIS_OK) { |