"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/redis-cli.c" between
redis-6.2-rc3.tar.gz and redis-6.2.0.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

redis-cli.c  (redis-6.2-rc3):redis-cli.c  (redis-6.2.0)
skipping to change at line 1696 skipping to change at line 1696
} else if (!strcmp(argv[i],"--cacertdir") && !lastarg) { } else if (!strcmp(argv[i],"--cacertdir") && !lastarg) {
config.sslconfig.cacertdir = argv[++i]; config.sslconfig.cacertdir = argv[++i];
} else if (!strcmp(argv[i],"--cacert") && !lastarg) { } else if (!strcmp(argv[i],"--cacert") && !lastarg) {
config.sslconfig.cacert = argv[++i]; config.sslconfig.cacert = argv[++i];
} else if (!strcmp(argv[i],"--cert") && !lastarg) { } else if (!strcmp(argv[i],"--cert") && !lastarg) {
config.sslconfig.cert = argv[++i]; config.sslconfig.cert = argv[++i];
} else if (!strcmp(argv[i],"--key") && !lastarg) { } else if (!strcmp(argv[i],"--key") && !lastarg) {
config.sslconfig.key = argv[++i]; config.sslconfig.key = argv[++i];
} else if (!strcmp(argv[i],"--tls-ciphers") && !lastarg) { } else if (!strcmp(argv[i],"--tls-ciphers") && !lastarg) {
config.sslconfig.ciphers = argv[++i]; config.sslconfig.ciphers = argv[++i];
} else if (!strcmp(argv[i],"--insecure")) {
config.sslconfig.skip_cert_verify = 1;
#ifdef TLS1_3_VERSION #ifdef TLS1_3_VERSION
} else if (!strcmp(argv[i],"--tls-ciphersuites") && !lastarg) { } else if (!strcmp(argv[i],"--tls-ciphersuites") && !lastarg) {
config.sslconfig.ciphersuites = argv[++i]; config.sslconfig.ciphersuites = argv[++i];
#endif #endif
#endif #endif
} else if (!strcmp(argv[i],"-v") || !strcmp(argv[i], "--version")) { } else if (!strcmp(argv[i],"-v") || !strcmp(argv[i], "--version")) {
sds version = cliVersion(); sds version = cliVersion();
printf("redis-cli %s\n", version); printf("redis-cli %s\n", version);
sdsfree(version); sdsfree(version);
exit(0); exit(0);
skipping to change at line 1821 skipping to change at line 1823
" -D <delimiter> Delimiter between responses for raw formatting (default: \ \n).\n" " -D <delimiter> Delimiter between responses for raw formatting (default: \ \n).\n"
" -c Enable cluster mode (follow -ASK and -MOVED redirections). \n" " -c Enable cluster mode (follow -ASK and -MOVED redirections). \n"
" -e Return exit error code when command execution fails.\n" " -e Return exit error code when command execution fails.\n"
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
" --tls Establish a secure TLS connection.\n" " --tls Establish a secure TLS connection.\n"
" --sni <host> Server name indication for TLS.\n" " --sni <host> Server name indication for TLS.\n"
" --cacert <file> CA Certificate file to verify with.\n" " --cacert <file> CA Certificate file to verify with.\n"
" --cacertdir <dir> Directory where trusted CA certificates are stored.\n" " --cacertdir <dir> Directory where trusted CA certificates are stored.\n"
" If neither cacert nor cacertdir are specified, the default \n" " If neither cacert nor cacertdir are specified, the default \n"
" system-wide trusted root certs configuration will apply.\n " " system-wide trusted root certs configuration will apply.\n "
" --insecure Allow insecure TLS connection by skipping cert validation. \n"
" --cert <file> Client certificate to authenticate with.\n" " --cert <file> Client certificate to authenticate with.\n"
" --key <file> Private key file to authenticate with.\n" " --key <file> Private key file to authenticate with.\n"
" --tls-ciphers <list> Sets the list of prefered ciphers (TLSv1.2 and below)\n" " --tls-ciphers <list> Sets the list of prefered ciphers (TLSv1.2 and below)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about t he syntax of this string.\n" " See the ciphers(1ssl) manpage for more information about t he syntax of this string.\n"
#ifdef TLS1_3_VERSION #ifdef TLS1_3_VERSION
" --tls-ciphersuites <list> Sets the list of prefered ciphersuites (TLSv1.3)\n" " --tls-ciphersuites <list> Sets the list of prefered ciphersuites (TLSv1.3)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about t he syntax of this string,\n" " See the ciphers(1ssl) manpage for more information about t he syntax of this string,\n"
" and specifically for TLSv1.3 ciphersuites.\n" " and specifically for TLSv1.3 ciphersuites.\n"
skipping to change at line 1927 skipping to change at line 1930
printf("%s (type 'yes' to accept): ", msg); printf("%s (type 'yes' to accept): ", msg);
fflush(stdout); fflush(stdout);
char buf[4]; char buf[4];
int nread = read(fileno(stdin),buf,4); int nread = read(fileno(stdin),buf,4);
buf[3] = '\0'; buf[3] = '\0';
return (nread != 0 && !strcmp("yes", buf)); return (nread != 0 && !strcmp("yes", buf));
} }
/* Turn the plain C strings into Sds strings */ /* Turn the plain C strings into Sds strings */
static char **convertToSds(int count, char** args) { static char **convertToSds(int count, char** args) {
int j; int j;
char **sds = zmalloc(sizeof(char*)*count); char **sds = zmalloc(sizeof(char*)*count);
for(j = 0; j < count; j++) for(j = 0; j < count; j++)
sds[j] = sdsnew(args[j]); sds[j] = sdsnew(args[j]);
return sds; return sds;
}
static void freeConvertedSds(int count, char **sds) {
int j;
for (j = 0; j < count; j++)
sdsfree(sds[j]);
zfree(sds);
} }
static int issueCommandRepeat(int argc, char **argv, long repeat) { static int issueCommandRepeat(int argc, char **argv, long repeat) {
while (1) { while (1) {
config.cluster_reissue_command = 0; config.cluster_reissue_command = 0;
if (cliSendCommand(argc,argv,repeat) != REDIS_OK) { if (cliSendCommand(argc,argv,repeat) != REDIS_OK) {
cliConnect(CC_FORCE); cliConnect(CC_FORCE);
/* If we still cannot send the command print error. /* If we still cannot send the command print error.
* We'll try to reconnect the next time. */ * We'll try to reconnect the next time. */
skipping to change at line 2166 skipping to change at line 2176
sdsfreesplitres(argv,argc); sdsfreesplitres(argv,argc);
} }
/* linenoise() returns malloc-ed lines like readline() */ /* linenoise() returns malloc-ed lines like readline() */
linenoiseFree(line); linenoiseFree(line);
} }
exit(0); exit(0);
} }
static int noninteractive(int argc, char **argv) { static int noninteractive(int argc, char **argv) {
int retval = 0; int retval = 0;
argv = convertToSds(argc, argv);
if (config.stdinarg) { if (config.stdinarg) {
argv = zrealloc(argv, (argc+1)*sizeof(char*)); argv = zrealloc(argv, (argc+1)*sizeof(char*));
argv[argc] = readArgFromStdin(); argv[argc] = readArgFromStdin();
retval = issueCommand(argc+1, argv); retval = issueCommand(argc+1, argv);
sdsfree(argv[argc]);
} else { } else {
retval = issueCommand(argc, argv); retval = issueCommand(argc, argv);
} }
freeConvertedSds(argc, argv);
return retval; return retval;
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Eval mode * Eval mode
*--------------------------------------------------------------------------- */ *--------------------------------------------------------------------------- */
static int evalMode(int argc, char **argv) { static int evalMode(int argc, char **argv) {
sds script = NULL; sds script = NULL;
FILE *fp; FILE *fp;
skipping to change at line 8129 skipping to change at line 8143
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Program main() * Program main()
*--------------------------------------------------------------------------- */ *--------------------------------------------------------------------------- */
int main(int argc, char **argv) { int main(int argc, char **argv) {
int firstarg; int firstarg;
struct timeval tv; struct timeval tv;
memset(&config.sslconfig, 0, sizeof(config.sslconfig));
config.hostip = sdsnew("127.0.0.1"); config.hostip = sdsnew("127.0.0.1");
config.hostport = 6379; config.hostport = 6379;
config.hostsocket = NULL; config.hostsocket = NULL;
config.repeat = 1; config.repeat = 1;
config.interval = 0; config.interval = 0;
config.dbnum = 0; config.dbnum = 0;
config.interactive = 0; config.interactive = 0;
config.shutdown = 0; config.shutdown = 0;
config.monitor_mode = 0; config.monitor_mode = 0;
config.pubsub_mode = 0; config.pubsub_mode = 0;
skipping to change at line 8325 skipping to change at line 8340
* A new attempt will be performed for every command send. */ * A new attempt will be performed for every command send. */
cliConnect(0); cliConnect(0);
repl(); repl();
} }
/* Otherwise, we have some arguments to execute */ /* Otherwise, we have some arguments to execute */
if (cliConnect(0) != REDIS_OK) exit(1); if (cliConnect(0) != REDIS_OK) exit(1);
if (config.eval) { if (config.eval) {
return evalMode(argc,argv); return evalMode(argc,argv);
} else { } else {
return noninteractive(argc,convertToSds(argc,argv)); return noninteractive(argc,argv);
} }
} }
 End of changes. 10 change blocks. 
6 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)