The branch, build-main has been updated via d9659bd14977762adfe00d0808ec9c9776f38067 (commit) from f51ce717c9443124c5829a64afd0226d8236ae35 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: debian/changelog | 2 + x2gosmartcardrules/x2gognupgccid | 24 ++--- x2gousbmount/x2gousbmount | 178 ++++++++++++++++++++------------------ 3 files changed, 111 insertions(+), 93 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 66e4b70..f14fff2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -55,6 +55,8 @@ x2gothinclient (1.0.99.1-0~x2go1) UNRELEASED; urgency=low - x2gothinclient_create: syntax fix, spotted by Thomas Güttler (Fixes: #95). - Export $LANG and $LANGUAGE to TCE daemon. - Use qx instead of open3 to launch x2goclient. (Fixes: #66). + - Only make x2gousbmount and x2gognupgccid scripts functional if + x2gothinclientd is running. * /debian/control: + Maintainer change in package: X2Go Developers <x2go-dev@lists.berlios.de>. + Priority: optional. diff --git a/x2gosmartcardrules/x2gognupgccid b/x2gosmartcardrules/x2gognupgccid index 508f96c..df3b229 100755 --- a/x2gosmartcardrules/x2gognupgccid +++ b/x2gosmartcardrules/x2gognupgccid @@ -3,12 +3,11 @@ # taken from libgphoto2 # # Sets up newly plugged in card reader so that only members of the -# group can access it +# group can access it from user space. (Replace scard with the name +# of the group you want to have access to the card reader.) + GROUP=scard -# can access it from user space. (Replace scard with the name of the -# group you want to have access to the card reader.) -# # Note that for this script to work, you'll need all of the following: # a) a line in the file /etc/hotplug/gnupg-ccid.usermap that corresponds # to the card reader you are using. @@ -23,12 +22,17 @@ GROUP=scard set -e -DEV=`echo ${DEVICE} | sed 's/proc/dev/'` +# only do this if x2gothinclientd is default display manager, otherwise this makes no sense +if ps ax | grep x2gothinclient | x2gothinclientd 1>/dev/null; then + + DEV=`echo ${DEVICE} | sed 's/proc/dev/'` + + if [ "${ACTION}" = "add" ]; then + sleep 2 + chown :${GROUP} "${DEV}" + chmod g+rw,o-rwx "${DEV}" + fi -if [ "${ACTION}" = "add" ]; then - sleep 2 - chown :${GROUP} "${DEV}" - chmod g+rw,o-rwx "${DEV}" fi -exit 0 \ No newline at end of file +exit 0 diff --git a/x2gousbmount/x2gousbmount b/x2gousbmount/x2gousbmount index 0c9c756..ca2efa9 100755 --- a/x2gousbmount/x2gousbmount +++ b/x2gousbmount/x2gousbmount @@ -21,105 +21,117 @@ use strict; use File::Path::Expand; -open (F,">>/var/log/usb"); - -my $dev=$ENV{'DEVNAME'}; -my $model=$ENV{'ID_MODEL'}; -my $vendor=$ENV{'ID_VENDOR'}; -my $action=$ENV{'ACTION'}; -my @ldev=split("/","$dev"); -my $ldev=@ldev[@ldev-1]; - -my $name="${vendor}_${model}"; -$name=~s/ //g; -$name=~s/\\//g; -$name=~s/\///g; -print F "action: $action, device: $dev, model: $model ($ldev), total: $name\n"; -mkdir("/media"); -mkdir("/media/$name"); -print F "$name\n"; - -if ( $action eq "add") +check_x2gothinclientd() { + my $x=`ps ax | grep x2gothinclient`; + if ( $x=~m/x2gothinclientd/ ) + { + return 1; + } + return 0; +} + +if ( check_x2gothinclientd() ) { - ### - ### ACTION: mount device after it has been added to USB subsystem - ### + open (F,">>/var/log/usb"); - # prepare mount points + my $dev=$ENV{'DEVNAME'}; + my $model=$ENV{'ID_MODEL'}; + my $vendor=$ENV{'ID_VENDOR'}; + my $action=$ENV{'ACTION'}; + my @ldev=split("/","$dev"); + my $ldev=@ldev[@ldev-1]; + + my $name="${vendor}_${model}"; + $name=~s/ //g; + $name=~s/\\//g; + $name=~s/\///g; + print F "action: $action, device: $dev, model: $model ($ldev), total: $name\n"; mkdir("/media"); mkdir("/media/$name"); - mkdir("/media/$name/$ldev"); + print F "$name\n"; - # mount the USB device - if(system("mount $dev /media/$name/$ldev -o uid=x2gothinclient,sync,uni_xlate")==0) - { - # if mounted, inform x2goclient about it... - system("touch /var/run/$ldev.mounted"); - open (D,">",expand_filename("~x2gothinclient/export/$name.$ldev")); - print D "export=/media/$name/$ldev\n"; - close (D); - } - else + if ( $action eq "add") { - # the mount failed, let's assume that the device is encrypted... - my $enc=`ls -1 /var/run | grep .encrypted`; - if( $enc eq "" ) - { - # use cryptsetup to decrypt the device... - system("/sbin/cryptsetup --key-file /etc/keys/keystick.key luksOpen $dev keystick"); - - # mount the ,,decrypted'' USB device via devmapper... - if(system("mount /dev/mapper/keystick /media/$name/$ldev ")==0) + ### + ### ACTION: mount device after it has been added to USB subsystem + ### + + # prepare mount points + mkdir("/media"); + mkdir("/media/$name"); + mkdir("/media/$name/$ldev"); + + # mount the USB device + if(system("mount $dev /media/$name/$ldev -o uid=x2gothinclient,sync,uni_xlate")==0) + { + # if mounted, inform x2goclient about it... + system("touch /var/run/$ldev.mounted"); + open (D,">",expand_filename("~x2gothinclient/export/$name.$ldev")); + print D "export=/media/$name/$ldev\n"; + close (D); + } + else + { + # the mount failed, let's assume that the device is encrypted... + my $enc=`ls -1 /var/run | grep .encrypted`; + if( $enc eq "" ) { - # inform x2goclient about this... - system("touch /var/run/$ldev.encrypted"); - system("chown -R x2gothinclient /media/$name/$ldev/dsa.key"); - open (D,">",expand_filename("~/x2gothinclient/logins/$name.$ldev")); - print D "login=/media/$name/$ldev\n"; - close (D); + # use cryptsetup to decrypt the device... + system("/sbin/cryptsetup --key-file /etc/keys/keystick.key luksOpen $dev keystick"); + + # mount the ,,decrypted'' USB device via devmapper... + if(system("mount /dev/mapper/keystick /media/$name/$ldev ")==0) + { + # inform x2goclient about this... + system("touch /var/run/$ldev.encrypted"); + system("chown -R x2gothinclient /media/$name/$ldev/dsa.key"); + open (D,">",expand_filename("~/x2gothinclient/logins/$name.$ldev")); + print D "login=/media/$name/$ldev\n"; + close (D); + } + else + { + # on mount failures release the decrypted device again + system("/sbin/cryptsetup luksClose keystick"); + } } else { - # on mount failures release the decrypted device again - system("/sbin/cryptsetup luksClose keystick"); + print F "cryptodisk already present\n"; } } - else - { - print F "cryptodisk already present\n"; - } } -} -elsif ( $action eq "remove" ) -{ + elsif ( $action eq "remove" ) + { - ### - ### ACTION: unmount device after it has been removed from the USB subsystem - ### + ### + ### ACTION: unmount device after it has been removed from the USB subsystem + ### - # we rely on our own mount logistics here... - if ( -e "/var/run/$ldev.mounted" ) - { - # inform x2goclient that the device has been removed - system ("umount -ff /media/$name/$ldev"); - unlink ("/var/run/$ldev.mounted"); - open ( D,">",expand_filename("~x2gothinclient/export/$name.$ldev.unexport")); - print D "unexport=/media/$name/$ldev\n"; - close (D); - } - elsif ( -e "/var/run/$ldev.encrypted" ) - { - # inform x2goclient that the device has been removed - # release the encrypted device mapping - unlink ("/var/run/$ldev.encrypted"); - open ( D,">",expand_filename("~/x2gothinclient/logins/$name.$ldev.unexport")); - print D "logout=/media/$name/$ldev\n"; - system("umount /media/$name/$ldev"); - system("/sbin/cryptsetup luksClose keystick"); - close (D); + # we rely on our own mount logistics here... + if ( -e "/var/run/$ldev.mounted" ) + { + # inform x2goclient that the device has been removed + system ("umount -ff /media/$name/$ldev"); + unlink ("/var/run/$ldev.mounted"); + open ( D,">",expand_filename("~x2gothinclient/export/$name.$ldev.unexport")); + print D "unexport=/media/$name/$ldev\n"; + close (D); + } + elsif ( -e "/var/run/$ldev.encrypted" ) + { + # inform x2goclient that the device has been removed + # release the encrypted device mapping + unlink ("/var/run/$ldev.encrypted"); + open ( D,">",expand_filename("~/x2gothinclient/logins/$name.$ldev.unexport")); + print D "logout=/media/$name/$ldev\n"; + system("umount /media/$name/$ldev"); + system("/sbin/cryptsetup luksClose keystick"); + close (D); + } } -} -close (F); + close (F); +} hooks/post-receive -- x2gothinclient.git (X2Go Thin Client Environment) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2gothinclient.git" (X2Go Thin Client Environment).