git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/4] git-imap-send: Implement CRAM-MD5 auth method

From
HMHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Date
Feb 11, 2010, 15:11 UTC
Message-ID
<4B741E20.3010602@dcl.info.waseda.ac.jp>
In-Reply-To
<40aa078e1002110659y9493052l3752c7e0afb6eb3c@mail.gmail.com>
(2010年02月11日 23:59), Erik Faye-Lund wrote:
Show 55 quoted lines
> On Thu, Feb 11, 2010 at 3:55 PM, Hitoshi Mitake
> <mitake@dcl.info.waseda.ac.jp>  wrote:
>> (2010年02月09日 23:22), Erik Faye-Lund wrote:
>>>
>>> On Tue, Feb 9, 2010 at 1:09 PM, Hitoshi Mitake
>>> <mitake@dcl.info.waseda.ac.jp>    wrote:
>>>>
>>>> +static int auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd,
>>>> const char *prompt)
>>>> +{
>>>> +       int ret;
>>>> +       char digest[DIGEST_HEX_LEN];
>>>> +       char buf[256], base64_out[256];
>>>> +
>>>> +       memset(buf, 0, 256);
>>>> +       base64_decode(buf, prompt, strlen(prompt));
>>>> +
>>>> +       memset(digest, 0, DIGEST_HEX_LEN);
>>>> +       md5_hex_hmac(digest, (const unsigned char *)buf, strlen(buf),
>>>> +                    (const unsigned char *)server.pass,
>>>> strlen(server.pass));
>>>> +
>>>> +       memset(buf, 0, 256);
>>>> +       strcpy(buf, server.user);
>>>> +       strcpy(buf + strlen(buf), " ");
>>>> +       strcpy(buf + strlen(buf), digest);
>>>> +       memset(base64_out, 0, 256);
>>>> +       base64_encode(base64_out, buf, strlen(buf));
>>>> +
>>>> +       ret = socket_write(&ctx->imap->buf.sock, base64_out,
>>>> strlen(base64_out));
>>>
>>> Since this is the only location in this function that accesses
>>> anything inside ctx, how about just passing the imap_socket itself to
>>> the function? That'd make it a bit simpler if, say, I was rewriting
>>> send-email in C and wanted to add CRAM-MD5 AUTH support (given that
>>> I'd done the work to use imap_socket first)...
>>>
>>
>> Do you mean that
>>   auth_cram_md5(struct imap_store *ctx, struct imap_cmd *cmd, const char
>> *prompt)
>> should be,
>>   auth_cram_md5(struct imap_socket *socket, struct imap_cmd *cmd, const char
>> *prompt)
>>   ?
>>
>> If this improves portability of cram-md5 auth, of course I agree.
>> But struct imap_socket is defined in imap-send.c yet.
>>
>
> Yes, it's what I meant. It's only a minor nit-pick, as some
> refactoring would have to be done anyway. But I think it'd be a good
> change to only pull in the state needed, but that's my personal
> opinion.

My latest patch doesn't change the point. Because auth_cram_md5() is a call back, so changing type of it needs some works...

Show 8 quoted lines
>
>> If you want to separate imap-send.c and cram-md5 auth for git-send-email,
>> I'll cooperate :)
>>
>
> Not at this point, if ever. I'm fine with you not doing anything about
> my comment. I was merely thinking out loud... ;)
>

I'm looking forward to using your new git-send-email. I'm also a heavy user of it :)

Previous: Erik Faye-LundNext: Hitoshi Mitake
Message 43 of 49 in “imap.preformattedHTML and imap.sslverify”
  1. Junio C HamanoFeb 6, 2010
  2. Jeremy WhiteFeb 8, 2010
  3. Junio C HamanoFeb 8, 2010
  4. 0/4 Some improvements for git-imap-sendHitoshi Mitake, Feb 9, 2010
  5. Jeff KingFeb 9, 2010
  6. Erik Faye-LundFeb 9, 2010
  7. Jeff KingFeb 9, 2010
  8. Erik Faye-LundFeb 9, 2010
  9. Jeff KingFeb 9, 2010
  10. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 11, 2010
  11. Erik Faye-LundFeb 11, 2010
  12. Hitoshi MitakeFeb 11, 2010
  13. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 11, 2010
  14. Junio C HamanoFeb 11, 2010
  15. Hitoshi MitakeFeb 12, 2010
  16. 2/2 git-imap-send: Convert LF to CRLF before storing patch to draft boxHitoshi Mitake, Feb 11, 2010
  17. Junio C HamanoFeb 11, 2010
  18. Hitoshi MitakeFeb 12, 2010
  19. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 11, 2010
  20. 2/2 git-imap-send: Convert LF to CRLF before storing patch to draft boxHitoshi Mitake, Feb 11, 2010
  21. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 12, 2010
  22. Erik Faye-LundFeb 12, 2010
  23. Hitoshi MitakeFeb 13, 2010
  24. Junio C HamanoFeb 12, 2010
  25. Hitoshi MitakeFeb 13, 2010
  26. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 13, 2010
  27. Junio C HamanoFeb 13, 2010
  28. Junio C HamanoFeb 16, 2010
  29. Hitoshi MitakeFeb 17, 2010
  30. 1/2 git-imap-send: Add CRAM-MD5 authenticate method supportHitoshi Mitake, Feb 17, 2010
  31. Junio C HamanoFeb 17, 2010
  32. Hitoshi MitakeFeb 18, 2010
  33. Hitoshi MitakeFeb 17, 2010
  34. 2/2 git-imap-send: Convert LF to CRLF before storing patch to draft boxHitoshi Mitake, Feb 12, 2010
  35. 1/4 Add base64 encoder and decoderHitoshi Mitake, Feb 9, 2010
  36. Erik Faye-LundFeb 9, 2010
  37. Hitoshi MitakeFeb 11, 2010
  38. 2/4 Add stuffs for MD5 hash algorithmHitoshi Mitake, Feb 9, 2010
  39. 3/4 git-imap-send: Implement CRAM-MD5 auth methodHitoshi Mitake, Feb 9, 2010
  40. Erik Faye-LundFeb 9, 2010
  41. Hitoshi MitakeFeb 11, 2010
  42. Erik Faye-LundFeb 11, 2010
  43. Hitoshi MitakeFeb 11, 2010
  44. 4/4 git-imap-send: Add method to convert from LF to CRLFHitoshi Mitake, Feb 9, 2010
  45. Jakub NarebskiFeb 9, 2010
  46. Hitoshi MitakeFeb 11, 2010
  47. Linus TorvaldsFeb 9, 2010
  48. Junio C HamanoFeb 9, 2010
  49. Hitoshi MitakeFeb 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.