1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00
svn path=/icecast/trunk/icecast/; revision=13595
This commit is contained in:
Karl Heyes 2007-08-23 16:58:18 +00:00
parent 176b9f7eca
commit fe0e17dbaa
2 changed files with 24 additions and 14 deletions

View File

@ -516,7 +516,7 @@ int auth_release_listener (client_t *client)
} }
static void get_authenticator (auth_t *auth, config_options_t *options) static int get_authenticator (auth_t *auth, config_options_t *options)
{ {
do do
{ {
@ -525,29 +525,31 @@ static void get_authenticator (auth_t *auth, config_options_t *options)
if (strcmp (auth->type, "url") == 0) if (strcmp (auth->type, "url") == 0)
{ {
#ifdef HAVE_AUTH_URL #ifdef HAVE_AUTH_URL
auth_get_url_auth (auth, options); if (auth_get_url_auth (auth, options) < 0)
return -1;
#else #else
ERROR0 ("Auth URL disabled"); ERROR0 ("Auth URL disabled");
return -1;
#endif #endif
break;
} }
if (strcmp (auth->type, "htpasswd") == 0) if (strcmp (auth->type, "htpasswd") == 0)
{ {
auth_get_htpasswd_auth (auth, options); if (auth_get_htpasswd_auth (auth, options) < 0)
return -1;
break; break;
} }
ERROR1("Unrecognised authenticator type: \"%s\"", auth->type); ERROR1("Unrecognised authenticator type: \"%s\"", auth->type);
return; return -1;
} while (0); } while (0);
auth->refcount = 1;
while (options) while (options)
{ {
if (strcmp(options->name, "allow_duplicate_users") == 0) if (strcmp(options->name, "allow_duplicate_users") == 0)
auth->allow_duplicate_users = atoi (options->value); auth->allow_duplicate_users = atoi (options->value);
options = options->next; options = options->next;
} }
return 0;
} }
@ -589,12 +591,20 @@ auth_t *auth_get_authenticator (xmlNodePtr node)
WARN1 ("unknown auth setting (%s)", current->name); WARN1 ("unknown auth setting (%s)", current->name);
} }
auth->type = xmlGetProp (node, "type"); auth->type = xmlGetProp (node, "type");
get_authenticator (auth, options); if (get_authenticator (auth, options) < 0)
auth->tailp = &auth->head; {
thread_mutex_create (&auth->lock); xmlFree (auth->type);
free (auth);
auth->running = 1; auth = NULL;
auth->thread = thread_create ("auth thread", auth_run_thread, auth, THREAD_ATTACHED); }
else
{
auth->tailp = &auth->head;
thread_mutex_create (&auth->lock);
auth->refcount = 1;
auth->running = 1;
auth->thread = thread_create ("auth thread", auth_run_thread, auth, THREAD_ATTACHED);
}
while (options) while (options)
{ {

View File

@ -17,7 +17,7 @@
#include <config.h> #include <config.h>
#endif #endif
void auth_get_htpasswd_auth (auth_t *auth, config_options_t *options); int auth_get_htpasswd_auth (auth_t *auth, config_options_t *options);
#endif #endif