MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / cliAuth

Function cliAuth

src/redis-cli.c:596–617  ·  view source on GitHub ↗

Send AUTH command to the server */

Source from the content-addressed store, hash-verified

594
595/* Send AUTH command to the server */
596static int cliAuth(redisContext *ctx, char *user, char *auth) {
597 redisReply *reply;
598 if (auth == NULL) return REDIS_OK;
599
600 if (user == NULL)
601 reply = redisCommand(ctx,"AUTH %s",auth);
602 else
603 reply = redisCommand(ctx,"AUTH %s %s",user,auth);
604
605 if (reply == NULL) {
606 fprintf(stderr, "\nI/O error\n");
607 return REDIS_ERR;
608 }
609
610 int result = REDIS_OK;
611 if (reply->type == REDIS_REPLY_ERROR) {
612 result = REDIS_ERR;
613 fprintf(stderr, "AUTH failed: %s\n", reply->str);
614 }
615 freeReplyObject(reply);
616 return result;
617}
618
619/* Send SELECT input_dbnum to the server */
620static int cliSelect(void) {

Callers 2

cliConnectFunction · 0.85

Calls 2

freeReplyObjectFunction · 0.85
redisCommandClass · 0.70

Tested by

no test coverage detected