~ubuntu-branches/ubuntu/maverick/gnutls26/maverick-updates

« back to all changes in this revision

Viewing changes to lgl/stdio.in.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2009-08-14 19:14:29 UTC
  • mfrom: (1.1.7 upstream) (12.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090814191429-6hovzz3oaqq101rm
Tags: 2.8.3-1
* New upstream version.
  + Stops hardcoding a hard dependency on the versions of gcrypt and tasn it
    was built against. Closes: #540449
  + Fixes CVE-2009-2730, a vulnerability related to NUL bytes in X.509
    certificate name fields. Closes: #541439        GNUTLS-SA-2009-4
    http://lists.gnu.org/archive/html/help-gnutls/2009-08/msg00011.html
* Drop 15_chainverify_expiredcert.diff, included upstream.
* Urgency high, since 541439 applies to testing, too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* A GNU-like <stdio.h>.
2
 
 
3
 
   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
4
 
 
5
 
   This program is free software; you can redistribute it and/or modify
6
 
   it under the terms of the GNU Lesser General Public License as published by
7
 
   the Free Software Foundation; either version 2.1, or (at your option)
8
 
   any later version.
9
 
 
10
 
   This program is distributed in the hope that it will be useful,
11
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
   GNU Lesser General Public License for more details.
14
 
 
15
 
   You should have received a copy of the GNU Lesser General Public License
16
 
   along with this program; if not, write to the Free Software Foundation,
17
 
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
 
 
19
 
@PRAGMA_SYSTEM_HEADER@
20
 
 
21
 
#if defined __need_FILE || defined __need___FILE
22
 
/* Special invocation convention inside glibc header files.  */
23
 
 
24
 
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
25
 
 
26
 
#else
27
 
/* Normal invocation convention.  */
28
 
 
29
 
#ifndef _GL_STDIO_H
30
 
 
31
 
/* The include_next requires a split double-inclusion guard.  */
32
 
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
33
 
 
34
 
#ifndef _GL_STDIO_H
35
 
#define _GL_STDIO_H
36
 
 
37
 
#include <stdarg.h>
38
 
#include <stddef.h>
39
 
 
40
 
#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
41
 
  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
42
 
  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
43
 
  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
44
 
/* Get off_t and ssize_t.  */
45
 
# include <sys/types.h>
46
 
#endif
47
 
 
48
 
#ifndef __attribute__
49
 
/* This feature is available in gcc versions 2.5 and later.  */
50
 
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
51
 
#  define __attribute__(Spec) /* empty */
52
 
# endif
53
 
/* The __-protected variants of `format' and `printf' attributes
54
 
   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
55
 
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
56
 
#  define __format__ format
57
 
#  define __printf__ printf
58
 
# endif
59
 
#endif
60
 
 
61
 
 
62
 
/* The definition of GL_LINK_WARNING is copied here.  */
63
 
 
64
 
 
65
 
#ifdef __cplusplus
66
 
extern "C" {
67
 
#endif
68
 
 
69
 
 
70
 
#if @GNULIB_FPRINTF_POSIX@
71
 
# if @REPLACE_FPRINTF@
72
 
#  define fprintf rpl_fprintf
73
 
extern int fprintf (FILE *fp, const char *format, ...)
74
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
75
 
# endif
76
 
#elif defined GNULIB_POSIXCHECK
77
 
# undef fprintf
78
 
# define fprintf \
79
 
    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
80
 
                      "use gnulib module fprintf-posix for portable " \
81
 
                      "POSIX compliance"), \
82
 
     fprintf)
83
 
#endif
84
 
 
85
 
#if @GNULIB_VFPRINTF_POSIX@
86
 
# if @REPLACE_VFPRINTF@
87
 
#  define vfprintf rpl_vfprintf
88
 
extern int vfprintf (FILE *fp, const char *format, va_list args)
89
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
90
 
# endif
91
 
#elif defined GNULIB_POSIXCHECK
92
 
# undef vfprintf
93
 
# define vfprintf(s,f,a) \
94
 
    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
95
 
                      "use gnulib module vfprintf-posix for portable " \
96
 
                      "POSIX compliance"), \
97
 
     vfprintf (s, f, a))
98
 
#endif
99
 
 
100
 
#if @GNULIB_PRINTF_POSIX@
101
 
# if @REPLACE_PRINTF@
102
 
/* Don't break __attribute__((format(printf,M,N))).  */
103
 
#  define printf __printf__
104
 
extern int printf (const char *format, ...)
105
 
       __attribute__ ((__format__ (__printf__, 1, 2)));
