git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jerry Qassar <jqassar@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH] http.c: Add config options/parsing for SSL engine vars
Date: Tue, 30 Apr 2013 13:17:03 -0700	[thread overview]
Message-ID: <7vzjwfbwow.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAJC3a=pU2m8LpUh0u0XXXgOiDiPo-QAdA471orGs9jcyDJTU5g@mail.gmail.com> (Jerry Qassar's message of "Tue, 30 Apr 2013 13:04:17 -0700")

Jerry Qassar <jqassar@gmail.com> writes:

> Curl already does support engine-based certificates (in code and
> help).  Its problem is that a) it doesn't yet read your engine
> defs out of OpenSSL config, and b) a bug in copying the engine
> data, once that's patched, to the handle that calling apps use.

So once the problem (a) is fixed, if the user has OpenSSL config
then the user doesn't need configuration from setopt() side?  That
makes it sound like you do not need to patch us at all, but there
must be something else going on...

> On git's side we just need to expose the proper options for setopt
> configuration.  No special work is needed to support them
> otherwise.

... I am somewhat puzzled.

>>> > +   if (ssl_keytype != NULL)
>>> > +           curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_keytype);
>>> > +   if (ssl_certtype != NULL)
>>> > +           curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_certtype);
>>
>> Shouldn't we be checking the result of curl_easy_setopt for errors here
>> (and when the engine cannot be loaded)?  I think we should probably die
>> if the engine can't be loaded, but at the very least we'd want to warn
>> the user that their settings are being ignored.
>
> Errors are handled by curl (up to this point):
>
> 1) Setting the cert type to FOO:
> error: not supported file type 'FOO' for certificate...
> fatal: HTTP request failed
>
> 2) Setting the key type to FOO:
> error: not supported file type for private key...
> fatal: HTTP request failed
>
> 3) Setting engine type to something invalid:
>  * SSL Engine 'pkcsfoo' not found (only with GIT_CURL_VERBOSE set)
> error: crypto engine not set, can't load certificate...
> fatal: HTTP request failed

Where do "error:" and "fatal:" happen in the codeflow?

I am guessing that "error:" may come from these easy_setopt() calls, but
the "fatal: HTTP request failed" come from us, much later in the
callpath when we actually make http request.

Between these two times, aren't we throwing user data at the cURL
library and possibly over the wire to the remote side (with a SSL
configuration that is different from what the user intended to use),
no?

That does not sound like a "managed by cURL" solution to me.
Shouldn't we notice the first error and abort without doing any
further damage?

>> Overall, I think it is looking good. Aside from a few style/cleanup
>> issues, my only real complaint is the lack of error-checking from
>> curl_easy_setopt.
>>
>> And of course adding some tests while you are working in the area would
>> be very nice. :)
> ...
> I guess my open question is, if you wish to wrap the
> prop setting in a curl version #if, what version is desired?

https://github.com/bagder/curl/blob/master/docs/libcurl/symbols-in-versions

says that SSLKEYTYPE, SSLCERTTYPE, etc. come from 7.9.3, so it would
be 

        #if LIBCURL_VERSION_NUM >= 0x070903
            ...
        #endif

Thanks.

  reply	other threads:[~2013-04-30 20:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 23:03 [PATCH] http.c: Add config options/parsing for SSL engine vars Jerry Qassar
2013-04-30 16:45 ` Junio C Hamano
2013-04-30 18:27   ` Jeff King
2013-04-30 20:04     ` Jerry Qassar
2013-04-30 20:17       ` Junio C Hamano [this message]
2013-04-30 20:29         ` Jeff King
2013-04-30 21:05           ` Jerry Qassar
2013-04-30 20:22       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vzjwfbwow.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jqassar@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).