9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] imap4d funny
@ 2008-06-18  0:53 erik quanstrom
  2008-06-18  2:12 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2008-06-18  0:53 UTC (permalink / raw)
  To: 9fans

perhaps i'm missing something, but i don't understand why
imap4d sets its site the way it does.  the relevant code is
so (edited for brevity):

	servername = csquery("sys", sysname(), "dom");
	t = getenv("site");
	if(t == nil)
		site = servername;
	else{
		n = strlen(t);
		s = strchr(servername, '.');
		if(s == nil)
			s = servername;
		else
			s++;
		n += strlen(s) + 2;
		site = emalloc(n);
		snprint(site, n, "%s.%s", t, s);
	}

thus if site=coraid.com and servername gets set to
rb2.coraid.com, then site will be coraid.com.coraid.com.
this results in envelops than can be mighty screwy if
no @ appears in the from line, for example:

6 uid fetch 7 (envelope)
* 4 FETCH (UID 7 ENVELOPE ("Tue, 17 Jun 2008 19:13:44 -0400" "testing123" (("erik quanstrom" NIL "quanstro" "coraid.com.coraid.com")) (("erik quanstrom" NIL "quanstro" "coraid.com.coraid.com")) (("erik quanstrom" NIL "quanstro" "coraid.com.coraid.com")) NIL NIL NIL NIL NIL))


i think it should be more like

	servername = csquery("sys", sysname(), "dom");
	site = getenv("site");
	if(site == nil){
		site = strchr(servername, '.');
		if(site == nil)
			site = servername;
		else
			site++;
	}

am i missing something?

- erik




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] imap4d funny
  2008-06-18  0:53 [9fans] imap4d funny erik quanstrom
@ 2008-06-18  2:12 ` Russ Cox
  2008-06-18  2:22   ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2008-06-18  2:12 UTC (permalink / raw)
  To: 9fans

> thus if site=coraid.com and servername gets set to
> rb2.coraid.com, then site will be coraid.com.coraid.com.

If you want to change the local mail domain,
you have to use the option

	-d me.coraid.com

The man page clearly says that if that's not specified,
then it uses $site with the domain from the server name.
So you're expected to use

	site=glenda

and then it turns that into glenda.coraid.com.

I'm not claiming it's fantastic--I'd get rid
of $site entirely--but it is working as documented.
You're just not using it the way it's intended to be used.

Russ



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] imap4d funny
  2008-06-18  2:12 ` Russ Cox
@ 2008-06-18  2:22   ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2008-06-18  2:22 UTC (permalink / raw)
  To: 9fans

> The man page clearly says that if that's not specified,
> then it uses $site with the domain from the server name.
> So you're expected to use
>
> 	site=glenda
>
> and then it turns that into glenda.coraid.com.
>
> I'm not claiming it's fantastic--I'd get rid
> of $site entirely--but it is working as documented.
> You're just not using it the way it's intended to be used.

that would make more sense to me if in upas
domainname_read() didn't end up using $site as
the first potential value for domainname_read().

- erik




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-18  2:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-18  0:53 [9fans] imap4d funny erik quanstrom
2008-06-18  2:12 ` Russ Cox
2008-06-18  2:22   ` erik quanstrom

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).