Compare commits

...

7 Commits

Author SHA1 Message Date
Andreas Schneider
2f0b671a61 Update version to 0.4.0. 2009-12-10 14:15:04 +01:00
Andreas Schneider
1fadec37d6 Don't install crypto.h which is an internal header file. 2009-12-10 13:55:07 +01:00
Andreas Schneider
2aabbd6245 Remove socklen_t definition.
Tthe problem is that winsock2.h defines socklen_t as a typedef, not as a
define, so depending on the order of includes you can get errors in
ws2tcpip.h with msvc.
2009-12-09 13:04:26 +01:00
Aris Adamantiadis
fd6823691b Fix stupid bug which stops log_verbosity working 2009-12-02 14:19:42 +01:00
Andreas Schneider
b174ad8ae4 Fixed indent. 2009-12-02 00:23:27 +01:00
Andreas Schneider
176778bb1c Added gettimeofday for Windows.
Thanks to Patrick Spendrin.
2009-12-02 00:23:20 +01:00
Andreas Schneider
e5bf645010 Fixed uint* to work on Windows.
Thanks to Patrick Spendrin.
2009-12-02 00:23:00 +01:00
9 changed files with 51 additions and 27 deletions

View File

@@ -12,8 +12,8 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
### versions ### versions
set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "3") set(CPACK_PACKAGE_VERSION_MINOR "4")
set(CPACK_PACKAGE_VERSION_PATCH "91") set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

View File

@@ -1,7 +1,7 @@
ChangeLog ChangeLog
========== ==========
version 0.4 (released xxxx-xx-xx) version 0.4.0 (released 2009-12-10)
* Added scp support. * Added scp support.
* Added support for sending signals (RFC 4254, section 6.9). * Added support for sending signals (RFC 4254, section 6.9).
* Added MSVC support. * Added MSVC support.

View File

@@ -3,7 +3,6 @@ project(libssh-headers C)
set(libssh_HDRS set(libssh_HDRS
callbacks.h callbacks.h
libssh.h libssh.h
crypto.h
ssh2.h ssh2.h
) )

View File

@@ -50,6 +50,7 @@
#ifdef _MSC_VER #ifdef _MSC_VER
/* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */ /* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */
typedef int int32_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;

View File

@@ -7,7 +7,7 @@
#ifdef WITH_PCAP #ifdef WITH_PCAP
typedef struct ssh_pcap_context_struct* ssh_pcap_context; typedef struct ssh_pcap_context_struct* ssh_pcap_context;
int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, u_int32_t original_len); int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, uint32_t original_len);
ssh_pcap_context ssh_pcap_context_new(ssh_session session); ssh_pcap_context ssh_pcap_context_new(ssh_session session);
void ssh_pcap_context_free(ssh_pcap_context ctx); void ssh_pcap_context_free(ssh_pcap_context ctx);
@@ -18,7 +18,7 @@ enum ssh_pcap_direction{
}; };
void ssh_pcap_context_set_file(ssh_pcap_context, ssh_pcap_file); void ssh_pcap_context_set_file(ssh_pcap_context, ssh_pcap_file);
int ssh_pcap_context_write(ssh_pcap_context,enum ssh_pcap_direction direction, void *data, int ssh_pcap_context_write(ssh_pcap_context,enum ssh_pcap_direction direction, void *data,
u_int32_t len, u_int32_t origlen); uint32_t len, uint32_t origlen);
#endif /* WITH_PCAP */ #endif /* WITH_PCAP */

View File

@@ -185,6 +185,11 @@ int match_hostname(const char *host, const char *pattern, unsigned int len);
/* log.c */ /* log.c */
/* misc.c */
#ifdef _WIN32
int gettimeofday(struct timeval *__p, void *__t);
#endif /* _WIN32 */
#ifndef __FUNCTION__ #ifndef __FUNCTION__
#if defined(__SUNPRO_C) #if defined(__SUNPRO_C)
#define __FUNCTION__ __func__ #define __FUNCTION__ __func__

View File

