pac_responder-tests.c revision 4139a7a731f2831963a42b26aac111422be28792
/*
SSSD - Test for PAC reponder functions
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2012 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 <check.h>
#include <stdbool.h>
#include <math.h>
#include <util/data_blob.h>
#include <gen_ndr/security.h>
#include "tests/common_check.h"
#include "lib/idmap/sss_idmap.h"
{21, 2127521184, 1604012920, 1887927527, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
const char *test_dom_sid_str = "S-1-5-21-2127521184-1604012920-1887927527";
{21, 123, 456, 789, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
const char *test_remote_dom_sid_str = "S-1-5-21-123-456-789";
{21, 2127521184, 1604012920, 1887927527, 1123,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
{21, 2127521184, 1604012920, 1887927527, 201456,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
{1000, 200999},
{201000, 400999}};
{
}
{
}
#define IDMAP_RANGE_MIN 1234
#define IDMAP_RANGE_MAX 9876543
void pac_setup(void) {
enum idmap_error_code err;
struct sss_domain_info *sd;
"TEST.DOM");
"TESTDOM");
"talloc_strdup failed.");
"talloc_strdup failed.");
}
void pac_teardown(void)
{
}
{
int ret;
"Failed to convert local sid to id.");
}
{
int ret;
"Failed to convert local sid to id.");
test_id_2nd, id);
}
{
int ret;
size_t c;
size_t add_gid_count = 0;
size_t del_gid_count = 0;
struct sss_domain_info grp_dom;
struct a_and_r_data {
struct pac_dom_grps *gids;
int exp_ret;
struct pac_dom_grps *exp_add_gids;
struct grp_info *exp_del_gids;
} a_and_r_data[] = {
};
&del_gid_count, &del_gids);
"groups.");
&del_gid_count, &del_gids);
"invalid current groups.");
&del_gid_count, &del_gids);
"invalid new groups.");
a_and_r_data[c].cur_gids,
a_and_r_data[c].gids,
&del_gid_count, &del_gids);
"Unexpected return value for test data #%d, " \
"expected [%d], got [%d]",
"Unexpected numer of groups to add for test data #%d, " \
"expected [%d], got [%d]",
"Unexpected numer of groups to delete for test data #%d, " \
"expected [%d], got [%d]",
/* The lists might be returned in any order, to make tests simple we
* only look at lists with 1 element. TODO: add code to compare lists
* with more than 1 member. */
if (add_gid_count == 1) {
"Unexpected gid to add for test data #%d, " \
"expected [%d], got [%d]",
}
if (del_gid_count == 1) {
"Unexpected gid to delete for test data #%d, " \
"expected [%d], got [%d]",
}
}
}
#define NUM_DOMAINS 10
{
struct sss_domain_info *domains;
struct sss_domain_info *dom;
size_t c;
char *id;
for (c = 0; c < NUM_DOMAINS; c++) {
}
for (c = 0; c < NUM_DOMAINS; c++) {
"Wrong domain returned for id [%s].", id);
}
}
{
int ret;
size_t c;
size_t d;
size_t g;
size_t t;
struct pac_dom_grps *gids;
struct PAC_LOGON_INFO *logon_info;
bool found;
struct timeval start_time;
struct samr_RidWithAttribute,
}
ret);
/* change SID to a known one */
"[%d] groups expected, got [%d]",
found = false;
for (g = 0; g < gid_count; g++) {
found = true;
break;
}
}
}
/* duplicated RIDs */
}
IDMAP_RANGE_MIN + 500);
for (c = 0; exp_gids[c] != 0; c++) {
found = false;
for (d = 0; d < 2; d++) {
found = true;
break;
}
}
if (found) {
break;
}
}
}
for (t = 0; t < 7; t++) {
struct samr_RidWithAttribute,
}
"duration [%ds %dus]\n", t,
}
}
Suite *idmap_test_suite (void)
{
suite_add_tcase(s, tc_pac);
return s;
}
{
int number_failed;
Suite *s = idmap_test_suite();
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
srunner_free (sr);
}