cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl with ssl dumps core (repost as subscriber)

From: Alex Hristov <ahristov_at_oblix.com>
Date: Thu, 3 Apr 2003 10:29:42 -0800

Hi,

I'm trying to use libcurl within a dynamic library function to submit
an XML request over https, but am consistently getting core dumps
during the SSL handshaking (see below).

I've tried using curl 7.10.3 and 7.10.4 with OpenSSL 0.9.6i.
The code seems to work OK when ran as part of a stand-alone executable,
but the problem occurs when executed as .so plugin.

Also, I'm using OpenSSL to establish SSL-encrypted connections to LDAP
(based on LDAP C SDK) from within the same plugin, and that works OK.

Can anyone shed some light on what could be going wrong?

The initialization of the curl handler is as follows:

...
curl = curl_easy_init();
...

if ( curl ) {
   SSL_RESULT = curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);
   if ( SSL_RESULT != 0 ) {
       sprintf(*ppszErrorMsg, "CURL SSL Engine Initialization Failed\n");
       return false;
   }
   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
   curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, "/dev/urandom");

   curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
   curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
   curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
   curl_easy_setopt(curl, CURLOPT_VERBOSE, CURL_VERBOSE);
   curl_easy_setopt(curl, CURLOPT_URL, "https://localhost/myurl");

   headerlist = curl_slist_append(headerlist, "iv-user:myuser);
   headerlist = curl_slist_append(headerlist, "Content-type:text/xml");
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);

   curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
   curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
   curl_easy_setopt(curl, CURLOPT_POST, 1);
   curl_easy_setopt(curl, CURLOPT_POSTFIELDS, szRequestXML);

   res = curl_easy_perform(curl);
   ...
}
...

#0 0xfc87eb84 in ssl23_connect (s=0x14abba8) at s23_clnt.c:144
144 if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
#1 0xfc8821ac in SSL_connect (s=0x14abba8) at ssl_lib.c:718
#2 0xfc8d5350 in Curl_SSLConnect (conn=0x1417458) at ssluse.c:887
#3 0xfc8cad1c in Curl_http_connect (conn=0x1417458) at http.c:564
#4 0xfc8d04e4 in Curl_protocol_connect (conn=0x1417458, hostadd=0x11c6800) at url.c:1768
#5 0xfc8d1da4 in CreateConnection (data=0x14d0038, in_connect=0xfba03464) at url.c:2907
#6 0xfc8d1e3c in Curl_connect (data=0x14d0038, in_connect=0xfba03464) at url.c:2950
#7 0xfc8db898 in Curl_perform (data=0x14d0038) at transfer.c:1647
#8 0xfc8dbc90 in curl_easy_perform (curl=0x14d0038) at easy.c:247

Thanks,
-Alex

-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
Received on 2003-04-03