comparison src/lib/network.c @ 2113:c5817f302aa6 HEAD

net_gethostbyname() was broken with IPv6 enabled (wasn't really used with Dovecot anyway). Some other cleanups.
author Timo Sirainen <tss@iki.fi>
date Mon, 14 Jun 2004 02:37:40 +0300
parents 24e382b88232
children a307ddd22a3a
comparison
equal deleted inserted replaced
2112:55d3864cc4f8 2113:c5817f302aa6
440 440
441 count = 0; 441 count = 0;
442 for (ai = origai; ai != NULL; ai = ai->ai_next, count++) { 442 for (ai = origai; ai != NULL; ai = ai->ai_next, count++) {
443 so = (union sockaddr_union *) ai->ai_addr; 443 so = (union sockaddr_union *) ai->ai_addr;
444 444
445 sin_get_ip(so, ips[count]); 445 sin_get_ip(so, &(*ips)[count]);
446 } 446 }
447 freeaddrinfo(origai); 447 freeaddrinfo(origai);
448 #else 448 #else
449 hp = gethostbyname(addr); 449 hp = gethostbyname(addr);
450 if (hp == NULL) 450 if (hp == NULL)
605 return error == HOST_NOT_FOUND || error == NO_ADDRESS; 605 return error == HOST_NOT_FOUND || error == NO_ADDRESS;
606 #endif 606 #endif
607 } 607 }
608 608
609 /* Get name of TCP service */ 609 /* Get name of TCP service */
610 char *net_getservbyport(unsigned short port) 610 const char *net_getservbyport(unsigned short port)
611 { 611 {
612 struct servent *entry; 612 struct servent *entry;
613 613
614 entry = getservbyport(htons(port), "tcp"); 614 entry = getservbyport(htons(port), "tcp");
615 return entry == NULL ? NULL : entry->s_name; 615 return entry == NULL ? NULL : entry->s_name;