xref: /illumos-gate/usr/src/lib/gss_mechs/mech_dh/backend/mech/validate.c (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	validate.c
24  *
25  *	Copyright (c) 1997, by Sun Microsystems, Inc.
26  *	All rights reserved.
27  *
28  */
29 
30 #include "dh_gssapi.h"
31 
32 /*
33  * This module provides the interface to validating contexts, credentials,
34  * and principals. The current implementation does nothing.
35  */
36 
37 /*
38  * __dh_validate_context: Validate a context, i.e., check if the context is
39  * in the database. If the context is non null then return success, else
40  * return bad context.
41  */
42 
43 OM_uint32
__dh_validate_context(dh_gss_context_t ctx)44 __dh_validate_context(dh_gss_context_t ctx)
45 {
46 	if (ctx && ctx->state != BAD)
47 		return (DH_SUCCESS);
48 	return (DH_BAD_CONTEXT);
49 }
50 
51 /*
52  * __dh_install_context: Install the context in to the database of current
53  * contexts.
54  */
55 OM_uint32
__dh_install_context(dh_gss_context_t ctx)56 __dh_install_context(dh_gss_context_t ctx)
57 {
58 	return (ctx ? DH_SUCCESS : DH_BAD_CONTEXT);
59 }
60 
61 /*
62  * __dh_remove_context: Deinstall the context from the database of current
63  * contexts.
64  */
65 OM_uint32
__dh_remove_context(dh_gss_context_t ctx)66 __dh_remove_context(dh_gss_context_t ctx)
67 {
68 	return (ctx ? DH_SUCCESS : DH_BAD_CONTEXT);
69 }
70 
71 /*
72  * __dh_validate_cred: Check the cred database if the supplied crediential
73  * is present, valid.
74  */
75 
76 /*ARGSUSED*/
77 OM_uint32
__dh_validate_cred(dh_cred_id_t cred)78 __dh_validate_cred(dh_cred_id_t cred)
79 {
80 	return (DH_SUCCESS);
81 }
82 
83 /*
84  * __dh_install_cred: Installed the cred into the credential database
85  */
86 
87 /*ARGSUSED*/
88 OM_uint32
__dh_install_cred(dh_cred_id_t cred)89 __dh_install_cred(dh_cred_id_t cred)
90 {
91 	return (DH_SUCCESS);
92 }
93 
94 /*
95  * __dh_remove_cred: Remove the supplied cred from the database.
96  */
97 
98 /*ARGSUSED*/
99 OM_uint32
__dh_remove_cred(dh_cred_id_t cred)100 __dh_remove_cred(dh_cred_id_t cred)
101 {
102 	return (DH_SUCCESS);
103 }
104 
105 /*
106  * Check if a principal is valid.
107  *
108  * XXX We could check for a valid netname.
109  */
110 
111 /*ARGSUSED*/
112 OM_uint32
__dh_validate_principal(dh_principal principal)113 __dh_validate_principal(dh_principal principal)
114 {
115 	return (DH_SUCCESS);
116 }
117