xref: /titanic_41/usr/src/cmd/gss/gsscred/gsscred.h (revision 7c2fbfb345896881c631598ee3852ce9ce33fb07)
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  * Copyright 1997-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * gsscred utility
29  *
30  * Manages mapping between a security principal
31  * name and unix uid.
32  */
33 
34 #ifndef	_GSSCRED_H
35 #define	_GSSCRED_H
36 
37 #pragma ident	"%Z%%M%	%I%	%E% SMI"
38 
39 #include <libintl.h>
40 #include <locale.h>
41 #include <gssapi/gssapi.h>
42 #include <pwd.h>
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 #if !defined(TEXT_DOMAIN)
49 #define	TEXT_DOMAIN "SUNW_OST_OSCMD"
50 #endif
51 
52 #define	GSSCRED_FLAT_FILE	-1
53 
54 /* Structure to hold GSS credentials for each entry */
55 typedef struct GssCredEntry_t {
56 	char *principal_name;
57 	int  unix_uid;
58 	char *comment;
59 	struct GssCredEntry_t *next;
60 } GssCredEntry;
61 
62 /*
63  * Misc functions in gsscred.
64  */
65 int gsscred_AsHex(const gss_buffer_t inBuf, gss_buffer_t outBuf);
66 int gsscred_MakeName(const gss_OID mechOid, const char *name,
67 		const char *nameOid, gss_buffer_t OutName);
68 int gsscred_read_config_file(void);
69 int gsscred_MakeNameHeader(const gss_OID mechOid, gss_buffer_t outNameHdr);
70 
71 
72 /*
73  * Flat file based gsscred functions.
74  */
75 int file_addGssCredEntry(const gss_buffer_t hexName, const char *uid,
76 	const char *comment, char **errDetails);
77 int file_getGssCredEntry(const gss_buffer_t name, const char *uid,
78 	char **errDetails);
79 int file_deleteGssCredEntry(const gss_buffer_t name, const char *uid,
80 	char **errDetails);
81 int file_getGssCredUid(const gss_buffer_t name, uid_t *uidOut);
82 
83 
84 /*
85  * GSS entry point for retrieving user uid information based on
86  * exported name buffer.
87  */
88 int gss_getGssCredEntry(const gss_buffer_t expName, uid_t *uid);
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _GSSCRED_H */
95