setting server cert from the api

View: New views
8 Messages — Rating Filter:   Alert me  

setting server cert from the api

by Kevin Steves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is the only way to do this via axis2_http_client_set_server_cert()?

if so, how does one get a (axis2_http_client_t*) when you have
a (axis2_svc_client_t*)?

Re: setting server cert from the api

by Selvaratnam Uthaiyashankar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Can you try whether following works for you?

axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT, property);

Regards,
Shankar

On Thu, Aug 27, 2009 at 4:35 AM, Kevin Steves<stevesk@...> wrote:
> Is the only way to do this via axis2_http_client_set_server_cert()?
>
> if so, how does one get a (axis2_http_client_t*) when you have
> a (axis2_svc_client_t*)?
>



--
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

Re: setting server cert from the api

by Kevin Steves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Aug 27, 2009 at 09:26:32PM +0530, Selvaratnam Uthaiyashankar wrote:
: Can you try whether following works for you?
:
: axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT, property);

thanks.  tried that.  it crashes in openssl now.  some kind of pointer issue.

any ideas?

[Thu Aug 27 14:41:45 2009] [debug] op_client.c(888) Start:axis2_op_client_infer_transport
[Thu Aug 27 14:41:45 2009] [debug] op_client.c(954) End:axis2_op_client_infer_transport
[Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(91) axis2_engine_send start
[Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(680) Start:axis2_engine_invoke_phases
[Thu Aug 27 14:41:45 2009] [...TRACE...] phase.c(166) Entry:axis2_phase_invoke
[Thu Aug 27 14:41:45 2009] [debug] phase.c(210) Invoke the handler AddressingOutHandler within the phase MessageOut
[Thu Aug 27 14:41:45 2009] [info]  Starting addressing out handler
[Thu Aug 27 14:41:45 2009] [debug] addr_out_handler.c(133) No action present. Stop processing addressing
[Thu Aug 27 14:41:45 2009] [...TRACE...] phase.c(273) Exit:axis2_phase_invoke
[Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(701) End:axis2_engine_invoke_phases
[Thu Aug 27 14:41:45 2009] [...TRACE...] http_transport_sender.c(194) Entry:axis2_http_transport_sender_invoke
[Thu Aug 27 14:41:45 2009] [debug] http_transport_sender.c(246) ctx_epr:https://map.ilabs.example.com/test.yaws
[Thu Aug 27 14:41:45 2009] [debug] http_transport_sender.c(805) using axis2 native http sender.
[Thu Aug 27 14:41:45 2009] [...TRACE...] http_sender.c(252) Entry:axis2_http_sender_send
[Thu Aug 27 14:41:45 2009] [debug] http_sender.c(416) msg_ctx_id:urn:uuid:6ab3031e-9352-1de1-257e-0016d320a8c8
[Thu Aug 27 14:41:45 2009] [info]  [ssl client] Client certificate chain filenot specified

Program received signal SIGSEGV, Segmentation fault.
[Switching to process 27096, thread 0x820b9c00]
0x0bac4eb7 in ERR_add_error_data (num=5) at /usr/src/lib/libssl/src/crypto/err/err.c:335
335                             n+=strlen(a);
(gdb) bt
#0  0x0bac4eb7 in ERR_add_error_data (num=5) at /usr/src/lib/libssl/src/crypto/err/err.c:335
#1  0x0bb0f1dd in BIO_new_file (filename=0x73657665 <Address 0x73657665 out of bounds>, mode=0x2ba58e8c "r")
    at /usr/src/lib/libssl/src/crypto/bio/bss_file.c:127
#2  0x0ba9f274 in X509_load_cert_crl_file (ctx=0x8168c6c0, file=0x7 <Address 0x7 out of bounds>, type=0)
    at /usr/src/lib/libssl/src/crypto/x509/by_file.c:272
#3  0x0ba9ee7e in by_file_ctrl (ctx=0x8168c6c0, cmd=1, argp=0x7 <Address 0x7 out of bounds>, argl=0, ret=0x0)
    at /usr/src/lib/libssl/src/crypto/x509/by_file.c:120
#4  0x0bab875a in X509_LOOKUP_ctrl (ctx=0xffffffff, cmd=1, argc=0x73657665 <Address 0x73657665 out of bounds>, argl=1, ret=0x0)
    at /usr/src/lib/libssl/src/crypto/x509/x509_lu.c:117
#5  0x0ba9e615 in X509_STORE_load_locations (ctx=0x8168bb40, file=0x73657665 <Address 0x73657665 out of bounds>, path=0x0)
    at /usr/src/lib/libssl/src/crypto/x509/x509_d2.c:92
#6  0x039acb10 in SSL_CTX_load_verify_locations (ctx=0x0, CAfile=0x73657665 <Address 0x73657665 out of bounds>, CApath=0x0)
    at /usr/src/lib/libssl/src/ssl/ssl_lib.c:2527
#7  0x0994c05c in axis2_ssl_utils_initialize_ctx (env=0x88486180, server_cert=0x73657665 <Address 0x73657665 out of bounds>, key_file=0x0,
    ssl_pp=0x0) at ssl/ssl_utils.c:110
#8  0x0994b98c in axutil_stream_create_ssl (env=0x88486180, socket=8, server_cert=0x73657665 <Address 0x73657665 out of bounds>, key_file=0x0,
    ssl_pp=0x0) at ssl/ssl_stream.c:96
#9  0x09949cc0 in axis2_http_client_send (client=0x85a8ee00, env=0x88486180, request=0x88656ec0, ssl_pp=0x0) at http_client.c:265
#10 0x09944728 in axis2_http_sender_send (sender=0x8168c460, env=0x88486180, msg_ctx=0x863d9e00, out=0x8168c2c0,
    str_url=0x7d79a040 "https://map.ilabs.example.com/test.yaws", soap_action=0x299394d2 "") at http_sender.c:1101
