> On Sun, Jul 07, 2013 at 09:54:53PM +0200, Stephan Schulz wrote: >> Any thoughts? >> > > yes. > you found a bug ;-)
ok, so here find a patch for it :) (against the just released portable
version)
--- opensmtpd-201307091512p1/smtpd/parse.y 2013-07-09
15:02:47.000000000 +0200
+++ opensmtpd-201307091512p1_patched/smtpd/parse.y 2013-07-09
17:19:45.956010425 +0200
@@ -1389,6 +1389,7 @@ parse_config(struct smtpd *x_conf, const
struct sym *sym, *next;
struct table *t;
char hostname[SMTPD_MAXHOSTNAMELEN];
+ char hostname_without_domain[SMTPD_MAXHOSTNAMELEN];
if (! getmailname(hostname, sizeof hostname)) {
return (-1);
@@ -1459,6 +1460,18 @@ parse_config(struct smtpd *x_conf, const
table_add(t, "localhost", NULL);
table_add(t, hostname, NULL);
+ /*
+ * save copy of hostname as strtok will modify its argument
+ */
+ strcpy(hostname_without_domain, hostname);
+ if (strtok(hostname_without_domain, ".") != NULL)
+ /*
+ * the first token is replaced with NULL which
+ * truncates hostname_without_domain to what
+ * its name says
+ */
+ table_add(t, hostname_without_domain, NULL);
+
table_create("getpwnam", "<getpwnam>", NULL, NULL);
/*
localhost.patch
Description: Binary data
