From 601c39cdea7c3a3fef66b50e2e07f3c211e25b52 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 13 Nov 2009 10:50:27 -0500 Subject: [PATCH 1/5] Make the sysdb user and group names case-sensitive --- server/db/sysdb_private.h | 1 - server/tests/sysdb-tests.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletions(-) diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h index 1f603eb..ea4b246 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 fffcb72..f1d3ae4 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); } -- 1.6.2.5