/*
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>
/* In order to access opaque types */
#include "providers/ad/ad_access.c"
#include "tests/cmocka/common_mock.h"
struct ad_access_test_ctx {
};
{
struct ad_access_test_ctx);
return 0;
}
{
return 0;
}
struct filter_parse_result {
const int result;
const char *best_match;
};
struct filter_parse_result *expected)
{
char *best_match;
&best_match);
goto done;
}
} else {
}
done:
}
/* Test that setting no filter lets all access through
*/
{
.best_match = NULL
};
}
/* Test that if one filter is provided, it is returned as-is
*/
{
.best_match = "(name=foo)"
};
}
/* Test that if more filters are provided, the best match is returned */
{
.best_match = "(name=foo)"
};
/* Test that another foreign domain wouldn't match */
}
{
.best_match = NULL
};
}
{
return 0;
}
{
return 0;
}
struct parse_result {
const int result;
const char *filter;
const char *spec;
const int flags;
};
{
char *filter;
char *spec;
int flags;
goto done;
}
} else {
}
} else {
}
done:
}
{
.filter = "name=foo",
};
}
{
.filter = "(name=foo)",
.spec = "mydom",
};
/* Check we can handle domain called DOM */
.filter = "(name=foo)",
.spec = "DOM",
};
}
{
.filter = "(name=foo)",
.spec = "mydom",
};
}
{
.filter = "(name=foo)",
.spec = "myforest",
};
}
{
};
}
{
int opt;
};
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
}