On Tue, Jul 09, 2013 at 05:30:55PM +0200, Stephan Schulz wrote:
> > 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)
>
Below is a diff based on yours but with two small changes:
- uses strlcpy() instead of strcpy()
- uses strcspn() instead of the strtok()
Can you confirm it still works for you ?
diff --git a/smtpd/parse.y b/smtpd/parse.y
index cc4f599..e481405 100644
--- a/smtpd/parse.y
+++ b/smtpd/parse.y
@@ -1383,10 +1383,10 @@ parse_config(struct smtpd *x_conf, const char
*filename, int opts)
struct sym *sym, *next;
struct table *t;
char hostname[SMTPD_MAXHOSTNAMELEN];
+ char hostname_copy[SMTPD_MAXHOSTNAMELEN];
- if (! getmailname(hostname, sizeof hostname)) {
+ if (! getmailname(hostname, sizeof hostname))
return (-1);
- }
conf = x_conf;
bzero(conf, sizeof(*conf));
@@ -1453,6 +1453,11 @@ parse_config(struct smtpd *x_conf, const char *filename,
int opts)
table_add(t, "localhost", NULL);
table_add(t, hostname, NULL);
+ (void)strlcpy(hostname_copy, hostname, sizeof hostname_copy);
+ hostname_copy[strcspn(hostname_copy, ".")] = '\0';
+ if (strcmp(hostname, hostname_copy) != 0)
+ table_add(t, hostname_copy, NULL);
+
table_create("getpwnam", "<getpwnam>", NULL, NULL);
/*
--
Gilles Chehade
https://www.poolp.org @poolpOrg
--
You received this email because you are subscribed to mailing list:
[email protected]
To unsubscribe, send mail with subject:
[[email protected]] unregister