52
52
53
53
#define HTTP_URI_PREFIX "/rpc"
54
54
55
- static char * s_acl_file = NULL ;
56
55
static struct mg_rpc * s_global_mg_rpc ;
57
56
58
57
extern const char * mg_build_id ;
@@ -403,7 +402,8 @@ static bool mgos_rpc_req_prehandler(struct mg_rpc_request_info *ri,
403
402
const char * auth_domain = NULL ;
404
403
const char * auth_file = NULL ;
405
404
406
- if (s_acl_file != NULL ) {
405
+ const char * acl_file = mgos_sys_config_get_rpc_acl_file ();
406
+ if (acl_file != NULL ) {
407
407
/* acl_file is set: then, by default, deny everything */
408
408
acl_entry = mg_mk_str ("-*" );
409
409
@@ -412,7 +412,7 @@ static bool mgos_rpc_req_prehandler(struct mg_rpc_request_info *ri,
412
412
};
413
413
414
414
size_t size ;
415
- acl_data = cs_read_file (s_acl_file , & size );
415
+ acl_data = cs_read_file (acl_file , & size );
416
416
int walk_res = json_walk (acl_data , size , acl_parse_cb , & ctx );
417
417
418
418
if (walk_res < 0 ) {
@@ -560,11 +560,6 @@ bool mgos_rpc_common_init(void) {
560
560
mg_rpc_add_list_handler (c );
561
561
s_global_mg_rpc = c ;
562
562
563
- /* We make a copy so that ACL file changes only apply on reboot. */
564
- if (mgos_sys_config_get_rpc_acl_file () != NULL ) {
565
- s_acl_file = strdup (mgos_sys_config_get_rpc_acl_file ());
566
- }
567
-
568
563
#if MGOS_ENABLE_SYS_SERVICE
569
564
if (mgos_sys_config_get_rpc_service_sys_enable ()) {
570
565
mg_rpc_add_handler (c , "Sys.Reboot" , "{delay_ms: %d}" ,
0 commit comments