summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2014-11-07 15:05:41 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-11-20 10:52:51 +0100
commit1c82a31a254c2fca6dfa3e3b52986b75221d8742 (patch)
treee70ac34da3da805e206dba2d486ce06c9b2c3efd /src
parent933326b4180b72636af84643d4811f6ad645fbe8 (diff)
downloadsssd-1c82a31a254c2fca6dfa3e3b52986b75221d8742.tar.gz
sssd-1c82a31a254c2fca6dfa3e3b52986b75221d8742.tar.xz
sssd-1c82a31a254c2fca6dfa3e3b52986b75221d8742.zip
ipa: add get_be_acct_req_for_uuid()
This new call creates the needs data for a lookup by UUID which is needed when trying to find the original object for an IPA override object. Related to https://fedorahosted.org/sssd/ticket/2481 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/providers/ipa/ipa_id.h4
-rw-r--r--src/providers/ipa/ipa_views.c42
2 files changed, 40 insertions, 6 deletions
diff --git a/src/providers/ipa/ipa_id.h b/src/providers/ipa/ipa_id.h
index 033ac40f1..890d00d49 100644
--- a/src/providers/ipa/ipa_id.h
+++ b/src/providers/ipa/ipa_id.h
@@ -83,6 +83,10 @@ errno_t get_be_acct_req_for_sid(TALLOC_CTX *mem_ctx, const char *sid,
const char *domain_name,
struct be_acct_req **_ar);
+errno_t get_be_acct_req_for_uuid(TALLOC_CTX *mem_ctx, const char *uuid,
+ const char *domain_name,
+ struct be_acct_req **_ar);
+
struct tevent_req *ipa_get_ad_override_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct sdap_id_ctx *sdap_id_ctx,
diff --git a/src/providers/ipa/ipa_views.c b/src/providers/ipa/ipa_views.c
index 2eb77216a..ee586894e 100644
--- a/src/providers/ipa/ipa_views.c
+++ b/src/providers/ipa/ipa_views.c
@@ -140,9 +140,10 @@ static errno_t be_acct_req_to_override_filter(TALLOC_CTX *mem_ctx,
return EOK;
}
-errno_t get_be_acct_req_for_sid(TALLOC_CTX *mem_ctx, const char *sid,
- const char *domain_name,
- struct be_acct_req **_ar)
+static errno_t get_be_acct_req_for_xyz(TALLOC_CTX *mem_ctx, const char *val,
+ const char *domain_name,
+ int type,
+ struct be_acct_req **_ar)
{
struct be_acct_req *ar;
@@ -152,9 +153,22 @@ errno_t get_be_acct_req_for_sid(TALLOC_CTX *mem_ctx, const char *sid,
return ENOMEM;
}
- ar->entry_type = BE_REQ_BY_SECID;
- ar->filter_type = BE_FILTER_SECID;
- ar->filter_value = talloc_strdup(ar, sid);
+ switch (type) {
+ case BE_REQ_BY_SECID:
+ ar->entry_type = BE_REQ_BY_SECID;
+ ar->filter_type = BE_FILTER_SECID;
+ break;
+ case BE_REQ_BY_UUID:
+ ar->entry_type = BE_REQ_BY_UUID;
+ ar->filter_type = BE_FILTER_UUID;
+ break;
+ default:
+ DEBUG(SSSDBG_CRIT_FAILURE, "Unsupported request type [%d].\n", type);
+ talloc_free(ar);
+ return EINVAL;
+ }
+
+ ar->filter_value = talloc_strdup(ar, val);
ar->domain = talloc_strdup(ar, domain_name);
if (ar->filter_value == NULL || ar->domain == NULL) {
DEBUG(SSSDBG_OP_FAILURE, "talloc_strdup failed.\n");
@@ -168,6 +182,22 @@ errno_t get_be_acct_req_for_sid(TALLOC_CTX *mem_ctx, const char *sid,
return EOK;
}
+errno_t get_be_acct_req_for_sid(TALLOC_CTX *mem_ctx, const char *sid,
+ const char *domain_name,
+ struct be_acct_req **_ar)
+{
+ return get_be_acct_req_for_xyz(mem_ctx, sid, domain_name, BE_REQ_BY_SECID,
+ _ar);
+}
+
+errno_t get_be_acct_req_for_uuid(TALLOC_CTX *mem_ctx, const char *uuid,
+ const char *domain_name,
+ struct be_acct_req **_ar)
+{
+ return get_be_acct_req_for_xyz(mem_ctx, uuid, domain_name, BE_REQ_BY_UUID,
+ _ar);
+}
+
struct ipa_get_ad_override_state {
struct tevent_context *ev;
struct sdap_id_ctx *sdap_id_ctx;