#11 0x09942555 in axis2_http_transport_sender_write_message (transport_sender=0x7f588de0, env=0x88486180, msg_ctx=0x863d9e00, epr=0x884862a0,
    out=0x8168c2c0, om_output=0x8168b480) at http_transport_sender.c:806
#12 0x09941606 in axis2_http_transport_sender_invoke (transport_sender=0x7f588de0, env=0x88486180, msg_ctx=0x863d9e00)
    at http_transport_sender.c:309
#13 0x078989b4 in axis2_engine_send (engine=0x88656f90, env=0x88486180, msg_ctx=0x863d9e00) at engine.c:176
#14 0x078c783b in axis2_op_client_two_way_send (env=0x88486180, msg_ctx=0x863d9e00) at op_client.c:1171
#15 0x078c66a2 in axis2_op_client_execute (op_client=0x8168b840, env=0x88486180, block=1) at op_client.c:508
#16 0x078c95fd in axis2_svc_client_send_receive_with_op_qname (svc_client=0x85a8e300, env=0x88486180, op_qname=0x8168c480, payload=0x8168dc40)
    at svc_client.c:732
#17 0x078c9871 in axis2_svc_client_send_receive (svc_client=0x85a8e300, env=0x88486180, payload=0x8168dc40) at svc_client.c:830
#18 0x1c001305 in test_request (log_level=AXIS2_LOG_LEVEL_TRACE, log_file=0x0,
    server_cert_path=0xcfbdb3a8 "/home/stevesk/cvs/example/test/cert.pem", url=0xcfbdb3d6 "https://map.ilabs.example.com/test.yaws")
    at test1.c:179
#19 0x1c001022 in main (argc=7, argv=0xcfbdb1d8) at test1.c:60
(gdb)

Re: setting server cert from the api

by Selvaratnam Uthaiyashankar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you attach your client code?

Regards,
Shankar

On Fri, Aug 28, 2009 at 3:24 AM, Kevin Steves<stevesk@...> wrote:

