[xiph-cvs] cvs commit: icecast/src admin.c config.c config.h connection.c
Michael Smith
msmith at xiph.org
Mon Mar 10 14:20:16 PST 2003
msmith 03/03/10 17:20:16
Modified: src admin.c config.c config.h connection.c
Log:
Fix relay stream listing. Remove seperate relay password, there's no
need for it.
Revision Changes Path
1.4 +37 -13 icecast/src/admin.c
Index: admin.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/admin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- admin.c 9 Mar 2003 14:12:24 -0000 1.3
+++ admin.c 10 Mar 2003 22:20:16 -0000 1.4
@@ -29,6 +29,7 @@
/* Global commands */
#define COMMAND_LIST_MOUNTS 101
#define COMMAND_RAW_STATS 102
+#define COMMAND_RAW_LISTSTREAM 103
int admin_get_command(char *command)
{
@@ -44,6 +45,8 @@
return COMMAND_RAW_STATS;
else if(!strcmp(command, "listmounts"))
return COMMAND_LIST_MOUNTS;
+ else if(!strcmp(command, "streamlist"))
+ return COMMAND_RAW_LISTSTREAM;
else
return COMMAND_ERROR;
}
@@ -53,7 +56,7 @@
static void command_show_listeners(client_t *client, source_t *source);
static void command_raw_stats(client_t *client);
-static void command_list_mounts(client_t *client);
+static void command_list_mounts(client_t *client, int formatted);
static void admin_handle_mount_request(client_t *client, source_t *source,
int command);
@@ -132,7 +135,10 @@
command_raw_stats(client);
break;
case COMMAND_LIST_MOUNTS:
- command_list_mounts(client);
+ command_list_mounts(client, 1);
+ break;
+ case COMMAND_RAW_LISTSTREAM:
+ command_list_mounts(client, 0);
break;
default:
WARN0("General admin request not recognised");
@@ -300,17 +306,28 @@
return;
}
-static void command_list_mounts(client_t *client) {
+static void command_list_mounts(client_t *client, int formatted) {
avl_node *node;
source_t *source;
+ int bytes;
DEBUG0("List mounts request");
- html_head(client);
+ if(formatted) {
+ html_head(client);
- html_write(client,
- "<table><tr><td>Mountpoint</td><td>Fallback</td>"
- "<td>Format</td><td>Listeners</td></tr>");
+ html_write(client,
+ "<table><tr><td>Mountpoint</td><td>Fallback</td>"
+ "<td>Format</td><td>Listeners</td></tr>");
+ }
+ else {
+ client->respcode = 200;
+ bytes = sock_write(client->con->sock,
+ "HTTP/1.0 200 OK\r\n"
+ "Content-Type: text/html\r\n"
+ "\r\n");
+ if(bytes > 0) client->con->sent_bytes = bytes;
+ }
avl_tree_rlock(global.source_tree);
@@ -318,18 +335,25 @@
while(node) {
source = (source_t *)node->key;
- html_write(client,
- "<tr><td>%s</td><td>%s</td><td>%s</td><td>%ld</td></tr>",
- source->mount, (source->fallback_mount != NULL)?
- source->fallback_mount:"", source->format->format_description,
- source->listeners);
+ if(formatted) {
+ html_write(client,
+ "<tr><td>%s</td><td>%s</td><td>%s</td><td>%ld</td></tr>",
+ source->mount, (source->fallback_mount != NULL)?
+ source->fallback_mount:"",
+ source->format->format_description, source->listeners);
+ }
+ else {
+ bytes = sock_write(client->con->sock, "%s\r\n", source->mount);
+ if(bytes > 0) client->con->sent_bytes += bytes;
+ }
node = avl_get_next(node);
}
avl_tree_unlock(global.source_tree);
- html_write(client, "</table></body></html>");
+ if(formatted)
+ html_write(client, "</table></body></html>");
client_destroy(client);
return;
<p><p>1.31 +0 -14 icecast/src/config.c
Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- config.c 9 Mar 2003 11:27:06 -0000 1.30
+++ config.c 10 Mar 2003 22:20:16 -0000 1.31
@@ -109,8 +109,6 @@
xmlFree(c->admin);
if (c->source_password && c->source_password != CONFIG_DEFAULT_SOURCE_PASSWORD)
xmlFree(c->source_password);
- if (c->relay_password && c->relay_password != CONFIG_DEFAULT_SOURCE_PASSWORD)
- xmlFree(c->relay_password);
if (c->admin_username)
xmlFree(c->admin_username);
if (c->admin_password)
@@ -260,7 +258,6 @@
configuration->header_timeout = CONFIG_DEFAULT_HEADER_TIMEOUT;
configuration->source_timeout = CONFIG_DEFAULT_SOURCE_TIMEOUT;
configuration->source_password = CONFIG_DEFAULT_SOURCE_PASSWORD;
- configuration->relay_password = CONFIG_DEFAULT_RELAY_PASSWORD;
configuration->ice_login = CONFIG_DEFAULT_ICE_LOGIN;
configuration->fileserve = CONFIG_DEFAULT_FILESERVE;
configuration->touch_interval = CONFIG_DEFAULT_TOUCH_FREQ;
@@ -314,10 +311,6 @@
if (configuration->source_password && configuration->source_password != CONFIG_DEFAULT_SOURCE_PASSWORD) xmlFree(configuration->source_password);
configuration->source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
}
- } else if (strcmp(node->name, "relay-password") == 0) {
- /* TODO: This is the backwards-compatibility location */
- if (configuration->relay_password && configuration->relay_password != CONFIG_DEFAULT_RELAY_PASSWORD) xmlFree(configuration->relay_password);
- configuration->relay_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "icelogin") == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
configuration->ice_login = atoi(tmp);
@@ -563,13 +556,6 @@
configuration->source_password =
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
}
- } else if (strcmp(node->name, "relay-password") == 0) {
- if (configuration->relay_password &&
- configuration->relay_password !=
- CONFIG_DEFAULT_RELAY_PASSWORD)
- xmlFree(configuration->relay_password);
- configuration->relay_password =
- (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
} else if (strcmp(node->name, "admin-password") == 0) {
if(configuration->admin_password)
xmlFree(configuration->admin_password);
<p><p>1.19 +0 -1 icecast/src/config.h
Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- config.h 9 Mar 2003 11:27:06 -0000 1.18
+++ config.h 10 Mar 2003 22:20:16 -0000 1.19
@@ -66,7 +66,6 @@
int fileserve;
char *source_password;
- char *relay_password;
char *admin_username;
char *admin_password;
<p><p>1.64 +0 -40 icecast/src/connection.c
Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- connection.c 9 Mar 2003 11:27:06 -0000 1.63
+++ connection.c 10 Mar 2003 22:20:16 -0000 1.64
@@ -519,17 +519,6 @@
return 1;
}
-int connection_check_relay_pass(http_parser_t *parser)
-{
- ice_config_t *config = config_get_config();
- char *pass = config->relay_password;
- if(!pass)
- pass = config->source_password;
- config_release_config();
-
- return _check_pass_http(parser, "relay", pass);
-}
-
int connection_check_admin_pass(http_parser_t *parser)
{
ice_config_t *config = config_get_config();
@@ -769,35 +758,6 @@
return;
}
- if (strcmp(uri, "/admin/streamlist") == 0) {
- if (!connection_check_relay_pass(parser)) {
- INFO0("Client attempted to fetch /admin/streamlist with bad password");
- client_send_401(client);
- } else {
- avl_node *node;
- source_t *s;
-
- client->respcode = 200;
- bytes = sock_write(client->con->sock,
- "HTTP/1.0 200 OK\r\n\r\n");
- if(bytes > 0) client->con->sent_bytes = bytes;
-
- avl_tree_rlock(global.source_tree);
- node = avl_get_first(global.source_tree);
- while (node) {
- s = (source_t *)node->key;
- bytes = sock_write(client->con->sock, "%s\r\n", s->mount);
- if(bytes > 0) client->con->sent_bytes += bytes;
- else break;
-
- node = avl_get_next(node);
- }
- avl_tree_unlock(global.source_tree);
- client_destroy(client);
- }
- return;
- }
-
global_lock();
if (global.clients >= client_limit) {
client_send_504(client,
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list