libssh  0.11.0
The SSH library
Loading...
Searching...
No Matches
gssapi.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2013 by Aris Adamantiadis
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef GSSAPI_H_
22#define GSSAPI_H_
23
24#include "config.h"
25#ifdef WITH_GSSAPI
26#include "session.h"
27#include <gssapi/gssapi.h>
28
29/* all OID begin with the tag identifier + length */
30#define SSH_OID_TAG 06
31
32typedef struct ssh_gssapi_struct *ssh_gssapi;
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
39enum ssh_gssapi_state_e {
40 SSH_GSSAPI_STATE_NONE, /* no status */
41 SSH_GSSAPI_STATE_RCV_TOKEN, /* Expecting a token */
42 SSH_GSSAPI_STATE_RCV_MIC, /* Expecting a MIC */
43};
44
45struct ssh_gssapi_struct{
46 enum ssh_gssapi_state_e state; /* current state */
47 struct gss_OID_desc_struct mech; /* mechanism being elected for auth */
48 gss_cred_id_t server_creds; /* credentials of server */
49 gss_cred_id_t client_creds; /* creds delegated by the client */
50 gss_ctx_id_t ctx; /* the authentication context */
51 gss_name_t client_name; /* Identity of the client */
52 char *user; /* username of client */
53 char *canonic_user; /* canonic form of the client's username */
54 char *service; /* name of the service */
55 struct {
56 gss_name_t server_name; /* identity of server */
57 OM_uint32 flags; /* flags used for init context */
58 gss_OID oid; /* mech being used for authentication */
59 gss_cred_id_t creds; /* creds used to initialize context */
60 gss_cred_id_t client_deleg_creds; /* delegated creds (const, not freeable) */
61 } client;
62};
63
64#ifdef WITH_SERVER
65int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n_oid, ssh_string *oids);
66SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server);
67SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_mic);
68#endif /* WITH_SERVER */
69
70SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token);
71SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client);
72SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response);
73
74
75int ssh_gssapi_init(ssh_session session);
76void ssh_gssapi_log_error(int verb, const char *msg_a, int maj_stat, int min_stat);
77int ssh_gssapi_auth_mic(ssh_session session);
78void ssh_gssapi_free(ssh_session session);
79char *ssh_gssapi_name_to_char(gss_name_t name);
80
81#ifdef __cplusplus
82}
83#endif
84
85#endif /* WITH_GSSAPI */
86#endif /* GSSAPI_H */
#define SSH_PACKET_CALLBACK(name)
This macro declares a packet callback handler.
Definition callbacks.h:560