diff options
author | Sumit Bose <sbose@redhat.com> | 2012-10-11 12:13:53 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-10-18 10:57:54 +0200 |
commit | 89e315d639e972608df11ae052029aaaf0eb1083 (patch) | |
tree | ce508bfe8a3b6a1785cf53146a66d6c4c288354d /daemons/ipa-slapi-plugins/ipa-extdom-extop | |
parent | c1b922352fd88909401bad914cf660f29d5b063c (diff) | |
download | freeipa-89e315d639e972608df11ae052029aaaf0eb1083.tar.gz freeipa-89e315d639e972608df11ae052029aaaf0eb1083.tar.xz freeipa-89e315d639e972608df11ae052029aaaf0eb1083.zip |
extdom: handle INP_POSIX_UID and INP_POSIX_GID requests
Fixes https://fedorahosted.org/freeipa/ticket/3166
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-extdom-extop')
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c index 47d4d68d..0c054fb8 100644 --- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c +++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c @@ -329,20 +329,46 @@ int handle_request(struct ipa_extdom_ctx *ctx, struct extdom_req *req, char *name; enum wbcSidType name_type; struct domain_info *domain_info = NULL; + uint32_t id; + enum idmap_error_code err; + char *sid_str; ret = get_domain_info(ctx, req->data.name.domain_name, &domain_info); if (ret != 0) { return LDAP_OPERATIONS_ERROR; } + if (req->input_type == INP_POSIX_UID || req->input_type == INP_POSIX_GID) { + if (req->input_type == INP_POSIX_UID) { + id = req->data.posix_uid.uid; + } else { + id = req->data.posix_gid.gid; + } + + err = sss_idmap_unix_to_sid(domain_info->idmap_ctx, id, &sid_str); + if (err != IDMAP_SUCCESS) { + ret = LDAP_OPERATIONS_ERROR; + goto done; + } + + werr = wbcStringToSid(sid_str, &sid); + free(sid_str); + if (!WBC_ERROR_IS_OK(werr)) { + ret = LDAP_OPERATIONS_ERROR; + goto done; + } + + } else if (req->input_type == INP_SID) { + werr = wbcStringToSid(req->data.sid, &sid); + if (!WBC_ERROR_IS_OK(werr)) { + ret = LDAP_OPERATIONS_ERROR; + goto done; + } + } switch (req->input_type) { + case INP_POSIX_UID: + case INP_POSIX_GID: case INP_SID: - werr = wbcStringToSid(req->data.sid, &sid); - if (!WBC_ERROR_IS_OK(werr)) { - ret = LDAP_OPERATIONS_ERROR; - goto done; - } - werr = wbcLookupSid(&sid, &domain_name, &name, &name_type); if (!WBC_ERROR_IS_OK(werr)) { ret = LDAP_OPERATIONS_ERROR; |