Testing for the 4.4p1 release

Corinna Vinschen vinschen at redhat.com
Thu Aug 31 02:35:21 EST 2006


On Aug 30 23:41, Damien Miller wrote:
> Hi,
> 
> The 4.4p1 release is approaching now, so we are now asking people to 
> actively test snapshots or CVS and report back to the mailing list.
> [...]
> $ ./configure && make tests
> 
> Testing on suitable non-production systems is also appreciated. Please send
> reports of success or failure to openssh-unix-dev at mindrot.org, including 
> details of your platform, compiler and configure options.

Cygwin 1.5.21, OpenSSL 0.9.8b

OpenSSH has been configured with the following options:
                     User binaries: /usr/bin
                   System binaries: /usr/sbin
               Configuration files: /etc
                   Askpass program: ${prefix}/sbin/ssh-askpass
                      Manual pages: /usr/share/man/manX
                          PID file: /var/run
  Privilege separation chroot path: /var/empty
            sshd default user PATH: /bin:/usr/sbin:/sbin:/usr/bin
                    Manpage format: doc
                       PAM support: no
                 KerberosV support: no
                   SELinux support: no
                 Smartcard support: no
                     S/KEY support: no
              TCP Wrappers support: yes
              MD5 password support: no
                   libedit support: no
       IP address in $DISPLAY hack: no
           Translate v4 in v6 hack: no
                  BSD Auth support: no
              Random number source: OpenSSL internal ONLY

              Host: i686-pc-cygwin
          Compiler: gcc
    Compiler flags: -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare 
Preprocessor flags: 
      Linker flags: 
         Libraries: -lwrap  -lresolv -lcrypto -lz  /usr/lib/textmode.o -lcrypt

Configures and builds OOTB.  make tests works mostly, but sftp-badcmds.sh
test is broken and results in core dumps when evaluating the result of a
glob() call.

The reason is a bit complicated and what confused me first was the fact
that this didn't happen under earlier versions of sftp.

Actually, OpenSSH didn't use Cygwin's glob() implementation before
(which is a relatively old NetBSD derived implementation), because the
configure test for gl_matchc failed up to 4.3p2.  The AC_EGREP_CPP
autoconf test failed, while the new AC_TRY_COMPILE test in 4.4p1 now
works, so starting with 4.4p1, OpenSSH uses Cygwin's glob function.

But why does it core dump?  The reason is that the old glob implementation
in Cygwin doesn't know about the GLOB_NOMATCH return code.  In case there's
no match, it returns 0, with gl_matchc set to 0 and gl_pathv set to NULL.

Unfortunately, this situation is not recognized as "File not found"
condition in sftp.  The result is that process_put as well as process_get
SEGV when accessing g.gl_pathv[0].

What can we do?  Of course we will update the glob function in Cygwin
for the next Cygwin version, but that won't help for older and current
versions of Cygwin.

As a workaround in sftp, I applied the below patch, which also checks
for gl_matchc being 0 to recognize a "File not found" condition.  Would
that be ok for sftp?

Index: sftp.c
===================================================================
RCS file: /cvs/openssh/sftp.c,v
retrieving revision 1.97
diff -p -u -r1.97 sftp.c
--- sftp.c      5 Aug 2006 02:39:40 -0000       1.97
+++ sftp.c      30 Aug 2006 15:55:30 -0000
@@ -535,7 +535,7 @@ process_get(struct sftp_conn *conn, char
 
        memset(&g, 0, sizeof(g));
        debug3("Looking up %s", abs_src);
-       if (remote_glob(conn, abs_src, 0, NULL, &g)) {
+       if (remote_glob(conn, abs_src, 0, NULL, &g) || g.gl_matchc == 0) {
                error("File \"%s\" not found.", abs_src);
                err = -1;
                goto out;
@@ -603,7 +603,7 @@ process_put(struct sftp_conn *conn, char
 
        memset(&g, 0, sizeof(g));
        debug3("Looking up %s", src);
-       if (glob(src, 0, NULL, &g)) {
+       if (glob(src, 0, NULL, &g) || g.gl_matchc == 0) {
                error("File \"%s\" not found.", src);
                err = -1;
                goto out;


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the openssh-unix-dev mailing list