summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-11-18 15:29:58 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-11-26 16:51:41 +0100
commit03b859510dc13a13a456ca4aa94c0561a0e9684c (patch)
tree8c467eb8c7605ce9d3c65a9789363f64ff75d8cb /src/providers
parent5c129880ae10c80b4f79cb2994e9d127dc6dfbef (diff)
downloadsssd-03b859510dc13a13a456ca4aa94c0561a0e9684c.tar.gz
sssd-03b859510dc13a13a456ca4aa94c0561a0e9684c.tar.xz
sssd-03b859510dc13a13a456ca4aa94c0561a0e9684c.zip
AD: Add autofs provider
https://fedorahosted.org/sssd/ticket/1632 Adds the possibility to configure: autofs_provider = ad The AD autofs provider uses the rfc2307 (nis*) attribute maps. This is different (at the moment) from using autofs_provider=ldap with ldap_schema=ad. Reviewed-by: Ondrej Valousek <ondrejv2@fedoraproject.org> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ad/ad_autofs.c50
-rw-r--r--src/providers/ad/ad_common.c31
-rw-r--r--src/providers/ad/ad_common.h9
-rw-r--r--src/providers/ad/ad_init.c24
4 files changed, 114 insertions, 0 deletions
diff --git a/src/providers/ad/ad_autofs.c b/src/providers/ad/ad_autofs.c
new file mode 100644
index 000000000..7d4ed34b5
--- /dev/null
+++ b/src/providers/ad/ad_autofs.c
@@ -0,0 +1,50 @@
+/*
+ SSSD
+
+ AD autofs Provider Initialization functions
+
+ Copyright (C) 2015 Red Hat
+
+ This program is free software; you can redistribute it and/or modify
+ 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 "providers/ad/ad_common.h"
+#include "providers/ldap/sdap_autofs.h"
+
+int ad_autofs_init(struct be_ctx *be_ctx,
+ struct ad_id_ctx *id_ctx,
+ struct bet_ops **ops,
+ void **pvt_data)
+{
+ int ret;
+
+ DEBUG(SSSDBG_TRACE_INTERNAL, "Initializing autofs AD back end\n");
+
+ ret = sdap_autofs_init(be_ctx, id_ctx->sdap_id_ctx, ops, pvt_data);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, "Cannot initialize AD autofs [%d]: %s\n",
+ ret, sss_strerror(ret));
+ return ret;
+ }
+
+ ret = ad_get_autofs_options(id_ctx->ad_options, be_ctx->cdb,
+ be_ctx->conf_path);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, "Cannot initialize AD autofs [%d]: %s\n",
+ ret, sss_strerror(ret));
+ return ret;
+ }
+
+ return EOK;
+}
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
index 52284a5f3..4f8223879 100644
--- a/src/providers/ad/ad_common.c
+++ b/src/providers/ad/ad_common.c
@@ -1020,6 +1020,37 @@ ad_get_id_options(struct ad_options *ad_opts,
}
errno_t
+ad_get_autofs_options(struct ad_options *ad_opts,
+ struct confdb_ctx *cdb,
+ const char *conf_path)
+{
+ errno_t ret;
+
+ /* autofs maps */
+ ret = sdap_get_map(ad_opts->id,
+ cdb,
+ conf_path,
+ ad_autofs_mobject_map,
+ SDAP_OPTS_AUTOFS_MAP,
+ &ad_opts->id->autofs_mobject_map);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ ret = sdap_get_map(ad_opts->id,
+ cdb,
+ conf_path,
+ ad_autofs_entry_map,
+ SDAP_OPTS_AUTOFS_ENTRY,
+ &ad_opts->id->autofs_entry_map);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ return EOK;
+}
+
+errno_t
ad_set_search_bases(struct sdap_options *id_opts)
{
errno_t ret;
diff --git a/src/providers/ad/ad_common.h b/src/providers/ad/ad_common.h
index de6ffbff7..49e97b0be 100644
--- a/src/providers/ad/ad_common.h
+++ b/src/providers/ad/ad_common.h
@@ -132,6 +132,10 @@ ad_get_id_options(struct ad_options *ad_opts,
const char *conf_path,
struct sdap_options **_opts);
errno_t
+ad_get_autofs_options(struct ad_options *ad_opts,
+ struct confdb_ctx *cdb,
+ const char *conf_path);
+errno_t
ad_get_auth_options(TALLOC_CTX *mem_ctx,
struct ad_options *ad_opts,
struct be_ctx *bectx,
@@ -170,4 +174,9 @@ int ad_sudo_init(struct be_ctx *be_ctx,
struct bet_ops **ops,
void **pvt_data);
+int ad_autofs_init(struct be_ctx *be_ctx,
+ struct ad_id_ctx *id_ctx,
+ struct bet_ops **ops,
+ void **pvt_data);
+
#endif /* AD_COMMON_H_ */
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
index 5f30b6ea8..72ce5536b 100644
--- a/src/providers/ad/ad_init.c
+++ b/src/providers/ad/ad_init.c
@@ -580,3 +580,27 @@ int sssm_ad_sudo_init(struct be_ctx *bectx,
return EOK;
#endif
}
+
+int sssm_ad_autofs_init(struct be_ctx *bectx,
+ struct bet_ops **ops,
+ void **pvt_data)
+{
+#ifdef BUILD_AUTOFS
+ struct ad_id_ctx *id_ctx;
+ int ret;
+
+ DEBUG(SSSDBG_TRACE_INTERNAL, "Initializing AD autofs handler\n");
+
+ ret = sssm_ad_id_init(bectx, ops, (void **) &id_ctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "sssm_ad_id_init failed.\n");
+ return ret;
+ }
+
+ return ad_autofs_init(bectx, id_ctx, ops, pvt_data);
+#else
+ DEBUG(SSSDBG_MINOR_FAILURE, "Autofs init handler called but SSSD is "
+ "built without autofs support, ignoring\n");
+ return EOK;
+#endif
+}