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

« back to all changes in this revision

Viewing changes to doc/manpage.d/ipsec_ttoul.3.html

  • 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
 
Content-type: text/html
2
 
 
3
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
 
<HTML><HEAD><TITLE>Man page of IPSEC_TTOUL</TITLE>
5
 
</HEAD><BODY>
6
 
<H1>IPSEC_TTOUL</H1>
7
 
Section: C Library Functions (3)<BR>Updated: 16 Aug 2000<BR><A HREF="#index">Index</A>
8
 
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
9
 
 
10
 
 
11
 
<A NAME="lbAB">&nbsp;</A>
12
 
<H2>NAME</H2>
13
 
 
14
 
ipsec ttoul, ultot - convert unsigned-long numbers to and from text
15
 
<A NAME="lbAC">&nbsp;</A>
16
 
<H2>SYNOPSIS</H2>
17
 
 
18
 
<B>#include &lt;<A HREF="file:///usr/include/freeswan.h">freeswan.h</A>&gt;</B>
19
 
 
20
 
<P>
21
 
<B>const char *ttoul(const char *src, size_t srclen,</B>
22
 
 
23
 
<BR>
24
 
&nbsp;
25
 
<B>int base, unsigned long *n);</B>
26
 
 
27
 
<BR>
28
 
 
29
 
<B>size_t ultot(unsigned long n, int format, char *dst,</B>
30
 
 
31
 
<BR>
32
 
&nbsp;
33
 
<B>size_t dstlen);</B>
34
 
 
35
 
<A NAME="lbAD">&nbsp;</A>
36
 
<H2>DESCRIPTION</H2>
37
 
 
38
 
<I>Ttoul</I>
39
 
 
40
 
converts a text-string number into a binary
41
 
<B>unsigned long</B>
42
 
 
43
 
value.
44
 
<I>Ultot</I>
45
 
 
46
 
does the reverse conversion, back to a text version.
47
 
<P>
48
 
 
49
 
Numbers are specified in text as
50
 
decimal (e.g.
51
 
<B>123</B>),
52
 
 
53
 
octal with a leading zero (e.g.
54
 
<B>012</B>,
55
 
 
56
 
which has value 10),
57
 
or hexadecimal with a leading
58
 
<B>0x</B>
59
 
 
60
 
(e.g.
61
 
<B>0x1f</B>,
62
 
 
63
 
which has value 31)
64
 
in either upper or lower case.
65
 
<P>
66
 
 
67
 
The
68
 
<I>srclen</I>
69
 
 
70
 
parameter of
71
 
<I>ttoul</I>
72
 
 
73
 
specifies the length of the string pointed to by
74
 
<I>src</I>;
75
 
 
76
 
it is an error for there to be anything else
77
 
(e.g., a terminating NUL) within that length.
78
 
As a convenience for cases where an entire NUL-terminated string is
79
 
to be converted,
80
 
a
81
 
<I>srclen</I>
82
 
 
83
 
value of
84
 
<B>0</B>
85
 
 
86
 
is taken to mean
87
 
<B>strlen(src)</B>.
88
 
 
89
 
<P>
90
 
 
91
 
The
92
 
<I>base</I>
93
 
 
94
 
parameter of
95
 
<I>ttoul</I>
96
 
 
97
 
can be
98
 
<B>8</B>,
99
 
 
100
 
<B>10</B>,
101
 
 
102
 
or
103
 
<B>16</B>,
104
 
 
105
 
in which case the number supplied is assumed to be of that form
106
 
(and in the case of
107
 
<B>16</B>,
108
 
 
109
 
to lack any
110
 
<B>0x</B>
111
 
 
112
 
prefix).
113
 
It can also be
114
 
<B>0</B>,
115
 
 
116
 
in which case the number is examined for a leading zero
117
 
or a leading
118
 
<B>0x</B>
119
 
 
120
 
to determine its base.
121
 
<P>
122
 
 
123
 
The
124
 
<I>dstlen</I>
125
 
 
126
 
parameter of
127
 
<I>ultot</I>
128
 
 
129
 
specifies the size of the
130
 
<I>dst</I>
131
 
 
132
 
parameter;
133
 
under no circumstances are more than
134
 
<I>dstlen</I>
135
 
 
136
 
bytes written to
137
 
<I>dst</I>.
138
 
 
139
 
A result which will not fit is truncated.
140
 
<I>Dstlen</I>
141
 
 
142
 
can be zero, in which case
143
 
<I>dst</I>
144
 
 
145
 
need not be valid and no result is written,
146
 
but the return value is unaffected;
147
 
in all other cases, the (possibly truncated) result is NUL-terminated.
148
 
The
149
 
<I>freeswan.h</I>
150
 
 
151
 
header file defines a constant,
152
 
<B>ULTOT_BUF</B>,
153
 
 
154
 
which is the size of a buffer just large enough for worst-case results.
155
 
<P>
156
 
 
157
 
The
158
 
<I>format</I>
159
 
 
160
 
parameter of
161
 
<I>ultot</I>
162
 
 
163
 
