mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/config/mingw/mlU...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/config/mingw/mlU...
Date: Wed, 06 Feb 2008 20:39:54 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       08/02/06 20:39:54

Modified files:
        distrib        : ChangeLog 
        src/config/mingw: mlUnix.ml 
        src/config/unix: mlUnix.ml 
        src/daemon/common: commonOptions.ml 
        src/daemon/driver: driverInteractive.ml driverMain.ml 
        src/utils/lib  : options.ml4 

Log message:
        patch #6407

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1358&r2=1.1359
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/config/mingw/mlUnix.ml?cvsroot=mldonkey&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/config/unix/mlUnix.ml?cvsroot=mldonkey&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.220&r2=1.221
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInteractive.ml?cvsroot=mldonkey&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverMain.ml?cvsroot=mldonkey&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.ml4?cvsroot=mldonkey&r1=1.28&r2=1.29

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1358
retrieving revision 1.1359
diff -u -b -r1.1358 -r1.1359
--- distrib/ChangeLog   6 Feb 2008 20:21:34 -0000       1.1358
+++ distrib/ChangeLog   6 Feb 2008 20:39:53 -0000       1.1359
@@ -15,6 +15,9 @@
 =========
 
 2008/02/06
+6407: New options run_as_group/run_as_groupgid
+- works the same way as options run_as_user/run_as_useruid
+- display system user:group running MLDonkey core in runinfo
 6406: Mail: Fix bug in rfc2047 encoding
 
 2008/02/05

Index: src/config/mingw/mlUnix.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/config/mingw/mlUnix.ml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/config/mingw/mlUnix.ml  20 Feb 2006 01:30:19 -0000      1.10
+++ src/config/mingw/mlUnix.ml  6 Feb 2008 20:39:53 -0000       1.11
@@ -65,6 +65,7 @@
 *)
 
 let setuid uid = ()
+let setgid gid = ()
 let set_close_on_exec fd = ()
 let set_signal signal f = Sys.set_signal signal f
   

Index: src/config/unix/mlUnix.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/config/unix/mlUnix.ml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/config/unix/mlUnix.ml   20 Feb 2006 01:30:19 -0000      1.15
+++ src/config/unix/mlUnix.ml   6 Feb 2008 20:39:53 -0000       1.16
@@ -94,6 +94,7 @@
   | id -> ignore (snd(Unix.waitpid [] id))
       
 let setuid = Unix.setuid
+let setgid = Unix.setgid
 let set_close_on_exec = Unix.set_close_on_exec
 let set_signal signal f = Sys.set_signal signal f
   

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -b -r1.220 -r1.221
--- src/daemon/common/commonOptions.ml  4 Feb 2008 23:58:22 -0000       1.220
+++ src/daemon/common/commonOptions.ml  6 Feb 2008 20:39:53 -0000       1.221
@@ -1260,17 +1260,27 @@
 let run_as_user = define_option current_section ["run_as_user"]
   ~restart: true
   "The login of the user you want mldonkey to run as, after the ports
-  have been bound (can be use not to run with root priviledges when
+  have been bound (can be used not to run with root privileges when
   a port < 1024 is needed)"
     string_option ""
 
 let run_as_useruid = define_option current_section ["run_as_useruid"]
   ~restart: true
   "The UID of the user (0=disabled) you want mldonkey to run as, after the 
ports
-  have been bound (can be use not to run with root priviledges when
+  have been bound (can be used not to run with root privileges when
   a port < 1024 is needed)"
     int_option 0
 
+let run_as_group = define_option current_section ["run_as_group"]
+  ~restart: true
+  "The group of run_as_user user to be used"
+    string_option ""
+
+let run_as_groupgid = define_option current_section ["run_as_groupgid"]
+  ~restart: true
+  "The group of run_as_user user to be used"
+    int_option 0
+
 let ask_for_gui = define_option current_section ["ask_for_gui"]
   "Ask for GUI start"
     bool_option false

Index: src/daemon/driver/driverInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- src/daemon/driver/driverInteractive.ml      19 Jan 2008 11:37:05 -0000      
1.135
+++ src/daemon/driver/driverInteractive.ml      6 Feb 2008 20:39:53 -0000       
1.136
@@ -1970,12 +1970,21 @@
   let list = ref [] in
   tack list
     (
-      "User:\t\t", 
-      Printf.sprintf "%s (%s) - uptime: %s" 
+      "MLDonkey user:\t\t", 
+      Printf.sprintf "%s (%s) - uptime: %s%s"
        o.conn_user.ui_user.user_name
        (if has_empty_password o.conn_user.ui_user then "Warning: empty 
Password"
        else "PW Protected")
        (Date.time_to_string (last_time () - start_time) "verbose")
+        (
+        let user_group =
+          (try Some (Unix.getpwuid (Unix.getuid())).Unix.pw_name with _ -> 
None),
+          (try Some (Unix.getgrgid (Unix.getgid())).Unix.gr_name with _ -> 
None)
+        in
+        match user_group with
+        | (Some g, Some u) -> Printf.sprintf " - running as %s:%s" u g
+        | _ -> ""
+        )
     );
   tack list
     (

Index: src/daemon/driver/driverMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverMain.ml,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- src/daemon/driver/driverMain.ml     20 Oct 2007 20:02:13 -0000      1.143
+++ src/daemon/driver/driverMain.ml     6 Feb 2008 20:39:53 -0000       1.144
@@ -565,6 +565,28 @@
             );
   );
 
+  if !!run_as_group <> "" then begin
+      try
+        let new_gr = Unix.getgrnam !!run_as_group in
+        MlUnix.setgid new_gr.Unix.gr_gid;
+        let gr = Unix.getgrgid (Unix.getgid()) in
+        lprintf_nl (_b "mldonkey is now running as group %s") gr.Unix.gr_name;
+      with e ->
+          lprintf_nl (_b "Exception %s trying to set group_gid [%s]")
+          (Printexc2.to_string e) !!run_as_group;
+          exit 67
+    end;
+
+  if !!run_as_groupgid <> 0 then begin
+      try
+        MlUnix.setgid !!run_as_groupgid;
+        lprintf_nl (_b "mldonkey is now running as gid %d")  !!run_as_groupgid;
+      with e ->
+          lprintf_nl (_b "Exception %s trying to set group_gid [%d]")
+          (Printexc2.to_string e) !!run_as_groupgid;
+          exit 67
+    end;
+
   if !!run_as_user <> "" then begin
       try
         let new_pw = Unix.getpwnam !!run_as_user in

Index: src/utils/lib/options.ml4
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- src/utils/lib/options.ml4   25 Jul 2007 19:27:09 -0000      1.28
+++ src/utils/lib/options.ml4   6 Feb 2008 20:39:53 -0000       1.29
@@ -1179,7 +1179,7 @@
        "-" ^ oi.M.option_name,
        Arg.String
          (fun s ->
-            lprintf "Setting option %s\n" oi.M.option_name;
+            lprintf_nl "Setting option %s" oi.M.option_name;
             set_simple_option opfile oi.M.option_name s),
        Printf.sprintf "<string> : \t%s (current: %s)"
          oi.M.option_help oi.M.option_value)




reply via email to

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