ipa_common.c revision b096321a5a02dda0b6b71ba0f9c4d8feacd979e4
/*
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/ldap/sdap_async_private.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)
{
struct ipa_options *opts;
char *domain;
char *server;
char *realm;
char *ipa_hostname;
int ret;
goto done;
}
if (!domain) {
goto done;
}
}
if (!server) {
}
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;
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 *primary;
char *basedn;
char *realm;
char *value;
char *desired_realm;
char *desired_primary;
bool primary_requested = true;
bool realm_requested = true;
int ret;
int i;
if (!tmpctx) {
return ENOMEM;
}
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;
}
}
/* Configuration of SASL auth ID and realm */
if (!desired_primary) {
primary_requested = false;
}
if (!desired_realm) {
realm_requested = false;
}
goto done;
}
goto done;
}
goto done;
}
goto done;
}
/* fix schema to IPAv1 for now */
goto done;
}
}
goto done;
}
}
#if 0
goto done;
}
#else
/* We don't yet have support for the representation
* of sudo in IPA. For now, we need to point at the
* compat tree
*/
if (!value) {
goto done;
}
value);
goto done;
}
#endif
}
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;
}
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;
}
}
done:
}
return ret;
}
{
struct ipa_service *service;
struct resolv_hostent *srvaddr;
struct sockaddr_storage *sockaddr;
char *address;
const char *safe_address;
char *new_uri;
const char *srv_name;
int ret;
return;
}
if (!service) {
return;
}
if (!srvaddr) {
return;
}
return;
}
return;
}
return;
}
if (!new_uri) {
return;
}
/* free old one and replace with new one */
address);
if (safe_address == NULL) {
return;
}
}
}
struct ipa_service *service,
struct ipa_options *options,
const char *servers,
bool primary)
{
char *ipa_domain;
int ret = 0;
int i;
if (!tmp_ctx) {
return ENOMEM;
}
/* split server parm into a list */
goto done;
}
/* 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;
}
{
}
const char *primary_servers,
const char *backup_servers,
struct ipa_options *options,
struct ipa_service **_service)
{
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) {
if (backup_servers) {
"backup server given - using it as primary!\n"));
} else {
"servers - 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;
}