* 1. The generic lexical scanner in lib/lex.c and lib/lex.h
*
* 2. The generic config scanner in lib/parse_config.c and
- * lib/parse_config.h.
- * These files contain the parser code, some utility
- * routines, and the common store routines (name, int,
- * string).
+ * lib/parse_config.h.
+ * These files contain the parser code, some utility
+ * routines, and the common store routines (name, int,
+ * string).
*
* 3. The daemon specific file, which contains the Resource
- * definitions as well as any specific store routines
- * for the resource records.
+ * definitions as well as any specific store routines
+ * for the resource records.
*
* Kern Sibbald, January MM, September MM
*/
{"description", store_str, ITEM(res_cons.hdr.desc), 0, 0, 0},
{"rcfile", store_dir, ITEM(res_cons.rc_file), 0, 0, 0},
{"historyfile", store_dir, ITEM(res_cons.hist_file), 0, 0, 0},
+ {"sslcertificatedirectory", store_dir, ITEM(res_cons.ssl_certs), 0, 0, 0},
{NULL, NULL, NULL, 0, 0, 0}
};
{"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
{"address", store_str, ITEM(res_dir.address), 0, ITEM_REQUIRED, 0},
{"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+ {"enablessl", store_yesno, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
{NULL, NULL, NULL, 0, 0, 0}
};
struct s_res resources[] = {
{"console", cons_items, R_CONSOLE, NULL},
{"director", dir_items, R_DIRECTOR, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
printf("No record for %d %s\n", type, res_to_str(type));
return;
}
- if (type < 0) { /* no recursion */
+ if (type < 0) { /* no recursion */
type = - type;
recurse = 0;
}
switch (type) {
case R_CONSOLE:
printf("Console: name=%s rcfile=%s histfile=%s\n", reshdr->name,
- res->res_cons.rc_file, res->res_cons.hist_file);
- break;
+ res->res_cons.rc_file, res->res_cons.hist_file);
+ break;
case R_DIRECTOR:
printf("Director: name=%s address=%s DIRport=%d\n", reshdr->name,
- res->res_dir.address, res->res_dir.DIRport);
- break;
+ res->res_dir.address, res->res_dir.DIRport);
+ break;
default:
printf("Unknown resource type %d\n", type);
}
switch (type) {
case R_CONSOLE:
- if (res->res_cons.rc_file) {
- free(res->res_cons.rc_file);
- }
- if (res->res_cons.hist_file) {
- free(res->res_cons.hist_file);
- }
+ if (res->res_cons.rc_file) {
+ free(res->res_cons.rc_file);
+ }
+ if (res->res_cons.hist_file) {
+ free(res->res_cons.hist_file);
+ }
case R_DIRECTOR:
- if (res->res_dir.address)
- free(res->res_dir.address);
- break;
+ if (res->res_dir.address)
+ free(res->res_dir.address);
+ break;
default:
printf("Unknown resource type %d\n", type);
}
*/
for (i=0; items[i].name; i++) {
if (items[i].flags & ITEM_REQUIRED) {
- if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
+ if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
Emsg2(M_ABORT, 0, "%s item is required in %s resource, but not found.\n",
- items[i].name, resources[rindex]);
- }
+ items[i].name, resources[rindex]);
+ }
}
}
*/
if (pass == 2) {
switch (type) {
- /* Resources not containing a resource */
- case R_CONSOLE:
- case R_DIRECTOR:
- break;
+ /* Resources not containing a resource */
+ case R_CONSOLE:
+ case R_DIRECTOR:
+ break;
- default:
+ default:
Emsg1(M_ERROR, 0, "Unknown resource type %d\n", type);
- error = 1;
- break;
+ error = 1;
+ break;
}
/* Note, the resoure name was already saved during pass 1,
* so here, we can just release it.
*/
if (res_all.res_dir.hdr.name) {
- free(res_all.res_dir.hdr.name);
- res_all.res_dir.hdr.name = NULL;
+ free(res_all.res_dir.hdr.name);
+ res_all.res_dir.hdr.name = NULL;
}
if (res_all.res_dir.hdr.desc) {
- free(res_all.res_dir.hdr.desc);
- res_all.res_dir.hdr.desc = NULL;
+ free(res_all.res_dir.hdr.desc);
+ res_all.res_dir.hdr.desc = NULL;
}
return;
}
/* The following code is only executed during pass 1 */
switch (type) {
case R_CONSOLE:
- size = sizeof(CONSRES);
- break;
+ size = sizeof(CONSRES);
+ break;
case R_DIRECTOR:
- size = sizeof(DIRRES);
- break;
+ size = sizeof(DIRRES);
+ break;
default:
printf("Unknown resource type %d\n", type);
- error = 1;
- size = 1;
- break;
+ error = 1;
+ size = 1;
+ break;
}
/* Common */
if (!error) {
res = (URES *)malloc(size);
memcpy(res, &res_all, size);
if (!resources[rindex].res_head) {
- resources[rindex].res_head = (RES *)res; /* store first entry */
+ resources[rindex].res_head = (RES *)res; /* store first entry */
} else {
- RES *next;
- /* Add new res to end of chain */
- for (next=resources[rindex].res_head; next->next; next=next->next)
- { }
- next->next = (RES *)res;
+ RES *next;
+ /* Add new res to end of chain */
+ for (next=resources[rindex].res_head; next->next; next=next->next)
+ { }
+ next->next = (RES *)res;
Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type),
- res->res_dir.hdr.name);
+ res->res_dir.hdr.name);
}
}
}
RES hdr;
char *rc_file; /* startup file */
char *hist_file; /* command history file */
+ char *ssl_certs; /* certificates directory */
};
typedef struct s_res_cons CONSRES;
int DIRport; /* UA server port */
char *address; /* UA server address */
char *password; /* UA server password */
+ int enable_ssl; /* Use SSL */
};
typedef struct s_res_dir DIRRES;
/* Commands sent to File daemon */
static char backupcmd[] = "backup\n";
-static char storaddr[] = "storage address=%s port=%d\n";
+static char storaddr[] = "storage address=%s port=%d ssl=%d\n";
static char levelcmd[] = "level = %s%s\n";
/* Responses received from File daemon */
if (jcr->store->SDDport == 0) {
jcr->store->SDDport = jcr->store->SDport;
}
- bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport);
+ bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport,
+ jcr->store->enable_ssl);
if (!response(fd, OKstore, "Storage", 1)) {
goto bail_out;
}
{"diraddress", store_str, ITEM(res_dir.DIRaddr), 0, 0, 0},
{"queryfile", store_dir, ITEM(res_dir.query_file), 0, ITEM_REQUIRED, 0},
{"workingdirectory", store_dir, ITEM(res_dir.working_directory), 0, ITEM_REQUIRED, 0},
- {"piddirectory", store_dir, ITEM(res_dir.pid_directory), 0, ITEM_REQUIRED, 0},
+ {"piddirectory",store_dir, ITEM(res_dir.pid_directory), 0, ITEM_REQUIRED, 0},
{"subsysdirectory", store_dir, ITEM(res_dir.subsys_directory), 0, ITEM_REQUIRED, 0},
+ {"sslcertificatedirectory", store_dir, ITEM(res_dir.ssl_certs), 0, 0, 0},
+ {"enablessl", store_yesno, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_dir.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
{"fdconnecttimeout", store_time,ITEM(res_dir.FDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
{"fileretention", store_time, ITEM(res_client.FileRetention), 0, ITEM_DEFAULT, 60*60*24*60},
{"jobretention", store_time, ITEM(res_client.JobRetention), 0, ITEM_DEFAULT, 60*60*24*180},
{"autoprune", store_yesno, ITEM(res_client.AutoPrune), 1, ITEM_DEFAULT, 1},
+ {"enablessl", store_yesno, ITEM(res_client.enable_ssl), 1, ITEM_DEFAULT, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{NULL, NULL, NULL, 0, 0, 0}
};
{"device", store_strname, ITEM(res_store.dev_name), 0, ITEM_REQUIRED, 0},
{"mediatype", store_strname, ITEM(res_store.media_type), 0, ITEM_REQUIRED, 0},
{"autochanger", store_yesno, ITEM(res_store.autochanger), 1, ITEM_DEFAULT, 0},
+ {"enablessl", store_yesno, ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_store.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{NULL, NULL, NULL, 0, 0, 0}
};
/*
* Resource codes -- they must be sequential for indexing
*/
-#define R_FIRST 1001
-
-#define R_DIRECTOR 1001
-#define R_CLIENT 1002
-#define R_JOB 1003
-#define R_STORAGE 1004
-#define R_CATALOG 1005
-#define R_SCHEDULE 1006
-#define R_FILESET 1007
-#define R_GROUP 1008
-#define R_POOL 1009
-#define R_MSGS 1010
-#define R_COUNTER 1011
-
-#define R_LAST R_COUNTER
+#define R_FIRST 1001
+
+#define R_DIRECTOR 1001
+#define R_CLIENT 1002
+#define R_JOB 1003
+#define R_STORAGE 1004
+#define R_CATALOG 1005
+#define R_SCHEDULE 1006
+#define R_FILESET 1007
+#define R_GROUP 1008
+#define R_POOL 1009
+#define R_MSGS 1010
+#define R_COUNTER 1011
+
+#define R_LAST R_COUNTER
/*
* Some resource attributes
*/
-#define R_NAME 1020
-#define R_ADDRESS 1021
-#define R_PASSWORD 1022
-#define R_TYPE 1023
-#define R_BACKUP 1024
+#define R_NAME 1020
+#define R_ADDRESS 1021
+#define R_PASSWORD 1022
+#define R_TYPE 1023
+#define R_BACKUP 1024
/* Used for certain KeyWord tables */
-struct s_kw {
+struct s_kw {
char *name;
- int token;
+ int token;
};
/* Job Level keyword structure */
struct s_jl {
- char *level_name; /* level keyword */
- int level; /* level */
- int job_type; /* JobType permitting this level */
+ char *level_name; /* level keyword */
+ int level; /* level */
+ int job_type; /* JobType permitting this level */
};
/* Job Type keyword structure */
/* Definition of the contents of each Resource */
/*
- * Director Resource
+ * Director Resource
*
*/
struct s_res_dir {
- RES hdr;
- int DIRport; /* where we listen -- UA port server port */
- char *DIRaddr; /* bind address */
- char *password; /* Password for UA access */
- char *query_file; /* SQL query file */
- char *working_directory; /* WorkingDirectory */
- char *pid_directory; /* PidDirectory */
- char *subsys_directory; /* SubsysDirectory */
+ RES hdr;
+ int DIRport; /* where we listen -- UA port server port */
+ char *DIRaddr; /* bind address */
+ char *password; /* Password for UA access */
+ char *query_file; /* SQL query file */
+ char *working_directory; /* WorkingDirectory */
+ char *pid_directory; /* PidDirectory */
+ char *subsys_directory; /* SubsysDirectory */
+ char *ssl_certs; /* SSL Certificates directory */
+ int enable_ssl; /* Use SSL */
struct s_res_msgs *messages; /* Daemon message handler */
- uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
- utime_t FDConnectTimeout; /* timeout for connect in seconds */
- utime_t SDConnectTimeout; /* timeout in seconds */
+ uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
+ utime_t FDConnectTimeout; /* timeout for connect in seconds */
+ utime_t SDConnectTimeout; /* timeout in seconds */
};
typedef struct s_res_dir DIRRES;
*
*/
struct s_res_client {
- RES hdr;
+ RES hdr;
- int FDport; /* Where File daemon listens */
- int AutoPrune; /* Do automatic pruning? */
- utime_t FileRetention; /* file retention period in seconds */
- utime_t JobRetention; /* job retention period in seconds */
+ int FDport; /* Where File daemon listens */
+ int AutoPrune; /* Do automatic pruning? */
+ utime_t FileRetention; /* file retention period in seconds */
+ utime_t JobRetention; /* job retention period in seconds */
char *address;
char *password;
- struct s_res_cat *catalog; /* Catalog resource */
- uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
- semlock_t sem; /* client semaphore */
+ struct s_res_cat *catalog; /* Catalog resource */
+ uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
+ semlock_t sem; /* client semaphore */
+ int enable_ssl; /* Use SSL */
};
typedef struct s_res_client CLIENT;
*
*/
struct s_res_store {
- RES hdr;
+ RES hdr;
- int SDport; /* port where Directors connect */
- int SDDport; /* data port for File daemon */
+ int SDport; /* port where Directors connect */
+ int SDDport; /* data port for File daemon */
char *address;
char *password;
char *media_type;
char *dev_name;
- int autochanger; /* set if autochanger */
- uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
- semlock_t sem; /* storage semaphore */
+ int autochanger; /* set if autochanger */
+ uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
+ semlock_t sem; /* storage semaphore */
+ int enable_ssl; /* Use SSL */
};
typedef struct s_res_store STORE;
*
*/
struct s_res_cat {
- RES hdr;
+ RES hdr;
- int db_port; /* Port -- not yet implemented */
- char *db_address; /* host name for remote access */
- char *db_socket; /* Socket for local access */
+ int db_port; /* Port -- not yet implemented */
+ char *db_address; /* host name for remote access */
+ char *db_socket; /* Socket for local access */
char *db_password;
char *db_user;
char *db_name;
*
*/
struct s_res_job {
- RES hdr;
-
- int JobType; /* job type (backup, verify, restore */
- int level; /* default backup/verify level */
- int RestoreJobId; /* What -- JobId to restore */
- char *RestoreWhere; /* Where on disk to restore -- directory */
- char *RestoreBootstrap; /* Bootstrap file */
- char *RunBeforeJob; /* Run program before Job */
- char *RunAfterJob; /* Run program after Job */
- char *WriteBootstrap; /* Where to write bootstrap Job updates */
- int replace; /* How (overwrite, ..) */
- utime_t MaxRunTime; /* max run time in seconds */
- utime_t MaxStartDelay; /* max start delay in seconds */
- int PrefixLinks; /* prefix soft links with Where path */
- int PruneJobs; /* Force pruning of Jobs */
- int PruneFiles; /* Force pruning of Files */
- int PruneVolumes; /* Force pruning of Volumes */
- int SpoolAttributes; /* Set to spool attributes in SD */
- uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
+ RES hdr;
+
+ int JobType; /* job type (backup, verify, restore */
+ int level; /* default backup/verify level */
+ int RestoreJobId; /* What -- JobId to restore */
+ char *RestoreWhere; /* Where on disk to restore -- directory */
+ char *RestoreBootstrap; /* Bootstrap file */
+ char *RunBeforeJob; /* Run program before Job */
+ char *RunAfterJob; /* Run program after Job */
+ char *WriteBootstrap; /* Where to write bootstrap Job updates */
+ int replace; /* How (overwrite, ..) */
+ utime_t MaxRunTime; /* max run time in seconds */
+ utime_t MaxStartDelay; /* max start delay in seconds */
+ int PrefixLinks; /* prefix soft links with Where path */
+ int PruneJobs; /* Force pruning of Jobs */
+ int PruneFiles; /* Force pruning of Files */
+ int PruneVolumes; /* Force pruning of Volumes */
+ int SpoolAttributes; /* Set to spool attributes in SD */
+ uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
struct s_res_msgs *messages; /* How and where to send messages */
struct s_res_sch *schedule; /* When -- Automatic schedule */
struct s_res_client *client; /* Who to backup */
struct s_res_fs *fileset; /* What to backup -- Fileset */
struct s_res_store *storage; /* Where is device -- Storage daemon */
- struct s_res_pool *pool; /* Where is media -- Media Pool */
+ struct s_res_pool *pool; /* Where is media -- Media Pool */
- semlock_t sem; /* Job semaphore */
+ semlock_t sem; /* Job semaphore */
};
typedef struct s_res_job JOB;
#define MAX_FOPTS 30
struct s_fopts_item {
- char opts[MAX_FOPTS]; /* options string */
- char *match; /* match string */
- char **base_list; /* list of base job names */
- int num_base; /* number of bases in list */
+ char opts[MAX_FOPTS]; /* options string */
+ char *match; /* match string */
+ char **base_list; /* list of base job names */
+ int num_base; /* number of bases in list */
};
typedef struct s_fopts_item FOPTS;
/* This is either an include item or an exclude item */
struct s_incexc_item {
- FOPTS *current_opts; /* points to current options structure */
- FOPTS **opts_list; /* options list */
- int num_opts; /* number of options items */
- char **name_list; /* filename list */
+ FOPTS *current_opts; /* points to current options structure */
+ FOPTS **opts_list; /* options list */
+ int num_opts; /* number of options items */
+ char **name_list; /* filename list */
int max_names; /* malloc'ed size of name list */
- int num_names; /* number of names in the list */
+ int num_names; /* number of names in the list */
};
typedef struct s_incexc_item INCEXE;
*
*/
struct s_res_fs {
- RES hdr;
+ RES hdr;
- int finclude; /* Set if finclude/fexclude used */
- INCEXE **include_items; /* array of incexe structures */
- int num_includes; /* number in array */
+ int finclude; /* Set if finclude/fexclude used */
+ INCEXE **include_items; /* array of incexe structures */
+ int num_includes; /* number in array */
INCEXE **exclude_items;
int num_excludes;
- int have_MD5; /* set if MD5 initialized */
- struct MD5Context md5c; /* MD5 of include/exclude */
- char MD5[30]; /* base 64 representation of MD5 */
+ int have_MD5; /* set if MD5 initialized */
+ struct MD5Context md5c; /* MD5 of include/exclude */
+ char MD5[30]; /* base 64 representation of MD5 */
};
typedef struct s_res_fs FILESET;
*
*/
struct s_res_sch {
- RES hdr;
+ RES hdr;
struct s_run *run;
};
*
*/
struct s_res_group {
- RES hdr;
+ RES hdr;
};
typedef struct s_res_group GROUP;
* Counter Resource
*/
struct s_res_counter {
- RES hdr;
+ RES hdr;
- int32_t MinValue; /* Minimum value */
- int32_t MaxValue; /* Maximum value */
- int Global; /* global/local */
- char *WrapCounter; /* Wrap counter name */
+ int32_t MinValue; /* Minimum value */
+ int32_t MaxValue; /* Maximum value */
+ int Global; /* global/local */
+ char *WrapCounter; /* Wrap counter name */
};
typedef struct s_res_counter COUNTER;
*
*/
struct s_res_pool {
- RES hdr;
+ RES hdr;
struct s_res_counter counter; /* Counter resources */
- char *pool_type; /* Pool type */
- char *label_format; /* Label format string */
- char *cleaning_prefix; /* Cleaning label prefix */
- int use_catalog; /* maintain catalog for media */
- int catalog_files; /* maintain file entries in catalog */
- int use_volume_once; /* write on volume only once */
- int accept_any_volume; /* accept any volume */
- int recycle_oldest_volume; /* recycle oldest volume */
- uint32_t max_volumes; /* max number of volumes */
- utime_t VolRetention; /* volume retention period in seconds */
- utime_t VolUseDuration; /* duration volume can be used */
- uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
- uint32_t MaxVolFiles; /* Maximum files on the Volume */
- uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
- int AutoPrune; /* default for pool auto prune */
- int Recycle; /* default for media recycle yes/no */
+ char *pool_type; /* Pool type */
+ char *label_format; /* Label format string */
+ char *cleaning_prefix; /* Cleaning label prefix */
+ int use_catalog; /* maintain catalog for media */
+ int catalog_files; /* maintain file entries in catalog */
+ int use_volume_once; /* write on volume only once */
+ int accept_any_volume; /* accept any volume */
+ int recycle_oldest_volume; /* recycle oldest volume */
+ uint32_t max_volumes; /* max number of volumes */
+ utime_t VolRetention; /* volume retention period in seconds */
+ utime_t VolUseDuration; /* duration volume can be used */
+ uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
+ uint32_t MaxVolFiles; /* Maximum files on the Volume */
+ uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
+ int AutoPrune; /* default for pool auto prune */
+ int Recycle; /* default for media recycle yes/no */
};
typedef struct s_res_pool POOL;
* resource structure definitions.
*/
union u_res {
- struct s_res_dir res_dir;
- struct s_res_client res_client;
- struct s_res_store res_store;
- struct s_res_cat res_cat;
- struct s_res_job res_job;
- struct s_res_fs res_fs;
- struct s_res_sch res_sch;
- struct s_res_group res_group;
- struct s_res_pool res_pool;
- struct s_res_msgs res_msgs;
+ struct s_res_dir res_dir;
+ struct s_res_client res_client;
+ struct s_res_store res_store;
+ struct s_res_cat res_cat;
+ struct s_res_job res_job;
+ struct s_res_fs res_fs;
+ struct s_res_sch res_sch;
+ struct s_res_group res_group;
+ struct s_res_pool res_pool;
+ struct s_res_msgs res_msgs;
struct s_res_counter res_counter;
RES hdr;
};
/* Run structure contained in Schedule Resource */
struct s_run {
- struct s_run *next; /* points to next run record */
- int level; /* level override */
+ struct s_run *next; /* points to next run record */
+ int level; /* level override */
int job_type;
- POOL *pool; /* Pool override */
- STORE *storage; /* Storage override */
- MSGS *msgs; /* Messages override */
+ POOL *pool; /* Pool override */
+ STORE *storage; /* Storage override */
+ MSGS *msgs; /* Messages override */
char *since;
int level_no;
- int minute; /* minute to run job */
- time_t last_run; /* last time run */
- time_t next_run; /* next time to run */
+ int minute; /* minute to run job */
+ time_t last_run; /* last time run */
+ time_t next_run; /* next time to run */
char hour[nbytes_for_bits(24)]; /* bit set for each hour */
char mday[nbytes_for_bits(31)]; /* bit set for each day of month */
char month[nbytes_for_bits(12)]; /* bit set for each month */
* 1. The generic lexical scanner in lib/lex.c and lib/lex.h
*
* 2. The generic config scanner in lib/parse_config.c and
- * lib/parse_config.h.
- * These files contain the parser code, some utility
- * routines, and the common store routines (name, int,
- * string).
+ * lib/parse_config.h.
+ * These files contain the parser code, some utility
+ * routines, and the common store routines (name, int,
+ * string).
*
* 3. The daemon specific file, which contains the Resource
- * definitions as well as any specific store routines
- * for the resource records.
+ * definitions as well as any specific store routines
+ * for the resource records.
*
* Kern Sibbald, September MM
*
/* Client or File daemon "Global" resources */
static struct res_items cli_items[] = {
- {"name", store_name, ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
+ {"name", store_name, ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
{"description", store_str, ITEM(res_client.hdr.desc), 0, 0, 0},
- {"fdport", store_pint, ITEM(res_client.FDport), 0, ITEM_DEFAULT, 9102},
+ {"fdport", store_pint, ITEM(res_client.FDport), 0, ITEM_DEFAULT, 9102},
{"fdaddress", store_str, ITEM(res_client.FDaddr), 0, 0, 0},
{"workingdirectory", store_dir, ITEM(res_client.working_directory), 0, ITEM_REQUIRED, 0},
- {"piddirectory", store_dir, ITEM(res_client.pid_directory), 0, ITEM_REQUIRED, 0},
+ {"piddirectory", store_dir, ITEM(res_client.pid_directory), 0, ITEM_REQUIRED, 0},
{"subsysdirectory", store_dir, ITEM(res_client.subsys_directory), 0, ITEM_REQUIRED, 0},
- {"maximumconcurrentjobs", store_pint, ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 3},
+ {"sslcertificatedirectory", store_dir, ITEM(res_client.ssl_certs), 0, 0, 0},
+ {"enablessl", store_yesno, ITEM(res_client.enable_ssl),1, ITEM_DEFAULT, 0},
+ {"maximumconcurrentjobs", store_pint, ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 3},
{"messages", store_res, ITEM(res_client.messages), R_MSGS, 0, 0},
{NULL, NULL, NULL, 0, 0, 0}
};
{"filedaemon", cli_items, R_CLIENT, NULL},
{"client", cli_items, R_CLIENT, NULL}, /* alias for filedaemon */
{"messages", msgs_items, R_MSGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
sendit(sock, "No record for %d %s\n", type, res_to_str(type));
return;
}
- if (type < 0) { /* no recursion */
+ if (type < 0) { /* no recursion */
type = - type;
recurse = 0;
}
switch (type) {
case R_DIRECTOR:
sendit(sock, "Director: name=%s password=%s\n", reshdr->name,
- res->res_dir.password);
- break;
+ res->res_dir.password);
+ break;
case R_CLIENT:
sendit(sock, "Client: name=%s FDport=%d\n", reshdr->name,
- res->res_client.FDport);
- break;
+ res->res_client.FDport);
+ break;
case R_MSGS:
sendit(sock, "Messages: name=%s\n", res->res_msgs.hdr.name);
- if (res->res_msgs.mail_cmd)
+ if (res->res_msgs.mail_cmd)
sendit(sock, " mailcmd=%s\n", res->res_msgs.mail_cmd);
- if (res->res_msgs.operator_cmd)
+ if (res->res_msgs.operator_cmd)
sendit(sock, " opcmd=%s\n", res->res_msgs.operator_cmd);
- break;
+ break;
default:
sendit(sock, "Unknown resource type %d\n", type);
}
switch (type) {
case R_DIRECTOR:
- if (res->res_dir.password) {
- free(res->res_dir.password);
- }
- if (res->res_dir.address) {
- free(res->res_dir.address);
- }
- break;
+ if (res->res_dir.password) {
+ free(res->res_dir.password);
+ }
+ if (res->res_dir.address) {
+ free(res->res_dir.address);
+ }
+ break;
case R_CLIENT:
- if (res->res_client.working_directory) {
- free(res->res_client.working_directory);
- }
- if (res->res_client.pid_directory) {
- free(res->res_client.pid_directory);
- }
- if (res->res_client.subsys_directory) {
- free(res->res_client.subsys_directory);
- }
- if (res->res_client.FDaddr) {
- free(res->res_client.FDaddr);
- }
- break;
+ if (res->res_client.working_directory) {
+ free(res->res_client.working_directory);
+ }
+ if (res->res_client.pid_directory) {
+ free(res->res_client.pid_directory);
+ }
+ if (res->res_client.subsys_directory) {
+ free(res->res_client.subsys_directory);
+ }
+ if (res->res_client.FDaddr) {
+ free(res->res_client.FDaddr);
+ }
+ break;
case R_MSGS:
- if (res->res_msgs.mail_cmd)
- free(res->res_msgs.mail_cmd);
- if (res->res_msgs.operator_cmd)
- free(res->res_msgs.operator_cmd);
- free_msgs_res((MSGS *)res); /* free message resource */
- res = NULL;
- break;
+ if (res->res_msgs.mail_cmd)
+ free(res->res_msgs.mail_cmd);
+ if (res->res_msgs.operator_cmd)
+ free(res->res_msgs.operator_cmd);
+ free_msgs_res((MSGS *)res); /* free message resource */
+ res = NULL;
+ break;
default:
printf("Unknown resource type %d\n", type);
}
*/
for (i=0; items[i].name; i++) {
if (items[i].flags & ITEM_REQUIRED) {
- if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
+ if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
Emsg2(M_ABORT, 0, _("%s item is required in %s resource, but not found.\n"),
- items[i].name, resources[rindex]);
- }
+ items[i].name, resources[rindex]);
+ }
}
}
*/
if (pass == 2) {
switch (type) {
- /* Resources not containing a resource */
- case R_MSGS:
- case R_DIRECTOR:
- break;
+ /* Resources not containing a resource */
+ case R_MSGS:
+ case R_DIRECTOR:
+ break;
- /* Resources containing another resource */
- case R_CLIENT:
- if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_dir.hdr.name)) == NULL) {
+ /* Resources containing another resource */
+ case R_CLIENT:
+ if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_dir.hdr.name)) == NULL) {
Emsg1(M_ABORT, 0, "Cannot find Client resource %s\n", res_all.res_dir.hdr.name);
- }
- res->res_client.messages = res_all.res_client.messages;
- break;
- default:
+ }
+ res->res_client.messages = res_all.res_client.messages;
+ break;
+ default:
Emsg1(M_ERROR, 0, _("Unknown resource type %d\n"), type);
- error = 1;
- break;
+ error = 1;
+ break;
}
/* Note, the resoure name was already saved during pass 1,
* so here, we can just release it.
*/
if (res_all.res_dir.hdr.name) {
- free(res_all.res_dir.hdr.name);
- res_all.res_dir.hdr.name = NULL;
+ free(res_all.res_dir.hdr.name);
+ res_all.res_dir.hdr.name = NULL;
}
if (res_all.res_dir.hdr.desc) {
- free(res_all.res_dir.hdr.desc);
- res_all.res_dir.hdr.desc = NULL;
+ free(res_all.res_dir.hdr.desc);
+ res_all.res_dir.hdr.desc = NULL;
}
return;
}
/* The following code is only executed on pass 1 */
switch (type) {
case R_DIRECTOR:
- size = sizeof(DIRRES);
- break;
+ size = sizeof(DIRRES);
+ break;
case R_CLIENT:
- size = sizeof(CLIENT);
- break;
+ size = sizeof(CLIENT);
+ break;
case R_MSGS:
- size = sizeof(MSGS);
- break;
+ size = sizeof(MSGS);
+ break;
default:
printf(_("Unknown resource type %d\n"), type);
- error = 1;
- size = 1;
- break;
+ error = 1;
+ size = 1;
+ break;
}
/* Common */
if (!error) {
res = (URES *)malloc(size);
memcpy(res, &res_all, size);
if (!resources[rindex].res_head) {
- resources[rindex].res_head = (RES *)res; /* store first entry */
+ resources[rindex].res_head = (RES *)res; /* store first entry */
} else {
- RES *next;
- /* Add new res to end of chain */
- for (next=resources[rindex].res_head; next->next; next=next->next)
- { }
- next->next = (RES *)res;
+ RES *next;
+ /* Add new res to end of chain */
+ for (next=resources[rindex].res_head; next->next; next=next->next)
+ { }
+ next->next = (RES *)res;
Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type),
- res->res_dir.hdr.name);
+ res->res_dir.hdr.name);
}
}
}
/*
* Resource codes -- they must be sequential for indexing
*/
-#define R_FIRST 1001
+#define R_FIRST 1001
-#define R_DIRECTOR 1001
-#define R_CLIENT 1002
-#define R_MSGS 1003
+#define R_DIRECTOR 1001
+#define R_CLIENT 1002
+#define R_MSGS 1003
-#define R_LAST R_MSGS
+#define R_LAST R_MSGS
/*
* Some resource attributes
*/
-#define R_NAME 1020
-#define R_ADDRESS 1021
-#define R_PASSWORD 1022
-#define R_TYPE 1023
+#define R_NAME 1020
+#define R_ADDRESS 1021
+#define R_PASSWORD 1022
+#define R_TYPE 1023
/* Definition of the contents of each Resource */
struct s_res_dir {
- RES hdr;
- char *password; /* Director password */
- char *address; /* Director address or zero */
+ RES hdr;
+ char *password; /* Director password */
+ char *address; /* Director address or zero */
};
typedef struct s_res_dir DIRRES;
struct s_res_client {
- RES hdr;
- int FDport; /* where we listen for Directors */
- char *FDaddr; /* bind address */
+ RES hdr;
+ int FDport; /* where we listen for Directors */
+ char *FDaddr; /* bind address */
char *working_directory;
char *pid_directory;
char *subsys_directory;
+ char *ssl_certs; /* SSL Certificates directory */
+ int enable_ssl; /* Use SSL */
struct s_res_msgs *messages; /* daemon message handler */
int MaxConcurrentJobs;
};
* resource structure definitions.
*/
union u_res {
- struct s_res_dir res_dir;
- struct s_res_client res_client;
- struct s_res_msgs res_msgs;
+ struct s_res_dir res_dir;
+ struct s_res_client res_client;
+ struct s_res_msgs res_msgs;
RES hdr;
};
/* Commands received from director that need scanning */
static char jobcmd[] = "JobId=%d Job=%127s SDid=%d SDtime=%d Authorization=%100s";
-static char storaddr[] = "storage address=%s port=%d\n";
+static char storaddr[] = "storage address=%s port=%d ssl=%d\n";
static char sessioncmd[] = "session %127s %ld %ld %ld %ld %ld %ld\n";
static char restorecmd[] = "restore replace=%c where=%s\n";
static char restorecmd1[] = "restore replace=%c where=\n";
static int storage_cmd(JCR *jcr)
{
int stored_port; /* storage daemon port */
+ int enable_ssl; /* enable ssl to sd */
BSOCK *dir = jcr->dir_bsock;
BSOCK *sd; /* storage daemon bsock */
Dmsg1(100, "StorageCmd: %s", dir->msg);
- if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port) != 2) {
+ if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port, &enable_ssl) != 3) {
Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), dir->msg);
return 0;
}
- Dmsg2(110, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
+ Dmsg3(110, "Open storage: %s:%d ssl=%d\n", jcr->stored_addr, stored_port, enable_ssl);
/* Open command communications with Storage daemon */
/* Try to connect for 1 hour at 10 second intervals */
sd = bnet_connect(jcr, 10, 3600, _("Storage daemon"),
{"workingdirectory", store_dir, ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
{"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
{"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, ITEM_REQUIRED, 0},
+ {"sslcertificatedirectory", store_dir,ITEM(res_store.ssl_certs), 0, 0, 0},
+ {"enablessl", store_yesno,ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
{"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 3},
{NULL, NULL, 0, 0, 0, 0}
};
*/
-#define R_FIRST 3001
+#define R_FIRST 3001
-#define R_DIRECTOR 3001
-#define R_STORAGE 3002
-#define R_DEVICE 3003
-#define R_MSGS 3004
+#define R_DIRECTOR 3001
+#define R_STORAGE 3002
+#define R_DEVICE 3003
+#define R_MSGS 3004
-#define R_LAST R_MSGS
+#define R_LAST R_MSGS
-#define R_NAME 3020
-#define R_ADDRESS 3021
-#define R_PASSWORD 3022
-#define R_TYPE 3023
-#define R_BACKUP 3024
+#define R_NAME 3020
+#define R_ADDRESS 3021
+#define R_PASSWORD 3022
+#define R_TYPE 3023
+#define R_BACKUP 3024
/* Definition of the contents of each Resource */
struct s_res_dir {
- RES hdr;
+ RES hdr;
- char *password; /* Director password */
- char *address; /* Director IP address or zero */
+ char *password; /* Director password */
+ char *address; /* Director IP address or zero */
};
typedef struct s_res_dir DIRRES;
/* Storage daemon "global" definitions */
struct s_res_store {
- RES hdr;
+ RES hdr;
- char *address; /* deprecated */
- char *SDaddr; /* bind address */
- int SDport; /* Where we listen for Directors */
+ char *address; /* deprecated */
+ char *SDaddr; /* bind address */
+ int SDport; /* Where we listen for Directors */
int SDDport; /* "Data" port where we listen for File daemons */
- char *working_directory; /* working directory for checkpoints */
+ char *working_directory; /* working directory for checkpoints */
char *pid_directory;
char *subsys_directory;
+ char *ssl_certs; /* SSL Certificates directory */
+ int enable_ssl; /* Use SSL */
uint32_t max_concurrent_jobs; /* maximum concurrent jobs to run */
struct s_res_msgs *messages; /* Daemon message handler */
};
/* Device specific definitions */
struct s_res_dev {
- RES hdr;
-
- char *media_type; /* User assigned media type */
- char *device_name; /* Archive device name */
- char *changer_name; /* Changer device name */
- char *changer_command; /* Changer command -- external program */
- int cap_bits; /* Capabilities of this device */
- uint32_t max_changer_wait; /* Changer timeout */
- uint32_t max_rewind_wait; /* maximum secs to wait for rewind */
- uint32_t max_open_wait; /* maximum secs to wait for open */
- uint32_t max_open_vols; /* maximum simultaneous open volumes */
- uint32_t min_block_size; /* min block size */
- uint32_t max_block_size; /* max block size */
- uint32_t max_volume_jobs; /* max jobs to put on one volume */
- int64_t max_volume_files; /* max files to put on one volume */
- int64_t max_volume_size; /* max bytes to put on one volume */
- int64_t max_file_size; /* max file size in bytes */
- int64_t volume_capacity; /* advisory capacity */
- DEVICE *dev; /* Pointer to phyical dev -- set at runtime */
+ RES hdr;
+
+ char *media_type; /* User assigned media type */
+ char *device_name; /* Archive device name */
+ char *changer_name; /* Changer device name */
+ char *changer_command; /* Changer command -- external program */
+ int cap_bits; /* Capabilities of this device */
+ uint32_t max_changer_wait; /* Changer timeout */
+ uint32_t max_rewind_wait; /* maximum secs to wait for rewind */
+ uint32_t max_open_wait; /* maximum secs to wait for open */
+ uint32_t max_open_vols; /* maximum simultaneous open volumes */
+ uint32_t min_block_size; /* min block size */
+ uint32_t max_block_size; /* max block size */
+ uint32_t max_volume_jobs; /* max jobs to put on one volume */
+ int64_t max_volume_files; /* max files to put on one volume */
+ int64_t max_volume_size; /* max bytes to put on one volume */
+ int64_t max_file_size; /* max file size in bytes */
+ int64_t volume_capacity; /* advisory capacity */
+ DEVICE *dev; /* Pointer to phyical dev -- set at runtime */
};
typedef struct s_res_dev DEVRES;
union u_res {
- struct s_res_dir res_dir;
- struct s_res_store res_store;
- struct s_res_dev res_dev;
- struct s_res_msgs res_msgs;
+ struct s_res_dir res_dir;
+ struct s_res_store res_store;
+ struct s_res_dev res_dev;
+ struct s_res_msgs res_msgs;
RES hdr;
};
typedef union u_res URES;