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

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

 



On Tue, Apr 22, 2008 at 10:11:59AM +0100, Andy Parkins wrote:

> I'm sure you are correct, but as I say - it's not guaranteed.  Since
> git-imap-send can't know what this particular tunnel requires it shouldn't
> force the creation of a dummy option.  If the tunnel does require a
> hostname then there is a place to put it, and the person writing the tunnel
> line can decide that.

I think Junio's point is that it's easy to start dereferencing NULL,
because later parts of the code assume that "host" is always set, even
if only to use it for informational purposes. So those callsites either
need to be fixed to handle a NULL host, or perhaps something like this
instead (totally untested):

diff --git a/imap-send.c b/imap-send.c
index 04afbc4..db65597 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1303,8 +1303,11 @@ main(int argc, char **argv)
 		return 1;
 	}
 	if (!server.host) {
-		fprintf( stderr, "no imap host specified\n" );
-		return 1;
+		if (!server.tunnel) {
+			fprintf( stderr, "no imap host specified\n" );
+			return 1;
+		}
+		server.host = "tunnel";
 	}
 
 	/* read the messages */

-Peff
--
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]

  Powered by Linux