libssh  0.7.2
include/libssh/auth.h
00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef AUTH_H_
00022 #define AUTH_H_
00023 #include "config.h"
00024 #include "libssh/callbacks.h"
00025 
00026 SSH_PACKET_CALLBACK(ssh_packet_userauth_banner);
00027 SSH_PACKET_CALLBACK(ssh_packet_userauth_failure);
00028 SSH_PACKET_CALLBACK(ssh_packet_userauth_success);
00029 SSH_PACKET_CALLBACK(ssh_packet_userauth_pk_ok);
00030 SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request);
00031 SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response);
00032 
00037 struct ssh_kbdint_struct {
00038     uint32_t nprompts;
00039     uint32_t nanswers;
00040     char *name;
00041     char *instruction;
00042     char **prompts;
00043     unsigned char *echo; /* bool array */
00044     char **answers;
00045 };
00046 typedef struct ssh_kbdint_struct* ssh_kbdint;
00047 
00048 ssh_kbdint ssh_kbdint_new(void);
00049 void ssh_kbdint_clean(ssh_kbdint kbd);
00050 void ssh_kbdint_free(ssh_kbdint kbd);
00051 
00052 
00053 #ifdef WITH_SSH1
00054 void ssh_auth1_handler(ssh_session session, uint8_t type);
00055 
00056 /* auth1.c */
00057 int ssh_userauth1_none(ssh_session session, const char *username);
00058 int ssh_userauth1_offer_pubkey(ssh_session session, const char *username,
00059         int type, ssh_string pubkey);
00060 int ssh_userauth1_password(ssh_session session, const char *username,
00061         const char *password);
00062 
00063 
00064 #endif
00065 
00070 enum ssh_auth_state_e {
00072   SSH_AUTH_STATE_NONE=0,
00074   SSH_AUTH_STATE_PARTIAL,
00076   SSH_AUTH_STATE_SUCCESS,
00078   SSH_AUTH_STATE_FAILED,
00080   SSH_AUTH_STATE_ERROR,
00082   SSH_AUTH_STATE_INFO,
00084   SSH_AUTH_STATE_PK_OK,
00086   SSH_AUTH_STATE_KBDINT_SENT,
00088   SSH_AUTH_STATE_GSSAPI_REQUEST_SENT,
00090   SSH_AUTH_STATE_GSSAPI_TOKEN,
00092   SSH_AUTH_STATE_GSSAPI_MIC_SENT,
00093 };
00094 
00098 enum ssh_auth_service_state_e {
00100   SSH_AUTH_SERVICE_NONE=0,
00102   SSH_AUTH_SERVICE_SENT,
00104   SSH_AUTH_SERVICE_ACCEPTED,
00106   SSH_AUTH_SERVICE_DENIED,
00108   SSH_AUTH_SERVICE_USER_SENT
00109 };
00110 
00111 #endif /* AUTH_H_ */