Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    SQUIDGUARD Times- date range bug?

    Scheduled Pinned Locked Moved Cache/Proxy
    7 Posts 3 Posters 989 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Marco Noronha
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • I
        isacporter
        last edited by

        :o Curious! Same to me.

        1 Reply Last reply Reply Quote 0
        • D
          doktornotor Banned
          last edited by

          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() ->

          1 Reply Last reply Reply Quote 0
          • I
            isacporter
            last edited by

            @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]
            
            1 Reply Last reply Reply Quote 0
            • D
              doktornotor Banned
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • I
                isacporter
                last edited by

                I proposed a pull request on github.

                1 Reply Last reply Reply Quote 0
                • D
                  doktornotor Banned
                  last edited by

                  Nice, thanks. ;)

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.