Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
2c72d9a3
Commit
2c72d9a3
authored
Nov 04, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Support per-<role> HTTP headers
parent
aeeee071
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
10 deletions
+19
-10
src/auth.c
src/auth.c
+3
-0
src/auth.h
src/auth.h
+4
-0
src/cfgfile.c
src/cfgfile.c
+5
-10
src/cfgfile.h
src/cfgfile.h
+4
-0
src/util.c
src/util.c
+3
-0
No files found.
src/auth.c
View file @
2c72d9a3
...
...
@@ -215,6 +215,7 @@ void auth_release (auth_t *authenticator) {
if
(
authenticator
->
mount
)
free
(
authenticator
->
mount
);
acl_release
(
authenticator
->
acl
);
config_clear_http_header
(
authenticator
->
http_headers
);
free
(
authenticator
);
}
...
...
@@ -841,6 +842,8 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
}
*
next_option
=
opt
;
next_option
=
&
opt
->
next
;
}
else
if
(
xmlStrcmp
(
child
->
name
,
XMLSTR
(
"http-headers"
))
==
0
)
{
config_parse_http_headers
(
child
->
xmlChildrenNode
,
&
(
auth
->
http_headers
));
}
else
if
(
xmlStrcmp
(
child
->
name
,
XMLSTR
(
"acl"
))
==
0
)
{
if
(
!
auth
->
acl
)
{
auth
->
acl
=
acl_new_from_xml_node
(
child
);
...
...
src/auth.h
View file @
2c72d9a3
...
...
@@ -26,6 +26,7 @@
#include "common/httpp/httpp.h"
#include "icecasttypes.h"
#include "cfgfile.h"
/* implemented */
#define AUTH_TYPE_ANONYMOUS "anonymous"
...
...
@@ -152,6 +153,9 @@ struct auth_tag
acl_t
*
acl
;
/* role name for later matching, may be NULL if no role name was given in config */
char
*
role
;
/* HTTP headers to send to clients using this role */
ice_config_http_header_t
*
http_headers
;
};
/* prototypes for auths that do not need own header file */
...
...
src/cfgfile.c
View file @
2c72d9a3
...
...
@@ -141,10 +141,6 @@ static void _parse_authentication(xmlDocPtr doc,
ice_config_t
*
c
,
char
**
source_password
);
static
void
_parse_http_headers
(
xmlDocPtr
doc
,
xmlNodePtr
node
,
ice_config_http_header_t
**
http_headers
);
static
void
_parse_relay
(
xmlDocPtr
doc
,
xmlNodePtr
node
,
ice_config_t
*
c
,
const
char
*
mount
);
static
void
_parse_mount
(
xmlDocPtr
doc
,
xmlNodePtr
parentnode
,
ice_config_t
*
c
);
...
...
@@ -512,7 +508,7 @@ static void __append_old_style_url_event(event_registration_t **list,
xmlFreeNode
(
exec
);
}
static
void
config_clear_http_header
(
ice_config_http_header_t
*
header
)
void
config_clear_http_header
(
ice_config_http_header_t
*
header
)
{
ice_config_http_header_t
*
old
;
...
...
@@ -1062,7 +1058,7 @@ static void _parse_root(xmlDocPtr doc,
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"limits"
))
==
0
)
{
_parse_limits
(
doc
,
node
->
xmlChildrenNode
,
configuration
);
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"http-headers"
))
==
0
)
{
_parse_http_headers
(
doc
,
node
->
xmlChildrenNode
,
&
(
configuration
->
http_headers
));
config_parse_http_headers
(
node
->
xmlChildrenNode
,
&
(
configuration
->
http_headers
));
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"relay"
))
==
0
)
{
_parse_relay
(
doc
,
node
->
xmlChildrenNode
,
configuration
,
NULL
);
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"mount"
))
==
0
)
{
...
...
@@ -1556,7 +1552,7 @@ static void _parse_mount(xmlDocPtr doc,
mount
->
subtype
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"http-headers"
))
==
0
)
{
_parse_http_headers
(
doc
,
node
->
xmlChildrenNode
,
config_parse_http_headers
(
node
->
xmlChildrenNode
,
&
(
mount
->
http_headers
));
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"event-bindings"
))
==
0
||
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"kartoffelsalat"
))
==
0
)
{
...
...
@@ -1644,9 +1640,8 @@ static void _parse_mount(xmlDocPtr doc,
}
}
static
void
_parse_http_headers
(
xmlDocPtr
doc
,
xmlNodePtr
node
,
ice_config_http_header_t
**
http_headers
)
void
config_parse_http_headers
(
xmlNodePtr
node
,
ice_config_http_header_t
**
http_headers
)
{
ice_config_http_header_t
*
header
;
ice_config_http_header_t
*
next
;
...
...
src/cfgfile.h
View file @
2c72d9a3
...
...
@@ -301,6 +301,10 @@ listener_t *config_copy_listener_one(const listener_t *listener);
config_options_t
*
config_parse_options
(
xmlNodePtr
node
);
void
config_clear_options
(
config_options_t
*
options
);
void
config_parse_http_headers
(
xmlNodePtr
node
,
ice_config_http_header_t
**
http_headers
);
void
config_clear_http_header
(
ice_config_http_header_t
*
header
);
int
config_rehash
(
void
);
ice_config_locks
*
config_locks
(
void
);
...
...
src/util.c
View file @
2c72d9a3
...
...
@@ -50,6 +50,7 @@
#include "client.h"
#include "source.h"
#include "admin.h"
#include "auth.h"
#define CATMODULE "util"
...
...
@@ -674,6 +675,8 @@ static inline char * _build_headers(int status, const char *allow, ice_config_t
_build_headers_loop
(
&
ret
,
&
len
,
config
->
http_headers
,
status
,
allow
,
client
);
if
(
mountproxy
&&
mountproxy
->
http_headers
)
_build_headers_loop
(
&
ret
,
&
len
,
mountproxy
->
http_headers
,
status
,
allow
,
client
);
if
(
client
&&
client
->
auth
&&
client
->
auth
->
http_headers
)
_build_headers_loop
(
&
ret
,
&
len
,
client
->
auth
->
http_headers
,
status
,
allow
,
client
);
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment