From: Richard Kettlewell Date: Sun, 7 Aug 2011 17:26:34 +0000 (+0100) Subject: server: docs: remove deprecated configuration and user upgrade. X-Git-Tag: branchpoint-5.1~21 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/657fdb79cbec1dba609675200797415978a50315 server: docs: remove deprecated configuration and user upgrade. User upgrade code has been removed. allow, restrict and trust only affected the user upgrade code. They are now removed completely. prefsync and lock have been non-functional for years. --wait-for-device and gap, both ugly hacks, were still functional but long-since deprecated. --- diff --git a/CHANGES.html b/CHANGES.html index 75a9ef4..df19347 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -68,6 +68,24 @@ href="README.upgrades.html">README.upgrades before upgrading.

href="http://www.unicode.org/versions/Unicode6.0.0/">Unicode 6.0.0.

+

The following have been removed:

+ + +

Various minor bug fixes.

diff --git a/README.upgrades.html b/README.upgrades.html index 842cf40..c628b06 100644 --- a/README.upgrades.html +++ b/README.upgrades.html @@ -144,6 +144,8 @@
  • trust
  • +

    (As of 5.1 these options are completely gone.)

    +

    3.0 -> 4.x

    If you customized any of the templates, you will pretty much have to @@ -180,6 +182,10 @@ version but for now they will generate harmless error messages. Remove them and the error messages will go away.

    +

    (Note: these options, and the code for upgrading old users, has been + removed entirely in release 5.1. You must either manually re-create your + users, or upgrade via 5.0.3.)

    +

    See README for new setup instructions for the web interface.

    Other Server Configuration

    diff --git a/cgi/actions.c b/cgi/actions.c index 584da76..6e18098 100644 --- a/cgi/actions.c +++ b/cgi/actions.c @@ -76,14 +76,13 @@ static void act_playing(void) { && dcgi_playing->sofar >= 0) { /* Try to put the next refresh at the start of the next track. */ xtime(&now); - fin = now + length - dcgi_playing->sofar + config->gap; + fin = now + length - dcgi_playing->sofar; if(now + refresh > fin) refresh = fin - now; } if(dcgi_queue && dcgi_queue->origin == origin_scratch) { - /* next track is a scratch, don't leave more than the inter-track gap */ - if(refresh > config->gap) - refresh = config->gap; + /* next track is a scratch, refresh immediately */ + refresh = 0; } if(!dcgi_playing && ((dcgi_queue @@ -91,9 +90,8 @@ static void act_playing(void) { || dcgi_random_enabled) && dcgi_enabled) { /* no track playing but playing is enabled and there is something coming - * up, must be in a gap */ - if(refresh > config->gap) - refresh = config->gap; + * up, so refresh immediately */ + refresh = 0; } /* Bound the refresh interval below as a back-stop against the above * calculations coming up with a stupid answer */ diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index e16e762..68ae601 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -398,8 +398,7 @@ For the possible values see .B "Users And Access Control" above. .IP -The default is to allow everything except \fBadmin\fR and \fBregister\fR -(modified in legacy configurations by the obsolete \fBrestrict\fR directive). +The default is to allow everything except \fBadmin\fR and \fBregister\fR. .TP .B device \fINAME\fR Sound output device. @@ -420,9 +419,6 @@ Remember to quote the name. The default is \fBdefault\fR, which is intended to map to whatever the system's default is. .TP -.B gap \fISECONDS\fR -This option no longer does anything and will be removed in a future version. -.TP .B history \fIINTEGER\fR Specifies the number of recently played tracks to remember (including failed tracks and scratches). @@ -441,9 +437,6 @@ Note that IPv6 is not currently well tested. .IP Normally the server only listens on a UNIX domain socket. .TP -.B lock yes\fR|\fBno -This option no longer does anything and will be removed in a future version. -.TP .B mixer \fIDEVICE\fR The mixer device name, if it needs to be specified separately from \fBdevice\fR. @@ -585,14 +578,6 @@ Specifies the player for files matching the glob \fIPATTERN\fR. The following options are supported: .RS .TP -.B \-\-wait\-for\-device\fR[\fB=\fIDEVICE\fR] -\fBThis option is deprecated\fR. -If you want gapless play use raw-format players and the speaker process instead. -(This the default in any case.) -.IP -Waits (for up to a couple of seconds) for the default, or specified, libao -device to become openable. -.TP .B \-\- Defines the end of the list of options. Needed if the first argument to the plugin starts with a "\-". @@ -641,9 +626,6 @@ Although players can be changed during the lifetime of the server, note that background decoders will not be stopped and restarted using changed configuration once they have been started. .TP -.B prefsync \fISECONDS\fR -This option no longer does anything and will be removed in a future version. -.TP .B queue_pad \fICOUNT\fR The target size of the queue. If random play is enabled then randomly picked tracks will be added until diff --git a/lib/configuration.c b/lib/configuration.c index 932c54b..4f21d25 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -323,33 +323,6 @@ static int set_string_accum(const struct config_state *cs, return 0; } -static int set_restrict(const struct config_state *cs, - const struct conf *whoami, - int nvec, char **vec) { - unsigned r = 0; - int n, i; - - static const struct restriction { - const char *name; - unsigned bit; - } restrictions[] = { - { "remove", RESTRICT_REMOVE }, - { "scratch", RESTRICT_SCRATCH }, - { "move", RESTRICT_MOVE }, - }; - - for(n = 0; n < nvec; ++n) { - if((i = TABLE_FIND(restrictions, name, vec[n])) < 0) { - disorder_error(0, "%s:%d: invalid restriction '%s'", - cs->path, cs->line, vec[n]); - return -1; - } - r |= restrictions[i].bit; - } - VALUE(cs->config, unsigned) = r; - return 0; -} - static int parse_sample_format(const struct config_state *cs, struct stream_header *format, int nvec, char **vec) { @@ -640,7 +613,6 @@ static const struct conftype type_stringlist_accum = { set_stringlist_accum, free_stringlistlist }, type_string_accum = { set_string_accum, free_stringlist }, type_sample_format = { set_sample_format, free_none }, - type_restrict = { set_restrict, free_none }, type_namepart = { set_namepart, free_namepartlist }, type_transform = { set_transform, free_transformlist }, type_netaddress = { set_netaddress, free_netaddress }, @@ -750,24 +722,6 @@ static int validate_tracklength(const struct config_state *cs, return 0; } -/** @brief Validate an allow directive - * @param cs Configuration state - * @param nvec Length of (proposed) new value - * @param vec Elements of new value - * @return 0 on success, non-0 on error - * - * Obsolete - only used for parsing legacy configuration. - */ -static int validate_allow(const struct config_state *cs, - int nvec, - char attribute((unused)) **vec) { - if(nvec != 2) { - disorder_error(0, "%s:%d: must be 'allow NAME PASS'", cs->path, cs->line); - return -1; - } - return 0; -} - /** @brief Validate a non-negative (@c long) integer * @param cs Configuration state * @param nvec Length of (proposed) new value @@ -1057,7 +1011,6 @@ static int validate_destaddr(const struct config_state attribute((unused)) *cs, /** @brief All configuration items */ static const struct conf conf[] = { { C(alias), &type_string, validate_alias }, - { C(allow), &type_stringlist_accum, validate_allow }, { C(api), &type_string, validate_backend }, { C(authorization_algorithm), &type_string, validate_algo }, { C(broadcast), &type_netaddress, validate_destaddr }, @@ -1072,11 +1025,9 @@ static const struct conf conf[] = { { C(dbversion), &type_integer, validate_positive }, { C(default_rights), &type_rights, validate_any }, { C(device), &type_string, validate_any }, - { C(gap), &type_integer, validate_non_negative }, { C(history), &type_integer, validate_positive }, { C(home), &type_string, validate_isabspath }, { C(listen), &type_netaddress, validate_any }, - { C(lock), &type_boolean, validate_any }, { C(mail_sender), &type_string, validate_any }, { C(mixer), &type_string, validate_any }, { C(mount_rescan), &type_boolean, validate_any }, @@ -1097,14 +1048,12 @@ static const struct conf conf[] = { { C(playlist_lock_timeout), &type_integer, validate_positive }, { C(playlist_max) , &type_integer, validate_positive }, { C(plugins), &type_string_accum, validate_isdir }, - { C(prefsync), &type_integer, validate_positive }, { C(queue_pad), &type_integer, validate_positive }, { C(refresh), &type_integer, validate_positive }, { C(refresh_min), &type_integer, validate_non_negative }, { C(reminder_interval), &type_integer, validate_positive }, { C(remote_userman), &type_boolean, validate_any }, { C(replay_min), &type_integer, validate_non_negative }, - { C2(restrict, restrictions), &type_restrict, validate_any }, { C(rtp_delay_threshold), &type_integer, validate_positive }, { C(rtp_verbose), &type_boolean, validate_any }, { C(sample_format), &type_sample_format, validate_sample_format }, @@ -1120,7 +1069,6 @@ static const struct conf conf[] = { { C(templates), &type_string_accum, validate_isdir }, { C(tracklength), &type_stringlist_accum, validate_tracklength }, { C(transform), &type_transform, validate_any }, - { C(trust), &type_string_accum, validate_any }, { C(url), &type_string, validate_url }, { C(user), &type_string, validate_isauser }, { C(username), &type_string, validate_any }, @@ -1333,7 +1281,6 @@ static struct config *config_default(void) { cs.line = 0; cs.config = c; /* Strings had better be xstrdup'd as they will get freed at some point. */ - c->gap = 0; c->history = 60; c->home = xstrdup(pkgstatedir); if(!(pw = getpwuid(getuid()))) @@ -1342,10 +1289,8 @@ static struct config *config_default(void) { c->username = xstrdup(logname); c->refresh = 15; c->refresh_min = 1; - c->prefsync = 0; c->signal = SIGKILL; c->alias = xstrdup("{/artist}{/album}{/title}{ext}"); - c->lock = 1; c->device = xstrdup("default"); c->nice_rescan = 10; c->speaker_command = 0; @@ -1514,18 +1459,7 @@ static void config_postdefaults(struct config *c, |RIGHT_MOVE__MASK |RIGHT_SCRATCH__MASK |RIGHT_REMOVE__MASK); - /* The idea is to approximate the meaning of the old 'restrict' directive - * in the default rights if they are not overridden. */ - if(c->restrictions & RESTRICT_SCRATCH) - r |= RIGHT_SCRATCH_MINE|RIGHT_SCRATCH_RANDOM; - else - r |= RIGHT_SCRATCH_ANY; - if(!(c->restrictions & RESTRICT_MOVE)) - r |= RIGHT_MOVE_ANY; - if(c->restrictions & RESTRICT_REMOVE) - r |= RIGHT_REMOVE_MINE; - else - r |= RIGHT_REMOVE_ANY; + r |= RIGHT_SCRATCH_ANY|RIGHT_MOVE_ANY|RIGHT_REMOVE_ANY; c->default_rights = rights_string(r); } } @@ -1612,18 +1546,6 @@ int config_read(int server, /* everything is good so we shall use the new config */ config_free(config); /* warn about obsolete directives */ - if(c->restrictions) - disorder_error(0, "'restrict' will be removed in a future version"); - if(c->allow.n) - disorder_error(0, "'allow' will be removed in a future version"); - if(c->trust.n) - disorder_error(0, "'trust' will be removed in a future version"); - if(!c->lock) - disorder_error(0, "'lock' will be removed in a future version"); - if(c->gap) - disorder_error(0, "'gap' will be removed in a future version"); - if(c->prefsync) - disorder_error(0, "'prefsync' will be removed in a future version"); config = c; return 0; } diff --git a/lib/configuration.h b/lib/configuration.h index 63c82c8..ed6d3f1 100644 --- a/lib/configuration.h +++ b/lib/configuration.h @@ -112,24 +112,15 @@ struct config { /** @brief All tracklength plugins */ struct stringlistlist tracklength; - /** @brief Allowed users */ - struct stringlistlist allow; - /** @brief Scratch tracks */ struct stringlist scratch; - /** @brief Gap between tracks in seconds */ - long gap; - /** @brief Maximum number of recent tracks to record in history */ long history; /** @brief Expiry limit for noticed.db */ long noticed_history; - /** @brief Trusted users */ - struct stringlist trust; - /** @brief User for server to run as */ const char *user; @@ -157,17 +148,12 @@ struct config { /** @brief Mixer channel to use */ char *channel; - long prefsync; /* preflog sync interval */ - /** @brief Secondary listen address */ struct netaddress listen; /** @brief Alias format string */ const char *alias; - /** @brief Enable server locking */ - int lock; - /** @brief Nice value for server */ long nice_server; @@ -222,16 +208,6 @@ struct config { /** @brief Minimum refresh interval for web interface (seconds) */ long refresh_min; - /** @brief Facilities restricted to trusted users - * - * A bitmap of @ref RESTRICT_SCRATCH, @ref RESTRICT_REMOVE and @ref - * RESTRICT_MOVE. - */ - unsigned restrictions; /* restrictions */ -#define RESTRICT_SCRATCH 1 /**< Restrict scratching */ -#define RESTRICT_REMOVE 2 /**< Restrict removal */ -#define RESTRICT_MOVE 4 /**< Restrict rearrangement */ - /** @brief Target queue length */ long queue_pad; diff --git a/lib/trackdb.c b/lib/trackdb.c index 7be53c1..aa9ad56 100644 --- a/lib/trackdb.c +++ b/lib/trackdb.c @@ -3005,21 +3005,6 @@ void trackdb_gc(void) { /* user database *************************************************************/ -/** @brief Return true if @p user is trusted - * @param user User to look up - * @return Nonzero if they are in the 'trusted' list - * - * Now used only in upgrade from old versions. - */ -static int trusted(const char *user) { - int n; - - for(n = 0; (n < config->trust.n - && strcmp(config->trust.s[n], user)); ++n) - ; - return n < config->trust.n; -} - /** @brief Add a user * @param user Username * @param password Initial password or NULL @@ -3096,41 +3081,6 @@ static int one_old_user(const char *user, const char *password, tid, DB_NOOVERWRITE); } -/** @brief Upgrade old users - * @param tid Owning transaction - * @return 0 or DB_LOCK_DEADLOCK - */ -static int trackdb_old_users_tid(DB_TXN *tid) { - int n; - - for(n = 0; n < config->allow.n; ++n) { - switch(one_old_user(config->allow.s[n].s[0], config->allow.s[n].s[1], - tid)) { - case 0: - disorder_info("created user %s from 'allow' directive", - config->allow.s[n].s[0]); - break; - case DB_KEYEXIST: - disorder_error(0, "user %s already exists, delete 'allow' directive", - config->allow.s[n].s[0]); - /* This won't ever become fatal - eventually 'allow' will be - * disabled. */ - break; - case DB_LOCK_DEADLOCK: - return DB_LOCK_DEADLOCK; - } - } - return 0; -} - -/** @brief Read old 'allow' directives and copy them to the users database */ -void trackdb_old_users(void) { - int e; - - if(config->allow.n) - WITH_TRANSACTION(trackdb_old_users_tid(tid)); -} - /** @brief Create a root user in the user database if there is none */ void trackdb_create_root(void) { int e; diff --git a/lib/trackdb.h b/lib/trackdb.h index a37c81b..1a74bb7 100644 --- a/lib/trackdb.h +++ b/lib/trackdb.h @@ -159,7 +159,6 @@ const char *trackdb_get_global(const char *name); char **trackdb_new(int *ntracksp, int maxtracks); void trackdb_expire_noticed(time_t when); -void trackdb_old_users(void); void trackdb_create_root(void); const char *trackdb_get_password(const char *user); int trackdb_adduser(const char *user, diff --git a/server/background.c b/server/background.c index 4901047..3a56bce 100644 --- a/server/background.c +++ b/server/background.c @@ -70,19 +70,9 @@ int play_background(ev_source *ev, --optc; break; } - if(!strcmp(optv[0], "--wait-for-device") - || !strncmp(optv[0], "--wait-for-device=", 18)) { - const char *waitdevice; - if((waitdevice = strchr(optv[0], '='))) { - params->waitdevice = waitdevice + 1; - } else - params->waitdevice = ""; /* use default */ - ++optv; - --optc; - } else { - disorder_error(0, "unknown option %s", optv[0]); - return START_HARDFAIL; - } + /* Currently no options supported */ + disorder_error(0, "unknown option %s", optv[0]); + return START_HARDFAIL; } params->argc = optc; params->argv = optv; diff --git a/server/disorder-server.h b/server/disorder-server.h index bc90c9b..a110aa6 100644 --- a/server/disorder-server.h +++ b/server/disorder-server.h @@ -348,8 +348,6 @@ struct pbgc_params { int argc; /** @brief Player command */ const char **argv; - /** @brief Device to wait for or NULL */ - const char *waitdevice; /** @brief Raw track name */ const char *rawpath; }; diff --git a/server/disorderd.c b/server/disorderd.c index 3e1ab44..af8347a 100644 --- a/server/disorderd.c +++ b/server/disorderd.c @@ -278,8 +278,6 @@ int main(int argc, char **argv) { recent_read(); /* Arrange timeouts for schedule actions */ schedule_init(ev); - /* pull in old users */ - trackdb_old_users(); /* create a root login */ trackdb_create_root(); /* create sockets */ diff --git a/server/play.c b/server/play.c index 9b919d1..b6d3dcc 100644 --- a/server/play.c +++ b/server/play.c @@ -340,33 +340,6 @@ static int start_child(struct queue_entry *q, void attribute((unused)) *bgdata) { int n; - /* Wait for a device to clear. This ugliness is now deprecated and will - * eventually be removed. */ - if(params->waitdevice) { - ao_initialize(); - if(*params->waitdevice) { - n = ao_driver_id(params->waitdevice); - if(n == -1) - disorder_fatal(0, "invalid libao driver: %s", params->waitdevice); - } else - n = ao_default_driver_id(); - /* Make up a format. */ - ao_sample_format format; - memset(&format, 0, sizeof format); - format.bits = 8; - format.rate = 44100; - format.channels = 1; - format.byte_format = AO_FMT_NATIVE; - int retries = 20; - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 100000000; /* 0.1s */ - ao_device *device; - while((device = ao_open_live(n, &format, 0)) == 0 && retries-- > 0) - nanosleep(&ts, 0); - if(device) - ao_close(device); - } /* Play the track */ play_track(q->pl, params->argv, params->argc, diff --git a/server/server.c b/server/server.c index 1169e2f..44c3a87 100644 --- a/server/server.c +++ b/server/server.c @@ -634,7 +634,7 @@ static int c_queue(struct conn *c, if((l = trackdb_get(playing->track, "_length")) && (length = atol(l))) { xtime(&when); - when += length - playing->sofar + config->gap; + when += length - playing->sofar; } } else /* Nothing is playing but playing is enabled, so whatever is @@ -649,7 +649,7 @@ static int c_queue(struct conn *c, if(when) { if((l = trackdb_get(q->track, "_length")) && (length = atol(l))) - when += length + config->gap; + when += length; else when = 0; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 5563f7f..a964b11 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,7 +25,7 @@ disorder_udplog_LDADD=$(LIBOBJS) ../lib/libdisorder.a $(LIBGC) disorder_udplog_DEPENDENCIES=../lib/libdisorder.a TESTS=cookie.py dbversion.py dump.py files.py play.py queue.py \ - recode.py search.py user-upgrade.py user.py aliases.py \ + recode.py search.py user.py aliases.py \ schedule.py hashes.py playlists.py TESTS_ENVIRONMENT=${PYTHON} -u diff --git a/tests/dtest.py b/tests/dtest.py index a5a8be9..74a7eb8 100644 --- a/tests/dtest.py +++ b/tests/dtest.py @@ -170,7 +170,6 @@ def default_config(encoding="UTF-8"): """home %s/home collection fs %s %s/tracks scratch %s/scratch.ogg -gap 0 queue_pad 5 stopword 01 02 03 04 05 06 07 08 09 10 stopword 1 2 3 4 5 6 7 8 9 diff --git a/tests/user-upgrade.py b/tests/user-upgrade.py deleted file mode 100755 index 019c4c9..0000000 --- a/tests/user-upgrade.py +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/env python -# -# This file is part of DisOrder. -# Copyright (C) 2007, 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 3 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, see . -# -import dtest,disorder - -def test(): - """Test upgrade to new user database""" - print " testing upgrade from old versions" - open("%s/config" % dtest.testroot, "a").write( - """allow fred fredpass -trust fred -""") - dtest.start_daemon() - print " checking can log in after upgrade" - c = disorder.client() - c.version() - dtest.stop_daemon() - dtest.default_config() - dtest.start_daemon() - print " checking can log in after removing 'allow'" - c = disorder.client() - c.version() - -if __name__ == '__main__': - dtest.run()