~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to lib/liblwres/man/lwres_buffer.3

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\"
2
 
.\" Copyright (C) 2000, 2001  Internet Software Consortium.
3
 
.\"
4
 
.\" Permission to use, copy, modify, and distribute this software for any
5
 
.\" purpose with or without fee is hereby granted, provided that the above
6
 
.\" copyright notice and this permission notice appear in all copies.
7
 
.\"
8
 
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9
 
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10
 
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11
 
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12
 
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13
 
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14
 
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15
 
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 
.\"
17
 
.TH "LWRES_BUFFER" "3" "Jun 30, 2000" "BIND9" ""
18
 
.SH NAME
19
 
lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem \- lightweight resolver buffer management
20
 
.SH SYNOPSIS
21
 
\fB#include <lwres/lwbuffer.h>
22
 
.sp
23
 
.na
24
 
void
25
 
lwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length);
26
 
.ad
27
 
.sp
28
 
.na
29
 
void
30
 
lwres_buffer_invalidate(lwres_buffer_t *b);
31
 
.ad
32
 
.sp
33
 
.na
34
 
void
35
 
lwres_buffer_add(lwres_buffer_t *b, unsigned int n);
36
 
.ad
37
 
.sp
38
 
.na
39
 
void
40
 
lwres_buffer_subtract(lwres_buffer_t *b, unsigned int n);
41
 
.ad
42
 
.sp
43
 
.na
44
 
void
45
 
lwres_buffer_clear(lwres_buffer_t *b);
46
 
.ad
47
 
.sp
48
 
.na
49
 
void
50
 
lwres_buffer_first(lwres_buffer_t *b);
51
 
.ad
52
 
.sp
53
 
.na
54
 
void
55
 
lwres_buffer_forward(lwres_buffer_t *b, unsigned int n);
56
 
.ad
57
 
.sp
58
 
.na
59
 
void
60
 
lwres_buffer_back(lwres_buffer_t *b, unsigned int n);
61
 
.ad
62
 
.sp
63
 
.na
64
 
lwres_uint8_t
65
 
lwres_buffer_getuint8(lwres_buffer_t *b);
66
 
.ad
67
 
.sp
68
 
.na
69
 
void
70
 
lwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val);
71
 
.ad
72
 
.sp
73
 
.na
74
 
lwres_uint16_t
75
 
lwres_buffer_getuint16(lwres_buffer_t *b);
76
 
.ad
77
 
.sp
78
 
.na
79
 
void
80
 
lwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val);
81
 
.ad
82
 
.sp
83
 
.na
84
 
lwres_uint32_t
85
 
lwres_buffer_getuint32(lwres_buffer_t *b);
86
 
.ad
87
 
.sp
88
 
.na
89
 
void
90
 
lwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val);
91
 
.ad
92
 
.sp
93
 
.na
94
 
void
95
 
lwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base, unsigned int length);
96
 
.ad
97
 
.sp
98
 
.na
99
 
void
100
 
lwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base, unsigned int length);
101
 
.ad
102
 
\fR.SH "DESCRIPTION"
103
 
.PP
104
 
These functions provide bounds checked access to a region of memory
105
 
where data is being read or written.
106
 
They are based on, and similar to, the
107
 
isc_buffer_
108
 
functions in the ISC library.
109
 
.PP
110
 
A buffer is a region of memory, together with a set of related
111
 
subregions.
112
 
The \fBused region\fR and the
113
 
\fBavailable\fR region are disjoint, and
114
 
their union is the buffer's region.
115
 
The used region extends from the beginning of the buffer region to the
116
 
last used byte.
117
 
The available region extends from one byte greater than the last used
118
 
byte to the end of the buffer's region.
119
 
The size of the used region can be changed using various
120
 
buffer commands.
121
 
Initially, the used region is empty.
122
 
.PP
123
 
The used region is further subdivided into two disjoint regions: the
124
 
\fBconsumed region\fR and the \fBremaining region\fR.
125
 
The union of these two regions is the used region.
126
 
The consumed region extends from the beginning of the used region to
127
 
the byte before the \fBcurrent\fR offset (if any).
128
 
The \fBremaining\fR region the current pointer to the end of the used
129
 
region.
130
 
The size of the consumed region can be changed using various
131
 
buffer commands.
132
 
Initially, the consumed region is empty.
133
 
.PP
134
 
The \fBactive region\fR is an (optional) subregion of the remaining
135
 
region.
136
 
It extends from the current offset to an offset in the
137
 
remaining region.
138
 
Initially, the active region is empty.
139
 
If the current offset advances beyond the chosen offset,
140
 
the active region will also be empty.
141
 
.PP
142
 
.sp
143
 
.nf
144
 
 
145
 
   /------------entire length---------------\\\\
