mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Fri, 03 Feb 2006 01:10:45 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/02/03 01:10:45

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonOptions.ml 
        src/daemon/driver: driverCommands.ml driverControlers.ml 
                           driverInterface.ml 

Log message:
        patch #4859

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.702&tr2=1.703&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonOptions.ml.diff?tr1=1.122&tr2=1.123&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.119&tr2=1.120&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml.diff?tr1=1.36&tr2=1.37&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.702 mldonkey/distrib/ChangeLog:1.703
--- mldonkey/distrib/ChangeLog:1.702    Fri Feb  3 00:45:15 2006
+++ mldonkey/distrib/ChangeLog  Fri Feb  3 01:10:45 2006
@@ -15,6 +15,8 @@
 =========
 
 2006/02/03
+4859: Multiuser: Only user "admin" is allowed to change options
+      if the new option enable_user_config (default true) is set to false
 4858: HTML: Update some links to mldonkey.sf.net
 4857: SIGUSR1 & SIGUSR2 don´t exist on Windows
 4856: configure: disable iconv by default on MinGW
Index: mldonkey/src/daemon/common/commonOptions.ml
diff -u mldonkey/src/daemon/common/commonOptions.ml:1.122 
mldonkey/src/daemon/common/commonOptions.ml:1.123
--- mldonkey/src/daemon/common/commonOptions.ml:1.122   Sun Jan 29 18:42:53 2006
+++ mldonkey/src/daemon/common/commonOptions.ml Fri Feb  3 01:10:45 2006
@@ -1136,6 +1136,11 @@
 ones in allowed_commands"
     bool_option false
 
+let enable_user_config = define_option current_section
+    ["enable_user_config"]
+  "Are all users allowed to change MLDonkey options?"
+    bool_option true
+
 let allow_browse_share = define_option current_section ["allow_browse_share"]
   "Allow others to browse our share list (0: none, 1: friends only, 2: 
everyone" allow_browse_share_option 1
 
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.119 
mldonkey/src/daemon/driver/driverCommands.ml:1.120
--- mldonkey/src/daemon/driver/driverCommands.ml:1.119  Fri Feb  3 00:31:40 2006
+++ mldonkey/src/daemon/driver/driverCommands.ml        Fri Feb  3 01:10:45 2006
@@ -343,7 +343,7 @@
            _s "exit"
          end
         else
-          _s "Only 'admin' is allowed to do that"
+          _s "Only 'admin' is allowed to kill MLDonkey"
         ), ":\t\t\t\t\t$bsave and kill the server$n";
 
     "add_url", Arg_two (fun kind url o ->
@@ -654,7 +654,7 @@
               users =:= (user, Md4.string pass) :: !!users;
               _s "User added"
         else
-          _s "Only 'admin' is allowed to do that"
+          _s "Only 'admin' is allowed to add users"
     ), "<user> <passwd> :\t\tadd new mldonkey user/change user password";
 
     "remove_user", Arg_one (fun user o ->
@@ -675,7 +675,7 @@
                  _s (Printf.sprintf "user %s not found" user)
            end
         else
-          _s "Only 'admin' is allowed to do that"
+          _s "Only 'admin' is allowed to remove users"
     ), "<user> :\t\t\tremove a mldonkey user";
 
 
@@ -739,7 +739,7 @@
           end;
         ""
         else
