From 4f383cf8758e3d92a456346d9e0a8e08d5cf8ed2 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Mon, 14 May 2012 13:14:14 +0200 Subject: [PATCH] Rename struct dom_sid to struct sss_dom_sid To avoid conflicts with struct dom_sid used by samba the sss_ prefix is added to the struct used by libsss_idmap. --- src/lib/idmap/sss_idmap.c | 6 +++--- src/lib/idmap/sss_idmap.h | 14 +++++++------- src/lib/idmap/sss_idmap_conv.c | 26 +++++++++++++------------- src/tests/sss_idmap-tests.c | 16 ++++++++-------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c index c970293..c589bd4 100644 --- a/src/lib/idmap/sss_idmap.c +++ b/src/lib/idmap/sss_idmap.c @@ -361,7 +361,7 @@ enum idmap_error_code sss_idmap_unix_to_sid(struct sss_idmap_ctx *ctx, } enum idmap_error_code sss_idmap_dom_sid_to_unix(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, uint32_t *id) { enum idmap_error_code err; @@ -407,11 +407,11 @@ done: enum idmap_error_code sss_idmap_unix_to_dom_sid(struct sss_idmap_ctx *ctx, uint32_t id, - struct dom_sid **_dom_sid) + struct sss_dom_sid **_dom_sid) { enum idmap_error_code err; char *sid = NULL; - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID); diff --git a/src/lib/idmap/sss_idmap.h b/src/lib/idmap/sss_idmap.h index 78e786a..a3ec919 100644 --- a/src/lib/idmap/sss_idmap.h +++ b/src/lib/idmap/sss_idmap.h @@ -90,7 +90,7 @@ struct sss_idmap_range { /** * Opaque type for SIDs */ -struct dom_sid; +struct sss_dom_sid; /** * Opaque type for the idmap context @@ -167,7 +167,7 @@ enum idmap_error_code sss_idmap_sid_to_unix(struct sss_idmap_ctx *ctx, * idmap context */ enum idmap_error_code sss_idmap_dom_sid_to_unix(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, uint32_t *id); /** @@ -220,7 +220,7 @@ enum idmap_error_code sss_idmap_unix_to_sid(struct sss_idmap_ctx *ctx, */ enum idmap_error_code sss_idmap_unix_to_dom_sid(struct sss_idmap_ctx *ctx, uint32_t id, - struct dom_sid **dom_sid); + struct sss_dom_sid **dom_sid); /** * @brief Translate unix UID or GID to a binary SID @@ -288,7 +288,7 @@ bool is_domain_sid(const char *str); enum idmap_error_code sss_idmap_bin_sid_to_dom_sid(struct sss_idmap_ctx *ctx, const uint8_t *bin_sid, size_t length, - struct dom_sid **dom_sid); + struct sss_dom_sid **dom_sid); /** * @brief Convert binary SID to SID string @@ -322,7 +322,7 @@ enum idmap_error_code sss_idmap_bin_sid_to_sid(struct sss_idmap_ctx *ctx, * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result */ enum idmap_error_code sss_idmap_dom_sid_to_bin_sid(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, uint8_t **bin_sid, size_t *length); @@ -357,7 +357,7 @@ enum idmap_error_code sss_idmap_sid_to_bin_sid(struct sss_idmap_ctx *ctx, * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result */ enum idmap_error_code sss_idmap_dom_sid_to_sid(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, char **sid); /** @@ -374,7 +374,7 @@ enum idmap_error_code sss_idmap_dom_sid_to_sid(struct sss_idmap_ctx *ctx, */ enum idmap_error_code sss_idmap_sid_to_dom_sid(struct sss_idmap_ctx *ctx, const char *sid, - struct dom_sid **dom_sid); + struct sss_dom_sid **dom_sid); /** * @} */ diff --git a/src/lib/idmap/sss_idmap_conv.c b/src/lib/idmap/sss_idmap_conv.c index e2064f6..df96fcc 100644 --- a/src/lib/idmap/sss_idmap_conv.c +++ b/src/lib/idmap/sss_idmap_conv.c @@ -33,7 +33,7 @@ #define SID_ID_AUTHS 6 #define SID_SUB_AUTHS 15 -struct dom_sid { +struct sss_dom_sid { uint8_t sid_rev_num; int8_t num_auths; /* [range(0,15)] */ uint8_t id_auth[SID_ID_AUTHS]; /* highest order byte has index 0 */ @@ -43,19 +43,19 @@ struct dom_sid { enum idmap_error_code sss_idmap_bin_sid_to_dom_sid(struct sss_idmap_ctx *ctx, const uint8_t *bin_sid, size_t length, - struct dom_sid **_dom_sid) + struct sss_dom_sid **_dom_sid) { enum idmap_error_code err; - struct dom_sid *dom_sid; + struct sss_dom_sid *dom_sid; size_t i = 0; size_t p = 0; uint32_t val; CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID); - if (length > sizeof(struct dom_sid)) return IDMAP_SID_INVALID; + if (length > sizeof(struct sss_dom_sid)) return IDMAP_SID_INVALID; - dom_sid = ctx->alloc_func(sizeof(struct dom_sid), ctx->alloc_pvt); + dom_sid = ctx->alloc_func(sizeof(struct sss_dom_sid), ctx->alloc_pvt); if (dom_sid == NULL) { return IDMAP_OUT_OF_MEMORY; } @@ -101,7 +101,7 @@ done: } enum idmap_error_code sss_idmap_dom_sid_to_bin_sid(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, uint8_t **_bin_sid, size_t *_length) { @@ -157,7 +157,7 @@ done: } enum idmap_error_code sss_idmap_dom_sid_to_sid(struct sss_idmap_ctx *ctx, - struct dom_sid *dom_sid, + struct sss_dom_sid *dom_sid, char **_sid) { enum idmap_error_code err; @@ -222,13 +222,13 @@ done: enum idmap_error_code sss_idmap_sid_to_dom_sid(struct sss_idmap_ctx *ctx, const char *sid, - struct dom_sid **_dom_sid) + struct sss_dom_sid **_dom_sid) { enum idmap_error_code err; unsigned long ul; char *r; char *end; - struct dom_sid *dom_sid; + struct sss_dom_sid *dom_sid; CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID); @@ -236,11 +236,11 @@ enum idmap_error_code sss_idmap_sid_to_dom_sid(struct sss_idmap_ctx *ctx, return IDMAP_SID_INVALID; } - dom_sid = ctx->alloc_func(sizeof(struct dom_sid), ctx->alloc_pvt); + dom_sid = ctx->alloc_func(sizeof(struct sss_dom_sid), ctx->alloc_pvt); if (dom_sid == NULL) { return IDMAP_OUT_OF_MEMORY; } - memset(dom_sid, 0, sizeof(struct dom_sid)); + memset(dom_sid, 0, sizeof(struct sss_dom_sid)); if (!isdigit(sid[2])) { @@ -330,7 +330,7 @@ enum idmap_error_code sss_idmap_sid_to_bin_sid(struct sss_idmap_ctx *ctx, size_t *_length) { enum idmap_error_code err; - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; size_t length; uint8_t *bin_sid = NULL; @@ -363,7 +363,7 @@ enum idmap_error_code sss_idmap_bin_sid_to_sid(struct sss_idmap_ctx *ctx, char **_sid) { enum idmap_error_code err; - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; char *sid = NULL; err = sss_idmap_bin_sid_to_dom_sid(ctx, bin_sid, length, &dom_sid); diff --git a/src/tests/sss_idmap-tests.c b/src/tests/sss_idmap-tests.c index d81922f..b821dfc 100644 --- a/src/tests/sss_idmap-tests.c +++ b/src/tests/sss_idmap-tests.c @@ -182,7 +182,7 @@ START_TEST(idmap_test_dom_sid2uid) { enum idmap_error_code err; uint32_t id; - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; err = sss_idmap_sid_to_dom_sid(idmap_ctx, "S-1-5-21-1-2-3-1000", &dom_sid); fail_unless(err == IDMAP_SUCCESS, "Failed to convert SID to SID structure"); @@ -219,7 +219,7 @@ END_TEST START_TEST(idmap_test_uid2dom_sid) { enum idmap_error_code err; - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; char *sid = NULL; err = sss_idmap_unix_to_dom_sid(idmap_ctx, 10000, &dom_sid); @@ -269,7 +269,7 @@ END_TEST START_TEST(idmap_test_sid_bin2dom_sid) { - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; enum idmap_error_code err; uint8_t *new_bin_sid = NULL; size_t new_bin_sid_length; @@ -278,12 +278,12 @@ START_TEST(idmap_test_sid_bin2dom_sid) test_bin_sid_length, &dom_sid); fail_unless(err == IDMAP_SUCCESS, - "Failed to convert binary SID to struct dom_sid."); + "Failed to convert binary SID to struct sss_dom_sid."); err = sss_idmap_dom_sid_to_bin_sid(idmap_ctx, dom_sid, &new_bin_sid, &new_bin_sid_length); fail_unless(err == IDMAP_SUCCESS, - "Failed to convert struct dom_sid to binary SID."); + "Failed to convert struct sss_dom_sid to binary SID."); fail_unless(new_bin_sid_length == test_bin_sid_length, "Length of binary SIDs do not match."); @@ -297,18 +297,18 @@ END_TEST START_TEST(idmap_test_sid2dom_sid) { - struct dom_sid *dom_sid = NULL; + struct sss_dom_sid *dom_sid = NULL; enum idmap_error_code err; char *new_sid = NULL; err = sss_idmap_sid_to_dom_sid(idmap_ctx, "S-1-5-21-1-2-3-1000", &dom_sid); fail_unless(err == IDMAP_SUCCESS, - "Failed to convert SID string to struct dom_sid."); + "Failed to convert SID string to struct sss_dom_sid."); err = sss_idmap_dom_sid_to_sid(idmap_ctx, dom_sid, &new_sid); fail_unless(err == IDMAP_SUCCESS, - "Failed to convert struct dom_sid to SID string."); + "Failed to convert struct sss_dom_sid to SID string."); fail_unless(new_sid != NULL, "SID string not set"); fail_unless(strlen("S-1-5-21-1-2-3-1000") == strlen(new_sid), -- 1.7.7.6