106
 
# endif
107
 
#elif defined GNULIB_POSIXCHECK
108
 
# undef printf
109
 
# define printf \
110
 
    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
111
 
                      "use gnulib module printf-posix for portable " \
112
 
                      "POSIX compliance"), \
113
 
     printf)
114
 
/* Don't break __attribute__((format(printf,M,N))).  */
115
 
# define format(kind,m,n) format (__##kind##__, m, n)
116
 
# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
117
 
# define ____printf____ __printf__
118
 
# define ____scanf____ __scanf__
119
 
# define ____strftime____ __strftime__
120
 
# define ____strfmon____ __strfmon__
121
 
#endif
122
 
 
123
 
#if @GNULIB_VPRINTF_POSIX@
124
 
# if @REPLACE_VPRINTF@
125
 
#  define vprintf rpl_vprintf
126
 
extern int vprintf (const char *format, va_list args)
127
 
       __attribute__ ((__format__ (__printf__, 1, 0)));
128
 
# endif
129
 
#elif defined GNULIB_POSIXCHECK
130
 
# undef vprintf
131
 
# define vprintf(f,a) \
132
 
    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
133
 
                      "use gnulib module vprintf-posix for portable " \
134
 
                      "POSIX compliance"), \
135
 
     vprintf (f, a))
136
 
#endif
137
 
 
138
 
#if @GNULIB_SNPRINTF@
139
 
# if @REPLACE_SNPRINTF@
140
 
#  define snprintf rpl_snprintf
141
 
# endif
142
 
# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
143
 
extern int snprintf (char *str, size_t size, const char *format, ...)
144
 
       __attribute__ ((__format__ (__printf__, 3, 4)));
145
 
# endif
146
 
#elif defined GNULIB_POSIXCHECK
147
 
# undef snprintf
148
 
# define snprintf \
149
 
    (GL_LINK_WARNING ("snprintf is unportable - " \
150
 
                      "use gnulib module snprintf for portability"), \
151
 
     snprintf)
152
 
#endif
153
 
 
154
 
#if @GNULIB_VSNPRINTF@
155
 
# if @REPLACE_VSNPRINTF@
156
 
#  define vsnprintf rpl_vsnprintf
157
 
# endif
158
 
# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
159
 
extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
160
 
       __attribute__ ((__format__ (__printf__, 3, 0)));
161
 
# endif
162
 
#elif defined GNULIB_POSIXCHECK
163
 
# undef vsnprintf
164
 
# define vsnprintf(b,s,f,a) \
165
 
    (GL_LINK_WARNING ("vsnprintf is unportable - " \
166
 
                      "use gnulib module vsnprintf for portability"), \
167
 
     vsnprintf (b, s, f, a))
168
 
#endif
169
 
 
170
 
#if @GNULIB_SPRINTF_POSIX@
171
 
# if @REPLACE_SPRINTF@
172
 
#  define sprintf rpl_sprintf
173
 
extern int sprintf (char *str, const char *format, ...)
174
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
175
 
# endif
176
 
#elif defined GNULIB_POSIXCHECK
177
 
# undef sprintf
178
 
# define sprintf \
179
 
    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
180
 
                      "use gnulib module sprintf-posix for portable " \
181
 
                      "POSIX compliance"), \
182
 
     sprintf)
183
 
#endif
184
 
 
185
 
#if @GNULIB_VSPRINTF_POSIX@
186
 
# if @REPLACE_VSPRINTF@
187
 
#  define vsprintf rpl_vsprintf
188
 
extern int vsprintf (char *str, const char *format, va_list args)
189
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
190
 
# endif
191
 
#elif defined GNULIB_POSIXCHECK
192
 
# undef vsprintf
193
 
# define vsprintf(b,f,a) \
194
 
    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
195
 
                      "use gnulib module vsprintf-posix for portable " \
196
 
                      "POSIX compliance"), \
197
 
     vsprintf (b, f, a))
198
 
#endif
199
 
 
200
 
#if @GNULIB_VASPRINTF@
201
 
# if @REPLACE_VASPRINTF@
202
 
#  define asprintf rpl_asprintf
203
 
#  define vasprintf rpl_vasprintf
204
 
# endif
205
 
# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
206
 
  /* Write formatted output to a string dynamically allocated with malloc().
207
 
     If the memory allocation succeeds, store the address of the string in
208
 
     *RESULT and return the number of resulting bytes, excluding the trailing
209
 
     NUL.  Upon memory allocation error, or some other error, return -1.  */
