Hi Francesco,

That wasn't a dumb question at all: it's the first time this issue occurs.

On Wed, Jan 12, 2011 at 1:23 AM, Francesco P. Sileno <[email protected]> wrote:
> One of them is setup as follow:
>        (password == "#removed#" and 1w and 23h-01h)
>
> Which should mean "from 11pm of monday to 01am of the day after".

I agree that we want to read it that way, but (as you observed) this
is wrong. But it's not a bug. When you write 23h-01h you're specifying
a time interval independent of the day, so the day isn't taken into
account when the interval is checked: it works whenever the hour H is
>=23 or <1.

> So now I suppose I have to split that declaration in two pieces:
>        (password == "#removed#" and 1w and 23h-00h)
>        or
>        (password == "#removed#" and 2w and 00h-01h)

This is correct. You can compact it as (password == "foo" and (THIS or
THAT)). But an even better solution comes from my explanation above:
put the weekday with the hour and just use the interval 1w23h-2w01h.

> Sorry to ask here before trying, but I won't have time to try on my test
> installation in the next days, and I'm curious. :)

It's not obvious how to test intervals. In fact, you have to modify
them to the current time, which is annoying... But that's what I did:

$ liquidsoap 'print(7w1h-1w0h30m)'
true

It's currently sunday after 1am but before monday 0:30am. But not
beween saturday 1m and sunday 0:30am:

$ liquidsoap 'print(6w1h-7w0h30m)'
false

> What also if I did like to enhance the log message reported for the
> authentication failure, so I can know if that was a wrong password or an
> out-of-time or a someone-is-already-here error? Can it be done?

Yes, something like:
 pass_ok = (password == "...")
 time_ok = (1w23h-2w01h)
 if not(pass_ok) then log("invalid password")
 if not(time_ok) then log("not allowed at this time")
 pass_ok and log_og

Enjoy!
--
David

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to