]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Report an error when .query cannot find a suitable plugin
authorEric Bollengier <eric@baculasystems.com>
Tue, 28 Feb 2023 08:32:59 +0000 (09:32 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/filed/fd_plugins.c

index f45594efda00aebde2900fb77d7429026189a1d4..54c859ac5229a0ffe4130156635b879f761e4a05 100644 (file)
@@ -1585,6 +1585,7 @@ bool plugin_query_parameter(JCR *jcr, char *param, char *command, void sendit(JC
    bRC rc;
    int len;
    int i;
+   int found=0;
 
    Dmsg0(dbglvl, "plugin_query\n");
 
@@ -1629,10 +1630,17 @@ bool plugin_query_parameter(JCR *jcr, char *param, char *command, void sendit(JC
       /* check out status */
       if (rc != bRC_OK){
          Dmsg0(dbglvl, "plugin->queryParameter returned error\n");
-         return false;
+         OutputWriter ow;// TODO: pass api_opts
+         sendit(jcr, ow.get_output(OT_STRING, "error", "plugin protocol error", OT_END));
+         goto bail_out;
       }
+      found=1;
       break;
    }
+   if (!found) {
+      OutputWriter ow;        // TODO: pass api_opts
+      sendit(jcr, ow.get_output(OT_STRING, "error", "plugin not found", OT_END));
+   }
 bail_out:
    jcr->plugin_ctx = NULL;
    jcr->plugin = NULL;