diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/common/commonInteractive.ml ./src/daemon/common/commonInteractive.ml
--- ./src/daemon/common/commonInteractive.ml	2006-09-23 22:29:46.000000000 +0200
+++ ./src/daemon/common/commonInteractive.ml	2006-10-24 21:52:46.000000000 +0200
@@ -249,6 +249,24 @@
 
             if Unix2.is_directory file_name then Unix2.remove_all_directory file_name;
 
+(* if user_chown is set, chown file to Unix user and group of MLDonkey core *)
+	    begin
+	      let user = file_owner file in
+	      if user2_user_chown user then
+	      try
+		let unix_user = Unix.getpwnam user in
+		begin
+		  try
+		    Unix.chown new_name unix_user.Unix.pw_uid (Unix.getgid ())
+		  with e ->
+		    lprintf_nl "Exception %s while chmod of %s to user %s"
+		      (Printexc2.to_string e) new_name user
+		end
+	      with Not_found ->
+                  lprintf_nl "Can not chmod %s to user %s, system user %s does not exist."
+                    new_name user user
+	    end;
+
             let impl = as_file_impl file in
 (* When the commit action is called, the file is supposed not to exist anymore. *)
             impl.impl_file_ops.op_file_commit impl.impl_file_val new_name;
diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/common/commonUserDb.ml ./src/daemon/common/commonUserDb.ml
--- ./src/daemon/common/commonUserDb.ml	2006-09-19 19:07:42.000000000 +0200
+++ ./src/daemon/common/commonUserDb.ml	2006-10-24 21:12:06.000000000 +0200
@@ -42,6 +42,7 @@
     user_default_group : string option;
     user_mail : string;
     user_commit_dir : string;
+    user_chown : bool;
     user_max_concurrent_downloads : int;
   }
 
@@ -187,6 +188,11 @@
               get_value "user_commit_dir" value_to_string
             with _ -> ""
           in
+          let uchown =
+	    try
+              get_value "user_chown" value_to_bool
+            with _ -> false
+          in
           let umaxdl =
 	    try
               get_value "user_max_concurrent_downloads" value_to_int
@@ -222,6 +228,7 @@
 	    user_default_group = udgroup;
 	    user_mail = umail; 
 	    user_commit_dir = ucdir; 
+	    user_chown = uchown; 
 	    user_max_concurrent_downloads = umaxdl; 
 	  }
 
@@ -235,6 +242,7 @@
         "user_default_group", option_to_stringvalue user.user_default_group;
         "user_mail", string_to_value user.user_mail;
         "user_commit_dir", string_to_value user.user_commit_dir;
+        "user_chown", bool_to_value user.user_chown;
         "user_max_concurrent_downloads", int_to_value user.user_max_concurrent_downloads;
       ]
 
@@ -250,6 +258,7 @@
 user_groups                   = Files belonging to one of these groups can be seen by the user.
 user_default_group            = New downloads by this user will belong to this group.
 user_commit_dir               = Commit files to <incoming>/<user_commit_dir>
+user_chown                    = Chown committed file to Unix user <user_name>, if it exists.
 user_max_concurrent_downloads = Maximum number of downloads allowed, 0 = unlimited
 "
     (list_option UserOption.t)
@@ -259,6 +268,7 @@
         user_default_group = Some system_user_default_group;
         user_mail = "";
         user_commit_dir = "";
+        user_chown = false;
         user_max_concurrent_downloads = 0;
     } ]
 
@@ -276,7 +286,7 @@
 
 let user2_user_add name pass ?(groups = [system_user_default_group])
 			     ?(default_group = Some system_user_default_group)
-			     ?(mail = "") ?(commit_dir = "") ?(max_dl = 0) () =
+			     ?(mail = "") ?(commit_dir = "") ?(chown = false) ?(max_dl = 0) () =
   let groups =
     let l =
       (List.filter (fun g -> user2_group_exists g) groups)
@@ -297,6 +307,7 @@
       user_default_group = default_group;
       user_mail = mail;
       user_commit_dir = commit_dir;
+      user_chown = chown;
       user_max_concurrent_downloads = max_dl;
   } in
   userlist =:= new_user :: List.filter (fun u -> u.user_name <> name) !!userlist
@@ -395,6 +406,25 @@
   userlist =:= new_user :: List.filter (fun u -> u.user_name <> user) !!userlist
 
 (*************************************************************************)
+(*                 User database functions / chown                       *)
+(*************************************************************************)
+
+let user2_user_chown user =
+  (user2_user_find user).user_chown
+
+let user2_print_user_chown user =
+  try
+    if user2_user_chown user then "true" else "false"
+  with Not_found -> "false"
+
+let user2_user_set_chown user chown =
+  let new_user = {
+    (user2_user_find user) with
+    user_chown = chown
+  } in
+  userlist =:= new_user :: List.filter (fun u -> u.user_name <> user) !!userlist
+
+(*************************************************************************)
 (*                         User/Group database functions                 *)
 (*************************************************************************)
 
diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/driver/driverCommands.ml ./src/daemon/driver/driverCommands.ml
--- ./src/daemon/driver/driverCommands.ml	2006-10-23 15:08:30.000000000 +0200
+++ ./src/daemon/driver/driverCommands.ml	2006-10-24 21:40:34.000000000 +0200
@@ -2873,6 +2873,22 @@
 	_s ""
     ), "<user> <dir> :\t\tchange user specific commit directory";
 
+    "userchown", Arg_two (fun user chown o ->
+        let buf = o.conn_buf in
+        if user2_is_admin o.conn_user.ui_user_name
+	  || o.conn_user.ui_user_name = (find_ui_user user).ui_user_name then
+	  begin
+	    try
+	      user2_user_set_chown user (bool_of_string chown);
+	      print_command_result o buf (Printf.sprintf "Changed user_chown of user %s to %s" user (user2_print_user_chown user))
+	    with
+	      Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user)
+	    | Invalid_argument s -> print_command_result o buf (Printf.sprintf "error %s while parsing command userchown" s)
+	  end
+        else print_command_result o buf "You are not allowed to change this value";
+	_s ""
+    ), "<user> <true|false> :\t\tshould chown <user> be called on committed files";
+
     "groupadd", Arg_multiple (fun args o ->
         let buf = o.conn_buf in
 	let add_new_group group admin mail =
@@ -2943,6 +2959,7 @@
               ( "0", "srh", "Default group", "Default group" ) ;
               ( "0", "srh", "Mail address", "Email" ) ;
               ( "0", "srh", "Commit dir", "Commit dir" ) ;
+              ( "0", "srh ac", "Chown", "Chown" ) ;
               ( "0", "srh ar", "Download quota", "Max DLs" ) ;
               ( "0", "srh ar", "Download count", "DLs" ) ];
 
@@ -2976,6 +2993,8 @@
 		Printf.bprintf buf
 		  "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (user2_print_user_commit_dir user.user_name);
 		Printf.bprintf buf
+		  "\\<td class=\\\"sr ac\\\"\\>%s\\</td\\>" (user2_print_user_chown user.user_name);
+		Printf.bprintf buf
 		  "\\<td class=\\\"sr ar\\\"\\>%s\\</td\\>" (user2_print_user_dls user.user_name);
 		Printf.bprintf buf
 		  "\\<td class=\\\"sr ar\\\"\\>%d\\</td\\>" u_dls
