ipa_common.c revision fda9ee900387d9d793e3696cd32b73c253097fe3
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano IPA Provider Common Functions
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Simo Sorce <ssorce@redhat.com>
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Copyright (C) 2009 Red Hat
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano This program is free software; you can redistribute it and/or modify
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano it under the terms of the GNU General Public License as published by
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano the Free Software Foundation; either version 3 of the License, or
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano (at your option) any later version.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano This program is distributed in the hope that it will be useful,
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano but WITHOUT ANY WARRANTY; without even the implied warranty of
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano GNU General Public License for more details.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano You should have received a copy of the GNU General Public License
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano along with this program. If not, see <http://www.gnu.org/licenses/>.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_domain", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_server", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_hostname", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_dyndns_update", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_dyndns_iface", DP_OPT_STRING, NULL_STRING, NULL_STRING},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ipa_hbac_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "krb5_realm", DP_OPT_STRING, NULL_STRING, NULL_STRING}
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_uri", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_default_bind_dn", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_default_authtok_type", DP_OPT_STRING, NULL_STRING, NULL_STRING},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_default_authtok", DP_OPT_BLOB, NULL_BLOB, NULL_BLOB },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_search_timeout", DP_OPT_NUMBER, { .number = 6 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_network_timeout", DP_OPT_NUMBER, { .number = 6 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_opt_timeout", DP_OPT_NUMBER, { .number = 6 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_reqcert", DP_OPT_STRING, { "hard" }, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_search_scope", DP_OPT_STRING, { "sub" }, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_search_filter", DP_OPT_STRING, NULL_STRING, NULL_STRING },
998dc19ad6f62fcc7722e596c8cbaa488a5a5e93dlezcano { "ldap_group_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_group_search_scope", DP_OPT_STRING, { "sub" }, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_group_search_filter", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_schema", DP_OPT_STRING, { "ipa_v1" }, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_offline_timeout", DP_OPT_NUMBER, { .number = 60 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_force_upper_case_realm", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_enumeration_refresh_timeout", DP_OPT_NUMBER, { .number = 300 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_purge_cache_timeout", DP_OPT_NUMBER, { .number = 3600 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "entry_cache_timeout", DP_OPT_NUMBER, { .number = 1800 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_cacert", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_cacertdir", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_cert", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_key", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_tls_cipher_suite", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_id_use_start_tls", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_sasl_mech", DP_OPT_STRING, { "GSSAPI" } , NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_sasl_authid", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_sasl_realm", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_krb5_keytab", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_krb5_init_creds", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano /* use the same parm name as the krb5 module so we set it only once */
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "krb5_server", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "krb5_realm", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_pwd_policy", DP_OPT_STRING, { "none" } , NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_referrals", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "account_cache_expiration", DP_OPT_NUMBER, { .number = 0 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_dns_service_name", DP_OPT_STRING, { SSS_LDAP_SRV_NAME }, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_krb5_ticket_lifetime", DP_OPT_NUMBER, { .number = (24 * 60 * 60) }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_access_filter", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_netgroup_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_group_nesting_level", DP_OPT_NUMBER, { .number = 2 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_deref", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_account_expire_policy", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_access_order", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_chpass_uri", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_chpass_dns_service_name", DP_OPT_STRING, NULL_STRING, NULL_STRING },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_enumeration_search_timeout", DP_OPT_NUMBER, { .number = 60 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano /* Do not include ldap_auth_disable_tls_never_use_in_production in the
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano * manpages or SSSDConfig API
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_auth_disable_tls_never_use_in_production", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_page_size", DP_OPT_NUMBER, { .number = 1000 }, NULL_NUMBER },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_deref_threshold", DP_OPT_NUMBER, { .number = 10 }, NULL_NUMBER }
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_rootdse_last_usn", "lastUSN", SYSDB_HIGH_USN, NULL }
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_object_class", "posixAccount", SYSDB_USER_CLASS, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_pwd", "userPassword", SYSDB_PWD, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_uid_number", "uidNumber", SYSDB_UIDNUM, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_gid_number", "gidNumber", SYSDB_GIDNUM, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_home_directory", "homeDirectory", SYSDB_HOMEDIR, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shell", "loginShell", SYSDB_SHELL, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_principal", "krbPrincipalName", SYSDB_UPN, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_fullname", "cn", SYSDB_FULLNAME, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_member_of", "memberOf", SYSDB_MEMBEROF, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_uuid", "nsUniqueId", SYSDB_UUID, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_modify_timestamp", "modifyTimestamp", SYSDB_ORIG_MODSTAMP, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_last_change", "shadowLastChange", SYSDB_SHADOWPW_LASTCHANGE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_min", "shadowMin", SYSDB_SHADOWPW_MIN, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_max", "shadowMax", SYSDB_SHADOWPW_MAX, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_warning", "shadowWarning", SYSDB_SHADOWPW_WARNING, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_inactive", "shadowInactive", SYSDB_SHADOWPW_INACTIVE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_expire", "shadowExpire", SYSDB_SHADOWPW_EXPIRE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_shadow_flag", "shadowFlag", SYSDB_SHADOWPW_FLAG, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_krb_last_pwd_change", "krbLastPwdChange", SYSDB_KRBPW_LASTCHANGE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_krb_password_expiration", "krbPasswordExpiration", SYSDB_KRBPW_EXPIRATION, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_pwd_attribute", "pwdAttribute", SYSDB_PWD_ATTRIBUTE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_authorized_service", "authorizedService", SYSDB_AUTHORIZED_SERVICE, NULL },
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_ad_account_expires", "accountExpires", SYSDB_AD_ACCOUNT_EXPIRES, NULL},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_ad_user_account_control", "userAccountControl", SYSDB_AD_USER_ACCOUNT_CONTROL, NULL},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_ns_account_lock", "nsAccountLock", SYSDB_NS_ACCOUNT_LOCK, NULL},
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_user_authorized_host", "host", SYSDB_AUTHORIZED_HOST, NULL }
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano { "ldap_group_object_class", "posixGroup", SYSDB_GROUP_CLASS, NULL },
const char *conf_path,
char *domain;
char *server;
char *realm;
char *ipa_hostname;
int ret;
goto done;
if (!domain) {
goto done;
if (!server) {
goto done;
goto done;
if (!realm) {
if (!realm) {
goto done;
for (i = 0; realm[i]; i++) {
realm);
goto done;
done:
return ret;
const char *conf_path,
char *primary;
char *basedn;
char *realm;
char *value;
char *desired_realm;
char *desired_primary;
bool primary_requested = true;
bool realm_requested = true;
int ret;
abort();
if (!tmpctx) {
return ENOMEM;
goto done;
goto done;
&basedn);
goto done;
if (!value) {
goto done;
goto done;
goto done;
goto done;
if (!desired_primary) {
primary_requested = false;
if (!desired_realm) {
realm_requested = false;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (!value) {
goto done;
value);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
done:
return ret;
const char *conf_path,
char *value;
int ret;
abort();
goto done;
goto done;
goto done;
if (!value) {
goto done;
goto done;
goto done;
done:
return ret;
char *address;
const char *safe_address;
char *new_uri;
int ret;
if (!service) {
if (!srvaddr) {
address);
if (!new_uri) {
const char *servers,
char *realm;
int ret;
if (!tmp_ctx) {
return ENOMEM;
if (!service) {
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
if (!realm) {
goto done;
goto done;
if (!servers) {
goto done;
for (i = 0; list[i]; i++) {
if (ret) {
goto done;
goto done;
goto done;
done:
return ret;