Module Name:    othersrc
Committed By:   lukem
Date:           Sat Sep 23 04:45:03 UTC 2023

Modified Files:
        othersrc/libexec/tnftpd: configure.ac tnftpd.h

Log Message:
configure: only replace fts_open if required FTS_ flags aren't available

Use system fts_open() if it provides the flags we use:
        FTS_COMFOLLOW|FTS_LOGICAL|FTS_NOSTAT|FTS_PHYSICAL|FTS_SEEDOT


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.40 -r1.41 othersrc/libexec/tnftpd/tnftpd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.51 othersrc/libexec/tnftpd/configure.ac:1.52
--- othersrc/libexec/tnftpd/configure.ac:1.51	Sat Sep 23 04:28:10 2023
+++ othersrc/libexec/tnftpd/configure.ac	Sat Sep 23 04:45:03 2023
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.51 2023/09/23 04:28:10 lukem Exp $
+# $NetBSD: configure.ac,v 1.52 2023/09/23 04:45:03 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -95,8 +95,10 @@ AH_TEMPLATE([USE_BLOCKLIST],
             [Define if using blocklist.])
 AH_TEMPLATE([USE_BLACKLIST],
             [Define if using blacklist.])
+AH_TEMPLATE([USE_FTS_H],
+            [Define if using system <fts.h> instead of ftpfts.h.])
 AH_TEMPLATE([USE_GLOB_H],
-            [Define if using system <glob.h> instead of local glob.])
+            [Define if using system <glob.h> instead of ftpglob.h.])
 AH_TEMPLATE([USE_INET6],
             [Define if using IPv6 support.])
 AH_TEMPLATE([USE_PAM],
@@ -313,7 +315,7 @@ AC_CHECK_HEADER([glob.h],
 int f = GLOB_BRACE|GLOB_LIMIT|GLOB_NOCHECK|GLOB_TILDE;
 ]])],
                          [AC_MSG_RESULT([yes])
-			  use_local_glob=no],
+                          use_local_glob=no],
                          [AC_MSG_RESULT([no - using local version])],
                          [AC_MSG_RESULT([unknown - cross-compiling])])])
 AS_IF([test "$use_local_glob" = yes],
@@ -485,9 +487,25 @@ AS_IF([test "$with_skey" != no],
 AS_IF([test "$opt_builtinls" = yes],
       [AC_MSG_NOTICE([--enable-builtinls; checking for required features])
        AC_REPLACE_FUNCS([strmode user_from_uid])
-       # Always replace fts_open(); the vendor's may not be secure.
+
+       # Use system fts if required FTS_ flags are available.
        #
-       AC_LIBOBJ([fts_open])
+       use_local_fts=yes
+       AC_CHECK_HEADER([fts.h],
+                       [AC_MSG_CHECKING([fts supports required flags])
+                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+$accheck_includes
+#include <fts.h>]], [[
+int f = FTS_COMFOLLOW|FTS_LOGICAL|FTS_NOSTAT|FTS_PHYSICAL|FTS_SEEDOT;
+]])],
+                                [AC_MSG_RESULT([yes])
+                                 use_local_fts=no],
+                                [AC_MSG_RESULT([no - using local version])],
+                                [AC_MSG_RESULT([unknown - cross-compiling])])])
+       AS_IF([test "$use_local_fts" = yes],
+             [AC_LIBOBJ([fts_open])],
+             [AC_DEFINE([USE_FTS_H], [1])])
+
        AC_MSG_NOTICE([--enable-builtinls feature check complete])],
       [AC_DEFINE([NO_INTERNAL_LS], [1])])
 

Index: othersrc/libexec/tnftpd/tnftpd.h
diff -u othersrc/libexec/tnftpd/tnftpd.h:1.40 othersrc/libexec/tnftpd/tnftpd.h:1.41
--- othersrc/libexec/tnftpd/tnftpd.h:1.40	Sat Sep 23 04:28:10 2023
+++ othersrc/libexec/tnftpd/tnftpd.h	Sat Sep 23 04:45:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tnftpd.h,v 1.40 2023/09/23 04:28:10 lukem Exp $ */
+/* $NetBSD: tnftpd.h,v 1.41 2023/09/23 04:45:03 lukem Exp $ */
 
 #define	FTPD_VERSION	PACKAGE_STRING
 
@@ -246,7 +246,7 @@ int		 sl_delete(StringList *, const char
 # endif
 #endif
 
-#if defined(HAVE_FTS_H)
+#if defined(USE_FTS_H)
 # include <fts.h>
 #else
 # include "ftpfts.h"

Reply via email to