Commit 0392b4a3 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Feature: Added lookup function for auth_alter_t

parent 4d7a60d5
......@@ -814,6 +814,30 @@ int auth_alter_client(auth_t *auth, auth_client *auth_user, auth_alter_t action,
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 */
void auth_initialise (void)
......
......@@ -174,6 +174,7 @@ void auth_stack_add_client(auth_stack_t *stack,
void *userdata);
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_addref(auth_stack_t *stack);
......
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