Commit fe0e17db authored by Karl Heyes's avatar Karl Heyes

fix bug #1141

svn path=/icecast/trunk/icecast/; revision=13595
parent 176b9f7e
...@@ -516,7 +516,7 @@ int auth_release_listener (client_t *client) ...@@ -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) ...@@ -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) ...@@ -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)
{ {
......
...@@ -17,7 +17,7 @@ ...@@ -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
......
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