Portable OpenSSH-2.5.2p2

Philippe Levan levan at epix.net
Mon Mar 26 12:58:11 EST 2001


The same problem exists under Solaris.

What I found out is that on Solaris struct dirent is defined as :

typedef struct dirent {
        ino_t           d_ino;          /* "inode number" of entry */
        off_t           d_off;          /* offset of disk directory entry */
        unsigned short  d_reclen;       /* length of this record */
        char            d_name[1];      /* name of file */
} dirent_t;

In that case, fudge_readdir() in sftp-glob.c will reserve 1 byte
for ret.d_name : just enough to store the NULL character but
nothing else.

It looks like, short of redefining struct dirent on Solaris, one
possibility would be to allocate an oversized buffer to hold the
structure and the real string. Something like :

	static char buffer[sizeof(struct dirent)+DNAME_SIZE];
	static struct dirent *ret = (struct dirent *)buffer;
	...
	memset(buffer, 0, sizeof(buffer));
	strlcpy(ret->d_name, od->dir[od->offset++]->filename,
	    sizeof(ret->d_name)+DNAME_SIZE);
	...
	return ret;

where DNAME_SIZE would be an appropriate buffer size.

			Philippe.

---
Philippe Levan | Systems Engineering
levan at epix.net | epix Internet Services

On Thu, 22 Mar 2001, Jan-Frode Myklebust wrote:

> On Thu, Mar 22, 2001 at 09:43:56PM +1100, Damien Miller wrote:
> >
> > Sftp:
> > 	sftp client supports globbing (get *, put *).
> >
>
> It globs put, but not get for me:
>
> sftp> put *.res
> Uploading bouen100.res to /tmp/bouen100.res
> Uploading cdelapp.res to /tmp/cdelapp.res
> sftp> get *.res
> File "/tmp/*.res" not found.
> sftp> get cdelapp.res
> Fetching /tmp/cdelapp.res to cdelapp.res
> sftp>
>
>
> OpenSSH configured has been configured with the following options.
>                  User binaries: /usr/openssh/bin
>                System binaries: /usr/openssh/sbin
>            Configuration files: /usr/openssh/etc
>                Askpass program: /usr/openssh/libexec/ssh-askpass
>                   Manual pages: /usr/openssh/man/manX
>                       PID file: /usr/openssh/etc
>         sshd default user PATH: /usr/bin:/bin:/usr/sbin:/sbin:/usr/openssh/bin
>       Random number collection: Builtin (timeout 200)
>                 Manpage format: cat
>                    PAM support: no
>             KerberosIV support: no
>                    AFS support: no
>                  S/KEY support: no
>           TCP Wrappers support: yes
>           MD5 password support: no
>    IP address in $DISPLAY hack: no
>       Use IPv4 by default hack: no
>        Translate v4 in v6 hack: no
>
>               Host: mips-sgi-irix6.5
>           Compiler: cc
>     Compiler flags: -g
> Preprocessor flags:  -I/usr/local/include -I/usr/local/ssl/include
>       Linker flags:  -L/usr/local/ssl/lib
>          Libraries: -lwrap -lz  -lgen  -lcrypto
>
>
>
>   -jf
>
>




More information about the openssh-unix-dev mailing list