summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_autofs.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-01-19 15:17:42 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-21 15:55:48 +0100
commit2234d49c8a307ee4f11cc544c862a359f76b44ad (patch)
tree400a1825971ecca435f874d92aa535a96d2a3c9b /src/db/sysdb_autofs.c
parent99b2c04e198e077708c5a08f2fdfa9574512a82c (diff)
downloadsssd-2234d49c8a307ee4f11cc544c862a359f76b44ad.tar.gz
sssd-2234d49c8a307ee4f11cc544c862a359f76b44ad.tar.xz
sssd-2234d49c8a307ee4f11cc544c862a359f76b44ad.zip
LDAP: Compare lists of DNs when saving autofs entries
https://fedorahosted.org/sssd/ticket/1758 The autofs entries do not have the key as an unique identifier, but rather the full (key, value) tuple as some keys have a special meaning, such as the direct mount key (/-) and may be present in a single map multiple times. Comparing the full DN that contains both the key and the value will allow for working updates if either key or value changes.
Diffstat (limited to 'src/db/sysdb_autofs.c')
-rw-r--r--src/db/sysdb_autofs.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c
index f8fe3925b..cc44c350b 100644
--- a/src/db/sysdb_autofs.c
+++ b/src/db/sysdb_autofs.c
@@ -78,6 +78,26 @@ done:
return dn;
}
+char *
+sysdb_autofsentry_strdn(TALLOC_CTX *mem_ctx,
+ struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
+ const char *map_name,
+ const char *entry_name,
+ const char *entry_value)
+{
+ struct ldb_dn *dn;
+ char *strdn;
+
+ dn = sysdb_autofsentry_dn(mem_ctx, sysdb, domain,
+ map_name, entry_name, entry_value);
+ if (!dn) return NULL;
+
+ strdn = talloc_strdup(mem_ctx, ldb_dn_get_linearized(dn));
+ talloc_free(dn);
+ return strdn;
+}
+
errno_t
sysdb_save_autofsmap(struct sysdb_ctx *sysdb_ctx,
struct sss_domain_info *domain,
@@ -319,15 +339,12 @@ done:
errno_t
sysdb_del_autofsentry(struct sysdb_ctx *sysdb_ctx,
- struct sss_domain_info *domain,
- const char *map,
- const char *key,
- const char *value)
+ const char *entry_dn)
{
struct ldb_dn *dn;
errno_t ret;
- dn = sysdb_autofsentry_dn(sysdb_ctx, sysdb_ctx, domain, map, key, value);
+ dn = ldb_dn_new(NULL, sysdb_ctx_get_ldb(sysdb_ctx), entry_dn);
if (!dn) {
return ENOMEM;
}