mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
parent
b5e721ebff
commit
001ac59127
@ -98,7 +98,8 @@ icecast_SOURCES = \
|
||||
auth.c \
|
||||
auth_htpasswd.c \
|
||||
auth_anonymous.c \
|
||||
auth_static.c
|
||||
auth_static.c \
|
||||
auth_enforce_auth.c
|
||||
|
||||
if HAVE_CURL
|
||||
icecast_SOURCES += \
|
||||
|
@ -596,6 +596,10 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
|
||||
if (auth_get_static_auth(auth, options) < 0)
|
||||
return -1;
|
||||
break;
|
||||
} else if (strcmp(auth->type, AUTH_TYPE_ENFORCE_AUTH) == 0) {
|
||||
if (auth_get_enforce_auth_auth(auth, options) < 0)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
ICECAST_LOG_ERROR("Unrecognised authenticator type: \"%s\"", auth->type);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define AUTH_TYPE_LEGACY_PASSWORD "legacy-password"
|
||||
#define AUTH_TYPE_URL "url"
|
||||
#define AUTH_TYPE_HTPASSWD "htpasswd"
|
||||
#define AUTH_TYPE_ENFORCE_AUTH "enforce-auth"
|
||||
|
||||
#define MAX_ADMIN_COMMANDS 32
|
||||
|
||||
@ -170,6 +171,7 @@ int auth_get_anonymous_auth(auth_t *auth, config_options_t *options);
|
||||
int auth_get_static_auth(auth_t *auth, config_options_t *options);
|
||||
int auth_get_url_auth(auth_t *authenticator, config_options_t *options);
|
||||
int auth_get_htpasswd_auth(auth_t *auth, config_options_t *options);
|
||||
int auth_get_enforce_auth_auth(auth_t *auth, config_options_t *options);
|
||||
|
||||
/* prototypes for auth.c */
|
||||
void auth_initialise(void);
|
||||
|
39
src/auth_enforce_auth.c
Normal file
39
src/auth_enforce_auth.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Icecast
|
||||
*
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2014-2019, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||
*/
|
||||
|
||||
/**
|
||||
* Client authentication functions
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "auth.h"
|
||||
#include "client.h"
|
||||
|
||||
#include "logging.h"
|
||||
#define CATMODULE "auth_enforce_auth"
|
||||
|
||||
static auth_result enforce_auth_auth(auth_client *auth_user)
|
||||
{
|
||||
client_t *client = auth_user->client;
|
||||
|
||||
if (client->password)
|
||||
return AUTH_NOMATCH;
|
||||
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
|
||||
int auth_get_enforce_auth_auth(auth_t *authenticator, config_options_t *options)
|
||||
{
|
||||
(void)options;
|
||||
authenticator->authenticate_client = enforce_auth_auth;
|
||||
authenticator->immediate = 1;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user