Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A bug-fix for die_on_unsafe_path() when the path doesn't exist.
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
12b88ed
..
afff767
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-92,7
+92,7
@@
int fd_pair(int fd[2])
void print_child_argv(char **cmd)
{
void print_child_argv(char **cmd)
{
- rprintf(F
INFO
, "opening connection using ");
+ rprintf(F
CLIENT
, "opening connection using ");
for (; *cmd; cmd++) {
/* Look for characters that ought to be quoted. This
* is not a great quoting algorithm, but it's
for (; *cmd; cmd++) {
/* Look for characters that ought to be quoted. This
* is not a great quoting algorithm, but it's
@@
-101,23
+101,23
@@
void print_child_argv(char **cmd)
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"
",.-_=+@/") != strlen(*cmd)) {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"
",.-_=+@/") != strlen(*cmd)) {
- rprintf(F
INFO
, "\"%s\" ", *cmd);
+ rprintf(F
CLIENT
, "\"%s\" ", *cmd);
} else {
} else {
- rprintf(F
INFO
, "%s ", *cmd);
+ rprintf(F
CLIENT
, "%s ", *cmd);
}
}
}
}
- rprintf(F
INFO
, "\n");
+ rprintf(F
CLIENT
, "\n");
}
void out_of_memory(char *str)
{
}
void out_of_memory(char *str)
{
- rprintf(FERROR, "ERROR: out of memory in %s
\n", str
);
+ rprintf(FERROR, "ERROR: out of memory in %s
[%s]\n", str, who_am_i()
);
exit_cleanup(RERR_MALLOC);
}
void overflow_exit(char *str)
{
exit_cleanup(RERR_MALLOC);
}
void overflow_exit(char *str)
{
- rprintf(FERROR, "ERROR: buffer overflow in %s
\n", str
);
+ rprintf(FERROR, "ERROR: buffer overflow in %s
[%s]\n", str, who_am_i()
);
exit_cleanup(RERR_MALLOC);
}
exit_cleanup(RERR_MALLOC);
}
@@
-922,7
+922,8
@@
void die_on_unsafe_path(char *path, int strip_filename)
if ((p = strchr(p, '/')) != NULL)
*p = '\0';
if (safe_stat(path, &st) < 0) {
if ((p = strchr(p, '/')) != NULL)
*p = '\0';
if (safe_stat(path, &st) < 0) {
- *p++ = '/';
+ if (p)
+ *p = '/';
goto done;
}
if (S_ISLNK(st.st_mode)) {
goto done;
}
if (S_ISLNK(st.st_mode)) {
@@
-1021,7
+1022,7
@@
char *full_fname(const char *fn)
if (*fn == '/')
p1 = p2 = "";
else {
if (*fn == '/')
p1 = p2 = "";
else {
- p1 = curr_dir;
+ p1 = curr_dir
+ module_dirlen
;
for (p2 = p1; *p2 == '/'; p2++) {}
if (*p2)
p2 = "/";
for (p2 = p1; *p2 == '/'; p2++) {}
if (*p2)
p2 = "/";
@@
-1030,17
+1031,11
@@
char *full_fname(const char *fn)
m1 = " (in ";
m2 = lp_name(module_id);
m3 = ")";
m1 = " (in ";
m2 = lp_name(module_id);
m3 = ")";
- if (p1 == curr_dir) {
- if (!lp_use_chroot(module_id)) {
- char *p = lp_path(module_id);
- if (*p != '/' || p[1])
- p1 += strlen(p);
- }
- }
} else
m1 = m2 = m3 = "";
} else
m1 = m2 = m3 = "";
- asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3);
+ if (asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3) <= 0)
+ out_of_memory("full_fname");
return result;
}
return result;
}