From be160928b79888fc8b4ce8122435f3f633f01ead Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 26 Aug 2010 11:43:07 -0700 Subject: [PATCH] Add linux idmap support Use idmap service if available. Signed-off-by: Brian Behlendorf --- lib/libzfs/libzfs_dataset.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 87ee182..023563b 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -41,9 +41,11 @@ #include #include #include +#ifdef HAVE_IDMAP #include #include #include +#endif /* HAVE_IDMAP */ #include #include @@ -2166,6 +2168,7 @@ zfs_prop_get_numeric(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t *value, return (0); } +#ifdef HAVE_IDMAP static int idmap_id_to_numeric_domain_rid(uid_t id, boolean_t isuser, char **domainp, idmap_rid_t *ridp) @@ -2195,6 +2198,7 @@ out: idmap_get_destroy(get_hdl); return (err); } +#endif /* HAVE_IDMAP */ /* * convert the propname into parameters needed by kernel @@ -2228,6 +2232,7 @@ userquota_propname_decode(const char *propname, boolean_t zoned, cp = strchr(propname, '@') + 1; if (strchr(cp, '@')) { +#ifdef HAVE_IDMAP /* * It's a SID name (eg "user@domain") that needs to be * turned into S-1-domainID-RID. @@ -2250,6 +2255,9 @@ userquota_propname_decode(const char *propname, boolean_t zoned, return (ENOENT); cp = numericsid; /* will be further decoded below */ +#else + return (ENOSYS); +#endif /* HAVE_IDMAP */ } if (strncmp(cp, "S-1-", 4) == 0) { @@ -2288,6 +2296,7 @@ userquota_propname_decode(const char *propname, boolean_t zoned, *ridp = gr->gr_gid; } } else { +#ifdef HAVE_IDMAP /* It's a user/group ID (eg "12345"). */ uid_t id = strtoul(cp, &end, 10); idmap_rid_t rid; @@ -2305,6 +2314,9 @@ userquota_propname_decode(const char *propname, boolean_t zoned, } else { *ridp = id; } +#else + return (ENOSYS); +#endif /* HAVE_IDMAP */ } ASSERT3P(numericsid, ==, NULL); -- 1.8.3.1