/*
Authors:
Fabiano FidĂȘncio <fidencio@redhat.com>
Copyright (C) 2017 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 "responder/common/cache_req/cache_req_domain.h"
struct cache_req_domain *
const char *name)
{
continue;
}
break;
}
}
}
return ret;
}
struct cache_req_domain *src,
struct cache_req_domain **_dest)
{
return EINVAL;
}
goto done;
}
}
*_dest = cr_domains;
done:
}
return ret;
}
{
struct cache_req_domain *p, *q, *r;
DLIST_FOR_EACH_SAFE(p, q, *cr_domains) {
r = p;
DLIST_REMOVE(*cr_domains, p);
talloc_zfree(r);
}
*cr_domains = NULL;
}
static bool
bool enforce_non_fqnames)
{
/*
* In order to decide whether fully_qualified_names must be used on the
* lookups we have to take into consideration:
* - use_fully_qualified_name value of the head of the domains;
* (head->fqnames)
* - the presence of a domains' resolution order list;
* (non_fqnames_enforced)
*
* The relationship between those two can be described by:
* - head->fqnames:
* - true: in this case doesn't matter whether it's enforced or not,
* fully-qualified-names will _always_ be used
* - false: in this case (which is also the default case), the usage
* depends on it being enforced;
*
* - enforce_non_fqnames:
* - true: in this case, the usage of fully-qualified-names is not
* needed;
* - false: in this case, the usage of fully-qualified-names will be
* done accordingly to what's set for the domain itself.
*/
return true;
} else if (enforce_non_fqnames) {
return false;
} else {
}
}
static struct cache_req_domain *
struct sss_domain_info *domains,
char **resolution_order)
{
char *name;
int i;
bool enforce_non_fqnames = false;
/* Firstly, in case a domains' resolution order is passed ... iterate over
* the list adding its domains to the flatten cache req domains' list */
if (resolution_order != NULL) {
enforce_non_fqnames = true;
for (i = 0; resolution_order[i] != NULL; i++) {
name = resolution_order[i];
continue;
}
goto done;
}
/* when using the domain resolution order, using shortnames as
* input is allowed by default. However, we really want to use
* the fully qualified name as output in order to avoid
* conflicts whith users who have the very same name. */
struct cache_req_domain *);
break;
}
}
}
/* Then iterate through all the other domains (and subdomains) and add them
* to the flatten cache req domains' list */
continue;
}
goto done;
}
/* when using the domain resolution order, using shortnames as input
* is allowed by default. However, we really want to use the fully
* qualified name as output in order to avoid conflicts whith users
* who have the very same name. */
if (resolution_order != NULL) {
}
}
done:
}
return cr_domains;
}
struct sss_domain_info *domains,
const char *domain_resolution_order,
struct cache_req_domain **_cr_domains)
{
return ENOMEM;
}
if (domain_resolution_order != NULL) {
"Domain resolution order list (split by ':'): \"%s\"\n",
"split_on_separator() failed [%d]: [%s].\n",
goto done;
}
} else {
"Domain resolution order list: ':' "
"(do not use any specific order)\n");
}
} else {
"Domain resolution order list: not set\n");
}
list);
if (cr_domains == NULL) {
"cache_req_domain_new_list_from_domain_resolution_order() "
"failed [%d]: [%s].\n",
goto done;
}
done:
return ret;
}