chiark / gitweb /
Merge disorder.userman branch
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 20 Apr 2008 15:01:45 +0000 (16:01 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 20 Apr 2008 15:01:45 +0000 (16:01 +0100)
CHANGES
configure.ac
debian/control
debian/prerm.disorder-server
lib/Makefile.am
lib/mime.c
lib/t-cookies.c
lib/trackdb-stub.c [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index e1909eb2e457ceef1d31295f2a5e78de8ce5388e..773115330e041288ee788b7ec30701b1c04756b9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,17 @@ This has been completely rewritten to support new features:
 There is now a new user management window.  From here you can add and
 remove users or modify their settings.
 
+* Changes up to version 3.0.2
+
+Builds --without-server should work again.
+
+The web interface is a bit more liberal in the cookie value syntax it
+will accept.
+
+* Changes up to version 3.0.1
+
+Debian upgrades from 2.0.x should now work better.
+
 * Changes up to version 3.0
 
 Important!  See README.upgrades when upgrading.
index e3e836487d2d638411bb2c23cc0c0e883b59eb24..1de3613ff903daa6601b4a0294fa0b0a51ab4d5e 100644 (file)
@@ -455,6 +455,8 @@ if test $want_server = yes; then
   fi
 fi
 
+AM_CONDITIONAL([SERVER], [test x$want_server = xyes])
+
 if test "x$GCC" = xyes; then
   # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
   AC_CACHE_CHECK([checking for GCC bug 29478],[rjk_cv_pr29478],[
index aa63349c12bfc967b76ae7ca51cc02a3eb84b7ee..0054b60ad91b9ea0f320d3d4206a401e5446c97e 100644 (file)
@@ -26,7 +26,7 @@ Package: disorder-server
 Architecture: any
 Section: sound
 Priority: extra
-Depends: disorder,httpd-cgi,sox,debconf,mktemp,${shlibs:Depends}
+Depends: disorder,httpd-cgi,sox,debconf,${shlibs:Depends}
 Suggests: disorder-playrtp,disobedience
 Description: Play random or selected digital audio files continuously
  DisOrder is a software jukebox.  It can play OGG, MP3, WAV and FLAC files,
index 0e65ed61d83c9353ca4d0a1ab6bb4eebcc2ab1b0..394afcdb5367f90d467a6397eda2a67d3a85af9e 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 #
 # This file is part of DisOrder
-# Copyright (C) 2004 Richard Kettlewell
+# Copyright (C) 2008 Richard Kettlewell
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA
 #
-set -e
-/etc/init.d/disorder stop
+set -
+case "$1" in
+upgrade )
+  /etc/init.d/disorder stop
+  ;;
+failed-upgrade )
+  # Upgrading from 2.0 to 3.0.x can provoke this problem.  The 2.0
+  # init script attempts to run disorder(1) but that isn't ready to go
+  # get as users.db has not been created.  Therefore old-prerm upgrade
+  # fails and dpkg tries new-prerm failed-upgrade instead.
+  start-stop-daemon -K -q -n disorderd
+  ;;
+esac
index 7f225bdec8e0c7837de833bc65301e3e9ea430bd..ecd106f43272299e1f12ae03b80626eaad69220f 100644 (file)
@@ -22,6 +22,12 @@ noinst_LIBRARIES=libdisorder.a
 include_HEADERS=disorder.h
 noinst_PROGRAMS=test
 
+if SERVER
+TRACKDB=trackdb.c
+else
+TRACKDB=trackdb-stub.c
+endif
+
 libdisorder_a_SOURCES=charset.c charset.h              \
        addr.c addr.h                                   \
        alsabg.c alsabg.h                               \
@@ -68,7 +74,7 @@ libdisorder_a_SOURCES=charset.c charset.h             \
        types.h                                         \
        table.c table.h                                 \
        timeval.h                                       \
-       trackdb.h trackdb.c trackdb-int.h               \
+       $(TRACKDB) trackdb.h trackdb-int.h              \
        trackname.c trackname.h                         \
        url.h url.c                                     \
        user.h user.c                                   \
@@ -134,3 +140,5 @@ rebuild-unicode:
        mv $@.new $@
 
 CLEANFILES=definitions.h definitions.h.new
+
+EXTRA_DIST=trackdb.c trackdb-stub.c
index 78a8bd36f181deec957c352b74f5a1e9ad5893f7..da41426a3abfb51cd9f9034f787f975b0ce839df 100644 (file)
@@ -527,6 +527,26 @@ static int cookie_separator(int c) {
   }
 }
 
+/** @brief Match cookie value separator characters
+ *
+ * Same as cookie_separator() but allows for @c = in cookie values.
+ */
+static int cookie_value_separator(int c) {
+  switch(c) {
+  case '(':
+  case ')':
+  case ',':
+  case ';':
+  case ' ':
+  case '"':
+  case '\t':
+    return 1;
+
+  default:
+    return 0;
+  }
+}
+
 /** @brief Parse a RFC2109 Cookie: header
  * @param s Header field value
  * @param cd Where to store result
@@ -557,7 +577,7 @@ int parse_cookie(const char *s,
       return -1;
     }
     s = skipwhite(s, 0);
-    if(!(s = mime_parse_word(s, &v, cookie_separator))) {
+    if(!(s = mime_parse_word(s, &v, cookie_value_separator))) {
       error(0, "parse_cookie: cannot parse value for '%s'", n);
       return -1;
     }
index 89e92878d091cbd6a10a77106929f67a348cd36c..7fdde3272d58b3a94386720e21e039c64acecd90 100644 (file)
@@ -27,7 +27,7 @@ void test_cookies(void) {
   /* These are the examples from RFC2109 */
   insist(!parse_cookie("$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"", cd));
   insist(!strcmp(cd->version, "1"));
-  insist(cd->ncookies = 1);
+  insist(cd->ncookies == 1);
   insist(find_cookie(cd, "Customer") == &cd->cookies[0]);
   check_string(cd->cookies[0].value, "WILE_E_COYOTE");
   check_string(cd->cookies[0].path, "/acme");
@@ -36,7 +36,7 @@ void test_cookies(void) {
                        "Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\";\n"
                        "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"",
                        cd));
-  insist(cd->ncookies = 2);
+  insist(cd->ncookies == 2);
   insist(find_cookie(cd, "Customer") == &cd->cookies[0]);
   insist(find_cookie(cd, "Part_Number") == &cd->cookies[1]);
   check_string(cd->cookies[0].value, "WILE_E_COYOTE");
@@ -50,7 +50,7 @@ void test_cookies(void) {
                        "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\";\n"
                        "Shipping=\"FedEx\"; $Path=\"/acme\"",
                        cd));
-  insist(cd->ncookies = 3);
+  insist(cd->ncookies == 3);
   insist(find_cookie(cd, "Customer") == &cd->cookies[0]);
   insist(find_cookie(cd, "Part_Number") == &cd->cookies[1]);
   insist(find_cookie(cd, "Shipping") == &cd->cookies[2]);
@@ -63,6 +63,13 @@ void test_cookies(void) {
   check_string(cd->cookies[2].value, "FedEx");
   check_string(cd->cookies[2].path, "/acme");
   insist(cd->cookies[2].domain == 0);
+
+  insist(!parse_cookie("BX=brqn3il3r9jro&b=3&s=vv", cd));
+  insist(cd->ncookies == 1);
+  insist(find_cookie(cd, "BX") == &cd->cookies[0]);
+  check_string(cd->cookies[0].value, "brqn3il3r9jro&b=3&s=vv");
+  insist(cd->cookies[0].path == 0);
+  insist(cd->cookies[0].domain == 0);
 }
 
 /*
diff --git a/lib/trackdb-stub.c b/lib/trackdb-stub.c
new file mode 100644 (file)
index 0000000..22174d3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * This file is part of DisOrder
+ * Copyright (C) 2008 Richard Kettlewell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+/** @file lib/trackdb-stub.c
+ * @brief Track database stubs
+ *
+ * Stubs for non-server builds
+ */
+
+#include <config.h>
+#include "types.h"
+
+#include <pcre.h>
+
+#include "rights.h"
+#include "trackdb.h"
+
+const char *trackdb_get_password(const char attribute((unused)) *user)  {
+  return NULL;
+}
+
+void trackdb_close(void) {
+}
+
+void trackdb_open(int attribute((unused)) flags) {
+}
+
+void trackdb_init(int attribute((unused)) flags) {
+}
+
+/*
+Local Variables:
+c-basic-offset:2
+comment-column:40
+fill-column:79
+indent-tabs-mode:nil
+End:
+*/