146
 
   /----- used region -----\\\\/-- available --\\\\
147
 
   +----------------------------------------+
148
 
   | consumed  | remaining |                |
149
 
   +----------------------------------------+
150
 
   a           b     c     d                e
151
 
 
152
 
  a == base of buffer.
153
 
  b == current pointer.  Can be anywhere between a and d.
154
 
  c == active pointer.  Meaningful between b and d.
155
 
  d == used pointer.
156
 
  e == length of buffer.
157
 
 
158
 
  a-e == entire length of buffer.
159
 
  a-d == used region.
160
 
  a-b == consumed region.
161
 
  b-d == remaining region.
162
 
  b-c == optional active region.
163
 
.sp
164
 
.fi
165
 
.PP
166
 
\fBlwres_buffer_init()\fR
167
 
initializes the
168
 
\fBlwres_buffer_t\fR
169
 
\fI*b\fR
170
 
and assocates it with the memory region of size
171
 
\fIlength\fR
172
 
bytes starting at location
173
 
\fIbase.\fR
174
 
.PP
175
 
\fBlwres_buffer_invalidate()\fR
176
 
marks the buffer
177
 
\fI*b\fR
178
 
as invalid. Invalidating a buffer after use is not required,
179
 
but makes it possible to catch its possible accidental use.
180
 
.PP
181
 
The functions
182
 
\fBlwres_buffer_add()\fR
183
 
and
184
 
\fBlwres_buffer_subtract()\fR
185
 
respectively increase and decrease the used space in
186
 
buffer
187
 
\fI*b\fR
188
 
by
189
 
\fIn\fR
190
 
bytes.
191
 
\fBlwres_buffer_add()\fR
192
 
checks for buffer overflow and
193
 
\fBlwres_buffer_subtract()\fR
194
 
checks for underflow.
195
 
These functions do not allocate or deallocate memory.
196
 
They just change the value of
197
 
\fBused\fR.
198
 
.PP
199
 
A buffer is re-initialised by
200
 
\fBlwres_buffer_clear()\fR.
201
 
The function sets
202
 
\fBused\fR ,
203
 
\fBcurrent\fR
204
 
and
205
 
\fBactive\fR
206
 
to zero.
207
 
.PP
208
 
\fBlwres_buffer_first\fR
209
 
makes the consumed region of buffer
210
 
\fI*p\fR
211
 
empty by setting
212
 
\fBcurrent\fR
213
 
to zero (the start of the buffer).
214
 
.PP
215
 
\fBlwres_buffer_forward()\fR
216
 
increases the consumed region of buffer
217
 
\fI*b\fR
218
 
by
219
 
\fIn\fR
220
 
bytes, checking for overflow.
221
 
Similarly,
222
 
\fBlwres_buffer_back()\fR
223
 
decreases buffer
224
 
\fIb\fR's
225
 
consumed region by
226
 
\fIn\fR
227
 
bytes and checks for underflow.
228
 
.PP
229
 
\fBlwres_buffer_getuint8()\fR
230
 
reads an unsigned 8-bit integer from
231
 
\fI*b\fR
232
 
and returns it.
233
 
\fBlwres_buffer_putuint8()\fR
234
 
writes the unsigned 8-bit integer
235
 
\fIval\fR
236
 
to buffer
237
 
\fI*b\fR.
238
 
.PP
239
 
\fBlwres_buffer_getuint16()\fR
240
 
and
241
 
\fBlwres_buffer_getuint32()\fR
242
 
are identical to
243
 
\fBlwres_buffer_putuint8()\fR
244
 
except that they respectively read an unsigned 16-bit or 32-bit integer 
245
 
in network byte order from
246
 
\fIb\fR.
247
 
Similarly,
248
 
\fBlwres_buffer_putuint16()\fR
249
 
and
250
 
\fBlwres_buffer_putuint32()\fR
251
 
writes the unsigned 16-bit or 32-bit integer
252
 
\fIval\fR
253
 
to buffer
254
 
\fIb\fR,
255
 
in network byte order.
256
 
.PP
257
 
Arbitrary amounts of data are read or written from a lightweight
258
 
resolver buffer with
259
 
\fBlwres_buffer_getmem()\fR
260
 
and
261
 
\fBlwres_buffer_putmem()\fR
262
 
respectively.
263
 
\fBlwres_buffer_putmem()\fR
264
 
copies
265
 
\fIlength\fR
266
 
bytes of memory at
267
 
\fIbase\fR
268
 
to
269
 
\fIb\fR.
270
 
Conversely,
271
 
\fBlwres_buffer_getmem()\fR
272
 
copies
273
 
\fIlength\fR
274
 
bytes of memory from
275
 
\fIb\fR
276
 
to
277
 
\fIbase\fR.