1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-05 20:55:46 +03:00

added Jean-Philippe's patch for libtools. it doesn't compile on my computer.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@40 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Aris Adamantiadis
2005-10-25 23:11:41 +00:00
parent d86f001754
commit 9a2683f183
15 changed files with 30403 additions and 396 deletions

View File

@@ -3,6 +3,7 @@ VPATH = @srcdir@
subdirs = libssh/ sftp_server/
top_srcdir = @top_srcdir@
top_builddir = .
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -18,6 +19,7 @@ LDFLAGS = @LDFLAGS@
LIBS = -lssh -Llibssh/
INSTALL = @INSTALL@
LN= @LN_S@
LIBTOOL= @LIBTOOL@
OBJECTS= sample.o samplesshd.o
VERSION=0.12-dev
DISTLIB=libssh-$(VERSION)
@@ -27,16 +29,16 @@ all: $(CONFIG) $(OBJECTS)
(cd $$dir && $(MAKE) all) \
|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
$(CC) -o samplessh sample.o $(LDFLAGS) $(LIBS)
$(LIBTOOL) --mode=link $(CC) -o samplessh sample.o $(LDFLAGS) $(LIBS)
$(LN) -sf samplessh samplesftp
$(CC) -o samplesshd samplesshd.o $(LDFLAGS) $(LIBS)
$(LIBTOOL) --mode=link $(CC) -o samplesshd samplesshd.o $(LDFLAGS) $(LIBS)
$(CONFIG):
$(LN) -f ../../config.h $(CONFIG)
dist:
rm -fr $(DISTLIB)
mkdir $(DISTLIB)
cp Makefile.in configure.in configure config.h.in install-sh \
mkinstalldirs config.sub config.guess $(DISTLIB)
ltmain.sh mkinstalldirs config.sub config.guess $(DISTLIB)
mkdir $(DISTLIB)/libssh
mkdir $(DISTLIB)/include
mkdir $(DISTLIB)/include/libssh
@@ -44,8 +46,8 @@ dist:
cp libssh/Makefile.in $(DISTLIB)/libssh/
cp libssh/*.c $(DISTLIB)/libssh/
cp include/libssh/libssh.h include/libssh/sftp.h \
include/libssh/priv.h \
include/libssh/crypto.h include/libssh/ssh2.h \
include/libssh/priv.h include/libssh/crypto.h \
include/libssh/ssh1.h include/libssh/ssh2.h \
include/libssh/server.h $(DISTLIB)/include/libssh/
cp *.c COPYING README AUTHORS CHANGELOG $(DISTLIB)/
cp doc/* $(DISTLIB)/doc/
@@ -64,16 +66,16 @@ install: all
$(INSTALL) include/libssh/ssh2.h $(incldir)/libssh/
$(INSTALL) include/libssh/ssh1.h $(incldir)/libssh/
clean:
/bin/rm -f *~ *.o ssh sftp
$(LIBTOOL) --mode=clean rm -f *~ *.o samplessh samplesftp samplesshd include/libssh/config.h
@for dir in ${subdirs}; do \
(cd $$dir && $(MAKE) clean) \
|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
distclean: clean
/bin/rm -f Makefile config.h config.status config.cache config.log
@for dir in ${subdirs}; do \
(cd $$dir && $(MAKE) distclean) \
|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
rm -f Makefile config.h config.status config.cache config.log libtool

7011
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

17025
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -6,21 +6,49 @@ AC_INIT(libssh, 0.2-dev , aris@0xbadc0de.be)
AC_CONFIG_SRCDIR([sample.c])
AC_CONFIG_HEADER([config.h])
# LT Version numbers, remember to change them just *before* a release.
# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
# (Interfaces added: CURRENT++, AGE++, REVISION=0)
# (No interfaces changed: REVISION++)
LIBSSH_CURRENT=0
LIBSSH_AGE=0
LIBSSH_REVISION=0
AC_SUBST(LIBSSH_CURRENT)
AC_SUBST(LIBSSH_AGE)
AC_SUBST(LIBSSH_REVISION)
# Check for the OS.
AC_CANONICAL_HOST
case "$host" in
*-apple*)
DYLIB_EXTENSION="dylib"
LIBSSH_LDFLAGS="-dynamiclib -prebind -seg1addr 0x3a000000 -install_name \"${libdir}/libssh.dylib\" -headerpad_max_install_names -current_version 0.1"
LIBSSH_LDFLAGS="-prebind -seg1addr 0x3a000000 -headerpad_max_install_names"
;;
*)
DYLIB_EXTENSION="so"
LIBSSH_LDFLAGS="-shared"
LIBSSH_LDFLAGS=""
;;
esac
AC_SUBST(DYLIB_EXTENSION)
AC_SUBST(LIBSSH_LDFLAGS)
AC_MSG_CHECKING([version script options])
case "$host" in
*-*-linux*)
LIBSSH_VERS="$LIBSSH_LDFLAGS -Wl,--version-script,libssh.vers -Wl,-01"
;;
*-*-gnu*)
LIBSSH_VERS="$LIBSSH_LDFLAGS -Wl,--version-script,libssh.vers-Wl,-01"
;;
esac
AC_ARG_WITH([versioned-symbol],
AC_HELP_STRING([--with-versioned-symbol],[Use versioned symbols]),
[echo $withval > plop
if test $withval = "yes"; then
LIBSSH_VERS="$LIBSSH_LDFLAGS -Wl,--version-script,libssh.vers-Wl,-01"
else
LIBSSH_VERS=""
fi], [ : ])
AC_SUBST(LIBSSH_VERS)
enable_ssh1=${enable_ssh1:-"no"}
AC_ARG_ENABLE(ssh1, [ --enable-ssh1 support SSH1])
AC_MSG_CHECKING([for SSH1 support])
@@ -34,15 +62,15 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_LIBTOOL
AC_C_BIGENDIAN
# Checks for libraries.
# AC_CHECK_LIB([gcrypt], [gcry_md_open])
# if test "$ac_cv_lib_gcrypt_gcry_md_open" != yes; then
# AC_CHECK_LIB([crypto], [BN_init])
# fi
AC_CHECK_LIB([crypto],[BN_init])
AC_CHECK_LIB([gcrypt], [gcry_md_open])
if test "$ac_cv_lib_gcrypt_gcry_md_open" != yes; then
AC_CHECK_LIB([crypto], [BN_init])
fi
#AC_CHECK_LIB([crypto],[BN_init])
AC_CHECK_LIB([z], [deflateInit_])
AC_SEARCH_LIBS([hstrerror],[nsl resolv])
AC_SEARCH_LIBS([gethostbyname],[nsl resolv])

View File

@@ -81,6 +81,7 @@ typedef gcry_mpi_t bignum;
#define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8)
#define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit)
#define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num)
#define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2)
#elif defined HAVE_LIBCRYPTO
#include <openssl/dsa.h>
@@ -116,6 +117,7 @@ typedef BN_CTX* bignum_CTX;
#define bignum_num_bits(num) BN_num_bits(num)
#define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)
#define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr)
#define bignum_cmp(num1,num2) BN_cmp(num1,num2)
#endif /* OPENSSL_BIGNUMS */

