mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Fri, 03 Feb 2006 03:12:14 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/02/03 03:12:14

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonOptions.ml 
        src/daemon/driver: driverControlers.ml driverInteractive.ml 
                           driverInterface.ml driverMain.ml 

Log message:
        patch #4860

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.704&tr2=1.705&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonOptions.ml.diff?tr1=1.123&tr2=1.124&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml.diff?tr1=1.37&tr2=1.38&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverMain.ml.diff?tr1=1.95&tr2=1.96&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.704 mldonkey/distrib/ChangeLog:1.705
--- mldonkey/distrib/ChangeLog:1.704    Fri Feb  3 01:18:59 2006
+++ mldonkey/distrib/ChangeLog  Fri Feb  3 03:12:14 2006
@@ -15,6 +15,10 @@
 =========
 
 2006/02/03
+4860: Multiuser: print warning if admin password is empty
+- user admin is re-created if deleted, it has to be present in any case because
+  some commands are only available for admin,  like users, remove_user and kill
+- create structure for startup messages, displayed on GUI, HTML, Telnet
 4859: Multiuser: Only user "admin" is allowed to change options
       if the new option enable_user_config (default true) is set to false
 4858: HTML: Update some links to mldonkey.sf.net
Index: mldonkey/src/daemon/common/commonOptions.ml
diff -u mldonkey/src/daemon/common/commonOptions.ml:1.123 
mldonkey/src/daemon/common/commonOptions.ml:1.124
--- mldonkey/src/daemon/common/commonOptions.ml:1.123   Fri Feb  3 01:10:45 2006
+++ mldonkey/src/daemon/common/commonOptions.ml Fri Feb  3 03:12:14 2006
@@ -26,6 +26,8 @@
 open Unix
 
 
+let startup_message = ref ""
+
 let bin_dir = Filename.dirname Sys.argv.(0)
 
 let hidden_dir_prefix =
@@ -117,7 +119,9 @@
   end;
   if not (Sys.file_exists file_basedir) then begin
     lprint_newline ();
