]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Update files license header.
authorRadosław Korzeniewski <radoslaw@korzeniewski.net>
Thu, 11 Feb 2021 09:59:19 +0000 (10:59 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:00 +0000 (09:03 +0100)
22 files changed:
bacula/src/plugins/fd/docker/dkcommctx.c
bacula/src/plugins/fd/docker/dkcommctx.h
bacula/src/plugins/fd/docker/dkid.c
bacula/src/plugins/fd/docker/dkid.h
bacula/src/plugins/fd/docker/dkid_test.c
bacula/src/plugins/fd/docker/dkinfo.c
bacula/src/plugins/fd/docker/dkinfo.h
bacula/src/plugins/fd/docker/docker-fd.c
bacula/src/plugins/fd/docker/docker-fd.h
bacula/src/plugins/fd/pluginlib/commctx.h
bacula/src/plugins/fd/pluginlib/metaplugin.cpp
bacula/src/plugins/fd/pluginlib/metaplugin.h
bacula/src/plugins/fd/pluginlib/pluginlib.cpp
bacula/src/plugins/fd/pluginlib/pluginlib.h
bacula/src/plugins/fd/pluginlib/pluginlib_test.cpp
bacula/src/plugins/fd/pluginlib/ptcomm.cpp
bacula/src/plugins/fd/pluginlib/ptcomm.h
bacula/src/plugins/fd/pluginlib/smartalist.h
bacula/src/plugins/fd/pluginlib/smartalist_test.cpp
bacula/src/plugins/fd/pluginlib/smartptr.h
bacula/src/plugins/fd/pluginlib/smartptr_test.cpp
bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c

index 5891959a5912faf135c7aa26a1faa1bd9e70e8c9..0e736a5c54164de0fdfe28628612560f16362cd9 100644 (file)
@@ -1,8 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright © 2000-2020 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkcommctx.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "dkcommctx.h"
index de59dbb53a4952b5bff8141df5c18c6e8742ab21..a9dc7be0628fbf16dd7f546a14364e39f44f2f6f 100644 (file)
@@ -1,8 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright © 2000-2020 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkcommctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _DKCOMMCTX_H_
index 3430aeb52839f0c0f85f723cd00dcc767928da8b..21da661d9fa408370070b9350d4a3f7be9fa080e 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "dkid.h"
index 47e1ad5de80bce50afed083e030f482880427c97..f2bcc7eedb3e6d26bb48892d764e5b6cd5f83f40 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _DKID_H_
index 8a7f3c67f8416b7d35b68ea3a1002c8304a20e0f..c35c3011c3a4d6d86d8f77d12e139c0e0adb170a 100644 (file)
 */
 /*
  * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid_test.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools - unittest.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "bacula.h"
index 0f6740ce903553016d31fcbaee2828c35a7d2ce0..0bf1d9f90ac39b98f9c3b90e638b1fb021130ca6 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
- *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ */
+/**
+ * @file dkinfo.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  * TODO: add unittests
  */
 
index 3f6a54f6abd09ec02346ed5fe9c2888dd6059dd9..218e92079cf9b3ce2e7f4f7a4af3685ab87ccddd 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkinfo.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _DKINFO_H_
index c762faf45f232db4ce9ed8cfd98df93a8f450deb..1547d634c661ee071aabe8885c817bc8111b204d 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file docker-fd.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "docker-fd.h"
index 35542ab71152f3f2375b1bd6d484dc1fce149363..bb6c6ce0b4ea355dfc9a1f4ee518dbaf3efe068d 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2019 Kern Sibbald
+   Copyright (C) 2000-2020 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.
    conveyed and/or propagated.
 
    Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file docker-fd.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
  *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _DOCKER_FD_H_
index 6c8e20f9d8122a99301c5d7414be23b34d959218..7cbd06680b203417fb2aa8b2c3deee4d15203efe 100644 (file)
@@ -23,8 +23,7 @@
  * @version 1.2.0
  * @date 2020-01-05
  *
- * @copyright Copyright (c) 2021 All rights reserved.
- *            IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef PLUGINLIB_COMMCTX_H
index c365b148ad441c5e3f62dda36114aa08973e8680..7e60b4683a2231b9ae1d71019773d54fdbe56a3c 100644 (file)
@@ -1,19 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file metaplugin.h
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
@@ -21,8 +23,7 @@
  * @version 2.1.0
  * @date 2020-12-23
  *
- * @copyright Copyright (c) 2021 All rights reserved.
- *            IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "metaplugin.h"
@@ -145,7 +146,7 @@ METAPLUGIN::METAPLUGIN(bpContext *bpctx) :
       ctx(NULL),
       backend_available(false),
       backend_error(PM_MESSAGE),
-      mode(MODE::NONE),
+      mode(NONE),
       JobId(0),
       JobName(NULL),
       since(0),
@@ -376,7 +377,7 @@ bRC METAPLUGIN::parse_plugin_command(bpContext *ctx, const char *command, alist
       if (strcasecmp(parser.argk[i], "listing") == 0){
          /* found, so check the value if provided */
          if (parser.argv[i]){
-            listing = Listing;
+            listing = ListingMode;
             DMSG0(ctx, DINFO, "listing procedure param found\n");
          }
       }
@@ -384,7 +385,7 @@ bRC METAPLUGIN::parse_plugin_command(bpContext *ctx, const char *command, alist
       if (strcasecmp(parser.argk[i], "query") == 0){
          /* found, so check the value if provided */
          if (parser.argv[i]){
-            listing = QueryParams;
+            listing = ListingQueryParams;
             DMSG0(ctx, DINFO, "query procedure param found\n");
          }
       }
@@ -630,102 +631,98 @@ bRC METAPLUGIN::terminate_all_backends(bpContext *ctx)
 bRC METAPLUGIN::send_jobinfo(bpContext *ctx, char type)
 {
    int32_t rc;
-   int len;
-   bRC status = bRC_OK;
-   POOLMEM *cmd;
+   POOL_MEM cmd;
    char lvl;
 
-   cmd = get_pool_memory(PM_FNAME);
-   len = sizeof_pool_memory(cmd);
    /* we will be sending Job Info data */
-   bsnprintf(cmd, len, "Job\n");
+   pm_strcpy(cmd, "Job\n");
    rc = backend.ctx->write_command(ctx, cmd);
    if (rc < 0){
       /* error */
-      status = bRC_Error;
-      goto bailout;
+      return bRC_Error;
    }
    /* required parameters */
-   bsnprintf(cmd, len, "Name=%s\n", JobName);
+   Mmsg(cmd, "Name=%s\n", JobName);
    rc = backend.ctx->write_command(ctx, cmd);
    if (rc < 0){
       /* error */
-      status = bRC_Error;
-      goto bailout;
+      return bRC_Error;
    }
-   bsnprintf(cmd, len, "JobID=%i\n", JobId);
+   Mmsg(cmd, "JobID=%i\n", JobId);
    rc = backend.ctx->write_command(ctx, cmd);
    if (rc < 0){
       /* error */
-      status = bRC_Error;
-      goto bailout;
+      return bRC_Error;
    }
-   bsnprintf(cmd, len, "Type=%c\n", type);
+   Mmsg(cmd, "Type=%c\n", type);
    rc = backend.ctx->write_command(ctx, cmd);
    if (rc < 0){
       /* error */
-      status = bRC_Error;
-      goto bailout;
+      return bRC_Error;
    }
    /* optional parameters */
-   if (mode != MODE::RESTORE){
+   if (mode != RESTORE){
       switch (mode){
-         case MODE::BACKUP_FULL:
+         case BACKUP_FULL:
             lvl = 'F';
             break;
-         case MODE::BACKUP_DIFF:
+         case BACKUP_DIFF:
             lvl = 'D';
             break;
-         case MODE::BACKUP_INCR:
+         case BACKUP_INCR:
             lvl = 'I';
             break;
          default:
             lvl = 0;
       }
       if (lvl){
-         bsnprintf(cmd, len, "Level=%c\n", lvl);
+         Mmsg(cmd, "Level=%c\n", lvl);
          rc = backend.ctx->write_command(ctx, cmd);
          if (rc < 0){
             /* error */
-            status = bRC_Error;
-            goto bailout;
+         return bRC_Error;
          }
       }
    }
    if (since){
-      bsnprintf(cmd, len, "Since=%ld\n", since);
+      Mmsg(cmd, "Since=%ld\n", since);
       rc = backend.ctx->write_command(ctx, cmd);
       if (rc < 0){
          /* error */
-         status = bRC_Error;
-         goto bailout;
+         return bRC_Error;
       }
    }
    if (where){
-      bsnprintf(cmd, len, "Where=%s\n", where);
+      Mmsg(cmd, "Where=%s\n", where);
       rc = backend.ctx->write_command(ctx, cmd);
       if (rc < 0){
          /* error */
-         status = bRC_Error;
-         goto bailout;
+         return bRC_Error;
       }
    }
    if (regexwhere){
-      bsnprintf(cmd, len, "RegexWhere=%s\n", regexwhere);
+      Mmsg(cmd, "RegexWhere=%s\n", regexwhere);
       rc = backend.ctx->write_command(ctx, cmd);
       if (rc < 0){
          /* error */
-         status = bRC_Error;
-         goto bailout;
+         return bRC_Error;
       }
    }
    if (replace){
-      bsnprintf(cmd, len, "Replace=%c\n", replace);
+      Mmsg(cmd, "Replace=%c\n", replace);
       rc = backend.ctx->write_command(ctx, cmd);
       if (rc < 0){
          /* error */
-         status = bRC_Error;
-         goto bailout;
+         return bRC_Error;
+      }
+   }
+
+   if (CUSTOMNAMESPACE){
+      Mmsg(cmd, "Namespace=%s\n", PLUGINNAMESPACE);
+      rc = backend.ctx->write_command(ctx, cmd);
+      if (rc < 0){
+         /* error */
+         return bRC_Error;
       }
    }
    backend.ctx->signal_eod(ctx);
@@ -733,12 +730,10 @@ bRC METAPLUGIN::send_jobinfo(bpContext *ctx, char type)
    if (!backend.ctx->read_ack(ctx)){
       DMSG0(ctx, DERROR, "Wrong backend response to Job command.\n");
       JMSG0(ctx, backend.ctx->jmsg_err_level(), "Wrong backend response to Job command.\n");
-      status = bRC_Error;
+      return bRC_Error;
    }
 
-bailout:
-   free_pool_memory(cmd);
-   return status;
+   return bRC_OK;
 }
 
 /*
@@ -967,7 +962,7 @@ bRC METAPLUGIN::send_startrestore(bpContext *ctx)
    /* here we expect a PIPE: command only */
    if (scan_parameter_str(cmd, "PIPE:", extpipename)){
       /* got PIPE: */
-      DMSG(ctx, DINFO, "PIPE:%s\n", extpipename);
+      DMSG(ctx, DINFO, "PIPE:%s\n", extpipename.c_str());
       backend.ctx->set_extpipename(extpipename.c_str());
       /* TODO: decide if plugin should verify if extpipe is available */
       pm_strcpy(cmd, "OK\n");
@@ -1093,7 +1088,7 @@ bRC METAPLUGIN::prepare_backend(bpContext *ctx, char type, char *command)
          break;
       case BACKEND_JOB_INFO_ESTIMATE:
          /* Start Estimate or Listing (4) */
-         if (listing){
+         if (listing != ListingNone){
             DMSG0(ctx, DINFO, "Start Listing (4) ...\n");
             if (send_startlisting(ctx) != bRC_OK){
                backend.ctx->terminate(ctx);
@@ -1162,15 +1157,15 @@ bRC METAPLUGIN::handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
       switch (lvl) {
          case 'F':
             DMSG0(ctx, D2, "backup level = Full\n");
-            mode = MODE::BACKUP_FULL;
+            mode = BACKUP_FULL;
             break;
          case 'I':
             DMSG0(ctx, D2, "backup level = Incr\n");
-            mode = MODE::BACKUP_INCR;
+            mode = BACKUP_INCR;
             break;
          case 'D':
             DMSG0(ctx, D2, "backup level = Diff\n");
-            mode = MODE::BACKUP_DIFF;
+            mode = BACKUP_DIFF;
             break;
          default:
             DMSG0(ctx, D2, "unsupported backup level!\n");
@@ -1199,7 +1194,7 @@ bRC METAPLUGIN::handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
       DMSG(ctx, DINFO, "RegexWhere=%s\n", NPRT(regexwhere));
       getBaculaVar(bVarReplace, &replace);
       DMSG(ctx, DINFO, "Replace=%c\n", replace);
-      mode = MODE::RESTORE;
+      mode = RESTORE;
       break;
 
    case bEventEndRestoreJob:
@@ -1740,11 +1735,11 @@ bRC METAPLUGIN::pluginIO(bpContext *ctx, struct io_pkt *io)
       case IO_OPEN:
          DMSG(ctx, D2, "IO_OPEN: (%s)\n", io->fname);
          switch (mode){
-            case MODE::BACKUP_FULL:
-            case MODE::BACKUP_INCR:
-            case MODE::BACKUP_DIFF:
+            case BACKUP_FULL:
+            case BACKUP_INCR:
+            case BACKUP_DIFF:
                return perform_backup_open(ctx, io);
-            case MODE::RESTORE:
+            case RESTORE:
                nodata = true;
                break;
             default:
@@ -1757,9 +1752,9 @@ bRC METAPLUGIN::pluginIO(bpContext *ctx, struct io_pkt *io)
             DMSG2(ctx, D2, "IO_READ buf=%p len=%d\n", io->buf, io->count);
          }
          switch (mode){
-            case MODE::BACKUP_FULL:
-            case MODE::BACKUP_INCR:
-            case MODE::BACKUP_DIFF:
+            case BACKUP_FULL:
+            case BACKUP_INCR:
+            case BACKUP_DIFF:
                return perform_read_data(ctx, io);
             default:
                return bRC_Error;
@@ -1771,7 +1766,7 @@ bRC METAPLUGIN::pluginIO(bpContext *ctx, struct io_pkt *io)
             DMSG2(ctx, D2, "IO_WRITE buf=%p len=%d\n", io->buf, io->count);
          }
          switch (mode){
-            case MODE::RESTORE:
+            case RESTORE:
                return perform_write_data(ctx, io);
             default:
                return bRC_Error;
@@ -1784,11 +1779,11 @@ bRC METAPLUGIN::pluginIO(bpContext *ctx, struct io_pkt *io)
             return bRC_Error;
          }
          switch (mode){
-            case MODE::RESTORE:
+            case RESTORE:
                return perform_write_end(ctx, io);
-            case MODE::BACKUP_FULL:
-            case MODE::BACKUP_INCR:
-            case MODE::BACKUP_DIFF:
+            case BACKUP_FULL:
+            case BACKUP_INCR:
+            case BACKUP_DIFF:
                return perform_read_metadata(ctx);
             default:
                return bRC_Error;
@@ -1844,7 +1839,7 @@ bRC METAPLUGIN::startBackupFile(bpContext *ctx, struct save_pkt *sp)
    int reqparams = 2;
 
    /* The first file in Full backup, is the RestoreObject */
-   if (!estimate && mode == MODE::BACKUP_FULL && robjsent == false) {
+   if (!estimate && mode == BACKUP_FULL && robjsent == false) {
       ConfigFile ini;
 
       /* robj for the first time, allocate the buffer */
@@ -1910,8 +1905,8 @@ bRC METAPLUGIN::startBackupFile(bpContext *ctx, struct save_pkt *sp)
                default:
                   /* we need to signal error */
                   sp->type = FT_REG;
-                  DMSG2(ctx, DERROR, "Invalid file type: %c for %s\n", type, fname);
-                  JMSG2(ctx, M_ERROR, "Invalid file type: %c for %s\n", type, fname);
+                  DMSG2(ctx, DERROR, "Invalid file type: %c for %s\n", type, fname.c_str());
+                  JMSG2(ctx, M_ERROR, "Invalid file type: %c for %s\n", type, fname.c_str());
             }
             DMSG6(ctx, DINFO, "STAT:%c size:%lld uid:%d gid:%d mode:%06o nl:%d\n", type, size, uid, gid, perms, nlinks);
             reqparams--;
@@ -2003,7 +1998,7 @@ bRC METAPLUGIN::endBackupFile(bpContext *ctx)
 
    if (!estimate){
       /* The current file was the restore object, so just ask for the next file */
-      if (mode == MODE::BACKUP_FULL && robjsent == false) {
+      if (mode == BACKUP_FULL && robjsent == false) {
          robjsent = true;
          return bRC_More;
       }
@@ -2219,7 +2214,7 @@ bRC METAPLUGIN::queryParameter(bpContext *ctx, struct query_pkt *qp)
    DMSG0(ctx, D1, "METAPLUGIN::queryParameter\n");
 
    if (listing == ListingNone){
-      listing = QueryParams;
+      listing = ListingQueryParams;
       Mmsg(cmd, "%s query=%s", qp->command, qp->parameter);
       if (prepare_backend(ctx, BACKEND_JOB_INFO_ESTIMATE, cmd.c_str()) == bRC_Error){
          return bRC_Error;
index 59fabad6ff1f4b1fb7f3ac8efa9683ca86b04af7..680c2f953bea43e5f515da4d7ef0ae3c5ee3785c 100644 (file)
@@ -1,19 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file metaplugin.h
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
@@ -21,8 +23,7 @@
  * @version 2.1.0
  * @date 2020-12-23
  *
- * @copyright Copyright (c) 2021 All rights reserved.
- *            IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "pluginlib.h"
@@ -48,6 +49,8 @@ extern const char *PLUGIN_DESCRIPTION;
 // Plugin linking time variables
 extern const char *PLUGINPREFIX;
 extern const char *PLUGINNAME;
+extern const char *PLUGINNAMESPACE;
+extern const bool CUSTOMNAMESPACE;
 extern const char *PLUGINAPI;
 extern const char *BACKEND_CMD;
 
@@ -65,7 +68,7 @@ extern const char *valid_params[];
 class METAPLUGIN: public SMARTALLOC
 {
 public:
-   enum class MODE
+   enum MODE
    {
       NONE = 0,
       BACKUP_FULL,
@@ -101,11 +104,11 @@ public:
    ~METAPLUGIN();
 
 private:
-   enum ListingMode
+   enum LISTING
    {
       ListingNone,
-      Listing,
-      QueryParams,
+      ListingMode,
+      ListingQueryParams,
    };
 
    // TODO: define a variable which will signal job cancel
@@ -121,7 +124,7 @@ private:
    char replace;                 // the replace variable for restore job
    bool robjsent;                // set when RestoreObject was sent during Full backup
    bool estimate;                // used when mode is METAPLUGIN_BACKUP_* but we are doing estimate only
-   ListingMode listing;          // used for a Listing procedure for estimate
+   LISTING listing;              // used for a Listing procedure for estimate
    bool nodata;                  // set when backend signaled no data for backup or no data for restore
    bool nextfile;                // set when IO_CLOSE got FNAME: command
    bool openerror;               // show if "openfile" was unsuccessful
index 67016d1141643093e3d14132fc4c9926330e7fc4..7d091a77a6a406a0123b1a4b56881c3681da71e1 100644 (file)
@@ -1,26 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file commctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief Common definitions and utility functions for Inteos plugins.
+ * @version 2.1.0
+ * @date 2021-02-10
  *
- * Common definitions and utility functions for Inteos plugins.
- * Functions defines a common framework used in our utilities and plugins.
- * Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "pluginlib.h"
index b0e4de058873329b99b2631c8df0adf2e31b2333..4084ade89d923bea790e784597275a6432b1ee3e 100644 (file)
@@ -1,26 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file commctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief Common definitions and utility functions for Inteos plugins.
+ * @version 2.1.0
+ * @date 2021-02-10
  *
- * Common definitions and utility functions for Inteos plugins.
- * Functions defines a common framework used in our utilities and plugins.
- * Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _PLUGINLIB_H_
index fbcc60c0b8a70bbc95cd14aabf8d2abcd97d0c85..7352fcd088a968ca8e12f79284b4e964a8c3f04b 100644 (file)
@@ -1,19 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file commctx.h
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
@@ -21,6 +23,7 @@
  * @version 1.1.0
  * @date 2020-12-23
  *
+ * @copyright Copyright (c) 2020 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include "pluginlib.h"
index 46fb6352ac0f7f679892f6d905331905ec6bb3ab..38c87d2afe7d5e3195539cf832895bdd3eec4549 100644 (file)
@@ -1,23 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file ptcomm.cpp
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
- * @brief This is a Bacula plugin library for interfacing with Metaplugin backend.
+ * @brief This is a process communication lowlevel library for Bacula plugin.
  * @version 2.0.0
  * @date 2020-11-20
  *
index e4eb8672c147b3c06f3443cb6e6385664a73eb71..c869f46e78b4ab99c06593460107ddf36609b81f 100644 (file)
@@ -1,22 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
- * This is a process communication lowlevel library for Bacula plugin.
- * Author: Radoslaw Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @file ptcomm.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a process communication lowlevel library for Bacula plugin.
+ * @version 2.0.0
+ * @date 2021-02-10
+ *
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #ifndef _PTCOMM_H_
index adb5ad88b6b33fbee8ac93383767ec5d5e3bd95b..178d9e1883e6a46ccdd6ab238fc35d58904fb127 100644 (file)
@@ -17,7 +17,7 @@
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
- * @file commctx.h
+ * @file smartalist.h
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
  * @brief This is a simple smart array list (alist) resource guard conceptually based on C++11 - RAII.
  * @version 1.1.0
index b9d584e23334ef8b68fbfa6d3e00638e74b5f9a9..24841213de0b4d875cc814a693ddbc2f31c33725 100644 (file)
@@ -1,19 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file smartalist_test.cpp
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
index a08cfdfb391d169f958ea4aa82ad6029ff75174c..32cf68c2ae7e662116a21137a41b338f6e64d750 100644 (file)
@@ -17,7 +17,7 @@
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
- * @file commctx.h
+ * @file smartptr.h
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
  * @brief This is a simple smart pointer guard conceptually based on C++11 smart pointers - unique_ptr.
  * @version 1.1.0
index a05203519b939979127e30b2f72a5de86b56f813..0b44fe50cbdb5fa93cd327ea119660ee7f752109 100644 (file)
@@ -1,19 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
 /**
  * @file smartptr_test.cpp
  * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
index 9b31564338e6bf3cd5820ff976534256b96ca4a2..7e15c48e59fe5f291436991f5b496e00677f0f03 100644 (file)
@@ -1,27 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2017 Bacula Systems SA
-   All rights reserved.
+   Copyright (C) 2000-2020 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   Licensees holding a valid Bacula Systems SA license may use this file
-   and others of this release in accordance with the proprietary license
-   agreement provided in the LICENSE file.  Redistribution of any part of
-   this release is not permitted.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * File:   test_rhv_backend.c
- * Author: radekk, radoslaw@korzeniewski.net
- *
- * Copyright (c) 2017 by Inteos sp. z o.o.
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
- * This is a dumb and extremely simple backend simulator used for test swift Plugin.
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file test_metaplugin_backend.cpp
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a dumb and extremely simple backend simulator used for test Metaplugin.
+ * @version 2.1.0
+ * @date 2020-12-23
  *
+ * @copyright Copyright (c) 2020 All rights reserved. IP transferred to Bacula Systems according to agreement.
  */
 
 #include <stdio.h>
@@ -60,7 +62,7 @@ bool regress_backup_other_file = false;
 #define BUFLEN             4096
 #define BIGBUFLEN          65536
 
-    void LOG(const char *txt)
+void LOG(const char *txt)
 {
    char _buf[BUFLEN];
 
@@ -371,7 +373,9 @@ void perform_backup()
    const char *longfilename = longfilenamestr;
 
    // test for fname > 500c
+#if __cplusplus > 201103L
    static_assert(sizeof(longfilenamestr) > 500);
+#endif
    snprintf(buf, BIGBUFLEN, "FNAME:%s/%s\n", PLUGINPREFIX, longfilename);
    write_plugin('C', buf);
    write_plugin('C', "STAT:F 234560 901 901 0100640 1\n");