View File

@@ -6,8 +6,8 @@ OBJECTS= client.o packet.o dh.o crypt.o connect.o error.o buffer.o \
SHELL = /bin/sh
VPATH = @srcdir@
subdirs = @subdirs@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -18,27 +18,34 @@ libdir = $(prefix)/lib/
mandir = $(prefix)/man/man1
CC = @CC@
CFLAGS = @CFLAGS@ -Wall -g -I../include/ -fPIC
CFLAGS = @CFLAGS@ -Wall -g -I../include/
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
INSTALL = @INSTALL@
DYLIB_EXTENSION = @DYLIB_EXTENSION@
LIBTOOL = @LIBTOOL@
LIBSSH_LDFLAGS = @LIBSSH_LDFLAGS@
LIBSSH_VERS = @LIBSSH_VERS@
LIBSSH_CURRENT = @LIBSSH_CURRENT@
LIBSSH_REVISION = @LIBSSH_REVISION@
LIBSSH_AGE = @LIBSSH_AGE@
.c.o:
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
all: libssh.so
libssh.so: $(OBJECTS)
$(CC) -o libssh.$(DYLIB_EXTENSION) $(LIBSSH_LDFLAGS) $(OBJECTS) $(LIBS) $(LDFLAGS)
libssh.a: $(OBJECTS)
rm -f libssh.a
ar q libssh.a $(OBJECTS)
@RANLIB@ libssh.a
libssh.la: $(OBJECTS) libssh.vers
$(LIBTOOL) --mode=link $(CC) -o libssh.la -export-dynamic -version-info $(LIBSSH_CURRENT):$(LIBSSH_REVISION):$(LIBSSH_AGE) -rpath $(libdir) $(OBJECTS:.o=.lo) $(LIBS) $(LIBSSH_LDFLAGS) $(LIBSSH_VERS) $(LDFLAGS)
libssh.so: libssh.la
libssh.a: libssh.la
install: all
$(top_srcdir)/mkinstalldirs $(incldir)
$(top_srcdir)/mkinstalldirs $(libdir)
$(INSTALL) libssh.$(DYLIB_EXTENSION) $(libdir)
$(LIBTOOL) --mode=install $(INSTALL) libssh.la $(libdir)
clean:
rm -f *~ libssh.a libssh.so *.o
$(LIBTOOL) --mode=clean rm -f *~ libssh.la *.lo
distclean: clean
rm -f Makefile

