Bug 1634

Summary: [PATCH] openbsd-compat/glob.h conflicts with system glob.h
Product: Portable OpenSSH Reporter: Jonathan Chen <opensslbug0lkdsfo8hsd>
Component: MiscellaneousAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: dtucker
Priority: P2    
Version: 5.2p1   
Hardware: All   
OS: FreeBSD   
Bug Depends on:    
Bug Blocks: 1560    

Description Jonathan Chen 2009-08-20 13:54:14 AEST
On FreeBSD, openbsd-compat's glob is supposed to be used used instead of the system glob, due to BROKEN_GLOB being set in configure.  However, includes.h pulls in the system glob.h nonetheless, resulting in divergent glob_t definitions within openssh.

On FreeBSD, this can manifest as sftp throwing a SIGBUS when a directory listing is requested.

The trivial patch below fixes the problem.


--- includes.h~ 2009-08-19 23:32:26.000000000 -0400
+++ includes.h  2009-08-19 23:32:53.000000000 -0400
@@ -31,7 +31,8 @@
 #endif
 #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \
     defined(GLOB_HAS_GL_MATCHC) && \
-    defined(HAVE_DECL_GLOB_NOMATCH) &&  HAVE_DECL_GLOB_NOMATCH != 0
+    defined(HAVE_DECL_GLOB_NOMATCH) &&  HAVE_DECL_GLOB_NOMATCH != 0 &&\
+    !defined(BROKEN_GLOB)
 # include <glob.h>
 #endif
 #ifdef HAVE_ENDIAN_H
Comment 1 Darren Tucker 2009-08-20 16:16:38 AEST
Applied, thanks.  This will be in the 5.3p1 release.
Comment 2 Damien Miller 2009-10-06 15:02:04 AEDT
Mass move of RESOLVED bugs to CLOSED now that 5.3 is out.