chiark / gitweb /
By default, disable user management over TCP (since it tends to have
authorRichard Kettlewell <rjk@greenend.org.uk>
Tue, 22 Apr 2008 17:59:32 +0000 (18:59 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Tue, 22 Apr 2008 17:59:32 +0000 (18:59 +0100)
passwords in it).  The remote_userman configuration directive can be
used to re-enable it.

CHANGES
doc/disorder_config.5.in
lib/configuration.c
lib/configuration.h
server/server.c

diff --git a/CHANGES b/CHANGES
index 91ab4e1f26f3546b61e43dec5917406d44299719..32822ef26c5c6de9e61e9fd223309104de91e246 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,9 @@ 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.
 
 There is now a new user management window.  From here you can add and
 remove users or modify their settings.
 
+Relatedly, the server will only allow remote user management if you set
+remote_userman to 'yes'.
+
 * Changes up to version 3.0.2
 
 Builds --without-server should work again.
 * Changes up to version 3.0.2
 
 Builds --without-server should work again.
index a9549ed61f2b5a2548f42483b9e3490590279114..e714a22549b0b5b76f700150cb9a76756f791bac 100644 (file)
@@ -593,6 +593,10 @@ The default is 10.
 The minimum number of seconds that must elapse between password reminders.
 The default is 600, i.e. 10 minutes.
 .TP
 The minimum number of seconds that must elapse between password reminders.
 The default is 600, i.e. 10 minutes.
 .TP
+.B remote_userman yes\fR|\fBno
+User management over TCP connection is only allowed if this is set to
+\fByes\fR.  By default it is set to \fBno\fR.
+.TP
 .B replay_min \fISECONDS\fR
 The minimum number of seconds that must elapse after a track has been played
 before it can be picked at random.  The default is 8 hours.  If this is set to
 .B replay_min \fISECONDS\fR
 The minimum number of seconds that must elapse after a track has been played
 before it can be picked at random.  The default is 8 hours.  If this is set to
index b93e1e9ea16217b06ff9b21cb70c5c1a4486a3f1..bcce6c7a848cbbd586838f254223c4e066f1c6a7 100644 (file)
@@ -960,6 +960,7 @@ static const struct conf conf[] = {
   { C(replay_min),       &type_integer,          validate_non_negative },
   { C(refresh),          &type_integer,          validate_positive },
   { C(reminder_interval), &type_integer,         validate_positive },
   { C(replay_min),       &type_integer,          validate_non_negative },
   { C(refresh),          &type_integer,          validate_positive },
   { C(reminder_interval), &type_integer,         validate_positive },
+  { C(remote_userman),   &type_boolean,          validate_any },
   { C2(restrict, restrictions),         &type_restrict,         validate_any },
   { C(sample_format),    &type_sample_format,    validate_sample_format },
   { C(scratch),          &type_string_accum,     validate_isreg },
   { C2(restrict, restrictions),         &type_restrict,         validate_any },
   { C(sample_format),    &type_sample_format,    validate_sample_format },
   { C(scratch),          &type_string_accum,     validate_isreg },
index de251970855cc103316b2f503bf192e0dc6528ff..78c31ef361c35bcd51d62e4080fb3c531316ebf4 100644 (file)
@@ -270,6 +270,9 @@ struct config {
 
   /** @brief Minimum interval between password reminder emails */
   long reminder_interval;
 
   /** @brief Minimum interval between password reminder emails */
   long reminder_interval;
+
+  /** @brief Whether to allow user management over TCP */
+  int remote_userman;
   
   /* derived values: */
   int nparts;                          /* number of distinct name parts */
   
   /* derived values: */
   int nparts;                          /* number of distinct name parts */
index e03ff9c3ea1a4c5b935b7f3723eed704ced337ec..cbeb0abae1107037e0d2e0e132024b13d8a493d5 100644 (file)
@@ -1096,6 +1096,10 @@ static int c_adduser(struct conn *c,
                     int nvec) {
   const char *rights;
 
                     int nvec) {
   const char *rights;
 
+  if(!config->remote_userman && !(c->rights & RIGHT__LOCAL)) {
+    sink_writes(ev_writer_sink(c->w), "550 Remote user management is disabled\n");
+    return 1;
+  }
   if(nvec > 2) {
     rights = vec[2];
     if(parse_rights(vec[2], 0, 1)) {
   if(nvec > 2) {
     rights = vec[2];
     if(parse_rights(vec[2], 0, 1)) {
@@ -1117,6 +1121,10 @@ static int c_deluser(struct conn *c,
                     int attribute((unused)) nvec) {
   struct conn *d;
 
                     int attribute((unused)) nvec) {
   struct conn *d;
 
+  if(!config->remote_userman && !(c->rights & RIGHT__LOCAL)) {
+    sink_writes(ev_writer_sink(c->w), "550 Remote user management is disabled\n");
+    return 1;
+  }
   if(trackdb_deluser(vec[0])) {
     sink_writes(ev_writer_sink(c->w), "550 Cannot delete user\n");
     return 1;
   if(trackdb_deluser(vec[0])) {
     sink_writes(ev_writer_sink(c->w), "550 Cannot delete user\n");
     return 1;
@@ -1134,6 +1142,10 @@ static int c_edituser(struct conn *c,
                      int attribute((unused)) nvec) {
   struct conn *d;
 
                      int attribute((unused)) nvec) {
   struct conn *d;
 
+  if(!config->remote_userman && !(c->rights & RIGHT__LOCAL)) {
+    sink_writes(ev_writer_sink(c->w), "550 Remote user management is disabled\n");
+    return 1;
+  }
   /* RIGHT_ADMIN can do anything; otherwise you can only set your own email
    * address and password. */
   if((c->rights & RIGHT_ADMIN)
   /* RIGHT_ADMIN can do anything; otherwise you can only set your own email
    * address and password. */
   if((c->rights & RIGHT_ADMIN)
@@ -1172,6 +1184,10 @@ static int c_userinfo(struct conn *c,
   struct kvp *k;
   const char *value;
 
   struct kvp *k;
   const char *value;
 
+  if(!config->remote_userman && !(c->rights & RIGHT__LOCAL)) {
+    sink_writes(ev_writer_sink(c->w), "550 Remote user management is disabled\n");
+    return 1;
+  }
   /* RIGHT_ADMIN allows anything; otherwise you can only get your own email
    * address and rights list. */
   if((c->rights & RIGHT_ADMIN)
   /* RIGHT_ADMIN allows anything; otherwise you can only get your own email
    * address and rights list. */
   if((c->rights & RIGHT_ADMIN)