- user_data_t ud;
- char callback_name[3*DATA_MAX_NAME_LEN];
-
- memset (&ud, 0, sizeof (ud));
- ud.data = st;
-
- memset (callback_name, 0, sizeof (callback_name));
- ssnprintf (callback_name, sizeof (callback_name),
- "openldap/%s/%s",
- (st->host != NULL) ? st->host : hostname_g,
- (st->name != NULL) ? st->name : "default"),
-
- status = plugin_register_complex_read (/* group = */ NULL,
- /* name = */ callback_name,
- /* callback = */ cldap_read_host,
- /* interval = */ 0,
- /* user_data = */ &ud);
+ cldap_t **temp;
+
+ temp = (cldap_t **) realloc (databases,
+ sizeof (*databases) * (databases_num + 1));
+
+ if (temp == NULL)
+ {
+ ERROR ("openldap plugin: realloc failed");
+ status = -1;
+ }
+ else
+ {
+ user_data_t ud;
+ char callback_name[3*DATA_MAX_NAME_LEN];
+
+ databases = temp;
+ databases[databases_num] = st;
+ databases_num++;
+
+ memset (&ud, 0, sizeof (ud));
+ ud.data = st;
+
+ memset (callback_name, 0, sizeof (callback_name));
+ ssnprintf (callback_name, sizeof (callback_name),
+ "openldap/%s/%s",
+ (st->host != NULL) ? st->host : hostname_g,
+ (st->name != NULL) ? st->name : "default"),
+
+ status = plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ callback_name,
+ /* callback = */ cldap_read_host,
+ /* interval = */ 0,
+ /* user_data = */ &ud);
+ }