> On Thu, Aug 27, 2009 at 09:26:32PM +0530, Selvaratnam Uthaiyashankar wrote:
> : Can you try whether following works for you?
> :
> : axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT, property);
>
> thanks.  tried that.  it crashes in openssl now.  some kind of pointer issue.
>
> any ideas?
>
> [Thu Aug 27 14:41:45 2009] [debug] op_client.c(888) Start:axis2_op_client_infer_transport
> [Thu Aug 27 14:41:45 2009] [debug] op_client.c(954) End:axis2_op_client_infer_transport
> [Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(91) axis2_engine_send start
> [Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(680) Start:axis2_engine_invoke_phases
> [Thu Aug 27 14:41:45 2009] [...TRACE...] phase.c(166) Entry:axis2_phase_invoke
> [Thu Aug 27 14:41:45 2009] [debug] phase.c(210) Invoke the handler AddressingOutHandler within the phase MessageOut
> [Thu Aug 27 14:41:45 2009] [info]  Starting addressing out handler
> [Thu Aug 27 14:41:45 2009] [debug] addr_out_handler.c(133) No action present. Stop processing addressing
> [Thu Aug 27 14:41:45 2009] [...TRACE...] phase.c(273) Exit:axis2_phase_invoke
> [Thu Aug 27 14:41:45 2009] [...TRACE...] engine.c(701) End:axis2_engine_invoke_phases
> [Thu Aug 27 14:41:45 2009] [...TRACE...] http_transport_sender.c(194) Entry:axis2_http_transport_sender_invoke
> [Thu Aug 27 14:41:45 2009] [debug] http_transport_sender.c(246) ctx_epr:https://map.ilabs.example.com/test.yaws
> [Thu Aug 27 14:41:45 2009] [debug] http_transport_sender.c(805) using axis2 native http sender.
> [Thu Aug 27 14:41:45 2009] [...TRACE...] http_sender.c(252) Entry:axis2_http_sender_send
> [Thu Aug 27 14:41:45 2009] [debug] http_sender.c(416) msg_ctx_id:urn:uuid:6ab3031e-9352-1de1-257e-0016d320a8c8
> [Thu Aug 27 14:41:45 2009] [info]  [ssl client] Client certificate chain filenot specified
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to process 27096, thread 0x820b9c00]
> 0x0bac4eb7 in ERR_add_error_data (num=5) at /usr/src/lib/libssl/src/crypto/err/err.c:335
> 335                             n+=strlen(a);
> (gdb) bt
> #0  0x0bac4eb7 in ERR_add_error_data (num=5) at /usr/src/lib/libssl/src/crypto/err/err.c:335
> #1  0x0bb0f1dd in BIO_new_file (filename=0x73657665 <Address 0x73657665 out of bounds>, mode=0x2ba58e8c "r")
>    at /usr/src/lib/libssl/src/crypto/bio/bss_file.c:127
> #2  0x0ba9f274 in X509_load_cert_crl_file (ctx=0x8168c6c0, file=0x7 <Address 0x7 out of bounds>, type=0)
>    at /usr/src/lib/libssl/src/crypto/x509/by_file.c:272
> #3  0x0ba9ee7e in by_file_ctrl (ctx=0x8168c6c0, cmd=1, argp=0x7 <Address 0x7 out of bounds>, argl=0, ret=0x0)
>    at /usr/src/lib/libssl/src/crypto/x509/by_file.c:120
> #4  0x0bab875a in X509_LOOKUP_ctrl (ctx=0xffffffff, cmd=1, argc=0x73657665 <Address 0x73657665 out of bounds>, argl=1, ret=0x0)
>    at /usr/src/lib/libssl/src/crypto/x509/x509_lu.c:117
> #5  0x0ba9e615 in X509_STORE_load_locations (ctx=0x8168bb40, file=0x73657665 <Address 0x73657665 out of bounds>, path=0x0)
>    at /usr/src/lib/libssl/src/crypto/x509/x509_d2.c:92
> #6  0x039acb10 in SSL_CTX_load_verify_locations (ctx=0x0, CAfile=0x73657665 <Address 0x73657665 out of bounds>, CApath=0x0)
>    at /usr/src/lib/libssl/src/ssl/ssl_lib.c:2527
> #7  0x0994c05c in axis2_ssl_utils_initialize_ctx (env=0x88486180, server_cert=0x73657665 <Address 0x73657665 out of bounds>, key_file=0x0,
>    ssl_pp=0x0) at ssl/ssl_utils.c:110
> #8  0x0994b98c in axutil_stream_create_ssl (env=0x88486180, socket=8, server_cert=0x73657665 <Address 0x73657665 out of bounds>, key_file=0x0,
>    ssl_pp=0x0) at ssl/ssl_stream.c:96
> #9  0x09949cc0 in axis2_http_client_send (client=0x85a8ee00, env=0x88486180, request=0x88656ec0, ssl_pp=0x0) at http_client.c:265
> #10 0x09944728 in axis2_http_sender_send (sender=0x8168c460, env=0x88486180, msg_ctx=0x863d9e00, out=0x8168c2c0,
>    str_url=0x7d79a040 "https://map.ilabs.example.com/test.yaws", soap_action=0x299394d2 "") at http_sender.c:1101
> #11 0x09942555 in axis2_http_transport_sender_write_message (transport_sender=0x7f588de0, env=0x88486180, msg_ctx=0x863d9e00, epr=0x884862a0,
>    out=0x8168c2c0, om_output=0x8168b480) at http_transport_sender.c:806
> #12 0x09941606 in axis2_http_transport_sender_invoke (transport_sender=0x7f588de0, env=0x88486180, msg_ctx=0x863d9e00)
>    at http_transport_sender.c:309
> #13 0x078989b4 in axis2_engine_send (engine=0x88656f90, env=0x88486180, msg_ctx=0x863d9e00) at engine.c:176
> #14 0x078c783b in axis2_op_client_two_way_send (env=0x88486180, msg_ctx=0x863d9e00) at op_client.c:1171
> #15 0x078c66a2 in axis2_op_client_execute (op_client=0x8168b840, env=0x88486180, block=1) at op_client.c:508
> #16 0x078c95fd in axis2_svc_client_send_receive_with_op_qname (svc_client=0x85a8e300, env=0x88486180, op_qname=0x8168c480, payload=0x8168dc40)
>    at svc_client.c:732
> #17 0x078c9871 in axis2_svc_client_send_receive (svc_client=0x85a8e300, env=0x88486180, payload=0x8168dc40) at svc_client.c:830
> #18 0x1c001305 in test_request (log_level=AXIS2_LOG_LEVEL_TRACE, log_file=0x0,
>    server_cert_path=0xcfbdb3a8 "/home/stevesk/cvs/example/test/cert.pem", url=0xcfbdb3d6 "https://map.ilabs.example.com/test.yaws")
>    at test1.c:179
> #19 0x1c001022 in main (argc=7, argv=0xcfbdb1d8) at test1.c:60
> (gdb)
>



