Package: libcgsi-gsoap-dev
Version: 1.3.4.0-1
Severity: important
While trying to use the packaged cgsi_plugin library, I found that
gSOAP was behaving as if the plugin was not registered. After some
debugging, I discovered that this was due to the package plugin
failing to hook itself correctly into the "struct soap" structure's
function pointers.
For correct behaviour, the cgsi_plugin library must (amongst other
things) update the gSOAP context structure's 'fopen' member. This
allows the cgsi_plugin to intercept attempt to connect to the peer and
establish the GSI connection.
I wrote a simple program to demonstrate the problem:
cat - > cgsi_plugin_test.c << EOF
#include "stdio.h"
#include "cgsi_plugin.h"
/*
* How to compile:
*
* gcc -Wall -o cgsi_plugin_test cgsi_plugin_test.c -lgsoap -lcgsi_plugin
*/
int main()
{
struct soap soap;
void *fopen_before;
soap_init(&soap);
printf("Before registering plugin:\n");
printf("\tfopen: %p\n", soap.fopen);
fopen_before = soap.fopen;
printf("\nRegistring cgsi_plugin gSOAP plugin.\n");
int flags = CGSI_OPT_DISABLE_NAME_CHECK | CGSI_OPT_DELEG_FLAG;
if (soap_register_plugin_arg(&soap, client_cgsi_plugin, &flags)) {
// if we fail to register, print some kind of feedback and exit
soap_print_fault(&soap, stderr);
return 1;
}
printf("\nAfter registering plugin:\n");
printf("\tfopen: %p\n", soap.fopen);
if( soap.fopen == fopen_before) {
printf("ERROR: cgsi_plugin failed to hook itself into fopen\n");
}
printf("\nCheck for plugin-specific data:\n");
void *data = soap_lookup_plugin(&soap, "CGSI_PLUGIN_CLIENT_1.0");
printf("\tdata: %p\n", data);
if( data == NULL) {
printf("ERROR: cgsi_plugin failed to register\n");
}
soap_destroy(&soap);
soap_end(&soap);
/* From http://www.cs.fsu.edu/~engelen/soapdoc2.html
"The soap_done function de-registers all plugin-ins,
so this function should be called to cleanly
terminate a gSOAP run-time context"
Unfortunately, calling soap_done causes gSOAP to block
indefinitely so we're forced to leave this step out.
*/
// soap_done(&soap);
return 0;
}
/* Dummy routines to satisfy linker for gSOAP dependencies */
struct Namespace namespaces[0];
const char ** soap_faultstring(struct soap *soap) {return NULL;}
int soap_getfault(struct soap *soap) {return 1;}
void soap_serializefault(struct soap *soap) {}
void soap_serializeheader(struct soap *soap) {}
void *soap_getelement(struct soap *soap, int *type) {return NULL;}
int soap_putfault(struct soap *soap) {return SOAP_OK;}
const char ** soap_faultdetail(struct soap *soap) {return NULL;}
const char ** soap_faultsubcode(struct soap *soap) {return NULL;}
void soap_markelement(struct soap *soap, const void *ptr, int type) {}
int soap_getheader(struct soap *soap) {return 1;}
const char ** soap_faultcode(struct soap *soap) {return NULL;}
int soap_putelement(struct soap *soap, const void *ptr, const char *tag,
int id, int type) {return SOAP_OK;}
int soap_putheader(struct soap *soap) {return SOAP_OK;}
EOF
Here is typical output when compiled as suggested and run against
current sid:
Before registering plugin:
fopen: 0xf7766f60
Registring cgsi_plugin gSOAP plugin.
After registering plugin:
fopen: 0xf7766f60
ERROR: cgsi_plugin failed to hook itself into fopen
Check for plugin-specific data:
data: 0x9affb50
If I compile cgsi_plugin from CVS and link against this version, I get
the following output:
Before registering plugin:
fopen: 0xf7748f60
Registring cgsi_plugin gSOAP plugin.
After registering plugin:
fopen: 0xf7725725
Check for plugin-specific data:
data: 0x97d1b50
I'm pretty sure I've used gSOAP with cgsi-plugin from Debain packages
in the past. I'm not sure what has changed so that it no longer works
(at least, not for me).
I'm also at a loss to identify a likely cause for this problem. It is
as if the packaged cgsi-plugin attempts to write the replacement fopen
method into the wrong memory location; but, if so, valgrind should
notice this. Running valgrind against the test-code fails to find any
problem. Altering the test-code to allocate the 'struct soap'
variable from the heap (rather than the stack) and rerunning with
Valgrind also fails to find any problem.
Cheers,
Paul.
-- System Information:
Debian Release: wheezy/sid
APT prefers oldstable
APT policy: (500, 'oldstable'), (500, 'unstable')
Architecture: i386 (x86_64)
Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libcgsi-gsoap-dev depends on:
ii gsoap 2.8.3-1 Development libraries and stub gen
ii libcgsi-gsoap1 1.3.4.0-1 GSI plugin for gSOAP
libcgsi-gsoap-dev recommends no packages.
libcgsi-gsoap-dev suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]