mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-09-29 04:25:55 -04:00
Cleanup: Made assigning of client->admin_command a function on it's own.
This commit is contained in:
parent
fe948bffea
commit
e4560e15a2
@ -1506,6 +1506,23 @@ static int _need_body(client_queue_t *node)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Updates client's admin_command */
|
||||||
|
static int _update_admin_command(client_t *client)
|
||||||
|
{
|
||||||
|
if (strcmp(client->uri, "/admin.cgi") == 0) {
|
||||||
|
client->admin_command = admin_get_command(client->uri + 1);
|
||||||
|
__prepare_shoutcast_admin_cgi_request(client);
|
||||||
|
if (!client->password) {
|
||||||
|
client_send_error_by_id(client, ICECAST_ERROR_CON_MISSING_PASS_PARAMETER);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else if (strncmp(client->uri, "/admin/", 7) == 0) {
|
||||||
|
client->admin_command = admin_get_command(client->uri + 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Connection thread. Here we take clients off the connection queue and check
|
/* Connection thread. Here we take clients off the connection queue and check
|
||||||
* the contents provided. We set up the parser then hand off to the specific
|
* the contents provided. We set up the parser then hand off to the specific
|
||||||
* request handler.
|
* request handler.
|
||||||
@ -1624,16 +1641,8 @@ static void _handle_connection(void)
|
|||||||
|
|
||||||
client->uri = uri;
|
client->uri = uri;
|
||||||
|
|
||||||
if (strcmp(uri, "/admin.cgi") == 0) {
|
if (_update_admin_command(client) == -1)
|
||||||
client->admin_command = admin_get_command(uri + 1);
|
|
||||||
__prepare_shoutcast_admin_cgi_request(client);
|
|
||||||
if (!client->password) {
|
|
||||||
client_send_error_by_id(client, ICECAST_ERROR_CON_MISSING_PASS_PARAMETER);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
} else if (strncmp("/admin/", uri, 7) == 0) {
|
|
||||||
client->admin_command = admin_get_command(uri + 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
_handle_authentication(client, uri);
|
_handle_authentication(client, uri);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user