/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: AD access control filter tests
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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include <unistd.h>
#include <ifaddrs.h>
#include "util/crypto/sss_crypto.h"
#ifdef HAVE_NSS
#include "util/crypto/nss/nss_util.h"
#endif
#include "util/util_sss_idmap.h"
/* In order to access opaque types */
#include "providers/ad/ad_common.c"
#include "tests/cmocka/common_mock.h"
#include "tests/cmocka/common_mock_krb5.h"
static bool call_real_sasl_options;
NULL };
struct ad_sysdb_test_ctx {
};
{
struct ad_sysdb_test_ctx);
return 0;
}
{
return 0;
}
{
int ret;
/* PAC available but too old */
/* PAC available but still too old */
/* PAC available but still too old */
}
#define TEST_PAC_BASE64 \
"BQAAAAAAAAABAAAA6AEAAFgAAAAAAAAACgAAABAAAABAAgAAAA" \
"AAAAwAAAA4AAAAUAIAAAAAAAAGAAAAFAAAAIgCAAAAAAAABwAA" \
"ABQAAACgAgAAAAAAAAEQCADMzMzM2AEAAAAAAAAAAAIA2hr35p" \
"Ji0QH/////////f/////////9/4veKrwAP0AHit/TZyQ/QAf//" \
"//////9/BgAGAAQAAgAGAAYACAACAAAAAAAMAAIAAAAAABAAAg" \
"AAAAAAFAACAAAAAAAYAAIATwAAAFAEAAABAgAABQAAABwAAgAg" \
"AAAAAAAAAAAAAAAAAAAAAAAAABIAFAAgAAIABAAGACQAAgAoAA" \
"IAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \
"AAAAAAEAAAAsAAIAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAdA" \
"B1ADEAAAADAAAAAAAAAAMAAAB0ACAAdQAAAAAAAAAAAAAAAAAA" \
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \
"UAAAD9ogAABwAAAAECAAAHAAAAXAQAAAcAAABWBAAABwAAAImm" \
"AAAHAAAACgAAAAAAAAAJAAAAQQBEAC0AUwBFAFIAVgBFAFIAAA" \
"ADAAAAAAAAAAIAAABBAEQABAAAAAEEAAAAAAAFFQAAAPgSE9xH" \
"8xx2Ry8u1wEAAAAwAAIABwAAAAUAAAABBQAAAAAABRUAAAApyU" \
"AAAAAAAAAAB0AHUAMQBAAGEAZAAuAGQAZQB2AGUAbABBAEQALg" \
"BEAEUAVgBFAEwAdv///4yBQZ5ZQnp3qwj2lKGcd0UAAAAAdv//" \
"/39fn4UneD5l6YxP8w/U0coAAAAA"
{
int ret;
struct ad_common_test_ctx);
&logon_info);
}
{
int ret;
char *user_sid;
char *primary_group_sid;
char **sid_list;
size_t c;
size_t s;
"S-1-5-21-3692237560-1981608775-3610128199-1110",
"S-1-5-21-3692237560-1981608775-3610128199-1116",
"S-1-5-21-3692237560-1981608775-3610128199-41725",
"S-1-5-21-3692237560-1981608775-3610128199-42633",
"S-1-5-21-3645884713-2026060994-4169618742-1108",
NULL };
struct ad_common_test_ctx);
&idmap_ctx);
&logon_info);
"S-1-5-21-3692237560-1981608775-3610128199-1104");
"S-1-5-21-3692237560-1981608775-3610128199-513");
for (c = 0; sid_check_list[c] != NULL; c++) {
for (s = 0; s < num_sids; s++) {
break;
}
}
if (s == num_sids) {
}
}
}
{
int ret;
struct ad_common_test_ctx);
char *username;
char *user_sid;
char *primary_group_sid;
char **sid_list;
size_t c;
size_t s;
"S-1-5-21-3692237560-1981608775-3610128199-1110",
"S-1-5-21-3692237560-1981608775-3610128199-1116",
"S-1-5-21-3692237560-1981608775-3610128199-41725",
"S-1-5-21-3692237560-1981608775-3610128199-42633",
"S-1-5-21-3645884713-2026060994-4169618742-1108",
NULL };
&idmap_ctx);
&sid_list);
"S-1-5-21-3692237560-1981608775-3610128199-1104");
"S-1-5-21-3692237560-1981608775-3610128199-513");
for (c = 0; sid_check_list[c] != NULL; c++) {
for (s = 0; s < num_sids; s++) {
break;
}
}
if (s == num_sids) {
}
}
}
{
}
struct ad_common_test_ctx {
};
{
return 0;
}
{
int ret;
struct ad_common_test_ctx);
return 0;
}
{
struct ad_common_test_ctx);
const char *s;
call_real_sasl_options = true;
/* Make sure this is not the keytab that __wrap_krb5_kt_default uses */
NULL,
NULL,
NULL,
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
}
{
struct ad_common_test_ctx);
const char *s;
call_real_sasl_options = true;
NULL,
NULL,
NULL,
NULL);
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
assert_null(s); /* This is the system keytab */
assert_non_null(s);
assert_non_null(s);
assert_non_null(s);
}
static int
{
NULL,
NULL,
NULL,
NULL);
struct sdap_options);
return 0;
}
static int
{
struct ad_common_test_ctx);
test_ad_common_teardown((void **) &test_ctx);
return 0;
}
char *default_primary,
char *default_realm,
const char *keytab_path);
char *default_primary,
char *default_realm,
const char *keytab_path)
{
/* Pretend SASL is fine */
if (call_real_sasl_options == true) {
return __real_sdap_set_sasl_options(id_opts,
}
return EOK;
}
{
struct ad_common_test_ctx);
}
{
struct ad_common_test_ctx);
AD_ENABLE_GC));
/* If there is a fallback, we should ignore the offline mode */
/* Subdomain error should not set the backend offline! */
AD_ENABLE_GC));
}
{
struct ad_common_test_ctx);
}
{
struct ad_common_test_ctx);
/* Subdomain error should not set the backend offline! */
}
{
int ret;
char *flat_name;
char *site;
char *forest;
struct ad_common_test_ctx);
val.data = sss_base64_decode(test_ctx, "FwAAAP0zAABsGcIYI7j2TL97Rd+TvpATAmFkBWRldmVsAMAYCWFkLXNlcnZlcsAYAkFEAAlBRC1TRVJWRVIAABdEZWZhdWx0LUZpcnN0LVNpdGUtTmFtZQDAQAUAAAD/////", &val.length);
/* missing site */
val.data = sss_base64_decode(test_ctx, "FwAAAH0zAABsGcIYI7j2TL97Rd+TvpATAmFkBWRldmVsAMAYCWFkLXNlcnZlcsAYAkFEAAlBRC1TRVJWRVIAABdEZWZhdWx0LUZpcnN0LVNpdGUtTmFtZQAABQAAAP////8=", &val.length);
}
{
int opt;
int ret;
};
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
#ifdef HAVE_NSS
/* Cleanup NSS and NSPR to make Valgrind happy. */
#endif
return ret;
}