[Pkg-ocaml-maint-commits] r3520 - in /trunk/packages/mldonkey/trunk/debian: changelog mldonkey-server.init mldonkey-server.install mldonkey-server.postinst patches/00list patches/avoid-duplicate-sending.dpatch patches/useradd.dpatch utils/parse_options.mly

smimram at users.alioth.debian.org smimram at users.alioth.debian.org
Tue Jan 16 23:34:50 CET 2007


Author: smimram
Date: Tue Jan 16 23:34:50 2007
New Revision: 3520

URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=3520
Log:
  * Added avoid-duplicate-sending to fix a serious bug which lead mldonkey to
    uploading data blocks twice to eMule clients, closes: #406247.
  * Added useradd.dpatch to be able to add users using useradd command and
    use it in postinst, closes: #397497. Not installing mldonkey_users anymore
    since it is not compatible with the new users.ini format.
  * Change uid of mldonkey on startup, closes: #405173.

Added:
    trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch   (with props)
    trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch   (with props)
Modified:
    trunk/packages/mldonkey/trunk/debian/changelog
    trunk/packages/mldonkey/trunk/debian/mldonkey-server.init
    trunk/packages/mldonkey/trunk/debian/mldonkey-server.install
    trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
    trunk/packages/mldonkey/trunk/debian/patches/00list
    trunk/packages/mldonkey/trunk/debian/utils/parse_options.mly

