[Top][All Lists]
[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: |
Sun, 01 Jul 2007 12:57:04 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 07/07/01 12:57:04
Modified files:
distrib : ChangeLog
src/daemon/common: commonGlobals.ml commonInteractive.ml
commonTypes.ml commonUserDb.ml
src/daemon/driver: driverCommands.ml driverControlers.ml
driverControlers.mli driverInterface.ml
src/networks/direct_connect: dcClients.ml
src/utils/lib : options.ml4
Log message:
patch #6056
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1292&r2=1.1293
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonGlobals.ml?cvsroot=mldonkey&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonInteractive.ml?cvsroot=mldonkey&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonTypes.ml?cvsroot=mldonkey&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonUserDb.ml?cvsroot=mldonkey&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.238&r2=1.239
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverControlers.ml?cvsroot=mldonkey&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverControlers.mli?cvsroot=mldonkey&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInterface.ml?cvsroot=mldonkey&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/direct_connect/dcClients.ml?cvsroot=mldonkey&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.ml4?cvsroot=mldonkey&r1=1.25&r2=1.26
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1292
retrieving revision 1.1293
diff -u -b -r1.1292 -r1.1293
--- distrib/ChangeLog 30 Jun 2007 17:54:10 -0000 1.1292
+++ distrib/ChangeLog 1 Jul 2007 12:57:02 -0000 1.1293
@@ -14,6 +14,9 @@
ChangeLog
=========
+2007/07/01
+6056: Log username, IP:port and old/new value when changing options
+
2007/06/30
6049: BT: Support user_commit_dir when seeding,
reshare every share_scan_interval minutes
Index: src/daemon/common/commonGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- src/daemon/common/commonGlobals.ml 24 Jun 2007 18:40:02 -0000 1.85
+++ src/daemon/common/commonGlobals.ml 1 Jul 2007 12:57:02 -0000 1.86
@@ -460,38 +460,8 @@
let last_message_log = ref 0
-
-
let debug_clients = ref Intset.empty
-let default_user = {
- ui_user = CommonUserDb.admin_user ();
- ui_user_searches = [];
- ui_last_search = None;
- ui_last_results = [];
- ui_http_conn = None;
- }
-
-let ui_users = ref [default_user]
-
-let find_ui_user user =
- let rec iter list =
- match list with
- [] ->
- let u = {
- ui_user = (CommonUserDb.user2_user_find user);
- ui_user_searches = [];
- ui_last_search = None;
- ui_last_results = [];
- ui_http_conn = None;
- } in
- ui_users := u :: !ui_users;
- u
- | u :: tail ->
- if u.ui_user = (CommonUserDb.user2_user_find user) then u else iter
tail
- in
- iter !ui_users
-
(* control_: means that it is the limited bandwidth, not the unlimited one
used by the interfaces. tcp_: the full bandwidth (limited+unlimited) *)
Index: src/daemon/common/commonInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- src/daemon/common/commonInteractive.ml 17 Jun 2007 01:28:24 -0000
1.97
+++ src/daemon/common/commonInteractive.ml 1 Jul 2007 12:57:03 -0000
1.98
@@ -832,11 +832,9 @@
!names
let apply_on_fully_qualified_options name f =
- if !verbose then lprintf_nl "Change option %s" name;
let rec iter prefix opfile =
let args = simple_options prefix opfile true in
List.iter (fun o ->
-(* lprintf "Compare [%s] [%s]\n" o.option_name name; *)
if o.option_name = name then
(f opfile o.option_shortname o.option_value; raise Exit))
args
@@ -848,7 +846,6 @@
try
List.iter (fun opfile ->
let prefix = r.network_shortname ^ "-" in
-(* lprintf "Prefix [%s]\n" prefix; *)
iter prefix opfile;
)
r.network_config_file ;
@@ -860,10 +857,6 @@
end
with Exit -> ()
-let set_fully_qualified_options name value =
- apply_on_fully_qualified_options name (fun opfile old_name old_value ->
- set_simple_option opfile old_name value)
-
let get_fully_qualified_options name =
let value = ref None in
(try
@@ -872,14 +865,30 @@
);
with _ -> ());
match !value with
- None -> "????"
+ None -> "unknown"
| Some s -> s
-let add_item_to_fully_qualified_options name value =
- ()
-
-let del_item_from_fully_qualified_options name value =
- ()
+let set_fully_qualified_options name value ?(user = None) ?(ip = None) ?(port
= None) ?(gui_type = None) () =
+ let old_value = get_fully_qualified_options name in
+ apply_on_fully_qualified_options name
+ (fun opfile old_name old_value -> set_simple_option opfile old_name value);
+ if !verbose && old_value <> get_fully_qualified_options name then
+ begin
+ let ip_port_text =
+ match ip with
+ | None -> "IP unknown"
+ | Some ip ->
+ Printf.sprintf "from host %s%s" (Ip.to_string ip)
+ (match port with | None -> "" | Some port -> Printf.sprintf
":%d" port)
+ in
+ lprintf_nl "User %s changed option %s %s %s, old: %s, new %s"
+ (match user with | None -> "unknown" | Some user -> user)
+ name ip_port_text
+ (match gui_type with
+ | None -> "GUI type unknown"
+ | Some gt -> Printf.sprintf "using %s interface"
(connection_type_to_text gt))
+ old_value (get_fully_qualified_options name)
+ end
let keywords_of_query query =
let keywords = ref [] in
Index: src/daemon/common/commonTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonTypes.ml,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- src/daemon/common/commonTypes.ml 24 Jun 2007 18:38:28 -0000 1.72
+++ src/daemon/common/commonTypes.ml 1 Jul 2007 12:57:03 -0000 1.73
@@ -367,6 +367,16 @@
type output_type = TEXT | HTML | ANSI | XML | XHTML
+type connection_type = TELNET | WEB | GUI | GIFT | CALENDAR
+
+let connection_type_to_text ct =
+ match ct with
+ | TELNET -> "Telnet"
+ | WEB -> "Web"
+ | GUI -> "GUI"
+ | GIFT -> "Gift"
+ | CALENDAR -> "Calendar"
+
type sortvd_type =
BySize
| ByName
@@ -559,6 +569,7 @@
mutable conn_user : ui_user;
mutable conn_width : int;
mutable conn_height : int;
+ mutable conn_info : (connection_type * (Ip.t * int)) option;
}
Index: src/daemon/common/commonUserDb.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonUserDb.ml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/daemon/common/commonUserDb.ml 17 Jun 2007 01:33:38 -0000 1.9
+++ src/daemon/common/commonUserDb.ml 1 Jul 2007 12:57:03 -0000 1.10
@@ -140,7 +140,7 @@
(*************************************************************************)
let default_admin_user = {
- user_name = "";
+ user_name = admin_user_name;
user_pass = blank_password;
user_groups = [admin_group ()];
user_default_group = Some (admin_group ());
@@ -451,3 +451,32 @@
if level > 0 then
List.iter (fun u -> Printf.bprintf buf " user %s\n" u.user_name)
!!userlist;
)
+
+(* GUI user list *)
+let ui_users = ref []
+
+let find_ui_user user =
+ let rec iter list =
+ match list with
+ [] ->
+ let u = {
+ ui_user = user2_user_find user;
+ ui_user_searches = [];
+ ui_last_search = None;
+ ui_last_results = [];
+ ui_http_conn = None;
+ } in
+ ui_users := u :: !ui_users;
+ u
+ | u :: tail ->
+ if u.ui_user = user2_user_find user then u else iter tail
+ in
+ iter !ui_users
+
+let _ =
+(* these functions are called before ini files are read
+ user "admin" is always needed in !!users, so create a
+ dummy here which is replaced during start-up with the
+ admin user read from users.ini *)
+ update_user admin_user_name (Some default_admin_user);
+ ignore (find_ui_user admin_user_name)
Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -b -r1.238 -r1.239
--- src/daemon/driver/driverCommands.ml 24 Jun 2007 18:40:03 -0000 1.238
+++ src/daemon/driver/driverCommands.ml 1 Jul 2007 12:57:03 -0000 1.239
@@ -1718,9 +1718,15 @@
if user2_is_admin o.conn_user.ui_user then begin
try
try
- CommonInteractive.set_fully_qualified_options name value;
+ let gui_type, ip, port =
+ match o.conn_info with
+ | None -> None, None, None
+ | Some (gui_type, (ip, port)) -> Some gui_type, Some ip, Some
port
+ in
+ CommonInteractive.set_fully_qualified_options name value
+ ~user:(Some o.conn_user.ui_user.user_name)
+ ~ip:ip ~port:port ~gui_type:gui_type ();
Printf.sprintf "option %s value changed" name
-
with _ ->
Options.set_simple_option downloads_ini name value;
Printf.sprintf "option %s value changed" name
Index: src/daemon/driver/driverControlers.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- src/daemon/driver/driverControlers.ml 17 Jun 2007 02:08:15 -0000
1.107
+++ src/daemon/driver/driverControlers.ml 1 Jul 2007 12:57:03 -0000
1.108
@@ -342,8 +342,9 @@
conn_output = TEXT;
conn_sortvd = NotSorted;
conn_filter = (fun _ -> ());
- conn_user = default_user;
+ conn_user = find_ui_user CommonUserDb.admin_user_name;
conn_width = 80; conn_height = 0;
+ conn_info = Some (CALENDAR, (Ip.null, 0));
}
let check_calendar () =
@@ -558,19 +559,6 @@
user_socks := List2.removeq sock !user_socks;
()
-(* Here, we clearly need a good html parser to remove tags, and to translate
-special characters. Avoid them in the meantime. *)
-let text_of_html html =
- String2.convert false (fun buf state c ->
- if state then
- c <> '>'
- else
- if c = '<' then true else begin
- Buffer.add_char buf c;
- false
- end
-) html
-
let telnet_handler t event =
match event with
TcpServerSocket.CONNECTION (s, Unix.ADDR_INET (from_ip, from_port)) ->
@@ -591,9 +579,10 @@
conn_output = (if !!term_ansi then ANSI else TEXT);
conn_sortvd = NotSorted;
conn_filter = (fun _ -> ());
- conn_user = default_user;
+ conn_user = find_ui_user CommonUserDb.admin_user_name;
conn_width = 80;
conn_height = 0;
+ conn_info = Some (TELNET, (from_ip, from_port));
} in
(match Ip_set.match_ip !allowed_ips_set from_ip with
| Some br ->
@@ -975,8 +964,10 @@
begin
let user = find_ui_user user in
let o = match user.ui_http_conn with
- Some oo -> oo.conn_buf <- o.conn_buf; oo
- | None -> let oo = { o with conn_user = user } in
+ Some oo -> oo.conn_buf <- o.conn_buf;
+ oo.conn_info <- Some (WEB, peer_addr t); oo
+ | None -> let oo = { o with conn_user = user;
+ conn_info = Some (WEB, peer_addr t)} in
user.ui_http_conn <- Some oo; oo
in
try
@@ -1400,9 +1391,16 @@
| [ "setoption", _ ; "option", name; "value", value ] ->
html_open_page buf t r true;
+ let gui_type, ip, port =
+ match o.conn_info with
+ | None -> None, None, None
+ | Some (gui_type, (ip, port)) -> Some gui_type, Some ip,
Some port
+ in
if user2_is_admin o.conn_user.ui_user then
begin
- CommonInteractive.set_fully_qualified_options name value;
+ CommonInteractive.set_fully_qualified_options name value
+ ~user:(Some o.conn_user.ui_user.CommonTypes.user_name)
+ ~ip:ip ~port:port ~gui_type:gui_type ();
Buffer.add_string buf "Option value changed"
end
else
@@ -1533,8 +1531,9 @@
conn_output = HTML;
conn_sortvd = NotSorted;
conn_filter = (fun _ -> ());
- conn_user = default_user;
+ conn_user = find_ui_user CommonUserDb.admin_user_name;
conn_width = 80; conn_height = 0;
+ conn_info = Some (WEB, (Ip.null, 0));
}
let create_http_handler () =
Index: src/daemon/driver/driverControlers.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverControlers.mli,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/daemon/driver/driverControlers.mli 27 Jun 2006 10:38:35 -0000
1.2
+++ src/daemon/driver/driverControlers.mli 1 Jul 2007 12:57:03 -0000
1.3
@@ -25,6 +25,3 @@
val create_http_handler : unit -> unit
val check_calendar : unit -> unit
-
-(* should not be here ... *)
-val text_of_html : string -> string
Index: src/daemon/driver/driverInterface.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- src/daemon/driver/driverInterface.ml 12 Apr 2007 10:03:37 -0000
1.64
+++ src/daemon/driver/driverInterface.ml 1 Jul 2007 12:57:03 -0000
1.65
@@ -621,11 +621,18 @@
) list
| P.SetOption (name, value) ->
+ let o = gui.gui_conn in
+ let gui_type, ip, port =
+ match o.conn_info with
+ | None -> None, None, None
+ | Some (gui_type, (ip, port)) -> Some gui_type, Some ip, Some
port
+ in
if user2_is_admin gui.gui_conn.conn_user.ui_user then
CommonInteractive.set_fully_qualified_options name value
+ ~user:(Some o.conn_user.ui_user.user_name)
+ ~ip:ip ~port:port ~gui_type:gui_type ()
else
begin
- let o = gui.gui_conn in
let buf = o.conn_buf in
Buffer.reset buf;
Buffer.add_string buf "\nYou are not allowed to change
options\n";
@@ -787,9 +794,18 @@
server_remove (server_find num)
| P.SaveOptions_query list ->
+ let o = gui.gui_conn in
+ let gui_type, ip, port =
+ match o.conn_info with
+ | None -> None, None, None
+ | Some (gui_type, (ip, port)) -> Some gui_type, Some ip, Some
port
+ in
if user2_is_admin gui.gui_conn.conn_user.ui_user then
List.iter (fun (name, value) ->
- CommonInteractive.set_fully_qualified_options name value)
list;
+ CommonInteractive.set_fully_qualified_options name value
+ ~user:(Some o.conn_user.ui_user.user_name)
+ ~ip:ip ~port:port ~gui_type:gui_type ();
+ ) list;
DriverInteractive.save_config ()
| P.RemoveDownload_query num ->
@@ -1133,7 +1149,7 @@
}
-let new_gui gui_send gui_auth sock =
+let new_gui gui_send gui_auth sock gui_type =
incr gui_counter;
let gui = {
gui_searches = [];
@@ -1155,8 +1171,12 @@
conn_sortvd = BySize;
conn_filter = (fun _ -> ());
conn_buf = Buffer.create 100;
- conn_user = default_user;
+ conn_user = find_ui_user CommonUserDb.admin_user_name;
conn_width = 80; conn_height = 25;
+ conn_info =
+ match sock with
+ | None -> Some (gui_type, (Ip.null, 0));
+ | Some t -> Some (gui_type, peer_addr t);
};
gui_send = gui_send;
} in
@@ -1183,7 +1203,7 @@
s in
let gui = new_gui binary_gui_send
- false (Some sock) in
+ false (Some sock) GUI in
gui.gui_result_handler <- binary_result_handler gui;
TcpBufferedSocket.set_max_output_buffer sock !!interface_buffer;
TcpBufferedSocket.set_lifetime sock 30.;
@@ -1221,7 +1241,7 @@
"gui connection"
s in
- let gui = new_gui gift_gui_send true (Some sock) in
+ let gui = new_gui gift_gui_send true (Some sock) GIFT in
gui.gui_result_handler <- gift_result_handler gui;
guis := gui :: !guis;
@@ -1462,7 +1482,7 @@
if !gui_reconnected then begin
lprintf "gui_reconnected !\n";
gui_reconnected := false;
- let gui = new_gui binary_gui_send false None in
+ let gui = new_gui binary_gui_send false None GUI in
gui.gui_result_handler <- binary_result_handler gui;
local_gui := Some gui;
()
Index: src/networks/direct_connect/dcClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/direct_connect/dcClients.ml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- src/networks/direct_connect/dcClients.ml 1 Jun 2007 19:31:09 -0000
1.14
+++ src/networks/direct_connect/dcClients.ml 1 Jul 2007 12:57:03 -0000
1.15
@@ -259,7 +259,7 @@
(* Create new search automatically if possible *)
let create_new_search f =
let query = QAnd (QHasField (Field_Type , "TTH") , (QHasWord
f.file_unchecked_tiger_root)) in
- let search = CommonSearch.new_search CommonGlobals.default_user
+ let search = CommonSearch.new_search (CommonUserDb.find_ui_user
CommonUserDb.admin_user_name)
(let module G = GuiTypes in
{ G.search_num = 0;
G.search_query = query;
@@ -272,7 +272,7 @@
server_send_search s search 9 f.file_unchecked_tiger_root
);
(match !dc_last_autosearch with
- | Some s -> CommonSearch.search_forget CommonGlobals.default_user s
+ | Some s -> CommonSearch.search_forget (CommonUserDb.find_ui_user
CommonUserDb.admin_user_name) s
| _ -> () );
dc_last_autosearch := Some search;
dc_last_autosearch_time := current_time ();
Index: src/utils/lib/options.ml4
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- src/utils/lib/options.ml4 24 Jun 2007 18:38:29 -0000 1.25
+++ src/utils/lib/options.ml4 1 Jul 2007 12:57:04 -0000 1.26
@@ -1098,18 +1098,6 @@
let once_value v = OnceValue v
- (*
-let strings_of_option o =
- match o.option_name with
- [] | _ :: _ :: _ -> failwith "Complex option"
- | [name] ->
- name,
- (match o.option_class.string_wrappers with
- None -> safe_value_to_string (o.option_class.to_value o.option_value)
- | Some (to_string, _) -> to_string o.option_value)
- *)
-
-
let restore_default o =
o =:= o.option_default
let set_option_desc o s =
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/01
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/01
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/01
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/03
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/09
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2007/07/25