]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/dird/dird_conf.h
authorEric Bollengier <eric@baculasystems.com>
Fri, 24 Apr 2020 15:54:31 +0000 (17:54 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:17 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Wed Feb 5 12:00:41 2020 +0100

    Fix *json segfault on OpenBSD

    In memcpy(&res_all, res, sizeof(res_all));

    The res_all is likely bigger than res itself. We
    copy too much data, and on OpenBSD, we get segfaults.

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Apr 8 14:56:33 2019 +0200

    PSK: Add new "TLS PSK Enable" directive to all resources

    - add the field to the resources
    - create default "psk_ctx" CONTEXT for each of them at startup

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Mar 25 18:32:11 2019 +0100

    Rename MaximumConnectionTime to ReconnectionTime, Run to Connect and ConnectToDir to AllowFDConnections

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Wed Mar 20 14:53:33 2019 +0100

    Add FD Calls Director feature to ease client behind NAT access

     - Implement scheduler in Client side to activate the feature
     - Refactor Run resource between the director and the file daemon
     - Allow to use the Director resource to connect a Director for the proxy command and the FDCallsDir
     - Add FDCallsDir state in show client
     - Add code to handle permanent connections bsock_meeting

    New Directive
     FileDaemon:Director:FDCallsDir=<yes/no>
     FileDaemon:Director:FDCallsDirReconnect=<time>
     FileDaemon:Director:FDCallsDirSchedule=<resource>

     Director:Client:FDCallsDir=<yes/no>

    New Resource
     FileDaemon:Schedule

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri Feb 22 10:14:44 2019 +0100

    Add AllowIncompleteJobs Job directive

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri Dec 21 10:11:06 2018 +0100

    Add Director:Autoprune directive to control globally the autoprune feature

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Oct 18 18:07:24 2016 +0200

    Add DirectoryACL and UserIdACL directives to the Console resource

bacula/src/dird/dird_conf.h

index 6e41e00e29d89287a0913d583e0603942599a9f9..76fa58b81291328d959d8a312fd4aa442e92d96e 100644 (file)
@@ -20,6 +20,7 @@
  * Director specific configuration and defines
  *
  *     Kern Sibbald, Feb MM
+ *
  */
 
 /* NOTE:  #includes at the end of this file */
@@ -67,13 +68,6 @@ struct s_fs_opt {
    const char *option;
 };
 
-/* Job Level keyword structure */
-struct s_jl {
-   const char *level_name;                 /* level keyword */
-   int32_t  level;                         /* level */
-   int32_t  job_type;                      /* JobType permitting this level */
-};
-
 /* Job Type keyword structure */
 struct s_jt {
    const char *type_name;
@@ -121,10 +115,14 @@ public:
    char *tls_dhfile;                  /* TLS Diffie-Hellman Parameters */
    alist *tls_allowed_cns;            /* TLS Allowed Clients */
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
+   TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
    utime_t stats_retention;           /* Stats retention period in seconds */
    bool comm_compression;             /* Enable comm line compression */
+   bool AutoPrune;                    /* Global autoprune flag */
+   bool require_fips;                  /* Check for FIPS module */
    bool tls_authenticate;             /* Authenticated with TLS */
    bool tls_enable;                   /* Enable TLS */
+   bool tls_psk_enable;               /* Enable TLS-PSK */
    bool tls_require;                  /* Require TLS */
    bool tls_verify_peer;              /* TLS Verify Client Certificate */
    char *verid;                       /* Custom Id to print in version command */
@@ -186,6 +184,7 @@ enum {
    PluginOptions_ACL,
    RestoreClient_ACL,
    BackupClient_ACL,
+   UserId_ACL,                  /* List of users/uid that can access to a file in the restore tree */
    Directory_ACL,               /* List of directories that can be accessed in the restore tree */
    Num_ACL                      /* keep last */
 };
@@ -205,8 +204,10 @@ public:
    char *tls_dhfile;                  /* TLS Diffie-Hellman Parameters */
    alist *tls_allowed_cns;            /* TLS Allowed Clients */
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
+   TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
    bool tls_authenticate;             /* Authenticated with TLS */
    bool tls_enable;                   /* Enable TLS */
+   bool tls_psk_enable;               /* Enable TLS-PSK */
    bool tls_require;                  /* Require TLS */
    bool tls_verify_peer;              /* TLS Verify Client Certificate */
 
@@ -255,6 +256,7 @@ public:
    int32_t NumConcurrentJobs;         /* number of concurrent jobs running */
    char *SetIPaddress;                /* address from SetIP command */
    int enabled;                       /* -1: not set, 0 disabled, 1 enabled */
+   BsockMeeting *socket;              /* existing socket, NULL if not enabled */
 };
 
 /*
@@ -281,13 +283,17 @@ public:
    char *tls_keyfile;                 /* TLS Client Key File */
    alist *tls_allowed_cns;            /* TLS Allowed Clients */
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
+   TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
    bool tls_authenticate;             /* Authenticated with TLS */
    bool tls_enable;                   /* Enable TLS */
+   bool tls_psk_enable;               /* Enable TLS-PSK */
    bool tls_require;                  /* Require TLS */
+   bool tls_verify_peer;              /* TLS Verify Client Certificate */
    bool Enabled;                      /* Set if client enabled */
    bool AutoPrune;                    /* Do automatic pruning? */
    bool sd_calls_client;              /* SD calls the client */
    int64_t max_bandwidth;             /* Limit speed on this client */
+   bool allow_fd_connections;         /* FD calls the director */
 
    /* Methods */
    char *name() const;
@@ -298,6 +304,9 @@ public:
    void setAddress(char *addr);
    bool is_enabled();
    void setEnabled(bool val);
+   BSOCK *getBSOCK(int timeout);
+   bool getBSOCK_state(POOLMEM *&buf);
+   void setBSOCK(BSOCK *socket);
 };
 
 inline char *CLIENT::name() const { return hdr.name; }