Modified: trunk/packages/mldonkey/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/changelog?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/changelog (original)
+++ trunk/packages/mldonkey/trunk/debian/changelog Tue Jan 16 23:34:50 2007
@@ -1,3 +1,14 @@
+mldonkey (2.8.2-2) unstable; urgency=low
+
+  * Added avoid-duplicate-sending to fix a serious bug which lead mldonkey to
+    uploading data blocks twice to eMule clients, closes: #406247.
+  * Added useradd.dpatch to be able to add users using useradd command and
+    use it in postinst, closes: #397497. Not installing mldonkey_users anymore
+    since it is not compatible with the new users.ini format.
+  * Change uid of mldonkey on startup, closes: #405173.
+
+ -- Samuel Mimram <smimram at debian.org>  Wed, 29 Nov 2006 00:10:25 +0000
+
 mldonkey (2.8.2-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.init
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/mldonkey-server.init?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.init (original)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.init Tue Jan 16 23:34:50 2007
@@ -51,6 +51,10 @@
 WRAPPER_OPTIONS=""
 
 # Set configuration value, from CONFIG
+if [ -n "$MLDONKEY_USER" ] && [ -n "$MLDONKEY_GROUP" ]; then
+    WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chuid $MLDONKEY_USER:$MLDONKEY_GROUP"
+fi
+
 if [ -n "$MLDONKEY_DIR" ]; then
   WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chdir $MLDONKEY_DIR"
 fi

Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.install
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/mldonkey-server.install?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.install (original)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.install Tue Jan 16 23:34:50 2007
@@ -1,6 +1,5 @@
 mlnet                               usr/bin/
 debian/utils/mldonkey_options       usr/bin/
-debian/utils/mldonkey_users         usr/bin/
 debian/utils/mldonkey_files         usr/bin/
 debian/utils/mldonkey_command       usr/bin/
 debian/utils/mldonkey_submit        usr/bin/

Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst (original)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst Tue Jan 16 23:34:50 2007
@@ -200,37 +200,11 @@
       # Users.ini #
       #############
 
-      if [ -e "$new_mldonkey_dir/downloads.ini" ] && \
-        /usr/bin/mldonkey_users --test-users-section -q -f "$new_mldonkey_dir/downloads.ini"; then
-        if [ -e "$new_mldonkey_dir/users.ini" ]; then
-          echo "File $new_mldonkey_dir/users.ini exists and $new_mldonkey_dir/downloads.ini contains a \"users\" section, this is inconstitent."
-          echo "Please user mldonkey_users(1) to strip the \"users\" section of $new_mldonkey_dir/downloads.ini."
-        else
-          # OK we have downloads.ini containing a "users" section, this is pre 2.5.28.1 
-          # configuration, lets split it...
-          $DEBUG && echo -n "Transferring \"users\" section  from file $new_mldonkey_dir/downloads.ini to $new_mldonkey_dir/users.ini: "
-          /usr/bin/mldonkey_users --dump-users-section -q -f "$new_mldonkey_dir/downloads.ini" > "$new_mldonkey_dir/users.ini"
-          /usr/bin/mldonkey_users --strip-users-section -q -f "$new_mldonkey_dir/downloads.ini" > "$new_mldonkey_dir/downloads.ini.tmp"
-          mv -f "$new_mldonkey_dir/downloads.ini.tmp" "$new_mldonkey_dir/downloads.ini"
-          $DEBUG && echo "done."
-        fi
-      fi
-
-      if [ -n "$password" ]; then
-        if [ -e "$new_mldonkey_dir/users.ini" ]; then
-          $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/users.ini: "
-          /bin/cp -p -f "$new_mldonkey_dir/users.ini" "$new_mldonkey_dir/users.ini.dpkg"
-          $DEBUG && echo "done."
-        else
-          $DEBUG && echo -n "Creating empty $new_mldonkey_dir/users.ini: "
-          /bin/touch "$new_mldonkey_dir/users.ini"
-          $DEBUG && echo "done."
-        fi
-
-	$DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
-	/usr/bin/mldonkey_users --add admin -q -f "$new_mldonkey_dir/users.ini" -p $password
-	$DEBUG && echo "done."
-      fi
+        if [ -n "$password" ]; then
+            $DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
+            /usr/bin/mlnet -useradd "admin $password"
+            $DEBUG && echo "done."
+        fi
 
       ####################
       # Files permission #

Modified: trunk/packages/mldonkey/trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/patches/00list?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/patches/00list (original)
+++ trunk/packages/mldonkey/trunk/debian/patches/00list Tue Jan 16 23:34:50 2007
@@ -1,1 +1,3 @@
 01_see
+useradd
+avoid-duplicate-sending

Added: trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch?rev=3520&op=file
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch (added)
+++ trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch Tue Jan 16 23:34:50 2007
@@ -1,0 +1,141 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## avoid-duplicate-sending.dpatch by Samuel Mimram <smimram at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix a serious bug which lead mldonkey to uploading data blocks twice to eMule clients.
+## DP: See bug #406247.
+
+ at DPATCH@
+diff -urNad mldonkey-2.8.2~/src/networks/donkey/donkeyClient.ml mldonkey-2.8.2/src/networks/donkey/donkeyClient.ml
+--- mldonkey-2.8.2~/src/networks/donkey/donkeyClient.ml	2006-11-26 16:36:29.000000000 +0000
++++ mldonkey-2.8.2/src/networks/donkey/donkeyClient.ml	2007-01-16 18:09:54.000000000 +0000
+@@ -442,15 +442,17 @@
+   
+ let new_chunk up begin_pos end_pos =
+   if begin_pos <> end_pos then
+-    let pair = (begin_pos, end_pos) in
+-    (match up.up_chunks with
+-        [] ->
++    let chunk = (begin_pos, end_pos) in
++    (* the zone requested is already "in the pipe" *)
++    if not (List.mem chunk up.up_flying_chunks) then
++      match up.up_chunks with
++      | [] ->
+           up.up_pos <- begin_pos;
+           up.up_end_chunk <- end_pos;
+-          up.up_chunks <- [pair];
+-      | chunks ->
+-          if not (List.mem pair chunks) then
+-            up.up_chunks <- chunks @ [pair])
++          up.up_chunks <- [chunk];
++      | up_chunks ->
++          if not (List.mem chunk up_chunks) then
++            up.up_chunks <- up_chunks @ [chunk]
+   
+ let identify_client_brand c =
+   if c.client_brand = Brand_unknown then
+@@ -2039,13 +2041,21 @@
+         set_rtimeout sock !!upload_timeout;
+         
+         let up, waiting = match c.client_upload with
+-            Some ({ up_file = f } as up) when f == file ->  up, up.up_waiting
++          | Some ({ up_file = f } as up) when f == file ->
++	      (* zones are received in the order they're sent, so we
++		 know that the oldest of the zones "in fly" must have
++		 been received when this QueryBlockReq was sent *)
++	      (match up.up_flying_chunks with
++	       | [] -> () 
++	       | _ :: q -> up.up_flying_chunks <- q);
++	      up, up.up_waiting
+           | Some old_up ->
+               {
+                 up_file = file;
+                 up_pos = Int64.zero;
+                 up_end_chunk = Int64.zero;
+                 up_chunks = [];
++		up_flying_chunks = [];
+                 up_waiting = old_up.up_waiting;
+               }, old_up.up_waiting
+           | _ ->
+@@ -2054,6 +2064,7 @@
+                 up_pos = Int64.zero;
+                 up_end_chunk = Int64.zero;
+                 up_chunks = [];
++		up_flying_chunks = [];
+                 up_waiting = false;
+               }, false
+         in
+@@ -2141,12 +2152,12 @@
+ let init_client sock c =
+   set_handler sock WRITE_DONE (fun s ->
+       match c.client_upload with
+-        None -> ()
+-      | Some up ->
++      | Some ({ up_chunks = _ :: _ } as up) ->
+           if not up.up_waiting && !CommonUploads.has_upload = 0 then begin
+               up.up_waiting <- true;
+               CommonUploads.ready_for_upload (as_client c)
+             end
++      | _ -> ()
+   );
+ (*
+   set_handler sock (BASIC_EVENT RTIMEOUT) (fun s ->
+diff -urNad mldonkey-2.8.2~/src/networks/donkey/donkeyFiles.ml mldonkey-2.8.2/src/networks/donkey/donkeyFiles.ml
+--- mldonkey-2.8.2~/src/networks/donkey/donkeyFiles.ml	2006-11-21 22:34:33.000000000 +0000
++++ mldonkey-2.8.2/src/networks/donkey/donkeyFiles.ml	2007-01-16 18:09:54.000000000 +0000
+@@ -123,7 +123,7 @@
+ (*      lprintf "send_client_block\n"; *)
+       if per_client > 0 && CommonUploads.can_write_len sock max_msg_size then
+         match c.client_upload with
+-        | Some ({ up_chunks = _ :: chunks } as up)  ->
++        | Some ({ up_chunks = current_chunk :: chunks } as up)  ->
+             if up.up_file.file_shared = None then begin
+ (* Is there a message to warn that a file is not shared anymore ? *)
+                 c.client_upload <- None;
+@@ -134,16 +134,17 @@
+             if max_len <= msg_block_size_int then
+ (* last block from chunk *)
+               begin
++                send_small_block c sock up.up_file up.up_pos max_len;
+                 if !verbose_upload then
+                     lprintf_nl "End of chunk (%d) %Ld %s" max_len up.up_end_chunk (file_best_name up.up_file);
+-                send_small_block c sock up.up_file up.up_pos max_len;
++		up.up_flying_chunks <- up.up_flying_chunks @ [current_chunk];
+                 up.up_chunks <- chunks;
+                 let per_client = per_client - max_len in
+                 match chunks with
+-                  [] -> 
++		| [] -> 
+                     if !verbose_upload then
+-                        lprintf_nl "NO CHUNKS";
+-                    c.client_upload <- None;
++                        lprintf_nl "NO MORE CHUNKS";
++		    up.up_waiting <- false;
+                 | (begin_pos, end_pos) :: _ ->
+                     up.up_pos <- begin_pos;
+                     up.up_end_chunk <- end_pos;
+@@ -168,10 +169,10 @@
+           let size = min max_msg_size size in
+           send_client_block c sock size;
+            (match c.client_upload with
+-              None -> ()
+-            | Some up ->
++            | Some ({ up_chunks = _ :: _ }) ->
+                 if !CommonUploads.has_upload = 0 then
+                   CommonUploads.ready_for_upload (as_client c)
++	    | _ -> ()
+           )
+       )
+     let _ =
+diff -urNad mldonkey-2.8.2~/src/networks/donkey/donkeyTypes.ml mldonkey-2.8.2/src/networks/donkey/donkeyTypes.ml
+--- mldonkey-2.8.2~/src/networks/donkey/donkeyTypes.ml	2006-11-26 16:36:29.000000000 +0000
++++ mldonkey-2.8.2/src/networks/donkey/donkeyTypes.ml	2007-01-16 18:09:54.000000000 +0000
+@@ -602,6 +602,8 @@
+     mutable up_pos : int64;
+     mutable up_end_chunk : int64;
+     mutable up_chunks : (int64 * int64) list;
++    (* zones sent but not yet received by other peer, oldest first *)
++    mutable up_flying_chunks : (int64 * int64) list; 
+     mutable up_waiting : bool;
+   }
+ 

