test_nested_groups.c revision 78fb1789e8a5c2c7c51ad9002bbbdf0a1e390bdf
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina Pavel Březina <pbrezina@redhat.com>
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina Copyright (C) 2013 Red Hat
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina This program is free software; you can redistribute it and/or modify
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina it under the terms of the GNU General Public License as published by
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina the Free Software Foundation; either version 3 of the License, or
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina (at your option) any later version.
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina This program is distributed in the hope that it will be useful,
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina GNU General Public License for more details.
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina You should have received a copy of the GNU General Public License
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
7b74632f498dd1edf69294b597a4d92ec6d73b9fPavel Březina#include "tests/cmocka/common_mock_sysdb_objects.h"
5d00ee0e07dea78806df780db69e94900e5bb8c0Jakub Hrozek#define TEST_CONF_DB "test_ldap_nested_groups_conf.ldb"
5d00ee0e07dea78806df780db69e94900e5bb8c0Jakub Hrozek cmocka_unit_test_setup_teardown(nested_groups_test_ ## test, \
751a7930d5af7c1a3c36936e3c5b9205189c6b92Pavel Březina/* put users and groups under the same container so we can easily run the
751a7930d5af7c1a3c36936e3c5b9205189c6b92Pavel Březina * same tests cases for several search base scenarios */
751a7930d5af7c1a3c36936e3c5b9205189c6b92Pavel Březina#define OBJECT_BASE_DN "cn=objects,dc=test,dc=com"
efe918d7cb27a6ac5901748fc1f5879e3296c012Pavel Březina#define GROUP_BASE_DN "cn=groups," OBJECT_BASE_DN
f143937efc6cbb1eb84042979c83dd5b3f23a40cPavel Březina#define USER_BASE_DN "cn=users," OBJECT_BASE_DN
c407643004a02566e35a864ba0d8b0c0f88d9d67Pavel Březina unsigned long num_users;
c407643004a02566e35a864ba0d8b0c0f88d9d67Pavel Březina unsigned long num_groups;
5f73b623fc72e3b9b3590420825f30e618b4d4ddPavel Březina/* Both arrays must have the same length! */
5f73b623fc72e3b9b3590420825f30e618b4d4ddPavel Březinastatic void compare_sysdb_string_array_noorder(struct sysdb_attrs **sysdb_array,
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina /* Check the returned groups. The order is irrelevant. */
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina for (i = 0; i < len; i++) {
e9eeb4302e0e426c6cc1a4e65b95a6f7066e80b9Pavel Březina ret = sysdb_attrs_get_string(sysdb_array[i], SYSDB_NAME, &name);
for (i = 0; i < len; i++) {
NULL };
const char *name;
NULL };
NULL };
NULL };
NULL };
NULL };
NULL };
NULL };
NULL };
NULL };
int rv;
int no_cleanup = 0;
int opt;
switch(opt) {
return rv;