summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-11-13 10:50:27 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-18 06:47:23 -0500
commite5d8e5e436667166facdce454b240549dcfd04cd (patch)
tree8b3fbf369f593cd46781d5f822b2283bd42f7fbc /server
parent0922a8897a6ae1ce7b7c994df0a5cb99c36bfd9c (diff)
downloadsssd-e5d8e5e436667166facdce454b240549dcfd04cd.tar.gz
sssd-e5d8e5e436667166facdce454b240549dcfd04cd.tar.xz
sssd-e5d8e5e436667166facdce454b240549dcfd04cd.zip
Make the sysdb user and group names case-sensitive
Diffstat (limited to 'server')
-rw-r--r--server/db/sysdb_private.h1
-rw-r--r--server/tests/sysdb-tests.c39
2 files changed, 39 insertions, 1 deletions
diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h
index 1f603eb4b..ea4b24680 100644
--- a/server/db/sysdb_private.h
+++ b/server/db/sysdb_private.h
@@ -34,7 +34,6 @@
"cn: CASE_INSENSITIVE\n" \
"dc: CASE_INSENSITIVE\n" \
"dn: CASE_INSENSITIVE\n" \
- "name: CASE_INSENSITIVE\n" \
"objectclass: CASE_INSENSITIVE\n" \
"\n" \
"dn: @INDEXLIST\n" \
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index fffcb72ad..f1d3ae49d 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -1398,6 +1398,7 @@ START_TEST (test_sysdb_getpwnam)
{
struct sysdb_test_ctx *test_ctx;
struct test_data *data;
+ struct test_data *data_uc;
int ret;
/* Setup */
@@ -1428,6 +1429,25 @@ START_TEST (test_sysdb_getpwnam)
}
fail_unless(data->uid == _i,
"Did not find the expected UID");
+
+ /* Search for the user with the wrong case */
+ data_uc = talloc_zero(test_ctx, struct test_data);
+ data_uc->ctx = test_ctx;
+ data_uc->username = talloc_asprintf(data_uc, "TESTUSER%d", _i);
+
+ ret = sysdb_getpwnam(test_ctx,
+ test_ctx->sysdb,
+ data_uc->ctx->domain,
+ data_uc->username,
+ test_getpwent,
+ data_uc);
+ if (ret == EOK) {
+ ret = test_loop(data_uc);
+ }
+
+ fail_unless(ret == ENOENT,
+ "The upper-case username search should fail. ");
+
done:
talloc_free(test_ctx);
}
@@ -1437,6 +1457,7 @@ START_TEST (test_sysdb_getgrnam)
{
struct sysdb_test_ctx *test_ctx;
struct test_data *data;
+ struct test_data *data_uc;
int ret;
/* Setup */
@@ -1468,6 +1489,24 @@ START_TEST (test_sysdb_getgrnam)
fail_unless(data->gid == _i,
"Did not find the expected GID (found %d expected %d)",
data->gid, _i);
+
+ /* Search for the group with the wrong case */
+ data_uc = talloc_zero(test_ctx, struct test_data);
+ data_uc->ctx = test_ctx;
+ data_uc->groupname = talloc_asprintf(data_uc, "TESTGROUP%d", _i);
+
+ ret = sysdb_getgrnam(test_ctx,
+ test_ctx->sysdb,
+ data_uc->ctx->domain,
+ data_uc->groupname,
+ test_getgrent,
+ data_uc);
+ if (ret == EOK) {
+ ret = test_loop(data_uc);
+ }
+
+ fail_unless(ret == ENOENT,
+ "The upper-case groupname search should fail. ");
done:
talloc_free(test_ctx);
}