Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case T_HOST:
- if (!gothost) {
- int i=0;
- struct in_addr **addr_list;
- struct hostent *he = gethostbyname(ap[i].x.from); //Le paso el domain permitido o prohibido
- //En he->addr_list me queda la lista de IPs que resuelven.
- if (he!=NULL)
- {
- addr_list = (struct in_addr **)he->h_addr_list;
- for(i = 0; addr_list[i] != NULL; i++) //Para todas las IPs de ese dominio
- {//Comparar con la IP r->connection->remote_ip. Si alguno matchea, pa'dentro, else denied
- char *ip=inet_ntoa( *(struct in_addr *) addr_list[i]);
- if (ip!=NULL) //Si tengo una IP
- if (strcmp (ip,r->connection->remote_ip)==0) //y concide con la remota
- return (1); //hemos encontrado la IP
- }
- }
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement