summaryrefslogtreecommitdiffstats
path: root/src/lib/idmap/sss_idmap.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-11-01 12:23:23 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-11-07 11:16:02 +0100
commitaa0e78c283c1a6e652e50f913f5e4e8d82e8554c (patch)
treee1c075b295d2c4d46b67f1ab2064e1600edcae63 /src/lib/idmap/sss_idmap.c
parentbd3a63399dfa355b8e2c58fe3ee1035d114be336 (diff)
downloadsssd-aa0e78c283c1a6e652e50f913f5e4e8d82e8554c.tar.gz
sssd-aa0e78c283c1a6e652e50f913f5e4e8d82e8554c.tar.xz
sssd-aa0e78c283c1a6e652e50f913f5e4e8d82e8554c.zip
idmap: add API to free allocated SIDs
Diffstat (limited to 'src/lib/idmap/sss_idmap.c')
-rw-r--r--src/lib/idmap/sss_idmap.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
index 9278e10d2..3f1e7a58f 100644
--- a/src/lib/idmap/sss_idmap.c
+++ b/src/lib/idmap/sss_idmap.c
@@ -246,6 +246,42 @@ enum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx)
return IDMAP_SUCCESS;
}
+static enum idmap_error_code sss_idmap_free_ptr(struct sss_idmap_ctx *ctx,
+ void *ptr)
+{
+ CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID);
+
+ if (ptr != NULL) {
+ ctx->free_func(ptr, ctx->alloc_pvt);
+ }
+
+ return IDMAP_SUCCESS;
+}
+
+enum idmap_error_code sss_idmap_free_sid(struct sss_idmap_ctx *ctx,
+ char *sid)
+{
+ return sss_idmap_free_ptr(ctx, sid);
+}
+
+enum idmap_error_code sss_idmap_free_dom_sid(struct sss_idmap_ctx *ctx,
+ struct sss_dom_sid *dom_sid)
+{
+ return sss_idmap_free_ptr(ctx, dom_sid);
+}
+
+enum idmap_error_code sss_idmap_free_smb_sid(struct sss_idmap_ctx *ctx,
+ struct dom_sid *smb_sid)
+{
+ return sss_idmap_free_ptr(ctx, smb_sid);
+}
+
+enum idmap_error_code sss_idmap_free_bin_sid(struct sss_idmap_ctx *ctx,
+ uint8_t *bin_sid)
+{
+ return sss_idmap_free_ptr(ctx, bin_sid);
+}
+
enum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx,
const char *dom_sid,
id_t *slice_num,