xref: /titanic_41/usr/src/lib/gss_mechs/mech_dh/backend/mech/validate.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include "dh_gssapi.h"
33 
34 /*
35  * This module provides the interface to validating contexts, credentials,
36  * and principals. The current implementation does nothing.
37  */
38 
39 /*
40  * __dh_validate_context: Validate a context, i.e., check if the context is
41  * in the database. If the context is non null then return success, else
42  * return bad context.
43  */
44 
45 OM_uint32
__dh_validate_context(dh_gss_context_t ctx)46 __dh_validate_context(dh_gss_context_t ctx)
47 {
48 	if (ctx && ctx->state != BAD)
49 		return (DH_SUCCESS);
50 	return (DH_BAD_CONTEXT);
51 }
52 
53 /*
54  * __dh_install_context: Install the context in to the database of current
55  * contexts.
56  */
57 OM_uint32
__dh_install_context(dh_gss_context_t ctx)58 __dh_install_context(dh_gss_context_t ctx)
59 {
60 	return (ctx ? DH_SUCCESS : DH_BAD_CONTEXT);
61 }
62 
63 /*
64  * __dh_remove_context: Deinstall the context from the database of current
65  * contexts.
66  */
67 OM_uint32
__dh_remove_context(dh_gss_context_t ctx)68 __dh_remove_context(dh_gss_context_t ctx)
69 {
70 	return (ctx ? DH_SUCCESS : DH_BAD_CONTEXT);
71 }
72 
73 /*
74  * __dh_validate_cred: Check the cred database if the supplied crediential
75  * is present, valid.
76  */
77 
78 /*ARGSUSED*/
79 OM_uint32
__dh_validate_cred(dh_cred_id_t cred)80 __dh_validate_cred(dh_cred_id_t cred)
81 {
82 	return (DH_SUCCESS);
83 }
84 
85 /*
86  * __dh_install_cred: Installed the cred into the credential database
87  */
88 
89 /*ARGSUSED*/
90 OM_uint32
__dh_install_cred(dh_cred_id_t cred)91 __dh_install_cred(dh_cred_id_t cred)
92 {
93 	return (DH_SUCCESS);
94 }
95 
96 /*
97  * __dh_remove_cred: Remove the supplied cred from the database.
98  */
99 
100 /*ARGSUSED*/
101 OM_uint32
__dh_remove_cred(dh_cred_id_t cred)102 __dh_remove_cred(dh_cred_id_t cred)
103 {
104 	return (DH_SUCCESS);
105 }
106 
107 /*
108  * Check if a principal is valid.
109  *
110  * XXX We could check for a valid netname.
111  */
112 
113 /*ARGSUSED*/
114 OM_uint32
__dh_validate_principal(dh_principal principal)115 __dh_validate_principal(dh_principal principal)
116 {
117 	return (DH_SUCCESS);
118 }
119