[X2go-Commits] cups-x2go.git - master (branch) updated: 3.0.0.2-12-g59c2429

X2go dev team git-admin at x2go.org
Tue Aug 30 11:01:51 CEST 2011


The branch, master has been updated
       via  59c2429e0897568b5815eb50a71dbcd7b9a40188 (commit)
      from  66ceeab13cba84ed0e23e09310465d9bb3c184fc (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 -----------------------------------------------------------------
commit 59c2429e0897568b5815eb50a71dbcd7b9a40188
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Aug 30 11:03:07 2011 +0200

    Multiple changes in this commit...
    
    * Adapt to x2goprint setgid change in x2goserver package (>=3.0.99.6).
    * Add syslog support for cups-x2go (Mario Oroz).
    * Ownership fix for .title file (Mario Oroz).

-----------------------------------------------------------------------

Summary of changes:
 cups-x2go        |   40 +++++++++++++++++++++++++++++++++++-----
 debian/changelog |    5 +++++
 2 files changed, 40 insertions(+), 5 deletions(-)

The diff of changes is:
diff --git a/cups-x2go b/cups-x2go
index 853599f..1045a0e 100755
--- a/cups-x2go
+++ b/cups-x2go
@@ -17,14 +17,19 @@
 #  Free Software Foundation, Inc.,
 #  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
+use Sys::Syslog qw( :DEFAULT setlogsock);
 use Sys::Hostname;
 use File::Basename;
 use File::Copy;
 use strict;
 
+setlogsock('unix');
+openlog($0,'','user');
+
 my $x2goserver = "local";
 my $printdsa = "/root/.x2go/ssh/.x2goprint/id_dsa";
 my $ps2pdf = "/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s.pdf\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f \"%s\"";
+#my $ps2pdf = "/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s.pdf\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /usr/bin/margen-offset.ps \"%s\"";
 my $cfgfile="/etc/cups/cups-x2go.conf";
 my $userName;
 my @sessions;
@@ -64,16 +69,30 @@ sub readconfig
  }
 }
 
+
 sub getsessions
 {
   my $sesslist;
   if ( $x2goserver eq "local" )
   {
-        $sesslist=`su $userName -c "x2golistsessions --all-servers"`;
+       $sesslist=`su $userName -c "x2golistsessions --all-servers"`;
+
+       ### Suggested patch from Mario OROZ, probably not acceptable here...
+       #-$sesslist=`su $userName -c "x2golistsessions --all-servers"`;
+       #+open (SQLCONF, "</etc/x2go/x2gosql/sql");
+       #+my $cfgline=<SQLCONF>;
+       #+close (SQLCONF);
+       #+if(($cfgline=~m/local/)||($cfgline=~m/sqlite/))
+       #+{
+       #+    $sesslist=`su $userName -c "x2golistsessions --all-servers"`;
+       #+}
+
   }
   else
   {
-          $sesslist=`ssh -i $printdsa x2goprint\@$x2goserver "sudo x2goprint $userName"`;
+          # Calling x2goprint with a single parameter <username> will result in an x2golistsessions --all-servers command on the
+          # remote X2go server.
+          $sesslist=`ssh -i $printdsa x2goprint\@$x2goserver 'test -f $(x2gobasepath)/lib/x2go/x2goprint.pl && x2goprint $userName || sudo x2goprint $userName"`;
   }
   @sessions=split("\n",$sesslist);
 }
@@ -89,8 +108,12 @@ sub printfile
        my $spfile="$spooldir/$sess$bname";
        copy($pfile, $spfile);
        copy($tfile, "$spfile.title");
-       chown $uid,$gid,$spfile;
-       system( "su x2goprint -c \"sudo x2goprint $userName $sess $sess$bname $sess$bname.title\"" );
+       chown $uid,$gid,"$spfile";
+       chown $uid,$gid,"$spfile.title";
+       system( "su x2goprint -c \"x2goprint $userName $sess $sess$bname $sess$bname.title\"" );
+
+       # log that we processed a print job
+       syslog('info', "su x2goprint -c \"x2goprint $userName $sess $bname $bname.title\"");
     }
     else
     {
@@ -99,6 +122,7 @@ sub printfile
     }
 }
 
+
 my $uname=$ENV{USER};
 
 if (!$ARGV[0])
@@ -120,7 +144,7 @@ my $printOptions;
 my $printFile;
 
 ($jobID, $userName, $jobTitle, $copies, $printOptions, $printFile) =  @ARGV;
-
+syslog('notice', "Print job received from cups-> $jobID $userName $jobTitle $copies $printOptions $sepa $printFile");
 
 my $tempFile;
 if (!$printFile)
@@ -131,6 +155,7 @@ if (!$printFile)
     $uid =~ s/\W//g; #sanity check
     $tempFile = "/tmp/$jid-$uid-cupsjob$$";
     open (OUT, ">$tempFile") or die "ERROR: Cannot write $tempFile: $!\n";
+    syslog('info', "Print job comes from STDIN, writing incoming job to temp file $tempFile\n");
     while(<STDIN>)
     {
         print OUT "$_";
@@ -157,8 +182,13 @@ for(my $i=0; $i<scalar(@sessions);$i++ )
      if(@sinfo[4] eq "R")
      {
          printfile( $printFile, $titleFile, @sinfo[3], @sinfo[1]);
+         syslog('info', "Call to printfile function with: $printFile $titleFile @sinfo[3] @sinfo[1]\n");
      }
 }
 
 unlink ($printFile);
 unlink ($titleFile);
+
+# closing syslog 
+closelog;
+
diff --git a/debian/changelog b/debian/changelog
index 6f8e439..26979b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,11 @@ cups-x2go (3.0.0.2-0~x2go2) UNRELEASED; urgency=low
   * Add dpkg-statoverride for CUPS backend cups-x2go, file permission 0700
     on CUPS backend makes CUPS run this backend with root-privileges which
     is needed for cups-x2go to work.
+  * Adapt to x2goprint setgid change in x2goserver package (>=3.0.99.6).
+
+  [ Mario Oroz ]
+  * Add syslog support for cups-x2go.
+  * Ownership fix for .title file.
 
   [ Oleksandr Shneyder ]
   * fixed reading deprecated /etc/x2go/sql


hooks/post-receive
-- 
cups-x2go.git (CUPS Backend for X2go Printing)

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 "cups-x2go.git" (CUPS Backend for X2go Printing).




More information about the x2go-commits mailing list