diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2022-04-03 02:04:31 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2022-04-06 03:37:07 +0000 |
commit | 227e52a9c0b0be9656757fec47a2648f5619bf67 (patch) | |
tree | 68515772dc31b20b4f3979dd910f3881f2e6f2c6 /lib/libbe | |
parent | 0e90da6549d177874437dc2e7bab085873538da2 (diff) | |
download | src-227e52a9c0b0be9656757fec47a2648f5619bf67.tar.gz src-227e52a9c0b0be9656757fec47a2648f5619bf67.zip |
bectl: push space-in-name check down into libbe
This check was previously in `create` only, not applying to renames. It
should really be applied at the libbe level, so that we can avoid
writing about this restriction over and over again.
While we're here: `bectl rename` always succeeds, even when it doesn't.
Start returning the error.
Reported By: Christian McDonald <cmcdonald netgate com>
(cherry picked from commit dadb9c70938c4ae2c260f6af65752c67ac752284)
Diffstat (limited to 'lib/libbe')
-rw-r--r-- | lib/libbe/be.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libbe/be.c b/lib/libbe/be.c index d6fe027f5df3..13f7a59d5215 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -961,6 +961,17 @@ be_validate_name(libbe_handle_t *lbh, const char *name) if (!zfs_name_valid(name, ZFS_TYPE_DATASET)) return (BE_ERR_INVALIDNAME); + /* + * ZFS allows spaces in boot environment names, but the kernel can't + * handle booting from such a dataset right now. vfs.root.mountfrom + * is defined to be a space-separated list, and there's no protocol for + * escaping whitespace in the path component of a dev:path spec. So + * while loader can handle this situation alright, it can't safely pass + * it on to mountroot. + */ + if (strchr(name, ' ') != NULL) + return (BE_ERR_INVALIDNAME); + return (BE_ERR_SUCCESS); } |