From efbaf8132d09a6bd26b64556291a7ff62fd413b9 Mon Sep 17 00:00:00 2001 From: midipix Date: May 23 2020 05:59:02 +0000 Subject: driver: --strict-path-input, --pure-path-output: initial support. --- diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h index a06a1e5..059dbac 100644 --- a/include/tpax/tpax.h +++ b/include/tpax/tpax.h @@ -51,6 +51,8 @@ extern "C" { #define TPAX_DRIVER_WRITE_FORMAT_RUSTAR 0x80000 #define TPAX_DRIVER_DIR_MEMBER_RECURSE 0x100000 +#define TPAX_DRIVER_STRICT_PATH_INPUT 0x200000 +#define TPAX_DRIVER_PURE_PATH_OUTPUT 0x400000 /* error flags */ #define TPAX_ERROR_TOP_LEVEL 0x0001 @@ -63,6 +65,7 @@ enum tpax_custom_error { TPAX_ERR_FLEE_ERROR, TPAX_ERR_NULL_CONTEXT, TPAX_ERR_BAD_DATA, + TPAX_ERR_FORBIDDEN_PATH, TPAX_ERR_CAP, }; diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c index d8e2de8..c27ce90 100644 --- a/src/driver/tpax_driver_ctx.c +++ b/src/driver/tpax_driver_ctx.c @@ -403,6 +403,14 @@ int tpax_get_driver_ctx( case TAG_NORECURSE: cctx.drvflags &= ~(uintptr_t)TPAX_DRIVER_DIR_MEMBER_RECURSE; break; + + case TAG_STRICT_PATH: + cctx.drvflags |= TPAX_DRIVER_STRICT_PATH_INPUT; + break; + + case TAG_PURE_PATH: + cctx.drvflags |= TPAX_DRIVER_PURE_PATH_OUTPUT; + break; } } else { operand = entry; diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h index 5f98415..c99553a 100644 --- a/src/internal/tpax_driver_impl.h +++ b/src/internal/tpax_driver_impl.h @@ -36,6 +36,8 @@ enum app_tags { TAG_BLKSIZE, TAG_RECURSE, TAG_NORECURSE, + TAG_STRICT_PATH, + TAG_PURE_PATH, }; struct tpax_driver_ctx_impl { diff --git a/src/skin/tpax_skin_default.c b/src/skin/tpax_skin_default.c index c6de7e6..4e93231 100644 --- a/src/skin/tpax_skin_default.c +++ b/src/skin/tpax_skin_default.c @@ -41,5 +41,21 @@ const struct argv_option tpax_default_options[] = { {"no-recurse", 'd',TAG_NORECURSE,ARGV_OPTARG_NONE,0,0,0, "do not recurse into directory archive members"}, + {"strict-path-input", + 0,TAG_STRICT_PATH,ARGV_OPTARG_NONE,0,0,0, + "do not allow file arguments (in write and copy modes) " + "to contain parent-directoy (dot dot) references"}, + + {"pure-path-output", + 0,TAG_PURE_PATH,ARGV_OPTARG_NONE,0,0,0, + "output (in list mode) or store (in write mode) path " + "names in pure form, specifically by liminating all " + "this-dir (dot) elements from the listed/stored path " + "name, as well as replacing each meaningless sequence " + "of consecutive forward slash characters with a single " + "forward slash; the presence of exactly two forward " + "slash characters in the beginning of a path may be " + "meaningful, and therefore shall remain instact."}, + {0,0,0,0,0,0,0,0} };