From b7a114a19156f71f93545495d0897b51de2ac83d Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Mon, 21 Jan 2002 03:10:37 +0000 Subject: [PATCH] Fix a stupid but that Oddsock and Ciaran both found. When sources log in we weren't checking to see if the mountpoint was already taken. Since the mountpoint was the key in the avl tree, bad things happened. svn path=/trunk/icecast/; revision=2966 --- src/connection.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/connection.c b/src/connection.c index 8cb19672..d1620063 100644 --- a/src/connection.c +++ b/src/connection.c @@ -345,10 +345,28 @@ static void *_handle_connection(void *arg) continue; } + /* check to make sure this source has + ** a unique mountpoint + */ + + avl_tree_rlock(global.source_tree); + if (source_find_mount(httpp_getvar(parser, HTTPP_VAR_URI)) != NULL) { + printf("Source attempted to connect with an already used mountpoint.\n"); + INFO1("Source tried to log in as %s, but is already used", httpp_getvar(parser, HTTPP_VAR_URI)); + connection_close(con); + httpp_destroy(parser); + avl_tree_unlock(global.source_tree); + continue; + } + avl_tree_unlock(global.source_tree); + + /* check to make sure this source wouldn't + ** be over the limit + */ global_lock(); if (global.sources >= config_get_config()->source_limit) { printf("TOO MANY SOURCE, KICKING THIS ONE\n"); - INFO1("Source (%d) logged in, but there are too many sources", httpp_getvar(parser, HTTPP_VAR_URI)); + INFO1("Source (%s) logged in, but there are too many sources", httpp_getvar(parser, HTTPP_VAR_URI)); connection_close(con); httpp_destroy(parser); global_unlock();