>From cb86bce52a2b040001e26366df5ded1c18f9ba53 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 2 May 2014 19:15:17 +0200 Subject: [PATCH 1/2] SYSDB: return SYSDB_NAME from sysdb_initgroups For the GetGroupsList function it would be handy to get the user names as well with a single sysdb_initgroups() call. This patch adds SYSDB_NAME to the default attribute list. --- src/db/sysdb.h | 1 + src/tests/sysdb-tests.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 5d337ffd8c0f7fbe6808d50538192369102caf17..6710400182f3d74994c7313d3ae0f897778c0bd4 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -195,6 +195,7 @@ SYSDB_DEFAULT_ATTRS, \ SYSDB_ORIG_DN, \ SYSDB_SID_STR, \ + SYSDB_NAME, \ NULL} #define SYSDB_TMPL_USER SYSDB_NAME"=%s,"SYSDB_TMPL_USER_BASE diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index ffd11c523100bcf9c4f095121f63fed5b9f9ee5f..3e4d5f7f0f4e7ba887fab8ccf00d4f89771776f0 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -1309,6 +1309,11 @@ START_TEST (test_sysdb_initgroups) "Did not find the expected UID (found %d expected %d)", uid, _i); + fail_unless(strcmp(ldb_msg_find_attr_as_string(user, SYSDB_NAME, NULL), + username) == 0, + "Wrong username\n"); + + gid = ldb_msg_find_attr_as_uint(group, SYSDB_GIDNUM, 0); fail_unless(gid == _i + 1000, "Did not find the expected GID (found %d expected %d)", -- 1.9.0