diff options
author | Massimo Maggi <[email protected]> | 2012-12-16 14:33:51 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-12-17 09:52:58 -0800 |
commit | 5e6320cd1262de6eada39751807c31c059517d01 (patch) | |
tree | 3e34d59a8d08f79565c28aa96378c64d3ed96a36 /lib/libzfs/libzfs_dataset.c | |
parent | fd7fd5ebcf6cceb107dd27592a9bd7d60f93738f (diff) |
Fix get/set users/groups in quota props via numeric id
Fix setting/getting users/groups in quota properties through
numeric identifier. This support was accidentally disabled
in the original port by applying the HAVE_IDMAP wrapper macro
too broadly.
Fix obtained by moving #ifdef HAVE_IDMAP to exclude only
the part of code that really needs IDMAP. Now zfs (get|set)
(user|group)quota@1000 works as expected.
Signed-off-by: Massimo Maggi <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1147
Diffstat (limited to 'lib/libzfs/libzfs_dataset.c')
-rw-r--r-- | lib/libzfs/libzfs_dataset.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 7cf78c8f7..73d45882a 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -2532,29 +2532,29 @@ userquota_propname_decode(const char *propname, boolean_t zoned, return (ENOSYS); #endif /* HAVE_IDMAP */ } else { -#ifdef HAVE_IDMAP /* It's a user/group ID (eg "12345"). */ uid_t id; - idmap_rid_t rid; - char *mapdomain; char *end; - id = strtoul(cp, &end, 10); if (*end != '\0') return (EINVAL); if (id > MAXUID) { +#ifdef HAVE_IDMAP /* It's an ephemeral ID. */ + idmap_rid_t rid; + char *mapdomain; + if (idmap_id_to_numeric_domain_rid(id, isuser, &mapdomain, &rid) != 0) return (ENOENT); (void) strlcpy(domain, mapdomain, domainlen); *ridp = rid; +#else + return (ENOSYS); +#endif /* HAVE_IDMAP */ } else { *ridp = id; } -#else - return (ENOSYS); -#endif /* HAVE_IDMAP */ } return (0); |