On Wed, Aug 6, 2008 at 8:28 PM, Wietse Venema <[EMAIL PROTECTED]> wrote:
> Seblu:
>> On Tue, Aug 5, 2008 at 12:56 PM, Wietse Venema <[EMAIL PROTECTED]> wrote:
>> > Seblu:
>> > [ Charset ISO-8859-1 unsupported, converting... ]
>> >> Hello,
>> >>
>> >> i use postfix postfix 2.5.1 on an OpenBSD 4.3 and i have a stange
>> >> behaviour (for me) with DNS lookup in logs.
>> >>
>> >> i've a local dns, which resolv 192.42.42.1 to toto.titi
>> >>
>> >> # host 192.42.42.1
>> >> 1.42.42.192.in-addr.arpa domain name pointer toto.titi.
>> >
>> > Not here:
>> >
>> > % host 192.42.42.1
>> > 1.42.42.192.in-addr.arpa domain name pointer accessa.unine.ch.
>> >
>> > Check your resolv.conf files.
>>
>> My resolv.conf is :
>>
>> search toto
>> nameserver 127.0.0.1
>> lookup file bind
>>
>>
>> but if my resolv.conf was not good, host command not answer corrrectly. No ?
>>
>> I paste the dig result.
>>
>>
>> # dig -t ptr 1.42.42.192.in-addr.arpa @127.0.0.1
>>
>> ; <<>> DiG 9.4.2 <<>> -t ptr 1.42.42.192.in-addr.arpa @127.0.0.1
>> ;; global options: printcmd
>> ;; Got answer:
>> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10197
>> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
>>
>> ;; QUESTION SECTION:
>> ;1.42.42.192.in-addr.arpa. IN PTR
>>
>> ;; ANSWER SECTION:
>> 1.42.42.192.in-addr.arpa. 3600 IN PTR raptor.toto.
>>
>> ;; AUTHORITY SECTION:
>> 42.42.192.in-addr.arpa. 3600IN NS ns.toto.
>>
>> ;; ADDITIONAL SECTION:
>> ns.toto. 3600IN A 192.42.42.254
>>
>> ;; Query time: 2 msec
>> ;; SERVER: 127.0.0.1#53(127.0.0.1)
>> ;; WHEN: Wed Aug 6 18:54:28 2008
>> ;; MSG SIZE rcvd: 110
>>
>>
>> and the arp command has a right answer
>>
>> # arp -a
>> toto.titi (192.42.42.1) at 00:1d:7d:03:6a:zb on vlan42
>>
>>
>> I'm really lost.
>
> Postfix does not use DNS to look up the SMTP client hostname.
> Postfix uses the getnameinfo() system library routine.
>
> If the getnameinfo() system library routine does not produce the
> answer that you like to see, then that is not a problem in Postfix.
> It can be solved by someone who is familiar with the implementation
> details of OpenBSD.
ok but
cerber /tmp # cat test2.c
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MYPORT 3490// the port users will be connecting to
int main(void)
{
int sockfd, new_fd; // listen on sock_fd, new connection on new_fd
struct sockaddr_in my_addr;// my address information
struct sockaddr_in their_addr; // connector's address information
socklen_t sin_size;
int yes=1;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
perror("setsockopt");
exit(1);
}
my_addr.sin_family = AF_INET; // host byte order
my_addr.sin_port = htons(MYPORT); // short, network byte order
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill with my IP
memset(my_addr.sin_zero, '\0', sizeof my_addr.sin_zero);
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof my_addr) == -1) {
perror("bind");
exit(1);
}
if (listen(sockfd, 2) == -1) {
perror("listen");
exit(1);
}
while(1) { // main accept() loop
sin_size = sizeof their_addr;
if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr, \
&sin_size)) == -1) {
perror("accept");
continue;
}
printf("server: got connection from %s\n", \
inet_ntoa(their_addr.sin_addr));
if (send(new_fd, "Hello, world!\n", 14, 0) == -1) {
perror("send");
}
char hbuf[NI_MAXHOST];
int ret = getnameinfo((struct sockaddr *) &their_addr, ((struct
sockaddr *) &their_addr)->sa_len, hbuf, sizeof(hbuf), NULL, 0,
NI_NAMEREQD);
if (ret)
errx(1, gai_strerror(ret));
else
printf("host=%s\n", hbuf);
close(new_fd); // parent doesn't need this
}
return 0;}
and after a test my binary return a good resolution
./a.out
server: got connection from 192.42.42.1
host=toto.titi
and the function gethostbyaddr return also a good answer !
I don't do a system OpenBSD bug report because, because all others
soft have a normal behaviour.
If you don't have an idear, i can try with openbsd dev, like Wietse
suggest to me.
--
Sébastien Luttringer
www.seblu.net