9991ea
From 8d8cbc740af171a24e768fd6e4af17013d1fa261 Mon Sep 17 00:00:00 2001
9991ea
From: Sumit Bose <sbose@redhat.com>
9991ea
Date: Tue, 25 Mar 2014 11:29:58 +0100
9991ea
Subject: [PATCH] extdom: do not return results from the wrong domain
9991ea
9991ea
Resolves: https://fedorahosted.org/freeipa/ticket/4264
9991ea
Reviewed-By: Tomas Babej <tbabej@redhat.com>
9991ea
---
9991ea
 .../ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c   | 12 ++++++++++++
9991ea
 1 file changed, 12 insertions(+)
9991ea
9991ea
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
9991ea
index 675fc368042373314e9416dcf7d5866cb8c9871e..025d37dc5eda05c8db43d4e8176fd7898ed32fe7 100644
9991ea
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
9991ea
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
9991ea
@@ -359,6 +359,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
9991ea
                         if ((locat = strchr(pg_data->data.pwd.pw_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
9991ea
                             if (strcasecmp(locat+1, domain_name) == 0  ) {
9991ea
                                 locat[0] = 0;
9991ea
+                            } else {
9991ea
+                                ret = LDAP_NO_SUCH_OBJECT;
9991ea
+                                goto done;
9991ea
                             }
9991ea
                         }
9991ea
                         res->data.name.object_name =
9991ea
@@ -368,6 +371,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
9991ea
                         if ((locat = strchr(pg_data->data.grp.gr_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
9991ea
                             if (strcasecmp(locat+1, domain_name) == 0) {
9991ea
                                 locat[0] = 0;
9991ea
+                            } else {
9991ea
+                                ret = LDAP_NO_SUCH_OBJECT;
9991ea
+                                goto done;
9991ea
                             }
9991ea
                         }
9991ea
                         res->data.name.object_name =
9991ea
@@ -408,6 +414,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
9991ea
                     if ((locat = strchr(pg_data->data.pwd.pw_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
9991ea
                         if (strcasecmp(locat+1, domain_name) == 0) {
9991ea
                             locat[0] = 0;
9991ea
+                        } else {
9991ea
+                            ret = LDAP_NO_SUCH_OBJECT;
9991ea
+                            goto done;
9991ea
                         }
9991ea
                     }
9991ea
                     res->data.user.user_name =
9991ea
@@ -428,6 +437,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
9991ea
                     if ((locat = strchr(pg_data->data.grp.gr_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
9991ea
                         if (strcasecmp(locat+1, domain_name) == 0) {
9991ea
                             locat[0] = 0;
9991ea
+                        } else {
9991ea
+                            ret = LDAP_NO_SUCH_OBJECT;
9991ea
+                            goto done;
9991ea
                         }
9991ea
                     }
9991ea
                     res->data.group.group_name =
9991ea
-- 
9991ea
1.8.5.3
9991ea