+ if (ci->children_num != 0)
+ {
+ WARNING ("exec plugin: The config option `%s' may not be a block.",
+ ci->key);
+ return (-1);
+ }
+ if (ci->values_num < 2)
+ {
+ WARNING ("exec plugin: The config option `%s' needs at least two "
+ "arguments.", ci->key);
+ return (-1);
+ }
+ if ((ci->values[0].type != OCONFIG_TYPE_STRING)
+ || (ci->values[1].type != OCONFIG_TYPE_STRING))
+ {
+ WARNING ("exec plugin: The first two arguments to the `%s' option must "
+ "be string arguments.", ci->key);
+ return (-1);
+ }
+
+ pl = (program_list_t *) malloc (sizeof (program_list_t));
+ if (pl == NULL)
+ {
+ ERROR ("exec plugin: malloc failed.");
+ return (-1);
+ }
+ memset (pl, '\0', sizeof (program_list_t));
+
+ if (strcasecmp ("NagiosExec", ci->key) == 0)
+ pl->flags |= PL_NAGIOS_PLUGIN;
+ else if (strcasecmp ("NotificationExec", ci->key) == 0)
+ pl->flags |= PL_NOTIF_ACTION;
+ else
+ pl->flags |= PL_NORMAL;
+
+ pl->user = strdup (ci->values[0].value.string);
+ if (pl->user == NULL)
+ {
+ ERROR ("exec plugin: strdup failed.");
+ sfree (pl);
+ return (-1);
+ }
+
+ pl->group = strchr (pl->user, ':');
+ if (pl->group != NULL)
+ {
+ *pl->group = '\0';
+ pl->group++;
+ }