1 /*
2  * Copyright (c) 2009, 2011, 2012
3  *      Inferno Nettverk A/S, Norway.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. The above copyright notice, this list of conditions and the following
9  *    disclaimer must appear in all copies of the software, derivative works
10  *    or modified versions, and any portions thereof, aswell as in all
11  *    supporting documentation.
12  * 2. All advertising materials mentioning features or use of this software
13  *    must display the following acknowledgement:
14  *      This product includes software developed by
15  *      Inferno Nettverk A/S, Norway.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * Inferno Nettverk A/S requests users of this software to return to
31  *
32  *  Software Distribution Coordinator  or  sdc@inet.no
33  *  Inferno Nettverk A/S
34  *  Oslo Research Park
35  *  Gaustadall�en 21
36  *  NO-0349 Oslo
37  *  Norway
38  *
39  * any improvements or extensions that they make and grant Inferno Nettverk A/S
40  * the rights to redistribute these changes.
41  *
42  */
43 
44 /* $Id: socks_glibc.h,v 1.10 2012/06/01 20:23:05 karls Exp $ */
45 
46 /*
47  * Workaround for limitations in newer glibc versions, where LD_PRELOAD
48  * cannot intercept system calls made by glibc.
49  *
50  * Code contributed by Markus Moeller (markus_moeller at compuserve.com),
51  * thanks.
52  */
53 
54 #if HAVE_GSSAPI
55 #define gets Rgets
56 #define fgetc Rfgetc
57 #define fgets Rfgets
58 #define fputc Rfputc
59 #define fputs Rfputs
60 #define fflush Rfflush
61 #define fclose Rfclose
62 #define fprintf Rfprintf
63 #define vfprintf Rvfprintf
64 #define fwrite Rfwrite
65 #define fread Rfread
66 #define puts(x) Rfputs(x, stdout)
67 #define printf(x, ...) Rfprintf(stdout,x, __VA_ARGS__)
68 #define vprintf(x, y)  Rvfprintf(stdout,x, y)
69 /* Undefine any macro */
70 #ifdef getc
71 #undef getc
72 #endif
73 #define getc Rfgetc
74 /* Undefine any macro */
75 #ifdef putc
76 #undef putc
77 #endif
78 #define putc Rfputc
79 /* Some Linux functions */
80 #ifdef __fprintf_chk
81 #undef __fprintf_chk
82 #endif
83 #define __fprintf_chk Rfprintf
84 #ifdef __vfprintf_chk
85 #undef __vfprintf_chk
86 #endif
87 #define __vfprintf_chk Rvfprintf
88 
89 int Rfgetc(FILE *fp);
90 int Rfputc(int c, FILE *fp);
91 char *Rgets(char *s);
92 char *Rfgets(char *s, int size, FILE *fp);
93 int Rfputs(const char *s, FILE *fp);
94 int Rfprintf(FILE *fp, const char *s, ...);
95 int Rvfprintf(FILE *fp, const char *s, va_list ap);
96 size_t Rfwrite(const void *ptr, size_t size, size_t nmb, FILE *fp);
97 size_t Rfread(void *ptr, size_t size, size_t nmb, FILE *fp);
98 int Rfflush(FILE *fp);
99 int Rfclose(FILE *fp);
100 #endif /* HAVE_GSSAPI */
101