dkstar88
Joined: 23 Apr 2010 Posts: 1
|
Posted: Fri Apr 23, 2010 3:35 am Post subject: My implementation of dynamic source authentication |
|
|
Hi all:
I am working on a project that uses icecast as the stream server. The problem is although icecast now has the stream_auth by url feature, but it will only work when a mount point is specified in the config. It works only when I have a limited mountpoints, but I intend to allow any registered user supply a source, and modifying the config every time a new user is registered just creates more work for the server.
So I made a small modification to the source to allow a default mount point. When I put a "/default" mount-name in the config, any unspecified mount-name will automatically go to the default mount point for authentication.
Here is my modification:
In cfgfile.c +1126
Code: |
/* return the mount details that match the supplied mountpoint */
mount_proxy *config_find_mount (ice_config_t *config, const char *mount)
{
mount_proxy *mountinfo = config->mounts;
mount_proxy *defaultmount = NULL;
while (mountinfo)
{
if (strcmp (mountinfo->mountname, "/default") == 0)
defaultmount = mountinfo;
if (strcmp (mountinfo->mountname, mount) == 0)
break;
mountinfo = mountinfo->next;
}
// change to default
if (mountinfo) {
return mountinfo;
} else {
return defaultmount;
}
} |
This code might not be most efficient. Since I am looking for the default mount point everytime config_find_mount() is called. But really it only need be called once when the config is loaded. Maybe someone could improve the code. |
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Apr 23, 2010 3:28 pm Post subject: |
|
|
That is the correct location for such a match, it is only used when applying mount settings, so not just at xml read time. I suspect default without a / would be better as /default could be a valid streaming mountpoint.
karl. |
|