other-licenses/android/resolv_static.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /*
     2  * This version of this file is derived from Android 2.3 "Gingerbread",
     3  * which contains uncredited changes by Android/Google developers.  It has
     4  * been modified in 2011 for use in the Android build of Mozilla Firefox by
     5  * Mozilla contributors (including Michael Edwards <m.k.edwards@gmail.com>,
     6  * and Steve Workman <sjhworkman@gmail.com>).
     7  * These changes are offered under the same license as the original NetBSD
     8  * file, whose copyright and license are unchanged above.
     9  */
    11 #ifndef _RESOLV_STATIC_H
    12 #define _RESOLV_STATIC_H
    14 #include <netdb.h>
    16 /* this structure contains all the variables that were declared
    17  * 'static' in the original NetBSD resolver code.
    18  *
    19  * this caused vast amounts of crashes and memory corruptions
    20  * when the resolver was being used by multiple threads.
    21  *
    22  * (note: the OpenBSD/FreeBSD resolver has similar 'issues')
    23  */
    25 #define	MAXALIASES	35
    26 #define	MAXADDRS	35
    28 typedef struct res_static {
    29     char*           h_addr_ptrs[MAXADDRS + 1];
    30     char*           host_aliases[MAXALIASES];
    31     char            hostbuf[8*1024];
    32     u_int32_t       host_addr[16 / sizeof(u_int32_t)];  /* IPv4 or IPv6 */
    33     FILE*           hostf;
    34     int             stayopen;
    35     const char*     servent_ptr;
    36     struct servent  servent;
    37     struct hostent  host;
    38 } *res_static;
    40 extern res_static __res_get_static(void);
    42 #endif /* _RESOLV_STATIC_H */

mercurial