|
|
2fc102 |
From 16c8b0e7a0ac40b078f98c9f8025d39a59dca9bb Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
|
2fc102 |
Date: Fri, 1 Nov 2013 12:23:23 +0100
|
|
|
2fc102 |
Subject: [PATCH 18/31] idmap: add API to free allocated SIDs
|
|
|
2fc102 |
|
|
|
2fc102 |
---
|
|
|
2fc102 |
src/lib/idmap/sss_idmap.c | 36 +++++++++++++++++++++++++++++++++++
|
|
|
2fc102 |
src/lib/idmap/sss_idmap.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
2fc102 |
2 files changed, 84 insertions(+)
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
index 9278e10d2bee37b741a87cd84d666d8a5b7bb671..3f1e7a58f390a3c10999251e2155ef513ba69bd7 100644
|
|
|
2fc102 |
--- a/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
+++ b/src/lib/idmap/sss_idmap.c
|
|
|
2fc102 |
@@ -246,6 +246,42 @@ enum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx)
|
|
|
2fc102 |
return IDMAP_SUCCESS;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+static enum idmap_error_code sss_idmap_free_ptr(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ void *ptr)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ if (ptr != NULL) {
|
|
|
2fc102 |
+ ctx->free_func(ptr, ctx->alloc_pvt);
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ return IDMAP_SUCCESS;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ char *sid)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ return sss_idmap_free_ptr(ctx, sid);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_dom_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ struct sss_dom_sid *dom_sid)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ return sss_idmap_free_ptr(ctx, dom_sid);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_smb_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ struct dom_sid *smb_sid)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ return sss_idmap_free_ptr(ctx, smb_sid);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_bin_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ uint8_t *bin_sid)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ return sss_idmap_free_ptr(ctx, bin_sid);
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
const char *dom_sid,
|
|
|
2fc102 |
id_t *slice_num,
|
|
|
2fc102 |
diff --git a/src/lib/idmap/sss_idmap.h b/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
index 4101fb9a5e0982c6ba0560decd299a0ed9e722b6..1e1c9a5cfe490301d0e633db808589f1bc0ef857 100644
|
|
|
2fc102 |
--- a/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
+++ b/src/lib/idmap/sss_idmap.h
|
|
|
2fc102 |
@@ -504,6 +504,54 @@ enum idmap_error_code sss_idmap_unix_to_bin_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
enum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx);
|
|
|
2fc102 |
|
|
|
2fc102 |
/**
|
|
|
2fc102 |
+ * @brief Free mapped SID.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] ctx Idmap context
|
|
|
2fc102 |
+ * @param[in] sid SID to be freed.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_CONTEXT_INVALID: Provided context is invalid
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ char *sid);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
+ * @brief Free mapped domain SID.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] ctx Idmap context
|
|
|
2fc102 |
+ * @param[in] dom_sid Domain SID to be freed.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_CONTEXT_INVALID: Provided context is invalid
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_dom_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ struct sss_dom_sid *dom_sid);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
+ * @brief Free mapped Samba SID.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] ctx Idmap context
|
|
|
2fc102 |
+ * @param[in] smb_sid Samba SID to be freed.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_CONTEXT_INVALID: Provided context is invalid
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_smb_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ struct dom_sid *smb_sid);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
+ * @brief Free mapped binary SID.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @param[in] ctx Idmap context
|
|
|
2fc102 |
+ * @param[in] smb_sid Binary SID to be freed.
|
|
|
2fc102 |
+ *
|
|
|
2fc102 |
+ * @return
|
|
|
2fc102 |
+ * - #IDMAP_CONTEXT_INVALID: Provided context is invalid
|
|
|
2fc102 |
+ */
|
|
|
2fc102 |
+enum idmap_error_code sss_idmap_free_bin_sid(struct sss_idmap_ctx *ctx,
|
|
|
2fc102 |
+ uint8_t *bin_sid);
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+/**
|
|
|
2fc102 |
* @brief Translate error code to a string
|
|
|
2fc102 |
*
|
|
|
2fc102 |
* @param[in] err Idmap error code
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.4.2
|
|
|
2fc102 |
|