/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Fully Qualified Names 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 <popt.h>
#include "db/sysdb_private.h"
#include "tests/cmocka/common_mock.h"
const char *name,
const char *flatname,
struct sss_domain_info *parent,
struct sss_names_ctx *nctx)
{
/* just to make new_subdomain happy */
return dom;
}
struct fqdn_test_ctx {
};
{
return 0;
}
{
struct fqdn_test_ctx);
return 1;
}
return 0;
}
{
struct fqdn_test_ctx);
char *fqdn;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
{
struct fqdn_test_ctx);
char *fqdn;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
{
struct fqdn_test_ctx);
char *fqdn;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
{
struct fqdn_test_ctx);
char *fqdn;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
/* If flat name is requested but does not exist, the code falls back to domain
* name
*/
}
struct parse_name_test_ctx {
};
const char *full_name,
const char *default_domain,
const char exp_ret,
const char *exp_name,
const char *exp_domain)
{
if (exp_name) {
}
if (exp_domain) {
}
}
{
/* Init with an AD-style regex to be able to test flat name */
"(((?P<domain>[^\\\\]+)\\\\(?P<name>.+$))|" \
"((?P<name>[^@]+)@(?P<domain>.+$))|" \
"(^(?P<name>[^@\\\\]+)$))",
/* The setup is two domains, first one with no subdomains,
* second one with a single subdomain
*/
/* Create the subdomain, but don't add it yet, we want to be able to
* test sss_parse_name_for_domains() signaling that domains must be
* discovered
*/
return 0;
}
{
struct parse_name_test_ctx);
return 0;
}
const char *input_name,
const int exp_ret,
const char *exp_name,
const char *exp_domain)
{
if (exp_name) {
}
if (exp_domain) {
}
}
{
struct parse_name_test_ctx);
int ret;
}
{
struct parse_name_test_ctx);
}
{
struct parse_name_test_ctx);
/* The subdomain name is valid, but not known */
/* Link the subdomain (simulating subdom handler) and retry */
}
{
struct parse_name_test_ctx);
/* Link the subdomain (simulating subdom handler) */
/* The subdomain name is valid, but not known */
}
{
struct parse_name_test_ctx);
/* Simulate uknown default domain */
}
{
struct fqdn_test_ctx);
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
/* Initialization with no user name must fail */
}
{
struct parse_name_test_ctx);
}
{
int opt;
};
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* Even though normally the tests should clean up after themselves
* they might not after a failed run. Remove the old db to be sure */
}