mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/ip_set.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/ip_set.ml
Date: Sun, 01 Apr 2007 12:16:04 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/04/01 12:16:04

Modified files:
        distrib        : ChangeLog 
        src/utils/net  : ip_set.ml 

Log message:
        patch #5839

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1215&r2=1.1216
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/ip_set.ml?cvsroot=mldonkey&r1=1.31&r2=1.32

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1215
retrieving revision 1.1216
diff -u -b -r1.1215 -r1.1216
--- distrib/ChangeLog   1 Apr 2007 12:14:57 -0000       1.1215
+++ distrib/ChangeLog   1 Apr 2007 12:16:04 -0000       1.1216
@@ -15,6 +15,8 @@
 =========
 
 2007/04/01
+5839: IP block: Scan all files inside a .zip file when loading
+      a blocklist, use the first valid file
 5831: BT: New option BT-tracker_retries
 
 2007/03/26

Index: src/utils/net/ip_set.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/ip_set.ml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- src/utils/net/ip_set.ml     20 Nov 2006 22:34:40 -0000      1.31
+++ src/utils/net/ip_set.ml     1 Apr 2007 12:16:04 -0000       1.32
@@ -242,7 +242,10 @@
     let last_ext = String.lowercase (Filename2.last_extension filename) in
     if last_ext = ".zip" then
       let filenames_list = 
-       ["guarding.p2p"; "guarding_full.p2p"; "ipfilter.dat"] in
+        Unix2.tryopen_read_zip filename (fun ic ->
+          try
+            List.map (fun e -> e.Zip.filename) (Zip.entries ic)
+          with _ -> []) in
       (try
        Unix2.tryopen_read_zip filename (fun ic ->
          try
@@ -254,7 +257,11 @@
                      let file = Zip.find_entry ic h in
                        lprintf_nl (_b "%s found in zip file") h;
                      ignore(Misc.archive_extract filename "zip");
-                     load_merge bl_empty file.Zip.filename true
+                      let bl = load_merge bl_empty file.Zip.filename true in
+                      if bl_length bl = 0 then
+                        raise Not_found
+                      else
+                        bl
                    with Not_found ->
                      find_in_zip q in
            find_in_zip filenames_list
@@ -263,7 +270,7 @@
              (Printexc2.to_string e) 
              (String.concat "/" filenames_list)
              filename;
-           lprintf_nl "One of the mentioned files has to be present in the zip 
file";
+           lprintf_nl "One of the mentioned files has to be a valid IP 
blocklist";
            bl_empty)
       with e ->
        lprintf_nl "Exception %s while opening %s"




reply via email to

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