Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
a4ef94d2
Unverified
Commit
a4ef94d2
authored
Jun 29, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 29, 2018
Browse files
Merge pull request #5076 from 0xtonyxia/add-no-auth-warning-option
Add no auth warning option
parents
5baf50d8
9f185626
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
a4ef94d2
...
@@ -220,6 +220,7 @@ static struct config {
...
@@ -220,6 +220,7 @@ static struct config {
int
last_cmd_type
;
int
last_cmd_type
;
int
verbose
;
int
verbose
;
clusterManagerCommand
cluster_manager_command
;
clusterManagerCommand
cluster_manager_command
;
int
no_auth_warning
;
}
config
;
}
config
;
/* User preferences. */
/* User preferences. */
...
@@ -1235,8 +1236,9 @@ static int parseOptions(int argc, char **argv) {
...
@@ -1235,8 +1236,9 @@ static int parseOptions(int argc, char **argv) {
config
.
interval
=
seconds
*
1000000
;
config
.
interval
=
seconds
*
1000000
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-n"
)
&&
!
lastarg
)
{
}
else
if
(
!
strcmp
(
argv
[
i
],
"-n"
)
&&
!
lastarg
)
{
config
.
dbnum
=
atoi
(
argv
[
++
i
]);
config
.
dbnum
=
atoi
(
argv
[
++
i
]);
}
else
if
(
!
strcmp
(
argv
[
i
],
"--no-auth-warning"
))
{
config
.
no_auth_warning
=
1
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-a"
)
&&
!
lastarg
)
{
}
else
if
(
!
strcmp
(
argv
[
i
],
"-a"
)
&&
!
lastarg
)
{
fputs
(
"Warning: Using a password with '-a' option on the command line interface may not be safe.
\n
"
,
stderr
);
config
.
auth
=
argv
[
++
i
];
config
.
auth
=
argv
[
++
i
];
}
else
if
(
!
strcmp
(
argv
[
i
],
"-u"
)
&&
!
lastarg
)
{
}
else
if
(
!
strcmp
(
argv
[
i
],
"-u"
)
&&
!
lastarg
)
{
parseRedisUri
(
argv
[
++
i
]);
parseRedisUri
(
argv
[
++
i
]);
...
@@ -1387,6 +1389,12 @@ static int parseOptions(int argc, char **argv) {
...
@@ -1387,6 +1389,12 @@ static int parseOptions(int argc, char **argv) {
fprintf
(
stderr
,
"Try %s --help for more information.
\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
"Try %s --help for more information.
\n
"
,
argv
[
0
]);
exit
(
1
);
exit
(
1
);
}
}
if
(
!
config
.
no_auth_warning
&&
config
.
auth
!=
NULL
)
{
fputs
(
"Warning: Using a password with '-a' or '-u' option on the command"
" line interface may not be safe.
\n
"
,
stderr
);
}
return
i
;
return
i
;
}
}
...
@@ -1463,9 +1471,14 @@ static void usage(void) {
...
@@ -1463,9 +1471,14 @@ static void usage(void) {
" --cluster <command> [args...] [opts...]
\n
"
" --cluster <command> [args...] [opts...]
\n
"
" Cluster Manager command and arguments (see below).
\n
"
" Cluster Manager command and arguments (see below).
\n
"
" --verbose Verbose mode.
\n
"
" --verbose Verbose mode.
\n
"
" --no-auth-warning Don't show warning message when using password on command
\n
"
" line interface.
\n
"
" --help Output this help and exit.
\n
"
" --help Output this help and exit.
\n
"
" --version Output version and exit.
\n
"
" --version Output version and exit.
\n
"
"
\n
"
"
\n
"
,
version
,
REDIS_CLI_DEFAULT_PIPE_TIMEOUT
);
/* Using another fprintf call to avoid -Woverlength-strings compile warning */
fprintf
(
stderr
,
"Cluster Manager Commands:
\n
"
"Cluster Manager Commands:
\n
"
" Use --cluster help to list all available cluster manager commands.
\n
"
" Use --cluster help to list all available cluster manager commands.
\n
"
"
\n
"
"
\n
"
...
@@ -1482,8 +1495,7 @@ static void usage(void) {
...
@@ -1482,8 +1495,7 @@ static void usage(void) {
"When no command is given, redis-cli starts in interactive mode.
\n
"
"When no command is given, redis-cli starts in interactive mode.
\n
"
"Type
\"
help
\"
in interactive mode for information on available commands
\n
"
"Type
\"
help
\"
in interactive mode for information on available commands
\n
"
"and settings.
\n
"
"and settings.
\n
"
"
\n
"
,
"
\n
"
);
version
,
REDIS_CLI_DEFAULT_PIPE_TIMEOUT
);
sdsfree
(
version
);
sdsfree
(
version
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -4855,7 +4867,7 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
...
@@ -4855,7 +4867,7 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
}
}
/* Calculate the slots balance for each node. It's the number of
/* Calculate the slots balance for each node. It's the number of
* slots the node should lose (if positive) or gain (if negative)
* slots the node should lose (if positive) or gain (if negative)
* in order to be balanced. */
* in order to be balanced. */
int
threshold_reached
=
0
,
total_balance
=
0
;
int
threshold_reached
=
0
,
total_balance
=
0
;
float
threshold
=
config
.
cluster_manager_command
.
threshold
;
float
threshold
=
config
.
cluster_manager_command
.
threshold
;
i
=
0
;
i
=
0
;
...
@@ -4867,9 +4879,9 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
...
@@ -4867,9 +4879,9 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
n
->
weight
);
n
->
weight
);
n
->
balance
=
n
->
slots_count
-
expected
;
n
->
balance
=
n
->
slots_count
-
expected
;
total_balance
+=
n
->
balance
;
total_balance
+=
n
->
balance
;
/* Compute the percentage of difference between the
/* Compute the percentage of difference between the
* expected number of slots and the real one, to see
* expected number of slots and the real one, to see
* if it's over the threshold specified by the user. */
* if it's over the threshold specified by the user. */
int
over_threshold
=
0
;
int
over_threshold
=
0
;
if
(
threshold
>
0
)
{
if
(
threshold
>
0
)
{
if
(
n
->
slots_count
>
0
)
{
if
(
n
->
slots_count
>
0
)
{
...
@@ -6551,6 +6563,7 @@ int main(int argc, char **argv) {
...
@@ -6551,6 +6563,7 @@ int main(int argc, char **argv) {
config
.
enable_ldb_on_eval
=
0
;
config
.
enable_ldb_on_eval
=
0
;
config
.
last_cmd_type
=
-
1
;
config
.
last_cmd_type
=
-
1
;
config
.
verbose
=
0
;
config
.
verbose
=
0
;
config
.
no_auth_warning
=
0
;
config
.
cluster_manager_command
.
name
=
NULL
;
config
.
cluster_manager_command
.
name
=
NULL
;
config
.
cluster_manager_command
.
argc
=
0
;
config
.
cluster_manager_command
.
argc
=
0
;
config
.
cluster_manager_command
.
argv
=
NULL
;
config
.
cluster_manager_command
.
argv
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment