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
1b10522a
Commit
1b10522a
authored
Jul 02, 2013
by
antirez
Browse files
Only allow basenames for dbfilename and appendfilename.
This fixes issue #1094.
parent
6978aeb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
1b10522a
...
@@ -306,6 +306,10 @@ void loadServerConfigFromString(char *config) {
...
@@ -306,6 +306,10 @@ void loadServerConfigFromString(char *config) {
}
}
server
.
aof_state
=
yes
?
REDIS_AOF_ON
:
REDIS_AOF_OFF
;
server
.
aof_state
=
yes
?
REDIS_AOF_ON
:
REDIS_AOF_OFF
;
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"appendfilename"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"appendfilename"
)
&&
argc
==
2
)
{
if
(
!
pathIsBaseName
(
argv
[
1
]))
{
err
=
"appendfilename can't be a path, just a filename"
;
goto
loaderr
;
}
zfree
(
server
.
aof_filename
);
zfree
(
server
.
aof_filename
);
server
.
aof_filename
=
zstrdup
(
argv
[
1
]);
server
.
aof_filename
=
zstrdup
(
argv
[
1
]);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"no-appendfsync-on-rewrite"
)
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"no-appendfsync-on-rewrite"
)
...
@@ -352,6 +356,10 @@ void loadServerConfigFromString(char *config) {
...
@@ -352,6 +356,10 @@ void loadServerConfigFromString(char *config) {
zfree
(
server
.
pidfile
);
zfree
(
server
.
pidfile
);
server
.
pidfile
=
zstrdup
(
argv
[
1
]);
server
.
pidfile
=
zstrdup
(
argv
[
1
]);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"dbfilename"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"dbfilename"
)
&&
argc
==
2
)
{
if
(
!
pathIsBaseName
(
argv
[
1
]))
{
err
=
"dbfilename can't be a path, just a filename"
;
goto
loaderr
;
}
zfree
(
server
.
rdb_filename
);
zfree
(
server
.
rdb_filename
);
server
.
rdb_filename
=
zstrdup
(
argv
[
1
]);
server
.
rdb_filename
=
zstrdup
(
argv
[
1
]);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-entries"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-entries"
)
&&
argc
==
2
)
{
...
@@ -540,6 +548,10 @@ void configSetCommand(redisClient *c) {
...
@@ -540,6 +548,10 @@ void configSetCommand(redisClient *c) {
o
=
c
->
argv
[
3
];
o
=
c
->
argv
[
3
];
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"dbfilename"
))
{
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"dbfilename"
))
{
if
(
!
pathIsBaseName
(
o
->
ptr
))
{
addReplyError
(
c
,
"dbfilename can't be a path, just a filename"
);
return
;
}
zfree
(
server
.
rdb_filename
);
zfree
(
server
.
rdb_filename
);
server
.
rdb_filename
=
zstrdup
(
o
->
ptr
);
server
.
rdb_filename
=
zstrdup
(
o
->
ptr
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"requirepass"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"requirepass"
))
{
...
...
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