|
Packit Service |
31306d |
/*
|
|
Packit Service |
31306d |
* This file is part of the SSH Library
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* Copyright (c) 2003-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 |
/*
|
|
Packit Service |
31306d |
* priv.h file
|
|
Packit Service |
31306d |
* This include file contains everything you shouldn't deal with in
|
|
Packit Service |
31306d |
* user programs. Consider that anything in this file might change
|
|
Packit Service |
31306d |
* without notice; libssh.h file will keep backward compatibility
|
|
Packit Service |
31306d |
* on binary & source
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef _LIBSSH_PRIV_H
|
|
Packit Service |
31306d |
#define _LIBSSH_PRIV_H
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#include <stdint.h>
|
|
Packit Service |
31306d |
#include <stdlib.h>
|
|
Packit Service |
31306d |
#include <string.h>
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#if !defined(HAVE_STRTOULL)
|
|
Packit Service |
31306d |
# if defined(HAVE___STRTOULL)
|
|
Packit Service |
31306d |
# define strtoull __strtoull
|
|
Packit Service |
31306d |
# elif defined(HAVE__STRTOUI64)
|
|
Packit Service |
31306d |
# define strtoull _strtoui64
|
|
Packit Service |
31306d |
# elif defined(__hpux) && defined(__LP64__)
|
|
Packit Service |
31306d |
# define strtoull strtoul
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# error "no strtoull function found"
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
#endif /* !defined(HAVE_STRTOULL) */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#if !defined(HAVE_STRNDUP)
|
|
Packit Service |
31306d |
char *strndup(const char *s, size_t n);
|
|
Packit Service |
31306d |
#endif /* ! HAVE_STRNDUP */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifdef HAVE_BYTESWAP_H
|
|
Packit Service |
31306d |
#include <byteswap.h>
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifdef HAVE_ARPA_INET_H
|
|
Packit Service |
31306d |
#include <arpa/inet.h>
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef bswap_32
|
|
Packit Service |
31306d |
#define bswap_32(x) \
|
|
Packit Service |
31306d |
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
|
|
Packit Service |
31306d |
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifdef _WIN32
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* Imitate define of inttypes.h */
|
|
Packit Service |
31306d |
# ifndef PRIdS
|
|
Packit Service |
31306d |
# define PRIdS "Id"
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef PRIu64
|
|
Packit Service |
31306d |
# if __WORDSIZE == 64
|
|
Packit Service |
31306d |
# define PRIu64 "lu"
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# define PRIu64 "llu"
|
|
Packit Service |
31306d |
# endif /* __WORDSIZE */
|
|
Packit Service |
31306d |
# endif /* PRIu64 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef PRIu32
|
|
Packit Service |
31306d |
# define PRIu32 "u"
|
|
Packit Service |
31306d |
# endif /* PRIu32 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef PRIx64
|
|
Packit Service |
31306d |
# if __WORDSIZE == 64
|
|
Packit Service |
31306d |
# define PRIx64 "lx"
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# define PRIx64 "llx"
|
|
Packit Service |
31306d |
# endif /* __WORDSIZE */
|
|
Packit Service |
31306d |
# endif /* PRIx64 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef PRIx32
|
|
Packit Service |
31306d |
# define PRIx32 "x"
|
|
Packit Service |
31306d |
# endif /* PRIx32 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifdef _MSC_VER
|
|
Packit Service |
31306d |
# include <stdio.h>
|
|
Packit Service |
31306d |
# include <stdarg.h> /* va_copy define check */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* On Microsoft compilers define inline to __inline on all others use inline */
|
|
Packit Service |
31306d |
# undef inline
|
|
Packit Service |
31306d |
# define inline __inline
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef va_copy
|
|
Packit Service |
31306d |
# define va_copy(dest, src) (dest = src)
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# define strcasecmp _stricmp
|
|
Packit Service |
31306d |
# define strncasecmp _strnicmp
|
|
Packit Service |
31306d |
# if ! defined(HAVE_ISBLANK)
|
|
Packit Service |
31306d |
# define isblank(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r')
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# define usleep(X) Sleep(((X)+1000)/1000)
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# undef strtok_r
|
|
Packit Service |
31306d |
# define strtok_r strtok_s
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# if defined(HAVE__SNPRINTF_S)
|
|
Packit Service |
31306d |
# undef snprintf
|
|
Packit Service |
31306d |
# define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
|
|
Packit Service |
31306d |
# else /* HAVE__SNPRINTF_S */
|
|
Packit Service |
31306d |
# if defined(HAVE__SNPRINTF)
|
|
Packit Service |
31306d |
# undef snprintf
|
|
Packit Service |
31306d |
# define snprintf _snprintf
|
|
Packit Service |
31306d |
# else /* HAVE__SNPRINTF */
|
|
Packit Service |
31306d |
# if !defined(HAVE_SNPRINTF)
|
|
Packit Service |
31306d |
# error "no snprintf compatible function found"
|
|
Packit Service |
31306d |
# endif /* HAVE_SNPRINTF */
|
|
Packit Service |
31306d |
# endif /* HAVE__SNPRINTF */
|
|
Packit Service |
31306d |
# endif /* HAVE__SNPRINTF_S */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# if defined(HAVE__VSNPRINTF_S)
|
|
Packit Service |
31306d |
# undef vsnprintf
|
|
Packit Service |
31306d |
# define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v))
|
|
Packit Service |
31306d |
# else /* HAVE__VSNPRINTF_S */
|
|
Packit Service |
31306d |
# if defined(HAVE__VSNPRINTF)
|
|
Packit Service |
31306d |
# undef vsnprintf
|
|
Packit Service |
31306d |
# define vsnprintf _vsnprintf
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# if !defined(HAVE_VSNPRINTF)
|
|
Packit Service |
31306d |
# error "No vsnprintf compatible function found"
|
|
Packit Service |
31306d |
# endif /* HAVE_VSNPRINTF */
|
|
Packit Service |
31306d |
# endif /* HAVE__VSNPRINTF */
|
|
Packit Service |
31306d |
# endif /* HAVE__VSNPRINTF_S */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# ifndef _SSIZE_T_DEFINED
|
|
Packit Service |
31306d |
# undef ssize_t
|
|
Packit Service |
31306d |
# include <BaseTsd.h>
|
|
Packit Service |
31306d |
typedef _W64 SSIZE_T ssize_t;
|
|
Packit Service |
31306d |
# define _SSIZE_T_DEFINED
|
|
Packit Service |
31306d |
# endif /* _SSIZE_T_DEFINED */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
# endif /* _MSC_VER */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
struct timeval;
|
|
Packit Service |
31306d |
int gettimeofday(struct timeval *__p, void *__t);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define _XCLOSESOCKET closesocket
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#else /* _WIN32 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#include <unistd.h>
|
|
Packit Service |
31306d |
#define PRIdS "zd"
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define _XCLOSESOCKET close
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#endif /* _WIN32 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#include "libssh/libssh.h"
|
|
Packit Service |
31306d |
#include "libssh/callbacks.h"
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* some constants */
|
|
Packit Service |
31306d |
#ifndef MAX_PACKAT_LEN
|
|
Packit Service |
31306d |
#define MAX_PACKET_LEN 262144
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
#ifndef ERROR_BUFFERLEN
|
|
Packit Service |
31306d |
#define ERROR_BUFFERLEN 1024
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef CLIENT_BANNER_SSH2
|
|
Packit Service |
31306d |
#define CLIENT_BANNER_SSH2 "SSH-2.0-libssh_" SSH_STRINGIFY(LIBSSH_VERSION)
|
|
Packit Service |
31306d |
#endif /* CLIENT_BANNER_SSH2 */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef KBDINT_MAX_PROMPT
|
|
Packit Service |
31306d |
#define KBDINT_MAX_PROMPT 256 /* more than openssh's :) */
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
#ifndef MAX_BUF_SIZE
|
|
Packit Service |
31306d |
#define MAX_BUF_SIZE 4096
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef HAVE_COMPILER__FUNC__
|
|
Packit Service |
31306d |
# ifdef HAVE_COMPILER__FUNCTION__
|
|
Packit Service |
31306d |
# define __func__ __FUNCTION__
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# error "Your system must provide a __func__ macro"
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#if defined(HAVE_GCC_THREAD_LOCAL_STORAGE)
|
|
Packit Service |
31306d |
# define LIBSSH_THREAD __thread
|
|
Packit Service |
31306d |
#elif defined(HAVE_MSC_THREAD_LOCAL_STORAGE)
|
|
Packit Service |
31306d |
# define LIBSSH_THREAD __declspec(thread)
|
|
Packit Service |
31306d |
#else
|
|
Packit Service |
31306d |
# define LIBSSH_THREAD
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/*
|
|
Packit Service |
31306d |
* This makes sure that the compiler doesn't optimize out the code
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* Use it in a macro where the provided variable is 'x'.
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
#if defined(HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
|
|
Packit Service |
31306d |
# define LIBSSH_MEM_PROTECTION __asm__ volatile("" : : "r"(&(x)) : "memory")
|
|
Packit Service |
31306d |
#else
|
|
Packit Service |
31306d |
# define LIBSSH_MEM_PROTECTION
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* forward declarations */
|
|
Packit Service |
31306d |
struct ssh_common_struct;
|
|
Packit Service |
31306d |
struct ssh_kex_struct;
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
enum ssh_digest_e {
|
|
Packit Service |
31306d |
SSH_DIGEST_AUTO=0,
|
|
Packit Service |
31306d |
SSH_DIGEST_SHA1=1,
|
|
Packit Service |
31306d |
SSH_DIGEST_SHA256,
|
|
Packit Service |
31306d |
SSH_DIGEST_SHA384,
|
|
Packit Service |
31306d |
SSH_DIGEST_SHA512,
|
|
Packit Service |
31306d |
};
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_get_key_params(ssh_session session,
|
|
Packit Service |
31306d |
ssh_key *privkey,
|
|
Packit Service |
31306d |
enum ssh_digest_e *digest);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* LOGGING */
|
|
Packit Service |
31306d |
void ssh_log_function(int verbosity,
|
|
Packit Service |
31306d |
const char *function,
|
|
Packit Service |
31306d |
const char *buffer);
|
|
Packit Service |
31306d |
#define SSH_LOG(priority, ...) \
|
|
Packit Service |
31306d |
_ssh_log(priority, __func__, __VA_ARGS__)
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* LEGACY */
|
|
Packit Service |
31306d |
void ssh_log_common(struct ssh_common_struct *common,
|
|
Packit Service |
31306d |
int verbosity,
|
|
Packit Service |
31306d |
const char *function,
|
|
Packit Service |
31306d |
const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* ERROR HANDLING */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* error handling structure */
|
|
Packit Service |
31306d |
struct error_struct {
|
|
Packit Service |
31306d |
int error_code;
|
|
Packit Service |
31306d |
char error_buffer[ERROR_BUFFERLEN];
|
|
Packit Service |
31306d |
};
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define ssh_set_error(error, code, ...) \
|
|
Packit Service |
31306d |
_ssh_set_error(error, code, __func__, __VA_ARGS__)
|
|
Packit Service |
31306d |
void _ssh_set_error(void *error,
|
|
Packit Service |
31306d |
int code,
|
|
Packit Service |
31306d |
const char *function,
|
|
Packit Service |
31306d |
const char *descr, ...) PRINTF_ATTRIBUTE(4, 5);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define ssh_set_error_oom(error) \
|
|
Packit Service |
31306d |
_ssh_set_error_oom(error, __func__)
|
|
Packit Service |
31306d |
void _ssh_set_error_oom(void *error, const char *function);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define ssh_set_error_invalid(error) \
|
|
Packit Service |
31306d |
_ssh_set_error_invalid(error, __func__)
|
|
Packit Service |
31306d |
void _ssh_set_error_invalid(void *error, const char *function);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
void ssh_reset_error(void *error);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* server.c */
|
|
Packit Service |
31306d |
#ifdef WITH_SERVER
|
|
Packit Service |
31306d |
int ssh_auth_reply_default(ssh_session session,int partial);
|
|
Packit Service |
31306d |
int ssh_auth_reply_success(ssh_session session, int partial);
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
/* client.c */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_send_banner(ssh_session session, int is_server);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* connect.c */
|
|
Packit Service |
31306d |
socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
|
|
Packit Service |
31306d |
const char *bind_addr, int port);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* in base64.c */
|
|
Packit Service |
31306d |
ssh_buffer base64_to_bin(const char *source);
|
|
Packit Service |
31306d |
uint8_t *bin_to_base64(const uint8_t *source, size_t len);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* gzip.c */
|
|
Packit Service |
31306d |
int compress_buffer(ssh_session session,ssh_buffer buf);
|
|
Packit Service |
31306d |
int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* match.c */
|
|
Packit Service |
31306d |
int match_pattern_list(const char *string, const char *pattern,
|
|
Packit Service |
31306d |
unsigned int len, int dolower);
|
|
Packit Service |
31306d |
int match_hostname(const char *host, const char *pattern, unsigned int len);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* connector.c */
|
|
Packit Service |
31306d |
int ssh_connector_set_event(ssh_connector connector, ssh_event event);
|
|
Packit Service |
31306d |
int ssh_connector_remove_event(ssh_connector connector);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef MIN
|
|
Packit Service |
31306d |
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef MAX
|
|
Packit Service |
31306d |
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/** Free memory space */
|
|
Packit Service |
31306d |
#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/** Zero a structure */
|
|
Packit Service |
31306d |
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/** Zero a structure given a pointer to the structure */
|
|
Packit Service |
31306d |
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/** Get the size of an array */
|
|
Packit Service |
31306d |
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef HAVE_EXPLICIT_BZERO
|
|
Packit Service |
31306d |
void explicit_bzero(void *s, size_t n);
|
|
Packit Service |
31306d |
#endif /* !HAVE_EXPLICIT_BZERO */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/**
|
|
Packit Service |
31306d |
* This is a hack to fix warnings. The idea is to use this everywhere that we
|
|
Packit Service |
31306d |
* get the "discarding const" warning by the compiler. That doesn't actually
|
|
Packit Service |
31306d |
* fix the real issue, but marks the place and you can search the code for
|
|
Packit Service |
31306d |
* discard_const.
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* Please use this macro only when there is no other way to fix the warning.
|
|
Packit Service |
31306d |
* We should use this function in only in a very few places.
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* Also, please call this via the discard_const_p() macro interface, as that
|
|
Packit Service |
31306d |
* makes the return type safe.
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/**
|
|
Packit Service |
31306d |
* Type-safe version of discard_const
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/**
|
|
Packit Service |
31306d |
* Get the argument cound of variadic arguments
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
/*
|
|
Packit Service |
31306d |
* Since MSVC 2010 there is a bug in passing __VA_ARGS__ to subsequent
|
|
Packit Service |
31306d |
* macros as a single token, which results in:
|
|
Packit Service |
31306d |
* warning C4003: not enough actual parameters for macro '_VA_ARG_N'
|
|
Packit Service |
31306d |
* and incorrect behavior. This fixes issue.
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
#define VA_APPLY_VARIADIC_MACRO(macro, tuple) macro tuple
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define __VA_NARG__(...) \
|
|
Packit Service |
31306d |
(__VA_NARG_(__VA_ARGS__, __RSEQ_N()))
|
|
Packit Service |
31306d |
#define __VA_NARG_(...) \
|
|
Packit Service |
31306d |
VA_APPLY_VARIADIC_MACRO(__VA_ARG_N, (__VA_ARGS__))
|
|
Packit Service |
31306d |
#define __VA_ARG_N( \
|
|
Packit Service |
31306d |
_1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
|
|
Packit Service |
31306d |
_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
|
|
Packit Service |
31306d |
_21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \
|
|
Packit Service |
31306d |
_31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \
|
|
Packit Service |
31306d |
_41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \
|
|
Packit Service |
31306d |
_51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \
|
|
Packit Service |
31306d |
_61,_62,_63,N,...) N
|
|
Packit Service |
31306d |
#define __RSEQ_N() \
|
|
Packit Service |
31306d |
63, 62, 61, 60, \
|
|
Packit Service |
31306d |
59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
|
|
Packit Service |
31306d |
49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
|
|
Packit Service |
31306d |
39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
|
|
Packit Service |
31306d |
29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
|
|
Packit Service |
31306d |
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
|
Packit Service |
31306d |
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef HAVE_HTONLL
|
|
Packit Service |
31306d |
# ifdef WORDS_BIGENDIAN
|
|
Packit Service |
31306d |
# define htonll(x) (x)
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# define htonll(x) \
|
|
Packit Service |
31306d |
(((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32))
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef HAVE_NTOHLL
|
|
Packit Service |
31306d |
# ifdef WORDS_BIGENDIAN
|
|
Packit Service |
31306d |
# define ntohll(x) (x)
|
|
Packit Service |
31306d |
# else
|
|
Packit Service |
31306d |
# define ntohll(x) \
|
|
Packit Service |
31306d |
(((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))
|
|
Packit Service |
31306d |
# endif
|
|
Packit Service |
31306d |
#endif
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef FALL_THROUGH
|
|
Packit Service |
31306d |
# ifdef HAVE_FALLTHROUGH_ATTRIBUTE
|
|
Packit Service |
31306d |
# define FALL_THROUGH __attribute__ ((fallthrough))
|
|
Packit Service |
31306d |
# else /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
|
Packit Service |
31306d |
# define FALL_THROUGH
|
|
Packit Service |
31306d |
# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
|
Packit Service |
31306d |
#endif /* FALL_THROUGH */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef __attr_unused__
|
|
Packit Service |
31306d |
# ifdef HAVE_UNUSED_ATTRIBUTE
|
|
Packit Service |
31306d |
# define __attr_unused__ __attribute__((unused))
|
|
Packit Service |
31306d |
# else /* HAVE_UNUSED_ATTRIBUTE */
|
|
Packit Service |
31306d |
# define __attr_unused__
|
|
Packit Service |
31306d |
# endif /* HAVE_UNUSED_ATTRIBUTE */
|
|
Packit Service |
31306d |
#endif /* __attr_unused__ */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef UNUSED_PARAM
|
|
Packit Service |
31306d |
#define UNUSED_PARAM(param) param __attr_unused__
|
|
Packit Service |
31306d |
#endif /* UNUSED_PARAM */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef UNUSED_VAR
|
|
Packit Service |
31306d |
#define UNUSED_VAR(var) __attr_unused__ var
|
|
Packit Service |
31306d |
#endif /* UNUSED_VAR */
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
void ssh_agent_state_free(void *data);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#endif /* _LIBSSH_PRIV_H */
|