diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-13 12:06:40 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-21 16:00:18 +0100 |
commit | eafa1e3679ebfc9ce4dfc8f17881baaef4c26c37 (patch) | |
tree | b31a52198e97b1552295ebff748444bdb2d8bf79 /src/db/sysdb_autofs.c | |
parent | a40f572fb5022b1f1e121267e91ceb0e370602a9 (diff) | |
download | sssd-eafa1e3679ebfc9ce4dfc8f17881baaef4c26c37.tar.gz sssd-eafa1e3679ebfc9ce4dfc8f17881baaef4c26c37.tar.xz sssd-eafa1e3679ebfc9ce4dfc8f17881baaef4c26c37.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.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c index 57380cfdc..f5aad259a 100644 --- a/src/db/sysdb_autofs.c +++ b/src/db/sysdb_autofs.c @@ -77,6 +77,25 @@ done: return dn; } +char * +sysdb_autofsentry_strdn(TALLOC_CTX *mem_ctx, + struct sysdb_ctx *sysdb, + 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, + 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, const char *name, @@ -314,14 +333,12 @@ done: errno_t sysdb_del_autofsentry(struct sysdb_ctx *sysdb_ctx, - 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, map, key, value); + dn = ldb_dn_new(NULL, sysdb_ctx_get_ldb(sysdb_ctx), entry_dn); if (!dn) { return ENOMEM; } |