diff --git a/src/core/store.c b/src/core/store.c
index e9e0979e72e4db10ec99d34f2596f178c5d19317..ed5b7ceb5095c683bdb2a3c775c67ff389950ff7 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
/*
* SysDB - src/core/store.c
- * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+ * Copyright (C) 2012-2013 Sebastian 'tokkee' Harl <sh@tokkee.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
return sobj;
}
+ /* don't lookups non-host types from hierarchical hosts */
+ if ((type != SDB_HOST) && (sobj->type == SDB_HOST))
+ continue;
+
sobj = sdb_store_lookup_in_list(sobj->children, type, name);
if (sobj) {
sdb_llist_iter_destroy(iter);
parent_list = parent->children;
}
- /* TODO: only look into direct children? */
if (type == SDB_HOST)
/* make sure that each host is unique */
old = STORE_OBJ(sdb_store_lookup_in_list(obj_list, type, name));
else if (type == SDB_ATTRIBUTE)
+ /* look into attributes of this host */
old = STORE_OBJ(sdb_llist_search_by_name(parent_list, name));
else
+ /* look into services assigned to this host (sdb_store_lookup_in_list
+ * does not look up services from hierarchical hosts) */
old = STORE_OBJ(sdb_store_lookup_in_list(parent_list, type, name));
if (old) {