Release v2.29.0 #312
+2
-2
@@ -550,7 +550,7 @@ bool delete_extras(const char* dest_root, const ArrayList* manifest) {
|
|||||||
its root-relative form, and one outside the root returns NULL (the walk
|
its root-relative form, and one outside the root returns NULL (the walk
|
||||||
cannot reach it, and it is not protected data beneath the root). Exposed so
|
cannot reach it, and it is not protected data beneath the root). Exposed so
|
||||||
tests can exercise the root-of-"/" child mapping directly. */
|
tests can exercise the root-of-"/" child mapping directly. */
|
||||||
char* file_receive_basis_delete_relative(const Config* config, const char* path) {
|
char* delete_basis_relative(const Config* config, const char* path) {
|
||||||
if (!path)
|
if (!path)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (path[0] != '/')
|
if (path[0] != '/')
|
||||||
@@ -616,7 +616,7 @@ bool delete_skips_build(const Config* config, const ArrayList* protected_paths,
|
|||||||
if (basis_root_relative) {
|
if (basis_root_relative) {
|
||||||
/* An absolute basis outside the receive root is unreachable by this walk,
|
/* An absolute basis outside the receive root is unreachable by this walk,
|
||||||
so it contributes no protection prefix (and no slot). */
|
so it contributes no protection prefix (and no slot). */
|
||||||
char* relative = file_receive_basis_delete_relative(config, config->basis_dirs[i].path);
|
char* relative = delete_basis_relative(config, config->basis_dirs[i].path);
|
||||||
if (!relative)
|
if (!relative)
|
||||||
continue;
|
continue;
|
||||||
out->owned_prefixes[i] = relative;
|
out->owned_prefixes[i] = relative;
|
||||||
|
|||||||
+1
-1
@@ -146,6 +146,6 @@ void delete_skips_free(DeleteSkipSet* set);
|
|||||||
/* Convert one basis-directory path to the receive-root-relative protection
|
/* Convert one basis-directory path to the receive-root-relative protection
|
||||||
prefix the delete walker uses (NULL when it lies outside the root). Exposed
|
prefix the delete walker uses (NULL when it lies outside the root). Exposed
|
||||||
for unit tests of the root-of-"/" and normalization edge cases. */
|
for unit tests of the root-of-"/" and normalization edge cases. */
|
||||||
char* file_receive_basis_delete_relative(const Config* config, const char* path);
|
char* delete_basis_relative(const Config* config, const char* path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-6
@@ -2255,26 +2255,26 @@ static void test_basis_delete_relative_root_slash() {
|
|||||||
EXPECT_NOT_NULL(cfg);
|
EXPECT_NOT_NULL(cfg);
|
||||||
cfg->receive_root_directory = str_dup("/");
|
cfg->receive_root_directory = str_dup("/");
|
||||||
|
|
||||||
char* rel = file_receive_basis_delete_relative(cfg, "/a");
|
char* rel = delete_basis_relative(cfg, "/a");
|
||||||
EXPECT_NOT_NULL(rel);
|
EXPECT_NOT_NULL(rel);
|
||||||
EXPECT_EQ_STR(rel, "a");
|
EXPECT_EQ_STR(rel, "a");
|
||||||
free(rel);
|
free(rel);
|
||||||
rel = file_receive_basis_delete_relative(cfg, "/a/b");
|
rel = delete_basis_relative(cfg, "/a/b");
|
||||||
EXPECT_NOT_NULL(rel);
|
EXPECT_NOT_NULL(rel);
|
||||||
EXPECT_EQ_STR(rel, "a/b");
|
EXPECT_EQ_STR(rel, "a/b");
|
||||||
free(rel);
|
free(rel);
|
||||||
/* The root itself is not a child. */
|
/* The root itself is not a child. */
|
||||||
EXPECT_NULL(file_receive_basis_delete_relative(cfg, "/"));
|
EXPECT_NULL(delete_basis_relative(cfg, "/"));
|
||||||
/* A relative entry is already root-relative. */
|
/* A relative entry is already root-relative. */
|
||||||
rel = file_receive_basis_delete_relative(cfg, "x/y");
|
rel = delete_basis_relative(cfg, "x/y");
|
||||||
EXPECT_NOT_NULL(rel);
|
EXPECT_NOT_NULL(rel);
|
||||||
EXPECT_EQ_STR(rel, "x/y");
|
EXPECT_EQ_STR(rel, "x/y");
|
||||||
free(rel);
|
free(rel);
|
||||||
/* An absolute path outside a non-"/" root is unreachable. */
|
/* An absolute path outside a non-"/" root is unreachable. */
|
||||||
free(cfg->receive_root_directory);
|
free(cfg->receive_root_directory);
|
||||||
cfg->receive_root_directory = str_dup("/root");
|
cfg->receive_root_directory = str_dup("/root");
|
||||||
EXPECT_NULL(file_receive_basis_delete_relative(cfg, "/other/a"));
|
EXPECT_NULL(delete_basis_relative(cfg, "/other/a"));
|
||||||
rel = file_receive_basis_delete_relative(cfg, "/root/a");
|
rel = delete_basis_relative(cfg, "/root/a");
|
||||||
EXPECT_NOT_NULL(rel);
|
EXPECT_NOT_NULL(rel);
|
||||||
EXPECT_EQ_STR(rel, "a");
|
EXPECT_EQ_STR(rel, "a");
|
||||||
free(rel);
|
free(rel);
|
||||||
|
|||||||
Reference in New Issue
Block a user