kopia lustrzana https://gitlab.com/sane-project/backends
Replaces a strncmp() call by a macro detecting V4-mapped address. This is a
lot safer than the strncmp, and doesn't break anything. Patch from Julien BLACHE <jb@jblache.org>.merge-requests/1/head
rodzic
8f240bbce4
commit
d3322e4519
|
@ -2,6 +2,9 @@
|
|||
|
||||
* po/sane-backends.fr.po: Updated french translation (from Yann
|
||||
E. MORIN <yann dot morin dot 1998 at anciens dot enib dot fr>).
|
||||
* frontends/saned.c: Replaces a strncmp() call by a macro detecting
|
||||
V4-mapped address. This is a lot safer than the strncmp, and doesn't
|
||||
break anything. Patch from Julien BLACHE <jb@jblache.org>.
|
||||
|
||||
2003-05-11 Eddy De Greef <eddy_de_greef at tiscali dot be>
|
||||
|
||||
|
|
|
@ -150,6 +150,11 @@ poll (struct pollfd *ufds, unsigned int nfds, int timeout)
|
|||
&& ((const uint32_t *) (a))[1] == 0 \
|
||||
&& ((const uint32_t *) (a))[2] == 0 \
|
||||
&& ((const uint32_t *) (a))[3] == htonl (1))
|
||||
|
||||
#define SANE_IN6_IS_ADDR_V4MAPPED(a) \
|
||||
((((const uint32_t *) (a))[0] == 0) \
|
||||
&& (((const uint32_t *) (a))[1] == 0) \
|
||||
&& (((const uint32_t *) (a))[2] == htonl (0xffff)))
|
||||
#endif /* ENABLE_IPV6 */
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
|
@ -503,8 +508,10 @@ check_host (int fd)
|
|||
else
|
||||
remote_ip = strdup (hostname);
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
if (strncmp (remote_ip, "::ffff:", 7) == 0)
|
||||
#ifdef ENABLE_IPV6
|
||||
sin6 = (struct sockaddr_in6 *) &remote_address;
|
||||
|
||||
if (SANE_IN6_IS_ADDR_V4MAPPED (sin6->sin6_addr.s6_addr))
|
||||
{
|
||||
DBG (DBG_DBG, "check_host: detected an IPv4-mapped address\n");
|
||||
remote_ipv4 = remote_ip + 7;
|
||||
|
@ -548,9 +555,6 @@ check_host (int fd)
|
|||
#endif /* ENABLE_IPV6 */
|
||||
|
||||
sin = (struct sockaddr_in *) &remote_address;
|
||||
#ifdef ENABLE_IPV6
|
||||
sin6 = (struct sockaddr_in6 *) &remote_address;
|
||||
#endif /* ENABLE_IPV6 */
|
||||
|
||||
switch (remote_address.ss_family)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue