SQUIDGUARD Times- date range bug?



  • When I go to squidguard, in the "times" option to create an hour plan the system will not let me save the date range: 2017.11.02-2017.12.03 or any other

    in fact any range that you try to add will give a message stating that it does not agree with the correct mask, but the right way to add a date range is this one, right?



  • :o Curious! Same to me.


  • Banned

    Probably never worked. Once again got lost in the shitty code, the guy who wrote this must have been smoking something extremely strong. Unless you provide a patch noone's going to fix it.

    squidguard_validate_times() -> sg_check_time() ->



  • @doktornotor:

    Probably never worked. Once again got lost in the shitty code, the guy who wrote this must have been smoking something extremely strong. Unless you provide a patch noone's going to fix it.

    squidguard_validate_times() -> sg_check_time()

    @docktornotor thanks for the indication of the file to be changed. I have reviewed the file and fix the bug. @Marco Noronha, Now we can have timerange in pfsense's Squidguard configurator.  ;D ;D ;D

    To fix, just edit the squidguard_configurator.inc file.

    Patch to file on pfsense: /usr/local/pkg/squidguard_configurator.inc

    ## line 285

    New value:

    define('F_DATERANGE',            'daterange');
    

    This change will fix a typo.

    Old value:

    define('F_DATRANGE',            'daterange');
    

    ## line 1838
    New value:

    $dtfmt = "/^([0-9]{4})\.([0-9]{2})\.([0-9]{2})\-([0-9]{4})\.([0-9]{2})\.([0-9]{2})$/i";
    

    This change will fix the date comparison variable in case of date range

    Old value:

    $dtfmt = "/^([0-9]{4})\.([0-9]{2})\.([0-9]{2})/i";
    

    ## line 1841
    New value:

    if (preg_match("{$dtfmt}", $val)) {
    

    This change will fix the date range comparison

    Old value:

    if (preg_match("{$dtfmt}-{$dtfmt}$", $val)) {
    

    And FINALLY… 8)

    ## line 1846
    New value:

    elseif (!preg_match("/^(([0-9]{4})|[*])\.(([0-9]{2})|[*])\.(([0-9]{2})|[*])$|^([0-9]{4})\.([0-9]{2})\.([0-9]{2})\-([0-9]{4})\.([0-9]{2})\.([0-9]{2})$/i", $val)) {
    [i]This change is the solution to the main complaint in this post. It will make it possible to create the date range in all possible squidguard patterns.[/i]
    
    Old value:    
    [code]elseif (!preg_match("/^(([0-9]{4})|[*])\.(([0-9]{2})|[*])\.(([0-9]{2})|[*])$/i", $val)) {
    
    [b][BONUS][/b] How to set "date" to default option on TIME TYPE field on SG configurator instead of "weekly".
    
    Patch to file: /usr/local/pkg/squidguard_time.xml
    
    [b]## line 108[/b]
    
    New Value:
    [code]<value>date</value>[/code]
    
    Old Value:
    [code]<value>weekly</value>[/code]
    
    [/code]
    

  • Banned

    Would be better to submit a proper pull request at GitHub.



  • I proposed a pull request on github.


  • Banned

    Nice, thanks. ;)


Log in to reply