demexp-dev
[Top][All Lists]
Advanced

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

Re: [Demexp-dev] Problem with preference saving ?


From: Thomas Petazzoni
Subject: Re: [Demexp-dev] Problem with preference saving ?
Date: Wed, 28 Sep 2005 00:38:22 +0200
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050802)

Hi,

Thomas Petazzoni a écrit :

> After a small modification of the server, I've been able to see that the
> received password is really "demexp", as suggested by the network trace.

Ok, I *think* I've found the bug. (Line numbers refers to 0.6.2).

In srv/participants.ml.nw, the function which is in charge of creating
the default root login (with the demexp password) is
initialize_default_participant_base. After a quick grep inside
srv/*.ml.nw, I found two places where this function is called:
 - inside the participants autotest
 - in src/demexp-server.ml.nw

In srv/demexp-server.ml.nw, line 290, we can read:

  if !flag_autotests then (
    log "server: use default participant base";
    Participants.initialize_default_participant_base ()
   ) else
    log "server: use bases '%s'" !flag_bases_name;
  start_server ()

If I correctly read OCaml, it means that
initialize_default_participant_base() is called *only* in the case of
autotests. Otherwise, start_server() is called, will try to load a
bases.dmxp file, won't find it... and will run the server with not
default root login.

Is that right ?

Anyway, the enclosed patch fixes it. It simply calls the
initialize_default_participant_base() when the base loading fails. I
don't think io.ml is the right place to call this function (should be
done in demexp-server.ml), but as I'm an OCaml newbie, this is just a
quick and dirty fix.

(The !flag_autotests notation is quite strange for the C programmer,
which may think that it's the same as if flag_autotests == FALSE. In
fact, after a quick read inside Weis and Leroy book, I've
(re)-discovered that it's like the '*' in C, a dereference operator. Funny).

Sincerly,

Thomas

--- demexp-0.6.2/srv/io.ml.nw   2005-09-28 00:36:50.000000000 +0200
+++ demexp-0.6.2-new/srv/io.ml.nw       2005-09-28 00:37:02.000000000 +0200
@@ -103,5 +103,6 @@
     log " done."
    ) else
     log " File \"%s\" does not exists. Don't load bases." filename;
+    Participants.initialize_default_participant_base () ;
   flush_all ()
 @
-- 
PETAZZONI Thomas - address@hidden
http://{thomas,sos,kos}.enix.org - Jabber: address@hidden
http://{agenda,livret}dulibre.org
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E  1624 F653 CB30 98D3 F7A7

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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