fix file open() and fstat() issues in tests

This commit is contained in:
arif-pragmasys 2015-10-05 21:22:05 -05:00
parent ac89e98293
commit 522af1564b
13 changed files with 153 additions and 221 deletions

8
.gitignore vendored
View File

@ -234,3 +234,11 @@ config.h.in
config.h config.h
ssh_host_rsa_key.pub
ssh_host_rsa_key
ssh_host_rsa_key
ssh_host_rsa_key
ssh_host_dsa_key
ssh_host_ecdsa_key.pub
ssh_host_rsa_key.pub
id_rsa.pub

View File

@ -8,7 +8,8 @@
*/ */
/* #undef AIX_GETNAMEINFO_HACK */ /* #undef AIX_GETNAMEINFO_HACK */
/* Define if your AIX loginfailed() function takes 4 arguments (AIX >= 5.2) */ /* Define if your AIX loginfailed() function takes 4 arguments (AIX >= 5.2)
*/
/* #undef AIX_LOGINFAILED_4ARG */ /* #undef AIX_LOGINFAILED_4ARG */
/* System only supports IPv4 audit records */ /* System only supports IPv4 audit records */
@ -38,8 +39,8 @@
/* Ultrix mmap can't map files */ /* Ultrix mmap can't map files */
/* #undef BROKEN_MMAP */ /* #undef BROKEN_MMAP */
/* Define if your struct dirent expects you to allocate extra space for d_name /* Define if your struct dirent expects you to allocate extra space for
*/ d_name */
/* #undef BROKEN_ONE_BYTE_DIRENT_D_NAME */ /* #undef BROKEN_ONE_BYTE_DIRENT_D_NAME */
/* Can't do comparisons on readv */ /* Can't do comparisons on readv */
@ -682,7 +683,8 @@
/* Define to 1 if you have the `openpty' function. */ /* Define to 1 if you have the `openpty' function. */
/* #undef HAVE_OPENPTY */ /* #undef HAVE_OPENPTY */
/* Define if your ssl headers are included with #include <openssl/header.h> */ /* Define if your ssl headers are included with #include <openssl/header.h>
*/
#define HAVE_OPENSSL 1 #define HAVE_OPENSSL 1
/* Define if you have Digital Unix Security Integration Architecture */ /* Define if you have Digital Unix Security Integration Architecture */
@ -814,9 +816,6 @@
/* Define to 1 if you have the `setluid' function. */ /* Define to 1 if you have the `setluid' function. */
/* #undef HAVE_SETLUID */ /* #undef HAVE_SETLUID */
/* Define to 1 if you have the `setpassent' function. */
/* #undef HAVE_SETPASSENT */
/* Define to 1 if you have the `setpcred' function. */ /* Define to 1 if you have the `setpcred' function. */
/* #undef HAVE_SETPCRED */ /* #undef HAVE_SETPCRED */
@ -1290,7 +1289,8 @@
/* Need setpgrp to acquire controlling tty */ /* Need setpgrp to acquire controlling tty */
/* #undef NEED_SETPGRP */ /* #undef NEED_SETPGRP */
/* Define if the concept of ports only accessible to superusers isn't known */ /* Define if the concept of ports only accessible to superusers isn't known
*/
#define NO_IPPORT_RESERVED_CONCEPT 1 #define NO_IPPORT_RESERVED_CONCEPT 1
/* Define if you don't want to use lastlog in session.c */ /* Define if you don't want to use lastlog in session.c */

View File