@@ -335,8 +344,10 @@ public:
    char *tls_certfile;                /* TLS Client Certificate File */
    char *tls_keyfile;                 /* TLS Client Key File */
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
+   TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
    bool tls_authenticate;             /* Authenticated with TLS */
    bool tls_enable;                   /* Enable TLS */
+   bool tls_psk_enable;               /* Enable TLS-PSK */
    bool tls_require;                  /* Require TLS */
    bool Enabled;                      /* Set if device is enabled */
    bool AllowCompress;                /* set if this Storage should allow jobs to enable compression */
@@ -457,6 +468,7 @@ public:
    uint32_t MaxSpawnedJobs;           /* Max Jobs that can be started by Migration/Copy */
    uint32_t BackupsToKeep;            /* Number of backups to keep in Virtual Full */
    bool allow_mixed_priority;         /* Allow jobs with higher priority concurrently with this */
+   bool allow_incomplete_jobs;        /* Allow incomplete jobs */
 
    MSGS      *messages;               /* How and where to send messages */
    SCHED     *schedule;               /* When -- Automatic schedule */
@@ -723,7 +735,7 @@ union URES {
 
 
 /* Run structure contained in Schedule Resource */
-class RUN {
+class RUN: public RUNBASE {
 public:
    RUN *next;                         /* points to next run record */
    uint32_t level;                    /* level override */
@@ -749,17 +761,9 @@ public:
    STORE *storage;                    /* Storage override */
    MSGS *msgs;                        /* Messages override */
    char *since;
-   uint32_t level_no;
-   uint32_t minute;                   /* minute to run job */
-   time_t last_run;                   /* last time run */
-   time_t next_run;                   /* next time to run */
-   bool last_day_set;                 /* set if last_day is used */
-   char hour[nbytes_for_bits(24)];    /* bit set for each hour */
-   char mday[nbytes_for_bits(32)];    /* bit set for each day of month */
-   char month[nbytes_for_bits(12)];   /* bit set for each month */
-   char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
-   char wom[nbytes_for_bits(6)];      /* week of month */
-   char woy[nbytes_for_bits(54)];     /* week of year */
+
+   void copyall(RUN *src);
+   void clearall();
 };
 
 #define GetPoolResWithName(x) ((POOL *)GetResWithName(R_POOL, (x)))
@@ -790,3 +794,4 @@ void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_run(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
+int get_resource_size(int type);