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

« back to all changes in this revision

Viewing changes to include/curl/curlrules.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:
 
1
#ifndef __CURL_CURLRULES_H
 
2
#define __CURL_CURLRULES_H
 
3
/***************************************************************************
 
4
 *                                  _   _ ____  _
 
5
 *  Project                     ___| | | |  _ \| |
 
6
 *                             / __| | | | |_) | |
 
7
 *                            | (__| |_| |  _ <| |___
 
8
 *                             \___|\___/|_| \_\_____|
 
9
 *
 
10
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
 
11
 *
 
12
 * This software is licensed as described in the file COPYING, which
 
13
 * you should have received as part of this distribution. The terms
 
14
 * are also available at http://curl.haxx.se/docs/copyright.html.
 
15
 *
 
16
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 
17
 * copies of the Software, and permit persons to whom the Software is
 
18
 * furnished to do so, under the terms of the COPYING file.
 
19
 *
 
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 
21
 * KIND, either express or implied.
 
22
 *
 
23
 * $Id: curlrules.h,v 1.5 2008-08-25 01:18:49 yangtse Exp $
 
24
 ***************************************************************************/
 
25
 
 
26
/* ================================================================ */
 
27
/*                    COMPILE TIME SANITY CHECKS                    */
 
28
/* ================================================================ */
 
29
 
 
30
/*
 
31
 * NOTE 1:
 
32
 * -------
 
33
 *
 
34
 * All checks done in this file are intentionally placed in a public
 
35
 * header file which is pulled by curl/curl.h when an application is
 
36
 * being built using an already built libcurl library. Additionally
 
37
 * this file is also included and used when building the library.
 
38
 *
 
39
 * If compilation fails on this file it is certainly sure that the
 
40
 * problem is elsewhere. It could be a problem in the curlbuild.h
 
41
 * header file, or simply that you are using different compilation
 
42
 * settings than those used to build the library.
 
43
 *
 
44
 * Nothing in this file is intended to be modified or adjusted by the
 
45
 * curl library user nor by the curl library builder.
 
46
 *
 
47
 * Do not deactivate any check, these are done to make sure that the
 
48
 * library is properly built and used.
 
49
 *
 
50
 * You can find further help on the libcurl development mailing list:
 
51
 * http://cool.haxx.se/mailman/listinfo/curl-library/
 
52
 *
 
53
 * NOTE 2
 
54
 * ------
 
55
 *
 
56
 * Some of the following compile time checks are based on the fact
 
57
 * that the dimension of a constant array can not be a negative one.
 
58
 * In this way if the compile time verification fails, the compilation
 
59
 * will fail issuing an error. The error description wording is compiler
 
60
 * dependant but it will be quite similar to one of the following:
 
61
 *
 
62
 *   "negative subscript or subscript is too large"
 
63
 *   "array must have at least one element"
 
64
 *   "-1 is an illegal array size"
 
65
 *   "size of array is negative"
 
66
 *
 
67
 * If you are building an application which tries to use an already
 
68
 * built libcurl library and you are getting this kind of errors on
 
69
 * this file, it is a clear indication that there is a mismatch between
 
70
 * how the library was built and how you are trying to use it for your
 
71
 * application. Your already compiled or binary library provider is the
 
72
 * only one who can give you the details you need to properly use it.
 
73
 */
 
74
 
 
75
/*
 
76
 * Verify that some macros are actually defined.
 
77
 */
 
78
 
 
79
#ifndef CURL_SIZEOF_LONG
 
80
#  error "CURL_SIZEOF_LONG definition is missing!"
 
81
   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
 
82
#endif
 
83
 
 
84
#ifndef CURL_TYPEOF_CURL_OFF_T
 
85
#  error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
 
86
   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
 
87
#endif
 
88
 
 
89
#ifndef CURL_FORMAT_CURL_OFF_T
 
90
#  error "CURL_FORMAT_CURL_OFF_T definition is missing!"
 
91
   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
 
92
#endif
 
