1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

Feature: Added lookup function for auth_alter_t

This commit is contained in:
Philipp Schafft 2018-09-14 14:13:38 +00:00
parent 4d7a60d588
commit 0392b4a32f
2 changed files with 25 additions and 0 deletions

View File

@ -814,6 +814,30 @@ int auth_alter_client(auth_t *auth, auth_client *auth_user, auth_alter_t action,
return 0; return 0;
} }
auth_alter_t auth_str2alter(const char *str)
{
if (!str)
return AUTH_ALTER_NOOP;
if (strcasecmp(str, "noop") == 0) {
return AUTH_ALTER_NOOP;
} else if (strcasecmp(str, "rewrite") == 0) {
return AUTH_ALTER_REWRITE;
} else if (strcasecmp(str, "redirect") == 0) {
return AUTH_ALTER_REDIRECT;
} else if (strcasecmp(str, "redirect_see_other") == 0) {
return AUTH_ALTER_REDIRECT_SEE_OTHER;
} else if (strcasecmp(str, "redirect_temporary") == 0) {
return AUTH_ALTER_REDIRECT_TEMPORARY;
} else if (strcasecmp(str, "redirect_permanent") == 0) {
return AUTH_ALTER_REDIRECT_PERMANENT;
} else if (strcasecmp(str, "send_error") == 0) {
return AUTH_ALTER_SEND_ERROR;
} else {
return AUTH_ALTER_NOOP;
}
}
/* these are called at server start and termination */ /* these are called at server start and termination */
void auth_initialise (void) void auth_initialise (void)

View File

@ -174,6 +174,7 @@ void auth_stack_add_client(auth_stack_t *stack,
void *userdata); void *userdata);
int auth_alter_client(auth_t *auth, auth_client *auth_user, auth_alter_t action, const char *arg); int auth_alter_client(auth_t *auth, auth_client *auth_user, auth_alter_t action, const char *arg);
auth_alter_t auth_str2alter(const char *str);
void auth_stack_release(auth_stack_t *stack); void auth_stack_release(auth_stack_t *stack);
void auth_stack_addref(auth_stack_t *stack); void auth_stack_addref(auth_stack_t *stack);