1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

Merge branch 'master' into ph3

This commit is contained in:
Philipp Schafft 2014-12-26 23:11:15 +00:00
commit 5fc99fd9e9
7 changed files with 99 additions and 47 deletions

View File

@ -34,13 +34,6 @@
<small><xsl:value-of select="server_name" /></small> <small><xsl:value-of select="server_name" /></small>
</xsl:if> </xsl:if>
</h3> </h3>
<ul class="nav">
<li><a href="listclients.xsl?mount={@mount}">List Clients</a></li>
<li><a href="moveclients.xsl?mount={@mount}">Move Listeners</a></li>
<li><a href="updatemetadata.xsl?mount={@mount}">Update Metadata</a></li>
<li><a href="manageauth.xsl?mount={@mount}">Manage Authentication</a></li>
<li><a href="killsource.xsl?mount={@mount}">Kill Source</a></li>
</ul>
<xsl:if test="users"> <xsl:if test="users">
<table class="colortable"> <table class="colortable">
<thead> <thead>

View File

@ -38,6 +38,24 @@
</xsl:for-each> </xsl:for-each>
</tbody> </tbody>
</table> </table>
<xsl:if test="authentication">
<table>
<ul>
<xsl:for-each select="authentication/role">
<li>
Role
<xsl:if test="@name">
<xsl:value-of select="@name" />
</xsl:if>
of type <xsl:value-of select="@type" />:
<xsl:if test="@management-url">
<a href="{@management-url}">Manage Authentication</a>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</table>
</xsl:if>
</div> </div>
<!--end global server stats--> <!--end global server stats-->
@ -82,13 +100,44 @@
<table class="yellowkeys"> <table class="yellowkeys">
<tbody> <tbody>
<xsl:for-each select="*"> <xsl:for-each select="*">
<tr> <xsl:if test="name() != 'metadata' and name() != 'authentication'">
<td><xsl:value-of select="name()" /></td> <tr>
<td><xsl:value-of select="." /></td> <td><xsl:value-of select="name()" /></td>
</tr> <td><xsl:value-of select="." /></td>
</tr>
</xsl:if>
</xsl:for-each> </xsl:for-each>
<xsl:if test="metadata">
<tr>
<th colspan="2">Extra metadata</th>
</tr>
<xsl:for-each select="metadata/*">
<tr>
<td><xsl:value-of select="name()" /></td>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</xsl:if>
</tbody> </tbody>
</table> </table>
<xsl:if test="authentication">
<table>
<ul>
<xsl:for-each select="authentication/role">
<li>
Role
<xsl:if test="@name">
<xsl:value-of select="@name" />
</xsl:if>
of type <xsl:value-of select="@type" />:
<xsl:if test="@management-url">
<a href="{@management-url}">Manage Authentication</a>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</table>
</xsl:if>
</div> </div>
</div> </div>
</xsl:if> </xsl:if>

View File

