From: Erik Faye-Lund <kusmabite@googlemail.com>
To: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: gitster@pobox.com, git@vger.kernel.org,
Jeremy White <jwhite@codeweavers.com>,
Robert Shearman <robertshearman@gmail.com>
Subject: Re: [PATCH 3/4] git-imap-send: Implement CRAM-MD5 auth method
Date: Thu, 11 Feb 2010 15:59:25 +0100 [thread overview]
Message-ID: <40aa078e1002110659y9493052l3752c7e0afb6eb3c@mail.gmail.com> (raw)
In-Reply-To: <4B741A44.7060003@dcl.info.waseda.ac.jp>
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.
> 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... ;)
--
Erik "kusma" Faye-Lund
next prev parent reply other threads:[~2010-02-11 14:59 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-06 19:26 imap.preformattedHTML and imap.sslverify Junio C Hamano
2010-02-08 22:31 ` Jeremy White
2010-02-08 23:05 ` Junio C Hamano
2010-02-09 12:09 ` [PATCH 0/4] Some improvements for git-imap-send Hitoshi Mitake
2010-02-09 15:06 ` Jeff King
2010-02-09 15:13 ` Erik Faye-Lund
2010-02-09 16:57 ` Jeff King
2010-02-09 18:37 ` Erik Faye-Lund
2010-02-09 18:54 ` Jeff King
2010-02-11 14:38 ` [PATCH v2 1/2] git-imap-send: Add CRAM-MD5 authenticate method support Hitoshi Mitake
2010-02-11 14:55 ` Erik Faye-Lund
2010-02-11 14:59 ` Hitoshi Mitake
2010-02-11 15:06 ` [PATCH v3 " Hitoshi Mitake
2010-02-11 20:30 ` Junio C Hamano
2010-02-12 11:23 ` Hitoshi Mitake
2010-02-11 14:38 ` [PATCH v2 2/2] git-imap-send: Convert LF to CRLF before storing patch to draft box Hitoshi Mitake
2010-02-11 20:48 ` Junio C Hamano
2010-02-12 11:24 ` Hitoshi Mitake
2010-02-11 14:45 ` [PATCH v2 1/2] git-imap-send: Add CRAM-MD5 authenticate method support Hitoshi Mitake
2010-02-11 14:45 ` [PATCH v2 2/2] git-imap-send: Convert LF to CRLF before storing patch to draft box Hitoshi Mitake
2010-02-12 11:36 ` [PATCH v4 1/2] git-imap-send: Add CRAM-MD5 authenticate method support Hitoshi Mitake
2010-02-12 12:41 ` Erik Faye-Lund
2010-02-13 4:21 ` Hitoshi Mitake
2010-02-12 21:44 ` Junio C Hamano
2010-02-13 6:49 ` Hitoshi Mitake
2010-02-13 6:56 ` [PATCH v5 " Hitoshi Mitake
2010-02-13 7:42 ` [PATCH v4 " Junio C Hamano
2010-02-16 6:34 ` Junio C Hamano
2010-02-17 9:17 ` Hitoshi Mitake
2010-02-17 9:18 ` [PATCH v6 " Hitoshi Mitake
2010-02-17 18:31 ` [PATCH v4 " Junio C Hamano
2010-02-18 15:45 ` Hitoshi Mitake
2010-02-17 8:51 ` Hitoshi Mitake
2010-02-12 11:36 ` [PATCH v4 2/2] git-imap-send: Convert LF to CRLF before storing patch to draft box Hitoshi Mitake
2010-02-09 12:09 ` [PATCH 1/4] Add base64 encoder and decoder Hitoshi Mitake
2010-02-09 14:45 ` Erik Faye-Lund
2010-02-11 14:37 ` Hitoshi Mitake
2010-02-09 12:09 ` [PATCH 2/4] Add stuffs for MD5 hash algorithm Hitoshi Mitake
2010-02-09 12:09 ` [PATCH 3/4] git-imap-send: Implement CRAM-MD5 auth method Hitoshi Mitake
2010-02-09 14:22 ` Erik Faye-Lund
2010-02-11 14:55 ` Hitoshi Mitake
2010-02-11 14:59 ` Erik Faye-Lund [this message]
2010-02-11 15:11 ` Hitoshi Mitake
2010-02-09 12:09 ` [PATCH 4/4] git-imap-send: Add method to convert from LF to CRLF Hitoshi Mitake
2010-02-09 16:15 ` Jakub Narebski
2010-02-11 14:37 ` Hitoshi Mitake
2010-02-09 17:24 ` Linus Torvalds
2010-02-09 18:20 ` Junio C Hamano
2010-02-11 14:38 ` Hitoshi Mitake
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=40aa078e1002110659y9493052l3752c7e0afb6eb3c@mail.gmail.com \
--to=kusmabite@googlemail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jwhite@codeweavers.com \
--cc=kusmabite@gmail.com \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=robertshearman@gmail.com \
/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).