On 2013-08-16 02:15, Emmanuel Dreyfus wrote: > Hajimu UMEMOTO <ume@...> wrote: > >> However, I'm >> not sure if there is such implementation that changes addr on fail. >> POSIX says only on success: >> >> Upon successful completion, getnameinfo() shall return the node >> and service names, if requested, in the buffers provided. The >> returned names are always null-terminated strings. > > Thank you for digging that out. Let us start with assuming the standard > are honoured, we will add workaround later if they are not. The way I read it, the standard only determines the actions about success, and not about failure - which is implementation-dependent (replace the original string with the IP address number, or don't touch the original string at all). Given that the milter-greylist rulesets may depend on bracketed names (as mine do, to delay the message until a later retry might have successful DNS resolution), I think it would be portable to ensure that we do the same thing on all platforms - by using the getnameinfo() with a temporary copy of the string, inspecting the return code, and copying the string into original buffer if it resolved successfully. This way we won't have to guess later on about esoteric (or popular) platforms which might have private quirks. This only costs a few lines of code and about 300 bytes of temporary buffer space ;) //Jim
Message
Re: [milter-greylist] Submitter DNS name resolution and forgery detection
2013-08-16 by Jim Klimov
Attachments
- No local attachments were found for this message.