Commit 637af17f authored by Philipp Schafft's avatar Philipp Schafft 🦁

some more changes for ACL framework: exported admin_get_command() and...

some more changes for ACL framework: exported admin_get_command() and ADMIN_COMMAND_ERROR as well as introduced ADMIN_COMMAND_ANY

svn path=/icecast/trunk/icecast/; revision=19349
parent 09692dd4
......@@ -45,16 +45,18 @@
#define CATMODULE "admin"
#define COMMAND_ERROR (-1)
/* special commands */
#define COMMAND_ERROR ADMIN_COMMAND_ERROR
#define COMMAND_ANY ADMIN_COMMAND_ANY
/* Mount-specific commands */
#define COMMAND_RAW_FALLBACK 1
#define COMMAND_RAW_METADATA_UPDATE 2
#define COMMAND_RAW_SHOW_LISTENERS 3
#define COMMAND_RAW_MOVE_CLIENTS 4
#define COMMAND_RAW_MANAGEAUTH 5
#define COMMAND_SHOUTCAST_METADATA_UPDATE 6
#define COMMAND_RAW_UPDATEMETADATA 7
#define COMMAND_RAW_FALLBACK 1
#define COMMAND_RAW_METADATA_UPDATE 2
#define COMMAND_RAW_SHOW_LISTENERS 3
#define COMMAND_RAW_MOVE_CLIENTS 4
#define COMMAND_RAW_MANAGEAUTH 5
#define COMMAND_SHOUTCAST_METADATA_UPDATE 6
#define COMMAND_RAW_UPDATEMETADATA 7
#define COMMAND_TRANSFORMED_FALLBACK 50
#define COMMAND_TRANSFORMED_SHOW_LISTENERS 53
......@@ -174,6 +176,8 @@ int admin_get_command(const char *command)
return COMMAND_TRANSFORMED_STATS;
else if(!strcmp(command, DEFAULT_RAW_REQUEST))
return COMMAND_TRANSFORMED_STATS;
else if(!strcmp(command, "*")) /* for ACL framework */
return COMMAND_ANY;
else
return COMMAND_ERROR;
}
......@@ -375,7 +379,7 @@ void admin_handle_request(client_t *client, const char *uri)
ICECAST_LOG_DEBUG("Got command (%s)", command_string);
command = admin_get_command(command_string);
if(command < 0) {
if(command <= 0) {
ICECAST_LOG_ERROR("Error parsing command string or unrecognised command: %s",
command_string);
client_send_error(client, 400, 0, "Unrecognised command");
......
......@@ -24,10 +24,16 @@
#define TRANSFORMED 2
#define PLAINTEXT 3
/* special commands */
#define ADMIN_COMMAND_ERROR (-1)
#define ADMIN_COMMAND_ANY 0 /* for ACL framework */
void admin_handle_request(client_t *client, const char *uri);
void admin_send_response(xmlDocPtr doc, client_t *client,
int response, const char *xslt_template);
void admin_add_listeners_to_mount(source_t *source, xmlNodePtr parent);
int admin_get_command(const char *command);
#endif /* __ADMIN_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment