[dovecot-cvs]
dovecot/src/lib fd-close-on-exec.c,1.5,1.6 network.c,1.17,1.18
network.h,1.9,1.10
cras at procontrol.fi
cras at procontrol.fi
Sun May 18 20:37:07 EEST 2003
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv27890/lib
Modified Files:
fd-close-on-exec.c network.c network.h
Log Message:
s/host/addr/ in a few network functions
Index: fd-close-on-exec.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/fd-close-on-exec.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- fd-close-on-exec.c 17 Mar 2003 04:40:39 -0000 1.5
+++ fd-close-on-exec.c 18 May 2003 16:37:04 -0000 1.6
@@ -68,7 +68,7 @@
}
i_panic("Leaked socket fd %d: %s:%u",
- first_fd, net_ip2host(&addr), port);
+ first_fd, net_ip2addr(&addr), port);
}
if (fstat(first_fd, &st) == 0) {
Index: network.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- network.c 4 Mar 2003 02:18:09 -0000 1.17
+++ network.c 18 May 2003 16:37:04 -0000 1.18
@@ -499,16 +499,16 @@
return 0;
}
-const char *net_ip2host(const struct ip_addr *ip)
+const char *net_ip2addr(const struct ip_addr *ip)
{
#ifdef HAVE_IPV6
- char host[MAX_IP_LEN+1];
+ char addr[MAX_IP_LEN+1];
- host[MAX_IP_LEN] = '\0';
- if (inet_ntop(ip->family, &ip->ip, host, MAX_IP_LEN) == NULL)
+ addr[MAX_IP_LEN] = '\0';
+ if (inet_ntop(ip->family, &ip->ip, addr, MAX_IP_LEN) == NULL)
return NULL;
- return t_strdup(host);
+ return t_strdup(addr);
#else
unsigned long ip4;
@@ -525,13 +525,13 @@
return 0;
}
-int net_host2ip(const char *host, struct ip_addr *ip)
+int net_addr2ip(const char *addr, struct ip_addr *ip)
{
- if (strchr(host, ':') != NULL) {
+ if (strchr(addr, ':') != NULL) {
/* IPv6 */
ip->family = AF_INET6;
#ifdef HAVE_IPV6
- if (inet_pton(AF_INET6, host, &ip->ip) == 0)
+ if (inet_pton(AF_INET6, addr, &ip->ip) == 0)
return -1;
#else
ip->ip.s_addr = 0;
@@ -539,7 +539,7 @@
} else {
/* IPv4 */
ip->family = AF_INET;
- if (inet_aton(host, (struct in_addr *) &ip->ip) == 0)
+ if (inet_aton(addr, (struct in_addr *) &ip->ip) == 0)
return -1;
}
@@ -607,23 +607,23 @@
return entry == NULL ? NULL : entry->s_name;
}
-int is_ipv4_address(const char *host)
+int is_ipv4_address(const char *addr)
{
- while (*host != '\0') {
- if (*host != '.' && !i_isdigit(*host))
+ while (*addr != '\0') {
+ if (*addr != '.' && !i_isdigit(*addr))
return 0;
- host++;
+ addr++;
}
return 1;
}
-int is_ipv6_address(const char *host)
+int is_ipv6_address(const char *addr)
{
- while (*host != '\0') {
- if (*host != ':' && !i_isxdigit(*host))
+ while (*addr != '\0') {
+ if (*addr != ':' && !i_isxdigit(*addr))
return 0;
- host++;
+ addr++;
}
return 1;
Index: network.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/network.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- network.h 5 Jan 2003 13:09:51 -0000 1.9
+++ network.h 18 May 2003 16:37:04 -0000 1.10
@@ -91,9 +91,9 @@
int net_getsockname(int fd, struct ip_addr *addr, unsigned int *port);
/* Returns ip_addr as string, or NULL if ip is invalid. */
-const char *net_ip2host(const struct ip_addr *ip);
+const char *net_ip2addr(const struct ip_addr *ip);
/* char* -> struct ip_addr translation. */
-int net_host2ip(const char *host, struct ip_addr *ip);
+int net_addr2ip(const char *addr, struct ip_addr *ip);
/* Get socket error */
int net_geterror(int fd);
@@ -101,7 +101,7 @@
/* Get name of TCP service */
char *net_getservbyport(unsigned short port);
-int is_ipv4_address(const char *host);
-int is_ipv6_address(const char *host);
+int is_ipv4_address(const char *addr);
+int is_ipv6_address(const char *addr);
#endif
More information about the dovecot-cvs
mailing list