/*
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Unit tests for libsss_idmap
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 <popt.h>
#include "tests/cmocka/common_mock.h"
#include "lib/idmap/sss_idmap.h"
#define TEST_FIRST_RID 0
#define TEST_EXT_MAPPING true
#define TEST_2_EXT_MAPPING true
struct test_ctx {
};
{
}
{
}
{
return 0;
}
bool second_domain, bool sec_slices)
{
const char *name;
const char *sid;
if (second_domain) {
} else {
sid = TEST_DOM_SID;
}
if (sec_slices) {
} else {
NULL, 0, external_mapping);
}
if (sec_slices) {
} else {
}
return 0;
}
{
const char *name;
const char *sid;
/* Pick a new slice. */
sid = TEST_DOM_SID;
&range);
/* Range computation should be deterministic. Lets validate that. */
NULL, 0, false /* No external mapping */);
return 0;
}
{
setup_ranges(test_ctx, false, false, false);
return 0;
}
{
return 0;
}
{
setup_ranges(test_ctx, false, false, true);
return 0;
}
{
setup_ranges(test_ctx, true, false, false);
return 0;
}
{
setup_ranges(test_ctx, false, false, false);
setup_ranges(test_ctx, true, true, false);
return 0;
}
{
return 0;
}
{
&range);
&range);
false);
false);
true);
false);
false);
true);
}
{
&id);
}
/* ID mapping - bug in computing max id for slice range */
{
/* Last SID = first SID + (default) rangesize -1 */
/* Last SID = first SID + rangesize */
/* Min UNIX ID to SID */
/* First SID to UNIX ID */
/* Max UNIX ID to SID */
/* Last SID to UNIX ID */
/* Max UNIX ID + 1 to SID */
&sid);
/* Last SID + 1 to UNIX ID */
/* Auto adding new ranges is disable in this test. */
}
{
&id);
}
{
&id);
}
{
TEST_RANGE_MIN-1);
}
{
bool use_id_mapping;
TEST_DOM_SID"1",
}
{
bool use_id_mapping;
TEST_DOM_NAME"1",
}
{
/* Same name, different SID */
/* Same SID, different name */
/* Same SID and name, no overlaps */
/* Same SID and name, different mappings */
/* Same SID and name, Overlapping RID range */
false,
false);
/* Different SID and name, Overlapping RID range */
false,
false);
/* Overlapping ranges with no external mapping */
false,
false);
/* Overlapping ranges with external mapping */
true,
true);
}
{
size_t c;
for (c = IDMAP_SUCCESS; c < IDMAP_ERR_LAST; c++) {
}
}
{
&range);
&range);
slice_num++;
&range);
}
{
int opt;
};
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
}