axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bartley <>
Subject Stub::SetSecure
Date Tue, 08 Mar 2005 05:08:57 GMT

I don't understand the usage of the SetSecure method on the generated 
client stub code.

I haven't found any documentation so looking at the source code for a 
generated stub:

void Service::SetSecure( char * pszArguments, ...)
        char ** ppszArgPtr = &pszArguments;
        int             iArgIndex = 0;

        while( *ppszArgPtr != NULL)
                sArguments[iArgIndex] = *ppszArgPtr;


Is this trying to do a poor man's variable argument list? If it is it's 
very broken. 

A call to SetSecure("a", "b") will NOT result in ppszArgPtr iterating 
first to "a" and then to "b" unless you happen to be lucky in your 
platform choice. This doesn't work because arguments are not necessarily 
passed on the stack so incrementing a pointer to the first argument does 
not necessarily get you to the second argument.

I suspect this should really be:

#include <stdarg.h>

void Service::SetSecure(char* pszArguments, ...)
        int iArgIndex = 0;
        if (pszArguments) {
                sArguments[iArgIndex++] = pszArguments;
                va_list args;
                va_start(args, pszArguments);

                char* arg;
                while ((arg = va_arg(args)) != NULL) {
                        sArguments[iArgIndex++] = arg;


or am I misunderstanding how SetSecure is supposed to be called? Looking 
at some of the sample programs I don't think so.


Tim Bartley
IBM Tivoli Access Manager Development
Gold Coast Development Lab, Australia
+61-7-5552-4001 phone
+61-7-5571-0420 fax
View raw message