diff options
author | Darren Tucker <dtucker@zip.com.au> | 2015-10-29 10:48:23 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2015-10-29 10:48:23 +1100 |
commit | 8db134e7f457bcb069ec72bc4ee722e2af557c69 (patch) | |
tree | a0d16eb42cc7d97396504b75163b812468811269 /openbsd-compat | |
parent | 86c10dbbef6a5800d2431a66cf7f41a954bb62b5 (diff) |
Prevent name collisions with system glob (bz#2463)
Move glob.h from includes.h to the only caller (sftp) and override the
names for the symbols. This prevents name collisions with the system glob
in the case where something other than ssh uses it (eg kerberos). With
jjelen at redhat.com, ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/glob.c | 1 | ||||
-rw-r--r-- | openbsd-compat/glob.h | 8 | ||||
-rw-r--r-- | openbsd-compat/openbsd-compat.h | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index 742b4b954..7c97e67f5 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c | |||
@@ -59,6 +59,7 @@ | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "includes.h" | 61 | #include "includes.h" |
62 | #include "glob.h" | ||
62 | 63 | ||
63 | #include <sys/types.h> | 64 | #include <sys/types.h> |
64 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
diff --git a/openbsd-compat/glob.h b/openbsd-compat/glob.h index f8a7fa5ff..f069a05dc 100644 --- a/openbsd-compat/glob.h +++ b/openbsd-compat/glob.h | |||
@@ -42,11 +42,15 @@ | |||
42 | !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 || \ | 42 | !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 || \ |
43 | defined(BROKEN_GLOB) | 43 | defined(BROKEN_GLOB) |
44 | 44 | ||
45 | #ifndef _GLOB_H_ | 45 | #ifndef _COMPAT_GLOB_H_ |
46 | #define _GLOB_H_ | 46 | #define _COMPAT_GLOB_H_ |
47 | 47 | ||
48 | #include <sys/stat.h> | 48 | #include <sys/stat.h> |
49 | 49 | ||
50 | # define glob_t _ssh_compat_glob_t | ||
51 | # define glob(a, b, c, d) _ssh__compat_glob(a, b, c, d) | ||
52 | # define globfree(a) _ssh__compat_globfree(a) | ||
53 | |||
50 | struct stat; | 54 | struct stat; |
51 | typedef struct { | 55 | typedef struct { |
52 | int gl_pathc; /* Count of total paths so far. */ | 56 | int gl_pathc; /* Count of total paths so far. */ |
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index 1ff7114ef..8cc8a11b7 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h | |||
@@ -39,7 +39,6 @@ | |||
39 | /* OpenBSD function replacements */ | 39 | /* OpenBSD function replacements */ |
40 | #include "base64.h" | 40 | #include "base64.h" |
41 | #include "sigact.h" | 41 | #include "sigact.h" |
42 | #include "glob.h" | ||
43 | #include "readpassphrase.h" | 42 | #include "readpassphrase.h" |
44 | #include "vis.h" | 43 | #include "vis.h" |
45 | #include "getrrsetbyname.h" | 44 | #include "getrrsetbyname.h" |