vpnmain.cgi: Allow passing strings with double @@ as IDs

Message ID 20240613170936.3287234-1-michael.tremer@ipfire.org
State New
Headers
Series vpnmain.cgi: Allow passing strings with double @@ as IDs |

Commit Message

Michael Tremer June 13, 2024, 5:09 p.m. UTC
  This is required to configure a user FQDN which some VPN peers might
send.

This patch also allows setting a key ID using @#.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 html/cgi-bin/vpnmain.cgi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi
index 9173a85d8..25e0f0a53 100644
--- a/html/cgi-bin/vpnmain.cgi
+++ b/html/cgi-bin/vpnmain.cgi
@@ -1856,8 +1856,8 @@  END
 
 		# Allow nothing or a string (DN,FDQN,) beginning with @
 		# with no comma but slashes between RID eg @O=FR/C=Paris/OU=myhome/CN=franck
-		if ( ($cgiparams{'LOCAL_ID'} !~ /^(|[\w.-]*@[\w. =*\/-]+|\d+\.\d+\.\d+\.\d+)$/) ||
-			($cgiparams{'REMOTE_ID'} !~ /^(|[\w.-]*@[\w. =*\/-]+|\d+\.\d+\.\d+\.\d+)$/) ||
+		if ( ($cgiparams{'LOCAL_ID'} !~ /^(|[\w.-]*@[@#]?[\w. =*\/-]+|\d+\.\d+\.\d+\.\d+)$/) ||
+			($cgiparams{'REMOTE_ID'} !~ /^(|[\w.-]*@[@#]?[\w. =*\/-]+|\d+\.\d+\.\d+\.\d+)$/) ||
 			(($cgiparams{'REMOTE_ID'} eq $cgiparams{'LOCAL_ID'}) && ($cgiparams{'LOCAL_ID'} ne ''))
 		) {
 			$errormessage = $Lang::tr{'invalid local-remote id'} . '<br />' .