From 7c335c8899f076071c0114a797e9b2fba8f1dbe3 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Jun 2014 10:40:21 +0200 Subject: [PATCH 1/8] Makefile: For now, link libsysdb sources directly into sysdbd. Libtool's convenience libraries don't work with programs. When linking sysdbd previously, none of the libsysdb objects only used by plugins would have been linked in. That is, the respective libraries could not be loaded when running the daemon. We'll keep the library around, though, since it's used for the unit tests. This is just a hack but it'll go away after the API is stable and libsysdb is turned back into a "real" library. That'll happen before the 1.0 release. --- src/Makefile.am | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index ed3ebdad..d8514925 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,11 +114,18 @@ sysdb_LDADD = libsysdb_scanner.la libsysdbclient.la @READLINE_LIBS@ endif sysdbd_SOURCES = tools/sysdbd/main.c include/sysdb.h \ - tools/sysdbd/configfile.c tools/sysdbd/configfile.h + tools/sysdbd/configfile.c tools/sysdbd/configfile.h \ + $(libsysdb_la_SOURCES) sysdbd_CFLAGS = $(AM_CFLAGS) -DBUILD_DATE="\"$$( date --utc '+%F %T' ) (UTC)\"" -sysdbd_LDFLAGS = -export-dynamic -sysdbd_LDADD = libsysdb.la liboconfig/liboconfig.la -sysdbd_DEPENDENCIES = liboconfig/liboconfig.la +sysdbd_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL) +sysdbd_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -pthread +sysdbd_LDADD = libsysdb_fe_parser.la liboconfig/liboconfig.la \ + $(LIBLTDL) -lrt +sysdbd_DEPENDENCIES = libsysdb_fe_parser.la liboconfig/liboconfig.la + +if BUILD_WITH_LIBDBI +sysdbd_LDADD += -ldbi +endif sdbconfdir = $(sysconfdir)/sysdb dist_sdbconf_DATA = tools/sysdbd/sysdbd.conf.sample @@ -138,40 +145,40 @@ if BUILD_PLUGIN_CNAMEDNS pkgcnamelib_LTLIBRARIES += plugins/cname/dns.la plugins_cname_dns_la_SOURCE = plugins/cname/dns.c plugins_cname_dns_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -libsysdb_la_LIBADD += -dlopen plugins/cname/dns.la -libsysdb_la_DEPENDENCIES += plugins/cname/dns.la +sysdbd_LDADD += -dlopen plugins/cname/dns.la +sysdbd_DEPENDENCIES += plugins/cname/dns.la endif if BUILD_PLUGIN_COLLECTD pkgbackendcollectdlib_LTLIBRARIES += backend/collectd/unixsock.la backend_collectd_unixsock_la_SOURCES = backend/collectd/unixsock.c backend_collectd_unixsock_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -libsysdb_la_LIBADD += -dlopen backend/collectd/unixsock.la -libsysdb_la_DEPENDENCIES += backend/collectd/unixsock.la +sysdbd_LDADD += -dlopen backend/collectd/unixsock.la +sysdbd_DEPENDENCIES += backend/collectd/unixsock.la endif if BUILD_PLUGIN_MKLIVESTATUS pkgbackendlib_LTLIBRARIES += backend/mk-livestatus.la backend_mk_livestatus_la_SOURCES = backend/mk-livestatus.c backend_mk_livestatus_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -libsysdb_la_LIBADD += -dlopen backend/mk-livestatus.la -libsysdb_la_DEPENDENCIES += backend/mk-livestatus.la +sysdbd_LDADD += -dlopen backend/mk-livestatus.la +sysdbd_DEPENDENCIES += backend/mk-livestatus.la endif if BUILD_PLUGIN_PUPPETSTORECONFIGS pkgbackendpuppetlib_LTLIBRARIES += backend/puppet/store-configs.la backend_puppet_store_configs_la_SOURCES = backend/puppet/store-configs.c backend_puppet_store_configs_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -libsysdb_la_LIBADD += -dlopen backend/puppet/store-configs.la -libsysdb_la_DEPENDENCIES += backend/puppet/store-configs.la +sysdbd_LDADD += -dlopen backend/puppet/store-configs.la +sysdbd_DEPENDENCIES += backend/puppet/store-configs.la endif if BUILD_PLUGIN_SYSLOG pkglib_LTLIBRARIES += plugins/syslog.la plugins_syslog_la_SOURCE = plugins/syslog.c plugins_syslog_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -libsysdb_la_LIBADD += -dlopen plugins/syslog.la -libsysdb_la_DEPENDENCIES += plugins/syslog.la +sysdbd_LDADD += -dlopen plugins/syslog.la +sysdbd_DEPENDENCIES += plugins/syslog.la endif include/client/sysdb.h: include/client/sysdb.h.in ../version From ab6e6823b628af93e1f5d95ab1677e8843d913af Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Jun 2014 23:07:33 +0200 Subject: [PATCH 2/8] client: Added sdb_client_shutdown(). --- src/client/sock.c | 16 ++++++++++++++++ src/include/client/sock.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/client/sock.c b/src/client/sock.c index 805dc1d1..b60bad45 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -211,6 +211,22 @@ sdb_client_sockfd(sdb_client_t *client) return client->fd; } /* sdb_client_sockfd */ +int +sdb_client_shutdown(sdb_client_t *client, int how) +{ + if (! client) { + errno = ENOTSOCK; + return -1; + } + + if (client->fd < 0) { + errno = EBADF; + return -1; + } + + return shutdown(client->fd, how); +} /* sdb_client_shutdown */ + void sdb_client_close(sdb_client_t *client) { diff --git a/src/include/client/sock.h b/src/include/client/sock.h index bce3da91..aeed8a25 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -83,6 +83,14 @@ sdb_client_connect(sdb_client_t *client, const char *username); int sdb_client_sockfd(sdb_client_t *client); +/* + * sdb_client_shutdown: + * Shut down the client's send and/or receive operations. + * See shutdown(3) for details. + */ +int +sdb_client_shutdown(sdb_client_t *client, int how); + /* * sdb_client_close: * Close the client connection. From 1bbb0664ecaed4eeb492d0faae79ca8c5d9f6435 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Jun 2014 23:07:50 +0200 Subject: [PATCH 3/8] sysdb: Wait for remaining data after the mainloop terminates. --- src/tools/sysdb/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/sysdb/main.c b/src/tools/sysdb/main.c index 05c5b9fb..fc226f96 100644 --- a/src/tools/sysdb/main.c +++ b/src/tools/sysdb/main.c @@ -328,6 +328,12 @@ main(int argc, char **argv) sdb_input_init(&input); sdb_input_mainloop(); + sdb_client_shutdown(input.client, SHUT_WR); + while (! sdb_client_eof(input.client)) { + /* wait for remaining data to arrive */ + sdb_command_print_reply(input.client); + } + if (hist_file[0] != '\0') { errno = 0; if (write_history(hist_file)) { From 703c09231bca96e2e5d680ead4b471ec9e276ef5 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Jun 2014 23:12:44 +0200 Subject: [PATCH 4/8] plugin: Ignore internal loggers when checking for existing loggers. An internal logger may currently be registered by the frontend which uses it to send log messages to a client. Usually, these internal loggers will not actually log stuff. Thus, we'll have to ignore them when deciding about fallbacks. --- src/core/plugin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/plugin.c b/src/core/plugin.c index 8cd490a2..b3d59731 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -1113,12 +1113,11 @@ sdb_plugin_log(int prio, const char *msg) sdb_llist_iter_t *iter; int ret = -1; + _Bool logged = 0; + if (! msg) return 0; - if (! sdb_llist_len(log_list)) - return fprintf(stderr, "[%s] %s\n", SDB_LOG_PRIO_TO_STRING(prio), msg); - iter = sdb_llist_get_iter(log_list); while (sdb_llist_iter_has_next(iter)) { sdb_plugin_log_cb callback; @@ -1131,8 +1130,15 @@ sdb_plugin_log(int prio, const char *msg) tmp = callback(prio, msg, SDB_PLUGIN_CB(obj)->cb_user_data); if (tmp > ret) ret = tmp; + + if (SDB_PLUGIN_CB(obj)->cb_ctx) + logged = 1; + /* else: this is an internally registered callback */ } sdb_llist_iter_destroy(iter); + + if (! logged) + return fprintf(stderr, "[%s] %s\n", SDB_LOG_PRIO_TO_STRING(prio), msg); return ret; } /* sdb_plugin_log */ From e2f0b2814ab337b9f975b16162f73dbbc7fdf717 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 26 Jun 2014 22:26:42 +0200 Subject: [PATCH 5/8] store: Removed obsolete TODO note. --- src/core/store-private.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/store-private.h b/src/core/store-private.h index 49ddaf54..7cc2f66d 100644 --- a/src/core/store-private.h +++ b/src/core/store-private.h @@ -174,8 +174,6 @@ typedef struct { typedef struct { sdb_store_matcher_t super; char *name; - /* XXX: this needs to be more flexible; - * add support for type-specific operators */ string_matcher_t value; } attr_matcher_t; #define ATTR_M(m) ((attr_matcher_t *)(m)) From ed569e21915fe71ead292582a8699d25234cf303 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 26 Jun 2014 22:27:31 +0200 Subject: [PATCH 6/8] store: Renamed a store object's 'children' to 'services'. Hierarchical data will be represented using some object relationship information rather than a weird tree construct below each host. That's going to be more flexible. --- src/core/store-private.h | 2 +- src/core/store.c | 14 +++++++------- src/core/store_lookup.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/store-private.h b/src/core/store-private.h index 7cc2f66d..e501b2cd 100644 --- a/src/core/store-private.h +++ b/src/core/store-private.h @@ -66,7 +66,7 @@ typedef struct { typedef struct { sdb_store_base_t super; - sdb_llist_t *children; + sdb_llist_t *services; sdb_llist_t *attributes; } sdb_store_obj_t; #define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj)) diff --git a/src/core/store.c b/src/core/store.c index df8c02fb..4e642de6 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -92,8 +92,8 @@ sdb_store_obj_init(sdb_object_t *obj, va_list ap) if (ret) return ret; - sobj->children = sdb_llist_create(); - if (! sobj->children) + sobj->services = sdb_llist_create(); + if (! sobj->services) return -1; sobj->attributes = sdb_llist_create(); if (! sobj->attributes) @@ -110,8 +110,8 @@ sdb_store_obj_destroy(sdb_object_t *obj) store_base_destroy(obj); - if (sobj->children) - sdb_llist_destroy(sobj->children); + if (sobj->services) + sdb_llist_destroy(sobj->services); if (sobj->attributes) sdb_llist_destroy(sobj->attributes); } /* sdb_store_obj_destroy */ @@ -188,7 +188,7 @@ store_lookup_in_list(sdb_llist_t *l, int type, const char *name) if ((type != SDB_HOST) && (STORE_BASE(sobj)->type == SDB_HOST)) continue; - sobj = store_lookup_in_list(sobj->children, type, name); + sobj = store_lookup_in_list(sobj->services, type, name); if (sobj) { sdb_llist_iter_destroy(iter); return sobj; @@ -269,7 +269,7 @@ store_obj(int parent_type, const char *parent_name, if (type == SDB_ATTRIBUTE) parent_list = parent->attributes; else - parent_list = parent->children; + parent_list = parent->services; } if (type == SDB_HOST) @@ -543,7 +543,7 @@ sdb_store_host_tojson(sdb_store_base_t *h, sdb_strbuf_t *buf, int flags) if (! (flags & SDB_SKIP_SERVICES)) { sdb_strbuf_append(buf, ", \"services\": "); - store_obj_tojson(host->children, SDB_SERVICE, buf); + store_obj_tojson(host->services, SDB_SERVICE, buf); } sdb_strbuf_append(buf, "}"); diff --git a/src/core/store_lookup.c b/src/core/store_lookup.c index 3920b801..f57cb05c 100644 --- a/src/core/store_lookup.c +++ b/src/core/store_lookup.c @@ -172,7 +172,7 @@ match_name(sdb_store_matcher_t *m, sdb_store_base_t *obj) return match_string(&NAME_M(m)->name, obj->super.name); break; case SDB_SERVICE: - iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->children); + iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->services); break; case SDB_ATTRIBUTE: iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes); From 13052a811a0689bb150be81642721ac0c375becb Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 26 Jun 2014 22:55:47 +0200 Subject: [PATCH 7/8] store: Simplified object update based on having hosts on the toplevel only. --- src/core/store.c | 70 +++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/src/core/store.c b/src/core/store.c index 4e642de6..5a80a310 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -49,7 +49,7 @@ * private variables */ -static sdb_llist_t *obj_list = NULL; +static sdb_llist_t *host_list = NULL; static pthread_rwlock_t obj_lock = PTHREAD_RWLOCK_INITIALIZER; /* @@ -201,16 +201,15 @@ store_lookup_in_list(sdb_llist_t *l, int type, const char *name) static sdb_store_obj_t * store_lookup(int type, const char *name) { - return store_lookup_in_list(obj_list, type, name); + return store_lookup_in_list(host_list, type, name); } /* store_lookup */ /* The obj_lock has to be acquired before calling this function. */ static int -store_obj(int parent_type, const char *parent_name, - int type, const char *name, sdb_time_t last_update, - sdb_store_base_t **updated_obj) +store_obj(const char *hostname, int type, const char *name, + sdb_time_t last_update, sdb_store_base_t **updated_obj) { - char *parent_cname = NULL, *cname = NULL; + char *host_cname = NULL, *cname = NULL; sdb_llist_t *parent_list; sdb_store_base_t *old; @@ -219,22 +218,16 @@ store_obj(int parent_type, const char *parent_name, if (last_update <= 0) last_update = sdb_gettime(); - assert((parent_type == 0) - || (parent_type == SDB_HOST) - || (parent_type == SDB_SERVICE)); assert((type == 0) || (type == SDB_HOST) || (type == SDB_SERVICE) || (type == SDB_ATTRIBUTE)); - if (parent_type == SDB_HOST) { - parent_cname = sdb_plugin_cname(strdup(parent_name)); - if (! parent_cname) { - sdb_log(SDB_LOG_ERR, "store: strdup failed"); + if (! host_list) + if (! (host_list = sdb_llist_create())) return -1; - } - parent_name = parent_cname; - } + parent_list = host_list; + if (type == SDB_HOST) { cname = sdb_plugin_cname(strdup(name)); if (! cname) { @@ -244,24 +237,23 @@ store_obj(int parent_type, const char *parent_name, name = cname; } - if (! obj_list) { - if (! (obj_list = sdb_llist_create())) { - free(parent_cname); + if (hostname) { + sdb_store_obj_t *parent; + + host_cname = sdb_plugin_cname(strdup(hostname)); + if (! host_cname) { + sdb_log(SDB_LOG_ERR, "store: strdup failed"); free(cname); return -1; } - } - parent_list = obj_list; - - if (parent_type && parent_name) { - sdb_store_obj_t *parent; + hostname = host_cname; - parent = store_lookup(parent_type, parent_name); + parent = store_lookup(SDB_HOST, hostname); if (! parent) { sdb_log(SDB_LOG_ERR, "store: Failed to store %s '%s' - " - "parent %s '%s' not found", SDB_STORE_TYPE_TO_NAME(type), - name, SDB_STORE_TYPE_TO_NAME(parent_type), parent_name); - free(parent_cname); + "host '%s' not found", SDB_STORE_TYPE_TO_NAME(type), + name, hostname); + free(host_cname); free(cname); return -1; } @@ -274,7 +266,7 @@ store_obj(int parent_type, const char *parent_name, if (type == SDB_HOST) /* make sure that each host is unique */ - old = STORE_BASE(store_lookup_in_list(obj_list, type, name)); + old = STORE_BASE(store_lookup_in_list(host_list, type, name)); else if (type == SDB_ATTRIBUTE) /* look into attributes of this host */ old = STORE_BASE(sdb_llist_search_by_name(parent_list, name)); @@ -324,13 +316,11 @@ store_obj(int parent_type, const char *parent_name, sdb_log(SDB_LOG_ERR, "store: Failed to create %s '%s': %s", SDB_STORE_TYPE_TO_NAME(type), name, sdb_strerror(errno, errbuf, sizeof(errbuf))); - free(parent_cname); + free(host_cname); free(cname); return -1; } - /* TODO: insert type-aware; the current version works as long as we - * don't support to store hierarchical data */ status = sdb_llist_insert_sorted(parent_list, SDB_OBJ(new), sdb_object_cmp_by_name); @@ -340,7 +330,7 @@ store_obj(int parent_type, const char *parent_name, if (updated_obj) *updated_obj = new; } - free(parent_cname); + free(host_cname); free(cname); return status; } /* store_obj */ @@ -415,8 +405,8 @@ store_obj_tojson(sdb_llist_t *list, int type, sdb_strbuf_t *buf) void sdb_store_clear(void) { - sdb_llist_destroy(obj_list); - obj_list = NULL; + sdb_llist_destroy(host_list); + host_list = NULL; } /* sdb_store_clear */ int @@ -428,7 +418,7 @@ sdb_store_host(const char *name, sdb_time_t last_update) return -1; pthread_rwlock_wrlock(&obj_lock); - status = store_obj(/* parent = */ 0, NULL, + status = store_obj(/* hostname = */ NULL, /* stored object = */ SDB_HOST, name, last_update, /* updated_obj = */ NULL); pthread_rwlock_unlock(&obj_lock); @@ -476,7 +466,7 @@ sdb_store_attribute(const char *hostname, return -1; pthread_rwlock_wrlock(&obj_lock); - status = store_obj(/* parent = */ SDB_HOST, hostname, + status = store_obj(hostname, /* stored object = */ SDB_ATTRIBUTE, key, last_update, &updated_attr); @@ -503,7 +493,7 @@ sdb_store_service(const char *hostname, const char *name, return -1; pthread_rwlock_wrlock(&obj_lock); - status = store_obj(/* parent = */ SDB_HOST, hostname, + status = store_obj(hostname, /* stored object = */ SDB_SERVICE, name, last_update, /* updated obj = */ NULL); pthread_rwlock_unlock(&obj_lock); @@ -560,7 +550,7 @@ sdb_store_tojson(sdb_strbuf_t *buf, int flags) pthread_rwlock_rdlock(&obj_lock); - host_iter = sdb_llist_get_iter(obj_list); + host_iter = sdb_llist_get_iter(host_list); if (! host_iter) { pthread_rwlock_unlock(&obj_lock); return -1; @@ -595,7 +585,7 @@ sdb_store_iterate(sdb_store_iter_cb cb, void *user_data) pthread_rwlock_rdlock(&obj_lock); - host_iter = sdb_llist_get_iter(obj_list); + host_iter = sdb_llist_get_iter(host_list); if (! host_iter) status = -1; From a08b303ff95b7a03de4b5e19397f4ea352db1e47 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 26 Jun 2014 23:05:36 +0200 Subject: [PATCH 8/8] store: Simplified object lookup during update. Again, based on having hosts on the toplevel only. This greatly simplifies the overall structure. After all, this is the underlying storage layer only. More complex relationships between objects will be handled on a different layer. --- src/core/store.c | 71 ++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/src/core/store.c b/src/core/store.c index 5a80a310..bb37e26a 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -163,46 +163,10 @@ static sdb_type_t sdb_attribute_type = { */ static sdb_store_obj_t * -store_lookup_in_list(sdb_llist_t *l, int type, const char *name) +lookup_host(const char *name) { - sdb_llist_iter_t *iter; - - if (! l) - return NULL; - - iter = sdb_llist_get_iter(l); - if (! iter) - return NULL; - - while (sdb_llist_iter_has_next(iter)) { - sdb_store_obj_t *sobj = SDB_STORE_OBJ(sdb_llist_iter_get_next(iter)); - assert(sobj); - - if ((STORE_BASE(sobj)->type == type) - && (! strcasecmp(SDB_OBJ(sobj)->name, name))) { - sdb_llist_iter_destroy(iter); - return sobj; - } - - /* don't lookups non-host types from hierarchical hosts */ - if ((type != SDB_HOST) && (STORE_BASE(sobj)->type == SDB_HOST)) - continue; - - sobj = store_lookup_in_list(sobj->services, type, name); - if (sobj) { - sdb_llist_iter_destroy(iter); - return sobj; - } - } - sdb_llist_iter_destroy(iter); - return NULL; -} /* store_lookup_in_list */ - -static sdb_store_obj_t * -store_lookup(int type, const char *name) -{ - return store_lookup_in_list(host_list, type, name); -} /* store_lookup */ + return SDB_STORE_OBJ(sdb_llist_search_by_name(host_list, name)); +} /* lookup_host */ /* The obj_lock has to be acquired before calling this function. */ static int @@ -223,6 +187,11 @@ store_obj(const char *hostname, int type, const char *name, || (type == SDB_SERVICE) || (type == SDB_ATTRIBUTE)); + assert(hostname || (type == SDB_HOST)); + assert((! hostname) + || (type == SDB_SERVICE) + || (type == SDB_ATTRIBUTE)); + if (! host_list) if (! (host_list = sdb_llist_create())) return -1; @@ -238,7 +207,7 @@ store_obj(const char *hostname, int type, const char *name, } if (hostname) { - sdb_store_obj_t *parent; + sdb_store_obj_t *host; host_cname = sdb_plugin_cname(strdup(hostname)); if (! host_cname) { @@ -248,8 +217,8 @@ store_obj(const char *hostname, int type, const char *name, } hostname = host_cname; - parent = store_lookup(SDB_HOST, hostname); - if (! parent) { + host = lookup_host(hostname); + if (! host) { sdb_log(SDB_LOG_ERR, "store: Failed to store %s '%s' - " "host '%s' not found", SDB_STORE_TYPE_TO_NAME(type), name, hostname); @@ -259,21 +228,15 @@ store_obj(const char *hostname, int type, const char *name, } if (type == SDB_ATTRIBUTE) - parent_list = parent->attributes; + parent_list = host->attributes; else - parent_list = parent->services; + parent_list = host->services; } if (type == SDB_HOST) - /* make sure that each host is unique */ - old = STORE_BASE(store_lookup_in_list(host_list, type, name)); - else if (type == SDB_ATTRIBUTE) - /* look into attributes of this host */ - old = STORE_BASE(sdb_llist_search_by_name(parent_list, name)); + old = STORE_BASE(sdb_llist_search_by_name(host_list, name)); else - /* look into services assigned to this host (store_lookup_in_list - * does not look up services from hierarchical hosts) */ - old = STORE_BASE(store_lookup_in_list(parent_list, type, name)); + old = STORE_BASE(sdb_llist_search_by_name(parent_list, name)); if (old) { if (old->last_update > last_update) { @@ -433,7 +396,7 @@ sdb_store_has_host(const char *name) if (! name) return NULL; - host = store_lookup(SDB_HOST, name); + host = lookup_host(name); return host != NULL; } /* sdb_store_has_host */ @@ -445,7 +408,7 @@ sdb_store_get_host(const char *name) if (! name) return NULL; - host = store_lookup(SDB_HOST, name); + host = lookup_host(name); if (! host) return NULL;