NAME_ERR_RESERVED, /* entire name is reserved */
NAME_ERR_DISKLIKE, /* reserved disk name (c[0-9].*) */
NAME_ERR_TOOLONG, /* name is too long */
+ NAME_ERR_SELF_REF, /* reserved self path name ('.') */
+ NAME_ERR_PARENT_REF, /* reserved parent path name ('..') */
NAME_ERR_NO_AT, /* permission set is missing '@' */
} namecheck_err_t;
"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);
}
}
+ if (*end == '\0' || *end == '/') {
+ int component_length = end - start;
+ /* Validate the contents of this component is not '.' */
+ if (component_length == 1) {
+ if (start[0] == '.') {
+ if (why)
+ *why = NAME_ERR_SELF_REF;
+ return (-1);
+ }
+ }
+
+ /* Validate the content of this component is not '..' */
+ if (component_length == 2) {
+ if (start[0] == '.' && start[1] == '.') {
+ if (why)
+ *why = NAME_ERR_PARENT_REF;
+ return (-1);
+ }
+ }
+ }
+
/* Snapshot or bookmark delimiter found */
if (*end == '@' || *end == '#') {
/* Multiple delimiters are not allowed */
"$TESTPOOL/blah*blah" "$TESTPOOL/blah blah" \
"-s $TESTPOOL/$TESTFS1" "-b 1092 $TESTPOOL/$TESTFS1" \
"-b 64k $TESTPOOL/$TESTFS1" "-s -b 32k $TESTPOOL/$TESTFS1" \
- "$TESTPOOL/$BYND_MAX_NAME" "$TESTPOOL/$BYND_NEST_LIMIT"
+ "$TESTPOOL/$BYND_MAX_NAME" "$TESTPOOL/$BYND_NEST_LIMIT" \
+ "$TESTPOOL/." "$TESTPOOL/.." "$TESTPOOL/../blah" "$TESTPOOL/./blah" \
+ "$TESTPOOL/blah/./blah" "$TESTPOOL/blah/../blah"
log_assert "Verify 'zfs create <filesystem>' fails with bad <filesystem> argument."