diff -Nru openwsman-2.3.6/bindings/client_opt.i openwsman-2.4.3/bindings/client_opt.i --- openwsman-2.3.6/bindings/client_opt.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/client_opt.i 2013-12-23 04:47:33.000000000 -0600 @@ -12,6 +12,8 @@ /* + * Document-class: ClientOptions + * * ClientOptions control the behaviour of the Client connection * * The primary use of ClientOptions in normal operations is adding @@ -27,6 +29,7 @@ client_opt_t *options = wsmc_options_init(); #if defined(SWIGJAVA) if (options) { + options->options = hash_create3(HASHCOUNT_T_MAX, 0, 0); options->selectors = hash_create3(HASHCOUNT_T_MAX, 0, 0); options->properties = hash_create3(HASHCOUNT_T_MAX, 0, 0); } @@ -43,6 +46,10 @@ * * Used for debugging on the wire-level * + * See also: clear_dump_request + * + * call-seq: + * options.set_dump_request */ void set_dump_request(void) { wsmc_set_action_option($self, FLAG_DUMP_REQUEST ); @@ -53,33 +60,41 @@ * * Used for debugging on the wire-level * + * See also: set_dump_request + * + * call-seq: + * options.clear_dump_request */ void clear_dump_request(void) { wsmc_clear_action_option($self, FLAG_DUMP_REQUEST ); } +#if defined(SWIGRUBY) + %rename( "flags=" ) set_flags(int flags); +#endif /* * set option flag(s) * * adds new flag(s) to options * + * call-seq: + * options.flags = Openwsman::FLAG_ENUMERATION_OPTIMIZATION */ -#if defined(SWIGRUBY) - %rename( "flags=" ) set_flags(int flags); -#endif void set_flags(int flags) { wsmc_set_action_option($self, flags); } +#if defined(SWIGRUBY) + %rename( "flags" ) get_flags(); +#endif /* * get option flag(s) * * return current flags bitmask * + * call-seq: + * optins.flags -> Integer */ -#if defined(SWIGRUBY) - %rename( "flags" ) get_flags(); -#endif unsigned int get_flags() { return wsmc_get_action_option($self); } @@ -89,6 +104,9 @@ * * clears specific flag(s) from options * + * call-seq: + * options.clear_flags Openwsman::FLAG_ENUMERATION_OPTIMIZATION + * */ void clear_flags(int flags) { wsmc_clear_action_option($self, flags); @@ -99,18 +117,22 @@ * * sets option flags bitmask to FLAG_NONE * + * call-seq: + * options.reset_flags */ void reset_flags() { wsmc_clear_action_option($self, ~FLAG_NONE); } +#if defined(SWIGRUBY) + %rename( "max_envelope_size=" ) set_max_envelope_size(unsigned long size); +#endif /* * Limit size of result document * + * call-seq: + * options.max_envelope_size = 10240 */ -#if defined(SWIGRUBY) - %rename( "max_envelope_size=" ) set_max_envelope_size(unsigned long size); -#endif void set_max_envelope_size(unsigned long size) { $self->max_envelope_size = size; } @@ -118,17 +140,25 @@ #if defined(SWIGRUBY) %rename( "max_envelope_size" ) get_max_envelope_size(); #endif + /* + * Return size limit of result document + * + * call-seq: + * options.max_envelope_size -> Integer + */ unsigned long get_max_envelope_size() { return $self->max_envelope_size; } +#if defined(SWIGRUBY) + %rename( "max_elements=" ) set_max_elements(int elements); +#endif /* * Limit number of elements returned by enumeration * + * call-seq: + * options.max_elements = 42 */ -#if defined(SWIGRUBY) - %rename( "max_elements=" ) set_max_elements(int elements); -#endif void set_max_elements(int elements) { $self->max_elements = elements; } @@ -136,18 +166,26 @@ #if defined(SWIGRUBY) %rename( "max_elements" ) get_max_elements(); #endif + /* + * Return enumeration elements limit + * + * call-seq: + * options.max_elements -> Integer + */ int get_max_elements() { return $self->max_elements; } +#if defined(SWIGRUBY) + %rename( "timeout=" ) set_timeout(unsigned long timeout); +#endif /* * Operation timeout in milliseconds * See Openwsman::Transport.timeout for transport timeout * + * call-seq: + * options.timeout = 60*1000 # 60 seconds */ -#if defined(SWIGRUBY) - %rename( "timeout=" ) set_timeout(unsigned long timeout); -#endif void set_timeout(unsigned long timeout) { $self->timeout = timeout; } @@ -155,18 +193,28 @@ #if defined(SWIGRUBY) %rename( "timeout" ) get_timeout(); #endif + /* + * Return operation timeout in milliseconds + * See Openwsman::Transport.timeout for transport timeout + * + * call-seq: + * options.timeout -> Integer + */ unsigned long get_timeout() { return $self->timeout; } +#if defined(SWIGRUBY) + %rename( "fragment=" ) set_fragment(char *fragment); +#endif /* - * Fragment + * Set fragment filter + * See DSP0226, section 7.7. * (Supported Dialects: XPATH) * + * call-seq: + * options.fragment = "xpath/expression" */ -#if defined(SWIGRUBY) - %rename( "fragment=" ) set_fragment(char *fragment); -#endif void set_fragment(char *fragment) { wsmc_set_fragment(fragment, $self); } @@ -174,18 +222,32 @@ #if defined(SWIGRUBY) %rename( "fragment" ) get_fragment(); #endif + /* + * Get fragment filter + * See DSP0226, section 7.7. + * + * call-seq: + * options.fragment -> String + */ const char *get_fragment() { return $self->fragment; } +#if defined(SWIGRUBY) + %rename( "cim_namespace=" ) set_cim_namespace(char *cim_namespace); +#endif /* - * CIM Namespace + * Set CIM Namespace for Openwsman * (default is root/cimv2) + * Note: + * Microsoft WinRM set the resource namespace by attaching it + * to the resource URI + * + * See also: Openwsman.epr_prefix_for * + * call-seq: + * options.cim_namespace = "root/interop" */ -#if defined(SWIGRUBY) - %rename( "cim_namespace=" ) set_cim_namespace(char *cim_namespace); -#endif void set_cim_namespace(char *cim_namespace) { wsmc_set_cim_ns(cim_namespace, $self); } @@ -193,18 +255,31 @@ #if defined(SWIGRUBY) %rename( "cim_namespace" ) get_cim_namespace(); #endif - const char *get_cim_namespace() { - return $self->cim_ns; - } - /* - * Reference - * (XML string) + * Get CIM Namespace for Openwsman + * Note: + * Microsoft WinRM set the resource namespace by attaching it + * to the resource URI * + * See also: Openwsman.epr_prefix_for + * + * call-seq: + * options.cim_namespace -> String */ + const char *get_cim_namespace() { + return $self->cim_ns; + } + #if defined(SWIGRUBY) %rename( "reference=" ) set_reference(const char *reference); #endif + /* + * Set WS-Addressing reference properties + * Argument must the string representation of a valid XML document + * + * call-seq: + * options.reference = "" + */ void set_reference(const char *reference) { wsmc_set_reference(reference, $self); } @@ -212,18 +287,84 @@ #if defined(SWIGRUBY) %rename( "reference" ) get_reference(); #endif + /* + * Get WS-Addressing reference properties + * Returns the string representation of a valid XML document + * + * call-seq: + * options.reference -> String + */ const char *get_reference() { return $self->reference; } +#if defined(SWIGRUBY) /* - * Add a selector as key/value pair + * Add an option (for OptionSet) as key/value pair + * + * NOTE: + * the value must be properly escaped (replace & with &, etc.) + * in Ruby use CGI::escapeHTML() + * + * call-seq: + * options.add_option "Name", "Value" + */ + void add_option(VALUE k, VALUE v) + { + const char *key = as_string(k); + const char *value = as_string(v); +#else + void add_option(const char *key, const char *value) + { +#endif +#if defined(SWIGJAVA) + key = strdup(key); + value = strdup(value); +#endif + wsmc_add_option($self, key, value); + } + +#if defined(SWIGRUBY) + %rename( "options=" ) set_options(VALUE hash); + /* + * Set options (for OptionSet) from Hash + * + * NOTE: + * the values must be properly escaped (replace & with &, etc.) + * in Ruby use CGI::escapeHTML() * - * NOTE: the value must be properly escaped (replace & with &, etc.) - * in Ruby use CGI::escapeHTML() + * call-seq: + * options.options = { "Name" => "Value", ... } + */ + void set_options(VALUE hash) + { + $self->options = value2hash(NULL, hash, 0); + } + + %rename( "options" ) get_options(void); + /* + * Get options (for OptionSet) as Hash * + * call-seq: + * options.options -> Hash */ + VALUE get_options(void) + { + return hash2value($self->options); + } +#endif + #if defined(SWIGRUBY) + /* + * Add a selector as key/value pair + * + * NOTE: + * the value must be properly escaped (replace & with &, etc.) + * in Ruby use CGI::escapeHTML() + * + * call-seq: + * options.add_selector "Key", "Value" + */ void add_selector(VALUE k, VALUE v) { const char *key = as_string(k); @@ -240,25 +381,42 @@ } #if defined(SWIGRUBY) + %rename( "selectors=" ) set_selectors(VALUE hash); /* * Set selectors from Hash * - * NOTE: the values must be properly escaped (replace & with &, etc.) - * in Ruby use CGI::escapeHTML() + * NOTE: + * the values must be properly escaped (replace & with &, etc.) + * in Ruby use CGI::escapeHTML() * + * call-seq: + * options.selectors = { "Key" => "Value", ... } */ - %rename( "selectors=" ) set_selectors(VALUE hash); void set_selectors(VALUE hash) { $self->selectors = value2hash(NULL, hash, 0); } + + %rename( "selectors" ) get_selectors(void); + /* + * Get selectors as Hash + * + * call-seq: + * options.selectors -> Hash + */ + VALUE get_selectors(void) + { + return hash2value($self->selectors); + } #endif +#if defined(SWIGRUBY) /* * Add a property as key/value pair * + * call-seq: + * options.add_property "Key", "Value" */ -#if defined(SWIGRUBY) void add_property(VALUE k, VALUE v) { const char *key = as_string(k); @@ -275,67 +433,109 @@ } #if defined(SWIGRUBY) + %rename( "properties=" ) set_properties(VALUE hash); /* * Set properties from Hash + * + * call-seq: + * options.properties = { "Key" => "Value", ...} */ - %rename( "properties=" ) set_properties(VALUE hash); void set_properties(VALUE hash) { $self->properties = value2hash(NULL, hash, 0); } -#endif + %rename( "properties" ) get_properties(void); /* - * Set delivery uri + * Get properties as Hash + * + * call-seq: + * options.properties -> Hash */ + VALUE get_properties(void) + { + return hash2value($self->properties); + } +#endif + #if defined(SWIGRUBY) %rename( "delivery_uri=" ) set_delivery_uri(const char *delivery_uri); #endif + /* + * Set delivery uri + * + * call-seq: + * options.delivery_uri = "http://..." + */ void set_delivery_uri( const char *delivery_uri ) { wsmc_set_delivery_uri(delivery_uri, $self); } /* * Get delivery uri + * + * call-seq: + * options.delivery_uri -> String */ const char *delivery_uri() { return $self->delivery_uri; } - /* - * Set subscription expiry timeout (in seconds) - */ #if defined(SWIGRUBY) %rename( "sub_expiry=" ) set_sub_expiry(unsigned int event_subscription_expire); #endif + /* + * Set subscription expiry timeout (in seconds) + * + * call-seq: + * options.sub_expiry = 600 # 10 mins + */ void set_sub_expiry(unsigned int event_subscription_expire) { wsmc_set_sub_expiry(event_subscription_expire, $self); } + /* + * Get subscription expiry timeout (in seconds) + * + * call-seq: + * options.sub_expiry -> Integer + */ int sub_expiry() { return $self->expires; } - /* - * Set subscription heartbeat interval (in seconds) - */ #if defined(SWIGRUBY) %rename("heartbeat_interval=") set_heartbeat_interval(unsigned int heartbeat_interval); #endif + /* + * Set subscription heartbeat interval (in seconds) + * + * call-seq: + * options.heartbeat_interval = 60 # every minute + */ void set_heartbeat_interval(unsigned int heartbeat_interval) { wsmc_set_heartbeat_interval(heartbeat_interval, $self); } + /* + * Get subscription heartbeat interval (in seconds) + * + * call-seq: + * options.heartbeat_interval -> Integer + */ int heartbeat_interval() { return $self->heartbeat_interval; } - /* - * Set subscription delivery mode (push, pushwithack,events,pull) - */ #if defined(SWIGRUBY) %rename( "delivery_mode=" ) set_delivery_mode(unsigned int delivery_mode); #endif + /* + * Set subscription delivery mode (push, pushwithack,events,pull) + * + * call-seq: + * options.delivery_mode = Openwsman::WSMAN_DELIVERY_PUSH + */ void set_delivery_mode(unsigned int delivery_mode) { if (delivery_mode > WSMAN_DELIVERY_PULL) SWIG_exception( SWIG_ValueError, "Bad delivery mode" ); @@ -347,16 +547,30 @@ #endif } + /* + * Get subscription delivery mode (push, pushwithack,events,pull) + * + * call-seq: + * options.delivery_mode -> Integer + */ int delivery_mode() { return $self->delivery_mode; } - /* - * Set subscription delivery security mode (lots) - */ #if defined(SWIGRUBY) - %rename( "delivery_security_mode=" ) set_delivery_sec_mode(unsigned int delivery_mode); + %rename( "delivery_security_mode=" ) set_delivery_security_mode(unsigned int delivery_mode); #endif + /* + * Set subscription delivery security mode + * + * (auto, http basic, http digest, https basic, https digest, + * https mutual, https mutual basic, https mutual digest, + * http spnego kerberos, https spnego kerberos, + * https mutual spnego kerberos) + * + * call-seq: + * options.delivery_security_mode = Openwsman::WSMAN_DELIVERY_SEC_HTTPS_BASIC + */ void set_delivery_security_mode(unsigned int delivery_sec_mode) { if (delivery_sec_mode > WSMAN_DELIVERY_SEC_HTTP_SPNEGO_KERBEROS) SWIG_exception( SWIG_ValueError, "Bad delivery security mode" ); @@ -367,9 +581,14 @@ #endif } + /* + * Get subscription delivery security mode + * + * call-seq: + * options.delivery_security_mode -> Integer + */ int delivery_sec_mode() { return $self->delivery_sec_mode; } } - diff -Nru openwsman-2.3.6/bindings/java/CMakeLists.txt openwsman-2.4.3/bindings/java/CMakeLists.txt --- openwsman-2.3.6/bindings/java/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/java/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -30,11 +30,15 @@ SET( java_TARGET "-target") ENDIF(EXPLICIT_TARGET) +IF(EXPLICIT_SOURCE) + SET( java_SOURCE "-source") +ENDIF(EXPLICIT_SOURCE) + ADD_CUSTOM_COMMAND ( OUTPUT ${jar_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo_append "Compiling Java files ..." - COMMAND ${JAVA_COMPILE} ${java_TARGET} ${EXPLICIT_TARGET} -d . *.java + COMMAND ${JAVA_COMPILE} ${java_SOURCE} ${EXPLICIT_SOURCE} ${java_TARGET} ${EXPLICIT_TARGET} -d . *.java COMMAND ${CMAKE_COMMAND} -E echo_append "Creating JAR ..." COMMAND ${JAVA_ARCHIVE} cvf ${jar_NAME} *.so org/* DEPENDS ${SWIG_OUTPUT} diff -Nru openwsman-2.3.6/bindings/java/tests/CMakeLists.txt openwsman-2.4.3/bindings/java/tests/CMakeLists.txt --- openwsman-2.3.6/bindings/java/tests/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/java/tests/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -28,7 +28,8 @@ # Identify ADD_TEST(bindings_java_identify_compile ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR} -cp ${CMAKE_CURRENT_BINARY_DIR}/../${jar_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/identify.java ) -ADD_TEST(bindings_java_identify ${JAVA_RUNTIME} -cp ${CMAKE_CURRENT_BINARY_DIR}/../${jar_NAME}:${CMAKE_CURRENT_BINARY_DIR} identify ) +#ADD_TEST(bindings_java_identify ${JAVA_RUNTIME} -cp ${CMAKE_CURRENT_BINARY_DIR}/../${jar_NAME}:${CMAKE_CURRENT_BINARY_DIR} identify ) +ADD_TEST(bindings_java_identify ${CMAKE_CURRENT_SOURCE_DIR}/run ${CMAKE_CURRENT_BINARY_DIR} ${jar_NAME} identify ) # data types # ADD_TEST(bindings_java_fault ${CMAKE_CURRENT_SOURCE_DIR}/run ${CMAKE_CURRENT_SOURCE_DIR} fault ) diff -Nru openwsman-2.3.6/bindings/java/tests/run openwsman-2.4.3/bindings/java/tests/run --- openwsman-2.3.6/bindings/java/tests/run 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/java/tests/run 2013-12-23 04:47:33.000000000 -0600 @@ -2,6 +2,8 @@ # # run script for Java tests # -# Usage: run +# Usage: run # -(cd $1; java -Djava.library.path=`pwd` $2) +(cd $1; + f=`dirname $0`; + LD_LIBRARY_PATH=$f/../../../build/src/lib java -Djava.library.path=`pwd` -cp ../$2:$1 $3) diff -Nru openwsman-2.3.6/bindings/openwsman.i openwsman-2.4.3/bindings/openwsman.i --- openwsman-2.3.6/bindings/openwsman.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/openwsman.i 2013-12-23 04:47:33.000000000 -0600 @@ -1,31 +1,3 @@ -/* - * Document-module: Openwsman - * = About openwsman - * Openwsman (http://www.openwsman.org) is a project intended to provide an open-source - * implementation of the Web Services Management specification - * (WS-Management) and to expose system management information on the - * Linux operating system using the WS-Management protocol. WS-Management - * is based on a suite of web services specifications and usage - * requirements that exposes a set of operations focused on and covers - * all system management aspects. - * - * = Using the bindings - * The bindings provide access to the client-side API of openwsman. - * You start by creating a Client instance and set up ClientOptions - * to control the communication. - * - * The Client instance now provides the WS-Management operations, like - * enumerate, get, invoke, etc. - * - * All client operations return a XmlDoc representing the SOAP response - * from the system. - * - * You can then use XmlDoc methods to extract SOAP elements from the - * response and dig down through its XmlNode and XmlAttr objects. - * - */ - - #if defined(SWIGRUBY) %module Openwsman @@ -103,6 +75,7 @@ /* get the java environment so we can throw exceptions */ %{ static JNIEnv *jenv; + /*:nodoc:*/ jint JNI_OnLoad(JavaVM *vm, void *reserved) { (*vm)->AttachCurrentThread(vm, (void **)&jenv, NULL); return JNI_VERSION_1_2; @@ -150,11 +123,17 @@ #if defined(SWIGRUBY) #include -/* Init_ for the %module, defined by Swig */ -SWIGEXPORT void Init_Openwsman(void); +SWIGEXPORT +/* Init_ for the %module, defined by Swig + * :nodoc: + */ +void Init_Openwsman(void); -/* Init_ for the .so lib, called by Ruby */ -SWIGEXPORT void Init__openwsman(void) { +SWIGEXPORT +/* Init_ for the .so lib, called by Ruby + * :nodoc: + */ +void Init__openwsman(void) { Init_Openwsman(); } #endif @@ -170,13 +149,18 @@ /* Provide WsManTransport definition so it can be used as * dedicated datatype in bindings. - * Internally, its aliased to WsManClient + * :nodoc:ly, its aliased to WsManClient */ struct _WsManTransport { }; typedef struct _WsManTransport WsManTransport; static void set_debug(int dbg); +/* + * Set openwsman debug level. + * call-seq: + * Openwsman::debug = -1 # full debug + */ static void set_debug(int dbg) { static int init = 0; @@ -192,29 +176,56 @@ static int get_debug(void); +/* + * Return openwsman debug level. + * call-seq: + * Openwsman::debug -> Integer + */ static int get_debug(void) { return (int)wsman_debug_get_level(); } static WsXmlDocH create_soap_envelope(void); +/* + * Create empty SOAP envelope + * call-seq: + * Openwsman::create_soap_envelope -> XmlDoc + */ static WsXmlDocH create_soap_envelope() { return ws_xml_create_soap_envelope(); } static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding); +/* + * Read XmlDoc from file + * call-seq: + * Openwsman::create_doc_from_file("/path/to/file", "utf-8") -> XmlDoc + * + */ static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding) { return xml_parser_file_to_doc( filename, encoding, 0); } static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding); +/* + * Read XmlDoc from string + * call-seq: + * Openwsman::create_doc_from_string("", "utf-8") -> XmlDoc + * + */ static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding) { return xml_parser_memory_to_doc( buf, strlen(buf), encoding, 0); } static char *uri_classname(const char *uri); -/* get classname from resource URI */ +/* + * get classname from resource URI + * call-seq: + * Openwsman::uri_classname("http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_OperatingSystem") -> "Linux_OperatingSystem" + * + */ static char *uri_classname(const char *uri) { const char *lastslash = strrchr(uri,'/'); if (lastslash) { @@ -223,9 +234,14 @@ return NULL; } - static const char *uri_prefix(const char *classname); -/* get resource URI prefix for a specific classname (resp class schema) */ +/* + * Map classname (class schema) to resource uri prefix + * call-seq: + * Openwsman::uri_prefix("Linux") -> "http://sblim.sf.net/wbem/wscim/1/cim-schema/2" + * Openwsman::uri_prefix("Win32") -> "http://schemas.microsoft.com/wbem/wsman/1/wmi" + * + */ static const char *uri_prefix(const char *classname) { static struct map { int len; @@ -252,6 +268,10 @@ { 3, "IPS", "http://intel.com/wbem/wscim/1/ips-schema/1" }, /* Sun */ { 3, "Sun","http://schemas.sun.com/wbem/wscim/1/cim-schema/2" }, + /* Microsoft HyperV */ + { 4, "Msvm", "http://schemas.microsoft.com/wbem/wsman/1/wmi" }, + /* Dell DRAC */ + { 4, "DCIM", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2" }, { 0, NULL, NULL } }; const char *schema_end; @@ -283,6 +303,7 @@ #if defined(SWIGRUBY) static epr_t *my_epr_deserialize(WsXmlNodeH node); +/*:nodoc:*/ static epr_t *my_epr_deserialize(WsXmlNodeH node) { if (strcmp(WSA_EPR, ws_xml_get_node_local_name(node)) == 0) { /* Use node as-is if its already a WSA_EPR */ @@ -294,7 +315,9 @@ #endif static char *epr_prefix(const char *uri); -/* Get prefix from a EPR uri */ +/* Get prefix from a EPR uri + * :nodoc: + */ static char *epr_prefix(const char *uri) { char *classname = uri_classname(uri); const char *prefix = uri_prefix(classname); @@ -313,6 +336,83 @@ %} +#if RUBY_VERSION > 18 +%{ + typedef struct { + WsManClient *client; + client_opt_t *options; + filter_t *filter; + const char *resource_uri; + epr_t *epr; + const char *context; + const char *identifier; + const char *data; + size_t size; + const char *encoding; + const char *method; + WsXmlDocH method_args; + } wsmc_action_args_t; + + WsXmlDocH + ruby_enumerate_thread(wsmc_action_args_t *args) { + return wsmc_action_enumerate(args->client, args->resource_uri, args->options, args->filter); + } + WsXmlDocH + ruby_identify_thread(wsmc_action_args_t *args) { + return wsmc_action_identify(args->client, args->options); + } + WsXmlDocH + ruby_get_from_epr_thread(wsmc_action_args_t *args) { + return wsmc_action_get_from_epr(args->client, args->epr, args->options); + } + WsXmlDocH + ruby_delete_from_epr_thread(wsmc_action_args_t *args) { + return wsmc_action_delete_from_epr(args->client, args->epr, args->options); + } + WsXmlDocH + ruby_pull_thread(wsmc_action_args_t *args) { + return wsmc_action_pull(args->client, args->resource_uri, args->options, args->filter, args->context); + } + WsXmlDocH + ruby_create_fromtext_thread(wsmc_action_args_t *args) { + return wsmc_action_create_fromtext(args->client, args->resource_uri, args->options, args->data, args->size, args->encoding); + } + WsXmlDocH + ruby_put_fromtext_thread(wsmc_action_args_t *args) { + return wsmc_action_put_fromtext(args->client, args->resource_uri, args->options, args->data, args->size, args->encoding); + } + WsXmlDocH + ruby_release_thread(wsmc_action_args_t *args) { + return wsmc_action_release(args->client, args->resource_uri, args->options, args->context); + } + WsXmlDocH + ruby_get_thread(wsmc_action_args_t *args) { + return wsmc_action_get(args->client, args->resource_uri, args->options); + } + WsXmlDocH + ruby_delete_thread(wsmc_action_args_t *args) { + return wsmc_action_delete(args->client, args->resource_uri, args->options); + } + WsXmlDocH + ruby_invoke_thread(wsmc_action_args_t *args) { + return wsmc_action_invoke(args->client, args->resource_uri, args->options, args->method, args->method_args); + } + WsXmlDocH + ruby_subscribe_thread(wsmc_action_args_t *args) { + return wsmc_action_subscribe(args->client, args->resource_uri, args->options, args->filter); + } + WsXmlDocH + ruby_unsubscribe_thread(wsmc_action_args_t *args) { + return wsmc_action_unsubscribe(args->client, args->resource_uri, args->options, args->identifier); + } + WsXmlDocH + ruby_renew_thread(wsmc_action_args_t *args) { + return wsmc_action_renew(args->client, args->resource_uri, args->options, args->identifier); + } +%} +#endif + + /* * hash_t typemaps */ @@ -377,38 +477,12 @@ #if defined(SWIGRUBY) %rename("debug=") set_debug(int debug); #endif - -/* - * Return openwsman debug level. - */ static void set_debug(int dbg); - #if defined(SWIGRUBY) %rename("debug") get_debug(); #endif - -/* - * Set openwsman debug level. - */ static int get_debug(); - -/* - * Create empty SOAP envelope (XmlDoc) - * - */ static WsXmlDocH create_soap_envelope(); - -/* - * Read XmlDoc from file - */ static WsXmlDocH create_doc_from_file(const char *filename, const char *encoding = "UTF-8"); - -/* - * Read XmlDoc from string - */ static WsXmlDocH create_doc_from_string(const char *buf, const char *encoding = "UTF-8"); - -/* - * Map classname (class schema) to resource uri prefix - */ static const char *uri_prefix(const char* classname); diff -Nru openwsman-2.3.6/bindings/perl/tests/CIM_ComputerSystem_EnumInstances.pl openwsman-2.4.3/bindings/perl/tests/CIM_ComputerSystem_EnumInstances.pl --- openwsman-2.3.6/bindings/perl/tests/CIM_ComputerSystem_EnumInstances.pl 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/perl/tests/CIM_ComputerSystem_EnumInstances.pl 2013-12-23 04:47:33.000000000 -0600 @@ -53,7 +53,7 @@ # Get nodes. # soap body -> PullResponse -> items - my $nodes = $result->body()->child()->child()->child(); + my $nodes = $result->body()->find($openwsman::XML_NS_ENUMERATION, "Items")->child(); next unless($nodes); # Get items. diff -Nru openwsman-2.3.6/bindings/perl/tests/run openwsman-2.4.3/bindings/perl/tests/run --- openwsman-2.3.6/bindings/perl/tests/run 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/perl/tests/run 2013-12-23 04:47:33.000000000 -0600 @@ -4,4 +4,6 @@ # # Usage: run # -(cd $1; perl $2) +(cd $1; + f=`dirname $0`; + LD_LIBRARY_PATH=$f/../../../build/src/lib perl $2) diff -Nru openwsman-2.3.6/bindings/python/tests/run openwsman-2.4.3/bindings/python/tests/run --- openwsman-2.3.6/bindings/python/tests/run 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/python/tests/run 2013-12-23 04:47:33.000000000 -0600 @@ -4,4 +4,6 @@ # # Usage: run # -(cd $1; python $2) +(cd $1; + f=`dirname $0`; + LD_LIBRARY_PATH=$f/../../../build/src/lib python $2) diff -Nru openwsman-2.3.6/bindings/ruby/CMakeLists.txt openwsman-2.4.3/bindings/ruby/CMakeLists.txt --- openwsman-2.3.6/bindings/ruby/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -6,11 +6,14 @@ add_subdirectory(tests) +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['ruby_version']" OUTPUT_VARIABLE RUBY_VERSION) + # prefer vendor dirs SET(RUBY_WSMAN_LIB_DIR ${RUBY_VENDORLIB_DIR}) SET(RUBY_WSMAN_ARCH_DIR ${RUBY_VENDORARCH_DIR}) MESSAGE(STATUS "Ruby executable: ${RUBY_EXECUTABLE}") +MESSAGE(STATUS "Ruby version: ${RUBY_VERSION}") MESSAGE(STATUS "Ruby dir: ${RUBY_WSMAN_LIB_DIR}") MESSAGE(STATUS "Ruby arch dir: ${RUBY_WSMAN_ARCH_DIR}") MESSAGE(STATUS "Ruby include path: ${RUBY_INCLUDE_PATH}") @@ -22,8 +25,7 @@ ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Ruby..." - COMMAND ${SWIG_EXECUTABLE} -ruby -autorename -DRUBY_VERSION=${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR} -features autodoc -I${CMAKE_BINARY_DIR}/bindings -I${CMAKE_SOURCE_DIR}/bindings -I${CMAKE_SOURCE_DIR}/include -o ${SWIG_OUTPUT} ${SWIG_INPUT} - + COMMAND ${SWIG_EXECUTABLE} -ruby -autorename -DRUBY_VERSION=${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR} -I${CMAKE_BINARY_DIR}/bindings -I${CMAKE_SOURCE_DIR}/bindings -I${CMAKE_SOURCE_DIR}/include -o ${SWIG_OUTPUT} ${SWIG_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i @@ -64,26 +66,22 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/openwsman.rb DESTINATION ${RUBY_WSMAN_LIB_DIR}) -IF(${RUBY_VERSION_MAJOR} EQUAL 1) - IF (${RUBY_VERSION_MINOR} LESS 9) - # rdoc SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html") ADD_CUSTOM_COMMAND ( OUTPUT ${rdoc_dir} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..." COMMAND rm -rf ${rdoc_dir} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rdoc -o ${rdoc_dir} openwsman.i *.i ruby/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_SOURCE_DIR}/bindings + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/bindings/*.i DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/openwsman/*.rb ) + ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}") ADD_DEPENDENCIES(ruby_rdoc rbwsman) - ENDIF (${RUBY_VERSION_MINOR} LESS 9) -ENDIF(${RUBY_VERSION_MAJOR} EQUAL 1) IF( BUILD_RUBY_GEM ) @@ -127,6 +125,7 @@ COMMAND "mkdir" "-p" "lib/openwsman" COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/openwsman.rb" "lib" COMMAND "cp" "${CMAKE_CURRENT_SOURCE_DIR}/openwsman/*.rb" "lib/openwsman" + COMMAND "cp" "${CMAKE_CURRENT_BINARY_DIR}/openwsman/version.rb" "lib/openwsman" DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/extconf.rb DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/openwsman.rb diff -Nru openwsman-2.3.6/bindings/ruby/openwsman/openwsman.rb openwsman-2.4.3/bindings/ruby/openwsman/openwsman.rb --- openwsman-2.3.6/bindings/ruby/openwsman/openwsman.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/openwsman/openwsman.rb 2013-12-23 04:47:33.000000000 -0600 @@ -15,6 +15,28 @@ # this extends Openwsman::XmlDoc with method_missing require 'openwsman/xmldoc' +# = About openwsman +# Openwsman (http://www.openwsman.org) is a project intended to provide an open-source +# implementation of the Web Services Management specification +# (WS-Management) and to expose system management information on the +# Linux operating system using the WS-Management protocol. WS-Management +# is based on a suite of web services specifications and usage +# requirements that exposes a set of operations focused on and covers +# all system management aspects. +# +# = Using the bindings +# The bindings provide access to the client-side API of openwsman. +# You start by creating a Client instance and set up ClientOptions +# to control the communication. +# +# The Client instance now provides the WS-Management operations, like +# enumerate, get, invoke, etc. +# +# All client operations return a XmlDoc representing the SOAP response +# from the system. +# # You can then use XmlDoc methods to extract SOAP elements from the +# response and dig down through its XmlNode and XmlAttr objects. + module Openwsman class Transport # called when authentication credentials missing or wrong @@ -32,7 +54,9 @@ # # ==== Examples # prefix = Openwsman.epr_prefix_for "CIM_Managed_Element" + # => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2" # prefix = Openwsman.epr_prefix_for "Win32_Foo", "root/cimv2" + # => "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2" # def self.epr_prefix_for classname, namespace = nil prefix = Openwsman::uri_prefix classname @@ -41,6 +65,13 @@ end # create full endpoint reference URI for namespace and classname + # + # * +classname+ - classname (using the _ format) + # * +namespace+ - optional namespace, required for Windows WMI which embeds the namespace in the EPR + # + # ==== Examples + # Openwsman.epr_uri_for "root/cimv2", "Win32_Foo" + # => "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Foo" def self.epr_uri_for namespace, classname raise "Namespace must not be nil" unless namespace raise "Classname must not be nil" unless classname @@ -48,7 +79,7 @@ end class EndPointReference - def method_missing name, *args + def method_missing name, *args # :nodoc: selector(name) end end diff -Nru openwsman-2.3.6/bindings/ruby/openwsman/xmldoc.rb openwsman-2.4.3/bindings/ruby/openwsman/xmldoc.rb --- openwsman-2.3.6/bindings/ruby/openwsman/xmldoc.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/openwsman/xmldoc.rb 2013-12-23 04:47:33.000000000 -0600 @@ -1,10 +1,9 @@ -# -# Assume XmlDoc.foo means XmlDoc.body.foo -# - module Openwsman class XmlDoc - def method_missing method, *args + # + # Assume XmlDoc.foo means XmlDoc.body.foo + # + def method_missing method, *args # :nodoc: self.body.send method,*args end end diff -Nru openwsman-2.3.6/bindings/ruby/openwsman/xmlnode.rb openwsman-2.4.3/bindings/ruby/openwsman/xmlnode.rb --- openwsman-2.3.6/bindings/ruby/openwsman/xmlnode.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/openwsman/xmlnode.rb 2013-12-23 04:47:33.000000000 -0600 @@ -1,6 +1,6 @@ module Openwsman class XmlNode - def method_missing method, *args + def method_missing method, *args # :nodoc: find(nil, method.to_s) end end diff -Nru openwsman-2.3.6/bindings/ruby/rdoc openwsman-2.4.3/bindings/ruby/rdoc --- openwsman-2.3.6/bindings/ruby/rdoc 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/rdoc 1969-12-31 18:00:00.000000000 -0600 @@ -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 -Nru openwsman-2.3.6/bindings/ruby/rdoc1.8 openwsman-2.4.3/bindings/ruby/rdoc1.8 --- openwsman-2.3.6/bindings/ruby/rdoc1.8 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/rdoc1.8 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,19 @@ +#!/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 -Nru openwsman-2.3.6/bindings/ruby/rdoc1.9 openwsman-2.4.3/bindings/ruby/rdoc1.9 --- openwsman-2.3.6/bindings/ruby/rdoc1.9 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/rdoc1.9 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,10 @@ +#!/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 -Nru openwsman-2.3.6/bindings/ruby/rdoc2.0 openwsman-2.4.3/bindings/ruby/rdoc2.0 --- openwsman-2.3.6/bindings/ruby/rdoc2.0 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/rdoc2.0 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,10 @@ +#!/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 -Nru openwsman-2.3.6/bindings/ruby/rdoc_parser_swig.rb openwsman-2.4.3/bindings/ruby/rdoc_parser_swig.rb --- openwsman-2.3.6/bindings/ruby/rdoc_parser_swig.rb 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/rdoc_parser_swig.rb 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,918 @@ + +require 'rdoc/parser/ruby' +require 'rdoc/known_classes' + +## +# RDoc::Parser::SWIG attempts to parse SWIG extension files. It looks for +# the standard patterns that you find in extensions: %extend, %define, +# %rename, %alias and so on. It tries to find the corresponding +# C source for the methods and extract comments, but if we fail +# we don't worry too much. +# +# The comments associated with a Ruby method are extracted from the SWIG +# comment block associated with the routine that _implements_ that +# method +# +# The comment blocks may include special directives: +# +# [Document-class: +name+] +# Documentation for the named class. +# +# [Document-module: +name+] +# Documentation for the named module. +# +# [Document-const: +name+] +# Documentation for the named +rb_define_const+. +# +# [Document-global: +name+] +# Documentation for the named +rb_define_global_const+ +# +# [Document-variable: +name+] +# Documentation for the named +rb_define_variable+ +# +# [Document-method: +method_name+] +# Documentation for the named method. Use this when the method name is +# unambiguous. +# +# [Document-method: ClassName::method_name] +# Documentation for a singleton method in the given class. Use this when +# the method name alone is ambiguous. +# +# [Document-method: ClassName#method_name] +# Documentation for a instance method in the given class. Use this when the +# method name alone is ambiguous. +# +# [Document-attr: +name+] +# Documentation for the named attribute. +# +# [call-seq: text up to an empty line] +# Because C source doesn't give descriptive names to Ruby-level parameters, +# you need to document the calling sequence explicitly +# +# +# As an example, we might have an extension that defines multiple classes +# in its Init_xxx method. We could document them using +# +# /* +# * Document-class: MyClass +# * +# * Encapsulate the writing and reading of the configuration +# * file. ... +# */ +# +# /* +# * Document-method: read_value +# * +# * call-seq: +# * cfg.read_value(key) -> value +# * cfg.read_value(key} { |key| } -> value +# * +# * Return the value corresponding to +key+ from the configuration. +# * In the second form, if the key isn't found, invoke the +# * block and return its value. +# */ + +class RDoc::Parser::SWIG < RDoc::Parser + + parse_files_matching(/\.i\z/) + + include RDoc::Text + + ## + # SWIG file the parser is parsing + + attr_accessor :content + + + ## + # Maps C type names to names of ruby classes (andsingleton classes) + + attr_reader :known_classes + + ## + # Maps C type names to names of ruby singleton classes + + attr_reader :singleton_classes + + ## + # Resets cross-file state. Call when parsing different projects that need + # separate documentation. + + def self.reset + @@enclosure_classes = {} + @@known_bodies = {} + end + + reset + + ## + # Prepare to parse a SWIG file + + def initialize(top_level, file_name, content, options, stats) + super + + @known_classes = RDoc::KNOWN_CLASSES.dup + @content = handle_tab_width handle_ifdefs_in(@content) + @renames = {} # maps old_name => [ new_name, args ] + @aliases = {} # maps name => [ alias_name, args ] + @classes = {} + @singleton_classes = {} + @file_dir = File.dirname(@file_name) + end + + ## + # Scans #content for %alias + + def do_aliases + @content.scan(/%alias\s+(\w+)\s+"([^"]+)";/) do |old_name, new_name| # " +# class_name = @known_classes[var_name] +# +# unless class_name then +# warn "Enclosing class/module %p for alias %s %s not known" % [ +# var_name, new_name, old_name] +# next +# end +# +# class_obj = find_class var_name, class_name + + al = RDoc::Alias.new '', old_name, new_name, '' +# al.singleton = @singleton_classes.key? var_name + +# comment = find_alias_comment var_name, new_name, old_name +# comment = strip_stars comment +# al.comment = comment + + al.record_location @top_level + +# class_obj.add_alias al + @stats.add_alias al + end + end + + ## + # Scans #content for rb_attr and rb_define_attr + + def do_attrs + @content.scan(/rb_attr\s*\( + \s*(\w+), + \s*([\w"()]+), + \s*([01]), + \s*([01]), + \s*\w+\);/xm) do |var_name, attr_name, read, write| + handle_attr var_name, attr_name, read, write + end + + @content.scan(%r%rb_define_attr\( + \s*([\w\.]+), + \s*"([^"]+)", + \s*(\d+), + \s*(\d+)\s*\); + %xm) do |var_name, attr_name, read, write| + handle_attr var_name, attr_name, read, write + end + end + + ## + # Scans #content for %rename + + def do_renames + @content.scan(/\s*%rename\s*\(\s*"?([\w_=]+)"?\s*\)\s*([\w_]+)\s*\(?([\w_,\*\s]+)?\s*\)?;/) do + |new_name, old_name, args| + @renames[old_name] = [new_name, args] + end + end + + ## + # Scans #content for first(!) %module + + def do_modules + @content.scan(/%module\s+(\w+)/) do |match_data| + module_name = match_data[0] + @module = handle_class_module(nil, "module", module_name, @toplevel) + break # first %module only + end + @@module ||= @module + @module = @@module + end + + ## + # Scans #content for %extend + + def do_classes content + found = false +# puts "do_classes #{content.inspect}" + content.scan(/%extend\s+([\w_]+)(.*)/m) do |class_name, content| + real_name = @renames[class_name][0] rescue nil + klass = handle_class_module(class_name, "class", real_name, @module) + # now check if we have multiple %extend, the regexp above is greedy and will match all of them + while content =~ /%extend/ + do_classes $& + $' # ' add the %extend back in + content = $` # real content is everything before the embedded %extend + end +# puts "%extend #{class_name}: #{content.inspect}" + do_methods klass, class_name, content + found = true + end + found + end + + ## + # Scans #content for #define and %constant + + def do_constants + # %constant [*] = ; + + @content.scan(/(\/\*.*?\*\/)?\s*%constant\s+([\w_]+)([\s\*]+)([\w_]+)\s*=\s*([\w_]+);/) do |comment, type, pointer, const_name, definition| +# puts "\nConst #{const_name} : #{comment.inspect}" + handle_constants comment, const_name, definition + end + end + + ## + # Scans #content for %mixin + + def do_includes + @content.scan(/%mixin/) do |c,m| + if cls = @classes[c] + m = @known_classes[m] || m + incl = cls.add_include RDoc::Include.new(m, "") + incl.record_location @top_level + end + end + end + + ## + # Scans content for methods + # klass is a RDoc::NormalClass + # name is the 'C' (type) name + # content is what's enclosed in %extend { ... } + + def do_methods klass, name, content + # Find class constructor as 'new' + content.scan(/^\s+#{name}\s*\(([^\)]*)\)\s*\{/m) do |args| + handle_method("method", klass.name, "initialize", name, (args.to_s.split(",")||[]).size, content) + end + content.scan(%r{static\s+((const\s+)?\w+)([\s\*]+)(\w+)\s*\(([^\)]*)\)\s*;}) do + |const,type,pointer,meth_name,args| + handle_method("method", klass.name, meth_name, nil, (args.split(",")||[]).size, content) + end + content.scan(/((const\s+)?\w+) # ? + ([ \t\*]+) # ? + (\w+) # + \s*\(([^\)]*)\) # args + \s*\{/xm) do # function def start + |const,type,pointer,meth_name,args| +# puts "do_methods klass #{klass}, name #{name}: const #{const.inspect}, type #{type.inspect}, pointer #{pointer.inspect}, meth_name #{meth_name.inspect}" + next unless meth_name + next if meth_name =~ /~/ + type = "string" if type =~ /char/ && pointer =~ /\*/ + handle_method("method", klass.name, meth_name, nil, (args.split(",")||[]).size, content) + end + end + + ## + # Finds the comment for an alias on +class_name+ from +new_name+ to + # +old_name+ + + def find_alias_comment class_name, new_name, old_name + content =~ %r%((?>/\*.*?\*/\s+)) + rb_define_alias\(\s*#{Regexp.escape class_name}\s*, + \s*"#{Regexp.escape new_name}"\s*, + \s*"#{Regexp.escape old_name}"\s*\);%xm + + $1 || '' + end + + ## + # Finds a comment for rb_define_attr, rb_attr or Document-attr. + # + # +var_name+ is the C class variable the attribute is defined on. + # +attr_name+ is the attribute's name. + # + # +read+ and +write+ are the read/write flags ('1' or '0'). Either both or + # neither must be provided. + + def find_attr_comment var_name, attr_name, read = nil, write = nil + attr_name = Regexp.escape attr_name + + rw = if read and write then + /\s*#{read}\s*,\s*#{write}\s*/xm + else + /.*?/m + end + + if @content =~ %r%((?>/\*.*?\*/\s+)) + rb_define_attr\((?:\s*#{var_name},)?\s* + "#{attr_name}"\s*, + #{rw}\)\s*;%xm then + $1 + elsif @content =~ %r%((?>/\*.*?\*/\s+)) + rb_attr\(\s*#{var_name}\s*, + \s*#{attr_name}\s*, + #{rw},.*?\)\s*;%xm then + $1 + elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n + ((?>.*?\*/))%xm then + $1 + else + '' + end + end + + ## + # Find the C code corresponding to a Ruby method + + def find_body class_name, meth_name, meth_obj, file_content, quiet = false +# puts "\n\tfind_body #{meth_obj.c_function.inspect}[#{meth_name.inspect}]" if meth_obj.name == "new" +# puts "\n\tfind_body #{meth_name}[#{meth_obj.name}] ?" +# puts "\n\t#{file_content}" + case file_content +# when %r%(/\*.*\*/\s*#{meth_obj.c_function})%xm + when %r%((?>/\*.*?\*/\s+)?) + ((?:(?:static\s*)?(?:\s*const)?(?:\s*unsigned)?(?:\s*struct)?\s+)? + (VALUE|[\w_]+)(\s+\*|\*\s+|\s+)#{meth_name} + \s*(\([^)]*\))([^;]|$))%xm, + %r%(/\*.*?\*/\s+) + #{meth_name} + \s*(\([^)]*\))([^;]|$)%xm then +# puts "\n found! [1:#{$1.inspect},2:#{$2.inspect},3:#{$3.inspect},#{$4.inspect},#{$5.inspect},#{$6.inspect}]" if meth_obj.name == "detail" + + comment = $1 + body = $2 + # type = $3 + return false if $3 == "define" # filter out SWIG_Exception + return false if $3.nil? && meth_name != "initialize" # constructor has no type + # ptr = $4 + offset = $~.offset(2).first + + remove_private_comments comment if comment + + # try to find the whole body + body = $& if /#{Regexp.escape body}[^(]*?\{.*?^\}/m =~ file_content + +# puts "\n\tfind_body #{meth_name} -> #{body}" + # The comment block may have been overridden with a 'Document-method' + # block. This happens in the interpreter when multiple methods are + # vectored through to the same C method but those methods are logically + # distinct (for example Kernel.hash and Kernel.object_id share the same + # implementation + + override_comment = find_override_comment class_name, meth_obj + comment = override_comment if override_comment + + find_modifiers comment, meth_obj if comment + + #meth_obj.params = params + meth_obj.start_collecting_tokens + tk = RDoc::RubyToken::Token.new nil, 1, 1 + tk.set_text body + meth_obj.add_token tk + meth_obj.comment = strip_stars comment + meth_obj.offset = offset + meth_obj.line = file_content[0, offset].count("\n") + 1 + + body + when %r%((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+#{meth_name}\s+(\w+))%m then + comment = $1 + body = $2 + offset = $~.offset(2).first + + find_body class_name, $3, meth_obj, file_content, true + find_modifiers comment, meth_obj + + meth_obj.start_collecting_tokens + tk = RDoc::RubyToken::Token.new nil, 1, 1 + tk.set_text body + meth_obj.add_token tk + meth_obj.comment = strip_stars(comment) + meth_obj.comment.to_s + meth_obj.offset = offset + meth_obj.line = file_content[0, offset].count("\n") + 1 + + body + when %r%^\s*\#\s*define\s+#{meth_name}\s+(\w+)%m then + # with no comment we hope the aliased definition has it and use it's + # definition + + body = find_body(class_name, $1, meth_obj, file_content, true) + + return body if body + + warn "No definition for #{meth_name}" if @options.verbosity > 1 + false + else # No body, but might still have an override comment + comment = find_override_comment class_name, meth_obj + + if comment then + find_modifiers comment, meth_obj + meth_obj.comment = strip_stars comment + + '' + else + warn "No definition for #{meth_name}" if @options.verbosity > 1 + false + end + end + end + + ## + # Finds a RDoc::NormalClass or RDoc::NormalModule for +raw_name+ + + def find_class(raw_name, name) + unless @classes[raw_name] + if raw_name =~ /^rb_m/ + container = @top_level.add_module RDoc::NormalModule, name + else + container = @top_level.add_class RDoc::NormalClass, name + end + + container.record_location @top_level + @classes[raw_name] = container + end + @classes[raw_name] + end + + ## + # Look for class or module documentation above Init_+class_name+(void), + # in a Document-class +class_name+ (or module) comment or above an + # rb_define_class (or module). If a comment is supplied above a matching + # Init_ and a rb_define_class the Init_ comment is used. + # + # /* + # * This is a comment for Foo + # */ + # Init_Foo(void) { + # VALUE cFoo = rb_define_class("Foo", rb_cObject); + # } + # + # /* + # * Document-class: Foo + # * This is a comment for Foo + # */ + # Init_foo(void) { + # VALUE cFoo = rb_define_class("Foo", rb_cObject); + # } + # + # /* + # * This is a comment for Foo + # */ + # VALUE cFoo = rb_define_class("Foo", rb_cObject); + + def find_class_comment(class_name, class_mod) + comment = nil + + if @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*? + (?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then + comment = $1 + elsif @content =~ %r% + ((?>/\*.*?\*/\s+)) + (static\s+)? + void\s+ + Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xmi then + comment = $1.sub(%r%Document-(?:class|module):\s+#{class_name}%, '') + end + + return unless comment + + comment = strip_stars comment + + comment = look_for_directives_in class_mod, comment + + class_mod.add_comment comment, @top_level + end + + ## + # Handles modifiers in +comment+ and updates +meth_obj+ as appropriate. + # + # If :nodoc: is found, documentation on +meth_obj+ is suppressed. + # + # If :yields: is followed by an argument list it is used for the + # #block_params of +meth_obj+. + # + # If the comment block contains a call-seq: section like: + # + # call-seq: + # ARGF.readlines(sep=$/) -> array + # ARGF.readlines(limit) -> array + # ARGF.readlines(sep, limit) -> array + # + # ARGF.to_a(sep=$/) -> array + # ARGF.to_a(limit) -> array + # ARGF.to_a(sep, limit) -> array + # + # it is used for the parameters of +meth_obj+. + + def find_modifiers comment, meth_obj + # we must handle situations like the above followed by an unindented first + # comment. The difficulty is to make sure not to match lines starting + # with ARGF at the same indent, but that are after the first description + # paragraph. + + if comment =~ /call-seq:(.*?(?:\S|\*\/?).*?)^\s*(?:\*\/?)?\s*$/m then + all_start, all_stop = $~.offset(0) + seq_start, seq_stop = $~.offset(1) + + # we get the following lines that start with the leading word at the + # same indent, even if they have blank lines before + if $1 =~ /(^\s*\*?\s*\n)+^(\s*\*?\s*\w+)/m then + leading = $2 # ' * ARGF' in the example above + re = %r% + \A( + (^\s*\*?\s*\n)+ + (^#{Regexp.escape leading}.*?\n)+ + )+ + ^\s*\*?\s*$ + %xm + if comment[seq_stop..-1] =~ re then + all_stop = seq_stop + $~.offset(0).last + seq_stop = seq_stop + $~.offset(1).last + end + end + + seq = comment[seq_start..seq_stop] + seq.gsub!(/^(\s*\*?\s*?)(\S|\n)/m, '\2') + comment.slice! all_start...all_stop + meth_obj.call_seq = seq + elsif comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '') then + meth_obj.call_seq = $1.strip + end + + look_for_directives_in meth_obj, comment + end + + ## + # Finds a Document-method override for +meth_obj+ on +class_name+ + + def find_override_comment class_name, meth_obj + name = Regexp.escape meth_obj.name + prefix = Regexp.escape meth_obj.name_prefix + + if @content =~ %r%Document-method:\s+#{class_name}#{prefix}#{name}\s*?\n((?>.*?\*/))%m then + $1 + elsif @content =~ %r%Document-method:\s#{name}\s*?\n((?>.*?\*/))%m then + $1 + end + end + + ## + # Creates a new RDoc::Attr +attr_name+ on class +var_name+ that is either + # +read+, +write+ or both + + def handle_attr(var_name, attr_name, read, write) + rw = '' + rw << 'R' if '1' == read + rw << 'W' if '1' == write + + class_name = @known_classes[var_name] + + return unless class_name + + class_obj = find_class var_name, class_name + + return unless class_obj + + comment = find_attr_comment var_name, attr_name + comment = strip_stars comment + + name = attr_name.gsub(/rb_intern\("([^"]+)"\)/, '\1') # " + + attr = RDoc::Attr.new '', name, rw, comment + + attr.record_location @top_level + class_obj.add_attribute attr + @stats.add_attribute attr + end + + ## + # Creates a new RDoc::NormalClass or RDoc::NormalModule based on +type+ + # named +class_name+ in +parent+ which was assigned to the C +var_name+. + + def handle_class_module(type_name, type, class_name, enclosure) + enclosure ||= @top_level + + if type == "class" then + full_name = if RDoc::ClassModule === enclosure then + enclosure.full_name + "::#{class_name}" + else + class_name + end + + if @content =~ %r%Document-class:\s+#{full_name}\s*<\s+([:,\w]+)% then + parent_name = $1 + end + + cm = enclosure.add_class RDoc::NormalClass, class_name, parent_name + else + cm = enclosure.add_module RDoc::NormalModule, class_name + end + + cm.record_location enclosure.top_level + + find_class_comment class_name, cm + + case cm + when RDoc::NormalClass + @stats.add_class cm + when RDoc::NormalModule + @stats.add_module cm + end + + @classes[type_name] = cm + @@enclosure_classes[class_name] = cm + @known_classes[class_name] = cm.full_name + cm + end + + ## + # Adds constants. + # + + def handle_constants(comment, const_name, definition) + class_obj = @module + + unless class_obj then + warn "Enclosing class/module #{const_name.inspect} not known" + return + end + + class_name = class_obj.name + + if comment + comment = strip_stars comment + comment = normalize_comment comment + else + comment = "" + end + + con = RDoc::Constant.new const_name, definition, comment + con.record_location @top_level + @stats.add_constant con + class_obj.add_constant con + end + + ## + # Removes #ifdefs that would otherwise confuse us + + def handle_ifdefs_in(body) + result = "" + loop do + body.match(/^#if ((\s*\|\|\s*)?defined\(SWIG([\w]+)\))+/) do + result << $` # copy everything before #if + after = $' #' + if $1 =~ /RUBY/ # if defined(SWIGRUBY) + raise "Unmatched #if SWIGRUBY\n#{after}" unless after.match /^#(if|else|endif)/ + result << $` # copy everything between SWIGRUBY and #if/else/endif + case $1 + when "if" + result << handle_ifdefs_in($& + $') #' + when "else" + after = $' #' + raise "Unclosed #else" unless after.match /^#endif/ + result << handle_ifdefs_in($') #' + when "endif" + result << handle_ifdefs_in($') #' + end + else # if defined(SWIG...) + # throw away everything between SIWG... and #if/else/endif + raise "Unmatched #if" unless after.match /^#(if|else|endif)/ + case $1 + when "if" + result << handle_ifdefs_in($& + $') #' + when "else" + after = $' #' + raise "Unclosed #else" unless after.match /^#endif/ + result << $` # copy everything between #else and #endif + result << handle_ifdefs_in($') #' + when "endif" + result << handle_ifdefs_in($') #' + end + end + end + break + end + result.empty? ? body : result + end + + ## + # Adds an RDoc::AnyMethod +meth_name+ defined on a class or module assigned + # to +var_name+. +type+ is the type of method definition function used. + # +singleton_method+ and +module_function+ create a singleton method. + + def handle_method(type, klass_name, meth_name, function, param_count, content = nil, + source_file = nil) + ruby_name = (@renames[meth_name][0] rescue nil) || meth_name +# puts "\n\thandle_method #{type},#{klass_name},#{meth_name}[#{ruby_name}],#{function},#{param_count} args" # if meth_name == "initialize" + class_name = @known_classes[klass_name] + singleton = @singleton_classes.key? klass_name + + return unless class_name + + class_obj = find_class klass_name, class_name +# puts "\n\tclass_obj #{class_obj.inspect}" #if meth_name == "initialize" + + if class_obj then + if meth_name == "initialize" then + ruby_name = 'new' + singleton = true + type = 'method' # force public + end + + function ||= meth_name + meth_obj = RDoc::AnyMethod.new '', ruby_name + meth_obj.c_function = function + meth_obj.singleton = singleton + + p_count = Integer(param_count) rescue -1 + + if source_file then + file_name = File.join @file_dir, source_file + + if File.exist? file_name then + file_content = (@@known_bodies[file_name] ||= File.read(file_name)) + else + warn "unknown source #{source_file} for #{meth_name} in #{@file_name}" + end + else + file_content = content || @content + end + + body = find_body class_name, function, meth_obj, file_content +# puts "find_body #{class_name}##{function} -> #{body}" + if body and meth_obj.document_self then + meth_obj.params = if p_count < -1 then # -2 is Array + '(*args)' + elsif p_count == -1 then # argc, argv + rb_scan_args body + else + "(#{(1..p_count).map { |i| "p#{i}" }.join ', '})" + end + + + meth_obj.record_location @top_level + class_obj.add_method meth_obj + @stats.add_method meth_obj + meth_obj.visibility = :private if 'private_method' == type + end + end + end + + ## + # Registers a singleton class +sclass_var+ as a singleton of +class_var+ + + def handle_singleton sclass_var, class_var + class_name = @known_classes[class_var] + + @known_classes[sclass_var] = class_name + @singleton_classes[sclass_var] = class_name + end + + ## + # Normalizes tabs in +body+ + + def handle_tab_width(body) + if /\t/ =~ body + tab_width = @options.tab_width + body.split(/\n/).map do |line| + 1 while line.gsub!(/\t+/) do + ' ' * (tab_width * $&.length - $`.length % tab_width) + end && $~ + line + end.join "\n" + else + body + end + end + + ## + # Look for directives in a normal comment block: + # + # /* + # * :title: My Awesome Project + # */ + # + # This method modifies the +comment+ + + def look_for_directives_in context, comment + @preprocess.handle comment, context do |directive, param| + case directive + when 'main' then + @options.main_page = param + '' + when 'title' then + @options.default_title = param if @options.respond_to? :default_title= + '' + end + end + + comment + end + + ## + # Extracts parameters from the +method_body+ and returns a method + # parameter string. Follows 1.9.3dev's scan-arg-spec, see README.EXT + + def rb_scan_args method_body + method_body =~ /rb_scan_args\((.*?)\)/m + return '(*args)' unless $1 + + $1.split(/,/)[2] =~ /"(.*?)"/ # format argument + format = $1.split(//) + + lead = opt = trail = 0 + + if format.first =~ /\d/ then + lead = $&.to_i + format.shift + if format.first =~ /\d/ then + opt = $&.to_i + format.shift + if format.first =~ /\d/ then + trail = $&.to_i + format.shift + block_arg = true + end + end + end + + if format.first == '*' and not block_arg then + var = true + format.shift + if format.first =~ /\d/ then + trail = $&.to_i + format.shift + end + end + + if format.first == ':' then + hash = true + format.shift + end + + if format.first == '&' then + block = true + format.shift + end + + # if the format string is not empty there's a bug in the C code, ignore it + + args = [] + position = 1 + + (1...(position + lead)).each do |index| + args << "p#{index}" + end + + position += lead + + (position...(position + opt)).each do |index| + args << "p#{index} = v#{index}" + end + + position += opt + + if var then + args << '*args' + position += 1 + end + + (position...(position + trail)).each do |index| + args << "p#{index}" + end + + position += trail + + if hash then + args << "p#{position} = {}" + position += 1 + end + + args << '&block' if block + + "(#{args.join ', '})" + end + + ## + # Removes private comments from +comment+ + + def remove_private_comments(comment) + comment.gsub!(/\/?\*--\n(.*?)\/?\*\+\+/m, '') + comment.sub!(/\/?\*--\n.*/m, '') + end + + ## + # Extracts the classes, modules, methods, attributes, constants and aliases + # from a SWIG file and returns an RDoc::TopLevel for this file + + def scan + do_modules + do_renames + do_aliases + do_constants + have_classes = do_classes @content # -> do_methods + do_methods @module, @module.name, @content unless have_classes # file without %extend +# do_includes +# do_attrs + @top_level + end + +end + diff -Nru openwsman-2.3.6/bindings/ruby/README.rdoc openwsman-2.4.3/bindings/ruby/README.rdoc --- openwsman-2.3.6/bindings/ruby/README.rdoc 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/README.rdoc 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,60 @@ += \Openwsman - WS-Management for all + +home :: http://openwsman.github.io +wiki :: https://github.com/Openwsman/openwsman/wiki +mailing list :: openwsman-devel@lists.sourceforge.net +source :: https://github.com/Openwsman/openwsman +rdoc :: http://www.suse.de/~kkaempf/openwsman +bugs :: https://github.com/Openwsman/openwsman/issues +code climate :: {}[https://codeclimate.com/github/Openwsman/openwsman] + +== Description + +Openwsman is an open source implementation of WS-Management; enabling +the in-band management of Linux/uni*/Windows platforms. +Openwsman supports the generic WS-Management protocol as well as +specific protocol extensions for the +{Common Information Model}[http://www.dmtf.org/standards/cim] (CIM) + +Openwsman provides 'C' language API by default and a 'C++' API in an +'alpha' state. For other languages, see the bindings. + +== About the bindings + +The bindings provide the simplest way to perform WS-Management +operations with Openwsman. + +Bindings exist for +{Ruby}[https://github.com/Openwsman/openwsman/tree/master/bindings/ruby], +{Python}[https://github.com/Openwsman/openwsman/tree/master/bindings/python], +{Perl}[https://github.com/Openwsman/openwsman/tree/master/bindings/perl], and +{Java}[https://github.com/Openwsman/openwsman/tree/master/bindings/java]. +with plenty of examples in the respective 'tests' directories. + +The Ruby bindings are fully maintained an considered 'production' +quality. + +== Bugs + +If you have problems using Openwsman, report to the +{mailing list}[mailto:openwsman-devel@lists.sourceforge.net] +first. + +If you are sure to have found a bug, please report it via the +{Github issue tracker}[https://github.com/Openwsman/openwsman/issues] + +== License + +Openwsman is copyright (C) 2004-2006 by Intel Corp, 2006-2013 by SUSE +Linux Products GmbH. + +Openwsman is free software, and may be redistributed under the terms +of the +{BSD-3-Clause}[https://github.com/Openwsman/openwsman/blob/master/COPYING] +license. + +== Warranty + +This software is provided "as is" and without any express or implied +warranties, including, without limitation, the implied warranties of +merchantability and fitness for a particular purpose. diff -Nru openwsman-2.3.6/bindings/ruby/tests/_client.rb openwsman-2.4.3/bindings/ruby/tests/_client.rb --- openwsman-2.3.6/bindings/ruby/tests/_client.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/_client.rb 2013-12-23 04:47:33.000000000 -0600 @@ -41,7 +41,7 @@ raise "Check WSMANCLIENT environment variable against clients.yml" end wsmc = Openwsman::Client.new( client["host"], client["port"], client["path"], client["scheme"], client["username"], client["password"] ) - wsmc.transport.timeout = 5 + wsmc.transport.timeout = 120 # # Allow to enforce auth scheme # e.g. required for Windows which offers BASIC|GSS and Openwsman chooses the strongest (GSS) but non-working diff -Nru openwsman-2.3.6/bindings/ruby/tests/enumerate_class_names.rb openwsman-2.4.3/bindings/ruby/tests/enumerate_class_names.rb --- openwsman-2.3.6/bindings/ruby/tests/enumerate_class_names.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/enumerate_class_names.rb 2013-12-23 04:47:33.000000000 -0600 @@ -17,6 +17,8 @@ options.set_dump_request # options.selectors = { Openwsman::CIM_NAMESPACE_SELECTOR => "cimv2/interop" } + # enable this line to get *all* (child) classes +# options.add_selector "DeepInheritance", 1 method = Openwsman::CIM_ACTION_ENUMERATE_CLASS_NAMES uri = Openwsman::XML_NS_CIM_INTRINSIC diff -Nru openwsman-2.3.6/bindings/ruby/tests/ruby19_threaded_enumerate.rb openwsman-2.4.3/bindings/ruby/tests/ruby19_threaded_enumerate.rb --- openwsman-2.3.6/bindings/ruby/tests/ruby19_threaded_enumerate.rb 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/ruby19_threaded_enumerate.rb 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,86 @@ +# +# Do parallel enumerate request via celluloid gem +# +# Tests Ruby 1.9 threading model and proper use of rb_thread_blocking_region by the bindings +# +# Written by https://github.com/thehappycoder +# +require 'openwsman' +require 'celluloid' +require 'open-uri' + +connection_credentials = [ + { + :host => '10.120.67.93', + :port => 5985, + :username => 'wsman', + :password => 'secret' + }, + + { + :host => '10.120.4.11', + :port => 5985, + :username => 'wsman', + :password => 'secret' + } +] + +uris = [ +# 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_NICView' + 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem' + #'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_SoftwareIdentity' +] + +class Downloader + include Celluloid + + def download(host, port, username, password, uri) + puts "Requesting #{host}/#{File.basename(uri)}" + @wsman = Openwsman::Client.new(host, port, "/wsman", "http", username, password) + #Openwsman::debug = 9 + @wsman.transport.verify_peer=0 + @options = Openwsman::ClientOptions.new + @options.flags = Openwsman::FLAG_ENUMERATION_OPTIMIZATION + @options.max_elements = 100 + + puts "Client #{host} prepared" + request(uri) do |response| + puts "#{host} responded" + end + end + + def download_http(*params) + host = 'http://google.com' + puts "Requesting #{host}" + open(host).read + puts "#{host} responded" + end + + private + def request(uri, &response_handler_block) + puts "Enumerate..." + response = @wsman.enumerate(@options, nil, uri) + puts "...done" + response_handler_block.call(response) + + context = response.context + puts "Context #{context}" + + while (context) + response = @wsman.pull( @options, nil, uri, context ) + response_handler_block.call(response) + context = response.context + end + end +end + +downloaders = Downloader.pool(size: connection_credentials.size * uris.size) + +connection_credentials.each do |credential| + uris.each do |uri| + puts "Starting async" + downloaders.async.download(credential[:host], credential[:port], credential[:username], credential[:password], uri) + end +end + +sleep diff -Nru openwsman-2.3.6/bindings/ruby/tests/transport.rb openwsman-2.4.3/bindings/ruby/tests/transport.rb --- openwsman-2.3.6/bindings/ruby/tests/transport.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/transport.rb 2013-12-23 04:47:33.000000000 -0600 @@ -20,43 +20,54 @@ assert Openwsman::Transport.auth_name( Openwsman::NTLM_AUTH ) == Openwsman::NTLM_AUTH_STR assert Openwsman::Transport.auth_name( Openwsman::GSSNEGOTIATE_AUTH ) == Openwsman::GSSNEGOTIATE_AUTH_STR - assert transport.agent = "agent" + transport.agent = "agent" assert transport.agent == "agent" - assert transport.auth_method = Openwsman::DIGEST_AUTH_STR + transport.auth_method = Openwsman::DIGEST_AUTH_STR assert transport.auth_method == Openwsman::Transport.auth_name( Openwsman::DIGEST_AUTH ) assert transport.auth_value == Openwsman::DIGEST_AUTH assert Openwsman::Transport.error_string(0) - assert transport.timeout = 42 + transport.timeout = 42 assert transport.timeout == 42 - assert transport.verify_peer = 42 - assert transport.verify_peer == 42 + transport.verify_peer = false + assert !transport.verify_peer? + + transport.verify_peer = nil + assert !transport.verify_peer? + + transport.verify_peer = 0 + assert !transport.verify_peer? + + transport.verify_peer = true + assert transport.verify_peer? + transport.verify_peer = "foo" + assert transport.verify_peer? - assert transport.verify_host = 42 - assert transport.verify_host == 42 + transport.verify_host = true + assert transport.verify_host? - assert transport.proxy = "proxy" + transport.proxy = "proxy" assert transport.proxy == "proxy" - assert transport.proxyauth = "proxy_auth" + transport.proxyauth = "proxy_auth" assert transport.proxyauth == "proxy_auth" - assert transport.cainfo = "cainfo" + transport.cainfo = "cainfo" assert transport.cainfo == "cainfo" - assert transport.capath = "capath" + transport.capath = "capath" assert transport.capath == "capath" - assert transport.caoid = "caoid" + transport.caoid = "caoid" assert transport.caoid == "caoid" - assert transport.cert = "cert" + transport.cert = "cert" assert transport.cert == "cert" - assert transport.key = "key" + transport.key = "key" assert transport.key == "key" end diff -Nru openwsman-2.3.6/bindings/ruby/tests/win32_services.rb openwsman-2.4.3/bindings/ruby/tests/win32_services.rb --- openwsman-2.3.6/bindings/ruby/tests/win32_services.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/win32_services.rb 2013-12-23 04:47:33.000000000 -0600 @@ -18,6 +18,7 @@ assert client options = Openwsman::ClientOptions.new assert options + options.timeout = 30 # options.set_dump_request # @@ -59,10 +60,12 @@ # state = node.child( 0, uri, "State" ).text; node = result.body.find( "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Service", "Win32_Service" ) +# puts node.to_xml name = node.find( "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Service", "Name" ) + caption = node.find( "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Service", "Caption" ) state = node.find( "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Service", "State" ) - puts "#{name} is #{state}" + puts "#{name} (#{caption}) is #{state}" end client.release( options, uri, context ) if context diff -Nru openwsman-2.3.6/bindings/ruby/tests/winenum.rb openwsman-2.4.3/bindings/ruby/tests/winenum.rb --- openwsman-2.3.6/bindings/ruby/tests/winenum.rb 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/winenum.rb 2013-12-23 04:47:33.000000000 -0600 @@ -138,7 +138,8 @@ if c.size == 0 attrs = "" c.each_attr { |a| attrs << " #{a.name}=#{a.value}" } - puts "#{indentation}#{c.name}(#{attrs}): #{c.text}" + attrs = "<"+attrs+">" unless attrs.empty? + puts "#{indentation}#{c.name}#{attrs}: #{c.text}" else print_item indent+1, c end diff -Nru openwsman-2.3.6/bindings/ruby/tests/winrs.rb openwsman-2.4.3/bindings/ruby/tests/winrs.rb --- openwsman-2.3.6/bindings/ruby/tests/winrs.rb 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/bindings/ruby/tests/winrs.rb 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,292 @@ +# winrs.rb +# +# Windows Remote Shell +# +# See http://msdn.microsoft.com/en-us/library/cc251731.aspx (Remote Shell Examples) +# for details on the SOAP protocol +# + +require 'rexml/document' +require 'openwsman' +require 'getoptlong' + +def usage msg=nil + if msg + STDERR.puts "Error: #{msg}" + STDERR.puts + end + STDERR.puts "Usage:" + STDERR.puts + STDERR.puts "winrs [-U|--url ] []" + STDERR.puts "winrs [-s|--scheme http|https] [-h|--host ] [-u|--user ] [-p|--password ] [-P|--port port] []" + STDERR.puts + STDERR.puts "If is given as a command line argument, winrs exists after executing ." + STDERR.puts "Else winrs runs interactively, accepting and executing command until Ctrl-D is pressed." + exit 1 +end + +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 + + # + # Argument parsing + # + + opts = GetoptLong.new( + [ "-U", "--url", GetoptLong::REQUIRED_ARGUMENT ], + [ "-h", "--host", GetoptLong::REQUIRED_ARGUMENT ], + [ "-u", "--user", GetoptLong::REQUIRED_ARGUMENT ], + [ "-p", "--password", GetoptLong::REQUIRED_ARGUMENT ], + [ "-P", "--port", GetoptLong::REQUIRED_ARGUMENT ], + [ "-s", "--scheme", GetoptLong::REQUIRED_ARGUMENT ] + ) + + options = { :port => 5985, :scheme => "http" } + url = nil + opts.each do |opt,arg| + case opt + when "-U" + usage "-U|--url invalid, --host|--user|--password|--port already given" unless options.empty? + url = arg + when "-h" + usage "-h|--host invalid, --url already given" unless url.nil? + options[:host] = arg + when "-u" + usage "-u|--user invalid, --url already given" unless url.nil? + options[:user] = arg + when "-p" + usage "-p|--password invalid, --url already given" unless url.nil? + options[:password] = arg + when "-P" + usage "-P|--port invalid, --url already given" unless url.nil? + options[:port] = arg.to_i + when "-s" + usage "-s|--scheme invalid, --url already given" unless url.nil? + options[:scheme] = arg + end + end + + commands = ARGV.empty? ? nil : ARGV + + + client = if url + Openwsman::Client.new url + elsif options.empty? + usage + else + Openwsman::Client.new(options[:host], options[:port], "wsman", options[:scheme], options[:user], options[:password]) + end + + # + # Client connection + # + + client.transport.timeout = 120 + client.transport.auth_method = Openwsman::BASIC_AUTH_STR + # https + # client.transport.verify_peer = 0 + # client.transport.verify_host = 0 + + options = Openwsman::ClientOptions.new +# options.set_dump_request +# Openwsman::debug = -1 + options.timeout = 60 * 1000 # 60 seconds + uri = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd" + + # + # Start shell + # + + service = "Themes" + options.add_selector( "Name", service ) + + options.add_option "WINRS_NOPROFILE","FALSE" + options.add_option "WINRS_CODEPAGE", 437 + + # instance values + instance = { "InputStreams" => "stdin", "OutputStreams" => "stdout stderr" } + + namespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell" + data = Openwsman::XmlDoc.new("Shell", namespace) + root = data.root + instance.each do |key,value| + root.add namespace, key, value + end + + s = data.to_xml + result = client.create( options, uri, s, s.size, "utf-8" ) + # returns something like + # + # + # http://10.120.5.37:5985/wsman + # + # http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd + # + # 3D5D8879-98EA-49B7-9A33-6842EC0D35D0 + # + # + # + # + handle_fault client, result + + shell_id = result.find(nil, "Selector") + raise "No shell id returned" unless shell_id +# puts "Shell ID: #{shell_id}" + command_id = nil + + # + # Run command(s) + # + + loop do + if commands + break if commands.empty? + cmd = commands.shift + else + print "WinRS> " + STDOUT.flush + cmd = gets + break if cmd.nil? + cmd.chomp! + next if cmd.empty? + end + + # issue command + options.options = { "WINRS_CONSOLEMODE_STDIN" => "TRUE", "WINRS_SKIP_CMD_SHELL" => "FALSE" } + options.selectors = { "ShellId" => shell_id } + data = Openwsman::XmlDoc.new("CommandLine", namespace) + root = data.root + root.add namespace, "Command", cmd + result = client.invoke( options, uri, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command", data) + handle_fault client, result + + command_id = result.find(namespace, "CommandId") + raise "No command id returned" unless command_id + command_id = command_id.text +# puts "Command ID: #{command_id}" + + # + # Request stdout/stderr + # + + options.options = { } + # keep ShellId selector + data = Openwsman::XmlDoc.new("Receive", namespace) + root = data.root + node = root.add namespace, "DesiredStream", "stdout stderr" + node.attr_add nil, "CommandId", command_id + result = client.invoke( options, uri, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive", data) + handle_fault client, result + + # + # Receive response + # + + response = result.find(namespace, "ReceiveResponse") + unless response + STDERR.puts "***Err: No ReceiveResponse in: #{result.to_xml}" + next + end + response.each do |node| + cmd_id = node.attr "CommandId" + if cmd_id.nil? + STDERR.puts "***Err: No CommandId in ReceiveResponse node: #{node.to_xml}" + next + end + if cmd_id.value != command_id + STDERR.puts "***Err: Wrong CommandId in ReceiveResponse node. Expected #{command_id}, found #{cmd_id.value}" + next + end +# puts "Node: #{node.to_xml}" + case node.name + when "Stream" + stream_name = node.attr "Name" + unless stream_name + STDERR.puts "***Err: Stream node has no Name attribute: #{node.to_xml}" + next + end + stream_name = stream_name.value + str = node.text.unpack('m')[0] + case stream_name + when "stdout" + puts str + when "stderr" + STDERR.puts str + else + STDERR.puts "***Err: Unknown stream name: #{stream_name}" + end + when "CommandState" + state = node.attr "State" + unless state + STDERR.puts "***Err: CommandState node has no State attribute: #{node.to_xml}" + next + end + case state.value + when "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done" + exit_code = node.get "ExitCode" + if exit_code + puts "Exit code: #{exit_code.text}" + else + STDERR.puts "***Err: No exit code for 'done' command: #{node.to_xml}" + end + when "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Running" + # unclear how to handle this + when "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Pending" + # no-op + # WinRM 1.1 sends this with ExitCode:0 + else + STDERR.puts "***Err: Unknown command state: #{state.value}" + end + else + STDERR.puts "***Err: Unknown receive response: #{node.to_xml}" + end + end # response.each + + # + # terminate shell command + # + # not strictly needed for WinRM 2.0, but WinRM 1.1 requires this + # + data = Openwsman::XmlDoc.new("Signal", namespace) + root = data.root + root.attr_add nil, "CommandId", command_id + root.add namespace, "Code", "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate" + result = client.invoke( options, uri, "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Signal", data) + handle_fault client, result + + response = result.find(namespace, "SignalResponse") + unless response + STDERR.puts "***Err: No SignalResponse in: #{result.to_xml}" + end + end + + # + # delete shell resource + # + + if shell_id + options.options = { } + options.selectors = { "ShellId" => shell_id } + + result = client.invoke( options, uri, "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete", nil) + handle_fault client, result + end diff -Nru openwsman-2.3.6/bindings/wsman-client.i openwsman-2.4.3/bindings/wsman-client.i --- openwsman-2.3.6/bindings/wsman-client.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-client.i 2013-12-23 04:47:33.000000000 -0600 @@ -11,6 +11,8 @@ } WsManClient; /* + * Document-class: Client + * * Instances of Client represent a connection to a client used for * sending WS-Management operation requests. * @@ -32,7 +34,13 @@ * */ _WsManClient( const char *uri ) { - return wsmc_create_from_uri( uri ); + struct _WsManClient *client = wsmc_create_from_uri( uri ); + if (client == NULL) + SWIG_exception( SWIG_ValueError, "Can't create Openwsman::Client from given URI" ); +#if defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGJAVA) + fail: +#endif + return client; } /* @@ -43,7 +51,13 @@ const char *scheme, const char *username, const char *password) { - return wsmc_create( hostname, port, path, scheme, username, password ); + struct _WsManClient *client = wsmc_create( hostname, port, path, scheme, username, password ); + if (client == NULL) + SWIG_exception( SWIG_ValueError, "Can't create Openwsman::Client from given values" ); +#if defined(SWIGPYTHON) || defined(SWIGPERL) || defined(SWIGJAVA) + fail: +#endif + return client; } /* destructor */ @@ -79,7 +93,10 @@ } /* - * String representation of the transport scheme ('http', 'https') + * String representation of the transport scheme + * + * call-seq: + * client.scheme -> String */ char *scheme() { return wsmc_get_scheme( $self ); @@ -134,7 +151,7 @@ * Send a (raw) SOAP request to the client * * call-seq: - * result = client.send_request(XmlDoc.new("...")) + * client.send_request(XmlDoc.new("...")) -> Integer * */ int send_request(WsXmlDocH request) { @@ -142,6 +159,17 @@ } /* + * Build envelope from response + * + * call-seq: + * client.build_envelope_from_response() -> XmlDoc + * + */ + WsXmlDocH build_envelope_from_response() { + return wsmc_build_envelope_from_response($self); + } + + /* * Get client encoding * * call-seq: @@ -175,11 +203,18 @@ * identify: Sends an identify request * * call-seq: - * result = client.identify(options) + * client.identify(options) -> XmlDoc * */ WsXmlDocH identify( client_opt_t *options ) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_identify_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_identify( $self, options ); +#endif } /* @@ -187,9 +222,20 @@ * * get_from_epr: Get a resource via an endpoint reference * + * call-seq: + * client.get_from_epr(options, end_point_reference) -> XmlDoc + * */ WsXmlDocH get_from_epr( client_opt_t *options , epr_t *epr) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.epr = epr; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_get_from_epr_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_get_from_epr( $self, epr, options); +#endif } /* @@ -197,9 +243,20 @@ * * delete_from_epr: Remove a resource via an endpoint reference * + * call-seq: + * client.delete_from_epr(options, end_point_reference) -> XmlDoc + * */ WsXmlDocH delete_from_epr( client_opt_t *options , epr_t *epr) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.epr = epr; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_delete_from_epr_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_delete_from_epr( $self, epr, options); +#endif } /* @@ -218,11 +275,20 @@ * affecting performance. * * call-seq: - * result = client.enumerate(options, filter, uri) + * client.enumerate(options, filter, uri) -> XmlDoc * */ WsXmlDocH enumerate( client_opt_t *options , filter_t *filter, char *resource_uri) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.filter = filter; + args.resource_uri = resource_uri; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_enumerate_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_enumerate( $self, resource_uri, options, filter); +#endif } /* @@ -231,11 +297,21 @@ * pull: Get resources from enumeration context * * call-seq: - * result = client.pull(options, filter, uri, context) + * client.pull(options, filter, uri, context) -> XmlDoc * */ - WsXmlDocH pull( client_opt_t *options , filter_t *filter, char *resource_uri, char *enum_ctx) { - return wsmc_action_pull( $self, resource_uri, options, filter, enum_ctx); + WsXmlDocH pull( client_opt_t *options , filter_t *filter, const char *resource_uri, const char *context) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.filter = filter; + args.resource_uri = resource_uri; + args.context = context; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_pull_thread, &args, RUBY_UBF_IO, 0); +#else + return wsmc_action_pull( $self, resource_uri, options, filter, context); +#endif } /* @@ -244,11 +320,22 @@ * create: Create a resource * * call-seq: - * result = client.get(options, uri, xml, xml.size, "utf-8") + * client.create(options, uri, xml, xml.size, "utf-8") -> XmlDoc * */ - WsXmlDocH create( client_opt_t *options, char *resource_uri, char *data, size_t size, char *encoding = "utf-8") { + WsXmlDocH create( client_opt_t *options, const char *resource_uri, const char *data, size_t size, const char *encoding = "utf-8") { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + args.data = data; + args.size = size; + args.encoding = encoding; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_create_fromtext_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_create_fromtext( $self, resource_uri, options, data, size, encoding); +#endif } /* @@ -257,11 +344,22 @@ * put: Change a resource * * call-seq: - * result = client.get(options, uri, xml, xml.size, "utf-8") + * client.put(options, uri, xml, xml.size, "utf-8") -> XmlDoc * */ - WsXmlDocH put( client_opt_t *options , char *resource_uri, char *data, size_t size, char *encoding = "utf-8") { + WsXmlDocH put( client_opt_t *options, const char *resource_uri, const char *data, size_t size, const char *encoding = "utf-8") { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + args.data = data; + args.size = size; + args.encoding = encoding; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_put_fromtext_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_put_fromtext( $self, resource_uri, options, data, size, encoding); +#endif } /* @@ -270,11 +368,20 @@ * release: Release enumeration context * * call-seq: - * result = client.release(options, uri, context) + * client.release(options, uri, context) -> XmlDoc * */ - WsXmlDocH release( client_opt_t *options , char *resource_uri, char *enum_ctx) { - return wsmc_action_release( $self, resource_uri, options, enum_ctx); + WsXmlDocH release( client_opt_t *options, const char *resource_uri, const char *context) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + args.context = context; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_release_thread, &args, RUBY_UBF_IO, 0); +#else + return wsmc_action_release( $self, resource_uri, options, context); +#endif } /* @@ -283,11 +390,19 @@ * get: Get a resource * * call-seq: - * result = client.get(options, uri) + * client.get(options, uri) -> XmlDoc * */ - WsXmlDocH get( client_opt_t *options , char *resource_uri) { + WsXmlDocH get( client_opt_t *options, const char *resource_uri) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_get_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_get( $self, resource_uri, options); +#endif } /* @@ -296,11 +411,19 @@ * delete: Delete a resource * * call-seq: - * result = client.delete(options, uri) + * client.delete(options, uri) -> XmlDoc * */ - WsXmlDocH delete( client_opt_t *options , char *resource_uri) { + WsXmlDocH delete( client_opt_t *options, const char *resource_uri) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_delete_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_delete( $self, resource_uri, options); +#endif } /* @@ -309,12 +432,22 @@ * invoke: Invoke a resource function * * call-seq: - * result = client.invoke(options, uri, "method-name") - * result = client.invoke(options, uri, "method-name", xml_doc) + * client.invoke(options, uri, "method-name") -> XmlDoc + * client.invoke(options, uri, "method-name", xml_doc) -> XmlDoc * */ - WsXmlDocH invoke( client_opt_t *options , char *resource_uri, char *method, WsXmlDocH data = NULL) { + WsXmlDocH invoke( client_opt_t *options, const char *resource_uri, const char *method, WsXmlDocH data = NULL) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + args.method = method; + args.method_args = data; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_invoke_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_invoke( $self, resource_uri, options, method, data); +#endif } /* @@ -323,11 +456,20 @@ * subscribe: Subscribe a listener to events * * call-seq: - * result = client.subscribe(options, filter, uri) + * client.subscribe(options, filter, uri) -> XmlDoc * */ - WsXmlDocH subscribe(client_opt_t *options , filter_t *filter, char *resource_uri) { + WsXmlDocH subscribe(client_opt_t *options, filter_t *filter, const char *resource_uri) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.filter = filter; + args.resource_uri = resource_uri; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_subscribe_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_subscribe($self, resource_uri, options, filter); +#endif } /* @@ -336,11 +478,21 @@ * unsubscribe: Remove a listener from events * * call-seq: - * result = client.unsubscribe(options, filter, uri, identifier) + * client.unsubscribe(options, filter, uri, identifier) -> XmlDoc * */ - WsXmlDocH unsubscribe(client_opt_t *options , filter_t *filter, char *resource_uri, char *identifier) { + WsXmlDocH unsubscribe(client_opt_t *options, filter_t *filter, const char *resource_uri, const char *identifier) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.filter = filter; + args.resource_uri = resource_uri; + args.identifier = identifier; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_unsubscribe_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_unsubscribe($self, resource_uri, options, identifier); +#endif } /* @@ -349,18 +501,27 @@ * renew: Renew a subscription * * call-seq: - * result = client.renew(options, uri, identifier) + * client.renew(options, uri, identifier) -> XmlDoc * */ WsXmlDocH renew(client_opt_t *options , char *resource_uri, char *identifier) { +#if RUBY_VERSION > 18 /* YARV */ + wsmc_action_args_t args; + args.client = $self; + args.options = options; + args.resource_uri = resource_uri; + args.identifier = identifier; + return (WsXmlDocH)rb_thread_blocking_region((rb_blocking_function_t*)ruby_renew_thread, &args, RUBY_UBF_IO, 0); +#else return wsmc_action_renew($self, resource_uri, options, identifier); +#endif } /* * Get a string representation of the last fault * * call-seq: - * client.fault_string + * client.fault_string -> String * */ char *fault_string() { @@ -371,7 +532,7 @@ * Get a numeric representation of the last fault * * call-seq: - * client.last_error + * client.last_error -> Integer * */ int last_error() { diff -Nru openwsman-2.3.6/bindings/wsman-epr.i openwsman-2.4.3/bindings/wsman-epr.i --- openwsman-2.3.6/bindings/wsman-epr.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-epr.i 2013-12-23 04:47:33.000000000 -0600 @@ -14,7 +14,7 @@ typedef struct {} epr_t; /* - * EndPointReference + * Document-class: EndPointReference * * The EndPointReference is a stub to proxy server-side operations * @@ -152,8 +152,16 @@ #if defined(SWIGRUBY) /* - * get value of selector by name + * Get value of selector by name + * epr#selector converts any value passed to String * + * ==== Shortcut + * epr.selector("name") can also be abbreviated as epr.name + * + * ==== Examples + * epr.selector("name") + * epr.selector(value) + * epr.name */ char *selector(VALUE v) { const char *name = as_string(v); diff -Nru openwsman-2.3.6/bindings/wsman-filter.i openwsman-2.4.3/bindings/wsman-filter.i --- openwsman-2.3.6/bindings/wsman-filter.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-filter.i 2013-12-23 04:47:33.000000000 -0600 @@ -56,6 +56,8 @@ #endif /* + * Document-class: Filter + * * Filter are evaluated on the server side and help to reduce the amount * of processing and information transport. * diff -Nru openwsman-2.3.6/bindings/wsman-names.i openwsman-2.4.3/bindings/wsman-names.i --- openwsman-2.3.6/bindings/wsman-names.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-names.i 2013-12-23 04:47:33.000000000 -0600 @@ -46,4 +46,16 @@ #define WS_NTLM_AUTH 4 #define WS_GSSNEGOTIATE_AUTH 5 #define WS_MAX_AUTH 6 - \ No newline at end of file + +/* delivery security mode */ +#define WSMAN_DELIVERY_SEC_AUTO 0 +#define WSMAN_DELIVERY_SEC_HTTP_BASIC 1 +#define WSMAN_DELIVERY_SEC_HTTP_DIGEST 2 +#define WSMAN_DELIVERY_SEC_HTTPS_BASIC 3 +#define WSMAN_DELIVERY_SEC_HTTPS_DIGEST 4 +#define WSMAN_DELIVERY_SEC_HTTPS_MUTUAL 5 +#define WSMAN_DELIVERY_SEC_HTTPS_MUTUAL_BASIC 6 +#define WSMAN_DELIVERY_SEC_HTTPS_MUTUAL_DIGEST 7 +#define WSMAN_DELIVERY_SEC_HTTPS_SPNEGO_KERBEROS 8 +#define WSMAN_DELIVERY_SEC_HTTPS_MUTUAL_SPNEGO_KERBEROS 9 +#define WSMAN_DELIVERY_SEC_HTTP_SPNEGO_KERBEROS 10 diff -Nru openwsman-2.3.6/bindings/wsman-soap.i openwsman-2.4.3/bindings/wsman-soap.i --- openwsman-2.3.6/bindings/wsman-soap.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-soap.i 2013-12-23 04:47:33.000000000 -0600 @@ -16,59 +16,80 @@ struct __WsEnumerateInfo {}; /* + * Document-class: EnumerateInfo + * * EnumerateInfo contains all information related to an enumeration * request. * * The initial client.enumerate operation only returns a +context+ - * which can be used to +pull+ the next enumeration item. This item - * contains the next context in the chain. + * (String) which can be used to +pull+ the next enumeration item. + * This item contains the next context in the chain. * */ %extend __WsEnumerateInfo { ~__WsEnumerateInfo() { } + /* + * Return the maximum number of items that will be returned by this enumeration + * call-seq: + * enumerate_info.max_items -> Integer + */ int max_items() { return $self->maxItems; } #if defined(SWIGRUBY) %rename("max_items=") set_max_items(int mi); #endif /* * Set the maximum number of items returned by this enumeration + * call-seq: + * enumerate_info.max_items = 100 */ void set_max_items(int mi) { $self->maxItems = mi; } /* - * flags + * enumeration flags + * call-seq: + * enumerate_info.flags -> Integer */ int flags() { return $self->flags; } /* - * The URL of the endpoint receiving the enumeration (String) + * The URL of the endpoint receiving the enumeration + * call-seq: + * enumerate_info.epr_to -> String */ const char *epr_to() { return $self->epr_to; } /* - * The URI of the end point reference (String) + * The URI of the end point reference + * call-seq: + * enumerate_info.epr_uri -> String */ const char *epr_uri() { return $self->epr_uri; } /* * The current encoding (defaults to 'utf-8') + * call-seq: + * enumerate_info.encoding -> String */ const char *encoding() { return $self->encoding; } /* * The Filter for this enumeration + * call-seq: + * enumerate_info.filter -> Openwsman::Filter */ const filter_t *filter() { return $self->filter; } /* * The current index (number of the last returned item) + * call-seq: + * enumerate_info.index -> Integer */ int index() { return $self->index; @@ -78,6 +99,8 @@ #endif /* * Set a specific index (used to skip ahead) + * call-seq: + * enumerate_info.index = 42 */ void set_index(int i) { $self->index = i; @@ -86,6 +109,8 @@ * The total number of items in this enumeration * * index is the number already returned, this is the total number + * call-seq: + * enumerate_info.total_items -> Integer * */ int total_items() { @@ -94,28 +119,20 @@ #if defined(SWIGRUBY) %rename("total_items=") set_total_items(int i); #endif + /* + * Set the total number of items in this enumeration + * call-seq: + * enumerate_info.total_items = 10 + * + */ void set_total_items(int i) { $self->totalItems = i; } -#if defined(SWIGRUBY) - VALUE enum_results() { - return (VALUE)$self->enumResults; - } - %rename("enum_results=") set_enum_results(VALUE result); - void set_enum_results(VALUE result) { - $self->enumResults = (void *)result; - } - VALUE enum_context() { - return (VALUE)$self->appEnumContext; - } - %rename("enum_context=") set_enum_context(VALUE context); - void set_enum_context(VALUE context) { - $self->appEnumContext = (void *)context; - } -#endif /* * XmlDoc representing the result pulled last + * call-seq: + * enumerate_info.pull_result -> Openwsman::XmlDoc */ WsXmlDocH pull_result() { return (WsXmlDocH)$self->pullResultPtr; @@ -127,7 +144,8 @@ * Set the pull result (XmlDoc) * * Used for server-side plugin extensions - * + * call-seq: + * enumerate_info.pull_result = xml_doc */ void set_pull_result(WsXmlDocH result) { $self->pullResultPtr = (void *)result; @@ -144,12 +162,16 @@ struct __SoapOp {}; /* + * Document-class: SoapOp + * * SoapOp represents a SOAP operation * */ %extend __SoapOp { /* * The incoming XmlDoc + * call-seq: + * soap_op.indoc -> Openwsman::XmlDoc */ WsXmlDocH indoc() { return soap_get_op_doc($self, 1); @@ -159,12 +181,16 @@ #endif /* * Set the incoming XmlDoc + * call-seq: + * soap_op.indoc = xml_doc */ void set_indoc( WsXmlDocH doc ) { soap_set_op_doc( $self, doc, 1 ); } /* * The outgoing XmlDoc + * call-seq: + * soap_op.outdoc -> Openwsman::XmlDoc */ WsXmlDocH outdoc() { return soap_get_op_doc($self, 0); @@ -174,25 +200,32 @@ #endif /* * Set the outgoing XmlDoc + * call-seq: + * soap_op.outdoc = xml_doc */ void set_outdoc( WsXmlDocH doc ) { soap_set_op_doc( $self, doc, 0 ); } /* * The Soap instance of this operation + * call-seq: + * soap_op.soap -> Openwsman::Soap */ struct __Soap *soap() { return soap_get_op_soap($self); } /* - * The raw (SOAP) message for this operation (opaque pointer - * currently) + * The raw (SOAP) message for this operation + * call-seq: + * soap_op.msg -> Openwsman::Message */ WsmanMessage *msg() { return wsman_get_msg_from_op($self); } /* * The maximum size (on the wire) of this operation + * call-seq: + * soap_op.maxsize -> Integer */ unsigned long maxsize(){ return wsman_get_maxsize_from_op($self); @@ -209,6 +242,8 @@ struct __Soap {}; /* + * Document-class: Soap + * * Soap represents a part of a SoapOp used to create and reference * context information. * @@ -224,13 +259,16 @@ /* * Create a new Context - * + * call-seq: + * soap.create_context -> Openwsman::Context */ WsContextH create_context() { return ws_create_context($self); } /* * Get the current Context + * call-seq: + * soap.context -> Openwsman::Context * */ WsContextH context() { @@ -239,6 +277,8 @@ /* * Create a new endpoint Context + * call-seq: + * soap.create_ep_context -> Openwsman::Context * */ WsContextH create_ep_context( WsXmlDocH doc ) { @@ -258,6 +298,8 @@ /* + * Document-class: Context + * * Context contains all information of an ongoing SOAP operation * * There is no constructor for Context, use Soap.context to get the @@ -271,13 +313,16 @@ %typemap(newfree) WsXmlDocH "ws_xml_destroy_doc($1);"; /* * The incoming XmlDoc + * call-seq: + * context.indox -> Openwsman::XmlDoc */ WsXmlDocH indoc() { return $self->indoc; } /* * Get the Soap runtime environment - * + * call-seq: + * context.runtime -> Openwsman::Soap */ struct __Soap *runtime() { return ws_context_get_runtime($self); @@ -287,58 +332,128 @@ #endif /* * Set the idle timeout for enumerations + * call-seq: + * context.enum_idle_timeout = 60 */ void set_enumIdleTimeout(unsigned long timeout) { ws_set_context_enumIdleTimeout($self, timeout); } /* - * The class name (String) + * The class name + * call-seq: + * context.classname -> String */ const char *classname() { return wsman_get_class_name($self); } /* - * The method name (String) + * The method name + * call-seq: + * context.method -> String */ const char *method() { return wsman_get_method_name($self); } /* - * The method arguments (Hash) + * The method arguments + * call-seq: + * context.method -> Hash */ hash_t *method_args(const char *resource_uri) { return wsman_get_method_args($self, resource_uri); } + /* + * The maximum elements of the document + * call-seq: + * context.max_elements -> Integer + * context.max_elements(xmldoc) -> Integer + */ int max_elements(WsXmlDocH doc = NULL) { return wsman_get_max_elements($self, doc); } + /* + * The maximum envelope size of the document + * call-seq: + * context.max_envelope_size -> Integer + * context.max_envelope_size(xmldoc) -> Integer + */ unsigned long max_envelope_size(WsXmlDocH doc = NULL) { return wsman_get_max_envelope_size($self, doc); } + /* + * The fragment of the document + * call-seq: + * context.fragment_string -> String + * context.fragment_string(xmldoc) -> String + */ const char *fragment_string(WsXmlDocH doc = NULL) { return wsman_get_fragment_string($self, doc); } + /* + * The selector for an element + * call-seq: + * context.selector(xml_doc, "Name", 1) -> String + */ const char *selector(WsXmlDocH doc, const char *name, int index) { return wsman_get_selector($self, doc, name, index); } + /* + * The selectors from an endpoint reference + * call-seq: + * context.selectors_from_epr(epr_node_as_xml_doc) -> Hash + */ hash_t *selectors_from_epr(WsXmlNodeH epr_node) { return wsman_get_selectors_from_epr($self, epr_node); } + /* + * The selectors for a document + * call-seq: + * context.selectors -> Hash + * context.selectors(xml_doc) -> Hash + */ hash_t *selectors(WsXmlDocH doc = NULL) { return wsman_get_selector_list($self, doc); } + /* + * The selectors from a filter + * call-seq: + * context.selectors_from_filter -> Hash + * context.selectors_from_filter(xml_doc) -> Hash + */ hash_t *selectors_from_filter(WsXmlDocH doc = NULL) { return wsman_get_selector_list_from_filter($self, doc); } + /* + * The action + * call-seq: + * context.action -> String + * context.action(xml_doc) -> String + */ const char *action(WsXmlDocH doc = NULL) { return wsman_get_action($self, doc); } + /* + * The resource uri + * call-seq: + * context.resource_uri -> String + * context.resource_uri(xml_doc) -> String + */ const char *resource_uri(WsXmlDocH doc = NULL) { return wsman_get_resource_uri($self, doc); } + /* + * The option set + * call-seq: + * context.option_set(xml_doc, "op") -> String + */ const char *option_set(WsXmlDocH doc, const char *op) { return wsman_get_option_set($self, doc, op); } + /* + * Parse enumeration request + * call-seq: + * context.parse_enum_request(enumerate_info) -> Integer + */ int parse_enum_request(WsEnumerateInfo *enumInfo) { WsmanStatus status; wsman_status_init(&status); @@ -359,15 +474,23 @@ typedef struct _WsmanStatus WsmanStatus; /* - * Status + * Document-class: Status * + * Status represents the detailed status of a (failed) WS-Management + * operation. + * + * Its primarily used implementing server-side plugins to report a Fault + * back to the calling client. */ %extend _WsmanStatus { /* - * Create an empty status + * Create a new Status object * - * optionally pass - * int code, int code_detail, string message + * call-seq: + * Openwsman::Status.new # create 'good' status + * Openwsman::Status.new error_code + * Openwsman::Status.new error_code, error_detail + * Openwsman::Status.new error_code, error_detail, "Error message" */ _WsmanStatus(int code = 0, int detail = 0, const char *msg = NULL) { WsmanStatus *s = (WsmanStatus *)malloc(sizeof(WsmanStatus)); @@ -394,6 +517,8 @@ } /* * String representation (returns the fault message) + * call-seq: + * status.to_s -> String */ const char *to_s() { return $self->fault_msg; @@ -403,10 +528,14 @@ #endif /* * Set the fault code + * call-seq: + * status.code = 1 */ void set_code(int code) { $self->fault_code = code; } /* * Get the fault code + * call-seq: + * status.code -> Integer */ int code() { return $self->fault_code; @@ -416,7 +545,8 @@ #endif /* * Set the fault detail code - * + * call-seq: + * status.detail = 42 */ void set_detail(int detail) { if (detail < 0 @@ -431,6 +561,11 @@ return; #endif } + /* + * Get the fault detail code + * call-seq: + * status.detail -> Integer + */ int detail() { return $self->fault_detail_code; } @@ -439,22 +574,31 @@ #endif /* * Set the fault message - * + * call-seq: + * status.msg = "This is a fault message" */ void set_msg(const char *msg) { + if ($self->fault_msg) + free($self->fault_msg); if (msg) $self->fault_msg = strdup(msg); else $self->fault_msg = NULL; } + /* + * Get the fault message + * call-seq: + * status.msg -> String + */ const char *msg() { return $self->fault_msg; } %typemap(newfree) WsXmlDocH "ws_xml_destroy_doc($1);"; /* - * Create a new fault XmlDoc - * + * Create a new fault XmlDoc based on Status information + * call-seq: + * status.generate_fault(xml_doc) -> XmlDoc */ WsXmlDocH generate_fault(WsXmlDocH doc) { return wsman_generate_fault( doc, $self->fault_code, $self->fault_detail_code, $self->fault_msg); @@ -471,10 +615,17 @@ typedef struct _WsManFault WsManFault; /* - * Fault + * Document-class: Fault + * + * Fault represents details of a failed WS-Management operation * */ %extend _WsManFault { + /* + * Create a Fault representation of a failed WS-Management result doc + * call-seq: + * Openwsman::Fault.new result -> Openwsman::Fault + */ _WsManFault(WsXmlDocH doc) { WsManFault *fault = wsmc_fault_new(); wsmc_get_fault_data(doc, fault); @@ -483,15 +634,35 @@ ~_WsManFault() { wsmc_fault_destroy($self); } + /* + * Fault code + * call-seq: + * fault.code -> String + */ const char *code() { return $self->code; } + /* + * Fault subcode + * call-seq: + * fault.subcode -> String + */ const char *subcode() { return $self->subcode; } + /* + * Fault reason + * call-seq: + * fault.reason -> String + */ const char *reason() { return $self->reason; } + /* + * Fault detail + * call-seq: + * fault.detail -> String + */ const char *detail() { return $self->fault_detail; } diff -Nru openwsman-2.3.6/bindings/wsman-transport.i openwsman-2.4.3/bindings/wsman-transport.i --- openwsman-2.3.6/bindings/wsman-transport.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-transport.i 2013-12-23 04:47:33.000000000 -0600 @@ -9,16 +9,10 @@ typedef struct _WsManTransport {} WsManTransport; /* - * Transport is no separate struct in openwsman but part of WsManClient + * Document-class: Transport * - * However, accessing transport in e.g. Ruby as - * client.transport_ - * is cumbersome - * - * Instead we provide - * t = client.transport - * t. - * as a convenience + * Transport reflects details of the http(s) transport layer between + * client and server. * */ @@ -33,29 +27,51 @@ %include "u/libu.h" %include "wsman-client-transport.h" -%extend WsManTransport { +%extend _WsManTransport { + /* No authentication */ %constant int NO_AUTH = WS_NO_AUTH; + /* HTTP basic auth */ %constant int BASIC_AUTH = WS_BASIC_AUTH; + /* HTTP digest auth */ %constant int DIGEST_AUTH = WS_DIGEST_AUTH; + /* Windows Passport auth */ %constant int PASS_AUTH = WS_PASS_AUTH; + /* Windows NT Lan manager auth */ %constant int NTLM_AUTH = WS_NTLM_AUTH; + /* GSSAPI auth */ %constant int GSSNEGOTIATE_AUTH = WS_GSSNEGOTIATE_AUTH; + /* No authentication */ %constant char *NO_AUTH_STR = _WS_NO_AUTH; + /* HTTP basic auth */ %constant char *BASIC_AUTH_STR = _WS_BASIC_AUTH; + /* HTTP digest auth */ %constant char *DIGEST_AUTH_STR = _WS_DIGEST_AUTH; + /* Windows Passport auth */ %constant char *PASS_AUTH_STR = _WS_PASS_AUTH; + /* Windows NT Lan manager auth */ %constant char *NTLM_AUTH_STR = _WS_NTLM_AUTH; + /* GSSAPI auth */ %constant char *GSSNEGOTIATE_AUTH_STR = _WS_GSSNEGOTIATE_AUTH; #if defined(SWIGRUBY) %rename("auth_method?") is_auth_method(int method); + %typemap(out) int is_auth_method + "$result = ($1 != 0) ? Qtrue : Qfalse;"; #endif + /* + * Check if the passed method id is valid for authentication + * call-seq: + * transport.auth_method?(Integer) -> Boolean + */ int is_auth_method(int method) { return wsman_is_auth_method((WsManClient *)$self, method); } + /* + * Close the transport. No further communication possible. + */ void close() { wsman_transport_close_transport((WsManClient *)$self); } @@ -63,10 +79,23 @@ #if defined(SWIGRUBY) %rename("agent=") set_agent(const char *agent); #endif + /* + * Set the HTTP agent identifier (User-agent:) string + * + * This is how the client will show up in the servers http log. + * Defaults to "Openwsman" + * call-seq: + * transport.agent = "Client identifier" + */ void set_agent(const char *agent) { wsman_transport_set_agent((WsManClient *)$self, agent); } %newobject agent; + /* + * Get the HTTP agent identifier string + * call-seq: + * transport.agent -> String + */ char *agent() { return wsman_transport_get_agent ((WsManClient *)$self); } @@ -75,6 +104,12 @@ %rename("username") get_username(); #endif %newobject get_username; + /* + * Server credentials + * Get the username part of the http transport credentials + * call-seq: + * transport.username -> String + */ char *get_username() { return wsman_transport_get_userName((WsManClient *)$self); } @@ -82,6 +117,12 @@ #if defined(SWIGRUBY) %rename("username=") set_username(char *user_name); #endif + /* + * Server credentials + * Set the username part of the http transport credentials + * call-seq: + * transport.username = "Username" + */ void set_username(char *user_name) { wsman_transport_set_userName((WsManClient *)$self, user_name); } @@ -90,6 +131,12 @@ %rename("password") get_password(); #endif %newobject get_password; + /* + * Server credentials + * Get the password part of the http transport credentials + * call-seq: + * transport.password -> String + */ char *get_password() { return wsman_transport_get_password((WsManClient *)$self); } @@ -97,6 +144,12 @@ #if defined(SWIGRUBY) %rename("password=") set_password(char *password); #endif + /* + * Server credentials + * Set the password part of the http transport credentials + * call-seq: + * transport.password = "Password" + */ void set_password(char *password) { wsman_transport_set_password((WsManClient *)$self, password); } @@ -105,6 +158,13 @@ %rename("proxy_username") get_proxy_username(); #endif %newobject get_proxy_username; + /* + * Windows clients: HTTP proxy credentials + * + * Get the username part of the http proxy credentials + * call-seq: + * transport.proxy_username -> String + */ char *get_proxy_username() { return wsman_transport_get_proxy_username((WsManClient *)$self ); } @@ -112,6 +172,13 @@ #if defined(SWIGRUBY) %rename("proxy_username=") set_proxy_username(char *proxy_username); #endif + /* + * Windows clients: HTTP proxy credentials + * + * Set the username part of the http proxy credentials + * call-seq: + * transport.proxy_username = "proxy_username" + */ void set_proxy_username(char *proxy_username) { wsman_transport_set_proxy_username((WsManClient *)$self, proxy_username ); } @@ -120,6 +187,13 @@ %rename("proxy_password") get_proxy_password(); #endif %newobject get_proxy_password; + /* + * Windows clients: HTTP proxy credentials + * + * Get the password part of the http proxy credentials + * call-seq: + * transport.proxy_password -> String + */ char *get_proxy_password() { return wsman_transport_get_proxy_password((WsManClient *)$self ); } @@ -127,6 +201,13 @@ #if defined(SWIGRUBY) %rename("proxy_password=") set_proxy_password(char *proxy_password); #endif + /* + * Windows clients: HTTP proxy credentials + * + * Set the password part of the http proxy credentials + * call-seq: + * transport.proxy_password = "proxy_password" + */ void set_proxy_password(char *proxy_password) { wsman_transport_set_proxy_password((WsManClient *)$self, proxy_password ); } @@ -134,64 +215,166 @@ #if defined(SWIGRUBY) %rename("auth_method=") set_auth_method( const char *am); #endif - void set_auth_method( const char *am) { + /* + * Set the authentication method + * Value must be one of: + * +Openwsman::NO_AUTH_STR+ + * +Openwsman::BASIC_AUTH_STR+ + * +Openwsman::DIGEST_AUTH_STR+ + * +Openwsman::PASS_AUTH_STR+ + * +Openwsman::NTLM_AUTH_STR+ + * +Openwsman::GSSNEGOTIATE_AUTH_STR+ + */ + void set_auth_method(const char *am) { wsman_transport_set_auth_method((WsManClient *)$self, am); } %newobject auth_method; + /* + * Set the authentication method + * call-seq: + * transport.auth_method -> String + */ char *auth_method() { return wsman_transport_get_auth_method ((WsManClient *)$self); } + /* + * Set the authentication method string corresponding to the given + * auth method id + * + * Value must be one of: + * +Openwsman::NO_AUTH+ + * +Openwsman::BASIC_AUTH+ + * +Openwsman::DIGEST_AUTH+ + * +Openwsman::PASS_AUTH+ + * +Openwsman::NTLM_AUTH+ + * +Openwsman::GSSNEGOTIATE_AUTH+ + * + * call-seq: + * transport.auth_name(Integer) -> String + */ static const char *auth_name(int auth) { return wsmc_transport_get_auth_name(auth); } + /* + * Get the authentication method integer id + */ int auth_value() { return wsmc_transport_get_auth_value((WsManClient *)$self); } + /* + * Get string corresponding to given error code + * call-seq: + * transport.error_string(Integer) -> String + */ static char *error_string(int err) { return wsman_transport_get_last_error_string(err); } -/* - * transport timeout in seconds - * - */ #if defined(SWIGRUBY) %rename("timeout=") set_timeout(unsigned long timeout); #endif + /* + * Set the transport timeout in seconds + * + * ==== Note + * This is the http layer timeout. Not to be confused with the + * WS-Management operation timeout set via Openwsman::ClientOptions.timeout + */ void set_timeout(unsigned long timeout) { wsman_transport_set_timeout((WsManClient *)$self, timeout); } + /* + * Get the transport timeout in seconds + * call-seq: + * transport.timeout -> Integer + */ unsigned long timeout() { return wsman_transport_get_timeout((WsManClient *)$self); } -/* - * verify the peer in SSL communication ? - * no: == 0 - * yes: != 0 - */ #if defined(SWIGRUBY) - %rename("verify_peer=") set_verify_peer( unsigned int value ); -#endif + %rename("verify_peer=") set_verify_peer( VALUE rvalue ); + /* + * verify the peer in SSL communication ? + * + * If passed +false+, +nil+, or 0: disable peer verification + * else: enable peer verification + */ + void set_verify_peer( VALUE rvalue ) { + unsigned int value; + if ((rvalue == Qfalse) || (rvalue == Qnil)) { + value = 0; + } + else if ((TYPE(rvalue) == T_FIXNUM) && (FIX2INT(rvalue) == 0)) { + value = 0; + } + else { + value = 1; + } +#else + /* + * verify the peer in SSL communication ? + * no: == 0 + * yes: != 0 + */ void set_verify_peer( unsigned int value ) { +#endif wsman_transport_set_verify_peer((WsManClient *)$self, value); } +#if defined(SWIGRUBY) + %rename("verify_peer?") verify_peer(); + %typemap(out) unsigned int verify_peer + "$result = ($1 != 0) ? Qtrue : Qfalse;"; +#endif + /* + * Peer to be verified ? + * call-seq: + * transport.verify_peer? -> Boolean + */ unsigned int verify_peer() { return wsman_transport_get_verify_peer((WsManClient *)$self); } -/* - * verify the host in SSL communication ? - * no: == 0 - * yes: != 0 - */ #if defined(SWIGRUBY) - %rename("verify_host=") set_verify_host(unsigned int value); -#endif + %rename("verify_host=") set_verify_host(VALUE rvalue); + /* + * verify the host in SSL communication ? + * + * If passed +false+, +nil+, or 0: disable peer verification + * else: enable peer verification + */ + void set_verify_host( VALUE rvalue ) { + unsigned int value; + if ((rvalue == Qfalse) || (rvalue == Qnil)) { + value = 0; + } + else if ((TYPE(rvalue) == T_FIXNUM) && (FIX2INT(rvalue) == 0)) { + value = 0; + } + else { + value = 1; + } +#else + /* + * verify the host in SSL communication ? + * no: == 0 + * yes: != 0 + */ void set_verify_host(unsigned int value) { +#endif wsman_transport_set_verify_host((WsManClient *)$self, value); } +#if defined(SWIGRUBY) + %rename("verify_host?") verify_host(); + %typemap(out) unsigned int verify_host + "$result = ($1 != 0) ? Qtrue : Qfalse;"; +#endif + /* + * Host to be verified ? + * call-seq: + * transport.verify_host? -> Boolean + */ unsigned int verify_host() { return wsman_transport_get_verify_host((WsManClient *)$self); } @@ -199,10 +382,20 @@ #if defined(SWIGRUBY) %rename("proxy=") set_proxy(const char *proxy); #endif + /* + * Set http proxy URL + * + * Pass nil to disable proxy communication + * ==== Example + * transport.proxy = "http://your.proxy.com:80" + */ void set_proxy(const char *proxy) { wsman_transport_set_proxy((WsManClient *)$self, proxy); } %newobject proxy; + /* + * Get http proxy URL + */ char *proxy() { return wsman_transport_get_proxy((WsManClient *)$self); } @@ -210,10 +403,24 @@ #if defined(SWIGRUBY) %rename("proxyauth=") set_proxyauth(const char *pauth); #endif + /* + * Linux clients: HTTP proxy credentials + * + * Set the proxy username and password + * ==== Example + * transport.proxyauth = "username:password" + */ void set_proxyauth(const char *pauth) { wsman_transport_set_proxyauth((WsManClient *)$self, pauth); } %newobject proxyauth; + /* + * Linux clients: HTTP proxy credentials + * + * Get the proxy username and password as "username:password" + * call-seq: + * transport.proxyauth -> String + */ char *proxyauth(){ return wsman_transport_get_proxyauth((WsManClient *)$self); } @@ -221,10 +428,18 @@ #if defined(SWIGRUBY) %rename("cainfo=") set_cainfo(const char *cainfo); #endif + /* + * Set the certification authority (CAINFO) + */ void set_cainfo(const char *cainfo) { wsman_transport_set_cainfo((WsManClient *)$self, cainfo); } %newobject cainfo; + /* + * Get the certification authority (CAINFO) + * call-seq: + * transport.cainfo -> String + */ char *cainfo() { return wsman_transport_get_cainfo((WsManClient *)$self); } @@ -232,10 +447,18 @@ #if defined(SWIGRUBY) %rename("certhumbprint=") set_certhumbprint(const char *arg); #endif + /* + * Set the certification thumbprint + */ void set_certhumbprint(const char *arg) { wsman_transport_set_certhumbprint((WsManClient *)$self, arg); } %newobject certhumbprint; + /* + * Set the certification thumbprint + * call-seq: + * transport.certhumbprint -> String + */ char *certhumbprint() { return wsman_transport_get_certhumbprint((WsManClient *)$self); } @@ -243,10 +466,16 @@ #if defined(SWIGRUBY) %rename("capath=") set_capath(const char *capath); #endif + /* + * Set the path to the certification authority (CAINFO) store + */ void set_capath(const char *capath) { wsman_transport_set_capath((WsManClient *)$self, capath); } %newobject capath; + /* + * Get the path to the certification authority (CAINFO) store + */ char *capath() { return wsman_transport_get_capath((WsManClient *)$self); } @@ -254,10 +483,23 @@ #if defined(SWIGRUBY) %rename("caoid=") set_caoid(const char *oid); #endif + /* + * Windows client + * + * Set the CA OID + * + * ==== Reference + * http://support.microsoft.com/kb/287547 + */ void set_caoid(const char *oid) { wsman_transport_set_caoid((WsManClient *)$self, oid); } %newobject caoid; + /* + * Windows client + * + * Get the CA OID + */ char *caoid() { return wsman_transport_get_caoid((WsManClient *)$self); } @@ -266,9 +508,21 @@ #if defined(SWIGRUBY) %rename("calocal=") set_calocal(BOOL local); #endif + /* + * Windows client + * + * Use local CA ? + */ void set_calocal(BOOL local) { wsman_transport_set_calocal((WsManClient *)$self, local); } + /* + * Windows client + * + * Use local CA ? + * call-seq: + * transport.calocal -> Boolean + */ BOOL calocal() { return wsman_transport_get_calocal((WsManClient *)$self); } @@ -277,10 +531,16 @@ #if defined(SWIGRUBY) %rename("cert=") set_cert(const char *cert); #endif + /* + * Set the certificate + */ void set_cert(const char *cert) { wsman_transport_set_cert((WsManClient *)$self, cert); } %newobject cert; + /* + * Get the certificate + */ char *cert() { return wsman_transport_get_cert((WsManClient *)$self); } @@ -288,10 +548,16 @@ #if defined(SWIGRUBY) %rename("key=") set_key(const char *key); #endif + /* + * Set the key + */ void set_key(const char *key) { wsman_transport_set_key((WsManClient *)$self, key); } %newobject key; + /* + * Get the key + */ char *key() { return wsman_transport_get_key((WsManClient *)$self); } diff -Nru openwsman-2.3.6/bindings/wsman-xml.i openwsman-2.4.3/bindings/wsman-xml.i --- openwsman-2.3.6/bindings/wsman-xml.i 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/bindings/wsman-xml.i 2013-12-23 04:47:33.000000000 -0600 @@ -5,7 +5,7 @@ */ /* - * XmlNs + * Document-class: XmlNs * Xml namespace */ @@ -15,7 +15,7 @@ typedef struct __WsXmlNs* WsXmlNsH; /* - * class XmlDoc + * XmlDoc * * Implementation advice * DONT do a %newobject on functions returning WsXmlDoc. Swig will @@ -56,7 +56,6 @@ } %typemap(newfree) char * "free($1);"; #if defined(SWIGRUBY) - %alias string "to_s"; %alias string "to_xml"; #endif #if defined(SWIGPYTHON) @@ -67,7 +66,14 @@ #endif %newobject string; /* - * generic (indented) string representation of the XmlDoc + * generic (indented) string representation of the XmlDoc UTF-8 encoded. + * see encode for setting the encoding. + * + * alias: to_xml + * + * call-seq: + * doc.string -> String + * doc.to_xml -> String */ char *string() { int size; @@ -77,22 +83,36 @@ return buf; } +#if defined(SWIGRUBY) + %alias encode "to_s"; +#endif + %newobject encode; /* * encode document as string with specific encoding * (non-indented representation) * * encoding defaults to 'utf-8' * + * alias: to_s + * + * call-seq: + * doc.encode -> String + * doc.encode("UTF-16") -> String + * doc.to_s -> string + * */ - %newobject encode; - char *encode(const char *encoding="utf-8") { + char *encode(const char *encoding = "utf-8") { int size; char *buf; ws_xml_dump_memory_enc( $self, &buf, &size, encoding ); return buf; } + /* * dump document to file + * + * call-seq: + * doc.dump(IO) -> nil */ void dump_file(FILE *fp) { ws_xml_dump_doc( fp, $self ); @@ -137,10 +157,14 @@ * get soap element node by name * returns nil if no element with the name can be found * + * call-seq: + * doc.element(String) -> XmlNode + * */ WsXmlNodeH element(const char *name) { return ws_xml_get_soap_element( $self, name ); } + %newobject context; /* * get enumeration context as string * return nil if context not present or empty @@ -149,7 +173,6 @@ * doc.context -> String * */ - %newobject context; const char *context() { char *c = wsmc_get_enum_context( $self ); if (c) { @@ -164,6 +187,9 @@ * * This creates a new XmlDoc instance representing a fault * + * call-seq: + * doc.generate_fault(Openwsman::Status) -> XmlDoc + * */ WsXmlDocH generate_fault(WsmanStatus *s) { return wsman_generate_fault( $self, s->fault_code, s->fault_detail_code, s->fault_msg); @@ -184,15 +210,22 @@ /* * Check if document represents a fault * + * call-seq: + * doc.fault?(XmlDoc) -> Boolean + * */ int is_fault() { return wsmc_check_for_fault( $self ); } + %newobject fault; /* * retrieve fault data + * + * call-seq: + * doc.fault(XmlDoc) -> Openwsman::Fault + * doc.fault(XmlDoc) -> nil # if XmlDoc is not a fault */ - %newobject fault; WsManFault *fault() { WsManFault *f = NULL; if (wsmc_check_for_fault($self)) { @@ -208,6 +241,9 @@ * * This creates a new XmlDoc instance representing a response. * + * call-seq: + * doc.create_response_envelope(String action) -> XmlDoc + * */ WsXmlDocH create_response_envelope(const char *action = NULL) { return wsman_create_response_envelope($self, action); @@ -221,6 +257,8 @@ /* * Check if document represents an end of sequence (last enumeration item) * + * call-seq: + * doc.is_end_of_sequence() -> Boolean */ int is_end_of_sequence() { return NULL != ws_xml_find_in_tree( ws_xml_get_soap_body( $self ), XML_NS_ENUMERATION, WSENUM_END_OF_SEQUENCE, 1 ); @@ -269,6 +307,11 @@ %newobject string; /* * dump node as XML string + * + * alias: to_xml + * + * call-seq: + * node.string(XmlNode) -> String */ char *string() { int size; @@ -279,6 +322,9 @@ /* * dump node to file + * + * call-seq: + * node.dump_file(IO) -> nil */ void dump_file(FILE *fp) { ws_xml_dump_node_tree( fp, $self ); @@ -294,10 +340,21 @@ #else int equal( WsXmlNodeH n ) #endif + /* + * Test for identity (same object) + * + * call-seq: + * XmlNode == XmlNode -> Boolean + */ { return $self == n; } /* * get text (without xml tags) of node + * + * alias: to_s + * + * call-seq: + * node.text(XmlNode) -> String */ char *text() { return ws_xml_get_node_text( $self ); @@ -307,6 +364,9 @@ #endif /* * Set text of node + * + * call-seq: + * node.text = String */ void set_text( const char *text ) { ws_xml_set_node_text( $self, text ); @@ -314,6 +374,9 @@ /* * get XmlDoc to which node belongs + * + * call-seq: + * node.doc -> XmlDoc */ WsXmlDocH doc() { return ws_xml_get_node_doc( $self ); @@ -321,6 +384,9 @@ /* * get parent for node + * + * call-seq: + * node.parent -> XmlNode */ WsXmlNodeH parent() { return ws_xml_get_node_parent( $self ); @@ -331,6 +397,9 @@ /* * get first child of node + * + * call-seq: + * node.child -> XmlNode */ WsXmlNodeH child() { return xml_parser_get_first_child($self); @@ -338,6 +407,9 @@ /* * get name for node + * + * call-seq: + * node.name -> String */ char *name() { return ws_xml_get_node_local_name( $self ); @@ -348,6 +420,9 @@ /* * set name of node + * + * call-seq: + * node.name = String */ void set_name( const char *name ) { ws_xml_set_node_name( $self, ws_xml_get_node_name_ns( $self ), name ); @@ -355,16 +430,22 @@ /* * get namespace for node + * + * call-seq: + * node.ns -> String */ char *ns() { return ws_xml_get_node_name_ns( $self ); } + #if defined(SWIGRUBY) %rename("ns=") set_ns( const char *nsuri ); #endif - /* * set namespace of node + * + * call-seq: + * node.ns = String */ void set_ns( const char *ns ) { ws_xml_set_ns( $self, ns, ws_xml_get_node_name_ns_prefix($self) ); @@ -372,17 +453,23 @@ /* * get prefix of nodes namespace + * + * call-seq: + * node.prefix -> String */ const char *prefix() { return ws_xml_get_node_name_ns_prefix($self); } - /* - * set language - */ #if defined(SWIGRUBY) %rename("lang=") set_lang(const char *lang); #endif + /* + * set language + * + * call-seq: + * node.lang = String + */ void set_lang(const char *lang) { ws_xml_set_node_lang($self, lang); } @@ -390,6 +477,10 @@ /* * find node within tree * a NULL passed as 'ns' (namespace) is treated as wildcard + * + * call-seq: + * node.find("namespace", "name") -> String # recursive + * node.find("namespace", "name", 0) -> String # non-recursive */ WsXmlNodeH find( const char *ns, const char *name, int recursive = 1) { return ws_xml_find_in_tree( $self, ns, name, recursive ); @@ -511,6 +602,11 @@ * ... do something with node ... * node = node.next * end + * + * call-seq: + * node.each { |XmlNode| ... } + * node.each("name") { |XmlNode| ... } + * node.each("name", "namespace") { |XmlNode| ... } */ void each(const char *name = NULL, const char *ns = NULL) { @@ -542,6 +638,11 @@ #endif /* * get child by index + * + * call-seq: + * node.get(42) -> XmlNode + * node.get(42, "name") -> XmlNode + * node.get(42, "name", "namespace") -> XmlNode */ WsXmlNodeH get(int i, const char *name = NULL, const char *ns = NULL) { if (i < 0 || i >= ws_xml_get_child_count_by_qname($self,ns,name)) @@ -551,25 +652,24 @@ /* * get first child by name (and namespace) + * + * call-seq: + * node.get("name") -> XmlNode + * node.get("name", "namespace") -> XmlNode */ WsXmlNodeH get(const char *name, const char *ns = NULL) { -#if 1 return ws_xml_get_child($self, 0, ns, name); -#else - /* Hmm, why is this code so complicated ? */ - int i = 0; - while ( i < ws_xml_get_child_count_by_qname($self, ns, name)) { - WsXmlNodeH child = ws_xml_get_child($self, i, ns, name); - if (!strcmp(ws_xml_get_node_local_name(child), name)) - return child; - ++i; - } - return NULL; -#endif } #if defined(SWIGRUBY) - /* get node attribute by index or name */ + /* + * get node attribute by index or name + * + * call-seq: + * node.attr(1) -> XmlAttr + * node.attr("name") -> XmlAttr + * node.attr("name", "namespace") -> XmlAttr + */ WsXmlAttrH attr(VALUE index = Qnil, VALUE namespace = Qnil) { if (NIL_P(index)) { /* nil */ return ws_xml_get_node_attr( $self, 0 ); @@ -590,26 +690,51 @@ return ws_xml_get_node_attr( $self, index ); } #endif - /* count node attribute */ + /* + * count node attribute + * + * call-seq: + * node.attr_count -> Integer + */ int attr_count() { return ws_xml_get_node_attr_count( $self ); } - /* find node attribute by name */ + /* + * find node attribute by name + * + * call-seq: + * node.attr_find("namespace", "name") -> XmlAttr + */ WsXmlAttrH attr_find( const char *ns, const char *name ) { return ws_xml_find_node_attr( $self, ns, name ); } - /* add attribute to node */ + /* + * add attribute to node + * + * call-seq: + * node.attr_add("namespace", "name", "value") -> XmlAttr + */ WsXmlAttrH attr_add( const char *ns, const char *name, const char *value ) { return ws_xml_add_node_attr( $self, ns, name, value ); } - + /* + * get end point reference + * + * call-seq: + * node.epr("namespace", "epr_node_name", Integer embedded) -> EndPointReference + */ epr_t *epr( const char *ns, const char *epr_node_name, int embedded) { return epr_deserialize($self, ns, epr_node_name, embedded); } #if defined(SWIGRUBY) - /* enumerate attributes */ + /* + * enumerate attributes + * + * call-seq: + * node.each_attr { |XmlAttr| ... } + */ void each_attr() { int i = 0; while ( i < ws_xml_get_node_attr_count( $self ) ) { @@ -644,19 +769,39 @@ #if defined(SWIGRUBY) %alias value "to_s"; #endif - /* get name for attr */ + /* + * get name for attr + * + * call-seq: + * attr.name -> String + */ char *name() { return ws_xml_get_attr_name( $self ); } - /* get namespace for attr */ + /* + * get namespace for attr + * + * call-seq: + * attr.ns -> String + */ char *ns() { return ws_xml_get_attr_ns( $self ); } - /* get value for attr */ + /* + * get value for attr + * + * call-seq: + * attr.value -> String + */ char *value() { return ws_xml_get_attr_value( $self ); } - /* remove note attribute */ + /* + * remove note attribute + * + * call-seq: + * attr.remove -> nil + */ void remove() { ws_xml_remove_node_attr( $self ); } diff -Nru openwsman-2.3.6/ChangeLog openwsman-2.4.3/ChangeLog --- openwsman-2.3.6/ChangeLog 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/ChangeLog 2013-12-23 04:47:33.000000000 -0600 @@ -1,3 +1,57 @@ +2.4.3 +- Bugfixes + - Fix bindings for Java 1.5 + - Raise exception if client creation fails (bindings) + +2.4.2 +- Standards compliance + - Honor WS-Management 1.1.1 standard (line 739) + Disable multiple MessageID checks +- Bugfixes + - Fix crash in redirect module (typo) + +2.4.1 +- Build fixes + - Builds now on SLES11 (cmake 2.4), Fedora 18 + - Fedora 19 + - needs rubypick package + - has empty ruby_version in CONFIG + - fix Ruby gem, include version.rb + +2.4.0 +- Features + - Add support for OptionSet in SOAP header (breaks ABI) + - Increase soversion of libwsman_client to 2.0.0 + - new function wsmc_add_option + - Redirect plugin: Added facilities to import the redirection + details from an included file (Praveen K Paladugu) +- Bugfixes + - wsman_transport_set_verify_host passed wrong values to CURL + - recognize 'Msvc' (Hyper V) and 'DCIM' (Dell Drac) CIM schemata + - xml_parser_element_dump: fix pointer (github issue #8) +- Bindings + - Ruby: Fix Ruby 1.9 threading locks for wsmc_action_* functions + - Ruby: API change: Transport.verify_{host,peer}? return Boolean now + Transport.verify_peer -> Transport.verify_peer? + Transport.verify_host -> Transport.verify_host? + - Support for OptionSet + - ClientOptions#add_option + - ClientOptions#options= (Ruby) + - XmlDoc#to_s returns non-indented xml representation + - Ruby: Accessors for OptionSet, Selectors, and Properties + - ClientOptions#options + - ClientOptions#properties + - ClientOptions#selectors + - Define security delivery modes (WSMAN_DELIVERY_SEC_*) + - Vastly improved bindings documentation + - Generate documenation with rdoc 1.9 + - Windows Remote Shell client implementation (see ruby/tests/winrs.rb) + +2.3.7 +- Bugfixes + - Generate pkgconfig (.pc) files correctly + - Require SWIG > 2.0.4 for building + 2.3.6 - Features - Plugins: Ability to redirect requests to a different WS-Management diff -Nru openwsman-2.3.6/cmake/modules/FindRuby.cmake openwsman-2.4.3/cmake/modules/FindRuby.cmake --- openwsman-2.3.6/cmake/modules/FindRuby.cmake 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/cmake/modules/FindRuby.cmake 2013-12-23 04:47:33.000000000 -0600 @@ -57,10 +57,15 @@ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorarchdir']" OUTPUT_VARIABLE RUBY_VENDORARCH_DIR ERROR_QUIET) -IF(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") +IF(RUBY_VENDORARCH_DIR) + IF(${RUBY_VENDORARCH_DIR} STREQUAL "nil") + ELSE(${RUBY_VENDORARCH_DIR} STREQUAL "nil") EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']" OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) -ELSE(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") + ENDIF(${RUBY_VENDORARCH_DIR} STREQUAL "nil") +ENDIF(RUBY_VENDORARCH_DIR) + +IF(NOT RUBY_VENDORLIB_DIR) # fall back to site*dir EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" @@ -68,7 +73,8 @@ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitelibdir']" OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) -ENDIF(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") + +ENDIF(NOT RUBY_VENDORLIB_DIR) # this is not needed if you use "print" inside the ruby statements # remove the new lines from the output by replacing them with empty strings diff -Nru openwsman-2.3.6/CMakeLists.txt openwsman-2.4.3/CMakeLists.txt --- openwsman-2.3.6/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -159,16 +159,8 @@ IF( BUILD_RUBY ) INCLUDE(FindRuby) -IF( RUBY_VERSION_MAJOR EQUAL 2) - MESSAGE(ERROR "Ruby 2.x not supported yet") -ENDIF( RUBY_VERSION_MAJOR EQUAL 2 ) - IF( RUBY_VERSION VERSION_LESS "1.9.0" ) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_SITEARCH_DIR) - ELSE( RUBY_VERSION VERSION_LESS "1.9.0" ) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_SITEARCH_DIR) - ENDIF( RUBY_VERSION VERSION_LESS "1.9.0" ) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" + OUTPUT_VARIABLE RUBY_SITEARCH_DIR) MESSAGE(STATUS "Building Ruby bindings" ) IF(NOT RUBY_INCLUDE_PATH) @@ -230,9 +222,18 @@ FIND_PACKAGE(SWIG) IF( NOT SWIG_EXECUTABLE) FIND_PROGRAM(SWIG_EXECUTABLE - NAMES swig-1.3 swig + NAMES swig PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin ) + SET(SWIG_VERSION "(unknown version)") + ELSE ( NOT SWIG_EXECUTABLE) + # FIND_PACKAGE(SWIG) succeeded, now check the version + # swig 2.0.4 and lower is known to be broken + IF (SWIG_VERSION) + IF(${SWIG_VERSION} VERSION_LESS "2.0.5") + MESSAGE( FATAL_ERROR "Found SWIG version ${SWIG_VERSION}, please upgrade SWIG to 2.0.5 or later" ) + ENDIF(${SWIG_VERSION} VERSION_LESS "2.0.5") + ENDIF (SWIG_VERSION) ENDIF( NOT SWIG_EXECUTABLE) ENDIF( BUILD_BINDINGS ) @@ -246,7 +247,7 @@ MESSAGE( ERROR "Cannot build client bindings" ) ENDIF( BUILD_PYTHON_EXPLICIT OR BUILD_RUBY_EXPLICIT OR BUILD_PERL_EXPLICIT OR BUILD_JAVA_EXPLICIT) ELSE ( NOT SWIG_EXECUTABLE ) - MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" ) + MESSAGE( STATUS "SWIG ${SWIG_VERSION} found at ${SWIG_EXECUTABLE}" ) ADD_SUBDIRECTORY(bindings) ENDIF ( NOT SWIG_EXECUTABLE ) @@ -465,8 +466,11 @@ SET("prefix" ${CMAKE_INSTALL_PREFIX}) SET("includedir" ${CMAKE_INSTALL_PREFIX}/include) SET("libdir" ${LIB_INSTALL_DIR}) +# Library names ! SET(WSMAN_PKG wsman) +SET(WSMAN_SERVER_PKG wsman_server) SET(WSMAN_CLIENT_PKG wsman_client) +SET(WSMAN_CLIENTPP_PKG wsman_clientpp) SET(WSMAN_CLIENT_TRANSPORT_PKG wsman_curl_client_transport) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/wsman_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/wsman_config.h) diff -Nru openwsman-2.3.6/configure.in openwsman-2.4.3/configure.in --- openwsman-2.3.6/configure.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/configure.in 2013-12-23 04:47:33.000000000 -0600 @@ -3,7 +3,7 @@ dnl ******************************************* AC_PREREQ(2.53) -AC_INIT(openwsman, 2.3.6) +AC_INIT(openwsman, 2.3.7) AC_CONFIG_SRCDIR(src/server/wsmand.c) AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) diff -Nru openwsman-2.3.6/debian/changelog openwsman-2.4.3/debian/changelog --- openwsman-2.3.6/debian/changelog 2013-02-15 05:01:14.000000000 -0600 +++ openwsman-2.4.3/debian/changelog 2014-01-13 13:50:58.000000000 -0600 @@ -1,3 +1,18 @@ +openwsman (2.4.3-0ubuntu2) trusty; urgency=low + + * Add bug link. (LP: #1268707) + + -- Kent Baxley Mon, 13 Jan 2014 13:50:24 -0600 + +openwsman (2.4.3-0ubuntu1) trusty; urgency=low + + * Sync with upstream 2.4.3 + * debian/control: bump standards version to 3.9.5 + * debian/patches: removed cmake-findruby.patch. FTBS no longer occurs due to + overhauled ruby cmake file upstream. + + -- Kent Baxley Mon, 13 Jan 2014 12:11:37 -0600 + openwsman (2.3.6-0ubuntu1) raring; urgency=low * Sync with upstream 2.3.6 diff -Nru openwsman-2.3.6/debian/control openwsman-2.4.3/debian/control --- openwsman-2.3.6/debian/control 2013-02-15 05:02:02.000000000 -0600 +++ openwsman-2.4.3/debian/control 2014-01-13 13:20:08.000000000 -0600 @@ -1,9 +1,9 @@ Source: openwsman -Section: universe/admin +Section: admin Priority: extra Maintainer: Ubuntu Developers Build-Depends: debhelper (>= 9.0.0), cmake (>= 2.8.5), libssl-dev, libpam0g-dev, libxml2-dev, libcurl4-openssl-dev, libcimcclient0-dev, swig, python-dev -Standards-Version: 3.9.2 +Standards-Version: 3.9.5 Homepage: http://sourceforge.net/projects/openwsman/ Package: openwsman @@ -36,6 +36,7 @@ This package provides the core run-time libraries. Package: libopenwsman-dev +Section: libdevel Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libopenwsman1 (= ${binary:Version}), openwsman (= ${binary:Version}) Description: Open Web Services Manager library development files @@ -64,6 +65,7 @@ This package provides the C++ bindings to the Openwsman client libraries Package: libwsman-clientpp-dev +Section: libdevel Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libwsman-clientpp1 (= ${binary:Version}) Description: Open Web Services Manager C++ bindings development files @@ -78,6 +80,7 @@ Openwsman client libraries Package: python-openwsman +Section: python Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libopenwsman1 (= ${binary:Version}) Description: Open Web Services Manager Python bindings diff -Nru openwsman-2.3.6/debian/patches/cmake-findruby.patch openwsman-2.4.3/debian/patches/cmake-findruby.patch --- openwsman-2.3.6/debian/patches/cmake-findruby.patch 2013-01-09 08:13:02.000000000 -0600 +++ openwsman-2.4.3/debian/patches/cmake-findruby.patch 1969-12-31 18:00:00.000000000 -0600 @@ -1,32 +0,0 @@ -Description: Fix FTBS in FindRuby cmake script - Upstream release 2.3.6 contains this bug which was discovered on - build-test. -Forwarded: pending -Author: Stefan Bader -Last-Update: 2012-12-11 -Index: openwsman-2.3.6/cmake/modules/FindRuby.cmake -=================================================================== ---- openwsman-2.3.6.orig/cmake/modules/FindRuby.cmake 2012-11-07 15:11:22.000000000 +0100 -+++ openwsman-2.3.6/cmake/modules/FindRuby.cmake 2012-12-11 16:28:36.950856062 +0100 -@@ -57,10 +57,10 @@ EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABL - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorarchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR ERROR_QUIET) - --IF(RUBY_VENDORARCH_DIR AND NOT(${RUBY_VENDORARCH_DIR} STREQUAL "nil")) -+IF(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) --ELSE(RUBY_VENDORARCH_DIR AND NOT(${RUBY_VENDORARCH_DIR} STREQUAL "nil")) -+ELSE(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") - - # fall back to site*dir - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" -@@ -68,7 +68,7 @@ ELSE(RUBY_VENDORARCH_DIR AND NOT(${RUBY_ - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitelibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) --ENDIF(RUBY_VENDORARCH_DIR AND NOT(${RUBY_VENDORARCH_DIR} STREQUAL "nil")) -+ENDIF(RUBY_VENDORARCH_DIR AND NOT ${RUBY_VENDORARCH_DIR} STREQUAL "nil") - - # this is not needed if you use "print" inside the ruby statements - # remove the new lines from the output by replacing them with empty strings diff -Nru openwsman-2.3.6/debian/patches/series openwsman-2.4.3/debian/patches/series --- openwsman-2.3.6/debian/patches/series 2013-01-09 08:06:46.000000000 -0600 +++ openwsman-2.4.3/debian/patches/series 2014-01-13 12:21:13.000000000 -0600 @@ -1,2 +1 @@ -cmake-findruby.patch cmake-python-includes.patch diff -Nru openwsman-2.3.6/etc/openwsman.conf openwsman-2.4.3/etc/openwsman.conf --- openwsman-2.3.6/etc/openwsman.conf 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/etc/openwsman.conf 2013-12-23 04:47:33.000000000 -0600 @@ -4,6 +4,7 @@ # ################################## [server] +# port to accept http requests port = 5985 # @@ -26,10 +27,18 @@ ipv4 = yes ipv6 = yes +# port to accept https requests #ssl_port = 5986 + +# the openwsman server certificate file, in .pem format ssl_cert_file = /etc/openwsman/servercert.pem +# the openwsman server private key, in .pem format ssl_key_file = /etc/openwsman/serverkey.pem + +# set these to enable digest authentication against a local datbase #digest_password_file = /etc/openwsman/digest_auth.passwd + +# set these to enable basic authentication against a local datbase #basic_password_file = /etc/openwsman/simple_auth.passwd min_threads = 4 @@ -82,7 +91,7 @@ #indication_profile_implementation_ns = root/interop # The following are in part fake namespaces for some publicly available CIM implementations. -vendor_namespaces = OpenWBEM=http://schema.openwbem.org/wbem/wscim/1/cim-schema/2,Linux=http://sblim.sf.net/wbem/wscim/1/cim-schema/2,OMC=http://schema.omc-project.org/wbem/wscim/1/cim-schema/2,PG=http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2 +vendor_namespaces = OpenWBEM=http://schema.openwbem.org/wbem/wscim/1/cim-schema/2,Linux=http://sblim.sf.net/wbem/wscim/1/cim-schema/2,OMC=http://schema.omc-project.org/wbem/wscim/1/cim-schema/2,PG=http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2,RCP=http://schema.suse.com/wbem/wscim/1/cim-schema/2 # CIMOM host, default is localhost # host = localhost @@ -101,3 +110,7 @@ # boolean # omit_schema_optional = 0 + +# Redirect module, see redirect.conf for details +#[redirect] +#include='/etc/openwsman/redirect.conf' diff -Nru openwsman-2.3.6/etc/owsmangencert.sh.in openwsman-2.4.3/etc/owsmangencert.sh.in --- openwsman-2.3.6/etc/owsmangencert.sh.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/etc/owsmangencert.sh.in 2013-12-23 04:47:33.000000000 -0600 @@ -18,7 +18,7 @@ FQDN=localhost.localdomain fi echo -echo creating selfsingned certificate +echo creating selfsigned certificate echo "replace it with one signed by a certification authority (CA)" echo #echo enter your ServerName at the Common Name prompt @@ -42,4 +42,3 @@ chmod 600 $KEYFILE - diff -Nru openwsman-2.3.6/etc/redirect.conf openwsman-2.4.3/etc/redirect.conf --- openwsman-2.3.6/etc/redirect.conf 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/etc/redirect.conf 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,53 @@ +################################## +# +# settings for the Redirect plugin +# (WS-Management forwarding) +# +# This module can proxy/forward/redirect requests to another WS-Management server +# A typical scenario is Dell's "Integrated Dell Remote Access Controller" (iDRAC) +# which acts as a baseboard management controller (out of band management) but has +# it's own network configuration. +# +# The redirect plugin allows the host to forward WS-Management request to this +# controller. For the client, in-band (talking to host) and out of band (talking +# to iDrac) only differs in the resource URI. +################################## + +# server to redirect to +server='hostname-or-ip' +# port for server +port=443 + +# resource URI prefix, must be different from known prefixes +resource='http://schemas.dell.com/wbem/wscim/1/cim-schema/2' + +# credentials for the remote server +username='user' +password='pass' +authentication_method='basic' + +# path for SOAP requests +url_path='/wsman' + +cim_namespace='root/cimv2' + +# empty: http, non-empty: https +# +# Pass a string naming a file holding one or more certificates to verify the peer with. +# This makes sense only when used in combination with the noverifypeer=0 option +# If noverifypeer=1, cacert need not even indicate an accessible file. +cacert='dummy.pem' + +# if certificates need to be verified +noverifypeer=1 +noverifyhost=1 + +# File of the private key, in .pem format +sslkey= + +# File of your certificate, in .pem format +# With NSS or Secure Transport, this can also be the nickname of the certificate you wish +# to authenticate with as it is named in the security database. +# If you want to use a file from the current directory, please precede it with "./" prefix, +# in order to avoid confusion with a nickname. +cl_cert= diff -Nru openwsman-2.3.6/examples/serialize.c openwsman-2.4.3/examples/serialize.c --- openwsman-2.3.6/examples/serialize.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/examples/serialize.c 2013-12-23 04:47:33.000000000 -0600 @@ -184,7 +184,7 @@ } - retval = memcmp(cs, &servie, sizeof(&servie)); + retval = memcmp(cs, &servie, sizeof(servie)); if (retval) { printf("Not compared (%d) - FAILED\n", retval); printf("%d : %d\n", servie.AcceptPause, cs->AcceptPause); diff -Nru openwsman-2.3.6/include/wsman-client-api.h openwsman-2.4.3/include/wsman-client-api.h --- openwsman-2.3.6/include/wsman-client-api.h 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/include/wsman-client-api.h 2013-12-23 04:47:33.000000000 -0600 @@ -105,6 +105,7 @@ // accepted and we failed to login WS_LASTERR_BAD_CRL_FILE, //bad CRL file provided (Format, Path or permission) + WS_LASTERR_CURL_BAD_FUNCTION_ARG, // bad function arg calling curl WS_LASTERR_LAST // never use! } WS_LASTERR_Code; @@ -191,6 +192,7 @@ unsigned int timeout; unsigned int max_envelope_size; unsigned int max_elements; + hash_t *options; /* for WSM_OPTION_SET */ } client_opt_t; @@ -754,6 +756,9 @@ void wsmc_set_filter(filter_t *filter, client_opt_t * options); + void wsmc_add_option(client_opt_t * options, + const char *key, const char *value); + void wsmc_add_selector(client_opt_t * options, const char *key, const char *value); diff -Nru openwsman-2.3.6/include/wsman-server-api.h openwsman-2.4.3/include/wsman-server-api.h --- openwsman-2.3.6/include/wsman-server-api.h 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/include/wsman-server-api.h 2013-12-23 04:47:33.000000000 -0600 @@ -40,7 +40,10 @@ extern "C" { #endif /* __cplusplus */ -void *wsman_server_create_config(char *config_file); +typedef struct __Soap *ServerConfig; + +ServerConfig *wsman_server_create_config(char *config_file); +void wsman_server_destroy_config(ServerConfig *config); void wsman_server_get_response(void *arg, void *msg); void wsman_server_read_plugin_config(void *arg, char *config_file); void wsman_server_set_subscription_repos(char *repos); diff -Nru openwsman-2.3.6/openwsman.pc.in openwsman-2.4.3/openwsman.pc.in --- openwsman-2.3.6/openwsman.pc.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/openwsman.pc.in 2013-12-23 04:47:33.000000000 -0600 @@ -4,9 +4,9 @@ includedir=@includedir@ plugindir=${libdir}/openwsman/plugins -Name: @PACKAGE_NAME@ +Name: @PACKAGE@ Description: Opensource Implementation of WS-Management Client Version: @VERSION@ Requires: Libs: -L${libdir} -l@WSMAN_PKG@ -l@WSMAN_CLIENT_PKG@ -l@WSMAN_CLIENT_TRANSPORT_PKG@ -Cflags: -I${includedir}/@PACKAGE_NAME@ +Cflags: -I${includedir}/@PACKAGE@ diff -Nru openwsman-2.3.6/openwsman++.pc.in openwsman-2.4.3/openwsman++.pc.in --- openwsman-2.3.6/openwsman++.pc.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/openwsman++.pc.in 2013-12-23 04:47:33.000000000 -0600 @@ -3,9 +3,9 @@ libdir=@libdir@ includedir=@includedir@ -Name: openwsman++ +Name: @PACKAGE@++ Description: Opensource Implementation of WS-Management Client Version: @VERSION@ Requires: Libs: -L${libdir} -l@WSMAN_PKG@ -l@WSMAN_CLIENTPP_PKG@ -Cflags: -I${includedir}/@PACKAGE_NAME@ -I${includedir}/@PACKAGE_NAME@/cpp +Cflags: -I${includedir}/@PACKAGE@ -I${includedir}/@PACKAGE@/cpp diff -Nru openwsman-2.3.6/openwsman-server.pc.in openwsman-2.4.3/openwsman-server.pc.in --- openwsman-2.3.6/openwsman-server.pc.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/openwsman-server.pc.in 2013-12-23 04:47:33.000000000 -0600 @@ -3,9 +3,9 @@ libdir=@libdir@ includedir=@includedir@ -Name: @PACKAGE_NAME@-server +Name: @PACKAGE@-server Description: Opensource Implementation of WS-Management / Server Version: @VERSION@ Requires: -Libs: -L${libdir} -l@WSMAN_PKG@ -l@WSMAN_SERVER_PKG@ -Cflags: -I${includedir}/@PACKAGE_NAME@ +Libs: -L${libdir} -l@WSMAN_PKG@ -l@WSMAN_SERVER_PKG@ +Cflags: -I${includedir}/@PACKAGE@ diff -Nru openwsman-2.3.6/package/openwsman.spec.in openwsman-2.4.3/package/openwsman.spec.in --- openwsman-2.3.6/package/openwsman.spec.in 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/package/openwsman.spec.in 2013-12-23 04:47:33.000000000 -0600 @@ -1,7 +1,7 @@ # # spec file for package openwsman # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 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 @@ -28,7 +28,7 @@ BuildRequires: libxml2-devel BuildRequires: pam-devel BuildRequires: sblim-sfcc-devel -BuildRequires: swig >= 1.3.30 +BuildRequires: swig >= 2.0.5 BuildRequires: perl BuildRequires: python-devel @@ -43,7 +43,7 @@ %if 0%{?fedora} == 16 || (0%{?centos_version}>=500 && 0%{?centos_version}<700) || (0%{?rhel_version}>=500 && 0%{?rhel_version}<700) BuildRequires: java-1.6.0-openjdk-devel %else -%if 0%{?fedora} == 17 +%if 0%{?fedora} >= 17 BuildRequires: java-1.7.0-openjdk-devel %else BuildRequires: java-devel @@ -54,12 +54,13 @@ BuildRequires: pkgconfig BuildRequires: ruby -# RHEL6 is missing ruby-devel in OBS -%if 0%{?rhel_version} != 600 BuildRequires: ruby-devel -%if 0%{?fedora} != 17 +%if 0%{?fedora} == 0 BuildRequires: ruby-rdoc %endif + +%if 0%{?fedora} == 19 +BuildRequires: rubypick %endif %if 0%{?fedora} > 0 || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 @@ -88,7 +89,6 @@ %endif %if 0%{?suse_version} > 910 -BuildRequires: ruby-devel %if 0%{?suse_version} < 1110 # SLE 10 has Ruby 1.8.6 and runs into http://help.rubygems.org/discussions/problems/859-trying-to-install-rubygems BuildRequires: rubygems <= 1.3.7 @@ -96,6 +96,7 @@ BuildRequires: rubygems %endif BuildRequires: pkg-config +BuildRequires: ruby-devel %else # SLE9 BuildRequires: pkgconfig @@ -171,7 +172,7 @@ %package -n libwsman_clientpp-devel Summary: C++ bindings to Openwsman Client libraries -Group: System/Management +Group: Development/Libraries/C and C++ Requires: libwsman-devel = %{version} Requires: libwsman_clientpp1 = %{version} @@ -183,6 +184,8 @@ Requires(pre): sed coreutils grep diffutils /bin/hostname %if 0%{?suse_version} Requires(pre): fillup +# for pam_unix2 and pam_pwcheck +Requires: pam-modules %endif Summary: Openwsman Server and service libraries Group: System/Management @@ -206,7 +209,13 @@ %package ruby Requires: ruby + +# RbConfig::CONFIG["ruby_version"] is empty in Fedora 19 !? +%if 0%{?fedora} == 19 +%{!?ruby_version: %global ruby_version %(ruby -r rbconfig -e 'print(RbConfig::CONFIG["RUBY_PROGRAM_VERSION"])')} +%else %{!?ruby_version: %global ruby_version %(ruby -r rbconfig -e 'print(RbConfig::CONFIG["ruby_version"])')} +%endif %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel} Requires: ruby(abi) = %{ruby_version} @@ -240,6 +249,14 @@ %description ruby This package provides Ruby bindings to access the openwsman client API. +%package ruby-docs +Summary: HTML documentation for Opendwsman Ruby bindings +Group: Documentation/HTML + +%description ruby-docs +This package provides HTML documentation for the Openwsman Ruby +bindings. + %package perl %if 0%{?fedora} @@ -286,6 +303,7 @@ %endif # SLES 10 needs explicit java bytecode target %if 0%{?suse_version} == 1010 || 0%{?suse_version} == 1110 +export EXPLICIT_SOURCE=1.5 export EXPLICIT_TARGET=1.5 %endif @@ -299,6 +317,7 @@ -DCMAKE_CXX_FLAGS_RELEASE:STRING="$RPM_OPT_FLAGS" \ -DCMAKE_SKIP_RPATH=1 \ -DPACKAGE_ARCHITECTURE=`uname -m` \ + -DEXPLICIT_SOURCE="$EXPLICIT_SOURCE" \ -DEXPLICIT_TARGET="$EXPLICIT_TARGET" \ -DLIB=%{_lib} \ -DBUILD_RUBY_GEM=no \ @@ -309,6 +328,8 @@ %install cd build make DESTDIR=$RPM_BUILD_ROOT install +mkdir -p $RPM_BUILD_ROOT%{_docdir} +cp -a bindings/ruby/html $RPM_BUILD_ROOT%{_docdir}/openwsman-ruby-docs cd .. rm -f $RPM_BUILD_ROOT%{_libdir}/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/openwsman/plugins/*.la @@ -340,7 +361,7 @@ # follow http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines %if 0%{?has_systemd} %pre server -if [-f /var/lib/systemd/migrated/%{name}]; then +if [ -f /var/lib/systemd/migrated/%{name} ]; then %service_add_pre %{name}.service fi %endif @@ -388,7 +409,7 @@ %files -n libwsman1 %defattr(-,root,root) -%doc AUTHORS COPYING ChangeLog README.md TODO +%doc AUTHORS COPYING ChangeLog README.md TODO src/plugins/redirect/redirect-README %{_libdir}/libwsman.so.* %{_libdir}/libwsman_client.so.* %{_libdir}/libwsman_curl_client_transport.so.* @@ -407,9 +428,6 @@ %{python_sitearch}/*.so %{python_sitearch}/*.py* -# RHEL6 is missing ruby-devel in OBS -%if 0%{?rhel_version} != 600 - %files ruby %defattr(-,root,root) %if 0%{?mandriva_version} @@ -424,7 +442,10 @@ %{ruby_sitelib}/openwsman/*.rb %endif -%endif +%files ruby-docs +%defattr(-,root,root) +%dir %{_docdir}/openwsman-ruby-docs +%{_docdir}/openwsman-ruby-docs %files perl %defattr(-,root,root) diff -Nru openwsman-2.3.6/src/cpp/CMakeLists.txt openwsman-2.4.3/src/cpp/CMakeLists.txt --- openwsman-2.3.6/src/cpp/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/cpp/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -5,11 +5,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) SET( wsmaninclude_HEADERS OpenWsmanClient.h Exception.h WsmanClient.h WsmanFilter.h WsmanEPR.h ) -SET(wsman_clientpp_LIB_SRCS OpenWsmanClient.cpp ) -add_library(wsman_clientpp SHARED ${wsman_clientpp_LIB_SRCS}) +SET( wsman_clientpp_LIB_SRCS OpenWsmanClient.cpp ) +add_library( ${WSMAN_CLIENTPP_PKG} SHARED ${wsman_clientpp_LIB_SRCS}) -set_target_properties(wsman_clientpp PROPERTIES VERSION 1.0.0 SOVERSION 1) -install(TARGETS wsman_clientpp DESTINATION ${LIB_INSTALL_DIR}) +set_target_properties( ${WSMAN_CLIENTPP_PKG} PROPERTIES VERSION 1.0.0 SOVERSION 1) +install(TARGETS ${WSMAN_CLIENTPP_PKG} DESTINATION ${LIB_INSTALL_DIR}) install(FILES ${wsmaninclude_HEADERS} DESTINATION ${INCLUDE_DIR}/openwsman/cpp) diff -Nru openwsman-2.3.6/src/lib/CMakeLists.txt openwsman-2.4.3/src/lib/CMakeLists.txt --- openwsman-2.3.6/src/lib/CMakeLists.txt 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/CMakeLists.txt 2013-12-23 04:47:33.000000000 -0600 @@ -10,7 +10,7 @@ ADD_DEFINITIONS( -DPACKAGE_PLUGIN_DIR="\\\"${PACKAGE_PLUGIN_DIR}\\\"" ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML_CFLAGS} -g" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML_CFLAGS} -g -DIGNORE_DUPLICATE_ID" ) ########### wsman ############### @@ -32,7 +32,7 @@ endif( HAVE_LIBDL ) IF( ENABLE_EVENTING_SUPPORT ) -TARGET_LINK_LIBRARIES( wsman wsman_client ) +TARGET_LINK_LIBRARIES( wsman ${WSMAN_CLIENT_PKG} ) ENDIF( ENABLE_EVENTING_SUPPORT ) SET_TARGET_PROPERTIES(wsman PROPERTIES VERSION 1.0.0 SOVERSION 1) @@ -42,29 +42,28 @@ IF ( NOT DISABLE_SERVER ) SET( wsman_server_SOURCES wsman-server.c wsman-plugins.c wsman-server-api.c ) - ADD_LIBRARY( wsman_server SHARED ${wsman_server_SOURCES} ) - TARGET_LINK_LIBRARIES( wsman_server wsman ) - SET_TARGET_PROPERTIES(wsman_server PROPERTIES VERSION 1.0.0 SOVERSION 1) - INSTALL(TARGETS wsman_server DESTINATION ${LIB_INSTALL_DIR}) + ADD_LIBRARY( ${WSMAN_SERVER_PKG} SHARED ${wsman_server_SOURCES} ) + TARGET_LINK_LIBRARIES( ${WSMAN_SERVER_PKG} wsman ) + SET_TARGET_PROPERTIES( ${WSMAN_SERVER_PKG} PROPERTIES VERSION 1.0.0 SOVERSION 1) + INSTALL(TARGETS ${WSMAN_SERVER_PKG} DESTINATION ${LIB_INSTALL_DIR}) ENDIF ( NOT DISABLE_SERVER ) ########## wsman_curl_client_transport ############### SET( wsman_curl_client_transport_SOURCES wsman-client-transport.c wsman-curl-client-transport.c ) -ADD_LIBRARY( wsman_curl_client_transport SHARED ${wsman_curl_client_transport_SOURCES} ) -TARGET_LINK_LIBRARIES( wsman_curl_client_transport ${CURL_LIBRARIES} ) -SET_TARGET_PROPERTIES(wsman_curl_client_transport PROPERTIES VERSION 1.0.0 SOVERSION 1) -INSTALL(TARGETS wsman_curl_client_transport DESTINATION ${LIB_INSTALL_DIR}) +ADD_LIBRARY( ${WSMAN_CLIENT_TRANSPORT_PKG} SHARED ${wsman_curl_client_transport_SOURCES} ) +TARGET_LINK_LIBRARIES( ${WSMAN_CLIENT_TRANSPORT_PKG} ${CURL_LIBRARIES} ) +SET_TARGET_PROPERTIES( ${WSMAN_CLIENT_TRANSPORT_PKG} PROPERTIES VERSION 1.0.0 SOVERSION 1) +INSTALL(TARGETS ${WSMAN_CLIENT_TRANSPORT_PKG} DESTINATION ${LIB_INSTALL_DIR}) ############### wsman_client ############### - SET( wsman_client_SOURCES wsman-client.c ) -ADD_LIBRARY( wsman_client SHARED ${wsman_client_SOURCES} ) -TARGET_LINK_LIBRARIES( wsman_client wsman_curl_client_transport ) -SET_TARGET_PROPERTIES(wsman_client PROPERTIES VERSION 1.0.0 SOVERSION 1) -INSTALL(TARGETS wsman_client DESTINATION ${LIB_INSTALL_DIR}) +ADD_LIBRARY( ${WSMAN_CLIENT_PKG} SHARED ${wsman_client_SOURCES} ) +TARGET_LINK_LIBRARIES( ${WSMAN_CLIENT_PKG} wsman_curl_client_transport ) +SET_TARGET_PROPERTIES( ${WSMAN_CLIENT_PKG} PROPERTIES VERSION 2.0.0 SOVERSION 2) +INSTALL(TARGETS ${WSMAN_CLIENT_PKG} DESTINATION ${LIB_INSTALL_DIR}) # #EXTRA_DIST = \ diff -Nru openwsman-2.3.6/src/lib/wsman-client.c openwsman-2.4.3/src/lib/wsman-client.c --- openwsman-2.3.6/src/lib/wsman-client.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-client.c 2013-12-23 04:47:33.000000000 -0600 @@ -321,6 +321,9 @@ void wsmc_options_destroy(client_opt_t * op) { + if (op->options) { + hash_free(op->options); + } if (op->selectors) { hash_free(op->selectors); } @@ -376,6 +379,27 @@ } } +/* + * add key/value pair to WSM_OPTION_SET + * + */ +void +wsmc_add_option(client_opt_t * options, + const char *key, + const char *value) +{ + if (options->options == NULL) + options->options = hash_create(HASHCOUNT_T_MAX, 0, 0); + if (!hash_lookup(options->options, key)) { + if (!hash_alloc_insert(options->options, + (char *)key, (char *)value)) { + error( "hash_alloc_insert failed"); + } + } else { + error( "duplicate not added to hash"); + } +} + void wsmc_add_selector(client_opt_t * options, const char *key, @@ -432,11 +456,12 @@ while ((hn = hash_scan_next(&hs))) { wsman_add_selector(header, (char *) hnode_getkey(hn), (char *) hnode_get(hn)); - debug("key = %s value=%s", + debug("key=%s value=%s", (char *) hnode_getkey(hn), (char *) hnode_get(hn)); } } +/* Err: should be wsmc_set_selectors_from_uri() */ void wsmc_set_options_from_uri(const char *resource_uri, client_opt_t * options) { @@ -835,9 +860,10 @@ request = ws_xml_create_envelope(); } else { if (method) { + /* WSA_ACTION is a URI */ if (strchr(method, '/')) _action = u_strdup(method); - else + else /* 'invoke' action */ _action = wsman_make_action((char *)resource_uri, method); } else { _action = wsmc_create_action_str(action); @@ -857,9 +883,13 @@ if (!body || !header ) return NULL; /* - * flags to be passed as > */ - if (options && (options->flags & (FLAG_CIM_EXTENSIONS|FLAG_EXCLUDE_NIL_PROPS))) { - WsXmlNodeH opset = ws_xml_add_child(header, + * flags to be passed as > + */ + if (options) { + WsXmlNodeH opset = NULL; + if (options->flags & (FLAG_CIM_EXTENSIONS|FLAG_EXCLUDE_NIL_PROPS)) { + /* need WSM_OPTION_SET */ + opset = ws_xml_add_child(header, XML_NS_WS_MAN, WSM_OPTION_SET, NULL); if ((options->flags & FLAG_CIM_EXTENSIONS) == FLAG_CIM_EXTENSIONS) { WsXmlNodeH op = ws_xml_add_child(opset, @@ -872,6 +902,22 @@ XML_NS_OPENWSMAN, WSM_OPTION, NULL); ws_xml_add_node_attr(op, NULL, WSM_NAME, WSMB_EXCLUDE_NIL_PROPS); } + } + if (options->options && hash_count(options->options) > 0) { + hnode_t *hn; + hscan_t hs; + hash_scan_begin(&hs, options->options); + if (!opset) { + opset = ws_xml_add_child(header, + XML_NS_WS_MAN, WSM_OPTION_SET, NULL); + } + while ((hn = hash_scan_next(&hs))) { + WsXmlNodeH op = ws_xml_add_child(opset, + XML_NS_WS_MAN, WSM_OPTION, NULL); + ws_xml_add_node_attr(op, NULL, WSM_NAME, (char *) hnode_getkey(hn)); + ws_xml_set_node_text(op, (char *) hnode_get(hn)); + } + } } @@ -1271,10 +1317,12 @@ (char *) hnode_get(hn)); } } - } else { + } else if (!strchr(method, '/')) { /* non-custom method without parameters */ ws_xml_add_empty_child_format(body, (char *)resource_uri, "%s_INPUT", method); - } + } else { + /* empty body */ + } if ((options->flags & FLAG_DUMP_REQUEST) == FLAG_DUMP_REQUEST) { ws_xml_dump_node_tree(cl->dumpfile, ws_xml_get_doc_root(request)); } diff -Nru openwsman-2.3.6/src/lib/wsman-client-transport.c openwsman-2.4.3/src/lib/wsman-client-transport.c --- openwsman-2.3.6/src/lib/wsman-client-transport.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-client-transport.c 2013-12-23 04:47:33.000000000 -0600 @@ -509,6 +509,8 @@ return "Unrecognized transfer encoding"; case WS_LASTERR_LOGIN_DENIED: return "User, password or similar was not accepted"; + case WS_LASTERR_CURL_BAD_FUNCTION_ARG: + return "Internal error: Wrong function argument in call to CURL"; default: return "Unrecognized error"; } diff -Nru openwsman-2.3.6/src/lib/wsman-curl-client-transport.c openwsman-2.4.3/src/lib/wsman-curl-client-transport.c --- openwsman-2.3.6/src/lib/wsman-curl-client-transport.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-curl-client-transport.c 2013-12-23 04:47:33.000000000 -0600 @@ -182,6 +182,8 @@ return WS_LASTERR_TOO_MANY_REDIRECTS; case CURLE_SSL_CONNECT_ERROR: return WS_LASTERR_SSL_CONNECT_ERROR; + case CURLE_BAD_FUNCTION_ARGUMENT: + return WS_LASTERR_CURL_BAD_FUNCTION_ARG; case CURLE_SSL_PEER_CERTIFICATE: return WS_LASTERR_SSL_PEER_CERTIFICATE; case CURLE_SSL_ENGINE_NOTFOUND: @@ -276,14 +278,14 @@ } debug("cl->authentication.verify_peer: %d", cl->authentication.verify_peer ); // verify peer - r = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, cl->authentication.verify_peer); + r = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, wsman_transport_get_verify_peer(cl)?1:0); if (r != 0) { curl_err("curl_easy_setopt(CURLOPT_SSL_VERIFYPEER) failed"); goto DONE; } // verify host - r = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, cl->authentication.verify_host); + r = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, wsman_transport_get_verify_host(cl)?2:0); if (r != 0) { curl_err("curl_easy_setopt(CURLOPT_SSL_VERIFYHOST) failed"); goto DONE; @@ -412,12 +414,11 @@ } if (cl->transport == NULL) { cl->transport = init_curl_transport(cl); + if (cl->transport == NULL) { + return; + } } curl = (CURL *)cl->transport; - if (curl == NULL) { - cl->last_error = WS_LASTERR_FAILED_INIT; - return; - } r = curl_easy_setopt(curl, CURLOPT_URL, cl->data.endpoint); if (r != CURLE_OK) { diff -Nru openwsman-2.3.6/src/lib/wsman-dispatcher.c openwsman-2.4.3/src/lib/wsman-dispatcher.c --- openwsman-2.3.6/src/lib/wsman-dispatcher.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-dispatcher.c 2013-12-23 04:47:33.000000000 -0600 @@ -312,6 +312,7 @@ n = ws_xml_get_child(header, 0, XML_NS_ADDRESSING, WSA_FAULT_TO); if (n != NULL) { + debug("wsa:FaultTo is not supported"); retVal = 1; generate_op_fault(op, WSMAN_UNSUPPORTED_FEATURE, WSMAN_DETAIL_ADDRESSING_MODE); diff -Nru openwsman-2.3.6/src/lib/wsman-epr.c openwsman-2.4.3/src/lib/wsman-epr.c --- openwsman-2.3.6/src/lib/wsman-epr.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-epr.c 2013-12-23 04:47:33.000000000 -0600 @@ -135,13 +135,13 @@ if(entry->type == 0) { p->type = 0; p->value = u_strdup(entry->entry.text); - debug("key = %s value=%s", + debug("key=%s value=%s", (char *) hnode_getkey(hn), p->value); } else { p->type = 1; p->value = (char *)epr_copy(entry->entry.eprp); - debug("key = %s value=%p(nested epr)", + debug("key=%s value=%p(nested epr)", (char *) hnode_getkey(hn), p->value); } p++; diff -Nru openwsman-2.3.6/src/lib/wsman-faults.c openwsman-2.4.3/src/lib/wsman-faults.c --- openwsman-2.3.6/src/lib/wsman-faults.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-faults.c 2013-12-23 04:47:33.000000000 -0600 @@ -610,7 +610,6 @@ char *subcode_value=ws_xml_get_xpath_value(doc, FAULT_SUBCODE_VALUE_XPATH); char *subcode_value_msg =calloc(1,strlen(subcode_value)); char *start_pos = strchr(subcode_value,':'); - int copy_len = strlen (subcode_value) - (int)(start_pos - subcode_value); strcpy(subcode_value_msg, start_pos+1); if (strlen(subcode_value)== 0 ) return ; diff -Nru openwsman-2.3.6/src/lib/wsman-filter.c openwsman-2.4.3/src/lib/wsman-filter.c --- openwsman-2.3.6/src/lib/wsman-filter.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-filter.c 2013-12-23 04:47:33.000000000 -0600 @@ -94,12 +94,12 @@ if(entry->type == 1) { p->type = 1; p->value = (char *)epr_copy(entry->entry.eprp); - debug("key = %s value=%p(nested epr)", + debug("key=%s value=%p(nested epr)", (char *) hnode_getkey(hn), p->value); } else { p->type = 0; p->value = u_strdup(entry->entry.text); - debug("key = %s value=%s", + debug("key=%s value=%s", (char *) hnode_getkey(hn), p->value); } p++; diff -Nru openwsman-2.3.6/src/lib/wsman-libxml2-binding.c openwsman-2.4.3/src/lib/wsman-libxml2-binding.c --- openwsman-2.3.6/src/lib/wsman-libxml2-binding.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-libxml2-binding.c 2013-12-23 04:47:33.000000000 -0600 @@ -489,15 +489,15 @@ * Compensate for this here. */ if (xmlNs == NULL && strcmp(prefix,"xml") == 0 - && strcmp(uri,XML_XML_NAMESPACE)== 0) { + && strcmp(uri, (const char *)XML_XML_NAMESPACE) == 0) { xmlNs = (xmlNsPtr) u_zalloc(sizeof(xmlNs)); if (xmlNs == NULL) { error("Couldn't create a new Namespace structure"); return(NULL); } xmlNs->type = XML_LOCAL_NAMESPACE; - xmlNs->href = xmlStrdup(uri); - xmlNs->prefix = xmlStrdup(prefix); + xmlNs->href = xmlStrdup((const xmlChar *)uri); + xmlNs->prefix = xmlStrdup((const xmlChar *)prefix); } } } @@ -817,7 +817,7 @@ { xmlNodePtr n = (xmlNodePtr) node; - xmlDocPtr d = (xmlDocPtr) doc; + xmlDocPtr d = (xmlDocPtr) doc->parserDoc; xmlElemDump(f, d, n); } diff -Nru openwsman-2.3.6/src/lib/wsman-server-api.c openwsman-2.4.3/src/lib/wsman-server-api.c --- openwsman-2.3.6/src/lib/wsman-server-api.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/lib/wsman-server-api.c 2013-12-23 04:47:33.000000000 -0600 @@ -94,7 +94,14 @@ } } -void *wsman_server_create_config(char *config_file) +/* + * Create server config (from ini-style config file) + * + * call wsman_server_destroy_config() to de-allocate the returned pointer + * + */ + +ServerConfig *wsman_server_create_config(char *config_file) { SoapH soap = NULL; dictionary *ini; @@ -115,7 +122,24 @@ soap->listener = (WsManListenerH *)listener; } //debug_add_handler (debug_message_handler, DEBUG_LEVEL_ALWAYS, NULL); - return (void *) soap; + return (ServerConfig *)soap; +} + + +void wsman_server_destroy_config(ServerConfig *config) +{ + SoapH soap = (SoapH)config; + if (soap == NULL) + return; + if (soap->listener) { +#if 0 + if (soap->listener->config) { + iniparser_free(soap->listener->config); + } +#endif + u_free(soap->listener); + } + soap_destroy(soap); } diff -Nru openwsman-2.3.6/src/plugins/cim/sfcc-interface.c openwsman-2.4.3/src/plugins/cim/sfcc-interface.c --- openwsman-2.3.6/src/plugins/cim/sfcc-interface.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/plugins/cim/sfcc-interface.c 2013-12-23 04:47:33.000000000 -0600 @@ -1632,7 +1632,7 @@ &rc); if (cimclient == NULL) { - debug( "*** Connection to CIMOM %s://%s:%s failed with %d:%s", frontend, cim_host, cim_port, rc.rc, rc.msg ? CMGetCharPtr(rc.msg) : "?"); + debug( "*** Connection to CIMOM %s://%s:%s failed with %d:%s", frontend, cim_host, cim_port, rc.rc, rc.msg ? CMGetCharPtr(rc.msg) : "NewCIMCEnv failed in sfcc"); } else { debug("new cimclient: 0x%8x", cimclient); debug("new cimclient: %d", cimclient->ft->ftVersion); diff -Nru openwsman-2.3.6/src/plugins/redirect/redirect.c openwsman-2.4.3/src/plugins/redirect/redirect.c --- openwsman-2.3.6/src/plugins/redirect/redirect.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/plugins/redirect/redirect.c 2013-12-23 04:47:33.000000000 -0600 @@ -44,7 +44,7 @@ SER_START_ITEMS(Redirect) SER_END_ITEMS(Redirect); -//As the data value in endPoints is not used, setting it to NULL for now +/*As the data value in endPoints is not used, setting it to NULL for now*/ START_END_POINTS(Redirect) END_POINT_TRANSFER_DIRECT_GET(Redirect, NULL), END_POINT_TRANSFER_DIRECT_PUT(Redirect, NULL), @@ -96,7 +96,7 @@ int init( void *self, void **data ) { char* filename; - dictionary *ini; + dictionary *ini, *inc_ini; filename = (char *) wsmand_options_get_config_file(); ini = iniparser_new(filename); @@ -106,12 +106,25 @@ return 0; } - //Check if the conf file has the required fields populated. + /*Check if the conf file has the required fields populated.*/ if ( iniparser_getstring(ini, "redirect:server", NULL) ==NULL || - iniparser_getstring(ini, "redirect:namespace", NULL) ==NULL + iniparser_getstring(ini, "redirect:resource", NULL) ==NULL ){ + /*if the redirection details are not provided in the core config file, check for an include tag, and check file in the include tag*/ - error("The required inputs are not provided in the config file"); + filename=iniparser_getstring(ini,"redirect:include",NULL); + if (filename == NULL) goto err_out; + + inc_ini=iniparser_new(filename); + if (inc_ini == NULL) goto err_out; + + + if ( iniparser_getstring(inc_ini, ":server",NULL) != NULL && + iniparser_getstring(inc_ini,":resource",NULL) != NULL ) + return 1; /*the inputs are fine */ + + err_out: + error("Redirect Plugin: The required inputs are not provided in the config file"); return 0; } @@ -126,12 +139,38 @@ } void set_config( void *self, dictionary *config ) { + if (config == NULL) + return; + char *inc_filename; + dictionary *inc_ini; + +/*Check for include tag first, if exists, only use the included file*/ + + if ( (inc_filename=iniparser_getstring(config,"redirect:include",NULL)) != NULL ){ + + inc_ini = iniparser_new(inc_filename); + redirect_data->server = iniparser_getstr (inc_ini, ":server"); + redirect_data->namespace = iniparser_getstr (inc_ini, ":resource"); + + redirect_data->username = iniparser_getstring (inc_ini, ":username",NULL); + redirect_data->password = iniparser_getstring (inc_ini, ":password",NULL); + redirect_data->url_path = iniparser_getstring (inc_ini, ":url_path","/wsman"); + redirect_data->authentication_method = iniparser_getstring (inc_ini, ":authentication_method", "basic"); + redirect_data->cim_namespace = iniparser_getstring (inc_ini, ":cim_namespace","root/cimv2"); + redirect_data->cainfo = iniparser_getstring (inc_ini, ":cacert",NULL); + redirect_data->server_port = iniparser_getint (inc_ini, ":port",5895); + redirect_data->noverifypeer = iniparser_getint (inc_ini, ":noverifypeer", 0); + redirect_data->noverifyhost = iniparser_getint (inc_ini, ":noverifyhost", 0); + redirect_data->sslkey = iniparser_getstring (inc_ini, ":sslkey", NULL); + redirect_data->cl_cert = iniparser_getstring (inc_ini, ":cl_cert", NULL); + return; + } - if (config) { +/*No Include file, read the main configuration file */ redirect_data->server = iniparser_getstr (config, "redirect:server"); - redirect_data->namespace = iniparser_getstr (config, "redirect:namespace"); + redirect_data->namespace = iniparser_getstr (config, "redirect:resource"); redirect_data->username = iniparser_getstring (config, "redirect:username",NULL); redirect_data->password = iniparser_getstring (config, "redirect:password",NULL); @@ -144,7 +183,6 @@ redirect_data->noverifyhost = iniparser_getint (config, "redirect:noverifyhost", 0); redirect_data->sslkey = iniparser_getstring (config, "redirect:sslkey", NULL); redirect_data->cl_cert = iniparser_getstring (config, "redirect:cl_cert", NULL); - } } @@ -242,7 +280,7 @@ } if (get_remote_cl_cert()){ - wsman_transport_set_cert(cl, get_remote_cert()); + wsman_transport_set_cert(cl, get_remote_cl_cert()); if (!get_remote_cainfo()) debug("Warning: cainfo not set to enable SSL operation in Redirect Plugin\n"); @@ -262,17 +300,6 @@ wsman_transport_set_verify_host(cl, get_remote_cainfo() ? !get_remote_noverifyhost(): 0 ); -// No need for client options -// cl_options = wsmc_options_init(); - // cl_options->properties = hash_create(HASHCOUNT_T_MAX, 0, 0) ; //properties are only valid for put, get & create.. so skippping - // cl_options->cim_ns = get_remote_cim_namespace() ; - -//Pass this option to request the Estimated Total num of Items in the response. - // cl_options->flags |= FLAG_ENUMERATION_COUNT_ESTIMATION; - // cl_options->max_elements = wsman_get_max_elements(cntx,NULL); - - // cl_options->max_envelope_size = wsman_get_max_envelope_size(cntx,NULL); - // cl_options->timeout= wsman_get_operation_timeout(cntx, NULL) * 1000; return cl; diff -Nru openwsman-2.3.6/src/plugins/redirect/redirect-README openwsman-2.4.3/src/plugins/redirect/redirect-README --- openwsman-2.3.6/src/plugins/redirect/redirect-README 1969-12-31 18:00:00.000000000 -0600 +++ openwsman-2.4.3/src/plugins/redirect/redirect-README 2013-12-23 04:47:33.000000000 -0600 @@ -0,0 +1,70 @@ +While configuring the details for redirection, the following formats are to be used: + + +i) in openwsman.conf file (the main configuration file) you can have a section like the following: + +[redirect] +#server field is mandatory +server='a.b.c.d' +#resource field is mandatory +resource='http://schemas.example.com/wbem/wscim/1/cim-schema/2' + +#the remaining fields below are optional. If not provides, these fields will be imported from main wsman command or defaults + +# username and password will be imported from the main wsman request +username='user1' +password='password' + + +#default for url_path is '/wsman' +url_path='/wsman' + +#default for authentication_method is basic +authentication_method='basic' + +#default for cim_namespace is root/cimv2 +cim_namespace='root/cimv2' + +#Default value of cacert is NULL. While talking to a remote WSMAN server over SSL, this has to be assigned some value. If not assigned some value, the redirection will fail. +cacert='/etc/dummy.cert' + +#default of 5985 is used. +port=5985 + +#Default vaule is 0 +noverifypeer=0 + +#default value is 0 +noverifyhost=0 + +#default value is NULL +sslkey=NULL + +#default value is NULL +cl_cert=NULL + + +ii)In order to hide the sensitive username and password details better, you can include a new file to the openwsman.conf as follows + +[redirect] +include='/etc/openwsman/redirect.conf' + +You can make the new conf file, only root read-only and hide the sensitive info better. The new redirect.conf file will capture the details in the following format: + +server='a.b.c.d' +resource='http://schemas.example.com/wbem/wscim/1/cim-schema/2' + +username='user1' +password='password' +url_path='/wsman' +authentication_method='basic' +cim_namespace='root/cimv2' +cacert='/etc/dummy.cert' +port=5985 +noverifypeer=0 +noverifyhost=0 +sslkey=NULL +cl_cert=NULL + + +All the above options are simila to the corresponding options provided to wsman program (in wsmancli package). Please refer to documentation in wsmancli for more details on each option. diff -Nru openwsman-2.3.6/src/server/shttpd/shttpd.c openwsman-2.4.3/src/server/shttpd/shttpd.c --- openwsman-2.3.6/src/server/shttpd/shttpd.c 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/src/server/shttpd/shttpd.c 2013-12-23 04:47:33.000000000 -0600 @@ -777,11 +777,11 @@ if (wsmand_options_get_use_ipv6()) { char str[INET6_ADDRSTRLEN]; inet_ntop( AF_INET6,&sa.u.sin6.sin6_addr, str, sizeof(str)); - DBG(("%s:%hu connected (socket %d)", str , ntohs(sa.u.sin6.sin6_port), sock)); + DBG(("%s:%hu connected IPv6 (socket %d)", str , ntohs(sa.u.sin6.sin6_port), sock)); } else { #endif - DBG(("%s:%hu connected (socket %d)", + DBG(("%s:%hu connected IPv4 (socket %d)", inet_ntoa(* (struct in_addr *) &sa.u.sin.sin_addr.s_addr), ntohs(sa.u.sin.sin_port), sock)); #ifdef ENABLE_IPV6 diff -Nru openwsman-2.3.6/VERSION.cmake openwsman-2.4.3/VERSION.cmake --- openwsman-2.3.6/VERSION.cmake 2012-11-07 08:11:22.000000000 -0600 +++ openwsman-2.4.3/VERSION.cmake 2013-12-23 04:47:33.000000000 -0600 @@ -44,10 +44,10 @@ # set COMPATMINOR to MINOR. (binary incompatible change) # -# Package version 2.3.0 +# Package version 2.4.3 SET(OPENWSMAN_MAJOR "2") -SET(OPENWSMAN_MINOR "3") -SET(OPENWSMAN_PATCH "6") +SET(OPENWSMAN_MINOR "4") +SET(OPENWSMAN_PATCH "3") # Plugin API 2.2 SET(OPENWSMAN_PLUGIN_API_MAJOR "2")