[xiph-cvs] cvs commit: icecast/src config.c config.h connection.c format.c global.h source.h
Michael Smith
msmith at xiph.org
Tue Feb 11 06:23:34 PST 2003
msmith 03/02/11 09:23:34
Modified: . TODO
conf icecast.xml
src config.c config.h connection.c format.c global.h
source.h
Log:
Per mountpoint usernames, passwords, and some infrastructure for other
per-mountpoint configuration (some of these are given as examples in
the config file, but they aren't yet used).
Revision Changes Path
1.9 +2 -5 icecast/TODO
Index: TODO
===================================================================
RCS file: /usr/local/cvsroot/icecast/TODO,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TODO 6 Feb 2003 13:10:47 -0000 1.8
+++ TODO 11 Feb 2003 14:23:33 -0000 1.9
@@ -2,14 +2,12 @@
----
- stats get off? this needs testing more testing.
-- autoconf doesn't set HAVE_POLL
+- autoconf doesn't set HAVE_POLL (still true?)
- some stuff (like 'genre') isn't making it into the stats dump
- make install - doesn't install configs?
-- pthread/bsd: -pthread instead of -lpthread (autoconf)
-
FEATURES
--------
@@ -48,8 +46,7 @@
- httpp - split out query string for further processing
-- finish mp3 metadata: http://server:ip/admin.cgi?pass=%s&mode=updinfo&mount=%s&song=%s
-
+- binding to multiple ports (possibly including full ipv6 support)
<p><p>1.16 +11 -0 icecast/conf/icecast.xml
Index: icecast.xml
===================================================================
RCS file: /usr/local/cvsroot/icecast/conf/icecast.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- icecast.xml 7 Feb 2003 10:53:38 -0000 1.15
+++ icecast.xml 11 Feb 2003 14:23:34 -0000 1.16
@@ -45,6 +45,17 @@
</relay>
-->
+ <mount>
+ <mount-name>/example1.ogg</mount-name>
+ <username>othersource</username>
+ <password>hackmemore</password>
+
+ <!-- These next three aren't yet implemented -->
+ <max-listeners>1</max-listeners>
+ <dump-file>/tmp/dump-example1.ogg</dump-file>
+ <fallback-mount>/example2.ogg</fallback-mount>
+ </mount>
+
<fileserve>1</fileserve>
<paths>
<p><p>1.25 +64 -0 icecast/src/config.c
Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- config.c 7 Feb 2003 12:26:07 -0000 1.24
+++ config.c 11 Feb 2003 14:23:34 -0000 1.25
@@ -56,6 +56,7 @@
static void _parse_security(xmlDocPtr doc, xmlNodePtr node);
static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node);
static void _parse_relay(xmlDocPtr doc, xmlNodePtr node);
+static void _parse_mount(xmlDocPtr doc, xmlNodePtr node);
static void _add_server(xmlDocPtr doc, xmlNodePtr node);
void config_initialize(void)
@@ -70,6 +71,7 @@
ice_config_dir_t *dirnode, *nextdirnode;
ice_config_t *c = &_configuration;
relay_server *relay, *nextrelay;
+ mount_proxy *mount, *nextmount;
if (_config_filename) free(_config_filename);
@@ -110,6 +112,17 @@
free(relay);
relay = nextrelay;
}
+ mount = _configuration.mounts;
+ while(mount) {
+ nextmount = mount->next;
+ xmlFree(mount->mountname);
+ xmlFree(mount->username);
+ xmlFree(mount->password);
+ xmlFree(mount->dumpfile);
+ xmlFree(mount->fallback_mount);
+ free(mount);
+ mount = nextmount;
+ }
dirnode = _configuration.dir_list;
while(dirnode) {
nextdirnode = dirnode->next;
@@ -273,6 +286,8 @@
_parse_limits(doc, node->xmlChildrenNode);
} else if (strcmp(node->name, "relay") == 0) {
_parse_relay(doc, node->xmlChildrenNode);
+ } else if (strcmp(node->name, "mount") == 0) {
+ _parse_mount(doc, node->xmlChildrenNode);
} else if (strcmp(node->name, "directory") == 0) {
_parse_directory(doc, node->xmlChildrenNode);
} else if (strcmp(node->name, "paths") == 0) {
@@ -318,6 +333,55 @@
_configuration.source_timeout = atoi(tmp);
if (tmp) xmlFree(tmp);
}
+ } while ((node = node->next));
+}
+
+static void _parse_mount(xmlDocPtr doc, xmlNodePtr node)
+{
+ char *tmp;
+ mount_proxy *mount = calloc(1, sizeof(mount_proxy));
+ mount_proxy *current = _configuration.mounts;
+ mount_proxy *last=NULL;
+
+ while(current) {
+ last = current;
+ current = current->next;
+ }
+
+ if(last)
+ last->next = mount;
+ else
+ _configuration.mounts = mount;
+
+ do {
+ if (node == NULL) break;
+ if (xmlIsBlankNode(node)) continue;
+
+ if (strcmp(node->name, "mount-name") == 0) {
+ mount->mountname = (char *)xmlNodeListGetString(
+ doc, node->xmlChildrenNode, 1);
+ }
+ else if (strcmp(node->name, "username") == 0) {
+ mount->username = (char *)xmlNodeListGetString(
+ doc, node->xmlChildrenNode, 1);
+ }
+ else if (strcmp(node->name, "password") == 0) {
+ mount->password = (char *)xmlNodeListGetString(
+ doc, node->xmlChildrenNode, 1);
+ }
+ else if (strcmp(node->name, "dump-file") == 0) {
+ mount->dumpfile = (char *)xmlNodeListGetString(
+ doc, node->xmlChildrenNode, 1);
+ }
+ else if (strcmp(node->name, "fallback-mount") == 0) {
+ mount->fallback_mount = (char *)xmlNodeListGetString(
+ doc, node->xmlChildrenNode, 1);
+ }
+ else if (strcmp(node->name, "max-listeners") == 0) {
+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+ mount->max_listeners = atoi(tmp);
+ if(tmp) xmlFree(tmp);
+ }
} while ((node = node->next));
}
<p><p>1.14 +16 -0 icecast/src/config.h
Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- config.h 7 Feb 2003 10:53:38 -0000 1.13
+++ config.h 11 Feb 2003 14:23:34 -0000 1.14
@@ -22,6 +22,20 @@
struct _relay_server *next;
} relay_server;
+typedef struct _mount_proxy {
+ char *mountname; /* The mountpoint this proxy is used for */
+
+ char *username; /* Username and password for this mountpoint. If unset, */
+ char *password; /* falls back to global source password */
+
+ char *dumpfile; /* Filename to dump this stream to (will be appended). NULL
+ to not dump. */
+ int max_listeners; /* Max listeners for this mountpoint only. -1 to not
+ limit here (i.e. only use the global limit) */
+ char *fallback_mount;
+ struct _mount_proxy *next;
+} mount_proxy;
+
typedef struct ice_config_tag
{
char *location;
@@ -53,6 +67,8 @@
char *master_password;
relay_server *relay;
+
+ mount_proxy *mounts;
char *base_dir;
char *log_dir;
<p><p>1.47 +17 -4 icecast/src/connection.c
Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- connection.c 7 Feb 2003 13:56:33 -0000 1.46
+++ connection.c 11 Feb 2003 14:23:34 -0000 1.47
@@ -321,7 +321,7 @@
}
} else {
format_type_t format = FORMAT_TYPE_MP3;
- ERROR0("No content-type header, falling back to backwards compatiblity mode for icecast 1.x relays. Assuming content is mp3.");
+ ERROR0("No content-type header, falling back to backwards compatibility mode for icecast 1.x relays. Assuming content is mp3.");
source = source_create(client, con, parser, mount, format);
}
client->respcode = 200;
@@ -418,11 +418,24 @@
static int _check_source_pass(http_parser_t *parser, char *mount)
{
char *pass = config_get_config()->source_password;
+ char *user = "source";
int ret;
- if(!pass)
- pass = "";
- ret = _check_pass_http(parser, "source", pass);
+ mount_proxy *mountinfo = config_get_config()->mounts;
+ while(mountinfo) {
+ if(!strcmp(mountinfo->mountname, mount)) {
+ pass = mountinfo->password;
+ user = mountinfo->username;
+ break;
+ }
+ }
+
+ if(!pass) {
+ WARN0("No source password set, rejecting source");
+ return 0;
+ }
+
+ ret = _check_pass_http(parser, user, pass);
if(!ret && config_get_config()->ice_login)
{
ret = _check_pass_ice(parser, pass);
<p><p>1.15 +4 -0 icecast/src/format.c
Index: format.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- format.c 11 Feb 2003 12:18:22 -0000 1.14
+++ format.c 11 Feb 2003 14:23:34 -0000 1.15
@@ -13,6 +13,7 @@
#include "source.h"
#include "format.h"
+#include "global.h"
#include "format_vorbis.h"
#include "format_mp3.h"
@@ -111,6 +112,9 @@
"%s: %s\r\n", var->name, var->value);
if(bytes > 0) client->con->sent_bytes += bytes;
}
+ bytes = sock_write(client->con->sock,
+ "Server: %s\r\n", ICECAST_VERSION_STRING);
+ if(bytes > 0) client->con->sent_bytes += bytes;
node = avl_get_next(node);
}
avl_tree_unlock(source->parser->vars);
<p><p>1.5 +2 -0 icecast/src/global.h
Index: global.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/global.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- global.h 5 Aug 2002 14:48:01 -0000 1.4
+++ global.h 11 Feb 2003 14:23:34 -0000 1.5
@@ -6,6 +6,8 @@
#define ICE_RUNNING 1
#define ICE_HALTING 2
+#define ICECAST_VERSION_STRING "Icecast 2.0-alpha2/cvs"
+
#include "thread/thread.h"
typedef struct ice_global_tag
<p><p>1.7 +2 -1 icecast/src/source.h
Index: source.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- source.h 6 Feb 2003 13:10:48 -0000 1.6
+++ source.h 11 Feb 2003 14:23:34 -0000 1.7
@@ -28,7 +28,8 @@
rwlock_t *shutdown_rwlock;
ypdata_t *ypdata[MAX_YP_DIRECTORIES];
int num_yp_directories;
- long listeners;
+ long listeners;
+ long max_listeners;
} source_t;
source_t *source_create(client_t *client, connection_t *con, http_parser_t *parser, const char *mount, format_type_t type);
<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