summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-10-11 12:13:53 +0200
committerMartin Kosek <mkosek@redhat.com>2012-10-18 10:57:54 +0200
commit89e315d639e972608df11ae052029aaaf0eb1083 (patch)
treece508bfe8a3b6a1785cf53146a66d6c4c288354d
parentc1b922352fd88909401bad914cf660f29d5b063c (diff)
downloadfreeipa-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
-rw-r--r--daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c38
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 47d4d68d1..0c054fb84 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;