cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using libcurl from a pam module

From: Jason Borden <jasonborden79_at_yahoo.com>
Date: Wed, 16 Jan 2013 09:21:23 -0700

On 01/16/2013 03:02 AM, Daniel Stenberg wrote:
> On Tue, 15 Jan 2013, Jason Borden wrote:
>
>> I'm writing a pam authentication module and would like to use libcurl
>> to query a web service api. My only issue is that since pam modules
>> are invoked by single or multithreaded applications, there isn't a way
>> for me to run curl_global_init before the invoking application starts
>> their threads. Am I just out of luck using libcurl or is there a way I
>> can still make it work?
>
> That restriction is unfortunately enforced upon us by third party
> libraries, not by anything we can control. So if your module wants to
> use OpenSSL, or whatever, that requirement will be there no matter which
> other transfer library you use...
>
Thank you for the info. If I forgo the use of SSL (use
CURL_GLOBAL_NOTHING in curl_global_init) would that then be multithread
safe? Or perhaps could I use SSL if I used a mutex to prevent
curl_global_init from being called more than once and use a reference
counter to keep track of the threads using curl before calling
curl_global_cleanup?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-16