stdint.patch, debug_output.patch, ssh_12_select.patch,
solaris_7.patch and args_in_decl.patch from Norbert. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@12 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
d95242d2cd
Коммит
f23685f92b
@ -172,4 +172,5 @@
|
|||||||
#undef realloc
|
#undef realloc
|
||||||
|
|
||||||
#undef HAVE_SSH1
|
#undef HAVE_SSH1
|
||||||
|
#undef HAVE_PTY_H
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
190
configure
поставляемый
190
configure
поставляемый
@ -2934,14 +2934,139 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking for library containing hstrerror" >&5
|
||||||
echo "$as_me:$LINENO: checking for gethostbyname in -lresolv" >&5
|
echo $ECHO_N "checking for library containing hstrerror... $ECHO_C" >&6
|
||||||
echo $ECHO_N "checking for gethostbyname in -lresolv... $ECHO_C" >&6
|
if test "${ac_cv_search_hstrerror+set}" = set; then
|
||||||
if test "${ac_cv_lib_resolv_gethostbyname+set}" = set; then
|
|
||||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_func_search_save_LIBS=$LIBS
|
||||||
LIBS="-lresolv $LIBS"
|
ac_cv_search_hstrerror=no
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char hstrerror ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
hstrerror ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||||
|
(eval $ac_link) 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -z "$ac_c_werror_flag"
|
||||||
|
|| test ! -s conftest.err'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; } &&
|
||||||
|
{ ac_try='test -s conftest$ac_exeext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
ac_cv_search_hstrerror="none required"
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
if test "$ac_cv_search_hstrerror" = no; then
|
||||||
|
for ac_lib in nsl resolv; do
|
||||||
|
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char hstrerror ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
hstrerror ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||||
|
(eval $ac_link) 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -z "$ac_c_werror_flag"
|
||||||
|
|| test ! -s conftest.err'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; } &&
|
||||||
|
{ ac_try='test -s conftest$ac_exeext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
ac_cv_search_hstrerror="-l$ac_lib"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
LIBS=$ac_func_search_save_LIBS
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $ac_cv_search_hstrerror" >&5
|
||||||
|
echo "${ECHO_T}$ac_cv_search_hstrerror" >&6
|
||||||
|
if test "$ac_cv_search_hstrerror" != no; then
|
||||||
|
test "$ac_cv_search_hstrerror" = "none required" || LIBS="$ac_cv_search_hstrerror $LIBS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
|
||||||
|
echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6
|
||||||
|
if test "${ac_cv_search_gethostbyname+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
ac_func_search_save_LIBS=$LIBS
|
||||||
|
ac_cv_search_gethostbyname=no
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
_ACEOF
|
_ACEOF
|
||||||
@ -2986,37 +3111,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
|||||||
ac_status=$?
|
ac_status=$?
|
||||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
(exit $ac_status); }; }; then
|
(exit $ac_status); }; }; then
|
||||||
ac_cv_lib_resolv_gethostbyname=yes
|
ac_cv_search_gethostbyname="none required"
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
ac_cv_lib_resolv_gethostbyname=no
|
|
||||||
fi
|
fi
|
||||||
rm -f conftest.err conftest.$ac_objext \
|
rm -f conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
if test "$ac_cv_search_gethostbyname" = no; then
|
||||||
fi
|
for ac_lib in nsl resolv; do
|
||||||
echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_gethostbyname" >&5
|
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||||
echo "${ECHO_T}$ac_cv_lib_resolv_gethostbyname" >&6
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
if test $ac_cv_lib_resolv_gethostbyname = yes; then
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_LIBRESOLV 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
LIBS="-lresolv $LIBS"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
|
|
||||||
echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
|
|
||||||
if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
|
|
||||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
|
||||||
else
|
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
|
||||||
LIBS="-lnsl $LIBS"
|
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
_ACEOF
|
_ACEOF
|
||||||
cat confdefs.h >>conftest.$ac_ext
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
@ -3060,25 +3166,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
|||||||
ac_status=$?
|
ac_status=$?
|
||||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
(exit $ac_status); }; }; then
|
(exit $ac_status); }; }; then
|
||||||
ac_cv_lib_nsl_gethostbyname=yes
|
ac_cv_search_gethostbyname="-l$ac_lib"
|
||||||
|
break
|
||||||
else
|
else
|
||||||
echo "$as_me: failed program was:" >&5
|
echo "$as_me: failed program was:" >&5
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
ac_cv_lib_nsl_gethostbyname=no
|
|
||||||
fi
|
fi
|
||||||
rm -f conftest.err conftest.$ac_objext \
|
rm -f conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
done
|
||||||
fi
|
fi
|
||||||
echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
|
LIBS=$ac_func_search_save_LIBS
|
||||||
echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
|
fi
|
||||||
if test $ac_cv_lib_nsl_gethostbyname = yes; then
|
echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5
|
||||||
cat >>confdefs.h <<_ACEOF
|
echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6
|
||||||
#define HAVE_LIBNSL 1
|
if test "$ac_cv_search_gethostbyname" != no; then
|
||||||
_ACEOF
|
test "$ac_cv_search_gethostbyname" = "none required" || LIBS="$ac_cv_search_gethostbyname $LIBS"
|
||||||
|
|
||||||
LIBS="-lnsl $LIBS"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -3585,9 +3689,11 @@ done
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_header in fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h \
|
for ac_header in fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h \
|
||||||
sys/time.h termios.h unistd.h openssl/aes.h openssl/blowfish.h zlib.h \
|
sys/time.h termios.h unistd.h openssl/aes.h openssl/blowfish.h zlib.h \
|
||||||
sys/poll.h
|
sys/poll.h stdint.h pty.h
|
||||||
do
|
do
|
||||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||||
|
@ -40,14 +40,14 @@ AC_C_BIGENDIAN
|
|||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
AC_CHECK_LIB([crypto], [BN_init])
|
AC_CHECK_LIB([crypto], [BN_init])
|
||||||
AC_CHECK_LIB([z], [deflateInit_])
|
AC_CHECK_LIB([z], [deflateInit_])
|
||||||
AC_CHECK_LIB([resolv],[gethostbyname])
|
AC_SEARCH_LIBS([hstrerror],[nsl resolv])
|
||||||
AC_CHECK_LIB([nsl],[gethostbyname])
|
AC_SEARCH_LIBS([gethostbyname],[nsl resolv])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS([fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h \
|
AC_CHECK_HEADERS([fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h \
|
||||||
sys/time.h termios.h unistd.h openssl/aes.h openssl/blowfish.h zlib.h \
|
sys/time.h termios.h unistd.h openssl/aes.h openssl/blowfish.h zlib.h \
|
||||||
sys/poll.h ])
|
sys/poll.h stdint.h pty.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
@ -24,6 +24,9 @@ MA 02111-1307, USA. */
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/select.h> /* for fd_set * */
|
#include <sys/select.h> /* for fd_set * */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#define LIBSSH_VERSION "libssh-0.2-dev"
|
#define LIBSSH_VERSION "libssh-0.2-dev"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -40,10 +43,10 @@ typedef struct ssh_session SSH_SESSION;
|
|||||||
typedef struct ssh_kbdint SSH_KBDINT;
|
typedef struct ssh_kbdint SSH_KBDINT;
|
||||||
|
|
||||||
/* integer values */
|
/* integer values */
|
||||||
typedef u_int32_t u32;
|
typedef uint32_t u32;
|
||||||
typedef u_int16_t u16;
|
typedef uint16_t u16;
|
||||||
typedef u_int64_t u64;
|
typedef uint64_t u64;
|
||||||
typedef u_int8_t u8;
|
typedef uint8_t u8;
|
||||||
|
|
||||||
/* the offsets of methods */
|
/* the offsets of methods */
|
||||||
#define SSH_KEX 0
|
#define SSH_KEX 0
|
||||||
@ -109,7 +112,7 @@ void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options);
|
|||||||
int ssh_get_fd(SSH_SESSION *session);
|
int ssh_get_fd(SSH_SESSION *session);
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
int ssh_connect();
|
int ssh_connect(SSH_SESSION *session);
|
||||||
void ssh_disconnect(SSH_SESSION *session);
|
void ssh_disconnect(SSH_SESSION *session);
|
||||||
int ssh_service_request(SSH_SESSION *session,char *service);
|
int ssh_service_request(SSH_SESSION *session,char *service);
|
||||||
char *ssh_get_issue_banner(SSH_SESSION *session);
|
char *ssh_get_issue_banner(SSH_SESSION *session);
|
||||||
|
@ -287,13 +287,17 @@ static STRING *make_rsa1_string(STRING *e, STRING *n){
|
|||||||
static void build_session_id1(SSH_SESSION *session, STRING *servern,
|
static void build_session_id1(SSH_SESSION *session, STRING *servern,
|
||||||
STRING *hostn){
|
STRING *hostn){
|
||||||
MD5CTX *md5=md5_init();
|
MD5CTX *md5=md5_init();
|
||||||
|
#ifdef DEBUG_CRYPTO
|
||||||
ssh_print_hexa("host modulus",hostn->string,string_len(hostn));
|
ssh_print_hexa("host modulus",hostn->string,string_len(hostn));
|
||||||
ssh_print_hexa("server modulus",servern->string,string_len(servern));
|
ssh_print_hexa("server modulus",servern->string,string_len(servern));
|
||||||
|
#endif
|
||||||
md5_update(md5,hostn->string,string_len(hostn));
|
md5_update(md5,hostn->string,string_len(hostn));
|
||||||
md5_update(md5,servern->string,string_len(servern));
|
md5_update(md5,servern->string,string_len(servern));
|
||||||
md5_update(md5,session->server_kex.cookie,8);
|
md5_update(md5,session->server_kex.cookie,8);
|
||||||
md5_final(session->next_crypto->session_id,md5);
|
md5_final(session->next_crypto->session_id,md5);
|
||||||
|
#ifdef DEBUG_CRYPTO
|
||||||
ssh_print_hexa("session_id",session->next_crypto->session_id,MD5_DIGEST_LEN);
|
ssh_print_hexa("session_id",session->next_crypto->session_id,MD5_DIGEST_LEN);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey,
|
STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey,
|
||||||
@ -307,7 +311,9 @@ STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey,
|
|||||||
memcpy(buffer,session->next_crypto->encryptkey,32);
|
memcpy(buffer,session->next_crypto->encryptkey,32);
|
||||||
memcpy(session->next_crypto->decryptkey,
|
memcpy(session->next_crypto->decryptkey,
|
||||||
session->next_crypto->encryptkey,32);
|
session->next_crypto->encryptkey,32);
|
||||||
|
#ifdef DEBUG_CRYPTO
|
||||||
ssh_print_hexa("session key",buffer,32);
|
ssh_print_hexa("session key",buffer,32);
|
||||||
|
#endif
|
||||||
/* xor session key with session_id */
|
/* xor session key with session_id */
|
||||||
for (i=0;i<16;++i)
|
for (i=0;i<16;++i)
|
||||||
buffer[i]^=session->next_crypto->session_id[i];
|
buffer[i]^=session->next_crypto->session_id[i];
|
||||||
|
@ -34,7 +34,11 @@ SSH_OPTIONS *ssh_options_new(){
|
|||||||
option->port=22; /* set the default port */
|
option->port=22; /* set the default port */
|
||||||
option->fd=-1;
|
option->fd=-1;
|
||||||
option->ssh2allowed=1;
|
option->ssh2allowed=1;
|
||||||
|
#ifdef HAVE_SSH1
|
||||||
|
option->ssh1allowed=1;
|
||||||
|
#else
|
||||||
option->ssh1allowed=0;
|
option->ssh1allowed=0;
|
||||||
|
#endif
|
||||||
option->bindport=22;
|
option->bindport=22;
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
@ -283,7 +287,11 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
|
|||||||
char *identity=NULL;
|
char *identity=NULL;
|
||||||
char **save=malloc(argc * sizeof(char *));
|
char **save=malloc(argc * sizeof(char *));
|
||||||
int current=0;
|
int current=0;
|
||||||
|
#ifdef HAVE_SSH1
|
||||||
|
int ssh1=1;
|
||||||
|
#else
|
||||||
int ssh1=0;
|
int ssh1=0;
|
||||||
|
#endif
|
||||||
int ssh2=1;
|
int ssh2=1;
|
||||||
|
|
||||||
int saveoptind=optind; /* need to save 'em */
|
int saveoptind=optind; /* need to save 'em */
|
||||||
@ -384,13 +392,8 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv){
|
|||||||
ssh_options_set_bind(options,localaddr,0);
|
ssh_options_set_bind(options,localaddr,0);
|
||||||
ssh_options_set_port(options,port);
|
ssh_options_set_port(options,port);
|
||||||
options->bindport=port;
|
options->bindport=port;
|
||||||
if(ssh1){
|
ssh_options_allow_ssh1(options,ssh1);
|
||||||
ssh_options_allow_ssh1(options,1);
|
ssh_options_allow_ssh2(options,ssh2);
|
||||||
ssh_options_allow_ssh2(options,0);
|
|
||||||
} else { // default behaviour
|
|
||||||
ssh_options_allow_ssh1(options,0);
|
|
||||||
ssh_options_allow_ssh2(options,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!cont){
|
if(!cont){
|
||||||
return -1;
|
return -1;
|
||||||
|
14
sample.c
14
sample.c
@ -12,6 +12,7 @@ The goal is to show the API in action. It's not a reference on how terminal
|
|||||||
clients must be made or how a client should react.
|
clients must be made or how a client should react.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -20,7 +21,9 @@ clients must be made or how a client should react.
|
|||||||
|
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifdef HAVE_PTY_H
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
@ -77,6 +80,17 @@ int opts(int argc, char **argv){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_PTY_H
|
||||||
|
static void cfmakeraw(struct termios *termios_p){
|
||||||
|
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
||||||
|
termios_p->c_oflag &= ~OPOST;
|
||||||
|
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
||||||
|
termios_p->c_cflag &= ~(CSIZE|PARENB);
|
||||||
|
termios_p->c_cflag |= CS8;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void do_cleanup(){
|
void do_cleanup(){
|
||||||
tcsetattr(0,TCSANOW,&terminal);
|
tcsetattr(0,TCSANOW,&terminal);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user