]> andersk Git - gssapi-openssh.git/blob - openssh/ssh-gss.h
revision: solve the compilation problem when both GSI and Kerberos are supported...
[gssapi-openssh.git] / openssh / ssh-gss.h
1 /*
2  * Copyright (c) 2001 Simon Wilkinson. All rights reserved.
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
25 #ifdef GSSAPI
26
27 #include "kex.h"
28 #include "buffer.h"
29
30 #include "gssapi_krb.h"
31
32 #ifdef KRB5
33 #ifndef HEIMDAL
34
35 /* MIT Kerberos doesn't seem to define GSS_NT_HOSTBASED_SERVICE */
36
37 #ifndef GSS_C_NT_HOSTBASED_SERVICE
38 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
39 #endif /* GSS_C_NT_... */
40 #endif /* !HEIMDAL */
41 #endif /* KRB5 */
42
43 /* draft-ietf-secsh-gsskeyex-01 */
44 #define SSH2_MSG_KEXGSS_INIT            30
45 #define SSH2_MSG_KEXGSS_CONTINUE        31
46 #define SSH2_MSG_KEXGSS_COMPLETE        32
47 #define SSH2_MSG_KEXGSS_HOSTKEY         33
48 #define KEX_GSS_SHA1                    "gss-group1-sha1-"
49
50 /* draft-galb-secsh-gssapi-01 */
51 #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE     60
52 #define SSH2_MSG_USERAUTH_GSSAPI_TOKEN        61
53 #define SSH2_MSG_USERAUTH_GSSAPI_HASH         62
54 #define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE      63    
55
56 enum ssh_gss_id {
57 #ifdef GSI
58         GSS_GSI,
59 #endif /* GSI */
60 #ifdef KRB5
61         GSS_KERBEROS,
62 #endif
63         GSS_LAST_ENTRY
64 };
65
66 typedef struct ssh_gss_mech_struct {
67         char *enc_name;
68         char *name;
69         gss_OID_desc oid;
70 } ssh_gssapi_mech;
71
72 typedef struct {
73         OM_uint32       status; /* both */
74         gss_ctx_id_t    context; /* both */
75         gss_name_t      name; /* both */
76         gss_OID         oid; /* client */
77         gss_cred_id_t   creds; /* server */
78         gss_name_t      client; /* server */
79         gss_cred_id_t   client_creds; /* server */
80 } Gssctxt;
81
82 extern ssh_gssapi_mech supported_mechs[];
83 extern gss_buffer_desc gssapi_client_name;
84 extern gss_cred_id_t   gssapi_client_creds;
85 extern enum ssh_gss_id gssapi_client_type;
86
87 char *ssh_gssapi_mechanisms(int server, char *host);
88 int ssh_gssapi_id_kex(Gssctxt *ctx, char *name);
89 void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len);
90 void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid);
91 void ssh_gssapi_supported_oids(gss_OID_set *oidset);
92 enum ssh_gss_id ssh_gssapi_get_ctype(Gssctxt *ctxt);
93
94 OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host);
95 OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx);
96 OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds,
97                               gss_buffer_desc *recv_tok, 
98                               gss_buffer_desc *send_tok, OM_uint32 *flags);
99 OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx,
100                                 gss_buffer_desc *recv_tok,
101                                 gss_buffer_desc *send_tok,
102                                 OM_uint32 *flags);
103 OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx,
104                                 enum ssh_gss_id *type,
105                                 gss_buffer_desc *name,
106                                 gss_cred_id_t *creds);
107 void ssh_gssapi_error(OM_uint32 major_status,OM_uint32 minor_status);
108 void ssh_gssapi_send_error(OM_uint32 major_status,OM_uint32 minor_status);
109 void ssh_gssapi_build_ctx(Gssctxt *ctx);
110 void ssh_gssapi_delete_ctx(Gssctxt *ctx);
111
112 /* In the client */
113 void ssh_gssapi_client(Kex *kex, char *host, struct sockaddr *hostaddr,
114                        Buffer *client_kexinit, Buffer *server_kexinit);
115
116 /* In the server */
117 void ssh_gssapi_server(Kex *kex, Buffer *client_kexinit, 
118                        Buffer *server_kexinit);
119 void ssh_gssapi_do_child(char ***envp, u_int *envsizep);                 
120 void ssh_gssapi_cleanup_creds(void *ignored);
121 void ssh_gssapi_storecreds();
122 void ssh_gssapi_clean_env();
123 #endif /* GSSAPI */
This page took 0.065638 seconds and 5 git commands to generate.