/*
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Tests for utility functions
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/>.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "test_utils.h"
struct dom_list_test_ctx {
};
{
struct sss_domain_info *c = NULL;
assert_non_null(c);
assert_non_null(c->name);
assert_non_null(c->realm);
assert_non_null(c->flat_name);
assert_non_null(c->domain_id);
assert_non_null(c);
assert_non_null(c->name);
assert_non_null(c->realm);
assert_non_null(c->flat_name);
assert_non_null(c->domain_id);
assert_non_null(c);
assert_non_null(c->name);
assert_non_null(c->realm);
assert_non_null(c->flat_name);
assert_non_null(c->domain_id);
return 0;
}
{
size_t c;
}
return 0;
}
{
struct dom_list_test_ctx);
return 1;
}
return 0;
}
{
struct dom_list_test_ctx);
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
}
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
for (c = 0; c < mis; c++) {
}
if (c == mis - 1) {
} else {
}
if (c == mis - 1) {
} else {
}
if (c == mis - 1) {
} else {
}
}
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
for (c = 0; c < mis; c++) {
}
if (c == mis - 1) {
} else {
}
if (c == mis - 1) {
} else {
}
if (c == mis - 1) {
} else {
}
}
}
{
struct dom_list_test_ctx);
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
}
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
for (c = 0; c < mis; c++) {
}
if (c == mis - 1) {
} else {
}
}
}
{
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
for (c = 0; c < mis; c++) {
}
if (c == mis - 1) {
} else {
}
}
}
/*
* dom1 -> sub1a
* |
* dom2 -> sub2a -> sub2b
*
*/
{
return 0;
}
{
struct dom_list_test_ctx);
return 1;
}
return 0;
}
{
struct dom_list_test_ctx);
}
{
struct dom_list_test_ctx);
}
{
struct dom_list_test_ctx);
}
}
{
struct dom_list_test_ctx);
/* No flags; all doms enabled */
gnd_flags = 0;
/* Descend flag only; all doms enabled */
/* Incl. disabled flag only; all doms enabled */
/* Descend and include disabled; all doms enabled */
/* Now disable dom2 and sub2a */
/* No flags; dom2 and sub2a disabled */
gnd_flags = 0;
/* Descend flag only; dom2 and sub2a disabled */
/* Incl. disabled flag only; dom2 and sub2a disabled */
/* Descend and include disabled; dom2 and sub2a disabled */
}
struct name_init_test_ctx {
};
"((?P<name>[^@]+)@(?P<domain>.+$))|" \
"(^(?P<name>[^@\\\\]+)$))"
{
int ret;
val[0] = TEST_DOMAIN_NAME;
val[0] = GLOBAL_FULL_NAME_FORMAT;
val[0] = GLOBAL_RE_EXPRESSION;
val[0] = "ldap";
val[0] = DOMAIN_FULL_NAME_FORMAT;
val[0] = DOMAIN_RE_EXPRESSION;
return 0;
}
{
return 0;
}
{
int ret;
&names_ctx);
}
{
int ret;
const char *name;
const char *dom;
}
{
int ret;
const char *sid;
}
{
int ret;
char *sanitized;
char *lc_sanitized;
dom->case_sensitive = true;
&sanitized, &lc_sanitized);
dom->case_sensitive = false;
&sanitized, &lc_sanitized);
}
struct sss_nss_homedir_ctx *homedir_ctx,
{
char *homedir;
} else {
}
}
{
struct sss_nss_homedir_ctx);
return 1;
}
*state = homedir_ctx;
return 0;
}
{
struct sss_nss_homedir_ctx);
if (homedir_ctx == NULL) {
return 1;
}
return 0;
}
{
char *homedir;
/* following format strings requires data in homedir_ctx */
NULL };
int i;
/* missing data in homedir_ctx */
for (i = 0; format_strings[i] != NULL; ++i) {
}
/* flatname requires domain and username */
/* test unknown format string */
/* test malformed format string */
}
{
struct sss_nss_homedir_ctx);
/* string without template */
/* test all format strings */
}
{
return 0;
}
{
return 0;
}
{
char **res;
int ret;
size_t c;
size_t d;
assert_null(res[0]);
assert_null(res[0]);
/* 'copy_strings' is 'false', pointers must be equal */
}
assert_null(res[c]);
/* 'copy_strings' is 'true', pointers must be different, but strings
* must be equal */
}
assert_null(res[c]);
/* 'copy_strings' is 'false', pointers must be equal */
}
assert_null(res[c]);
/* 'copy_strings' is 'true', pointers must be different, but strings
* must be equal */
}
assert_null(res[c]);
/* 'copy_strings' is 'false', pointers must be equal */
}
}
assert_null(res[c+d]);
/* 'copy_strings' is 'true', pointers must be different, but strings
* must be equal */
}
}
assert_null(res[c+d]);
}
{
int ret;
char *cwd;
char *path;
char *file;
char *file_krb5_libdefaults;
assert_true(ret > 0);
assert_true(ret > 0);
assert_true(ret > 0);
/* Check if writing a second time will work as well */
#ifdef HAVE_KRB5_LOCALAUTH_PLUGIN
#endif
}
struct unique_file_test_ctx {
char *filename;
};
{
return 0;
}
{
errno = 0;
fail();
}
return 0;
}
struct unique_file_test_ctx *test_ctx)
{
int fd;
char *check_filename;
/* Test that the destructor works */
return;
}
}
bool test_destructor)
{
int fd;
if (test_destructor) {
}
}
{
sss_unique_file_test(test_ctx, false);
}
{
sss_unique_file_test(test_ctx, true);
}
{
int fd;
}
bool test_destructor)
{
int fd;
char *tmp_filename;
if (test_destructor) {
}
0);
}
{
sss_unique_filename_test(test_ctx, false);
}
{
sss_unique_filename_test(test_ctx, true);
}
{
int ret;
&cv_opts);
"no_ocsp,no_verification", &cv_opts);
"ocsp_default_responder=", &cv_opts);
"ocsp_default_responder_signing_cert=",
&cv_opts);
"ocsp_default_responder=abc", &cv_opts);
"ocsp_default_responder_signing_cert=def",
&cv_opts);
"ocsp_default_responder=abc,"
"ocsp_default_responder_signing_cert=def",
&cv_opts);
}
const char *exp_shortname,
const char *exp_domname)
{
if (exp_shortname) {
}
if (exp_domname) {
}
}
{
}
{
}
{
}
{
in_list1, "DOM");
NULL, "DOM");
}
{
char *outname;
char *fqname;
"Foo Bar", "DOM");
}
{
int ret;
char *content;
struct sss_domain_info *c;
/* no forest */
"[domain_realm]\n"
".subdom1.dom = SUBDOM1.DOM\n"
"subdom1.dom = SUBDOM1.DOM\n"
".subdom2.dom = SUBDOM2.DOM\n"
"subdom2.dom = SUBDOM2.DOM\n"
".subdom3.dom = SUBDOM3.DOM\n"
"subdom3.dom = SUBDOM3.DOM\n");
/* IPA with forest */
assert_non_null(c);
assert_non_null(c);
"[domain_realm]\n"
".subdom1.dom = SUBDOM1.DOM\n"
"subdom1.dom = SUBDOM1.DOM\n"
".subdom2.dom = SUBDOM2.DOM\n"
"subdom2.dom = SUBDOM2.DOM\n"
".subdom3.dom = SUBDOM3.DOM\n"
"subdom3.dom = SUBDOM3.DOM\n"
"[capaths]\n"
"SUBDOM2.DOM = {\n"
" CONFIGURED.DOM = SUBDOM1.DOM\n"
"}\n"
"SUBDOM3.DOM = {\n"
" CONFIGURED.DOM = SUBDOM1.DOM\n"
"}\n"
"CONFIGURED.DOM = {\n"
" SUBDOM2.DOM = SUBDOM1.DOM\n"
" SUBDOM3.DOM = SUBDOM1.DOM\n"
"}\n");
/* Next steps, test AD domain setup. If we join a child domain we have a
* similar case as with IPA but if we join the forest root the generate
* capaths might not be as expected. */
}
{
struct dom_list_test_ctx);
struct sss_domain_info *d;
assert_non_null(d);
}
{
int opt;
int rv;
};
#ifdef BUILD_SSH
#endif
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* Even though normally the tests should clean up after themselves
* they might not after a failed run. Remove the old DB to be sure */
if (rv == 0) {
}
return rv;
}