>From ac674d2e4196da9ff749db8709e967289446e9cc Mon Sep 17 00:00:00 2001 From: Cove Schneider Date: Fri, 31 May 2013 23:56:48 -0700 Subject: [PATCH] Add ldap_autofs_map_master_name option --- src/config/etc/sssd.api.d/sssd-ipa.conf | 1 + src/config/etc/sssd.api.d/sssd-ldap.conf | 1 + src/db/sysdb_autofs.h | 4 ++-- src/man/sssd-ldap.5.xml | 13 +++++++++++++ src/providers/ad/ad_opts.h | 1 + src/providers/data_provider_be.c | 7 ------- src/providers/ipa/ipa_opts.h | 1 + src/providers/ldap/ldap_common.c | 1 + src/providers/ldap/ldap_opts.h | 1 + src/providers/ldap/sdap.h | 1 + src/providers/ldap/sdap_autofs.c | 12 ++++++++++++ 11 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/config/etc/sssd.api.d/sssd-ipa.conf b/src/config/etc/sssd.api.d/sssd-ipa.conf index bc14fbe3d4153bd7a7ca4ffe0351edf0b8c02ee4..72b36c0b583046f2833c25821ae9736cb20aa45a 100644 --- a/src/config/etc/sssd.api.d/sssd-ipa.conf +++ b/src/config/etc/sssd.api.d/sssd-ipa.conf @@ -164,6 +164,7 @@ ipa_hostgroup_uuid = str, None, false [provider/ipa/autofs] ipa_automount_location = str, None, false +ldap_autofs_map_master_name = str, None, false ldap_autofs_map_object_class = str, None, false ldap_autofs_map_name = str, None, false ldap_autofs_entry_object_class = str, None, false diff --git a/src/config/etc/sssd.api.d/sssd-ldap.conf b/src/config/etc/sssd.api.d/sssd-ldap.conf index eb239664c49e9d516468c184dfeac190ecf8ddd8..441390b0cda1e08b0f274278d5f26b97b08df33d 100644 --- a/src/config/etc/sssd.api.d/sssd-ldap.conf +++ b/src/config/etc/sssd.api.d/sssd-ldap.conf @@ -156,6 +156,7 @@ ldap_sudorule_notafter = str, None, false ldap_sudorule_order = str, None, false [provider/ldap/autofs] +ldap_autofs_map_master_name = str, None, false ldap_autofs_map_object_class = str, None, false ldap_autofs_map_name = str, None, false ldap_autofs_entry_object_class = str, None, false diff --git a/src/db/sysdb_autofs.h b/src/db/sysdb_autofs.h index e3528ce4e6bd2c8b594c80828cfb02a9a7ce7923..1c334cf796c3cbde7ddb636ca963845c5054eeae 100644 --- a/src/db/sysdb_autofs.h +++ b/src/db/sysdb_autofs.h @@ -28,8 +28,8 @@ #define AUTOFS_MAP_SUBDIR "autofsmaps" #define AUTOFS_ENTRY_SUBDIR "autofsentries" -#define SYSDB_AUTOFS_MAP_OC "automountMap" -#define SYSDB_AUTOFS_MAP_NAME "automountMapName" +#define SYSDB_AUTOFS_MAP_OC "automountMap" +#define SYSDB_AUTOFS_MAP_NAME "automountMapName" #define SYSDB_AUTOFS_ENTRY_OC "automount" #define SYSDB_AUTOFS_ENTRY_KEY "automountKey" diff --git a/src/man/sssd-ldap.5.xml b/src/man/sssd-ldap.5.xml index 98b0349e5d29bc0b9d6d071c08eee5ef93e0eef6..72586fb1d97037ebd43a737c2a0394bcd652bac9 100644 --- a/src/man/sssd-ldap.5.xml +++ b/src/man/sssd-ldap.5.xml @@ -2244,6 +2244,19 @@ ldap_access_filter = memberOf=cn=allowedusers,ou=Groups,dc=example,dc=com + ldap_autofs_map_master_name (string) + + + The name of the automount master map in LDAP. + + + Default: auto.master + + + + + + ldap_autofs_map_object_class (string) diff --git a/src/providers/ad/ad_opts.h b/src/providers/ad/ad_opts.h index 8022a16274a04389b7a64b491ec28a0c3c55aaef..9055b4516c7e5834f0540f30c28f2accb3111e9f 100644 --- a/src/providers/ad/ad_opts.h +++ b/src/providers/ad/ad_opts.h @@ -66,6 +66,7 @@ struct dp_option ad_def_ldap_opts[] = { { "ldap_sudo_include_netgroups", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_sudo_include_regexp", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_autofs_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING }, + { "ldap_autofs_map_master_name", DP_OPT_STRING, { "auto.master" }, NULL_STRING }, { "ldap_schema", DP_OPT_STRING, { "ad" }, NULL_STRING }, { "ldap_offline_timeout", DP_OPT_NUMBER, { .number = 60 }, NULL_NUMBER }, { "ldap_force_upper_case_realm", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 5aef2308a76fd2c9fcf1e1835a5957b8277c4159..29dd2def908fb43a515e3c1922462c06181fc16f 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -1846,13 +1846,6 @@ static int be_autofs_handler(DBusMessage *message, struct sbus_connection *conn) goto done; } - /* If a request for auto.master comes in, the automounter deamon - * has been reloaded. Expire all autofs maps to force reload - */ - if (strcmp(be_autofs_req->mapname, "auto.master") == 0) { - be_autofs_req->invalidate = true; - } - be_req->req_data = be_autofs_req; if (!be_cli->bectx->bet_info[BET_AUTOFS].bet_ops) { diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h index 5ec36c550b166e07a9ed2f2c31474c55d0ecdaee..b3eef456c071792bdcbefe975176c6102a252d6e 100644 --- a/src/providers/ipa/ipa_opts.h +++ b/src/providers/ipa/ipa_opts.h @@ -90,6 +90,7 @@ struct dp_option ipa_def_ldap_opts[] = { { "ldap_sudo_include_netgroups", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_sudo_include_regexp", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_autofs_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING }, + { "ldap_autofs_map_master_name", DP_OPT_STRING, { "auto.master" }, NULL_STRING }, { "ldap_schema", DP_OPT_STRING, { "ipa_v1" }, NULL_STRING }, { "ldap_offline_timeout", DP_OPT_NUMBER, { .number = 60 }, NULL_NUMBER }, { "ldap_force_upper_case_realm", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index 83f901c74f5916e67ec3216036c8cfa74b5eb99d..cd38ac35adf2f6bf3013487c36a63d7cf35aa851 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -571,6 +571,7 @@ int ldap_get_autofs_options(TALLOC_CTX *memctx, struct sdap_options *opts) { const char *search_base; + const char *master_map; struct sdap_attr_map *default_entry_map; struct sdap_attr_map *default_mobject_map; int ret; diff --git a/src/providers/ldap/ldap_opts.h b/src/providers/ldap/ldap_opts.h index a6c821f3ac3ad951a3b45168b298b96fefb96b60..d6a2fc501d180c6db1f72de19d5a116c997d7b09 100644 --- a/src/providers/ldap/ldap_opts.h +++ b/src/providers/ldap/ldap_opts.h @@ -56,6 +56,7 @@ struct dp_option default_basic_opts[] = { { "ldap_sudo_include_netgroups", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_sudo_include_regexp", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE }, { "ldap_autofs_search_base", DP_OPT_STRING, NULL_STRING, NULL_STRING }, + { "ldap_autofs_map_master_name", DP_OPT_STRING, { "auto.master" }, NULL_STRING }, { "ldap_schema", DP_OPT_STRING, { "rfc2307" }, NULL_STRING }, { "ldap_offline_timeout", DP_OPT_NUMBER, { .number = 60 }, NULL_NUMBER }, { "ldap_force_upper_case_realm", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE }, diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h index c53471b9bd6d9b18f37a8bf4089c8700d4a1163d..92ff6673e43fdace89456b7a2dd48564c07c4999 100644 --- a/src/providers/ldap/sdap.h +++ b/src/providers/ldap/sdap.h @@ -164,6 +164,7 @@ enum sdap_basic_opt { SDAP_SUDO_INCLUDE_NETGROUPS, SDAP_SUDO_INCLUDE_REGEXP, SDAP_AUTOFS_SEARCH_BASE, + SDAP_AUTOFS_MAP_MASTER_NAME, SDAP_SCHEMA, SDAP_OFFLINE_TIMEOUT, SDAP_FORCE_UPPER_CASE_REALM, diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c index e7947c9b223636cf1263b22889c53fd18106a02d..c0bf3b689ab462fdb4c25ee2af9128d841ea6b0d 100644 --- a/src/providers/ldap/sdap_autofs.c +++ b/src/providers/ldap/sdap_autofs.c @@ -30,6 +30,7 @@ #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_async.h" #include "providers/dp_backend.h" +#include "providers/data_provider.h" #include "db/sysdb_autofs.h" #include "util/util.h" @@ -82,6 +83,7 @@ void sdap_autofs_handler(struct be_req *be_req) struct sdap_id_ctx *id_ctx; struct be_autofs_req *autofs_req; struct tevent_req *req; + const char *master_map; int ret = EOK; DEBUG(SSSDBG_TRACE_INTERNAL, ("sdap autofs handler called\n")); @@ -98,6 +100,16 @@ void sdap_autofs_handler(struct be_req *be_req) DEBUG(SSSDBG_FUNC_DATA, ("Requested refresh for: %s\n", autofs_req->mapname ? autofs_req->mapname : "\n")); + if (autofs_req->mapname != NULL) { + master_map = dp_opt_get_string(id_ctx->opts->basic, + SDAP_AUTOFS_MAP_MASTER_NAME); + if (strcmp(master_map, autofs_req->mapname) == 0) { + autofs_req->invalidate = true; + DEBUG(SSSDBG_FUNC_DATA, ("Refresh of automount master map triggered: %s\n", + autofs_req->mapname)); + } + } + if (autofs_req->invalidate) { ret = sysdb_invalidate_autofs_maps(id_ctx->be->domain->sysdb, id_ctx->be->domain); -- 1.8.4.2