[xiph-commits] r9867 - icecast/trunk/icecast/src

msmith at svn.xiph.org msmith at svn.xiph.org
Tue Aug 30 13:29:22 PDT 2005


Author: msmith
Date: 2005-08-30 13:29:20 -0700 (Tue, 30 Aug 2005)
New Revision: 9867

Modified:
   icecast/trunk/icecast/src/auth_htpasswd.c
Log:
Fix bug reported by Jason at weatherserver.net - don't crash in htpasswd auth
if the auth file doesn't exist.


Modified: icecast/trunk/icecast/src/auth_htpasswd.c
===================================================================
--- icecast/trunk/icecast/src/auth_htpasswd.c	2005-08-30 19:03:40 UTC (rev 9866)
+++ icecast/trunk/icecast/src/auth_htpasswd.c	2005-08-30 20:29:20 UTC (rev 9867)
@@ -129,8 +129,16 @@
     if (stat (htpasswd->filename, &file_stat) < 0)
     {
         WARN1 ("failed to check status of %s", htpasswd->filename);
+
+        /* Create a dummy users tree for things to use later */
+        thread_rwlock_wlock (&htpasswd->file_rwlock);
+        if(!htpasswd->users)
+            htpasswd->users = avl_tree_new(compare_users, NULL);
+        thread_rwlock_unlock (&htpasswd->file_rwlock);
+
         return;
     }
+
     if (file_stat.st_mtime == htpasswd->mtime)
     {
         /* common case, no update to file */



More information about the commits mailing list