[X2Go-Commits] x2gobroker.git - build-main (branch) updated: 57030875e10c269c360ac2b1c1623b9f427d6714

X2Go dev team git-admin at x2go.org
Sun May 19 13:02:55 CEST 2013


The branch, build-main has been updated
       via  57030875e10c269c360ac2b1c1623b9f427d6714 (commit)
      from  00034ba69ecca2523dc6ad1b5b16f9952508683c (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:
 X2Go/Broker/ZeroConf.pm |   46 +++++++++++++++++++++++++++-------------------
 cgi/x2gobroker.cgi      |   14 ++++++--------
 2 files changed, 33 insertions(+), 27 deletions(-)

The diff of changes is:
diff --git a/X2Go/Broker/ZeroConf.pm b/X2Go/Broker/ZeroConf.pm
index b98f9d8..da4eb98 100644
--- a/X2Go/Broker/ZeroConf.pm
+++ b/X2Go/Broker/ZeroConf.pm
@@ -21,7 +21,7 @@
 package X2Go::Broker::ZeroConf;
 
 use strict;
-use Sys:Hostname;
+use Sys::Hostname;
 use Authen::PAM;
 use Authen::Simple::PAM;
 use X2Go::Broker::Common;
@@ -38,12 +38,15 @@ my $hostname = hostname;
 ### public functions, available to broker cgi
 ###
 
+my $username;
+my $password;
+
 ### exported function ###
 sub CheckAccess
 {
 	# zeroconf broker: use PAM to perform authentication against
 	#                  the local PAM login module
-	my ($user,$pass)=@_;
+	($username, $password)=@_;
 	my $pam = Authen::Simple::PAM->new(service => 'x2gobroker');
 	if ( $pam->authenticate( $username, $password ) ) {
 		# successfull authentication
@@ -64,10 +67,10 @@ sub SetPass
 
 	# zeroconf broker: use PAM to initiate a local passwd change
 	my $service = "x2gobroker";
-	ref($pamh = new Authen::PAM($service, $username, \&passwd_conv_func)) ||
-	    die "Error code $pamh during PAM init!";
-	$state = 0;
-	$res = $pamh->pam_chauthtok;
+	my $pamh = new Authen::PAM($service, $username, \&passwd_conv_func) ||
+	    die "Error code \$pamh during PAM init!";
+	my $state = 0;
+	my $res = $pamh->pam_chauthtok;
 	die $pamh->pam_strerror($res) unless $res == PAM_SUCCESS();
 
 	print "\n<br>CHANGING PASS OK<br>\n";
@@ -76,16 +79,16 @@ sub SetPass
 ### exported function ###
 sub SelectSession
 {
-	my ($user, $sid)=@_;
-	my @words=split("\@",$sid);
+	my ($user, $session_id)=@_;
+	my @words=split("\@",$session_id);
 	###
-	### FIXME: why the heck is the $sid format <host>@<session>,
+	### FIXME: why the heck is the $session_id format <host>@<session>,
 	###        <session>@<host> would make much more sense!!! (for
 	###        the human eye...)
 	###
-	my $sess_id=@words[1];
+	my $session_id=@words[1];
 	my $host=@words[0];
-	check_and_start_session($user, $host, $sess_id);
+	check_and_start_session($user, $host, $session_id);
 }
 
 ### exported function ###
@@ -93,15 +96,15 @@ sub ListSessions
 {
 	# print Dumper($message->entries);
 	print "START_USER_SESSIONS<br>";
-	my($status,$sessions)=CallBrokerAgent($hostname, $user, 'listsessions');
+	my($status,$sessions)=CallBrokerAgent($hostname, $username, 'listsessions');
 	if ( $status )
 	{
 		if($sessions)
 		{
 			my @sinfo = split("\\|",$sessions);
 			my $session_status = @sinfo[4];
-			my $sid = @sinfo[1];
-			print "<br>[$hostname\@$sid]<br>";
+			my $session_id = @sinfo[1];
+			print "<br>[$hostname\@$session_id]<br>";
 			print "status=$session_status<br>";
 		} else {
 			print "<br>[$hostname]<br>";
@@ -121,6 +124,10 @@ sub passwd_conv_func {
 		my $code = shift;
 		my $msg = shift;
 		my $ans = "";
+		my $state;
+
+		my $oldpassword;
+		my $newpassword;
 
 		$ans = $username if ( $code == PAM_PROMPT_ECHO_ON() );
 		if ( $code == PAM_PROMPT_ECHO_OFF() ) {
@@ -137,8 +144,9 @@ sub passwd_conv_func {
 
 sub check_and_start_session
 {
-	my ($uid, $host, $sid) = @_;
-	my ($status, $sessions)=ExecRemoteBroker($user, $hostname, 'listsessions');
+	my ($username, $hostname, $session_id) = @_;
+	my $running;
+	my ($status, $sessions)=ExecRemoteBroker($username, $hostname, 'listsessions');
 	if ( ! $status )
 	{
 		print "ERROR: X2Go server not available\n";
@@ -151,12 +159,12 @@ sub check_and_start_session
 		my @sinfo = split("\\|",$sessions);
 		my $session_status = @sinfo[4];
 		my $session_server = @sinfo[3];
-		$sid=@sinfo[1];
+		$session_id=@sinfo[1];
 		if( $session_status eq 'R' )
 		{
 			$running = 1;
 			my $str;
-			($status, $str) = ExecRemoteBroker($uid, $hostname, "suspend $sid");
+			($status, $str) = ExecRemoteBroker($username, $hostname, "suspend $session_id");
 			$sessions =~ s/\|R\|/\|S\|/;
 		}
 		if( $session_status eq 'S' )
@@ -165,7 +173,7 @@ sub check_and_start_session
 		}
 	}
 
-	print "SERVER:$hostname:$port\n";
+	print "SERVER:$hostname\n";
 	if($running)
 	{
 		# use first session in session list...
diff --git a/cgi/x2gobroker.cgi b/cgi/x2gobroker.cgi
index 06ed66b..3d44d52 100755
--- a/cgi/x2gobroker.cgi
+++ b/cgi/x2gobroker.cgi
@@ -24,15 +24,13 @@ use strict;
 use File::Basename qw(basename);
 
 my $cgi_name = basename($0);
-my $broker_backend ~= s/x2gobroker-(.*)\.cgi/\1/
+my $broker_backend = $cgi_name;
+$broker_backend =~ s/x2gobroker-(.*)\.cgi/\1/;
 
-use lib "/usr/lib/x2go/";
-use lib "/usr/lib/x2go/broker/";
-
-switch ( $broker_backend ) {
-	case 'zeroconf' { use X2Go::Broker::ZeroConf qw(CheckAccess SetPass SelectSession ListSessions) }
-	case 'simple' { use X2Go::Broker::Simple qw(CheckAccess SetPass SelectSession ListSessions) }
-	case 'ldap' { use X2Go::Broker::LDAP qw(CheckAccess SetPass SelectSession ListSessions) }
+SWITCH: {
+  $broker_backend == "zeroconf" && do { use X2Go::Broker::ZeroConf qw(CheckAccess SetPass SelectSession ListSessions); last SWITCH; };
+#  $broker_backend == "simple" && do { use X2Go::Broker::Simple qw(CheckAccess SetPass SelectSession ListSessions); last SWITCH; };
+#  $broker_backend == "ldap" && do { use X2Go::Broker::LDAP qw(CheckAccess SetPass SelectSession ListSessions); last SWITCH; };
 }
 
 use CGI;


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

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 "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list