[1/2] urlfilterctrl: Fix bug#10649 - add option to remove urlfilter from fcron directories

Message ID 20230926140701.3438340-1-adolf.belka@ipfire.org
State Staged
Commit 01ed9ff3219de2683b3a3e74cea6602dde3e04fb
Headers
Series [1/2] urlfilterctrl: Fix bug#10649 - add option to remove urlfilter from fcron directories |

Commit Message

Adolf Belka Sept. 26, 2023, 2:07 p.m. UTC
  - Currently if the urlfilter update is enabled then autoupdate.pl is renamed urlfilter and
   added into either the daily, weekly or monthly fcron directoiries. If the update is
   disabled then the urlfilter update script stays in the directory and is not removed.
- This patch adds in the option of remove to the urlfilterctrl program. The first part
   of the urlfilterctrl.c code removes any existing symlinks so all that needs to be done
   for the remove option is to not add any symlinks to the fcron directories.
- Confirmed in a vm testbed that the current approach leaves the symlink in place. Installed
   the changes from this and the previous patch and confirmed that when the url update is
   disabled the symlink is removed.

Fixes: Bug#10649
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 src/misc-progs/urlfilterctrl.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/src/misc-progs/urlfilterctrl.c b/src/misc-progs/urlfilterctrl.c
index 28dc03075..a11d6d041 100644
--- a/src/misc-progs/urlfilterctrl.c
+++ b/src/misc-progs/urlfilterctrl.c
@@ -24,6 +24,8 @@  int main(int argc, char *argv[]){
 			safe_system("ln -s /var/ipfire/urlfilter/bin/autoupdate.pl /etc/fcron.weekly/urlfilter");
 		} else if (strcmp(argv[2], "monthly") == 0){
 			safe_system("ln -s /var/ipfire/urlfilter/bin/autoupdate.pl /etc/fcron.monthly/urlfilter");
+		} else if (strcmp(argv[2], "remove") == 0){
+			// Don't add urlfilter into any fcron directory
 		}else{
 			printf("invalid parameter(s)\n");
 		return(1);