[xiph-commits] r14788 - icecast/trunk/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Tue Apr 22 19:48:54 PDT 2008
Author: karl
Date: 2008-04-22 19:48:53 -0700 (Tue, 22 Apr 2008)
New Revision: 14788
Modified:
icecast/trunk/icecast/src/auth.c
icecast/trunk/icecast/src/auth_htpasswd.c
Log:
htpasswd auth should apply even if no filename is specified, just reject all
new listeners with the reason logged. auth_t refcount was getting out of sync
which is a potential small memory leak.
Modified: icecast/trunk/icecast/src/auth.c
===================================================================
--- icecast/trunk/icecast/src/auth.c 2008-04-23 01:45:38 UTC (rev 14787)
+++ icecast/trunk/icecast/src/auth.c 2008-04-23 02:48:53 UTC (rev 14788)
@@ -195,15 +195,25 @@
{
DEBUG0 ("listener is no longer connected");
client->respcode = 400;
+ auth_release (client->auth);
+ client->auth = NULL;
return;
}
if (auth->authenticate)
{
if (auth->authenticate (auth_user) != AUTH_OK)
+ {
+ auth_release (client->auth);
+ client->auth = NULL;
return;
+ }
}
if (auth_postprocess_listener (auth_user) < 0)
+ {
+ auth_release (client->auth);
+ client->auth = NULL;
INFO1 ("client %lu failed", client->con->id);
+ }
}
Modified: icecast/trunk/icecast/src/auth_htpasswd.c
===================================================================
--- icecast/trunk/icecast/src/auth_htpasswd.c 2008-04-23 01:45:38 UTC (rev 14787)
+++ icecast/trunk/icecast/src/auth_htpasswd.c 2008-04-23 02:48:53 UTC (rev 14788)
@@ -185,6 +185,11 @@
if (client->username == NULL || client->password == NULL)
return AUTH_FAILED;
+ if (htpasswd->filename == NULL)
+ {
+ ERROR0("No filename given in options for authenticator.");
+ return AUTH_FAILED;
+ }
htpasswd_recheckfile (htpasswd);
thread_rwlock_rlock (&htpasswd->file_rwlock);
@@ -225,19 +230,20 @@
while(options) {
if(!strcmp(options->name, "filename"))
+ {
+ free (state->filename);
state->filename = strdup(options->value);
+ }
options = options->next;
}
- if(!state->filename) {
- free(state);
+ if (state->filename)
+ INFO1("Configured htpasswd authentication using password file \"%s\"",
+ state->filename);
+ else
ERROR0("No filename given in options for authenticator.");
- return -1;
- }
authenticator->state = state;
- DEBUG1("Configured htpasswd authentication using password file %s",
- state->filename);
thread_rwlock_create(&state->file_rwlock);
htpasswd_recheckfile (state);
More information about the commits
mailing list