domain_info_utils.c revision 04d4c4d45f3942a813b7f772737f801f877f4e64
/*
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 <utime.h>
{
/* get to the top level domain */
return dom;
}
{
struct sss_domain_info *dom;
while (dom) {
} else {
}
if (dom) {
&& !include_disabled) {
continue;
} else {
/* Next domain found. */
break;
}
}
}
return dom;
}
const char *sd_name)
{
"Subdomain_enumerate not set\n");
return false;
}
return true;
return false;
} else {
for (int i=0; parent->sd_enumerate[i]; i++) {
return true;
}
}
}
return false;
}
const char *name,
bool match_any)
{
return NULL;
}
}
while (dom) {
return dom;
}
}
return NULL;
}
const char *sid)
{
return NULL;
}
}
while (dom) {
if (dom_sid_len == sid_len) {
/* sid is domain sid */
return dom;
}
/* sid is object sid, check if domain sid is align with
* sid first subauthority component */
return dom;
}
}
}
}
return NULL;
}
struct sss_domain_info*
const char* sid)
{
/* LDAP provider doesn't know about sub-domains and hence can only
* have one configured domain
*/
return domain;
} else {
}
}
struct sss_domain_info *
const char *object_name)
{
char *domainname = NULL;
return NULL;
}
NULL, &domainname);
goto done;
}
if (domainname == NULL) {
} else {
}
done:
return dom;
}
struct confdb_ctx *cdb,
const char *domain_name,
const char *db_path,
struct sss_domain_info **_domain)
{
int ret;
struct sss_domain_info *dom;
return ret;
}
return EEXIST;
}
return ret;
}
return EOK;
}
static errno_t
sss_krb5_touch_config(void)
{
}
if (ret == -1) {
return ret;
}
return EOK;
}
struct sss_domain_info *domain,
char **content)
{
int ret;
char *o = NULL;
struct sss_domain_info *dom;
struct sss_domain_info *parent_dom;
char *parent_capaths = NULL;
bool capaths_started = false;
return EINVAL;
}
if (o == NULL) {
goto done;
}
/* This loops skips the starting parent and start rigth with the first
* subdomain. Although in all the interesting cases (AD and IPA) the
* default is that realm and DNS domain are the same strings (expect case)
* and no domain_realm mapping is needed we might consider to add this
* domain here as well to cover corner cases? */
o = talloc_asprintf_append(o, ".%s = %s\n%s = %s\n",
if (o == NULL) {
goto done;
}
}
parent_dom = domain;
goto done;
}
continue;
}
goto done;
}
if (!capaths_started) {
o = talloc_asprintf_append(o, "[capaths]\n");
if (o == NULL) {
goto done;
}
capaths_started = true;
}
o = talloc_asprintf_append(o, "%s = {\n %s = %s\n}\n",
if (o == NULL) {
goto done;
}
if (parent_capaths == NULL) {
} else {
}
if (parent_capaths == NULL) {
"talloc_asprintf/talloc_asprintf_append failed.\n");
goto done;
}
}
if (parent_capaths != NULL) {
if (o == NULL) {
goto done;
}
}
done:
*content = o;
} else {
talloc_free(o);
}
return ret;
}
{
const char *mapping_file;
char *sanitized_domain;
int fd = -1;
int i;
return EINVAL;
}
goto done;
}
if (sanitized_domain == NULL) {
return ENOMEM;
}
/* only alpha-numeric chars, dashes and underscores are allowed in
* krb5 include directory */
for (i = 0; sanitized_domain[i] != '\0'; i++) {
if (!isalnum(sanitized_domain[i])
sanitized_domain[i] = '_';
}
}
if (!mapping_file) {
goto done;
}
goto done;
}
if (fd < 0) {
"creating the temp file [%s] for domain-realm mappings "
"failed.\n", tmp_file);
goto done;
}
if (!fstream) {
if (ret != 0) {
/* Nothing to do here, just report the failure */
}
goto done;
}
if (ret < 0) {
goto done;
}
if (ret != 0) {
goto done;
}
if (ret == -1) {
goto done;
}
if (ret == -1) {
goto done;
}
done:
err = sss_krb5_touch_config();
"of krb5.conf. Created mappings may not be loaded.\n");
/* Ignore */
}
if (fstream) {
if (err != 0) {
/* Nothing to do here, just report the failure */
}
}
if (tmp_file) {
if (err < 0) {
"Could not remove file [%s]: [%d]: %s\n",
}
}
return ret;
}
/* Save domain names, do not descend. */
struct sss_domain_info *start_dom,
char ***_dom_names,
int *_dom_names_count)
{
struct sss_domain_info *dom;
char **dom_names;
goto done;
}
/* get count of domains*/
count = 0;
while (dom) {
count++;
}
goto done;
}
/* copy names */
i = 0;
while (dom) {
goto done;
}
i++;
}
if (_dom_names != NULL ) {
}
if (_dom_names_count != NULL ) {
}
done:
return ret;
}
const char *content)
{
int ret;
int fd = -1;
return ENOMEM;
}
goto done;
}
if (fd < 0) {
"krb5 config snippet failed.\n", tmp_file);
goto done;
}
if (written == -1) {
goto done;
}
goto done;
}
if (ret == -1) {
goto done;
}
if (ret == -1) {
goto done;
}
done:
if (err == -1) {
"Could not remove file [%s]: [%d]: %s\n",
}
}
return ret;
}
#define LOCALAUTH_PLUGIN_CONFIG \
"[plugins]\n" \
" localauth = {\n" \
" }\n"
{
#ifdef HAVE_KRB5_LOCALAUTH_PLUGIN
int ret;
const char *file_name;
return ENOMEM;
}
goto done;
}
goto done;
}
done:
return ret;
#else
return EOK;
#endif
}
#define KRB5_LIBDEFAUTLS_CONFIG \
"[libdefaults]\n" \
" canonicalize = true\n"
{
int ret;
const char *file_name;
return ENOMEM;
}
goto done;
}
goto done;
}
done:
return ret;
}
{
return EOK;
}
return EINVAL;
}
goto done;
}
if (canonicalize) {
goto done;
}
}
done:
err = sss_krb5_touch_config();
"of krb5.conf. Created mappings may not be loaded.\n");
/* Ignore */
}
return ret;
}
{
}
enum sss_domain_state state)
{
}
{
const char *p;
return false;
}
if (p == NULL) {
"Input [%s] does not look like an email address.\n", email);
return false;
}
return true;
}
return false;
}