summaryrefslogtreecommitdiff
path: root/usr/src/lib/libzfs/common/libzfs_dataset.c
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2012-12-16 22:41:29 -0500
committerGordon Ross <gwr@nexenta.com>2014-11-18 14:17:36 -0500
commit1ed6b69a5ca1ca3ee5e9a4931f74e2237c7e1c9f (patch)
treecbf5612fc6b3f93ddc715d40058879ef005f72de /usr/src/lib/libzfs/common/libzfs_dataset.c
parent177d5b5f8c0e969013441207a0a705ae66b08cf7 (diff)
downloadillumos-joyent-1ed6b69a5ca1ca3ee5e9a4931f74e2237c7e1c9f.tar.gz
5316 allow smbadm join to use RPC
Reviewed by: Bayard Bell <bayard.bell@nexenta.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Thomas Keiser <thomas.keiser@nexenta.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 27c3cca8e8..05a2fdc9be 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -2557,7 +2557,7 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
boolean_t isuser;
domain[0] = '\0';
-
+ *ridp = 0;
/* Figure out the property type ({user|group}{quota|space}) */
for (type = 0; type < ZFS_NUM_USERQUOTA_PROPS; type++) {
if (strncmp(propname, zfs_userquota_prop_prefixes[type],
@@ -2578,35 +2578,61 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
* It's a SID name (eg "user@domain") that needs to be
* turned into S-1-domainID-RID.
*/
- directory_error_t e;
+ int flag = 0;
+ idmap_stat stat, map_stat;
+ uid_t pid;
+ idmap_rid_t rid;
+ idmap_get_handle_t *gh = NULL;
+
+ stat = idmap_get_create(&gh);
+ if (stat != IDMAP_SUCCESS) {
+ idmap_get_destroy(gh);
+ return (ENOMEM);
+ }
if (zoned && getzoneid() == GLOBAL_ZONEID)
return (ENOENT);
if (isuser) {
- e = directory_sid_from_user_name(NULL,
- cp, &numericsid);
+ stat = idmap_getuidbywinname(cp, NULL, flag, &pid);
+ if (stat < 0)
+ return (ENOENT);
+ stat = idmap_get_sidbyuid(gh, pid, flag, &numericsid,
+ &rid, &map_stat);
} else {
- e = directory_sid_from_group_name(NULL,
- cp, &numericsid);
+ stat = idmap_getgidbywinname(cp, NULL, flag, &pid);
+ if (stat < 0)
+ return (ENOENT);
+ stat = idmap_get_sidbygid(gh, pid, flag, &numericsid,
+ &rid, &map_stat);
+ }
+ if (stat < 0) {
+ idmap_get_destroy(gh);
+ return (ENOENT);
}
- if (e != NULL) {
- directory_error_free(e);
+ stat = idmap_get_mappings(gh);
+ idmap_get_destroy(gh);
+
+ if (stat < 0) {
return (ENOENT);
}
if (numericsid == NULL)
return (ENOENT);
cp = numericsid;
+ *ridp = rid;
/* will be further decoded below */
}
if (strncmp(cp, "S-1-", 4) == 0) {
/* It's a numeric SID (eg "S-1-234-567-89") */
(void) strlcpy(domain, cp, domainlen);
- cp = strrchr(domain, '-');
- *cp = '\0';
- cp++;
-
errno = 0;
- *ridp = strtoull(cp, &end, 10);
+ if (*ridp == 0) {
+ cp = strrchr(domain, '-');
+ *cp = '\0';
+ cp++;
+ *ridp = strtoull(cp, &end, 10);
+ } else {
+ end = "";
+ }
if (numericsid) {
free(numericsid);
numericsid = NULL;