summaryrefslogtreecommitdiff
path: root/cddl
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2020-05-12 09:04:57 +0000
committerAndriy Gapon <avg@FreeBSD.org>2020-05-12 09:04:57 +0000
commit54904c38f8b0233128f3be72637ad1fd30f7eeac (patch)
treea8b4a76567b8233bc139899b447b6e063e2deb81 /cddl
parent051fc58cb368b8d1670f2728e1c07103cae812dd (diff)
downloadsrc-test-54904c38f8b0233128f3be72637ad1fd30f7eeac.tar.gz
src-test-54904c38f8b0233128f3be72637ad1fd30f7eeac.zip
zfs allow/unallow should work with numeric uid/gid
And that should work even (especially) if there is no matching user or group name. This change allows to see and modify delegations for deleted groups and users. The change is originally by Xin Li. illumos report: https://www.illumos.org/issues/6037 OpenZFS (ZoL) PR: https://github.com/openzfs/zfs/pull/10280 Obtained from: delphij MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=360956
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index 851ba3f9523f9..301042b54ca3f 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -4696,6 +4696,14 @@ parse_fs_perm(fs_perm_t *fsperm, nvlist_t *nvl)
(void) strlcpy(
node->who_perm.who_ug_name,
nice_name, 256);
+ else {
+ /* User or group unknown */
+ (void) snprintf(
+ node->who_perm.who_ug_name,
+ sizeof (
+ node->who_perm.who_ug_name),
+ "(unknown: %d)", rid);
+ }
}
uu_avl_insert(avl, node, idx);
@@ -5194,9 +5202,9 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
if (p != NULL)
rid = p->pw_uid;
- else {
+ else if (*endch != '\0') {
(void) snprintf(errbuf, 256, gettext(
- "invalid user %s"), curr);
+ "invalid user %s\n"), curr);
allow_usage(un, B_TRUE, errbuf);
}
} else if (opts->group) {
@@ -5208,9 +5216,9 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
if (g != NULL)
rid = g->gr_gid;
- else {
+ else if (*endch != '\0') {
(void) snprintf(errbuf, 256, gettext(
- "invalid group %s"), curr);
+ "invalid group %s\n"), curr);
allow_usage(un, B_TRUE, errbuf);
}
} else {
@@ -5236,7 +5244,7 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
rid = g->gr_gid;
} else {
(void) snprintf(errbuf, 256, gettext(
- "invalid user/group %s"), curr);
+ "invalid user/group %s\n"), curr);
allow_usage(un, B_TRUE, errbuf);
}
}