xref: /titanic_44/usr/src/lib/smbsrv/libsmbns/common/smbns_krb.h (revision b9bc7f7832704fda46b4d6b04f3f7be1227dc644)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_SMB_KRB5_H
27 #define	_SMBSRV_SMB_KRB5_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <gssapi/gssapi.h>
32 #include <kerberosv5/krb5.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	SMBNS_KRB5_KEYTAB "/etc/krb5/krb5.keytab"
39 
40 extern gss_OID gss_nt_user_name;
41 extern gss_OID gss_nt_machine_uid_name;
42 extern gss_OID gss_nt_string_uid_name;
43 extern gss_OID gss_nt_service_name;
44 extern gss_OID gss_nt_exported_name;
45 extern gss_OID gss_nt_service_name_v2;
46 
47 int krb5_acquire_cred_kinit(char *, char *, gss_cred_id_t *,
48     gss_OID *, int *, char *);
49 int krb5_establish_sec_ctx_kinit(char *, char *, gss_cred_id_t,
50     gss_ctx_id_t *, gss_name_t, gss_OID, int, gss_buffer_desc *,
51     gss_buffer_desc *, OM_uint32 *, OM_uint32 *, int *,
52     int *, OM_uint32 *, char *);
53 int smb_krb5_ctx_init(krb5_context *ctx);
54 void smb_krb5_ctx_fini(krb5_context ctx);
55 int smb_krb5_get_principal(krb5_context ctx, char *princ_str,
56     krb5_principal *princ);
57 int smb_krb5_setpwd(krb5_context ctx, krb5_principal princ, char *passwd);
58 int smb_krb5_remove_keytab_entries(krb5_context ctx, krb5_principal princ,
59     char *fname);
60 int smb_krb5_update_keytab_entries(krb5_context ctx, krb5_principal princ,
61     char *fname, krb5_kvno kvno, char *passwd, krb5_enctype *enctypes,
62     int enctype_count);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* _SMBSRV_SMB_KRB5_H */
69