squidGuard: Fix generating databases with libdb >= 5

Message ID 20200522114903.7093-1-michael.tremer@ipfire.org
State Accepted
Commit 91b23ce05b77dc96b38de3589049cbe8350ba9ad
Headers
Series squidGuard: Fix generating databases with libdb >= 5 |

Commit Message

Michael Tremer May 22, 2020, 11:49 a.m. UTC
  Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 lfs/squidguard                       |  1 +
 src/patches/squidGuard-1.4-db5.patch | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 src/patches/squidGuard-1.4-db5.patch
  

Comments

Matthias Fischer May 22, 2020, 12:33 p.m. UTC | #1
Hi,

just saw this patch (and couldn't help but smile a bit):

=> https://patchwork.ipfire.org/patch/947/

I don't know why, but I can't find this one on GIT anymore.

But:
Interested?

Best,
Matthias

On 22.05.2020 13:49, Michael Tremer wrote:
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
>  lfs/squidguard                       |  1 +
>  src/patches/squidGuard-1.4-db5.patch | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 src/patches/squidGuard-1.4-db5.patch
> 
> diff --git a/lfs/squidguard b/lfs/squidguard
> index f627a27d8..38efab0ee 100644
> --- a/lfs/squidguard
> +++ b/lfs/squidguard
> @@ -71,6 +71,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>  	@$(PREBUILD)
>  	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
>  	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidGuard-1.4-db5.patch
>  	cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
>  		--sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man  \
>  		--with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \
> diff --git a/src/patches/squidGuard-1.4-db5.patch b/src/patches/squidGuard-1.4-db5.patch
> new file mode 100644
> index 000000000..733fbad2e
> --- /dev/null
> +++ b/src/patches/squidGuard-1.4-db5.patch
> @@ -0,0 +1,12 @@
> +diff -ruN squidGuard-1.4-vanilla/src/sgDb.c squidGuard-1.4/src/sgDb.c
> +--- squidGuard-1.4-vanilla/src/sgDb.c	2008-07-15 04:29:41.000000000 +1000
> ++++ squidGuard-1.4/src/sgDb.c	2013-01-21 12:47:41.049325756 +1100
> +@@ -114,7 +114,7 @@
> +     }
> +   }
> + #endif
> +-#if DB_VERSION_MAJOR == 4
> ++#if DB_VERSION_MAJOR >= 4
> +   if(globalUpdate || createdb || (dbfile != NULL && stat(dbfile,&st))){
> +     flag = DB_CREATE;
> +     if(createdb)
> \ No newline at end of file
>
  
Michael Tremer May 22, 2020, 12:38 p.m. UTC | #2
Hi,

Oh yes, I totally forgot.

Patchwork only seems to have half of the patch for some reason.

But it is here: https://lists.ipfire.org/pipermail/development/2016-December/002829.html

@Arne: I would recommend to merge this one then for the next core update. There seem to be some security-related fixes in it.

Best,
-Michael

> On 22 May 2020, at 13:33, Matthias Fischer <matthias.fischer@ipfire.org> wrote:
> 
> Hi,
> 
> just saw this patch (and couldn't help but smile a bit):
> 
> => https://patchwork.ipfire.org/patch/947/
> 
> I don't know why, but I can't find this one on GIT anymore.
> 
> But:
> Interested?
> 
> Best,
> Matthias
> 
> On 22.05.2020 13:49, Michael Tremer wrote:
>> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
>> ---
>> lfs/squidguard                       |  1 +
>> src/patches/squidGuard-1.4-db5.patch | 12 ++++++++++++
>> 2 files changed, 13 insertions(+)
>> create mode 100644 src/patches/squidGuard-1.4-db5.patch
>> 
>> diff --git a/lfs/squidguard b/lfs/squidguard
>> index f627a27d8..38efab0ee 100644
>> --- a/lfs/squidguard
>> +++ b/lfs/squidguard
>> @@ -71,6 +71,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>> 	@$(PREBUILD)
>> 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
>> 	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
>> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidGuard-1.4-db5.patch
>> 	cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
>> 		--sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man  \
>> 		--with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \
>> diff --git a/src/patches/squidGuard-1.4-db5.patch b/src/patches/squidGuard-1.4-db5.patch
>> new file mode 100644
>> index 000000000..733fbad2e
>> --- /dev/null
>> +++ b/src/patches/squidGuard-1.4-db5.patch
>> @@ -0,0 +1,12 @@
>> +diff -ruN squidGuard-1.4-vanilla/src/sgDb.c squidGuard-1.4/src/sgDb.c
>> +--- squidGuard-1.4-vanilla/src/sgDb.c	2008-07-15 04:29:41.000000000 +1000
>> ++++ squidGuard-1.4/src/sgDb.c	2013-01-21 12:47:41.049325756 +1100
>> +@@ -114,7 +114,7 @@
>> +     }
>> +   }
>> + #endif
>> +-#if DB_VERSION_MAJOR == 4
>> ++#if DB_VERSION_MAJOR >= 4
>> +   if(globalUpdate || createdb || (dbfile != NULL && stat(dbfile,&st))){
>> +     flag = DB_CREATE;
>> +     if(createdb)
>> \ No newline at end of file
>> 
>
  
Matthias Fischer May 23, 2020, 10:06 a.m. UTC | #3
Hi,

JFYI: regarding this update I saw that at that time I forgot to delete a
no longer needed patch while sending it:

src/patches/squidGuard-1.4-db5.patch

Best,
Matthias

On 22.05.2020 14:38, Michael Tremer wrote:
> Hi,
> 
> Oh yes, I totally forgot.
> 
> Patchwork only seems to have half of the patch for some reason.
> 
> But it is here: https://lists.ipfire.org/pipermail/development/2016-December/002829.html
> 
> @Arne: I would recommend to merge this one then for the next core update. There seem to be some security-related fixes in it.
> 
> Best,
> -Michael
> 
>> On 22 May 2020, at 13:33, Matthias Fischer <matthias.fischer@ipfire.org> wrote:
>> 
>> Hi,
>> 
>> just saw this patch (and couldn't help but smile a bit):
>> 
>> => https://patchwork.ipfire.org/patch/947/
>> 
>> I don't know why, but I can't find this one on GIT anymore.
>> 
>> But:
>> Interested?
>> 
>> Best,
>> Matthias
>> 
>> On 22.05.2020 13:49, Michael Tremer wrote:
>>> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
>>> ---
>>> lfs/squidguard                       |  1 +
>>> src/patches/squidGuard-1.4-db5.patch | 12 ++++++++++++
>>> 2 files changed, 13 insertions(+)
>>> create mode 100644 src/patches/squidGuard-1.4-db5.patch
>>> 
>>> diff --git a/lfs/squidguard b/lfs/squidguard
>>> index f627a27d8..38efab0ee 100644
>>> --- a/lfs/squidguard
>>> +++ b/lfs/squidguard
>>> @@ -71,6 +71,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>>> 	@$(PREBUILD)
>>> 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
>>> 	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
>>> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidGuard-1.4-db5.patch
>>> 	cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
>>> 		--sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man  \
>>> 		--with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \
>>> diff --git a/src/patches/squidGuard-1.4-db5.patch b/src/patches/squidGuard-1.4-db5.patch
>>> new file mode 100644
>>> index 000000000..733fbad2e
>>> --- /dev/null
>>> +++ b/src/patches/squidGuard-1.4-db5.patch
>>> @@ -0,0 +1,12 @@
>>> +diff -ruN squidGuard-1.4-vanilla/src/sgDb.c squidGuard-1.4/src/sgDb.c
>>> +--- squidGuard-1.4-vanilla/src/sgDb.c	2008-07-15 04:29:41.000000000 +1000
>>> ++++ squidGuard-1.4/src/sgDb.c	2013-01-21 12:47:41.049325756 +1100
>>> +@@ -114,7 +114,7 @@
>>> +     }
>>> +   }
>>> + #endif
>>> +-#if DB_VERSION_MAJOR == 4
>>> ++#if DB_VERSION_MAJOR >= 4
>>> +   if(globalUpdate || createdb || (dbfile != NULL && stat(dbfile,&st))){
>>> +     flag = DB_CREATE;
>>> +     if(createdb)
>>> \ No newline at end of file
>>> 
>> 
>
  

Patch

diff --git a/lfs/squidguard b/lfs/squidguard
index f627a27d8..38efab0ee 100644
--- a/lfs/squidguard
+++ b/lfs/squidguard
@@ -71,6 +71,7 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
+	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidGuard-1.4-db5.patch
 	cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
 		--sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man  \
 		--with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \
diff --git a/src/patches/squidGuard-1.4-db5.patch b/src/patches/squidGuard-1.4-db5.patch
new file mode 100644
index 000000000..733fbad2e
--- /dev/null
+++ b/src/patches/squidGuard-1.4-db5.patch
@@ -0,0 +1,12 @@ 
+diff -ruN squidGuard-1.4-vanilla/src/sgDb.c squidGuard-1.4/src/sgDb.c
+--- squidGuard-1.4-vanilla/src/sgDb.c	2008-07-15 04:29:41.000000000 +1000
++++ squidGuard-1.4/src/sgDb.c	2013-01-21 12:47:41.049325756 +1100
+@@ -114,7 +114,7 @@
+     }
+   }
+ #endif
+-#if DB_VERSION_MAJOR == 4
++#if DB_VERSION_MAJOR >= 4
+   if(globalUpdate || createdb || (dbfile != NULL && stat(dbfile,&st))){
+     flag = DB_CREATE;
+     if(createdb)
\ No newline at end of file