diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/autom4te.cache/requests ntfs-3g-2016.2.22AR.2/autom4te.cache/requests --- ntfs-3g-2016.2.22AR.1+dfsg/autom4te.cache/requests 2016-04-01 06:38:02.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/autom4te.cache/requests 2016-10-01 06:42:15.000000000 +0000 @@ -44,194 +44,194 @@ 'configure.ac' ], { - '_LT_WITH_SYSROOT' => 1, - 'LT_SYS_MODULE_EXT' => 1, - '_LT_PROG_F77' => 1, - 'PKG_CHECK_EXISTS' => 1, - 'AC_LTDL_SHLIBPATH' => 1, - 'AM_DEP_TRACK' => 1, - 'LT_PATH_NM' => 1, - '_LT_AC_CHECK_DLFCN' => 1, - 'AC_LIBTOOL_CONFIG' => 1, - 'LT_CMD_MAX_LEN' => 1, + '_LT_AC_LANG_F77_CONFIG' => 1, + 'AC_LIBTOOL_SETUP' => 1, 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, - 'AC_ENABLE_SHARED' => 1, + '_LT_AC_LANG_CXX_CONFIG' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'm4_pattern_allow' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'LT_LANG' => 1, + 'AC_LIBLTDL_CONVENIENCE' => 1, + 'include' => 1, + 'AC_LIBTOOL_LANG_RC_CONFIG' => 1, + 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1, + 'AC_DISABLE_STATIC' => 1, + '_LT_PATH_TOOL_PREFIX' => 1, + 'AC_LIBTOOL_F77' => 1, + 'LTVERSION_VERSION' => 1, + '_LT_COMPILER_OPTION' => 1, + '_LT_PREPARE_SED_QUOTE_VARS' => 1, + '_LT_PROG_LTMAIN' => 1, + '_LT_AC_LANG_F77' => 1, + '_LT_AC_LANG_C_CONFIG' => 1, + 'AC_DEFUN' => 1, + 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, '_LT_PROG_CXX' => 1, - '_LT_AC_PROG_ECHO_BACKSLASH' => 1, - '_AM_SET_OPTIONS' => 1, - '_AM_MANGLE_OPTION' => 1, - 'AC_LIBTOOL_POSTDEP_PREDEP' => 1, + 'AC_LTDL_OBJDIR' => 1, + '_LT_PROG_F77' => 1, + 'LT_SYS_DLOPEN_SELF' => 1, + 'AC_LIBTOOL_PROG_COMPILER_PIC' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AM_PROG_NM' => 1, + '_LT_PROG_FC' => 1, + '_LT_AC_PROG_CXXCPP' => 1, + 'LT_SYS_DLOPEN_DEPLIBS' => 1, + '_LT_LINKER_BOILERPLATE' => 1, + 'AC_CHECK_LIBM' => 1, + 'AC_LTDL_PREOPEN' => 1, + 'AC_PROG_NM' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'LT_AC_PROG_GCJ' => 1, 'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1, - 'LT_SYS_SYMBOL_USCORE' => 1, - 'AM_DISABLE_STATIC' => 1, - 'LTOPTIONS_VERSION' => 1, - 'LT_SYS_DLSEARCH_PATH' => 1, - 'PKG_INSTALLDIR' => 1, - 'LT_AC_PROG_RC' => 1, - 'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1, - 'AM_MISSING_PROG' => 1, - '_LT_PATH_TOOL_PREFIX' => 1, - '_LT_AC_LANG_GCJ' => 1, - '_LT_AC_SYS_COMPILER' => 1, - '_AC_PROG_LIBTOOL' => 1, - 'AM_MAINTAINER_MODE' => 1, - 'AM_MAKE_INCLUDE' => 1, - 'AM_CONDITIONAL' => 1, + '_PKG_SHORT_ERRORS_SUPPORTED' => 1, + 'AM_PROG_CC_C_O' => 1, + 'LT_PATH_LD' => 1, + 'AM_DEP_TRACK' => 1, + 'AM_MISSING_HAS_RUN' => 1, '_AM_CONFIG_MACRO_DIRS' => 1, - 'AC_DISABLE_FAST_INSTALL' => 1, - '_LT_PROG_ECHO_BACKSLASH' => 1, - 'LT_PROG_RC' => 1, - 'AC_CONFIG_MACRO_DIR' => 1, - '_LTDL_SETUP' => 1, - '_LT_PROG_FC' => 1, - 'LT_PROG_GO' => 1, - '_LT_COMPILER_OPTION' => 1, - 'AC_LIBTOOL_FC' => 1, - 'AC_DISABLE_STATIC' => 1, - 'LT_AC_PROG_EGREP' => 1, - 'AC_DISABLE_SHARED' => 1, - 'LT_LANG' => 1, + 'AM_ENABLE_STATIC' => 1, + 'AC_PROG_LIBTOOL' => 1, + '_AM_IF_OPTION' => 1, + 'AC_LIBTOOL_POSTDEP_PREDEP' => 1, + '_AM_SET_OPTIONS' => 1, + 'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1, + 'AC_LIBTOOL_CONFIG' => 1, + '_AM_DEPENDENCIES' => 1, + 'gl_FUNC_ARGZ' => 1, + 'gl_PREREQ_ARGZ' => 1, 'AC_LIBTOOL_PROG_LD_SHLIBS' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, - 'AC_DEFUN_ONCE' => 1, + 'AC_LIBTOOL_LANG_C_CONFIG' => 1, + '_LT_AC_LANG_GCJ' => 1, + 'AC_LTDL_ENABLE_INSTALL' => 1, + 'AC_WITH_LTDL' => 1, + 'AM_CONDITIONAL' => 1, + 'PKG_CHECK_VAR' => 1, + '_LT_AC_SYS_LIBPATH_AIX' => 1, + 'AC_LTDL_SHLIBPATH' => 1, + '_LT_AC_LANG_RC_CONFIG' => 1, + 'AC_LTDL_DLLIB' => 1, + '_LT_AC_LANG_GCJ_CONFIG' => 1, + 'AM_SUBST_NOTMAKE' => 1, + '_LT_AC_FILE_LTDLL_C' => 1, + 'AM_DISABLE_SHARED' => 1, + 'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1, + 'LTOPTIONS_VERSION' => 1, + '_LT_CC_BASENAME' => 1, + 'AC_LIBTOOL_CXX' => 1, + '_AC_AM_CONFIG_HEADER_HOOK' => 1, + 'LT_SYS_MODULE_EXT' => 1, + 'LTOBSOLETE_VERSION' => 1, + 'AC_LIBTOOL_LANG_CXX_CONFIG' => 1, + 'LT_SYS_SYMBOL_USCORE' => 1, + 'LT_OUTPUT' => 1, + 'AC_LIBTOOL_GCJ' => 1, 'AC_DEPLIBS_CHECK_METHOD' => 1, - 'AC_PROG_LD_GNU' => 1, - '_LT_AC_SHELL_INIT' => 1, - 'AM_AUX_DIR_EXPAND' => 1, - '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, - 'AM_PROG_INSTALL_STRIP' => 1, - 'gl_FUNC_ARGZ' => 1, + 'AC_DISABLE_SHARED' => 1, + 'AC_LIBLTDL_INSTALLABLE' => 1, + 'AC_PATH_TOOL_PREFIX' => 1, 'PKG_NOARCH_INSTALLDIR' => 1, - 'AM_DISABLE_SHARED' => 1, - 'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1, - 'AM_PATH_LIBGCRYPT' => 1, + 'AM_ENABLE_SHARED' => 1, + 'LT_SUPPORTED_TAG' => 1, '_LT_AC_TAGVAR' => 1, - 'AC_CONFIG_MACRO_DIR_TRACE' => 1, - '_AM_DEPENDENCIES' => 1, - 'LTOBSOLETE_VERSION' => 1, - 'LTDL_CONVENIENCE' => 1, - '_AM_SET_OPTION' => 1, - 'AC_LIBTOOL_WIN32_DLL' => 1, - 'AC_PROG_LD' => 1, + 'LT_LIB_M' => 1, + 'AC_ENABLE_SHARED' => 1, + 'AC_DEFUN_ONCE' => 1, + 'AC_LIBTOOL_COMPILER_OPTION' => 1, + 'LT_PROG_RC' => 1, 'LT_FUNC_DLSYM_USCORE' => 1, - '_LT_AC_LANG_F77' => 1, - '_LT_AC_SYS_LIBPATH_AIX' => 1, - 'AC_LIBTOOL_DLOPEN_SELF' => 1, - 'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1, - 'AC_LIBLTDL_CONVENIENCE' => 1, + 'AM_PROG_INSTALL_STRIP' => 1, 'AC_LTDL_SYMBOL_USCORE' => 1, - 'AC_LIBTOOL_PROG_COMPILER_PIC' => 1, - 'LT_SYS_MODULE_PATH' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'LT_AC_PROG_GCJ' => 1, - 'AC_ENABLE_STATIC' => 1, - 'AC_LIBTOOL_RC' => 1, - '_AM_AUTOCONF_VERSION' => 1, - 'AC_PROG_NM' => 1, - '_AM_PROG_CC_C_O' => 1, - 'LT_SYS_DLOPEN_SELF' => 1, - 'AM_RUN_LOG' => 1, - '_LT_AC_LANG_RC_CONFIG' => 1, - 'LTDL_INIT' => 1, - 'AM_PROG_CC_C_O' => 1, - '_LT_REQUIRED_DARWIN_CHECKS' => 1, - 'm4_pattern_allow' => 1, - 'AM_SET_LEADING_DOT' => 1, - 'AC_DEFUN' => 1, - 'AC_ENABLE_FAST_INSTALL' => 1, - 'gl_PREREQ_ARGZ' => 1, - 'LTDL_INSTALLABLE' => 1, - 'AC_LIB_LTDL' => 1, - 'AC_PATH_TOOL_PREFIX' => 1, - 'AC_LTDL_SYSSEARCHPATH' => 1, + 'AC_LIBTOOL_FC' => 1, + 'LT_AC_PROG_RC' => 1, + 'AC_LIBTOOL_SYS_LIB_STRIP' => 1, 'AM_PROG_INSTALL_SH' => 1, - 'AC_LIBTOOL_SETUP' => 1, - 'AM_PROG_LIBTOOL' => 1, + 'AM_PROG_LD' => 1, + 'AC_LIBTOOL_DLOPEN' => 1, + 'LT_PATH_NM' => 1, + '_LT_LIBOBJ' => 1, 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1, - 'AC_LTDL_PREOPEN' => 1, - 'AC_LTDL_OBJDIR' => 1, - 'AU_DEFUN' => 1, - 'AC_LTDL_DLSYM_USCORE' => 1, - 'AM_ENABLE_SHARED' => 1, - 'AM_SANITY_CHECK' => 1, - '_LT_AC_TRY_DLOPEN_SELF' => 1, - '_LT_AC_LANG_GCJ_CONFIG' => 1, - 'AM_ENABLE_STATIC' => 1, - 'm4_pattern_forbid' => 1, - 'AC_LIBTOOL_COMPILER_OPTION' => 1, - 'AC_LIBTOOL_CXX' => 1, - '_LT_CC_BASENAME' => 1, - 'AC_CHECK_LIBM' => 1, + 'AC_LIB_LTDL' => 1, + 'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1, + 'AM_RUN_LOG' => 1, 'LT_WITH_LTDL' => 1, - 'LT_OUTPUT' => 1, + '_AM_AUTOCONF_VERSION' => 1, + 'AC_PATH_MAGIC' => 1, + '_LT_AC_TRY_DLOPEN_SELF' => 1, + 'AU_DEFUN' => 1, + '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'm4_include' => 1, + 'AM_SET_LEADING_DOT' => 1, + 'AC_PROG_LD' => 1, + 'AM_DISABLE_STATIC' => 1, + 'PKG_PROG_PKG_CONFIG' => 1, + 'AC_LIBTOOL_RC' => 1, + '_LT_PROG_ECHO_BACKSLASH' => 1, + 'LTDL_INSTALLABLE' => 1, 'AC_LIBTOOL_OBJDIR' => 1, - 'AC_LIBTOOL_SYS_LIB_STRIP' => 1, - '_LT_AC_LANG_F77_CONFIG' => 1, - 'AC_PROG_EGREP' => 1, - 'AC_LIBTOOL_PROG_CC_C_O' => 1, - 'LT_SUPPORTED_TAG' => 1, - '_LT_COMPILER_BOILERPLATE' => 1, - 'AM_SILENT_RULES' => 1, - 'AM_PROG_NM' => 1, - 'LTVERSION_VERSION' => 1, - 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1, - '_AM_IF_OPTION' => 1, - 'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1, - 'AC_LIBTOOL_LANG_C_CONFIG' => 1, + 'AM_PROG_LIBTOOL' => 1, + '_LT_AC_SYS_COMPILER' => 1, + 'LT_PROG_GO' => 1, + '_AM_MANGLE_OPTION' => 1, + 'LT_AC_PROG_EGREP' => 1, 'LTSUGAR_VERSION' => 1, - 'AC_LIBTOOL_LANG_F77_CONFIG' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'PKG_CHECK_VAR' => 1, - '_AM_SUBST_NOTMAKE' => 1, - 'LT_SYS_DLOPEN_DEPLIBS' => 1, - '_LT_AC_PROG_CXXCPP' => 1, - 'AC_LIBTOOL_LINKER_OPTION' => 1, - '_LT_LIBOBJ' => 1, - '_LT_LINKER_BOILERPLATE' => 1, + 'PKG_INSTALLDIR' => 1, 'AC_LTDL_SHLIBEXT' => 1, - '_LT_AC_TAGCONFIG' => 1, - 'AC_LTDL_DLLIB' => 1, - 'AM_SET_DEPDIR' => 1, - 'LT_PROG_GCJ' => 1, - 'AC_LIBTOOL_LANG_RC_CONFIG' => 1, - '_LT_PROG_LTMAIN' => 1, - 'LT_LIB_DLLOAD' => 1, + 'AM_PATH_LIBGCRYPT' => 1, + '_LT_AC_LANG_CXX' => 1, + 'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1, + 'AC_PROG_EGREP' => 1, + '_AM_PROG_CC_C_O' => 1, + '_LT_REQUIRED_DARWIN_CHECKS' => 1, 'AC_PROG_LD_RELOAD_FLAG' => 1, - 'PKG_PROG_PKG_CONFIG' => 1, - '_LT_PREPARE_SED_QUOTE_VARS' => 1, - 'AC_LIBLTDL_INSTALLABLE' => 1, - 'AC_WITH_LTDL' => 1, - '_LT_AC_LANG_C_CONFIG' => 1, - 'LT_PATH_LD' => 1, - 'AC_LIBTOOL_DLOPEN' => 1, - 'LT_INIT' => 1, - 'AC_LIBTOOL_GCJ' => 1, - '_LT_AC_LANG_CXX_CONFIG' => 1, - 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, - 'AC_LTDL_ENABLE_INSTALL' => 1, - 'AC_LIBTOOL_F77' => 1, - 'AC_LIBTOOL_LANG_CXX_CONFIG' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_LIBTOOL_WIN32_DLL' => 1, + '_LT_WITH_SYSROOT' => 1, + 'AM_AUX_DIR_EXPAND' => 1, + 'LT_LIB_DLLOAD' => 1, + 'AC_LIBTOOL_LINKER_OPTION' => 1, + 'PKG_CHECK_EXISTS' => 1, + 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1, + 'LT_PROG_GCJ' => 1, '_LT_AC_LOCK' => 1, - 'AM_MISSING_HAS_RUN' => 1, - '_m4_warn' => 1, + '_LT_AC_CHECK_DLFCN' => 1, + '_AC_PROG_LIBTOOL' => 1, + 'PKG_CHECK_MODULES' => 1, 'AC_LIBTOOL_PICMODE' => 1, + 'AM_SET_DEPDIR' => 1, + 'AC_LIBTOOL_DLOPEN_SELF' => 1, + 'AC_ENABLE_FAST_INSTALL' => 1, + '_LTDL_SETUP' => 1, + '_LT_LINKER_OPTION' => 1, + '_LT_COMPILER_BOILERPLATE' => 1, + 'AM_MISSING_PROG' => 1, + 'AC_DISABLE_FAST_INSTALL' => 1, + 'LTDL_INIT' => 1, + 'AC_LIBTOOL_LANG_F77_CONFIG' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'AC_CONFIG_MACRO_DIR' => 1, + 'AC_PROG_LD_GNU' => 1, + 'LT_CMD_MAX_LEN' => 1, + 'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1, + '_LT_AC_PROG_ECHO_BACKSLASH' => 1, + 'AM_SANITY_CHECK' => 1, + 'AC_LTDL_DLSYM_USCORE' => 1, + '_AM_SET_OPTION' => 1, + 'AM_MAKE_INCLUDE' => 1, + 'LT_SYS_MODULE_PATH' => 1, + 'AM_SILENT_RULES' => 1, + '_m4_warn' => 1, + 'AC_CONFIG_MACRO_DIR_TRACE' => 1, '_AM_PROG_TAR' => 1, - 'include' => 1, - '_LT_AC_LANG_CXX' => 1, - 'AM_PROG_LD' => 1, - 'AM_SUBST_NOTMAKE' => 1, - 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1, - '_LT_AC_FILE_LTDLL_C' => 1, - 'LT_LIB_M' => 1, - 'AC_PROG_LIBTOOL' => 1, - '_AC_AM_CONFIG_HEADER_HOOK' => 1, - 'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1, + 'LT_SYS_DLSEARCH_PATH' => 1, + 'LTDL_CONVENIENCE' => 1, + 'AC_LIBTOOL_PROG_CC_C_O' => 1, + 'AC_ENABLE_STATIC' => 1, + 'LT_INIT' => 1, + 'm4_pattern_forbid' => 1, + 'AC_LTDL_SYSSEARCHPATH' => 1, 'LT_AC_PROG_SED' => 1, - 'm4_include' => 1, - 'PKG_CHECK_MODULES' => 1, - '_LT_LINKER_OPTION' => 1, - 'AC_PATH_MAGIC' => 1, - '_PKG_SHORT_ERRORS_SUPPORTED' => 1 + '_LT_AC_SHELL_INIT' => 1 } ], 'Autom4te::Request' ), bless( [ @@ -246,65 +246,65 @@ 'configure.ac' ], { - 'AC_FC_SRCEXT' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AM_PROG_F77_C_O' => 1, 'LT_INIT' => 1, - 'AM_EXTRA_RECURSIVE_TARGETS' => 1, - 'AH_OUTPUT' => 1, - 'AM_PROG_MOC' => 1, - 'AM_GNU_GETTEXT' => 1, 'AC_CONFIG_SUBDIRS' => 1, - 'AM_PROG_MKDIR_P' => 1, - 'AM_PROG_FC_C_O' => 1, - 'AC_CONFIG_LIBOBJ_DIR' => 1, - 'AM_NLS' => 1, - 'AC_LIBSOURCE' => 1, 'm4_pattern_forbid' => 1, - 'AC_CONFIG_AUX_DIR' => 1, - 'AC_CANONICAL_TARGET' => 1, - 'AM_PROG_F77_C_O' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AM_PROG_AR' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_PROG_LIBTOOL' => 1, 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, - 'AM_PATH_GUILE' => 1, - '_AM_MAKEFILE_INCLUDE' => 1, - 'AC_CONFIG_FILES' => 1, - '_LT_AC_TAGCONFIG' => 1, - 'AC_DEFINE_TRACE_LITERAL' => 1, - 'AC_FC_PP_SRCEXT' => 1, - 'AC_CANONICAL_HOST' => 1, + 'AM_SILENT_RULES' => 1, + '_m4_warn' => 1, + 'AC_INIT' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AM_NLS' => 1, + 'AM_GNU_GETTEXT' => 1, 'AC_FC_FREEFORM' => 1, + '_AM_COND_ELSE' => 1, + 'AC_LIBSOURCE' => 1, + '_AM_COND_IF' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_CONFIG_FILES' => 1, 'AC_SUBST_TRACE' => 1, - 'LT_CONFIG_LTDL_DIR' => 1, + 'm4_include' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_FC_SRCEXT' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'AC_FC_PP_DEFINE' => 1, + 'AM_PROG_MKDIR_P' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'sinclude' => 1, + 'AM_PROG_CXX_C_O' => 1, 'AM_POT_TOOLS' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, 'AC_CONFIG_LINKS' => 1, - 'AC_CONFIG_HEADERS' => 1, - 'AC_PROG_LIBTOOL' => 1, - '_AM_COND_ELSE' => 1, - 'AM_PROG_CC_C_O' => 1, - 'AM_ENABLE_MULTILIB' => 1, - 'AM_XGETTEXT_OPTION' => 1, + 'm4_sinclude' => 1, + 'AC_SUBST' => 1, + 'AM_PATH_GUILE' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'include' => 1, '_AM_COND_ENDIF' => 1, - 'AM_PROG_AR' => 1, - 'm4_pattern_allow' => 1, - 'AM_AUTOMAKE_VERSION' => 1, - 'AC_INIT' => 1, - '_AM_SUBST_NOTMAKE' => 1, - 'm4_include' => 1, - 'sinclude' => 1, + 'AH_OUTPUT' => 1, + 'AC_FC_PP_SRCEXT' => 1, 'AC_CANONICAL_BUILD' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AM_PROG_MOC' => 1, 'AM_MAINTAINER_MODE' => 1, - 'AC_CANONICAL_SYSTEM' => 1, - 'AM_CONDITIONAL' => 1, - '_m4_warn' => 1, - '_AM_COND_IF' => 1, - 'm4_sinclude' => 1, - 'AM_INIT_AUTOMAKE' => 1, - 'AC_REQUIRE_AUX_FILE' => 1, - 'AM_PROG_CXX_C_O' => 1, 'AM_MAKEFILE_INCLUDE' => 1, - 'include' => 1, - 'LT_SUPPORTED_TAG' => 1, - 'AC_SUBST' => 1, - 'AM_SILENT_RULES' => 1, - 'AC_FC_PP_DEFINE' => 1 + 'AM_INIT_AUTOMAKE' => 1, + 'AM_XGETTEXT_OPTION' => 1, + 'm4_pattern_allow' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AM_EXTRA_RECURSIVE_TARGETS' => 1 } ], 'Autom4te::Request' ) ); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/config.h.in ntfs-3g-2016.2.22AR.2/config.h.in --- ntfs-3g-2016.2.22AR.1+dfsg/config.h.in 2016-04-01 06:38:01.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/config.h.in 2016-10-01 06:42:14.000000000 +0000 @@ -93,6 +93,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `c' library (-lc). */ +#undef HAVE_LIBC + /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H @@ -260,9 +263,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MKDEV_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H @@ -275,9 +275,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSMACROS_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -325,6 +322,14 @@ */ #undef LT_OBJDIR +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#undef MAJOR_IN_MKDEV + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#undef MAJOR_IN_SYSMACROS + /* Don't use default IO ops */ #undef NO_NTFS_DEVICE_DEFAULT_IO_OPS diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/configure ntfs-3g-2016.2.22AR.2/configure --- ntfs-3g-2016.2.22AR.1+dfsg/configure 2016-04-01 06:38:04.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/configure 2016-10-01 06:42:17.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ntfs-3g 2016.2.22AR.1. +# Generated by GNU Autoconf 2.69 for ntfs-3g 2016.2.22AR.2. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='ntfs-3g' PACKAGE_TARNAME='ntfs-3g' -PACKAGE_VERSION='2016.2.22AR.1' -PACKAGE_STRING='ntfs-3g 2016.2.22AR.1' +PACKAGE_VERSION='2016.2.22AR.2' +PACKAGE_STRING='ntfs-3g 2016.2.22AR.2' PACKAGE_BUGREPORT='ntfs-3g-devel@lists.sf.net' PACKAGE_URL='' @@ -676,6 +676,7 @@ rootbindir ntfs3gincludedir pkgconfigdir +LIBDL LIBOBJS all_libraries all_includes @@ -1408,7 +1409,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ntfs-3g 2016.2.22AR.1 to adapt to many kinds of systems. +\`configure' configures ntfs-3g 2016.2.22AR.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1479,7 +1480,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfs-3g 2016.2.22AR.1:";; + short | recursive ) echo "Configuration of ntfs-3g 2016.2.22AR.2:";; esac cat <<\_ACEOF @@ -1638,7 +1639,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ntfs-3g configure 2016.2.22AR.1 +ntfs-3g configure 2016.2.22AR.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2118,7 +2119,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ntfs-3g $as_me 2016.2.22AR.1, which was +It was created by ntfs-3g $as_me 2016.2.22AR.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2467,7 +2468,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -LIBNTFS_3G_VERSION="871" +LIBNTFS_3G_VERSION="872" # Environment @@ -3098,7 +3099,7 @@ # Define the identity of the package. PACKAGE='ntfs-3g' - VERSION='2016.2.22AR.1' + VERSION='2016.2.22AR.2' cat >>confdefs.h <<_ACEOF @@ -3324,7 +3325,7 @@ # Check whether --enable-plugins was given. if test "${enable_plugins+set}" = set; then : - enableval=$enable_plugins; + enableval=$enable_plugins; if test x${enableval} = "xyes"; then disable_plugins="no"; fi else disable_plugins="no" @@ -13778,12 +13779,62 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 +$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } +if ${ac_cv_header_sys_types_h_makedev+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +return makedev(0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_header_sys_types_h_makedev=yes +else + ac_cv_header_sys_types_h_makedev=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 +$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } + +if test $ac_cv_header_sys_types_h_makedev = no; then +ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : + +$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h + +fi + + + + if test $ac_cv_header_sys_mkdev_h = no; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : + +$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h + +fi + + + fi +fi + for ac_header in ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \ mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \ strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \ regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \ - sys/param.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h \ - sys/vfs.h sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h \ + sys/param.h sys/ioctl.h sys/mount.h sys/stat.h sys/types.h \ + sys/vfs.h sys/statvfs.h linux/major.h linux/fd.h \ linux/fs.h inttypes.h linux/hdreg.h \ machine/endian.h windows.h syslog.h pwd.h malloc.h do : @@ -14903,6 +14954,101 @@ fi +# The dlopen API might be in libc or in libdl. Check libc first, then +# fall back to libdl. +LIBDL="" +if test "x${disable_plugins}" = "xno"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 +$as_echo_n "checking for dlopen in -lc... " >&6; } +if ${ac_cv_lib_c_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_dlopen=yes +else + ac_cv_lib_c_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 +$as_echo "$ac_cv_lib_c_dlopen" >&6; } +if test "x$ac_cv_lib_c_dlopen" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBC 1 +_ACEOF + + LIBS="-lc $LIBS" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + LIBDL="-ldl" +else + as_fn_error $? "\"Unable to find libdl (required for external plugin support)\"" "$LINENO" 5 +fi + +fi + +fi + + if test "$GCC" = "yes" ; then # We add -Wall to enable some compiler warnings. CFLAGS="${CFLAGS} -Wall" @@ -15693,7 +15839,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ntfs-3g $as_me 2016.2.22AR.1, which was +This file was extended by ntfs-3g $as_me 2016.2.22AR.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15759,7 +15905,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ntfs-3g config.status 2016.2.22AR.1 +ntfs-3g config.status 2016.2.22AR.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/configure.ac ntfs-3g-2016.2.22AR.2/configure.ac --- ntfs-3g-2016.2.22AR.1+dfsg/configure.ac 2016-04-01 06:37:47.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/configure.ac 2016-10-01 06:42:01.000000000 +0000 @@ -24,8 +24,8 @@ # Autoconf AC_PREREQ(2.59) -AC_INIT([ntfs-3g],[2016.2.22AR.1],[ntfs-3g-devel@lists.sf.net]) -LIBNTFS_3G_VERSION="871" +AC_INIT([ntfs-3g],[2016.2.22AR.2],[ntfs-3g-devel@lists.sf.net]) +LIBNTFS_3G_VERSION="872" AC_CONFIG_SRCDIR([src/ntfs-3g.c]) # Environment @@ -125,7 +125,7 @@ [plugins], [AS_HELP_STRING([--disable-plugins], [Disable external reparse point plugins for the ntfs-3g FUSE driver])], - , + [if test x${enableval} = "xyes"; then disable_plugins="no"; fi], [disable_plugins="no"] ) @@ -473,12 +473,13 @@ # Checks for header files. AC_HEADER_STDC +AC_HEADER_MAJOR AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \ mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \ strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \ regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \ - sys/param.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h \ - sys/vfs.h sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h \ + sys/param.h sys/ioctl.h sys/mount.h sys/stat.h sys/types.h \ + sys/vfs.h sys/statvfs.h linux/major.h linux/fd.h \ linux/fs.h inttypes.h linux/hdreg.h \ machine/endian.h windows.h syslog.h pwd.h malloc.h]) @@ -542,6 +543,16 @@ ]) AC_SYS_LARGEFILE +# The dlopen API might be in libc or in libdl. Check libc first, then +# fall back to libdl. +LIBDL="" +if test "x${disable_plugins}" = "xno"; then + AC_CHECK_LIB(c, dlopen, , + [AC_CHECK_LIB(dl, dlopen, [LIBDL="-ldl"], + [AC_MSG_ERROR(["Unable to find libdl (required for external plugin support)"])])]) +fi +AC_SUBST([LIBDL]) + if test "$GCC" = "yes" ; then # We add -Wall to enable some compiler warnings. CFLAGS="${CFLAGS} -Wall" diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/changelog ntfs-3g-2016.2.22AR.2/debian/changelog --- ntfs-3g-2016.2.22AR.1+dfsg/debian/changelog 2017-02-26 12:34:31.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/changelog 2017-06-22 19:12:30.000000000 +0000 @@ -1,17 +1,16 @@ -ntfs-3g (1:2016.2.22AR.1+dfsg-1) unstable; urgency=medium +ntfs-3g (1:2016.2.22AR.2-2) unstable; urgency=medium - * Repack source to have a DFSG free NTFS boot sector (closes: #808463) and - update copyright accordingly. - * Update watch file to mangle +dfsg from source version. + * Start the transition with upload to Sid. - -- Laszlo Boszormenyi (GCS) Sun, 26 Feb 2017 12:34:31 +0000 + -- Laszlo Boszormenyi (GCS) Thu, 22 Jun 2017 19:12:30 +0000 -ntfs-3g (1:2016.2.22AR.1-4) unstable; urgency=high +ntfs-3g (1:2016.2.22AR.2-1) experimental; urgency=low - * Fix CVE-2017-0358: modprobe influence vulnerability via environment - variables. + * New upstream release. + * Library transition from libntfs-3g871 to libntfs-3g872 . + * Remove 0002-kFreeBSD_ELIBBAD patch as included upstream. - -- Laszlo Boszormenyi (GCS) Wed, 01 Feb 2017 06:23:28 +0000 + -- Laszlo Boszormenyi (GCS) Sat, 26 Nov 2016 18:16:45 +0000 ntfs-3g (1:2016.2.22AR.1-3) unstable; urgency=low diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/control ntfs-3g-2016.2.22AR.2/debian/control --- ntfs-3g-2016.2.22AR.1+dfsg/debian/control 2016-04-21 18:49:07.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/control 2016-11-26 18:16:45.000000000 +0000 @@ -26,7 +26,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, - libntfs-3g871 (= ${binary:Version}) + libntfs-3g872 (= ${binary:Version}) #Provides: ${ntfs-3g:Provides} Description: read/write NTFS driver for FUSE NTFS-3G uses FUSE (Filesystem in Userspace) to provide support for the NTFS @@ -52,7 +52,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, - libntfs-3g871 (= ${binary:Version}), + libntfs-3g872 (= ${binary:Version}), ntfs-3g (= ${binary:Version}) Breaks: ntfs-3g (<< 1:2014.2.15AR.1-2~) Description: read/write NTFS driver for FUSE (development) @@ -61,7 +61,7 @@ . This package contains the development files. -Package: libntfs-3g871 +Package: libntfs-3g872 Section: libs Architecture: linux-any kfreebsd-any Depends: ${misc:Depends}, diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/copyright ntfs-3g-2016.2.22AR.2/debian/copyright --- ntfs-3g-2016.2.22AR.1+dfsg/debian/copyright 2017-02-26 12:34:31.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/copyright 2016-04-02 16:18:49.000000000 +0000 @@ -11,32 +11,6 @@ Copyright: 2000-2013 ntfs-3g Development Team License: LGPL-2+ -Files: ntfsprogs/boot.c -Copyright: Copyright (C) 1991 Linus Torvalds , - Copyright (C) 1992-1993 Remy Card , - Copyright (C) 1993-1994 David Hudson , - Copyright (C) 1998 H. Peter Anvin , - Copyright (C) 1998-2005 Roman Hodek , - Copyright (C) 2008-2014 Daniel Baumann , - Copyright (C) 2015 Andreas Bombe -License: GPL-3+ - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - . - On Debian systems, the complete text of the GNU General Public License - version 3 can be found in `/usr/share/common-licenses/GPL-3'. - Files: debian/* Copyright: 2014- Laszlo Boszormenyi (GCS) , 2011-2014 Daniel Baumann , diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/libntfs-3g871.install ntfs-3g-2016.2.22AR.2/debian/libntfs-3g871.install --- ntfs-3g-2016.2.22AR.1+dfsg/debian/libntfs-3g871.install 2015-10-24 07:41:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/libntfs-3g871.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -lib/*/*.so.* diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/libntfs-3g872.install ntfs-3g-2016.2.22AR.2/debian/libntfs-3g872.install --- ntfs-3g-2016.2.22AR.1+dfsg/debian/libntfs-3g872.install 1970-01-01 00:00:00.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/libntfs-3g872.install 2015-10-24 07:41:03.000000000 +0000 @@ -0,0 +1 @@ +lib/*/*.so.* diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/0002-kFreeBSD_ELIBBAD.patch ntfs-3g-2016.2.22AR.2/debian/patches/0002-kFreeBSD_ELIBBAD.patch --- ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/0002-kFreeBSD_ELIBBAD.patch 2016-04-21 17:31:24.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/patches/0002-kFreeBSD_ELIBBAD.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -Description: kFreeBSD ELIBBAD errno replacement - ELIBBAD errno is Linux only, use ENOEXEC instead on kFreeBSD. -Origin: upstream, http://www.tuxera.com/forum/viewtopic.php?f=5&t=31102 -Author: Jean-Pierre -Bug-Debian: https://bugs.debian.org/ -Last-Update: 2016-04-21 - ---- - ---- ntfs-3g-2016.2.22AR.1.orig/include/ntfs-3g/compat.h -+++ ntfs-3g-2016.2.22AR.1/include/ntfs-3g/compat.h -@@ -37,6 +37,10 @@ - #define ENODATA ENOENT - #endif - -+#ifndef ELIBBAD -+#define ELIBBAD ENOEXEC -+#endif -+ - #ifndef PATH_MAX - #define PATH_MAX 4096 - #endif ---- ntfs-3g-2016.2.22AR.1.orig/src/ntfs-3g_common.c.ref 2016-04-20 19:09:15.152385100 +0200 -+++ ntfs-3g-2016.2.22AR.1/src/ntfs-3g_common.c 2016-04-20 19:10:31.778302900 +0200 -@@ -47,6 +47,7 @@ - #include - #include - -+#include "compat.h" - #include "inode.h" - #include "dir.h" - #include "security.h" diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/0003-CVE-2017-0358.patch ntfs-3g-2016.2.22AR.2/debian/patches/0003-CVE-2017-0358.patch --- ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/0003-CVE-2017-0358.patch 2017-02-01 06:23:28.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/patches/0003-CVE-2017-0358.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ ---- ntfs-3g/src/lowntfs-3g.c.ref 2016-12-31 08:56:59.011749600 +0100 -+++ ntfs-3g/src/lowntfs-3g.c 2017-01-05 14:41:52.041473700 +0100 -@@ -4291,13 +4291,14 @@ - struct stat st; - pid_t pid; - const char *cmd = "/sbin/modprobe"; -+ char *env = (char*)NULL; - struct timespec req = { 0, 100000000 }; /* 100 msec */ - fuse_fstype fstype; - - if (!stat(cmd, &st) && !geteuid()) { - pid = fork(); - if (!pid) { -- execl(cmd, cmd, "fuse", NULL); -+ execle(cmd, cmd, "fuse", NULL, &env); - _exit(1); - } else if (pid != -1) - waitpid(pid, NULL, 0); ---- ntfs-3g/src/ntfs-3g.c.ref 2016-12-31 08:56:59.022518700 +0100 -+++ ntfs-3g/src/ntfs-3g.c 2017-01-05 15:45:45.912499400 +0100 -@@ -3885,13 +3885,14 @@ - struct stat st; - pid_t pid; - const char *cmd = "/sbin/modprobe"; -+ char *env = (char*)NULL; - struct timespec req = { 0, 100000000 }; /* 100 msec */ - fuse_fstype fstype; - - if (!stat(cmd, &st) && !geteuid()) { - pid = fork(); - if (!pid) { -- execl(cmd, cmd, "fuse", NULL); -+ execle(cmd, cmd, "fuse", NULL, &env); - _exit(1); - } else if (pid != -1) - waitpid(pid, NULL, 0); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/series ntfs-3g-2016.2.22AR.2/debian/patches/series --- ntfs-3g-2016.2.22AR.1+dfsg/debian/patches/series 2017-02-01 06:23:28.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/patches/series 2016-11-26 18:16:45.000000000 +0000 @@ -1,3 +1 @@ 0001-link-with-gpg-error.patch -0002-kFreeBSD_ELIBBAD.patch -0003-CVE-2017-0358.patch diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/README.source ntfs-3g-2016.2.22AR.2/debian/README.source --- ntfs-3g-2016.2.22AR.1+dfsg/debian/README.source 2017-02-26 12:34:31.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/README.source 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -The source is repacked to use a DFSG free ntfsprogs/boot.c file from -upstream 2016.2.22AR.2 version. diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/debian/watch ntfs-3g-2016.2.22AR.2/debian/watch --- ntfs-3g-2016.2.22AR.1+dfsg/debian/watch 2017-02-26 12:34:31.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/debian/watch 2014-07-30 21:24:43.000000000 +0000 @@ -1,3 +1,2 @@ version=3 -opts=dversionmangle=s/\+dfsg\d*$// \ http://www.tuxera.com/community/ntfs-3g-advanced/ .*#ntfs-3g_ntfsprogs-(.+)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/fedora/ntfs-3g.spec ntfs-3g-2016.2.22AR.2/fedora/ntfs-3g.spec --- ntfs-3g-2016.2.22AR.1+dfsg/fedora/ntfs-3g.spec 2016-04-01 06:38:04.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/fedora/ntfs-3g.spec 2016-10-01 06:42:17.000000000 +0000 @@ -15,7 +15,7 @@ Name: ntfs-3g Summary: Linux NTFS userspace driver -Version: 2016.2.22AR.1 +Version: 2016.2.22AR.2 Release: 1.fc23 License: GPLv2+ Group: System Environment/Base @@ -260,7 +260,7 @@ %exclude %{_mandir}/man8/ntfs-3g* %changelog -* Fri Apr 1 2016 Jean-Pierre Andre 2016.2.22AR.1 +* Sat Oct 1 2016 Jean-Pierre Andre 2016.2.22AR.2 - adapted to advanced ntfs-3g and basic ntfsprogs * Wed Jun 17 2015 Fedora Release Engineering - 2:2015.3.14-3 diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/fuse_common.h ntfs-3g-2016.2.22AR.2/include/fuse-lite/fuse_common.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/fuse_common.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/fuse-lite/fuse_common.h 2016-10-01 06:42:00.000000000 +0000 @@ -44,8 +44,10 @@ #ifdef POSIXACLS /* * FUSE_CAP_DONT_MASK: don't apply umask to file mode on create operations + * FUSE_CAP_POSIX_ACL: process Posix ACLs within the kernel */ #define FUSE_CAP_DONT_MASK (1 << 6) +#define FUSE_CAP_POSIX_ACL (1 << 18) #endif #define FUSE_CAP_BIG_WRITES (1 << 5) diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/fuse_kernel.h ntfs-3g-2016.2.22AR.2/include/fuse-lite/fuse_kernel.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/fuse_kernel.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/fuse-lite/fuse_kernel.h 2016-10-01 06:42:00.000000000 +0000 @@ -138,12 +138,14 @@ * FUSE_BIG_WRITES: allow big writes to be issued to the file system * FUSE_DONT_MASK: don't apply umask to file mode on create operations * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories + * FUSE_POSIX_ACL: kernel supports Posix ACLs */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) #define FUSE_BIG_WRITES (1 << 5) #define FUSE_DONT_MASK (1 << 6) #define FUSE_HAS_IOCTL_DIR (1 << 11) +#define FUSE_POSIX_ACL (1 << 19) /** * Release flags diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/Makefile.in ntfs-3g-2016.2.22AR.2/include/fuse-lite/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/include/fuse-lite/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/fuse-lite/Makefile.in 2016-10-01 06:42:15.000000000 +0000 @@ -171,6 +171,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/Makefile.in ntfs-3g-2016.2.22AR.2/include/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/include/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/Makefile.in 2016-10-01 06:42:15.000000000 +0000 @@ -210,6 +210,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/compat.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/compat.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/compat.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/compat.h 2016-10-01 06:42:00.000000000 +0000 @@ -37,6 +37,10 @@ #define ENODATA ENOENT #endif +#ifndef ELIBBAD +#define ELIBBAD ENOEXEC +#endif + #ifndef PATH_MAX #define PATH_MAX 4096 #endif diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/debug.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/debug.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/debug.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/debug.h 2016-10-01 06:42:00.000000000 +0000 @@ -36,12 +36,4 @@ static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} #endif -#define NTFS_BUG(msg) \ -{ \ - int ___i = 1; \ - ntfs_log_critical("Bug in %s(): %s\n", __FUNCTION__, msg); \ - ntfs_log_debug("Forcing segmentation fault!"); \ - ___i = ((int*)NULL)[___i]; \ -} - #endif /* defined _NTFS_DEBUG_H */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/index.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/index.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/index.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/index.h 2016-10-01 06:42:00.000000000 +0000 @@ -129,6 +129,7 @@ VCN parent_vcn[MAX_PARENT_VCN]; /* entry's parent nodes */ int pindex; /* maximum it's the number of the parent nodes */ BOOL ib_dirty; + BOOL bad_index; u32 block_size; u8 vcn_size_bits; } ntfs_index_context; diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/layout.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/layout.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/layout.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/layout.h 2016-10-01 06:42:00.000000000 +0000 @@ -161,6 +161,12 @@ #define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) ) +/* + * The size of a logical sector in bytes, used as the sequence number stride for + * multi-sector transfers. This is intended to be less than or equal to the + * physical sector size, since if this were greater than the physical sector + * size, then incomplete multi-sector transfers may not be detected. + */ #define NTFS_BLOCK_SIZE 512 #define NTFS_BLOCK_SIZE_BITS 9 @@ -515,16 +521,15 @@ * enum COLLATION_RULES - The collation rules for sorting views/indexes/etc * (32-bit). * - * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary - * Unicode values, except that when a character can be uppercased, the - * upper case value collates before the lower case one. - * COLLATION_FILE_NAME - Collate file names as Unicode strings. The collation - * is done very much like COLLATION_UNICODE_STRING. In fact I have no idea - * what the difference is. Perhaps the difference is that file names - * would treat some special characters in an odd way (see - * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] - * for what I mean but COLLATION_UNICODE_STRING would not give any special - * treatment to any characters at all, but this is speculation. + * COLLATION_BINARY - Collate by binary compare where the first byte is most + * significant. + * COLLATION_FILE_NAME - Collate Unicode strings by comparing their 16-bit + * coding units, primarily ignoring case using the volume's $UpCase table, + * but falling back to a case-sensitive comparison if the names are equal + * ignoring case. + * COLLATION_UNICODE_STRING - TODO: this is not yet implemented and still needs + * to be properly documented --- is it really the same as + * COLLATION_FILE_NAME? * COLLATION_NTOFS_ULONG - Sorting is done according to ascending le32 key * values. E.g. used for $SII index in FILE_Secure, which sorts by * security_id (le32). @@ -549,17 +554,9 @@ * equal then the second le32 values would be compared, etc. */ typedef enum { - COLLATION_BINARY = const_cpu_to_le32(0), /* Collate by binary - compare where the first byte is most - significant. */ - COLLATION_FILE_NAME = const_cpu_to_le32(1), /* Collate file names - as Unicode strings. */ - COLLATION_UNICODE_STRING = const_cpu_to_le32(2), /* Collate Unicode - strings by comparing their binary - Unicode values, except that when a - character can be uppercased, the upper - case value collates before the lower - case one. */ + COLLATION_BINARY = const_cpu_to_le32(0), + COLLATION_FILE_NAME = const_cpu_to_le32(1), + COLLATION_UNICODE_STRING = const_cpu_to_le32(2), COLLATION_NTOFS_ULONG = const_cpu_to_le32(16), COLLATION_NTOFS_SID = const_cpu_to_le32(17), COLLATION_NTOFS_SECURITY_HASH = const_cpu_to_le32(18), diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/Makefile.in ntfs-3g-2016.2.22AR.2/include/ntfs-3g/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/Makefile.in 2016-10-01 06:42:16.000000000 +0000 @@ -213,6 +213,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/param.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/param.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/param.h 2016-04-01 06:37:47.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/param.h 2016-10-01 06:42:01.000000000 +0000 @@ -107,6 +107,11 @@ * performances, but bad on security with internal fuse or external * fuse older than 2.8 * + * On Linux, cacheing is discouraged for the high level interface + * in order to get proper support of hard links. As a consequence, + * having access control in the file system leads to fewer requests + * to the file system and fewer context switches. + * * Possible values for high level : * 1 : no cache, kernel control (recommended) * 4 : no cache, file system control @@ -119,8 +124,9 @@ * 5 : no cache, file system control * 6 : kernel/fuse cache, file system control (OpenIndiana only) * 8 : no cache, kernel control for ACLs + * 9 : kernel/fuse cache, kernel control for ACLs (target) * - * Use of options 7 and 8 requires a patch to fuse + * Use of options 7, 8 and 9 requires a fuse module upgrade * When Posix ACLs are selected in the configure options, a value * of 6 is added in the mount report. */ @@ -139,7 +145,7 @@ * the fuse high level interface. */ #define HPERMSCONFIG 1 -#define LPERMSCONFIG 3 +#define LPERMSCONFIG 3 /* Use 9 when ACLs are supported by fuse kernel */ #endif /* defined(__sun) && defined(__SVR4) */ #endif /* defined _NTFS_PARAM_H */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/plugin.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/plugin.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/plugin.h 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/plugin.h 2016-10-01 06:42:00.000000000 +0000 @@ -27,10 +27,14 @@ * add support for processing some type of reparse points. */ -#ifndef PLUGIN_H -#define PLUGIN_H +#ifndef _NTFS_PLUGIN_H +#define _NTFS_PLUGIN_H + +#include "inode.h" +#include "layout.h" struct fuse_file_info; +struct stat; /* * The plugin operations currently defined. @@ -134,4 +138,4 @@ typedef const struct plugin_operations *(*plugin_init_t)(le32 tag); const struct plugin_operations *init(le32 tag); -#endif /* PLUGIN_H */ +#endif /* _NTFS_PLUGIN_H */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/reparse.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/reparse.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/reparse.h 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/reparse.h 2016-10-01 06:42:00.000000000 +0000 @@ -24,8 +24,8 @@ #ifndef REPARSE_H #define REPARSE_H -char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point, - int *pattr_size); +char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point); + BOOL ntfs_possible_symlink(ntfs_inode *ni); int ntfs_get_ntfs_reparse_data(ntfs_inode *ni, char *value, size_t size); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/security.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/security.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/security.h 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/security.h 2016-10-01 06:42:00.000000000 +0000 @@ -256,7 +256,9 @@ le32 ntfs_inherited_id(struct SECURITY_CONTEXT *scx, ntfs_inode *dir_ni, BOOL fordir); int ntfs_open_secure(ntfs_volume *vol); -void ntfs_close_secure(struct SECURITY_CONTEXT *scx); +int ntfs_close_secure(ntfs_volume *vol); + +void ntfs_destroy_security_context(struct SECURITY_CONTEXT *scx); #if POSIXACLS diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/unistr.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/unistr.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/unistr.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/unistr.h 2016-10-01 06:42:00.000000000 +0000 @@ -50,9 +50,6 @@ extern void ntfs_name_locase(ntfschar *name, u32 name_len, const ntfschar *locase, const u32 locase_len); -extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, - const ntfschar *upcase, const u32 upcase_len); - extern int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, int outs_len); extern int ntfs_mbstoucs(const char *ins, ntfschar **outs); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/xattrs.h ntfs-3g-2016.2.22AR.2/include/ntfs-3g/xattrs.h --- ntfs-3g-2016.2.22AR.1+dfsg/include/ntfs-3g/xattrs.h 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/include/ntfs-3g/xattrs.h 2016-10-01 06:42:00.000000000 +0000 @@ -19,8 +19,27 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _NTFS_XATTR_H_ -#define _NTFS_XATTR_H_ +#ifndef _NTFS_XATTRS_H_ +#define _NTFS_XATTRS_H_ + +/* + * Flags that modify setxattr() semantics. These flags are also used by a + * number of libntfs-3g functions, such as ntfs_set_ntfs_acl(), which were + * originally tied to extended attributes support but now can be used by + * applications even if the platform does not support extended attributes. + * + * Careful: applications including this header should define HAVE_SETXATTR or + * HAVE_SYS_XATTR_H if the platform supports extended attributes. Otherwise the + * defined flags values may be incorrect (they will be correct for Linux but not + * necessarily for other platforms). + */ +#if defined(HAVE_SETXATTR) || defined(HAVE_SYS_XATTR_H) +#include +#else +#include "compat.h" /* may be needed for ENODATA definition */ +#define XATTR_CREATE 1 +#define XATTR_REPLACE 2 +#endif /* * Identification of data mapped to the system name space @@ -61,6 +80,8 @@ enum SYSTEMXATTRS ntfs_xattr_system_type(const char *name, ntfs_volume *vol); +struct SECURITY_CONTEXT; + int ntfs_xattr_system_getxattr(struct SECURITY_CONTEXT *scx, enum SYSTEMXATTRS attr, ntfs_inode *ni, ntfs_inode *dir_ni, @@ -73,4 +94,4 @@ enum SYSTEMXATTRS attr, ntfs_inode *ni, ntfs_inode *dir_ni); -#endif /* _NTFS_XATTR_H_ */ +#endif /* _NTFS_XATTRS_H_ */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fuse.c ntfs-3g-2016.2.22AR.2/libfuse-lite/fuse.c --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fuse.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/fuse.c 2016-10-01 06:42:00.000000000 +0000 @@ -1281,8 +1281,15 @@ { if (!err) { struct fuse *f = req_fuse(req); +#ifdef __SOLARIS__ + /* Skip forget for negative result */ + if ((fuse_reply_entry(req, e) == -ENOENT) + && (e->ino != 0)) + forget_node(f, e->ino, 1); +#else /* __SOLARIS__ */ if (fuse_reply_entry(req, e) == -ENOENT) forget_node(f, e->ino, 1); +#endif } else reply_err(req, err); } @@ -2081,9 +2088,7 @@ } } else { reply_err(req, err); -#ifndef __SOLARIS__ pthread_mutex_destroy(&dh->lock); -#endif /* ! __SOLARIS__ */ free(dh); } free(path); @@ -2901,7 +2906,7 @@ " -o direct_io use direct I/O\n" " -o kernel_cache cache files in kernel\n" #ifdef __SOLARIS__ -" -o [no]auto_cache enable caching based on modification times\n" +" -o [no]auto_cache enable caching based on modification times (off)\n" #endif /* __SOLARIS__ */ " -o umask=M set file permissions (octal)\n" " -o uid=N set file owner\n" diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fuse_lowlevel.c ntfs-3g-2016.2.22AR.2/libfuse-lite/fuse_lowlevel.c --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fuse_lowlevel.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/fuse_lowlevel.c 2016-10-01 06:42:00.000000000 +0000 @@ -22,6 +22,16 @@ #include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef MAJOR_IN_MKDEV +#include +#endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif + #define PARAM(inarg) (((const char *)(inarg)) + sizeof(*(inarg))) #define OFFSET_MAX 0x7fffffffffffffffLL @@ -561,10 +571,13 @@ if (req->f->op.mknod) { #if defined(__SOLARIS__) && defined(_LP64) - /* Must unpack the device, as arg->rdev is limited to 32 bits */ + /* + * Must unpack the device, as arg->rdev is limited to 32 bits, + * and must have the same format in 32-bit and 64-bit builds. + */ req->f->op.mknod(req, nodeid, name, arg->mode, - makedev((arg->rdev >> 18) & 0x3ffff, - arg->rdev & 0x3fff)); + makedev((arg->rdev >> 18) & 0x3fff, + arg->rdev & 0x3ffff)); #else req->f->op.mknod(req, nodeid, name, arg->mode, arg->rdev); #endif @@ -1090,6 +1103,8 @@ #ifdef POSIXACLS if (arg->flags & FUSE_DONT_MASK) f->conn.capable |= FUSE_CAP_DONT_MASK; + if (arg->flags & FUSE_POSIX_ACL) + f->conn.capable |= FUSE_CAP_POSIX_ACL; #endif if (arg->flags & FUSE_BIG_WRITES) f->conn.capable |= FUSE_CAP_BIG_WRITES; @@ -1130,6 +1145,8 @@ #ifdef POSIXACLS if (f->conn.want & FUSE_CAP_DONT_MASK) outarg.flags |= FUSE_DONT_MASK; + if (f->conn.want & FUSE_CAP_POSIX_ACL) + outarg.flags |= FUSE_POSIX_ACL; #endif } else { /* Never use a version more recent than supported by the kernel */ @@ -1144,6 +1161,8 @@ #ifdef POSIXACLS if (f->conn.want & FUSE_CAP_DONT_MASK) outarg.flags |= FUSE_DONT_MASK; + if (f->conn.want & FUSE_CAP_POSIX_ACL) + outarg.flags |= FUSE_POSIX_ACL; #endif } } diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fusermount.c ntfs-3g-2016.2.22AR.2/libfuse-lite/fusermount.c --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/fusermount.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/fusermount.c 2016-10-01 06:42:00.000000000 +0000 @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef __SOLARIS__ #include diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/Makefile.in ntfs-3g-2016.2.22AR.2/libfuse-lite/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/Makefile.in 2016-10-01 06:42:16.000000000 +0000 @@ -212,6 +212,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/mount.c ntfs-3g-2016.2.22AR.2/libfuse-lite/mount.c --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/mount.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/mount.c 2016-10-01 06:42:00.000000000 +0000 @@ -380,10 +380,13 @@ then the filesystem is already unmounted */ if (res == 1 && (pfd.revents & POLLERR)) return; + /* + * Need to close file descriptor, otherwise synchronous umount + * would recurse into filesystem, and deadlock. + */ + close(fd); } #ifndef __SOLARIS__ - close(fd); - fusermount(1, 0, 1, "", mountpoint); #else /* __SOLARIS__ */ if (geteuid() == 0) { diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/mount_util.c ntfs-3g-2016.2.22AR.2/libfuse-lite/mount_util.c --- ntfs-3g-2016.2.22AR.1+dfsg/libfuse-lite/mount_util.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libfuse-lite/mount_util.c 2016-10-01 06:42:00.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #ifdef __SOLARIS__ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/acls.c ntfs-3g-2016.2.22AR.2/libntfs-3g/acls.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/acls.c 2016-04-01 06:37:46.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/acls.c 2016-10-01 06:42:00.000000000 +0000 @@ -4,7 +4,7 @@ * This module is part of ntfs-3g library, but may also be * integrated in tools running over Linux or Windows * - * Copyright (c) 2007-2015 Jean-Pierre Andre + * Copyright (c) 2007-2016 Jean-Pierre Andre * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -546,6 +546,7 @@ unsigned int acecnt; unsigned int acesz; unsigned int nace; + unsigned int wantsz; BOOL ok; ok = TRUE; @@ -560,9 +561,16 @@ &((const char*)pacl)[offace]; acesz = le16_to_cpu(pace->size); if (((offace + acesz) > end) - || !ntfs_valid_sid(&pace->sid) - || ((ntfs_sid_size(&pace->sid) + 8) != (int)acesz)) + || !ntfs_valid_sid(&pace->sid)) ok = FALSE; + else { + /* Win10 may insert garbage in the last ACE */ + wantsz = ntfs_sid_size(&pace->sid) + 8; + if (((nace < (acecnt - 1)) + && (wantsz != acesz)) + || (wantsz > acesz)) + ok = FALSE; + } offace += acesz; } } diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/attrib.c ntfs-3g-2016.2.22AR.2/libntfs-3g/attrib.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/attrib.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/attrib.c 2016-10-01 06:42:00.000000000 +0000 @@ -2215,7 +2215,7 @@ } else written = ntfs_pwrite(vol->dev, wpos, to_write, b); - } + } } else written = to_write; /* If everything ok, update progress counters and continue. */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/dir.c ntfs-3g-2016.2.22AR.2/libntfs-3g/dir.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/dir.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/dir.c 2016-10-01 06:42:00.000000000 +0000 @@ -40,7 +40,13 @@ #include #endif -#ifdef HAVE_SYS_SYSMACROS_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef MAJOR_IN_MKDEV +#include +#endif +#ifdef MAJOR_IN_SYSMACROS #include #endif @@ -61,10 +67,7 @@ #include "security.h" #include "reparse.h" #include "object_id.h" - -#ifdef HAVE_SETXATTR -#include -#endif +#include "xattrs.h" /* * The little endian Unicode strings "$I30", "$SII", "$SDH", "$O" @@ -1898,20 +1901,23 @@ if (!actx) goto err_out; search: - while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE, - 0, NULL, 0, actx)) { + while (!(err = ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, + CASE_SENSITIVE, 0, NULL, 0, actx))) { + #ifdef DEBUG char *s; + #endif IGNORE_CASE_BOOL case_sensitive = IGNORE_CASE; - errno = 0; fn = (FILE_NAME_ATTR*)((u8*)actx->attr + le16_to_cpu(actx->attr->value_offset)); + #ifdef DEBUG s = ntfs_attr_name_get(fn->file_name, fn->file_name_length); ntfs_log_trace("name: '%s' type: %d dos: %d win32: %d " "case: %d\n", s, fn->file_name_type, looking_for_dos_name, looking_for_win32_name, case_sensitive_match); ntfs_attr_name_free(&s); + #endif if (looking_for_dos_name) { if (fn->file_name_type == FILE_NAME_DOS) break; @@ -1952,7 +1958,7 @@ break; } } - if (errno) { + if (err) { /* * If case sensitive search failed, then try once again * ignoring case. @@ -2274,8 +2280,6 @@ return (dir_ni); } -#ifdef HAVE_SETXATTR - #define MAX_DOS_NAME_LENGTH 12 /* @@ -2424,11 +2428,11 @@ */ ntfs_name_upcase(dosname, doslen, ni->vol->upcase, ni->vol->upcase_len); - if (ntfs_ucstombs(dosname, doslen, &outname, size) < 0) { + outsize = ntfs_ucstombs(dosname, doslen, &outname, 0); + if (outsize < 0) { ntfs_log_error("Cannot represent dosname in current locale.\n"); outsize = -errno; } else { - outsize = strlen(outname); if (value && (outsize <= (int)size)) memcpy(value, outname, outsize); else @@ -2784,5 +2788,3 @@ } return (res); } - -#endif diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/ea.c ntfs-3g-2016.2.22AR.2/libntfs-3g/ea.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/ea.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/ea.c 2016-10-01 06:42:00.000000000 +0000 @@ -25,8 +25,6 @@ #include "config.h" #endif -#ifdef HAVE_SETXATTR /* extended attributes support required */ - #ifdef HAVE_STDIO_H #include #endif @@ -46,10 +44,6 @@ #include #endif -#ifdef HAVE_SETXATTR -#include -#endif - #include "types.h" #include "param.h" #include "layout.h" @@ -59,6 +53,7 @@ #include "ea.h" #include "misc.h" #include "logging.h" +#include "xattrs.h" /* * Create a needed attribute (EA or EA_INFORMATION) @@ -398,5 +393,3 @@ } return (res ? -1 : 0); } - -#endif /* HAVE_SETXATTR */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/efs.c ntfs-3g-2016.2.22AR.2/libntfs-3g/efs.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/efs.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/efs.c 2016-10-01 06:42:00.000000000 +0000 @@ -39,10 +39,6 @@ #include #endif -#ifdef HAVE_SETXATTR -#include -#endif - #ifdef HAVE_SYS_SYSMACROS_H #include #endif @@ -57,8 +53,7 @@ #include "logging.h" #include "misc.h" #include "efs.h" - -#ifdef HAVE_SETXATTR /* extended attributes interface required */ +#include "xattrs.h" static ntfschar logged_utility_stream_name[] = { const_cpu_to_le16('$'), @@ -433,5 +428,3 @@ ntfs_attr_put_search_ctx(ctx); return (-1); } - -#endif /* HAVE_SETXATTR */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/index.c ntfs-3g-2016.2.22AR.2/libntfs-3g/index.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/index.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/index.c 2016-10-01 06:42:00.000000000 +0000 @@ -143,7 +143,7 @@ { ntfs_log_trace("Entering\n"); - if (!icx->entry) + if (!icx->bad_index && !icx->entry) return; if (icx->actx) @@ -719,7 +719,7 @@ ret = ntfs_ie_lookup(key, key_len, icx, &ir->index, &vcn, &ie); if (ret == STATUS_ERROR) { err = errno; - goto err_out; + goto err_lookup; } icx->ir = ir; @@ -780,6 +780,8 @@ goto descend_into_child_node; err_out: + icx->bad_index = TRUE; /* Force icx->* to be freed */ +err_lookup: free(ib); if (!err) err = EIO; diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/inode.c ntfs-3g-2016.2.22AR.2/libntfs-3g/inode.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/inode.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/inode.c 2016-10-01 06:42:00.000000000 +0000 @@ -36,9 +36,6 @@ #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_SETXATTR -#include -#endif #include "param.h" #include "compat.h" @@ -57,6 +54,7 @@ #include "ntfstime.h" #include "logging.h" #include "misc.h" +#include "xattrs.h" ntfs_inode *ntfs_inode_base(ntfs_inode *ni) { @@ -1446,8 +1444,6 @@ return ret; } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ - /* * Get high precision NTFS times * @@ -1604,5 +1600,3 @@ errno = EEXIST; return (ret); } - -#endif /* HAVE_SETXATTR */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/ioctl.c ntfs-3g-2016.2.22AR.2/libntfs-3g/ioctl.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/ioctl.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/ioctl.c 2016-10-01 06:42:00.000000000 +0000 @@ -49,14 +49,15 @@ #include #endif #include - -#ifdef HAVE_SETXATTR -#include -#endif - #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef MAJOR_IN_MKDEV +#include +#endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #ifdef HAVE_SYS_STAT_H #include diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/Makefile.in ntfs-3g-2016.2.22AR.2/libntfs-3g/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/Makefile.in 2016-10-01 06:42:16.000000000 +0000 @@ -264,6 +264,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/mft.c ntfs-3g-2016.2.22AR.2/libntfs-3g/mft.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/mft.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/mft.c 2016-10-01 06:42:00.000000000 +0000 @@ -1276,8 +1276,10 @@ /* Sanity checks. */ if (mft_na->data_size > mft_na->allocated_size || - mft_na->initialized_size > mft_na->data_size) - NTFS_BUG("mft_na sanity checks failed"); + mft_na->initialized_size > mft_na->data_size) { + ntfs_log_critical("mft_na sanity checks failed"); + goto undo_data_init; + } /* Sync MFT to minimize data loss if there won't be clean unmount. */ if (ntfs_inode_sync(mft_na->ni)) @@ -1343,8 +1345,10 @@ /* Sanity checks. */ if (mft_na->data_size > mft_na->allocated_size || - mft_na->initialized_size > mft_na->data_size) - NTFS_BUG("mft_na sanity checks failed"); + mft_na->initialized_size > mft_na->data_size) { + ntfs_log_critical("mft_na sanity checks failed"); + goto undo_data_init; + } out: ntfs_log_leave("\n"); return ret; diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/mst.c ntfs-3g-2016.2.22AR.2/libntfs-3g/mst.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/mst.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/mst.c 2016-10-01 06:42:00.000000000 +0000 @@ -31,6 +31,21 @@ #include "mst.h" #include "logging.h" +/* + * Basic validation of a NTFS multi-sector record. The record size must be a + * multiple of the logical sector size; and the update sequence array must be + * properly aligned, of the expected length, and must end before the last le16 + * in the first logical sector. + */ +static BOOL +is_valid_record(u32 size, u16 usa_ofs, u16 usa_count) +{ + return size % NTFS_BLOCK_SIZE == 0 && + usa_ofs % 2 == 0 && + usa_count == 1 + (size / NTFS_BLOCK_SIZE) && + usa_ofs + ((u32)usa_count * 2) <= NTFS_BLOCK_SIZE - 2; +} + /** * ntfs_mst_post_read_fixup - deprotect multi sector transfer protected data * @b: pointer to the data to deprotect @@ -57,12 +72,9 @@ /* Setup the variables. */ usa_ofs = le16_to_cpu(b->usa_ofs); - /* Decrement usa_count to get number of fixups. */ - usa_count = le16_to_cpu(b->usa_count) - 1; - /* Size and alignment checks. */ - if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 || - (u32)(usa_ofs + (usa_count * 2)) > size || - (size >> NTFS_BLOCK_SIZE_BITS) != usa_count) { + usa_count = le16_to_cpu(b->usa_count); + + if (!is_valid_record(size, usa_ofs, usa_count)) { errno = EINVAL; if (warn) { ntfs_log_perror("%s: magic: 0x%08lx size: %ld " @@ -91,7 +103,7 @@ /* * Check for incomplete multi sector transfer(s). */ - while (usa_count--) { + while (--usa_count) { if (*data_pos != usn) { /* * Incomplete multi sector transfer detected! )-: @@ -109,10 +121,10 @@ data_pos += NTFS_BLOCK_SIZE/sizeof(u16); } /* Re-setup the variables. */ - usa_count = le16_to_cpu(b->usa_count) - 1; + usa_count = le16_to_cpu(b->usa_count); data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* Fixup all sectors. */ - while (usa_count--) { + while (--usa_count) { /* * Increment position in usa and restore original data from * the usa into the data buffer. @@ -171,12 +183,9 @@ } /* Setup the variables. */ usa_ofs = le16_to_cpu(b->usa_ofs); - /* Decrement usa_count to get number of fixups. */ - usa_count = le16_to_cpu(b->usa_count) - 1; - /* Size and alignment checks. */ - if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 || - (u32)(usa_ofs + (usa_count * 2)) > size || - (size >> NTFS_BLOCK_SIZE_BITS) != usa_count) { + usa_count = le16_to_cpu(b->usa_count); + + if (!is_valid_record(size, usa_ofs, usa_count)) { errno = EINVAL; ntfs_log_perror("%s", __FUNCTION__); return -1; @@ -195,7 +204,7 @@ /* Position in data of first le16 that needs fixing up. */ data_pos = (le16*)b + NTFS_BLOCK_SIZE/sizeof(le16) - 1; /* Fixup all sectors. */ - while (usa_count--) { + while (--usa_count) { /* * Increment the position in the usa and save the * original data from the data buffer into the usa. @@ -223,7 +232,7 @@ u16 *usa_pos, *data_pos; u16 usa_ofs = le16_to_cpu(b->usa_ofs); - u16 usa_count = le16_to_cpu(b->usa_count) - 1; + u16 usa_count = le16_to_cpu(b->usa_count); ntfs_log_trace("Entering\n"); @@ -234,7 +243,7 @@ data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* Fixup all sectors. */ - while (usa_count--) { + while (--usa_count) { /* * Increment position in usa and restore original data from * the usa into the data buffer. diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/object_id.c ntfs-3g-2016.2.22AR.2/libntfs-3g/object_id.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/object_id.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/object_id.c 2016-10-01 06:42:00.000000000 +0000 @@ -37,11 +37,6 @@ #ifdef HAVE_SYS_STAT_H #include #endif - -#ifdef HAVE_SETXATTR -#include -#endif - #ifdef HAVE_SYS_SYSMACROS_H #include #endif @@ -59,6 +54,7 @@ #include "object_id.h" #include "logging.h" #include "misc.h" +#include "xattrs.h" /* * Endianness considerations @@ -130,7 +126,6 @@ static ntfschar objid_index_name[] = { const_cpu_to_le16('$'), const_cpu_to_le16('O') }; -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Set the index for a new object id @@ -176,8 +171,6 @@ return (ntfs_ie_add(xo,(INDEX_ENTRY*)&indx)); } -#endif /* HAVE_SETXATTR */ - /* * Open the $Extend/$ObjId file and its index * @@ -213,7 +206,6 @@ return (xo); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Merge object_id data stored in the index into @@ -263,7 +255,6 @@ return (res); } -#endif /* HAVE_SETXATTR */ /* * Remove an object id index entry if attribute present @@ -311,7 +302,6 @@ return (ret); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Update the object id and index @@ -417,7 +407,6 @@ return (res); } -#endif /* HAVE_SETXATTR */ /* * Delete an object_id index entry @@ -456,7 +445,6 @@ return (res); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Get the ntfs object id into an extended attribute @@ -636,5 +624,3 @@ } return (res ? -1 : 0); } - -#endif /* HAVE_SETXATTR */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/reparse.c ntfs-3g-2016.2.22AR.2/libntfs-3g/reparse.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/reparse.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/reparse.c 2016-10-01 06:42:00.000000000 +0000 @@ -37,11 +37,6 @@ #ifdef HAVE_SYS_STAT_H #include #endif - -#ifdef HAVE_SETXATTR -#include -#endif - #ifdef HAVE_SYS_SYSMACROS_H #include #endif @@ -60,6 +55,7 @@ #include "logging.h" #include "misc.h" #include "reparse.h" +#include "xattrs.h" struct MOUNT_POINT_REPARSE_DATA { /* reparse data for junctions */ le16 subst_name_offset; @@ -450,6 +446,11 @@ if (ok) { switch (reparse_attr->reparse_tag) { case IO_REPARSE_TAG_MOUNT_POINT : + if (size < sizeof(REPARSE_POINT) + + sizeof(struct MOUNT_POINT_REPARSE_DATA)) { + ok = FALSE; + break; + } mount_point_data = (const struct MOUNT_POINT_REPARSE_DATA*) reparse_attr->reparse_data; offs = le16_to_cpu(mount_point_data->subst_name_offset); @@ -462,6 +463,11 @@ ok = FALSE; break; case IO_REPARSE_TAG_SYMLINK : + if (size < sizeof(REPARSE_POINT) + + sizeof(struct SYMLINK_REPARSE_DATA)) { + ok = FALSE; + break; + } symlink_data = (const struct SYMLINK_REPARSE_DATA*) reparse_attr->reparse_data; offs = le16_to_cpu(symlink_data->subst_name_offset); @@ -718,8 +724,7 @@ * symbolic link or directory junction */ -char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point, - int *pattr_size) +char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point) { s64 attr_size = 0; char *target; @@ -814,7 +819,6 @@ } free(reparse_attr); } - *pattr_size = attr_size; if (bad) errno = EOPNOTSUPP; return (target); @@ -849,7 +853,6 @@ return (possible); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Set the index for new reparse data @@ -888,7 +891,6 @@ return (ntfs_ie_add(xr,(INDEX_ENTRY*)&indx)); } -#endif /* HAVE_SETXATTR */ /* * Remove a reparse data index entry if attribute present @@ -965,7 +967,6 @@ return (xr); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Update the reparse data and index @@ -1031,7 +1032,6 @@ return (res); } -#endif /* HAVE_SETXATTR */ /* * Delete a reparse index entry @@ -1070,7 +1070,6 @@ return (res); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Get the ntfs reparse data into an extended attribute @@ -1255,7 +1254,6 @@ return (res ? -1 : 0); } -#endif /* HAVE_SETXATTR */ /* * Get the reparse data into a buffer diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/security.c ntfs-3g-2016.2.22AR.2/libntfs-3g/security.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/security.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/security.c 2016-10-01 06:42:00.000000000 +0000 @@ -41,9 +41,6 @@ #ifdef HAVE_FCNTL_H #include #endif -#ifdef HAVE_SETXATTR -#include -#endif #ifdef HAVE_SYS_STAT_H #include #endif @@ -64,6 +61,7 @@ #include "acls.h" #include "cache.h" #include "misc.h" +#include "xattrs.h" /* * JPA NTFS constants or structs @@ -525,8 +523,7 @@ */ res = ntfs_attr_shrink_size(vol->secure_ni,STREAM_SDS, 4, offs - gap + ALIGN_SDS_BLOCK + fullsz); - } - else + } else errno = ENOSPC; free(fullattr); } else @@ -3063,7 +3060,6 @@ return (allowed); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ #if POSIXACLS @@ -3242,7 +3238,6 @@ return (res ? -1 : 0); } -#endif /* HAVE_SETXATTR */ /* * Set new permissions to a file @@ -4383,7 +4378,6 @@ return (!scx->mapping[MAPUSERS] || link_group_members(scx)); } -#ifdef HAVE_SETXATTR /* extended attributes interface required */ /* * Get the ntfs attribute into an extended attribute @@ -4469,58 +4463,83 @@ return (res ? -1 : 0); } -#endif /* HAVE_SETXATTR */ /* - * Open $Secure once for all - * returns zero if it succeeds - * non-zero if it fails. This is not an error (on NTFS v1.x) + * Open the volume's security descriptor index ($Secure) + * + * returns 0 if it succeeds + * -1 with errno set if it fails and the volume is NTFS v3.0+ */ - - int ntfs_open_secure(ntfs_volume *vol) { ntfs_inode *ni; - int res; + ntfs_index_context *sii; + ntfs_index_context *sdh; - res = -1; - vol->secure_ni = (ntfs_inode*)NULL; - vol->secure_xsii = (ntfs_index_context*)NULL; - vol->secure_xsdh = (ntfs_index_context*)NULL; - if (vol->major_ver >= 3) { - /* make sure this is a genuine $Secure inode 9 */ - ni = ntfs_pathname_to_inode(vol, NULL, "$Secure"); - if (ni && (ni->mft_no == 9)) { - vol->secure_reentry = 0; - vol->secure_xsii = ntfs_index_ctx_get(ni, - sii_stream, 4); - vol->secure_xsdh = ntfs_index_ctx_get(ni, - sdh_stream, 4); - if (ni && vol->secure_xsii && vol->secure_xsdh) { - vol->secure_ni = ni; - res = 0; - } - } + if (vol->secure_ni) /* Already open? */ + return 0; + + ni = ntfs_pathname_to_inode(vol, NULL, "$Secure"); + if (!ni) + goto err; + + if (ni->mft_no != FILE_Secure) { + ntfs_log_error("$Secure does not have expected inode number!"); + errno = EINVAL; + goto err_close_ni; } - return (res); + + /* Allocate the needed index contexts. */ + sii = ntfs_index_ctx_get(ni, sii_stream, 4); + if (!sii) + goto err_close_ni; + + sdh = ntfs_index_ctx_get(ni, sdh_stream, 4); + if (!sdh) + goto err_close_sii; + + vol->secure_xsdh = sdh; + vol->secure_xsii = sii; + vol->secure_ni = ni; + return 0; + +err_close_sii: + ntfs_index_ctx_put(sii); +err_close_ni: + ntfs_inode_close(ni); +err: + /* Failing on NTFS pre-v3.0 is expected. */ + if (vol->major_ver < 3) + return 0; + ntfs_log_perror("Failed to open $Secure"); + return -1; } /* - * Final cleaning - * Allocated memory is freed to facilitate the detection of memory leaks + * Close the volume's security descriptor index ($Secure) + * + * returns 0 if it succeeds + * -1 with errno set if it fails */ - -void ntfs_close_secure(struct SECURITY_CONTEXT *scx) +int ntfs_close_secure(ntfs_volume *vol) { - ntfs_volume *vol; + int res = 0; - vol = scx->vol; if (vol->secure_ni) { - ntfs_index_ctx_put(vol->secure_xsii); ntfs_index_ctx_put(vol->secure_xsdh); - ntfs_inode_close(vol->secure_ni); - + ntfs_index_ctx_put(vol->secure_xsii); + res = ntfs_inode_close(vol->secure_ni); + vol->secure_ni = NULL; } + return res; +} + +/* + * Destroy a security context + * Allocated memory is freed to facilitate the detection of memory leaks + */ +void ntfs_destroy_security_context(struct SECURITY_CONTEXT *scx) +{ ntfs_free_mapping(scx->mapping); free_caches(scx); } @@ -5339,7 +5358,6 @@ scx->vol->secure_flags = 0; /* accept no mapping and no $Secure */ ntfs_build_mapping(scx,(const char*)NULL,TRUE); - ntfs_open_secure(vol); } else { if (scapi) free(scapi); @@ -5371,7 +5389,7 @@ ok = FALSE; if (scapi && (scapi->magic == MAGIC_API) && scapi->security.vol) { vol = scapi->security.vol; - ntfs_close_secure(&scapi->security); + ntfs_destroy_security_context(&scapi->security); free(scapi); if (!ntfs_umount(vol, 0)) ok = TRUE; diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/unistr.c ntfs-3g-2016.2.22AR.2/libntfs-3g/unistr.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/unistr.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/unistr.c 2016-10-01 06:42:00.000000000 +0000 @@ -59,7 +59,11 @@ #include "logging.h" #include "misc.h" -#define NOREVBOM 0 /* JPA rejecting U+FFFE and U+FFFF, open to debate */ +#ifndef ALLOW_BROKEN_UNICODE +/* Erik allowing broken UTF-16 surrogate pairs and U+FFFE and U+FFFF by default, + * open to debate. */ +#define ALLOW_BROKEN_UNICODE 1 +#endif /* !defined(ALLOW_BROKEN_UNICODE) */ /* * IMPORTANT @@ -139,14 +143,24 @@ * @name1_len: length of first Unicode name to compare * @name2: second Unicode name to compare * @name2_len: length of second Unicode name to compare - * @ic: either CASE_SENSITIVE or IGNORE_CASE - * @upcase: upcase table (ignored if @ic is CASE_SENSITIVE) - * @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE) + * @ic: either CASE_SENSITIVE or IGNORE_CASE (see below) + * @upcase: upcase table + * @upcase_len: upcase table size + * + * If @ic is CASE_SENSITIVE, then the names are compared primarily ignoring + * case, but if the names are equal ignoring case, then they are compared + * case-sensitively. As an example, "abc" would collate before "BCD" (since + * "abc" and "BCD" differ ignoring case and 'A' < 'B') but after "ABC" (since + * "ABC" and "abc" are equal ignoring case and 'A' < 'a'). This matches the + * collation order of filenames as indexed in NTFS directories. * - * -1 if the first name collates before the second one, - * 0 if the names match, - * 1 if the second name collates before the first one, or + * If @ic is IGNORE_CASE, then the names are only compared case-insensitively + * and are considered to match if and only if they are equal ignoring case. * + * Returns: + * -1 if the first name collates before the second one, + * 0 if the names match, or + * 1 if the second name collates before the first one */ int ntfs_names_full_collate(const ntfschar *name1, const u32 name1_len, const ntfschar *name2, const u32 name2_len, @@ -158,7 +172,7 @@ u16 u1, u2; #ifdef DEBUG - if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) { + if (!name1 || !name2 || !upcase || !upcase_len) { ntfs_log_debug("ntfs_names_collate received NULL pointer!\n"); exit(1); } @@ -201,9 +215,9 @@ return 1; } else { do { - u1 = c1 = le16_to_cpu(*name1); + u1 = le16_to_cpu(*name1); name1++; - u2 = c2 = le16_to_cpu(*name2); + u2 = le16_to_cpu(*name2); name2++; if (u1 < upcase_len) u1 = le16_to_cpu(upcase[u1]); @@ -402,23 +416,6 @@ name[i] = locase[u]; } -/** - * ntfs_file_value_upcase - Convert a filename to upper case - * @file_name_attr: - * @upcase: - * @upcase_len: - * - * Description... - * - * Returns: - */ -void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, - const ntfschar *upcase, const u32 upcase_len) -{ - ntfs_name_upcase((ntfschar*)&file_name_attr->file_name, - file_name_attr->file_name_length, upcase, upcase_len); -} - /* NTFS uses Unicode (UTF-16LE [NTFS-3G uses UCS-2LE, which is enough for now]) for path names, but the Unicode code points need to be @@ -444,10 +441,15 @@ */ /* - * Return the amount of 8-bit elements in UTF-8 needed (without the terminating - * null) to store a given UTF-16LE string. + * Return the number of bytes in UTF-8 needed (without the terminating null) to + * store the given UTF-16LE string. * - * Return -1 with errno set if string has invalid byte sequence or too long. + * On error, -1 is returned, and errno is set to the error code. The following + * error codes can be expected: + * EILSEQ The input string is not valid UTF-16LE (only possible + * if compiled without ALLOW_BROKEN_UNICODE). + * ENAMETOOLONG The length of the UTF-8 string in bytes (without the + * terminating null) would exceed @outs_len. */ static int utf16_to_utf8_size(const ntfschar *ins, const int ins_len, int outs_len) { @@ -456,14 +458,28 @@ BOOL surrog; surrog = FALSE; - for (i = 0; i < ins_len && ins[i]; i++) { + for (i = 0; i < ins_len && ins[i] && count <= outs_len; i++) { unsigned short c = le16_to_cpu(ins[i]); if (surrog) { if ((c >= 0xdc00) && (c < 0xe000)) { surrog = FALSE; count += 4; - } else + } else { +#if ALLOW_BROKEN_UNICODE + /* The first UTF-16 unit of a surrogate pair has + * a value between 0xd800 and 0xdc00. It can be + * encoded as an individual UTF-8 sequence if we + * cannot combine it with the next UTF-16 unit + * unit as a surrogate pair. */ + surrog = FALSE; + count += 3; + + --i; + continue; +#else goto fail; +#endif /* ALLOW_BROKEN_UNICODE */ + } } else if (c < 0x80) count++; @@ -473,21 +489,30 @@ count += 3; else if (c < 0xdc00) surrog = TRUE; -#if NOREVBOM - else if ((c >= 0xe000) && (c < 0xfffe)) -#else +#if ALLOW_BROKEN_UNICODE + else if (c < 0xe000) + count += 3; else if (c >= 0xe000) -#endif +#else + else if ((c >= 0xe000) && (c < 0xfffe)) +#endif /* ALLOW_BROKEN_UNICODE */ count += 3; else goto fail; - if (count > outs_len) { - errno = ENAMETOOLONG; - goto out; - } } - if (surrog) + + if (surrog && count <= outs_len) { +#if ALLOW_BROKEN_UNICODE + count += 3; /* ending with a single surrogate */ +#else goto fail; +#endif /* ALLOW_BROKEN_UNICODE */ + } + + if (count > outs_len) { + errno = ENAMETOOLONG; + goto out; + } ret = count; out: @@ -502,7 +527,7 @@ * @ins: input utf16 string buffer * @ins_len: length of input string in utf16 characters * @outs: on return contains the (allocated) output multibyte string - * @outs_len: length of output buffer in bytes + * @outs_len: length of output buffer in bytes (ignored if *@outs is NULL) * * Return -1 with errno set if string has invalid byte sequence or too long. */ @@ -521,10 +546,16 @@ int halfpair; halfpair = 0; - if (!*outs) + if (!*outs) { + /* If no output buffer was provided, we will allocate one and + * limit its length to PATH_MAX. Note: we follow the standard + * convention of PATH_MAX including the terminating null. */ outs_len = PATH_MAX; + } - size = utf16_to_utf8_size(ins, ins_len, outs_len); + /* The size *with* the terminating null is limited to @outs_len, + * so the size *without* the terminating null is limited to one less. */ + size = utf16_to_utf8_size(ins, ins_len, outs_len - 1); if (size < 0) goto out; @@ -548,8 +579,24 @@ *t++ = 0x80 + ((c >> 6) & 15) + ((halfpair & 3) << 4); *t++ = 0x80 + (c & 63); halfpair = 0; - } else + } else { +#if ALLOW_BROKEN_UNICODE + /* The first UTF-16 unit of a surrogate pair has + * a value between 0xd800 and 0xdc00. It can be + * encoded as an individual UTF-8 sequence if we + * cannot combine it with the next UTF-16 unit + * unit as a surrogate pair. */ + *t++ = 0xe0 | (halfpair >> 12); + *t++ = 0x80 | ((halfpair >> 6) & 0x3f); + *t++ = 0x80 | (halfpair & 0x3f); + halfpair = 0; + + --i; + continue; +#else goto fail; +#endif /* ALLOW_BROKEN_UNICODE */ + } } else if (c < 0x80) { *t++ = c; } else { @@ -562,6 +609,13 @@ *t++ = 0x80 | (c & 0x3f); } else if (c < 0xdc00) halfpair = c; +#if ALLOW_BROKEN_UNICODE + else if (c < 0xe000) { + *t++ = 0xe0 | (c >> 12); + *t++ = 0x80 | ((c >> 6) & 0x3f); + *t++ = 0x80 | (c & 0x3f); + } +#endif /* ALLOW_BROKEN_UNICODE */ else if (c >= 0xe000) { *t++ = 0xe0 | (c >> 12); *t++ = 0x80 | ((c >> 6) & 0x3f); @@ -570,6 +624,13 @@ goto fail; } } +#if ALLOW_BROKEN_UNICODE + if (halfpair) { /* ending with a single surrogate */ + *t++ = 0xe0 | (halfpair >> 12); + *t++ = 0x80 | ((halfpair >> 6) & 0x3f); + *t++ = 0x80 | (halfpair & 0x3f); + } +#endif /* ALLOW_BROKEN_UNICODE */ *t = '\0'; #if defined(__APPLE__) || defined(__DARWIN__) @@ -691,15 +752,16 @@ | ((u32)(s[1] & 0x3F) << 6) | ((u32)(s[2] & 0x3F)); /* Check valid ranges */ -#if NOREVBOM +#if ALLOW_BROKEN_UNICODE if (((*wc >= 0x800) && (*wc <= 0xD7FF)) - || ((*wc >= 0xe000) && (*wc <= 0xFFFD))) + || ((*wc >= 0xD800) && (*wc <= 0xDFFF)) + || ((*wc >= 0xe000) && (*wc <= 0xFFFF))) return 3; #else if (((*wc >= 0x800) && (*wc <= 0xD7FF)) - || ((*wc >= 0xe000) && (*wc <= 0xFFFF))) + || ((*wc >= 0xe000) && (*wc <= 0xFFFD))) return 3; -#endif +#endif /* ALLOW_BROKEN_UNICODE */ } goto fail; /* four-byte */ @@ -804,7 +866,7 @@ * @ins: input Unicode string buffer * @ins_len: length of input string in Unicode characters * @outs: on return contains the (allocated) output multibyte string - * @outs_len: length of output buffer in bytes + * @outs_len: length of output buffer in bytes (ignored if *@outs is NULL) * * Convert the input little endian, 2-byte Unicode string @ins, of length * @ins_len into the multibyte string format dictated by the current locale. @@ -1236,7 +1298,8 @@ { 0x3c2, 0x3c2, 0x0, 2, 6, 1 }, { 0x3d7, 0x3d7, -0x8, 2, 6, 1 }, { 0x515, 0x523, -0x1, 2, 6, 1 }, - { 0x1d79, 0x1d79, 0x8a04, 2, 6, 1 }, + /* below, -0x75fc stands for 0x8a04 and truncation */ + { 0x1d79, 0x1d79, -0x75fc, 2, 6, 1 }, { 0x1efb, 0x1eff, -0x1, 2, 6, 1 }, { 0x1fc3, 0x1ff3, 0x9, 48, 6, 1 }, { 0x1fcc, 0x1ffc, 0x0, 48, 6, 1 }, diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/volume.c ntfs-3g-2016.2.22AR.2/libntfs-3g/volume.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/volume.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/volume.c 2016-10-01 06:42:00.000000000 +0000 @@ -74,6 +74,7 @@ #include "cache.h" #include "realpath.h" #include "misc.h" +#include "security.h" const char *ntfs_home = "News, support and information: http://tuxera.com\n"; @@ -172,6 +173,9 @@ { int err = 0; + if (ntfs_close_secure(v)) + ntfs_error_set(&err); + if (ntfs_inode_free(&v->vol_ni)) ntfs_error_set(&err); /* @@ -1234,6 +1238,11 @@ ntfs_log_perror("Failed to close $AttrDef"); goto error_exit; } + + /* Open $Secure. */ + if (ntfs_open_secure(vol)) + goto error_exit; + /* * Check for dirty logfile and hibernated Windows. * We care only about read-write mounts. diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/xattrs.c ntfs-3g-2016.2.22AR.2/libntfs-3g/xattrs.c --- ntfs-3g-2016.2.22AR.1+dfsg/libntfs-3g/xattrs.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/libntfs-3g/xattrs.c 2016-10-01 06:42:00.000000000 +0000 @@ -23,8 +23,6 @@ #include "config.h" #endif -#ifdef HAVE_SETXATTR /* extended attributes support required */ - #ifdef HAVE_STDIO_H #include #endif @@ -83,10 +81,6 @@ #endif #endif -static const char xattr_ntfs_3g[] = "ntfs-3g."; -static const char nf_ns_user_prefix[] = "user."; -static const int nf_ns_user_prefix_len = sizeof(nf_ns_user_prefix) - 1; - static const char nf_ns_xattr_ntfs_acl[] = "system.ntfs_acl"; static const char nf_ns_xattr_attrib[] = "system.ntfs_attrib"; static const char nf_ns_xattr_attrib_be[] = "system.ntfs_attrib_be"; @@ -798,5 +792,3 @@ } return (res); } - -#endif /* HAVE_SETXATTR */ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/Makefile.in ntfs-3g-2016.2.22AR.2/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/Makefile.in 2016-04-01 06:38:02.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/Makefile.in 2016-10-01 06:42:15.000000000 +0000 @@ -264,6 +264,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/Makefile.in ntfs-3g-2016.2.22AR.2/ntfsprogs/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/Makefile.in 2016-04-01 06:38:03.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/Makefile.in 2016-10-01 06:42:16.000000000 +0000 @@ -500,6 +500,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfscmp.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfscmp.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfscmp.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfscmp.c 2016-10-01 06:42:00.000000000 +0000 @@ -547,7 +547,7 @@ /* * FIXME: ia can be the same even if the bitmap sizes are different. */ - if (cia1.bm_size != cia1.bm_size) + if (cia1.bm_size != cia2.bm_size) goto out; if (cmp_buffer(cia1.bitmap, cia2.bitmap, cia1.bm_size, na1)) diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsfix.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsfix.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsfix.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsfix.c 2016-10-01 06:42:00.000000000 +0000 @@ -341,6 +341,39 @@ return 0; } +/* + * Clear the sparse flag of an attribute + */ + +static int clear_sparse(ntfs_attr *na, const char *name) +{ + ntfs_attr_search_ctx *ctx; + int res; + + res = -1; + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (ctx) { + if (!ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + na->data_flags &= ~ATTR_IS_SPARSE; + ctx->attr->data_size = cpu_to_sle64(na->data_size); + ctx->attr->initialized_size + = cpu_to_sle64(na->initialized_size); + ctx->attr->flags = cpu_to_le16(na->data_flags); + ctx->attr->compression_unit = 0; + ntfs_inode_mark_dirty(ctx->ntfs_ino); + NInoFileNameSetDirty(na->ni); + res = 0; + } else + ntfs_log_perror("Could not locate attribute for %s", + name); + ntfs_attr_put_search_ctx(ctx); + } else + ntfs_log_perror("Could not get a search context for %s", + name); + return (res); +} + /** * Clear the bad cluster marks (option) */ @@ -372,15 +405,14 @@ * (which requires setting the data size according * to allocation), then reallocate a sparse stream * to full size of volume and reset the data size. + * Note : the sparse flags should not be set. */ na->data_size = na->allocated_size; na->initialized_size = na->allocated_size; if (!ntfs_attr_truncate(na,0) && !ntfs_attr_truncate(na,vol->nr_clusters << vol->cluster_size_bits)) { - na->data_size = 0; na->initialized_size = 0; - ni->flags |= FILE_ATTR_SPARSE_FILE; NInoFileNameSetDirty(ni); ok = TRUE; } else { @@ -390,6 +422,14 @@ ntfs_log_info("No bad clusters..."); ok = TRUE; } + /* + * The sparse flags are not set after an initial + * formatting, so do the same. + */ + if (ok) { + ni->flags &= ~FILE_ATTR_SPARSE_FILE; + ok = !clear_sparse(na, "$BadClus::$Bad"); + } ntfs_attr_close(na); } else { ntfs_log_perror("Failed to open $BadClus::$Bad"); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsinfo.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsinfo.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsinfo.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsinfo.c 2016-10-01 06:42:00.000000000 +0000 @@ -412,16 +412,23 @@ { const char *name; - if (tag == IO_REPARSE_TAG_MOUNT_POINT) + switch (tag) { + case IO_REPARSE_TAG_MOUNT_POINT : name = " (mount point)"; - else - if (tag == IO_REPARSE_TAG_SYMLINK) - name = " (symlink)"; - else - if (tag == IO_REPARSE_TAG_WOF) - name = " (Wof compressed)"; - else - name = ""; + break; + case IO_REPARSE_TAG_SYMLINK : + name = " (symlink)"; + break; + case IO_REPARSE_TAG_WOF : + name = " (Wof compressed)"; + break; + case IO_REPARSE_TAG_DEDUP : + name = " (deduplicated)"; + break; + default : + name = ""; + break; + } return (name); } diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfslabel.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfslabel.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfslabel.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfslabel.c 2016-10-01 06:42:00.000000000 +0000 @@ -299,8 +299,9 @@ serial_number = cpu_to_le64(sn); } if (!change_serial(vol, 0, serial_number, bs, oldbs)) { - number_of_sectors = sle64_to_cpu(bs->number_of_sectors); - if (!change_serial(vol, number_of_sectors, + number_of_sectors = ntfs_device_size_get(vol->dev, + vol->sector_size); + if (!change_serial(vol, number_of_sectors - 1, serial_number, bs, oldbs)) { ntfs_log_info("New serial number : %016llx\n", (long long)le64_to_cpu( diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsrecover.8.in ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsrecover.8.in --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsrecover.8.in 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsrecover.8.in 2016-10-01 06:42:00.000000000 +0000 @@ -86,6 +86,13 @@ \fB\-h\fR, \fB\-\-help\fR Show some help information. .TP +\fB\-k\fR, \fB\-\-kill\-fast\-restart\fR +When Windows has been interrupted with fast restart mode activated, +part of pending changes are kept in the Windows cache and only the same +Windows version can recover them. This option can be used to apply the +changes recorded in the log file and drop the ones in the Windows cache. +This is dangerous and may cause loss of data. +.TP \fB\-n\fR, \fB\-\-no-action\fR Do not apply any modification, useful when using the options -p, -s or -u. .TP diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsrecover.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsrecover.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsrecover.c 2016-04-01 06:37:46.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsrecover.c 2016-10-01 06:42:00.000000000 +0000 @@ -146,6 +146,7 @@ BOOL opth; /* show help */ BOOL opti; /* show invalid (stale) records */ BOOL optf; /* show full log */ +BOOL optk; /* kill fast restart */ BOOL optn; /* do not apply modifications */ BOOL optp; /* count of transaction sets to play */ BOOL optr; /* show a range of blocks */ @@ -2894,6 +2895,7 @@ { const struct BUFFER *buf; BOOL bad; + int major, minor; bad = FALSE; if (ctx->vol) { @@ -2943,13 +2945,22 @@ } if (!bad && !ctx->vol) dorest(ctx, 0, &buf->block.restart, TRUE); - if ((buf->block.restart.major_ver != const_cpu_to_le16(1)) - || (buf->block.restart.minor_ver != const_cpu_to_le16(1))) { - printf("** Unsupported $LogFile version %d.%d\n", - le16_to_cpu(buf->block.restart.major_ver), - le16_to_cpu(buf->block.restart.minor_ver)); - bad = TRUE; - } + major = le16_to_cpu(buf->block.restart.major_ver); + minor = le16_to_cpu(buf->block.restart.minor_ver); + if ((major == 2) && (minor == 0)) { + if (!optk) { + printf("** Fast restart mode detected," + " data could be lost\n"); + printf(" Use option --kill-fast-restart" + " to bypass\n"); + bad = TRUE; + } + } else + if ((major != 1) || (minor != 1)) { + printf("** Unsupported $LogFile version %d.%d\n", + major, minor); + bad = TRUE; + } if (bad) { buf = (const struct BUFFER*)NULL; } @@ -2974,6 +2985,9 @@ restart.client_in_use_list = LOGFILE_NO_CLIENT; restart.flags |= RESTART_VOLUME_IS_CLEAN; client.oldest_lsn = cpu_to_sle64(restart_lsn); + /* Set $LogFile version to 1.1 so that volume can be mounted */ + log_header.major_ver = const_cpu_to_le16(1); + log_header.minor_ver = const_cpu_to_le16(1); memcpy(buffer, &log_header, sizeof(RESTART_PAGE_HEADER)); off = le16_to_cpu(log_header.restart_area_offset); @@ -3113,12 +3127,31 @@ BOOL ok; u32 off; s64 size; + u32 system_page_size; + u32 log_page_size; ok = FALSE; fseek(ctx->file,0L,2); size = ftell(ctx->file); rph = (const RESTART_PAGE_HEADER*)boot; off = le16_to_cpu(rph->restart_area_offset); + /* + * If the system or log page sizes are smaller than the ntfs block size + * or either is not a power of 2 we cannot handle this log file. + */ + system_page_size = le32_to_cpu(rph->system_page_size); + log_page_size = le32_to_cpu(rph->log_page_size); + if (system_page_size < NTFS_BLOCK_SIZE || + log_page_size < NTFS_BLOCK_SIZE || + system_page_size & (system_page_size - 1) || + log_page_size & (log_page_size - 1)) { + printf("** Unsupported page size.\n"); + goto out; + } + if (off & 7 || off > system_page_size) { + printf("** Inconsistent restart area offset.\n"); + goto out; + } rest = (const RESTART_AREA*)&boot[off]; /* estimate cluster size from log file size (unreliable) */ @@ -3142,6 +3175,7 @@ mftrecsz = 0; mftrecbits = 0; ok = TRUE; +out: return (ok); } @@ -3172,8 +3206,9 @@ if (ctx->file && (!memcmp(boot,"RSTR",4) || !memcmp(boot,"CHKD",4))) { printf("* Assuming a log file copy\n"); - getlogfiledata(ctx, boot); - ok = TRUE; + ok = getlogfiledata(ctx, boot); + if (!ok) + goto out; } else fprintf(stderr,"** Not an NTFS image or log file\n"); } @@ -3187,6 +3222,7 @@ if (le16_to_cpu(rest->client_in_use_list) > 1) printf("** multiple clients not implemented\n"); } +out: return (ok); } @@ -3223,15 +3259,19 @@ /* This appears to be a log file */ ctx->vol = (ntfs_volume*)NULL; ok = getvolumedata(ctx, boot.buf); - } - if (!ok) + if (!ok) { + fclose(ctx->file); + goto out; + } + } else { fclose(ctx->file); + } } if (!ok) { /* Not a log file, assume an ntfs device, mount it */ ctx->file = (FILE*)NULL; ctx->vol = ntfs_mount(device_name, - ((optp || optu || opts) && !optn + ((optk || optp || optu || opts) && !optn ? NTFS_MNT_FORENSIC : NTFS_MNT_RDONLY)); if (ctx->vol) { ok = getvolumedata(ctx, boot.buf); @@ -3239,6 +3279,7 @@ ntfs_umount(ctx->vol, TRUE); } } +out: return (ok); } @@ -3849,6 +3890,7 @@ fprintf(stderr," -i : show invalid (stale) records\n"); fprintf(stderr," -f : show the full log forward\n"); fprintf(stderr," -h : show this help information\n"); + fprintf(stderr," -k : kill fast restart data\n"); fprintf(stderr," -n : do not apply any modification\n"); fprintf(stderr," -p : undo the latest count transaction sets and play one\n"); fprintf(stderr," -r : show a range of log blocks forward\n"); @@ -3870,12 +3912,13 @@ u32 xval; char *endptr; BOOL err; - static const char *sopt = "-bc:hifnp:r:stu:vVx:"; + static const char *sopt = "-bc:hifknp:r:stu:vVx:"; static const struct option lopt[] = { { "backward", no_argument, NULL, 'b' }, { "clusters", required_argument, NULL, 'c' }, { "forward", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "kill-fast-restart", no_argument, NULL, 'k' }, { "no-action", no_argument, NULL, 'n' }, { "play", required_argument, NULL, 'p' }, { "range", required_argument, NULL, 'r' }, @@ -3895,6 +3938,7 @@ optf = FALSE; opth = FALSE; opti = FALSE; + optk = FALSE; optn = FALSE; optp = FALSE; optr = FALSE; @@ -3937,6 +3981,9 @@ case 'h': opth = TRUE; break; + case 'k': + optk = TRUE; + break; case 'n': optn = TRUE; break; diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsresize.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsresize.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfsresize.c 2016-02-22 07:34:33.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfsresize.c 2016-10-01 06:42:00.000000000 +0000 @@ -2377,6 +2377,7 @@ { ntfs_inode *base_ni; ntfs_attr *na; + ntfs_attr_search_ctx *ctx; s64 nr_clusters = resize->new_volume_size; ntfs_volume *vol = resize->vol; @@ -2390,7 +2391,16 @@ err_printf("Could not adjust the bad sector list\n"); exit(1); } - na->ni->flags |= FILE_ATTR_SPARSE_FILE; + /* Clear the sparse flags, even if there are bad clusters */ + na->ni->flags &= ~FILE_ATTR_SPARSE_FILE; + na->data_flags &= ~ATTR_IS_SPARSE; + ctx = resize->ctx; + ctx->attr->data_size = cpu_to_sle64(na->data_size); + ctx->attr->initialized_size = cpu_to_sle64(na->initialized_size); + ctx->attr->flags = cpu_to_le16(na->data_flags); + ctx->attr->compression_unit = 0; + ntfs_inode_mark_dirty(ctx->ntfs_ino); + NInoFileNameSetDirty(na->ni); NInoFileNameSetDirty(na->ni); ntfs_attr_close(na); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfssecaudit.c ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfssecaudit.c --- ntfs-3g-2016.2.22AR.1+dfsg/ntfsprogs/ntfssecaudit.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/ntfsprogs/ntfssecaudit.c 2016-10-01 06:42:00.000000000 +0000 @@ -16,47 +16,47 @@ * -t run internal tests (with no access to storage) * * On Linux (being root, with volume not mounted) : - * secaudit -h [file] + * ntfssecaudit -h [file] * display the security descriptors found in file - * secaudit -a[rv] volume + * ntfssecaudit -a[rv] volume * audit the volume - * secaudit [-v] volume file + * ntfssecaudit [-v] volume file * display the security parameters of file - * secaudit -r[v] volume directory + * ntfssecaudit -r[v] volume directory * display the security parameters of files in directory - * secaudit -b[v] volume [directory] + * ntfssecaudit -b[v] volume [directory] * backup the security parameters of files in directory - * secaudit -s[ve] volume [backupfile] + * ntfssecaudit -s[ve] volume [backupfile] * set the security parameters as indicated in backup * with -e set extra parameters (Windows attrib) - * secaudit volume perms file + * ntfssecaudit volume perms file * set the security parameters of file to perms (mode or acl) - * secaudit -r[v] volume perms directory + * ntfssecaudit -r[v] volume perms directory * set the security parameters of files in directory to perms * special cases, do not require being root : - * secaudit [-v] mounted-file + * ntfssecaudit [-v] mounted-file * display the security parameters of mounted file - * secaudit -u[v] mounted-file + * ntfssecaudit -u[v] mounted-file * display a user mapping proposal * * * On Windows (the volume being part of file name) - * secaudit -h [file] + * ntfssecaudit -h [file] * display the security descriptors found in file - * secaudit -a[rv] volume + * ntfssecaudit -a[rv] volume * audit the volume - * secaudit [-v] file + * ntfssecaudit [-v] file * display the security parameters of file - * secaudit -r[v] directory + * ntfssecaudit -r[v] directory * display the security parameters of files in directory - * secaudit -b[v] directory + * ntfssecaudit -b[v] directory * backup the security parameters of files in directory - * secaudit -s[v] volume [backupfile] + * ntfssecaudit -s[v] volume [backupfile] * set the security parameters as indicated in backup * with -e set extra parameters (Windows attrib) - * secaudit perms file + * ntfssecaudit perms file * set the security parameters of file to perms (mode or acl) - * secaudit -r[v] perms directory + * ntfssecaudit -r[v] perms directory * set the security parameters of files in directory to perms */ @@ -583,7 +583,7 @@ ntfs_context = ntfs_initialize_file_security(volume, flags); if (ntfs_context) { if (*(u32*)ntfs_context != MAGIC_API) { - fprintf(stderr,"Versions of ntfs-3g and secaudit" + fprintf(stderr,"Versions of ntfs-3g and ntfssecaudit" " are not compatible\n"); } else { fprintf(stderr,"\"%s\" opened %s\n",volume, @@ -971,10 +971,12 @@ marker = ' '; cnt = attr[off+1] & 255; auth = get6h(attr,off+2); - first = get4l(attr,off+8); known = FALSE; + /* SID names taken from https://support.microsoft.com/en-us/kb/243330 */ if ((attr[off] == 1) /* revision */ - && (auth < 100)) + && cnt + && (auth < 100)) { + first = get4l(attr,off+8); switch (cnt) { case 0 : /* no level (error) */ break; @@ -1028,23 +1030,23 @@ break; case 7 : known = TRUE; - printf("%*cAnonymous logon SID\n",-level,marker); + printf("%*cAnonymous SID\n",-level,marker); break; case 11 : known = TRUE; - printf("%*cAuthenticated user SID\n",-level,marker); + printf("%*cAuthenticated Users SID\n",-level,marker); break; case 13 : known = TRUE; - printf("%*cLocal service SID\n",-level,marker); + printf("%*cTerminal Server Users SID\n",-level,marker); break; case 14 : known = TRUE; - printf("%*cNetwork service SID\n",-level,marker); + printf("%*cRemote Interactive Logon SID\n",-level,marker); break; case 18 : known = TRUE; - printf("%*cNT System SID\n",-level,marker); + printf("%*cLocal System SID\n",-level,marker); break; } break; @@ -1058,13 +1060,13 @@ known = TRUE; switch (second) { case 544 : - printf("%*cLocal admins SID\n",-level,marker); + printf("%*cAdministrators SID\n",-level,marker); break; case 545 : - printf("%*cLocal users SID\n",-level,marker); + printf("%*cUsers SID\n",-level,marker); break; case 546 : - printf("%*cLocal guests SID\n",-level,marker); + printf("%*cGuests SID\n",-level,marker); break; default : printf("%*cSome domain SID\n",-level,marker); @@ -1073,6 +1075,7 @@ } break; } + break; default : /* three levels or more */ second = get4l(attr,off+12); last = get4l(attr,off+4+4*cnt); @@ -1081,37 +1084,38 @@ if (first == 21) { known = TRUE; switch (last) { - case 500 : - printf("%*cSystem admin SID\n",-level,marker); - break; - case 501 : - printf("%*cGuest SID\n",-level,marker); - break; - case 512 : - printf("%*cLocal admins SID\n",-level,marker); - break; - case 513 : - printf("%*cLocal users SID\n",-level,marker); - break; - case 514 : - printf("%*cLocal guests SID\n",-level,marker); - break; - default : - printf("%*cLocal user-%lu SID\n",-level,marker,last); - break; + case 500 : + printf("%*cAdministrator SID\n",-level,marker); + break; + case 501 : + printf("%*cGuest SID\n",-level,marker); + break; + case 512 : + printf("%*cDomain Admins SID\n",-level,marker); + break; + case 513 : + printf("%*cDomain Users SID\n",-level,marker); + break; + case 514 : + printf("%*cDomain Guests SID\n",-level,marker); + break; + default : + printf("%*cLocal user-%lu SID\n",-level,marker,last); + break; } } break; } } + } if (!known) printf("%*cUnknown SID\n",-level,marker); - printf("%*c%shex S-%d-",-level,marker,prefix,attr[off] & 255); + printf("%*c%shex S-%x-",-level,marker,prefix,attr[off] & 255); printf("%llx",(long long)auth); for (i=0; i #endif -#ifdef HAVE_SYS_MKDEV_H +#ifdef MAJOR_IN_MKDEV #include #endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #if defined(__APPLE__) || defined(__DARWIN__) #include @@ -87,6 +90,10 @@ #include #endif +#ifndef FUSE_CAP_POSIX_ACL /* until defined in */ +#define FUSE_CAP_POSIX_ACL (1 << 18) +#endif /* FUSE_CAP_POSIX_ACL */ + #include "compat.h" #include "bitmap.h" #include "attrib.h" @@ -137,13 +144,18 @@ * FUSE cacheing is only usable with basic permissions * checked by the kernel with external fuse >= 2.8 */ -#if KERNELACLS | !KERNELPERMS +#if !KERNELPERMS #warning "Fuse cacheing is only usable with basic permissions checked by kernel" #endif -#define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0) -#define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0) +#if KERNELACLS +#define ATTR_TIMEOUT 10.0 +#define ENTRY_TIMEOUT 10.0 +#else /* KERNELACLS */ +#define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0) +#define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 10.0 : 0.0) +#endif /* KERNELACLS */ #endif /* defined(__sun) && defined (__SVR4) */ -#endif +#endif /* !CACHEING */ #define GHOSTLTH 40 /* max length of a ghost file name - see ghostformat */ /* sometimes the kernel cannot check access */ @@ -204,9 +216,9 @@ fuse_ino_t ino; fuse_ino_t parent; int state; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS struct fuse_file_info fi; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ } ; enum { @@ -545,6 +557,10 @@ /* request umask not to be enforced by fuse */ conn->want |= FUSE_CAP_DONT_MASK; #endif /* defined FUSE_CAP_DONT_MASK */ +#if POSIXACLS & KERNELACLS + /* request ACLs to be checked by kernel */ + conn->want |= FUSE_CAP_POSIX_ACL; +#endif /* POSIXACLS & KERNELACLS */ #ifdef FUSE_CAP_BIG_WRITES if (ctx->big_writes && ((ctx->vol->nr_clusters << ctx->vol->cluster_size_bits) @@ -556,7 +572,7 @@ #endif /* defined(FUSE_CAP_IOCTL_DIR) */ } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS /* * Define attributes for a junction or symlink @@ -568,22 +584,20 @@ struct stat *stbuf) { char *target; - int attr_size; int res; errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + target = ntfs_make_symlink(ni, ctx->abs_mnt_point); /* * If the reparse point is not a valid * directory junction, and there is no error * we still display as a symlink */ if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ if (target) - stbuf->st_size = attr_size; + stbuf->st_size = strlen(target); else - stbuf->st_size = sizeof(ntfs_bad_reparse); + stbuf->st_size = sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_mode = S_IFLNK; free(target); @@ -615,7 +629,7 @@ } } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, ntfs_inode *ni, struct stat *stbuf) @@ -630,7 +644,7 @@ if ((ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) || (ni->flags & FILE_ATTR_REPARSE_POINT)) { if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -639,32 +653,29 @@ apply_umask(stbuf); } else { stbuf->st_size = - sizeof(ntfs_bad_reparse); + sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_mode = S_IFLNK; res = 0; } goto ok; -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ char *target; - int attr_size; errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, - &attr_size); + target = ntfs_make_symlink(ni, ctx->abs_mnt_point); /* * If the reparse point is not a valid * directory junction, and there is no error * we still display as a symlink */ if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ if (target) - stbuf->st_size = attr_size; + stbuf->st_size = strlen(target); else stbuf->st_size = - sizeof(ntfs_bad_reparse); + sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_nlink = @@ -675,7 +686,7 @@ res = -errno; goto exit; } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ } else { /* Directory. */ stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); @@ -771,17 +782,38 @@ le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_SYMBOLIC_LINK) + if (intx_file->magic == INTX_SYMBOLIC_LINK) { + char *target = NULL; + int len; + + /* st_size should be set to length of + * symlink target as multibyte string */ + len = ntfs_ucstombs( + intx_file->target, + (na->data_size - + offsetof(INTX_FILE, + target)) / + sizeof(ntfschar), + &target, 0); + if (len < 0) { + res = -errno; + free(intx_file); + ntfs_attr_close(na); + goto exit; + } + free(target); stbuf->st_mode = S_IFLNK; + stbuf->st_size = len; + } free(intx_file); } ntfs_attr_close(na); } stbuf->st_mode |= (0777 & ~ctx->fmask); } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS ok: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if (withusermapping) { if (ntfs_get_owner_mode(scx,ni,stbuf) < 0) set_fuse_error(&res); @@ -924,7 +956,7 @@ fuse_reply_entry(req, &entry); } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS /* * Get the link defined by a junction or symlink @@ -935,12 +967,11 @@ const REPARSE_POINT *reparse __attribute__((unused)), char **pbuf) { - int attr_size; int res; errno = 0; res = 0; - *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point); if (!*pbuf) { if (errno == EOPNOTSUPP) { *pbuf = strdup(ntfs_bad_reparse); @@ -952,7 +983,7 @@ return (res); } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino) { @@ -972,7 +1003,7 @@ * Reparse point : analyze as a junction point */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -982,19 +1013,17 @@ if (!buf) res = -errno; } -#else /* PLUGINS_DISABLED */ - int attr_size; - +#else /* DISABLE_PLUGINS */ errno = 0; res = 0; - buf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + buf = ntfs_make_symlink(ni, ctx->abs_mnt_point); if (!buf) { if (errno == EOPNOTSUPP) buf = strdup(ntfs_bad_reparse); if (!buf) res = -errno; } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } /* Sanity checks. */ @@ -1382,7 +1411,7 @@ } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1391,9 +1420,9 @@ if (!res && fi->fh) { state = CLOSE_REPARSE; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto close; } if ((res >= 0) @@ -1471,7 +1500,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; struct open_file *of; @@ -1481,9 +1510,9 @@ if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -1522,9 +1551,9 @@ } ok: res = total; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps : -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ ntfs_fuse_update_times(ni, NTFS_UPDATE_ATIME); exit: if (na) @@ -1552,7 +1581,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; struct open_file *of; @@ -1563,9 +1592,9 @@ if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -1584,9 +1613,9 @@ total += ret; } res = total; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps : -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if ((res > 0) && (!ctx->dmtime || (sle64_to_cpu(ntfs_current_time()) @@ -1766,7 +1795,7 @@ } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1775,9 +1804,9 @@ set_archive(ni); goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } /* @@ -1796,9 +1825,9 @@ if (oldsize != size) set_archive(ni); -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps : -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ ntfs_fuse_update_times(ni, NTFS_UPDATE_MCTIME); res = ntfs_fuse_getstat(scx, ni, stbuf); errno = (res ? -res : 0); @@ -2352,6 +2381,11 @@ res = -errno; goto exit; } + /* Deny creating into $Extend */ + if (parent == FILE_Extend) { + res = -EPERM; + goto exit; + } /* Open parent directory. */ dir_ni = ntfs_inode_open(ctx->vol, INODE(parent)); if (!dir_ni) { @@ -2643,6 +2677,11 @@ struct SECURITY_CONTEXT security; #endif + /* Deny removing from $Extend */ + if (parent == FILE_Extend) { + res = -EPERM; + goto exit; + } /* Open parent directory. */ dir_ni = ntfs_inode_open(ctx->vol, INODE(parent)); if (!dir_ni) { @@ -2993,7 +3032,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -3001,10 +3040,10 @@ if (!res) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ /* Assume release() was not needed */ res = 0; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); @@ -3019,9 +3058,9 @@ if (of->state & CLOSE_ENCRYPTED) res = ntfs_efs_fixup_attribute(NULL, na); #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps : -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if (of->state & CLOSE_DMTIME) ntfs_inode_update_times(ni,NTFS_UPDATE_MCTIME); exit: @@ -4018,7 +4057,7 @@ #endif #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS static void register_internal_reparse_plugins(void) { static const plugin_operations_t ops = { @@ -4030,7 +4069,7 @@ register_reparse_plugin(ctx, IO_REPARSE_TAG_SYMLINK, &ops, (void*)NULL); } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static void ntfs_close(void) { @@ -4057,7 +4096,7 @@ / ctx->seccache->head.p_reads % 10); } } - ntfs_close_secure(&security); + ntfs_destroy_security_context(&security); } if (ntfs_umount(ctx->vol, FALSE)) @@ -4147,7 +4186,8 @@ if (ctx->ro) flags |= NTFS_MNT_RDONLY; else - flags |= NTFS_MNT_MAY_RDONLY; + if (!ctx->hiberfile) + flags |= NTFS_MNT_MAY_RDONLY; if (ctx->recover) flags |= NTFS_MNT_RECOVER; if (ctx->hiberfile) @@ -4565,10 +4605,6 @@ #ifdef HAVE_SETXATTR /* extended attributes interface required */ ctx->vol->efs_raw = ctx->efs_raw; #endif /* HAVE_SETXATTR */ - /* JPA open $Secure, (whatever NTFS version !) */ - /* to initialize security data */ - if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3)) - failed_secure = "Could not open file $Secure"; if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path, (ctx->vol->secure_flags & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL))) @@ -4643,9 +4679,9 @@ free(ctx->xattrmap_path); #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS register_internal_reparse_plugins(); -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ se = mount_fuse(parsed_options); if (!se) { @@ -4682,9 +4718,9 @@ #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ err2: ntfs_close(); -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS close_reparse_plugins(ctx); -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ free(ctx); free(parsed_options); free(opts.options); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/Makefile.am ntfs-3g-2016.2.22AR.2/src/Makefile.am --- ntfs-3g-2016.2.22AR.1+dfsg/src/Makefile.am 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/Makefile.am 2016-10-01 06:42:00.000000000 +0000 @@ -23,7 +23,7 @@ rootsbin_DATA = #Create directory man_MANS = ntfs-3g.8 ntfs-3g.probe.8 -ntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +ntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la if REALLYSTATIC ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static endif @@ -35,7 +35,7 @@ $(PLUGIN_CFLAGS) ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c -lowntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +lowntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la if REALLYSTATIC lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static endif diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/Makefile.in ntfs-3g-2016.2.22AR.2/src/Makefile.in --- ntfs-3g-2016.2.22AR.1+dfsg/src/Makefile.in 2016-04-01 06:38:04.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/Makefile.in 2016-10-01 06:42:16.000000000 +0000 @@ -109,7 +109,8 @@ am__DEPENDENCIES_1 = @FUSE_INTERNAL_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) @FUSE_INTERNAL_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/libfuse-lite/libfuse-lite.la -@ENABLE_NTFS_3G_TRUE@lowntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +@ENABLE_NTFS_3G_TRUE@lowntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@ENABLE_NTFS_3G_TRUE@ $(am__DEPENDENCIES_2) \ @ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -122,7 +123,8 @@ @ENABLE_NTFS_3G_TRUE@am_ntfs_3g_OBJECTS = ntfs_3g-ntfs-3g.$(OBJEXT) \ @ENABLE_NTFS_3G_TRUE@ ntfs_3g-ntfs-3g_common.$(OBJEXT) ntfs_3g_OBJECTS = $(am_ntfs_3g_OBJECTS) -@ENABLE_NTFS_3G_TRUE@ntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +@ENABLE_NTFS_3G_TRUE@ntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@ENABLE_NTFS_3G_TRUE@ $(am__DEPENDENCIES_2) \ @ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la ntfs_3g_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfs_3g_CFLAGS) \ @@ -268,6 +270,7 @@ LD = @LD@ LDCONFIG = @LDCONFIG@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@ LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ @@ -388,7 +391,7 @@ @DISABLE_PLUGINS_FALSE@PLUGIN_CFLAGS = -DPLUGIN_DIR=\"$(plugindir)\" @ENABLE_NTFS_3G_TRUE@rootsbin_DATA = #Create directory @ENABLE_NTFS_3G_TRUE@man_MANS = ntfs-3g.8 ntfs-3g.probe.8 -@ENABLE_NTFS_3G_TRUE@ntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +@ENABLE_NTFS_3G_TRUE@ntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la @ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static @ENABLE_NTFS_3G_TRUE@ntfs_3g_CFLAGS = \ @ENABLE_NTFS_3G_TRUE@ $(AM_CFLAGS) \ @@ -398,7 +401,7 @@ @ENABLE_NTFS_3G_TRUE@ $(PLUGIN_CFLAGS) @ENABLE_NTFS_3G_TRUE@ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c -@ENABLE_NTFS_3G_TRUE@lowntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la +@ENABLE_NTFS_3G_TRUE@lowntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la @ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static @ENABLE_NTFS_3G_TRUE@lowntfs_3g_CFLAGS = \ @ENABLE_NTFS_3G_TRUE@ $(AM_CFLAGS) \ diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g.8.in ntfs-3g-2016.2.22AR.2/src/ntfs-3g.8.in --- ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g.8.in 2016-04-01 06:37:46.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/ntfs-3g.8.in 2016-10-01 06:42:00.000000000 +0000 @@ -185,8 +185,8 @@ directory listings. .TP .B remove_hiberfile -Unlike in case of read-only mount, the read-write mount is denied if -the NTFS volume is hibernated. One needs either to resume Windows and +When the NTFS volume is hibernated, a read-write mount is denied and +a read-only mount is forced. One needs either to resume Windows and shutdown it properly, or use this option which will remove the Windows hibernation file. Please note, this means that the saved Windows session will be completely lost. Use this option under your own diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g.c ntfs-3g-2016.2.22AR.2/src/ntfs-3g.c --- ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/ntfs-3g.c 2016-10-01 06:42:00.000000000 +0000 @@ -72,9 +72,12 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_MKDEV_H +#ifdef MAJOR_IN_MKDEV #include #endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #if defined(__APPLE__) || defined(__DARWIN__) #include @@ -82,6 +85,10 @@ #include #endif /* defined(__APPLE__) || defined(__DARWIN__), ... */ +#ifndef FUSE_CAP_POSIX_ACL /* until defined in */ +#define FUSE_CAP_POSIX_ACL (1 << 18) +#endif /* FUSE_CAP_POSIX_ACL */ + #include "compat.h" #include "attrib.h" #include "inode.h" @@ -329,6 +336,7 @@ allowed = 1; else #endif + { if (dir_ni) allowed = ntfs_real_allowed_access(scx, dir_ni, accesstype); @@ -371,6 +379,7 @@ ntfs_inode_close(ni2); } } + } return (allowed); } @@ -669,6 +678,10 @@ /* request umask not to be enforced by fuse */ conn->want |= FUSE_CAP_DONT_MASK; #endif /* defined FUSE_CAP_DONT_MASK */ +#if POSIXACLS & KERNELACLS + /* request ACLs to be checked by kernel */ + conn->want |= FUSE_CAP_POSIX_ACL; +#endif /* POSIXACLS & KERNELACLS */ #ifdef FUSE_CAP_BIG_WRITES if (ctx->big_writes && ((ctx->vol->nr_clusters << ctx->vol->cluster_size_bits) @@ -681,7 +694,7 @@ return NULL; } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS /* * Define attributes for a junction or symlink @@ -693,22 +706,20 @@ struct stat *stbuf) { char *target; - int attr_size; int res; errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + target = ntfs_make_symlink(ni, ctx->abs_mnt_point); /* * If the reparse point is not a valid * directory junction, and there is no error * we still display as a symlink */ if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ if (target) - stbuf->st_size = attr_size; + stbuf->st_size = strlen(target); else - stbuf->st_size = sizeof(ntfs_bad_reparse); + stbuf->st_size = sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_mode = S_IFLNK; free(target); @@ -740,7 +751,7 @@ } } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) { @@ -781,7 +792,7 @@ || (ni->flags & FILE_ATTR_REPARSE_POINT)) && !stream_name_len) { if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -791,7 +802,7 @@ goto ok; } else { stbuf->st_size = - sizeof(ntfs_bad_reparse); + sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_mode = S_IFLNK; @@ -799,23 +810,21 @@ goto ok; } goto exit; -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ char *target; - int attr_size; errno = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + target = ntfs_make_symlink(ni, ctx->abs_mnt_point); /* * If the reparse point is not a valid * directory junction, and there is no error * we still display as a symlink */ if (target || (errno == EOPNOTSUPP)) { - /* returning attribute size */ if (target) - stbuf->st_size = attr_size; + stbuf->st_size = strlen(target); else - stbuf->st_size = sizeof(ntfs_bad_reparse); + stbuf->st_size = sizeof(ntfs_bad_reparse) - 1; stbuf->st_blocks = (ni->allocated_size + 511) >> 9; stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); stbuf->st_mode = S_IFLNK; @@ -824,7 +833,7 @@ res = -errno; goto exit; } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ } else { /* Directory. */ stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); @@ -937,17 +946,38 @@ le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_SYMBOLIC_LINK) + if (intx_file->magic == INTX_SYMBOLIC_LINK) { + char *target = NULL; + int len; + + /* st_size should be set to length of + * symlink target as multibyte string */ + len = ntfs_ucstombs( + intx_file->target, + (na->data_size - + offsetof(INTX_FILE, + target)) / + sizeof(ntfschar), + &target, 0); + if (len < 0) { + res = -errno; + free(intx_file); + ntfs_attr_close(na); + goto exit; + } + free(target); stbuf->st_mode = S_IFLNK; + stbuf->st_size = len; + } free(intx_file); } ntfs_attr_close(na); } stbuf->st_mode |= (0777 & ~ctx->fmask); } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS ok: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if (withusermapping) { if (ntfs_get_owner_mode(&security,ni,stbuf) < 0) set_fuse_error(&res); @@ -1003,7 +1033,7 @@ return res; } -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS /* * Get the link defined by a junction or symlink @@ -1014,12 +1044,11 @@ const REPARSE_POINT *reparse __attribute__((unused)), char **pbuf) { - int attr_size; int res; errno = 0; res = 0; - *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point); if (!*pbuf) { if (errno == EOPNOTSUPP) { *pbuf = strdup(ntfs_bad_reparse); @@ -1031,7 +1060,7 @@ return (res); } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) { @@ -1059,7 +1088,7 @@ * Reparse point : analyze as a junction point */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS char *gotlink; const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1073,13 +1102,12 @@ strncpy(buf, ntfs_bad_reparse, buf_size); res = 0; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ char *target; - int attr_size; errno = 0; res = 0; - target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size); + target = ntfs_make_symlink(ni, ctx->abs_mnt_point); if (target) { strncpy(buf,target,buf_size); free(target); @@ -1088,7 +1116,7 @@ strcpy(buf,ntfs_bad_reparse); else res = -errno; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } /* Sanity checks. */ @@ -1355,15 +1383,15 @@ } #endif if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; fi->fh = 0; res = CALL_REPARSE_PLUGIN(ni, open, fi); -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto close; } if ((res >= 0) @@ -1420,7 +1448,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1432,9 +1460,9 @@ if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1473,9 +1501,9 @@ } ok: res = total; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ ntfs_fuse_update_times(ni, NTFS_UPDATE_ATIME); exit: if (na) @@ -1508,7 +1536,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1520,9 +1548,9 @@ if (res >= 0) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1541,9 +1569,9 @@ total += ret; } res = total; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if ((res > 0) && (!ctx->dmtime || (sle64_to_cpu(ntfs_current_time()) @@ -1594,7 +1622,7 @@ goto exit; } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1606,10 +1634,10 @@ if (!res) { goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ /* Assume release() was not needed */ res = 0; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1624,9 +1652,9 @@ if (fi->fh & CLOSE_ENCRYPTED) res = ntfs_efs_fixup_attribute(NULL, na); #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ if (fi->fh & CLOSE_DMTIME) ntfs_inode_update_times(ni,NTFS_UPDATE_MCTIME); exit: @@ -1676,7 +1704,7 @@ } if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS const plugin_operations_t *ops; REPARSE_POINT *reparse; @@ -1689,9 +1717,9 @@ set_archive(ni); goto stamps; } -#else /* PLUGINS_DISABLED */ +#else /* DISABLE_PLUGINS */ res = -EOPNOTSUPP; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -1727,9 +1755,9 @@ if (oldsize != size) set_archive(ni); -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS stamps: -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ ntfs_fuse_update_times(ni, NTFS_UPDATE_MCTIME); errno = 0; exit: @@ -1940,9 +1968,12 @@ /* Open parent directory. */ *--name = 0; dir_ni = ntfs_pathname_to_inode(ctx->vol, NULL, dir_path); - if (!dir_ni) { + /* Deny creating files in $Extend */ + if (!dir_ni || (dir_ni->mft_no == FILE_Extend)) { free(path); res = -errno; + if (dir_ni->mft_no == FILE_Extend) + res = -EPERM; goto exit; } #if !KERNELPERMS | (POSIXACLS & !KERNELACLS) @@ -2285,8 +2316,11 @@ /* Open parent directory. */ *--name = 0; dir_ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); - if (!dir_ni) { + /* deny unlinking metadata files from $Extend */ + if (!dir_ni || (dir_ni->mft_no == FILE_Extend)) { res = -errno; + if (dir_ni->mft_no == FILE_Extend) + res = -EPERM; goto exit; } @@ -3609,7 +3643,7 @@ #endif #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS static void register_internal_reparse_plugins(void) { static const plugin_operations_t ops = { @@ -3621,7 +3655,7 @@ register_reparse_plugin(ctx, IO_REPARSE_TAG_SYMLINK, &ops, (void*)NULL); } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ static void ntfs_close(void) { @@ -3648,7 +3682,7 @@ / ctx->seccache->head.p_reads % 10); } } - ntfs_close_secure(&security); + ntfs_destroy_security_context(&security); } if (ntfs_umount(ctx->vol, FALSE)) @@ -3745,7 +3779,8 @@ if (ctx->ro) flags |= NTFS_MNT_RDONLY; else - flags |= NTFS_MNT_MAY_RDONLY; + if (!ctx->hiberfile) + flags |= NTFS_MNT_MAY_RDONLY; if (ctx->recover) flags |= NTFS_MNT_RECOVER; if (ctx->hiberfile) @@ -4164,10 +4199,6 @@ #ifdef HAVE_SETXATTR /* extended attributes interface required */ ctx->vol->efs_raw = ctx->efs_raw; #endif /* HAVE_SETXATTR */ - /* JPA open $Secure, (whatever NTFS version !) */ - /* to initialize security data */ - if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3)) - failed_secure = "Could not open file $Secure"; if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path, (ctx->vol->secure_flags & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL))) @@ -4241,9 +4272,9 @@ free(ctx->xattrmap_path); #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS register_internal_reparse_plugins(); -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ fh = mount_fuse(parsed_options); if (!fh) { @@ -4282,9 +4313,9 @@ #endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */ err2: ntfs_close(); -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS close_reparse_plugins(ctx); -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ free(ctx); free(parsed_options); free(opts.options); diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g_common.c ntfs-3g-2016.2.22AR.2/src/ntfs-3g_common.c --- ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g_common.c 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/ntfs-3g_common.c 2016-10-01 06:42:00.000000000 +0000 @@ -47,6 +47,7 @@ #include #include +#include "compat.h" #include "inode.h" #include "dir.h" #include "security.h" @@ -758,7 +759,7 @@ #endif /* HAVE_SETXATTR */ -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS int register_reparse_plugin(ntfs_fuse_context_t *ctx, le32 tag, const plugin_operations_t *ops, void *handle) @@ -834,10 +835,12 @@ if (!ops) dlclose(handle); } else { - if (!(ctx->errors_logged & ERR_PLUGIN)) + if (!(ctx->errors_logged & ERR_PLUGIN)) { ntfs_log_perror( "Could not load plugin %s", name); + ntfs_log_error("Hint %s\n",dlerror()); + } ctx->errors_logged |= ERR_PLUGIN; } } @@ -862,7 +865,7 @@ } } -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ #ifdef HAVE_SETXATTR @@ -874,7 +877,8 @@ * does not harm Windows). */ -BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni) +BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx __attribute__((unused)), + ntfs_inode *ni) { u32 dt_type; BOOL res; @@ -886,7 +890,7 @@ else { /* Reparse point depends on kind, see plugin */ if (ni->flags & FILE_ATTR_REPARSE_POINT) { -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS struct stat stbuf; REPARSE_POINT *reparse; const plugin_operations_t *ops; @@ -900,10 +904,10 @@ || S_ISDIR(stbuf.st_mode); } free(reparse); -#else /* PLUGINS_DISABLED */ - res = FALSE; /* mountpoints, symlinks, ... */ -#endif /* PLUGINS_DISABLED */ } +#else /* DISABLE_PLUGINS */ + res = FALSE; /* mountpoints, symlinks, ... */ +#endif /* DISABLE_PLUGINS */ } else { /* Metadata */ if (ni->mft_no < FILE_first_user) diff -Nru ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g_common.h ntfs-3g-2016.2.22AR.2/src/ntfs-3g_common.h --- ntfs-3g-2016.2.22AR.1+dfsg/src/ntfs-3g_common.h 2016-04-01 06:37:45.000000000 +0000 +++ ntfs-3g-2016.2.22AR.2/src/ntfs-3g_common.h 2016-10-01 06:42:00.000000000 +0000 @@ -114,7 +114,7 @@ ERR_PLUGIN = 1 } single_log_t; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS typedef struct plugin_list { struct plugin_list *next; @@ -123,7 +123,7 @@ le32 tag; } plugin_list_t; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ typedef struct { ntfs_volume *vol; @@ -163,9 +163,9 @@ single_log_t errors_logged; char *usermap_path; char *abs_mnt_point; -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS plugin_list_t *plugins; -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ struct PERMISSIONS_CACHE *seccache; struct SECURITY_CONTEXT security; struct open_file *open_files; /* only defined in lowntfs-3g */ @@ -200,16 +200,16 @@ int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx, char *list, size_t size, BOOL prefixing); +BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni); -#ifndef PLUGINS_DISABLED +#ifndef DISABLE_PLUGINS void close_reparse_plugins(ntfs_fuse_context_t *ctx); const struct plugin_operations *select_reparse_plugin(ntfs_fuse_context_t *ctx, ntfs_inode *ni, REPARSE_POINT **reparse); int register_reparse_plugin(ntfs_fuse_context_t *ctx, le32 tag, const plugin_operations_t *ops, void *handle); -BOOL user_xattrs_allowed(ntfs_fuse_context_t *ctx, ntfs_inode *ni); -#endif /* PLUGINS_DISABLED */ +#endif /* DISABLE_PLUGINS */ #endif /* _NTFS_3G_COMMON_H */