mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-24 22:45:17 +02:00
Merge remote-tracking branch 'refs/remotes/origin/L1'
This commit is contained in:
commit
ef4ffdad49
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -21,3 +21,4 @@
|
||||
*.sh text eol=lf
|
||||
config.sub text eol=lf
|
||||
fixalgorithms text eol=lf
|
||||
runconfigure text eol=lf
|
||||
|
11
.gitignore
vendored
11
.gitignore
vendored
@ -254,4 +254,13 @@ regress/t6.out1
|
||||
Makefile
|
||||
openbsd-compat/Makefile
|
||||
openbsd-compat/regress/Makefile
|
||||
contrib/win32/win32compat/Makefile
|
||||
contrib/win32/win32compat/Makefile
|
||||
config.h
|
||||
config.h
|
||||
regress/rsa_ssh2_cr.prv
|
||||
regress/rsa_ssh2_crnl.prv
|
||||
regress/t7.out.pub
|
||||
regress/t6.out2
|
||||
config.h
|
||||
configure
|
||||
config.h
|
616
Makefile
616
Makefile
@ -1,616 +0,0 @@
|
||||
# $Id: Makefile.in,v 1.325 2011/08/05 20:15:18 djm Exp $
|
||||
|
||||
# uncomment if you run a non bourne compatable shell. Ie. csh
|
||||
#SHELL = /usr/bin/sh
|
||||
|
||||
AUTORECONF=autoreconf
|
||||
|
||||
prefix=/usr/local
|
||||
exec_prefix=${prefix}
|
||||
bindir=${exec_prefix}/bin
|
||||
sbindir=${exec_prefix}/sbin
|
||||
libexecdir=${exec_prefix}/libexec
|
||||
datadir=${datarootdir}
|
||||
datarootdir=${prefix}/share
|
||||
mandir=${datarootdir}/man
|
||||
mansubdir=man
|
||||
sysconfdir=${prefix}/etc
|
||||
piddir=/var/run
|
||||
srcdir=.
|
||||
top_srcdir=.
|
||||
|
||||
DESTDIR=
|
||||
|
||||
SSH_PROGRAM=${exec_prefix}/bin/ssh
|
||||
ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
|
||||
SFTP_SERVER=$(libexecdir)/sftp-server
|
||||
SSH_KEYSIGN=$(libexecdir)/ssh-keysign
|
||||
SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
|
||||
PRIVSEP_PATH=/var/empty
|
||||
SSH_PRIVSEP_USER=sshd
|
||||
STRIP_OPT=-s
|
||||
TEST_SHELL=sh
|
||||
|
||||
PATHS= -DSSHDIR=\"$(sysconfdir)\" \
|
||||
-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
|
||||
-D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \
|
||||
-D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \
|
||||
-D_PATH_SSH_KEY_SIGN=\"$(SSH_KEYSIGN)\" \
|
||||
-D_PATH_SSH_PKCS11_HELPER=\"$(SSH_PKCS11_HELPER)\" \
|
||||
-D_PATH_SSH_PIDDIR=\"$(piddir)\" \
|
||||
-D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\"
|
||||
|
||||
CC=i686-pc-mingw32-gcc
|
||||
LD=i686-pc-mingw32-gcc
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-all -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
CPPFLAGS=-I. -I$(srcdir) -I/cygdrive/c/openssh/openssl-1.0.2d/include -I/cygdrive/c/openssh/zlib-1.2.8 $(PATHS) -DHAVE_CONFIG_H
|
||||
LIBS=-lcrypto -lz -lws2_32 -lgdi32 -lNetAPI32 -luserenv -lsecur32 -lshlwapi
|
||||
K5LIBS=@K5LIBS@
|
||||
GSSLIBS=@GSSLIBS@
|
||||
SSHLIBS=
|
||||
SSHDLIBS=
|
||||
LIBEDIT=
|
||||
AR=/usr/bin/ar
|
||||
AWK=gawk
|
||||
RANLIB=i686-pc-mingw32-ranlib
|
||||
INSTALL=/usr/bin/install -c
|
||||
PERL=/usr/bin/perl
|
||||
SED=/usr/bin/sed
|
||||
ENT=
|
||||
XAUTH_PATH=undefined
|
||||
LDFLAGS=-L. -Lopenbsd-compat/ -Lcontrib/win32/win32compat -L/cygdrive/c/openssh/openssl-1.0.2d -L/cygdrive/c/openssh/zlib-1.2.8 -fstack-protector-all
|
||||
EXEEXT=.exe
|
||||
MANFMT=/usr/bin/nroff -mandoc
|
||||
|
||||
TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT)
|
||||
|
||||
LIBOPENSSH_OBJS=\
|
||||
ssh_api.o \
|
||||
ssherr.o \
|
||||
sshbuf.o \
|
||||
sshkey.o \
|
||||
sshbuf-getput-basic.o \
|
||||
sshbuf-misc.o \
|
||||
sshbuf-getput-crypto.o \
|
||||
krl.o \
|
||||
bitmap.o
|
||||
|
||||
LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
|
||||
authfd.o authfile.o bufaux.o bufbn.o bufec.o buffer.o \
|
||||
canohost.o channels.o cipher.o cipher-aes.o cipher-aesctr.o \
|
||||
cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
|
||||
compat.o crc32.o deattack.o fatal.o hostfile.o \
|
||||
log.o match.o md-sha256.o moduli.o nchan.o packet.o opacket.o \
|
||||
readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
|
||||
atomicio.o key.o dispatch.o mac.o uidswap.o uuencode.o misc.o \
|
||||
monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
|
||||
msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \
|
||||
ssh-pkcs11.o smult_curve25519_ref.o \
|
||||
poly1305.o chacha.o cipher-chachapoly.o \
|
||||
ssh-ed25519.o digest-openssl.o digest-libc.o hmac.o \
|
||||
sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o \
|
||||
kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
|
||||
kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \
|
||||
kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \
|
||||
kerberos-sspi.o schnorr.o jpake.o
|
||||
|
||||
SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
|
||||
sshconnect.o sshconnect1.o sshconnect2.o mux.o \
|
||||
roaming_common.o roaming_client.o
|
||||
|
||||
SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
|
||||
audit.o audit-bsm.o audit-linux.o platform.o \
|
||||
sshpty.o sshlogin.o servconf.o serverloop.o \
|
||||
auth.o auth1.o auth2.o auth-options.o session.o \
|
||||
auth-chall.o auth2-chall.o groupaccess.o \
|
||||
auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
|
||||
auth2-none.o auth2-passwd.o auth2-pubkey.o \
|
||||
monitor_mm.o monitor.o monitor_wrap.o auth-krb5.o \
|
||||
auth2-gss.o gss-serv.o gss-serv-krb5.o \
|
||||
loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
|
||||
sftp-server.o sftp-common.o \
|
||||
roaming_common.o roaming_serv.o \
|
||||
sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
|
||||
sandbox-seccomp-filter.o sandbox-capsicum.o \
|
||||
pam.o kexdhs.o kexgexs.o kexecdhs.o
|
||||
|
||||
MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-keysign.8.out ssh-pkcs11-helper.8.out sshd_config.5.out ssh_config.5.out
|
||||
MANPAGES_IN = moduli.5 scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-keysign.8 ssh-pkcs11-helper.8 sshd_config.5 ssh_config.5
|
||||
MANTYPE = doc
|
||||
|
||||
CONFIGFILES=sshd_config.out ssh_config.out moduli.out
|
||||
CONFIGFILES_IN=sshd_config ssh_config moduli
|
||||
|
||||
PATHSUBS = \
|
||||
-e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
|
||||
-e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
|
||||
-e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
|
||||
-e 's|/usr/libexec|$(libexecdir)|g' \
|
||||
-e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
|
||||
-e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
|
||||
-e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
|
||||
-e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
|
||||
-e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
|
||||
-e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \
|
||||
-e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
|
||||
-e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
|
||||
-e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
|
||||
-e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
|
||||
-e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
|
||||
-e 's|/var/empty|$(PRIVSEP_PATH)|g' \
|
||||
-e 's|/usr/bin:/bin:/usr/sbin:/sbin|/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin|g'
|
||||
|
||||
FIXPATHSCMD = $(SED) $(PATHSUBS)
|
||||
FIXALGORITHMSCMD= $(SHELL) $(srcdir)/fixalgorithms $(SED) \
|
||||
@UNSUPPORTED_ALGORITHMS@
|
||||
|
||||
all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
|
||||
|
||||
$(LIBSSH_OBJS): Makefile.in config.h
|
||||
$(SSHOBJS): Makefile.in config.h
|
||||
$(SSHDOBJS): Makefile.in config.h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
LIBWIN32COMPAT=contrib/win32/win32compat/libwin32compat.a
|
||||
$(LIBWIN32COMPAT): always
|
||||
(cd contrib/win32/win32compat && $(MAKE))
|
||||
|
||||
LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
|
||||
$(LIBCOMPAT): always
|
||||
(cd openbsd-compat && $(MAKE))
|
||||
always:
|
||||
|
||||
libssh.a: $(LIBSSH_OBJS)
|
||||
$(AR) rv $@ $(LIBSSH_OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
ssh$(EXEEXT): $(LIBCOMPAT) libssh.a contrib/win32/win32compat/libwin32compat.a $(SSHOBJS)
|
||||
$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) ./libssh.a -lopenbsd-compat $(SSHLIBS) -lwin32compat $(LIBS)
|
||||
|
||||
sshd$(EXEEXT): libssh.a contrib/win32/win32compat/libwin32compat.a $(LIBCOMPAT) $(SSHDOBJS)
|
||||
$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(SSHDLIBS) $(LIBS)
|
||||
|
||||
ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-add.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-keygen.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o readconf.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS) $(LIBEDIT)
|
||||
|
||||
# test driver for the loginrec code - not built by default
|
||||
logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o contrib/win32/win32compat/libwin32compat.a
|
||||
$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat ./libssh.a -lwin32compat $(LIBS)
|
||||
|
||||
$(MANPAGES): $(MANPAGES_IN)
|
||||
if test "$(MANTYPE)" = "cat"; then \
|
||||
manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
|
||||
else \
|
||||
manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
|
||||
fi; \
|
||||
if test "$(MANTYPE)" = "man"; then \
|
||||
$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) | \
|
||||
$(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
|
||||
else \
|
||||
$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) > $@; \
|
||||
fi
|
||||
|
||||
$(CONFIGFILES): $(CONFIGFILES_IN)
|
||||
conffile=`echo $@ | sed 's/.out$$//'`; \
|
||||
$(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
|
||||
|
||||
# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
|
||||
moduli:
|
||||
echo
|
||||
|
||||
# special case target for umac128
|
||||
umac128.o: umac.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o umac128.o -c $(srcdir)/umac.c \
|
||||
-DUMAC_OUTPUT_LEN=16 -Dumac_new=umac128_new \
|
||||
-Dumac_update=umac128_update -Dumac_final=umac128_final \
|
||||
-Dumac_delete=umac128_delete
|
||||
|
||||
clean: regressclean
|
||||
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
|
||||
rm -f *.out core survey
|
||||
rm -f regress/unittests/test_helper/*.a
|
||||
rm -f regress/unittests/test_helper/*.o
|
||||
rm -f regress/unittests/sshbuf/*.o
|
||||
rm -f regress/unittests/sshbuf/test_sshbuf
|
||||
rm -f regress/unittests/sshkey/*.o
|
||||
rm -f regress/unittests/sshkey/test_sshkey
|
||||
rm -f regress/unittests/bitmap/*.o
|
||||
rm -f regress/unittests/bitmap/test_bitmap
|
||||
rm -f regress/unittests/hostkeys/*.o
|
||||
rm -f regress/unittests/hostkeys/test_hostkeys
|
||||
rm -f regress/unittests/kex/*.o
|
||||
rm -f regress/unittests/kex/test_kex
|
||||
(cd openbsd-compat && $(MAKE) clean)
|
||||
if test -f contrib/win32/win32compat/Makefile ; then \
|
||||
(cd contrib/win32/win32compat && $(MAKE) clean) \
|
||||
fi
|
||||
|
||||
distclean: regressclean
|
||||
rm -f *.o *.a $(TARGETS) logintest config.cache config.log
|
||||
rm -f *.out core opensshd.init openssh.xml
|
||||
rm -f Makefile buildpkg.sh config.h config.status
|
||||
rm -f survey.sh openbsd-compat/regress/Makefile *~
|
||||
rm -rf autom4te.cache
|
||||
rm -f regress/unittests/test_helper/*.a
|
||||
rm -f regress/unittests/test_helper/*.o
|
||||
rm -f regress/unittests/sshbuf/*.o
|
||||
rm -f regress/unittests/sshbuf/test_sshbuf
|
||||
rm -f regress/unittests/sshkey/*.o
|
||||
rm -f regress/unittests/sshkey/test_sshkey
|
||||
rm -f regress/unittests/bitmap/*.o
|
||||
rm -f regress/unittests/bitmap/test_bitmap
|
||||
rm -f regress/unittests/hostkeys/*.o
|
||||
rm -f regress/unittests/hostkeys/test_hostkeys
|
||||
rm -f regress/unittests/kex/*.o
|
||||
rm -f regress/unittests/kex/test_kex
|
||||
(cd openbsd-compat && $(MAKE) distclean)
|
||||
if test -f contrib/win32/win32compat/Makefile ; then \
|
||||
(cd contrib/win32/win32compat && $(MAKE) distclean) \
|
||||
fi
|
||||
if test -d pkg ; then \
|
||||
rm -fr pkg ; \
|
||||
fi
|
||||
|
||||
veryclean: distclean
|
||||
rm -f configure config.h.in *.0
|
||||
|
||||
cleandir: veryclean
|
||||
|
||||
mrproper: veryclean
|
||||
|
||||
realclean: veryclean
|
||||
|
||||
catman-do:
|
||||
@for f in $(MANPAGES_IN) ; do \
|
||||
base=`echo $$f | sed 's/\..*$$//'` ; \
|
||||
echo "$$f -> $$base.0" ; \
|
||||
$(MANFMT) $$f | cat -v | sed -e 's/.\^H//g' \
|
||||
>$$base.0 ; \
|
||||
done
|
||||
|
||||
distprep: catman-do
|
||||
$(AUTORECONF)
|
||||
-rm -rf autom4te.cache
|
||||
|
||||
install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
|
||||
install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
|
||||
install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
|
||||
|
||||
check-config:
|
||||
-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
|
||||
|
||||
install-files:
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
|
||||
(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
|
||||
$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
|
||||
$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
|
||||
$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
|
||||
$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
|
||||
$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
|
||||
$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
|
||||
$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
|
||||
$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
|
||||
$(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
|
||||
$(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
|
||||
$(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
|
||||
$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
|
||||
$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
|
||||
$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
|
||||
$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
|
||||
$(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
|
||||
-rm -f $(DESTDIR)$(bindir)/slogin
|
||||
ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
|
||||
ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
|
||||
|
||||
install-sysconf:
|
||||
if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
|
||||
$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
|
||||
fi
|
||||
@if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
|
||||
$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
|
||||
else \
|
||||
echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
|
||||
fi
|
||||
@if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
|
||||
$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
|
||||
else \
|
||||
echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
|
||||
fi
|
||||
@if [ ! -f $(DESTDIR)$(sysconfdir)/moduli ]; then \
|
||||
if [ -f $(DESTDIR)$(sysconfdir)/primes ]; then \
|
||||
echo "moving $(DESTDIR)$(sysconfdir)/primes to $(DESTDIR)$(sysconfdir)/moduli"; \
|
||||
mv "$(DESTDIR)$(sysconfdir)/primes" "$(DESTDIR)$(sysconfdir)/moduli"; \
|
||||
else \
|
||||
$(INSTALL) -m 644 moduli.out $(DESTDIR)$(sysconfdir)/moduli; \
|
||||
fi ; \
|
||||
else \
|
||||
echo "$(DESTDIR)$(sysconfdir)/moduli already exists, install will not overwrite"; \
|
||||
fi
|
||||
|
||||
host-key: ssh-keygen$(EXEEXT)
|
||||
@if [ -z "$(DESTDIR)" ] ; then \
|
||||
if [ -f "$(sysconfdir)/ssh_host_key" ] ; then \
|
||||
echo "$(sysconfdir)/ssh_host_key already exists, skipping." ; \
|
||||
else \
|
||||
./ssh-keygen -t rsa1 -f $(sysconfdir)/ssh_host_key -N "" ; \
|
||||
fi ; \
|
||||
if [ -f $(sysconfdir)/ssh_host_dsa_key ] ; then \
|
||||
echo "$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
|
||||
else \
|
||||
./ssh-keygen -t dsa -f $(sysconfdir)/ssh_host_dsa_key -N "" ; \
|
||||
fi ; \
|
||||
if [ -f $(sysconfdir)/ssh_host_rsa_key ] ; then \
|
||||
echo "$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
|
||||
else \
|
||||
./ssh-keygen -t rsa -f $(sysconfdir)/ssh_host_rsa_key -N "" ; \
|
||||
fi ; \
|
||||
if [ -f $(sysconfdir)/ssh_host_ed25519_key ] ; then \
|
||||
echo "$(sysconfdir)/ssh_host_ed25519_key already exists, skipping." ; \
|
||||
else \
|
||||
./ssh-keygen -t ed25519 -f $(sysconfdir)/ssh_host_ed25519_key -N "" ; \
|
||||
fi ; \
|
||||
if [ -z "" ] ; then \
|
||||
if [ -f $(sysconfdir)/ssh_host_ecdsa_key ] ; then \
|
||||
echo "$(sysconfdir)/ssh_host_ecdsa_key already exists, skipping." ; \
|
||||
else \
|
||||
./ssh-keygen -t ecdsa -f $(sysconfdir)/ssh_host_ecdsa_key -N "" ; \
|
||||
fi ; \
|
||||
fi ; \
|
||||
fi ;
|
||||
|
||||
host-key-force: ssh-keygen$(EXEEXT)
|
||||
./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
|
||||
./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
|
||||
./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
|
||||
./ssh-keygen -t ed25519 -f $(DESTDIR)$(sysconfdir)/ssh_host_ed25519_key -N ""
|
||||
test -z "" && ./ssh-keygen -t ecdsa -f $(DESTDIR)$(sysconfdir)/ssh_host_ecdsa_key -N ""
|
||||
|
||||
uninstallall: uninstall
|
||||
-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
|
||||
-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
|
||||
-rmdir $(DESTDIR)$(sysconfdir)
|
||||
-rmdir $(DESTDIR)$(bindir)
|
||||
-rmdir $(DESTDIR)$(sbindir)
|
||||
-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
|
||||
-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
|
||||
-rmdir $(DESTDIR)$(mandir)
|
||||
-rmdir $(DESTDIR)$(libexecdir)
|
||||
|
||||
uninstall:
|
||||
-rm -f $(DESTDIR)$(bindir)/slogin
|
||||
-rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
|
||||
-rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
|
||||
-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
|
||||
|
||||
regress-prep:
|
||||
[ -d `pwd`/regress ] || mkdir -p `pwd`/regress
|
||||
[ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests
|
||||
[ -d `pwd`/regress/unittests/test_helper ] || \
|
||||
mkdir -p `pwd`/regress/unittests/test_helper
|
||||
[ -d `pwd`/regress/unittests/sshbuf ] || \
|
||||
mkdir -p `pwd`/regress/unittests/sshbuf
|
||||
[ -d `pwd`/regress/unittests/sshkey ] || \
|
||||
mkdir -p `pwd`/regress/unittests/sshkey
|
||||
[ -d `pwd`/regress/unittests/bitmap ] || \
|
||||
mkdir -p `pwd`/regress/unittests/bitmap
|
||||
[ -d `pwd`/regress/unittests/hostkeys ] || \
|
||||
mkdir -p `pwd`/regress/unittests/hostkeys
|
||||
[ -d `pwd`/regress/unittests/kex ] || \
|
||||
mkdir -p `pwd`/regress/unittests/kex
|
||||
[ -f `pwd`/regress/Makefile ] || \
|
||||
ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
|
||||
|
||||
regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
|
||||
$(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
|
||||
$(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
regress/netcat$(EXEEXT): $(srcdir)/regress/netcat.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
|
||||
$(LDFLAGS) ./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
UNITTESTS_TEST_HELPER_OBJS=\
|
||||
regress/unittests/test_helper/test_helper.o \
|
||||
regress/unittests/test_helper/fuzz.o
|
||||
|
||||
regress/unittests/test_helper/libtest_helper.a: ${UNITTESTS_TEST_HELPER_OBJS}
|
||||
$(AR) rv $@ $(UNITTESTS_TEST_HELPER_OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
UNITTESTS_TEST_SSHBUF_OBJS=\
|
||||
regress/unittests/sshbuf/tests.o \
|
||||
regress/unittests/sshbuf/test_sshbuf.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_getput_basic.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_getput_crypto.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_misc.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_fuzz.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_getput_fuzz.o \
|
||||
regress/unittests/sshbuf/test_sshbuf_fixed.o
|
||||
|
||||
regress/unittests/sshbuf/test_sshbuf$(EXEEXT): ${UNITTESTS_TEST_SSHBUF_OBJS} \
|
||||
regress/unittests/test_helper/libtest_helper.a libssh.a
|
||||
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHBUF_OBJS) \
|
||||
regress/unittests/test_helper/libtest_helper.a \
|
||||
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
UNITTESTS_TEST_SSHKEY_OBJS=\
|
||||
regress/unittests/sshkey/test_fuzz.o \
|
||||
regress/unittests/sshkey/tests.o \
|
||||
regress/unittests/sshkey/common.o \
|
||||
regress/unittests/sshkey/test_file.o \
|
||||
regress/unittests/sshkey/test_sshkey.o
|
||||
|
||||
regress/unittests/sshkey/test_sshkey$(EXEEXT): ${UNITTESTS_TEST_SSHKEY_OBJS} \
|
||||
regress/unittests/test_helper/libtest_helper.a libssh.a
|
||||
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHKEY_OBJS) \
|
||||
regress/unittests/test_helper/libtest_helper.a \
|
||||
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
UNITTESTS_TEST_BITMAP_OBJS=\
|
||||
regress/unittests/bitmap/tests.o
|
||||
|
||||
regress/unittests/bitmap/test_bitmap$(EXEEXT): ${UNITTESTS_TEST_BITMAP_OBJS} \
|
||||
regress/unittests/test_helper/libtest_helper.a libssh.a
|
||||
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_BITMAP_OBJS) \
|
||||
regress/unittests/test_helper/libtest_helper.a \
|
||||
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
UNITTESTS_TEST_KEX_OBJS=\
|
||||
regress/unittests/kex/tests.o \
|
||||
regress/unittests/kex/test_kex.o \
|
||||
roaming_dummy.o
|
||||
|
||||
regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \
|
||||
regress/unittests/test_helper/libtest_helper.a libssh.a
|
||||
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_KEX_OBJS) \
|
||||
regress/unittests/test_helper/libtest_helper.a \
|
||||
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
UNITTESTS_TEST_HOSTKEYS_OBJS=\
|
||||
regress/unittests/hostkeys/tests.o \
|
||||
regress/unittests/hostkeys/test_iterate.o
|
||||
|
||||
regress/unittests/hostkeys/test_hostkeys$(EXEEXT): \
|
||||
${UNITTESTS_TEST_HOSTKEYS_OBJS} \
|
||||
regress/unittests/test_helper/libtest_helper.a libssh.a
|
||||
$(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_HOSTKEYS_OBJS) \
|
||||
regress/unittests/test_helper/libtest_helper.a \
|
||||
./libssh.a -lopenbsd-compat -lwin32compat $(LIBS)
|
||||
|
||||
REGRESS_BINARIES=\
|
||||
regress/modpipe$(EXEEXT) \
|
||||
regress/setuid-allowed$(EXEEXT) \
|
||||
regress/netcat$(EXEEXT) \
|
||||
regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
|
||||
regress/unittests/sshkey/test_sshkey$(EXEEXT) \
|
||||
regress/unittests/bitmap/test_bitmap$(EXEEXT) \
|
||||
regress/unittests/hostkeys/test_hostkeys$(EXEEXT) \
|
||||
regress/unittests/kex/test_kex$(EXEEXT)
|
||||
|
||||
tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES)
|
||||
BUILDDIR=`pwd`; \
|
||||
TEST_SSH_SCP="$${BUILDDIR}/scp"; \
|
||||
TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
|
||||
TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
|
||||
TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
|
||||
TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
|
||||
TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
|
||||
TEST_SSH_SSHPKCS11HELPER="$${BUILDDIR}/ssh-pkcs11-helper"; \
|
||||
TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
|
||||
TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
|
||||
TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
|
||||
TEST_SSH_PLINK="plink"; \
|
||||
TEST_SSH_PUTTYGEN="puttygen"; \
|
||||
TEST_SSH_CONCH="conch"; \
|
||||
TEST_SSH_IPV6="no" ; \
|
||||
TEST_SSH_ECC="yes" ; \
|
||||
cd $(srcdir)/regress || exit $$?; \
|
||||
$(MAKE) \
|
||||
.OBJDIR="$${BUILDDIR}/regress" \
|
||||
.CURDIR="`pwd`" \
|
||||
BUILDDIR="$${BUILDDIR}" \
|
||||
OBJ="$${BUILDDIR}/regress/" \
|
||||
PATH="$${BUILDDIR}:$${PATH}" \
|
||||
TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
|
||||
TEST_SSH_SCP="$${TEST_SSH_SCP}" \
|
||||
TEST_SSH_SSH="$${TEST_SSH_SSH}" \
|
||||
TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
|
||||
TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
|
||||
TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
|
||||
TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
|
||||
TEST_SSH_SSHPKCS11HELPER="$${TEST_SSH_SSHPKCS11HELPER}" \
|
||||
TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
|
||||
TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
|
||||
TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
|
||||
TEST_SSH_PLINK="$${TEST_SSH_PLINK}" \
|
||||
TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \
|
||||
TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
|
||||
TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
|
||||
TEST_SSH_ECC="$${TEST_SSH_ECC}" \
|
||||
TEST_SHELL="${TEST_SHELL}" \
|
||||
EXEEXT="$(EXEEXT)" \
|
||||
$@ && echo all tests passed
|
||||
|
||||
compat-tests: $(LIBCOMPAT)
|
||||
(cd openbsd-compat/regress && $(MAKE))
|
||||
|
||||
regressclean:
|
||||
if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
|
||||
(cd regress && $(MAKE) clean) \
|
||||
fi
|
||||
|
||||
survey: survey.sh ssh
|
||||
@$(SHELL) ./survey.sh > survey
|
||||
@echo 'The survey results have been placed in the file "survey" in the'
|
||||
@echo 'current directory. Please review the file then send with'
|
||||
@echo '"make send-survey".'
|
||||
|
||||
send-survey: survey
|
||||
mail portable-survey@mindrot.org <survey
|
||||
|
||||
package: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
|
||||
if [ "no" = yes ]; then \
|
||||
sh buildpkg.sh; \
|
||||
fi
|
@ -44,7 +44,7 @@ CC=@CC@
|
||||
LD=@LD@
|
||||
CFLAGS=@CFLAGS@
|
||||
CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
|
||||
LIBS=@LIBS@
|
||||
LIBS=@LIBS@ -lbcrypt
|
||||
K5LIBS=@K5LIBS@
|
||||
GSSLIBS=@GSSLIBS@
|
||||
SSHLIBS=@SSHLIBS@
|
||||
@ -58,7 +58,7 @@ PERL=@PERL@
|
||||
SED=@SED@
|
||||
ENT=@ENT@
|
||||
XAUTH_PATH=@XAUTH_PATH@
|
||||
LDFLAGS=-L. -Lopenbsd-compat/ -Lcontrib/win32/win32compat @LDFLAGS@
|
||||
LDFLAGS=-L. -Lopenbsd-compat/ -Lcontrib/win32/win32compat @LDFLAGS@ -L/lib/w32api
|
||||
EXEEXT=@EXEEXT@
|
||||
MANFMT=@MANFMT@
|
||||
|
||||
|
1
README
1
README
@ -1,4 +1,5 @@
|
||||
See http://www.openssh.com/txt/release-7.1 for the release notes.
|
||||
See https://github.com/PowerShell/Win32-OpenSSH/wiki for build/deployment information
|
||||
|
||||
Please read http://www.openssh.com/report.html for bug reporting
|
||||
instructions and note that we do not use Github for bug reporting or
|
||||
|
17
channels.c
17
channels.c
@ -2454,25 +2454,16 @@ channel_input_data(int type, u_int32_t seq, void *ctxt)
|
||||
c->local_window -= win_len;
|
||||
}
|
||||
|
||||
#ifdef WIN32_FIXME
|
||||
if ( (c->client_tty) && (data_len >= 5) ) {
|
||||
if ( data[0] == '\033' ) { // escape char octal 33, decimal 27
|
||||
if ( (data[1] == '[') && (data[2]== '2') && (data[3]== '0') && ( data[4]== 'h' )) {
|
||||
lftocrlf = 1;
|
||||
data = data + 5 ; // we have processed the 5 bytes ESC sequence
|
||||
data_len = data_len - 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c->datagram)
|
||||
buffer_put_string(&c->output, data, data_len);
|
||||
else {
|
||||
#ifndef WIN32_FIXME
|
||||
buffer_append(&c->output, data, data_len);
|
||||
#else
|
||||
buffer_append(&c->output, data, data_len);
|
||||
if ( c->client_tty )
|
||||
telProcessNetwork ( data, data_len ); // run it by ANSI engine if it is the ssh client
|
||||
else
|
||||
buffer_append(&c->output, data, data_len); // it is the sshd server, so pass it on
|
||||
if ( c->isatty ) {
|
||||
buffer_append(&c->input, data, data_len); // we echo the data if it is sshd server and pty interactive mode
|
||||
if ( (data_len ==1) && (data[0] == '\b') )
|
||||
|
68
cipher.c
68
cipher.c
@ -34,7 +34,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -43,6 +43,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "cipher.h"
|
||||
#include "misc.h"
|
||||
#include "sshbuf.h"
|
||||
@ -51,6 +52,12 @@
|
||||
|
||||
#include "openbsd-compat/openssl-compat.h"
|
||||
|
||||
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
#undef WITH_OPENSSL
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SSH1
|
||||
extern const EVP_CIPHER *evp_ssh1_bf(void);
|
||||
extern const EVP_CIPHER *evp_ssh1_3des(void);
|
||||
@ -108,9 +115,19 @@ static const struct sshcipher ciphers[] = {
|
||||
SSH_CIPHER_SSH2, 16, 32, 12, 16, 0, 0, EVP_aes_256_gcm },
|
||||
# endif /* OPENSSL_HAVE_EVPGCM */
|
||||
#else /* WITH_OPENSSL */
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
{ "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CTR, NULL },
|
||||
{ "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CTR, NULL },
|
||||
{ "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CTR, NULL },
|
||||
{ "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CBC, NULL },
|
||||
{ "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CBC, NULL },
|
||||
{ "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, _CNG_CIPHER_AES | _CNG_MODE_CBC, NULL },
|
||||
#else
|
||||
{ "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, CFLAG_AESCTR, NULL },
|
||||
{ "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, CFLAG_AESCTR, NULL },
|
||||
{ "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, CFLAG_AESCTR, NULL },
|
||||
#endif
|
||||
{ "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, CFLAG_NONE, NULL },
|
||||
#endif /* WITH_OPENSSL */
|
||||
{ "chacha20-poly1305@openssh.com",
|
||||
@ -293,6 +310,8 @@ cipher_init(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
|
||||
const u_char *key, u_int keylen, const u_char *iv, u_int ivlen,
|
||||
int do_encrypt)
|
||||
{
|
||||
|
||||
|
||||
#ifdef WITH_OPENSSL
|
||||
int ret = SSH_ERR_INTERNAL_ERROR;
|
||||
const EVP_CIPHER *type;
|
||||
@ -316,11 +335,25 @@ cipher_init(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
|
||||
return chachapoly_init(&cc->cp_ctx, key, keylen);
|
||||
}
|
||||
#ifndef WITH_OPENSSL
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
|
||||
/* cng shares cipher flag with NONE. Make sure the NONE cipher isn't requested */
|
||||
if ((cc->cipher->flags & CFLAG_NONE) == 0)
|
||||
{
|
||||
|
||||
if (cng_cipher_init(&cc->cng_ctx,key,keylen,iv, ivlen,cc->cipher->flags))
|
||||
return SSH_ERR_LIBCRYPTO_ERROR;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
|
||||
aesctr_keysetup(&cc->ac_ctx, key, 8 * keylen, 8 * ivlen);
|
||||
aesctr_ivsetup(&cc->ac_ctx, iv);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if ((cc->cipher->flags & CFLAG_NONE) != 0)
|
||||
return 0;
|
||||
return SSH_ERR_INVALID_ARGUMENT;
|
||||
@ -373,6 +406,7 @@ cipher_init(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* cipher_crypt() operates as following:
|
||||
* Copy 'aadlen' bytes (without en/decryption) from 'src' to 'dest'.
|
||||
@ -387,18 +421,44 @@ int
|
||||
cipher_crypt(struct sshcipher_ctx *cc, u_int seqnr, u_char *dest,
|
||||
const u_char *src, u_int len, u_int aadlen, u_int authlen)
|
||||
{
|
||||
#ifdef USE_MSCNG
|
||||
int ret = 0;
|
||||
#endif
|
||||
|
||||
if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
|
||||
return chachapoly_crypt(&cc->cp_ctx, seqnr, dest, src,
|
||||
len, aadlen, authlen, cc->encrypt);
|
||||
}
|
||||
#ifndef WITH_OPENSSL
|
||||
if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
|
||||
/* cng shares cipher flag with NONE. Make sure the NONE cipher isn't requested */
|
||||
if ((cc->cipher->flags & CFLAG_NONE) == 0)
|
||||
{
|
||||
if (aadlen)
|
||||
memcpy(dest, src, aadlen);
|
||||
if (cc->encrypt)
|
||||
ret = cng_cipher_encrypt(&cc->cng_ctx,dest+aadlen, len, src+aadlen,len);
|
||||
else
|
||||
ret = cng_cipher_decrypt(&cc->cng_ctx,dest+aadlen, len, src+aadlen, len);
|
||||
|
||||
if (ret != len){
|
||||
return SSH_ERR_LIBCRYPTO_ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
|
||||
if (aadlen)
|
||||
memcpy(dest, src, aadlen);
|
||||
aesctr_encrypt_bytes(&cc->ac_ctx, src + aadlen,
|
||||
dest + aadlen, len);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if ((cc->cipher->flags & CFLAG_NONE) != 0) {
|
||||
memcpy(dest, src, aadlen + len);
|
||||
return 0;
|
||||
@ -472,6 +532,10 @@ cipher_cleanup(struct sshcipher_ctx *cc)
|
||||
else if (EVP_CIPHER_CTX_cleanup(&cc->evp) == 0)
|
||||
return SSH_ERR_LIBCRYPTO_ERROR;
|
||||
#endif
|
||||
#ifdef USE_MSCNG
|
||||
else
|
||||
cng_cipher_cleanup(&cc->cng_ctx);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
8
cipher.h
8
cipher.h
@ -41,7 +41,9 @@
|
||||
#include <openssl/evp.h>
|
||||
#include "cipher-chachapoly.h"
|
||||
#include "cipher-aesctr.h"
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
#include "contrib/win32/win32compat/cng_cipher.h"
|
||||
#endif
|
||||
/*
|
||||
* Cipher types for SSH-1. New types can be added, but old types should not
|
||||
* be removed for compatibility. The maximum allowed value is 31.
|
||||
@ -70,6 +72,10 @@ struct sshcipher_ctx {
|
||||
struct chachapoly_ctx cp_ctx; /* XXX union with evp? */
|
||||
struct aesctr_ctx ac_ctx; /* XXX union with evp? */
|
||||
const struct sshcipher *cipher;
|
||||
#ifdef USE_MSCNG
|
||||
struct ssh_cng_cipher_ctx cng_ctx;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
u_int cipher_mask_ssh1(int);
|
||||
|
211
config.h
211
config.h
@ -83,7 +83,7 @@
|
||||
/* #undef BSD_AUTH */
|
||||
|
||||
/* Define if you want to specify the path to your lastlog file */
|
||||
/* #undef CONF_LASTLOG_FILE */
|
||||
#define CONF_LASTLOG_FILE "/var/log/lastlog"
|
||||
|
||||
/* Define if you want to specify the path to your utmp file */
|
||||
#define CONF_UTMP_FILE "/var/run/utmp"
|
||||
@ -1540,107 +1540,108 @@
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
/* #undef socklen_t */
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define WIN32_FIXME 1
|
||||
#undef USE_NTCREATETOKEN
|
||||
|
||||
/* Define if you must implement a startup_needs function for your platform */
|
||||
#define HAVE_STARTUP_NEEDS 1
|
||||
|
||||
/* Define if your platform uses Winsock instead of BSD sockets (yeah, there are a lot of platforms like this :) */
|
||||
#define HAVE_WINSOCK 1
|
||||
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define BROKEN_READV_COMPARISON
|
||||
|
||||
/* Override detection of some headers and functions on MinGW */
|
||||
#undef BROKEN_SNPRINTF
|
||||
#define GETPGRP_VOID 1
|
||||
#undef HAVE_CRYPT_H
|
||||
#define HAVE_DAEMON 1
|
||||
#undef HAVE_ENDIAN_H
|
||||
#undef HAVE_FCNTL_H
|
||||
#define HAVE_FREEADDRINFO 1
|
||||
#define HAVE_GAI_STRERROR 1
|
||||
#define HAVE_GETADDRINFO 1
|
||||
#define HAVE_GETGROUPLIST 1
|
||||
#define HAVE_GETNAMEINFO 1
|
||||
#undef HAVE_ID_IN_UTMPX
|
||||
#define HAVE_INET_ATON 1
|
||||
#define HAVE_INET_NTOA 1
|
||||
#define HAVE_INNETGR 1
|
||||
#undef HAVE_LIBCRYPT
|
||||
#define HAVE_MKDTEMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#undef HAVE_PATHS_H
|
||||
#undef HAVE_POLL_H
|
||||
#undef HAVE_PROC_PID
|
||||
#undef HAVE_PTY_H
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_READPASSPHRASE 1
|
||||
#define HAVE_REALPATH 1
|
||||
#undef HAVE_SIG_ATOMIC_T
|
||||
#define HAVE_SIZE_T 1
|
||||
#undef HAVE_STRERROR
|
||||
#define HAVE_STRMODE 1
|
||||
#undef __USE_W32_SOCKETS
|
||||
|
||||
#ifdef __MINGW32__ /* FIXME: Use autoconf to set this correctly */
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#endif
|
||||
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
#undef HAVE_SYS_SYSMACROS_H
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
#define HAVE_TCGETPGRP 1
|
||||
|
||||
#undef HAVE_TIME
|
||||
|
||||
#define HAVE_TRUNCATE 1
|
||||
|
||||
#define HAVE_VIS_H 1
|
||||
|
||||
#define MISSING_FD_MASK 1
|
||||
#define MISSING_HOWMANY 1
|
||||
#define MISSING_NFDBITS 1
|
||||
|
||||
#undef SSH_PRIVSEP_USER
|
||||
|
||||
#define HAVE_OPENPTY 1
|
||||
|
||||
/* Fixes for loginrec.c */
|
||||
#undef CONF_UTMP_FILE
|
||||
#undef CONF_WTMPX_FILE
|
||||
#undef CONF_WTMP_FILE
|
||||
#undef CONF_UTMPX_FILE
|
||||
#undef CONF_LASTLOG_FILE
|
||||
|
||||
#define BROKEN_SYS_TERMIO_H
|
||||
|
||||
#define strerror strerror_win32
|
||||
|
||||
#define strerror strerror_win32
|
||||
|
||||
// PRAGMA SYS PORT
|
||||
#define WITH_OPENSSL 1
|
||||
#define HAVE_KRB5_GET_ERROR_MESSAGE 1
|
||||
#define HAVE_KRB5_FREE_ERROR_MESSAGE 1
|
||||
#define HAVE_DECL_NFDBITS 0
|
||||
#define HAVE_DECL_HOWMANY 0
|
||||
|
||||
#define WIN32_ZLIB_NO 1
|
||||
|
||||
//#define HAVE_ARC4RANDOM_UNIFORM 1
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define WIN32_FIXME 1
|
||||
#undef USE_NTCREATETOKEN
|
||||
|
||||
/* Define if you must implement a startup_needs function for your platform */
|
||||
#define HAVE_STARTUP_NEEDS 1
|
||||
|
||||
/* Define if your platform uses Winsock instead of BSD sockets (yeah, there are a lot of platforms like this :) */
|
||||
#define HAVE_WINSOCK 1
|
||||
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define BROKEN_READV_COMPARISON
|
||||
|
||||
/* Override detection of some headers and functions on MinGW */
|
||||
#undef BROKEN_SNPRINTF
|
||||
#define GETPGRP_VOID 1
|
||||
#undef HAVE_CRYPT_H
|
||||
#define HAVE_DAEMON 1
|
||||
#undef HAVE_ENDIAN_H
|
||||
#undef HAVE_FCNTL_H
|
||||
#define HAVE_FREEADDRINFO 1
|
||||
#define HAVE_GAI_STRERROR 1
|
||||
#define HAVE_GETADDRINFO 1
|
||||
#define HAVE_GETGROUPLIST 1
|
||||
#define HAVE_GETNAMEINFO 1
|
||||
#undef HAVE_ID_IN_UTMPX
|
||||
#define HAVE_INET_ATON 1
|
||||
#define HAVE_INET_NTOA 1
|
||||
#define HAVE_INNETGR 1
|
||||
#undef HAVE_LIBCRYPT
|
||||
#define HAVE_MKDTEMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#undef HAVE_PATHS_H
|
||||
#undef HAVE_POLL_H
|
||||
#undef HAVE_PROC_PID
|
||||
#undef HAVE_PTY_H
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_READPASSPHRASE 1
|
||||
#define HAVE_REALPATH 1
|
||||
#undef HAVE_SIG_ATOMIC_T
|
||||
#define HAVE_SIZE_T 1
|
||||
#undef HAVE_STRERROR
|
||||
#define HAVE_STRMODE 1
|
||||
#undef __USE_W32_SOCKETS
|
||||
|
||||
#ifdef __MINGW32__ /* FIXME: Use autoconf to set this correctly */
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#endif
|
||||
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
#undef HAVE_SYS_SYSMACROS_H
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
#define HAVE_TCGETPGRP 1
|
||||
|
||||
#undef HAVE_TIME
|
||||
|
||||
#define HAVE_TRUNCATE 1
|
||||
|
||||
#define HAVE_VIS_H 1
|
||||
|
||||
#define MISSING_FD_MASK 1
|
||||
#define MISSING_HOWMANY 1
|
||||
#define MISSING_NFDBITS 1
|
||||
|
||||
#undef SSH_PRIVSEP_USER
|
||||
|
||||
#define HAVE_OPENPTY 1
|
||||
|
||||
/* Fixes for loginrec.c */
|
||||
#undef CONF_UTMP_FILE
|
||||
#undef CONF_WTMPX_FILE
|
||||
#undef CONF_WTMP_FILE
|
||||
#undef CONF_UTMPX_FILE
|
||||
#undef CONF_LASTLOG_FILE
|
||||
|
||||
#define BROKEN_SYS_TERMIO_H
|
||||
|
||||
#define strerror strerror_win32
|
||||
|
||||
#define strerror strerror_win32
|
||||
|
||||
// PRAGMA SYS PORT
|
||||
#define WITH_OPENSSL 1
|
||||
#define HAVE_KRB5_GET_ERROR_MESSAGE 1
|
||||
#define HAVE_KRB5_FREE_ERROR_MESSAGE 1
|
||||
#define HAVE_DECL_NFDBITS 0
|
||||
#define HAVE_DECL_HOWMANY 0
|
||||
|
||||
#define WIN32_ZLIB_NO 1
|
||||
#define USE_MSCNG 1
|
||||
|
||||
//#define HAVE_ARC4RANDOM_UNIFORM 1
|
||||
|
||||
|
@ -99,6 +99,7 @@
|
||||
#define HAVE_DECL_HOWMANY 0
|
||||
|
||||
#define WIN32_ZLIB_NO 1
|
||||
#define USE_MSCNG 1
|
||||
|
||||
//#define HAVE_ARC4RANDOM_UNIFORM 1
|
||||
|
||||
|
@ -8,25 +8,32 @@ top_srcdir=@top_srcdir@
|
||||
VPATH=@srcdir@
|
||||
CC=@CC@
|
||||
LD=@LD@
|
||||
CFLAGS=@CFLAGS@
|
||||
CPPFLAGS=-I. -I../../.. -I$(srcdir) -I$(top_srcdir) -I$(srcdir)/includes @CPPFLAGS@ @DEFS@
|
||||
LIBS=@LIBS@
|
||||
BCRYPTFLAGS=-I/usr/include/w32api
|
||||
CFLAGS=@CFLAGS@
|
||||
CPPFLAGS=-I. -I../../.. -I$(srcdir) -I$(top_srcdir) -I$(srcdir)/includes @CPPFLAGS@ @DEFS@ -DUSE_MSCNG
|
||||
LIBS=@LIBS@ -lbcrypt
|
||||
AR=@AR@
|
||||
RANLIB=@RANLIB@
|
||||
INSTALL=@INSTALL@
|
||||
LDFLAGS=-L. @LDFLAGS@
|
||||
LDFLAGS=-L. @LDFLAGS@ -L/lib/win32api
|
||||
|
||||
WIN32COMPATFILES = daemon.o gettimeofday.o homedirhelp.o pwd.o sfds.o \
|
||||
socket.o startupneeds.o strcasecmp.o syslog.o lsalogon.o lsastring.o \
|
||||
stringhelp.o deskright.o win32auth.o kerberos.o
|
||||
stringhelp.o deskright.o win32auth.o kerberos.o cng_cipher.o ansiprsr.o console.o tnnet.o
|
||||
|
||||
WIN32COMPATLIB=@LIBWIN32COMPAT@
|
||||
|
||||
CNGFILES=cng_cipher.o
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
all: $(WIN32COMPATLIB)
|
||||
|
||||
$(CNGFILES): %.o: %.c
|
||||
$(CC) $(CFLAGS) $(BCRYPTFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
||||
|
922
contrib/win32/win32compat/ansiprsr.c
Normal file
922
contrib/win32/win32compat/ansiprsr.c
Normal file
@ -0,0 +1,922 @@
|
||||
/* ansiprsr.c
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* ANSI Parser to run on Win32 based operating systems.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "ansiprsr.h"
|
||||
#include "tncon.h"
|
||||
#include "tnnet.h"
|
||||
|
||||
#define TS_IS 0
|
||||
#define TS_SEND 1
|
||||
|
||||
// items used from other modules
|
||||
int NetWriteString(char* pszString, size_t cbString);
|
||||
TelParams Parameters;
|
||||
extern int lftocrlf;
|
||||
|
||||
extern int ScreenX;
|
||||
extern int ScreenY;
|
||||
extern int ScrollTop;
|
||||
extern int ScrollBottom;
|
||||
// end of imports from outside module
|
||||
|
||||
bool gbVTAppMode = false;
|
||||
|
||||
// private message for port printing to
|
||||
unsigned char VT_ST[] = { 0x1b, '/', '\0' };
|
||||
|
||||
static int AutoWrap = 1;
|
||||
|
||||
int marginTop, marginBottom;
|
||||
BOOL bAtEOLN = FALSE;
|
||||
|
||||
static int term_mode;
|
||||
|
||||
// ParseANSI globals - these need to be here, because sometimes blocks are sent
|
||||
// in mid ANSI sequence
|
||||
int iParam[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int iCurrentParam = 0;
|
||||
int bDelimiter = 0;
|
||||
int bMode = 0;
|
||||
int fcompletion = 1;
|
||||
int bExtMode = 0;
|
||||
int bCS0 = 0;
|
||||
int bCS1 = 0;
|
||||
int bBkMode = 0;
|
||||
int bCharMode = 0;
|
||||
|
||||
|
||||
BOOL fShiftOut = FALSE;
|
||||
BOOL InPrintMode = FALSE;
|
||||
BOOL fPcMode = FALSE;
|
||||
|
||||
char printErr[] = "Unable to Print: Printer not assigned. Press any key to continue...";
|
||||
|
||||
#define MODE_CURSORAPP 0x0001
|
||||
#define MODE_ANSIVT52 0x0002
|
||||
#define MODE_COL132 0x0004
|
||||
#define MODE_SMOOTHSCROLL 0x0008
|
||||
#define MODE_REVERSESCREEN 0x0010
|
||||
#define MODE_ORIGINREL 0x0020
|
||||
#define MODE_WRAPAROUND 0x0040
|
||||
#define MODE_AUTOREPEAT 0x0080
|
||||
#define MODE_APPMODE 0x0100
|
||||
#define MODE_LNM 0x0200
|
||||
#define MODE_IRM_INSERT 0x0400
|
||||
|
||||
int VTMode = 0;
|
||||
|
||||
#define MODE_CURSORAPP 0x0001
|
||||
#define MODE_ANSIVT52 0x0002
|
||||
#define MODE_COL132 0x0004
|
||||
#define MODE_SMOOTHSCROLL 0x0008
|
||||
#define MODE_REVERSESCREEN 0x0010
|
||||
#define MODE_ORIGINREL 0x0020
|
||||
#define MODE_WRAPAROUND 0x0040
|
||||
#define MODE_AUTOREPEAT 0x0080
|
||||
#define MODE_APPMODE 0x0100
|
||||
#define MODE_LNM 0x0200
|
||||
|
||||
char *GetTerminalId()
|
||||
{
|
||||
return "\033[?1;2c";
|
||||
}
|
||||
|
||||
char * GetStatusReport()
|
||||
{
|
||||
return "\033[2;5R";
|
||||
}
|
||||
|
||||
void BufConvertToG2(char * pszBuffer, int length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<length;i++)
|
||||
pszBuffer[i]='|';
|
||||
//*(pszBuffer+i) += 20;
|
||||
}
|
||||
|
||||
|
||||
void GoToNextLine()
|
||||
{
|
||||
if (ConGetCursorY() >= (ConWindowSizeY()-1))
|
||||
{
|
||||
ConScrollDown(ScrollTop,ScrollBottom);
|
||||
ConMoveCursorPosition(-ConGetCursorX(),0);
|
||||
}
|
||||
else
|
||||
ConMoveCursorPosition(-ConGetCursorX(),1);
|
||||
bAtEOLN = FALSE;
|
||||
}
|
||||
|
||||
unsigned char* ParseBuffer(unsigned char* pszBuffer, unsigned char* pszBufferEnd)
|
||||
{
|
||||
int CurrentX;
|
||||
int CurrentY;
|
||||
int rc = 0, bufLen, cmpLen, i;
|
||||
|
||||
|
||||
if (!fcompletion)
|
||||
{
|
||||
if (pszBuffer < pszBufferEnd -1)
|
||||
{
|
||||
unsigned char * pszCurrent = pszBuffer+1;
|
||||
unsigned char * pszNewCurrent = pszCurrent;
|
||||
|
||||
if (term_mode == TERM_ANSI)
|
||||
{
|
||||
pszNewCurrent = ParseANSI(pszCurrent, pszBufferEnd);
|
||||
}
|
||||
else if (term_mode == TERM_VT52)
|
||||
{
|
||||
pszNewCurrent = ParseVT52(pszCurrent, pszBufferEnd);
|
||||
}
|
||||
if ( pszCurrent == pszNewCurrent ) // didn't move inside Parsefunction
|
||||
{
|
||||
pszNewCurrent += ConWriteString( (char *)pszCurrent, 1);
|
||||
return pszBuffer + 1;
|
||||
}
|
||||
if (pszNewCurrent > pszCurrent )
|
||||
pszBuffer = pszNewCurrent;
|
||||
}
|
||||
}
|
||||
switch ((unsigned char) (*pszBuffer))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 11:
|
||||
pszBuffer++;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
Beep( 1000, 400);
|
||||
pszBuffer++;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
pszBuffer++;
|
||||
if (!bAtEOLN)
|
||||
{
|
||||
CurrentX = ConGetCursorX();
|
||||
if (CurrentX == 0)
|
||||
{
|
||||
ConMoveCursorPosition( ScreenX-1,-1);
|
||||
ConWriteString(" ",1);
|
||||
// ConMoveCursorPosition(-1,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConClearNFromCursorLeft(1);
|
||||
ConMoveCursorPosition( -1, 0 );
|
||||
}
|
||||
}
|
||||
bAtEOLN = FALSE;
|
||||
|
||||
//ConWriteString( " ", 1 );
|
||||
//ConMoveCursorPosition( -1, 0 );
|
||||
break;
|
||||
|
||||
case 9:
|
||||
{
|
||||
if (bAtEOLN) GoToNextLine();
|
||||
int i, MoveRight = 8 - (ConGetCursorX() % 8);
|
||||
|
||||
for ( i = 0; i < MoveRight; i++ )
|
||||
ConWriteString( " ", 1 );
|
||||
pszBuffer++;
|
||||
AutoWrap = 1;
|
||||
bAtEOLN = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
|
||||
|
||||
pszBuffer++;
|
||||
CurrentY = ConGetCursorY();
|
||||
|
||||
|
||||
if (CurrentY >= marginBottom )
|
||||
{
|
||||
if (VTMode & MODE_APPMODE)
|
||||
ConScrollDown(marginTop,marginBottom);
|
||||
else
|
||||
printf("\n");
|
||||
ConMoveCursorPosition(-ConGetCursorX(),0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConMoveCursorPosition(0,1);
|
||||
}
|
||||
if ( Parameters.nReceiveCRLF == ENUM_LF )
|
||||
ConMoveCursorPosition(-ConGetCursorX(),0);
|
||||
AutoWrap = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
pszBuffer++;
|
||||
ConSetCursorPosition(0, 0);
|
||||
ConClearScreen();
|
||||
AutoWrap = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
pszBuffer++;
|
||||
ConMoveCursorPosition(-ConGetCursorX(),0);
|
||||
AutoWrap = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
pszBuffer++;
|
||||
fShiftOut = TRUE;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
fShiftOut = FALSE;
|
||||
pszBuffer++;
|
||||
break;
|
||||
|
||||
case 27:
|
||||
if (pszBuffer < pszBufferEnd -1)
|
||||
{
|
||||
unsigned char * pszCurrent = pszBuffer+1;
|
||||
unsigned char * pszNewCurrent = pszCurrent;
|
||||
|
||||
if ( *pszCurrent == 27 )
|
||||
{
|
||||
pszNewCurrent += ConWriteString( (char *)pszCurrent, 1);
|
||||
return pszBuffer + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (term_mode == TERM_ANSI)
|
||||
{
|
||||
pszNewCurrent = ParseANSI(pszCurrent, pszBufferEnd);
|
||||
}
|
||||
else if (term_mode == TERM_VT52)
|
||||
{
|
||||
pszNewCurrent = ParseVT52(pszCurrent, pszBufferEnd);
|
||||
}
|
||||
}
|
||||
if (pszNewCurrent > pszCurrent )
|
||||
pszBuffer = pszNewCurrent;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (bAtEOLN) GoToNextLine();
|
||||
|
||||
unsigned char* pszCurrent = pszBuffer;
|
||||
CurrentX = ConGetCursorX();
|
||||
|
||||
while ((pszCurrent < pszBufferEnd) && (*pszCurrent != (unsigned char)27)
|
||||
&& (*pszCurrent > (unsigned char)15) && (*pszCurrent != (unsigned char)255)
|
||||
&& (CurrentX++ < ScreenX ))
|
||||
// (*pszCurrent != (char)15) && (*pszCurrent != (char)14) &&
|
||||
// (*pszCurrent != (char)12) && (*pszCurrent != (char)13) && (*pszCurrent != (char)8) &&
|
||||
// (*pszCurrent != (char)9))
|
||||
pszCurrent++;
|
||||
|
||||
if (fShiftOut)
|
||||
memset( pszBuffer, '|', pszCurrent-pszBuffer );
|
||||
|
||||
pszBuffer += ConWriteString((char *)pszBuffer, (int)(pszCurrent - pszBuffer));
|
||||
|
||||
if ((CurrentX >= ScreenX) && AutoWrap && !(VTMode & MODE_CURSORAPP) )
|
||||
{
|
||||
bAtEOLN = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pszBuffer;
|
||||
}
|
||||
|
||||
|
||||
unsigned char * GetNextChar(unsigned char * pszBuffer, unsigned char *pszBufferEnd)
|
||||
{
|
||||
if (++pszBuffer > pszBufferEnd)
|
||||
return NULL;
|
||||
else
|
||||
return pszBuffer;
|
||||
}
|
||||
|
||||
void ConSetExtendedMode(int iFunction, BOOL bEnable)
|
||||
{
|
||||
switch(iFunction)
|
||||
{
|
||||
case 1:
|
||||
if (bEnable){
|
||||
VTMode |= MODE_CURSORAPP;
|
||||
gbVTAppMode = true;
|
||||
}else{
|
||||
VTMode &= ~MODE_CURSORAPP;
|
||||
gbVTAppMode = false;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!bEnable)
|
||||
VTMode |= MODE_ANSIVT52;
|
||||
break;
|
||||
case 3:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_COL132;
|
||||
else
|
||||
VTMode &= ~MODE_COL132;
|
||||
break;
|
||||
case 4:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_SMOOTHSCROLL;
|
||||
else
|
||||
VTMode &= ~MODE_SMOOTHSCROLL;
|
||||
break;
|
||||
case 5:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_REVERSESCREEN;
|
||||
else
|
||||
VTMode &= ~MODE_REVERSESCREEN;
|
||||
break;
|
||||
case 6:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_ORIGINREL;
|
||||
else
|
||||
VTMode &= ~MODE_ORIGINREL;
|
||||
break;
|
||||
case 7:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_WRAPAROUND;
|
||||
else
|
||||
VTMode &= ~MODE_WRAPAROUND;
|
||||
break;
|
||||
case 8:
|
||||
if (bEnable)
|
||||
VTMode |= MODE_AUTOREPEAT;
|
||||
else
|
||||
VTMode &= ~MODE_AUTOREPEAT;
|
||||
break;
|
||||
case 20: // LNM Mode CSI 20h
|
||||
if (bEnable){
|
||||
VTMode |= MODE_LNM;
|
||||
Parameters.nReceiveCRLF = ENUM_LF;
|
||||
lftocrlf = 1;
|
||||
}else{
|
||||
VTMode &= ~MODE_LNM;
|
||||
Parameters.nReceiveCRLF = ENUM_CRLF;
|
||||
lftocrlf = 0;
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
ConDisplayCursor(bEnable);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ((iFunction == 2) && (bEnable))
|
||||
{
|
||||
term_mode = TERM_VT52;
|
||||
}
|
||||
}
|
||||
|
||||
#define MODE_EXT 0x00000001
|
||||
#define MODE_CS0 0x00000002
|
||||
#define MODE_CS1 0x00000004
|
||||
#define MODE_CS2 0x00000008
|
||||
#define MODE_CS3 0x00000010
|
||||
#define MODE_BRK 0x00000020
|
||||
#define MODE_CHAR 0x00000040
|
||||
#define MODE_K 0x00000080
|
||||
|
||||
#define DIGI_MASK (MODE_CS0 | MODE_CS1 | MODE_CS2 | MODE_CS3 | MODE_CHAR)
|
||||
|
||||
unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEnd)
|
||||
{
|
||||
unsigned char * pszCurrent = pszBuffer;
|
||||
const int nParam = 10; // Maximum number of parameters
|
||||
int rc = 0;
|
||||
static int SavedX = 0;
|
||||
static int SavedY = 0;
|
||||
SCREEN_HANDLE hScreen = NULL;
|
||||
char anyKey[2] = " ";
|
||||
WORD BytesRead;
|
||||
char pszServerPort[10];
|
||||
int indx;
|
||||
char jobName[40];
|
||||
|
||||
fcompletion = 0;
|
||||
do
|
||||
{
|
||||
switch ((unsigned char) *pszCurrent)
|
||||
{
|
||||
case ';': // delimiter
|
||||
bDelimiter = TRUE;
|
||||
break;
|
||||
// Modifiers
|
||||
case '?': // Extended Mode
|
||||
bMode |= MODE_EXT;
|
||||
break;
|
||||
case '(':
|
||||
bMode |= MODE_CS0;
|
||||
break;
|
||||
case ')':
|
||||
bMode |= MODE_CS1;
|
||||
break;
|
||||
case '*':
|
||||
bMode |= MODE_CS2;
|
||||
break;
|
||||
case '+':
|
||||
bMode |= MODE_CS3;
|
||||
break;
|
||||
case '[':
|
||||
bMode |= MODE_BRK;
|
||||
break;
|
||||
case '#':
|
||||
bMode |= MODE_CHAR;
|
||||
break;
|
||||
|
||||
// Termination Options
|
||||
case 0:
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case '}':
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case '<': // character set
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case '^': // private message pszCurrent++;
|
||||
while (_strnicmp((const char *)pszCurrent, (const char *)VT_ST, strlen((const char *)VT_ST) ) )// while not stop
|
||||
{
|
||||
if (_strnicmp((const char *)pszCurrent, (const char *)VT_ST, strlen((const char *)VT_ST) ) )
|
||||
pszCurrent++;
|
||||
}
|
||||
pszCurrent += strlen((const char *)VT_ST) - 1;
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'A': // British Character Set or Cursor Up
|
||||
if (bMode & MODE_CHAR)
|
||||
{
|
||||
// Britsh Character Set
|
||||
}
|
||||
else if (bMode & MODE_BRK)
|
||||
{
|
||||
// Cursor UP
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 1;
|
||||
ConMoveCursorPosition(0, -iParam[0]);
|
||||
// AutoWrap = 0;
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'B': // US ASCII or Cursor down
|
||||
if (bMode & MODE_CHAR)
|
||||
{
|
||||
// US ASCII Character Set
|
||||
}
|
||||
else if (bMode & MODE_BRK)
|
||||
{
|
||||
// Cursor DOWN
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 1;
|
||||
ConMoveCursorPosition(0, iParam[0]);
|
||||
// AutoWrap = 0;
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'C': // Finish Character Set or Cursor right
|
||||
if (bMode & MODE_CHAR)
|
||||
{
|
||||
// Britsh Character Set
|
||||
}
|
||||
else if (bMode & MODE_BRK)
|
||||
{
|
||||
// Cursor right
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 1;
|
||||
ConMoveCursorPosition(iParam[0], 0);
|
||||
// AutoWrap = 0;
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'D': // Cursor left
|
||||
if (bMode & MODE_BRK)
|
||||
{
|
||||
// Cursor left
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 1;
|
||||
ConMoveCursorPosition(-iParam[0], 0);
|
||||
// AutoWrap = 0;
|
||||
}
|
||||
else if (bMode == 0)
|
||||
{
|
||||
// Index
|
||||
ConScrollDown(ScrollTop,ScrollBottom);
|
||||
}
|
||||
fcompletion = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
|
||||
case '=': // application mode
|
||||
VTMode |= MODE_APPMODE;
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case '>': // numeric mode
|
||||
VTMode &= ~MODE_APPMODE;
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case '%': // character set definitions
|
||||
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'h':
|
||||
case 'l': // ^[?25h
|
||||
if (bMode & MODE_EXT)
|
||||
{
|
||||
if (iParam[0] == 4){
|
||||
VTMode |= MODE_IRM_INSERT;
|
||||
}
|
||||
// iParam[0] = atoi( (pszCurrent - iCurrentParam) );
|
||||
int i;
|
||||
for ( i = 0; i < iCurrentParam; i++ )
|
||||
ConSetExtendedMode(iParam[i], *pszCurrent=='h'?1:0);
|
||||
}
|
||||
else if (bMode & MODE_BRK)
|
||||
{
|
||||
// Possible set Line feed (option 20)
|
||||
// Possible set Line feed (option 20)
|
||||
if (iParam[0] == 20)
|
||||
ConSetExtendedMode(iParam[0], *pszCurrent=='h'?1:0);
|
||||
if (iParam[0] == 4){
|
||||
VTMode &= ~MODE_IRM_INSERT;
|
||||
}
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (iParam[0])
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<iParam[0]; i++)
|
||||
ConScrollUp(ConGetCursorY()-1,ScrollTop + ConWindowSizeY()-2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConGetCursorY() <= ScrollTop + ConWindowSizeY()-2)
|
||||
{
|
||||
ConScrollUp(ConGetCursorY()-1,ScrollTop + ConWindowSizeY()-2);
|
||||
}
|
||||
}
|
||||
fcompletion = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
case 'N':
|
||||
case 'O':
|
||||
fcompletion =1;
|
||||
break;
|
||||
case 'm':
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 0;
|
||||
ConSetAttribute(iParam, iCurrentParam);
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
marginTop = (iParam[0] > 0) ? iParam[0] - 1 : 0;
|
||||
marginBottom = (iParam[1] > 0) ? iParam[1] - 1 : 0;
|
||||
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'H':
|
||||
case 'f':
|
||||
if (bMode & MODE_BRK)
|
||||
{
|
||||
if ((iParam[0]-1) > ConWindowSizeY())
|
||||
ConSetScreenRect(ConWindowSizeX(), iParam[0]-1);
|
||||
ConSetCursorPosition((iParam[1] > 0) ? iParam[1] - 1 : 0, (iParam[0] > 0) ? iParam[0] - 1 : 0);
|
||||
//AutoWrap = 0;
|
||||
}
|
||||
else if (bMode == 0)
|
||||
{
|
||||
//Set tab
|
||||
}
|
||||
fcompletion = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
if (iParam[0])
|
||||
{
|
||||
int i ;
|
||||
for (i=0; i<iParam[0]; i++)
|
||||
ConScrollUp(ConGetCursorY(),ScrollTop + marginBottom - ConGetCursorY());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConGetCursorY() <= ScrollTop + ConWindowSizeY()-2)
|
||||
{
|
||||
ConScrollUp(ConGetCursorY(),ScrollTop + marginBottom - ConGetCursorY());
|
||||
}
|
||||
}
|
||||
fcompletion = 1;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
case 'E':
|
||||
case 'g':
|
||||
fcompletion = 1;
|
||||
break;
|
||||
case 'i': // ANSI or VTXXX Print
|
||||
fcompletion = 1;//
|
||||
if ( iParam[0] == 5 )
|
||||
{
|
||||
}
|
||||
else if ( iParam[0] == 4 )
|
||||
InPrintMode = FALSE;
|
||||
break;
|
||||
case 'K':
|
||||
if (bMode & MODE_BRK)
|
||||
{
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 0;
|
||||
switch (iParam[0])
|
||||
{
|
||||
case 0:
|
||||
ConClearEOLine();
|
||||
break;
|
||||
case 1:
|
||||
ConClearBOLine();
|
||||
break;
|
||||
case 2:
|
||||
ConClearLine();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (bMode == 0)
|
||||
{
|
||||
bMode |= MODE_K;
|
||||
}
|
||||
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
if (iCurrentParam < 1)
|
||||
iParam[0] = 0;
|
||||
switch (iParam[0])
|
||||
{
|
||||
case 0:
|
||||
ConClearEOScreen();
|
||||
break;
|
||||
case 1:
|
||||
ConClearBOScreen();
|
||||
break;
|
||||
case 2:
|
||||
ConClearScreen();
|
||||
break;
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (iCurrentParam < 1)
|
||||
{
|
||||
if (iParam[0] == 5)
|
||||
{
|
||||
char * szStatus = GetStatusReport();
|
||||
NetWriteString(szStatus, strlen(szStatus));
|
||||
}
|
||||
else if ( iParam[0] == 6 )
|
||||
{
|
||||
char * szStatus = GetStatusReport();
|
||||
NetWriteString(szStatus, strlen(szStatus));
|
||||
}
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
||||
if (bMode == (MODE_BRK & MODE_EXT))
|
||||
{
|
||||
// What are you response
|
||||
}
|
||||
else if (bMode == MODE_BRK)
|
||||
{
|
||||
char* szTerminalId = GetTerminalId();
|
||||
NetWriteString(szTerminalId, strlen(szTerminalId));
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
case 'q':
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'Z': // Identify - This is really a VT52 command
|
||||
{
|
||||
char* szTerminalId = GetTerminalId();
|
||||
NetWriteString(szTerminalId, strlen(szTerminalId));
|
||||
}
|
||||
fcompletion = 1;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
ConDeleteChars(iParam[0]);
|
||||
fcompletion = 1;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// pszHead should point to digit now. Otherwise we got bad escape
|
||||
// sequence, so we just get out of here!
|
||||
if (!isdigit(*pszCurrent))
|
||||
{
|
||||
pszCurrent = pszBuffer;
|
||||
return pszCurrent;
|
||||
}
|
||||
|
||||
iParam[iCurrentParam] = strtoul((const char *)pszCurrent, (char **)&pszCurrent, 10);
|
||||
|
||||
pszCurrent--;
|
||||
|
||||
if (iCurrentParam < nParam)
|
||||
iCurrentParam++;
|
||||
|
||||
// Check for digit completion
|
||||
if (bMode & DIGI_MASK)
|
||||
fcompletion = 1;
|
||||
|
||||
if (bMode == 0)
|
||||
{
|
||||
switch(iParam[0])
|
||||
{
|
||||
case 7:
|
||||
SavedX = ConGetCursorX();
|
||||
SavedY = ConGetCursorY();
|
||||
break;
|
||||
case 8:
|
||||
ConSetCursorPosition(SavedX,SavedY);
|
||||
break;
|
||||
}
|
||||
fcompletion = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} while ((++pszCurrent < pszBufferEnd) && !fcompletion);
|
||||
|
||||
if (fcompletion)
|
||||
{
|
||||
memset(iParam, '\0', sizeof(iParam));
|
||||
iCurrentParam = 0;
|
||||
bDelimiter = 0;
|
||||
bMode = 0;
|
||||
// fcompletion = 0;
|
||||
bExtMode = 0;
|
||||
bCS0 = 0;
|
||||
bCS1 = 0;
|
||||
bBkMode = 0;
|
||||
bCharMode = 0;
|
||||
return pszCurrent;
|
||||
}
|
||||
else
|
||||
return pszBuffer;
|
||||
}
|
||||
|
||||
unsigned char * ParseVT52(unsigned char * pszBuffer, unsigned char * pszBufferEnd)
|
||||
{
|
||||
unsigned char * pszCurrent = pszBuffer;
|
||||
int iLine;
|
||||
int iColumn;
|
||||
|
||||
switch ((unsigned char) *pszCurrent)
|
||||
{
|
||||
|
||||
case 'A': // Cursor Up
|
||||
ConMoveCursorPosition(0, -1);
|
||||
pszCurrent++;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
|
||||
case 'B': // Cursor Down
|
||||
ConMoveCursorPosition(0, 1);
|
||||
pszCurrent++;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
case 'C': // Cursor Right
|
||||
ConMoveCursorPosition(1, 0);
|
||||
pszCurrent++;
|
||||
break;
|
||||
case 'D': // Cursor Left
|
||||
ConMoveCursorPosition(-1, 0);
|
||||
pszCurrent++;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
case 'F': // Special Graphics Character Set
|
||||
case 'G': // ASCII Character Set
|
||||
pszCurrent++;
|
||||
break;
|
||||
case 'H': // Cursor Home
|
||||
|
||||
ConSetCursorPosition(1, 1);
|
||||
pszCurrent++;
|
||||
bAtEOLN = FALSE;
|
||||
break;
|
||||
case 'I': // Reverse Line Feed
|
||||
pszCurrent++;
|
||||
break;
|
||||
case 'J': // Erase to End of Screen
|
||||
ConClearEOScreen();
|
||||
pszCurrent++;
|
||||
break;
|
||||
case 'K': // Erase to End of Line
|
||||
ConClearEOLine();
|
||||
pszCurrent++;
|
||||
break;
|
||||
case 'Y': // Direct Cursor Addressing
|
||||
pszCurrent = GetNextChar(pszCurrent,pszBufferEnd);
|
||||
if (pszCurrent != NULL)
|
||||
{
|
||||
iLine = *pszCurrent - 31;
|
||||
|
||||
pszCurrent = GetNextChar(pszCurrent,pszBufferEnd);
|
||||
if (pszCurrent != NULL)
|
||||
{
|
||||
iColumn = *pszCurrent - 31;
|
||||
ConSetCursorPosition(iLine,iColumn);
|
||||
pszCurrent++;
|
||||
}
|
||||
else
|
||||
pszCurrent = pszBuffer;
|
||||
}
|
||||
else
|
||||
pszCurrent = pszBuffer;
|
||||
break;
|
||||
|
||||
case 'Z': // Identify
|
||||
NetWriteString("\033/Z",3);
|
||||
pszCurrent++;
|
||||
break;
|
||||
case '=': // Enter Alt Keypad mode
|
||||
case '>': // Exit Alt Keypad mode
|
||||
case '1': // Graphics processor on
|
||||
case '2': // Graphics processor off
|
||||
pszCurrent++;
|
||||
break;
|
||||
case '<': // Enter ANSI mode
|
||||
term_mode = TERM_ANSI;
|
||||
pszCurrent++;
|
||||
break;
|
||||
default:
|
||||
pszCurrent++;
|
||||
}
|
||||
|
||||
return pszCurrent;
|
||||
|
||||
}
|
46
contrib/win32/win32compat/ansiprsr.h
Normal file
46
contrib/win32/win32compat/ansiprsr.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* ansiprsr.h
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* ANSI Parser header file to run on Win32 based operating systems.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#ifndef __ANSIPRSR_H
|
||||
#define __ANSIPRSR_H
|
||||
|
||||
#define TERM_ANSI 0
|
||||
#define TERM_VT52 1
|
||||
|
||||
unsigned char * ParseBuffer(unsigned char* pszBuffer, unsigned char* pszBufferEnd);
|
||||
unsigned char * GetNextChar(unsigned char * pszBuffer, unsigned char *pszBufferEnd);
|
||||
unsigned char * ParseANSI(unsigned char * pszBuffer, unsigned char * pszBufferEnd);
|
||||
unsigned char * ParseVT52(unsigned char * pszBuffer, unsigned char * pszBufferEnd);
|
||||
|
||||
#define true TRUE
|
||||
#define false FALSE
|
||||
#define bool BOOL
|
||||
|
||||
//typedef enum _crlftype { CRLF = 0, LF, CR } CRLFType;
|
||||
#define ENUM_CRLF 0
|
||||
#define ENUM_LF 1
|
||||
#define ENUM_CR 2
|
||||
|
||||
typedef struct _TelParams
|
||||
{
|
||||
int timeOut;
|
||||
int fLocalEcho;
|
||||
int fTreatLFasCRLF;
|
||||
int fSendCROnly;
|
||||
int nReceiveCRLF;
|
||||
} TelParams;
|
||||
|
||||
#endif
|
298
contrib/win32/win32compat/cng_cipher.c
Normal file
298
contrib/win32/win32compat/cng_cipher.c
Normal file
@ -0,0 +1,298 @@
|
||||
/* cng_cipher.c
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Common library for Windows Console Screen IO.
|
||||
* Contains Windows console related definition so that emulation code can draw
|
||||
* on Windows console screen surface.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#include <Windows.h>
|
||||
#include <bcrypt.h>
|
||||
|
||||
#include "cng_cipher.h"
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
|
||||
/*
|
||||
* increment the aes counter (iv)
|
||||
*/
|
||||
static void aesctr_inc(unsigned char *ctr, unsigned int len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
#ifndef CONSTANT_TIME_INCREMENT
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
if (++ctr[i]) /* continue on overflow */
|
||||
return;
|
||||
#else
|
||||
u8 x, add = 1;
|
||||
|
||||
for (i = len - 1; i >= 0; i--) {
|
||||
ctr[i] += add;
|
||||
/* constant time for: x = ctr[i] ? 1 : 0 */
|
||||
x = ctr[i];
|
||||
x = (x | (x >> 4)) & 0xf;
|
||||
x = (x | (x >> 2)) & 0x3;
|
||||
x = (x | (x >> 1)) & 0x1;
|
||||
add *= (x ^ 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Routine to encrypt a counter for ctr encryption. This requries
|
||||
* us to use an IV that is reset for each call to avoid cng attempting
|
||||
* to chain encryptions.
|
||||
*/
|
||||
DWORD cng_counter_encrypt(const unsigned char *in, unsigned char *out, BCRYPT_KEY_HANDLE key, unsigned int blocklen)
|
||||
{
|
||||
HRESULT status = S_OK;
|
||||
DWORD cbResult = 0;
|
||||
|
||||
unsigned char iv[AES_BLOCK_SIZE] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
status = BCryptEncrypt(
|
||||
key,
|
||||
(PUCHAR)in,
|
||||
blocklen,
|
||||
NULL,
|
||||
iv,
|
||||
blocklen,
|
||||
out,
|
||||
blocklen,
|
||||
&cbResult,
|
||||
0);
|
||||
|
||||
return cbResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encrypt/Decrypt data using a CTR mode.
|
||||
* In this mode, we can't call CNG encryption/decription directly. The mode requires
|
||||
* the use of the iv as a counter that is incremented and encrypted. The
|
||||
* encrypted counter is then XORd with the data to produce the cipher text.
|
||||
*/
|
||||
int cng_aesctr_encrypt_bytes(PSSH_CNG_CIPHER_CTX x, const unsigned char *m, unsigned char *c, unsigned int bytes)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int n = 0;
|
||||
unsigned char buf[AES_BLOCK_SIZE];
|
||||
|
||||
while ((bytes--) > 0) {
|
||||
if (n == 0) {
|
||||
if (!cng_counter_encrypt(x->pbIV, buf, x->hKey, AES_BLOCK_SIZE))
|
||||
{
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
aesctr_inc(x->pbIV, AES_BLOCK_SIZE);
|
||||
}
|
||||
*(c++) = *(m++) ^ buf[n];
|
||||
n = (n + 1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Encrypt data using a provided cipher context
|
||||
*/
|
||||
unsigned int cng_cipher_encrypt(PSSH_CNG_CIPHER_CTX x, unsigned char *dest, unsigned int dest_len, const unsigned char *src, unsigned int len)
|
||||
{
|
||||
DWORD cbResult = 0;
|
||||
HRESULT status = S_OK;
|
||||
|
||||
if (x->flags & _CNG_MODE_CTR)
|
||||
{
|
||||
if (-1 == cng_aesctr_encrypt_bytes(x, src, dest, len))
|
||||
{
|
||||
status = GetLastError();
|
||||
}
|
||||
cbResult = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
status = BCryptEncrypt(
|
||||
x->hKey,
|
||||
(PUCHAR)src,
|
||||
len,
|
||||
NULL,
|
||||
x->pbIV,
|
||||
x->cbBlockSize,
|
||||
dest,
|
||||
dest_len,
|
||||
&cbResult,
|
||||
0);
|
||||
if (S_OK != status)
|
||||
{
|
||||
cbResult = 0;
|
||||
SetLastError(status);
|
||||
}
|
||||
}
|
||||
return cbResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decrypt encrypted data using a provided cipher context
|
||||
*/
|
||||
unsigned int cng_cipher_decrypt(PSSH_CNG_CIPHER_CTX x, unsigned char *dest, unsigned int dest_len, const unsigned char *src, unsigned int len)
|
||||
{
|
||||
DWORD cbResult = 0;
|
||||
HRESULT status = S_OK;
|
||||
|
||||
if (x->flags & _CNG_MODE_CTR)
|
||||
{
|
||||
// ctr mode is just an XOR so encrypt=decrypt
|
||||
if (-1 == cng_aesctr_encrypt_bytes(x, src, dest, len))
|
||||
{
|
||||
status = GetLastError();
|
||||
}
|
||||
cbResult = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
status = BCryptDecrypt(
|
||||
x->hKey,
|
||||
(PUCHAR)src,
|
||||
len,
|
||||
NULL,
|
||||
x->pbIV,
|
||||
x->cbBlockSize,
|
||||
dest,
|
||||
dest_len,
|
||||
&cbResult,
|
||||
0);
|
||||
if (S_OK != status)
|
||||
{
|
||||
cbResult = 0;
|
||||
SetLastError(status);
|
||||
}
|
||||
}
|
||||
return cbResult;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize cipher context
|
||||
*/
|
||||
unsigned int cng_cipher_init(PSSH_CNG_CIPHER_CTX x, const unsigned char *key, unsigned int keylen, const unsigned char *iv, size_t ivlen, unsigned int flags)
|
||||
{
|
||||
HRESULT status = S_OK;
|
||||
BCRYPT_ALG_HANDLE hAlg = NULL;
|
||||
DWORD cbData = 0;
|
||||
LPCWSTR pAlg = NULL;
|
||||
DWORD cbBlockLen = 0;
|
||||
|
||||
if ((0 == (flags & _CNG_CIPHER_AES)) || (0 == (flags & (_CNG_MODE_CBC | _CNG_MODE_CTR))))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
|
||||
|
||||
// wipe out old context
|
||||
memset(x, 0, sizeof(SSH_CNG_CIPHER_CTX));
|
||||
|
||||
|
||||
// initialize simple context fields
|
||||
x->flags = flags;
|
||||
|
||||
// only one cipher supported right now
|
||||
if (flags & _CNG_CIPHER_AES)
|
||||
pAlg = BCRYPT_AES_ALGORITHM;
|
||||
|
||||
|
||||
// Generate BCrypt Key and set mode if applicable
|
||||
if (NT_SUCCESS(status = BCryptOpenAlgorithmProvider(
|
||||
&hAlg,
|
||||
pAlg,
|
||||
NULL,
|
||||
0)))
|
||||
{
|
||||
|
||||
if (NT_SUCCESS(status = BCryptGetProperty(
|
||||
hAlg,
|
||||
BCRYPT_BLOCK_LENGTH,
|
||||
(PBYTE)&cbBlockLen,
|
||||
sizeof(DWORD),
|
||||
&cbData,
|
||||
0)))
|
||||
{
|
||||
x->cbBlockSize = cbBlockLen;
|
||||
if (cbBlockLen != ivlen)
|
||||
{
|
||||
status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
x->pbIV = (PBYTE)HeapAlloc(GetProcessHeap(), 0, ivlen);
|
||||
if (NULL == x->pbIV)
|
||||
{
|
||||
status = GetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(x->pbIV, iv, ivlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (status == S_OK && flags & _CNG_MODE_CBC)
|
||||
{
|
||||
status = BCryptSetProperty(
|
||||
hAlg,
|
||||
BCRYPT_CHAINING_MODE,
|
||||
(PBYTE)BCRYPT_CHAIN_MODE_CBC,
|
||||
sizeof(BCRYPT_CHAIN_MODE_CBC),
|
||||
0);
|
||||
}
|
||||
|
||||
if (status == S_OK)
|
||||
{
|
||||
status = BCryptGenerateSymmetricKey(
|
||||
hAlg,
|
||||
&(x->hKey),
|
||||
NULL,
|
||||
0,
|
||||
(PBYTE)key,
|
||||
keylen,
|
||||
0);
|
||||
}
|
||||
BCryptCloseAlgorithmProvider(hAlg, 0);
|
||||
|
||||
// if we got an error along the way, free up the iv
|
||||
if (status != S_OK && x->pbIV)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, x->pbIV);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
/*
|
||||
* Cleanup cipher context fields
|
||||
*/
|
||||
void cng_cipher_cleanup(PSSH_CNG_CIPHER_CTX x)
|
||||
{
|
||||
if (x->pbIV)
|
||||
HeapFree(GetProcessHeap(), 0, x->pbIV);
|
||||
if (x->hKey)
|
||||
BCryptDestroyKey(x->hKey);
|
||||
}
|
||||
|
||||
#endif
|
64
contrib/win32/win32compat/cng_cipher.h
Normal file
64
contrib/win32/win32compat/cng_cipher.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* cng_cipher.h
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Common library for Windows Console Screen IO.
|
||||
* Contains Windows console related definition so that emulation code can draw
|
||||
* on Windows console screen surface.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CNG_CIPHER_H
|
||||
#define CNG_CIPHER_H
|
||||
|
||||
#ifdef USE_MSCNG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
|
||||
|
||||
#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)
|
||||
|
||||
/* CIPHER/MODE bits specify cipher and mode in the flags
|
||||
* field of the context
|
||||
*/
|
||||
#define _CNG_CIPHER_AES 0x00000001
|
||||
#define _CNG_MODE_CTR 0x00010000
|
||||
#define _CNG_MODE_CBC 0x00020000
|
||||
|
||||
#define _CNG_CIPHER_MASK 0x0000FFFF
|
||||
#define _CNG_MODE_MASK 0xFFFF0000
|
||||
|
||||
typedef struct ssh_cng_cipher_ctx
|
||||
{
|
||||
void * hKey;
|
||||
unsigned char * pbIV;
|
||||
unsigned int cbBlockSize;
|
||||
unsigned int flags;
|
||||
} SSH_CNG_CIPHER_CTX, *PSSH_CNG_CIPHER_CTX;
|
||||
|
||||
|
||||
unsigned int cng_cipher_encrypt(PSSH_CNG_CIPHER_CTX x, unsigned char *dest, unsigned int dest_len, const unsigned char *src, unsigned int len);
|
||||
unsigned int cng_cipher_decrypt(PSSH_CNG_CIPHER_CTX x, unsigned char *dest, unsigned int dest_len, const unsigned char *src, unsigned int len);
|
||||
unsigned int cng_cipher_init(PSSH_CNG_CIPHER_CTX x, const unsigned char *key, unsigned int keylen, const unsigned char *iv, size_t ivlen, unsigned int flags);
|
||||
void cng_cipher_cleanup(PSSH_CNG_CIPHER_CTX x);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
1764
contrib/win32/win32compat/console.c
Normal file
1764
contrib/win32/win32compat/console.c
Normal file
File diff suppressed because it is too large
Load Diff
114
contrib/win32/win32compat/console.h
Normal file
114
contrib/win32/win32compat/console.h
Normal file
@ -0,0 +1,114 @@
|
||||
/* console.h
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Common library for Windows Console Screen IO.
|
||||
* Contains Windows console related definition so that emulation code can draw
|
||||
* on Windows console screen surface.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#ifndef __PRAGMA_CONSOLE_h
|
||||
#define __PRAGMA_CONSOLE_h
|
||||
|
||||
#define ANSI_ATTR_RESET 0
|
||||
#define ANSI_BRIGHT 1
|
||||
#define ANSI_DIM 2
|
||||
#define ANSI_UNDERSCORE 4
|
||||
#define ANSI_BLINK 5
|
||||
#define ANSI_REVERSE 7
|
||||
#define ANSI_HIDDEN 8
|
||||
#define ANSI_NOREVERSE 27
|
||||
|
||||
#define ANSI_FOREGROUND_BLACK 30
|
||||
#define ANSI_FOREGROUND_RED 31
|
||||
#define ANSI_FOREGROUND_GREEN 32
|
||||
#define ANSI_FOREGROUND_YELLOW 33
|
||||
#define ANSI_FOREGROUND_BLUE 34
|
||||
#define ANSI_FOREGROUND_MAGENTA 35
|
||||
#define ANSI_FOREGROUND_CYAN 36
|
||||
#define ANSI_FOREGROUND_WHITE 37
|
||||
#define ANSI_BACKGROUND_BLACK 40
|
||||
#define ANSI_BACKGROUND_RED 41
|
||||
#define ANSI_BACKGROUND_GREEN 42
|
||||
#define ANSI_BACKGROUND_YELLOW 43
|
||||
#define ANSI_BACKGROUND_BLUE 44
|
||||
#define ANSI_BACKGROUND_MAGENTA 45
|
||||
#define ANSI_BACKGROUND_CYAN 46
|
||||
#define ANSI_BACKGROUND_WHITE 47
|
||||
#define ANSI_BACKGROUND_BRIGHT 128
|
||||
|
||||
#define TAB_LENGTH 4
|
||||
#define TAB_CHAR '\t'
|
||||
#define TAB_SPACE " "
|
||||
|
||||
#define true TRUE
|
||||
#define false FALSE
|
||||
#define bool BOOL
|
||||
|
||||
typedef void * SCREEN_HANDLE;
|
||||
|
||||
int ConInit( DWORD OutputHandle, BOOL fSmartInit);
|
||||
int ConUnInitWithRestore( void );
|
||||
int ConUnInit( void );
|
||||
//void ConHideConsole(void);
|
||||
BOOL ConSetScreenRect( int xSize, int ySize );
|
||||
BOOL ConSetScreenSize( int X, int Y );
|
||||
BOOL ConRestoreScreen( void );
|
||||
BOOL ConSaveScreen( void );
|
||||
DWORD ConRedrawScreen( void );
|
||||
void ConSetAttribute( int *iParam, int iParamCount );
|
||||
void ConSetScrollRegion( int Top, int Bottom );
|
||||
int ConScreenSizeX();
|
||||
int ConSetScreenX();
|
||||
int ConScreenSizeY();
|
||||
int ConWindowSizeX();
|
||||
int ConWindowSizeY();
|
||||
int ConSetScreenY();
|
||||
void ConFillToEndOfLine();
|
||||
int ConWriteString(char* pszString, int cbString);
|
||||
int ConWriteMenu(char* pszString, int cbString);
|
||||
BOOL ConWriteChar( CHAR ch );
|
||||
int ConWriteConsole( char *pData, int NumChars );
|
||||
PCHAR ConDisplayData(char* pData, int NumLines);
|
||||
PCHAR ConWriteLine(char* pData);
|
||||
int Con_printf( const char *Format, ... );
|
||||
void ConClearScrollRegion();
|
||||
void ConClearScreen();
|
||||
void ConClearEOScreen();
|
||||
void ConClearBOScreen();
|
||||
void ConClearLine();
|
||||
void ConClearEOLine();
|
||||
void ConClearNFromCursorRight(int n);
|
||||
void ConClearNFromCursorLeft(int n);
|
||||
void ConScrollUpEntireBuffer();
|
||||
void ConScrollDownEntireBuffer();
|
||||
void ConScrollUp(int topline,int botline);
|
||||
void ConScrollDown(int topline,int botline);
|
||||
void ConClearBOLine();
|
||||
BOOL ConChangeCursor( CONSOLE_CURSOR_INFO *pCursorInfo );
|
||||
void ConSetCursorPosition(int x, int y);
|
||||
int ConGetCursorX();
|
||||
int ConGetCursorY();
|
||||
int ConGetCursorInBufferY(void);
|
||||
BOOL ConDisplayCursor( BOOL bVisible );
|
||||
void ConMoveCursorPosition(int x, int y);
|
||||
void ConGetRelativeCursorPosition(int *x, int *y);
|
||||
BOOL ConRestoreScreenHandle( SCREEN_HANDLE hScreen );
|
||||
BOOL ConRestoreScreenColors( void );
|
||||
SCREEN_HANDLE ConSaveScreenHandle( SCREEN_HANDLE);
|
||||
void ConDeleteScreenHandle( SCREEN_HANDLE hScreen );
|
||||
void ConSaveViewRect( void );
|
||||
void ConRestoreViewRect( void );
|
||||
void ConDeleteChars(int n);
|
||||
|
||||
|
||||
#endif
|
1
contrib/win32/win32compat/libwin32compat.q
Normal file
1
contrib/win32/win32compat/libwin32compat.q
Normal file
@ -0,0 +1 @@
|
||||
!<arch>
|
@ -8,25 +8,33 @@ top_srcdir=../../..
|
||||
|
||||
CC=i686-pc-mingw32-gcc
|
||||
LD=i686-pc-mingw32-gcc
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-all -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
CPPFLAGS=-I. -I../../.. -I$(srcdir) -I$(top_srcdir) -I$(srcdir)/includes -I/cygdrive/c/openssh/openssl-1.0.2d/include -I/cygdrive/c/openssh/zlib-1.2.8 -DHAVE_CONFIG_H
|
||||
LIBS=-lcrypto -lz -lws2_32 -lgdi32 -lNetAPI32 -luserenv -lsecur32 -lshlwapi
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
BCRYPTFLAGS=-I/usr/include/w32api
|
||||
CPPFLAGS=-I. -I../../.. -I$(srcdir) -I$(top_srcdir) -I$(srcdir)/includes -I/cygdrive/c/openssh/Win32-OpenSSH/../openssl-1.0.2d/include -DHAVE_CONFIG_H -DUSE_MSCNG
|
||||
LIBS=-lcrypto -lz -lws2_32 -lgdi32 -lNetAPI32 -luserenv -lsecur32 -lshlwapi -lbcrypt
|
||||
AR=/usr/bin/ar
|
||||
RANLIB=i686-pc-mingw32-ranlib
|
||||
INSTALL=/usr/bin/install -c
|
||||
LDFLAGS=-L. -L/cygdrive/c/openssh/openssl-1.0.2d -L/cygdrive/c/openssh/zlib-1.2.8 -fstack-protector-all
|
||||
LDFLAGS=-L. -L/cygdrive/c/openssh/Win32-OpenSSH/../openssl-1.0.2d -L/lib/win32api
|
||||
|
||||
WIN32COMPATFILES = daemon.o gettimeofday.o homedirhelp.o pwd.o sfds.o \
|
||||
socket.o startupneeds.o strcasecmp.o syslog.o lsalogon.o lsastring.o \
|
||||
stringhelp.o deskright.o win32auth.o kerberos.o
|
||||
stringhelp.o deskright.o win32auth.o kerberos.o cng_cipher.o ansiprsr.o console.o tnnet.o
|
||||
|
||||
WIN32COMPATLIB=libwin32compat.a
|
||||
|
||||
CNGFILES=cng_cipher.o
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
|
||||
all: $(WIN32COMPATLIB)
|
||||
|
||||
|
||||
$(CNGFILES): %.o: %.c
|
||||
$(CC) $(CFLAGS) $(BCRYPTFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
158
contrib/win32/win32compat/tncon.h
Normal file
158
contrib/win32/win32compat/tncon.h
Normal file
@ -0,0 +1,158 @@
|
||||
/* tncon.h
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Contains terminal emulation console related key definition
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
#ifndef __TNCON_H
|
||||
#define __TNCON_H
|
||||
|
||||
#include "console.h"
|
||||
|
||||
#define UP_ARROW "\033[A"
|
||||
#define DOWN_ARROW "\033[B"
|
||||
#define RIGHT_ARROW "\033[C"
|
||||
#define LEFT_ARROW "\033[D"
|
||||
|
||||
#define APP_UP_ARROW "\033OA"
|
||||
#define APP_DOWN_ARROW "\033OB"
|
||||
#define APP_RIGHT_ARROW "\033OC"
|
||||
#define APP_LEFT_ARROW "\033OD"
|
||||
|
||||
// VT100 Function Key's
|
||||
#define VT100_PF1_KEY "\x1b\x4f\x50"
|
||||
#define VT100_PF2_KEY "\x1b\x4f\x51"
|
||||
#define VT100_PF3_KEY "\x1b\x4f\x52"
|
||||
#define VT100_PF4_KEY "\x1b\x4f\x53"
|
||||
#define VT100_PF5_KEY "\x1b\x4f\x54"
|
||||
#define VT100_PF6_KEY "\x1b\x4f\x55"
|
||||
#define VT100_PF7_KEY "\x1b\x4f\x56"
|
||||
#define VT100_PF8_KEY "\x1b\x4f\x57"
|
||||
#define VT100_PF9_KEY "\x1b\x4f\x58"
|
||||
#define VT100_PF10_KEY "\x1b\x4f\x59"
|
||||
|
||||
// VT420 Key's
|
||||
#define PF1_KEY "\033[11~"
|
||||
#define PF2_KEY "\033[12~"
|
||||
#define PF3_KEY "\033[13~"
|
||||
#define PF4_KEY "\033[14~"
|
||||
#define PF5_KEY "\033[15~"
|
||||
#define PF6_KEY "\033[17~"
|
||||
#define PF7_KEY "\033[18~"
|
||||
#define PF8_KEY "\033[19~"
|
||||
#define PF9_KEY "\033[20~"
|
||||
#define PF10_KEY "\033[21~"
|
||||
#define PF11_KEY "\033[23~"
|
||||
#define PF12_KEY "\033[24~"
|
||||
|
||||
#define SHIFT_PF1_KEY "\033[11;2~"
|
||||
#define SHIFT_PF2_KEY "\033[12;2~"
|
||||
#define SHIFT_PF3_KEY "\033[13;2~"
|
||||
#define SHIFT_PF4_KEY "\033[14;2~"
|
||||
#define SHIFT_PF5_KEY "\033[15;2~"
|
||||
#define SHIFT_PF6_KEY "\033[17;2~"
|
||||
#define SHIFT_PF7_KEY "\033[18;2~"
|
||||
#define SHIFT_PF8_KEY "\033[19;2~"
|
||||
#define SHIFT_PF9_KEY "\033[20;2~"
|
||||
#define SHIFT_PF10_KEY "\033[21;2~"
|
||||
#define SHIFT_PF11_KEY "\033[24;2~"
|
||||
#define SHIFT_PF12_KEY "\033[25;2~"
|
||||
|
||||
#define ALT_PF1_KEY "\033[11;3~"
|
||||
#define ALT_PF2_KEY "\033[12;3~"
|
||||
#define ALT_PF3_KEY "\033[13;3~"
|
||||
#define ALT_PF4_KEY "\033[14;3~"
|
||||
#define ALT_PF5_KEY "\033[15;3~"
|
||||
#define ALT_PF6_KEY "\033[17;3~"
|
||||
#define ALT_PF7_KEY "\033[18;3~"
|
||||
#define ALT_PF8_KEY "\033[19;3~"
|
||||
#define ALT_PF9_KEY "\033[20;3~"
|
||||
#define ALT_PF10_KEY "\033[21;3~"
|
||||
#define ALT_PF11_KEY "\033[24;3~"
|
||||
#define ALT_PF12_KEY "\033[25;3~"
|
||||
|
||||
#define CTRL_PF1_KEY "\033[11;4~"
|
||||
#define CTRL_PF2_KEY "\033[12;4~"
|
||||
#define CTRL_PF3_KEY "\033[13;4~"
|
||||
#define CTRL_PF4_KEY "\033[14;4~"
|
||||
#define CTRL_PF5_KEY "\033[15;4~"
|
||||
#define CTRL_PF6_KEY "\033[17;4~"
|
||||
#define CTRL_PF7_KEY "\033[18;4~"
|
||||
#define CTRL_PF8_KEY "\033[19;4~"
|
||||
#define CTRL_PF9_KEY "\033[20;4~"
|
||||
#define CTRL_PF10_KEY "\033[21;4~"
|
||||
#define CTRL_PF11_KEY "\033[24;4~"
|
||||
#define CTRL_PF12_KEY "\033[25;4~"
|
||||
|
||||
#define SHIFT_CTRL_PF1_KEY "\033[11;6~"
|
||||
#define SHIFT_CTRL_PF2_KEY "\033[12;6~"
|
||||
#define SHIFT_CTRL_PF3_KEY "\033[13;6~"
|
||||
#define SHIFT_CTRL_PF4_KEY "\033[14;6~"
|
||||
#define SHIFT_CTRL_PF5_KEY "\033[15;6~"
|
||||
#define SHIFT_CTRL_PF6_KEY "\033[17;6~"
|
||||
#define SHIFT_CTRL_PF7_KEY "\033[18;6~"
|
||||
#define SHIFT_CTRL_PF8_KEY "\033[19;6~"
|
||||
#define SHIFT_CTRL_PF9_KEY "\033[20;6~"
|
||||
#define SHIFT_CTRL_PF10_KEY "\033[21;6~"
|
||||
#define SHIFT_CTRL_PF11_KEY "\033[24;6~"
|
||||
#define SHIFT_CTRL_PF12_KEY "\033[25;6~"
|
||||
|
||||
#define SHIFT_ALT_PF1_KEY "\033[11;5~"
|
||||
#define SHIFT_ALT_PF2_KEY "\033[12;5~"
|
||||
#define SHIFT_ALT_PF3_KEY "\033[13;5~"
|
||||
#define SHIFT_ALT_PF4_KEY "\033[14;5~"
|
||||
#define SHIFT_ALT_PF5_KEY "\033[15;5~"
|
||||
#define SHIFT_ALT_PF6_KEY "\033[17;5~"
|
||||
#define SHIFT_ALT_PF7_KEY "\033[18;5~"
|
||||
#define SHIFT_ALT_PF8_KEY "\033[19;5~"
|
||||
#define SHIFT_ALT_PF9_KEY "\033[20;5~"
|
||||
#define SHIFT_ALT_PF10_KEY "\033[21;5~"
|
||||
#define SHIFT_ALT_PF11_KEY "\033[24;5~"
|
||||
#define SHIFT_ALT_PF12_KEY "\033[25;5~"
|
||||
|
||||
#define ALT_CTRL_PF1_KEY "\033[11;7~"
|
||||
#define ALT_CTRL_PF2_KEY "\033[12;7~"
|
||||
#define ALT_CTRL_PF3_KEY "\033[13;7~"
|
||||
#define ALT_CTRL_PF4_KEY "\033[14;7~"
|
||||
#define ALT_CTRL_PF5_KEY "\033[15;7~"
|
||||
#define ALT_CTRL_PF6_KEY "\033[17;7~"
|
||||
#define ALT_CTRL_PF7_KEY "\033[18;7~"
|
||||
#define ALT_CTRL_PF8_KEY "\033[19;7~"
|
||||
#define ALT_CTRL_PF9_KEY "\033[20;7~"
|
||||
#define ALT_CTRL_PF10_KEY "\033[21;7~"
|
||||
#define ALT_CTRL_PF11_KEY "\033[24;7~"
|
||||
#define ALT_CTRL_PF12_KEY "\033[25;7~"
|
||||
|
||||
#define SHIFT_ALT_CTRL_PF1_KEY "\033[11;8~"
|
||||
#define SHIFT_ALT_CTRL_PF2_KEY "\033[12;8~"
|
||||
#define SHIFT_ALT_CTRL_PF3_KEY "\033[13;8~"
|
||||
#define SHIFT_ALT_CTRL_PF4_KEY "\033[14;8~"
|
||||
#define SHIFT_ALT_CTRL_PF5_KEY "\033[15;8~"
|
||||
#define SHIFT_ALT_CTRL_PF6_KEY "\033[17;8~"
|
||||
#define SHIFT_ALT_CTRL_PF7_KEY "\033[18;8~"
|
||||
#define SHIFT_ALT_CTRL_PF8_KEY "\033[19;8~"
|
||||
#define SHIFT_ALT_CTRL_PF9_KEY "\033[20;8~"
|
||||
#define SHIFT_ALT_CTRL_PF10_KEY "\033[21;8~"
|
||||
#define SHIFT_ALT_CTRL_PF11_KEY "\033[24;8~"
|
||||
#define SHIFT_ALT_CTRL_PF12_KEY "\033[25;8~"
|
||||
|
||||
#define FIND_KEY "\x1b\x5b\x31\x7e"
|
||||
#define INSERT_KEY "\x1b\x5b\x32\x7e"
|
||||
#define REMOVE_KEY "\x1b\x5b\x33\x7e"
|
||||
#define SELECT_KEY "\x1b\x5b\x34\x7e"
|
||||
#define PREV_KEY "\x1b\x5b\x35\x7e"
|
||||
#define NEXT_KEY "\x1b\x5b\x36\x7e"
|
||||
#define SHIFT_TAB_KEY "\x1b\x5b\x5A"
|
||||
#define ESCAPE_KEY "\x1b"
|
||||
|
||||
|
||||
#endif
|
74
contrib/win32/win32compat/tnnet.c
Normal file
74
contrib/win32/win32compat/tnnet.c
Normal file
@ -0,0 +1,74 @@
|
||||
/* tnnet.c
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Contains terminal emulation related network calls to invoke ANSI parsing engine
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "ansiprsr.h"
|
||||
#include "tncon.h"
|
||||
|
||||
#define dwBuffer 4096
|
||||
|
||||
int NetWriteString( char* pszString, size_t cbString)
|
||||
{
|
||||
//return send_output_to_remote_client( sock, pszString, (int)cbString, 0 );
|
||||
return (int)cbString ;
|
||||
}
|
||||
|
||||
size_t telProcessNetwork ( char *buf, size_t len )
|
||||
{
|
||||
unsigned char szBuffer[dwBuffer + 8];
|
||||
unsigned char* pszHead = szBuffer;
|
||||
unsigned char* pszTail = szBuffer;
|
||||
size_t Result;
|
||||
unsigned char* pszNewHead;
|
||||
|
||||
if (1)
|
||||
{
|
||||
Result = len ;
|
||||
pszTail = (unsigned char *)buf ;
|
||||
pszHead = (unsigned char *)buf ;
|
||||
|
||||
pszTail += Result;
|
||||
|
||||
pszNewHead = pszHead;
|
||||
|
||||
do
|
||||
{
|
||||
pszHead = pszNewHead;
|
||||
pszNewHead = ParseBuffer(pszHead, pszTail);
|
||||
} while ((pszNewHead != pszHead) && (pszNewHead < pszTail));
|
||||
|
||||
if ( pszNewHead >= pszTail )
|
||||
{
|
||||
// Everything is okay and we will reset variables and continue
|
||||
pszTail = pszHead = szBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveMemory(szBuffer, pszNewHead, pszTail - pszNewHead);
|
||||
pszTail = szBuffer + (pszTail - pszNewHead);
|
||||
pszHead = szBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
24
contrib/win32/win32compat/tnnet.h
Normal file
24
contrib/win32/win32compat/tnnet.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* tnnet.h
|
||||
* Author: Pragma Systems, Inc. <www.pragmasys.com>
|
||||
* Contribution by Pragma Systems, Inc. for Microsoft openssh win32 port
|
||||
* Copyright (c) 2011, 2015 Pragma Systems, Inc.
|
||||
* All rights reserved
|
||||
*
|
||||
* Contains terminal emulation related network calls to invoke ANSI parsing engine
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice.
|
||||
* 2. Binaries produced provide no direct or implied warranties or any
|
||||
* guarantee of performance or suitability.
|
||||
*/
|
||||
|
||||
#ifndef __TNNET_H
|
||||
#define __TNNET_H
|
||||
|
||||
int NetWriteString( char* pszString, size_t cbString);
|
||||
size_t telProcessNetwork ( char *buf, size_t len );
|
||||
|
||||
#endif
|
||||
|
@ -1,42 +0,0 @@
|
||||
# $Id: Makefile.in,v 1.56 2014/09/30 23:43:08 djm Exp $
|
||||
|
||||
sysconfdir=${prefix}/etc
|
||||
piddir=/var/run
|
||||
srcdir=.
|
||||
top_srcdir=..
|
||||
|
||||
|
||||
CC=i686-pc-mingw32-gcc
|
||||
LD=i686-pc-mingw32-gcc
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-all -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. -I/cygdrive/c/openssh/openssl-1.0.2d/include -I/cygdrive/c/openssh/zlib-1.2.8 -DHAVE_CONFIG_H
|
||||
LIBS=-lcrypto -lz -lws2_32 -lgdi32 -lNetAPI32 -luserenv -lsecur32 -lshlwapi
|
||||
AR=/usr/bin/ar
|
||||
RANLIB=i686-pc-mingw32-ranlib
|
||||
INSTALL=/usr/bin/install -c
|
||||
LDFLAGS=-L. -L/cygdrive/c/openssh/openssl-1.0.2d -L/cygdrive/c/openssh/zlib-1.2.8 -fstack-protector-all
|
||||
|
||||
OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o
|
||||
|
||||
COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o kludge-fd_set.o
|
||||
|
||||
PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
all: libopenbsd-compat.a
|
||||
|
||||
$(COMPAT): ../config.h
|
||||
$(OPENBSD): ../config.h
|
||||
$(PORTS): ../config.h
|
||||
|
||||
libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS)
|
||||
$(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a core
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile *~
|
@ -8,12 +8,12 @@ top_srcdir=../..
|
||||
|
||||
CC=i686-pc-mingw32-gcc
|
||||
LD=i686-pc-mingw32-gcc
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -fstack-protector-all -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. -I/cygdrive/c/openssh/openssl-1.0.2d/include -I/cygdrive/c/openssh/zlib-1.2.8 -DHAVE_CONFIG_H
|
||||
CFLAGS=-g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/openbsd-compat -I/cygdrive/c/openssh/Win32-OpenSSH/contrib/win32/win32compat/includes -I/cygdrive/c/openssh/Win32-OpenSSH/libkrb -I/usr/local
|
||||
CPPFLAGS=-I. -I.. -I$(srcdir) -I$(srcdir)/.. -I/cygdrive/c/openssh/Win32-OpenSSH/../openssl-1.0.2d/include -DHAVE_CONFIG_H
|
||||
EXEEXT=.exe
|
||||
LIBCOMPAT=../libopenbsd-compat.a
|
||||
LIBS=-lcrypto -lz -lws2_32 -lgdi32 -lNetAPI32 -luserenv -lsecur32 -lshlwapi
|
||||
LDFLAGS=-L/cygdrive/c/openssh/openssl-1.0.2d -L/cygdrive/c/openssh/zlib-1.2.8 -fstack-protector-all $(LIBCOMPAT)
|
||||
LDFLAGS=-L/cygdrive/c/openssh/Win32-OpenSSH/../openssl-1.0.2d $(LIBCOMPAT)
|
||||
|
||||
TESTPROGS=closefromtest$(EXEEXT) snprintftest$(EXEEXT) strduptest$(EXEEXT) \
|
||||
strtonumtest$(EXEEXT) opensslvertest$(EXEEXT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user