static bool check_access(int sock, const char **allow_list,
			 const char **deny_list)
{
	bool ret = false;
	bool only_ip = false;
	char addr[INET6_ADDRSTRLEN];

	if ((!deny_list || *deny_list==0) && (!allow_list || *allow_list==0)) {
		return true;
	}

	/* Bypass name resolution calls if the lists
	 * only contain IP addrs */
	if (only_ipaddrs_in_list(allow_list) &&
	    only_ipaddrs_in_list(deny_list)) {
		only_ip = true;
		DEBUG (3, ("check_access: no hostnames "
			   "in host allow/deny list.\n"));
		ret = allow_access(deny_list,
				   allow_list,
				   "",
				   get_peer_addr(sock,addr,sizeof(addr)));
	} else {
		DEBUG (3, ("check_access: hostnames in "
			   "host allow/deny list.\n"));
		ret = allow_access(deny_list,
				   allow_list,
				   get_peer_name(sock,true),
				   get_peer_addr(sock,addr,sizeof(addr)));
	}

	if (ret) {
		DEBUG(2,("Allowed connection from %s (%s)\n",
			 only_ip ? "" : get_peer_name(sock,true),
			 get_peer_addr(sock,addr,sizeof(addr))));
	} else {
		DEBUG(0,("Denied connection from %s (%s)\n",
			 only_ip ? "" : get_peer_name(sock,true),
			 get_peer_addr(sock,addr,sizeof(addr))));
	}

	return(ret);
}
static bool check_access(int sock, const char **allow_list,
			 const char **deny_list)
{
	bool ret = false;
	bool only_ip = false;
	char addr[INET6_ADDRSTRLEN];

	if ((!deny_list || *deny_list==0) && (!allow_list || *allow_list==0)) {
		return true;
	}

	 
	if (only_ipaddrs_in_list(allow_list) &&
	    only_ipaddrs_in_list(deny_list)) {
		only_ip = true;
		DEBUG (3, ("check_access: no hostnames "
			   "in host allow/deny list.\n"));
		ret = allow_access(deny_list,
				   allow_list,
				   "",
				   get_peer_addr(sock,addr,sizeof(addr)));
	} else {
		DEBUG (3, ("check_access: hostnames in "
			   "host allow/deny list.\n"));
		ret = allow_access(deny_list,
				   allow_list,
				   get_peer_name(sock,true),
				   get_peer_addr(sock,addr,sizeof(addr)));
	}

	if (ret) {
		DEBUG(2,("Allowed connection from %s (%s)\n",
			 only_ip ? "" : get_peer_name(sock,true),
			 get_peer_addr(sock,addr,sizeof(addr))));
	} else {
		DEBUG(0,("Denied connection from %s (%s)\n",
			 only_ip ? "" : get_peer_name(sock,true),
			 get_peer_addr(sock,addr,sizeof(addr))));
	}

	return(ret);
}