]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_verto] more perms checks
authorAnthony Minessale <anthm@signalwire.com>
Sun, 14 Mar 2021 19:21:01 +0000 (19:21 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:01:05 +0000 (22:01 +0300)
src/mod/endpoints/mod_verto/mod_verto.c

index 2faf77455eac40e30ddc2f42ae8de1b678d7e393..610ec131c9a4cacdd2f3430f18e2c05f9dfd6fa8 100644 (file)
@@ -663,6 +663,7 @@ static switch_status_t jsock_queue_event(jsock_t *jsock, cJSON **json, switch_bo
        return status;
 }
 
+static switch_bool_t event_channel_check_auth(jsock_t *jsock, const char *event_channel);
 static void write_event(const char *event_channel, const char *super_channel, jsock_t *use_jsock, cJSON *event)
 {
        jsock_sub_node_head_t *head;
@@ -680,13 +681,21 @@ static void write_event(const char *event_channel, const char *super_channel, js
                                if ((visibility = cJSON_GetObjectCstr(event, "contentVisibility"))) {
                                        if (strcasecmp(visibility, "public") && (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5))) {
                                                int perm = 0;
+                                               
+                                               perm = event_channel_check_auth(np->jsock, event_channel);
+                                               
+                                               if (!perm && super_channel) {
+                                                       perm = event_channel_check_auth(np->jsock, super_channel);
+                                               }
 
-                                               perm = switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel);
+                                               if (!perm) {                                            
+                                                       perm = switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel);
+                                               }
 
                                                if (!perm && super_channel) {
                                                        perm = switch_event_channel_permission_verify(np->jsock->uuid_str, super_channel);
                                                }
-                                               
+
                                                if (!perm) {
                                                        continue;
                                                }