diff options
author | Darren Tucker <dtucker@zip.com.au> | 2015-07-17 04:52:34 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2015-07-17 04:58:02 +0200 |
commit | d3e2aee41487d55b8d7d40f538b84ff1db7989bc (patch) | |
tree | cbe43672e70bc3fdcaf47c311dfabc8d282cacd5 /openbsd-compat | |
parent | upstream commit (diff) | |
download | openssh-d3e2aee41487d55b8d7d40f538b84ff1db7989bc.tar.xz openssh-d3e2aee41487d55b8d7d40f538b84ff1db7989bc.zip |
Check if realpath works on nonexistent files.
On some platforms the native realpath doesn't work with non-existent
files (this is actually specified in some versions of POSIX), however
the sftp spec says its realpath with "canonicalize any given path name".
On those platforms, use realpath from the compat library.
In addition, when compiling with -DFORTIFY_SOURCE, glibc redefines
the realpath symbol to the checked version, so redefine ours to
something else so we pick up the compat version we want.
bz#2428, ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/openbsd-compat.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index cb59ccd57..1ff7114ef 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -70,8 +70,16 @@ void *reallocarray(void *, size_t, size_t); #endif #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) +/* + * glibc's FORTIFY_SOURCE can redefine this and prevent us picking up the + * compat version. + */ +# ifdef BROKEN_REALPATH +# define realpath(x, y) _ssh_compat_realpath(x, y) +# endif + char *realpath(const char *path, char *resolved); -#endif +#endif #ifndef HAVE_RRESVPORT_AF int rresvport_af(int *alport, sa_family_t af); |