From 70581a78c803dd20e43ce33899dc4ce1595f9dab Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 18 Aug 2012 15:46:03 +0200 Subject: [PATCH] Make dump_resource respect console ACL's --- bacula/src/dird/dird_conf.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 7dcf591748..2f2eb000d2 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -554,6 +554,7 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm bool recurse = true; char ed1[100], ed2[100], ed3[100]; DEVICE *dev; + UAContext *ua = (UAContext *)sock; if (res == NULL) { sendit(sock, _("No %s resource defined\n"), res_to_str(type)); @@ -599,6 +600,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm break; case R_CLIENT: + if (!acl_access_ok(ua, Client_ACL, res->res_client.hdr.name)) { + break; + } sendit(sock, _("Client: name=%s address=%s FDport=%d MaxJobs=%u\n"), res->res_client.hdr.name, res->res_client.address, res->res_client.FDport, res->res_client.MaxConcurrentJobs); @@ -626,6 +630,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm break; case R_STORAGE: + if (!acl_access_ok(ua, Storage_ACL, res->res_store.hdr.name)) { + break; + } sendit(sock, _("Storage: name=%s address=%s SDport=%d MaxJobs=%u\n" " DeviceName=%s MediaType=%s StorageId=%s\n"), res->res_store.hdr.name, res->res_store.address, res->res_store.SDport, @@ -636,6 +643,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm break; case R_CATALOG: + if (!acl_access_ok(ua, Catalog_ACL, res->res_cat.hdr.name)) { + break; + } sendit(sock, _("Catalog: name=%s address=%s DBport=%d db_name=%s\n" " db_driver=%s db_user=%s MutliDBConn=%d\n"), res->res_cat.hdr.name, NPRT(res->res_cat.db_address), @@ -646,6 +656,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm case R_JOB: case R_JOBDEFS: + if (!acl_access_ok(ua, Job_ACL, res->res_job.hdr.name)) { + break; + } sendit(sock, _("%s: name=%s JobType=%d level=%s Priority=%d Enabled=%d\n"), type == R_JOB ? _("Job") : _("JobDefs"), res->res_job.hdr.name, res->res_job.JobType, @@ -767,6 +780,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm case R_FILESET: { int i, j, k; + if (!acl_access_ok(ua, FileSet_ACL, res->res_fs.hdr.name)) { + break; + } sendit(sock, _("FileSet: name=%s\n"), res->res_fs.hdr.name); for (i=0; ires_fs.num_includes; i++) { INCEXE *incexe = res->res_fs.include_items[i]; @@ -854,6 +870,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm } case R_SCHEDULE: + if (!acl_access_ok(ua, Schedule_ACL, res->res_sch.hdr.name)) { + break; + } if (res->res_sch.run) { int i; RUN *run = res->res_sch.run; @@ -942,6 +961,9 @@ next_run: break; case R_POOL: + if (!acl_access_ok(ua, Pool_ACL, res->res_pool.hdr.name)) { + break; + } sendit(sock, _("Pool: name=%s PoolType=%s\n"), res->res_pool.hdr.name, res->res_pool.pool_type); sendit(sock, _(" use_cat=%d use_once=%d cat_files=%d\n"), -- 2.39.5