]> git.pld-linux.org Git - packages/proftpd.git/blame - proftpd-v6_fix.patch
- use pam by default(originaly aren't authoritative)
[packages/proftpd.git] / proftpd-v6_fix.patch
CommitLineData
473c64f9
PG
1--- ./src/inet.c.org Mon Oct 22 01:22:33 2001
2+++ ./src/inet.c Mon Oct 22 01:29:14 2001
3@@ -211,60 +211,27 @@
4 * memory.
5 */
6
7-char *inet_ascii(pool *pool, p_in_addr_t *addr)
8+char *inet_ascii(pool *pool, struct sockaddr_storage *addr)
9 {
10 char *res = NULL;
11
12- if((res = inet_ntoa(*addr)) != NULL)
13+ if((res = INET_NTOA(addr)) != NULL)
14 res = pstrdup(pool,res);
15
16 return res;
17 }
18
19 /* Given an ip addresses, return the FQDN */
20-char *inet_getname(pool *pool, p_in_addr_t *addr)
21+char *inet_getname(pool *pool, struct sockaddr_storage *addr)
22 {
23+ char name[1025] = {'\0'};
24 char *res = NULL;
25 char **checkaddr;
26- struct hostent *hptr_rev = NULL, *hptr_forw = NULL;
27 static char *res_cache = NULL;
28- static p_in_addr_t *addr_cache = NULL;
29
30- if(reverse_dns) {
31- if(res_cache && addr_cache && addr_cache->s_addr == addr->s_addr) {
32- res = pstrdup(pool, res_cache);
33- return inet_validate(res);
34- }
35-
36- if((hptr_rev = gethostbyaddr((const char *)addr,
37- sizeof(p_in_addr_t), AF_INET)) != NULL) {
38- if((hptr_forw = gethostbyname(hptr_rev->h_name)) != NULL) {
39- for(checkaddr = hptr_forw->h_addr_list; *checkaddr; ++checkaddr) {
40- if(((p_in_addr_t*)(*checkaddr))->s_addr == addr->s_addr) {
41- res = pstrdup(pool, hptr_rev->h_name);
42- break;
43- }
44- }
45- }
46- }
47- }
48-
49- if(!res)
50- res = pstrdup(pool, inet_ntoa(*addr));
51-
52- if(reverse_dns) {
53- /* cache the result */
54- if(!addr_cache)
55- addr_cache = malloc(sizeof(p_in_addr_t));
56-
57- if(addr_cache)
58- memcpy(addr_cache, addr, sizeof(p_in_addr_t));
59-
60- if(res_cache)
61- free(res_cache);
62-
63- res_cache = strdup(res);
64- }
65+ getnameinfo((struct sockaddr *)addr, sizeof(struct sockaddr_storage),
66+ name, sizeof(name), NULL, 0, 0);
67+ res = pstrdup(pool, name);
68
69 return inet_validate(res);
70 }
This page took 0.034818 seconds and 4 git commands to generate.