Propchange: trunk/packages/mldonkey/trunk/debian/patches/avoid-duplicate-sending.dpatch
------------------------------------------------------------------------------
    svn:executable = *

Added: trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch?rev=3520&op=file
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch (added)
+++ trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch Tue Jan 16 23:34:50 2007
@@ -1,0 +1,35 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## useradd.dpatch by spiralvoice <spiralvoice at hotmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add an useradd command to mldonkey to add users.
+## DP: See bug #397497.
+
+ at DPATCH@
+diff -urNad mldonkey-2.8.2~/src/daemon/driver/driverMain.ml mldonkey-2.8.2/src/daemon/driver/driverMain.ml
+--- mldonkey-2.8.2~/src/daemon/driver/driverMain.ml	2006-11-28 23:15:21.000000000 +0000
++++ mldonkey-2.8.2/src/daemon/driver/driverMain.ml	2007-01-16 17:51:29.000000000 +0000
+@@ -306,6 +306,23 @@
+       "-pid", Arg.String (fun s -> pid := s;
+       ),
+        _s ": directory for pid file";
++      "-useradd", Arg.Rest (fun s ->
++        (match String2.split s ' ' with
++        | user :: pass :: _ ->
++            if user2_user_exists user then
++              begin
++                user2_user_set_password (user2_user_find user) pass;
++                Printf.printf "%sPassword of user %s changed\n%!" (log_time ()) user
++              end
++            else
++              begin
++                user2_user_add user (Md4.Md4.string pass) ();
++                Printf.printf "%sUser %s added\n%!" (log_time ()) user
++              end;
++            Options.save_with_help_private users_ini;
++            Printf.printf "%sSaved changes to users.ini\n%!" (log_time ())
++        | _ -> raise (Arg.Bad "invalid syntax"));
++          exit 0), _s "<user> <pass> : create user/change password";
+     ] @
+       !more_args
+       @

Propchange: trunk/packages/mldonkey/trunk/debian/patches/useradd.dpatch
------------------------------------------------------------------------------
    svn:executable = *

Modified: trunk/packages/mldonkey/trunk/debian/utils/parse_options.mly
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/mldonkey/trunk/debian/utils/parse_options.mly?rev=3520&op=diff
==============================================================================
--- trunk/packages/mldonkey/trunk/debian/utils/parse_options.mly (original)
+++ trunk/packages/mldonkey/trunk/debian/utils/parse_options.mly Tue Jan 16 23:34:50 2007
@@ -20,7 +20,7 @@
 %type <Type_options.file> main
 %%
 main:
-  COMMENT main  { Comment ($1,$2) }  
+  COMMENT main  { $2 (* Comment ($1,$2) *) }  
 | options main  { Options ($1,$2) }
 | EOF    { Eof }
 | END_MOD  { Eof }
@@ -42,5 +42,3 @@
 parse_options SEP_LIST parse_list  { $1 :: $3 }
 | parse_options END_LIST    { [ $1 ] }
 | END_LIST        { [] }
-
-




More information about the Pkg-ocaml-maint-commits mailing list