Hello community, here is the log from the commit of package openwsman for openSUSE:Factory checked in at 2015-01-15 15:59:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openwsman (Old) and /work/SRC/openSUSE:Factory/.openwsman.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openwsman" Changes: -------- --- /work/SRC/openSUSE:Factory/openwsman/openwsman.changes 2014-10-31 20:20:07.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.openwsman.new/openwsman.changes 2015-01-15 15:59:30.000000000 +0100 @@ -1,0 +2,11 @@ +Thu Jan 15 08:01:43 UTC 2015 - kkae...@suse.com + +- Update to 2.4.13 + - Features + - Support Ruby 2.2 + - Bugfixes + - Parsing of vendor namespaces (#48, #38) + - Client getters memory leaks (#47) + - Keep order of 'invoke' parameters (#49) + +------------------------------------------------------------------- Old: ---- openwsman-2.4.12.tar.bz2 New: ---- openwsman-2.4.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openwsman.spec ++++++ --- /var/tmp/diff_new_pack.cfGU8S/_old 2015-01-15 15:59:30.000000000 +0100 +++ /var/tmp/diff_new_pack.cfGU8S/_new 2015-01-15 15:59:30.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package openwsman # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -118,7 +118,7 @@ %endif Requires(pre): sed coreutils grep /bin/hostname -Version: 2.4.12 +Version: 2.4.13 Release: 0 # Mandriva: # Release %mkrel 1 @@ -279,7 +279,7 @@ %if 0%{?fedora} %define perl_version %(eval "`%{__perl} -V:version`"; echo $version) %define perl_requires perl(:MODULE_COMPAT_%{perl_version}) -Requires: %{perl_version} +Requires: %{perl_requires} %else Requires: perl = %{perl_version} %endif ++++++ openwsman-2.4.12.tar.bz2 -> openwsman-2.4.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/CMakeLists.txt new/openwsman-2.4.13/CMakeLists.txt --- old/openwsman-2.4.12/CMakeLists.txt 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/CMakeLists.txt 2015-01-13 14:06:54.000000000 +0100 @@ -13,10 +13,8 @@ # if(COMMAND cmake_policy) cmake_policy(SET CMP0003 OLD) -endif(COMMAND cmake_policy) - -if(COMMAND cmake_policy) cmake_policy(SET CMP0005 OLD) + cmake_policy(SET CMP0046 OLD) endif(COMMAND cmake_policy) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/ChangeLog new/openwsman-2.4.13/ChangeLog --- old/openwsman-2.4.12/ChangeLog 2014-10-20 12:22:36.000000000 +0200 +++ new/openwsman-2.4.13/ChangeLog 2015-01-15 08:58:00.000000000 +0100 @@ -1,3 +1,11 @@ +2.4.13 +- Features + - Support Ruby 2.2 +- Bugfixes + - Parsing of vendor namespaces (#48, #38) + - Client getters memory leaks (#47) + - Keep order of 'invoke' parameters (#49) + 2.4.12 - Features - New config option 'ssl_disable_protocols'. Pre-set to disable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/README-TESTING.md new/openwsman-2.4.13/README-TESTING.md --- old/openwsman-2.4.12/README-TESTING.md 1970-01-01 01:00:00.000000000 +0100 +++ new/openwsman-2.4.13/README-TESTING.md 2015-01-13 15:37:09.000000000 +0100 @@ -0,0 +1,22 @@ +# Testing openwsman + +Note: Package names refer to openSUSE, ymmv. + +## Install required packages + +* sblim-sfcb +* sblim-cmpi-base +* sblim-wbemcli +* wsmancli + +## Preparing the test environment + +* sudo sfcbd +* sudo openwsmand +* sudo wseventsink + +## Testing from git + + + +## Testing openwsman packages \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/VERSION.cmake new/openwsman-2.4.13/VERSION.cmake --- old/openwsman-2.4.12/VERSION.cmake 2014-10-20 12:19:29.000000000 +0200 +++ new/openwsman-2.4.13/VERSION.cmake 2015-01-15 08:58:00.000000000 +0100 @@ -44,10 +44,10 @@ # set COMPATMINOR to MINOR. (binary incompatible change) # -# Package version 2.4.12 +# Package version 2.4.13 SET(OPENWSMAN_MAJOR "2") SET(OPENWSMAN_MINOR "4") -SET(OPENWSMAN_PATCH "12") +SET(OPENWSMAN_PATCH "13") # Plugin API 2.2 SET(OPENWSMAN_PLUGIN_API_MAJOR "2") Files old/openwsman-2.4.12/bindings/perl/tests/core and new/openwsman-2.4.13/bindings/perl/tests/core differ Files old/openwsman-2.4.12/bindings/python/tests/core and new/openwsman-2.4.13/bindings/python/tests/core differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/python/tests/mem_test.py new/openwsman-2.4.13/bindings/python/tests/mem_test.py --- old/openwsman-2.4.12/bindings/python/tests/mem_test.py 1970-01-01 01:00:00.000000000 +0100 +++ new/openwsman-2.4.13/bindings/python/tests/mem_test.py 2015-01-13 15:57:25.000000000 +0100 @@ -0,0 +1,7 @@ +# sample code from https://github.com/Openwsman/openwsman/issues/47 +# run with +# valgrind --leak-check=full python mem_test.py +import pywsman + +c = pywsman.Client('http://user:password@localhost:1234/test') +print c.scheme(), c.user(), c.password(), c.host(), c.path() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/CMakeLists.txt new/openwsman-2.4.13/bindings/ruby/CMakeLists.txt --- old/openwsman-2.4.12/bindings/ruby/CMakeLists.txt 2014-10-28 10:54:17.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/CMakeLists.txt 2015-01-15 08:58:00.000000000 +0100 @@ -72,7 +72,7 @@ OUTPUT ${rdoc_dir} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..." COMMAND rm -rf ${rdoc_dir} - COMMAND ./rdoc${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR} -o ${rdoc_dir} -t "Openwsman - WS-Management for all" -m README.rdoc README.rdoc ../openwsman.i ../*.i openwsman/*.rb + COMMAND ./rdoc ${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR} -o ${rdoc_dir} -t "Openwsman - WS-Management for all" -m README.rdoc README.rdoc ../openwsman.i ../*.i openwsman/*.rb COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/bindings/*.i @@ -135,6 +135,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../*.i + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/openwsman/version.rb ) ENDIF( BUILD_RUBY_GEM ) @@ -145,4 +146,4 @@ # # -SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "ext;lib;openwsman") +SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "ext;lib") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/openwsman/openwsman.rb new/openwsman-2.4.13/bindings/ruby/openwsman/openwsman.rb --- old/openwsman-2.4.12/bindings/ruby/openwsman/openwsman.rb 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/openwsman/openwsman.rb 2015-01-15 08:58:13.000000000 +0100 @@ -38,6 +38,14 @@ # response and dig down through its XmlNode and XmlAttr objects. module Openwsman + class ClientOption + # assign hash to properties + def properties= value + value.each do |k,v| + self.add_property k.to_s, v.to_s + end + end + end class Transport # called when authentication credentials missing or wrong def Transport.auth_request_callback client, auth_type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/openwsman.gemspec.in new/openwsman-2.4.13/bindings/ruby/openwsman.gemspec.in --- old/openwsman-2.4.12/bindings/ruby/openwsman.gemspec.in 2014-10-28 16:13:31.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/openwsman.gemspec.in 2015-01-13 09:22:16.000000000 +0100 @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "openwsman" - s.version = "@VERSION@.1" + s.version = "@VERSION@" s.platform = Gem::Platform::RUBY s.authors = ["Klaus Kämpf"] s.email = ["kkae...@suse.de"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc new/openwsman-2.4.13/bindings/ruby/rdoc --- old/openwsman-2.4.12/bindings/ruby/rdoc 1970-01-01 01:00:00.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/rdoc 2015-01-13 12:13:12.000000000 +0100 @@ -0,0 +1,55 @@ +#!/usr/bin/env ruby + +# This is ./rdoc +# +# Call as +# ./rdoc <version-major>.<version-minor> ... +# + +def usage msg=nil + STDERR.puts "*** Error: #{msg}" if msg + STDERR.puts "Usage:" + STDERR.puts " rdoc <version-major>.<version-minor> ..." + exit 1 +end + +home = File.expand_path(File.dirname(__FILE__)) +$:.unshift(home) + +version = ARGV.shift +usage "Called without arguments" unless version + +if version =~ /(\d+)\.(\d+)/ + major = $1.to_i + minor = $2.to_i +else + usage "Version argument malformed, must be X.Y" +end + +# can't directly require /usr/bin/rdoc since it does not have a '.rb' extension +# work around: create temporary symlink + +rdoc = "rdoc#{major}_#{minor}.rb" +new_rdoc = File.join(home, rdoc) + +# Symlink ./rdoc.rb to /usr/bin/rdoc +# +File.symlink("/usr/bin/rdoc", new_rdoc) unless File.symlink?(new_rdoc) + +begin + if major == 1 && minor == 8 + require 'parse_swig.rb' # load the swig parser + else + require 'rdoc' + + require 'rdoc/encoding' + require 'rdoc/parser' + + # Simple must come first + require 'rdoc/parser/simple' + require File.join(home, 'rdoc_parser_swig') + end + require "./#{rdoc}" # load the original rdoc +ensure + File.delete new_rdoc # Discard the symlink +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc1.8 new/openwsman-2.4.13/bindings/ruby/rdoc1.8 --- old/openwsman-2.4.12/bindings/ruby/rdoc1.8 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/rdoc1.8 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -#!/usr/bin/ruby - -# This is ./rdoc -# - -home = File.dirname __FILE__ -$:.unshift(home) -new_rdoc = home+"/rdoc.rb" - -# Symlink ./rdoc.rb to /usr/bin/rdoc -# -File.symlink("/usr/bin/rdoc", new_rdoc) unless File.symlink?(new_rdoc) - -begin - require 'parse_swig.rb' # load the swig parser - require 'rdoc' # load the original rdoc -ensure - File.delete new_rdoc # Discard the symlink -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc1.9 new/openwsman-2.4.13/bindings/ruby/rdoc1.9 --- old/openwsman-2.4.12/bindings/ruby/rdoc1.9 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/rdoc1.9 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -require 'rdoc' - -require 'rdoc/encoding' -require 'rdoc/parser' - -# Simple must come first -require 'rdoc/parser/simple' -require File.join(File.dirname(__FILE__),'rdoc_parser_swig') -require File.join(File.dirname(__FILE__),'rdoc1_9') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc1_9.rb new/openwsman-2.4.13/bindings/ruby/rdoc1_9.rb --- old/openwsman-2.4.12/bindings/ruby/rdoc1_9.rb 2015-01-15 15:59:31.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/rdoc1_9.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to /usr/bin/rdoc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc2.0 new/openwsman-2.4.13/bindings/ruby/rdoc2.0 --- old/openwsman-2.4.12/bindings/ruby/rdoc2.0 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/rdoc2.0 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -require 'rdoc' - -require 'rdoc/encoding' -require 'rdoc/parser' - -# Simple must come first -require 'rdoc/parser/simple' -require File.join(File.dirname(__FILE__),'rdoc_parser_swig') -require File.join(File.dirname(__FILE__),'rdoc2_0') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc2.1 new/openwsman-2.4.13/bindings/ruby/rdoc2.1 --- old/openwsman-2.4.12/bindings/ruby/rdoc2.1 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/rdoc2.1 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -require 'rdoc' - -require 'rdoc/encoding' -require 'rdoc/parser' - -# Simple must come first -require 'rdoc/parser/simple' -require File.join(File.dirname(__FILE__),'rdoc_parser_swig') -require File.join(File.dirname(__FILE__),'rdoc2_1') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc2_0.rb new/openwsman-2.4.13/bindings/ruby/rdoc2_0.rb --- old/openwsman-2.4.12/bindings/ruby/rdoc2_0.rb 2015-01-15 15:59:31.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/rdoc2_0.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to /usr/bin/rdoc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/rdoc2_1.rb new/openwsman-2.4.13/bindings/ruby/rdoc2_1.rb --- old/openwsman-2.4.12/bindings/ruby/rdoc2_1.rb 2015-01-15 15:59:31.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/rdoc2_1.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to /usr/bin/rdoc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/tests/clients.yml new/openwsman-2.4.13/bindings/ruby/tests/clients.yml --- old/openwsman-2.4.12/bindings/ruby/tests/clients.yml 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/ruby/tests/clients.yml 2015-01-13 12:13:12.000000000 +0100 @@ -1,3 +1,20 @@ +x220: + scheme: http + host: 10.160.65.142 + port: 16992 + path: /wsman + username: admin + password: P4ssw0rd! + +server2012: + scheme: http + host: 10.160.67.78 + port: 5985 + path: /wsman + username: wsman + password: secret + auth: basic + server2003sp2: scheme: http host: 10.10.4.227 Files old/openwsman-2.4.12/bindings/ruby/tests/core and new/openwsman-2.4.13/bindings/ruby/tests/core differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/ruby/tests/wql1.rb new/openwsman-2.4.13/bindings/ruby/tests/wql1.rb --- old/openwsman-2.4.12/bindings/ruby/tests/wql1.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/openwsman-2.4.13/bindings/ruby/tests/wql1.rb 2015-01-09 13:04:10.000000000 +0100 @@ -0,0 +1,76 @@ +# wql.rb +# WS-Man Query Language (for WINRM) +# +# http://msdn.microsoft.com/en-us/library/aa394606(VS.85).aspx + +require 'test/unit' +require 'rexml/document' +require File.join(File.dirname(__FILE__),'_loadpath') +require 'openwsman' +require File.join(File.dirname(__FILE__), '_client') + +def handle_fault client, result + unless result + if client.last_error != 0 + STDERR.puts "Client connection to #{client.scheme}://#{client.user}:#{client.password}@#{client.host}:#{client.port}/#{client.path} failed with #{client.last_error}, Fault: #{client.fault_string}" + exit 1 + end + if client.response_code != 200 + STDERR.puts "Client requested result #{client.response_code}, Fault: #{client.fault_string}" + exit 1 + end + STDERR.puts "Client action failed for unknown reason" + exit 1 + end + if result.fault? + fault = Openwsman::Fault.new result + STDERR.puts "Fault code #{fault.code}, subcode #{fault.subcode}" + STDERR.puts "\treason #{fault.reason}" + STDERR.puts "\tdetail #{fault.detail}" + exit 1 + end +end + +class WsmanTest < Test::Unit::TestCase + + def test_wql + client = Client.open + options = Openwsman::ClientOptions.new + options.flags = Openwsman::FLAG_ENUMERATION_OPTIMIZATION + options.max_elements = 999 +# options.set_dump_request + + namespace = "root/cimv2" + classname = "*" # must be '*' for WQL + uri = "http://schemas.microsoft.com/wbem/wsman/1/wmi/#{namespace}/#{classname}" + + filter = Openwsman::Filter.new + # see winenum.rb for more examples + filter.wql "select * from Win32_NetworkAdapterConfiguration where IPEnabled=true" + + result = client.enumerate( options, filter, uri ) + handle_fault client, result + assert result + if result.fault? + puts "Enumerate returned fault" + puts "\t #{client.last_error}:#{client.fault_string}" + exit 1 + end + +# puts "Result #{result.to_xml}" + results = 0 + faults = 0 + + loop do + result.Items.each do |node| + results += 1 + puts "#{node.name}: IPEnabled: #{node.IPEnabled}" + end + context = result.context + break unless context + result = client.pull( options, nil, uri, context ) + break unless result + end + puts "#{results} results, #{faults} faults" + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/wsman-client.i new/openwsman-2.4.13/bindings/wsman-client.i --- old/openwsman-2.4.12/bindings/wsman-client.i 2014-10-20 12:18:50.000000000 +0200 +++ new/openwsman-2.4.13/bindings/wsman-client.i 2015-01-15 08:58:00.000000000 +0100 @@ -92,6 +92,7 @@ return wsmc_get_response_code( $self ); } + %newobject scheme; /* * String representation of the transport scheme * @@ -103,6 +104,7 @@ return wsmc_get_scheme( $self ); } + %newobject host; /* * The host part of the client URL * @@ -119,6 +121,7 @@ return wsmc_get_port( $self ); } + %newobject path; /* * The path of the clien URL * @@ -127,6 +130,7 @@ return wsmc_get_path( $self ); } + %newobject user; /* * The user name used for authentication * @@ -135,6 +139,7 @@ return wsmc_get_user( $self ); } + %newobject password; /* * The password used for authentication * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/bindings/wsman-client_opt.i new/openwsman-2.4.13/bindings/wsman-client_opt.i --- old/openwsman-2.4.12/bindings/wsman-client_opt.i 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/bindings/wsman-client_opt.i 2015-01-15 08:58:13.000000000 +0100 @@ -474,20 +474,6 @@ #endif #if defined(SWIGRUBY) - %rename( "properties=" ) set_properties(VALUE hash); - /* - * Set properties from Hash - * * Input parameters to 'invoke'd methods are represented as ClientOption properties - * - * call-seq: - * options.properties = { "Key" => "Value", ...} - * - */ - void set_properties(VALUE hash) - { - $self->properties = value2hash(NULL, hash, 0); - } - %rename( "properties" ) get_properties(void); /* * Get properties as Hash @@ -499,7 +485,22 @@ */ VALUE get_properties(void) { - return hash2value($self->properties); + VALUE v = Qnil; + if (!list_isempty($self->properties)) { + v = rb_hash_new(); + lnode_t *node = list_first($self->properties); + while (node) { + client_property_t *property = (client_property_t *)node->list_data; + if (property->value.type == 0) { + rb_hash_aset( v, makestring(property->key), makestring(property->value.entry.text)); + } + else { + rb_hash_aset( v, makestring(property->key), makestring(epr_to_string(property->value.entry.eprp))); + } + node = list_next($self->properties, node); + } + } + return v; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/include/u/list.h new/openwsman-2.4.13/include/u/list.h --- old/openwsman-2.4.12/include/u/list.h 2014-07-25 17:08:56.000000000 +0200 +++ new/openwsman-2.4.13/include/u/list.h 2015-01-15 08:58:13.000000000 +0100 @@ -162,7 +162,7 @@ #if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) #define lnode_pool_isempty(P) ((P)->list_free == 0) #define list_count(L) ((L)->list_nodecount) -#define list_isempty(L) ((L)->list_nodecount == 0) +#define list_isempty(L) ((L == NULL) || ((L)->list_nodecount == 0)) #define list_isfull(L) (LIST_SFX_CHECK(L)->list_nodecount == (L)->list_maxcount) #define list_next(L, N) (LIST_SFX_CHECK(N)->list_next == &(L)->list_nilnode ? NULL : (N)->list_next) #define list_prev(L, N) (LIST_SFX_CHECK(N)->list_prev == &(L)->list_nilnode ? NULL : (N)->list_prev) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/include/u/uri.h new/openwsman-2.4.13/include/u/uri.h --- old/openwsman-2.4.12/include/u/uri.h 2014-07-25 17:08:56.000000000 +0200 +++ new/openwsman-2.4.13/include/u/uri.h 2015-01-13 12:13:12.000000000 +0100 @@ -26,6 +26,7 @@ int u_uri_parse (const char *s, u_uri_t **pu); void u_uri_free (u_uri_t *uri); hash_t *u_parse_query(const char *query); +hash_t *u_parse_list(const char *list); #ifdef __cplusplus } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/include/wsman-client-api.h new/openwsman-2.4.13/include/wsman-client-api.h --- old/openwsman-2.4.12/include/wsman-client-api.h 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/include/wsman-client-api.h 2015-01-15 08:58:13.000000000 +0100 @@ -46,6 +46,7 @@ #include "wsman-xml-serializer.h" #include "wsman-epr.h" #include "wsman-filter.h" +#include "u/list.h" /** * @defgroup Client Client @@ -188,14 +189,17 @@ float heartbeat_interval; float expires; hash_t *selectors; - hash_t *properties; + list_t *properties; /* keep properties sorted */ unsigned int timeout; unsigned int max_envelope_size; unsigned int max_elements; hash_t *options; /* for WSM_OPTION_SET */ } client_opt_t; - + typedef struct { + char *key; + selector_entry value; /* either char* or epr_t */ + } client_property_t; struct _WsManFault { const char *code; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/package/openwsman.spec.in new/openwsman-2.4.13/package/openwsman.spec.in --- old/openwsman-2.4.12/package/openwsman.spec.in 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/package/openwsman.spec.in 2015-01-13 12:13:12.000000000 +0100 @@ -279,7 +279,7 @@ %if 0%{?fedora} %define perl_version %(eval "`%{__perl} -V:version`"; echo $version) %define perl_requires perl(:MODULE_COMPAT_%{perl_version}) -Requires: %{perl_version} +Requires: %{perl_requires} %else Requires: perl = %{perl_version} %endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/src/lib/u/uri.c new/openwsman-2.4.13/src/lib/u/uri.c --- old/openwsman-2.4.12/src/lib/u/uri.c 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/src/lib/u/uri.c 2015-01-13 12:13:12.000000000 +0100 @@ -201,18 +201,20 @@ } -hash_t *u_parse_query(const char *query) +static hash_t * +_u_parse(const char *query, const char *separator) { char *pp, *tok, *src, *q = NULL; char *key=NULL, *val=NULL; hash_t *h = NULL; dbg_err_if(query == NULL); + dbg_err_if(separator == NULL); q = u_strdup(query); h = hash_create3(HASHCOUNT_T_MAX, 0, 0); /* foreach name=value pair... */ - for (src = q; (tok = strtok_r(src, "&", &pp)) != NULL; src = NULL) { + for (src = q; (tok = strtok_r(src, separator, &pp)) != NULL; src = NULL) { /* dup the string so we can modify it */ key = u_strdup(tok); dbg_err_if(key == NULL); @@ -257,6 +259,17 @@ return NULL; } +hash_t * +u_parse_query(const char *query) +{ + return _u_parse(query, "&"); +} + +hash_t * +u_parse_list(const char *list) +{ + return _u_parse(list, ","); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/src/lib/wsman-client.c new/openwsman-2.4.13/src/lib/wsman-client.c --- old/openwsman-2.4.12/src/lib/wsman-client.c 2014-10-20 10:00:56.000000000 +0200 +++ new/openwsman-2.4.13/src/lib/wsman-client.c 2015-01-15 08:58:13.000000000 +0100 @@ -49,17 +49,6 @@ #include "wsman-faults.h" #include "wsman-client.h" -/* - * Since the options->properties can only handle pointers, - * we need to flag somehow that the value is not a char pointer - * but a epr_t pointer. - * We do this by prefixing the name with "<epr>". Since neither - * '<' nor '>' are valid property names, this should not conflict - * with normal options. - */ -#define EPR_KEY_PREFIX "<epr>" -#define EPR_KEY_PREFIX_LEN 5 - static hash_t * get_selectors_from_uri(const char *resource_uri) { @@ -328,6 +317,29 @@ return op; } +static void +_wsmc_properties_destroy(list_t *properties) +{ + while (!list_isempty(properties)) { + lnode_t *node; + client_property_t *prop; + + node = list_del_last(properties); + if (!node) + break; + prop = (client_property_t *)node->list_data; + lnode_destroy(node); + u_free(prop->key); + if (prop->value.type == 0) { + u_free(prop->value.entry.text); + } + else { + epr_destroy(prop->value.entry.eprp); + } + u_free(prop); + } + list_destroy(properties); +} void wsmc_options_destroy(client_opt_t * op) @@ -338,10 +350,7 @@ if (op->selectors) { hash_free(op->selectors); } - if (op->properties) { - hash_free(op->properties); - } - + _wsmc_properties_destroy(op->properties); u_free(op->fragment); u_free(op->cim_ns); u_free(op->delivery_uri); @@ -374,58 +383,88 @@ /* - * free a properties hash entry - * take care of epr_t vs 'normal' hash data + * compare two property list entries by key */ +static int +_property_key_compare(const void *node1, const void *node2) +{ + const char *key1 = ((client_property_t *)node1)->key; + const char *key2 = ((client_property_t *)node2)->key; + return strcmp(key1, key2); +} + +/* + * (static function) + * Add property to options + * either as char* (string set, epr == NULL) + * or as epr_t (string == NULL, epr set) + */ + static void -properties_hnode_free(hnode_t *node, void *context) +_wsmc_add_property(client_opt_t *options, + const char *key, + const char *string, + const epr_t *epr) { - const char *key = node->hash_key; - if (*key == '<' - && strncmp(key, EPR_KEY_PREFIX, EPR_KEY_PREFIX_LEN) == 0) { - epr_destroy((epr_t *)node->hash_data); + client_property_t *prop; + lnode_t *lnode; + if ((string != NULL) && (epr != NULL)) { + error("Ambiguous call to add_property"); + return; + } + if (key == NULL) { + error("Can't add property with NULL key"); + return; + } + if (options->properties == NULL) { + options->properties = list_create(LISTCOUNT_T_MAX); } - else { - u_free((void *)node->hash_data); + if (list_find(options->properties, key, _property_key_compare)) { + error("duplicate key not added to properties"); + return; + } + prop = u_malloc(sizeof(client_property_t)); + if (!prop) { + error("No memory for property"); + return; + } + prop->key = u_strdup(key); + if (string != NULL) { + prop->value.type = 0; + prop->value.entry.text = u_strdup(string); + } else if (epr != NULL) { + prop->value.type = 1; + prop->value.entry.eprp = epr_copy(epr); + } else { + error("Can't add NULL as property value"); + return; + } + lnode = lnode_create(prop); + if (!lnode) { + error("No memory for property node"); + return; } - u_free((void *)node->hash_key); - free(node); + list_append(options->properties, lnode); } +/* + * add a char* as property + * + */ + void wsmc_add_property(client_opt_t * options, const char *key, const char *value) { - if (options->properties == NULL) { - options->properties = hash_create3(HASHCOUNT_T_MAX, 0, 0); - hash_set_allocator(options->properties, (hnode_alloc_t)NULL, - properties_hnode_free, NULL); - } - if (!hash_lookup(options->properties, key)) { - char *k = u_strdup(key); - char *v = u_strdup(value); - if (!hash_alloc_insert(options->properties, k, v)) { - error("hash_alloc_insert failed"); - u_free(v); - u_free(k); - } - } else { - error("duplicate not added to hash"); - } + _wsmc_add_property(options, key, value, NULL); } /* * add an EndpointReference as property * - * Since the options->properties can only handle pointers, - * we need to flag somehow that the value is not a char pointer - * but a epr_t pointer. - * We do this by prefixing the name with "<epr>". Since neither - * '<' nor '>' are valid property names, this should not conflict - * with normal options. */ void @@ -433,30 +472,7 @@ const char *key, const epr_t *value) { - if (options->properties == NULL) { - options->properties = hash_create3(HASHCOUNT_T_MAX, 0, 0); - hash_set_allocator(options->properties, (hnode_alloc_t)NULL, - properties_hnode_free, NULL); - } - if (!hash_lookup(options->properties, key)) { /* does 'key' exist */ - char *epr_key = alloca(EPR_KEY_PREFIX_LEN + strlen(key) + 1); - sprintf(epr_key, "%s%s", EPR_KEY_PREFIX, key); - if (!hash_lookup(options->properties, epr_key)) { /* does '<epr>key' exist ? */ - char *k = u_strdup(epr_key); - epr_t *v = epr_copy(value); - if (!hash_alloc_insert(options->properties, k, (char *)v)) { - error("hash_alloc_insert failed"); - epr_destroy(v); - u_free(k); - } - } - else { - error("duplicate not added to hash"); - } - } - else { - error("duplicate not added to hash"); - } + _wsmc_add_property(options, key, NULL, value); } /* @@ -526,7 +542,19 @@ query = u_parse_query(query_string); if (query) { - options->properties = query; + /* convert query hash to property list */ + hscan_t hs; + hnode_t *hn; + _wsmc_properties_destroy(options->properties); + options->properties = NULL; + hash_scan_begin(&hs, query); + while ((hn = hash_scan_next(&hs))) { + _wsmc_add_property(options, + (char *)hnode_getkey(hn), + (char *)hnode_get(hn), + NULL); + } + hash_free(query); } } @@ -880,8 +908,6 @@ { WsXmlNodeH resource_node; char *ns_uri; - hscan_t hs; - hnode_t *hn; WsXmlNodeH get_body = ws_xml_get_soap_body(get_response); WsXmlNodeH put_body = ws_xml_get_soap_body(put_request); @@ -889,14 +915,20 @@ resource_node = ws_xml_get_child(put_body, 0, NULL, NULL); ns_uri = ws_xml_get_node_name_ns_uri(resource_node); - if (!options->properties) { - return; - } - hash_scan_begin(&hs, options->properties); - while ((hn = hash_scan_next(&hs))) { - WsXmlNodeH n = ws_xml_get_child(resource_node, 0, - ns_uri, (char *) hnode_getkey(hn)); - ws_xml_set_node_text(n, (char *) hnode_get(hn)); + if (!list_isempty(options->properties)) { + lnode_t *node = list_first(options->properties); + while (node) { + client_property_t *property = (client_property_t *)node->list_data; + WsXmlNodeH n = ws_xml_get_child(resource_node, 0, + ns_uri, property->key); + if (property->value.type == 0) { + ws_xml_set_node_text(n, property->value.entry.text); + } + else { + epr_serialize(n, ns_uri, property->key, property->value.entry.eprp, 1); + } + node = list_next(options->properties, node); + } } } @@ -1388,35 +1420,26 @@ body = ws_xml_get_soap_body(request); - if ((!options->properties || - hash_count(options->properties) == 0) && + if (list_isempty(options->properties) && data != NULL) { WsXmlNodeH n = ws_xml_get_doc_root(data); ws_xml_duplicate_tree(ws_xml_get_soap_body(request), n); - } else if (options->properties && - hash_count(options->properties) > 0 ) { + } else if (!list_isempty(options->properties)) { if (method) { - WsXmlNodeH node = ws_xml_add_empty_child_format(body, - (char *)resource_uri, "%s_INPUT", method); - hash_scan_begin(&hs, options->properties); - while ((hn = hash_scan_next(&hs))) { - const char *key = hnode_getkey(hn); - if (*key == '<' - && strncmp(key, EPR_KEY_PREFIX, EPR_KEY_PREFIX_LEN) == 0) { - epr_t *val; - key = key + EPR_KEY_PREFIX_LEN; - val = (epr_t *)hnode_get(hn); - epr_serialize(node, (char *)resource_uri, key, val, 1); /* add epr as embedded */ - } - else { - const char *val = hnode_get(hn); - ws_xml_add_child(node, - (char *)resource_uri, - (char *) hnode_getkey(hn), - (char *) hnode_get(hn)); - } + WsXmlNodeH xnode = ws_xml_add_empty_child_format(body, + (char *)resource_uri, "%s_INPUT", method); + lnode_t *lnode = list_first(options->properties); + while (lnode) { + client_property_t *property = (client_property_t *)lnode->list_data; + if (property->value.type == 0) { + ws_xml_add_child(xnode, (char *)resource_uri, (char *)property->key, (char *)property->value.entry.text); + } + else { + epr_serialize(xnode, (char *)resource_uri, property->key, property->value.entry.eprp, 1); } + lnode = list_next(options->properties, lnode); + } } } else if (!strchr(method, '/')) { /* non-custom method without parameters */ ws_xml_add_empty_child_format(body, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openwsman-2.4.12/src/plugins/cim/cim_data.c new/openwsman-2.4.13/src/plugins/cim/cim_data.c --- old/openwsman-2.4.12/src/plugins/cim/cim_data.c 2014-10-20 10:00:57.000000000 +0200 +++ new/openwsman-2.4.13/src/plugins/cim/cim_data.c 2015-01-13 12:13:12.000000000 +0100 @@ -102,6 +102,7 @@ (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces)); ns->class_prefix = CimResource_Namespaces[i].class_prefix; ns->ns = (char*) CimResource_Namespaces[i].ns; + debug("Namespace %s => %s", ns->class_prefix, ns->ns); lnode_t *node = lnode_create(ns); list_append(l, node); } @@ -113,6 +114,7 @@ (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces)); ns->class_prefix = (char*)hnode_getkey(hn); ns->ns = (char*) hnode_get(hn); + debug("Namespace %s => %s", ns->class_prefix, ns->ns); lnode_t *node = lnode_create(ns); list_append(l, node); } @@ -169,7 +171,7 @@ indication_profile_implementation_ns = iniparser_getstring(config, "cim:indication_profile_implementation_ns", "root/interop"); debug("vendor namespaces: %s", namespaces); if (namespaces) { - hash_t * t = u_parse_query(namespaces); + hash_t * t = u_parse_list(namespaces); if (t) { vendor_namespaces = t; } -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org