/*
SSSD
IPA Provider Common Functions
Authors:
Simo Sorce <ssorce@redhat.com>
Copyright (C) 2009 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 <netdb.h>
#include <ctype.h>
#include "db/sysdb_selinux.h"
#include "providers/ipa/ipa_common.h"
#include "providers/ipa/ipa_dyndns.h"
#include "providers/ldap/sdap_async_private.h"
#include "providers/be_dyndns.h"
#include "util/sss_krb5.h"
#include "db/sysdb_services.h"
#include "db/sysdb_autofs.h"
#include "providers/ipa/ipa_opts.h"
struct confdb_ctx *cdb,
const char *conf_path,
struct sss_domain_info *dom,
struct ipa_options **_opts)
{
char *domain;
char *server;
char *realm;
char *ipa_hostname;
int ret;
goto done;
}
if (!domain) {
goto done;
}
}
if (!server) {
"No ipa server set, will use service discovery!\n");
}
if (ipa_hostname == NULL) {
goto done;
}
goto done;
}
}
/* First check whether the realm has been manually specified */
if (!realm) {
/* No explicit krb5_realm, use the IPA domain, transform to upper-case */
if (!realm) {
goto done;
}
realm);
goto done;
}
}
done:
}
return ret;
}
struct sdap_search_base ***_search_bases)
{
const char *class_name;
char *unparsed_base;
*_search_bases = NULL;
switch (class) {
case IPA_HBAC_SEARCH_BASE:
class_name = "IPA_HBAC";
break;
case IPA_HOST_SEARCH_BASE:
class_name = "IPA_HOST";
break;
case IPA_SELINUX_SEARCH_BASE:
class_name = "IPA_SELINUX";
break;
class_name = "IPA_SUBDOMAINS";
break;
class_name = "IPA_MASTER_DOMAIN";
break;
case IPA_RANGES_SEARCH_BASE:
class_name = "IPA_RANGES";
break;
case IPA_VIEWS_SEARCH_BASE:
class_name = "IPA_VIEWS";
break;
default:
"Unknown search base type: [%d]\n", class);
class_name = "UNKNOWN";
/* Non-fatal */
break;
}
}
struct confdb_ctx *cdb,
const char *conf_path,
struct sdap_options **_opts)
{
char *basedn;
char *realm;
char *value;
int ret;
int i;
if (!tmpctx) {
return ENOMEM;
}
goto done;
}
NULL);
goto done;
}
/* get sdap options */
goto done;
}
&basedn);
goto done;
}
/* FIXME: get values by querying IPA */
/* set search base */
if (!value) {
goto done;
}
goto done;
}
}
/* set krb realm */
goto done;
}
goto done;
}
}
goto done;
}
/* fix schema to IPAv1 for now */
goto done;
}
}
goto done;
}
}
if (!value) {
goto done;
}
value);
goto done;
}
}
goto done;
}
}
if (!value) {
goto done;
}
goto done;
}
}
if (!value) {
goto done;
}
goto done;
}
}
goto done;
}
}
goto done;
}
}
goto done;
}
goto done;
}
}
goto done;
}
goto done;
}
}
goto done;
}
goto done;
}
}
goto done;
}
goto done;
}
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
&ipa_opts->override_map);
goto done;
}
done:
}
return ret;
}
struct confdb_ctx *cdb,
const char *conf_path,
{
char *value;
int ret;
goto done;
}
/* get krb5 options */
goto done;
}
/* If there is no KDC, try the deprecated krb5_kdcip option, too */
/* FIXME - this can be removed in a future version */
goto done;
}
/* set krb realm */
if (!value) {
goto done;
}
goto done;
}
goto done;
}
}
/* If krb5_fast_principal was not set explicitly, default to
* host/$client_hostname@REALM
*/
KRB5_REALM));
goto done;
}
value);
goto done;
}
}
/* Set flag that controls whether we want to write the
* kdcinfo files at all
*/
done:
}
return ret;
}
{
char *address;
const char *safe_address;
char *new_uri;
const char *srv_name;
int ret;
return;
}
if (!service) {
return;
}
if (!srvaddr) {
"FATAL: No hostent available for server (%s)\n",
return;
}
return;
}
return;
}
return;
}
if (!new_uri) {
return;
}
/* free old one and replace with new one */
address);
if (safe_address == NULL) {
return;
}
"write_krb5info_file failed, authentication might fail.\n");
}
}
}
struct ipa_service *service,
struct ipa_options *options,
const char *servers,
bool primary)
{
char *ipa_domain;
int ret = 0;
int i;
int j;
if (!tmp_ctx) {
return ENOMEM;
}
/* split server parm into a list */
goto done;
}
for (j = 0; list[j]; j++) {
if (resolv_is_address(list[j])) {
"ipa_server [%s] is detected as IP address, "
"this can cause GSSAPI problems\n", list[j]);
}
}
/* now for each one add a new server to the failover service */
for (i = 0; list[i]; i++) {
if (be_fo_is_srv_identifier(list[i])) {
if (!primary) {
"Failed to add server [%s] to failover service: "
"SRV resolution only allowed for primary servers!\n",
list[i]);
continue;
}
BE_FO_PROTO_TCP, false, NULL);
if (ret) {
goto done;
}
continue;
}
/* It could be ipv6 address in square brackets. Remove
* the brackets if needed. */
goto done;
}
goto done;
}
}
done:
return ret;
}
static inline errno_t
{
}
static inline errno_t
{
}
{
}
const char *primary_servers,
const char *backup_servers,
struct ipa_options *options,
struct ipa_service **_service)
{
char *realm;
int ret;
if (!tmp_ctx) {
return ENOMEM;
}
if (!service) {
goto done;
}
goto done;
}
if (!service->krb5_service) {
goto done;
}
goto done;
}
goto done;
}
goto done;
}
if (!realm) {
goto done;
}
goto done;
}
if (!primary_servers) {
"No primary servers defined, using service discovery\n");
}
goto done;
}
if (backup_servers) {
goto done;
}
}
goto done;
}
done:
}
return ret;
}
struct confdb_ctx *cdb,
const char *conf_path,
struct sdap_options **_opts)
{
char *basedn;
char *autofs_base;
if (!tmp_ctx) {
return ENOMEM;
}
&basedn);
goto done;
}
basedn);
if (!autofs_base) {
goto done;
}
goto done;
}
}
goto done;
}
"Could not get autofs map object attribute map\n");
goto done;
}
"Could not get autofs entry object attribute map\n");
goto done;
}
done:
return ret;
}
struct ipa_options *ctx)
{
char *val;
bool update;
int ttl;
"Cannot initialize IPA dyndns opts [%d]: %s\n",
return ret;
}
"initialized, cannot copy legacy options\n");
return EOK;
}
/* Reuse legacy option values */
"ipa_dyndns_update");
/* Not fatal */
update = false;
update = true;
} else {
"ipa_dyndns_update value is not a boolean!\n");
return EINVAL;
}
"deprecated and should not be used in favor of %s\n",
"ipa_dyndns_update", "dyndns_update");
return ret;
}
}
"ipa_dyndns_ttl");
/* Not fatal */
"deprecated and should not be used in favor of %s\n",
"ipa_dyndns_ttl", "dyndns_ttl");
return ret;
}
}
/* Reuse legacy option values */
"ipa_dyndns_iface");
/* Not fatal */
"deprecated and should not be used in favor of %s\n",
"ipa_dyndns_iface", "dyndns_iface");
return ret;
}
}
return EOK;
}