-          _s "Only 'admin' is allowed to do that"
+          _s "Only 'admin' is allowed to list users"
     ), ":\t\t\t\t\tprint users";
 
     "whoami", Arg_none (fun o ->
@@ -1452,34 +1452,20 @@
     [
 
     "set", Arg_two (fun name value o ->
+       if (o.conn_user == default_user) || !!enable_user_config then begin
         try
           try
             CommonInteractive.set_fully_qualified_options name value;
             Printf.sprintf "option %s value changed" name
 
-(*
-            let pos = String.index name '-' in
-            let prefix = String.sub name 0 pos in
-            let name = String.sub name (pos+1) (String.length name - pos-1) in
-            networks_iter (fun n ->
-                match n.network_config_file with
-                  None -> ()
-                | Some opfile ->
-                    List.iter (fun p ->
-                        if p = prefix then begin
-                            set_simple_option opfile name value;
-                            Printf.bprintf buf "option %s :: %s value changed"
-                            n.network_name name
-
-                          end)
-                    n.network_prefixes
-);
-  *)
           with _ ->
               Options.set_simple_option downloads_ini name value;
               Printf.sprintf "option %s value changed" name
         with e ->
             Printf.sprintf "Error %s" (Printexc2.to_string e)
+         end
+       else
+         _s "Only 'admin' is allowed to change options"
     ), "<option_name> <option_value> :\t$bchange option value$n";
 
     "save", Arg_multiple (fun args o ->
@@ -1807,6 +1793,7 @@
                   | 8 ->
                       [
                        strings_of_option term_ansi;
+                       strings_of_option enable_user_config;
                        strings_of_option messages_filter;
                        strings_of_option max_displayed_results;
                        strings_of_option max_name_len;
@@ -1972,7 +1959,7 @@
          Printf.bprintf buf "bavail %s\n" (print_i64o (Unix32.bavail arg));
          Printf.bprintf buf "fnamelen %s\n" (print_i64o (Unix32.fnamelen arg));
          Printf.bprintf buf "filesystem %s\n" (Unix32.filesystem arg);
-        let print_i64o_amount = function 
+        let print_i64o_amount = function
           | None -> "Unknown"
           | Some v -> Printf.sprintf "%Ld - %s" v (size_of_int64 v) in
          Printf.bprintf buf "disktotal %s\n" (print_i64o_amount 
(Unix32.disktotal arg));
Index: mldonkey/src/daemon/driver/driverControlers.ml
diff -u mldonkey/src/daemon/driver/driverControlers.ml:1.59 
mldonkey/src/daemon/driver/driverControlers.ml:1.60
--- mldonkey/src/daemon/driver/driverControlers.ml:1.59 Sun Jan 29 18:53:17 2006
+++ mldonkey/src/daemon/driver/driverControlers.ml      Fri Feb  3 01:10:45 2006
@@ -1430,8 +1430,13 @@
 
               | [ "setoption", _ ; "option", name; "value", value ] ->
                   html_open_page buf t r true;
-                  CommonInteractive.set_fully_qualified_options name value;
-                  Buffer.add_string buf "Option value changed"
+                 if (o.conn_user == default_user) || !!enable_user_config then
+                   begin
+                      CommonInteractive.set_fully_qualified_options name value;
+                      Buffer.add_string buf "Option value changed"
+                   end
+                 else
+                    Buffer.add_string buf "Only 'admin' is allowed to change 
options"
 
               | args ->
                   List.iter (fun (s,v) ->
Index: mldonkey/src/daemon/driver/driverInterface.ml
diff -u mldonkey/src/daemon/driver/driverInterface.ml:1.36 
mldonkey/src/daemon/driver/driverInterface.ml:1.37
--- mldonkey/src/daemon/driver/driverInterface.ml:1.36  Fri Dec 16 20:56:31 2005
+++ mldonkey/src/daemon/driver/driverInterface.ml       Fri Feb  3 01:10:45 2006
@@ -615,7 +615,18 @@
               ) list
           
           | P.SetOption (name, value) ->
-              CommonInteractive.set_fully_qualified_options name value
+             if (gui.gui_conn.conn_user == default_user) || 
!!enable_user_config then
+               CommonInteractive.set_fully_qualified_options name value
+             else
+               begin
+                  let o = gui.gui_conn in
+                  let buf = o.conn_buf in
+                  Buffer.reset buf; 
+                  Buffer.add_string buf "\nOnly 'admin' is allowed to change 
options\n";
+                  gui_send gui (P.Console (
+                      DriverControlers.dollar_escape o false
+                        (Buffer.contents buf)))
+               end
           
           | P.CloseSearch (num, forget) ->
               let s = List.assoc num gui.gui_searches in




reply via email to

[Prev in Thread] Current Thread [Next in Thread]