mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-21 05:14:15 -04:00
Avoid crash of transfer logging w/default log format.
This commit is contained in:
1 parent
7a413c9722
commit
317beebef8
3 files changed
+17
-11
No files matched your search
@@ -8,6 +8,9 @@ Protocol: 31 (unchanged)
|
||||
|
||||
### BUG FIXES:
|
||||
|
||||
- Avoid a crash when a daemon module enables `transfer logging` without
|
||||
setting a `log format` value.
|
||||
|
||||
- Fixed installing rsync-ssl script from an alternate build dir.
|
||||
|
||||
- Fixed the updating of configure.sh from an alternate build dir.
|
||||
|
||||
+9
-10
@@ -463,25 +463,25 @@ void reset_daemon_vars(void)
|
||||
|
||||
/* Expand %VAR% references. Any unknown vars or unrecognized
|
||||
* syntax leaves the raw chars unchanged. */
|
||||
static char *expand_vars(char *str)
|
||||
static char *expand_vars(const char *str)
|
||||
{
|
||||
char *buf, *t, *f;
|
||||
char *buf, *t;
|
||||
const char *f;
|
||||
int bufsize;
|
||||
|
||||
if (!str || !strchr(str, '%'))
|
||||
return str;
|
||||
return (char *)str; /* TODO change return value to const char* at some point. */
|
||||
|
||||
bufsize = strlen(str) + 2048;
|
||||
buf = new_array(char, bufsize+1); /* +1 for trailing '\0' */
|
||||
|
||||
for (t = buf, f = str; bufsize && *f; ) {
|
||||
if (*f == '%' && *++f != '%') {
|
||||
char *percent = strchr(f, '%');
|
||||
if (percent) {
|
||||
if (*f == '%' && isUpper(f+1)) {
|
||||
char *percent = strchr(f+1, '%');
|
||||
if (percent && percent - f < bufsize) {
|
||||
char *val;
|
||||
*percent = '\0';
|
||||
val = getenv(f);
|
||||
*percent = '%';
|
||||
strlcpy(t, f+1, percent - f);
|
||||
val = getenv(t);
|
||||
if (val) {
|
||||
int len = strlcpy(t, val, bufsize+1);
|
||||
if (len > bufsize)
|
||||
@@ -492,7 +492,6 @@ static char *expand_vars(char *str)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
f--;
|
||||
}
|
||||
*t++ = *f++;
|
||||
bufsize--;
|
||||
|
||||
+5
-1
@@ -297,8 +297,9 @@ use chroot = no
|
||||
munge symlinks = no
|
||||
hosts allow = localhost 127.0.0.0/24 192.168.0.0/16 10.0.0.0/8 $hostname
|
||||
log file = $logfile
|
||||
log format = %i %h [%a] %m (%u) %l %f%L
|
||||
transfer logging = yes
|
||||
# We don't define log format here so that the test-hidden module will default
|
||||
# to the internal static string (since we had a crash trying to tweak it).
|
||||
exclude = ? foobar.baz
|
||||
max verbosity = 4
|
||||
$uid_setting
|
||||
@@ -306,16 +307,19 @@ $gid_setting
|
||||
|
||||
[test-from]
|
||||
path = $fromdir
|
||||
log format = %i %h [%a] %m (%u) %l %f%L
|
||||
read only = yes
|
||||
comment = r/o
|
||||
|
||||
[test-to]
|
||||
path = $todir
|
||||
log format = %i %h [%a] %m (%u) %l %f%L
|
||||
read only = no
|
||||
comment = r/w
|
||||
|
||||
[test-scratch]
|
||||
path = $scratchdir
|
||||
log format = %i %h [%a] %m (%u) %l %f%L
|
||||
read only = no
|
||||
|
||||
[test-hidden]
|
||||
|
||||
Reference in new issue
Block a user