359d341a35
- Ensure that the RPM creates the /var/lib/sss/mc directory - Add support for Netscape password warning expiration control - Rebuild against libldb 1.1.6
297 lines
12 KiB
Diff
297 lines
12 KiB
Diff
From 4e59e4c8f344e93a64d2bb53578c977475d76546 Mon Sep 17 00:00:00 2001
|
|
From: Sumit Bose <sbose@redhat.com>
|
|
Date: Mon, 14 May 2012 13:14:14 +0200
|
|
Subject: [PATCH 05/19] 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.
|
|
---
|
|
Makefile.am | 2 +-
|
|
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 ++++++++--------
|
|
5 files changed, 32 insertions(+), 32 deletions(-)
|
|
|
|
diff --git a/Makefile.am b/Makefile.am
|
|
index 5089b8e5c9cd6bddd0ad038423101a0d29e8b18e..2e13a9777a074e628b48bbd23626d019c2e5c617 100644
|
|
--- a/Makefile.am
|
|
+++ b/Makefile.am
|
|
@@ -500,7 +500,7 @@ libsss_idmap_la_SOURCES = \
|
|
src/lib/idmap/sss_idmap.c \
|
|
src/lib/idmap/sss_idmap_conv.c
|
|
libsss_idmap_la_LDFLAGS = \
|
|
- -version 1:0:1
|
|
+ -version-info 0:1:0
|
|
|
|
|
|
include_HEADERS = \
|
|
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
|
|
index c970293bccd2385886453afdc2573e2bbbc9c7ad..c589bd458a01ecd9ba298e879e21f746a2ef50e6 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 78e786afe680fa276e75148798a590115aec2c1b..a3ec919c8041bb151747cdb8b577dc25f64ad124 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 e2064f6dabf0c599ff415b9e5655c1d2d3f60dc5..df96fcc327679bedbe19fc2c8d7cc54f692a8161 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 d81922f1195413674a7a2b5f8429cfe0c2c037c5..b821dfc98b806f71e4d2a11b1fb609711d3e91b7 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.10.1
|
|
|