-    lprintf_nl "creating new MLDonkey base directory in %s\n" file_basedir end;
+    lprintf_nl "creating new MLDonkey base directory in %s\n" file_basedir;
+    startup_message := (Printf.sprintf "MLDonkey created a new home directory 
in %s\n" file_basedir)
+  end;
   (try
      Unix2.safe_mkdir file_basedir
    with e ->
@@ -128,7 +132,8 @@
   Unix.chdir file_basedir;
 
   if (String2.starts_with (Filename.basename Sys.argv.(0)) "mlnet")
-    && not Autoconf.windows && not (Autoconf.system = "morphos") && not 
(Sys.file_exists "/dev/urandom") then begin
+    && not Autoconf.windows && not (Autoconf.system = "morphos") &&
+       not (Autoconf.donkey_sui = "yes") && not (Sys.file_exists 
"/dev/urandom") then begin
       lprintf "%s" (exit_message_dev "urandom");
       if Autoconf.system = "hpux" then
         lprintf_nl "For HP-UX get urandom support from 
http://www.josvisser.nl/hpux11-random";;
@@ -1316,7 +1321,7 @@
 
 let motd_html = define_expert_option current_section ["motd_html"]
     "Message printed at startup (automatically downloaded from the previous
-    URL directory" string_option "<br><div align=\"center\"><h3>Welcome to 
MLdonkey</h3></div>"
+    URL directory" string_option "<br><div align=\"center\"><h3>Welcome to 
MLDonkey</h3></div>"
 
 let compaction_delay = define_expert_option current_section 
["compaction_delay"]
     "Force compaction every <n> hours (in [1..24])"
Index: mldonkey/src/daemon/driver/driverControlers.ml
diff -u mldonkey/src/daemon/driver/driverControlers.ml:1.60 
mldonkey/src/daemon/driver/driverControlers.ml:1.61
--- mldonkey/src/daemon/driver/driverControlers.ml:1.60 Fri Feb  3 01:10:45 2006
+++ mldonkey/src/daemon/driver/driverControlers.ml      Fri Feb  3 03:12:14 2006
@@ -601,10 +601,11 @@
 
         before_telnet_output o sock;
         TcpBufferedSocket.write_string sock
-          (Printf.sprintf "Welcome to MLDonkey %s" Autoconf.current_version);
+          (Printf.sprintf "Welcome to MLDonkey %s\n" Autoconf.current_version);
+        TcpBufferedSocket.write_string sock 
(DriverInteractive.real_startup_message ());
 
         TcpBufferedSocket.write_string sock (dollar_escape o false
-            "\n$cWelcome on mldonkey command-line$n\n\nUse $r?$n for 
help\n\n");
+            "$cWelcome on mldonkey command-line$n\n\nUse $r?$n for help\n\n");
 
         after_telnet_output o sock
        end
@@ -1146,7 +1147,9 @@
         | "oneframe.html" ->
             html_open_page buf t r true;
             Buffer.add_string buf !!motd_html;
-           Buffer.add_string buf "<p><pre>";
+           Buffer.add_string buf "<p><pre><b><h3>";
+            Buffer.add_string buf (DriverInteractive.real_startup_message ());
+           Buffer.add_string buf "</b></h3>";
            ignore (buildinfo false buf);
            Buffer.add_string buf "\n";
            ignore (runinfo false buf);
Index: mldonkey/src/daemon/driver/driverInteractive.ml
diff -u mldonkey/src/daemon/driver/driverInteractive.ml:1.59 
mldonkey/src/daemon/driver/driverInteractive.ml:1.60
--- mldonkey/src/daemon/driver/driverInteractive.ml:1.59        Sun Jan 29 
18:39:28 2006
+++ mldonkey/src/daemon/driver/driverInteractive.ml     Fri Feb  3 03:12:14 2006
@@ -37,7 +37,44 @@
 open CommonTypes
 open Int64ops
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s"
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s"
+    (log_time ()); lprintf
+
+let verify_user_admin () =
+  let warning =
+    "SECURITY WARNING: user admin has an empty password, use command: add_user 
admin password\n"
+  in
+  let found = ref false in
+  let empty_password = ref false in
+  List.iter (fun (user,pass) ->
+    if user = "admin" then begin
+      found := true;
+      if pass = Md4.string "" then
+        empty_password := true
+    end
+  ) !!users;
+  if not !found then begin
+    lprintf_nl () "SECURITY INFO: user 'admin' has to be present, creating...";
+    users =:= ("admin", Md4.string "") :: !!users;
+    empty_password := true
+  end;
+  if !empty_password then
+    begin
+      lprintf_n () "%s" warning;
+      warning
+    end
+  else ""
 
+let real_startup_message () =
+  !startup_message ^ (verify_user_admin ())
+      
 (* ripped from gui_downloads *)
 
 let calc_file_eta f =
Index: mldonkey/src/daemon/driver/driverInterface.ml
diff -u mldonkey/src/daemon/driver/driverInterface.ml:1.37 
mldonkey/src/daemon/driver/driverInterface.ml:1.38
--- mldonkey/src/daemon/driver/driverInterface.ml:1.37  Fri Feb  3 01:10:45 2006
+++ mldonkey/src/daemon/driver/driverInterface.ml       Fri Feb  3 03:12:14 2006
@@ -386,7 +386,8 @@
   gui.gui_initialized <- true;
   networks_iter_all (fun n ->
       gui_send gui (Network_info (network_info n)));
-  gui_send gui (Console (DriverControlers.text_of_html !!motd_html));
+  gui_send gui (Console ((DriverControlers.text_of_html !!motd_html) ^ "\n"));
+  gui_send gui (Console (DriverInteractive.real_startup_message ()));
   
   
   if gui.gui_poll then begin
Index: mldonkey/src/daemon/driver/driverMain.ml
diff -u mldonkey/src/daemon/driver/driverMain.ml:1.95 
mldonkey/src/daemon/driver/driverMain.ml:1.96
--- mldonkey/src/daemon/driver/driverMain.ml:1.95       Fri Feb  3 00:35:17 2006
+++ mldonkey/src/daemon/driver/driverMain.ml    Fri Feb  3 03:12:14 2006
@@ -275,6 +275,7 @@
   (try
       Options.load downloads_ini;
       Options.load users_ini;
+      ignore (DriverInteractive.verify_user_admin ())
     with e ->
         lprintf_nl () "Exception %s during options load" (Printexc2.to_string 
e);
         exit 70);




reply via email to

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