@ -127,7 +127,7 @@ t1:
tr '\n' '\r' <${.WIN32_CURDIR}/rsa_ssh2.prv > ${.WIN32_OBJDIR}/rsa_ssh2_cr.prv tr '\n' '\r' <${.WIN32_CURDIR}/rsa_ssh2.prv > ${.WIN32_OBJDIR}/rsa_ssh2_cr.prv
${TEST_SSH_SSHKEYGEN} -if ${.WIN32_OBJDIR}/rsa_ssh2_cr.prv | diff -w - ${.WIN32_CURDIR}/rsa_openssh.prv ${TEST_SSH_SSHKEYGEN} -if ${.WIN32_OBJDIR}/rsa_ssh2_cr.prv | diff -w - ${.WIN32_CURDIR}/rsa_openssh.prv
awk '{print $$0 "\r"}' ${.WIN32_CURDIR}/rsa_ssh2.prv > ${.WIN32_OBJDIR}/rsa_ssh2_crnl.prv awk '{print $$0 "\r"}' ${.WIN32_CURDIR}/rsa_ssh2.prv > ${.WIN32_OBJDIR}/rsa_ssh2_crnl.prv
${TEST_SSH_SSHKEYGEN} -if ${.WIN32_OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.WIN32_CURDIR}/rsa_openssh.prv ${TEST_SSH_SSHKEYGEN} -if ${.WIN32_OBJDIR}/rsa_ssh2_crnl.prv | diff -w - ${.WIN32_CURDIR}/rsa_openssh.prv
t2: t2:
cat ${.WIN32_CURDIR}/rsa_openssh.prv > $(WIN32_OBJ)/t2.out cat ${.WIN32_CURDIR}/rsa_openssh.prv > $(WIN32_OBJ)/t2.out
@ -186,7 +186,7 @@ t10: $(OBJ)/t10.out
t11: t11:
${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.WIN32_CURDIR}/rsa_openssh.pub |\ ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.WIN32_CURDIR}/rsa_openssh.pub |\
awk '{print $$2}' | diff - ${.WIN32_CURDIR}/t11.ok awk '{print $$2}' | diff -w - ${.WIN32_CURDIR}/t11.ok
$(OBJ)/t12.out: $(OBJ)/t12.out:
${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $(WIN32_PWD) ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $(WIN32_PWD)

Binary file not shown.

View File

@ -1 +0,0 @@
localhost-with-alias,127.0.0.1,::1 localhost-with-alias,127.0.0.1,::1

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec /cygdrive/c/openssh/Win32-OpenSSH/ssh -E/cygdrive/c/openssh/Win32-OpenSSH/regress/ssh.log "$@"

View File

@ -1,19 +0,0 @@
Host *
Protocol 2
Hostname 127.0.0.1
HostKeyAlias localhost-with-alias
Port 4242
User Administrator
GlobalKnownHostsFile /cygdrive/c/openssh/Win32-OpenSSH/regress/known_hosts
UserKnownHostsFile /cygdrive/c/openssh/Win32-OpenSSH/regress/known_hosts
RSAAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication no
HostbasedAuthentication no
PasswordAuthentication no
RhostsRSAAuthentication no
BatchMode yes
StrictHostKeyChecking yes
LogLevel DEBUG3
IdentityFile /cygdrive/c/openssh/Win32-OpenSSH/regress/rsa
IdentityFile /cygdrive/c/openssh/Win32-OpenSSH/regress/ed25519

View File

@ -1,20 +0,0 @@
Host *
Protocol 2
Hostname 127.0.0.1
HostKeyAlias localhost-with-alias
Port 4242
User Administrator
GlobalKnownHostsFile /cygdrive/c/openssh/Win32-OpenSSH/regress/known_hosts
UserKnownHostsFile /cygdrive/c/openssh/Win32-OpenSSH/regress/known_hosts
RSAAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication no
HostbasedAuthentication no
PasswordAuthentication no
RhostsRSAAuthentication no
BatchMode yes
StrictHostKeyChecking yes
LogLevel DEBUG3
IdentityFile /cygdrive/c/openssh/Win32-OpenSSH/regress/rsa
IdentityFile /cygdrive/c/openssh/Win32-OpenSSH/regress/ed25519
proxycommand sh /cygdrive/c/openssh/Win32-OpenSSH/regress/sshd-log-wrapper.sh /cygdrive/c/openssh/Win32-OpenSSH/regress/sshd.log /cygdrive/c/openssh/Win32-OpenSSH/sshd -i -f /cygdrive/c/openssh/Win32-OpenSSH/regress/sshd_proxy

View File

@ -1,14 +0,0 @@
StrictModes no
Port 4242
Protocol 2
AddressFamily inet
ListenAddress 127.0.0.1
#ListenAddress ::1
PidFile /cygdrive/c/openssh/Win32-OpenSSH/regress/pidfile
AuthorizedKeysFile /cygdrive/c/openssh/Win32-OpenSSH/regress/authorized_keys_%u
LogLevel DEBUG3
AcceptEnv _XXX_TEST_*
AcceptEnv _XXX_TEST
Subsystem sftp /cygdrive/c/openssh/Win32-OpenSSH/sftp-server
HostKey /cygdrive/c/openssh/Win32-OpenSSH/regress/host.rsa
HostKey /cygdrive/c/openssh/Win32-OpenSSH/regress/host.ed25519

View File

@ -1,15 +0,0 @@
StrictModes no
Port 4242
Protocol 2
AddressFamily inet
ListenAddress 127.0.0.1
#ListenAddress ::1
PidFile /cygdrive/c/openssh/Win32-OpenSSH/regress/pidfile
AuthorizedKeysFile /cygdrive/c/openssh/Win32-OpenSSH/regress/authorized_keys_%u
LogLevel DEBUG3
AcceptEnv _XXX_TEST_*
AcceptEnv _XXX_TEST
Subsystem sftp /cygdrive/c/openssh/Win32-OpenSSH/sftp-server
StrictModes no
HostKey /cygdrive/c/openssh/Win32-OpenSSH/regress/rsa
HostKey /cygdrive/c/openssh/Win32-OpenSSH/regress/ed25519

View File

@ -43,12 +43,7 @@ load_file(const char *name)
struct sshbuf *ret; struct sshbuf *ret;
ASSERT_PTR_NE(ret = sshbuf_new(), NULL); ASSERT_PTR_NE(ret = sshbuf_new(), NULL);
#ifdef WIN32_FIXME
ASSERT_INT_NE(fd = _open(test_data_file(name), O_RDONLY), -1);
#else
ASSERT_INT_NE(fd = open(test_data_file(name), O_RDONLY), -1); ASSERT_INT_NE(fd = open(test_data_file(name), O_RDONLY), -1);
#endif
ASSERT_INT_EQ(sshkey_load_file(fd, ret), 0); ASSERT_INT_EQ(sshkey_load_file(fd, ret), 0);
close(fd); close(fd);
return ret; return ret;