93
 
 
94
#ifndef CURL_FORMAT_CURL_OFF_TU
 
95
#  error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
 
96
   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
 
97
#endif
 
98
 
 
99
#ifndef CURL_FORMAT_OFF_T
 
100
#  error "CURL_FORMAT_OFF_T definition is missing!"
 
101
   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
 
102
#endif
 
103
 
 
104
#ifndef CURL_SIZEOF_CURL_OFF_T
 
105
#  error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
 
106
   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
 
107
#endif
 
108
 
 
109
#ifndef CURL_SUFFIX_CURL_OFF_T
 
110
#  error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
 
111
   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
 
112
#endif
 
113
 
 
114
#ifndef CURL_SUFFIX_CURL_OFF_TU
 
115
#  error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
 
116
   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
 
117
#endif
 
118
 
 
119
/*
 
120
 * Macros private to this header file.
 
121
 */
 
122
 
 
123
#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
 
124
 
 
125
#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
 
126
 
 
127
/*
 
128
 * Verify that the size previously defined and expected for long
 
129
 * is the same as the one reported by sizeof() at compile time.
 
130
 */
 
131
 
 
132
typedef char
 
133
  __curl_rule_01__
 
134
    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];
 
135
 
 
136
/*
 
137
 * Verify that the size previously defined and expected for
 
138
 * curl_off_t is actually the the same as the one reported
 
139
 * by sizeof() at compile time.
 
140
 */
 
141
 
 
142
typedef char
 
143
  __curl_rule_02__
 
144
    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
 
145
 
 
146
/*
 
147
 * Verify at compile time that the size of curl_off_t as reported
 
148
 * by sizeof() is greater or equal than the one reported for long
 
149
 * for the current compilation.
 
150
 */
 
151
 
 
152
typedef char
 
153
  __curl_rule_03__
 
154
    [CurlchkszGE(curl_off_t, long)];
 
155
 
 
156
/* ================================================================ */
 
157
/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */
 
158
/* ================================================================ */
 
159
 
 
160
/* 
 
161
 * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
 
162
 * these to be visible and exported by the external libcurl interface API,
 
163
 * while also making them visible to the library internals, simply including
 
164
 * setup.h, without actually needing to include curl.h internally.
 
165
 * If some day this section would grow big enough, all this should be moved
 
166
 * to its own header file.
 
167
 */
 
168
 
 
169
/*
 
170
 * Figure out if we can use the ## preprocessor operator, which is supported
 
171
 * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
 
172
 * or  __cplusplus so we need to carefully check for them too.
 
173
 */
 
174
 
 
175
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
 
176
  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
 
177
  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
 
178
  defined(__ILEC400__)
 
179
  /* This compiler is believed to have an ISO compatible preprocessor */
 
180
#define CURL_ISOCPP
 
181
#else
 
182
  /* This compiler is believed NOT to have an ISO compatible preprocessor */
 
183
#undef CURL_ISOCPP
 
184
#endif
 
185
 
 
186
/*
 
187
 * Macros for minimum-width signed and unsigned curl_off_t integer constants.
 
188
 */
 
189
 
 
190
#ifdef CURL_ISOCPP
 
191
#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix
 
192
#else
 
193
#  define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix
 
194
#endif
 
195
#define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix)
 
196
#define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T)
 
197
#define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU)
 
198
 
 
199
/*
 
200
 * Get rid of macros private to this header file.
 
201
 */
 
202
 
 
203
#undef CurlchkszEQ
 
204
#undef CurlchkszGE
 
205
 
 
206
/*
 
207
 * Get rid of macros not intended to exist beyond this point.
 
208
 */
 
209
 
 
210
#undef CURL_PULL_SYS_TYPES_H
 
211
#undef CURL_PULL_STDINT_H
 
212
#undef CURL_PULL_INTTYPES_H
 
213
 
 
214
#undef CURL_TYPEOF_CURL_OFF_T
 
215
 
 
216
#endif /* __CURL_CURLRULES_H */