summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTulsi Jain <[email protected]>2019-06-13 08:56:15 -0700
committerBrian Behlendorf <[email protected]>2019-06-13 08:56:15 -0700
commit9c7da9a95aaaecced0a1cfc40190906e7a691327 (patch)
treed60bad72f7c6fb38bfcdd375d50a78f2eb8a2d5c /lib
parent3475724ea4221a354633d7c4e50d9d90f6bd266f (diff)
Restrict filesystem creation if name referred either '.' or '..'
This change restricts filesystem creation if the given name contains either '.' or '..' Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Elling <[email protected]> Signed-off-by: TulsiJain <[email protected]> Closes #8842 Closes #8564
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_dataset.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index 93af50b99..3be205f1f 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -197,6 +197,16 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
"reserved disk name"));
break;
+ case NAME_ERR_SELF_REF:
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "self reference, '.' is found in name"));
+ break;
+
+ case NAME_ERR_PARENT_REF:
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "parent reference, '..' is found in name"));
+ break;
+
default:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"(%d) not defined"), why);