]> andersk Git - gssapi-openssh.git/blame - openssh/ssh-gss.h
recommit previous changes to simon's re-organized code
[gssapi-openssh.git] / openssh / ssh-gss.h
CommitLineData
5598e598 1/*
b59afbfe 2 * Copyright (c) 2001,2002 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 */
41
42#ifndef GSS_C_NT_HOSTBASED_SERVICE
43#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
44#endif /* GSS_C_NT_... */
45#endif /* !HEIMDAL */
46#endif /* KRB5 */
8f0688f5 47#endif /* !MECHGLUE */
5598e598 48
b59afbfe 49/* draft-ietf-secsh-gsskeyex-03 */
50#define SSH2_MSG_KEXGSS_INIT 30
51#define SSH2_MSG_KEXGSS_CONTINUE 31
52#define SSH2_MSG_KEXGSS_COMPLETE 32
53#define SSH2_MSG_KEXGSS_HOSTKEY 33
54#define SSH2_MSG_KEXGSS_ERROR 34
55#define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
56#define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
5598e598 57#define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
b59afbfe 58#define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
59
60#define KEX_GSS_SHA1 "gss-group1-sha1-"
5598e598 61
62enum ssh_gss_id {
63#ifdef KRB5
64 GSS_KERBEROS,
65#endif
66#ifdef GSI
67 GSS_GSI,
68#endif /* GSI */
69 GSS_LAST_ENTRY
70};
71
72typedef struct ssh_gss_mech_struct {
73 char *enc_name;
74 char *name;
75 gss_OID_desc oid;
76} ssh_gssapi_mech;
77
78typedef struct {
79 OM_uint32 status; /* both */
80 gss_ctx_id_t context; /* both */
81 gss_name_t name; /* both */
6f9f4dab 82 gss_OID oid; /* both */
5598e598 83 gss_cred_id_t creds; /* server */
84 gss_name_t client; /* server */
85 gss_cred_id_t client_creds; /* server */
86} Gssctxt;
87
88extern ssh_gssapi_mech supported_mechs[];
08c2f275 89extern char gssprefix[];
5598e598 90extern gss_buffer_desc gssapi_client_name;
91extern gss_cred_id_t gssapi_client_creds;
92extern enum ssh_gss_id gssapi_client_type;
93
08c2f275 94char *ssh_gssapi_mechanisms(char *host);
95char *ssh_server_gssapi_mechanisms();
b59afbfe 96gss_OID ssh_gssapi_id_kex(Gssctxt *ctx, char *name);
5598e598 97void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len);
98void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid);
99void ssh_gssapi_supported_oids(gss_OID_set *oidset);
100enum ssh_gss_id ssh_gssapi_get_ctype(Gssctxt *ctxt);
101
af6d5f4c 102OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host);
5598e598 103OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx);
104OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds,
105 gss_buffer_desc *recv_tok,
106 gss_buffer_desc *send_tok, OM_uint32 *flags);
107OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx,
108 gss_buffer_desc *recv_tok,
109 gss_buffer_desc *send_tok,
110 OM_uint32 *flags);
111OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx,
112 enum ssh_gss_id *type,
113 gss_buffer_desc *name,
114 gss_cred_id_t *creds);
6f9f4dab 115void ssh_gssapi_error(gss_OID mech,
116 OM_uint32 major_status, OM_uint32 minor_status);
117void ssh_gssapi_send_error(gss_OID mech,
118 OM_uint32 major_status,OM_uint32 minor_status);
b59afbfe 119void ssh_gssapi_build_ctx(Gssctxt **ctx);
120void ssh_gssapi_delete_ctx(Gssctxt **ctx);
121OM_uint32 ssh_gssapi_client_ctx(Gssctxt **ctx,gss_OID oid,char *host);
122OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx,gss_OID oid);
5598e598 123
5598e598 124/* In the server */
b59afbfe 125int ssh_gssapi_userok(char *name);
126int ssh_gssapi_localname(char **lname);
5598e598 127void ssh_gssapi_server(Kex *kex, Buffer *client_kexinit,
128 Buffer *server_kexinit);
b59afbfe 129
130OM_uint32 ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *buffer,
131 gss_buffer_desc *hash);
132
5598e598 133void ssh_gssapi_do_child(char ***envp, u_int *envsizep);
134void ssh_gssapi_cleanup_creds(void *ignored);
135void ssh_gssapi_storecreds();
c7221eee 136void ssh_gssapi_clean_env();
b59afbfe 137
138#ifdef GSI
139int gsi_gridmap(char *subject_name, char **mapped_name);
f9ee7be6 140#endif
141
142#ifdef MECHGLUE
143gss_cred_id_t __gss_get_mechanism_cred
144 (gss_cred_id_t, /* union_cred */
145 gss_OID /* mech_type */
146 );
b59afbfe 147#endif
076a92b0 148
5598e598 149#endif /* GSSAPI */
b59afbfe 150
151#endif /* _SSH_GSS_H */
This page took 0.07452 seconds and 5 git commands to generate.