summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2017-07-20 20:11:57 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2017-07-24 21:15:17 +0200
commitc377d4d604f1e7b35c484711f1084b7a761772b6 (patch)
tree5ba3372f9e9e541295f35dff6aa2e05338726da2
parent93493702980e23d5b0322d16681f4ba77d6dd999 (diff)
downloadsssd-c377d4d604f1e7b35c484711f1084b7a761772b6.tar.gz
sssd-c377d4d604f1e7b35c484711f1084b7a761772b6.tar.xz
sssd-c377d4d604f1e7b35c484711f1084b7a761772b6.zip
idmap_error_string: add missing descriptions
Related to https://pagure.io/SSSD/sssd/issue/1960 Related to https://pagure.io/SSSD/sssd/issue/1938 Related to https://pagure.io/SSSD/sssd/issue/1844 Related to https://pagure.io/SSSD/sssd/issue/1593 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rw-r--r--Makefile.am2
-rw-r--r--src/lib/idmap/sss_idmap.c16
-rw-r--r--src/lib/idmap/sss_idmap.h6
-rw-r--r--src/tests/cmocka/test_sss_idmap.c11
4 files changed, 33 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 5635a8c8f..9000866b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1139,7 +1139,7 @@ libsss_idmap_la_SOURCES = \
src/util/murmurhash3.c
libsss_idmap_la_LDFLAGS = \
-Wl,--version-script,$(srcdir)/src/lib/idmap/sss_idmap.exports \
- -version-info 5:0:5
+ -version-info 5:1:5
dist_noinst_DATA += src/lib/idmap/sss_idmap.exports
diff --git a/src/lib/idmap/sss_idmap.c b/src/lib/idmap/sss_idmap.c
index ffb218c84..51338c587 100644
--- a/src/lib/idmap/sss_idmap.c
+++ b/src/lib/idmap/sss_idmap.c
@@ -180,6 +180,22 @@ const char *idmap_error_string(enum idmap_error_code err)
break;
case IDMAP_NO_RANGE:
return "IDMAP range not found";
+ break;
+ case IDMAP_BUILTIN_SID:
+ return "IDMAP SID from BUILTIN domain";
+ break;
+ case IDMAP_OUT_OF_SLICES:
+ return "IDMAP not more free slices";
+ break;
+ case IDMAP_COLLISION:
+ return "IDMAP new range collides with existing one";
+ break;
+ case IDMAP_EXTERNAL:
+ return "IDMAP ID managed externally";
+ break;
+ case IDMAP_NAME_UNKNOWN:
+ return "IDMAP domain with the given name not found";
+ break;
default:
return "IDMAP unknown error code";
}
diff --git a/src/lib/idmap/sss_idmap.h b/src/lib/idmap/sss_idmap.h
index 20fdb6169..9c27a1600 100644
--- a/src/lib/idmap/sss_idmap.h
+++ b/src/lib/idmap/sss_idmap.h
@@ -84,7 +84,11 @@ enum idmap_error_code {
IDMAP_EXTERNAL,
/** The provided name was not found */
- IDMAP_NAME_UNKNOWN
+ IDMAP_NAME_UNKNOWN,
+
+ /** Sentinel to indicate the end of the error code list, not returned by
+ * any call */
+ IDMAP_ERR_LAST
};
/**
diff --git a/src/tests/cmocka/test_sss_idmap.c b/src/tests/cmocka/test_sss_idmap.c
index f82e3dc51..7c0bf767f 100644
--- a/src/tests/cmocka/test_sss_idmap.c
+++ b/src/tests/cmocka/test_sss_idmap.c
@@ -674,6 +674,16 @@ void test_sss_idmap_check_collision_ex(void **state)
assert_int_equal(err, IDMAP_SUCCESS);
}
+void test_sss_idmap_error_string(void **state)
+{
+ size_t c;
+
+ for (c = IDMAP_SUCCESS; c < IDMAP_ERR_LAST; c++) {
+ assert_string_not_equal(idmap_error_string(c),
+ idmap_error_string(IDMAP_ERR_LAST));
+ }
+}
+
int main(int argc, const char *argv[])
{
poptContext pc;
@@ -713,6 +723,7 @@ int main(int argc, const char *argv[])
test_sss_idmap_setup_with_both,
test_sss_idmap_teardown),
cmocka_unit_test(test_sss_idmap_check_collision_ex),
+ cmocka_unit_test(test_sss_idmap_error_string),
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */