xref: /freebsd/lib/libgssapi/gss_display_status.3 (revision 2bc6540439d0932b38067c9cc321fa0e2a61f264)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2005 Doug Rabson
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\"	$FreeBSD$
28.\"
29.\" Copyright (C) The Internet Society (2000).  All Rights Reserved.
30.\"
31.\" This document and translations of it may be copied and furnished to
32.\" others, and derivative works that comment on or otherwise explain it
33.\" or assist in its implementation may be prepared, copied, published
34.\" and distributed, in whole or in part, without restriction of any
35.\" kind, provided that the above copyright notice and this paragraph are
36.\" included on all such copies and derivative works.  However, this
37.\" document itself may not be modified in any way, such as by removing
38.\" the copyright notice or references to the Internet Society or other
39.\" Internet organizations, except as needed for the purpose of
40.\" developing Internet standards in which case the procedures for
41.\" copyrights defined in the Internet Standards process must be
42.\" followed, or as required to translate it into languages other than
43.\" English.
44.\"
45.\" The limited permissions granted above are perpetual and will not be
46.\" revoked by the Internet Society or its successors or assigns.
47.\"
48.\" This document and the information contained herein is provided on an
49.\" "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
50.\" TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
51.\" BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
52.\" HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
53.\" MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
54.\"
55.\" The following commands are required for all man pages.
56.Dd November 12, 2005
57.Os
58.Dt GSS_DISPLAY_STATUS 3 PRM
59.Sh NAME
60.Nm gss_display_status
61.Nd Convert a GSS-API status code to text
62.\" This next command is for sections 2 and 3 only.
63.\" .Sh LIBRARY
64.Sh SYNOPSIS
65.In "gssapi/gssapi.h"
66.Ft OM_uint32
67.Fo gss_display_status
68.Fa "OM_uint32 *minor_status"
69.Fa "OM_uint32 status_value"
70.Fa "int status_type"
71.Fa "const gss_OID mech_type"
72.Fa "OM_uint32 *message_context"
73.Fa "gss_buffer_t status_string"
74.Fc
75.Sh DESCRIPTION
76Allows an application to obtain a textual representation of a GSS-API
77status code,
78for display to the user or for logging purposes.
79Since some status values may indicate multiple conditions,
80applications may need to call
81.Fn gss_display_status
82multiple times,
83each call generating a single text string.
84The
85.Fa message_context
86parameter is used by
87.Fn gss_display_status
88to store state information about which error messages have already
89been extracted from a given
90.Fa status_value ;
91.Fa message_context
92must be initialized to zero by the application prior to the first call,
93and
94.Fn gss_display_status
95will return a non-zero value in this parameter if there are further
96messages to extract.
97.Pp
98The
99.Fa message_context
100parameter contains all state information required by
101.Fn gss_display_status
102in order to extract further messages from the
103.Fa status_value ;
104even when a non-zero value is returned in this parameter,
105the application is not required to call
106.Fn gss_display_status
107again unless subsequent messages are desired.
108The following code extracts all messages from a given status code and prints them to stderr:
109.Bd -literal
110OM_uint32 message_context;
111OM_uint32 status_code;
112OM_uint32 maj_status;
113OM_uint32 min_status;
114gss_buffer_desc status_string;
115
116       ...
117
118message_context = 0;
119
120do {
121
122  maj_status = gss_display_status (
123		  &min_status,
124		  status_code,
125		  GSS_C_GSS_CODE,
126		  GSS_C_NO_OID,
127		  &message_context,
128		  &status_string)
129
130  fprintf(stderr,
131	  "%.*s\\n",
132	 (int)status_string.length,
133	 (char *)status_string.value);
134
135  gss_release_buffer(&min_status, &status_string);
136
137} while (message_context != 0);
138.Ed
139.Sh PARAMETERS
140.Bl -tag
141.It minor_status
142Mechanism specific status code.
143.It status_value
144Status value to be converted
145.It status_type
146.Bl -tag
147.It GSS_C_GSS_CODE
148.Fa status_value
149is a GSS status code
150.It GSS_C_MECH_CODE
151.Fa status_value
152is a mechanism status code
153.El
154.It mech_type
155Underlying mechanism (used to interpret a minor status value).
156Supply
157.Dv GSS_C_NO_OID
158to obtain the system default.
159.It message_context
160Should be initialized to zero by the application prior to the first
161call.
162On return from
163.Fn gss_display_status ,
164a non-zero status_value parameter indicates that additional messages
165may be extracted from the status code via subsequent calls to
166.Fn gss_display_status ,
167passing the same
168.Fa status_value ,
169.Fa status_type ,
170.Fa mech_type ,
171and
172.Fa message_context
173parameters.
174.It status_string
175Textual interpretation of the
176.Fa status_value .
177Storage associated with this parameter must be freed by the
178application after use with a call to
179.Fn gss_release_buffer .
180.El
181.Sh RETURN VALUES
182.Bl -tag
183.It GSS_S_COMPLETE
184Successful completion
185.It GSS_S_BAD_MECH
186Indicates that translation in accordance with an unsupported mechanism
187type was requested
188.It GSS_S_BAD_STATUS
189The status value was not recognized, or the status type was neither
190.Dv GSS_C_GSS_CODE
191nor
192.Dv GSS_C_MECH_CODE .
193.El
194.Sh SEE ALSO
195.Xr gss_release_buffer 3
196.Sh STANDARDS
197.Bl -tag
198.It RFC 2743
199Generic Security Service Application Program Interface Version 2, Update 1
200.It RFC 2744
201Generic Security Service API Version 2 : C-bindings
202.\" .Sh HISTORY
203.El
204.Sh HISTORY
205The
206.Nm
207manual page example first appeared in
208.Fx 7.0 .
209.Sh AUTHORS
210John Wray, Iris Associates
211