Annotation of src/usr.bin/ssh/ssh-gss.h, Revision 1.1.4.1
1.1 markus 1: /*
2: * Copyright (c) 2001-2003 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: #ifndef _SSH_GSS_H
26: #define _SSH_GSS_H
27:
28: #ifdef GSSAPI
29:
30: #include "buffer.h"
31:
32: #include <gssapi.h>
33:
34: /* draft-ietf-secsh-gsskeyex-06 */
35: #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
36: #define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
37: #define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
38: #define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
39: #define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
40:
41: #define SSH_GSS_OIDTYPE 0x06
42:
43: typedef struct {
44: char *filename;
45: char *envvar;
46: char *envval;
47: void *data;
48: } ssh_gssapi_ccache;
49:
50: typedef struct {
51: gss_buffer_desc displayname;
52: gss_buffer_desc exportedname;
53: gss_cred_id_t creds;
54: struct ssh_gssapi_mech_struct *mech;
55: ssh_gssapi_ccache store;
56: } ssh_gssapi_client;
57:
58: typedef struct ssh_gssapi_mech_struct {
59: char *enc_name;
60: char *name;
61: gss_OID_desc oid;
62: int (*dochild) (ssh_gssapi_client *);
63: int (*userok) (ssh_gssapi_client *, char *);
64: int (*localname) (ssh_gssapi_client *, char **);
65: void (*storecreds) (ssh_gssapi_client *);
66: } ssh_gssapi_mech;
67:
68: typedef struct {
69: OM_uint32 major; /* both */
70: OM_uint32 minor; /* both */
71: gss_ctx_id_t context; /* both */
72: gss_name_t name; /* both */
73: gss_OID oid; /* client */
74: gss_cred_id_t creds; /* server */
75: gss_name_t client; /* server */
76: gss_cred_id_t client_creds; /* server */
77: } Gssctxt;
78:
79: extern ssh_gssapi_mech *supported_mechs[];
80:
81: int ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len);
82: void ssh_gssapi_set_oid_data(Gssctxt *ctx, void *data, size_t len);
83: void ssh_gssapi_set_oid(Gssctxt *ctx, gss_OID oid);
84: void ssh_gssapi_supported_oids(gss_OID_set *oidset);
85: ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *ctxt);
86:
87: OM_uint32 ssh_gssapi_import_name(Gssctxt *ctx, const char *host);
88: OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *ctx);
89: OM_uint32 ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds,
90: gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags);
91: OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *ctx,
92: gss_buffer_desc *recv_tok, gss_buffer_desc *send_tok, OM_uint32 *flags);
93: OM_uint32 ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *);
94: void ssh_gssapi_error(Gssctxt *ctx);
95: char *ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *maj, OM_uint32 *min);
96: void ssh_gssapi_build_ctx(Gssctxt **ctx);
97: void ssh_gssapi_delete_ctx(Gssctxt **ctx);
98: OM_uint32 ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid);
99:
100: /* In the server */
101: int ssh_gssapi_userok(char *name);
102:
103: void ssh_gssapi_do_child(char ***envp, u_int *envsizep);
104: void ssh_gssapi_cleanup_creds(void *ignored);
105: void ssh_gssapi_storecreds(void);
106:
107: #endif /* GSSAPI */
108:
109: #endif /* _SSH_GSS_H */