Subject: Bug#1131: x2gosqlitewrapper - Session not opening when username starts with a number

From: Frank Knoben <[email-masked]>
Date: Mon, 9 Jan 2017 14:25:59 +0100

Package: x2gosqlitewrapper
Version: 4.0.1.20-3.4

When a username starts with a number, the session on the client computer will not open, after connecting to the server.
The problem lies within x2gosqlitewrapper.pl in the sanitizer function.
This function will return 0 in the  $type eq "x2gosid" case, when the username starts with a number.
My workaround is to add a 0-9 in the line number 67 of x2gosqlitewrapper.pl

diff x2gosqlitewrapper.pl x2gosqlitewrapper.pl.original
67c67
<                       if ($string =~ /^([a-zA-Z0-9\_][a-zA-Z0-9\_\-\.\@]{0,47}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-\.]*\_dp[\d]{1,2}$/) {
---
>                       if ($string =~ /^([a-zA-Z\_][a-zA-Z0-9\_\-\.\@]{0,47}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-\.]*\_dp[\d]{1,2}$/) {

elsif ($type eq "x2gosid") {
                 $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,47}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-\.]*\_dp[\d]{1,2}$/) {
+                        if ($string =~ /^([a-zA-Z0-9\_][a-zA-Z0-9\_\-\.\@]{0,47}[\$]?)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\_\-\.]*\_dp[\d]{1,2}$/) {
                                 if ((length($1) > 0) and (length($1) < 48)){
                                         return $string;
                                 } else {return 0;}
                         } else {return 0;}
                 } else {return 0;}
         }

I  am using a OpenSuSE Leap System with x2goserver Version 4.0.1.20-3.4

Sincerly

Frank Knoben