mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-09-29 04:25:55 -04:00
Fix: Corrected namespace for httpp part
This commit is contained in:
parent
196b67a9a3
commit
0a87e9026b
@ -28,7 +28,7 @@ struct acl_tag {
|
|||||||
size_t refcount;
|
size_t refcount;
|
||||||
|
|
||||||
/* allowed methods */
|
/* allowed methods */
|
||||||
acl_policy_t method[httpp_req_unknown+1];
|
acl_policy_t method[igloo_httpp_req_unknown+1];
|
||||||
|
|
||||||
/* admin/ interface */
|
/* admin/ interface */
|
||||||
struct {
|
struct {
|
||||||
@ -250,7 +250,7 @@ int acl_set_method_str__callback(acl_t *acl,
|
|||||||
acl->method[i] = policy;
|
acl->method[i] = policy;
|
||||||
} else {
|
} else {
|
||||||
method = igloo_httpp_str_to_method(str);
|
method = igloo_httpp_str_to_method(str);
|
||||||
if (method == httpp_req_unknown)
|
if (method == igloo_httpp_req_unknown)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
acl->method[method] = policy;
|
acl->method[method] = policy;
|
||||||
@ -261,7 +261,7 @@ int acl_set_method_str__callback(acl_t *acl,
|
|||||||
|
|
||||||
acl_policy_t acl_test_method(acl_t * acl, igloo_httpp_request_type_e method)
|
acl_policy_t acl_test_method(acl_t * acl, igloo_httpp_request_type_e method)
|
||||||
{
|
{
|
||||||
if (!acl || method < httpp_req_none || method > httpp_req_unknown)
|
if (!acl || method < igloo_httpp_req_none || method > igloo_httpp_req_unknown)
|
||||||
return ACL_POLICY_ERROR;
|
return ACL_POLICY_ERROR;
|
||||||
|
|
||||||
return acl->method[method];
|
return acl->method[method];
|
||||||
|
18
src/admin.c
18
src/admin.c
@ -371,9 +371,9 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
|
|||||||
config = config_get_config();
|
config = config_get_config();
|
||||||
mountinfo = config_find_mount(config, source->mount, MOUNT_TYPE_NORMAL);
|
mountinfo = config_find_mount(config, source->mount, MOUNT_TYPE_NORMAL);
|
||||||
if (mountinfo)
|
if (mountinfo)
|
||||||
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, httpp_req_get);
|
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, igloo_httpp_req_get);
|
||||||
if (!acl)
|
if (!acl)
|
||||||
acl = auth_stack_get_anonymous_acl(config->authstack, httpp_req_get);
|
acl = auth_stack_get_anonymous_acl(config->authstack, igloo_httpp_req_get);
|
||||||
if (acl && acl_test_web(acl) == ACL_POLICY_DENY) {
|
if (acl && acl_test_web(acl) == ACL_POLICY_DENY) {
|
||||||
xmlNewTextChild(srcnode, NULL, XMLSTR("authenticator"), XMLSTR("(dummy)"));
|
xmlNewTextChild(srcnode, NULL, XMLSTR("authenticator"), XMLSTR("(dummy)"));
|
||||||
}
|
}
|
||||||
@ -499,8 +499,8 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
|
|
||||||
/* ACL disallows, check exceptions */
|
/* ACL disallows, check exceptions */
|
||||||
if ((handler->function == command_metadata && handler->format == ADMIN_FORMAT_RAW) &&
|
if ((handler->function == command_metadata && handler->format == ADMIN_FORMAT_RAW) &&
|
||||||
(acl_test_method(client->acl, httpp_req_source) == ACL_POLICY_ALLOW ||
|
(acl_test_method(client->acl, igloo_httpp_req_source) == ACL_POLICY_ALLOW ||
|
||||||
acl_test_method(client->acl, httpp_req_put) == ACL_POLICY_ALLOW)) {
|
acl_test_method(client->acl, igloo_httpp_req_put) == ACL_POLICY_ALLOW)) {
|
||||||
ICECAST_LOG_DEBUG("Granted right to call COMMAND_RAW_METADATA_UPDATE to "
|
ICECAST_LOG_DEBUG("Granted right to call COMMAND_RAW_METADATA_UPDATE to "
|
||||||
"client because it is allowed to do SOURCE or PUT.");
|
"client because it is allowed to do SOURCE or PUT.");
|
||||||
} else {
|
} else {
|
||||||
@ -550,8 +550,8 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (client->parser->req_type) {
|
switch (client->parser->req_type) {
|
||||||
case httpp_req_get:
|
case igloo_httpp_req_get:
|
||||||
case httpp_req_post:
|
case igloo_httpp_req_post:
|
||||||
if (handler->function) {
|
if (handler->function) {
|
||||||
handler->function(client, source, format);
|
handler->function(client, source, format);
|
||||||
} else {
|
} else {
|
||||||
@ -572,7 +572,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case httpp_req_options:
|
case igloo_httpp_req_options:
|
||||||
client_send_204(client);
|
client_send_204(client);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1044,7 +1044,7 @@ static void command_metadata(client_t *client,
|
|||||||
|
|
||||||
ICECAST_LOG_DEBUG("Got metadata update request");
|
ICECAST_LOG_DEBUG("Got metadata update request");
|
||||||
|
|
||||||
if (source->parser && source->parser->req_type == httpp_req_put) {
|
if (source->parser && source->parser->req_type == igloo_httpp_req_put) {
|
||||||
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
|
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
|
||||||
"source connected with PUT at mountpoint %s", source->mount);
|
"source connected with PUT at mountpoint %s", source->mount);
|
||||||
}
|
}
|
||||||
@ -1115,7 +1115,7 @@ static void command_shoutcast_metadata(client_t *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source->parser->req_type == httpp_req_put) {
|
if (source->parser->req_type == igloo_httpp_req_put) {
|
||||||
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
|
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
|
||||||
"on source connected with PUT at mountpoint %s", source->mount);
|
"on source connected with PUT at mountpoint %s", source->mount);
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ static inline int auth_get_authenticator__filter_method(auth_t *auth, xmlNodePtr
|
|||||||
}
|
}
|
||||||
|
|
||||||
idx = igloo_httpp_str_to_method(cur);
|
idx = igloo_httpp_str_to_method(cur);
|
||||||
if (idx == httpp_req_unknown) {
|
if (idx == igloo_httpp_req_unknown) {
|
||||||
ICECAST_LOG_ERROR("Can not add known method \"%H\" to role's %s", cur, name);
|
ICECAST_LOG_ERROR("Can not add known method \"%H\" to role's %s", cur, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -854,7 +854,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
idx = igloo_httpp_str_to_method(cur);
|
idx = igloo_httpp_str_to_method(cur);
|
||||||
if (idx == httpp_req_unknown) {
|
if (idx == igloo_httpp_req_unknown) {
|
||||||
auth_release(auth);
|
auth_release(auth);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1189,7 +1189,7 @@ auth_t *auth_stack_getbyid(auth_stack_t *stack, unsigned long id) {
|
|||||||
acl_t *auth_stack_get_anonymous_acl(auth_stack_t *stack, igloo_httpp_request_type_e method) {
|
acl_t *auth_stack_get_anonymous_acl(auth_stack_t *stack, igloo_httpp_request_type_e method) {
|
||||||
acl_t *ret = NULL;
|
acl_t *ret = NULL;
|
||||||
|
|
||||||
if (!stack || method < 0 || method > httpp_req_unknown)
|
if (!stack || method < 0 || method > igloo_httpp_req_unknown)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
auth_stack_addref(stack);
|
auth_stack_addref(stack);
|
||||||
|
@ -108,7 +108,7 @@ struct auth_tag
|
|||||||
char *mount;
|
char *mount;
|
||||||
|
|
||||||
/* filters */
|
/* filters */
|
||||||
auth_matchtype_t filter_method[httpp_req_unknown+1];
|
auth_matchtype_t filter_method[igloo_httpp_req_unknown+1];
|
||||||
auth_matchtype_t filter_web_policy;
|
auth_matchtype_t filter_web_policy;
|
||||||
auth_matchtype_t filter_admin_policy;
|
auth_matchtype_t filter_admin_policy;
|
||||||
struct {
|
struct {
|
||||||
|
@ -116,7 +116,7 @@ void client_complete(client_t *client)
|
|||||||
int have = 0;
|
int have = 0;
|
||||||
|
|
||||||
if (!have) {
|
if (!have) {
|
||||||
header = httpp_getvar(client->parser, "content-length");
|
header = igloo_httpp_getvar(client->parser, "content-length");
|
||||||
if (header) {
|
if (header) {
|
||||||
if (sscanf(header, "%llu", &scannumber) == 1) {
|
if (sscanf(header, "%llu", &scannumber) == 1) {
|
||||||
client->request_body_length = scannumber;
|
client->request_body_length = scannumber;
|
||||||
@ -126,7 +126,7 @@ void client_complete(client_t *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!have) {
|
if (!have) {
|
||||||
if (client->parser->req_type == httpp_req_source) {
|
if (client->parser->req_type == igloo_httpp_req_source) {
|
||||||
client->request_body_length = -1; /* streaming */
|
client->request_body_length = -1; /* streaming */
|
||||||
have = 1;
|
have = 1;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void client_complete(client_t *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!have) {
|
if (!have) {
|
||||||
if (client->parser->req_type == httpp_req_put) {
|
if (client->parser->req_type == igloo_httpp_req_put) {
|
||||||
/* As we don't know yet, we asume this PUT is in streaming mode */
|
/* As we don't know yet, we asume this PUT is in streaming mode */
|
||||||
client->request_body_length = -1; /* streaming */
|
client->request_body_length = -1; /* streaming */
|
||||||
have = 1;
|
have = 1;
|
||||||
@ -151,7 +151,7 @@ void client_complete(client_t *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!have) {
|
if (!have) {
|
||||||
if (client->parser->req_type == httpp_req_none) {
|
if (client->parser->req_type == igloo_httpp_req_none) {
|
||||||
/* We are a client. If the server did not tell us, we asume streaming. */
|
/* We are a client. If the server did not tell us, we asume streaming. */
|
||||||
client->request_body_length = -1; /* streaming */
|
client->request_body_length = -1; /* streaming */
|
||||||
have = 1;
|
have = 1;
|
||||||
|
@ -545,7 +545,7 @@ static client_slurp_result_t process_request_body_queue_one(client_queue_t *node
|
|||||||
client_t *client = node->client;
|
client_t *client = node->client;
|
||||||
client_slurp_result_t res;
|
client_slurp_result_t res;
|
||||||
|
|
||||||
if (client->parser->req_type == httpp_req_post) {
|
if (client->parser->req_type == igloo_httpp_req_post) {
|
||||||
if (node->bodybuffer == NULL && client->request_body_read == 0) {
|
if (node->bodybuffer == NULL && client->request_body_read == 0) {
|
||||||
if (client->request_body_length < 0) {
|
if (client->request_body_length < 0) {
|
||||||
node->bodybufferlen = body_size_limit;
|
node->bodybufferlen = body_size_limit;
|
||||||
@ -754,7 +754,7 @@ int connection_complete_source(source_t *source, int response)
|
|||||||
ICECAST_LOG_WARN("Content-type \"%s\" not supported, dropping source", contenttype);
|
ICECAST_LOG_WARN("Content-type \"%s\" not supported, dropping source", contenttype);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (source->parser->req_type == httpp_req_put) {
|
} else if (source->parser->req_type == igloo_httpp_req_put) {
|
||||||
config_release_config();
|
config_release_config();
|
||||||
global_unlock();
|
global_unlock();
|
||||||
if (response) {
|
if (response) {
|
||||||
@ -1013,7 +1013,7 @@ static void _handle_get_request(client_t *client) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->parser->req_type == httpp_req_options) {
|
if (client->parser->req_type == igloo_httpp_req_options) {
|
||||||
client_send_204(client);
|
client_send_204(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1331,19 +1331,19 @@ static void _handle_authed_client(client_t *client, void *userdata, auth_result
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (client->parser->req_type) {
|
switch (client->parser->req_type) {
|
||||||
case httpp_req_source:
|
case igloo_httpp_req_source:
|
||||||
case httpp_req_put:
|
case igloo_httpp_req_put:
|
||||||
_handle_source_request(client);
|
_handle_source_request(client);
|
||||||
break;
|
break;
|
||||||
case httpp_req_stats:
|
case igloo_httpp_req_stats:
|
||||||
_handle_stats_request(client);
|
_handle_stats_request(client);
|
||||||
break;
|
break;
|
||||||
case httpp_req_get:
|
case igloo_httpp_req_get:
|
||||||
case httpp_req_post:
|
case igloo_httpp_req_post:
|
||||||
case httpp_req_options:
|
case igloo_httpp_req_options:
|
||||||
_handle_get_request(client);
|
_handle_get_request(client);
|
||||||
break;
|
break;
|
||||||
case httpp_req_delete:
|
case igloo_httpp_req_delete:
|
||||||
_handle_delete_request(client);
|
_handle_delete_request(client);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1517,10 +1517,10 @@ static int _need_body(client_queue_t *node)
|
|||||||
if (node->tried_body)
|
if (node->tried_body)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (client->parser->req_type == httpp_req_source) {
|
if (client->parser->req_type == igloo_httpp_req_source) {
|
||||||
/* SOURCE connection. */
|
/* SOURCE connection. */
|
||||||
return 0;
|
return 0;
|
||||||
} else if (client->parser->req_type == httpp_req_put) {
|
} else if (client->parser->req_type == igloo_httpp_req_put) {
|
||||||
/* PUT connection.
|
/* PUT connection.
|
||||||
* TODO: We may need body for /admin/ but we do not know if it's an admin request yet.
|
* TODO: We may need body for /admin/ but we do not know if it's an admin request yet.
|
||||||
*/
|
*/
|
||||||
@ -1647,7 +1647,7 @@ static void _handle_connection(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser->req_type == httpp_req_options && strcmp(rawuri, "*") == 0) {
|
if (parser->req_type == igloo_httpp_req_options && strcmp(rawuri, "*") == 0) {
|
||||||
client->uri = strdup("*");
|
client->uri = strdup("*");
|
||||||
client_send_204(client);
|
client_send_204(client);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1149,9 +1149,9 @@ static void source_apply_mount (ice_config_t *config, source_t *source, mount_pr
|
|||||||
stats_event (source->mount, "subtype", mountinfo->subtype);
|
stats_event (source->mount, "subtype", mountinfo->subtype);
|
||||||
|
|
||||||
if (mountinfo)
|
if (mountinfo)
|
||||||
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, httpp_req_get);
|
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, igloo_httpp_req_get);
|
||||||
if (!acl)
|
if (!acl)
|
||||||
acl = auth_stack_get_anonymous_acl(config->authstack, httpp_req_get);
|
acl = auth_stack_get_anonymous_acl(config->authstack, igloo_httpp_req_get);
|
||||||
if (acl && acl_test_web(acl) == ACL_POLICY_DENY)
|
if (acl && acl_test_web(acl) == ACL_POLICY_DENY)
|
||||||
stats_event (source->mount, "authenticator", "(dummy)");
|
stats_event (source->mount, "authenticator", "(dummy)");
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user