--
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

Re: setting server cert from the api

by Kevin Steves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Aug 28, 2009 at 08:44:44PM +0530, Selvaratnam Uthaiyashankar wrote:
: Can you attach your client code?

yes, attached.

#include <stdio.h>
#include <unistd.h>

#include <axiom.h>
#include <axiom_soap.h>
#include <axis2_client.h>
#include <axis2_http_header.h>
#include <axis2_http_transport.h>
#include <axis2_util.h>

#define CLIENT_HOME "/usr/local/axis2c";

void usage(void);
axiom_node_t *build_om_payload(const axutil_env_t *env);
int convert_log_level(const char *s, axutil_log_levels_t *log_level);
int test_request(axutil_log_levels_t log_level,
    const char *log_file, const char *server_cert_path,
    const char *url);
void print_axis2_error(const axutil_env_t *env, const char *s);

int debug = 0;

int
main(int argc, char **argv)
{
        extern int optind;
        extern char *optarg;
        int ch;
        char *log_file = NULL;
        axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_WARNING;
        char *url = NULL;
        char *server_cert_path = NULL;

        while ((ch = getopt(argc, argv, "dL:l:s:u:")) != -1) {
                switch (ch) {
                case 'd':
                        debug++;
                        break;
                case 'L':
                        if (!convert_log_level(optarg, &log_level))
                                usage();
                        break;
                case 'l':
                        log_file = optarg;
                        break;
                case 's':
                        server_cert_path = optarg;
                        break;
                case 'u':
                        url = optarg;
                        break;
                case 'h':
                default:
                        usage();
                }
        }
        if (!url)
                usage();

        exit(test_request(log_level, log_file, server_cert_path, url));
}

void
usage(void)
{
        extern char *__progname;

        fprintf(stderr,
            "usage: %s [-d]\n"
            "       [-L crit|err|warn|info|debug|user|trace]\n"
            "       [-l log_file]\n"
            "       [-s server_cert_path]\n"
            "       -u URL\n", __progname);
        exit(1);
}

int
convert_log_level(const char *s, axutil_log_levels_t *log_level)
{
        if (strcmp(s, "crit") == 0)
                *log_level = AXIS2_LOG_LEVEL_CRITICAL;
        else if (strcmp(s, "err") == 0)
                *log_level = AXIS2_LOG_LEVEL_ERROR;
        else if (strcmp(s, "warn") == 0)
                *log_level = AXIS2_LOG_LEVEL_WARNING;
        else if (strcmp(s, "info") == 0)
                *log_level = AXIS2_LOG_LEVEL_INFO;
        else if (strcmp(s, "debug") == 0)
                *log_level = AXIS2_LOG_LEVEL_DEBUG;
        else if (strcmp(s, "user") == 0)
                *log_level = AXIS2_LOG_LEVEL_USER;
        else if (strcmp(s, "trace") == 0)
                *log_level = AXIS2_LOG_LEVEL_TRACE;
        else
                return 0;
        return 1;
}

