2002-09-25 23:18:51 +00:00
|
|
|
.\" Copyright (c) 1998, 2001, 2002, Juniper Networks, Inc.
|
1998-11-13 00:54:26 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1998-11-13 00:54:26 +00:00
|
|
|
.\"
|
|
|
|
.Dd September 2, 1998
|
|
|
|
.Dt LIBTACPLUS 3
|
2001-07-10 13:41:46 +00:00
|
|
|
.Os
|
1998-11-13 00:54:26 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm libtacplus
|
|
|
|
.Nd TACACS+ client library
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In taclib.h
|
1998-11-13 00:54:26 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn tac_add_server "struct tac_handle *h" "const char *host" "int port" "const char *secret" "int timeout" "int flags"
|
|
|
|
.Ft void
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_clear_avs "struct tac_handle *h"
|
|
|
|
.Ft void
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_close "struct tac_handle *h"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_config "struct tac_handle *h" "const char *path"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_create_authen "struct tac_handle *h" "int action" "int type" "int service"
|
2002-09-25 23:18:51 +00:00
|
|
|
.Ft int
|
|
|
|
.Fn tac_create_author "struct tac_handle *h" "int method" "int type" "int service"
|
|
|
|
.Ft char *
|
|
|
|
.Fn tac_get_av "struct tac_handle *h" "u_int index"
|
|
|
|
.Ft char *
|
|
|
|
.Fn tac_get_av_value "struct tac_handle *h" "const char *attribute"
|
1998-11-13 00:54:26 +00:00
|
|
|
.Ft void *
|
|
|
|
.Fn tac_get_data "struct tac_handle *h" "size_t *len"
|
|
|
|
.Ft char *
|
|
|
|
.Fn tac_get_msg "struct tac_handle *h"
|
|
|
|
.Ft struct tac_handle *
|
|
|
|
.Fn tac_open "void"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_send_authen "struct tac_handle *h"
|
|
|
|
.Ft int
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_send_author "struct tac_handle *h"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_av "struct tac_handle *h" "u_int index" "const char *av_pair"
|
|
|
|
.Ft int
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_set_data "struct tac_handle *h" "const void *data" "size_t data_len"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_msg "struct tac_handle *h" "const char *msg"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_port "struct tac_handle *h" "const char *port"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_priv "struct tac_handle *h" "int priv"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_rem_addr "struct tac_handle *h" "const char *addr"
|
|
|
|
.Ft int
|
|
|
|
.Fn tac_set_user "struct tac_handle *h" "const char *user"
|
|
|
|
.Ft const char *
|
|
|
|
.Fn tac_strerror "struct tac_handle *h"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
library implements the client side of the TACACS+ network access
|
2004-07-02 23:52:20 +00:00
|
|
|
control protocol.
|
|
|
|
TACACS+ allows clients to perform authentication,
|
1998-11-13 00:54:26 +00:00
|
|
|
authorization, and accounting by means of network requests to remote
|
2004-07-02 23:52:20 +00:00
|
|
|
servers.
|
|
|
|
This library currently supports only the authentication
|
2002-09-25 23:18:51 +00:00
|
|
|
and authorization portion of the protocol.
|
1998-11-13 00:54:26 +00:00
|
|
|
.Sh INITIALIZATION
|
|
|
|
To use the library, an application must first call
|
|
|
|
.Fn tac_open
|
|
|
|
to obtain a
|
|
|
|
.Va struct tac_handle * ,
|
|
|
|
which provides context for subsequent operations.
|
|
|
|
Calls to
|
|
|
|
.Fn tac_open
|
2004-07-02 23:52:20 +00:00
|
|
|
always succeed unless insufficient virtual memory is available.
|
|
|
|
If
|
1998-11-13 00:54:26 +00:00
|
|
|
the necessary memory cannot be allocated,
|
|
|
|
.Fn tac_open
|
|
|
|
returns
|
|
|
|
.Dv NULL .
|
|
|
|
.Pp
|
|
|
|
Before issuing any TACACS+ requests, the library must be made aware
|
2004-07-02 23:52:20 +00:00
|
|
|
of the servers it can contact.
|
|
|
|
The easiest way to configure the
|
1998-11-13 00:54:26 +00:00
|
|
|
library is to call
|
|
|
|
.Fn tac_config .
|
|
|
|
.Fn tac_config
|
|
|
|
causes the library to read a configuration file whose format is
|
|
|
|
described in
|
|
|
|
.Xr tacplus.conf 5 .
|
|
|
|
The pathname of the configuration file is passed as the
|
|
|
|
.Va file
|
|
|
|
argument to
|
|
|
|
.Fn tac_config .
|
|
|
|
This argument may also be given as
|
|
|
|
.Dv NULL ,
|
|
|
|
in which case the standard configuration file
|
|
|
|
.Pa /etc/tacplus.conf
|
|
|
|
is used.
|
|
|
|
.Fn tac_config
|
2002-11-29 15:57:50 +00:00
|
|
|
returns 0 on success, or \-1 if an error occurs.
|
1998-11-13 00:54:26 +00:00
|
|
|
.Pp
|
|
|
|
The library can also be configured programmatically by calls to
|
|
|
|
.Fn tac_add_server .
|
|
|
|
The
|
|
|
|
.Va host
|
|
|
|
parameter specifies the server host, either as a fully qualified
|
|
|
|
domain name or as a dotted-quad IP address in text form.
|
|
|
|
The
|
|
|
|
.Va port
|
2004-07-02 23:52:20 +00:00
|
|
|
parameter specifies the TCP port to contact on the server.
|
|
|
|
If
|
1998-11-13 00:54:26 +00:00
|
|
|
.Va port
|
|
|
|
is given as 0, the library uses port 49, the standard TACACS+ port.
|
|
|
|
The shared secret for the server host is passed to the
|
|
|
|
.Va secret
|
2004-07-02 23:52:20 +00:00
|
|
|
parameter.
|
|
|
|
It may be any null-terminated string of bytes.
|
1998-11-13 00:54:26 +00:00
|
|
|
The timeout for receiving replies from the server is passed to the
|
|
|
|
.Va timeout
|
|
|
|
parameter, in units of seconds.
|
|
|
|
The
|
|
|
|
.Va flags
|
|
|
|
parameter is a bit mask of flags to specify various characteristics of
|
2004-07-02 23:52:20 +00:00
|
|
|
the server.
|
|
|
|
It may contain:
|
1998-11-13 00:54:26 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -tag -width Fl
|
|
|
|
.It Dv TAC_SRVR_SINGLE_CONNECT
|
|
|
|
Causes the library to attempt to negotiate single connection mode
|
2004-07-02 23:52:20 +00:00
|
|
|
when communicating with the server.
|
|
|
|
In single connection mode, the
|
1998-11-13 00:54:26 +00:00
|
|
|
original TCP connection is held open for multiple TACACS+ sessions.
|
|
|
|
Older servers do not support this mode, and some of them become
|
|
|
|
confused if the client attempts to negotiate it.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
.Fn tac_add_server
|
2002-11-29 15:57:50 +00:00
|
|
|
returns 0 on success, or \-1 if an error occurs.
|
1998-11-13 00:54:26 +00:00
|
|
|
.Pp
|
|
|
|
.Fn tac_add_server
|
|
|
|
may be called multiple times, and it may be used together with
|
|
|
|
.Fn tac_config .
|
|
|
|
At most 10 servers may be specified.
|
|
|
|
When multiple servers are given, they are tried in round-robin
|
2004-07-02 23:52:20 +00:00
|
|
|
fashion until a working, accessible server is found.
|
|
|
|
Once the
|
1998-11-13 00:54:26 +00:00
|
|
|
library finds such a server, it continues to use it as long as it
|
|
|
|
works.
|
|
|
|
.Sh CREATING A TACACS+ AUTHENTICATION REQUEST
|
|
|
|
To begin constructing a new authentication request, call
|
|
|
|
.Fn tac_create_authen .
|
|
|
|
The
|
|
|
|
.Va action ,
|
|
|
|
.Va type ,
|
|
|
|
and
|
|
|
|
.Va service
|
2001-06-24 01:34:38 +00:00
|
|
|
arguments must be set to appropriate values as defined in the
|
2004-07-02 23:52:20 +00:00
|
|
|
TACACS+ protocol specification.
|
|
|
|
The
|
2003-09-08 19:57:22 +00:00
|
|
|
.In taclib.h
|
1998-11-13 00:54:26 +00:00
|
|
|
header file contains symbolic constants for these values.
|
2002-09-25 23:18:51 +00:00
|
|
|
.Sh CREATING A TACACS+ AUTHORIZATION REQUEST
|
|
|
|
To begin constructing a new authorization request, call
|
|
|
|
.Fn tac_create_author .
|
|
|
|
The
|
|
|
|
.Va method ,
|
|
|
|
.Va type ,
|
|
|
|
and
|
|
|
|
.Va service
|
|
|
|
arguments must be set to appropriate values as defined in the
|
2004-07-02 23:52:20 +00:00
|
|
|
TACACS+ protocol specification.
|
|
|
|
The
|
2003-09-08 19:57:22 +00:00
|
|
|
.In taclib.h
|
2002-09-25 23:18:51 +00:00
|
|
|
header file contains symbolic constants for these values.
|
|
|
|
.Sh SETTING OPTIONAL PARAMETERS ON A REQUEST
|
|
|
|
After creating a request,
|
1998-11-13 00:54:26 +00:00
|
|
|
various optional parameters may be attached to it through calls to
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_set_av ,
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_set_data ,
|
|
|
|
.Fn tac_set_port ,
|
|
|
|
.Fn tac_set_priv ,
|
|
|
|
.Fn tac_set_rem_addr ,
|
|
|
|
and
|
|
|
|
.Fn tac_set_user .
|
|
|
|
The library creates its own copies of any strings provided to these
|
|
|
|
functions, so that it is not necessary for the caller to preserve
|
2004-07-02 23:52:20 +00:00
|
|
|
them.
|
|
|
|
By default, each of these parameters is empty except for the
|
1998-11-13 00:54:26 +00:00
|
|
|
privilege level, which defaults to
|
|
|
|
.Ql USER
|
|
|
|
privilege.
|
2002-09-25 23:18:51 +00:00
|
|
|
.Pp
|
2002-11-29 15:57:50 +00:00
|
|
|
.Fn tac_set_av
|
2004-07-02 23:52:20 +00:00
|
|
|
only applies to the context of an authorization request.
|
|
|
|
The format
|
2002-09-25 23:18:51 +00:00
|
|
|
for an attribute value pair is defined in the TACACS+ protocol
|
2004-07-02 23:52:20 +00:00
|
|
|
specification.
|
|
|
|
The index specified can be any value between 0 and
|
2002-09-25 23:18:51 +00:00
|
|
|
255 inclusive and indicates the position in the list to place the
|
2004-07-02 23:52:20 +00:00
|
|
|
attribute value pair.
|
|
|
|
Calling
|
2002-11-29 15:57:50 +00:00
|
|
|
.Fn tac_set_av
|
2002-09-25 23:18:51 +00:00
|
|
|
with same index twice effectively replaces the value at that position.
|
|
|
|
Use
|
|
|
|
.Fn tac_clear_avs
|
|
|
|
to clear all attribute value pairs that may have been set.
|
1998-11-13 00:54:26 +00:00
|
|
|
.Sh SENDING THE AUTHENTICATION REQUEST AND RECEIVING THE RESPONSE
|
2002-09-25 23:18:51 +00:00
|
|
|
After the TACACS+ authentication request has been constructed, it is
|
|
|
|
sent by means of
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_send_authen .
|
|
|
|
This function connects to a server if not already connected, sends
|
2004-07-02 23:52:20 +00:00
|
|
|
the request, and waits for a reply.
|
|
|
|
On failure,
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_send_authen
|
2004-07-02 23:52:20 +00:00
|
|
|
returns \-1.
|
|
|
|
Otherwise, it returns the TACACS+ status code and flags,
|
|
|
|
packed into an integer value.
|
|
|
|
The status can be extracted using the
|
1998-11-13 00:54:26 +00:00
|
|
|
macro
|
|
|
|
.Fn TAC_AUTHEN_STATUS .
|
|
|
|
Possible status codes, defined in
|
2003-09-08 19:57:22 +00:00
|
|
|
.In taclib.h ,
|
1998-11-13 00:54:26 +00:00
|
|
|
include:
|
|
|
|
.Pp
|
|
|
|
.Bl -item -compact -offset indent
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_PASS
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_FAIL
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETDATA
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETUSER
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETPASS
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_RESTART
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_ERROR
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHEN_STATUS_FOLLOW
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The only flag is the no-echo flag, which can be tested using the
|
|
|
|
macro
|
|
|
|
.Fn TAC_AUTHEN_NOECHO .
|
2002-09-25 23:18:51 +00:00
|
|
|
.Sh EXTRACTING INFORMATION FROM THE SERVER'S AUTHENTICATION RESPONSE
|
1998-11-13 00:54:26 +00:00
|
|
|
An authentication response packet from the server may contain a
|
2004-07-02 23:52:20 +00:00
|
|
|
server message, a data string, or both.
|
|
|
|
After a successful call to
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_send_authen ,
|
|
|
|
this information may be retrieved from the response by calling
|
|
|
|
.Fn tac_get_msg
|
|
|
|
and
|
|
|
|
.Fn tac_get_data .
|
|
|
|
These functions return dynamically-allocated copies of the
|
2004-07-02 23:52:20 +00:00
|
|
|
information from the packet.
|
|
|
|
The caller is responsible for freeing
|
|
|
|
the copies when it no longer needs them.
|
|
|
|
The data returned from
|
1998-11-13 00:54:26 +00:00
|
|
|
these functions is guaranteed to be terminated by a null byte.
|
|
|
|
.Pp
|
|
|
|
In the case of
|
|
|
|
.Fn tac_get_data ,
|
|
|
|
the
|
|
|
|
.Va len
|
|
|
|
argument points to a location into which the library will store the
|
|
|
|
actual length of the received data, not including the null
|
2004-07-02 23:52:20 +00:00
|
|
|
terminator.
|
|
|
|
This argument may be given as
|
1998-11-13 00:54:26 +00:00
|
|
|
.Dv NULL
|
|
|
|
if the caller is not interested in the length.
|
|
|
|
.Sh SENDING AUTHENTICATION CONTINUE PACKETS
|
|
|
|
If
|
|
|
|
.Fn tac_send_authen
|
|
|
|
returns a value containing one of the status codes
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETDATA ,
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETUSER ,
|
|
|
|
or
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETPASS ,
|
|
|
|
then the client must provide additional information to the server by
|
2004-07-02 23:52:20 +00:00
|
|
|
means of a TACACS+ CONTINUE packet.
|
|
|
|
To do so, the application must
|
1998-11-13 00:54:26 +00:00
|
|
|
first set the packet's user message and/or data fields using
|
|
|
|
.Fn tac_set_msg
|
|
|
|
and
|
|
|
|
.Fn tac_set_data .
|
|
|
|
The client then sends the CONTINUE packet with
|
|
|
|
.Fn tac_send_authen .
|
|
|
|
N.B.,
|
|
|
|
.Fn tac_create_authen
|
|
|
|
should
|
|
|
|
.Em not
|
|
|
|
be called to construct a CONTINUE packet; it is used only for the
|
|
|
|
initial authentication request.
|
|
|
|
.Pp
|
|
|
|
When it receives the CONTINUE packet, the server may again request
|
|
|
|
more information by returning
|
2002-11-29 15:57:50 +00:00
|
|
|
.Dv TAC_AUTHEN_STATUS_GETDATA ,
|
1998-11-13 00:54:26 +00:00
|
|
|
.Dv TAC_AUTHEN_STATUS_GETUSER ,
|
|
|
|
or
|
|
|
|
.Dv TAC_AUTHEN_STATUS_GETPASS .
|
|
|
|
The application should send further CONTINUEs until some other
|
|
|
|
status is received from the server.
|
2002-09-25 23:18:51 +00:00
|
|
|
.Sh SENDING THE AUTHORIZATION REQUEST AND RECEIVING THE RESPONSE
|
|
|
|
After the TACACS+ authorization request has been constructed, it
|
|
|
|
is sent by means of
|
|
|
|
.Fn tac_send_author .
|
|
|
|
This function connects to a server if not already connected, sends
|
2004-07-02 23:52:20 +00:00
|
|
|
the request, and waits for a reply.
|
|
|
|
On failure,
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_send_author
|
2004-07-02 23:52:20 +00:00
|
|
|
returns \-1.
|
|
|
|
Otherwise, it returns the TACACS+ status code and
|
2002-11-29 15:57:50 +00:00
|
|
|
number of attribute value (AV) pairs received packed into an
|
2004-07-02 23:52:20 +00:00
|
|
|
integer value.
|
|
|
|
The status can be extracted using the macro
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn TAC_AUTHOR_STATUS .
|
|
|
|
Possible status codes, defined in
|
2003-09-08 19:57:22 +00:00
|
|
|
.In taclib.h ,
|
2002-09-25 23:18:51 +00:00
|
|
|
include:
|
|
|
|
.Pp
|
|
|
|
.Bl -item -compact -offset indent
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHOR_STATUS_PASS_ADD
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHOR_STATUS_PASS_REPL
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHOR_STATUS_FAIL
|
|
|
|
.It
|
|
|
|
.Dv TAC_AUTHOR_STATUS_ERROR
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-11-29 15:57:50 +00:00
|
|
|
The number of AV pairs received is obtained using
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn TAC_AUTHEN_AV_COUNT .
|
|
|
|
.Sh EXTRACTING INFORMATION FROM THE SERVER'S AUTHORIZATION RESPONSE
|
2002-11-29 15:57:50 +00:00
|
|
|
Like an authentication response packet, an authorization
|
2002-09-25 23:18:51 +00:00
|
|
|
response packet from the
|
2004-07-02 23:52:20 +00:00
|
|
|
server may contain a server message, a data string, or both.
|
|
|
|
Refer
|
2002-09-25 23:18:51 +00:00
|
|
|
to EXTRACTING INFORMATION FROM THE SERVER'S AUTHENTICATION RESPONSE
|
|
|
|
for instruction on extraction of those values.
|
|
|
|
.Pp
|
|
|
|
An authorization response packet from the server may also contain
|
2004-07-02 23:52:20 +00:00
|
|
|
attribute value (AV) pairs.
|
|
|
|
To extract these, use
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_get_av
|
|
|
|
or
|
|
|
|
.Fn tac_get_av_value .
|
|
|
|
.Fn tac_get_av
|
2002-11-29 15:57:50 +00:00
|
|
|
takes the index of the AV pair as it is positioned in the list.
|
|
|
|
The indexes start at 0 (use
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn TAC_AUTHEN_AV_COUNT
|
2002-11-29 15:57:50 +00:00
|
|
|
on the return value of
|
|
|
|
.Fn tac_send_author
|
2002-09-25 23:18:51 +00:00
|
|
|
to get the total number of items in this list).
|
2002-11-29 15:57:50 +00:00
|
|
|
Alternatively,
|
|
|
|
.Fn tac_get_av_value
|
|
|
|
can be used.
|
|
|
|
.Fn tac_get_av_value
|
2002-09-25 23:18:51 +00:00
|
|
|
takes the attribute name and returns the
|
2004-07-02 23:52:20 +00:00
|
|
|
corresponding value only, not the AV pair.
|
|
|
|
These functions return
|
2002-09-25 23:18:51 +00:00
|
|
|
dynamically-allocated copies of the information from the packet.
|
|
|
|
The caller is responsible for freeing the copies when it no longer
|
2004-07-02 23:52:20 +00:00
|
|
|
needs them.
|
|
|
|
The data returned from these functions is guaranteed
|
2002-09-25 23:18:51 +00:00
|
|
|
to be terminated by a null byte.
|
1998-11-13 00:54:26 +00:00
|
|
|
.Sh OBTAINING ERROR MESSAGES
|
|
|
|
Those functions which accept a
|
|
|
|
.Va struct tac_handle *
|
2004-07-02 23:52:20 +00:00
|
|
|
argument record an error message if they fail.
|
|
|
|
The error message
|
1998-11-13 00:54:26 +00:00
|
|
|
can be retrieved by calling
|
|
|
|
.Fn tac_strerror .
|
|
|
|
The message text is overwritten on each new error for the given
|
|
|
|
.Va struct tac_handle * .
|
2002-11-29 15:57:50 +00:00
|
|
|
Thus the message must be copied if it is to be preserved through
|
1998-11-13 00:54:26 +00:00
|
|
|
subsequent library calls using the same handle.
|
|
|
|
.Sh CLEANUP
|
|
|
|
To free the resources used by the TACACS+ library, call
|
|
|
|
.Fn tac_close .
|
|
|
|
.Sh RETURN VALUES
|
2004-07-02 23:52:20 +00:00
|
|
|
The following functions return a non-negative value on success.
|
|
|
|
If
|
2002-11-29 15:57:50 +00:00
|
|
|
they detect an error, they return \-1 and record an error message
|
1998-11-13 00:54:26 +00:00
|
|
|
which can be retrieved using
|
|
|
|
.Fn tac_strerror .
|
|
|
|
.Pp
|
2002-11-29 15:57:50 +00:00
|
|
|
.Bl -item -offset indent -compact
|
1998-11-13 00:54:26 +00:00
|
|
|
.It
|
|
|
|
.Fn tac_add_server
|
|
|
|
.It
|
|
|
|
.Fn tac_config
|
|
|
|
.It
|
|
|
|
.Fn tac_create_authen
|
|
|
|
.It
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_create_author
|
|
|
|
.It
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_send_authen
|
|
|
|
.It
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_send_author
|
|
|
|
.It
|
|
|
|
.Fn tac_set_av
|
|
|
|
.It
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_set_data
|
|
|
|
.It
|
|
|
|
.Fn tac_set_msg
|
|
|
|
.It
|
|
|
|
.Fn tac_set_port
|
|
|
|
.It
|
|
|
|
.Fn tac_set_priv
|
|
|
|
.It
|
|
|
|
.Fn tac_set_rem_addr
|
|
|
|
.It
|
|
|
|
.Fn tac_set_user
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The following functions return a
|
|
|
|
.No non- Ns Dv NULL
|
2004-07-02 23:52:20 +00:00
|
|
|
pointer on success.
|
|
|
|
If they are unable to allocate sufficient
|
1998-11-13 00:54:26 +00:00
|
|
|
virtual memory, they return
|
|
|
|
.Dv NULL
|
|
|
|
and record an error message which can be retrieved using
|
|
|
|
.Fn tac_strerror .
|
|
|
|
.Pp
|
|
|
|
.Bl -item -offset indent -compact
|
|
|
|
.It
|
2002-09-25 23:18:51 +00:00
|
|
|
.Fn tac_get_av
|
|
|
|
.It
|
|
|
|
.Fn tac_get_av_pair
|
|
|
|
.It
|
1998-11-13 00:54:26 +00:00
|
|
|
.Fn tac_get_data
|
|
|
|
.It
|
|
|
|
.Fn tac_get_msg
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The following functions return a
|
|
|
|
.No non- Ns Dv NULL
|
2004-07-02 23:52:20 +00:00
|
|
|
pointer on success.
|
|
|
|
If they are unable to allocate sufficient
|
1998-11-13 00:54:26 +00:00
|
|
|
virtual memory, they return
|
|
|
|
.Dv NULL ,
|
|
|
|
without recording an error message.
|
|
|
|
.Pp
|
|
|
|
.Bl -item -offset indent -compact
|
|
|
|
.It
|
|
|
|
.Fn tac_open
|
|
|
|
.El
|
|
|
|
.Sh FILES
|
|
|
|
.Pa /etc/tacplus.conf
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr tacplus.conf 5
|
|
|
|
.Rs
|
2000-05-10 09:49:04 +00:00
|
|
|
.%A D. Carrel
|
|
|
|
.%A Lol Grant
|
1998-11-13 00:54:26 +00:00
|
|
|
.%T The TACACS+ Protocol, Version 1.78
|
|
|
|
.%O draft-grant-tacacs-02.txt (Internet Draft)
|
|
|
|
.Re
|
|
|
|
.Sh AUTHORS
|
2002-11-29 15:57:50 +00:00
|
|
|
.An -nosplit
|
1998-11-13 00:54:26 +00:00
|
|
|
This software was written by
|
2002-11-29 15:57:50 +00:00
|
|
|
.An John Polstra
|
2002-09-25 23:18:51 +00:00
|
|
|
and
|
|
|
|
.An Paul Fraley ,
|
2000-11-14 11:20:58 +00:00
|
|
|
and donated to the
|
|
|
|
.Fx
|
|
|
|
project by Juniper Networks, Inc.
|