3 * Bacula Director -- User Agent Access Control List (ACL) handling
5 * Kern Sibbald, January MMIV
11 Copyright (C) 2004 Kern Sibbald and John Walker
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of
16 the License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write to the Free
25 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
34 * Check if access is permitted to item in acl
36 bool acl_access_ok(UAContext *ua, int acl, char *item)
38 return acl_access_ok(ua, acl, item, strlen(item));
42 bool acl_access_ok(UAContext *ua, int acl, char *item, int len)
45 Dmsg0(400, "Root cons access OK.\n");
46 return true; /* No cons resource -> root console OK for everything */
48 alist *list = ua->cons->ACL_lists[acl];
50 return false; /* List empty, reject */
52 for (int i=0; i<list->size(); i++) {
53 if (strncasecmp(item, (char *)list->get(i), len) == 0) {
54 Dmsg3(400, "Found %s in %d %s\n", item, acl, (char *)list->get(i));