Subject: When user-directories do not exist, saving sqlpass with x2godbadmin is not possible
From: Michael Kromer <[email-masked]>
To: [email-masked] <[email-masked]>
Date: Tue, 7 May 2013 11:31:33 +0200

Package: x2goserver
Version: 4.0.0.1
Tag: patch

when a user directory does not exist yet (and is deeper than /home/$USER), the call of x2godbadmin --createuser fails:

create DB user "x2gouser_test"
Can't open password file /home/prod/user/test/.x2go/sqlpass at /usr/sbin/x2godbadmin line 350.

The reason is the mkdir call, which does not recursively create the directory needed. See patch attached.

- mike
--- /usr/sbin/x2godbadmin.orig	2013-05-07 11:29:07.000000000 +0200
+++ /usr/sbin/x2godbadmin	2013-05-07 11:29:05.000000000 +0200
@@ -342,7 +342,7 @@ sub add_user()
 
 	if (! -d "$dir/.x2go" )
 	{
-		mkdir("$dir/.x2go");
+		system("mkdir -p $dir/.x2go");
 	}
 
 	#save user password