test_utils.c revision c84dcaa58449c53cf038311ce63bb2c304081b9d
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd Sumit Bose <sbose@redhat.com>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd Copyright (C) 2013 Red Hat
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd SSSD tests: Tests for utility functions
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd This program is free software; you can redistribute it and/or modify
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd it under the terms of the GNU General Public License as published by
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen the Free Software Foundation; either version 3 of the License, or
2e545ce2450a9953665f701bb05350f0d3f26275nd (at your option) any later version.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen This program is distributed in the hope that it will be useful,
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd but WITHOUT ANY WARRANTY; without even the implied warranty of
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen GNU General Public License for more details.
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd You should have received a copy of the GNU General Public License
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd along with this program. If not, see <http://www.gnu.org/licenses/>.
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd test_ctx = talloc_zero(global_talloc_context, struct dom_list_test_ctx);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, NULL, false);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, name, false);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, name, true);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, flat_name, true);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, flat_name, false);
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndvoid test_find_domain_by_name_missing_flat_name(void **state)
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd for (c = 0; c < mis; c++) {
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, name, true);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, name, false);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, flat_name, true);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd dom = find_domain_by_name(test_ctx->dom_list, flat_name, false);
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd struct dom_list_test_ctx *test_ctx = talloc_get_type(*state,
0d0ba3a410038e179b695446bb149cce6264e0abnd for (c = 0; c < mis; c++) {
0d0ba3a410038e179b695446bb149cce6264e0abnd name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
0d0ba3a410038e179b695446bb149cce6264e0abnd flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
0d0ba3a410038e179b695446bb149cce6264e0abnd sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
07dc96d063d49299da433f84b5c5681da9bbdf68rbowen dom = find_domain_by_name(test_ctx->dom_list, name, true);
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++) {
struct dom_list_test_ctx);
size_t c;
char *name;
char *flat_name;
char *sid;
for (c = 0; c < mis; c++) {
struct dom_list_test_ctx);
struct dom_list_test_ctx);
struct dom_list_test_ctx);
struct dom_list_test_ctx);
struct dom_list_test_ctx);
gnd_flags = 0;
gnd_flags = 0;
struct name_init_test_ctx {
int ret;
int ret;
&names_ctx);
int ret;
const char *name;
const char *dom;
int ret;
const char *sid;
int ret;
char *sanitized;
char *lc_sanitized;
char *homedir;
struct sss_nss_homedir_ctx);
struct sss_nss_homedir_ctx);
char *homedir;
NULL };
struct sss_nss_homedir_ctx);
char **res;
int ret;
size_t c;
size_t d;
int ret;
char *cwd;
char *path;
char *file;
#ifdef HAVE_KRB5_LOCALAUTH_PLUGIN
int ret;
struct unique_file_test_ctx {
char *filename;
errno = 0;
fail();
int fd;
char *check_filename;
bool test_destructor)
int fd;
if (test_destructor) {
int fd;
bool test_destructor)
int fd;
char *tmp_filename;
if (test_destructor) {
int opt;
int rv;
switch(opt) {
if (rv == 0) {
return rv;