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
aa5eaad4
Unverified
Commit
aa5eaad4
authored
Jun 26, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 26, 2018
Browse files
Merge pull request #5037 from madolson/repl-auth-fix
Fixed replication authentication with whitespace password
parents
3cf8dd2c
45731edc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
aa5eaad4
...
@@ -1315,23 +1315,30 @@ error:
...
@@ -1315,23 +1315,30 @@ error:
#define SYNC_CMD_FULL (SYNC_CMD_READ|SYNC_CMD_WRITE)
#define SYNC_CMD_FULL (SYNC_CMD_READ|SYNC_CMD_WRITE)
char
*
sendSynchronousCommand
(
int
flags
,
int
fd
,
...)
{
char
*
sendSynchronousCommand
(
int
flags
,
int
fd
,
...)
{
/* Create the command to send to the master, we use simple inline
/* Create the command to send to the master, we use redis binary
* protocol for simplicity as currently we only send simple strings. */
* protocol to make sure correct arguments are sent. This function
* is not safe for all binary data. */
if
(
flags
&
SYNC_CMD_WRITE
)
{
if
(
flags
&
SYNC_CMD_WRITE
)
{
char
*
arg
;
char
*
arg
;
va_list
ap
;
va_list
ap
;
sds
cmd
=
sdsempty
();
sds
cmd
=
sdsempty
();
sds
cmdargs
=
sdsempty
();
int
argslen
=
0
;
va_start
(
ap
,
fd
);
va_start
(
ap
,
fd
);
while
(
1
)
{
while
(
1
)
{
arg
=
va_arg
(
ap
,
char
*
);
arg
=
va_arg
(
ap
,
char
*
);
if
(
arg
==
NULL
)
break
;
if
(
arg
==
NULL
)
break
;
if
(
sdslen
(
cmd
)
!=
0
)
cmd
=
sdscatlen
(
cmd
,
" "
,
1
);
cmdargs
=
sdscatprintf
(
cmdargs
,
"$%zu
\r\n
%s
\r\n
"
,
strlen
(
arg
),
arg
);
cmd
=
sdscat
(
cmd
,
arg
)
;
argslen
++
;
}
}
cmd
=
sdscatlen
(
cmd
,
"
\r\n
"
,
2
);
va_end
(
ap
);
va_end
(
ap
);
cmd
=
sdscatprintf
(
cmd
,
"*%zu
\r\n
"
,
argslen
);
cmd
=
sdscatsds
(
cmd
,
cmdargs
);
sdsfree
(
cmdargs
);
/* Transfer command to the server. */
/* Transfer command to the server. */
if
(
syncWrite
(
fd
,
cmd
,
sdslen
(
cmd
),
server
.
repl_syncio_timeout
*
1000
)
if
(
syncWrite
(
fd
,
cmd
,
sdslen
(
cmd
),
server
.
repl_syncio_timeout
*
1000
)
...
...
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