src/dird/dir_plugins.c
static bool is_plugin_compatible(Plugin *plugin)
{
   pDirInfo *info = (pDirInfo *)plugin->pinfo;
   Dmsg0(50, "is_plugin_compatible called\n");
   if (chk_dbglvl(50)) {
      dump_dir_plugin(plugin, stdin);
   }
   if (strcmp(info->plugin_magic, DIR_PLUGIN_MAGIC) != 0) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin magic wrong. Plugin=%s wanted=%s got=%s\n"),
           plugin->file, DIR_PLUGIN_MAGIC, info->plugin_magic);
      Dmsg3(50, "Plugin magic wrong. Plugin=%s wanted=%s got=%s\n",
           plugin->file, DIR_PLUGIN_MAGIC, info->plugin_magic);

      return false;
   }
   if (info->version != DIR_PLUGIN_INTERFACE_VERSION) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin version incorrect. Plugin=%s wanted=%d got=%d\n"),
           plugin->file, DIR_PLUGIN_INTERFACE_VERSION, info->version);
      Dmsg3(50, "Plugin version incorrect. Plugin=%s wanted=%d got=%d\n",
           plugin->file, DIR_PLUGIN_INTERFACE_VERSION, info->version);
      return false;
   }
   if (strcmp(info->plugin_license, "Bacula AGPLv3") != 0 &&
       strcmp(info->plugin_license, "AGPLv3") != 0 &&
       strcmp(info->plugin_license, "Bacula") != 0) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin license incompatible. Plugin=%s license=%s\n"),
           plugin->file, info->plugin_license);
      Dmsg2(50, "Plugin license incompatible. Plugin=%s license=%s\n",
           plugin->file, info->plugin_license);
      return false;
   }
   if (info->size != sizeof(pDirInfo)) {
      Jmsg(NULL, M_ERROR, 0,
           _("Plugin size incorrect. Plugin=%s wanted=%d got=%d\n"),
           plugin->file, sizeof(pDirInfo), info->size);
      return false;
   }

   return true;
}
/**
 * Check if a plugin is compatible.  Called by the load_plugin function
 *  to allow us to verify the plugin.
 */
Check if a plugin is compatible.  Called by the load_plugin function
to allow us to verify the plugin.
Check if a plugin is compatible . Called by the load_plugin function to allow us to verify the plugin .
static bool is_plugin_compatible(Plugin *plugin)
{
   pDirInfo *info = (pDirInfo *)plugin->pinfo;
   Dmsg0(50, "is_plugin_compatible called\n");
   if (chk_dbglvl(50)) {
      dump_dir_plugin(plugin, stdin);
   }
   if (strcmp(info->plugin_magic, DIR_PLUGIN_MAGIC) != 0) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin magic wrong. Plugin=%s wanted=%s got=%s\n"),
           plugin->file, DIR_PLUGIN_MAGIC, info->plugin_magic);
      Dmsg3(50, "Plugin magic wrong. Plugin=%s wanted=%s got=%s\n",
           plugin->file, DIR_PLUGIN_MAGIC, info->plugin_magic);
      return false;
   }
   if (info->version != DIR_PLUGIN_INTERFACE_VERSION) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin version incorrect. Plugin=%s wanted=%d got=%d\n"),
           plugin->file, DIR_PLUGIN_INTERFACE_VERSION, info->version);
      Dmsg3(50, "Plugin version incorrect. Plugin=%s wanted=%d got=%d\n",
           plugin->file, DIR_PLUGIN_INTERFACE_VERSION, info->version);
      return false;
   }
   if (strcmp(info->plugin_license, "Bacula AGPLv3") != 0 &&
       strcmp(info->plugin_license, "AGPLv3") != 0 &&
       strcmp(info->plugin_license, "Bacula") != 0) {
      Jmsg(NULL, M_ERROR, 0, _("Plugin license incompatible. Plugin=%s license=%s\n"),
           plugin->file, info->plugin_license);
      Dmsg2(50, "Plugin license incompatible. Plugin=%s license=%s\n",
           plugin->file, info->plugin_license);
      return false;
   }
   if (info->size != sizeof(pDirInfo)) {
      Jmsg(NULL, M_ERROR, 0,
           _("Plugin size incorrect. Plugin=%s wanted=%d got=%d\n"),
           plugin->file, sizeof(pDirInfo), info->size);
      return false;
   }
   return true;
}
static bool is_plugin_compatible ( Plugin * plugin ) { pDirInfo * info = ( pDirInfo * ) plugin -> pinfo ; Dmsg0 ( 50 , " \n " ) ; if ( chk_dbglvl ( 50 ) ) { dump_dir_plugin ( plugin , stdin ) ; } if ( strcmp ( info -> plugin_magic , DIR_PLUGIN_MAGIC ) != 0 ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , plugin -> file , DIR_PLUGIN_MAGIC , info -> plugin_magic ) ; Dmsg3 ( 50 , " \n " , plugin -> file , DIR_PLUGIN_MAGIC , info -> plugin_magic ) ; return false ; } if ( info -> version != DIR_PLUGIN_INTERFACE_VERSION ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , plugin -> file , DIR_PLUGIN_INTERFACE_VERSION , info -> version ) ; Dmsg3 ( 50 , " \n " , plugin -> file , DIR_PLUGIN_INTERFACE_VERSION , info -> version ) ; return false ; } if ( strcmp ( info -> plugin_license , " " ) != 0 && strcmp ( info -> plugin_license , " " ) != 0 && strcmp ( info -> plugin_license , " " ) != 0 ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , plugin -> file , info -> plugin_license ) ; Dmsg2 ( 50 , " \n " , plugin -> file , info -> plugin_license ) ; return false ; } if ( info -> size != sizeof ( pDirInfo ) ) { Jmsg ( NULL , M_ERROR , 0 , _ ( " \n " ) , plugin -> file , sizeof ( pDirInfo ) , info -> size ) ; return false ; } return true ; }
Check if a plugin is compatible.
Check if a plugin is compatible .