~ubuntu-branches/ubuntu/lucid/curl/lucid-security

« back to all changes in this revision

Viewing changes to lib/setup.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-04-29 11:10:29 UTC
  • mfrom: (3.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090429111029-2j5eiyokfw2bw049
Tags: 7.19.4-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop build dependencies: stunnel, libdb4.6-dev, libssh2-1-dev
  - Add build-dependency on openssh-server
  - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.
  - Call automake-1.9 with --add-missing --copy --force
* drop debian/patches/security_CVE-2009-0037.patch 
  - this patch is part of 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *                            | (__| |_| |  _ <| |___
8
8
 *                             \___|\___/|_| \_\_____|
9
9
 *
10
 
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 
10
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
11
11
 *
12
12
 * This software is licensed as described in the file COPYING, which
13
13
 * you should have received as part of this distribution. The terms
20
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
21
 * KIND, either express or implied.
22
22
 *
23
 
 * $Id: setup.h,v 1.137 2008-04-22 22:53:54 danf Exp $
 
23
 * $Id: setup.h,v 1.163 2009-02-12 20:48:44 danf Exp $
24
24
 ***************************************************************************/
25
25
 
26
 
#ifdef HTTP_ONLY
27
 
#define CURL_DISABLE_TFTP
28
 
#define CURL_DISABLE_FTP
29
 
#define CURL_DISABLE_LDAP
30
 
#define CURL_DISABLE_TELNET
31
 
#define CURL_DISABLE_DICT
32
 
#define CURL_DISABLE_FILE
33
 
#endif /* HTTP_ONLY */
34
 
 
35
26
/*
36
27
 * Define WIN32 when build target is Win32 API
37
28
 */
57
48
#endif
58
49
#endif
59
50
 
60
 
#ifdef macintosh
61
 
#include "config-mac.h"
 
51
#if defined(macintosh) && defined(__MRC__)
 
52
#  include "config-mac.h"
62
53
#endif
63
54
 
64
55
#ifdef __AMIGA__
70
61
#endif
71
62
 
72
63
#ifdef __OS400__
73
 
#include "config-os400.h"
74
 
#include "setup-os400.h"
 
64
#  include "config-os400.h"
75
65
#endif
76
66
 
77
67
#ifdef TPF
82
72
 
83
73
#endif /* HAVE_CONFIG_H */
84
74
 
 
75
/* ================================================================ */
 
76
/* Definition of preprocessor macros/symbols which modify compiler  */
 
77
/* behaviour or generated code characteristics must be done here,   */
 
78
/* as appropriate, before any system header file is included. It is */
 
79
/* also possible to have them defined in the config file included   */
 
80
/* before this point. As a result of all this we frown inclusion of */
 
81
/* system header files in our config files, avoid this at any cost. */
 
82
/* ================================================================ */
 
83
 
 
84
/*
 
85
 * Tru64 needs _REENTRANT set for a few function prototypes and
 
86
 * things to appear in the system header files. Unixware needs it
 
87
 * to build proper reentrant code. Others may also need it.
 
88
 */
 
89
 
 
90
#ifdef NEED_REENTRANT
 
91
#  ifndef _REENTRANT
 
92
#    define _REENTRANT
 
93
#  endif
 
94
#endif
 
95
 
 
96
/* ================================================================ */
 
97
/*  If you need to include a system header file for your platform,  */
 
98
/*  please, do it beyond the point further indicated in this file.  */
 
99
/* ================================================================ */
 
100
 
 
101
/*
 
102
 * libcurl's external interface definitions are also used internally,
 
103
 * and might also include required system header files to define them.
 
104
 */
 
105
 
 
106
#include <curl/curlbuild.h>
 
107
 
 
108
/*
 
109
 * Compile time sanity checks must also be done when building the library.
 
110
 */
 
111
 
 
112
#include <curl/curlrules.h>
 
113
 
 
114
/*
 
115
 * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
 
116
 */
 
117
 
 
118
#ifdef SIZEOF_CURL_OFF_T
 
119
#  error "SIZEOF_CURL_OFF_T shall not be defined!"
 
120
   Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
 
121
#endif
 
122
 
 
123
/*
 
124
 * Set up internal curl_off_t formatting string directives for
 
125
 * exclusive use with libcurl's internal *printf functions.
 
126
 */
 
127
 
 
128
#ifdef FORMAT_OFF_T
 
129
#  error "FORMAT_OFF_T shall not be defined before this point!"
 
130
   Error Compilation_aborted_FORMAT_OFF_T_already_defined
 
131
#endif
 
132
 
 
133
#ifdef FORMAT_OFF_TU
 
134
#  error "FORMAT_OFF_TU shall not be defined before this point!"
 
135
   Error Compilation_aborted_FORMAT_OFF_TU_already_defined
 
136
#endif
 
137
 
 
138
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
 
139
#  define FORMAT_OFF_T  "lld"
 
140
#  define FORMAT_OFF_TU "llu"
 
141
#else
 
142
#  define FORMAT_OFF_T  "ld"
 
143
#  define FORMAT_OFF_TU "lu"
 
144
#endif
 
145
 
 
146
/*
 
147
 * Disable other protocols when http is the only one desired.
 
148
 */
 
149
 
 
150
#ifdef HTTP_ONLY
 
151
#  define CURL_DISABLE_TFTP
 
152
#  define CURL_DISABLE_FTP
 
153
#  define CURL_DISABLE_LDAP
 
154
#  define CURL_DISABLE_TELNET
 
155
#  define CURL_DISABLE_DICT
 
156
#  define CURL_DISABLE_FILE
 
157
#endif
 
158
 
 
159
/* ================================================================ */
 
160
/* No system header file shall be included in this file before this */
 
161
/* point. The only allowed ones are those included from curlbuild.h */
 
162
/* ================================================================ */
 
163
 
 
164
/*
 
165
 * OS/400 setup file includes some system headers.
 
166
 */
 
167
 
 
168
#ifdef __OS400__
 
169
#  include "setup-os400.h"
 
170
#endif
 
171
 
85
172
/*
86
173
 * Include header files for windows builds before redefining anything.
87
174
 * Use this preproessor block only to include or exclude windows.h,
126
213
#  endif
127
214
#endif
128
215
 
129
 
 
130
 
#ifdef HAVE_LONGLONG
131
 
#define LONG_LONG long long
132
 
#define ENABLE_64BIT
133
 
#else
134
 
#ifdef _MSC_VER
135
 
#define LONG_LONG __int64
136
 
#define ENABLE_64BIT
137
 
#endif /* _MSC_VER */
138
 
#endif /* HAVE_LONGLONG */
139
 
 
140
 
#ifndef SIZEOF_CURL_OFF_T
141
 
/* If we don't know the size here, we assume a conservative size: 4. When
142
 
   building libcurl, the actual size of this variable should be define in the
143
 
   config*.h file. */
144
 
#define SIZEOF_CURL_OFF_T 4
145
 
#endif
146
 
 
147
 
/* We set up our internal prefered (CURL_)FORMAT_OFF_T here */
148
 
#if SIZEOF_CURL_OFF_T > 4
149
 
#define FORMAT_OFF_T "lld"
150
 
#else
151
 
#define FORMAT_OFF_T "ld"
152
 
#endif /* SIZEOF_CURL_OFF_T */
153
 
 
154
 
#ifndef _REENTRANT
155
 
/* Solaris needs _REENTRANT set for a few function prototypes and things to
156
 
   appear in the #include files. We need to #define it before all #include
157
 
   files. Unixware needs it to build proper reentrant code. Others may also
158
 
   need it. */
159
 
#define _REENTRANT
 
216
#ifdef HAVE_EXTRA_STRICMP_H
 
217
#  include <extra/stricmp.h>
 
218
#endif
 
219
 
 
220
#ifdef HAVE_EXTRA_STRDUP_H
 
221
#  include <extra/strdup.h>
 
222
#endif
 
223
 
 
224
#ifdef TPF
 
225
#  include <strings.h>    /* for bzero, strcasecmp, and strncasecmp */
 
226
#  include <string.h>     /* for strcpy and strlen */
 
227
#  include <stdlib.h>     /* for rand and srand */
 
228
#  include <sys/socket.h> /* for select and ioctl*/
 
229
#  include <netdb.h>      /* for in_addr_t definition */
 
230
#  include <tpf/sysapi.h> /* for tpf_process_signals */
160
231
#endif
161
232
 
162
233
#include <stdio.h>
199
270
  #include <clib.h>
200
271
#endif
201
272
 
202
 
 
203
 
/* To make large file support transparent even on Windows */
204
 
#if defined(WIN32) && (SIZEOF_CURL_OFF_T > 4)
205
 
#include <sys/stat.h>   /* must come first before we redefine stat() */
206
 
#include <io.h>
207
 
#define lseek(x,y,z) _lseeki64(x, y, z)
208
 
#define struct_stat struct _stati64
209
 
#define stat(file,st) _stati64(file,st)
210
 
#define fstat(fd,st) _fstati64(fd,st)
211
 
#else
212
 
#define struct_stat struct stat
213
 
#endif /* Win32 with large file support */
214
 
 
 
273
/*
 
274
 * Large file (>2Gb) support using WIN32 functions.
 
275
 */
 
276
 
 
277
#ifdef USE_WIN32_LARGE_FILES
 
278
#  include <io.h>
 
279
#  include <sys/types.h>
 
280
#  include <sys/stat.h>
 
281
#  define lseek(fdes,offset,whence)  _lseeki64(fdes, offset, whence)
 
282
#  define fstat(fdes,stp)            _fstati64(fdes, stp)
 
283
#  define stat(fname,stp)            _stati64(fname, stp)
 
284
#  define struct_stat                struct _stati64
 
285
#endif
 
286
 
 
287
/*
 
288
 * Small file (<2Gb) support using WIN32 functions.
 
289
 */
 
290
 
 
291
#ifdef USE_WIN32_SMALL_FILES
 
292
#  include <io.h>
 
293
#  include <sys/types.h>
 
294
#  include <sys/stat.h>
 
295
#  define lseek(fdes,offset,whence)  _lseek(fdes, (long)offset, whence)
 
296
#  define fstat(fdes,stp)            _fstat(fdes, stp)
 
297
#  define stat(fname,stp)            _stat(fname, stp)
 
298
#  define struct_stat                struct _stat
 
299
#endif
 
300
 
 
301
#ifndef struct_stat
 
302
#  define struct_stat struct stat
 
303
#endif
 
304
 
 
305
/*
 
306
 * Default sizeof(off_t) in case it hasn't been defined in config file.
 
307
 */
 
308
 
 
309
#ifndef SIZEOF_OFF_T
 
310
#  if defined(__VMS) && (defined(__alpha) || defined(__ia64))
 
311
#    if defined(_LARGEFILE)
 
312
#      define SIZEOF_OFF_T 8
 
313
#    endif
 
314
#  elif defined(__OS400__) && defined(__ILEC400__)
 
315
#    if defined(_LARGE_FILES)
 
316
#      define SIZEOF_OFF_T 8
 
317
#    endif
 
318
#  elif defined(__MVS__) && defined(__IBMC__)
 
319
#    if defined(_LP64) || defined(_LARGE_FILES)
 
320
#      define SIZEOF_OFF_T 8
 
321
#    endif
 
322
#  elif defined(__370__) && defined(__IBMC__)
 
323
#    if defined(_LP64) || defined(_LARGE_FILES)
 
324
#      define SIZEOF_OFF_T 8
 
325
#    endif
 
326
#  endif
 
327
#  ifndef SIZEOF_OFF_T
 
328
#    define SIZEOF_OFF_T 4
 
329
#  endif
 
330
#endif
215
331
 
216
332
/* Below we define some functions. They should
217
333
   1. close a socket
222
338
 
223
339
#ifdef WIN32
224
340
 
225
 
#if !defined(__CYGWIN__)
226
 
#define sclose(x) closesocket(x)
227
 
 
228
 
#undef HAVE_ALARM
229
 
#else
230
 
     /* gcc-for-win is still good :) */
231
 
#define sclose(x) close(x)
232
 
#define HAVE_ALARM
233
 
#endif /* !GNU or mingw */
234
 
 
235
 
#define DIR_CHAR      "\\"
236
 
#define DOT_CHAR      "_"
 
341
#  if !defined(__CYGWIN__)
 
342
#    define sclose(x) closesocket(x)
 
343
#  else
 
344
#    define sclose(x) close(x)
 
345
#  endif
 
346
 
 
347
#  define DIR_CHAR      "\\"
 
348
#  define DOT_CHAR      "_"
237
349
 
238
350
#else /* WIN32 */
239
351
 
240
 
#ifdef MSDOS  /* Watt-32 */
241
 
#include <sys/ioctl.h>
242
 
#define sclose(x)         close_s(x)
243
 
#define select(n,r,w,x,t) select_s(n,r,w,x,t)
244
 
#define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
245
 
#define IOCTL_3_ARGS
246
 
#include <tcp.h>
247
 
#ifdef word
248
 
#undef word
249
 
#endif
250
 
 
251
 
#else /* MSDOS */
252
 
 
253
 
#ifdef __BEOS__
254
 
#define sclose(x) closesocket(x)
255
 
#else /* __BEOS__ */
256
 
#define sclose(x) close(x)
257
 
#endif /* __BEOS__ */
258
 
 
259
 
#define HAVE_ALARM
260
 
 
261
 
#endif /* MSDOS */
262
 
 
263
 
#ifdef _AMIGASF
264
 
#undef HAVE_ALARM
265
 
#undef sclose
266
 
#define sclose(x) CloseSocket(x)
267
 
#endif
268
 
 
269
 
#ifdef __minix
270
 
/* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
271
 
extern char * strtok_r(char *s, const char *delim, char **last);
272
 
extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
273
 
#endif
274
 
 
275
 
#ifdef __SYMBIAN32__
276
 
#undef HAVE_ALARM
277
 
#endif
278
 
 
279
 
#define DIR_CHAR      "/"
280
 
#ifndef DOT_CHAR
281
 
#define DOT_CHAR      "."
282
 
#endif
283
 
 
284
 
#ifdef MSDOS
285
 
#undef DOT_CHAR
286
 
#define DOT_CHAR      "_"
287
 
#endif
288
 
 
289
 
#ifndef fileno /* sunos 4 have this as a macro! */
290
 
int fileno( FILE *stream);
291
 
#endif
 
352
#  ifdef MSDOS  /* Watt-32 */
 
353
 
 
354
#    include <sys/ioctl.h>
 
355
#    define sclose(x)         close_s(x)
 
356
#    define select(n,r,w,x,t) select_s(n,r,w,x,t)
 
357
#    define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
 
358
#    include <tcp.h>
 
359
#    ifdef word
 
360
#      undef word
 
361
#    endif
 
362
#    ifdef byte
 
363
#      undef byte
 
364
#    endif
 
365
 
 
366
#  else /* MSDOS */
 
367
 
 
368
#    ifdef __BEOS__
 
369
#      define sclose(x) closesocket(x)
 
370
#    else /* __BEOS__ */
 
371
#      define sclose(x) close(x)
 
372
#    endif /* __BEOS__ */
 
373
 
 
374
#  endif /* MSDOS */
 
375
 
 
376
#  ifdef _AMIGASF
 
377
#    undef sclose
 
378
#    define sclose(x) CloseSocket(x)
 
379
#  endif
 
380
 
 
381
#  ifdef __minix
 
382
     /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
 
383
     extern char * strtok_r(char *s, const char *delim, char **last);
 
384
     extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp);
 
385
#  endif
 
386
 
 
387
#  define DIR_CHAR      "/"
 
388
#  ifndef DOT_CHAR
 
389
#    define DOT_CHAR      "."
 
390
#  endif
 
391
 
 
392
#  ifdef MSDOS
 
393
#    undef DOT_CHAR
 
394
#    define DOT_CHAR      "_"
 
395
#  endif
 
396
 
 
397
#  ifndef fileno /* sunos 4 have this as a macro! */
 
398
     int fileno( FILE *stream);
 
399
#  endif
292
400
 
293
401
#endif /* WIN32 */
294
402
 
321
429
#endif
322
430
#endif
323
431
 
324
 
#ifdef mpeix
325
 
#define IOCTL_3_ARGS
326
 
#endif
327
 
 
328
432
#ifdef NETWARE
329
433
int netware_init(void);
330
434
#ifndef __NOVELL_LIBC__
331
435
#include <sys/bsdskt.h>
332
436
#include <sys/timeval.h>
333
437
#endif
334
 
#undef HAVE_ALARM
335
438
#endif
336
439
 
337
440
#if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H)
347
450
 
348
451
#define LIBIDN_REQUIRED_VERSION "0.4.1"
349
452
 
350
 
#ifdef __UCLIBC__
351
 
#define HAVE_INET_NTOA_R_2_ARGS 1
352
 
#endif
353
 
 
354
453
#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL)
355
454
#define USE_SSL    /* SSL support has been enabled */
356
455
#endif
357
456
 
358
457
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
359
 
#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI)
 
458
#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || defined(USE_GNUTLS)
360
459
#define USE_NTLM
361
460
#endif
362
461
#endif