libssh 0.7.5

auth.h
1 /*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2009 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 AUTH_H_
22 #define AUTH_H_
23 #include "config.h"
24 #include "libssh/callbacks.h"
25
26 SSH_PACKET_CALLBACK(ssh_packet_userauth_banner);
27 SSH_PACKET_CALLBACK(ssh_packet_userauth_failure);
28 SSH_PACKET_CALLBACK(ssh_packet_userauth_success);
29 SSH_PACKET_CALLBACK(ssh_packet_userauth_pk_ok);
30 SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request);
31 SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response);
32
37 struct ssh_kbdint_struct {
38 uint32_t nprompts;
39 uint32_t nanswers;
40 char *name;
41 char *instruction;
42 char **prompts;
43 unsigned char *echo; /* bool array */
44 char **answers;
45 };
46 typedef struct ssh_kbdint_struct* ssh_kbdint;
47
48 ssh_kbdint ssh_kbdint_new(void);
49 void ssh_kbdint_clean(ssh_kbdint kbd);
50 void ssh_kbdint_free(ssh_kbdint kbd);
51
52
53 #ifdef WITH_SSH1
54 void ssh_auth1_handler(ssh_session session, uint8_t type);
55
56 /* auth1.c */
57 int ssh_userauth1_none(ssh_session session, const char *username);
58 int ssh_userauth1_offer_pubkey(ssh_session session, const char *username,
59 int type, ssh_string pubkey);
60 int ssh_userauth1_password(ssh_session session, const char *username,
61 const char *password);
62
63
64 #endif
65
70 enum ssh_auth_state_e {
72 SSH_AUTH_STATE_NONE=0,
74 SSH_AUTH_STATE_PARTIAL,
76 SSH_AUTH_STATE_SUCCESS,
78 SSH_AUTH_STATE_FAILED,
80 SSH_AUTH_STATE_ERROR,
82 SSH_AUTH_STATE_INFO,
84 SSH_AUTH_STATE_PK_OK,
86 SSH_AUTH_STATE_KBDINT_SENT,
88 SSH_AUTH_STATE_GSSAPI_REQUEST_SENT,
90 SSH_AUTH_STATE_GSSAPI_TOKEN,
92 SSH_AUTH_STATE_GSSAPI_MIC_SENT,
93 };
94
98 enum ssh_auth_service_state_e {
100 SSH_AUTH_SERVICE_NONE=0,
102 SSH_AUTH_SERVICE_SENT,
104 SSH_AUTH_SERVICE_ACCEPTED,
106 SSH_AUTH_SERVICE_DENIED,
108 SSH_AUTH_SERVICE_USER_SENT
109 };
110
111 #endif /* AUTH_H_ */
SSH_PACKET_CALLBACK
#define SSH_PACKET_CALLBACK(name)
This macro declares a packet callback handler.
Definition: callbacks.h:449