Preserve the anonymous mode if it is set in UMODE, do not send
authorPekka Riikonen <priikone@silcnet.org>
Wed, 5 Nov 2003 21:39:02 +0000 (21:39 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 5 Nov 2003 21:39:02 +0000 (21:39 +0000)
error if user didn't provide it in its mask.

CHANGES
apps/silcd/command.c

diff --git a/CHANGES b/CHANGES
index 76318ba276f50fb96d55dcb1b51978ee81028690..ea4b837bd74e55f8354ef5f179ef0a166ee8c4c4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Wed Nov  5 23:37:36 EET 2003 Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed UMODE setting in server when the client has anonymous
+         mode set.  The mode setting was not working.  Affected file
+         silcd/command.c.
+
 Mon Nov  2 11:36:08 CET 2003 Jochen Eisinger <jochen@penguin-breeder.org>
 
        * Fixed some bugs and typos related to sending split messages.
index 534c1f8a35b1921c8ee8daf8236f25ae236214ef..55f620ac0ef6d9569511d930422828507e84430b 100644 (file)
@@ -2694,18 +2694,11 @@ SILC_SERVER_CMD_FUNC(umode)
     }
 
     /* Anonymous mode cannot be set by client */
-    if (mask & SILC_UMODE_ANONYMOUS) {
-      if (!(client->mode & SILC_UMODE_ANONYMOUS)) {
-       silc_server_command_send_status_reply(cmd, SILC_COMMAND_UMODE,
-                                             SILC_STATUS_ERR_PERM_DENIED, 0);
-       goto out;
-      }
-    } else {
-      if (client->mode & SILC_UMODE_ANONYMOUS) {
-       silc_server_command_send_status_reply(cmd, SILC_COMMAND_UMODE,
-                                             SILC_STATUS_ERR_PERM_DENIED, 0);
-       goto out;
-      }
+    if (mask & SILC_UMODE_ANONYMOUS &&
+       !(client->mode & SILC_UMODE_ANONYMOUS)) {
+      silc_server_command_send_status_reply(cmd, SILC_COMMAND_UMODE,
+                                           SILC_STATUS_ERR_PERM_DENIED, 0);
+      goto out;
     }
 
     /* Update statistics */
@@ -2717,6 +2710,10 @@ SILC_SERVER_CMD_FUNC(umode)
        server->stat.my_aways--;
     }
 
+    /* If the client has anonymous mode set, preserve it. */
+    if (client->mode & SILC_UMODE_ANONYMOUS)
+      mask |= SILC_UMODE_ANONYMOUS;
+
     /* Change the mode */
     client->mode = mask;