MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cliAuth

Function cliAuth

app/redis-6.2.6/src/redis-cli.c:789–810  ·  view source on GitHub ↗

Send AUTH command to the server */

Source from the content-addressed store, hash-verified

787
788/* Send AUTH command to the server */
789static int cliAuth(redisContext *ctx, char *user, char *auth) {
790 redisReply *reply;
791 if (auth == NULL) return REDIS_OK;
792
793 if (user == NULL)
794 reply = redisCommand(ctx,"AUTH %s",auth);
795 else
796 reply = redisCommand(ctx,"AUTH %s %s",user,auth);
797
798 if (reply == NULL) {
799 fprintf(stderr, "\nI/O error\n");
800 return REDIS_ERR;
801 }
802
803 int result = REDIS_OK;
804 if (reply->type == REDIS_REPLY_ERROR) {
805 result = REDIS_ERR;
806 fprintf(stderr, "AUTH failed: %s\n", reply->str);
807 }
808 freeReplyObject(reply);
809 return result;
810}
811
812/* Send SELECT input_dbnum to the server */
813static int cliSelect(void) {

Callers 2

cliConnectFunction · 0.85

Calls 2

freeReplyObjectFunction · 0.85
redisCommandClass · 0.70

Tested by

no test coverage detected