Subject: Re: [PATCH] Don't force imap.host to be set when imap.tunnel is set

From: Junio C Hamano <[email-masked]>
Date: Mon, 21 Apr 2008 23:47:44 -0700

Andy Parkins <[email-masked]> writes:

> The documentation for git-imap-send suggests a tunnel setting such as
>
>   Tunnel = "ssh -q [email-masked] /usr/bin/imapd ./Maildir 2> /dev/null"
>
> which works wonderfully and doesn't require a username, password or port
> setting.
>
> However, git-imap-send currently requires that the imap.host variable be
> set in the config even when it was unused.  This led me to have to put
> the following in my .gitconfig.
>
>  [imap]
>    host = dummy
>
> This patch changes imap-send to only require that the imap.host setting
> is set if imap.tunnel is _not_ set.
>
> Signed-off-by: Andy Parkins <[email-masked]>

I am not an imap-send user myself, but is it the case that the use of
imap.tunnel always makes imap.host useless/unnecessary and safe to be left
as NULL?

My quick scan of imap-send.c suggests that

 * imap_open_store() does not look at host/port when tunnel is defined
   while connecting at the socket level;

 * however, when not preauth, "host" is used to issue error message when
   user is not set, and in prompt when pass needs to be asked.  I suspect
   you do not want to leave "host" NULL in this case.

Driving imapd standalone like the "tunnel" example you quoted above would
trigger preauth behaviour, so that should be safe, but I suspect there are
other ways to use tunnel to just relay the connection over the firewall,
while still requiring the client to authenticate the same way as usual.