|
|
905b4d |
From 21bc70002db718c353724d3aea2121a2bac23218 Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Sumit Bose <sbose@redhat.com>
|
|
|
905b4d |
Date: Fri, 7 Nov 2014 13:55:01 +0100
|
|
|
905b4d |
Subject: [PATCH 097/104] LDAP: add support for lookups by UUID
|
|
|
905b4d |
|
|
|
905b4d |
Related to https://fedorahosted.org/sssd/ticket/2481
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
---
|
|
|
905b4d |
src/providers/data_provider.h | 2 ++
|
|
|
905b4d |
src/providers/ldap/ldap_id.c | 58 +++++++++++++++++++++++++++++++++++++++----
|
|
|
905b4d |
2 files changed, 55 insertions(+), 5 deletions(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h
|
|
|
905b4d |
index e1cb4befadba7e24a418790b10ff361b3092ec6a..5df493e9d1ae21ada6f5fd6198a6d9c36680d044 100644
|
|
|
905b4d |
--- a/src/providers/data_provider.h
|
|
|
905b4d |
+++ b/src/providers/data_provider.h
|
|
|
905b4d |
@@ -127,6 +127,7 @@
|
|
|
905b4d |
#define BE_FILTER_IDNUM 2
|
|
|
905b4d |
#define BE_FILTER_ENUM 3
|
|
|
905b4d |
#define BE_FILTER_SECID 4
|
|
|
905b4d |
+#define BE_FILTER_UUID 5
|
|
|
905b4d |
|
|
|
905b4d |
#define BE_REQ_USER 0x0001
|
|
|
905b4d |
#define BE_REQ_GROUP 0x0002
|
|
|
905b4d |
@@ -139,6 +140,7 @@
|
|
|
905b4d |
#define BE_REQ_HOST 0x0010
|
|
|
905b4d |
#define BE_REQ_BY_SECID 0x0011
|
|
|
905b4d |
#define BE_REQ_USER_AND_GROUP 0x0012
|
|
|
905b4d |
+#define BE_REQ_BY_UUID 0x0013
|
|
|
905b4d |
#define BE_REQ_TYPE_MASK 0x00FF
|
|
|
905b4d |
#define BE_REQ_FAST 0x1000
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
|
|
|
905b4d |
index e8b3a0e1e1dce6e0c8a9b21aa7c6299108dad24d..2e58f4e49eb33a85cbb8b4144c69004c6b5b312b 100644
|
|
|
905b4d |
--- a/src/providers/ldap/ldap_id.c
|
|
|
905b4d |
+++ b/src/providers/ldap/ldap_id.c
|
|
|
905b4d |
@@ -179,6 +179,20 @@ struct tevent_req *users_get_send(TALLOC_CTX *memctx,
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
}
|
|
|
905b4d |
break;
|
|
|
905b4d |
+ case BE_FILTER_UUID:
|
|
|
905b4d |
+ attr_name = ctx->opts->user_map[SDAP_AT_USER_UUID].name;
|
|
|
905b4d |
+ if (attr_name == NULL) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
905b4d |
+ "UUID search not configured for this backend.\n");
|
|
|
905b4d |
+ ret = EINVAL;
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ ret = sss_filter_sanitize(state, name, &clean_name);
|
|
|
905b4d |
+ if (ret != EOK) {
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+ break;
|
|
|
905b4d |
default:
|
|
|
905b4d |
ret = EINVAL;
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
@@ -458,8 +472,9 @@ static void users_get_done(struct tevent_req *subreq)
|
|
|
905b4d |
break;
|
|
|
905b4d |
|
|
|
905b4d |
case BE_FILTER_SECID:
|
|
|
905b4d |
- /* Since it is not clear if the SID belongs to a user or a group
|
|
|
905b4d |
- * we have nothing to do here. */
|
|
|
905b4d |
+ case BE_FILTER_UUID:
|
|
|
905b4d |
+ /* Since it is not clear if the SID/UUID belongs to a user or a
|
|
|
905b4d |
+ * group we have nothing to do here. */
|
|
|
905b4d |
break;
|
|
|
905b4d |
|
|
|
905b4d |
default:
|
|
|
905b4d |
@@ -635,6 +650,20 @@ struct tevent_req *groups_get_send(TALLOC_CTX *memctx,
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
}
|
|
|
905b4d |
break;
|
|
|
905b4d |
+ case BE_FILTER_UUID:
|
|
|
905b4d |
+ attr_name = ctx->opts->group_map[SDAP_AT_GROUP_UUID].name;
|
|
|
905b4d |
+ if (attr_name == NULL) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
905b4d |
+ "UUID search not configured for this backend.\n");
|
|
|
905b4d |
+ ret = EINVAL;
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ ret = sss_filter_sanitize(state, name, &clean_name);
|
|
|
905b4d |
+ if (ret != EOK) {
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+ break;
|
|
|
905b4d |
default:
|
|
|
905b4d |
ret = EINVAL;
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
@@ -884,8 +913,9 @@ static void groups_get_done(struct tevent_req *subreq)
|
|
|
905b4d |
break;
|
|
|
905b4d |
|
|
|
905b4d |
case BE_FILTER_SECID:
|
|
|
905b4d |
- /* Since it is not clear if the SID belongs to a user or a group
|
|
|
905b4d |
- * we have nothing to do here. */
|
|
|
905b4d |
+ case BE_FILTER_UUID:
|
|
|
905b4d |
+ /* Since it is not clear if the SID/UUID belongs to a user or a
|
|
|
905b4d |
+ * group we have nothing to do here. */
|
|
|
905b4d |
break;
|
|
|
905b4d |
|
|
|
905b4d |
default:
|
|
|
905b4d |
@@ -1401,7 +1431,8 @@ sdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- if (ar->filter_type == BE_FILTER_SECID) {
|
|
|
905b4d |
+ if (ar->filter_type == BE_FILTER_SECID
|
|
|
905b4d |
+ || ar->filter_type == BE_FILTER_UUID) {
|
|
|
905b4d |
ret = EINVAL;
|
|
|
905b4d |
state->err = "Invalid filter type";
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
@@ -1430,6 +1461,21 @@ sdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
|
|
|
905b4d |
noexist_delete);
|
|
|
905b4d |
break;
|
|
|
905b4d |
|
|
|
905b4d |
+ case BE_REQ_BY_UUID:
|
|
|
905b4d |
+ if (ar->filter_type != BE_FILTER_UUID) {
|
|
|
905b4d |
+ ret = EINVAL;
|
|
|
905b4d |
+ state->err = "Invalid filter type";
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ subreq = get_user_and_group_send(breq, be_ctx->ev, id_ctx,
|
|
|
905b4d |
+ sdom, conn,
|
|
|
905b4d |
+ ar->filter_value,
|
|
|
905b4d |
+ ar->filter_type,
|
|
|
905b4d |
+ ar->attr_type,
|
|
|
905b4d |
+ noexist_delete);
|
|
|
905b4d |
+ break;
|
|
|
905b4d |
+
|
|
|
905b4d |
case BE_REQ_USER_AND_GROUP:
|
|
|
905b4d |
if (!(ar->filter_type == BE_FILTER_NAME ||
|
|
|
905b4d |
ar->filter_type == BE_FILTER_IDNUM)) {
|
|
|
905b4d |
@@ -1504,6 +1550,8 @@ sdap_handle_acct_req_done(struct tevent_req *subreq)
|
|
|
905b4d |
break;
|
|
|
905b4d |
case BE_REQ_BY_SECID:
|
|
|
905b4d |
/* Fallthrough */
|
|
|
905b4d |
+ case BE_REQ_BY_UUID:
|
|
|
905b4d |
+ /* Fallthrough */
|
|
|
905b4d |
case BE_REQ_USER_AND_GROUP:
|
|
|
905b4d |
err = "Lookup by SID failed";
|
|
|
905b4d |
ret = sdap_get_user_and_group_recv(subreq, &state->dp_error,
|
|
|
905b4d |
--
|
|
|
905b4d |
1.9.3
|
|
|
905b4d |
|