Blob Blame History Raw
From 8d8cbc740af171a24e768fd6e4af17013d1fa261 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Tue, 25 Mar 2014 11:29:58 +0100
Subject: [PATCH] extdom: do not return results from the wrong domain

Resolves: https://fedorahosted.org/freeipa/ticket/4264
Reviewed-By: Tomas Babej <tbabej@redhat.com>
---
 .../ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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 675fc368042373314e9416dcf7d5866cb8c9871e..025d37dc5eda05c8db43d4e8176fd7898ed32fe7 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
@@ -359,6 +359,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
                         if ((locat = strchr(pg_data->data.pwd.pw_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
                             if (strcasecmp(locat+1, domain_name) == 0  ) {
                                 locat[0] = 0;
+                            } else {
+                                ret = LDAP_NO_SUCH_OBJECT;
+                                goto done;
                             }
                         }
                         res->data.name.object_name =
@@ -368,6 +371,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
                         if ((locat = strchr(pg_data->data.grp.gr_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
                             if (strcasecmp(locat+1, domain_name) == 0) {
                                 locat[0] = 0;
+                            } else {
+                                ret = LDAP_NO_SUCH_OBJECT;
+                                goto done;
                             }
                         }
                         res->data.name.object_name =
@@ -408,6 +414,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
                     if ((locat = strchr(pg_data->data.pwd.pw_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
                         if (strcasecmp(locat+1, domain_name) == 0) {
                             locat[0] = 0;
+                        } else {
+                            ret = LDAP_NO_SUCH_OBJECT;
+                            goto done;
                         }
                     }
                     res->data.user.user_name =
@@ -428,6 +437,9 @@ int create_response(struct extdom_req *req, struct pwd_grp *pg_data,
                     if ((locat = strchr(pg_data->data.grp.gr_name, SSSD_DOMAIN_SEPARATOR)) != NULL) {
                         if (strcasecmp(locat+1, domain_name) == 0) {
                             locat[0] = 0;
+                        } else {
+                            ret = LDAP_NO_SUCH_OBJECT;
+                            goto done;
                         }
                     }
                     res->data.group.group_name =
-- 
1.8.5.3