From patchwork Wed Mar 13 22:12:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7612 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Tw4WF5dR3z3wkd for ; Wed, 13 Mar 2024 22:12:25 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Tw4WC06sjzZ8; Wed, 13 Mar 2024 22:12:23 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Tw4WB5pDqz32P8; Wed, 13 Mar 2024 22:12:22 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Tw4W8148nz2ygN for ; Wed, 13 Mar 2024 22:12:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Tw4W72fsZzT1; Wed, 13 Mar 2024 22:12:19 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710367939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=e4+jSsVzY03GjqOdZebcN6fGSoeRaBb7sjRNSTBNZgc=; b=bGNUwtCqpRC43IaOLjRI1qit4EZ3y8RON04YWpJcoEy5EHdETyrne67QFiNi/zi0ttJS// BFsW4IQLVy0PpABw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710367939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=e4+jSsVzY03GjqOdZebcN6fGSoeRaBb7sjRNSTBNZgc=; b=p2kBGae+td1EP3n+jrKfj08njXJPsBYdNLfXzBpc7zTVUfZPNBn8Dt7fwWL5I5nq/sC5fo 7ktT6jMBJMTYiFxIhPcOtZW7vqqR7WjOTz9gNhLyEp71BY7SeItvdOznbIEZnGiD0nBg/G z4gK2ZF0X0T8fPHJiVEMKNJzLuIT8/tcJbf7k9o4FQULGx5w8kCe3cV5i5w65YG8D7JOKt M+NGJ22At0PfroZqU3WLY1ohJ6P0tt9OqOIc5jd9gESV5/7XWMXSykNkjYXX0bSWKrwryZ ONqMikqwqLq9rnc33dTKk9afyaPPqDcEgqeWQWQ6JhLKebIWAwEwQtXodJ8OXg== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] dns.cgi: Add use Encode + encode back to UTF-8 Date: Wed, 13 Mar 2024 23:12:12 +0100 Message-ID: <20240313221212.2653062-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: J6HFQQ62NQ5ZWZXYJODFZG5W2EARCFWF X-Message-ID-Hash: J6HFQQ62NQ5ZWZXYJODFZG5W2EARCFWF X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - use Encode was missed out in the previous patch for dns.cgi This would mean that the decode from UTF-8 would fail. I had tested the previous change but forgot to copy across the use Encode line when I created the patch. - This patch adds an encode back to UTF-8 after running the cleanhtml command. This way the text is decoded from UTF-8 so that the cleanhtml command works correctly on umlauted characters and then is encoded back to UTF-8 so that all text in the cgi page is UTF-8. Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- html/cgi-bin/dns.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index eb6f908d5..c864c127d 100644 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2020 IPFire Development Team # +# Copyright (C) 2005-2024 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,6 +21,7 @@ use strict; use IO::Socket; +use Encode; # enable only the following on debugging purpose #use warnings; @@ -151,6 +152,9 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # are correctly encoded to their html entities $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'}); + # encode the text back to UTF-8 after running the cleanhtml command + $cgiparams{'REMARK'} = encode("UTF-8", $cgiparams{'REMARK'}); + my %dns_servers = (); my $id; my $status;