must be one of:
164
 
<DL COMPACT><DT><DD>
165
 
<DL COMPACT>
166
 
<DT><B>'o'</B><DD>
167
 
octal conversion with leading
168
 
<B>0</B>
169
 
 
170
 
<DT><B>&nbsp;8</B><DD>
171
 
octal conversion with no leading
172
 
<B>0</B>
173
 
 
174
 
<DT><B>'d'</B><DD>
175
 
decimal conversion
176
 
<DT><B>10</B><DD>
177
 
same as
178
 
<B>d</B>
179
 
 
180
 
<DT><B>'x'</B><DD>
181
 
hexadecimal conversion, including leading
182
 
<B>0x</B>
183
 
 
184
 
<DT><B>16</B><DD>
185
 
hexadecimal conversion with no leading
186
 
<B>0x</B>
187
 
 
188
 
<DT><B>17</B><DD>
189
 
like
190
 
<B>16</B>
191
 
 
192
 
except padded on left with
193
 
<B>0</B>s
194
 
 
195
 
to eight digits (full width of a 32-bit number)
196
 
</DL>
197
 
</DL>
198
 
 
199
 
<P>
200
 
 
201
 
<I>Ttoul</I>
202
 
 
203
 
returns NULL for success and
204
 
a pointer to a string-literal error message for failure;
205
 
see DIAGNOSTICS.
206
 
<I>Ultot</I>
207
 
 
208
 
returns
209
 
<B>0</B>
210
 
 
211
 
for a failure, and otherwise
212
 
returns the size of buffer which would 
213
 
be needed to
214
 
accommodate the full conversion result, including terminating NUL
215
 
(it is the caller's responsibility to check this against the size of
216
 
the provided buffer to determine whether truncation has occurred).
217
 
<A NAME="lbAE">&nbsp;</A>
218
 
<H2>SEE ALSO</H2>
219
 
 
220
 
<A HREF="/cgi-bin/man/man2html?3+atol">atol</A>(3), <A HREF="/cgi-bin/man/man2html?3+strtoul">strtoul</A>(3)
221
 
<A NAME="lbAF">&nbsp;</A>
222
 
<H2>DIAGNOSTICS</H2>
223
 
 
224
 
Fatal errors in
225
 
<I>ttoul</I>
226
 
 
227
 
are:
228
 
empty input;
229
 
unknown
230
 
<I>base</I>;
231
 
 
232
 
non-digit character found;
233
 
number too large for an
234
 
<B>unsigned long</B>.
235
 
 
236
 
<P>
237
 
 
238
 
Fatal errors in
239
 
<I>ultot</I>
240
 
 
241
 
are:
242
 
unknown
243
 
<I>format</I>.
244
 
 
245
 
<A NAME="lbAG">&nbsp;</A>
246
 
<H2>HISTORY</H2>
247
 
 
248
 
Written for the FreeS/WAN project by Henry Spencer.
249
 
<A NAME="lbAH">&nbsp;</A>
250
 
<H2>BUGS</H2>
251
 
 
252
 
Conversion of
253
 
<B>0</B>
254
 
 
255
 
with format
256
 
<B>o</B>
257
 
 
258
 
yields
259
 
<B>00</B>.
260
 
 
261
 
<P>
262
 
 
263
 
<I>Ultot</I>
264
 
 
265
 
format
266
 
<B>17</B>
267
 
 
268
 
is a bit of a kludge.
269
 
<P>
270
 
 
271
 
The restriction of error reports to literal strings
272
 
(so that callers don't need to worry about freeing them or copying them)
273
 
does limit the precision of error reporting.
274
 
<P>
275
 
 
276
 
The error-reporting convention lends itself to slightly obscure code,
277
 
because many readers will not think of NULL as signifying success.
278
 
A good way to make it clearer is to write something like:
279
 
<P>
280
 
 
281
 
<DL COMPACT><DT><DD>
282
 
<PRE>
283
 
<B>const char *error;</B>
284
 
 
285
 
<B>error = ttoul( /* ... */ );</B>
286
 
<B>if (error != NULL) {</B>
287
 
<B>        /* something went wrong */</B>
288
 
</PRE>
289
 
 
290
 
</DL>
291
 
 
292
 
<P>
293
 
 
294
 
<HR>
295
 
<A NAME="index">&nbsp;</A><H2>Index</H2>
296
 
<DL>
297
 
<DT><A HREF="#lbAB">NAME</A><DD>
298
 
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
299
 
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
300
 
<DT><A HREF="#lbAE">SEE ALSO</A><DD>
301
 
<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
302
 
<DT><A HREF="#lbAG">HISTORY</A><DD>
303
 
<DT><A HREF="#lbAH">BUGS</A><DD>
304
 
</DL>
305
 
<HR>
306
 
This document was created by
307
 
<A HREF="/cgi-bin/man/man2html">man2html</A>,
308
 
using the manual pages.<BR>
309
 
Time: 10:29:43 GMT, June 17, 2004
310
 
</BODY>
311
 
</HTML>