From 6f504738cad1ee9daa1bd6eec721caceef65f21d Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Mon, 26 Nov 2012 22:16:25 +0100 Subject: IDMAP: add sss_idmap_smb_sid_to_unix() To avoid a conversion on the caller side a new call is added to libsss_idmap which converts a Samba dom_sid structure to a Posix ID. --- src/lib/idmap/sss_idmap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/lib/idmap/sss_idmap.c') diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c index 3615e9d55..1764b6f4b 100644 --- a/src/lib/idmap/sss_idmap.c +++ b/src/lib/idmap/sss_idmap.c @@ -422,6 +422,28 @@ done: return err; } +enum idmap_error_code sss_idmap_smb_sid_to_unix(struct sss_idmap_ctx *ctx, + struct dom_sid *smb_sid, + uint32_t *id) +{ + enum idmap_error_code err; + char *sid; + + CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID); + + err = sss_idmap_smb_sid_to_sid(ctx, smb_sid, &sid); + if (err != IDMAP_SUCCESS) { + goto done; + } + + err = sss_idmap_sid_to_unix(ctx, sid, id); + +done: + ctx->free_func(sid, ctx->alloc_pvt); + + return err; +} + enum idmap_error_code sss_idmap_unix_to_dom_sid(struct sss_idmap_ctx *ctx, uint32_t id, struct sss_dom_sid **_dom_sid) -- cgit