]> git.sur5r.net Git - bacula/bacula/commitdiff
Make getmsg.c compatible with old FDs
authorKern Sibbald <kern@sibbald.com>
Sat, 10 Jun 2017 14:24:51 +0000 (16:24 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 10 Jun 2017 14:24:51 +0000 (16:24 +0200)
bacula/src/dird/getmsg.c

index 748a3d3bd5cc6ff5c62a05e79229dc1f1d969aa5..7e5a73df33d4fba9e01d2ba8ff66eeface0aa04d 100644 (file)
@@ -138,6 +138,7 @@ static bool is_msgid(char *msg)
 int bget_dirmsg(BSOCK *bs)
 {
    int32_t n = BNET_TERMINATE;
+   char Job[MAX_NAME_LENGTH];
    JobId_t JobId = 0;
    char MsgType[20];
    int type;
@@ -200,6 +201,7 @@ int bget_dirmsg(BSOCK *bs)
        *  Try to fulfill it.
        */
       if ((sscanf(bs->msg, "%020s JobId=%ld ", MsgType, &JobId) != 2) &&
+          (sscanf(bs->msg, "%020s Job=%127s ", MsgType, Job) != 2) &&
           (sscanf(bs->msg, "%020s Job=x", MsgType) != 1)) {
          if (is_msgid(strchr(bs->msg, '['))) {
             return n;
@@ -221,8 +223,10 @@ int bget_dirmsg(BSOCK *bs)
        *   the protocol.
        */
       if (bs->msg[0] == 'J') {           /* Job message */
-         if (sscanf(bs->msg, "Jmsg JobId=%ld type=%d level=%lld",
-                    &JobId, &type, &mtime) != 3) {
+         if ((sscanf(bs->msg, "Jmsg JobId=%ld type=%d level=%lld",
+                     &JobId, &type, &mtime) != 3) &&
+             (sscanf(bs->msg, "Jmsg Job=%127s type=%d level=%lld",
+                                 Job, &type, &mtime) != 3)) {
             Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
             continue;
          }