@ -775,6 +775,26 @@ static void command_buildm3u(client_t *client, const char *mount)
fserve_add_client (client, NULL); fserve_add_client (client, NULL);
} }
xmlNodePtr admin_add_role_to_authentication(auth_t *auth, xmlNodePtr parent) {
xmlNodePtr rolenode = xmlNewChild(parent, NULL, XMLSTR("role"), NULL);
char idbuf[32];
snprintf(idbuf, sizeof(idbuf), "%lu", auth->id);
xmlSetProp(rolenode, XMLSTR("id"), XMLSTR(idbuf));
if (auth->type)
xmlSetProp(rolenode, XMLSTR("type"), XMLSTR(auth->type));
if (auth->role)
xmlSetProp(rolenode, XMLSTR("name"), XMLSTR(auth->role));
if (auth->management_url)
xmlSetProp(rolenode, XMLSTR("management-url"), XMLSTR(auth->management_url));
xmlSetProp(rolenode, XMLSTR("can-adduser"), XMLSTR(auth->adduser ? "true" : "false"));
xmlSetProp(rolenode, XMLSTR("can-deleteuser"), XMLSTR(auth->deleteuser ? "true" : "false"));
xmlSetProp(rolenode, XMLSTR("can-listuser"), XMLSTR(auth->listuser ? "true" : "false"));
return rolenode;
}
static void command_manageauth(client_t *client, int response) { static void command_manageauth(client_t *client, int response) {
xmlDocPtr doc; xmlDocPtr doc;
@ -789,7 +809,6 @@ static void command_manageauth(client_t *client, int response) {
long unsigned int id; long unsigned int id;
ice_config_t *config = config_get_config(); ice_config_t *config = config_get_config();
auth_t *auth; auth_t *auth;
char idbuf[32];
do do
{ {
@ -871,19 +890,8 @@ static void command_manageauth(client_t *client, int response) {
doc = xmlNewDoc(XMLSTR("1.0")); doc = xmlNewDoc(XMLSTR("1.0"));
node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL); node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
rolenode = xmlNewChild(node, NULL, XMLSTR("role"), NULL);
snprintf(idbuf, sizeof(idbuf), "%lu", auth->id); rolenode = admin_add_role_to_authentication(auth, node);
xmlSetProp(rolenode, XMLSTR("id"), XMLSTR(idbuf));
if (auth->type)
xmlSetProp(rolenode, XMLSTR("type"), XMLSTR(auth->type));
if (auth->role)
xmlSetProp(rolenode, XMLSTR("name"), XMLSTR(auth->role));
xmlSetProp(rolenode, XMLSTR("can-adduser"), XMLSTR(auth->adduser ? "true" : "false"));
xmlSetProp(rolenode, XMLSTR("can-deleteuser"), XMLSTR(auth->deleteuser ? "true" : "false"));
xmlSetProp(rolenode, XMLSTR("can-listuser"), XMLSTR(auth->listuser ? "true" : "false"));
if (message) { if (message) {
msgnode = xmlNewChild(node, NULL, XMLSTR("iceresponse"), NULL); msgnode = xmlNewChild(node, NULL, XMLSTR("iceresponse"), NULL);

View File

@ -19,6 +19,7 @@
#include "refbuf.h" #include "refbuf.h"
#include "client.h" #include "client.h"
#include "source.h" #include "source.h"
#include "auth.h"
/* types */ /* types */
#define ADMINTYPE_ERROR (-1) #define ADMINTYPE_ERROR (-1)
@ -40,6 +41,7 @@ void admin_send_response(xmlDocPtr doc, client_t *client,
int response, const char *xslt_template); int response, const char *xslt_template);
void admin_add_listeners_to_mount(source_t *source, xmlNodePtr parent, operation_mode mode); void admin_add_listeners_to_mount(source_t *source, xmlNodePtr parent, operation_mode mode);
xmlNodePtr admin_add_role_to_authentication(auth_t *auth, xmlNodePtr parent);
int admin_get_command(const char *command); int admin_get_command(const char *command);
int admin_get_command_type(int command); int admin_get_command_type(int command);

View File

@ -815,16 +815,29 @@ static int _send_event_to_client(stats_event_t *event, client_t *client)
return 0; return 0;
} }
static inline void __add_authstack (auth_stack_t *stack, xmlNodePtr parent) {
xmlNodePtr authentication;
authentication = xmlNewTextChild(parent, NULL, XMLSTR("authentication"), NULL);
static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, int hidden) auth_stack_addref(stack);
{
while (stack) {
auth_t *auth = auth_stack_get(stack);
admin_add_role_to_authentication(auth, authentication);
auth_release(auth);
auth_stack_next(&stack);
}
}
static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, int hidden) {
avl_node *avlnode; avl_node *avlnode;
xmlNodePtr ret = NULL; xmlNodePtr ret = NULL;
ice_config_t *config;
thread_mutex_lock(&_stats_mutex); thread_mutex_lock(&_stats_mutex);
/* general stats first */ /* general stats first */
avlnode = avl_get_first(_stats.global_tree); avlnode = avl_get_first(_stats.global_tree);
while (avlnode)
while (avlnode)
{ {
stats_node_t *stat = avlnode->key; stats_node_t *stat = avlnode->key;
if (stat->hidden <= hidden) if (stat->hidden <= hidden)
@ -833,6 +846,10 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
} }
/* now per mount stats */ /* now per mount stats */
avlnode = avl_get_first(_stats.source_tree); avlnode = avl_get_first(_stats.source_tree);
config = config_get_config();
__add_authstack(config->authstack, root);
config_release_config();
while (avlnode) while (avlnode)
{ {
stats_source_t *source = (stats_source_t *)avlnode->key; stats_source_t *source = (stats_source_t *)avlnode->key;
@ -840,11 +857,9 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
if (source->hidden <= hidden && if (source->hidden <= hidden &&
(show_mount == NULL || strcmp (show_mount, source->source) == 0)) (show_mount == NULL || strcmp (show_mount, source->source) == 0))
{ {
xmlNodePtr metadata, authentication, role; xmlNodePtr metadata;
source_t *source_real; source_t *source_real;
ice_config_t *config;
mount_proxy *mountproxy; mount_proxy *mountproxy;
auth_stack_t *stack;
int i; int i;
avl_node *avlnode2 = avl_get_first (source->stats_tree); avl_node *avlnode2 = avl_get_first (source->stats_tree);
@ -870,25 +885,9 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
} }
avl_tree_unlock(global.source_tree); avl_tree_unlock(global.source_tree);
authentication = xmlNewTextChild(xmlnode, NULL, XMLSTR("authentication"), NULL);
config = config_get_config(); config = config_get_config();
mountproxy = config_find_mount(config, source->source, MOUNT_TYPE_NORMAL); mountproxy = config_find_mount(config, source->source, MOUNT_TYPE_NORMAL);
auth_stack_addref(stack = mountproxy->authstack); __add_authstack(mountproxy->authstack, xmlnode);
while (stack) {
auth_t *auth = auth_stack_get(stack);
char idbuf[32];
snprintf(idbuf, sizeof(idbuf), "%lu", auth->id);
role = xmlNewTextChild(authentication, NULL, XMLSTR("role"), NULL);
xmlSetProp(role, XMLSTR("id"), XMLSTR(idbuf));
if (auth->type)
xmlSetProp(role, XMLSTR("type"), XMLSTR(auth->type));
if (auth->role)
xmlSetProp(role, XMLSTR("name"), XMLSTR(auth->role));
if (auth->management_url)
xmlSetProp(role, XMLSTR("management-url"), XMLSTR(auth->management_url));
auth_release(auth);
auth_stack_next(&stack);
}
config_release_config(); config_release_config();
} }
avlnode = avl_get_next (avlnode); avlnode = avl_get_next (avlnode);

View File

@ -4,6 +4,7 @@ AUTOMAKE_OPTIONS = foreign
webdir = $(pkgdatadir)/web webdir = $(pkgdatadir)/web
dist_web_DATA = status.xsl \ dist_web_DATA = status.xsl \
favicon.ico \
icecast.png \ icecast.png \
style.css \ style.css \
auth.xsl \ auth.xsl \

BIN
win32/icecast2logo3.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB