[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xmlblaster] xmlBlasterClient.pl: SessionId '' is invalid + patch



Hello,

continuing my experiments with xmlBlaster demos, I tried the perl
demos in demo/perl/xmlrpc.  When running xmlBlasterClient.pl, the
following error message appeared on the xmlBlaster console:

[May 16, 2003 2:12:41 PM WARN  \
 Authenticate-/node/http_129_194_17_16_3412.AccessDenied] \
 SessionId '' is invalid, no access to xmlBlaster.

(see server.log3 and xmlBlasterClient.pl.log in annexe)

Same symptom for messagesList.pl.

Context:
  xmlBlaster 0.846
  Frontier-RPC-0.06
  XML-Parser-2.31
  expat 1.95.5
  gcc 2.95.2
  Solaris 9


After investigation, the cause is to be found in an error in
demo/perl/xmlrpc/xmlBlaster/ConnectQos.pm: it seems that the qos
structure returned by a connect call has changed format, the sessionId
info beeing now an attribute instead of a sub-element of the session
element.

You'll find in annexe a patched version of ConnectQos.pm that works
correctly (xmlBlasterClient.pl and also messagesList.pl now
works as intended).

This leads me to the following remarks and suggestions:

- If the format of the qos returned by a connection can change from
  one distribution to another, (like here: sessionId becoming an
  attribute), why not adding a version number as an attribute
  (e.g. <qos version="1.1">) and check it systematically in each
  client program?

- Just as documentation, demos are a very important part of a software
  distribution; in a way they are a show-case of the possibilities and
  features. Moreover, in the development process, demos are also
  useful for testing the software after each changes (akin to a poor
  man's regression tests). Therefore it would be nice if all the demos
  distributed with each version of xmlBlaster were updated so that
  they are functional with that version.

- Since all problems with demos cannot be avoided (because of
  platform, third party software versions, etc.), it would be
  nice to add to the documentation of each demo, some sample
  output made on a reference installation. This would enable
  newcomers to easily spot discrepancies instead of maybe
  missing the point of the demo (see in annexe the log of
  messagesList.pl which is not very explicit about the failure
  that occurred).

Just my two cents...

Best regards,
Dominique
--
Mr Dominique Petitpierre       Email: User at Domain
Division Informatique                 User=Dominique.Petitpierre
University of Geneva                  Domain=adm.unige.ch
==== extract of xmlBlaster server log ===
% java -jar lib/xmlBlaster.jar
# ....
# start of xmlBlasterClient.pl:
[May 16, 2003 2:12:41 PM INFO  Authenticate-/node/http_129_194_17_16_3412] Successful login for client /node/http_129_194_17_16_3412/client/admin/-2, session expires after [ 24 h 0 millis ], 1 of 10 sessions are in use.
[May 16, 2003 2:12:41 PM INFO  Authenticate-/node/http_129_194_17_16_3412] Successful login for client /node/http_129_194_17_16_3412/client/guest/-3, session expires after [ 24 h 0 millis ], 1 of 10 sessions are in use.
[May 16, 2003 2:12:41 PM WARN  Authenticate-/node/http_129_194_17_16_3412.AccessDenied] SessionId '' is invalid, no access to xmlBlaster.
[May 16, 2003 2:12:41 PM WARN  Authenticate-/node/http_129_194_17_16_3412.AccessDenied] SessionId '' is invalid, no access to xmlBlaster.
==== xmlBlasterClient.pl log ====
% perl xmlBlasterClient.pl un2sun2:8080
> Construct client I (admin)...
> Connect client I ...
> Construct client II (guest)...
> Connect client II ...
> Get server informations ...
> get __cmd:?totalMem... 
Use of uninitialized value in pattern match (m//) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 227.
Use of uninitialized value in pattern match (m//) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 227.
Use of uninitialized value in substitution (s///) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 232.
Use of uninitialized value in concatenation (.) or string at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 233.
========================================
A Exception occured :
code : XMLBLASTER_ERROR
info : Fault returned from XML RPC Server, fault code 0: java.lang.Exception: errorCode=user.security.authentication.accessDenied message=Your secretSessionId is invalid, no access to http_129_194_17_16_3412.

========================================
> Testing Publish/Subscribe ...
> user [admin] publish [my first HELLO!]...
Use of uninitialized value in pattern match (m//) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 227.
Use of uninitialized value in pattern match (m//) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 227.
Use of uninitialized value in substitution (s///) at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 232.
Use of uninitialized value in concatenation (.) or string at /usr/perl5/site_perl/5.6.1/Frontier/RPC2.pm line 233.
========================================
A Exception occured :
code : XMLBLASTER_ERROR
info : Fault returned from XML RPC Server, fault code 0: java.lang.Exception: errorCode=user.security.authentication.accessDenied message=Your secretSessionId is invalid, no access to http_129_194_17_16_3412.

========================================
==== messagesList.pl log ===
% perl messagesList.pl un2sun2:8080
> Construct client for server un2sun2:8080 ...
> Connect with xmlBlaster::XmlBlaster=HASH(0x350ac) ...
> Connected ...
> get list of all messages ...
# ConnectQos.pm
#
# 11/02/02 11:53 mad at ktaland.com
#
#	connection data helper for perl xmlBlaster client
#

# =======================================
#
# 08/07/02 16:53 cyrille at ktaland.com
#
# REMARQUE :
#
# 08/07/02 16:02 cyrille at ktaland.com 
# some warning in xmlBlaster with connectQos due to:
# from src/java/org/xmlBlaster/protocol/xmlrpc/AuthenticateImpl.java
#         returnValueStripped = StringHelper.replaceAll(returnValue, "<![CDATA[", "");
# 118          returnValueStripped = StringHelper.replaceAll(returnValueStripped, "]]>", "");
# 119          if (!returnValueStripped.equals(returnValue)) {
# 120             log.trace(ME, "Stripped CDATA tags surrounding security credentials, XML-RPC does not like it (Helma does not escape ']]>'). " +
# 121                            "This shouldn't be a problem as long as your credentials doesn't contain '<'");
# 122          }
# 123  

# =======================================
#
# 08/07/02 16:53 cyrille at ktaland.com
#
#	XML returned by $srv->call( 'authenticate.connect', $loginQos->xml );
#
#<qos>
#   <securityService type="htpasswd" version="1.0">
#      <user>admin</user>
#      <passwd>secret</passwd>
#   </securityService>
#   <ptp>true</ptp>
#   <session timeout=\'86400000\' maxSessions=\'10\' clearSessions=\'false\' publicSessionId=\'15\'>
#      <sessionId>sessionId:213.186.34.8-null-1026139708095--176967386-16</sessionId>
#   </session>
#</qos>

package xmlBlaster::ConnectQos ;

use strict ;

#######################
# new
#
# 11/02/02 11:54 mad at ktaland.com
#
sub new {

	my $class = shift;
	my $connectdata = shift;
	###my $self = ($#_ == 0) ? { %{ (shift) } } : {  at _ };
	my $self = {} ;
    bless( $self, $class );

	if( exists $connectdata->{'securityService.type'} ){
		$self->{'securityService.type'} = $connectdata->{'securityService.type'} ;
	}else{
		$self->{'securityService.type'} = 'htpasswd' ;
	}

	if( exists $connectdata->{'securityService.version'} ){
		$self->{'securityService.version'} = $connectdata->{'securityService.version'} ;
	}else{
		$self->{'securityService.version'} = '1.0' ;
	}

	$self->{'passwd'} = $connectdata->{'passwd'} ;
	$self->{'user'} = $connectdata->{'user'} ;

	return $self ;

}#new

####################
# sessionId
#
# 11/02/02 12:28 mad at ktaland.com
#
sub sessionId {

	my $self = shift ;
	my $xml = shift ;

	if( $xml ){
		# update connectQos data
		$self->_fromXml( $xml );
	}

	return $self->{'sessionId'} ;

}#sessionId

####################
# toXml
#
# 11/02/02 11:59 mad at ktaland.com
#
sub xml {

	my $self = shift ;

	my $xml = "<qos>\n"
			."<securityService type=\"".$self->{'securityService.type'}
						."\" version=\"".$self->{'securityService.version'}
						."\">\n"
            ."   <user>".$self->{'user'}."</user>\n"
            ."   <passwd>".$self->{'passwd'}."</passwd>\n"
            ."</securityService>\n"
            #."<ptp>true</ptp>\n"
            #."<session timeout='3600000' maxSessions='6'>\n</session>\n"
            ."</qos>\n" ;

	return $xml ;

}#xml

###############
#
sub _fromXml {

	# TODO : full parsing to get all da parameters & associated values
	# actually, only sessionId is parsed

	my $self = shift ;
	my $xml = shift ;

# <qos>
#   <securityService
#     type="htpasswd"
#     version="1.0">
#    <user>admin</user>
#    <passwd>secret</passwd>
#   </securityService>
#   <session name='/node/http_129_194_17_16_3412/client/admin/-24'
#       timeout='86400000'
#       maxSessions='10'
#       clearSessions='false'
#       sessionId='sessionId:129.194.17.16-null-1053040177135-712235115-24'/>
#   <queue
#       relating='clientSide'
#       maxEntries='10000000'
#       maxEntriesCache='1000'>
#    <address
#        type='IOR'
#        hostname='129.194.17.16'
#        port='3412'
#        dispatchPlugin='undef'>
#     http://129.194.17.16:3412
#    </address>
#   </queue>
#   <queue
#       relating='subject'/>
#   <queue
#       relating='callback'
#       maxEntries='1000'
#       maxEntriesCache='1000'/>
#  </qos>


	if( $xml =~ /\bsessionId=\'([^\']*)\'/ ){
		$self->{'sessionId'} = $1 ;
	}

	return 1 ;

}#_fromXml

1;