diff --git a/core/src/console/console_conf.cc b/core/src/console/console_conf.cc index d1f1063f731..c8776ef83e9 100644 --- a/core/src/console/console_conf.cc +++ b/core/src/console/console_conf.cc @@ -311,14 +311,14 @@ bool SaveResource(int type, ResourceItem *items, int pass) if (pass == 2) { switch (type) { case R_CONSOLE: - if ((res = (UnionOfResources *)GetResWithName(R_CONSOLE, res_all.res_cons.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_CONSOLE, res_all.res_cons.name())) == NULL) { Emsg1(M_ABORT, 0, _("Cannot find Console resource %s\n"), res_all.res_cons.name()); } else { res->res_cons.tls_cert.allowed_certificate_common_names_ = res_all.res_cons.tls_cert.allowed_certificate_common_names_; } break; case R_DIRECTOR: - if ((res = (UnionOfResources *)GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { Emsg1(M_ABORT, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.name()); } else { res->res_dir.tls_cert.allowed_certificate_common_names_ = res_all.res_dir.tls_cert.allowed_certificate_common_names_; diff --git a/core/src/dird/authenticate.cc b/core/src/dird/authenticate.cc index 0c180ba13ba..e37e17f25bc 100644 --- a/core/src/dird/authenticate.cc +++ b/core/src/dird/authenticate.cc @@ -200,7 +200,7 @@ bool AuthenticateFileDaemon(BareosSocket *fd, char *client_name) bool auth_success = false; UnbashSpaces(client_name); - client = (ClientResource *)GetResWithName(R_CLIENT, client_name); + client = (ClientResource *)my_config->GetResWithName(R_CLIENT, client_name); if (client) { if (IsConnectFromClientAllowed(client)) { auth_success = fd->AuthenticateInboundConnection( @@ -270,7 +270,7 @@ bool AuthenticateUserAgent(UaContext *uac) NULL, "Console", "*UserAgent*", me->password, me); } else { UnbashSpaces(name); - cons = (ConsoleResource *)GetResWithName(R_CONSOLE, name); + cons = (ConsoleResource *)my_config->GetResWithName(R_CONSOLE, name); if (cons) { auth_success = ua->AuthenticateInboundConnection(NULL, "Console", name, cons->password, cons); diff --git a/core/src/dird/bsr.cc b/core/src/dird/bsr.cc index c7aad56adc8..6c23c93c03e 100644 --- a/core/src/dird/bsr.cc +++ b/core/src/dird/bsr.cc @@ -30,6 +30,7 @@ #include "include/bareos.h" #include "dird.h" +#include "dird/dird_globals.h" #include "dird/ua_input.h" #include "dird/ua_restore.h" #include "dird/ua_server.h" @@ -73,7 +74,7 @@ static bool GetStorageDevice(char *device, char *storage) if (storage[0] == 0) { return false; } - store = (StorageResource *)GetResWithName(R_STORAGE, storage); + store = (StorageResource *)my_config->GetResWithName(R_STORAGE, storage); if (!store) { return false; } @@ -791,7 +792,7 @@ static inline bool IsOnSameStorage(JobControlRecord *jcr, char *new_one) return true; } - new_store = (StorageResource *)GetResWithName(R_STORAGE, new_one); + new_store = (StorageResource *)my_config->GetResWithName(R_STORAGE, new_one); if (!new_store) { Jmsg(jcr, M_WARNING, 0, _("Could not get storage resource '%s'.\n"), new_one); diff --git a/core/src/dird/dird_conf.cc b/core/src/dird/dird_conf.cc index bae5bc640fe..49d01feddde 100644 --- a/core/src/dird/dird_conf.cc +++ b/core/src/dird/dird_conf.cc @@ -2417,7 +2417,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) * * Find resource saved in pass 1 */ - if (!(res = (UnionOfResources *)GetResWithName(R_POOL, res_all.res_pool.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_POOL, res_all.res_pool.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Pool resource %s\n"), res_all.res_pool.name()); return false; } else { @@ -2434,7 +2434,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) } break; case R_CONSOLE: - if (!(res = (UnionOfResources *)GetResWithName(R_CONSOLE, res_all.res_con.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_CONSOLE, res_all.res_con.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Console resource %s\n"), res_all.res_con.name()); return false; } else { @@ -2443,7 +2443,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) } break; case R_DIRECTOR: - if (!(res = (UnionOfResources *)GetResWithName(R_DIRECTOR, res_all.res_dir.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_DIRECTOR, res_all.res_dir.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.name()); return false; } else { @@ -2454,7 +2454,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) } break; case R_STORAGE: - if (!(res = (UnionOfResources *)GetResWithName(type, res_all.res_store.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(type, res_all.res_store.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Storage resource %s\n"), res_all.res_dir.name()); return false; } else { @@ -2479,7 +2479,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) break; case R_JOBDEFS: case R_JOB: - if (!(res = (UnionOfResources *)GetResWithName(type, res_all.res_job.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(type, res_all.res_job.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Job resource %s\n"), res_all.res_job.name()); return false; } else { @@ -2539,7 +2539,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) } break; case R_COUNTER: - if (!(res = (UnionOfResources *)GetResWithName(R_COUNTER, res_all.res_counter.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_COUNTER, res_all.res_counter.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Counter resource %s\n"), res_all.res_counter.name()); return false; } else { @@ -2548,7 +2548,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) } break; case R_CLIENT: - if (!(res = (UnionOfResources *)GetResWithName(R_CLIENT, res_all.res_client.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_CLIENT, res_all.res_client.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Client resource %s\n"), res_all.res_client.name()); return false; } else { @@ -2573,7 +2573,7 @@ static bool UpdateResourcePointer(int type, ResourceItem *items) * in by run_conf.c during pass 2, so here we jam the pointer * into the Schedule resource. */ - if (!(res = (UnionOfResources *)GetResWithName(R_SCHEDULE, res_all.res_client.name()))) { + if (!(res = (UnionOfResources *)my_config->GetResWithName(R_SCHEDULE, res_all.res_client.name()))) { Emsg1(M_ERROR, 0, _("Cannot find Schedule resource %s\n"), res_all.res_client.name()); return false; } else { @@ -3138,7 +3138,7 @@ static void StoreRunscriptTarget(LEX *lc, ResourceItem *item, int index, int pas } else { CommonResourceHeader *res; - if (!(res = GetResWithName(R_CLIENT, lc->str))) { + if (!(res = my_config->GetResWithName(R_CLIENT, lc->str))) { scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"), lc->str, lc->line_no, lc->line); } @@ -3794,7 +3794,7 @@ bool GetTlsPskByFullyQualifiedResourceName(const char *fq_name_, std::string &ps psk_return_value = me->password.value; success = true; } else { - ConsoleResource *res = reinterpret_cast(GetResWithName(R_CONSOLE, fq_name.c_str())); + ConsoleResource *res = reinterpret_cast(my_config->GetResWithName(R_CONSOLE, fq_name.c_str())); if(res) { psk_return_value = res->password.value; success = true; diff --git a/core/src/dird/fd_cmds.cc b/core/src/dird/fd_cmds.cc index 78879fba3d0..d6b35ed9761 100644 --- a/core/src/dird/fd_cmds.cc +++ b/core/src/dird/fd_cmds.cc @@ -1205,7 +1205,7 @@ void *HandleFiledConnection(ConnectionPool *connections, BareosSocket *fd, ClientResource *client_resource; Connection *connection = NULL; - client_resource = (ClientResource *)GetResWithName(R_CLIENT, client_name); + client_resource = (ClientResource *)my_config->GetResWithName(R_CLIENT, client_name); if (!client_resource) { Emsg1(M_WARNING, 0, "Client \"%s\" tries to connect, " "but no matching resource is defined.\n", client_name); diff --git a/core/src/dird/getmsg.cc b/core/src/dird/getmsg.cc index a22f9034529..f80b27cfdfc 100644 --- a/core/src/dird/getmsg.cc +++ b/core/src/dird/getmsg.cc @@ -325,7 +325,7 @@ int BgetDirmsg(BareosSocket *bs, bool allow_any_message) Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg); } else { UnbashSpaces(dev_name); - dev = (Device *)GetResWithName(R_DEVICE, dev_name.c_str()); + dev = (Device *)my_config->GetResWithName(R_DEVICE, dev_name.c_str()); if (!dev) { continue; } diff --git a/core/src/dird/migrate.cc b/core/src/dird/migrate.cc index 9b8a190b0d9..28e2662a876 100644 --- a/core/src/dird/migrate.cc +++ b/core/src/dird/migrate.cc @@ -293,7 +293,7 @@ static inline bool SetMigrationNextPool(JobControlRecord *jcr, PoolResource **re /* * Get the pool resource corresponding to the original job */ - pool = (PoolResource *)GetResWithName(R_POOL, pr.Name); + pool = (PoolResource *)my_config->GetResWithName(R_POOL, pr.Name); *retpool = pool; if (!pool) { Jmsg(jcr, M_FATAL, 0, _("Pool resource \"%s\" not found.\n"), pr.Name); @@ -1131,8 +1131,8 @@ bool DoMigrationInit(JobControlRecord *jcr) Dmsg5(dbglevel, "JobId=%d: Current: Name=%s JobId=%d Type=%c Level=%c\n", (int)jcr->JobId, jcr->jr.Name, (int)jcr->jr.JobId, jcr->jr.JobType, jcr->jr.JobLevel); - job = (JobResource *)GetResWithName(R_JOB, jcr->jr.Name); - prev_job = (JobResource *)GetResWithName(R_JOB, jcr->previous_jr.Name); + job = (JobResource *)my_config->GetResWithName(R_JOB, jcr->jr.Name); + prev_job = (JobResource *)my_config->GetResWithName(R_JOB, jcr->previous_jr.Name); if (!job) { Jmsg(jcr, M_FATAL, 0, _("Job resource not found for \"%s\".\n"), jcr->jr.Name); diff --git a/core/src/dird/run_conf.cc b/core/src/dird/run_conf.cc index b795fb99efb..9258e964bbd 100644 --- a/core/src/dird/run_conf.cc +++ b/core/src/dird/run_conf.cc @@ -248,7 +248,7 @@ void StoreRun(LEX *lc, ResourceItem *item, int index, int pass) case 'n': /* NextPool */ token = LexGetToken(lc, BCT_NAME); if (pass == 2) { - res = GetResWithName(R_POOL, lc->str); + res = my_config->GetResWithName(R_POOL, lc->str); if (res == NULL) { scan_err1(lc, _("Could not find specified Pool Resource: %s"), lc->str); @@ -279,7 +279,7 @@ void StoreRun(LEX *lc, ResourceItem *item, int index, int pass) case 'S': /* Storage */ token = LexGetToken(lc, BCT_NAME); if (pass == 2) { - res = GetResWithName(R_STORAGE, lc->str); + res = my_config->GetResWithName(R_STORAGE, lc->str); if (res == NULL) { scan_err1(lc, _("Could not find specified Storage Resource: %s"), lc->str); @@ -291,7 +291,7 @@ void StoreRun(LEX *lc, ResourceItem *item, int index, int pass) case 'M': /* Messages */ token = LexGetToken(lc, BCT_NAME); if (pass == 2) { - res = GetResWithName(R_MSGS, lc->str); + res = my_config->GetResWithName(R_MSGS, lc->str); if (res == NULL) { scan_err1(lc, _("Could not find specified Messages Resource: %s"), lc->str); diff --git a/core/src/dird/scheduler.cc b/core/src/dird/scheduler.cc index 182bf1345b3..fc870f7a918 100644 --- a/core/src/dird/scheduler.cc +++ b/core/src/dird/scheduler.cc @@ -108,7 +108,7 @@ JobControlRecord *wait_for_next_job(char *one_shot_job_to_run) /* Create scheduled jobs list */ jobs_to_run = New(dlist(next_job, &next_job->link)); if (one_shot_job_to_run) { /* one shot */ - job = (JobResource *)GetResWithName(R_JOB, one_shot_job_to_run); + job = (JobResource *)my_config->GetResWithName(R_JOB, one_shot_job_to_run); if (!job) { Emsg1(M_ABORT, 0, _("Job %s not found\n"), one_shot_job_to_run); } diff --git a/core/src/dird/stats.cc b/core/src/dird/stats.cc index dd91f07191e..cd3ebf14022 100644 --- a/core/src/dird/stats.cc +++ b/core/src/dird/stats.cc @@ -168,7 +168,7 @@ void *statistics_thread(void *arg) LockRes(); if ((current_store.c_str())[0]) { - store = (StorageResource *)GetResWithName(R_STORAGE, current_store.c_str()); + store = (StorageResource *)my_config->GetResWithName(R_STORAGE, current_store.c_str()); } else { store = NULL; } diff --git a/core/src/dird/storage.cc b/core/src/dird/storage.cc index 4765ceb73fb..ec066fb8b88 100644 --- a/core/src/dird/storage.cc +++ b/core/src/dird/storage.cc @@ -460,7 +460,7 @@ bool SelectNextRstore(JobControlRecord *jcr, bootstrap_info &info) return true; /* Same SD nothing to change */ } - if (!(ustore.store = (StorageResource *)GetResWithName(R_STORAGE,info.storage))) { + if (!(ustore.store = (StorageResource *)my_config->GetResWithName(R_STORAGE,info.storage))) { Jmsg(jcr, M_FATAL, 0, _("Could not get storage resource '%s'.\n"), info.storage); jcr->setJobStatus(JS_ErrorTerminated); diff --git a/core/src/dird/testfind.cc b/core/src/dird/testfind.cc index 7697bfb3e9c..f4a06953762 100644 --- a/core/src/dird/testfind.cc +++ b/core/src/dird/testfind.cc @@ -143,7 +143,7 @@ main (int argc, char *const *argv) } jcr = new_jcr(sizeof(JobControlRecord), NULL); - jcr->res.fileset = (FilesetResource *)GetResWithName(R_FILESET, fileset_name); + jcr->res.fileset = (FilesetResource *)my_config->GetResWithName(R_FILESET, fileset_name); if (jcr->res.fileset == NULL) { fprintf(stderr, "%s: Fileset not found\n", fileset_name); diff --git a/core/src/dird/ua_acl.cc b/core/src/dird/ua_acl.cc index 36944addc91..daafd00f26e 100644 --- a/core/src/dird/ua_acl.cc +++ b/core/src/dird/ua_acl.cc @@ -30,6 +30,7 @@ #include "include/bareos.h" #include "dird.h" +#include "dird/dird_globals.h" #include "lib/edit.h" namespace directordaemon { @@ -393,7 +394,7 @@ CommonResourceHeader *UaContext::GetResWithName(int rcode, const char *name, boo } } - return ::GetResWithName(rcode, name, lock); + return my_config->GetResWithName(rcode, name, lock); bail_out: return NULL; diff --git a/core/src/dird/ua_configure.cc b/core/src/dird/ua_configure.cc index ef53bda98cb..bd0d909442b 100644 --- a/core/src/dird/ua_configure.cc +++ b/core/src/dird/ua_configure.cc @@ -292,7 +292,7 @@ static inline bool ConfigureAddResource(UaContext *ua, int first_parameter, Reso return false; } - if (GetResWithName(res_table->rcode, name.c_str())) { + if (my_config->GetResWithName(res_table->rcode, name.c_str())) { ua->ErrorMsg("Resource \"%s\" with name \"%s\" already exists.\n", res_table->name, name.c_str()); return false; } @@ -324,7 +324,7 @@ static inline bool ConfigureAddResource(UaContext *ua, int first_parameter, Reso * therefore we explicitly check the new resource here. */ if ((res_table->rcode == R_JOB) || (res_table->rcode == R_JOBDEFS)) { - res = (JobResource *)GetResWithName(res_table->rcode, name.c_str()); + res = (JobResource *)my_config->GetResWithName(res_table->rcode, name.c_str()); PropagateJobdefs(res_table->rcode, res); if (!ValidateResource(res_table->rcode, res_table->items, (BareosResource *)res)) { ua->ErrorMsg("failed to create config resource \"%s\"\n", name.c_str()); diff --git a/core/src/dird/ua_output.cc b/core/src/dird/ua_output.cc index 4f198d1c22b..6efbd773d56 100644 --- a/core/src/dird/ua_output.cc +++ b/core/src/dird/ua_output.cc @@ -1608,7 +1608,7 @@ of_filter_state filterit(void *ctx, void *data, of_filter_tuple *tuple) strlen(row[tuple->u.res_filter.column]) == 0) { retval = OF_FILTER_STATE_UNKNOWN; } else { - if (!GetResWithName(tuple->u.res_filter.restype, + if (!my_config->GetResWithName(tuple->u.res_filter.restype, row[tuple->u.res_filter.column], false)) { Dmsg2(200, "filterit: Filter on resource_type %d value %s, suppress output\n", tuple->u.res_filter.restype, row[tuple->u.res_filter.column]); diff --git a/core/src/dird/ua_prune.cc b/core/src/dird/ua_prune.cc index 6ca284cd857..1179781ff2f 100644 --- a/core/src/dird/ua_prune.cc +++ b/core/src/dird/ua_prune.cc @@ -634,21 +634,21 @@ static int JobSelectHandler(void *ctx, int num_fields, char **row) /* * If this job doesn't exist anymore in the configuration, delete it. */ - if (GetResWithName(R_JOB, row[0], false) == NULL) { + if (my_config->GetResWithName(R_JOB, row[0], false) == NULL) { return 0; } /* * If this fileset doesn't exist anymore in the configuration, delete it. */ - if (GetResWithName(R_FILESET, row[1], false) == NULL) { + if (my_config->GetResWithName(R_FILESET, row[1], false) == NULL) { return 0; } /* * If this client doesn't exist anymore in the configuration, delete it. */ - if (GetResWithName(R_CLIENT, row[2], false) == NULL) { + if (my_config->GetResWithName(R_CLIENT, row[2], false) == NULL) { return 0; } diff --git a/core/src/filed/authenticate.cc b/core/src/filed/authenticate.cc index c2025175446..124b6cb9b29 100644 --- a/core/src/filed/authenticate.cc +++ b/core/src/filed/authenticate.cc @@ -116,7 +116,7 @@ bool AuthenticateDirector(JobControlRecord *jcr) } UnbashSpaces(dirname.c_str()); - director = (DirectorResource *)GetResWithName(R_DIRECTOR, dirname.c_str()); + director = (DirectorResource *)my_config->GetResWithName(R_DIRECTOR, dirname.c_str()); if (!director) { char addr[64]; diff --git a/core/src/filed/filed_conf.cc b/core/src/filed/filed_conf.cc index 6f0b45a198b..d5b4abfda7e 100644 --- a/core/src/filed/filed_conf.cc +++ b/core/src/filed/filed_conf.cc @@ -623,7 +623,7 @@ bool SaveResource(int type, ResourceItem *items, int pass) /* * Resources containing another resource */ - if ((res = (UnionOfResources *)GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { Emsg1(M_ABORT, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.name()); } else { res->res_dir.tls_cert.allowed_certificate_common_names_ = res_all.res_dir.tls_cert.allowed_certificate_common_names_; @@ -632,7 +632,7 @@ bool SaveResource(int type, ResourceItem *items, int pass) } break; case R_CLIENT: - if ((res = (UnionOfResources *)GetResWithName(R_CLIENT, res_all.res_dir.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_CLIENT, res_all.res_dir.name())) == NULL) { Emsg1(M_ABORT, 0, _("Cannot find Client resource %s\n"), res_all.res_dir.name()); } else { res->res_client.plugin_names = res_all.res_client.plugin_names; diff --git a/core/src/lib/parse_conf.h b/core/src/lib/parse_conf.h index 229fccd0fb1..e4807481375 100644 --- a/core/src/lib/parse_conf.h +++ b/core/src/lib/parse_conf.h @@ -458,6 +458,7 @@ class DLL_IMP_EXP ConfigurationParser { const char *resourcetype, const char *name, bool error_if_exits = false, bool create_directories = false); CommonResourceHeader *GetNextRes(int rcode, CommonResourceHeader *res); + CommonResourceHeader *GetResWithName(int rcode, const char *name, bool lock = true); private: ConfigurationParser(const ConfigurationParser&) = delete; @@ -492,7 +493,6 @@ DLL_IMP_EXP const char *datatype_to_description(int type); /* * Resource routines */ -DLL_IMP_EXP CommonResourceHeader *GetResWithName(int rcode, const char *name, bool lock = true); DLL_IMP_EXP void b_LockRes(const char *file, int line); DLL_IMP_EXP void b_UnlockRes(const char *file, int line); DLL_IMP_EXP void DumpResource(int type, CommonResourceHeader *res, void sendmsg(void *sock, const char *fmt, ...), diff --git a/core/src/lib/res.cc b/core/src/lib/res.cc index 34a9e4558ad..e80afb3dcfc 100644 --- a/core/src/lib/res.cc +++ b/core/src/lib/res.cc @@ -95,7 +95,7 @@ void b_UnlockRes(const char *file, int line) /* * Return resource of type rcode that matches name */ -CommonResourceHeader *GetResWithName(int rcode, const char *name, bool lock) +CommonResourceHeader *ConfigurationParser::GetResWithName(int rcode, const char *name, bool lock) { CommonResourceHeader *res; int rindex = rcode - my_config->r_first_; @@ -575,7 +575,7 @@ static void StoreRes(LEX *lc, ResourceItem *item, int index, int pass) LexGetToken(lc, BCT_NAME); if (pass == 2) { - res = GetResWithName(item->code, lc->str); + res = my_config->GetResWithName(item->code, lc->str); if (res == NULL) { scan_err3(lc, _("Could not find config resource \"%s\" referenced on line %d: %s"), lc->str, lc->line_no, lc->line); @@ -629,7 +629,7 @@ static void StoreAlistRes(LEX *lc, ResourceItem *item, int index, int pass) for (;;) { LexGetToken(lc, BCT_NAME); /* scan next item */ - res = GetResWithName(item->code, lc->str); + res = my_config->GetResWithName(item->code, lc->str); if (res == NULL) { scan_err3(lc, _("Could not find config Resource \"%s\" referenced on line %d : %s\n"), item->name, lc->line_no, lc->line); @@ -790,7 +790,7 @@ static void StoreDefs(LEX *lc, ResourceItem *item, int index, int pass) LexGetToken(lc, BCT_NAME); if (pass == 2) { Dmsg2(900, "Code=%d name=%s\n", item->code, lc->str); - res = GetResWithName(item->code, lc->str); + res = my_config->GetResWithName(item->code, lc->str); if (res == NULL) { scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"), lc->str, lc->line_no, lc->line); diff --git a/core/src/lib/unittests/bsock_test.cc b/core/src/lib/unittests/bsock_test.cc index c2e40e1f053..d09a09c8c46 100644 --- a/core/src/lib/unittests/bsock_test.cc +++ b/core/src/lib/unittests/bsock_test.cc @@ -491,7 +491,7 @@ TEST(bsock, auth_works_with_tls_cert) EXPECT_TRUE(future.get()); } -CommonResourceHeader *GetResWithName(int rcode, const char *name, bool lock) +CommonResourceHeader *ConfigurationParser::GetResWithName(int rcode, const char *name, bool lock) { std::string clientname(name); std::string configured_name(dir_cons_config->hdr.name); diff --git a/core/src/stored/authenticate.cc b/core/src/stored/authenticate.cc index d09221eace7..340125ea82f 100644 --- a/core/src/stored/authenticate.cc +++ b/core/src/stored/authenticate.cc @@ -85,7 +85,7 @@ bool AuthenticateDirector(JobControlRecord *jcr) } UnbashSpaces(dirname); - director = (DirectorResource *)GetResWithName(R_DIRECTOR, dirname); + director = (DirectorResource *)my_config->GetResWithName(R_DIRECTOR, dirname); jcr->director = director; if (!director) { diff --git a/core/src/stored/stored_conf.cc b/core/src/stored/stored_conf.cc index 1238eb0227d..a589b58e8b2 100644 --- a/core/src/stored/stored_conf.cc +++ b/core/src/stored/stored_conf.cc @@ -699,14 +699,14 @@ bool SaveResource(int type, ResourceItem *items, int pass) /* * Resources containing a resource or an alist */ - if ((res = (UnionOfResources *)GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) { Emsg1(M_ERROR_TERM, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.name()); } else { res->res_dir.tls_cert.allowed_certificate_common_names_ = res_all.res_dir.tls_cert.allowed_certificate_common_names_; } break; case R_STORAGE: - if ((res = (UnionOfResources *)GetResWithName(R_STORAGE, res_all.res_store.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(R_STORAGE, res_all.res_store.name())) == NULL) { Emsg1(M_ERROR_TERM, 0, _("Cannot find Storage resource %s\n"), res_all.res_store.name()); } else { res->res_store.plugin_names = res_all.res_store.plugin_names; @@ -716,7 +716,7 @@ bool SaveResource(int type, ResourceItem *items, int pass) } break; case R_AUTOCHANGER: - if ((res = (UnionOfResources *)GetResWithName(type, res_all.res_changer.name())) == NULL) { + if ((res = (UnionOfResources *)my_config->GetResWithName(type, res_all.res_changer.name())) == NULL) { Emsg1(M_ERROR_TERM, 0, _("Cannot find AutoChanger resource %s\n"), res_all.res_changer.name()); } else { /*