1 /* $OpenBSD: ssh-gss.h,v 1.10 2007/06/12 08:20:00 djm Exp $ */
3 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #elif defined(HAVE_GSSAPI_GSSAPI_H)
34 #include <gssapi/gssapi.h>
39 # ifdef HAVE_GSSAPI_GENERIC_H
40 # include <gssapi_generic.h>
41 # elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
42 # include <gssapi/gssapi_generic.h>
46 #include <gssapi/gssapi_ext.h>
49 /* MIT Kerberos doesn't seem to define GSS_NT_HOSTBASED_SERVICE */
51 #ifndef GSS_C_NT_HOSTBASED_SERVICE
52 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
53 #endif /* GSS_C_NT_... */
57 /* draft-ietf-secsh-gsskeyex-06 */
58 #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
59 #define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
60 #define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
61 #define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
62 #define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
63 #define SSH2_MSG_USERAUTH_GSSAPI_MIC 66
65 #define SSH_GSS_OIDTYPE 0x06
75 gss_buffer_desc displayname;
76 gss_buffer_desc exportedname;
79 ssh_gssapi_ccache store;
83 OM_uint32 major; /* both */
84 OM_uint32 minor; /* both */
85 gss_ctx_id_t context; /* both */
86 gss_name_t name; /* both */
87 gss_OID oid; /* client */
88 gss_cred_id_t creds; /* server */
89 gss_name_t client; /* server */
90 gss_cred_id_t client_creds; /* server */
93 int ssh_gssapi_check_oid(Gssctxt *, void *, size_t);
94 void ssh_gssapi_set_oid_data(Gssctxt *, void *, size_t);
95 void ssh_gssapi_set_oid(Gssctxt *, gss_OID);
96 void ssh_gssapi_supported_oids(gss_OID_set *);
98 OM_uint32 ssh_gssapi_import_name(Gssctxt *, const char *);
99 OM_uint32 ssh_gssapi_init_ctx(Gssctxt *, int,
100 gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
101 OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *,
102 gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
103 OM_uint32 ssh_gssapi_getclient(Gssctxt *, ssh_gssapi_client *);
104 void ssh_gssapi_error(Gssctxt *);
105 char *ssh_gssapi_last_error(Gssctxt *, OM_uint32 *, OM_uint32 *);
106 void ssh_gssapi_build_ctx(Gssctxt **);
107 void ssh_gssapi_delete_ctx(Gssctxt **);
108 OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t);
109 void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *);
110 int ssh_gssapi_check_mechanism(Gssctxt **, gss_OID, const char *);
113 OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
114 int ssh_gssapi_userok(char *name);
115 OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
116 void ssh_gssapi_do_child(char ***, u_int *);
117 void ssh_gssapi_cleanup_creds(void);
118 void ssh_gssapi_storecreds(void);
122 #endif /* _SSH_GSS_H */