From 5c34efdc42f5c7ada8bfb92becb53a2e9d43750a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 27 Apr 2004 12:00:02 +0000 Subject: [PATCH] Add restricted consoles to wx-console git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1316 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/wx-console/console_conf.c | 12 ++++++------ bacula/src/wx-console/console_thread.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bacula/src/wx-console/console_conf.c b/bacula/src/wx-console/console_conf.c index d2afe3f1ae..50c01d1d7c 100644 --- a/bacula/src/wx-console/console_conf.c +++ b/bacula/src/wx-console/console_conf.c @@ -101,7 +101,7 @@ static RES_ITEM dir_items[] = { RES_TABLE resources[] = { {"console", cons_items, R_CONSOLE, NULL}, {"director", dir_items, R_DIRECTOR, NULL}, - {NULL, NULL, 0, NULL} + {NULL, NULL, 0, NULL} }; @@ -115,7 +115,7 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ... 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; } @@ -201,7 +201,7 @@ void save_resource(int type, RES_ITEM *items, int pass) 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]); - } + } } } @@ -260,14 +260,14 @@ void save_resource(int type, RES_ITEM *items, int pass) RES *next; for (next=resources[rindex].res_head; next->next; next=next->next) { if (strcmp(next->name, res->res_dir.hdr.name) == 0) { - Emsg2(M_ERROR_TERM, 0, + Emsg2(M_ERROR_TERM, 0, _("Attempt to define second %s resource named \"%s\" is not permitted.\n"), - resources[rindex].name, res->res_dir.hdr.name); + resources[rindex].name, res->res_dir.hdr.name); } } 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); } } } diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index 3b84c8bd07..6db894be02 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -109,7 +109,11 @@ void* console_thread::Entry() { csprint("Connected\n"); jcr.dir_bsock = UA_sock; - if (!authenticate_director(&jcr, dir, NULL)) { + LockRes(); + /* If cons==NULL, default console will be used */ + CONRES *cons = (CONRES *)GetNextRes(R_CONSOLE, (RES *)NULL); + UnlockRes(); + if (!authenticate_director(&jcr, dir, cons)) { csprint("ERR="); csprint(UA_sock->msg); csprint(NULL, CS_END); @@ -191,4 +195,3 @@ void console_thread::Delete() { UA_sock = NULL; } } - -- 2.39.5