]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - sshgss.h
Change the Unix version of Ssh_gss_name to be a gss_name_t rather than
[PuTTY.git] / sshgss.h
1 #include "puttyps.h"
2
3 #define SSH2_GSS_OIDTYPE 0x06
4 typedef void *Ssh_gss_ctx;
5
6 typedef enum Ssh_gss_stat {
7     SSH_GSS_OK = 0,
8     SSH_GSS_S_CONTINUE_NEEDED,
9     SSH_GSS_NO_MEM,
10     SSH_GSS_BAD_HOST_NAME,
11     SSH_GSS_FAILURE
12 } Ssh_gss_stat;
13
14 #define SSH_GSS_S_COMPLETE SSH_GSS_OK
15
16 #define SSH_GSS_CLEAR_BUF(buf) do {             \
17     (*buf).length = 0;                          \
18     (*buf).value = NULL;                                \
19 } while (0)
20
21 /* Functions, provided by either wingss.c or uxgss.c */
22
23 /*
24  * Do startup-time initialisation for using GSSAPI. (On Windows,
25  * for instance, this dynamically loads the GSSAPI DLL and
26  * retrieves some function pointers.)
27  *
28  * Return value is 1 on success, or 0 if initialisation failed.
29  *
30  * May be called multiple times (since the most convenient place
31  * to call it _from_ is the ssh.c setup code), and will harmlessly
32  * return success if already initialised.
33  */
34 int ssh_gss_init(void);
35
36 /*
37  * Fills in buf with a string describing the GSSAPI mechanism in
38  * use. buf->data is not dynamically allocated.
39  */
40 Ssh_gss_stat ssh_gss_indicate_mech(Ssh_gss_buf *buf);
41
42 /*
43  * Converts a name such as a hostname into a GSSAPI internal form,
44  * which is placed in "out". The result should be freed by
45  * ssh_gss_release_name().
46  */
47 Ssh_gss_stat ssh_gss_import_name(char *in, Ssh_gss_name *out);
48
49 /*
50  * Frees the contents of an Ssh_gss_name structure filled in by
51  * ssh_gss_import_name().
52  */
53 Ssh_gss_stat ssh_gss_release_name(Ssh_gss_name *name);
54
55 /*
56  * The main GSSAPI security context setup function. The "out"
57  * parameter will need to be freed by ssh_gss_free_tok.
58  */
59 Ssh_gss_stat ssh_gss_init_sec_context(Ssh_gss_ctx *ctx, Ssh_gss_name name, int delegate,
60                                       Ssh_gss_buf *in, Ssh_gss_buf *out);
61
62 /*
63  * Frees the contents of an Ssh_gss_buf filled in by
64  * ssh_gss_init_sec_context(). Do not accidentally call this on
65  * something filled in by ssh_gss_get_mic() (which requires a
66  * different free function) or something filled in by any other
67  * way.
68  */
69 Ssh_gss_stat ssh_gss_free_tok(Ssh_gss_buf *);
70
71 /*
72  * Acquires the credentials to perform authentication in the first
73  * place. Needs to be freed by ssh_gss_release_cred().
74  */
75 Ssh_gss_stat ssh_gss_acquire_cred(Ssh_gss_ctx *);
76
77 /*
78  * Frees the contents of an Ssh_gss_ctx filled in by
79  * ssh_gss_acquire_cred().
80  */
81 Ssh_gss_stat ssh_gss_release_cred(Ssh_gss_ctx *);
82
83 /*
84  * Gets a MIC for some input data. "out" needs to be freed by
85  * ssh_gss_free_mic().
86  */
87 Ssh_gss_stat ssh_gss_get_mic(Ssh_gss_ctx ctx, Ssh_gss_buf *in,
88                              Ssh_gss_buf *out);
89
90 /*
91  * Frees the contents of an Ssh_gss_buf filled in by
92  * ssh_gss_get_mic(). Do not accidentally call this on something
93  * filled in by ssh_gss_init_sec_context() (which requires a
94  * different free function) or something filled in by any other
95  * way.
96  */
97 Ssh_gss_stat ssh_gss_free_mic(Ssh_gss_buf *);
98
99 /*
100  * Return an error message after authentication failed. The
101  * message string is returned in "buf", with buf->len giving the
102  * number of characters of printable message text and buf->data
103  * containing one more character which is a trailing NUL.
104  * buf->data should be manually freed by the caller. 
105  */
106 Ssh_gss_stat ssh_gss_display_status(Ssh_gss_ctx, Ssh_gss_buf *buf);