void
print_axis2_error(const axutil_env_t *env, const char *s)
{
        fprintf(stderr, "%s: %d: %s\n",
            s, env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));

        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "%s: %d: %s",
            s, env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
}

int
test_request(axutil_log_levels_t log_level,
    const char *log_file,
    const char *server_cert_path,
    const char *url)
{
        const axutil_env_t *env;
        const axis2_char_t *address;
        axis2_endpoint_ref_t *endpoint_ref;
        axis2_options_t *options;
        const axis2_char_t *client_home;
        axis2_svc_client_t *svc_client;
        axiom_node_t *payload;
        axiom_node_t *ret_node;
        axutil_array_list_t *http_header_list;
        axis2_http_header_t *http_header;
        axis2_char_t *om_str;

        env = axutil_env_create_all(log_file, log_level);

        address = url;
        endpoint_ref = axis2_endpoint_ref_create(env, address);

        options = axis2_options_create(env);
        axis2_options_set_to(options, env, endpoint_ref);
        if (axis2_options_set_soap_version(options, env, AXIOM_SOAP11) != AXIS2_SUCCESS) {
                fprintf(stderr, "axis2_options_set_soap_version\n");
                return 1;
        }

        http_header_list = axutil_array_list_create(env, 1);
        if (!(http_header = axis2_http_header_create(env, "SOAPAction", "\"\""))) {
                print_axis2_error(env, "axis2_http_header_create");
                return 1;
        }
        if (axutil_array_list_add(http_header_list, env, http_header) != AXIS2_SUCCESS) {
                print_axis2_error(env, "axutil_array_list_add");
                return 1;
        }
        if (axis2_options_set_http_headers(options, env, http_header_list) != AXIS2_SUCCESS) {
                print_axis2_error(env, "axis2_options_set_http_headers");
                return 1;
        }

        client_home = AXIS2_GETENV("AXIS2C_HOME");
        if (!client_home || strcmp(client_home, "") == 0)
                client_home = CLIENT_HOME;

        svc_client = axis2_svc_client_create(env, client_home);
        if (!svc_client) {
                print_axis2_error(env, "axis2_svc_client_create");
                return 1;
        }

        axis2_svc_client_set_options(svc_client, env, options);

        if (server_cert_path) {
                fprintf(stderr, "-s %s\n", server_cert_path);
                if (axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT,
                    server_cert_path) != AXIS2_SUCCESS) {
                        print_axis2_error(env, "axis2_options_set_property");
                        return 1;
                }
        }

        payload = build_om_payload(env);

        ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
        if (!ret_node) {
                print_axis2_error(env, "axis2_svc_client_send_receive");
                return 1;
        }

        om_str = axiom_node_to_string(ret_node, env);
        if (om_str) {
                printf("Received OM: %s\n", om_str);
                AXIS2_FREE(env->allocator, om_str);
        }

        axis2_svc_client_free(svc_client, env);
        axutil_env_free((axutil_env_t *)env);

        return 0;
}

axiom_node_t *
build_om_payload(const axutil_env_t * env)
{
        axiom_node_t *om_node;
        axiom_element_t *om_ele;
        axiom_namespace_t *ns1;
        axis2_char_t *om_str;

        ns1 = axiom_namespace_create(env,
            "http://www.trustedcomputinggroup.org/2006/IFMAP/1", "ifmap");
        om_ele = axiom_element_create(env, NULL, "new-session", ns1, &om_node);
        om_str = axiom_node_to_string(om_node, env);

        if (om_str) {
                printf("Sending OM: %s\n", om_str);
                AXIS2_FREE(env->allocator, om_str);
        }
        return om_node;
}

Re: setting server cert from the api

by Kevin Steves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

haven't figured this out yet, but what I am seeing in tracing with
gdb, is we get to
http_sender.c:axis2_http_sender_configure_server_cert().

axis2_msg_ctx_get_property() returns a non-NULL (axutil_property_t*),
however the value member has a non-NULL but invalid pointer (as
returned by axutil_property_get_value()).  then
axis2_http_client_set_server_cert() is called with the pointer
(server_cert).

