[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/... |
Date: |
Sun, 24 Oct 2010 12:04:25 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 10/10/24 12:04:25
Modified files:
distrib : ChangeLog
src/networks/donkey: donkeyClient.ml donkeyInteractive.ml
Log message:
patch #7318
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1492&r2=1.1493
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyClient.ml?cvsroot=mldonkey&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyInteractive.ml?cvsroot=mldonkey&r1=1.168&r2=1.169
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1492
retrieving revision 1.1493
diff -u -b -r1.1492 -r1.1493
--- distrib/ChangeLog 24 Oct 2010 12:01:29 -0000 1.1492
+++ distrib/ChangeLog 24 Oct 2010 12:04:23 -0000 1.1493
@@ -15,6 +15,7 @@
=========
2010/10/24
+7318: EDK/Emule captcha: Use Base64 functions (ygrek)
7357: configure: fix quoting of arguments (ygrek)
2010/10/23
Index: src/networks/donkey/donkeyClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- src/networks/donkey/donkeyClient.ml 23 Oct 2010 18:25:13 -0000 1.132
+++ src/networks/donkey/donkeyClient.ml 24 Oct 2010 12:04:24 -0000 1.133
@@ -1135,6 +1135,18 @@
if !!ban_identity_thieves then
ban_client c sock "is probably using stolen client hashes"
+let string_of_client_addr c =
+ try
+ match c.client_source.DonkeySources.source_sock with
+ | Connection sock ->
+ (Ip.to_string (peer_ip sock) ^ ":" ^ string_of_int (peer_port sock))
+ | _ ->
+ raise Not_found
+ with _ ->
+ match c.client_kind with
+ | Direct_address (ip,port) -> ((Ip.to_string ip) ^ ":" ^ string_of_int
port)
+ | Indirect_address _ | Invalid_address _ -> "Indirect"
+
let client_to_client for_files c t sock =
let module M = DonkeyProtoClient in
@@ -1935,133 +1947,23 @@
(* FIXME: add logging *)
(* !say_hook c s *)
private_message_from (as_client c) s;
-
- let cip =
- (
- try
-
- match c.client_source.DonkeySources.source_sock with
- Connection sock ->
- (Ip.to_string (peer_ip sock) ^ ":" ^ string_of_int (peer_port
sock))
- | _ -> (match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- )
-
- with _ ->
-
- try
- match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- with _ -> ""
- )
- in
+ let cip = string_of_client_addr c in
log_chat_message cip (client_num c) c.client_name s;
-
| M.EmuleCaptchaReq t ->
- let buf = Buffer.create 4096 in
- let len = String.length t in
- let b64_map = [|
- 'A'; 'B'; 'C'; 'D'; 'E'; 'F'; 'G'; 'H'; 'I'; 'J'; 'K'; 'L'; 'M'; 'N';
'O'; 'P';
- 'Q'; 'R'; 'S'; 'T'; 'U'; 'V'; 'W'; 'X'; 'Y'; 'Z'; 'a'; 'b'; 'c'; 'd';
'e'; 'f';
- 'g'; 'h'; 'i'; 'j'; 'k'; 'l'; 'm'; 'n'; 'o'; 'p'; 'q'; 'r'; 's'; 't';
'u'; 'v';
- 'w'; 'x'; 'y'; 'z'; '0'; '1'; '2'; '3'; '4'; '5'; '6'; '7'; '8'; '9';
'+'; '/'|] in
-
- for i = 0 to (len / 3) - 1 do
- let c1 = int_of_char t.[i*3] in
- let c2 = int_of_char t.[i*3+1] in
- let c3 = int_of_char t.[i*3+2] in
- let n1 = c1 lsr 2 in
- let n2 = ((c1 land 3) lsl 4) lor (c2 lsr 4) in
- let n3 = ((c2 land 0xf) lsl 2) lor (c3 lsr 6) in
- let n4 = c3 land 63 in
- Printf.bprintf buf "%c%c%c%c" b64_map.(n1) b64_map.(n2) b64_map.(n3)
b64_map.(n4);
- done;
- if (len mod 3) = 1 then (
- let i = len - 2 in
- let c1 = int_of_char t.[i] in
- let c2 = int_of_char t.[i+1] in
- let n1 = ((c1 land 0xf) lsl 2) lor (c2 lsr 6) in
- let n2 = c2 land 63 in
- Printf.bprintf buf "%c%c==" b64_map.(n1) b64_map.(n2)
- )
- else if (len mod 3) = 2 then (
- let i = len - 3 in
- let c1 = int_of_char t.[i] in
- let c2 = int_of_char t.[i+1] in
- let c3 = int_of_char t.[i+2] in
- let n1 = ((c1 land 3) lsl 4) lor (c2 lsr 4) in
- let n2 = ((c2 land 0xf) lsl 2) lor (c3 lsr 6) in
- let n3 = c3 land 63 in
- Printf.bprintf buf "%c%c%c=" b64_map.(n1) b64_map.(n2) b64_map.(n3)
- );
-
- let b64data = Buffer.contents buf in
- let cip =
- (
- try
-
- match c.client_source.DonkeySources.source_sock with
- Connection sock ->
- (Ip.to_string (peer_ip sock) ^ ":" ^ string_of_int (peer_port
sock))
- | _ -> (match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- )
-
- with _ ->
-
- try
- match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- with _ -> ""
- )
- in
+ let b64data = Base64.encode t in
+ let cip = string_of_client_addr c in
log_chat_message cip (client_num c) c.client_name
("data:image/bmp;base64," ^ b64data)
-
| M.EmuleCaptchaRes t ->
- let cip =
- (
- try
-
- match c.client_source.DonkeySources.source_sock with
- Connection sock ->
- (Ip.to_string (peer_ip sock) ^ ":" ^ string_of_int (peer_port
sock))
- | _ -> (match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- )
-
- with _ ->
-
- try
- match c.client_kind with
- Direct_address (ip,port) ->
- ((Ip.to_string ip) ^ ":" ^ string_of_int port)
- | Indirect_address _ | Invalid_address _ -> "Indirect"
- with _ -> ""
- )
+ let msg = match t with
+ | 0 -> _s "You have correctly solved the captcha and your message was
sent."
+ | 1 -> _s "Wrong answer to the captcha, so your message was not sent.
You will only be sent 3 captchas. Try sending another message to receive
another captcha challenge."
+ | 2 -> _s "3 captchas have already been sent to you. Fail."
+ | _ -> _s "Unknown captcha state!?"
in
- log_chat_message cip (client_num c) c.client_name (
- if t = 0 then
- "You have correctly solved the captcha and your message was sent."
- else if t = 1 then
- "Wrong answer to the captcha, so your message was not sent. You
will only be sent 3 captchas. Try sending another message to receive another
captcha challenge."
- else if t = 2 then
- "3 captchas have already been sent to you. Fail."
- else
- "Unknown captcha state!?"
- )
-
+ let cip = string_of_client_addr c in
+ log_chat_message cip (client_num c) c.client_name msg
| M.QueryChunkMd4Req t when !CommonGlobals.has_upload = 0 ->
Index: src/networks/donkey/donkeyInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -b -r1.168 -r1.169
--- src/networks/donkey/donkeyInteractive.ml 23 May 2010 09:29:00 -0000
1.168
+++ src/networks/donkey/donkeyInteractive.ml 24 Oct 2010 12:04:24 -0000
1.169
@@ -1194,7 +1194,7 @@
}
)
-let string_of_client_addr c =
+let string_of_client_ip c =
try match c.client_source.DonkeySources.source_sock with
Connection sock -> (Ip.to_string (peer_ip sock))
| _ -> ""
@@ -1212,7 +1212,7 @@
(Ip.to_string real_ip),cc,cn
| _ ->
let cc,cn = Geoip.unknown_country in
- (string_of_client_addr c),cc,cn
+ (string_of_client_ip c),cc,cn
with _ -> ("X","??","Country Error")
@@ -1808,7 +1808,7 @@
(shorten c.client_name 20)
(match c.client_kind with
Direct_address (ip,port) -> (Ip.to_string ip)
- | _ -> (string_of_client_addr c));
+ | _ -> (string_of_client_ip c));
Printf.bprintf buf "\n%14sDown : %-10s
Uploaded: %-10s Ratio: %s%1.1f (%s)\n" ""
(Int64.to_string c.client_total_downloaded)
(Int64.to_string c.client_total_uploaded)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...,
mldonkey-commits <=