Re: [PATCH/RFC] http: pass http.cookiefile using CURLOPT_COOKIEFILE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shawn,

On Jun 2, 2011, at 8:01 PM, Shawn Pearce wrote:

> On Thu, Jun 2, 2011 at 13:31, Duncan Brown <dabrown@xxxxxxxxxxxxxxx> wrote:
>> If the config option http.cookiefile is set, pass this file to libCURL using
>> the CURLOPT_COOKIEFILE option. This is similar to calling curl with the -b
>> option.  This allows git http authorization with authentication mechanisms
>> that use cookies, such as SAML Enhanced Client or Proxy (ECP) used by
>> Shibboleth.
> 
> Wow, the patch was this simple?

Yep, it took longer to google for the libCURL docs than it did to write the code! With this patch, I can do the following:

[dbrown@spice-dev2 test]$ ./ecp.sh SUGWG https://sugwg-git.phy.syr.edu/git/qm/info/refs?service=git-upload-pack dbrown
Enter host password for user 'dbrown':

001e# service=git-upload-pack
0000009b0b31a9bef84542ff7dd5a10eb72ef2a67d176a35 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed
003f0b31a9bef84542ff7dd5a10eb72ef2a67d176a35 refs/heads/master
00424b2259eb6bada1a160e8dcf394b93fa60a60c90d refs/tags/first_corr
004266eea9443af5f0026a44d58990547f8ff60897c6 refs/tags/pre_double
0043f8d991153a857af157e9dfaa9e8851ae2440cafd refs/tags/ptf_test_01
0000

ecp.sh is Scott Koranda's demonstration ECP client:

<https://wiki.shibboleth.net/confluence/display/SHIB2/Contributions#Contributions-simplebash>

It gets a Shib session cookie and stores it in ~/.curlcookies with curl and xlstproc command line tools. Now that I have my session cookie, I can do

[dbrown@spice-dev2 test]$ git config --global http.cookiefile "/home/dbrown/.curlcookies"
[dbrown@spice-dev2 test]$ git clone https://sugwg-git.phy.syr.edu/git/qm
Cloning into qm...
remote: Counting objects: 2071, done.
remote: Compressing objects: 100% (833/833), done.
remote: Total 2071 (delta 1352), reused 1851 (delta 1224)
Receiving objects: 100% (2071/2071), 681.53 KiB, done.
Resolving deltas: 100% (1352/1352), done.

Without the session cookie:

[dbrown@spice-dev2 test]$ rm ~/.curlcookies 
[dbrown@spice-dev2 test]$ git clone https://sugwg-git.phy.syr.edu/git/qm
Cloning into qm...
warning: remote HEAD refers to nonexistent ref, unable to checkout.

> Thanks Duncan!

No problem.

Cheers,
Duncan.

> 
>> ---
>>  Documentation/config.txt |    8 ++++++++
>>  http.c                   |    5 +++++
>>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> Junio, I didn't test this myself, but the code looks good to me. I
> don't see any obvious issues with it.
> 
> -- 
> Shawn.
> 

-- 

Duncan Brown                          Room 263-1, Department of Physics,
Associate Professor of Physics        Syracuse University, NY 13244, USA
Phone: (315) 443 5993             http://www.gravity.phy.syr.edu/~duncan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]