void oss_versionVerify(void) { PL_OBJECT plugin,p; CM_OBJECT com; set_crash(); for (plugin=plugin_first; plugin!=NULL; plugin=p) { p=plugin->next; if (atoi(RUN_VER) < atoi(plugin->req_ver)) { printf("\nLotos: Plugin '%s' pozaduje vyssiu verziu Lotos.\n",plugin->name); write_syslog(SYSLOG, 0, "Lotos: Plugin '%s' pozaduje Lotos verzie %s.\n",plugin->name,plugin->req_ver); for (com=cmds_first; com!=NULL; com=com->next) if (com->plugin==plugin) destroy_pl_cmd(com); destroy_plugin(plugin); } printf("."); } printf(" OK\n"); }
/* Allocate a new plugin struct. */ struct plugin *new_plugin(const char *name, struct plugin_type *type) { struct plugin *p = malloc(sizeof *p); char *last_slash; if (p == NULL) return NULL; /* For security plugin names must not contain a slash. */ last_slash = strrchr(name, '/'); if (last_slash != NULL) name = last_slash+1; p->name = strdup(name); if (p->name == NULL) { free(p); return NULL; } p->context = NULL; p->save_disabled = false; for (size_t i = 0; i < nr_dependencies; i++) p->dependencies[i] = list_new(); p->type = type; if (p->type->init(p)) { return p; } else { destroy_plugin(p); return NULL; } }