[xiph-commits] r13595 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Thu Aug 23 09:58:18 PDT 2007
Author: karl
Date: 2007-08-23 09:58:18 -0700 (Thu, 23 Aug 2007)
New Revision: 13595
Modified:
icecast/trunk/icecast/src/auth.c
icecast/trunk/icecast/src/auth_htpasswd.h
Log:
fix bug #1141
Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c 2007-08-23 16:40:06 UTC (rev 13594)
+++ icecast/trunk/icecast/src/auth.c 2007-08-23 16:58:18 UTC (rev 13595)
@@ -516,7 +516,7 @@
}
-static void get_authenticator (auth_t *auth, config_options_t *options)
+static int get_authenticator (auth_t *auth, config_options_t *options)
{
do
{
@@ -525,29 +525,31 @@
if (strcmp (auth->type, "url") == 0)
{
#ifdef HAVE_AUTH_URL
- auth_get_url_auth (auth, options);
+ if (auth_get_url_auth (auth, options) < 0)
+ return -1;
#else
ERROR0 ("Auth URL disabled");
+ return -1;
#endif
- break;
}
if (strcmp (auth->type, "htpasswd") == 0)
{
- auth_get_htpasswd_auth (auth, options);
+ if (auth_get_htpasswd_auth (auth, options) < 0)
+ return -1;
break;
}
-
+
ERROR1("Unrecognised authenticator type: \"%s\"", auth->type);
- return;
+ return -1;
} while (0);
- auth->refcount = 1;
while (options)
{
if (strcmp(options->name, "allow_duplicate_users") == 0)
auth->allow_duplicate_users = atoi (options->value);
options = options->next;
}
+ return 0;
}
@@ -589,13 +591,21 @@
WARN1 ("unknown auth setting (%s)", current->name);
}
auth->type = xmlGetProp (node, "type");
- get_authenticator (auth, options);
- auth->tailp = &auth->head;
- thread_mutex_create (&auth->lock);
+ if (get_authenticator (auth, options) < 0)
+ {
+ xmlFree (auth->type);
+ free (auth);
+ auth = NULL;
+ }
+ 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);
+ }
- auth->running = 1;
- auth->thread = thread_create ("auth thread", auth_run_thread, auth, THREAD_ATTACHED);
-
while (options)
{
config_options_t *opt = options;
Modified: icecast/trunk/icecast/src/auth_htpasswd.h
===================================================================
--- icecast/trunk/icecast/src/auth_htpasswd.h 2007-08-23 16:40:06 UTC (rev 13594)
+++ icecast/trunk/icecast/src/auth_htpasswd.h 2007-08-23 16:58:18 UTC (rev 13595)
@@ -17,7 +17,7 @@
#include <config.h>
#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
More information about the commits
mailing list