Subject: 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

---

From: Stefan Baur <[email-masked]>
Date: Mon, 9 Jan 2017 14:50:01 +0100

reassign -1 x2goserver

Hi,

this problem occurs because your user names are violating the POSIX
standard, which states that usernames must not begin with digits.

Let me guess, you are authenticating against a Windows Domain / Active
Directory, which obviously doesn't care about POSIX (well, why should it).

So far, our stance was that we should conform to POSIX standards.

However, this issue has cropped up quite a bit lately, so maybe adding
support for corresponding config options to /etc/x2go/x2goserver.conf
would be an idea - something like

# support usernames that violate POSIX standard
allow_usernames_with_leading_digit=true|false
allow_usernames_with_backslashes=true|false # would fix Bug #227 as well

And while we're at it, let me suggest these as well, just for good
measure - not sure if they still pose a problem but we did have issues
with at least dashes in the past (ca. 2012):
allow_usernames_with_slashes=true|false
allow_usernames_with_dashes=true|false
allow_usernames_with_spaces=true|false

I wonder what the developers think about this approach?

Kind Regards,
Stefan Baur

Am 09.01.2017 um 14:25 schrieb Frank Knoben:
> When a username starts with a number, the session on the client computer
> will not open, after connecting to the server.
> <                       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}$/)
>> {
> 
> 
> -                        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}$/)
> {
> _______________________________________________
> x2go-dev mailing list
> [email-masked]
> http://lists.x2go.org/listinfo/x2go-dev

-- 
BAUR-ITCS UG (haftungsbeschränkt)
Geschäftsführer: Stefan Baur
Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364
Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243