{
fprintf(stderr, "Usage: %s [<options>]\n"
"Options: \n"
+ " -A <path>: Set the path to ACL files\n"
" -s <socket>: Set the unix domain socket to listen on\n"
"\n", progname);
return 1;
openlog("ubusd", LOG_PID, LOG_DAEMON);
uloop_init();
- while ((ch = getopt(argc, argv, "s:")) != -1) {
+ while ((ch = getopt(argc, argv, "A:s:")) != -1) {
switch (ch) {
case 's':
ubus_socket = optarg;
break;
+ case 'A':
+ ubusd_acl_dir = optarg;
+ break;
default:
return usage(argv[0]);
}
const char name[];
};
+extern const char *ubusd_acl_dir;
+
struct ubus_msg_buf *ubus_msg_new(void *data, int len, bool shared);
void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub, bool free);
void ubus_msg_free(struct ubus_msg_buf *ub);
int ok;
};
+const char *ubusd_acl_dir = "/usr/share/acl.d";
static struct blob_buf bbuf;
static struct avl_tree ubusd_acls;
static int ubusd_acl_seq;
struct stat st;
glob_t gl;
int j;
+ const char *suffix = "/*.json";
+ char *path = alloca(strlen(ubusd_acl_dir) + strlen(suffix) + 1);
- if (glob("/usr/share/acl.d/*.json", GLOB_NOESCAPE | GLOB_MARK, NULL, &gl))
+ sprintf(path, "%s%s", ubusd_acl_dir, suffix);
+ if (glob(path, GLOB_NOESCAPE | GLOB_MARK, NULL, &gl))
return;
vlist_update(&ubusd_acl_files);