]> andersk Git - gssapi-openssh.git/blame - openssh/ssh-gss.h
o Bump version to 2.7.
[gssapi-openssh.git] / openssh / ssh-gss.h
CommitLineData
5598e598 1/*
23987cb8 2 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
5598e598 3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
b59afbfe 25#ifndef _SSH_GSS_H
26#define _SSH_GSS_H
27
5598e598 28#ifdef GSSAPI
29
30#include "kex.h"
31#include "buffer.h"
32
33#include <gssapi.h>
34
8f0688f5 35#ifndef MECHGLUE
5598e598 36#ifdef KRB5
37#ifndef HEIMDAL
38#include <gssapi_generic.h>
39
40/* MIT Kerberos doesn't seem to define GSS_NT_HOSTBASED_SERVICE */
5598e598 41#ifndef GSS_C_NT_HOSTBASED_SERVICE
42#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
43#endif /* GSS_C_NT_... */
44#endif /* !HEIMDAL */
45#endif /* KRB5 */
8f0688f5 46#endif /* !MECHGLUE */
5598e598 47
b59afbfe 48/* draft-ietf-secsh-gsskeyex-03 */
49#define SSH2_MSG_KEXGSS_INIT 30
50#define SSH2_MSG_KEXGSS_CONTINUE 31
51#define SSH2_MSG_KEXGSS_COMPLETE 32
52#define SSH2_MSG_KEXGSS_HOSTKEY 33
53#define SSH2_MSG_KEXGSS_ERROR 34
54#define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
55#define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
5598e598 56#define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
b59afbfe 57#define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
e23e524c 58#define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
b59afbfe 59
60#define KEX_GSS_SHA1 "gss-group1-sha1-"
5598e598 61
23987cb8 62typedef struct {
63 char *filename;
64 char *envvar;
65 char *envval;
66 void *data;
67} ssh_gssapi_ccache;
68
69typedef struct {
70 gss_buffer_desc name;
71 gss_cred_id_t creds;
72 struct ssh_gssapi_mech_struct *mech;
73 ssh_gssapi_ccache store;
74} ssh_gssapi_client;
5598e598 75
23987cb8 76typedef struct ssh_gssapi_mech_struct {
5598e598 77 char *enc_name;
78 char *name;
79 gss_OID_desc oid;
23987cb8 80 int (*dochild) (ssh_gssapi_client *);
81 int (*userok) (ssh_gssapi_client *, char *);
82 int (*localname) (ssh_gssapi_client *, char **);
83 void (*storecreds) (ssh_gssapi_client *);
5598e598 84} ssh_gssapi_mech;
85
23987cb8 86
87
5598e598 88typedef struct {
23987cb8 89 OM_uint32 major; /* both */
90 OM_uint32 minor; /* both */
5598e598 91 gss_ctx_id_t context; /* both */
92 gss_name_t name; /* both */
6f9f4dab 93 gss_OID oid; /* both */
5598e598 94 gss_cred_id_t creds; /* server */
95 gss_name_t client; /* server */
96 gss_cred_id_t client_creds; /* server */
97} Gssctxt;
98
23987cb8 99extern ssh_gssapi_mech *supported_mechs[];
5598e598 100
08c2f275 101char *ssh_gssapi_mechanisms(char *host);
23987cb8 102char *ssh_gssapi_client_mechanisms(char *host);
103gss_OID ssh_gssapi_client_id_kex(Gssctxt *ctx, char *name);
104int ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len);
5598e598 105void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len);
106void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid);
107void ssh_gssapi_supported_oids(gss_OID_set *oidset);
23987cb8 108ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *ctxt);
5598e598 109
af6d5f4c 110OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host);
5598e598 111OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx);
112OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds,
113 gss_buffer_desc *recv_tok,
114 gss_buffer_desc *send_tok, OM_uint32 *flags);
115OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx,
116 gss_buffer_desc *recv_tok,
117 gss_buffer_desc *send_tok,
118 OM_uint32 *flags);
119OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx,
23987cb8 120 ssh_gssapi_mech **mech,
5598e598 121 gss_buffer_desc *name,
122 gss_cred_id_t *creds);
23987cb8 123void ssh_gssapi_error(Gssctxt *ctx);
124char *ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *maj, OM_uint32 *min);
b59afbfe 125void ssh_gssapi_build_ctx(Gssctxt **ctx);
126void ssh_gssapi_delete_ctx(Gssctxt **ctx);
b59afbfe 127OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx,gss_OID oid);
5598e598 128
23987cb8 129int ssh_gssapi_check_mechanism(gss_OID oid, char *host);
130
5598e598 131/* In the server */
e23e524c 132gss_OID ssh_gssapi_server_id_kex(char *name);
b59afbfe 133int ssh_gssapi_userok(char *name);
e23e524c 134int ssh_gssapi_localname(char **name);
5598e598 135void ssh_gssapi_server(Kex *kex, Buffer *client_kexinit,
136 Buffer *server_kexinit);
b59afbfe 137
138OM_uint32 ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *buffer,
139 gss_buffer_desc *hash);
140
5598e598 141void ssh_gssapi_do_child(char ***envp, u_int *envsizep);
142void ssh_gssapi_cleanup_creds(void *ignored);
143void ssh_gssapi_storecreds();
23987cb8 144char *ssh_gssapi_server_mechanisms();
b59afbfe 145
146#ifdef GSI
147int gsi_gridmap(char *subject_name, char **mapped_name);
f9ee7be6 148#endif
149
150#ifdef MECHGLUE
151gss_cred_id_t __gss_get_mechanism_cred
152 (gss_cred_id_t, /* union_cred */
153 gss_OID /* mech_type */
154 );
b59afbfe 155#endif
076a92b0 156
5598e598 157#endif /* GSSAPI */
b59afbfe 158
159#endif /* _SSH_GSS_H */
This page took 0.287122 seconds and 5 git commands to generate.