From: Eric Bollengier Date: Fri, 18 Mar 2022 12:54:29 +0000 (+0100) Subject: meta: Terminate jar. rpms: multi-version m365 X-Git-Tag: Beta-15.0.0~622 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6012047c3f204bb513f122b82736c59918314f08;p=thirdparty%2Fbacula.git meta: Terminate jar. rpms: multi-version m365 --- diff --git a/bacula/src/plugins/fd/pluginlib/metaplugin.cpp b/bacula/src/plugins/fd/pluginlib/metaplugin.cpp index ba89e4774..4fcf619be 100644 --- a/bacula/src/plugins/fd/pluginlib/metaplugin.cpp +++ b/bacula/src/plugins/fd/pluginlib/metaplugin.cpp @@ -1531,6 +1531,7 @@ bRC METAPLUGIN::perform_read_acl(bpContext *ctx) if (!backend.ctx->read_ack(ctx)){ /* should get EOD */ DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n"); + backend.ctx->terminate(ctx); return bRC_Error; } @@ -1567,6 +1568,7 @@ bRC METAPLUGIN::perform_read_xattr(bpContext *ctx) if (!backend.ctx->read_ack(ctx)){ /* should get EOD */ DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n"); + backend.ctx->terminate(ctx); return bRC_Error; } readxattr = true; @@ -1597,6 +1599,7 @@ bRC METAPLUGIN::perform_read_metadata_info(bpContext *ctx, metadata_type type, s if (!backend.ctx->read_ack(ctx)){ /* should get EOD */ DMSG0(ctx, DERROR, "Protocol error, should get EOD.\n"); + backend.ctx->terminate(ctx); return bRC_Error; } @@ -1813,6 +1816,7 @@ bRC METAPLUGIN::perform_read_metacommands(bpContext *ctx) /* error in protocol */ DMSG(ctx, DERROR, "Protocol error, got unknown command: %s\n", cmd.c_str()); JMSG(ctx, M_FATAL, "Protocol error, got unknown command: %s\n", cmd.c_str()); + backend.ctx->terminate(ctx); return bRC_Error; } else { if (backend.ctx->is_fatal()){ @@ -2074,6 +2078,7 @@ bRC METAPLUGIN::perform_read_pluginobject(bpContext *ctx, struct save_pkt *sp) /* error in protocol */ DMSG(ctx, DERROR, "Protocol error, got unknown command: %s\n", cmd.c_str()); JMSG(ctx, M_FATAL, "Protocol error, got unknown command: %s\n", cmd.c_str()); + backend.ctx->terminate(ctx); return bRC_Error; } else { if (backend.ctx->is_fatal()){ @@ -2458,6 +2463,7 @@ bRC METAPLUGIN::startBackupFile(bpContext *ctx, struct save_pkt *sp) if (reqparams > 0) { DMSG0(ctx, DERROR, "Protocol error, not enough file attributes from backend.\n"); JMSG0(ctx, M_FATAL, "Protocol error, not enough file attributes from backend.\n"); + backend.ctx->terminate(ctx); return bRC_Error; } diff --git a/bacula/src/plugins/fd/pluginlib/ptcomm.cpp b/bacula/src/plugins/fd/pluginlib/ptcomm.cpp index 10084bec6..979613722 100644 --- a/bacula/src/plugins/fd/pluginlib/ptcomm.cpp +++ b/bacula/src/plugins/fd/pluginlib/ptcomm.cpp @@ -79,6 +79,8 @@ void PTCOMM::terminate(bpContext *ctx) return; } + DMSG0(ctx, DINFO, "Terminating backend ...\n"); + struct timeval _timeout; _timeout.tv_sec = 0; _timeout.tv_usec = 1000; @@ -344,6 +346,7 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any) DMSG0(ctx, DERROR, "PTCOMM cannot get packet header from backend.\n"); JMSG0(ctx, M_FATAL, "PTCOMM cannot get packet header from backend.\n"); f_eod = f_error = f_fatal = true; + terminate(ctx); return -1; } @@ -373,6 +376,7 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any) if (header.status != *cmd) { DMSG2(ctx, DERROR, "Protocol error. Expected packet: %c got: %c\n", *cmd, header.status); JMSG2(ctx, M_FATAL, "Protocol error. Expected packet: %c got: %c\n", *cmd, header.status); + terminate(ctx); return -1; } } else { @@ -467,8 +471,9 @@ int32_t PTCOMM::recvbackend_header(bpContext *ctx, char *cmd, bool any) continue; default: - DMSG1(ctx, DERROR, "Protocol error. Unknown packet: %c\n", header.status); - JMSG1(ctx, M_FATAL, "Protocol error. Unknown packet: %c\n", header.status); + DMSG2(ctx, DERROR, "Protocol error. Unknown packet: %c:%s\n", header.status, header.length); + JMSG2(ctx, M_FATAL, "Protocol error. Unknown packet: %c:%s\n", header.status, header.length); + terminate(ctx); return -1; } }