Subject: x2goclient can not login with username in email format
From: Andrey Igoshin <[email-masked]>
To: [email-masked]
Date: Mon, 18 Aug 2014 12:26:18 +0400

Package: x2goserver
Version: 4.1.0.0-0~1055~ubuntu14.04.1

x2goclient can not connect if username is in email format
([email-masked]).

details:

in username field user specifies his/her username which is in email
format ([email-masked]). in password field user specifies his/her
password. using this information x2goclient successfully authenticates
on server via ssh but can not start nxproxy.

it is a username sanitize problem in x2goserver.

patch attached.

it is not a x2goclient problem as i reported before (#433), please close it.

-- 
Andrey Igoshin <[email-masked]>               Voronezh State University
sip:            [email-masked]                Network Operation Center
phone: +7 473 2281160, ext. 2020         Voronezh, Russia
diff -ur x2goserver.ORIG/X2Go/Utils.pm x2goserver/X2Go/Utils.pm
--- x2goserver.ORIG/X2Go/Utils.pm	2014-08-18 11:40:25.000000000 +0400
+++ x2goserver/X2Go/Utils.pm	2014-08-18 11:44:34.204177816 +0400
@@ -129,10 +129,10 @@
 			} else {return 0;}
 		} else {return 0;}
 	} elsif ($type eq "x2gosid") {
-		$string =~ s/[^a-zA-Z0-9\_\-\$\.]//g;
-		if ($string =~ /^([a-zA-Z0-9\_\-\$\.]*)$/) {
+		$string =~ s/[^a-zA-Z0-9\_\-\$\.\@]//g;
+		if ($string =~ /^([a-zA-Z0-9\_\-\$\.\@]*)$/) {
 			$string = $1;
-			if ($string =~ /^([a-zA-Z\_][a-zA-Z0-9\_\-\.]{0,31}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-]*\_dp[\d]{1,2}$/) {
+			if ($string =~ /^([a-zA-Z\_][a-zA-Z0-9\_\-\.\@]{0,31}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-]*\_dp[\d]{1,2}$/) {
 				if ((length($1) > 0) and (length($1) < 32)){
 					return $string;
 				} else {return 0;}
diff -ur x2goserver.ORIG/x2goserver/bin/x2gostartagent x2goserver/x2goserver/bin/x2gostartagent
--- x2goserver.ORIG/x2goserver/bin/x2gostartagent	2014-08-18 11:40:25.000000000 +0400
+++ x2goserver/x2goserver/bin/x2gostartagent	2014-08-18 11:48:29.533652011 +0400
@@ -176,7 +176,7 @@
 			SESSION_NAME=`echo "$SESSION_NAME" | perl -pe  "s/:/PP/g"`
 		fi
 		# sanitize session name
-		SESSION_NAME=`echo "$SESSION_NAME" | perl -pe  "s/[^a-zA-Z0-9\.\_\-]//g"`
+		SESSION_NAME=`echo "$SESSION_NAME" | perl -pe  "s/[^a-zA-Z0-9\.\_\-\@]//g"`
 
 		if [ -n "$SHADREQ_USER" ]; then
 			$X2GO_LIB_PATH/x2gosyslog "$0" "debug" "initializing new shadow session with ID $SESSION_NAME"