View File

@@ -21,6 +21,7 @@ MA 02111-1307, USA. */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <netdb.h>
#include "libssh/priv.h"
#include "libssh/ssh2.h"
@@ -309,9 +310,21 @@ static void build_session_id1(SSH_SESSION *session, STRING *servern,
/* returns 1 if the modulus of k1 is < than the one of k2 */
static int modulus_smaller(PUBLIC_KEY *k1, PUBLIC_KEY *k2){
RSA *r1=k1->rsa_pub;
RSA *r2=k2->rsa_pub;
if(BN_cmp(r1->n,r2->n)<0)
bignum n1;
bignum n2;
#ifdef HAVE_LIBGCRYPT
gcry_sexp_t sexp;
sexp=gcry_sexp_find_token(k1->rsa_pub,"n",0);
n1=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_STD);
gcry_sexp_release(sexp);
sexp=gcry_sexp_find_token(k2->rsa_pub,"n",0);
n2=gcry_sexp_nth_mpi(sexp,1,GCRYMPI_FMT_STD);
gcry_sexp_release(sexp);
#elif defined HAVE_LIBCRYPTO
n1=k1->rsa_pub->n;
n2=k2->rsa_pub->n;
#endif
if(bignum_cmp(n1,n2)<0)
return 1;
else
return 0;

59
libssh/libssh.vers Normal file
View File

@@ -0,0 +1,59 @@
SSH_0.2 {
global:
ssh_get_error; ssh_get_error_code; ssh_say; ssh_set_verbosity;
ssh_new; ssh_set_options; ssh_get_fd; ssh_silent_disconnect;
ssh_connect; ssh_disconnect; ssh_service_request; ssh_get_issue_banner;
ssh_copyright;
string_from_char; string_len; string_new; string_fill; string_to_char;
string_copy; string_burn; string_data;
ssh_crypto_init;
ssh_print_hexa; ssh_get_random;
ssh_get_pubkey_hash; ssh_get_pubkey;
ssh_fd_poll; ssh_select; publickey_free;
privatekey_from_file; publickey_to_string; publickey_from_privatekey;
private_key_free; publickey_from_file; publickey_from_next_file;
ssh_is_server_known; ssh_write_knownhost;
channel_new; channel_open_forward; channel_open_session; channel_free;
channel_request_pty; channel_request_pty_size; channel_change_pty_size;
channel_request_shell; channel_request_subsystem; channel_request_env;
channel_request_exec; channel_request_sftp; channel_write;
channel_send_eof; channel_read; channel_poll; channel_close;
channel_read_nonblocking; channel_is_open;
ssh_options_new; ssh_options_copy; ssh_options_set_wanted_algos;
ssh_options_set_username; ssh_options_set_port; ssh_options_getopt;
ssh_options_set_host; ssh_options_set_fd; ssh_options_set_bind;
ssh_options_set_identity; ssh_options_set_status_callback;
ssh_options_set_timeout; ssh_options_set_ssh_dir;
ssh_options_set_known_hosts_file; ssh_options_allow_ssh1;
ssh_options_allow_ssh2; ssh_options_set_dsa_server_key;
ssh_options_set_rsa_server_key;
buffer_new; buffer_free; buffer_get; buffer_get_len;
ssh_userauth_none; ssh_userauth_password; ssh_userauth_offer_pubkey;
ssh_userauth_pubkey; ssh_userauth_autopubkey; ssh_userauth_kbdint;
ssh_userauth_kbdint_getnprompts; ssh_userauth_kbdint_getname;
ssh_userauth_kbdint_getinstruction; ssh_userauth_kbdint_getprompt;
ssh_userauth_kbdint_setanswer;
sftp_new; sftp_free; sftp_init; sftp_opendir; sftp_readdir; sftp_dir_eof;
sftp_stat; sftp_lstat; sftp_fstat; sftp_attributes_free; sftp_dir_close;
sftp_file_close; sftp_open; sftp_read; sftp_write; sftp_seek; sftp_tell;
sftp_rewind; sftp_rm; sftp_rmdir; sftp_mkdir; sftp_rename; sftp_setstat;
sftp_canonicalize_path; sftp_server_new; sftp_server_init;
sftp_get_client_message; sftp_client_message_free; sftp_reply_name;
sftp_reply_handle; sftp_handle_alloc; sftp_reply_attr; sftp_handle;
sftp_reply_status; sftp_reply_names_add; sftp_reply_names;
sftp_reply_data; sftp_handle_remove;
ssh_bind_new; ssh_bind_set_options; ssh_bind_listen; ssh_bind_set_blocking;
ssh_bind_get_fd; ssh_bind_set_toaccept; ssh_bind_accept; ssh_bind_free;
ssh_accept;
ssh_message_get; ssh_message_type; ssh_message_subtype;
ssh_message_reply_default; ssh_message_free; ssh_message_auth_user;
ssh_message_auth_password; ssh_message_auth_reply_success;
ssh_message_auth_set_methods;
ssh_message_channel_request_open_reply_accept;
ssh_message_channel_request_channel; ssh_message_channel_request_pty_term;
ssh_message_channel_request_subsystem;
ssh_message_channel_request_reply_success;
set_encrypt_key; set_decrypt_key; cbc_encrypt; cbc_decrypt;
local:
*;
};

6538
ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

1
plop Normal file
View File

@@ -0,0 +1 @@
yes

View File

@@ -1,10 +1,11 @@
OBJECTS= main.o config.o list.o protocol.o userauth.o file.o acl.o \
libconfig/libconfig.a ../libssh/libssh.a
OBJECTS= main.o config.o list.o protocol.o userauth.o acl.o \
libconfig/libconfig.a ../libssh/libssh.la
SHELL = /bin/sh
subdirs = @subdirs@
top_srcdir = ..
top_builddir = ../
srcdir = .
prefix = /usr/local
exec_prefix = ${prefix}
@@ -17,10 +18,10 @@ mandir = $(prefix)/man/man1
CC = gcc
CFLAGS = -g -O2 -Wall -I../include/ -Ilibconfig/
LDFLAGS =
LIBS = -lz -lcrypto -lpam -lcrypto
LIBS = -lz -lgcrypt -lpam
INSTALL = /usr/bin/install -c
DYLIB_EXTENSION = so
LIBSSH_LDFLAGS = -shared
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBSSH_LDFLAGS =
all: sftp_server
@@ -32,20 +33,20 @@ config.o: server.h libconfig/libconfig.h
libconfig/libconfig.a: libconfig/libconfig.h
make -C libconfig/
../libssh/libssh.a:
make -C ../libssh/ libssh.a
../libssh/libssh.la:
make -C ../libssh/ libssh.la
libconfig/libconfig.h:
cd libconfig ; ./configure ; cd ..
make -C libconfig/
sftp_server: $(OBJECTS)
make -C ../libssh libssh.a
$(CC) -o sftp_server $(OBJECTS) $(LIBS) $(LDFLAGS)
# make -C ../libssh libssh.la
$(LIBTOOL) --mode=link $(CC) -o sftp_server $(OBJECTS) $(LIBS) $(LDFLAGS)
install: all
$(top_srcdir)/mkinstalldirs $(incldir)
$(top_srcdir)/mkinstalldirs $(libdir)
$(INSTALL) sftp_server $(bindir)
$(LIBTOOL) --mode=install $(INSTALL) sftp_server $(bindir)
clean:
rm -f *~ sftp_server *.o
$(LIBTOOL) --mode=clean rm -f *~ sftp_server *.o
distclean: clean
rm -f Makefile

View File

@@ -1,10 +1,11 @@
OBJECTS= main.o config.o list.o protocol.o userauth.o file.o acl.o \
libconfig/libconfig.a ../libssh/libssh.a
OBJECTS= main.o config.o list.o protocol.o userauth.o acl.o \
libconfig/libconfig.a ../libssh/libssh.la
SHELL = /bin/sh
VPATH = @srcdir@
subdirs = @subdirs@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -17,9 +18,9 @@ mandir = $(prefix)/man/man1
CC = @CC@
CFLAGS = @CFLAGS@ -Wall -I../include/ -Ilibconfig/
LDFLAGS =
LIBS = @LIBS@ -lpam -lcrypto
LIBS = @LIBS@ -lpam
INSTALL = @INSTALL@
DYLIB_EXTENSION = @DYLIB_EXTENSION@
LIBTOOL = @LIBTOOL@
LIBSSH_LDFLAGS = @LIBSSH_LDFLAGS@
all: sftp_server
@@ -32,20 +33,20 @@ config.o: server.h libconfig/libconfig.h
libconfig/libconfig.a: libconfig/libconfig.h
make -C libconfig/
../libssh/libssh.a:
make -C ../libssh/ libssh.a
../libssh/libssh.la:
make -C ../libssh/ libssh.la
libconfig/libconfig.h:
cd libconfig ; ./configure ; cd ..
make -C libconfig/
sftp_server: $(OBJECTS)
make -C ../libssh libssh.a
$(CC) -o sftp_server $(OBJECTS) $(LIBS) $(LDFLAGS)
# make -C ../libssh libssh.la
$(LIBTOOL) --mode=link $(CC) -o sftp_server $(OBJECTS) $(LIBS) $(LDFLAGS)
install: all
$(top_srcdir)/mkinstalldirs $(incldir)
$(top_srcdir)/mkinstalldirs $(libdir)
$(INSTALL) sftp_server $(bindir)
$(LIBTOOL) --mode=install $(INSTALL) sftp_server $(bindir)
clean:
rm -f *~ sftp_server *.o
$(LIBTOOL) --mode=clean rm -f *~ sftp_server *.o
distclean: clean
rm -f Makefile

View File

@@ -26,6 +26,8 @@ MA 02111-1307, USA. */
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "server.h"

View File

@@ -33,6 +33,7 @@ MA 02111-1307, USA. */
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "server.h"
#define TYPE_DIR 1

View File

@@ -36,6 +36,8 @@ MA 02111-1307, USA. */
#include <pwd.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "server.h"
#define SERVICE "sftp"