xref: /illumos-gate/usr/src/cmd/gss/gsscred/gsscred.h (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
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 #include <libintl.h>
38 #include <locale.h>
39 #include <gssapi/gssapi.h>
40 #include <pwd.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 #if !defined(TEXT_DOMAIN)
47 #define	TEXT_DOMAIN "SUNW_OST_OSCMD"
48 #endif
49 
50 #define	GSSCRED_FLAT_FILE	-1
51 
52 /* Structure to hold GSS credentials for each entry */
53 typedef struct GssCredEntry_t {
54 	char *principal_name;
55 	int  unix_uid;
56 	char *comment;
57 	struct GssCredEntry_t *next;
58 } GssCredEntry;
59 
60 /*
61  * Misc functions in gsscred.
62  */
63 int gsscred_AsHex(const gss_buffer_t inBuf, gss_buffer_t outBuf);
64 int gsscred_MakeName(const gss_OID mechOid, const char *name,
65 		const char *nameOid, gss_buffer_t OutName);
66 int gsscred_read_config_file(void);
67 int gsscred_MakeNameHeader(const gss_OID mechOid, gss_buffer_t outNameHdr);
68 
69 
70 /*
71  * Flat file based gsscred functions.
72  */
73 int file_addGssCredEntry(const gss_buffer_t hexName, const char *uid,
74 	const char *comment, char **errDetails);
75 int file_getGssCredEntry(const gss_buffer_t name, const char *uid,
76 	char **errDetails);
77 int file_deleteGssCredEntry(const gss_buffer_t name, const char *uid,
78 	char **errDetails);
79 int file_getGssCredUid(const gss_buffer_t name, uid_t *uidOut);
80 
81 
82 /*
83  * GSS entry point for retrieving user uid information based on
84  * exported name buffer.
85  */
86 int gss_getGssCredEntry(const gss_buffer_t expName, uid_t *uid);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _GSSCRED_H */
93