summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-05-18 14:30:28 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-06-23 13:40:11 +0200
commitdd285415d7a8d8376207960cfa3e977524c3b98c (patch)
tree38d848dcdc43045ef5d781665b0a28bf85bffd7b /src/db/sysdb.c
parent13d7df10bf4d76c333a9169f9fcbeb891d870351 (diff)
downloadsssd-dd285415d7a8d8376207960cfa3e977524c3b98c.tar.gz
sssd-dd285415d7a8d8376207960cfa3e977524c3b98c.tar.xz
sssd-dd285415d7a8d8376207960cfa3e977524c3b98c.zip
SYSDB: Search the timestamp caches in addition to the sysdb cache
When a sysdb entry is searched, the sysdb cache is consulted first for users or groups. If an entry is found in the sysdb cache, the attributes from the timestamp cache are merged to return the full and up-to-date set of attributes. The merging is done with a single BASE search which is a direct lookup into the underlying key-value database, so it should be relatively fast. More complex merging is done only for enumeration by filter which is currently done only via the IFP back end and should be quite infrequent, so I hope we can justify a more complex merging there. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/db/sysdb.c')
-rw-r--r--src/db/sysdb.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index fcdea0e01..81b731a0d 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1683,3 +1683,35 @@ int sysdb_delete_ulong(struct ldb_message *msg,
{
return sysdb_ldb_msg_ulong_helper(msg, LDB_FLAG_MOD_DELETE, attr, value);
}
+
+bool is_ts_ldb_dn(struct ldb_dn *dn)
+{
+ const char *sysdb_comp_name = NULL;
+ const struct ldb_val *sysdb_comp_val = NULL;
+
+ if (dn == NULL) {
+ return false;
+ }
+
+ sysdb_comp_name = ldb_dn_get_component_name(dn, 1);
+ if (strcasecmp("cn", sysdb_comp_name) != 0) {
+ /* The second component name is not "cn" */
+ return false;
+ }
+
+ sysdb_comp_val = ldb_dn_get_component_val(dn, 1);
+ if (strncasecmp("users",
+ (const char *) sysdb_comp_val->data,
+ sysdb_comp_val->length) == 0) {
+ return true;
+ }
+
+ sysdb_comp_val = ldb_dn_get_component_val(dn, 1);
+ if (strncasecmp("groups",
+ (const char *) sysdb_comp_val->data,
+ sysdb_comp_val->length) == 0) {
+ return true;
+ }
+
+ return false;
+}