|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Victor Duchovni (Victor.Duchovni
morganstanley.com)
Date: Wed Apr 23 2008 - 11:48:33 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Apr 23, 2008 at 06:56:02AM -0400, Wietse Venema wrote:
> > Something along the lines of:
> >
> > Index: src/smtpd/smtpd.c
> > --- src/smtpd/smtpd.c 31 Mar 2008 03:41:59 -0000 1.1.1.3.12.1
> > +++ src/smtpd/smtpd.c 23 Apr 2008 00:46:48 -0000
> > 
-3741,9 +3741,10 
> > state->xforward.namaddr =
> > IS_AVAIL_CLIENT_ADDR(state->xforward.addr) ?
> > concatenate(state->xforward.name, "[",
> > - state->xforward.addr, "]:",
> > - state->xforward.port,
> > - (char *) 0) : mystrdup(state->xforward.name);
> > + state->xforward.addr, "]",
> > + var_smtpd_client_port_log ? ":" : (char *) 0,
> > + state->xforward.port, (char *) 0) :
> > + mystrdup(state->xforward.name);
> > }
> > smtpd_chat_reply(state, "250 2.0.0 Ok");
> > return (0);
>
> I also think it is a good idea to specify the format of mumble.namaddr
> in one place (not multiple copies), when it's format becomes subject to
> additional conditions. A simple macro would do the job.
Yes, you are quite right about that (also needed in xclient_cmd()):
Index: src/smtpd/smtpd.h
--- src/smtpd/smtpd.h 16 Jan 2008 04:42:24 -0000 1.1.1.1
+++ src/smtpd/smtpd.h 23 Apr 2008 16:40:22 -0000

-180,6 +180,14 
ssize_t milter_argc;
} SMTPD_STATE;
+ /*
+ * Construct name[addr] or name[addr]:port as appropriate
+ */
+#define BUILD_NAMADDRPORT(name, addr, port) \
+ concatenate((name), "[", (addr), "]", \
+ var_smtpd_client_port_log ? ":" : (char *) 0, \
+ (port), (char *) 0)
+
#define SMTPD_FLAG_HANGUP (1<<0) /* disconnect */
#define SMTPD_STATE_XFORWARD_INIT (1<<0) /* xforward preset done */
Index: src/smtpd/smtpd.c
--- src/smtpd/smtpd.c 31 Mar 2008 03:41:59 -0000 1.1.1.3.12.1
+++ src/smtpd/smtpd.c 23 Apr 2008 16:45:22 -0000

-3474,8 +3474,7 
if (state->namaddr)
myfree(state->namaddr);
state->namaddr =
- concatenate(state->name, "[", state->addr, "]:",
- state->port, (char *) 0);
+ BUILD_NAMADDRPORT(state->name, state->addr, state->port);
}
/*

-3740,10 +3739,9 
myfree(state->xforward.namaddr);
state->xforward.namaddr =
IS_AVAIL_CLIENT_ADDR(state->xforward.addr) ?
- concatenate(state->xforward.name, "[",
- state->xforward.addr, "]:",
- state->xforward.port,
- (char *) 0) : mystrdup(state->xforward.name);
+ BUILD_NAMADDRPORT(state->xforward.name, state->xforward.addr,
+ state->xforward.port) :
+ mystrdup(state->xforward.name);
}
smtpd_chat_reply(state, "250 2.0.0 Ok");
return (0);
Index: src/smtpd/smtpd_peer.c
===================================================================
RCS file: /ms/dev/itsmg/postfix/cvs-dirs/20080115/postfix/src/smtpd/smtpd_peer.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 smtpd_peer.c
--- src/smtpd/smtpd_peer.c 22 Mar 2008 04:25:57 -0000 1.1.1.2
+++ src/smtpd/smtpd_peer.c 23 Apr 2008 16:41:14 -0000

-373,10 +373,7 
/*
* Do the name[addr]:port formatting for pretty reports.
*/
- state->namaddr =
- concatenate(state->name, "[", state->addr, "]",
- var_smtpd_client_port_log ? ":" : (char *) 0,
- state->port, (char *) 0);
+ state->namaddr = BUILD_NAMADDRPORT(state->name, state->addr, state->port);
}
/* smtpd_peer_reset - destroy peer information */
--
Viktor.
Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.
To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo
postfix.org?body=unsubscribe%20postfix-users>
If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]