210
 
  extern int asprintf (char **result, const char *format, ...)
211
 
    __attribute__ ((__format__ (__printf__, 2, 3)));
212
 
  extern int vasprintf (char **result, const char *format, va_list args)
213
 
    __attribute__ ((__format__ (__printf__, 2, 0)));
214
 
# endif
215
 
#endif
216
 
 
217
 
#if @GNULIB_OBSTACK_PRINTF@
218
 
# if @REPLACE_OBSTACK_PRINTF@
219
 
#  define obstack_printf rpl_osbtack_printf
220
 
#  define obstack_vprintf rpl_obstack_vprintf
221
 
# endif
222
 
# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
223
 
  struct obstack;
224
 
  /* Grow an obstack with formatted output.  Return the number of
225
 
     bytes added to OBS.  No trailing nul byte is added, and the
226
 
     object should be closed with obstack_finish before use.  Upon
227
 
     memory allocation error, call obstack_alloc_failed_handler.  Upon
228
 
     other error, return -1.  */
229
 
  extern int obstack_printf (struct obstack *obs, const char *format, ...)
230
 
    __attribute__ ((__format__ (__printf__, 2, 3)));
231
 
  extern int obstack_vprintf (struct obstack *obs, const char *format,
232
 
                              va_list args)
233
 
    __attribute__ ((__format__ (__printf__, 2, 0)));
234
 
# endif
235
 
#endif
236
 
 
237
 
#if @GNULIB_FOPEN@
238
 
# if @REPLACE_FOPEN@
239
 
#  define fopen rpl_fopen
240
 
extern FILE * fopen (const char *filename, const char *mode);
241
 
# endif
242
 
#elif defined GNULIB_POSIXCHECK
243
 
# undef fopen
244
 
# define fopen(f,m) \
245
 
   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
246
 
                     "use gnulib module fopen for portability"), \
247
 
    fopen (f, m))
248
 
#endif
249
 
 
250
 
#if @GNULIB_FREOPEN@
251
 
# if @REPLACE_FREOPEN@
252
 
#  define freopen rpl_freopen
253
 
extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
254
 
# endif
255
 
#elif defined GNULIB_POSIXCHECK
256
 
# undef freopen
257
 
# define freopen(f,m,s) \
258
 
   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
259
 
                     "use gnulib module freopen for portability"), \
260
 
    freopen (f, m, s))
261
 
#endif
262
 
 
263
 
#if @GNULIB_FSEEKO@
264
 
# if @REPLACE_FSEEKO@
265
 
/* Provide fseek, fseeko functions that are aware of a preceding
266
 
   fflush(), and which detect pipes.  */
267
 
#  define fseeko rpl_fseeko
268
 
extern int fseeko (FILE *fp, off_t offset, int whence);
269
 
#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
270
 
# endif
271
 
#elif defined GNULIB_POSIXCHECK
272
 
# undef fseeko
273
 
# define fseeko(f,o,w) \
274
 
   (GL_LINK_WARNING ("fseeko is unportable - " \
275
 
                     "use gnulib module fseeko for portability"), \
276
 
    fseeko (f, o, w))
277
 
#endif
278
 
 
279
 
#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
280
 
extern int rpl_fseek (FILE *fp, long offset, int whence);
281
 
# undef fseek
282
 
# if defined GNULIB_POSIXCHECK
283
 
#  define fseek(f,o,w) \
284
 
     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
285
 
                       "on 32-bit platforms - " \
286
 
                       "use fseeko function for handling of large files"), \
287
 
      rpl_fseek (f, o, w))
288
 
# else
289
 
#  define fseek rpl_fseek
290
 
# endif
291
 
#elif defined GNULIB_POSIXCHECK
292
 
# ifndef fseek
293
 
#  define fseek(f,o,w) \
294
 
     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
295
 
                       "on 32-bit platforms - " \
296
 
                       "use fseeko function for handling of large files"), \
297
 
      fseek (f, o, w))
298
 
# endif
299
 
#endif
300
 
 
301
 
#if @GNULIB_FTELLO@
302
 
# if @REPLACE_FTELLO@
303
 
#  define ftello rpl_ftello
304
 
extern off_t ftello (FILE *fp);
305
 
#  define ftell(fp) ftello (fp)
306
 
# endif
307
 
#elif defined GNULIB_POSIXCHECK
308
 
# undef ftello
309
 
# define ftello(f) \
310
 
   (GL_LINK_WARNING ("ftello is unportable - " \
311
 
                     "use gnulib module ftello for portability"), \
312
 
    ftello (f))
