]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/getmsg.c
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / dird / getmsg.c
index e05e63b584cde2f1bcb2e6b1977b270e81ad67cb..18b54e961d8159153b462e9fa401a041ac9a7538 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2018 Kern Sibbald
 
    The original author of Bacula is Kern Sibbald, with contributions
    from many others, a complete list can be found in the file AUTHORS.
@@ -11,7 +11,7 @@
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   This notice must be preserved when any source code is 
+   This notice must be preserved when any source code is
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
@@ -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;
@@ -147,7 +148,7 @@ int bget_dirmsg(BSOCK *bs)
 
    for ( ; !bs->is_stop() && !bs->is_timed_out(); ) {
       n = bs->recv();
-      Dmsg2(200, "bget_dirmsg %d: %s\n", n, bs->msg);
+      Dmsg4(200, "bget_dirmsg n=%d msglen=%ld is_stop=%d: %s\n", n, bs->msglen, bs->is_stop(), bs->msg);
 
       if (bs->is_stop() || bs->is_timed_out()) {
          return n;                    /* error or terminate */
@@ -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;
          }
@@ -279,6 +283,8 @@ int bget_dirmsg(BSOCK *bs)
          uint64_t bytes;
          if ((sscanf(bs->msg, "Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n",
                 &JobId,  &files, &bytes, &bps) == 4) ||
+             (sscanf(bs->msg, "Progress JobId=x files=%ld bytes=%lld bps=%ld\n",
+                &files, &bytes, &bps) == 3) ||
              (sscanf(bs->msg, "Progress Job=x files=%ld bytes=%lld bps=%ld\n",
                 &files, &bytes, &bps) == 3)) {
             Dmsg2(900, "JobId=%d %s", jcr->JobId, bs->msg);