/*
SSSD
sysdb_subdomains - Tests for subdomains and related calls
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2015 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "db/sysdb_private.h" /* for sysdb->ldb member */
NULL };
struct subdom_test_ctx {
};
{
};
struct subdom_test_ctx);
return 0;
}
{
return 0;
}
{
/* Reverse the trust directions */
}
{
"realm1", "flat1", "id1", "forest1",
NULL);
"realm2", "flat2", "id2", "forest2",
NULL);
}
/* Parent domain totally separate from subdomains that imitate
* IPA domain and two forests
*/
{
/* name, realm, flat, SID, forest */
"DOM1", "S-1", "DOM1.SUB" };
"CHILD1.DOM1", "S-1-2", "DOM1.SUB" };
"DOM2", "S-2", "DOM2.SUB" };
"CHILD2.DOM1", "S-2-2", "DOM2.SUB" };
false, false, child_dom1[4],
0, NULL);
false, false, dom2[4],
0, NULL);
false, false, child_dom2[4],
0, NULL);
/* Also update dom2 */
}
/* Parent domain is an AD forest root and there are two subdomains
* child and parallel
*/
{
"CHILD.TEST_SYSDB_SUBDOMAINS",/* realm */
"CHILD", /* flat */
"S-1-2", /* sid */
TEST_FOREST }; /* forest */
"ANOTHER.SUBDOMAIN", /* realm */
"ANOTHER", /* flat */
"S-1-3", /* sid */
TEST_FOREST }; /* forest */
NULL);
false, false, child_dom[4],
0, NULL);
false, false, sub_dom[4],
0, NULL);
/* Also update dom2 */
/* Another separate domain is a forest of its own */
}
/* Parent domain is an AD member domain connected to a root domain
*/
{
TEST_FOREST, /* realm */
TEST_FLAT_NAME, /* flat */
TEST_SID, /* sid */
TEST_FOREST }; /* forest */
"CHILD.TEST_SYSDB_SUBDOMAINS",/* realm */
"CHILD", /* flat */
"S-1-2", /* sid */
TEST_FOREST }; /* forest */
"ANOTHER.SUBDOMAIN", /* realm */
"ANOTHER", /* flat */
"S-1-3", /* sid */
TEST_FOREST }; /* forest */
child_dom[1],
child_dom[2],
child_dom[3],
NULL);
false, false, sub_dom[4],
0, NULL);
false, false, forest_root[4],
0, NULL);
/* Also update dom2 */
/* Checks */
/* Another separate domain is a forest of its own */
}
/* Each parent domain has a subdomain. One parent domain is a root domain,
* the other is not.
*/
{
"CHILD.TEST_SYSDB_SUBDOMAINS",/* realm */
"CHILD", /* flat */
"S-1-2", /* sid */
TEST_FOREST }; /* forest */
{ "test_sysdb_subdomains_2", /* name */
TEST_FOREST2, /* realm */
"TEST2", /* flat */
TEST_SID2, /* sid */
TEST_FOREST2 }; /* forest */
NULL);
false, false, child_dom[4],
0, NULL);
NULL);
}
{
int ret;
char *dom_basedn;
"child2.test_sysdb_subdomains_2", true);
assert_non_null(usr_attrs[0]);
"uid=user,cn=abc,dc=c2,dc=child2,dc=test_sysdb_subdomains_2");
"uid=user1,cn=abc,dc=child2,dc=test_sysdb_subdomains_2");
"uid=user2,cn=abc,dc=c2,dc=child2,dc=test_sysdb_subdomains_2");
/* Make sure cn=users match is preferred */
"uid=user2,cn=abc,cn=users,dc=child2,dc=test_sysdb_subdomains_2");
/* test a case where the domain name does not match the basedn */
dom_usr_attrs[0] = usr_attrs[0];
/* Make sure cn=users match is preferred */
"uid=user2,cn=abc,dc=c2,dc=child2,dc=test_sysdb_subdomains_2");
talloc_free(usr_attrs[0]);
}
{
int rv;
int no_cleanup = 0;
int opt;
_("Do not delete the test database after a test run"), NULL },
};
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
if (rv == 0 && no_cleanup == 0) {
}
return rv;
}