Compare commits
54 Commits
RELEASE.0.
...
RELEASE.0.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4c3dd3ea9f | ||
![]() |
0d78e69016 | ||
![]() |
02e5b3b423 | ||
![]() |
9399ef83c4 | ||
![]() |
68c86e2c4c | ||
![]() |
15e0f56d01 | ||
![]() |
d2ef367552 | ||
![]() |
3167f054ff | ||
![]() |
209d06d6c9 | ||
![]() |
2b7856ad32 | ||
![]() |
9a1ce06e31 | ||
![]() |
c9413c628d | ||
![]() |
327c31a634 | ||
![]() |
4ace76b30d | ||
![]() |
2127c5967e | ||
![]() |
242475c42a | ||
![]() |
854dffe0a4 | ||
![]() |
278219fc0a | ||
![]() |
16be3fc778 | ||
![]() |
edcfab905a | ||
![]() |
46f59112d9 | ||
![]() |
05c1164a67 | ||
![]() |
3fc4caf42f | ||
![]() |
1a9fee074b | ||
![]() |
8f62c7322f | ||
![]() |
839be89a49 | ||
![]() |
669e69966a | ||
![]() |
138b1b3830 | ||
![]() |
4088283465 | ||
![]() |
402978bd1b | ||
![]() |
387a1fdf4b | ||
![]() |
d574d7dea0 | ||
![]() |
b2df0b26f7 | ||
![]() |
bb76ed34a0 | ||
![]() |
153e1959f4 | ||
![]() |
a3155d5d12 | ||
![]() |
8485ee6fd5 | ||
![]() |
4f76c2b80c | ||
![]() |
accd865aff | ||
![]() |
84e16944b4 | ||
![]() |
e0254f3936 | ||
![]() |
14881b2370 | ||
![]() |
4ec68bdc04 | ||
![]() |
a87fdff9e9 | ||
![]() |
50fd6590f0 | ||
![]() |
2b1c979d7e | ||
![]() |
6ac790a477 | ||
![]() |
b53db3d3a9 | ||
![]() |
83d77f3878 | ||
![]() |
530e57d4ac | ||
![]() |
a9fc3bdb4e | ||
![]() |
e2c88f6ae3 | ||
![]() |
cf9ed016e7 | ||
![]() |
1901324122 |
@@ -1,5 +1,5 @@
|
|||||||
jas4711:Simon Josefsson <simon@josefsson.org>
|
jas4711:Simon Josefsson <simon@josefsson.org>
|
||||||
bagder:Daniel Stenberg <daniel@haxx.se>
|
bagder:Daniel Stenberg
|
||||||
sarag:Sara Golemon <pollita@libssh2.org>
|
sarag:Sara Golemon <pollita@libssh2.org>
|
||||||
gusarov:Mikhail Gusarov <dottedmag@dottedmag.net>
|
gusarov:Mikhail Gusarov <dottedmag@dottedmag.net>
|
||||||
wez:Wez Furlong
|
wez:Wez Furlong
|
||||||
|
32
HACKING
Normal file
32
HACKING
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
libssh2 source code style guide:
|
||||||
|
|
||||||
|
- 4 level indent
|
||||||
|
- spaces-only (no tabs)
|
||||||
|
- open braces on the if/for line:
|
||||||
|
|
||||||
|
if (banana) {
|
||||||
|
go_nuts();
|
||||||
|
}
|
||||||
|
|
||||||
|
- write both braces on the else line:
|
||||||
|
|
||||||
|
if (banana) {
|
||||||
|
go_nuts();
|
||||||
|
} else {
|
||||||
|
stay_calm();
|
||||||
|
}
|
||||||
|
|
||||||
|
- use braces even for single-statement blocks
|
||||||
|
|
||||||
|
- keep source lines shorter than 80 columns
|
||||||
|
|
||||||
|
------------
|
||||||
|
|
||||||
|
Older libssh2 code that still hasn't quite transitioned to the above
|
||||||
|
mentioned style, used a different style:
|
||||||
|
|
||||||
|
- indented with tabs (only)
|
||||||
|
|
||||||
|
- no line length limits
|
||||||
|
|
17
Makefile.am
17
Makefile.am
@@ -5,7 +5,13 @@ include_HEADERS = \
|
|||||||
include/libssh2_publickey.h \
|
include/libssh2_publickey.h \
|
||||||
include/libssh2_sftp.h
|
include/libssh2_sftp.h
|
||||||
|
|
||||||
EXTRA_DIST = win32 buildconf
|
NETWAREFILES = nw/keepscreen.c \
|
||||||
|
nw/Makefile \
|
||||||
|
nw/Makefile.netware \
|
||||||
|
nw/nwlib.c \
|
||||||
|
nw/test/Makefile.netware
|
||||||
|
|
||||||
|
EXTRA_DIST = win32 buildconf $(NETWAREFILES) get_ver.awk HACKING maketgz NMakefile
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
@@ -14,3 +20,12 @@ ChangeLog:
|
|||||||
if test -f .cvsusers; then \
|
if test -f .cvsusers; then \
|
||||||
cvs2cl --utc --fsf --FSF --usermap .cvsusers -I ChangeLog -I .cvs; \
|
cvs2cl --utc --fsf --FSF --usermap .cvsusers -I ChangeLog -I .cvs; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dist-hook:
|
||||||
|
rm -rf $(top_builddir)/tests/log
|
||||||
|
find $(distdir) -name "*.dist" -exec rm {} \;
|
||||||
|
(distit=`find $(srcdir) -name "*.dist"`; \
|
||||||
|
for file in $$distit; do \
|
||||||
|
strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
|
||||||
|
cp $$file $(distdir)$$strip; \
|
||||||
|
done)
|
||||||
|
28
NEWS
28
NEWS
@@ -1,4 +1,30 @@
|
|||||||
Version
|
Version 0.16
|
||||||
|
------------
|
||||||
|
Changes since previous version include:
|
||||||
|
|
||||||
|
o CRLF stripping fix for PEM reading
|
||||||
|
o libssh2_scp_recv() error message fix
|
||||||
|
o added HACKING as an initial attempt to describe our source code format
|
||||||
|
o new public defines in include/libssh2.h to allow applictions to figure out
|
||||||
|
version number etc
|
||||||
|
o new script (maketgz) to build releases with
|
||||||
|
o updated files for building with MSVC and mingw
|
||||||
|
o keyboard-interactive would always fail due to claimed memory problem
|
||||||
|
o a few minor memory leaks fixed
|
||||||
|
o libssh2_poll() no longer relies on C99 features
|
||||||
|
o AIX 4 and 5 now supports non-blocking sockets
|
||||||
|
o large file magic checks in configure
|
||||||
|
o LIBSSH2_APINO was removed from the public header file
|
||||||
|
|
||||||
|
This release would not have been possible without these friendly contributors:
|
||||||
|
|
||||||
|
James Housley, Simon Josefsson, Dan Fandrich, Guenter Knauf and I too did
|
||||||
|
some poking. (Sorry if I forgot anyone I should've mentioned here.)
|
||||||
|
|
||||||
|
Of course we would have nothing without the great work by Sara Golemon that
|
||||||
|
we're extending and building upon.
|
||||||
|
|
||||||
|
Version 0.15
|
||||||
------------
|
------------
|
||||||
Added libssh2_sftp_readdir_ex() and updated LIBSSH2_APINO to
|
Added libssh2_sftp_readdir_ex() and updated LIBSSH2_APINO to
|
||||||
200706151200 (James Housley)
|
200706151200 (James Housley)
|
||||||
|
15
NMakefile
15
NMakefile
@@ -1,16 +1,19 @@
|
|||||||
!include "win32/config.mk"
|
!include "win32/config.mk"
|
||||||
|
|
||||||
|
# SUBDIRS=src example\simple
|
||||||
SUBDIRS=src
|
SUBDIRS=src
|
||||||
|
|
||||||
all: all-sub ssh2_sample.exe
|
|
||||||
|
|
||||||
ssh2_sample.exe: ssh2_sample.c
|
|
||||||
$(CC) $(CFLAGS) -DWIN32 -o ssh2_sample.exe ssh2_sample.c libssh2$(SUFFIX).lib $(LIBS)
|
|
||||||
|
|
||||||
all-sub:
|
all-sub:
|
||||||
-for %D in ($(SUBDIRS)) do $(MAKE) /nologo /f %D/NMakefile BUILD=$(BUILD) SUBDIR=%D all-sub
|
-for %D in ($(SUBDIRS)) do $(MAKE) /nologo /f %D/NMakefile BUILD=$(BUILD) SUBDIR=%D all-sub
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rmdir /s/q $(TARGET)
|
-rmdir /s/q $(TARGET)
|
||||||
|
|
||||||
|
real-clean: clean
|
||||||
|
-del libssh2.dll
|
||||||
|
-del libssh2.exp
|
||||||
|
-del libssh2.ilk
|
||||||
|
-del libssh2.lib
|
||||||
|
-del *.pdb
|
||||||
|
|
||||||
|
|
||||||
|
@@ -178,7 +178,7 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
|
|||||||
# define PLATFORM_SUNOS4
|
# define PLATFORM_SUNOS4
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
|
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
|
||||||
# define PLATFORM_AIX_V3
|
# define PLATFORM_AIX_V3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -3,5 +3,9 @@
|
|||||||
${LIBTOOLIZE:-libtoolize} --copy --automake --force
|
${LIBTOOLIZE:-libtoolize} --copy --automake --force
|
||||||
${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS
|
${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS
|
||||||
${AUTOHEADER:-autoheader}
|
${AUTOHEADER:-autoheader}
|
||||||
|
# copy the private libssh2_config.h.in to the examples dir so that
|
||||||
|
# it can be included without pointing the include path to the private
|
||||||
|
# source dir
|
||||||
|
cp src/libssh2_config.h.in example/simple/config.h.in
|
||||||
${AUTOCONF:-autoconf}
|
${AUTOCONF:-autoconf}
|
||||||
${AUTOMAKE:-automake} --add-missing --copy
|
${AUTOMAKE:-automake} --add-missing --copy
|
||||||
|
29
configure.in
29
configure.in
@@ -1,8 +1,26 @@
|
|||||||
# AC_PREREQ(2.57)
|
# AC_PREREQ(2.57)
|
||||||
AC_INIT(libssh2, 0.15, libssh2-devel@lists.sourceforge.net)
|
AC_INIT(libssh2, [-], libssh2-devel@lists.sourceforge.net)
|
||||||
AM_INIT_AUTOMAKE(libssh2, 0.15)
|
|
||||||
AC_CONFIG_SRCDIR([src])
|
AC_CONFIG_SRCDIR([src])
|
||||||
AC_CONFIG_HEADER([src/libssh2_config.h])
|
AC_CONFIG_HEADER([src/libssh2_config.h example/simple/config.h])
|
||||||
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
|
dnl SED is needed by some of the tools
|
||||||
|
AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
|
||||||
|
$PATH:/usr/bin:/usr/local/bin)
|
||||||
|
AC_SUBST(SED)
|
||||||
|
|
||||||
|
if test "x$SED" = "xsed-was-not-found-by-configure"; then
|
||||||
|
AC_MSG_WARN([sed was not found, this may ruin your chances to build fine])
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl figure out the libssh2 version
|
||||||
|
VERSION=`$SED -ne 's/^#define LIBSSH2_VERSION *"\(.*\)"/\1/p' ${srcdir}/include/libssh2.h`
|
||||||
|
AM_INIT_AUTOMAKE(libssh2,$VERSION)
|
||||||
|
AC_MSG_CHECKING([libssh2 version])
|
||||||
|
AC_MSG_RESULT($VERSION)
|
||||||
|
|
||||||
|
AB_VERSION=$VERSION
|
||||||
|
|
||||||
AB_INIT
|
AB_INIT
|
||||||
|
|
||||||
# Check for the OS.
|
# Check for the OS.
|
||||||
@@ -40,6 +58,9 @@ if test -z "$PKG_CONFIG"; then
|
|||||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl check for how to do large files
|
||||||
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
# Look for libgcrypt.
|
# Look for libgcrypt.
|
||||||
AC_ARG_WITH(libgcrypt,
|
AC_ARG_WITH(libgcrypt,
|
||||||
AC_HELP_STRING([--with-libgcrypt],[Use libgcrypt for crypto]),
|
AC_HELP_STRING([--with-libgcrypt],[Use libgcrypt for crypto]),
|
||||||
@@ -230,6 +251,8 @@ AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
|
|||||||
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
||||||
AC_CHECK_FUNCS(poll gettimeofday select)
|
AC_CHECK_FUNCS(poll gettimeofday select)
|
||||||
|
|
||||||
|
AC_FUNC_ALLOCA
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.\" $Id: libssh2_sftp_readdir.3,v 1.9 2007/06/15 17:22:49 jehousley Exp $
|
.\" $Id: libssh2_sftp_readdir.3,v 1.11 2007/07/04 10:44:40 jehousley Exp $
|
||||||
.\"
|
.\"
|
||||||
.TH libssh2_sftp_readdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
.TH libssh2_sftp_readdir_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@@ -41,7 +41,7 @@ however, it uses a variable sized directory entry (filename) buffer and
|
|||||||
returns statbuf type data in the same call.
|
returns statbuf type data in the same call.
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Number of bytes actually populated into buffer, or -1 on failure. It returns
|
Number of bytes actually populated into buffer, or negative on failure. It returns
|
||||||
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
|
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
|
||||||
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
|
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
|
@@ -10,7 +10,7 @@ noinst_PROGRAMS = ssh2 \
|
|||||||
sftp_RW_nonblock \
|
sftp_RW_nonblock \
|
||||||
sftpdir sftpdir_nonblock
|
sftpdir sftpdir_nonblock
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/src
|
INCLUDES = -I$(top_srcdir)/include
|
||||||
LDADD = $(top_builddir)/src/libssh2.la
|
LDADD = $(top_builddir)/src/libssh2.la
|
||||||
|
|
||||||
ssh2_SOURCES = ssh2.c
|
ssh2_SOURCES = ssh2.c
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp.c,v 1.7 2007/06/06 12:34:08 jehousley Exp $
|
* $Id: scp.c,v 1.9 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_nonblock.c,v 1.5 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: scp_nonblock.c,v 1.8 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SCP transfers in a non-blocking manner.
|
* Sample showing how to do SCP transfers in a non-blocking manner.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -146,7 +146,10 @@ int main(int argc, char *argv[])
|
|||||||
channel = libssh2_scp_recv(session, scppath, &fileinfo);
|
channel = libssh2_scp_recv(session, scppath, &fileinfo);
|
||||||
|
|
||||||
if ((!channel) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
if ((!channel) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to open a session\n");
|
char *err_msg;
|
||||||
|
|
||||||
|
libssh2_session_last_error(session, &err_msg, NULL, 0);
|
||||||
|
fprintf(stderr, "%s\n", err_msg);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!channel);
|
} while (!channel);
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_write.c,v 1.1 2007/06/06 12:34:08 jehousley Exp $
|
* $Id: scp_write.c,v 1.4 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -142,10 +142,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//libssh2_trace(session, 0xFFFF);
|
|
||||||
|
|
||||||
/* Request a file via SCP */
|
/* Request a file via SCP */
|
||||||
channel = libssh2_scp_send(session, scppath, 0x1FF & fileinfo.st_mode, (unsigned long)fileinfo.st_size);
|
channel = libssh2_scp_send(session, scppath, 0x1FF & fileinfo.st_mode,
|
||||||
|
(unsigned long)fileinfo.st_size);
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
fprintf(stderr, "Unable to open a session\n");
|
fprintf(stderr, "Unable to open a session\n");
|
||||||
@@ -178,9 +177,6 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Waiting for channel to close\n");
|
fprintf(stderr, "Waiting for channel to close\n");
|
||||||
libssh2_channel_wait_closed(channel);
|
libssh2_channel_wait_closed(channel);
|
||||||
|
|
||||||
// fprintf(stderr, "Closing channel\n");
|
|
||||||
// libssh2_channel_close(channel);
|
|
||||||
|
|
||||||
libssh2_channel_free(channel);
|
libssh2_channel_free(channel);
|
||||||
channel = NULL;
|
channel = NULL;
|
||||||
|
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: scp_write_nonblock.c,v 1.2 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: scp_write_nonblock.c,v 1.6 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do a simple SCP transfer.
|
* Sample showing how to do a simple SCP transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -141,7 +142,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (auth_pw) {
|
if (auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2_ERROR_EAGAIN);
|
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
@@ -158,14 +160,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// libssh2_trace(session, 0xFF7D);
|
|
||||||
|
|
||||||
/* Request a file via SCP */
|
/* Request a file via SCP */
|
||||||
do {
|
do {
|
||||||
channel = libssh2_scp_send(session, scppath, 0x1FF & fileinfo.st_mode, (unsigned long)fileinfo.st_size);
|
channel = libssh2_scp_send(session, scppath, 0x1FF & fileinfo.st_mode,
|
||||||
|
(unsigned long)fileinfo.st_size);
|
||||||
|
|
||||||
if ((!channel) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
if ((!channel) && (libssh2_session_last_errno(session) !=
|
||||||
fprintf(stderr, "Unable to open a session\n");
|
LIBSSH2_ERROR_EAGAIN)) {
|
||||||
|
char *err_msg;
|
||||||
|
|
||||||
|
libssh2_session_last_error(session, &err_msg, NULL, 0);
|
||||||
|
fprintf(stderr, "%s\n", err_msg);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!channel);
|
} while (!channel);
|
||||||
@@ -181,7 +186,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
/* write data in a loop until we block */
|
/* write data in a loop until we block */
|
||||||
while ((rc = libssh2_channel_write(channel, ptr, nread)) == LIBSSH2_ERROR_EAGAIN);
|
while ((rc = libssh2_channel_write(channel, ptr, nread)) ==
|
||||||
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
fprintf(stderr, "ERROR %d\n", rc);
|
fprintf(stderr, "ERROR %d\n", rc);
|
||||||
}
|
}
|
||||||
@@ -199,15 +205,13 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Waiting for channel to close\n");
|
fprintf(stderr, "Waiting for channel to close\n");
|
||||||
while (libssh2_channel_wait_closed(channel) == LIBSSH2_ERROR_EAGAIN);
|
while (libssh2_channel_wait_closed(channel) == LIBSSH2_ERROR_EAGAIN);
|
||||||
|
|
||||||
// fprintf(stderr, "Closing channel\n");
|
|
||||||
// while (libssh2_channel_close(channel) == LIBSSH2_ERROR_EAGAIN);
|
|
||||||
|
|
||||||
libssh2_channel_free(channel);
|
libssh2_channel_free(channel);
|
||||||
channel = NULL;
|
channel = NULL;
|
||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
while ((rc = libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing")) == LIBSSH2_ERROR_EAGAIN);
|
while ((rc = libssh2_session_disconnect(session,
|
||||||
|
"Normal Shutdown, Thank you for playing")) == LIBSSH2_ERROR_EAGAIN);
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp.c,v 1.8 2007/06/06 12:34:08 jehousley Exp $
|
* $Id: sftp.c,v 1.12 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP transfers.
|
* Sample showing how to do SFTP transfers.
|
||||||
*
|
*
|
||||||
* The sample code has default values for host name, user name, password
|
* The sample code has default values for host name, user name, password
|
||||||
* and path to copy, but you can specify them on the command line like:
|
* and path to copy, but you can specify them on the command line like:
|
||||||
*
|
*
|
||||||
* "sftp 192.168.0.1 user password /tmp/secrets"
|
* "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -38,16 +38,41 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
char *keyfile1=(char *)"~/.ssh/id_rsa.pub";
|
||||||
unsigned long hostaddr;
|
char *keyfile2=(char *)"~/.ssh/id_rsa";
|
||||||
int sock, i, auth_pw = 1;
|
|
||||||
struct sockaddr_in sin;
|
|
||||||
const char *fingerprint;
|
|
||||||
LIBSSH2_SESSION *session;
|
|
||||||
char *username=(char *)"username";
|
char *username=(char *)"username";
|
||||||
char *password=(char *)"password";
|
char *password=(char *)"password";
|
||||||
char *sftppath=(char *)"/tmp/TEST";
|
char *sftppath=(char *)"/tmp/TEST";
|
||||||
|
|
||||||
|
|
||||||
|
static void kbd_callback(const char *name, int name_len,
|
||||||
|
const char *instruction, int instruction_len, int num_prompts,
|
||||||
|
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||||
|
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||||
|
void **abstract)
|
||||||
|
{
|
||||||
|
(void)name;
|
||||||
|
(void)name_len;
|
||||||
|
(void)instruction;
|
||||||
|
(void)instruction_len;
|
||||||
|
if (num_prompts == 1) {
|
||||||
|
responses[0].text = strdup(password);
|
||||||
|
responses[0].length = strlen(password);
|
||||||
|
}
|
||||||
|
(void)prompts;
|
||||||
|
(void)abstract;
|
||||||
|
} /* kbd_callback */
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
unsigned long hostaddr;
|
||||||
|
int sock, i, auth_pw = 0;
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
const char *fingerprint;
|
||||||
|
char *userauthlist;
|
||||||
|
LIBSSH2_SESSION *session;
|
||||||
int rc;
|
int rc;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||||
@@ -121,21 +146,57 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
/* check what authentication methods are available */
|
||||||
|
userauthlist = libssh2_userauth_list(session, username, sizeof(username));
|
||||||
|
printf("Authentication methods: %s\n", userauthlist);
|
||||||
|
if (strstr(userauthlist, "password") != NULL) {
|
||||||
|
auth_pw |= 1;
|
||||||
|
}
|
||||||
|
if (strstr(userauthlist, "keyboard-interactive") != NULL) {
|
||||||
|
auth_pw |= 2;
|
||||||
|
}
|
||||||
|
if (strstr(userauthlist, "publickey") != NULL) {
|
||||||
|
auth_pw |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we got an 4. argument we set this option if supported */
|
||||||
|
if(argc > 5) {
|
||||||
|
if ((auth_pw & 1) && !strcasecmp(argv[5], "-p")) {
|
||||||
|
auth_pw = 1;
|
||||||
|
}
|
||||||
|
if ((auth_pw & 2) && !strcasecmp(argv[5], "-i")) {
|
||||||
|
auth_pw = 2;
|
||||||
|
}
|
||||||
|
if ((auth_pw & 4) && !strcasecmp(argv[5], "-k")) {
|
||||||
|
auth_pw = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth_pw & 1) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if (libssh2_userauth_password(session, username, password)) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (auth_pw & 2) {
|
||||||
/* Or by public key */
|
/* Or via keyboard-interactive */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
if (libssh2_userauth_keyboard_interactive(session, username, &kbd_callback) ) {
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
printf("\tAuthentication by keyboard-interactive failed!\n");
|
||||||
"/home/username/.ssh/id_rsa",
|
|
||||||
password)) {
|
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
|
} else {
|
||||||
|
printf("\tAuthentication by keyboard-interactive succeeded.\n");
|
||||||
}
|
}
|
||||||
|
} else if (auth_pw & 4) {
|
||||||
|
/* Or by public key */
|
||||||
|
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
|
||||||
|
printf("\tAuthentication by public key failed!\n");
|
||||||
|
goto shutdown;
|
||||||
|
} else {
|
||||||
|
printf("\tAuthentication by public key succeeded.\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("No supported authentication methods found!\n");
|
||||||
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_RW_nonblock.c,v 1.7 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: sftp_RW_nonblock.c,v 1.9 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP transfers in a non-blocking manner.
|
* Sample showing how to do SFTP transfers in a non-blocking manner.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* Using the SFTP server running on 127.0.0.1
|
* Using the SFTP server running on 127.0.0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_mkdir.c,v 1.4 2007/06/06 12:34:08 jehousley Exp $
|
* $Id: sftp_mkdir.c,v 1.6 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP mkdir
|
* Sample showing how to do SFTP mkdir
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
|
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_mkdir_nonblock.c,v 1.6 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: sftp_mkdir_nonblock.c,v 1.8 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking mkdir.
|
* Sample showing how to do SFTP non-blocking mkdir.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_nonblock.c,v 1.10 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: sftp_nonblock.c,v 1.12 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking transfers.
|
* Sample showing how to do SFTP non-blocking transfers.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftp 192.168.0.1 user password /tmp/secrets"
|
* "sftp 192.168.0.1 user password /tmp/secrets"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_write.c,v 1.4 2007/06/06 12:34:09 jehousley Exp $
|
* $Id: sftp_write.c,v 1.7 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP write transfers.
|
* Sample showing how to do SFTP write transfers.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
|
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -147,8 +147,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//libssh2_trace(session, 0xFFFF);
|
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
@@ -195,7 +193,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session,
|
||||||
|
"Normal Shutdown, Thank you for playing");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftp_write_nonblock.c,v 1.7 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: sftp_write_nonblock.c,v 1.9 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SFTP non-blocking write transfers.
|
* Sample showing how to do SFTP non-blocking write transfers.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftpdir.c,v 1.6 2007/06/15 17:22:49 jehousley Exp $
|
* $Id: sftpdir.c,v 1.8 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample doing an SFTP directory listing.
|
* Sample doing an SFTP directory listing.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sftpdir_nonblock.c,v 1.7 2007/06/08 13:33:08 jehousley Exp $
|
* $Id: sftpdir_nonblock.c,v 1.9 2007/07/31 11:00:29 bagder Exp $
|
||||||
*
|
*
|
||||||
* Sample doing an SFTP directory listing.
|
* Sample doing an SFTP directory listing.
|
||||||
*
|
*
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -127,7 +127,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (auth_pw) {
|
if (auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2_ERROR_EAGAIN);
|
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
@@ -148,7 +149,8 @@ int main(int argc, char *argv[])
|
|||||||
do {
|
do {
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if ((!sftp_session) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
if ((!sftp_session) && (libssh2_session_last_errno(session) !=
|
||||||
|
LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -159,7 +161,8 @@ int main(int argc, char *argv[])
|
|||||||
do {
|
do {
|
||||||
sftp_handle = libssh2_sftp_opendir(sftp_session, sftppath);
|
sftp_handle = libssh2_sftp_opendir(sftp_session, sftppath);
|
||||||
|
|
||||||
if ((!sftp_handle) && (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
if ((!sftp_handle) && (libssh2_session_last_errno(session) !=
|
||||||
|
LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to open dir with SFTP\n");
|
fprintf(stderr, "Unable to open dir with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -171,7 +174,8 @@ int main(int argc, char *argv[])
|
|||||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
||||||
|
|
||||||
/* loop until we fail */
|
/* loop until we fail */
|
||||||
while ((rc = libssh2_sftp_readdir(sftp_handle, mem, sizeof(mem), &attrs)) == LIBSSH2_ERROR_EAGAIN) {
|
while ((rc = libssh2_sftp_readdir(sftp_handle, mem, sizeof(mem),
|
||||||
|
&attrs)) == LIBSSH2_ERROR_EAGAIN) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
if(rc > 0) {
|
if(rc > 0) {
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ssh2.c,v 1.3 2007/04/26 23:59:15 gknauf Exp $
|
* $Id: ssh2.c,v 1.16 2007/08/03 15:08:28 jehousley Exp $
|
||||||
*
|
*
|
||||||
* Sample showing how to do SSH2 connect.
|
* Sample showing how to do SSH2 connect.
|
||||||
*
|
*
|
||||||
* The sample code has default values for host name, user name, password
|
* The sample code has default values for host name, user name, password
|
||||||
* and path to copy, but you can specify them on the command line like:
|
* and path to copy, but you can specify them on the command line like:
|
||||||
*
|
*
|
||||||
* "ssh2 host user password"
|
* "ssh2 host user password [-p|-i|-k]"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
#include <libssh2_config.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
@@ -25,6 +25,9 @@
|
|||||||
# ifdef HAVE_UNISTD_H
|
# ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
# ifdef HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -32,16 +35,41 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
char *keyfile1=(char *)"~/.ssh/id_rsa.pub";
|
||||||
|
char *keyfile2=(char *)"~/.ssh/id_rsa";
|
||||||
|
char *username=(char *)"username";
|
||||||
|
char *password=(char *)"password";
|
||||||
|
|
||||||
|
|
||||||
|
static void kbd_callback(const char *name, int name_len,
|
||||||
|
const char *instruction, int instruction_len, int num_prompts,
|
||||||
|
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||||
|
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||||
|
void **abstract)
|
||||||
|
{
|
||||||
|
(void)name;
|
||||||
|
(void)name_len;
|
||||||
|
(void)instruction;
|
||||||
|
(void)instruction_len;
|
||||||
|
if (num_prompts == 1) {
|
||||||
|
responses[0].text = strdup(password);
|
||||||
|
responses[0].length = strlen(password);
|
||||||
|
}
|
||||||
|
(void)prompts;
|
||||||
|
(void)abstract;
|
||||||
|
} /* kbd_callback */
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned long hostaddr;
|
unsigned long hostaddr;
|
||||||
int sock, i, auth_pw = 1;
|
int sock, i, auth_pw = 0;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
|
char *userauthlist;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
char *username=(char *)"username";
|
|
||||||
char *password=(char *)"password";
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
|
||||||
@@ -97,19 +125,60 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
/* check what authentication methods are available */
|
||||||
|
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
||||||
|
printf("Authentication methods: %s\n", userauthlist);
|
||||||
|
if (strstr(userauthlist, "password") != NULL) {
|
||||||
|
auth_pw |= 1;
|
||||||
|
}
|
||||||
|
if (strstr(userauthlist, "keyboard-interactive") != NULL) {
|
||||||
|
auth_pw |= 2;
|
||||||
|
}
|
||||||
|
if (strstr(userauthlist, "publickey") != NULL) {
|
||||||
|
auth_pw |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we got an 4. argument we set this option if supported */
|
||||||
|
if(argc > 4) {
|
||||||
|
if ((auth_pw & 1) && !strcasecmp(argv[4], "-p")) {
|
||||||
|
auth_pw = 1;
|
||||||
|
}
|
||||||
|
if ((auth_pw & 2) && !strcasecmp(argv[4], "-i")) {
|
||||||
|
auth_pw = 2;
|
||||||
|
}
|
||||||
|
if ((auth_pw & 4) && !strcasecmp(argv[4], "-k")) {
|
||||||
|
auth_pw = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth_pw & 1) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if (libssh2_userauth_password(session, username, password)) {
|
||||||
printf("Authentication by password failed.\n");
|
printf("\tAuthentication by password failed!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
|
} else {
|
||||||
|
printf("\tAuthentication by password succeeded.\n");
|
||||||
|
}
|
||||||
|
} else if (auth_pw & 2) {
|
||||||
|
/* Or via keyboard-interactive */
|
||||||
|
if (libssh2_userauth_keyboard_interactive(session, username, &kbd_callback) ) {
|
||||||
|
printf("\tAuthentication by keyboard-interactive failed!\n");
|
||||||
|
goto shutdown;
|
||||||
|
} else {
|
||||||
|
printf("\tAuthentication by keyboard-interactive succeeded.\n");
|
||||||
|
}
|
||||||
|
} else if (auth_pw & 4) {
|
||||||
|
/* Or by public key */
|
||||||
|
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
|
||||||
|
printf("\tAuthentication by public key failed!\n");
|
||||||
|
goto shutdown;
|
||||||
|
} else {
|
||||||
|
printf("\tAuthentication by public key succeeded.\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Or by public key */
|
printf("No supported authentication methods found!\n");
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username, "/home/username/.ssh/id_rsa.pub", "/home/username/.ssh/id_rsa", password)) {
|
|
||||||
printf("\tAuthentication by public key failed\n");
|
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Request a shell */
|
/* Request a shell */
|
||||||
if (!(channel = libssh2_channel_open_session(session))) {
|
if (!(channel = libssh2_channel_open_session(session))) {
|
||||||
@@ -173,6 +242,6 @@ int main(int argc, char *argv[])
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
printf("all done\n");
|
printf("all done!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -64,20 +64,56 @@ extern "C" {
|
|||||||
# include <sys/uio.h>
|
# include <sys/uio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LIBSSH2_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1300)
|
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
||||||
typedef unsigned __int64 libssh2_uint64_t;
|
# include <sys/bsdskt.h>
|
||||||
typedef __int64 libssh2_int64_t;
|
|
||||||
#if (_MSC_VER <= 1200)
|
|
||||||
typedef long ssize_t;
|
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(LIBSSH2_WIN32) && defined(_MSC_VER) && (_MSC_VER <= 1400)
|
||||||
|
typedef unsigned __int64 libssh2_uint64_t;
|
||||||
|
typedef __int64 libssh2_int64_t;
|
||||||
|
typedef long ssize_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long long libssh2_uint64_t;
|
typedef unsigned long long libssh2_uint64_t;
|
||||||
typedef long long libssh2_int64_t;
|
typedef long long libssh2_int64_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LIBSSH2_VERSION "0.15-CVS"
|
#define LIBSSH2_VERSION "0.16.0-CVS"
|
||||||
#define LIBSSH2_APINO 200706151200
|
|
||||||
|
/* The numeric version number is also available "in parts" by using these
|
||||||
|
defines: */
|
||||||
|
#define LIBSSH2_VERSION_MAJOR 0
|
||||||
|
#define LIBSSH2_VERSION_MINOR 16
|
||||||
|
#define LIBSSH2_VERSION_PATCH 0
|
||||||
|
|
||||||
|
/* This is the numeric version of the libssh2 version number, meant for easier
|
||||||
|
parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will
|
||||||
|
always follow this syntax:
|
||||||
|
|
||||||
|
0xXXYYZZ
|
||||||
|
|
||||||
|
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||||
|
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||||
|
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||||
|
appears as "0x090b07".
|
||||||
|
|
||||||
|
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||||
|
and it is always a greater number in a more recent release. It makes
|
||||||
|
comparisons with greater than and less than work.
|
||||||
|
*/
|
||||||
|
#define LIBSSH2_VERSION_NUM 0x001000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the date and time when the full source package was created. The
|
||||||
|
* timestamp is not stored in CVS, as the timestamp is properly set in the
|
||||||
|
* tarballs by the maketgz script.
|
||||||
|
*
|
||||||
|
* The format of the date should follow this template:
|
||||||
|
*
|
||||||
|
* "Mon Feb 12 11:35:33 UTC 2007"
|
||||||
|
*/
|
||||||
|
#define LIBSSH2_TIMESTAMP "CVS"
|
||||||
|
|
||||||
/* Part of every banner, user specified or not */
|
/* Part of every banner, user specified or not */
|
||||||
#define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION
|
#define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION
|
||||||
|
73
maketgz
Executable file
73
maketgz
Executable file
@@ -0,0 +1,73 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Script to build release-archives with
|
||||||
|
#
|
||||||
|
|
||||||
|
version=$1
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "Specify a version number!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
libversion="$version"
|
||||||
|
|
||||||
|
major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
|
||||||
|
minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
|
||||||
|
patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
|
||||||
|
|
||||||
|
numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
|
||||||
|
|
||||||
|
HEADER=include/libssh2.h
|
||||||
|
|
||||||
|
# requires a date command that knows -u for UTC time zone
|
||||||
|
datestamp=`date -u`
|
||||||
|
|
||||||
|
# Replace version number in header file:
|
||||||
|
sed -e 's/^#define LIBSSH2_VERSION .*/#define LIBSSH2_VERSION "'$libversion'"/g' \
|
||||||
|
-e 's/^#define LIBSSH2_VERSION_NUM .*/#define LIBSSH2_VERSION_NUM 0x'$numeric'/g' \
|
||||||
|
-e 's/^#define LIBSSH2_VERSION_MAJOR .*/#define LIBSSH2_VERSION_MAJOR '$major'/g' \
|
||||||
|
-e 's/^#define LIBSSH2_VERSION_MINOR .*/#define LIBSSH2_VERSION_MINOR '$minor'/g' \
|
||||||
|
-e 's/^#define LIBSSH2_VERSION_PATCH .*/#define LIBSSH2_VERSION_PATCH '$patch'/g' \
|
||||||
|
-e "s/^#define LIBSSH2_TIMESTAMP .*/#define LIBSSH2_TIMESTAMP \"$datestamp\"/g" \
|
||||||
|
$HEADER >$HEADER.dist
|
||||||
|
|
||||||
|
echo "libssh2 version $libversion"
|
||||||
|
echo "libssh2 numerical $numeric"
|
||||||
|
echo "datestamp $datestamp"
|
||||||
|
|
||||||
|
findprog()
|
||||||
|
{
|
||||||
|
file="$1"
|
||||||
|
for part in `echo $PATH| tr ':' ' '`; do
|
||||||
|
path="$part/$file"
|
||||||
|
if [ -x "$path" ]; then
|
||||||
|
# there it is!
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# no such executable
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
|
||||||
|
# been modified.
|
||||||
|
#
|
||||||
|
|
||||||
|
if { findprog automake >/dev/null 2>/dev/null; } then
|
||||||
|
echo "- Could not find or run automake, I hope you know what you're doing!"
|
||||||
|
else
|
||||||
|
echo "Runs automake --include-deps"
|
||||||
|
automake --include-deps Makefile >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Now run make dist to generate a tar.gz archive
|
||||||
|
#
|
||||||
|
|
||||||
|
echo "make dist"
|
||||||
|
targz="libssh2-$version.tar.gz"
|
||||||
|
make -s dist VERSION=$version
|
@@ -5,7 +5,7 @@
|
|||||||
##
|
##
|
||||||
## Comments to: Guenter Knauf <eflash@gmx.net>
|
## Comments to: Guenter Knauf <eflash@gmx.net>
|
||||||
##
|
##
|
||||||
## $Id: Makefile.netware,v 1.9 2007/06/20 23:44:58 gknauf Exp $
|
## $Id: Makefile.netware,v 1.12 2007/07/22 00:47:21 gknauf Exp $
|
||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ TARGET = libssh2
|
|||||||
VERSION = $(LIBSSH2_VERSION)
|
VERSION = $(LIBSSH2_VERSION)
|
||||||
COPYR = Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
|
COPYR = Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
|
||||||
WWWURL = http://www.libssh2.org/
|
WWWURL = http://www.libssh2.org/
|
||||||
DESCR = libssh2 $(LIBSSH2_VERSION_STR) - $(WWWURL)
|
DESCR = libssh2 $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL)
|
||||||
MTSAFE = YES
|
MTSAFE = YES
|
||||||
STACK = 64000
|
STACK = 64000
|
||||||
SCREEN = none
|
SCREEN = none
|
||||||
@@ -67,11 +67,13 @@ else
|
|||||||
OBJDIR = debug
|
OBJDIR = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the version info retrieved from libssh2.h
|
# The following lines defines your compiler.
|
||||||
-include $(OBJDIR)/version.inc
|
ifdef CWFolder
|
||||||
|
METROWERKS = $(CWFolder)
|
||||||
# The following line defines your compiler.
|
endif
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
|
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
|
||||||
|
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
|
||||||
CC = mwccnlm
|
CC = mwccnlm
|
||||||
else
|
else
|
||||||
CC = gcc
|
CC = gcc
|
||||||
@@ -87,8 +89,15 @@ AWK = awk
|
|||||||
MPKXDC = mkxdc
|
MPKXDC = mkxdc
|
||||||
ZIP = zip -qzr9
|
ZIP = zip -qzr9
|
||||||
|
|
||||||
|
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
|
||||||
|
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
|
||||||
|
|
||||||
|
# Include the version info retrieved from libssh2.h
|
||||||
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc
|
||||||
|
#CFLAGS += -DHAVE_CONFIG_H
|
||||||
|
|
||||||
ifeq ($(CC),mwccnlm)
|
ifeq ($(CC),mwccnlm)
|
||||||
LD = mwldnlm
|
LD = mwldnlm
|
||||||
@@ -103,8 +112,10 @@ ifeq ($(LIBARCH),LIBC)
|
|||||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||||
CFLAGS += -align 4
|
CFLAGS += -align 4
|
||||||
else
|
else
|
||||||
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
|
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
|
||||||
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
|
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
||||||
|
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
|
||||||
|
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
|
||||||
CFLAGS += -align 1
|
CFLAGS += -align 1
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
@@ -120,7 +131,10 @@ CFLAGS += -Wall # -pedantic
|
|||||||
ifeq ($(LIBARCH),LIBC)
|
ifeq ($(LIBARCH),LIBC)
|
||||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
||||||
else
|
else
|
||||||
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
||||||
|
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
||||||
|
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
|
||||||
|
PRELUDE = $(NDK_ROOT)/pre/prelude.o
|
||||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -130,34 +144,33 @@ LDLIBS =
|
|||||||
NDK_ROOT = $(NDKBASE)/ndk
|
NDK_ROOT = $(NDKBASE)/ndk
|
||||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
||||||
SDK_LIBC = $(NDK_ROOT)/libc
|
SDK_LIBC = $(NDK_ROOT)/libc
|
||||||
SDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
|
SNPRINTF = $(NDKBASE)/snprintf
|
||||||
|
|
||||||
INCLUDES = -I. -I../include
|
INCLUDES = -I. -I../include
|
||||||
|
|
||||||
ifdef WITH_ZLIB
|
ifdef WITH_ZLIB
|
||||||
INCLUDES += -I$(ZLIB_PATH)
|
INCLUDES += -I$(ZLIB_PATH)
|
||||||
ifdef LINK_STATIC
|
ifdef LINK_STATIC
|
||||||
LDLIBS += $(ZLIB_PATH)/nw/libz.$(LIBEXT)
|
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
|
||||||
else
|
else
|
||||||
MODULES += libz.nlm
|
MODULES += libz.nlm
|
||||||
IMPORTS += @$(ZLIB_PATH)/nw/libz.imp
|
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_libc -I$(OPENSSL_PATH)/outinc_nw_libc/openssl
|
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl
|
||||||
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/ssl.$(LIBEXT) $(OPENSSL_PATH)/out_nw_libc/crypto.$(LIBEXT)
|
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
|
||||||
|
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
|
||||||
IMPORTS += GetProcessSwitchCount RunningProcess
|
IMPORTS += GetProcessSwitchCount RunningProcess
|
||||||
|
|
||||||
ifeq ($(LIBARCH),LIBC)
|
ifeq ($(LIBARCH),LIBC)
|
||||||
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
|
INCLUDES += -I$(SDK_LIBC)/include
|
||||||
|
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
||||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||||
# INCLUDES += -I$(SDK_LDAP)/libc/inc
|
|
||||||
CFLAGS += -D_POSIX_SOURCE
|
CFLAGS += -D_POSIX_SOURCE
|
||||||
# CFLAGS += -D__ANSIC__
|
|
||||||
else
|
else
|
||||||
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
|
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
||||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||||
# INCLUDES += -I$(SDK_LDAP)/clib/inc
|
# INCLUDES += -I$(SDK_CLIB)/include
|
||||||
CFLAGS += -DNETDB_USE_INTERNET
|
|
||||||
endif
|
endif
|
||||||
CFLAGS += $(INCLUDES)
|
CFLAGS += $(INCLUDES)
|
||||||
|
|
||||||
@@ -199,8 +212,16 @@ OBJECTS = \
|
|||||||
transport.o \
|
transport.o \
|
||||||
userauth.o
|
userauth.o
|
||||||
|
|
||||||
|
ifeq ($(LIBARCH),CLIB)
|
||||||
|
# CLIB lacks of snprint() function - here's a replacement:
|
||||||
|
# http://www.ijs.si/software/snprintf/
|
||||||
|
OBJECTS += snprintf.o
|
||||||
|
vpath %.c $(SNPRINTF)
|
||||||
|
endif
|
||||||
|
|
||||||
OBJS := $(addprefix $(OBJDIR)/,$(OBJECTS))
|
OBJS := $(addprefix $(OBJDIR)/,$(OBJECTS))
|
||||||
OBJL = $(OBJS) $(OBJDIR)/nwlibc.o $(LDLIBS)
|
|
||||||
|
OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS)
|
||||||
|
|
||||||
all: lib nlm
|
all: lib nlm
|
||||||
|
|
||||||
@@ -314,6 +335,7 @@ endif
|
|||||||
ifdef XDCDATA
|
ifdef XDCDATA
|
||||||
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
|
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
|
||||||
endif
|
endif
|
||||||
|
@echo $(DL)flag_on 64$(DL) >> $@
|
||||||
ifeq ($(LIBARCH),CLIB)
|
ifeq ($(LIBARCH),CLIB)
|
||||||
@echo $(DL)start _Prelude$(DL) >> $@
|
@echo $(DL)start _Prelude$(DL) >> $@
|
||||||
@echo $(DL)exit _Stop$(DL) >> $@
|
@echo $(DL)exit _Stop$(DL) >> $@
|
||||||
@@ -323,7 +345,6 @@ ifeq ($(LIBARCH),CLIB)
|
|||||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
||||||
@echo $(DL)module clib$(DL) >> $@
|
@echo $(DL)module clib$(DL) >> $@
|
||||||
else
|
else
|
||||||
@echo $(DL)flag_on 64$(DL) >> $@
|
|
||||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
@echo $(DL)pseudopreemption$(DL) >> $@
|
||||||
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
||||||
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
||||||
@@ -353,62 +374,83 @@ libssh2_config.h: Makefile.netware
|
|||||||
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
||||||
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
||||||
@echo $(DL)*/$(DL) >> $@
|
@echo $(DL)*/$(DL) >> $@
|
||||||
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
|
|
||||||
@echo $(DL)#define VERSION "$(LIBSSH2_VERSION_STR)"$(DL) >> $@
|
@echo $(DL)#define VERSION "$(LIBSSH2_VERSION_STR)"$(DL) >> $@
|
||||||
@echo $(DL)#define PACKAGE_BUGREPORT "http://sourceforge.net/projects/libssh2"$(DL) >> $@
|
@echo $(DL)#define PACKAGE_BUGREPORT "http://sourceforge.net/projects/libssh2"$(DL) >> $@
|
||||||
|
ifeq ($(LIBARCH),CLIB)
|
||||||
|
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
|
||||||
|
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define socklen_t int$(DL) >> $@
|
||||||
|
@echo $(DL)#define sleep(s) delay(1000 * s)$(DL) >> $@
|
||||||
|
else
|
||||||
|
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
||||||
|
ifdef ENABLE_IPV6
|
||||||
|
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
|
||||||
|
endif
|
||||||
|
endif
|
||||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_CTYPE_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_CTYPE_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
|
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
|
||||||
|
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
|
||||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
||||||
|
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
|
||||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
||||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
|
||||||
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
|
|
||||||
@echo $(DL)#define USE_SSLEAY 1$(DL) >> $@
|
@echo $(DL)#define USE_SSLEAY 1$(DL) >> $@
|
||||||
@echo $(DL)#define USE_OPENSSL 1$(DL) >> $@
|
@echo $(DL)#define USE_OPENSSL 1$(DL) >> $@
|
||||||
@echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@
|
@echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@
|
||||||
@@ -427,9 +469,6 @@ ifdef WITH_ZLIB
|
|||||||
@echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
|
@echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
|
||||||
@echo $(DL)#define LIBSSH2_HAVE_ZLIB 1$(DL) >> $@
|
@echo $(DL)#define LIBSSH2_HAVE_ZLIB 1$(DL) >> $@
|
||||||
endif
|
endif
|
||||||
ifdef ENABLE_IPV6
|
|
||||||
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef NW_WINSOCK
|
ifdef NW_WINSOCK
|
||||||
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
||||||
else
|
else
|
||||||
@@ -458,7 +497,11 @@ libssh2.imp: Makefile.netware
|
|||||||
@echo $(DL)# $@ for NetWare target.$(DL) > $@
|
@echo $(DL)# $@ for NetWare target.$(DL) > $@
|
||||||
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
|
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
|
||||||
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
|
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
|
||||||
@echo $(DL) (LIBSSH2)$(DL) >> $@
|
ifeq ($(LIBARCH),CLIB)
|
||||||
|
@echo $(DL) (CLIB_LIBSSH2)$(DL) >> $@
|
||||||
|
else
|
||||||
|
@echo $(DL) (LIBC_LIBSSH2)$(DL) >> $@
|
||||||
|
endif
|
||||||
@echo $(DL) libssh2_banner_set,$(DL) >> $@
|
@echo $(DL) libssh2_banner_set,$(DL) >> $@
|
||||||
@echo $(DL) libssh2_channel_close,$(DL) >> $@
|
@echo $(DL) libssh2_channel_close,$(DL) >> $@
|
||||||
@echo $(DL) libssh2_channel_direct_tcpip_ex,$(DL) >> $@
|
@echo $(DL) libssh2_channel_direct_tcpip_ex,$(DL) >> $@
|
||||||
@@ -531,7 +574,11 @@ $(DEVLDIR)/readme.txt: Makefile.netware
|
|||||||
|
|
||||||
help: $(OBJDIR)/version.inc
|
help: $(OBJDIR)/version.inc
|
||||||
@echo $(DL)===========================================================$(DL)
|
@echo $(DL)===========================================================$(DL)
|
||||||
|
ifeq ($(LIBARCH),LIBC)
|
||||||
@echo $(DL)Novell LibC NDK = $(SDK_LIBC)$(DL)
|
@echo $(DL)Novell LibC NDK = $(SDK_LIBC)$(DL)
|
||||||
|
else
|
||||||
|
@echo $(DL)Novell CLib NDK = $(SDK_CLIB)$(DL)
|
||||||
|
endif
|
||||||
@echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL)
|
@echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL)
|
||||||
@echo $(DL)Zlib path = $(ZLIB_PATH)$(DL)
|
@echo $(DL)Zlib path = $(ZLIB_PATH)$(DL)
|
||||||
@echo $(DL)===========================================================$(DL)
|
@echo $(DL)===========================================================$(DL)
|
||||||
|
306
nw/nwlib.c
Normal file
306
nw/nwlib.c
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* Universal NetWare library stub. *
|
||||||
|
* written by Ulrich Neuman and given to OpenSource copyright-free. *
|
||||||
|
* Extended for CLIB support by Guenter Knauf. *
|
||||||
|
*********************************************************************
|
||||||
|
* $Id: nwlib.c,v 1.1 2007/07/09 22:50:02 gknauf Exp $ *
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#ifdef NETWARE /* Novell NetWare */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __NOVELL_LIBC__
|
||||||
|
/* For native LibC-based NLM we need to register as a real lib. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <library.h>
|
||||||
|
#include <netware.h>
|
||||||
|
#include <screen.h>
|
||||||
|
#include <nks/thread.h>
|
||||||
|
#include <nks/synch.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int _errno;
|
||||||
|
void *twentybytes;
|
||||||
|
} libthreaddata_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
void *tenbytes;
|
||||||
|
NXKey_t perthreadkey; /* if -1, no key obtained... */
|
||||||
|
NXMutex_t *lock;
|
||||||
|
} libdata_t;
|
||||||
|
|
||||||
|
int gLibId = -1;
|
||||||
|
void *gLibHandle = (void *) NULL;
|
||||||
|
rtag_t gAllocTag = (rtag_t) NULL;
|
||||||
|
NXMutex_t *gLibLock = (NXMutex_t *) NULL;
|
||||||
|
|
||||||
|
/* internal library function prototypes... */
|
||||||
|
int DisposeLibraryData ( void * );
|
||||||
|
void DisposeThreadData ( void * );
|
||||||
|
int GetOrSetUpData ( int id, libdata_t **data, libthreaddata_t **threaddata );
|
||||||
|
|
||||||
|
|
||||||
|
int _NonAppStart( void *NLMHandle,
|
||||||
|
void *errorScreen,
|
||||||
|
const char *cmdLine,
|
||||||
|
const char *loadDirPath,
|
||||||
|
size_t uninitializedDataLength,
|
||||||
|
void *NLMFileHandle,
|
||||||
|
int (*readRoutineP)( int conn,
|
||||||
|
void *fileHandle, size_t offset,
|
||||||
|
size_t nbytes,
|
||||||
|
size_t *bytesRead,
|
||||||
|
void *buffer ),
|
||||||
|
size_t customDataOffset,
|
||||||
|
size_t customDataSize,
|
||||||
|
int messageCount,
|
||||||
|
const char **messages )
|
||||||
|
{
|
||||||
|
NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
|
||||||
|
|
||||||
|
#ifndef __GNUC__
|
||||||
|
#pragma unused(cmdLine)
|
||||||
|
#pragma unused(loadDirPath)
|
||||||
|
#pragma unused(uninitializedDataLength)
|
||||||
|
#pragma unused(NLMFileHandle)
|
||||||
|
#pragma unused(readRoutineP)
|
||||||
|
#pragma unused(customDataOffset)
|
||||||
|
#pragma unused(customDataSize)
|
||||||
|
#pragma unused(messageCount)
|
||||||
|
#pragma unused(messages)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Here we process our command line, post errors (to the error screen),
|
||||||
|
** perform initializations and anything else we need to do before being able
|
||||||
|
** to accept calls into us. If we succeed, we return non-zero and the NetWare
|
||||||
|
** Loader will leave us up, otherwise we fail to load and get dumped.
|
||||||
|
*/
|
||||||
|
gAllocTag = AllocateResourceTag(NLMHandle,
|
||||||
|
"<library-name> memory allocations", AllocSignature);
|
||||||
|
|
||||||
|
if (!gAllocTag) {
|
||||||
|
OutputToScreen(errorScreen, "Unable to allocate resource tag for "
|
||||||
|
"library memory allocations.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gLibId = register_library(DisposeLibraryData);
|
||||||
|
|
||||||
|
if (gLibId < -1) {
|
||||||
|
OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gLibHandle = NLMHandle;
|
||||||
|
|
||||||
|
gLibLock = NXMutexAlloc(0, 0, &liblock);
|
||||||
|
|
||||||
|
if (!gLibLock) {
|
||||||
|
OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Here we clean up any resources we allocated. Resource tags is a big part
|
||||||
|
** of what we created, but NetWare doesn't ask us to free those.
|
||||||
|
*/
|
||||||
|
void _NonAppStop( void )
|
||||||
|
{
|
||||||
|
(void) unregister_library(gLibId);
|
||||||
|
NXMutexFree(gLibLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This function cannot be the first in the file for if the file is linked
|
||||||
|
** first, then the check-unload function's offset will be nlmname.nlm+0
|
||||||
|
** which is how to tell that there isn't one. When the check function is
|
||||||
|
** first in the linked objects, it is ambiguous. For this reason, we will
|
||||||
|
** put it inside this file after the stop function.
|
||||||
|
**
|
||||||
|
** Here we check to see if it's alright to ourselves to be unloaded. If not,
|
||||||
|
** we return a non-zero value. Right now, there isn't any reason not to allow
|
||||||
|
** it.
|
||||||
|
*/
|
||||||
|
int _NonAppCheckUnload( void )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetOrSetUpData(int id, libdata_t **appData, libthreaddata_t **threadData)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
libdata_t *app_data;
|
||||||
|
libthreaddata_t *thread_data;
|
||||||
|
NXKey_t key;
|
||||||
|
NX_LOCK_INFO_ALLOC(liblock, "Application Data Lock", 0);
|
||||||
|
|
||||||
|
err = 0;
|
||||||
|
thread_data = (libthreaddata_t *) NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Attempt to get our data for the application calling us. This is where we
|
||||||
|
** store whatever application-specific information we need to carry in support
|
||||||
|
** of calling applications.
|
||||||
|
*/
|
||||||
|
app_data = (libdata_t *) get_app_data(id);
|
||||||
|
|
||||||
|
if (!app_data) {
|
||||||
|
/*
|
||||||
|
** This application hasn't called us before; set up application AND per-thread
|
||||||
|
** data. Of course, just in case a thread from this same application is calling
|
||||||
|
** us simultaneously, we better lock our application data-creation mutex. We
|
||||||
|
** also need to recheck for data after we acquire the lock because WE might be
|
||||||
|
** that other thread that was too late to create the data and the first thread
|
||||||
|
** in will have created it.
|
||||||
|
*/
|
||||||
|
NXLock(gLibLock);
|
||||||
|
|
||||||
|
if (!(app_data = (libdata_t *) get_app_data(id))) {
|
||||||
|
app_data = (libdata_t *) malloc(sizeof(libdata_t));
|
||||||
|
|
||||||
|
if (app_data) {
|
||||||
|
memset(app_data, 0, sizeof(libdata_t));
|
||||||
|
|
||||||
|
app_data->tenbytes = malloc(10);
|
||||||
|
app_data->lock = NXMutexAlloc(0, 0, &liblock);
|
||||||
|
|
||||||
|
if (!app_data->tenbytes || !app_data->lock) {
|
||||||
|
if (app_data->lock)
|
||||||
|
NXMutexFree(app_data->lock);
|
||||||
|
|
||||||
|
free(app_data);
|
||||||
|
app_data = (libdata_t *) NULL;
|
||||||
|
err = ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app_data) {
|
||||||
|
/*
|
||||||
|
** Here we burn in the application data that we were trying to get by calling
|
||||||
|
** get_app_data(). Next time we call the first function, we'll get this data
|
||||||
|
** we're just now setting. We also go on here to establish the per-thread data
|
||||||
|
** for the calling thread, something we'll have to do on each application
|
||||||
|
** thread the first time it calls us.
|
||||||
|
*/
|
||||||
|
err = set_app_data(gLibId, app_data);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
free(app_data);
|
||||||
|
app_data = (libdata_t *) NULL;
|
||||||
|
err = ENOMEM;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* create key for thread-specific data... */
|
||||||
|
err = NXKeyCreate(DisposeThreadData, (void *) NULL, &key);
|
||||||
|
|
||||||
|
if (err) /* (no more keys left?) */
|
||||||
|
key = -1;
|
||||||
|
|
||||||
|
app_data->perthreadkey = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NXUnlock(gLibLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app_data) {
|
||||||
|
key = app_data->perthreadkey;
|
||||||
|
|
||||||
|
if (key != -1 /* couldn't create a key? no thread data */
|
||||||
|
&& !(err = NXKeyGetValue(key, (void **) &thread_data))
|
||||||
|
&& !thread_data) {
|
||||||
|
/*
|
||||||
|
** Allocate the per-thread data for the calling thread. Regardless of whether
|
||||||
|
** there was already application data or not, this may be the first call by a
|
||||||
|
** a new thread. The fact that we allocation 20 bytes on a pointer is not very
|
||||||
|
** important, this just helps to demonstrate that we can have arbitrarily
|
||||||
|
** complex per-thread data.
|
||||||
|
*/
|
||||||
|
thread_data = (libthreaddata_t *) malloc(sizeof(libthreaddata_t));
|
||||||
|
|
||||||
|
if (thread_data) {
|
||||||
|
thread_data->_errno = 0;
|
||||||
|
thread_data->twentybytes = malloc(20);
|
||||||
|
|
||||||
|
if (!thread_data->twentybytes) {
|
||||||
|
free(thread_data);
|
||||||
|
thread_data = (libthreaddata_t *) NULL;
|
||||||
|
err = ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = NXKeySetValue(key, thread_data))) {
|
||||||
|
free(thread_data->twentybytes);
|
||||||
|
free(thread_data);
|
||||||
|
thread_data = (libthreaddata_t *) NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appData)
|
||||||
|
*appData = app_data;
|
||||||
|
|
||||||
|
if (threadData)
|
||||||
|
*threadData = thread_data;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DisposeLibraryData( void *data )
|
||||||
|
{
|
||||||
|
if (data) {
|
||||||
|
void *tenbytes = ((libdata_t *) data)->tenbytes;
|
||||||
|
|
||||||
|
if (tenbytes)
|
||||||
|
free(tenbytes);
|
||||||
|
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisposeThreadData( void *data )
|
||||||
|
{
|
||||||
|
if (data) {
|
||||||
|
void *twentybytes = ((libthreaddata_t *) data)->twentybytes;
|
||||||
|
|
||||||
|
if (twentybytes)
|
||||||
|
free(twentybytes);
|
||||||
|
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* __NOVELL_LIBC__ */
|
||||||
|
/* For native CLib-based NLM seems we can do a bit more simple. */
|
||||||
|
#include <nwthread.h>
|
||||||
|
|
||||||
|
int main ( void )
|
||||||
|
{
|
||||||
|
/* initialize any globals here... */
|
||||||
|
|
||||||
|
/* do this if any global initializing was done
|
||||||
|
SynchronizeStart();
|
||||||
|
*/
|
||||||
|
ExitThread (TSR_THREAD, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __NOVELL_LIBC__ */
|
||||||
|
|
||||||
|
#endif /* NETWARE */
|
||||||
|
|
||||||
|
|
309
nw/nwlibc.c
309
nw/nwlibc.c
@@ -1,309 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* Universal NetWare library stub. *
|
|
||||||
* written by Ulrich Neuman and given to OpenSource copyright-free. *
|
|
||||||
* version: 1.0 *
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <library.h>
|
|
||||||
#include <netware.h>
|
|
||||||
#include <screen.h>
|
|
||||||
#include <nks/thread.h>
|
|
||||||
#include <nks/synch.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int _errno;
|
|
||||||
void *twentybytes;
|
|
||||||
} libthreaddata_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int z;
|
|
||||||
void *tenbytes;
|
|
||||||
NXKey_t perthreadkey; /* if -1, no key obtained... */
|
|
||||||
NXMutex_t *lock;
|
|
||||||
} libdata_t;
|
|
||||||
|
|
||||||
int gLibId = -1;
|
|
||||||
void *gLibHandle = (void *) NULL;
|
|
||||||
rtag_t gAllocTag = (rtag_t) NULL;
|
|
||||||
NXMutex_t *gLibLock = (NXMutex_t *) NULL;
|
|
||||||
|
|
||||||
/* internal library function prototypes... */
|
|
||||||
int DisposeLibraryData ( void * );
|
|
||||||
void DisposeThreadData ( void * );
|
|
||||||
int GetOrSetUpData ( int id, libdata_t **data, libthreaddata_t **threaddata );
|
|
||||||
|
|
||||||
|
|
||||||
int _NonAppStart
|
|
||||||
(
|
|
||||||
void *NLMHandle,
|
|
||||||
void *errorScreen,
|
|
||||||
const char *cmdLine,
|
|
||||||
const char *loadDirPath,
|
|
||||||
size_t uninitializedDataLength,
|
|
||||||
void *NLMFileHandle,
|
|
||||||
int (*readRoutineP)( int conn, void *fileHandle, size_t offset,
|
|
||||||
size_t nbytes, size_t *bytesRead, void *buffer ),
|
|
||||||
size_t customDataOffset,
|
|
||||||
size_t customDataSize,
|
|
||||||
int messageCount,
|
|
||||||
const char **messages
|
|
||||||
)
|
|
||||||
{
|
|
||||||
NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
|
||||||
#pragma unused(cmdLine)
|
|
||||||
#pragma unused(loadDirPath)
|
|
||||||
#pragma unused(uninitializedDataLength)
|
|
||||||
#pragma unused(NLMFileHandle)
|
|
||||||
#pragma unused(readRoutineP)
|
|
||||||
#pragma unused(customDataOffset)
|
|
||||||
#pragma unused(customDataSize)
|
|
||||||
#pragma unused(messageCount)
|
|
||||||
#pragma unused(messages)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Here we process our command line, post errors (to the error screen),
|
|
||||||
** perform initializations and anything else we need to do before being able
|
|
||||||
** to accept calls into us. If we succeed, we return non-zero and the NetWare
|
|
||||||
** Loader will leave us up, otherwise we fail to load and get dumped.
|
|
||||||
*/
|
|
||||||
gAllocTag = AllocateResourceTag(NLMHandle,
|
|
||||||
"<library-name> memory allocations", AllocSignature);
|
|
||||||
|
|
||||||
if (!gAllocTag)
|
|
||||||
{
|
|
||||||
OutputToScreen(errorScreen, "Unable to allocate resource tag for "
|
|
||||||
"library memory allocations.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gLibId = register_library(DisposeLibraryData);
|
|
||||||
|
|
||||||
if (gLibId < -1)
|
|
||||||
{
|
|
||||||
OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gLibHandle = NLMHandle;
|
|
||||||
|
|
||||||
gLibLock = NXMutexAlloc(0, 0, &liblock);
|
|
||||||
|
|
||||||
if (!gLibLock)
|
|
||||||
{
|
|
||||||
OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Here we clean up any resources we allocated. Resource tags is a big part
|
|
||||||
** of what we created, but NetWare doesn't ask us to free those.
|
|
||||||
*/
|
|
||||||
void _NonAppStop( void )
|
|
||||||
{
|
|
||||||
(void) unregister_library(gLibId);
|
|
||||||
NXMutexFree(gLibLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** This function cannot be the first in the file for if the file is linked
|
|
||||||
** first, then the check-unload function's offset will be nlmname.nlm+0
|
|
||||||
** which is how to tell that there isn't one. When the check function is
|
|
||||||
** first in the linked objects, it is ambiguous. For this reason, we will
|
|
||||||
** put it inside this file after the stop function.
|
|
||||||
**
|
|
||||||
** Here we check to see if it's alright to ourselves to be unloaded. If not,
|
|
||||||
** we return a non-zero value. Right now, there isn't any reason not to allow
|
|
||||||
** it.
|
|
||||||
*/
|
|
||||||
int _NonAppCheckUnload( void )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetOrSetUpData
|
|
||||||
(
|
|
||||||
int id,
|
|
||||||
libdata_t **appData,
|
|
||||||
libthreaddata_t **threadData
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
libdata_t *app_data;
|
|
||||||
libthreaddata_t *thread_data;
|
|
||||||
NXKey_t key;
|
|
||||||
NX_LOCK_INFO_ALLOC(liblock, "Application Data Lock", 0);
|
|
||||||
|
|
||||||
err = 0;
|
|
||||||
thread_data = (libthreaddata_t *) NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Attempt to get our data for the application calling us. This is where we
|
|
||||||
** store whatever application-specific information we need to carry in support
|
|
||||||
** of calling applications.
|
|
||||||
*/
|
|
||||||
app_data = (libdata_t *) get_app_data(id);
|
|
||||||
|
|
||||||
if (!app_data)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** This application hasn't called us before; set up application AND per-thread
|
|
||||||
** data. Of course, just in case a thread from this same application is calling
|
|
||||||
** us simultaneously, we better lock our application data-creation mutex. We
|
|
||||||
** also need to recheck for data after we acquire the lock because WE might be
|
|
||||||
** that other thread that was too late to create the data and the first thread
|
|
||||||
** in will have created it.
|
|
||||||
*/
|
|
||||||
NXLock(gLibLock);
|
|
||||||
|
|
||||||
if (!(app_data = (libdata_t *) get_app_data(id)))
|
|
||||||
{
|
|
||||||
app_data = (libdata_t *) malloc(sizeof(libdata_t));
|
|
||||||
|
|
||||||
if (app_data)
|
|
||||||
{
|
|
||||||
memset(app_data, 0, sizeof(libdata_t));
|
|
||||||
|
|
||||||
app_data->tenbytes = malloc(10);
|
|
||||||
app_data->lock = NXMutexAlloc(0, 0, &liblock);
|
|
||||||
|
|
||||||
if (!app_data->tenbytes || !app_data->lock)
|
|
||||||
{
|
|
||||||
if (app_data->lock)
|
|
||||||
NXMutexFree(app_data->lock);
|
|
||||||
|
|
||||||
free(app_data);
|
|
||||||
app_data = (libdata_t *) NULL;
|
|
||||||
err = ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app_data)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** Here we burn in the application data that we were trying to get by calling
|
|
||||||
** get_app_data(). Next time we call the first function, we'll get this data
|
|
||||||
** we're just now setting. We also go on here to establish the per-thread data
|
|
||||||
** for the calling thread, something we'll have to do on each application
|
|
||||||
** thread the first time it calls us.
|
|
||||||
*/
|
|
||||||
err = set_app_data(gLibId, app_data);
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
free(app_data);
|
|
||||||
app_data = (libdata_t *) NULL;
|
|
||||||
err = ENOMEM;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* create key for thread-specific data... */
|
|
||||||
err = NXKeyCreate(DisposeThreadData, (void *) NULL, &key);
|
|
||||||
|
|
||||||
if (err) /* (no more keys left?) */
|
|
||||||
key = -1;
|
|
||||||
|
|
||||||
app_data->perthreadkey = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NXUnlock(gLibLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app_data)
|
|
||||||
{
|
|
||||||
key = app_data->perthreadkey;
|
|
||||||
|
|
||||||
if ( key != -1 /* couldn't create a key? no thread data */
|
|
||||||
&& !(err = NXKeyGetValue(key, (void **) &thread_data))
|
|
||||||
&& !thread_data)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** Allocate the per-thread data for the calling thread. Regardless of whether
|
|
||||||
** there was already application data or not, this may be the first call by a
|
|
||||||
** a new thread. The fact that we allocation 20 bytes on a pointer is not very
|
|
||||||
** important, this just helps to demonstrate that we can have arbitrarily
|
|
||||||
** complex per-thread data.
|
|
||||||
*/
|
|
||||||
thread_data = (libthreaddata_t *) malloc(sizeof(libthreaddata_t));
|
|
||||||
|
|
||||||
if (thread_data)
|
|
||||||
{
|
|
||||||
thread_data->_errno = 0;
|
|
||||||
thread_data->twentybytes = malloc(20);
|
|
||||||
|
|
||||||
if (!thread_data->twentybytes)
|
|
||||||
{
|
|
||||||
free(thread_data);
|
|
||||||
thread_data = (libthreaddata_t *) NULL;
|
|
||||||
err = ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((err = NXKeySetValue(key, thread_data)))
|
|
||||||
{
|
|
||||||
free(thread_data->twentybytes);
|
|
||||||
free(thread_data);
|
|
||||||
thread_data = (libthreaddata_t *) NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (appData)
|
|
||||||
*appData = app_data;
|
|
||||||
|
|
||||||
if (threadData)
|
|
||||||
*threadData = thread_data;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DisposeLibraryData
|
|
||||||
(
|
|
||||||
void *data
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
void *tenbytes = ((libdata_t *) data)->tenbytes;
|
|
||||||
|
|
||||||
if (tenbytes)
|
|
||||||
free(tenbytes);
|
|
||||||
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisposeThreadData
|
|
||||||
(
|
|
||||||
void *data
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
void *twentybytes = ((libthreaddata_t *) data)->twentybytes;
|
|
||||||
|
|
||||||
if (twentybytes)
|
|
||||||
free(twentybytes);
|
|
||||||
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@@ -5,7 +5,7 @@
|
|||||||
##
|
##
|
||||||
## Comments to: Guenter Knauf <eflash@gmx.net>
|
## Comments to: Guenter Knauf <eflash@gmx.net>
|
||||||
##
|
##
|
||||||
## $Id: Makefile.netware,v 1.5 2007/04/21 21:26:54 gknauf Exp $
|
## $Id: Makefile.netware,v 1.7 2007/07/15 20:34:33 gknauf Exp $
|
||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
@@ -28,17 +28,18 @@ endif
|
|||||||
LINK_STATIC = 1
|
LINK_STATIC = 1
|
||||||
|
|
||||||
# Edit the vars below to change NLM target settings.
|
# Edit the vars below to change NLM target settings.
|
||||||
TARGETS = scp.nlm sftp.nlm sftpdir.nlm ssh2.nlm
|
SAMPLES = ../../example/simple
|
||||||
|
TARGETS := $(patsubst $(SAMPLES)/%.c,%.nlm,$(strip $(wildcard $(SAMPLES)/*.c)))
|
||||||
VERSION = $(LIBSSH2_VERSION)
|
VERSION = $(LIBSSH2_VERSION)
|
||||||
COPYR = Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
|
COPYR = Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
|
||||||
WWWURL = http://www.libssh2.org/
|
WWWURL = http://www.libssh2.org/
|
||||||
DESCR = libssh2 $(notdir $(@:.def=)) $(LIBSSH2_VERSION_STR) - $(WWWURL)
|
DESCR = libssh2 $(notdir $(@:.def=)) $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL)
|
||||||
MTSAFE = YES
|
MTSAFE = YES
|
||||||
STACK = 64000
|
STACK = 64000
|
||||||
SCREEN = NONE
|
SCREEN = NONE
|
||||||
#SCREEN = libssh2 $(notdir $(@:.def=))
|
#SCREEN = libssh2 $(notdir $(@:.def=))
|
||||||
# Comment the line below if you dont want to load protected automatically.
|
# Comment the line below if you dont want to load protected automatically.
|
||||||
LDRING = 3
|
#LDRING = 3
|
||||||
|
|
||||||
# Edit the var below to point to your lib architecture.
|
# Edit the var below to point to your lib architecture.
|
||||||
ifndef LIBARCH
|
ifndef LIBARCH
|
||||||
@@ -56,14 +57,17 @@ ifeq ($(DB),NDEBUG)
|
|||||||
OBJDIR = release
|
OBJDIR = release
|
||||||
else
|
else
|
||||||
OPT = -g
|
OPT = -g
|
||||||
|
OPT += -DLIBSSH2DEBUG
|
||||||
OBJDIR = debug
|
OBJDIR = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the version info retrieved from xml2ver.h
|
# The following lines defines your compiler.
|
||||||
-include $(OBJDIR)/version.inc
|
ifdef CWFolder
|
||||||
|
METROWERKS = $(CWFolder)
|
||||||
# The following line defines your compiler.
|
endif
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
|
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
|
||||||
|
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
|
||||||
CC = mwccnlm
|
CC = mwccnlm
|
||||||
else
|
else
|
||||||
CC = gcc
|
CC = gcc
|
||||||
@@ -78,8 +82,14 @@ AWK = awk
|
|||||||
# http://www.gknw.net/development/prgtools/mkxdc.zip
|
# http://www.gknw.net/development/prgtools/mkxdc.zip
|
||||||
MPKXDC = mkxdc
|
MPKXDC = mkxdc
|
||||||
|
|
||||||
|
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
|
||||||
|
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
|
||||||
|
|
||||||
|
# Include the version info retrieved from libssh2.h
|
||||||
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc
|
||||||
|
|
||||||
ifeq ($(CC),mwccnlm)
|
ifeq ($(CC),mwccnlm)
|
||||||
LD = mwldnlm
|
LD = mwldnlm
|
||||||
@@ -94,8 +104,10 @@ ifeq ($(LIBARCH),LIBC)
|
|||||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||||
CFLAGS += -align 4
|
CFLAGS += -align 4
|
||||||
else
|
else
|
||||||
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
|
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
|
||||||
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
|
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
||||||
|
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
|
||||||
|
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
|
||||||
CFLAGS += -align 1
|
CFLAGS += -align 1
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
@@ -117,16 +129,27 @@ endif
|
|||||||
NDK_ROOT = $(NDKBASE)/ndk
|
NDK_ROOT = $(NDKBASE)/ndk
|
||||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
||||||
SDK_LIBC = $(NDK_ROOT)/libc
|
SDK_LIBC = $(NDK_ROOT)/libc
|
||||||
SDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
|
SNPRINTF = $(NDKBASE)/snprintf
|
||||||
|
|
||||||
INCLUDES = -I. -I.. -I../../include
|
INCLUDES = -I.. -I../../include
|
||||||
|
|
||||||
LDLIBS =
|
LDLIBS =
|
||||||
|
|
||||||
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_libc -I$(OPENSSL_PATH)/outinc_nw_libc/openssl
|
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl
|
||||||
LDLIBS += $(OPENSSL_PATH)/out_nw_libc/ssl.$(LIBEXT) $(OPENSSL_PATH)/out_nw_libc/crypto.$(LIBEXT)
|
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
|
||||||
|
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
|
||||||
IMPORTS += GetProcessSwitchCount RunningProcess
|
IMPORTS += GetProcessSwitchCount RunningProcess
|
||||||
|
|
||||||
|
ifdef WITH_ZLIB
|
||||||
|
INCLUDES += -I$(ZLIB_PATH)
|
||||||
|
ifdef LINK_STATIC
|
||||||
|
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
|
||||||
|
else
|
||||||
|
MODULES += libz.nlm
|
||||||
|
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef LINK_STATIC
|
ifdef LINK_STATIC
|
||||||
LDLIBS += ../libssh2.$(LIBEXT)
|
LDLIBS += ../libssh2.$(LIBEXT)
|
||||||
else
|
else
|
||||||
@@ -134,27 +157,16 @@ else
|
|||||||
MODULES += libssh2.nlm
|
MODULES += libssh2.nlm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef WITH_ZLIB
|
|
||||||
INCLUDES += -I$(ZLIB_PATH)
|
|
||||||
ifdef LINK_STATIC
|
|
||||||
LDLIBS += $(ZLIB_PATH)/nw/libz.$(LIBEXT)
|
|
||||||
else
|
|
||||||
IMPORTS += @$(ZLIB_PATH)/nw/libz.imp
|
|
||||||
MODULES += libz.nlm
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(LIBARCH),LIBC)
|
ifeq ($(LIBARCH),LIBC)
|
||||||
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
|
INCLUDES += -I$(SDK_LIBC)/include
|
||||||
|
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
||||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||||
# INCLUDES += -I$(SDK_LDAP)/libc/inc
|
|
||||||
CFLAGS += -D_POSIX_SOURCE
|
CFLAGS += -D_POSIX_SOURCE
|
||||||
# CFLAGS += -D__ANSIC__
|
|
||||||
else
|
else
|
||||||
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
|
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
||||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||||
# INCLUDES += -I$(SDK_LDAP)/clib/inc
|
# INCLUDES += -I$(SDK_CLIB)/include
|
||||||
CFLAGS += -DNETDB_USE_INTERNET
|
# CFLAGS += -DNETDB_USE_INTERNET
|
||||||
endif
|
endif
|
||||||
CFLAGS += $(INCLUDES)
|
CFLAGS += $(INCLUDES)
|
||||||
|
|
||||||
@@ -167,10 +179,9 @@ endif
|
|||||||
|
|
||||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
||||||
DL = '
|
DL = '
|
||||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
vpath %.c ../../example/simple
|
vpath %.c $(SAMPLES)
|
||||||
|
|
||||||
.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc
|
.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.am,v 1.9 2007/04/05 10:23:55 jas4711 Exp $
|
# $Id: Makefile.am,v 1.10 2007/07/17 13:22:55 gknauf Exp $
|
||||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
|
|
||||||
libssh2_la_SOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c \
|
libssh2_la_SOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c \
|
||||||
@@ -11,7 +11,7 @@ else
|
|||||||
libssh2_la_SOURCES += openssl.c
|
libssh2_la_SOURCES += openssl.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST = libssh2_config.h.in
|
EXTRA_DIST = libssh2_config.h.in NMakefile
|
||||||
|
|
||||||
lib_LTLIBRARIES = libssh2.la
|
lib_LTLIBRARIES = libssh2.la
|
||||||
|
|
||||||
|
@@ -2,10 +2,23 @@
|
|||||||
|
|
||||||
CFLAGS=$(CFLAGS)
|
CFLAGS=$(CFLAGS)
|
||||||
|
|
||||||
OBJECTS = $(INTDIR)\channel.obj $(INTDIR)\comp.obj $(INTDIR)\crypt.obj \
|
OBJECTS = \
|
||||||
$(INTDIR)\hostkey.obj $(INTDIR)\kex.obj $(INTDIR)\mac.obj \
|
$(INTDIR)\channel.obj \
|
||||||
$(INTDIR)\misc.obj $(INTDIR)\packet.obj $(INTDIR)\scp.obj \
|
$(INTDIR)\comp.obj \
|
||||||
$(INTDIR)\session.obj $(INTDIR)\sftp.obj $(INTDIR)\userauth.obj
|
$(INTDIR)\crypt.obj \
|
||||||
|
$(INTDIR)\hostkey.obj \
|
||||||
|
$(INTDIR)\kex.obj \
|
||||||
|
$(INTDIR)\mac.obj \
|
||||||
|
$(INTDIR)\misc.obj \
|
||||||
|
$(INTDIR)\openssl.obj \
|
||||||
|
$(INTDIR)\packet.obj \
|
||||||
|
$(INTDIR)\pem.obj \
|
||||||
|
$(INTDIR)\publickey.obj \
|
||||||
|
$(INTDIR)\scp.obj \
|
||||||
|
$(INTDIR)\session.obj \
|
||||||
|
$(INTDIR)\sftp.obj \
|
||||||
|
$(INTDIR)\transport.obj \
|
||||||
|
$(INTDIR)\userauth.obj
|
||||||
|
|
||||||
DLL=libssh2$(SUFFIX).dll
|
DLL=libssh2$(SUFFIX).dll
|
||||||
|
|
||||||
|
@@ -1172,7 +1172,7 @@ libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, int ignore_mode)
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* {{{ _libssh2_channel_read_ex
|
* {{{ libssh2_channel_read_ex
|
||||||
* Read data from a channel blocking or non-blocking depending on set state
|
* Read data from a channel blocking or non-blocking depending on set state
|
||||||
*
|
*
|
||||||
* When this is done non-blocking, it is important to not return 0 until the
|
* When this is done non-blocking, it is important to not return 0 until the
|
||||||
@@ -1329,6 +1329,52 @@ channel_read_ex_point1:
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* {{{ libssh2_channel_packet_data_len
|
||||||
|
* Return the size of the data block of the current packet, or 0 if there
|
||||||
|
* isn't a packet.
|
||||||
|
*/
|
||||||
|
unsigned long
|
||||||
|
libssh2_channel_packet_data_len(LIBSSH2_CHANNEL *channel, int stream_id)
|
||||||
|
{
|
||||||
|
LIBSSH2_SESSION *session = channel->session;
|
||||||
|
LIBSSH2_PACKET *read_packet;
|
||||||
|
uint32_t read_local_id;
|
||||||
|
|
||||||
|
if ((read_packet = session->packets.head) == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (read_packet) {
|
||||||
|
read_local_id = libssh2_ntohu32(read_packet->data + 1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Either we asked for a specific extended data stream
|
||||||
|
* (and data was available),
|
||||||
|
* or the standard stream (and data was available),
|
||||||
|
* or the standard stream with extended_data_merge
|
||||||
|
* enabled and data was available
|
||||||
|
*/
|
||||||
|
if ((stream_id && (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
|
||||||
|
(channel->local.id == read_local_id) &&
|
||||||
|
(stream_id == (int)libssh2_ntohu32(read_packet->data + 5))) ||
|
||||||
|
|
||||||
|
(!stream_id && (read_packet->data[0] == SSH_MSG_CHANNEL_DATA) &&
|
||||||
|
(channel->local.id == read_local_id)) ||
|
||||||
|
|
||||||
|
(!stream_id && (read_packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) &&
|
||||||
|
(channel->local.id == read_local_id) &&
|
||||||
|
(channel->remote.extended_data_ignore_mode == LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) {
|
||||||
|
|
||||||
|
return (read_packet->data_len - read_packet->data_head);
|
||||||
|
}
|
||||||
|
read_packet = read_packet->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ libssh2_channel_write_ex
|
/* {{{ libssh2_channel_write_ex
|
||||||
* Send data to a channel
|
* Send data to a channel
|
||||||
*/
|
*/
|
||||||
@@ -1684,10 +1730,7 @@ LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel)
|
|||||||
/* Allow channel freeing even when the socket has lost its connection */
|
/* Allow channel freeing even when the socket has lost its connection */
|
||||||
if (!channel->local.close && (session->socket_state == LIBSSH2_SOCKET_CONNECTED)) {
|
if (!channel->local.close && (session->socket_state == LIBSSH2_SOCKET_CONNECTED)) {
|
||||||
while ((rc = libssh2_channel_close(channel)) == PACKET_EAGAIN);
|
while ((rc = libssh2_channel_close(channel)) == PACKET_EAGAIN);
|
||||||
if (rc == PACKET_EAGAIN) {
|
if (rc) {
|
||||||
return PACKET_EAGAIN;
|
|
||||||
}
|
|
||||||
else if (rc) {
|
|
||||||
channel->free_state = libssh2_NB_state_idle;
|
channel->free_state = libssh2_NB_state_idle;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -487,6 +487,7 @@ struct _LIBSSH2_SFTP_HANDLE {
|
|||||||
/* State variables used in libssh2_sftp_close_handle() */
|
/* State variables used in libssh2_sftp_close_handle() */
|
||||||
libssh2_nonblocking_states close_state;
|
libssh2_nonblocking_states close_state;
|
||||||
unsigned long close_request_id;
|
unsigned long close_request_id;
|
||||||
|
unsigned char *close_packet;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _LIBSSH2_SFTP {
|
struct _LIBSSH2_SFTP {
|
||||||
@@ -790,6 +791,8 @@ struct _LIBSSH2_SESSION {
|
|||||||
long scpRecv_size;
|
long scpRecv_size;
|
||||||
long scpRecv_mtime;
|
long scpRecv_mtime;
|
||||||
long scpRecv_atime;
|
long scpRecv_atime;
|
||||||
|
char *scpRecv_err_msg;
|
||||||
|
long scpRecv_err_len;
|
||||||
LIBSSH2_CHANNEL *scpRecv_channel;
|
LIBSSH2_CHANNEL *scpRecv_channel;
|
||||||
|
|
||||||
/* State variables used in libssh2_scp_send_ex() */
|
/* State variables used in libssh2_scp_send_ex() */
|
||||||
@@ -798,6 +801,8 @@ struct _LIBSSH2_SESSION {
|
|||||||
unsigned long scpSend_command_len;
|
unsigned long scpSend_command_len;
|
||||||
unsigned char scpSend_response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
unsigned char scpSend_response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
||||||
unsigned long scpSend_response_len;
|
unsigned long scpSend_response_len;
|
||||||
|
char *scpSend_err_msg;
|
||||||
|
long scpSend_err_len;
|
||||||
LIBSSH2_CHANNEL *scpSend_channel;
|
LIBSSH2_CHANNEL *scpSend_channel;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1041,6 +1046,7 @@ int libssh2_packet_add(LIBSSH2_SESSION *session, unsigned char *data, size_t dat
|
|||||||
int libssh2_kex_exchange(LIBSSH2_SESSION *session, int reexchange, key_exchange_state_t *state);
|
int libssh2_kex_exchange(LIBSSH2_SESSION *session, int reexchange, key_exchange_state_t *state);
|
||||||
unsigned long libssh2_channel_nextid(LIBSSH2_SESSION *session);
|
unsigned long libssh2_channel_nextid(LIBSSH2_SESSION *session);
|
||||||
LIBSSH2_CHANNEL *libssh2_channel_locate(LIBSSH2_SESSION *session, unsigned long channel_id);
|
LIBSSH2_CHANNEL *libssh2_channel_locate(LIBSSH2_SESSION *session, unsigned long channel_id);
|
||||||
|
unsigned long libssh2_channel_packet_data_len(LIBSSH2_CHANNEL *channel, int stream_id);
|
||||||
|
|
||||||
/* this is the lib-internal set blocking function */
|
/* this is the lib-internal set blocking function */
|
||||||
int _libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking);
|
int _libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking);
|
||||||
|
@@ -43,11 +43,11 @@ static int readline (char *line, int line_size, FILE *fp)
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (*line && line[strlen(line) - 1] == '\r')
|
if (*line && line[strlen(line) - 1] == '\n')
|
||||||
{
|
{
|
||||||
line[strlen(line) - 1] = '\0';
|
line[strlen(line) - 1] = '\0';
|
||||||
}
|
}
|
||||||
if (*line && line[strlen(line) - 1] == '\n')
|
if (*line && line[strlen(line) - 1] == '\r')
|
||||||
{
|
{
|
||||||
line[strlen(line) - 1] = '\0';
|
line[strlen(line) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
62
src/scp.c
62
src/scp.c
@@ -162,7 +162,34 @@ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, const ch
|
|||||||
session->scpRecv_response_len++;
|
session->scpRecv_response_len++;
|
||||||
|
|
||||||
if (session->scpRecv_response[0] != 'T') {
|
if (session->scpRecv_response[0] != 'T') {
|
||||||
|
/*
|
||||||
|
* Set this as the default error for here, if
|
||||||
|
* we are successful it will be replaced
|
||||||
|
*/
|
||||||
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid data in SCP response, missing Time data", 0);
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid data in SCP response, missing Time data", 0);
|
||||||
|
|
||||||
|
session->scpRecv_err_len = libssh2_channel_packet_data_len(session->scpRecv_channel, 0);
|
||||||
|
session->scpRecv_err_msg = LIBSSH2_ALLOC(session, session->scpRecv_err_len+1);
|
||||||
|
if (!session->scpRecv_err_msg) {
|
||||||
|
goto scp_recv_error;
|
||||||
|
}
|
||||||
|
memset(session->scpRecv_err_msg, 0, session->scpRecv_err_len+1);
|
||||||
|
|
||||||
|
/* Read the remote error message */
|
||||||
|
rc = libssh2_channel_read_ex(session->scpRecv_channel, 0, session->scpRecv_err_msg, session->scpRecv_err_len);
|
||||||
|
if (rc <= 0) {
|
||||||
|
/*
|
||||||
|
* Since we have alread started reading this packet, it is
|
||||||
|
* already in the systems so it can't return PACKET_EAGAIN
|
||||||
|
*/
|
||||||
|
LIBSSH2_FREE(session, session->scpRecv_err_msg);
|
||||||
|
session->scpRecv_err_msg = NULL;
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Unknown error while getting error string", 0);
|
||||||
|
goto scp_recv_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, session->scpRecv_err_msg, 1);
|
||||||
|
session->scpRecv_err_msg = NULL;
|
||||||
goto scp_recv_error;
|
goto scp_recv_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,6 +506,7 @@ libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t
|
|||||||
/* previous call set libssh2_session_last_error(), pass it through */
|
/* previous call set libssh2_session_last_error(), pass it through */
|
||||||
LIBSSH2_FREE(session, session->scpSend_command);
|
LIBSSH2_FREE(session, session->scpSend_command);
|
||||||
session->scpSend_command = NULL;
|
session->scpSend_command = NULL;
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Unknown error while getting error string", 0);
|
||||||
goto scp_send_error;
|
goto scp_send_error;
|
||||||
}
|
}
|
||||||
LIBSSH2_FREE(session, session->scpSend_command);
|
LIBSSH2_FREE(session, session->scpSend_command);
|
||||||
@@ -577,16 +605,48 @@ libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t
|
|||||||
session->scpSend_state = libssh2_NB_state_sent6;
|
session->scpSend_state = libssh2_NB_state_sent6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (session->scpSend_state == libssh2_NB_state_sent6) {
|
||||||
/* Wait for ACK */
|
/* Wait for ACK */
|
||||||
rc = libssh2_channel_read_ex(session->scpSend_channel, 0, (char *)session->scpSend_response, 1);
|
rc = libssh2_channel_read_ex(session->scpSend_channel, 0, (char *)session->scpSend_response, 1);
|
||||||
if (rc == PACKET_EAGAIN) {
|
if (rc == PACKET_EAGAIN) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block waiting for response", 0);
|
libssh2_error(session, LIBSSH2_ERROR_EAGAIN, "Would block waiting for response", 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if ((rc <= 0) || (session->scpSend_response[0] != 0)) {
|
else if (rc <= 0) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid ACK response from remote", 0);
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid ACK response from remote", 0);
|
||||||
goto scp_send_error;
|
goto scp_send_error;
|
||||||
}
|
}
|
||||||
|
else if (session->scpSend_response[0] != 0) {
|
||||||
|
/*
|
||||||
|
* Set this as the default error for here, if
|
||||||
|
* we are successful it will be replaced
|
||||||
|
*/
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid ACK response from remote", 0);
|
||||||
|
|
||||||
|
session->scpSend_err_len = libssh2_channel_packet_data_len(session->scpSend_channel, 0);
|
||||||
|
session->scpSend_err_msg = LIBSSH2_ALLOC(session, session->scpSend_err_len+1);
|
||||||
|
if (!session->scpSend_err_msg) {
|
||||||
|
goto scp_send_error;
|
||||||
|
}
|
||||||
|
memset(session->scpSend_err_msg, 0, session->scpSend_err_len+1);
|
||||||
|
|
||||||
|
/* Read the remote error message */
|
||||||
|
rc = libssh2_channel_read_ex(session->scpSend_channel, 0, session->scpSend_err_msg, session->scpSend_err_len);
|
||||||
|
if (rc <= 0) {
|
||||||
|
/*
|
||||||
|
* Since we have alread started reading this packet, it is
|
||||||
|
* already in the systems so it can't return PACKET_EAGAIN
|
||||||
|
*/
|
||||||
|
LIBSSH2_FREE(session, session->scpSend_err_msg);
|
||||||
|
session->scpSend_err_msg = NULL;
|
||||||
|
goto scp_send_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, session->scpSend_err_msg, 1);
|
||||||
|
session->scpSend_err_msg = NULL;
|
||||||
|
goto scp_send_error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session->scpSend_state = libssh2_NB_state_idle;
|
session->scpSend_state = libssh2_NB_state_idle;
|
||||||
|
|
||||||
|
@@ -46,6 +46,9 @@
|
|||||||
#ifdef HAVE_GETTIMEOFDAY
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ALLOCA_H
|
||||||
|
#include <alloca.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* {{{ libssh2_default_alloc
|
/* {{{ libssh2_default_alloc
|
||||||
*/
|
*/
|
||||||
@@ -432,8 +435,12 @@ LIBSSH2_API LIBSSH2_SESSION *libssh2_session_init_ex(
|
|||||||
/* {{{ libssh2_session_callback_set
|
/* {{{ libssh2_session_callback_set
|
||||||
* Set (or reset) a callback function
|
* Set (or reset) a callback function
|
||||||
* Returns the prior address
|
* Returns the prior address
|
||||||
|
*
|
||||||
|
* FIXME: this function relies on that we can typecast function pointers
|
||||||
|
* to void pointers, which isn't allowed in ISO C!
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API void* libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callback)
|
LIBSSH2_API void* libssh2_session_callback_set(LIBSSH2_SESSION *session,
|
||||||
|
int cbtype, void *callback)
|
||||||
{
|
{
|
||||||
void *oldcb;
|
void *oldcb;
|
||||||
|
|
||||||
@@ -805,6 +812,17 @@ LIBSSH2_API int libssh2_session_free(LIBSSH2_SESSION *session)
|
|||||||
if (session->scpSend_command) {
|
if (session->scpSend_command) {
|
||||||
LIBSSH2_FREE(session, session->scpSend_command);
|
LIBSSH2_FREE(session, session->scpSend_command);
|
||||||
}
|
}
|
||||||
|
if (session->scpRecv_err_msg) {
|
||||||
|
LIBSSH2_FREE(session, session->scpRecv_err_msg);
|
||||||
|
}
|
||||||
|
if (session->scpSend_err_msg) {
|
||||||
|
LIBSSH2_FREE(session, session->scpSend_err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free the error message, if we ar supposed to */
|
||||||
|
if (session->err_msg && session->err_should_free) {
|
||||||
|
LIBSSH2_FREE(session, session->err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Cleanup any remaining packets */
|
/* Cleanup any remaining packets */
|
||||||
while (session->packets.head) {
|
while (session->packets.head) {
|
||||||
@@ -1131,12 +1149,16 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeou
|
|||||||
unsigned int i, active_fds;
|
unsigned int i, active_fds;
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
LIBSSH2_SESSION *session = NULL;
|
LIBSSH2_SESSION *session = NULL;
|
||||||
struct pollfd sockets[nfds];
|
#ifdef HAVE_ALLOCA
|
||||||
/* FIXME: (dast) this is not C89 code! However, the prototype for this
|
struct pollfd *sockets = alloca(sizeof(struct pollfd) * nfds);
|
||||||
function doesn't provide a session struct so we can't easily use
|
#else
|
||||||
the user-provided malloc replacement here... I suggest we modify
|
struct pollfd sockets[256];
|
||||||
the proto to make it possible. */
|
|
||||||
|
|
||||||
|
if(nfds > 256)
|
||||||
|
/* systems without alloca use a fixed-size array, this can be fixed
|
||||||
|
if we really want to, at least if the compiler is a C99 capable one */
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
/* Setup sockets for polling */
|
/* Setup sockets for polling */
|
||||||
for(i = 0; i < nfds; i++) {
|
for(i = 0; i < nfds; i++) {
|
||||||
fds[i].revents = 0;
|
fds[i].revents = 0;
|
||||||
@@ -1181,29 +1203,35 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeou
|
|||||||
case LIBSSH2_POLLFD_SOCKET:
|
case LIBSSH2_POLLFD_SOCKET:
|
||||||
if (fds[i].events & LIBSSH2_POLLFD_POLLIN) {
|
if (fds[i].events & LIBSSH2_POLLFD_POLLIN) {
|
||||||
FD_SET(fds[i].fd.socket, &rfds);
|
FD_SET(fds[i].fd.socket, &rfds);
|
||||||
if (fds[i].fd.socket > maxfd) maxfd = fds[i].fd.socket;
|
if (fds[i].fd.socket > maxfd)
|
||||||
|
maxfd = fds[i].fd.socket;
|
||||||
}
|
}
|
||||||
if (fds[i].events & LIBSSH2_POLLFD_POLLOUT) {
|
if (fds[i].events & LIBSSH2_POLLFD_POLLOUT) {
|
||||||
FD_SET(fds[i].fd.socket, &wfds);
|
FD_SET(fds[i].fd.socket, &wfds);
|
||||||
if (fds[i].fd.socket > maxfd) maxfd = fds[i].fd.socket;
|
if (fds[i].fd.socket > maxfd)
|
||||||
|
maxfd = fds[i].fd.socket;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIBSSH2_POLLFD_CHANNEL:
|
case LIBSSH2_POLLFD_CHANNEL:
|
||||||
FD_SET(fds[i].fd.channel->session->socket_fd, &rfds);
|
FD_SET(fds[i].fd.channel->session->socket_fd, &rfds);
|
||||||
if (fds[i].fd.channel->session->socket_fd > maxfd) maxfd = fds[i].fd.channel->session->socket_fd;
|
if (fds[i].fd.channel->session->socket_fd > maxfd)
|
||||||
|
maxfd = fds[i].fd.channel->session->socket_fd;
|
||||||
if (!session) session = fds[i].fd.channel->session;
|
if (!session) session = fds[i].fd.channel->session;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIBSSH2_POLLFD_LISTENER:
|
case LIBSSH2_POLLFD_LISTENER:
|
||||||
FD_SET(fds[i].fd.listener->session->socket_fd, &rfds);
|
FD_SET(fds[i].fd.listener->session->socket_fd, &rfds);
|
||||||
if (fds[i].fd.listener->session->socket_fd > maxfd) maxfd = fds[i].fd.listener->session->socket_fd;
|
if (fds[i].fd.listener->session->socket_fd > maxfd)
|
||||||
|
maxfd = fds[i].fd.listener->session->socket_fd;
|
||||||
if (!session) session = fds[i].fd.listener->session;
|
if (!session) session = fds[i].fd.listener->session;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (session) libssh2_error(session, LIBSSH2_ERROR_INVALID_POLL_TYPE,
|
if (session)
|
||||||
"Invalid descriptor passed to libssh2_poll()", 0);
|
libssh2_error(session, LIBSSH2_ERROR_INVALID_POLL_TYPE,
|
||||||
|
"Invalid descriptor passed to libssh2_poll()",
|
||||||
|
0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
src/sftp.c
14
src/sftp.c
@@ -1375,13 +1375,13 @@ LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle)
|
|||||||
unsigned long data_len, retcode;
|
unsigned long data_len, retcode;
|
||||||
/* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
|
/* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
|
||||||
ssize_t packet_len = handle->handle_len + 13;
|
ssize_t packet_len = handle->handle_len + 13;
|
||||||
unsigned char *packet, *s, *data;
|
unsigned char *s, *data;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (handle->close_state == libssh2_NB_state_idle) {
|
if (handle->close_state == libssh2_NB_state_idle) {
|
||||||
_libssh2_debug(session, LIBSSH2_DBG_SFTP, "Closing handle");
|
_libssh2_debug(session, LIBSSH2_DBG_SFTP, "Closing handle");
|
||||||
s = packet = LIBSSH2_ALLOC(session, packet_len);
|
s = handle->close_packet = LIBSSH2_ALLOC(session, packet_len);
|
||||||
if (!packet) {
|
if (!handle->close_packet) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for FXP_CLOSE packet", 0);
|
libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for FXP_CLOSE packet", 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1397,17 +1397,19 @@ LIBSSH2_API int libssh2_sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handle->close_state == libssh2_NB_state_created) {
|
if (handle->close_state == libssh2_NB_state_created) {
|
||||||
rc = libssh2_channel_write_ex(channel, 0, (char *)packet, packet_len);
|
rc = libssh2_channel_write_ex(channel, 0, (char *)handle->close_packet, packet_len);
|
||||||
if (rc == PACKET_EAGAIN) {
|
if (rc == PACKET_EAGAIN) {
|
||||||
return PACKET_EAGAIN;
|
return PACKET_EAGAIN;
|
||||||
}
|
}
|
||||||
else if (packet_len != rc) {
|
else if (packet_len != rc) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send FXP_CLOSE command", 0);
|
libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send FXP_CLOSE command", 0);
|
||||||
LIBSSH2_FREE(session, packet);
|
LIBSSH2_FREE(session, handle->close_packet);
|
||||||
|
handle->close_packet = NULL;
|
||||||
handle->close_state = libssh2_NB_state_idle;
|
handle->close_state = libssh2_NB_state_idle;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LIBSSH2_FREE(session, packet);
|
LIBSSH2_FREE(session, handle->close_packet);
|
||||||
|
handle->close_packet = NULL;
|
||||||
|
|
||||||
handle->close_state = libssh2_NB_state_sent;
|
handle->close_state = libssh2_NB_state_sent;
|
||||||
}
|
}
|
||||||
|
@@ -957,7 +957,7 @@ libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session, const char *u
|
|||||||
;
|
;
|
||||||
|
|
||||||
session->userauth_kybd_data = s = LIBSSH2_ALLOC(session, session->userauth_kybd_packet_len);
|
session->userauth_kybd_data = s = LIBSSH2_ALLOC(session, session->userauth_kybd_packet_len);
|
||||||
if (s) {
|
if (!s) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for keyboard-interactive authentication", 0);
|
libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for keyboard-interactive authentication", 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
##
|
##
|
||||||
## Comments to: Guenter Knauf <eflash@gmx.net>
|
## Comments to: Guenter Knauf <eflash@gmx.net>
|
||||||
##
|
##
|
||||||
## $Id: Makefile.win32,v 1.7 2007/04/21 23:36:51 gknauf Exp $
|
## $Id: Makefile.win32,v 1.8 2007/07/21 22:59:24 gknauf Exp $
|
||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
ifndef ZLIB_PATH
|
ifndef ZLIB_PATH
|
||||||
ZLIB_PATH = ../../zlib-1.2.3
|
ZLIB_PATH = ../../zlib-1.2.3
|
||||||
endif
|
endif
|
||||||
|
# since currently always enabled in libssh2_config.h set here too!
|
||||||
|
WITH_ZLIB = 1
|
||||||
|
|
||||||
# Edit the path below to point to the base of your OpenSSL package.
|
# Edit the path below to point to the base of your OpenSSL package.
|
||||||
ifndef OPENSSL_PATH
|
ifndef OPENSSL_PATH
|
||||||
@@ -61,7 +63,7 @@ endif
|
|||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
CC = mwcc
|
CC = mwcc
|
||||||
else
|
else
|
||||||
CC = gcc
|
CC = $(CRPREFIX)gcc
|
||||||
endif
|
endif
|
||||||
CP = cp -afv
|
CP = cp -afv
|
||||||
# RM = rm -f
|
# RM = rm -f
|
||||||
@@ -87,13 +89,13 @@ CFLAGS += -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -proc 58
|
|||||||
CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"
|
CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"
|
||||||
CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
|
CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
|
||||||
else
|
else
|
||||||
LD = gcc
|
LD = $(CRPREFIX)gcc
|
||||||
RC = windres
|
RC = $(CRPREFIX)windres
|
||||||
LDFLAGS = -s -shared -Wl,--out-implib,$(TARGET)dll.a
|
LDFLAGS = -s -shared -Wl,--out-implib,$(TARGET)dll.a
|
||||||
AR = ar
|
AR = $(CRPREFIX)ar
|
||||||
ARFLAGS = -cq
|
ARFLAGS = -cq
|
||||||
LIBEXT = a
|
LIBEXT = a
|
||||||
RANLIB = ranlib
|
RANLIB = $(CRPREFIX)ranlib
|
||||||
#LDLIBS += -lwsock32
|
#LDLIBS += -lwsock32
|
||||||
LDLIBS += -lws2_32
|
LDLIBS += -lws2_32
|
||||||
RCFLAGS = -O coff -i
|
RCFLAGS = -O coff -i
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
# Tweak these for your system
|
# Tweak these for your system
|
||||||
OPENSSLINC=..\libssh2_build\include
|
OPENSSLINC=..\openssl-0.9.8e\inc32
|
||||||
OPENSSLLIB=..\libssh2_build\lib
|
OPENSSLLIB=..\openssl-0.9.8e\out32dll
|
||||||
|
|
||||||
ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\libssh2_build\include
|
ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\zlib-1.2.3
|
||||||
ZLIBLIB=..\libssh2_build\lib
|
ZLIBLIB=..\zlib-1.2.3
|
||||||
|
|
||||||
!if "$(TARGET)" == ""
|
!if "$(TARGET)" == ""
|
||||||
TARGET=Release
|
TARGET=Release
|
||||||
|
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "libssh2"=.\libssh2.dsp - Package Owner=<4>
|
Project: "libssh2_dll"=".\libssh2_dll.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
@@ -15,7 +15,19 @@ Package=<4>
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "ssh2_sample"=.\ssh2_sample.dsp - Package Owner=<4>
|
Project: "libssh2_lib"=".\libssh2_lib.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "tests"=".\tests.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#define WINSOCK_VERSION MAKEWORD(2,0)
|
|
||||||
#define HAVE_UNISTD_H
|
#define HAVE_UNISTD_H
|
||||||
#define HAVE_INTTYPES_H
|
#define HAVE_INTTYPES_H
|
||||||
#define HAVE_SYS_TIME_H
|
#define HAVE_SYS_TIME_H
|
||||||
@@ -42,8 +41,19 @@ static inline int usleep(int udelay)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
|
#define strncasecmp _strnicmp
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#else
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#define WINSOCK_VERSION MAKEWORD(2,0)
|
||||||
|
#else
|
||||||
|
#define strncasecmp strnicmp
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#endif /* __MINGW32__ */
|
||||||
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
/* Compile in zlib support */
|
/* Compile in zlib support */
|
||||||
#define LIBSSH2_HAVE_ZLIB 1
|
#define LIBSSH2_HAVE_ZLIB 1
|
||||||
|
184
win32/libssh2_dll.dsp
Normal file
184
win32/libssh2_dll.dsp
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="libssh2_dll" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||||
|
|
||||||
|
CFG=libssh2_dll - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "libssh2_dll.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "libssh2_dll.mak" CFG="libssh2_dll - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "libssh2_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
|
!MESSAGE "libssh2_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "libssh2_dll - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release_dll"
|
||||||
|
# PROP BASE Intermediate_Dir "Release_dll"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release_dll"
|
||||||
|
# PROP Intermediate_Dir "Release_dll"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /map /debug /machine:I386 /out:"Release_dll/libssh2.dll"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "libssh2_dll - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug_dll"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug_dll"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug_dll"
|
||||||
|
# PROP Intermediate_Dir "Debug_dll"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
|
# SUBTRACT CPP /WX /YX
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib ws2_32.lib libeay32.lib ssleay32.lib zlib.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug_dll/libssh2.dll" /pdbtype:sept
|
||||||
|
# SUBTRACT LINK32 /nodefaultlib
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "libssh2_dll - Win32 Release"
|
||||||
|
# Name "libssh2_dll - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\channel.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\comp.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\crypt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\hostkey.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\kex.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\mac.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\misc.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\openssl.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\packet.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\pem.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\publickey.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\scp.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\session.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\sftp.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\transport.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\userauth.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\include\libssh2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\libssh2_config.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\include\libssh2_priv.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\include\libssh2_sftp.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
|
|
||||||
|
|
@@ -1,24 +1,24 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="libssh2" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="libssh2_lib" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
# ** DO NOT EDIT **
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||||
|
|
||||||
CFG=libssh2 - Win32 Debug
|
CFG=libssh2_lib - Win32 Debug
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libssh2.mak".
|
!MESSAGE NMAKE /f "libssh2_lib.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libssh2.mak" CFG="libssh2 - Win32 Debug"
|
!MESSAGE NMAKE /f "libssh2_lib.mak" CFG="libssh2_lib - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "libssh2 - Win32 Release" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libssh2_lib - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE "libssh2 - Win32 Debug" (based on "Win32 (x86) Static Library")
|
!MESSAGE "libssh2_lib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
@@ -28,17 +28,17 @@ CFG=libssh2 - Win32 Debug
|
|||||||
CPP=cl.exe
|
CPP=cl.exe
|
||||||
RSC=rc.exe
|
RSC=rc.exe
|
||||||
|
|
||||||
!IF "$(CFG)" == "libssh2 - Win32 Release"
|
!IF "$(CFG)" == "libssh2_lib - Win32 Release"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
# PROP BASE Output_Dir "libssh2___Win32_Release"
|
# PROP BASE Output_Dir "Release_lib"
|
||||||
# PROP BASE Intermediate_Dir "libssh2___Win32_Release"
|
# PROP BASE Intermediate_Dir "Release_lib"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir "Release"
|
# PROP Output_Dir "Release_lib"
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release_lib"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
@@ -50,18 +50,19 @@ BSC32=bscmake.exe
|
|||||||
LIB32=link.exe -lib
|
LIB32=link.exe -lib
|
||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo
|
# ADD LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo /out:"Release_lib\libssh.lib"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libssh2 - Win32 Debug"
|
!ELSEIF "$(CFG)" == "libssh2_lib - Win32 Debug"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
# PROP BASE Output_Dir "Debug"
|
# PROP BASE Output_Dir "Debug_lib"
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
# PROP BASE Intermediate_Dir "Debug_lib"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP Output_Dir "Debug"
|
# PROP Output_Dir "Debug_lib"
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug_lib"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
@@ -72,14 +73,14 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LIB32=link.exe -lib
|
LIB32=link.exe -lib
|
||||||
# ADD BASE LIB32 /nologo
|
# ADD BASE LIB32 /nologo
|
||||||
# ADD LIB32 /nologo /out:"Debug\libssh2d.lib"
|
# ADD LIB32 /nologo /out:"Debug_lib\libssh2d.lib"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
# Name "libssh2 - Win32 Release"
|
# Name "libssh2_lib - Win32 Release"
|
||||||
# Name "libssh2 - Win32 Debug"
|
# Name "libssh2_lib - Win32 Debug"
|
||||||
# Begin Group "Source Files"
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
@@ -113,10 +114,22 @@ SOURCE=..\src\misc.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\openssl.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\src\packet.c
|
SOURCE=..\src\packet.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\pem.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\publickey.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\src\scp.c
|
SOURCE=..\src\scp.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@@ -129,6 +142,10 @@ SOURCE=..\src\sftp.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\src\transport.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\src\userauth.c
|
SOURCE=..\src\userauth.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
@@ -154,3 +171,5 @@ SOURCE=..\include\libssh2_sftp.h
|
|||||||
# End Group
|
# End Group
|
||||||
# End Target
|
# End Target
|
||||||
# End Project
|
# End Project
|
||||||
|
|
||||||
|
|
@@ -1,24 +1,24 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="ssh2_sample" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="tests" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
# ** DO NOT EDIT **
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
CFG=ssh2_sample - Win32 Debug
|
CFG=tests - Win32 Debug
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "ssh2_sample.mak".
|
!MESSAGE NMAKE /f "tests.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "ssh2_sample.mak" CFG="ssh2_sample - Win32 Debug"
|
!MESSAGE NMAKE /f "tests.mak" CFG="tests - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "ssh2_sample - Win32 Release" (based on "Win32 (x86) Console Application")
|
!MESSAGE "tests - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
!MESSAGE "ssh2_sample - Win32 Debug" (based on "Win32 (x86) Console Application")
|
!MESSAGE "tests - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
@@ -28,12 +28,12 @@ CFG=ssh2_sample - Win32 Debug
|
|||||||
CPP=cl.exe
|
CPP=cl.exe
|
||||||
RSC=rc.exe
|
RSC=rc.exe
|
||||||
|
|
||||||
!IF "$(CFG)" == "ssh2_sample - Win32 Release"
|
!IF "$(CFG)" == "tests - Win32 Release"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
# PROP BASE Output_Dir "ssh2_sample___Win32_Release"
|
# PROP BASE Output_Dir "tests___Win32_Release"
|
||||||
# PROP BASE Intermediate_Dir "ssh2_sample___Win32_Release"
|
# PROP BASE Intermediate_Dir "tests___Win32_Release"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
@@ -42,7 +42,7 @@ RSC=rc.exe
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBSSH2_LIBRARY" /YX /FD /c
|
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /I "..\win32" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
@@ -50,14 +50,14 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libeay32.lib ssleay32.lib ws2_32.lib zlib.lib libssh2.lib /nologo /subsystem:console /machine:I386 /libpath:"Release"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libeay32.lib ssleay32.lib ws2_32.lib zlib.lib libssh2.lib /nologo /subsystem:console /machine:I386 /libpath:"Release" /out:"simple.exe"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "ssh2_sample - Win32 Debug"
|
!ELSEIF "$(CFG)" == "tests - Win32 Debug"
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
# PROP BASE Output_Dir "ssh2_sample___Win32_Debug"
|
# PROP BASE Output_Dir "tests___Win32_Debug"
|
||||||
# PROP BASE Intermediate_Dir "ssh2_sample___Win32_Debug"
|
# PROP BASE Intermediate_Dir "tests___Win32_Debug"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
@@ -66,7 +66,7 @@ LINK32=link.exe
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBSSH2_LIBRARY" /YX /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\win32" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
@@ -74,20 +74,20 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libeay32.lib ssleay32.lib ws2_32.lib zlib.lib libssh2d.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"Debug"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libeay32.lib ssleay32.lib ws2_32.lib zlib.lib libssh2d.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"Debug" /out:"simple.exe"
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
# Begin Target
|
# Begin Target
|
||||||
|
|
||||||
# Name "ssh2_sample - Win32 Release"
|
# Name "tests - Win32 Release"
|
||||||
# Name "ssh2_sample - Win32 Debug"
|
# Name "tests - Win32 Debug"
|
||||||
# Begin Group "Source Files"
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\ssh2_sample.c
|
SOURCE=..\tests\simple.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Header Files"
|
# Begin Group "Header Files"
|
Reference in New Issue
Block a user