Blame include/libssh/auth.h

Packit Service 31306d
/*
Packit Service 31306d
 * This file is part of the SSH Library
Packit Service 31306d
 *
Packit Service 31306d
 * Copyright (c) 2009 by Aris Adamantiadis
Packit Service 31306d
 *
Packit Service 31306d
 * This library is free software; you can redistribute it and/or
Packit Service 31306d
 * modify it under the terms of the GNU Lesser General Public
Packit Service 31306d
 * License as published by the Free Software Foundation; either
Packit Service 31306d
 * version 2.1 of the License, or (at your option) any later version.
Packit Service 31306d
 *
Packit Service 31306d
 * This library is distributed in the hope that it will be useful,
Packit Service 31306d
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 31306d
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 31306d
 * Lesser General Public License for more details.
Packit Service 31306d
 *
Packit Service 31306d
 * You should have received a copy of the GNU Lesser General Public
Packit Service 31306d
 * License along with this library; if not, write to the Free Software
Packit Service 31306d
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Packit Service 31306d
 */
Packit Service 31306d
Packit Service 31306d
#ifndef AUTH_H_
Packit Service 31306d
#define AUTH_H_
Packit Service 31306d
#include "config.h"
Packit Service 31306d
#include "libssh/callbacks.h"
Packit Service 31306d
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_banner);
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_failure);
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_success);
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_pk_ok);
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request);
Packit Service 31306d
SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response);
Packit Service 31306d
Packit Service 31306d
/** @internal
Packit Service 31306d
 * kdbint structure must be shared with message.c
Packit Service 31306d
 * and server.c
Packit Service 31306d
 */
Packit Service 31306d
struct ssh_kbdint_struct {
Packit Service 31306d
    uint32_t nprompts;
Packit Service 31306d
    uint32_t nanswers;
Packit Service 31306d
    char *name;
Packit Service 31306d
    char *instruction;
Packit Service 31306d
    char **prompts;
Packit Service 31306d
    unsigned char *echo; /* bool array */
Packit Service 31306d
    char **answers;
Packit Service 31306d
};
Packit Service 31306d
typedef struct ssh_kbdint_struct* ssh_kbdint;
Packit Service 31306d
Packit Service 31306d
ssh_kbdint ssh_kbdint_new(void);
Packit Service 31306d
void ssh_kbdint_clean(ssh_kbdint kbd);
Packit Service 31306d
void ssh_kbdint_free(ssh_kbdint kbd);
Packit Service 31306d
Packit Service 31306d
/** @internal
Packit Service 31306d
 * States of authentication in the client-side. They describe
Packit Service 31306d
 * what was the last response from the server
Packit Service 31306d
 */
Packit Service 31306d
enum ssh_auth_state_e {
Packit Service 31306d
  /** No authentication asked */
Packit Service 31306d
  SSH_AUTH_STATE_NONE=0,
Packit Service 31306d
  /** Last authentication response was a partial success */
Packit Service 31306d
  SSH_AUTH_STATE_PARTIAL,
Packit Service 31306d
  /** Last authentication response was a success */
Packit Service 31306d
  SSH_AUTH_STATE_SUCCESS,
Packit Service 31306d
  /** Last authentication response was failed */
Packit Service 31306d
  SSH_AUTH_STATE_FAILED,
Packit Service 31306d
  /** Last authentication was erroneous */
Packit Service 31306d
  SSH_AUTH_STATE_ERROR,
Packit Service 31306d
  /** Last state was a keyboard-interactive ask for info */
Packit Service 31306d
  SSH_AUTH_STATE_INFO,
Packit Service 31306d
  /** Last state was a public key accepted for authentication */
Packit Service 31306d
  SSH_AUTH_STATE_PK_OK,
Packit Service 31306d
  /** We asked for a keyboard-interactive authentication */
Packit Service 31306d
  SSH_AUTH_STATE_KBDINT_SENT,
Packit Service 31306d
  /** We have sent an userauth request with gssapi-with-mic */
Packit Service 31306d
  SSH_AUTH_STATE_GSSAPI_REQUEST_SENT,
Packit Service 31306d
  /** We are exchanging tokens until authentication */
Packit Service 31306d
  SSH_AUTH_STATE_GSSAPI_TOKEN,
Packit Service 31306d
  /** We have sent the MIC and expecting to be authenticated */
Packit Service 31306d
  SSH_AUTH_STATE_GSSAPI_MIC_SENT,
Packit Service 31306d
  /** We have offered a pubkey to check if it is supported */
Packit Service 31306d
  SSH_AUTH_STATE_PUBKEY_OFFER_SENT,
Packit Service 31306d
  /** We have sent pubkey and signature expecting to be authenticated */
Packit Service 31306d
  SSH_AUTH_STATE_PUBKEY_AUTH_SENT,
Packit Service 31306d
  /** We have sent a password expecting to be authenticated */
Packit Service 31306d
  SSH_AUTH_STATE_PASSWORD_AUTH_SENT,
Packit Service 31306d
  /** We have sent a request without auth information (method 'none') */
Packit Service 31306d
  SSH_AUTH_STATE_AUTH_NONE_SENT,
Packit Service 31306d
};
Packit Service 31306d
Packit Service 31306d
/** @internal
Packit Service 31306d
 * @brief states of the authentication service request
Packit Service 31306d
 */
Packit Service 31306d
enum ssh_auth_service_state_e {
Packit Service 31306d
  /** initial state */
Packit Service 31306d
  SSH_AUTH_SERVICE_NONE=0,
Packit Service 31306d
  /** Authentication service request packet sent */
Packit Service 31306d
  SSH_AUTH_SERVICE_SENT,
Packit Service 31306d
  /** Service accepted */
Packit Service 31306d
  SSH_AUTH_SERVICE_ACCEPTED,
Packit Service 31306d
  /** Access to service denied (fatal) */
Packit Service 31306d
  SSH_AUTH_SERVICE_DENIED,
Packit Service 31306d
};
Packit Service 31306d
Packit Service 31306d
#endif /* AUTH_H_ */