313
 
#endif
314
 
 
315
 
#if @GNULIB_FTELL@ && @REPLACE_FTELL@
316
 
extern long rpl_ftell (FILE *fp);
317
 
# undef ftell
318
 
# if GNULIB_POSIXCHECK
319
 
#  define ftell(f) \
320
 
     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
321
 
                       "on 32-bit platforms - " \
322
 
                       "use ftello function for handling of large files"), \
323
 
      rpl_ftell (f))
324
 
# else
325
 
#  define ftell rpl_ftell
326
 
# endif
327
 
#elif defined GNULIB_POSIXCHECK
328
 
# ifndef ftell
329
 
#  define ftell(f) \
330
 
     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
331
 
                       "on 32-bit platforms - " \
332
 
                       "use ftello function for handling of large files"), \
333
 
      ftell (f))
334
 
# endif
335
 
#endif
336
 
 
337
 
#if @GNULIB_FFLUSH@
338
 
# if @REPLACE_FFLUSH@
339
 
#  define fflush rpl_fflush
340
 
  /* Flush all pending data on STREAM according to POSIX rules.  Both
341
 
     output and seekable input streams are supported.
342
 
     Note! LOSS OF DATA can occur if fflush is applied on an input stream
343
 
     that is _not_seekable_ or on an update stream that is _not_seekable_
344
 
     and in which the most recent operation was input.  Seekability can
345
 
     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
346
 
  extern int fflush (FILE *gl_stream);
347
 
# endif
348
 
#elif defined GNULIB_POSIXCHECK
349
 
# undef fflush
350
 
# define fflush(f) \
351
 
   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
352
 
                     "use gnulib module fflush for portable " \
353
 
                     "POSIX compliance"), \
354
 
    fflush (f))
355
 
#endif
356
 
 
357
 
#if @GNULIB_GETDELIM@
358
 
# if !@HAVE_DECL_GETDELIM@
359
 
/* Read input, up to (and including) the next occurrence of DELIMITER, from
360
 
   STREAM, store it in *LINEPTR (and NUL-terminate it).
361
 
   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
362
 
   bytes of space.  It is realloc'd as necessary.
363
 
   Return the number of bytes read and stored at *LINEPTR (not including the
364
 
   NUL terminator), or -1 on error or EOF.  */
365
 
extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
366
 
                         FILE *stream);
367
 
# endif
368
 
#elif defined GNULIB_POSIXCHECK
369
 
# undef getdelim
370
 
# define getdelim(l, s, d, f)                                       \
371
 
  (GL_LINK_WARNING ("getdelim is unportable - "                     \
372
 
                    "use gnulib module getdelim for portability"),  \
373
 
   getdelim (l, s, d, f))
374
 
#endif
375
 
 
376
 
#if @GNULIB_GETLINE@
377
 
# if @REPLACE_GETLINE@
378
 
#  undef getline
379
 
#  define getline rpl_getline
380
 
# endif
381
 
# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
382
 
/* Read a line, up to (and including) the next newline, from STREAM, store it
383
 
   in *LINEPTR (and NUL-terminate it).
384
 
   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
385
 
   bytes of space.  It is realloc'd as necessary.
386
 
   Return the number of bytes read and stored at *LINEPTR (not including the
387
 
   NUL terminator), or -1 on error or EOF.  */
388
 
extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
389
 
# endif
390
 
#elif defined GNULIB_POSIXCHECK
391
 
# undef getline
392
 
# define getline(l, s, f)                                               \
393
 
  (GL_LINK_WARNING ("getline is unportable - "                          \
394
 
                    "use gnulib module getline for portability"),       \
395
 
   getline (l, s, f))
396
 
#endif
397
 
 
398
 
#if @GNULIB_PERROR@
399
 
# if @REPLACE_PERROR@
400
 
#  define perror rpl_perror
401
 
/* Print a message to standard error, describing the value of ERRNO,
402
 
   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
403
 
   and terminated with a newline.  */
404
 
extern void perror (const char *string);
405
 
# endif
406
 
#elif defined GNULIB_POSIXCHECK
407
 
# undef perror
408
 
# define perror(s) \
409
 
    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
410
 
                      "use gnulib module perror for portability"), \
411
 
     perror (s))
412
 
#endif
413
 
 
414
 
#ifdef __cplusplus
415
 
}
416
 
#endif
417
 
 
418
 
#endif /* _GL_STDIO_H */
419
 
#endif /* _GL_STDIO_H */
420
 
#endif