Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List private rooms if valid admin_key was provided. #2161

Merged
merged 3 commits into from
May 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions plugins/janus_videoroom.c
Original file line number Diff line number Diff line change
Expand Up @@ -3546,13 +3546,28 @@ static json_t *janus_videoroom_process_synchronous_request(janus_videoroom_sessi
GHashTableIter iter;
gpointer value;
g_hash_table_iter_init(&iter, rooms);
gboolean lock_room_list = TRUE;
if(admin_key != NULL) {
json_t *admin_key_json = json_object_get(root, "admin_key");
/* Verify admin_key if it was provided */
if(admin_key_json != NULL && json_is_string(admin_key_json) && strlen(json_string_value(admin_key_json)) > 0) {
JANUS_CHECK_SECRET(admin_key, root, "admin_key", error_code, error_cause,
JANUS_VIDEOROOM_ERROR_MISSING_ELEMENT, JANUS_VIDEOROOM_ERROR_INVALID_ELEMENT, JANUS_VIDEOROOM_ERROR_UNAUTHORIZED);
if(error_code != 0) {
janus_mutex_unlock(&rooms_mutex);
goto prepare_response;
} else {
lock_room_list = FALSE;
}
}
}
while(g_hash_table_iter_next(&iter, NULL, &value)) {
janus_videoroom *room = value;
if(!room)
continue;
janus_refcount_increase(&room->ref);
if(room->is_private) {
/* Skip private room */
if(room->is_private && lock_room_list) {
/* Skip private room if no valid admin_key was provided */
JANUS_LOG(LOG_VERB, "Skipping private room '%s'\n", room->room_name);
janus_refcount_decrease(&room->ref);
continue;
Expand Down