@@ -87,14 +87,30 @@ char *ssh_get_user_home_dir(void) {
return NULL; return NULL;
} }
/* we have read access on file */ /* we have read access on file */
int ssh_file_readaccess_ok(const char *file) { int ssh_file_readaccess_ok(const char *file) {
if (_access(file, 4) < 0) { if (_access(file, 4) < 0) {
return 0; return 0;
} }
return 1; return 1;
} }
#define SSH_USEC_IN_SEC 1000000LL
#define SSH_SECONDS_SINCE_1601 11644473600LL
int gettimeofday(struct timeval *__p, void *__t) {
union {
unsigned long long ns100; /* time since 1 Jan 1601 in 100ns units */
FILETIME ft;
} now;
GetSystemTimeAsFileTime (&now.ft);
__p->tv_usec = (long) ((now.ns100 / 10LL) % SSH_USEC_IN_SEC);
__p->tv_sec = (long)(((now.ns100 / 10LL ) / SSH_USEC_IN_SEC) - SSH_SECONDS_SINCE_1601);
return (0);
}
#else /* _WIN32 */ #else /* _WIN32 */
char *ssh_get_user_home_dir(void) { char *ssh_get_user_home_dir(void) {
char *szPath = NULL; char *szPath = NULL;

View File

@@ -553,6 +553,7 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
session->log_verbosity = *x & 0xffff; session->log_verbosity = *x & 0xffff;
} }
break;
case SSH_OPTIONS_LOG_VERBOSITY_STR: case SSH_OPTIONS_LOG_VERBOSITY_STR:
if (value == NULL) { if (value == NULL) {
session->log_verbosity = 0 & 0xffff; session->log_verbosity = 0 & 0xffff;

View File

@@ -30,8 +30,10 @@
#ifdef WITH_PCAP #ifdef WITH_PCAP
#include <stdio.h> #include <stdio.h>
#ifndef _WIN32
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h> #include <sys/socket.h>
#endif
#include <errno.h> #include <errno.h>
@@ -46,13 +48,13 @@
* Just for information. * Just for information.
*/ */
struct pcap_hdr_s { struct pcap_hdr_s {
u_int32_t magic_number; /* magic number */ uint32_t magic_number; /* magic number */
u_int16_t version_major; /* major version number */ uint16_t version_major; /* major version number */
u_int16_t version_minor; /* minor version number */ uint16_t version_minor; /* minor version number */
int32_t thiszone; /* GMT to local correction */ int32_t thiszone; /* GMT to local correction */
u_int32_t sigfigs; /* accuracy of timestamps */ uint32_t sigfigs; /* accuracy of timestamps */
u_int32_t snaplen; /* max length of captured packets, in octets */ uint32_t snaplen; /* max length of captured packets, in octets */
u_int32_t network; /* data link type */ uint32_t network; /* data link type */
}; };
#define PCAP_MAGIC 0xa1b2c3d4 #define PCAP_MAGIC 0xa1b2c3d4
@@ -73,10 +75,10 @@ struct pcap_hdr_s {
* Just for information. * Just for information.
*/ */
struct pcaprec_hdr_s { struct pcaprec_hdr_s {
u_int32_t ts_sec; /* timestamp seconds */ uint32_t ts_sec; /* timestamp seconds */
u_int32_t ts_usec; /* timestamp microseconds */ uint32_t ts_usec; /* timestamp microseconds */
u_int32_t incl_len; /* number of octets of packet saved in file */ uint32_t incl_len; /* number of octets of packet saved in file */
u_int32_t orig_len; /* actual length of packet */ uint32_t orig_len; /* actual length of packet */
}; };
/** @private /** @private
@@ -92,12 +94,12 @@ struct ssh_pcap_context_struct {
/* All of these informations are useful to generate /* All of these informations are useful to generate
* the dummy IP and TCP packets * the dummy IP and TCP packets
*/ */
u_int32_t ipsource; uint32_t ipsource;
u_int32_t ipdest; uint32_t ipdest;
u_int16_t portsource; uint16_t portsource;
u_int16_t portdest; uint16_t portdest;
u_int32_t outsequence; uint32_t outsequence;
u_int32_t insequence; uint32_t insequence;
}; };
/** @private /** @private
@@ -106,7 +108,7 @@ struct ssh_pcap_context_struct {
*/ */
struct ssh_pcap_file_struct { struct ssh_pcap_file_struct {
FILE *output; FILE *output;
u_int16_t ipsequence; uint16_t ipsequence;
}; };
/** /**
@@ -136,7 +138,7 @@ static int ssh_pcap_file_write(ssh_pcap_file pcap, ssh_buffer packet){
* @brief prepends a packet with the pcap header and writes packet * @brief prepends a packet with the pcap header and writes packet
* on file * on file
*/ */
int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, u_int32_t original_len){ int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, uint32_t original_len){
ssh_buffer header=buffer_new(); ssh_buffer header=buffer_new();
struct timeval now; struct timeval now;
int err; int err;
@@ -282,7 +284,7 @@ static int ssh_pcap_context_connect(ssh_pcap_context ctx){
* @returns SSH_ERROR an error happened. * @returns SSH_ERROR an error happened.
*/ */
int ssh_pcap_context_write(ssh_pcap_context ctx,enum ssh_pcap_direction direction int ssh_pcap_context_write(ssh_pcap_context ctx,enum ssh_pcap_direction direction
, void *data, u_int32_t len, u_int32_t origlen){ , void *data, uint32_t len, uint32_t origlen){
ssh_buffer ip; ssh_buffer ip;
int err; int err;
if(ctx==NULL || ctx->file ==NULL) if(ctx==NULL || ctx->file ==NULL)