#ifndef AXIS2_LIBCURL_ENABLED
static axis2_status_t
axis2_http_sender_configure_server_cert (axis2_http_sender_t * sender,
                                         const axutil_env_t * env,
                                         axis2_msg_ctx_t * msg_ctx)
{
    axutil_property_t *server_cert_property = NULL;
    axutil_param_t *server_cert_param = NULL;
    axis2_char_t *server_cert = NULL;
    axis2_status_t status = AXIS2_FAILURE;

    AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);

    server_cert_property = axis2_msg_ctx_get_property (msg_ctx, env,
                                                       AXIS2_SSL_SERVER_CERT);
    if (server_cert_property)
    {
        server_cert =
            (axis2_char_t *) axutil_property_get_value (server_cert_property,
                                                        env);
    }
    else
    {
        server_cert_param = axis2_msg_ctx_get_parameter (msg_ctx,
                                                         env,
                                                         AXIS2_SSL_SERVER_CERT);
        if (server_cert_param)
        {
            server_cert =
                (axis2_char_t *) axutil_param_get_value (server_cert_param, env);
        }
    }

    if (server_cert)
    {
        status = axis2_http_client_set_server_cert (sender->client,
                                                    env, server_cert);
    }

    return status;
}
#endif

Re: setting server cert from the api

by Selvaratnam Uthaiyashankar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

You have to create an axutil_property_t* and set the server cert
there. The following snippet is wrong:

<snip>
axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT,
server_cert_path)
</snip>

It should be
<snip>
axutil_property_t* property =axutil_property_create_with_args(env, 0,
0, 0, server_cert_path);
axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT,property );
</snip>

Regards,
Shankar

On Tue, Sep 1, 2009 at 2:08 AM, Kevin Steves<stevesk@...> wrote:

> haven't figured this out yet, but what I am seeing in tracing with
> gdb, is we get to
> http_sender.c:axis2_http_sender_configure_server_cert().
>
> axis2_msg_ctx_get_property() returns a non-NULL (axutil_property_t*),
> however the value member has a non-NULL but invalid pointer (as
> returned by axutil_property_get_value()).  then
> axis2_http_client_set_server_cert() is called with the pointer
> (server_cert).
>
> #ifndef AXIS2_LIBCURL_ENABLED
> static axis2_status_t
> axis2_http_sender_configure_server_cert (axis2_http_sender_t * sender,
>                                         const axutil_env_t * env,
>                                         axis2_msg_ctx_t * msg_ctx)
> {
>    axutil_property_t *server_cert_property = NULL;
>    axutil_param_t *server_cert_param = NULL;
>    axis2_char_t *server_cert = NULL;
>    axis2_status_t status = AXIS2_FAILURE;
>
>    AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);
>
>    server_cert_property = axis2_msg_ctx_get_property (msg_ctx, env,
>                                                       AXIS2_SSL_SERVER_CERT);
>    if (server_cert_property)
>    {
>        server_cert =
>            (axis2_char_t *) axutil_property_get_value (server_cert_property,
>                                                        env);
>    }
>    else
>    {
>        server_cert_param = axis2_msg_ctx_get_parameter (msg_ctx,
>                                                         env,
>                                                         AXIS2_SSL_SERVER_CERT);
>        if (server_cert_param)
>        {
>            server_cert =
>                (axis2_char_t *) axutil_param_get_value (server_cert_param, env);
>        }
>    }
>
>    if (server_cert)
>    {
>        status = axis2_http_client_set_server_cert (sender->client,
>                                                    env, server_cert);
>    }
>
>    return status;
> }
> #endif
>



--
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

Re: setting server cert from the api

by Kevin Steves :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 01, 2009 at 09:05:53AM +0530, Selvaratnam Uthaiyashankar wrote:
: You have to create an axutil_property_t* and set the server cert
: there. The following snippet is wrong:
:
: <snip>
: axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT,
: server_cert_path)
: </snip>
:
: It should be
: <snip>
: axutil_property_t* property =axutil_property_create_with_args(env, 0,
: 0, 0, server_cert_path);
: axis2_options_set_property(options, env, AXIS2_SSL_SERVER_CERT,property );
: </snip>

thank you, that was the issue.

I was confused because axis2_options_set_property() arg 4 is void*.