xref: /freebsd/lib/libradius/libradius.3 (revision 628e6cd45f03e625c2a48a645533ea28745c60d4)
1082bfe67SJohn Polstra.\" Copyright 1998 Juniper Networks, Inc.
2082bfe67SJohn Polstra.\" All rights reserved.
3082bfe67SJohn Polstra.\"
4082bfe67SJohn Polstra.\" Redistribution and use in source and binary forms, with or without
5082bfe67SJohn Polstra.\" modification, are permitted provided that the following conditions
6082bfe67SJohn Polstra.\" are met:
7082bfe67SJohn Polstra.\" 1. Redistributions of source code must retain the above copyright
8082bfe67SJohn Polstra.\"    notice, this list of conditions and the following disclaimer.
9082bfe67SJohn Polstra.\" 2. Redistributions in binary form must reproduce the above copyright
10082bfe67SJohn Polstra.\"    notice, this list of conditions and the following disclaimer in the
11082bfe67SJohn Polstra.\"    documentation and/or other materials provided with the distribution.
12082bfe67SJohn Polstra.\"
13082bfe67SJohn Polstra.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14082bfe67SJohn Polstra.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15082bfe67SJohn Polstra.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16082bfe67SJohn Polstra.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17082bfe67SJohn Polstra.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18082bfe67SJohn Polstra.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19082bfe67SJohn Polstra.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20082bfe67SJohn Polstra.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21082bfe67SJohn Polstra.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22082bfe67SJohn Polstra.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23082bfe67SJohn Polstra.\" SUCH DAMAGE.
24082bfe67SJohn Polstra.\"
257f3dea24SPeter Wemm.\" $FreeBSD$
26082bfe67SJohn Polstra.\"
270981dfefSJohn Polstra.Dd October 30, 1999
28082bfe67SJohn Polstra.Dt LIBRADIUS 3
29a307d598SRuslan Ermilov.Os
30082bfe67SJohn Polstra.Sh NAME
31082bfe67SJohn Polstra.Nm libradius
32082bfe67SJohn Polstra.Nd RADIUS client library
33082bfe67SJohn Polstra.Sh SYNOPSIS
3432eef9aeSRuslan Ermilov.In radlib.h
350981dfefSJohn Polstra.Ft struct rad_handle *
360981dfefSJohn Polstra.Fn rad_acct_open "void"
37082bfe67SJohn Polstra.Ft int
38082bfe67SJohn Polstra.Fn rad_add_server "struct rad_handle *h" "const char *host" "int port" "const char *secret" "int timeout" "int max_tries"
390981dfefSJohn Polstra.Ft struct rad_handle *
400981dfefSJohn Polstra.Fn rad_auth_open "void"
41082bfe67SJohn Polstra.Ft void
42082bfe67SJohn Polstra.Fn rad_close "struct rad_handle *h"
43082bfe67SJohn Polstra.Ft int
44082bfe67SJohn Polstra.Fn rad_config "struct rad_handle *h" "const char *file"
45082bfe67SJohn Polstra.Ft int
4648caee2aSBrian Somers.Fn rad_continue_send_request "struct rad_handle *h" "int selected" "int *fd" "struct timeval *tv"
4748caee2aSBrian Somers.Ft int
48082bfe67SJohn Polstra.Fn rad_create_request "struct rad_handle *h" "int code"
49082bfe67SJohn Polstra.Ft struct in_addr
50082bfe67SJohn Polstra.Fn rad_cvt_addr "const void *data"
51082bfe67SJohn Polstra.Ft u_int32_t
52082bfe67SJohn Polstra.Fn rad_cvt_int "const void *data"
53082bfe67SJohn Polstra.Ft char *
54082bfe67SJohn Polstra.Fn rad_cvt_string "const void *data" "size_t len"
55082bfe67SJohn Polstra.Ft int
56082bfe67SJohn Polstra.Fn rad_get_attr "struct rad_handle *h" "const void **data" "size_t *len"
5748caee2aSBrian Somers.Ft int
58fc3f62faSBrian Somers.Fn rad_get_vendor_attr "u_int32_t *vendor" "const void **data" "size_t *len"
59fc3f62faSBrian Somers.Ft int
6048caee2aSBrian Somers.Fn rad_init_send_request "struct rad_handle *h" "int *fd" "struct timeval *tv"
61082bfe67SJohn Polstra.Ft int
62082bfe67SJohn Polstra.Fn rad_put_addr "struct rad_handle *h" "int type" "struct in_addr addr"
63082bfe67SJohn Polstra.Ft int
64082bfe67SJohn Polstra.Fn rad_put_attr "struct rad_handle *h" "int type" "const void *data" "size_t len"
65082bfe67SJohn Polstra.Ft int
66082bfe67SJohn Polstra.Fn rad_put_int "struct rad_handle *h" "int type" "u_int32_t value"
67082bfe67SJohn Polstra.Ft int
68082bfe67SJohn Polstra.Fn rad_put_string "struct rad_handle *h" "int type" "const char *str"
69082bfe67SJohn Polstra.Ft int
70b49a88f6SBrian Somers.Fn rad_put_vendor_addr "struct rad_handle *h" "int vendor" "int type" "struct in_addr addr"
71b49a88f6SBrian Somers.Ft int
72b49a88f6SBrian Somers.Fn rad_put_vendor_attr "struct rad_handle *h" "int vendor" "int type" "const void *data" "size_t len"
73b49a88f6SBrian Somers.Ft int
74b49a88f6SBrian Somers.Fn rad_put_vendor_int "struct rad_handle *h" "int vendor" "int type" "u_int32_t value"
75b49a88f6SBrian Somers.Ft int
76b49a88f6SBrian Somers.Fn rad_put_vendor_string "struct rad_handle *h" "int vendor" "int type" "const char *str"
77628e6cd4SBrian Somers.Ft ssize_t
78628e6cd4SBrian Somers.Fn rad_request_authenticator "struct rad_handle *h" "char *buf" "size_t len"
79b49a88f6SBrian Somers.Ft int
80082bfe67SJohn Polstra.Fn rad_send_request "struct rad_handle *h"
81082bfe67SJohn Polstra.Ft const char *
82628e6cd4SBrian Somers.Fn rad_server_secret "struct rad_handle *h"
83628e6cd4SBrian Somers.Ft const char *
84082bfe67SJohn Polstra.Fn rad_strerror "struct rad_handle *h"
85082bfe67SJohn Polstra.Sh DESCRIPTION
86082bfe67SJohn PolstraThe
87082bfe67SJohn Polstra.Nm
880981dfefSJohn Polstralibrary implements the client side of the Remote Authentication Dial
890981dfefSJohn PolstraIn User Service (RADIUS).  RADIUS, defined in RFCs 2138 and 2139,
900981dfefSJohn Polstraallows clients to perform authentication and accounting by means of
910981dfefSJohn Polstranetwork requests to remote servers.
92082bfe67SJohn Polstra.Sh INITIALIZATION
93082bfe67SJohn PolstraTo use the library, an application must first call
940981dfefSJohn Polstra.Fn rad_auth_open
950981dfefSJohn Polstraor
960981dfefSJohn Polstra.Fn rad_acct_open
97082bfe67SJohn Polstrato obtain a
98082bfe67SJohn Polstra.Va struct rad_handle * ,
99082bfe67SJohn Polstrawhich provides the context for subsequent operations.
1000981dfefSJohn PolstraThe former function is used for RADIUS authentication and the
1010981dfefSJohn Polstralatter is used for RADIUS accounting.
102082bfe67SJohn PolstraCalls to
1030981dfefSJohn Polstra.Fn rad_auth_open
1040981dfefSJohn Polstraand
1050981dfefSJohn Polstra.Fn rad_acct_open
106082bfe67SJohn Polstraalways succeed unless insufficient virtual memory is available.  If
1070981dfefSJohn Polstrathe necessary memory cannot be allocated, the functions return
108082bfe67SJohn Polstra.Dv NULL .
1090981dfefSJohn PolstraFor compatibility with earlier versions of this library,
1100981dfefSJohn Polstra.Fn rad_open
1110981dfefSJohn Polstrais provided as a synonym for
1120981dfefSJohn Polstra.Fn rad_auth_open .
113082bfe67SJohn Polstra.Pp
114082bfe67SJohn PolstraBefore issuing any RADIUS requests, the library must be made aware
115082bfe67SJohn Polstraof the servers it can contact.  The easiest way to configure the
116082bfe67SJohn Polstralibrary is to call
117082bfe67SJohn Polstra.Fn rad_config .
118082bfe67SJohn Polstra.Fn rad_config
119082bfe67SJohn Polstracauses the library to read a configuration file whose format is
120082bfe67SJohn Polstradescribed in
121082bfe67SJohn Polstra.Xr radius.conf 5 .
122082bfe67SJohn PolstraThe pathname of the configuration file is passed as the
123082bfe67SJohn Polstra.Va file
124082bfe67SJohn Polstraargument to
125082bfe67SJohn Polstra.Fn rad_config .
126082bfe67SJohn PolstraThis argument may also be given as
127082bfe67SJohn Polstra.Dv NULL ,
128082bfe67SJohn Polstrain which case the standard configuration file
129082bfe67SJohn Polstra.Pa /etc/radius.conf
130082bfe67SJohn Polstrais used.
131082bfe67SJohn Polstra.Fn rad_config
132082bfe67SJohn Polstrareturns 0 on success, or -1 if an error occurs.
133082bfe67SJohn Polstra.Pp
134082bfe67SJohn PolstraThe library can also be configured programmatically by calls to
135082bfe67SJohn Polstra.Fn rad_add_server .
136082bfe67SJohn PolstraThe
137082bfe67SJohn Polstra.Va host
138082bfe67SJohn Polstraparameter specifies the server host, either as a fully qualified
139082bfe67SJohn Polstradomain name or as a dotted-quad IP address in text form.
140082bfe67SJohn PolstraThe
141082bfe67SJohn Polstra.Va port
142082bfe67SJohn Polstraparameter specifies the UDP port to contact on the server.  If
143082bfe67SJohn Polstra.Va port
144082bfe67SJohn Polstrais given as 0, the library looks up the
145082bfe67SJohn Polstra.Ql radius/udp
1460981dfefSJohn Polstraor
1470981dfefSJohn Polstra.Ql radacct/udp
148082bfe67SJohn Polstraservice in the network services database, and uses the port found
1490981dfefSJohn Polstrathere.  If no entry is found, the library uses the standard RADIUS
1500981dfefSJohn Polstraports, 1812 for authentication and 1813 for accounting.
1510981dfefSJohn PolstraThe shared secret for the server host is passed to the
152082bfe67SJohn Polstra.Va secret
153082bfe67SJohn Polstraparameter.
154082bfe67SJohn PolstraIt may be any NUL-terminated string of bytes.  The RADIUS protocol
155082bfe67SJohn Polstraignores all but the leading 128 bytes of the shared secret.
156082bfe67SJohn PolstraThe timeout for receiving replies from the server is passed to the
157082bfe67SJohn Polstra.Va timeout
158082bfe67SJohn Polstraparameter, in units of seconds.  The maximum number of repeated
159082bfe67SJohn Polstrarequests to make before giving up is passed into the
160082bfe67SJohn Polstra.Va max_tries
161082bfe67SJohn Polstraparameter.
162082bfe67SJohn Polstra.Fn rad_add_server
163082bfe67SJohn Polstrareturns 0 on success, or -1 if an error occurs.
164082bfe67SJohn Polstra.Pp
165082bfe67SJohn Polstra.Fn rad_add_server
166082bfe67SJohn Polstramay be called multiple times, and it may be used together with
167082bfe67SJohn Polstra.Fn rad_config .
168082bfe67SJohn PolstraAt most 10 servers may be specified.
169082bfe67SJohn PolstraWhen multiple servers are given, they are tried in round-robin
170082bfe67SJohn Polstrafashion until a valid response is received, or until each server's
171082bfe67SJohn Polstra.Va max_tries
172082bfe67SJohn Polstralimit has been reached.
173082bfe67SJohn Polstra.Sh CREATING A RADIUS REQUEST
174082bfe67SJohn PolstraA RADIUS request consists of a code specifying the kind of request,
175082bfe67SJohn Polstraand zero or more attributes which provide additional information.  To
176082bfe67SJohn Polstrabegin constructing a new request, call
177082bfe67SJohn Polstra.Fn rad_create_request .
178082bfe67SJohn PolstraIn addition to the usual
179082bfe67SJohn Polstra.Va struct rad_handle * ,
180082bfe67SJohn Polstrathis function takes a
181082bfe67SJohn Polstra.Va code
182082bfe67SJohn Polstraparameter which specifies the type of the request.  Most often this
183082bfe67SJohn Polstrawill be
184082bfe67SJohn Polstra.Dv RAD_ACCESS_REQUEST .
185082bfe67SJohn Polstra.Fn rad_create_request
186082bfe67SJohn Polstrareturns 0 on success, or -1 on if an error occurs.
187082bfe67SJohn Polstra.Pp
188082bfe67SJohn PolstraAfter the request has been created with
189abac9a9eSBrian Somers.Fn rad_create_request ,
190082bfe67SJohn Polstraattributes can be attached to it.  This is done through calls to
191082bfe67SJohn Polstra.Fn rad_put_addr ,
192082bfe67SJohn Polstra.Fn rad_put_int ,
193082bfe67SJohn Polstraand
194082bfe67SJohn Polstra.Fn rad_put_string .
195082bfe67SJohn PolstraEach accepts a
196082bfe67SJohn Polstra.Va type
197082bfe67SJohn Polstraparameter identifying the attribute, and a value which may be
198082bfe67SJohn Polstraan Internet address, an integer, or a NUL-terminated string,
199082bfe67SJohn Polstrarespectively.
200b49a88f6SBrian SomersAlternatively,
201b49a88f6SBrian Somers.Fn rad_put_vendor_addr ,
202b49a88f6SBrian Somers.Fn rad_put_vendor_int
203b49a88f6SBrian Somersor
204b49a88f6SBrian Somers.Fn rad_put_vendor_string
205b49a88f6SBrian Somersmay be used to specify vendor specific attributes.  Vendor specific
206b49a88f6SBrian Somersdefinitions may be found in
207b49a88f6SBrian Somers.In radlib_vs.h
208082bfe67SJohn Polstra.Pp
209082bfe67SJohn PolstraThe library also provides a function
210082bfe67SJohn Polstra.Fn rad_put_attr
211082bfe67SJohn Polstrawhich can be used to supply a raw, uninterpreted attribute.  The
212082bfe67SJohn Polstra.Va data
213082bfe67SJohn Polstraargument points to an array of bytes, and the
214082bfe67SJohn Polstra.Va len
215082bfe67SJohn Polstraargument specifies its length.
216082bfe67SJohn Polstra.Pp
217082bfe67SJohn PolstraThe
218082bfe67SJohn Polstra.Fn rad_put_X
219082bfe67SJohn Polstrafunctions return 0 on success, or -1 if an error occurs.
220082bfe67SJohn Polstra.Sh SENDING THE REQUEST AND RECEIVING THE RESPONSE
22148caee2aSBrian SomersAfter the RADIUS request has been constructed, it is sent either by means of
22248caee2aSBrian Somers.Fn rad_send_request
22348caee2aSBrian Somersor by a combination of calls to
22448caee2aSBrian Somers.Fn rad_init_send_request
22548caee2aSBrian Somersand
22648caee2aSBrian Somers.Fn rad_continue_send_request .
22748caee2aSBrian Somers.Pp
22848caee2aSBrian SomersThe
22948caee2aSBrian Somers.Fn rad_send_request
23048caee2aSBrian Somersfunction sends the request and waits for a valid reply,
231082bfe67SJohn Polstraretrying the defined servers in round-robin fashion as necessary.
232082bfe67SJohn PolstraIf a valid response is received,
233082bfe67SJohn Polstra.Fn rad_send_request
234082bfe67SJohn Polstrareturns the RADIUS code which specifies the type of the response.
235082bfe67SJohn PolstraThis will typically be
236082bfe67SJohn Polstra.Dv RAD_ACCESS_ACCEPT ,
237082bfe67SJohn Polstra.Dv RAD_ACCESS_REJECT ,
238082bfe67SJohn Polstraor
239082bfe67SJohn Polstra.Dv RAD_ACCESS_CHALLENGE .
240082bfe67SJohn PolstraIf no valid response is received,
241082bfe67SJohn Polstra.Fn rad_send_request
242082bfe67SJohn Polstrareturns -1.
243082bfe67SJohn Polstra.Pp
24448caee2aSBrian SomersAs an alternative, if you do not wish to block waiting for a response,
24548caee2aSBrian Somers.Fn rad_init_send_request
24648caee2aSBrian Somersand
24748caee2aSBrian Somers.Fn rad_continue_send_request
24848caee2aSBrian Somersmay be used instead.  If a reply is received from the RADIUS server or a
24948caee2aSBrian Somerstimeout occurs, these functions return a value as described for
25048caee2aSBrian Somers.Fn rad_send_request .
25148caee2aSBrian SomersOtherwise, a value of zero is returned and the values pointed to by
25248caee2aSBrian Somers.Ar fd
25348caee2aSBrian Somersand
25448caee2aSBrian Somers.Ar tv
25548caee2aSBrian Somersare set to the descriptor and timeout that should be passed to
25648caee2aSBrian Somers.Xr select 2 .
25748caee2aSBrian Somers.Pp
25848caee2aSBrian Somers.Fn rad_init_send_request
25948caee2aSBrian Somersmust be called first, followed by repeated calls to
26048caee2aSBrian Somers.Fn rad_continue_send_request
26148caee2aSBrian Somersas long as a return value of zero is given.
26248caee2aSBrian SomersBetween each call, the application should call
26348caee2aSBrian Somers.Xr select 2 ,
26448caee2aSBrian Somerspassing
26548caee2aSBrian Somers.Ar *fd
26648caee2aSBrian Somersas a read descriptor and timing out after the interval specified by
26748caee2aSBrian Somers.Ar tv .
26848caee2aSBrian SomersWhen select returns,
26948caee2aSBrian Somers.Fn rad_continue_send_request
27048caee2aSBrian Somersshould be called with
27148caee2aSBrian Somers.Ar selected
27248caee2aSBrian Somersset to a non-zero value if
27348caee2aSBrian Somers.Xr select 2
27448caee2aSBrian Somersindicated that the descriptor is readable.
27548caee2aSBrian Somers.Pp
276082bfe67SJohn PolstraLike RADIUS requests, each response may contain zero or more
277082bfe67SJohn Polstraattributes.  After a response has been received successfully by
27848caee2aSBrian Somers.Fn rad_send_request
27948caee2aSBrian Somersor
28048caee2aSBrian Somers.Fn rad_continue_send_request ,
281082bfe67SJohn Polstraits attributes can be extracted one by one using
282082bfe67SJohn Polstra.Fn rad_get_attr .
283082bfe67SJohn PolstraEach time
284082bfe67SJohn Polstra.Fn rad_get_attr
285082bfe67SJohn Polstrais called, it gets the next attribute from the current response, and
286082bfe67SJohn Polstrastores a pointer to the data and the length of the data via the
287082bfe67SJohn Polstrareference parameters
288082bfe67SJohn Polstra.Va data
289082bfe67SJohn Polstraand
290082bfe67SJohn Polstra.Va len ,
291082bfe67SJohn Polstrarespectively.  Note that the data resides in the response itself,
292082bfe67SJohn Polstraand must not be modified.
293082bfe67SJohn PolstraA successful call to
294082bfe67SJohn Polstra.Fn rad_get_attr
295082bfe67SJohn Polstrareturns the RADIUS attribute type.
296082bfe67SJohn PolstraIf no more attributes remain in the current response,
297082bfe67SJohn Polstra.Fn rad_get_attr
298082bfe67SJohn Polstrareturns 0.
299082bfe67SJohn PolstraIf an error such as a malformed attribute is detected, -1 is
300082bfe67SJohn Polstrareturned.
301082bfe67SJohn Polstra.Pp
302fc3f62faSBrian SomersIf
303fc3f62faSBrian Somers.Fn rad_get_attr
304fc3f62faSBrian Somersreturns
305fc3f62faSBrian Somers.Dv RAD_VENDOR_SPECIFIC ,
306fc3f62faSBrian Somers.Fn rad_get_vendor_attr
307fc3f62faSBrian Somersmay be called to determine the vendor.
308fc3f62faSBrian SomersThe vendor specific RADIUS attribute type is returned.
309fc3f62faSBrian SomersThe reference parameters
310fc3f62faSBrian Somers.Va data
311fc3f62faSBrian Somersand
312fc3f62faSBrian Somers.Va len
31348091bb0SRuslan Ermilov(as returned from
31448091bb0SRuslan Ermilov.Fn rad_get_attr )
315fc3f62faSBrian Somersare passed to
316fc3f62faSBrian Somers.Fn rad_get_vendor_attr ,
317fc3f62faSBrian Somersand are adjusted to point to the vendor specific attribute data.
318fc3f62faSBrian Somers.Pp
319082bfe67SJohn PolstraThe common types of attributes can be decoded using
320082bfe67SJohn Polstra.Fn rad_cvt_addr ,
321082bfe67SJohn Polstra.Fn rad_cvt_int ,
322082bfe67SJohn Polstraand
323082bfe67SJohn Polstra.Fn rad_cvt_string .
324082bfe67SJohn PolstraThese functions accept a pointer to the attribute data, which should
325082bfe67SJohn Polstrahave been obtained using
326fc3f62faSBrian Somers.Fn rad_get_attr
327fc3f62faSBrian Somersand optionally
328fc3f62faSBrian Somers.Fn rad_get_vendor_attr .
329082bfe67SJohn PolstraIn the case of
330082bfe67SJohn Polstra.Fn rad_cvt_string ,
331082bfe67SJohn Polstrathe length
332082bfe67SJohn Polstra.Va len
333082bfe67SJohn Polstramust also be given.  These functions interpret the attribute as an
334082bfe67SJohn PolstraInternet address, an integer, or a string, respectively, and return
335082bfe67SJohn Polstraits value.
336082bfe67SJohn Polstra.Fn rad_cvt_string
337082bfe67SJohn Polstrareturns its value as a NUL-terminated string in dynamically
338082bfe67SJohn Polstraallocated memory.  The application should free the string using
339082bfe67SJohn Polstra.Xr free 3
340082bfe67SJohn Polstrawhen it is no longer needed.
341082bfe67SJohn Polstra.Pp
342082bfe67SJohn PolstraIf insufficient virtual memory is available,
343082bfe67SJohn Polstra.Fn rad_cvt_string
344082bfe67SJohn Polstrareturns
345082bfe67SJohn Polstra.Dv NULL .
346082bfe67SJohn Polstra.Fn rad_cvt_addr
347082bfe67SJohn Polstraand
348082bfe67SJohn Polstra.Fn rad_cvt_int
349082bfe67SJohn Polstracannot fail.
350628e6cd4SBrian Somers.Pp
351628e6cd4SBrian SomersThe
352628e6cd4SBrian Somers.Fn rad_request_authenticator
353628e6cd4SBrian Somersfunction may be used to obtain the Request-Authenticator attribute value
354628e6cd4SBrian Somersassociated with the current RADIUS server according to the supplied
355628e6cd4SBrian Somersrad_handle.
356628e6cd4SBrian SomersThe target buffer
357628e6cd4SBrian Somers.Ar buf
358628e6cd4SBrian Somersof length
359628e6cd4SBrian Somers.Ar len
360628e6cd4SBrian Somersmust be supplied and should be at least 16 bytes.
361628e6cd4SBrian SomersThe return value is the number of bytes written to
362628e6cd4SBrian Somers.Ar buf
363628e6cd4SBrian Somersor -1 to indicate that
364628e6cd4SBrian Somers.Ar len
365628e6cd4SBrian Somerswas not large enough.
366628e6cd4SBrian Somers.Pp
367628e6cd4SBrian SomersThe
368628e6cd4SBrian Somers.Fn rad_server_secret
369628e6cd4SBrian Somersreturns the secret shared with the current RADIUS server according to the
370628e6cd4SBrian Somerssupplied rad_handle.
371082bfe67SJohn Polstra.Sh OBTAINING ERROR MESSAGES
372082bfe67SJohn PolstraThose functions which accept a
373082bfe67SJohn Polstra.Va struct rad_handle *
374082bfe67SJohn Polstraargument record an error message if they fail.  The error message
375082bfe67SJohn Polstracan be retrieved by calling
376082bfe67SJohn Polstra.Fn rad_strerror .
377082bfe67SJohn PolstraThe message text is overwritten on each new error for the given
378082bfe67SJohn Polstra.Va struct rad_handle * .
379082bfe67SJohn PolstraThus the message must be copied if it is to be preserved through
380082bfe67SJohn Polstrasubsequent library calls using the same handle.
381082bfe67SJohn Polstra.Sh CLEANUP
382082bfe67SJohn PolstraTo free the resources used by the RADIUS library, call
383082bfe67SJohn Polstra.Fn rad_close .
384082bfe67SJohn Polstra.Sh RETURN VALUES
385082bfe67SJohn PolstraThe following functions return a non-negative value on success.  If
386082bfe67SJohn Polstrathey detect an error, they return -1 and record an error message
387082bfe67SJohn Polstrawhich can be retrieved using
388082bfe67SJohn Polstra.Fn rad_strerror .
389082bfe67SJohn Polstra.Pp
390082bfe67SJohn Polstra.Bl -item -offset indent -compact
391082bfe67SJohn Polstra.It
392082bfe67SJohn Polstra.Fn rad_add_server
393082bfe67SJohn Polstra.It
394082bfe67SJohn Polstra.Fn rad_config
395082bfe67SJohn Polstra.It
396082bfe67SJohn Polstra.Fn rad_create_request
397082bfe67SJohn Polstra.It
398082bfe67SJohn Polstra.Fn rad_get_attr
399082bfe67SJohn Polstra.It
400082bfe67SJohn Polstra.Fn rad_put_addr
401082bfe67SJohn Polstra.It
402082bfe67SJohn Polstra.Fn rad_put_attr
403082bfe67SJohn Polstra.It
404082bfe67SJohn Polstra.Fn rad_put_int
405082bfe67SJohn Polstra.It
406082bfe67SJohn Polstra.Fn rad_put_string
407082bfe67SJohn Polstra.It
40848caee2aSBrian Somers.Fn rad_init_send_request
40948caee2aSBrian Somers.It
41048caee2aSBrian Somers.Fn rad_continue_send_request
41148caee2aSBrian Somers.It
412082bfe67SJohn Polstra.Fn rad_send_request
413082bfe67SJohn Polstra.El
414082bfe67SJohn Polstra.Pp
415082bfe67SJohn PolstraThe following functions return a
416082bfe67SJohn Polstra.No non- Ns Dv NULL
417082bfe67SJohn Polstrapointer on success.  If they are unable to allocate sufficient
418082bfe67SJohn Polstravirtual memory, they return
419082bfe67SJohn Polstra.Dv NULL ,
420082bfe67SJohn Polstrawithout recording an error message.
421082bfe67SJohn Polstra.Pp
422082bfe67SJohn Polstra.Bl -item -offset indent -compact
423082bfe67SJohn Polstra.It
4240981dfefSJohn Polstra.Fn rad_acct_open
425082bfe67SJohn Polstra.It
4260981dfefSJohn Polstra.Fn rad_auth_open
4270981dfefSJohn Polstra.It
4280981dfefSJohn Polstra.Fn rad_cvt_string
429082bfe67SJohn Polstra.El
430082bfe67SJohn Polstra.Sh FILES
431082bfe67SJohn Polstra.Pa /etc/radius.conf
432082bfe67SJohn Polstra.Sh SEE ALSO
433082bfe67SJohn Polstra.Xr radius.conf 5
434082bfe67SJohn Polstra.Rs
435082bfe67SJohn Polstra.%A C. Rigney, et al
43642635956SRuslan Ermilov.%T "Remote Authentication Dial In User Service (RADIUS)"
437082bfe67SJohn Polstra.%O RFC 2138
438082bfe67SJohn Polstra.Re
4390981dfefSJohn Polstra.Rs
4400981dfefSJohn Polstra.%A C. Rigney
4410981dfefSJohn Polstra.%T RADIUS Accounting
4420981dfefSJohn Polstra.%O RFC 2139
4430981dfefSJohn Polstra.Re
444082bfe67SJohn Polstra.Sh AUTHORS
4450981dfefSJohn PolstraThis software was originally written by
446082bfe67SJohn Polstra.An John Polstra ,
447b5c508fbSRuslan Ermilovand donated to the
448b5c508fbSRuslan Ermilov.Fx
449b5c508fbSRuslan Ermilovproject by Juniper Networks, Inc.
4500981dfefSJohn PolstraOleg Semyonov subsequently added the ability to perform RADIUS
4510981dfefSJohn Polstraaccounting.
452